Version 0.2.2.0
svn merge -r 14147:14417 https://dart.googlecode.com/svn/branches/bleeding_edge trunk
+ cherry picks: 14424, 14431, 14435, 14436
git-svn-id: http://dart.googlecode.com/svn/trunk@14438 260f80e4-7a28-3924-810f-c04153c831b5
diff --git a/compiler/java/com/google/dart/compiler/DartCompiler.java b/compiler/java/com/google/dart/compiler/DartCompiler.java
index e82153e..1d0eb285 100644
--- a/compiler/java/com/google/dart/compiler/DartCompiler.java
+++ b/compiler/java/com/google/dart/compiler/DartCompiler.java
@@ -4,6 +4,7 @@
package com.google.dart.compiler;
+import com.google.common.base.Objects;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
@@ -711,36 +712,50 @@
// check that all sourced units have no directives
for (DartUnit unit : lib.getUnits()) {
+ // don't need to check a unit that hasn't changed
if (unit.isDiet()) {
- // don't need to check a unit that hasn't changed
continue;
}
- if (invalidDirectivesForPart(unit.getDirectives())) {
- // find corresponding source node for this unit
- for (LibraryNode sourceNode : lib.getSourcePaths()) {
- if (sourceNode == lib.getSelfSourcePath()) {
- // skip the special synthetic selfSourcePath node
- continue;
- }
- DartSource dartSource = (DartSource) unit.getSourceInfo().getSource();
- // check for directives
- if (dartSource.getRelativePath().equals(sourceNode.getText())) {
- context.onError(new DartCompilationError(unit.getDirectives().get(0),
- DartCompilerErrorCode.ILLEGAL_DIRECTIVES_IN_SOURCED_UNIT,
- Elements.getRelativeSourcePath(dartSource, lib.getSource())));
- }
+ // ignore library unit
+ DartSource unitSource = (DartSource) unit.getSourceInfo().getSource();
+ if (isLibrarySelfUnit(lib, unitSource)) {
+ continue;
+ }
+ // analyze directives
+ List<DartDirective> directives = unit.getDirectives();
+ if (directives.isEmpty()) {
+ // TODO(scheglov) Remove after http://code.google.com/p/dart/issues/detail?id=6121
+ if (!StringUtils.startsWith(lib.getName(), "dart:")) {
+ context.onError(new DartCompilationError(unitSource,
+ DartCompilerErrorCode.MISSING_PART_OF_DIRECTIVE, lib.getName()));
}
+ } else if (directives.size() == 1 && directives.get(0) instanceof DartPartOfDirective) {
+ DartPartOfDirective directive = (DartPartOfDirective) directives.get(0);
+ String dirName = directive.getLibraryName();
+ if (!Objects.equal(dirName, lib.getName())) {
+ context.onError(new DartCompilationError(directive,
+ DartCompilerErrorCode.WRONG_PART_OF_NAME, lib.getName(), dirName));
+ }
+ } else {
+ context.onError(new DartCompilationError(directives.get(0),
+ DartCompilerErrorCode.ILLEGAL_DIRECTIVES_IN_SOURCED_UNIT,
+ Elements.getRelativeSourcePath(unitSource, lib.getSource())));
}
}
}
}
- private boolean invalidDirectivesForPart(List<DartDirective> directives) {
- int size = directives.size();
- if (size == 1) {
- return !(directives.get(0) instanceof DartPartOfDirective);
+ private static boolean isLibrarySelfUnit(LibraryUnit lib, DartSource unitSource) {
+ String unitRelativePath = unitSource.getRelativePath();
+ for (LibraryNode sourceNode : lib.getSourcePaths()) {
+ if (unitRelativePath.equals(sourceNode.getText())) {
+ if (sourceNode == lib.getSelfSourcePath()) {
+ return true;
+ }
+ return false;
+ }
}
- return size > 0;
+ return false;
}
private void setEntryPoint() {
diff --git a/compiler/java/com/google/dart/compiler/DartCompilerErrorCode.java b/compiler/java/com/google/dart/compiler/DartCompilerErrorCode.java
index 0744833..251b871 100644
--- a/compiler/java/com/google/dart/compiler/DartCompilerErrorCode.java
+++ b/compiler/java/com/google/dart/compiler/DartCompilerErrorCode.java
@@ -17,12 +17,16 @@
ENTRY_POINT_METHOD_MAY_NOT_BE_SETTER(ErrorSeverity.WARNING,
"Entry point \"%s\" may not be a setter"),
ILLEGAL_DIRECTIVES_IN_SOURCED_UNIT("This part was included by %s via a "
- + "part directive, so cannot itself contain directives other than a part of directive"),
+ + "part directive, so cannot itself contain directives other than a 'part of' directive"),
IO("Input/Output error: %s"),
MIRRORS_NOT_FULLY_IMPLEMENTED(ErrorSeverity.WARNING, "dart:mirrors is not fully implemented yet"),
MISSING_LIBRARY_DIRECTIVE("a library which is imported is missing a library directive: %s"),
MISSING_SOURCE("Cannot find referenced source: %s"),
- UNIT_WAS_ALREADY_INCLUDED("Unit '%s' was already included");
+ MISSING_PART_OF_DIRECTIVE("Unit is part of library '%s', but has no 'part of' directive"),
+ UNIT_WAS_ALREADY_INCLUDED("Unit '%s' was already included"),
+ WRONG_PART_OF_NAME(
+ ErrorSeverity.WARNING,
+ "This part was included by '%s' via a 'part' directive, but uses name '%s' in 'part of' directive");
private final ErrorSeverity severity;
private final String message;
diff --git a/compiler/java/com/google/dart/compiler/DeltaAnalyzer.java b/compiler/java/com/google/dart/compiler/DeltaAnalyzer.java
index e7c2ec5..2829cd9 100644
--- a/compiler/java/com/google/dart/compiler/DeltaAnalyzer.java
+++ b/compiler/java/com/google/dart/compiler/DeltaAnalyzer.java
@@ -16,6 +16,7 @@
import com.google.dart.compiler.resolver.CoreTypeProvider;
import com.google.dart.compiler.resolver.CoreTypeProviderImplementation;
import com.google.dart.compiler.resolver.Element;
+import com.google.dart.compiler.resolver.ElementKind;
import com.google.dart.compiler.resolver.LibraryElement;
import com.google.dart.compiler.resolver.MemberBuilder;
import com.google.dart.compiler.resolver.Resolver;
@@ -95,7 +96,11 @@
Scope scope = libraryUnit.getElement().getScope();
for (Element member : enclosingLibrary.getMembers()) {
if (member.getSourceInfo().getSource() != originalSource) {
- scope.declareElement(member.getName(), member);
+ String name = member.getName();
+ if (ElementKind.of(member) == ElementKind.LIBRARY) {
+ name = "__library_" + ((LibraryElement) member).getLibraryUnit().getName();
+ }
+ scope.declareElement(name, member);
}
}
return scope;
diff --git a/compiler/java/com/google/dart/compiler/ast/DartBlock.java b/compiler/java/com/google/dart/compiler/ast/DartBlock.java
index e19edc0..27d0d058 100644
--- a/compiler/java/com/google/dart/compiler/ast/DartBlock.java
+++ b/compiler/java/com/google/dart/compiler/ast/DartBlock.java
@@ -14,7 +14,9 @@
private final NodeList<DartStatement> statements = NodeList.create(this);
public DartBlock(List<DartStatement> statements) {
- this.statements.addAll(statements);
+ if (statements != null && !statements.isEmpty()) {
+ this.statements.addAll(statements);
+ }
}
public List<DartStatement> getStatements() {
diff --git a/compiler/java/com/google/dart/compiler/ast/DartClass.java b/compiler/java/com/google/dart/compiler/ast/DartClass.java
index 5fb737b..f5c20b5 100644
--- a/compiler/java/com/google/dart/compiler/ast/DartClass.java
+++ b/compiler/java/com/google/dart/compiler/ast/DartClass.java
@@ -30,49 +30,48 @@
// points to the JS class. Otherwise it is null.
private final DartStringLiteral nativeName;
+ private final int tokenOffset;
+ private final int tokenLength;
+ private final int defaultTokenOffset;
+ private final int implementsOffset;
private final int openBraceOffset;
private final int closeBraceOffset;
- public DartClass(DartIdentifier name, DartStringLiteral nativeName, DartTypeNode superclass,
- List<DartTypeNode> interfaces, int openBraceOffset, int closeBraceOffset,
- List<DartNode> members, List<DartTypeParameter> typeParameters, Modifiers modifiers) {
- this(name, nativeName, superclass, interfaces, openBraceOffset, closeBraceOffset, members,
- typeParameters, null, false, modifiers);
+ public DartClass(int tokenOffset, int tokenLength, DartIdentifier name,
+ DartStringLiteral nativeName, DartTypeNode superclass, int implementsOffset,
+ List<DartTypeNode> interfaces, int defaultTokenOffset, int openBraceOffset,
+ int closeBraceOffset, List<DartNode> members, List<DartTypeParameter> typeParameters,
+ Modifiers modifiers) {
+ this(tokenOffset, tokenLength, name, nativeName, superclass, implementsOffset, interfaces,
+ defaultTokenOffset, openBraceOffset, closeBraceOffset, members, typeParameters, null,
+ false, modifiers);
}
- public DartClass(DartIdentifier name, DartTypeNode superclass, List<DartTypeNode> interfaces,
- int openBraceOffset, int closeBraceOffset,
- List<DartNode> members,
- List<DartTypeParameter> typeParameters,
- DartParameterizedTypeNode defaultClass) {
- this(name,
- null,
- superclass,
- interfaces,
- openBraceOffset,
- closeBraceOffset,
- members,
- typeParameters,
- defaultClass,
- true,
- Modifiers.NONE);
+ public DartClass(int tokenOffset, int tokenLength, DartIdentifier name, DartTypeNode superclass,
+ int implementsOffset, List<DartTypeNode> interfaces, int defaultTokenOffset,
+ int openBraceOffset, int closeBraceOffset, List<DartNode> members,
+ List<DartTypeParameter> typeParameters, DartParameterizedTypeNode defaultClass) {
+ this(tokenOffset, tokenLength, name, null, superclass, implementsOffset, interfaces,
+ defaultTokenOffset, openBraceOffset, closeBraceOffset, members, typeParameters,
+ defaultClass, true, Modifiers.NONE);
}
- public DartClass(DartIdentifier name, DartStringLiteral nativeName,
- DartTypeNode superclass, List<DartTypeNode> interfaces,
- int openBraceOffset, int closeBraceOffset,
- List<DartNode> members,
- List<DartTypeParameter> typeParameters,
- DartParameterizedTypeNode defaultClass,
- boolean isInterface,
- Modifiers modifiers) {
+ public DartClass(int tokenOffset, int tokenLength, DartIdentifier name,
+ DartStringLiteral nativeName, DartTypeNode superclass, int implementsOffset,
+ List<DartTypeNode> interfaces, int defaultTokenOffset, int openBraceOffset,
+ int closeBraceOffset, List<DartNode> members, List<DartTypeParameter> typeParameters,
+ DartParameterizedTypeNode defaultClass, boolean isInterface, Modifiers modifiers) {
super(name);
+ this.tokenOffset = tokenOffset;
+ this.tokenLength = tokenLength;
this.nativeName = becomeParentOf(nativeName);
this.superclass = becomeParentOf(superclass);
+ this.defaultTokenOffset = defaultTokenOffset;
this.openBraceOffset = openBraceOffset;
this.closeBraceOffset = closeBraceOffset;
this.members.addAll(members);
this.typeParameters.addAll(typeParameters);
+ this.implementsOffset = implementsOffset;
this.interfaces.addAll(interfaces);
this.defaultClass = becomeParentOf(defaultClass);
this.isInterface = isInterface;
@@ -109,6 +108,18 @@
}
return false;
}
+
+ public int getTokenOffset() {
+ return tokenOffset;
+ }
+
+ public int getTokenLength() {
+ return tokenLength;
+ }
+
+ public int getDefaultTokenOffset() {
+ return defaultTokenOffset;
+ }
public int getOpenBraceOffset() {
return openBraceOffset;
@@ -125,6 +136,10 @@
public List<DartTypeParameter> getTypeParameters() {
return typeParameters;
}
+
+ public int getImplementsOffset() {
+ return implementsOffset;
+ }
public List<DartTypeNode> getInterfaces() {
return interfaces;
diff --git a/compiler/java/com/google/dart/compiler/ast/DartFunction.java b/compiler/java/com/google/dart/compiler/ast/DartFunction.java
index 09e644a..a7693d3 100644
--- a/compiler/java/com/google/dart/compiler/ast/DartFunction.java
+++ b/compiler/java/com/google/dart/compiler/ast/DartFunction.java
@@ -23,7 +23,9 @@
DartTypeNode returnTypeNode) {
this.parametersOptionalOpen = parametersOptionalOpen;
this.parametersOptionalClose = parametersOptionalClose;
- this.parameters.addAll(parameters);
+ if (parameters != null && !parameters.isEmpty()) {
+ this.parameters.addAll(parameters);
+ }
this.parametersCloseParen = parametersCloseParen;
this.body = becomeParentOf(body);
this.returnTypeNode = becomeParentOf(returnTypeNode);
diff --git a/compiler/java/com/google/dart/compiler/ast/DartIdentifier.java b/compiler/java/com/google/dart/compiler/ast/DartIdentifier.java
index 3f131a7..09eadc2 100644
--- a/compiler/java/com/google/dart/compiler/ast/DartIdentifier.java
+++ b/compiler/java/com/google/dart/compiler/ast/DartIdentifier.java
@@ -31,6 +31,12 @@
}
@Override
+ // Note: final added for performance reasons.
+ public final String toString() {
+ return name;
+ }
+
+ @Override
public boolean isAssignable() {
return true;
}
@@ -60,7 +66,7 @@
}
@Override
- public void visitChildren(ASTVisitor<?> visitor) {
+ public final void visitChildren(ASTVisitor<?> visitor) {
}
@Override
diff --git a/compiler/java/com/google/dart/compiler/ast/DartInvocation.java b/compiler/java/com/google/dart/compiler/ast/DartInvocation.java
index 4d81c28..477c4c3 100644
--- a/compiler/java/com/google/dart/compiler/ast/DartInvocation.java
+++ b/compiler/java/com/google/dart/compiler/ast/DartInvocation.java
@@ -39,7 +39,9 @@
private NodeElement element;
public DartInvocation(List<DartExpression> arguments) {
- this.arguments.addAll(arguments);
+ if (arguments != null && !arguments.isEmpty()) {
+ this.arguments.addAll(arguments);
+ }
}
public DartExpression getTarget() {
diff --git a/compiler/java/com/google/dart/compiler/ast/DartNode.java b/compiler/java/com/google/dart/compiler/ast/DartNode.java
index 7368822..1c20781 100644
--- a/compiler/java/com/google/dart/compiler/ast/DartNode.java
+++ b/compiler/java/com/google/dart/compiler/ast/DartNode.java
@@ -41,7 +41,7 @@
}
@Override
- public final String toString() {
+ public String toString() {
return this.toSource();
}
@@ -117,7 +117,10 @@
* @param visitor the visitor that will be used to visit the child
*/
protected void safelyVisitChild(DartNode child, ASTVisitor<?> visitor) {
- if (child != null) {
+ // Inline the DartIdentifier path - it's by far the most common.
+ if (child instanceof DartIdentifier) {
+ visitor.visitIdentifier((DartIdentifier)child);
+ } else if (child != null) {
child.accept(visitor);
}
}
diff --git a/compiler/java/com/google/dart/compiler/ast/DartPartOfDirective.java b/compiler/java/com/google/dart/compiler/ast/DartPartOfDirective.java
index d9bdbe0..9d55581 100644
--- a/compiler/java/com/google/dart/compiler/ast/DartPartOfDirective.java
+++ b/compiler/java/com/google/dart/compiler/ast/DartPartOfDirective.java
@@ -8,12 +8,18 @@
* Implements the "part of" directive.
*/
public class DartPartOfDirective extends DartDirective {
- private DartExpression name;
+ private final int ofOffset;
+ private final DartExpression name;
- public DartPartOfDirective(DartExpression name) {
+ public DartPartOfDirective(int ofOffset, DartExpression name) {
+ this.ofOffset = ofOffset;
this.name = becomeParentOf(name);
}
+ public int getOfOffset() {
+ return ofOffset;
+ }
+
public DartExpression getName() {
return name;
}
diff --git a/compiler/java/com/google/dart/compiler/ast/DartSyntheticErrorIdentifier.java b/compiler/java/com/google/dart/compiler/ast/DartSyntheticErrorIdentifier.java
index 2e7e96c..55f780f 100644
--- a/compiler/java/com/google/dart/compiler/ast/DartSyntheticErrorIdentifier.java
+++ b/compiler/java/com/google/dart/compiler/ast/DartSyntheticErrorIdentifier.java
@@ -26,7 +26,4 @@
return tokenString;
}
- @Override
- public void visitChildren(ASTVisitor<?> visitor) {
- }
}
diff --git a/compiler/java/com/google/dart/compiler/ast/DartToSourceVisitor.java b/compiler/java/com/google/dart/compiler/ast/DartToSourceVisitor.java
index 2d4d80a..e913de9 100644
--- a/compiler/java/com/google/dart/compiler/ast/DartToSourceVisitor.java
+++ b/compiler/java/com/google/dart/compiler/ast/DartToSourceVisitor.java
@@ -255,7 +255,12 @@
p(")");
}
if (x.getDefaultExpr() != null) {
- p(" = ");
+ if (x.getModifiers().isOptional()) {
+ p(" = ");
+ }
+ if (x.getModifiers().isNamed()) {
+ p(" : ");
+ }
accept(x.getDefaultExpr());
}
return null;
@@ -280,7 +285,7 @@
p("set ");
}
// name
- pFunctionDeclaration(x.getName(), func);
+ pFunctionDeclaration(x.getName(), func, !x.getModifiers().isGetter());
p(" ");
// initializers
List<DartInitializer> inits = x.getInitializers();
@@ -338,31 +343,40 @@
}
}
- private void pFunctionDeclaration(DartNode name, DartFunction x) {
+ private void pFunctionDeclaration(DartNode name, DartFunction x, boolean includeParameters) {
if (name != null) {
accept(name);
}
- p("(");
- pFormalParameters(x.getParameters());
- p(")");
+ if (includeParameters) {
+ p("(");
+ pFormalParameters(x.getParameters());
+ p(")");
+ }
}
private void pFormalParameters(List<DartParameter> params) {
- boolean first = true, hasNamed = false;
+ boolean first = true, hasPositional = false, hasNamed = false;
for (DartParameter param : params) {
if (!first) {
p(", ");
}
+ if (!hasPositional && param.getModifiers().isOptional()) {
+ hasPositional = true;
+ p("[");
+ }
if (!hasNamed && param.getModifiers().isNamed()) {
hasNamed = true;
- p("[");
+ p("{");
}
accept(param);
first = false;
}
- if (hasNamed) {
+ if (hasPositional) {
p("]");
}
+ if (hasNamed) {
+ p("}");
+ }
}
@Override
@@ -793,7 +807,7 @@
p(" ");
}
DartIdentifier name = x.getName();
- pFunctionDeclaration(name, x.getFunction());
+ pFunctionDeclaration(name, x.getFunction(), true);
p(" ");
if (x.getFunction().getBody() != null) {
pBlock(x.getFunction().getBody(), false);
diff --git a/compiler/java/com/google/dart/compiler/ast/DartUnit.java b/compiler/java/com/google/dart/compiler/ast/DartUnit.java
index 15c2537..063455e 100644
--- a/compiler/java/com/google/dart/compiler/ast/DartUnit.java
+++ b/compiler/java/com/google/dart/compiler/ast/DartUnit.java
@@ -24,6 +24,8 @@
private final NodeList<DartComment> comments = NodeList.create(this);
private final DartSource source;
private final boolean isDiet;
+
+ private boolean hasParseErrors;
public DartUnit(DartSource source, boolean isDiet) {
this.source = source;
@@ -69,6 +71,14 @@
return isDiet;
}
+ public void setHasParseErrors(boolean hasParseErrors) {
+ this.hasParseErrors = hasParseErrors;
+ }
+
+ public boolean hasParseErrors() {
+ return hasParseErrors;
+ }
+
/**
* Answer the receiver's directives, not <code>null</code>.
*/
diff --git a/compiler/java/com/google/dart/compiler/ast/NodeList.java b/compiler/java/com/google/dart/compiler/ast/NodeList.java
index 2394de6..8eda6ba 100644
--- a/compiler/java/com/google/dart/compiler/ast/NodeList.java
+++ b/compiler/java/com/google/dart/compiler/ast/NodeList.java
@@ -48,8 +48,8 @@
*/
public void accept(ASTVisitor<?> visitor) {
if (elements != null) {
- for (E element : elements) {
- element.accept(visitor);
+ for (int i = 0, size = elements.size(); i < size; i++) {
+ elements.get(i).accept(visitor);
}
}
}
diff --git a/compiler/java/com/google/dart/compiler/parser/AbstractParser.java b/compiler/java/com/google/dart/compiler/parser/AbstractParser.java
index 273313b..6295eb1 100644
--- a/compiler/java/com/google/dart/compiler/parser/AbstractParser.java
+++ b/compiler/java/com/google/dart/compiler/parser/AbstractParser.java
@@ -38,6 +38,7 @@
private Map<String, List<Token>> methods;
private void init(StackTraceElement[] stackTrace) {
+ // This method, she is slow.
if (classes == null) {
classes = Maps.newHashMap();
methods = Maps.newHashMap();
diff --git a/compiler/java/com/google/dart/compiler/parser/CompletionHooksParserBase.java b/compiler/java/com/google/dart/compiler/parser/CompletionHooksParserBase.java
index eee7ee2..6be2ebe 100644
--- a/compiler/java/com/google/dart/compiler/parser/CompletionHooksParserBase.java
+++ b/compiler/java/com/google/dart/compiler/parser/CompletionHooksParserBase.java
@@ -240,6 +240,10 @@
protected void beginImportDirective() {
begin();
}
+
+ protected void beginImportCombinator() {
+ begin();
+ }
protected void beginInitializer() {
begin();
diff --git a/compiler/java/com/google/dart/compiler/parser/DartParser.java b/compiler/java/com/google/dart/compiler/parser/DartParser.java
index 4b51d39..41d3d9b 100644
--- a/compiler/java/com/google/dart/compiler/parser/DartParser.java
+++ b/compiler/java/com/google/dart/compiler/parser/DartParser.java
@@ -11,6 +11,7 @@
import com.google.dart.compiler.DartCompilerListener;
import com.google.dart.compiler.DartSource;
import com.google.dart.compiler.ErrorCode;
+import com.google.dart.compiler.ErrorSeverity;
import com.google.dart.compiler.InternalCompilerException;
import com.google.dart.compiler.LibrarySource;
import com.google.dart.compiler.PackageLibraryManager;
@@ -103,6 +104,7 @@
import com.google.dart.compiler.ast.Modifiers;
import com.google.dart.compiler.metrics.CompilerMetrics;
import com.google.dart.compiler.parser.DartScanner.Location;
+import com.google.dart.compiler.resolver.Elements;
import com.google.dart.compiler.util.Lists;
import com.google.dart.compiler.util.apache.StringUtils;
@@ -143,7 +145,7 @@
private static final String ABSTRACT_KEYWORD = "abstract";
private static final String AS_KEYWORD = "as";
private static final String CALL_KEYWORD = "call";
- private static final String DYNAMIC_KEYWORD = "dynamic";
+ public static final String DYNAMIC_KEYWORD = "dynamic";
private static final String EXPORT_KEYWORD = "export";
private static final String EXTERNAL_KEYWORD = "external";
private static final String FACTORY_KEYWORD = "factory";
@@ -331,6 +333,13 @@
} else if (peekPseudoKeyword(0, INTERFACE_KEYWORD) && peek(1).equals(Token.IDENTIFIER)) {
consume(Token.IDENTIFIER);
isParsingInterface = true;
+ // TODO(scheglov) remove after http://code.google.com/p/dart/issues/detail?id=6318
+ if (!Elements.isCoreLibrarySource(source)
+ && !Elements.isLibrarySource(source, "/isolate/isolate.dart")
+ && !Elements.isLibrarySource(source, "crypto/crypto.dart")
+ && !Elements.isDart2JsLibrarySource(source)) {
+ reportError(position(), ParserErrorCode.DEPRECATED_INTERFACE);
+ }
node = done(parseClass());
} else if (peekPseudoKeyword(0, TYPEDEF_KEYWORD)
&& (peek(1).equals(Token.IDENTIFIER) || peek(1).equals(Token.VOID) || peek(1).equals(Token.AS))) {
@@ -362,6 +371,7 @@
DartParserCommentsHelper.addComments(unit, source, sourceCode, commentLocs);
}
// done
+ unit.setHasParseErrors(errorCount != 0);
return done(unit);
} catch (StringInterpolationParseError exception) {
throw new InternalCompilerException("Failed to parse " + source.getUri(), exception);
@@ -374,19 +384,22 @@
* @param node the node with which the metadata is to be associated
* @param metadata the metadata to be associated with the node
*/
- private void setMetadata(DartNodeWithMetadata node, List<DartAnnotation> metadata) {
- node.setMetadata(metadata);
- if (node instanceof DartDeclaration<?>) {
- for (DartAnnotation annotation : metadata) {
- DartExpression nameNode = annotation.getName();
- if (nameNode instanceof DartIdentifier) {
- String name = ((DartIdentifier) nameNode).getName();
- if (name.equals("deprecated")) {
- DartDeclaration<?> declaration = (DartDeclaration<?>) node;
- declaration.setObsoleteMetadata(declaration.getObsoleteMetadata().makeDeprecated());
- } else if (name.equals("override")) {
- DartDeclaration<?> declaration = (DartDeclaration<?>) node;
- declaration.setObsoleteMetadata(declaration.getObsoleteMetadata().makeOverride());
+ private void setMetadata(DartNodeWithMetadata node, List<DartAnnotation> annotations) {
+ if (annotations != null && !annotations.isEmpty()) {
+ node.setMetadata(annotations);
+ if (node instanceof DartDeclaration<?>) {
+ for (int i = 0, size = annotations.size(); i < size; i++) {
+ DartAnnotation annotation = annotations.get(i);
+ DartExpression nameNode = annotation.getName();
+ if (nameNode instanceof DartIdentifier) {
+ String name = ((DartIdentifier) nameNode).getName();
+ if (name.equals("deprecated")) {
+ DartDeclaration<?> declaration = (DartDeclaration<?>) node;
+ declaration.setObsoleteMetadata(declaration.getObsoleteMetadata().makeDeprecated());
+ } else if (name.equals("override")) {
+ DartDeclaration<?> declaration = (DartDeclaration<?>) node;
+ declaration.setObsoleteMetadata(declaration.getObsoleteMetadata().makeOverride());
+ }
}
}
}
@@ -624,12 +637,13 @@
List<ImportCombinator> combinators = new ArrayList<ImportCombinator>();
while (peekPseudoKeyword(0, HIDE_KEYWORD) || peekPseudoKeyword(0, SHOW_KEYWORD)) {
+ beginImportCombinator();
if (optionalPseudoKeyword(HIDE_KEYWORD)) {
List<DartIdentifier> hiddenNames = parseIdentifierList();
- combinators.add(new ImportHideCombinator(hiddenNames));
+ combinators.add(done(new ImportHideCombinator(hiddenNames)));
} else if (optionalPseudoKeyword(SHOW_KEYWORD)) {
List<DartIdentifier> shownNames = parseIdentifierList();
- combinators.add(new ImportShowCombinator(shownNames));
+ combinators.add(done(new ImportShowCombinator(shownNames)));
}
}
@@ -760,9 +774,10 @@
beginPartOfDirective();
next(); // "part"
next(); // "of"
+ int ofOffset= position();
DartExpression libraryName = parseLibraryName();
expect(Token.SEMICOLON);
- return done(new DartPartOfDirective(libraryName));
+ return done(new DartPartOfDirective(ofOffset, libraryName));
}
private void parseResourceDirective() {
@@ -914,6 +929,9 @@
*/
private DartDeclaration<?> parseClass() {
beginClassBody();
+
+ int tokenOffset = ctx.getTokenLocation().getBegin();
+ int tokenLength = ctx.getTokenLocation().getEnd() - tokenOffset;
// Parse modifiers.
Modifiers modifiers = Modifiers.NONE;
@@ -936,6 +954,7 @@
// Parse the extends and implements clauses.
DartTypeNode superType = null;
+ int implementsOffset = -1;
List<DartTypeNode> interfaces = null;
if (isParsingInterface) {
if (optional(Token.EXTENDS)) {
@@ -946,14 +965,18 @@
superType = parseTypeAnnotation();
}
if (optionalPseudoKeyword(IMPLEMENTS_KEYWORD)) {
+ implementsOffset = position();
interfaces = parseTypeAnnotationList();
}
}
// Deal with factory clause for interfaces.
DartParameterizedTypeNode defaultClass = null;
+ int defaultTokenOffset = -1;
if (isParsingInterface &&
(optionalDeprecatedFactory() || optional(Token.DEFAULT))) {
+ defaultTokenOffset = position();
+ beginTypeAnnotation();
DartExpression qualified = parseQualified(false);
List<DartTypeParameter> defaultTypeParameters = parseTypeParametersOpt();
defaultClass = doneWithoutConsuming(new DartParameterizedTypeNode(qualified,
@@ -990,18 +1013,13 @@
}
if (isParsingInterface) {
- return done(new DartClass(name, superType, interfaces, openBraceOffset, closeBraceOffset,
- members, typeParameters, defaultClass));
+ return done(new DartClass(tokenOffset, tokenLength, name, superType, implementsOffset,
+ interfaces, defaultTokenOffset, openBraceOffset, closeBraceOffset, members,
+ typeParameters, defaultClass));
} else {
- return done(new DartClass(name,
- nativeName,
- superType,
- interfaces,
- openBraceOffset,
- closeBraceOffset,
- members,
- typeParameters,
- modifiers));
+ return done(new DartClass(tokenOffset, tokenLength, name, nativeName, superType,
+ implementsOffset, interfaces, defaultTokenOffset, openBraceOffset, closeBraceOffset,
+ members, typeParameters, modifiers));
}
}
@@ -1257,9 +1275,6 @@
}
}
if (optionalPseudoKeyword(ABSTRACT_KEYWORD)) {
- if (isParsingInterface) {
- reportError(position(), ParserErrorCode.ABSTRACT_MEMBER_IN_INTERFACE);
- }
if (modifiers.isStatic()) {
reportError(position(), ParserErrorCode.STATIC_MEMBERS_CANNOT_BE_ABSTRACT);
}
@@ -1290,6 +1305,22 @@
reportError(position(), ParserErrorCode.DISALLOWED_FACTORY_KEYWORD);
}
}
+
+ // report "abstract" warning after all other checks to don't hide error with warning
+ // we ignore problems if there was already reported problem after given position
+ if (modifiers.isAbstract()) {
+ // TODO(scheglov) remove after http://code.google.com/p/dart/issues/detail?id=6322
+ // TODO(scheglov) remove after http://code.google.com/p/dart/issues/detail?id=6323
+ if (!Elements.isCoreLibrarySource(source)
+ && !Elements.isLibrarySource(source, "html/dartium/html_dartium.dart")
+ && !Elements.isLibrarySource(source, "/math/math.dart")
+ && !Elements.isLibrarySource(source, "/io/io_runtime.dart")
+ && !Elements.isLibrarySource(source, "/crypto/crypto.dart")
+ && !Elements.isLibrarySource(source, "/utf/utf.dart")
+ && !Elements.isDart2JsLibrarySource(source)) {
+ reportError(position(), ParserErrorCode.DEPRECATED_ABSTRACT_METHOD);
+ }
+ }
if (modifiers.isFactory()) {
if (!isParsingClass) {
@@ -1692,12 +1723,16 @@
// Parse the parameters definitions.
FormalParameters parametersInfo;
- if (modifiers.isGetter() && peek(0) != Token.LPAREN) {
- // TODO: For now the parameters are optional so that both the old and new style will be
- // accepted, but eventually parameters should be disallowed.
+ if (modifiers.isGetter()) {
parametersInfo = new FormalParameters(new ArrayList<DartParameter>(), -1, -1);
+ if (peek(0) == Token.LPAREN) {
+ // TODO(scheglov) remove after http://code.google.com/p/dart/issues/detail?id=6297
+ if (!Elements.isHtmlLibrarySource(source)) {
+ reportError(position(), ParserErrorCode.DEPRECATED_GETTER);
+ }
+ parametersInfo = parseFormalParameterList();
+ }
} else {
- //reportError(position(), ParserErrorCode.DEPRECATED_GETTER);
parametersInfo = parseFormalParameterList();
}
List<DartParameter> parameters = parametersInfo.val;
@@ -1708,7 +1743,11 @@
reportError(position(), ParserErrorCode.ILLEGAL_NUMBER_OF_PARAMETERS);
}
// In methods with required arity each parameter is required.
- for (DartParameter parameter : parameters) {
+ for (int i = 0, size = parameters.size(); i < size; i++) {
+ DartParameter parameter = parameters.get(i);
+ if (parameter.getModifiers().isOptional()) {
+ reportError(parameter, ParserErrorCode.OPTIONAL_POSITIONAL_PARAMETER_NOT_ALLOWED);
+ }
if (parameter.getModifiers().isNamed()) {
reportError(parameter, ParserErrorCode.NAMED_PARAMETER_NOT_ALLOWED);
}
@@ -1718,7 +1757,8 @@
reportError(position(), ParserErrorCode.ILLEGAL_NUMBER_OF_PARAMETERS);
}
// In methods with required arity each parameter is required.
- for (DartParameter parameter : parameters) {
+ for (int i = 0, size = parameters.size(); i < size; i++) {
+ DartParameter parameter = parameters.get(i);
if (parameter.getModifiers().isNamed()) {
reportError(parameter, ParserErrorCode.NAMED_PARAMETER_NOT_ALLOWED);
}
@@ -2139,8 +2179,6 @@
if (isOptional) {
modifiers = modifiers.makeOptional();
- // TODO(brianwilkerson) Remove the line below when we no longer need to support the old syntax.
- modifiers = modifiers.makeNamed();
}
if (isNamed) {
modifiers = modifiers.makeNamed();
@@ -2272,7 +2310,8 @@
*/
private void validateNoDefaultParameterValues(List<DartParameter> parameters,
ErrorCode errorCode) {
- for (DartParameter parameter : parameters) {
+ for (int i = 0, size = parameters.size(); i < size; i++) {
+ DartParameter parameter = parameters.get(i);
DartExpression defaultExpr = parameter.getDefaultExpr();
if (defaultExpr != null) {
reportError(defaultExpr, errorCode);
@@ -4343,6 +4382,13 @@
if (!optional(Token.LPAREN)) {
return false;
}
+ // if it looks as "(Type name, ....)" then it may be function expression
+ boolean hasTwoIdentifiersComma;
+ {
+ int nameOffset = skipTypeName(0);
+ hasTwoIdentifiersComma = nameOffset != -1 && peek(nameOffset + 0) == Token.IDENTIFIER
+ && peek(nameOffset + 1) == Token.COMMA;
+ }
// find matching parenthesis
int count = 1;
while (count != 0) {
@@ -4357,7 +4403,7 @@
break;
}
}
- return (peek(0) == Token.ARROW || peek(0) == Token.LBRACE);
+ return (peek(0) == Token.ARROW || peek(0) == Token.LBRACE) || hasTwoIdentifiersComma;
} finally {
rollback();
}
@@ -5319,8 +5365,11 @@
*
* @return whether the current error should be reported
*/
- private boolean incErrorCount() {
- errorCount++;
+ private boolean incErrorCount(ErrorCode errorCode) {
+ // count only errors, but not warnings (such as "abstract")
+ if (errorCode.getErrorSeverity() == ErrorSeverity.ERROR) {
+ errorCount++;
+ }
if (errorCount >= MAX_DEFAULT_ERRORS) {
if (errorCount == MAX_DEFAULT_ERRORS) {
@@ -5345,7 +5394,7 @@
@Override
protected void reportError(int position, ErrorCode errorCode, Object... arguments) {
// TODO(devoncarew): we're not correctly identifying dart:html as a core library
- if (incErrorCount()) {
+ if (incErrorCount(errorCode)) {
super.reportError(position, errorCode, arguments);
}
}
@@ -5353,13 +5402,13 @@
@Override
protected void reportErrorAtPosition(int startPosition, int endPosition,
ErrorCode errorCode, Object... arguments) {
- if (incErrorCount()) {
+ if (incErrorCount(errorCode)) {
super.reportErrorAtPosition(startPosition, endPosition, errorCode, arguments);
}
}
private void reportError(DartCompilationError dartError) {
- if (incErrorCount()) {
+ if (incErrorCount(dartError.getErrorCode())) {
ctx.error(dartError);
errorHistory.add(dartError.hashCode());
}
diff --git a/compiler/java/com/google/dart/compiler/parser/ParserErrorCode.java b/compiler/java/com/google/dart/compiler/parser/ParserErrorCode.java
index 645c7a0..0e3a536 100644
--- a/compiler/java/com/google/dart/compiler/parser/ParserErrorCode.java
+++ b/compiler/java/com/google/dart/compiler/parser/ParserErrorCode.java
@@ -33,8 +33,10 @@
DEFAULT_POSITIONAL_PARAMETER("Positional parameters cannot have default values"),
DEPRECATED_CATCH("This style of catch clause has been deprecated. Please use the 'on' <type> " +
"'catch' '(' <identifier> (',' <identifier>)? ')' form."),
- DEPRECATED_GETTER(ErrorSeverity.WARNING, "The presence of parentheses afer the name of the getter "
+ DEPRECATED_ABSTRACT_METHOD(ErrorSeverity.WARNING, "Modifier 'abstract' is deprecated for methods without body. Remove it."),
+ DEPRECATED_GETTER("The presence of parentheses after the name of the getter "
+ "has been deprecated and will soon be disallowed. Please remove the parentheses."),
+ DEPRECATED_INTERFACE("Deprecated declaration of the 'interface', use abstract 'class' instead"),
DEPRECATED_USE_OF_FACTORY_KEYWORD("Deprecated use of the 'factory' keyword: use 'default' instead"),
DEPRECATED_RAW_STRING("The use of '@' to prefix a raw string has been deprecated; use 'r' instead"),
DEPRECATED_RESOURCE_DIRECTIVE("The #resource directive has been deprecated and will soon be disallowed"),
@@ -73,9 +75,9 @@
EXPECTED_TOKEN("Unexpected token '%s' (expected '%s')"),
// TODO(zundel): error message needs JUnit test
EXPECTED_VAR_FINAL_OR_TYPE("Expected 'var', 'final' or type"),
+ EXTERNAL_ABSTRACT("External methods cannot be abstract"),
EXTERNAL_ONLY_METHOD("Only a top-level function, a method, a getter, a setter or an non-redirecting constructor can be specified as external"),
EXTERNAL_METHOD_BODY("External methods cannot have body"),
- EXTERNAL_ABSTRACT("External methods cannot be abstract"),
INVALID_SEPARATOR_FOR_NAMED("Use ':' between a named parameter and its value"),
INVALID_SEPARATOR_FOR_OPTIONAL("Use '=' between an optional parameter and its value"),
// TODO(zundel): this error message is out of date
@@ -117,6 +119,7 @@
ONLY_ONE_LIBRARY_DIRECTIVE("Only one library directive may be declared in a file"),
OPERATOR_CANNOT_BE_STATIC("Operators cannot be static"),
OPERATOR_IS_NOT_USER_DEFINABLE("Operator is not user definable"),
+ OPTIONAL_POSITIONAL_PARAMETER_NOT_ALLOWED("Optional positional parameter is not allowed for operator or setter method"),
POSITIONAL_AFTER_NAMED_ARGUMENT("Positional argument after named argument"),
REDIRECTING_CONSTRUCTOR_CANNOT_HAVE_A_BODY("Redirecting constructor cannot have a body"),
REDIRECTING_CONSTRUCTOR_PARAM("Redirecting constructor cannot have initializers"),
diff --git a/compiler/java/com/google/dart/compiler/resolver/ClassScope.java b/compiler/java/com/google/dart/compiler/resolver/ClassScope.java
index 5c39d05..a1b9a5b 100644
--- a/compiler/java/com/google/dart/compiler/resolver/ClassScope.java
+++ b/compiler/java/com/google/dart/compiler/resolver/ClassScope.java
@@ -7,6 +7,7 @@
import com.google.dart.compiler.type.InterfaceType;
import java.util.HashSet;
+import java.util.List;
import java.util.Set;
/**
@@ -54,7 +55,10 @@
}
}
}
- for (InterfaceType supertype : classElement.getInterfaces()) {
+
+ List<InterfaceType> interfaces = classElement.getInterfaces();
+ for (int i = 0, size = interfaces.size(); i < size; i++) {
+ InterfaceType supertype = interfaces.get(i);
Element enclosing = supertype.getElement().getEnclosingElement();
ClassElement superclassElement = supertype.getElement();
if (!examinedTypes.contains(superclassElement)) {
diff --git a/compiler/java/com/google/dart/compiler/resolver/Elements.java b/compiler/java/com/google/dart/compiler/resolver/Elements.java
index de23bb9..55f1401 100644
--- a/compiler/java/com/google/dart/compiler/resolver/Elements.java
+++ b/compiler/java/com/google/dart/compiler/resolver/Elements.java
@@ -446,7 +446,21 @@
int num = 0;
List<VariableElement> parameters = method.getParameters();
for (VariableElement parameter : parameters) {
- if (!parameter.isNamed()) {
+ if (!parameter.isOptional() && !parameter.isNamed()) {
+ num++;
+ }
+ }
+ return num;
+ }
+
+ /**
+ * @return the number of optional positional parameters in given {@link MethodElement}.
+ */
+ public static int getNumberOfOptionalPositionalParameters(MethodElement method) {
+ int num = 0;
+ List<VariableElement> parameters = method.getParameters();
+ for (VariableElement parameter : parameters) {
+ if (parameter.isOptional()) {
num++;
}
}
@@ -713,6 +727,21 @@
}
return false;
}
+
+ /**
+ * @return <code>true</code> if given {@link Source} represents library with given name.
+ */
+ public static boolean isDart2JsLibrarySource(Source source) {
+ if (source instanceof DartSource) {
+ DartSource dartSource = (DartSource) source;
+ LibrarySource library = dartSource.getLibrary();
+ if (library != null) {
+ String libraryName = library.getName();
+ return libraryName.contains("lib/compiler/implementation/");
+ }
+ }
+ return false;
+ }
/**
* @return <code>true</code> if given {@link Source} represents code library declaration or
@@ -727,6 +756,10 @@
|| Elements.isLibrarySource(source, "/core/core.dart")
|| Elements.isLibrarySource(source, "/core/coreimpl.dart");
}
+
+ public static boolean isHtmlLibrarySource(Source source) {
+ return Elements.isLibrarySource(source, "/html/dartium/html_dartium.dart");
+ }
/**
* @return the {@link LibraryElement} which declares given {@link Element}.
diff --git a/compiler/java/com/google/dart/compiler/resolver/MemberBuilder.java b/compiler/java/com/google/dart/compiler/resolver/MemberBuilder.java
index 12e7ce1..8953c4d 100644
--- a/compiler/java/com/google/dart/compiler/resolver/MemberBuilder.java
+++ b/compiler/java/com/google/dart/compiler/resolver/MemberBuilder.java
@@ -557,9 +557,9 @@
* Checks that top-level "main()" has no parameters.
*/
private void checkTopLevelMainFunction(DartMethodDefinition method) {
- if (Objects.equal(method.getName().toSource(), "main")
+ if (!method.getFunction().getParameters().isEmpty()
&& currentHolder instanceof LibraryElement
- && !method.getFunction().getParameters().isEmpty()) {
+ && Objects.equal(method.getName().toString(), "main")) {
resolutionError(method.getName(), ResolverErrorCode.MAIN_FUNCTION_PARAMETERS);
}
}
diff --git a/compiler/java/com/google/dart/compiler/resolver/ResolveVisitor.java b/compiler/java/com/google/dart/compiler/resolver/ResolveVisitor.java
index 666b0e9..ad1da78 100644
--- a/compiler/java/com/google/dart/compiler/resolver/ResolveVisitor.java
+++ b/compiler/java/com/google/dart/compiler/resolver/ResolveVisitor.java
@@ -55,10 +55,15 @@
Elements.setType(element, type);
for (DartParameter parameter : node.getParameters()) {
if (!(parameter.getQualifier() instanceof DartThisExpression) &&
- parameter.getModifiers().isNamed() &&
DartIdentifier.isPrivateName(parameter.getElement().getName())) {
- getContext().onError(parameter.getName(),
- ResolverErrorCode.NAMED_PARAMETERS_CANNOT_START_WITH_UNDER);
+ if (parameter.getModifiers().isOptional()) {
+ getContext().onError(parameter.getName(),
+ ResolverErrorCode.OPTIONAL_PARAMETERS_CANNOT_START_WITH_UNDER);
+ }
+ if (parameter.getModifiers().isNamed()) {
+ getContext().onError(parameter.getName(),
+ ResolverErrorCode.NAMED_PARAMETERS_CANNOT_START_WITH_UNDER);
+ }
}
}
return element;
diff --git a/compiler/java/com/google/dart/compiler/resolver/Resolver.java b/compiler/java/com/google/dart/compiler/resolver/Resolver.java
index b95c726..9edadea 100644
--- a/compiler/java/com/google/dart/compiler/resolver/Resolver.java
+++ b/compiler/java/com/google/dart/compiler/resolver/Resolver.java
@@ -84,7 +84,6 @@
import com.google.dart.compiler.type.TypeKind;
import com.google.dart.compiler.type.TypeVariable;
import com.google.dart.compiler.type.Types;
-import com.google.dart.compiler.util.apache.StringUtils;
import java.util.EnumSet;
import java.util.Iterator;
@@ -281,10 +280,15 @@
if (parameter.getQualifier() instanceof DartThisExpression) {
onError(parameter.getName(), ResolverErrorCode.PARAMETER_INIT_OUTSIDE_CONSTRUCTOR);
} else {
- if (parameter.getModifiers().isNamed()
- && DartIdentifier.isPrivateName(parameter.getElement().getName())) {
- onError(parameter.getName(),
- ResolverErrorCode.NAMED_PARAMETERS_CANNOT_START_WITH_UNDER);
+ if (DartIdentifier.isPrivateName(parameter.getElement().getName())) {
+ if (parameter.getModifiers().isOptional()) {
+ onError(parameter.getName(),
+ ResolverErrorCode.OPTIONAL_PARAMETERS_CANNOT_START_WITH_UNDER);
+ }
+ if (parameter.getModifiers().isNamed()) {
+ onError(parameter.getName(),
+ ResolverErrorCode.NAMED_PARAMETERS_CANNOT_START_WITH_UNDER);
+ }
}
getContext().declare(parameter.getElement(), ResolverErrorCode.DUPLICATE_PARAMETER);
}
@@ -374,14 +378,6 @@
// Make sure the default class matches the interface type parameters
checkInterfaceTypeParamsToDefault(classElement, defaultClass);
-
- // Check that interface constructors have corresponding methods in default class.
- checkInterfaceConstructors(classElement);
- } else if (classElement.isInterface() && classElement.getConstructors() != null) {
- for (ConstructorElement interfaceConstructor : classElement.getConstructors()) {
- onError(interfaceConstructor.getNameLocation(),
- ResolverErrorCode.ILLEGAL_CONSTRUCTOR_NO_DEFAULT_IN_INTERFACE);
- }
}
if (!classElement.isInterface() && Elements.needsImplicitDefaultConstructor(classElement)) {
@@ -545,57 +541,6 @@
}
/**
- * Checks that interface constructors have corresponding methods in default class.
- */
- private void checkInterfaceConstructors(ClassElement interfaceElement) {
- String interfaceClassName = interfaceElement.getName();
- String defaultClassName = interfaceElement.getDefaultClass().getElement().getName();
-
- for (ConstructorElement interfaceConstructor : interfaceElement.getConstructors()) {
- ConstructorElement defaultConstructor =
- resolveInterfaceConstructorInDefaultClass(
- interfaceConstructor,
- interfaceConstructor);
- if (defaultConstructor != null) {
- // Remember for TypeAnalyzer.
- interfaceConstructor.setDefaultConstructor(defaultConstructor);
- // Validate number of required parameters.
- {
- int numReqInterface = Elements.getNumberOfRequiredParameters(interfaceConstructor);
- int numReqDefault = Elements.getNumberOfRequiredParameters(defaultConstructor);
- if (numReqInterface != numReqDefault) {
- onError(
- interfaceConstructor,
- ResolverErrorCode.DEFAULT_CONSTRUCTOR_NUMBER_OF_REQUIRED_PARAMETERS,
- Elements.getRawMethodName(interfaceConstructor),
- interfaceClassName,
- numReqInterface,
- Elements.getRawMethodName(defaultConstructor),
- defaultClassName,
- numReqDefault);
- }
- }
- // Validate names of named parameters.
- {
- List<String> interfaceNames = Elements.getNamedParameters(interfaceConstructor);
- List<String> defaultNames = Elements.getNamedParameters(defaultConstructor);
- if (!interfaceNames.equals(defaultNames)) {
- onError(
- interfaceConstructor,
- ResolverErrorCode.DEFAULT_CONSTRUCTOR_NAMED_PARAMETERS,
- Elements.getRawMethodName(interfaceConstructor),
- interfaceClassName,
- interfaceNames,
- Elements.getRawMethodName(defaultConstructor),
- defaultClassName,
- defaultNames);
- }
- }
- }
- }
- }
-
- /**
* Returns <code>true</code> if the {@link ClassElement} has an implicit or a declared
* default constructor.
*/
@@ -1696,9 +1641,6 @@
// Will check that element is not null.
ConstructorElement constructor = checkIsConstructor(x, element);
- // try to lookup the constructor in the default class.
- constructor = resolveInterfaceConstructorInDefaultClass(x.getConstructor(), constructor);
-
// Check constructor.
if (constructor != null) {
boolean constConstructor = constructor.getModifiers().isConstant();
@@ -1721,87 +1663,6 @@
return recordElement(x, constructor);
}
- /**
- * If given {@link ConstructorElement} is declared in interface, try to resolve it in
- * corresponding default class.
- *
- * @return the resolved {@link ConstructorElement}, or same as given.
- */
- private ConstructorElement resolveInterfaceConstructorInDefaultClass(HasSourceInfo errorTarget,
- ConstructorElement constructor) {
- // If no default class, use existing constructor.
- if (constructor == null || constructor.getConstructorType().getDefaultClass() == null) {
- return constructor;
- }
- // Prepare elements and names for classes.
- ClassElement originalClass = constructor.getConstructorType();
- ClassElement defaultClass = originalClass.getDefaultClass().getElement();
- String originalClassName = originalClass.getName();
- String defaultClassName = defaultClass.getName();
- // Prepare "qualifier.name" for original constructor.
- String rawOriginalMethodName = Elements.getRawMethodName(constructor);
- int originalDotIndex = rawOriginalMethodName.indexOf('.');
- String originalQualifier = StringUtils.substringBefore(rawOriginalMethodName, ".");
- String originalName = StringUtils.substringAfter(rawOriginalMethodName, ".");
- // Separate checks for cases when factory implements interface and not.
- boolean factoryImplementsInterface = Elements.implementsType(defaultClass, originalClass);
- if (factoryImplementsInterface) {
- for (ConstructorElement defaultConstructor : defaultClass.getConstructors()) {
- String rawDefaultMethodName = Elements.getRawMethodName(defaultConstructor);
- // kI == nI and kF == nF
- if (rawOriginalMethodName.equals(originalClassName)
- && rawDefaultMethodName.equals(defaultClassName)) {
- return defaultConstructor;
- }
- // kI == nI.name and kF == nF.name
- if (originalDotIndex != -1) {
- int defaultDotIndex = rawDefaultMethodName.indexOf('.');
- if (defaultDotIndex != -1) {
- String defaultQualifier = StringUtils.substringBefore(rawDefaultMethodName, ".");
- String defaultName = StringUtils.substringAfter(rawDefaultMethodName, ".");
- if (defaultQualifier.equals(defaultClassName)
- && originalQualifier.equals(originalClassName)
- && defaultName.equals(originalName)) {
- return defaultConstructor;
- }
- }
- }
- }
- } else {
- for (ConstructorElement defaultConstructor : defaultClass.getConstructors()) {
- String rawDefaultMethodName = Elements.getRawMethodName(defaultConstructor);
- if (rawDefaultMethodName.equals(rawOriginalMethodName)) {
- return defaultConstructor;
- }
- }
- }
- // If constructor not found, try implicit default constructor of the default class.
- if (Elements.isDefaultConstructor(constructor)
- && (Elements.isSyntheticConstructor(constructor) || factoryImplementsInterface)
- && Elements.needsImplicitDefaultConstructor(defaultClass)) {
- return new SyntheticDefaultConstructorElement(null, defaultClass, typeProvider);
- }
- // Factory constructor not resolved, report error with specific message for each case.
- {
- String expectedFactoryConstructorName;
- if (factoryImplementsInterface) {
- if (originalDotIndex == -1) {
- expectedFactoryConstructorName = defaultClassName;
- } else {
- expectedFactoryConstructorName = defaultClassName + "." + originalName;
- }
- } else {
- expectedFactoryConstructorName = rawOriginalMethodName;
- }
- onError(
- errorTarget,
- ResolverErrorCode.DEFAULT_CONSTRUCTOR_UNRESOLVED,
- expectedFactoryConstructorName,
- defaultClassName);
- return null;
- }
- }
-
@Override
public Element visitGotoStatement(DartGotoStatement x) {
// Don't bother unless there's a target.
@@ -2220,14 +2081,7 @@
if (superCall != null) {
// Do positional parameters match?
- List<VariableElement> superParameters = superCall.getParameters();
- // Count the number of positional parameters required by super call
- int superPositionalCount = 0;
- for (; superPositionalCount < superParameters.size(); superPositionalCount++) {
- if (superParameters.get(superPositionalCount).isNamed()) {
- break;
- }
- }
+ int superPositionalCount = Elements.getNumberOfRequiredParameters(superCall);
if (superPositionalCount > 0) {
onError(node, ResolverErrorCode.TOO_FEW_ARGUMENTS_IN_IMPLICIT_SUPER,
superCall.getType().toString());
diff --git a/compiler/java/com/google/dart/compiler/resolver/ResolverErrorCode.java b/compiler/java/com/google/dart/compiler/resolver/ResolverErrorCode.java
index 7b7c295..b081100 100644
--- a/compiler/java/com/google/dart/compiler/resolver/ResolverErrorCode.java
+++ b/compiler/java/com/google/dart/compiler/resolver/ResolverErrorCode.java
@@ -34,8 +34,8 @@
CANNOT_OVERRIDE_INSTANCE_MEMBER("static member cannot override instance member %s of %s"),
CANNOT_OVERRIDE_METHOD_NUM_REQUIRED_PARAMS(
"cannot override method %s from %s, wrong number of required parameters"),
- CANNOT_OVERRIDE_METHOD_NAMED_PARAMS(
- "cannot override method %s, named parameters don't match"),
+ CANNOT_OVERRIDE_METHOD_NAMED_PARAMS("cannot override method %s, named parameters don't match"),
+ CANNOT_OVERRIDE_METHOD_OPTIONAL_PARAMS("cannot override method %s, optional positional parameters don't match"),
CANNOT_RESOLVE_CONSTRUCTOR("cannot resolve constructor %s"),
CANNOT_RESOLVE_FIELD("cannot resolve field %s"),
CANNOT_RESOLVE_LABEL("cannot resolve label %s"),
@@ -77,6 +77,8 @@
DEFAULT_CONSTRUCTOR_UNRESOLVED("Cannot resolve constructor with name '%s' in default class '%s'"),
DEFAULT_CONSTRUCTOR_NUMBER_OF_REQUIRED_PARAMETERS(
"Constructor '%s' in '%s' has %s required parameters, doesn't match '%s' in '%s' with %s"),
+ DEFAULT_CONSTRUCTOR_OPTIONAL_POSITIONAL_PARAMETERS(
+ "Constructor '%s' in '%s' has %s optional positional parameters, doesn't match '%s' in '%s' with %s"),
DEFAULT_CONSTRUCTOR_NAMED_PARAMETERS(
"Constructor '%s' in '%s' has named parameters %s, doesn't match '%s' in '%s' with %s"),
DEFAULT_MUST_SPECIFY_CLASS("default must indicate a class, not an interface"),
@@ -123,8 +125,6 @@
ILLEGAL_ACCESS_TO_PRIVATE("'%s' is private and not defined in this library"),
// TODO(zundel): error message needs JUnit test - how to test #imports in junit?
ILLEGAL_ACCESS_TO_PRIVATE_MEMBER("\"%s\" refers to \"%s\" which is in a different library"),
- ILLEGAL_CONSTRUCTOR_NO_DEFAULT_IN_INTERFACE(
- "Illegal constructor declaration. No default clause in interface"),
ILLEGAL_FIELD_ACCESS_FROM_STATIC("Illegal access of instance field %s from static scope"),
ILLEGAL_METHOD_ACCESS_FROM_STATIC("Illegal access of instance method %s from static scope"),
INIT_FIELD_ONLY_IMMEDIATELY_SURROUNDING_CLASS(
@@ -170,7 +170,7 @@
NOT_A_TYPE("type \"%s\" expected, but \"%s\" found"),
// TODO(zundel): error message needs JUnit test (reachable code?)
NOT_AN_INSTANCE_FIELD("%s is not an instance field"),
- REDIRECTED_CONSTRUCTOR_CYCLE("Redirected constructor call has a cycle."),
+ OPTIONAL_PARAMETERS_CANNOT_START_WITH_UNDER("Optional parameters cannot start with an '_' character"),
PARAMETER_INIT_OUTSIDE_CONSTRUCTOR("Parameter initializers can only be used in constructors"),
SUPER_METHOD_INVOCATION_IN_CONSTRUCTOR_INITIALIZER(
"Super method invocation is not allowed in constructor initializer"),
@@ -181,6 +181,7 @@
"Parameter initializers cannot be used with redirected constructors"),
// TODO(zundel): error message needs JUnit test
PARAMETER_NOT_MATCH_FIELD("Could not match parameter initializer '%s' with any field"),
+ REDIRECTED_CONSTRUCTOR_CYCLE("Redirected constructor call has a cycle."),
REDIRECTION_CONSTRUCTOR_TARGET_TYPE(
"Target of redirecting factory constructor is not a type"),
REDIRECTION_CONSTRUCTOR_TARGET_MUST_BE_CONST(
diff --git a/compiler/java/com/google/dart/compiler/resolver/Scope.java b/compiler/java/com/google/dart/compiler/resolver/Scope.java
index a20d7ee..3655f4e 100644
--- a/compiler/java/com/google/dart/compiler/resolver/Scope.java
+++ b/compiler/java/com/google/dart/compiler/resolver/Scope.java
@@ -27,7 +27,6 @@
private final String name;
private List<LabelElement> labels;
private LibraryElement library;
- private boolean stateProgress;
private boolean stateReady;
@VisibleForTesting
diff --git a/compiler/java/com/google/dart/compiler/resolver/TypeErrorCode.java b/compiler/java/com/google/dart/compiler/resolver/TypeErrorCode.java
index 068c897..36c182d 100644
--- a/compiler/java/com/google/dart/compiler/resolver/TypeErrorCode.java
+++ b/compiler/java/com/google/dart/compiler/resolver/TypeErrorCode.java
@@ -51,6 +51,7 @@
NO_SUCH_NAMED_PARAMETER("no such named parameter \"%s\" defined"),
NO_SUCH_TYPE("no such type \"%s\"", true),
NOT_A_FUNCTION_TYPE("\"%s\" is not a function type"),
+ NOT_A_FUNCTION_TYPE_FIELD("'%s' is a field of type '%s', not a function; remove parentheses"),
NOT_A_MEMBER_OF("\"%s\" is not a member of %s"),
NOT_A_MEMBER_OF_INFERRED(ErrorSeverity.INFO, "\"%s\" is not a member of %s"),
NOT_A_METHOD_IN("\"%s\" is not a method in %s"),
diff --git a/compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java b/compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java
index 3ccd7e2..454b0b0 100644
--- a/compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java
+++ b/compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java
@@ -32,6 +32,7 @@
import com.google.dart.compiler.ast.DartBlock;
import com.google.dart.compiler.ast.DartBooleanLiteral;
import com.google.dart.compiler.ast.DartBreakStatement;
+import com.google.dart.compiler.ast.DartCascadeExpression;
import com.google.dart.compiler.ast.DartCase;
import com.google.dart.compiler.ast.DartCatchBlock;
import com.google.dart.compiler.ast.DartClass;
@@ -127,6 +128,7 @@
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
+import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
@@ -773,7 +775,9 @@
// if we fell back to Dynamic, keep it
} else {
Type unionType = getUnionType(currentType, inferredType);
- unionType = Types.makeInferred(unionType);
+ if (unionType != currentType) {
+ unionType = Types.makeInferred(unionType);
+ }
blockOldTypes.getFirst().rememberOldType(element, element.getType());
Elements.setType(element, unionType);
}
@@ -784,21 +788,25 @@
* @return the {@link Type} which is both "a" and "b" types. May be "dynamic" if "a" and "b"
* don't form hierarchy.
*/
- Type getUnionType(Type a, Type b) {
- if (TypeKind.of(a) == TypeKind.DYNAMIC) {
- return b;
+ Type getUnionType(Type curType, Type newType) {
+ if (TypeKind.of(curType) == TypeKind.DYNAMIC) {
+ return newType;
}
- if (TypeKind.of(b) == TypeKind.DYNAMIC) {
- return a;
+ if (TypeKind.of(newType) == TypeKind.DYNAMIC) {
+ return curType;
}
- if (types.isSubtype(a, b)) {
- return a;
+ if (types.isSubtype(curType, newType)) {
+ return curType;
}
- if (types.isSubtype(b, a)) {
- return b;
+ if (types.isSubtype(newType, curType)) {
+ return newType;
}
- // TODO(scheglov) return union of types, but this is not easy
- return dynamicType;
+ // if InterfaceType, use union
+ if (curType instanceof InterfaceType && newType instanceof InterfaceType) {
+ return types.unionTypes(ImmutableList.of((InterfaceType) curType, (InterfaceType) newType));
+ }
+ // keep type as is
+ return curType;
}
void restore() {
@@ -1063,7 +1071,7 @@
if (Elements.isFieldWithGetter(field)) {
Type fieldType = field.getType();
if (!types.isAssignable(functionType, fieldType)) {
- onError(diagnosticNode, TypeErrorCode.NOT_A_FUNCTION_TYPE, fieldType);
+ onError(diagnosticNode, TypeErrorCode.NOT_A_FUNCTION_TYPE_FIELD, field.getName(), fieldType);
}
}
return dynamicType;
@@ -1137,14 +1145,13 @@
}
// Check optional parameters.
- // TODO(scheglov) currently this block does not work,
- // because we handle all optional parameter as named
{
Map<String, Type> optionalParameterTypes = ftype.getOptionalParameterTypes();
Iterator<Entry<String, Type>> optionalParameterTypesIterator =
optionalParameterTypes.entrySet().iterator();
while (optionalParameterTypesIterator.hasNext()
- && argumentTypes.hasNext()) {
+ && argumentTypes.hasNext()
+ && !(argumentNodes.get(argumentIndex) instanceof DartNamedExpression)) {
Entry<String, Type> namedEntry = optionalParameterTypesIterator.next();
Type optionalType = namedEntry.getValue();
optionalType.getClass(); // quick null check
@@ -1171,28 +1178,28 @@
Map<String, Type> namedParameterTypes = ftype.getNamedParameterTypes();
Iterator<Entry<String, Type>> namedParameterTypesIterator =
namedParameterTypes.entrySet().iterator();
- // Check positional arguments for named parameters.
- while (namedParameterTypesIterator.hasNext()
- && argumentTypes.hasNext()
- && !(argumentNodes.get(argumentIndex) instanceof DartNamedExpression)) {
- Entry<String, Type> namedEntry = namedParameterTypesIterator.next();
- String parameterName = namedEntry.getKey();
- usedNamedParametersPositional.add(parameterName);
- Type namedType = namedEntry.getValue();
- namedType.getClass(); // quick null check
- Type argumentType = argumentTypes.next();
- argumentType.getClass(); // quick null check
- DartExpression argumentNode = argumentNodes.get(argumentIndex);
- if (parameters != null) {
- argumentNode.setInvocationParameterId(parameters.get(argumentIndex));
- } else {
- argumentNode.setInvocationParameterId(argumentIndex);
- }
- if (checkAssignable(argumentNode, namedType, argumentType)) {
- inferFunctionLiteralParametersTypes(argumentNode, namedType);
- }
- argumentIndex++;
- }
+// // Check positional arguments for named parameters.
+// while (namedParameterTypesIterator.hasNext()
+// && argumentTypes.hasNext()
+// && !(argumentNodes.get(argumentIndex) instanceof DartNamedExpression)) {
+// Entry<String, Type> namedEntry = namedParameterTypesIterator.next();
+// String parameterName = namedEntry.getKey();
+// usedNamedParametersPositional.add(parameterName);
+// Type namedType = namedEntry.getValue();
+// namedType.getClass(); // quick null check
+// Type argumentType = argumentTypes.next();
+// argumentType.getClass(); // quick null check
+// DartExpression argumentNode = argumentNodes.get(argumentIndex);
+// if (parameters != null) {
+// argumentNode.setInvocationParameterId(parameters.get(argumentIndex));
+// } else {
+// argumentNode.setInvocationParameterId(argumentIndex);
+// }
+// if (checkAssignable(argumentNode, namedType, argumentType)) {
+// inferFunctionLiteralParametersTypes(argumentNode, namedType);
+// }
+// argumentIndex++;
+// }
// Check named arguments for named parameters.
while (argumentTypes.hasNext()
&& argumentNodes.get(argumentIndex) instanceof DartNamedExpression) {
@@ -1436,6 +1443,14 @@
}
@Override
+ public Type visitCascadeExpression(DartCascadeExpression node) {
+ DartExpression target = node.getTarget();
+ Type type = nonVoidTypeOf(target);
+ node.visitChildren(this);
+ return type;
+ }
+
+ @Override
public Type visitFunctionObjectInvocation(DartFunctionObjectInvocation node) {
ClassElement element = functionType.getElement();
node.setElement(element);
@@ -2947,6 +2962,7 @@
referencedTypes.add(type.getReturnType());
// parameters
referencedTypes.addAll(type.getParameterTypes());
+ referencedTypes.addAll(type.getOptionalParameterTypes().values());
referencedTypes.addAll(type.getNamedParameterTypes().values());
}
// check that referenced types do not have references on "target"
@@ -3328,64 +3344,161 @@
List<VariableElement> superParameters = superMethod.getParameters();
// Number of required parameters should be same.
{
- int numRequired = getNumRequiredParameters(parameters);
- int superNumRequired = getNumRequiredParameters(superParameters);
+ int numRequired = Elements.getNumberOfRequiredParameters(method);
+ int superNumRequired = Elements.getNumberOfRequiredParameters(superMethod);
if (numRequired != superNumRequired) {
- StringBuilder builder = new StringBuilder();
- builder.append(method.getName());
- builder.append("(");
- boolean inNamed = false;
- int parameterCount = superParameters.size();
- for (int i = 0; i < parameterCount; i++) {
- if (i > 0) {
- builder.append(", ");
- }
- VariableElement parameter = superParameters.get(i);
- if (!inNamed && parameter.isNamed()) {
- builder.append("[");
- inNamed = true;
- }
- builder.append(parameter.getType().toString());
- }
- if (inNamed) {
- builder.append("]");
- }
- builder.append(")");
onError(errorTarget,
ResolverErrorCode.CANNOT_OVERRIDE_METHOD_NUM_REQUIRED_PARAMS,
- builder.toString(),
+ getMethodSignature(superMethod),
superMethod.getEnclosingElement().getName());
return false;
}
}
- // "method" should have at least all named parameters of "superMethod" in the same order.
- List<VariableElement> named = getNamedParameters(parameters);
- List<VariableElement> superNamed = getNamedParameters(superParameters);
- Iterator<VariableElement> namedIterator = named.iterator();
- Iterator<VariableElement> superNamedIterator = superNamed.iterator();
- while (superNamedIterator.hasNext()) {
- VariableElement superParameter = superNamedIterator.next();
- if (namedIterator.hasNext()) {
- VariableElement parameter = namedIterator.next();
- if (Objects.equal(parameter.getName(), superParameter.getName())) {
- DartExpression superDefValue = superParameter.getDefaultValue();
- DartExpression defValue = parameter.getDefaultValue();
- if (superDefValue != null
- && !Objects.equal(ObjectUtils.toString(defValue),
- ObjectUtils.toString(superDefValue))) {
- onError(parameter.getSourceInfo(),
- TypeErrorCode.CANNOT_OVERRIDE_METHOD_DEFAULT_VALUE, method.getName(),
- superDefValue);
- }
- continue;
+ // TODO(scheglov) remove after http://code.google.com/p/dart/issues/detail?id=6306
+ if (Elements.isLibrarySource(errorTarget.getSourceInfo().getSource(), "/io/io_runtime.dart")) {
+ return true;
+ }
+ // "method" should have at least same number of optional positional parameters as "superMethod"
+ {
+ LinkedHashMap<VariableElement, DartExpression> defMethod = getParametersDefaultsOptional(parameters);
+ LinkedHashMap<VariableElement, DartExpression> defSuper = getParametersDefaultsOptional(superParameters);
+ if (defMethod.size() < defSuper.size()) {
+ onError(errorTarget,
+ ResolverErrorCode.CANNOT_OVERRIDE_METHOD_OPTIONAL_PARAMS,
+ getMethodSignature(superMethod),
+ superMethod.getEnclosingElement().getName());
+ return false;
+ }
+ Iterator<Entry<VariableElement, DartExpression>> defMethodIter = defMethod.entrySet().iterator();
+ Iterator<Entry<VariableElement, DartExpression>> defSuperIter = defSuper.entrySet().iterator();
+ while (defSuperIter.hasNext()) {
+ Entry<VariableElement, DartExpression> methodEntry = defMethodIter.next();
+ Entry<VariableElement, DartExpression> superEntry = defSuperIter.next();
+ DartExpression methodValue = methodEntry.getValue();
+ DartExpression superValue = superEntry.getValue();
+ if (superValue != null
+ && !Objects.equal(ObjectUtils.toString(methodValue),
+ ObjectUtils.toString(superValue))) {
+ onError(methodEntry.getKey().getSourceInfo(),
+ TypeErrorCode.CANNOT_OVERRIDE_METHOD_DEFAULT_VALUE, method.getName(),
+ superValue);
}
}
- onError(errorTarget, ResolverErrorCode.CANNOT_OVERRIDE_METHOD_NAMED_PARAMS, method.getName());
- return false;
}
+ // "method" should have at least all named parameters of "superMethod".
+ {
+ Map<String, VariableElement> methodNames = getParametersNamed(parameters);
+ Map<String, VariableElement> superNames = getParametersNamed(superParameters);
+ if (!methodNames.keySet().containsAll(superNames.keySet())) {
+ onError(errorTarget, ResolverErrorCode.CANNOT_OVERRIDE_METHOD_NAMED_PARAMS, method.getName());
+ return false;
+ }
+ Map<String, DartExpression> methodDefs = getParametersDefaultsNamed(parameters);
+ Map<String, DartExpression> superDefs = getParametersDefaultsNamed(superParameters);
+ for (Entry<String, DartExpression> entry : superDefs.entrySet()) {
+ String name = entry.getKey();
+ DartExpression defValue = methodDefs.get(name);
+ DartExpression superDefValue = superDefs.get(name);
+ if (superDefValue != null
+ && !Objects.equal(ObjectUtils.toString(defValue),
+ ObjectUtils.toString(superDefValue))) {
+ onError(methodNames.get(name).getSourceInfo(),
+ TypeErrorCode.CANNOT_OVERRIDE_METHOD_DEFAULT_VALUE, method.getName(),
+ superDefValue);
+ }
+ }
+ }
+// List<VariableElement> named = getNamedParameters(parameters);
+// List<VariableElement> superNamed = getNamedParameters(superParameters);
+// Iterator<VariableElement> namedIterator = named.iterator();
+// Iterator<VariableElement> superNamedIterator = superNamed.iterator();
+// while (superNamedIterator.hasNext()) {
+// VariableElement superParameter = superNamedIterator.next();
+// if (namedIterator.hasNext()) {
+// VariableElement parameter = namedIterator.next();
+// if (Objects.equal(parameter.getName(), superParameter.getName())) {
+// DartExpression superDefValue = superParameter.getDefaultValue();
+// DartExpression defValue = parameter.getDefaultValue();
+// if (superDefValue != null
+// && !Objects.equal(ObjectUtils.toString(defValue),
+// ObjectUtils.toString(superDefValue))) {
+// onError(parameter.getSourceInfo(),
+// TypeErrorCode.CANNOT_OVERRIDE_METHOD_DEFAULT_VALUE, method.getName(),
+// superDefValue);
+// }
+// continue;
+// }
+// }
+// onError(errorTarget, ResolverErrorCode.CANNOT_OVERRIDE_METHOD_NAMED_PARAMS, method.getName());
+// return false;
+// }
return true;
}
+ private String getMethodSignature(MethodElement method) {
+ StringBuilder builder = new StringBuilder();
+ builder.append(method.getName());
+ builder.append("(");
+ boolean inOptional = false;
+ boolean inNamed = false;
+ List<VariableElement> superParameters = method.getParameters();
+ int parameterCount = superParameters.size();
+ for (int i = 0; i < parameterCount; i++) {
+ if (i > 0) {
+ builder.append(", ");
+ }
+ VariableElement parameter = superParameters.get(i);
+ if (!inOptional && parameter.isOptional()) {
+ builder.append("[");
+ inOptional = true;
+ }
+ if (!inNamed && parameter.isNamed()) {
+ builder.append("{");
+ inNamed = true;
+ }
+ builder.append(parameter.getType().toString());
+ }
+ if (inOptional) {
+ builder.append("]");
+ }
+ if (inNamed) {
+ builder.append("}");
+ }
+ builder.append(")");
+ String methodSignature = builder.toString();
+ return methodSignature;
+ }
+
+ private LinkedHashMap<VariableElement, DartExpression> getParametersDefaultsOptional(List<VariableElement> parameters) {
+ LinkedHashMap<VariableElement, DartExpression> defaults = Maps.newLinkedHashMap();
+ for (VariableElement parameter : parameters) {
+ if (parameter.isOptional()) {
+ defaults.put(parameter, parameter.getDefaultValue());
+ }
+ }
+ return defaults;
+ }
+
+ private Map<String, VariableElement> getParametersNamed(List<VariableElement> parameters) {
+ Map<String, VariableElement> namedParameters = Maps.newHashMap();
+ for (VariableElement parameter : parameters) {
+ if (parameter.isNamed()) {
+ namedParameters.put(parameter.getName(), parameter);
+ }
+ }
+ return namedParameters;
+ }
+
+ private Map<String, DartExpression> getParametersDefaultsNamed(List<VariableElement> parameters) {
+ Map<String, DartExpression> defaults = Maps.newHashMap();
+ for (VariableElement parameter : parameters) {
+ if (parameter.isNamed()) {
+ defaults.put(parameter.getName(), parameter.getDefaultValue());
+ }
+ }
+ return defaults;
+ }
+
private int getNumRequiredParameters(List<VariableElement> parameters) {
int numRequired = 0;
for (VariableElement parameter : parameters) {
diff --git a/compiler/java/com/google/dart/compiler/type/Types.java b/compiler/java/com/google/dart/compiler/type/Types.java
index 43d6813..3c1d122 100644
--- a/compiler/java/com/google/dart/compiler/type/Types.java
+++ b/compiler/java/com/google/dart/compiler/type/Types.java
@@ -162,7 +162,14 @@
return interTypes.get(0);
}
// create union
- return new InterfaceTypeUnion(interTypes);
+ return unionTypes(interTypes);
+ }
+
+ /**
+ * @return the {@link InterfaceType} which is union of given ones.
+ */
+ public InterfaceType unionTypes(List<InterfaceType> types) {
+ return new InterfaceTypeUnion(types);
}
/**
@@ -355,6 +362,27 @@
return false;
}
}
+
+ {
+ Map<String, Type> sOpti = s.getOptionalParameterTypes();
+ Map<String, Type> tOpti = t.getOptionalParameterTypes();
+ if (tOpti.size() < sOpti.size()) {
+ return false;
+ }
+ Iterator<Entry<String, Type>> tList = tOpti.entrySet().iterator();
+ Iterator<Entry<String, Type>> sList = sOpti.entrySet().iterator();
+ while (sList.hasNext()) {
+ if (!tList.hasNext()) {
+ return false;
+ }
+ Entry<String, Type> sEntry = sList.next();
+ Entry<String, Type> tEntry = tList.next();
+ if (!isAssignable(tEntry.getValue(), sEntry.getValue())) {
+ return false;
+ }
+ }
+ }
+
Map<String, Type> tNamed = t.getNamedParameterTypes();
Map<String, Type> sNamed = s.getNamedParameterTypes();
if (tNamed.isEmpty() && !sNamed.isEmpty()) {
@@ -366,23 +394,34 @@
if (!sNamed.isEmpty()) {
LinkedHashMap<String,Type> tMap = (LinkedHashMap<String, Type>)(tNamed);
LinkedHashMap<String,Type> sMap = (LinkedHashMap<String, Type>)(sNamed);
- Iterator<Entry<String, Type>> tList = tMap.entrySet().iterator();
- Iterator<Entry<String, Type>> sList = sMap.entrySet().iterator();
- // t named parameters must start with the named parameters of s
- while (sList.hasNext()) {
- if (!tList.hasNext()) {
- return false;
- }
- Entry<String, Type> sEntry = sList.next();
- Entry<String, Type> tEntry = tList.next();
- if (!sEntry.getKey().equals(tEntry.getKey())) {
- return false;
- }
- // Classic: parameter types are contravariant; Dart: assignable.
- if (!isAssignable(tEntry.getValue(), sEntry.getValue())) {
+ if (!tMap.keySet().containsAll(sMap.keySet())) {
+ return false;
+ }
+ for (Entry<String, Type> entry : sMap.entrySet()) {
+ String name = entry.getKey();
+ Type sType = sMap.get(name);
+ Type tType = tMap.get(name);
+ if (!isAssignable(tType, sType)) {
return false;
}
}
+// Iterator<Entry<String, Type>> tList = tMap.entrySet().iterator();
+// Iterator<Entry<String, Type>> sList = sMap.entrySet().iterator();
+// // t named parameters must start with the named parameters of s
+// while (sList.hasNext()) {
+// if (!tList.hasNext()) {
+// return false;
+// }
+// Entry<String, Type> sEntry = sList.next();
+// Entry<String, Type> tEntry = tList.next();
+// if (!sEntry.getKey().equals(tEntry.getKey())) {
+// return false;
+// }
+// // Classic: parameter types are contravariant; Dart: assignable.
+// if (!isAssignable(tEntry.getValue(), sEntry.getValue())) {
+// return false;
+// }
+// }
}
// Classic: parameter types are contravariant; Dart: assignable.
diff --git a/compiler/javatests/com/google/dart/compiler/CodeCompletionParseTest.java b/compiler/javatests/com/google/dart/compiler/CodeCompletionParseTest.java
index 33f58d7..6776675 100644
--- a/compiler/javatests/com/google/dart/compiler/CodeCompletionParseTest.java
+++ b/compiler/javatests/com/google/dart/compiler/CodeCompletionParseTest.java
@@ -13,7 +13,7 @@
public class CodeCompletionParseTest extends CompilerTestCase {
public void test1() throws Exception {
- AnalyzeLibraryResult result = analyzeLibrary("foo", makeCode(
+ AnalyzeLibraryResult result = analyzeLibrary(makeCode(
"class CellLocation {",
" int _field1;",
" String _field2;",
@@ -29,7 +29,7 @@
}
public void test2() throws Exception {
- AnalyzeLibraryResult result = analyzeLibrary("foo", makeCode(
+ AnalyzeLibraryResult result = analyzeLibrary(makeCode(
"doFoo() {",
" new ", // cursor
"}"));
@@ -38,7 +38,7 @@
}
public void test3() throws Exception {
- AnalyzeLibraryResult result = analyzeLibrary("foo", makeCode(
+ AnalyzeLibraryResult result = analyzeLibrary(makeCode(
"class Foo {",
" static final Bar b = const ", // cursor
"}",
@@ -51,7 +51,7 @@
}
public void test4() throws Exception {
- AnalyzeLibraryResult result = analyzeLibrary("foo", makeCode(
+ AnalyzeLibraryResult result = analyzeLibrary(makeCode(
"foo() {",
" int SEED;",
" for (int i = 0; i < S)", // cursor before )
@@ -61,7 +61,7 @@
}
public void test5() throws Exception {
- AnalyzeLibraryResult result = analyzeLibrary("foo", makeCode(
+ AnalyzeLibraryResult result = analyzeLibrary(makeCode(
"ckass Sunflower {",
" static final int SEED_RADIUS = 2;",
" static final int SCALE_FACTOR = 4;",
@@ -73,7 +73,7 @@
}
public void test6() throws Exception {
- AnalyzeLibraryResult result = analyzeLibrary("foo", makeCode(
+ AnalyzeLibraryResult result = analyzeLibrary(makeCode(
"class Sunflower {",
" static final int SEED_RADIUS = 2;",
" static final int SCALE_FACTOR = 4;",
diff --git a/compiler/javatests/com/google/dart/compiler/CompilerTestCase.java b/compiler/javatests/com/google/dart/compiler/CompilerTestCase.java
index d2b4420..9a1cae7 100644
--- a/compiler/javatests/com/google/dart/compiler/CompilerTestCase.java
+++ b/compiler/javatests/com/google/dart/compiler/CompilerTestCase.java
@@ -19,6 +19,7 @@
import com.google.dart.compiler.ast.LibraryUnit;
import com.google.dart.compiler.common.ErrorExpectation;
import com.google.dart.compiler.common.SourceInfo;
+import com.google.dart.compiler.end2end.inc.MemoryLibrarySource;
import com.google.dart.compiler.parser.DartParser;
import com.google.dart.compiler.parser.DartParserRunner;
import com.google.dart.compiler.resolver.Element;
@@ -187,10 +188,9 @@
}
protected AnalyzeLibraryResult analyzeLibrary(String... lines) throws Exception {
- String name = getName();
testSource = makeCode(lines);
- AnalyzeLibraryResult libraryResult = analyzeLibrary(name, testSource);
- testUnit = libraryResult.getLibraryUnitResult().getUnit(name);
+ AnalyzeLibraryResult libraryResult = analyzeLibrary(testSource);
+ testUnit = libraryResult.getLibraryUnitResult().getUnits().iterator().next();
return libraryResult;
}
@@ -199,26 +199,24 @@
* <p>
* <b>Note:</b> if the IDE changes how it calls analyzeLibrary, this should
* be changed to match.
- *
- * @param name the name to use for the source file
* @param code the Dart code to parse/analyze
+ *
* @return an {@link AnalyzeLibraryResult} containing the {@link LibraryUnit}
* and all the errors/warnings generated from the supplied code
* @throws Exception
*/
- protected AnalyzeLibraryResult analyzeLibrary(String name, String code)
+ protected AnalyzeLibraryResult analyzeLibrary(String code)
throws Exception {
AnalyzeLibraryResult result = new AnalyzeLibraryResult();
result.source = code;
// Prepare library.
- MockLibrarySource lib = new MockLibrarySource();
+ MemoryLibrarySource lib = new MemoryLibrarySource("Test.dart");
+ lib.setContent("Test.dart", code);
// Prepare unit.
Map<URI, DartUnit> testUnits = Maps.newHashMap();
{
- DartSource src = new DartSourceTest(name, code, lib);
+ DartSource src = lib.getSourceFor("Test.dart");
DartUnit unit = makeParser(src, code, result).parseUnit();
- // Remember unit.
- lib.addSource(src);
testUnits.put(src.getUri(), unit);
}
DartArtifactProvider provider = new MockArtifactProvider();
diff --git a/compiler/javatests/com/google/dart/compiler/DeltaAnalyzerTest.java b/compiler/javatests/com/google/dart/compiler/DeltaAnalyzerTest.java
index 9924cc8..e4deb24 100644
--- a/compiler/javatests/com/google/dart/compiler/DeltaAnalyzerTest.java
+++ b/compiler/javatests/com/google/dart/compiler/DeltaAnalyzerTest.java
@@ -4,8 +4,10 @@
package com.google.dart.compiler;
+import com.google.common.base.Joiner;
import com.google.dart.compiler.ast.DartUnit;
import com.google.dart.compiler.ast.LibraryUnit;
+import com.google.dart.compiler.end2end.inc.MemoryLibrarySource;
import com.google.dart.compiler.resolver.ClassElement;
import com.google.dart.compiler.resolver.Element;
import com.google.dart.compiler.resolver.LibraryElement;
@@ -13,7 +15,6 @@
import com.google.dart.compiler.testing.TestCompilerConfiguration;
import com.google.dart.compiler.testing.TestCompilerContext;
import com.google.dart.compiler.testing.TestDartArtifactProvider;
-import com.google.dart.compiler.testing.TestLibrarySource;
import com.google.dart.compiler.util.DartSourceString;
import junit.framework.TestCase;
@@ -26,10 +27,13 @@
private final DartArtifactProvider provider = new TestDartArtifactProvider();
public void testNoChangeSingleFile() throws IOException {
- TestLibrarySource librarySource = new TestLibrarySource(getName());
- librarySource.addSource("before.dart",
+ MemoryLibrarySource librarySource = new MemoryLibrarySource("App.dart");
+ librarySource.setContent("App.dart", "library App; part 'before.dart';");
+ librarySource.setContent("before.dart",
+ Joiner.on("\n").join(new String[] {
+ "part of App;",
"class Foo {}",
- "m() {}");
+ "m() {}"}));
DartUnit change = analyzeNoChange(librarySource);
assertEquals(2, change.getTopLevelNodes().size());
ClassElement cls = (ClassElement) change.getTopLevelNodes().get(0).getElement();
@@ -45,12 +49,17 @@
}
public void testNoChangeTwoFiles() throws IOException {
- TestLibrarySource librarySource = new TestLibrarySource(getName());
- librarySource.addSource("before.dart",
+ MemoryLibrarySource librarySource = new MemoryLibrarySource("App.dart");
+ librarySource.setContent("App.dart", "library App; part 'before.dart'; part 'common.dart';");
+ librarySource.setContent("before.dart",
+ Joiner.on("\n").join(new String[] {
+ "part of App;",
"class Foo extends Bar {}",
- "m() {}");
- librarySource.addSource("common.dart",
- "class Bar {}");
+ "m() {}"}));
+ librarySource.setContent("common.dart",
+ Joiner.on("\n").join(new String[] {
+ "part of App;",
+ "class Bar {}"}));
DartUnit change = analyzeNoChange(librarySource);
assertEquals(2, change.getTopLevelNodes().size());
ClassElement cls = (ClassElement) change.getTopLevelNodes().get(0).getElement();
@@ -67,12 +76,14 @@
}
public void testChangeSingleFile() throws IOException {
- TestLibrarySource librarySource = new TestLibrarySource(getName());
- librarySource.addSource("before.dart",
- "class Foo {}",
- "m() {}");
+ MemoryLibrarySource librarySource = new MemoryLibrarySource("App.dart");
+ librarySource.setContent("App.dart", "library App;");
+ librarySource.setContent(
+ "before.dart",
+ Joiner.on("\n").join(new String[] {"part of App;", "class Foo {}", "m() {}"}));
DartSource sourceBefore = librarySource.getSourceFor("before.dart");
- DartSource sourceAfter = new DartSourceString("after.dart", "class Foo {}");
+ DartSource sourceAfter = new DartSourceString("after.dart", Joiner.on("\n").join(
+ new String[] {"part of App;", "class Foo {}", ""}));
DartUnit change = analyze(librarySource, sourceBefore, sourceAfter);
assertEquals(1, change.getTopLevelNodes().size());
Element element = change.getLibrary().getElement().lookupLocalElement("m");
@@ -85,14 +96,19 @@
}
public void testChangeTwoFiles() throws IOException {
- TestLibrarySource librarySource = new TestLibrarySource(getName());
- librarySource.addSource("before.dart",
+ MemoryLibrarySource librarySource = new MemoryLibrarySource("App.dart");
+ librarySource.setContent("App.dart", "library App; part 'before.dart'; part 'common.dart';");
+ librarySource.setContent("before.dart",
+ Joiner.on("\n").join(new String[] {
+ "part of App;",
"class Foo extends Bar {}",
- "m() {}");
- librarySource.addSource("common.dart",
- "class Bar {}");
+ "m() {}"}));
+ librarySource.setContent("common.dart",
+ Joiner.on("\n").join(new String[] {
+ "part of App;",
+ "class Bar {}"}));
DartSource sourceBefore = librarySource.getSourceFor("before.dart");
- DartSource sourceAfter = new DartSourceString("after.dart", "class Foo extends Bar {}");
+ DartSource sourceAfter = new DartSourceString("after.dart", "part of App; class Foo extends Bar {}");
DartUnit change = analyze(librarySource, sourceBefore, sourceAfter);
assertEquals(1, change.getTopLevelNodes().size());
assertNull(change.getLibrary().getElement().lookupLocalElement("m"));
diff --git a/compiler/javatests/com/google/dart/compiler/IdeTest.java b/compiler/javatests/com/google/dart/compiler/IdeTest.java
deleted file mode 100644
index 198a145..0000000
--- a/compiler/javatests/com/google/dart/compiler/IdeTest.java
+++ /dev/null
@@ -1,270 +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.
-
-package com.google.dart.compiler;
-
-import com.google.dart.compiler.ast.DartClass;
-import com.google.dart.compiler.ast.DartExprStmt;
-import com.google.dart.compiler.ast.DartExpression;
-import com.google.dart.compiler.ast.DartIdentifier;
-import com.google.dart.compiler.ast.DartMethodDefinition;
-import com.google.dart.compiler.ast.DartNode;
-import com.google.dart.compiler.ast.DartPropertyAccess;
-import com.google.dart.compiler.ast.DartReturnStatement;
-import com.google.dart.compiler.ast.DartStatement;
-import com.google.dart.compiler.ast.DartUnit;
-import com.google.dart.compiler.ast.DartUnqualifiedInvocation;
-import com.google.dart.compiler.ast.LibraryUnit;
-import com.google.dart.compiler.resolver.ClassElement;
-import com.google.dart.compiler.resolver.CoreTypeProvider;
-import com.google.dart.compiler.resolver.CoreTypeProviderImplementation;
-import com.google.dart.compiler.resolver.Element;
-import com.google.dart.compiler.resolver.FieldElement;
-import com.google.dart.compiler.resolver.MethodElement;
-import com.google.dart.compiler.resolver.Scope;
-import com.google.dart.compiler.testing.TestCompilerConfiguration;
-import com.google.dart.compiler.testing.TestCompilerContext;
-import com.google.dart.compiler.testing.TestCompilerContext.EventKind;
-import com.google.dart.compiler.testing.TestDartArtifactProvider;
-import com.google.dart.compiler.testing.TestLibrarySource;
-import com.google.dart.compiler.type.FunctionType;
-import com.google.dart.compiler.type.InterfaceType;
-import com.google.dart.compiler.type.Type;
-import com.google.dart.compiler.type.TypeAnalyzer;
-
-import junit.framework.TestCase;
-
-import java.io.IOException;
-
-/**
- * Test of the IDE API in DartCompiler.
- */
-public class IdeTest extends TestCase {
-
- private final TestCompilerContext context = new TestCompilerContext(EventKind.ERROR,
- EventKind.TYPE_ERROR) {
- @Override
- protected void handleEvent(DartCompilationError event, EventKind kind) {
- super.handleEvent(event, kind);
- // For debugging:
- // System.err.println(event);
- }
- };
-
- private final DartCompilerListener listener = context;
-
- private final DartArtifactProvider provider = new TestDartArtifactProvider();
-
- private final CompilerConfiguration config = new TestCompilerConfiguration();
-
- public void testAnalyseNoSemicolonPropertyAccess() {
- DartUnit unit =
- analyzeUnit(
- "no_semicolon_property_access",
- "class Foo {",
- " int i;",
- " void foo() {",
- " i.y", // Missing semicolon.
- " }",
- "}");
- assertEquals("errorCount", 1, context.getErrorCount()); // Missing semicolon.
- assertEquals("typeErrorCount", 1, context.getTypeErrorCount()); // No member named "y".
- DartExprStmt statement = (DartExprStmt) firstStatementOfMethod(unit, "Foo", "foo");
- FieldElement element = (FieldElement) qualifierElement(statement.getExpression());
- assertEquals("int", element.getType().getElement().getName());
- }
-
- public void testAnalyseNoSemicolonBrokenPropertyAccess() {
- DartUnit unit =
- analyzeUnit(
- "no_semicolon_broken_property_access",
- "class Foo {",
- " int i;",
- " void foo() {",
- " i.", // Syntax error and missing semicolon.
- " }",
- "}");
- // Expected identifier and missing semicolon
- assertEquals("errorCount", 2, context.getErrorCount());
- assertEquals("typeErrorCount", 1, context.getTypeErrorCount()); // No member named "".
- DartExprStmt statement = (DartExprStmt) firstStatementOfMethod(unit, "Foo", "foo");
- FieldElement element = (FieldElement) qualifierElement(statement.getExpression());
- assertEquals("int", element.getType().getElement().getName());
- }
-
- public void testAnalyseBrokenPropertyAccess() {
- DartUnit unit =
- analyzeUnit(
- "broken_property_access",
- "class Foo {",
- " int i;",
- " void foo() {",
- " i.;", // Syntax error here.
- " }",
- "}");
- assertEquals("errorCount", 1, context.getErrorCount()); // Expected identifier.
- assertEquals("typeErrorCount", 1, context.getTypeErrorCount()); // No member named "".
- DartExprStmt statement = (DartExprStmt) firstStatementOfMethod(unit, "Foo", "foo");
- FieldElement element = (FieldElement) qualifierElement(statement.getExpression());
- assertEquals("int", element.getType().getElement().getName());
- }
-
- public void testAnalyseNoSemicolonIdentifier() {
- DartUnit unit =
- analyzeUnit(
- "no_semicolon_identifier",
- "class Foo {",
- " int i;",
- " void foo() {",
- " i", // Missing semicolon.
- " }",
- "}");
- assertEquals("errorCount", 1, context.getErrorCount()); // Missing semicolon.
- assertEquals("typeErrorCount", 0, context.getTypeErrorCount());
- DartExprStmt statement = (DartExprStmt) firstStatementOfMethod(unit, "Foo", "foo");
- FieldElement field = (FieldElement) targetElement(statement.getExpression());
- assertEquals("int", field.getType().getElement().getName());
- }
-
- public void testAnalyseNoSemicolonMethodCall() {
- DartUnit unit =
- analyzeUnit(
- "no_semicolon_method_call",
- "class Foo {",
- " int i () { return 0; }",
- " void foo() {",
- " i()", // Missing semicolon.
- " }",
- "}");
- assertEquals("errorCount", 1, context.getErrorCount()); // Missing semicolon.
- assertEquals("typeErrorCount", 0, context.getTypeErrorCount());
- DartExprStmt statement = (DartExprStmt) firstStatementOfMethod(unit, "Foo", "foo");
- DartExpression expression = statement.getExpression();
- DartUnqualifiedInvocation invocation = (DartUnqualifiedInvocation) expression;
- MethodElement method = (MethodElement) targetElement(invocation.getTarget());
- assertEquals("i", method.getName());
- FunctionType type = (FunctionType) method.getType();
- assertEquals("int", type.getReturnType().getElement().getName());
- }
-
- public void testAnalyseVoidKeyword() {
- DartUnit unit =
- analyzeUnit(
- "void_keyword",
- "class Foo {",
- " Function voidFunction;",
- " void foo() {",
- " void", // Missing semicolon and keyword
- " }",
- "}");
- // Expected identifier and missing semicolon.
- assertEquals("errorCount", 2, context.getErrorCount());
- // You can't use 'void' as a member name. It might be the beginning of a variable declaration
- // so it isn't an error in and of itself.
- assertEquals("typeErrorCount", 0, context.getTypeErrorCount());
- DartExprStmt statement = (DartExprStmt) firstStatementOfMethod(unit, "Foo", "foo");
- DartIdentifier expression = (DartIdentifier) statement.getExpression();
- assertEquals("", expression.getName());
- }
-
- public void testAnalyseVoidKeywordPropertyAccess() {
- DartUnit unit =
- analyzeUnit(
- "void_keyword_property_access",
- "class Foo {",
- " Function voidFunction;",
- " void foo() {",
- " this.void", // Missing semicolon and keyword
- " }",
- "}");
- // Expected identifier and missing semicolon.
- assertEquals("errorCount", 2, context.getErrorCount());
- assertEquals("typeErrorCount", 1, context.getTypeErrorCount());
- DartExprStmt statement = (DartExprStmt) firstStatementOfMethod(unit, "Foo", "foo");
- DartPropertyAccess expression = (DartPropertyAccess) statement.getExpression();
- assertEquals("", expression.getPropertyName());
- }
-
- public void testReturnIntTypeAnalysis() {
- DartUnit unit =
- analyzeUnit(
- "return_int_type_analysis",
- "class Foo {",
- " int i;",
- " int foo() {",
- " return i;",
- " }",
- "}");
- Scope unitScope = unit.getLibrary().getElement().getScope();
- CoreTypeProvider typeProvider = new CoreTypeProviderImplementation(unitScope, context);
- DartClass classNode = getClassOfUnit(unit, "Foo");
- DartReturnStatement rtnStmt = (DartReturnStatement) firstStatementOfMethod(unit, "Foo", "foo");
- ClassElement classElement = classNode.getElement();
- InterfaceType definingType = classElement.getType();
- Type type = TypeAnalyzer.analyze(rtnStmt.getValue(), typeProvider, context, definingType);
- assertNotNull(type);
- assertEquals("int", type.getElement().getName());
- }
-
- private Element targetElement(DartExpression expression) {
- DartIdentifier identifier = (DartIdentifier) expression;
- Element element = identifier.getElement();
- assertNotNull(element);
- return element;
- }
-
- private Element qualifierElement(DartExpression node) {
- DartPropertyAccess propertyAccess = (DartPropertyAccess) node;
- DartIdentifier identifier = (DartIdentifier) propertyAccess.getQualifier();
- Element element = identifier.getElement();
- assertNotNull(element);
- return element;
- }
-
- private DartClass getClassOfUnit(DartUnit unit, String cls) {
- DartClass dartClass = null;
- for (DartNode node : unit.getTopLevelNodes()) {
- DartClass classNode = (DartClass) node;
- if (node instanceof DartClass) {
- if (classNode.getName().getName().equals(cls)) {
- dartClass = classNode;
- }
- }
- }
- assertNotNull(dartClass);
- return dartClass;
- }
-
- private DartStatement firstStatementOfMethod(DartUnit unit, String cls, String member) {
- DartClass classNode = getClassOfUnit(unit, cls);
- for (DartNode memberNode : classNode.getMembers()) {
- if (memberNode instanceof DartMethodDefinition) {
- DartMethodDefinition methodNode = (DartMethodDefinition) memberNode;
- if (methodNode.getName() instanceof DartIdentifier) {
- DartIdentifier methodName = (DartIdentifier) methodNode.getName();
- if (methodName.getName().equals(member)) {
- return methodNode.getFunction().getBody().getStatements().get(0);
- }
- }
- }
- }
- fail();
- return null;
- }
-
- private DartUnit analyzeUnit(String name, String... sourceLines) throws AssertionError {
- TestLibrarySource lib = new TestLibrarySource(name);
- lib.addSource(name + ".dart", sourceLines);
- LibraryUnit libraryUnit;
- try {
- libraryUnit = DartCompiler.analyzeLibrary(lib, null, config, provider, listener);
- assertNotNull("libraryUnit == null", libraryUnit);
- } catch (IOException e) {
- throw new AssertionError(e);
- }
- DartUnit unit = libraryUnit.getUnit(name + ".dart");
- assertNotNull("unit == null", unit);
- return unit;
- }
-}
diff --git a/compiler/javatests/com/google/dart/compiler/IdeTests.java b/compiler/javatests/com/google/dart/compiler/IdeTests.java
deleted file mode 100644
index 3e03e56..0000000
--- a/compiler/javatests/com/google/dart/compiler/IdeTests.java
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-package com.google.dart.compiler;
-
-import junit.extensions.TestSetup;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-public class IdeTests extends TestSetup {
-
- public IdeTests(Test test) {
- super(test);
- }
-
- public static Test suite() {
- TestSuite suite = new TestSuite("IDE/dartc integration test suite.");
- suite.addTestSuite(IdeTest.class);
- suite.addTestSuite(DeltaAnalyzerTest.class);
- suite.addTestSuite(CodeCompletionParseTest.class);
- return suite;
- }
-}
diff --git a/compiler/javatests/com/google/dart/compiler/end2end/inc/IncrementalCompilation2Test.java b/compiler/javatests/com/google/dart/compiler/end2end/inc/IncrementalCompilation2Test.java
index 9b1c945..eb13e61 100644
--- a/compiler/javatests/com/google/dart/compiler/end2end/inc/IncrementalCompilation2Test.java
+++ b/compiler/javatests/com/google/dart/compiler/end2end/inc/IncrementalCompilation2Test.java
@@ -91,9 +91,9 @@
"part 'B.dart';",
"part 'C.dart';",
""));
- appSource.setContent("A.dart", "");
- appSource.setContent("B.dart", "");
- appSource.setContent("C.dart", "");
+ appSource.setContent("A.dart", "part of application;");
+ appSource.setContent("B.dart", "part of application;");
+ appSource.setContent("C.dart", "part of application;");
}
@Override
@@ -114,6 +114,7 @@
"B.dart",
makeCode(
"// filler filler filler filler filler filler filler filler filler filler filler",
+ "part of application;",
"class A {",
" int not_hole;",
"}",
@@ -122,6 +123,7 @@
"C.dart",
makeCode(
"// filler filler filler filler filler filler filler filler filler filler filler",
+ "part of application;",
"class B extends A {",
" int bar() {",
" return super.not_hole;", // qualified reference
@@ -135,6 +137,7 @@
"A.dart",
makeCode(
"// filler filler filler filler filler filler filler filler filler filler filler",
+ "part of application;",
"int not_hole;",
""));
compile();
@@ -157,6 +160,7 @@
"B.dart",
makeCode(
"// filler filler filler filler filler filler filler filler filler filler filler",
+ "part of application;",
"class A {",
" int foo() {",
" return hole;", // no such field
@@ -164,12 +168,13 @@
"}",
""));
compile();
- assertErrors(errors, errEx(TypeErrorCode.CANNOT_BE_RESOLVED, 4, 12, 4));
+ assertErrors(errors, errEx(TypeErrorCode.CANNOT_BE_RESOLVED, 5, 12, 4));
// Update units and compile.
appSource.setContent(
"A.dart",
makeCode(
"// filler filler filler filler filler filler filler filler filler filler filler",
+ "part of application;",
"int hole;",
""));
compile();
@@ -190,6 +195,7 @@
"B.dart",
makeCode(
"// filler filler filler filler filler filler filler filler filler filler filler",
+ "part of application;",
"class A {",
" foo() {}",
"}",
@@ -198,6 +204,7 @@
"C.dart",
makeCode(
"// filler filler filler filler filler filler filler filler filler filler filler",
+ "part of application;",
"class B extends A {",
" int bar() {",
" foo();", // unqualified invocation
@@ -212,6 +219,7 @@
"A.dart",
makeCode(
"// filler filler filler filler filler filler filler filler filler filler filler",
+ "part of application;",
"foo() {}",
""));
compile();
@@ -226,7 +234,7 @@
Thread.sleep(5);
// Remove top-level foo(), so invocation of foo() in B should be bound to the super class.
{
- appSource.setContent("A.dart", "");
+ appSource.setContent("A.dart", "part of application;");
compile();
// B should be compiled because it also declares foo(), so produces "shadow" conflict.
// C should be compiled because it has unqualified invocation which was declared in A.
@@ -245,6 +253,7 @@
"B.dart",
makeCode(
"// filler filler filler filler filler filler filler filler filler filler filler",
+ "part of application;",
"class A {",
" foo() {}",
"}",
@@ -253,6 +262,7 @@
"C.dart",
makeCode(
"// filler filler filler filler filler filler filler filler filler filler filler",
+ "part of application;",
"class B extends A {",
" int bar() {",
" super.foo();", // qualified invocation
@@ -267,6 +277,7 @@
"A.dart",
makeCode(
"// filler filler filler filler filler filler filler filler filler filler filler",
+ "part of application;",
"foo() {}",
""));
compile();
@@ -288,6 +299,7 @@
"B.dart",
makeCode(
"// filler filler filler filler filler filler filler filler filler filler filler",
+ "part of application;",
"class A {",
" var foo;",
"}",
@@ -296,6 +308,7 @@
"C.dart",
makeCode(
"// filler filler filler filler filler filler filler filler filler filler filler",
+ "part of application;",
"class B extends A {",
" int bar() {",
" foo = 0;", // unqualified access
@@ -310,6 +323,7 @@
"A.dart",
makeCode(
"// filler filler filler filler filler filler filler filler filler filler filler",
+ "part of application;",
"var foo;",
""));
compile();
@@ -324,7 +338,7 @@
Thread.sleep(5);
// Remove top-level "foo", so access to "foo" in B should be bound to the super class.
{
- appSource.setContent("A.dart", "");
+ appSource.setContent("A.dart", "part of application;");
compile();
// B should be compiled because it also declares "foo", so produces "shadow" conflict.
// C should be compiled because it has unqualified access which was declared in A.
@@ -343,6 +357,7 @@
"B.dart",
makeCode(
"// filler filler filler filler filler filler filler filler filler filler filler",
+ "part of application;",
"class A {",
" var foo;",
"}",
@@ -351,6 +366,7 @@
"C.dart",
makeCode(
"// filler filler filler filler filler filler filler filler filler filler filler",
+ "part of application;",
"class B extends A {",
" int bar() {",
" super.foo = 0;", // qualified access
@@ -365,6 +381,7 @@
"A.dart",
makeCode(
"// filler filler filler filler filler filler filler filler filler filler filler",
+ "part of application;",
"var foo;",
""));
compile();
@@ -382,6 +399,7 @@
"B.dart",
makeCode(
"// filler filler filler filler filler filler filler filler filler filler filler",
+ "part of application;",
"methodB() {",
" var symbolDependency_foo;",
"}"));
@@ -392,6 +410,7 @@
"A.dart",
makeCode(
"// filler filler filler filler filler filler filler filler filler filler filler",
+ "part of application;",
"var symbolDependency_foo;"));
compile();
// Now there is top-level declarations conflict between A and B.
@@ -406,17 +425,19 @@
"A.dart",
makeCode(
"// filler filler filler filler filler filler filler filler filler filler filler",
+ "part of application;",
"var duplicate;"));
appSource.setContent(
"B.dart",
makeCode(
"// filler filler filler filler filler filler filler filler filler filler filler",
+ "part of application;",
"bar() {",
" var duplicate;",
"}"));
compile();
// Update units and compile.
- appSource.setContent("A.dart", "");
+ appSource.setContent("A.dart", "part of application;");
compile();
// Top-level declaration in A was removed, so no conflict.
// So:
@@ -434,11 +455,13 @@
"A.dart",
makeCode(
"// filler filler filler filler filler filler filler filler filler filler filler",
+ "part of application;",
"var duplicate;"));
appSource.setContent(
"B.dart",
makeCode(
"// filler filler filler filler filler filler filler filler filler filler filler",
+ "part of application;",
"bar() {",
" var duplicate;",
"}"));
@@ -465,6 +488,7 @@
"A.dart",
makeCode(
"// filler filler filler filler filler filler filler filler filler filler filler",
+ "part of application;",
"class A {",
"}",
""));
@@ -472,6 +496,7 @@
"B.dart",
makeCode(
"// filler filler filler filler filler filler filler filler filler filler filler",
+ "part of application;",
"class B extends A {",
" foo() {",
" var bar;",
@@ -485,6 +510,7 @@
"A.dart",
makeCode(
"// filler filler filler filler filler filler filler filler filler filler filler",
+ "part of application;",
"class A {",
" var bar;",
"}",
@@ -500,6 +526,7 @@
"A.dart",
makeCode(
"// filler filler filler filler filler filler filler filler filler filler filler",
+ "part of application;",
"var conflict;",
""));
compile();
@@ -509,6 +536,7 @@
"B.dart",
makeCode(
"// filler filler filler filler filler filler filler filler filler filler filler",
+ "part of application;",
"var conflict;",
""));
compile();
@@ -516,8 +544,8 @@
// Both A and B have errors.
assertErrors(
errors,
- errEx("A.dart", ResolverErrorCode.DUPLICATE_TOP_LEVEL_DECLARATION, 2, 5, 8),
- errEx("B.dart", ResolverErrorCode.DUPLICATE_TOP_LEVEL_DECLARATION, 2, 5, 8));
+ errEx("A.dart", ResolverErrorCode.DUPLICATE_TOP_LEVEL_DECLARATION, 3, 5, 8),
+ errEx("B.dart", ResolverErrorCode.DUPLICATE_TOP_LEVEL_DECLARATION, 3, 5, 8));
}
/**
@@ -797,6 +825,7 @@
"A.dart",
makeCode(
"// filler filler filler filler filler filler filler filler filler filler filler",
+ "part of application;",
""));
appSource.setContent(
APP,
@@ -936,40 +965,6 @@
errEx(ResolverErrorCode.CANNOT_ACCESS_METHOD, 6, 5, 7),
errEx(ResolverErrorCode.CANNOT_ACCESS_METHOD, 9, 11, 7));
}
-
- /**
- * When we resolve factory constructors, we should check if "lib" is library prefix, it is not
- * always have to be name of type.
- * <p>
- * http://code.google.com/p/dart/issues/detail?id=2478
- */
- public void test_factoryClass_fromPrefixImportedLibrary() throws Exception {
- appSource.setContent(
- "A.dart",
- makeCode(
- "// filler filler filler filler filler filler filler filler filler filler filler",
- "library A;",
- "import '" + APP + "';",
- "interface I default A {",
- " I();",
- " I.named();",
- "}",
- ""));
- appSource.setContent(
- APP,
- makeCode(
- "// filler filler filler filler filler filler filler filler filler filler filler",
- "library application;",
- "import 'A.dart' as lib;",
- "class A {",
- " factory lib.I() {}",
- " factory lib.I.named() {}",
- "}",
- ""));
- // do compile, no errors expected
- compile();
- assertErrors(errors);
- }
/**
* <p>
@@ -1478,6 +1473,97 @@
}
/**
+ * Part should have one and only one directive - "part of".
+ */
+ public void test_partDirectives_otherThenPartOf() throws Exception {
+ appSource.setContent(
+ "A.dart",
+ makeCode(
+ "// filler filler filler filler filler filler filler filler filler filler filler",
+ "library A;",
+ ""));
+ appSource.setContent(
+ APP,
+ makeCode(
+ "// filler filler filler filler filler filler filler filler filler filler filler",
+ "library application;",
+ "part 'A.dart';",
+ ""));
+ // do compile
+ compile();
+ assertErrors(errors, errEx(DartCompilerErrorCode.ILLEGAL_DIRECTIVES_IN_SOURCED_UNIT, 2, 1, 10));
+ }
+
+ /**
+ * Part should have one and only one directive - "part of".
+ */
+ public void test_partDirectives_otherThenPartOf2() throws Exception {
+ appSource.setContent(
+ "A.dart",
+ makeCode(
+ "// filler filler filler filler filler filler filler filler filler filler filler",
+ "part of application;",
+ "part 'A.dart';",
+ ""));
+ appSource.setContent(
+ APP,
+ makeCode(
+ "// filler filler filler filler filler filler filler filler filler filler filler",
+ "library application;",
+ "part 'A.dart';",
+ ""));
+ // do compile
+ compile();
+ assertErrors(errors, errEx(DartCompilerErrorCode.ILLEGAL_DIRECTIVES_IN_SOURCED_UNIT, 2, 1, 20));
+ }
+
+ /**
+ * Part should have one and only one directive - "part of".
+ */
+ public void test_partDirectives_noPartOf() throws Exception {
+ appSource.setContent(
+ "A.dart",
+ makeCode(
+ "// filler filler filler filler filler filler filler filler filler filler filler",
+ ""));
+ appSource.setContent(
+ APP,
+ makeCode(
+ "// filler filler filler filler filler filler filler filler filler filler filler",
+ "library application;",
+ "part 'A.dart';",
+ ""));
+ // do compile
+ compile();
+ assertErrors(errors, errEx(DartCompilerErrorCode.MISSING_PART_OF_DIRECTIVE, -1, -1, 0));
+ }
+
+ /**
+ * Part should have one and only one directive - "part of".
+ */
+ public void test_partDirectives_wrongNameInPartOf() throws Exception {
+ appSource.setContent(
+ "A.dart",
+ makeCode(
+ "// filler filler filler filler filler filler filler filler filler filler filler",
+ "part of Z;",
+ ""));
+ appSource.setContent(
+ APP,
+ makeCode(
+ "// filler filler filler filler filler filler filler filler filler filler filler",
+ "library application;",
+ "part 'A.dart';",
+ ""));
+ // do compile
+ compile();
+ assertErrors(
+ errors,
+ errEx(DartCompilerErrorCode.WRONG_PART_OF_NAME, 2, 1, 10),
+ errEx(TypeErrorCode.CANNOT_BE_RESOLVED, 2, 9, 1));
+ }
+
+ /**
* Internals of Dart use "dart-ext:" import scheme, and these libraries are allowed to use
* "native". New import syntax.
*/
@@ -1496,7 +1582,7 @@
compile();
assertErrors(errors);
}
-
+
/**
* Internals of Dart use "dart-ext:" import scheme, and these libraries are allowed to use
* "native". Obsolete import syntax.
diff --git a/compiler/javatests/com/google/dart/compiler/end2end/inc/IncrementalCompilationTest.java b/compiler/javatests/com/google/dart/compiler/end2end/inc/IncrementalCompilationTest.java
index 9e36610..ea7e9e1 100644
--- a/compiler/javatests/com/google/dart/compiler/end2end/inc/IncrementalCompilationTest.java
+++ b/compiler/javatests/com/google/dart/compiler/end2end/inc/IncrementalCompilationTest.java
@@ -17,6 +17,7 @@
import com.google.dart.compiler.MockArtifactProvider;
import com.google.dart.compiler.MockBundleLibrarySource;
import com.google.dart.compiler.Source;
+import com.google.dart.compiler.util.apache.StringUtils;
import junit.framework.AssertionFailedError;
@@ -104,6 +105,7 @@
public void testFullCompile() {
compile();
+ System.out.println(StringUtils.join(errors, "\n"));
// Assert that all artifacts are written.
didWrite("someimpl.dart", EXTENSION_TIMESTAMP);
diff --git a/compiler/javatests/com/google/dart/compiler/end2end/inc/MemoryLibrarySource.java b/compiler/javatests/com/google/dart/compiler/end2end/inc/MemoryLibrarySource.java
index a2fd2c4..e31466f 100644
--- a/compiler/javatests/com/google/dart/compiler/end2end/inc/MemoryLibrarySource.java
+++ b/compiler/javatests/com/google/dart/compiler/end2end/inc/MemoryLibrarySource.java
@@ -22,17 +22,20 @@
public class MemoryLibrarySource implements LibrarySource {
public static final String IO_EXCEPTION_CONTENT = "simulate-IOException";
private final String libName;
+ private final Map<String, DartSource> sourceMap;
private final Map<String, String> sourceContentMap;
private final Map<String, Long> sourceLastModifiedMap;
public MemoryLibrarySource(String libName) {
this.libName = libName;
+ sourceMap = Maps.newHashMap();
sourceContentMap = Maps.newHashMap();
sourceLastModifiedMap = Maps.newHashMap();
}
private MemoryLibrarySource(String libName, MemoryLibrarySource parent) {
this.libName = libName;
+ sourceMap = parent.sourceMap;
sourceContentMap = parent.sourceContentMap;
sourceLastModifiedMap = parent.sourceLastModifiedMap;
}
@@ -75,17 +78,33 @@
}
@Override
- public LibrarySource getImportFor(final String relPath) throws IOException {
+ public LibrarySource getImportFor(String relPath) throws IOException {
+ if (!sourceContentMap.containsKey(relPath)) {
+ return null;
+ }
return new MemoryLibrarySource(relPath, this);
}
@Override
public DartSource getSourceFor(final String relPath) {
+ DartSource result;
+ // check cache
+ {
+ result = sourceMap.get(relPath);
+ if (result != null) {
+ return result;
+ }
+ }
+ // prepare content
final String content = sourceContentMap.get(relPath);
final Long sourceLastModified = sourceLastModifiedMap.get(relPath);
+ // may be does not exist
+ if (content == null) {
+ return null;
+ }
// Return fake UrlDateSource with in-memory content.
final URI uri = URI.create(relPath);
- return new UrlDartSource(uri, relPath, this) {
+ result = new UrlDartSource(uri, relPath, this) {
@Override
public String getName() {
return relPath;
@@ -111,12 +130,15 @@
return new StringReader(content);
}
};
+ sourceMap.put(relPath, result);
+ return result;
}
/**
* Sets the given content for the source.
*/
public void setContent(String relPath, String content) {
+ sourceMap.remove(relPath);
sourceContentMap.put(relPath, content);
sourceLastModifiedMap.put(relPath, System.currentTimeMillis());
}
diff --git a/compiler/javatests/com/google/dart/compiler/end2end/inc/my.app.dart b/compiler/javatests/com/google/dart/compiler/end2end/inc/my.app.dart
index a905502..15aca3f 100644
--- a/compiler/javatests/com/google/dart/compiler/end2end/inc/my.app.dart
+++ b/compiler/javatests/com/google/dart/compiler/end2end/inc/my.app.dart
@@ -1,6 +1,7 @@
// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+library myApp;
import "some.lib.dart";
part "my.dart";
diff --git a/compiler/javatests/com/google/dart/compiler/end2end/inc/my.dart b/compiler/javatests/com/google/dart/compiler/end2end/inc/my.dart
index 37619d8..f123883 100644
--- a/compiler/javatests/com/google/dart/compiler/end2end/inc/my.dart
+++ b/compiler/javatests/com/google/dart/compiler/end2end/inc/my.dart
@@ -1,6 +1,7 @@
// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+part of myApp;
var x = 0, y = 1;
void fn() { /* ... */ }
diff --git a/compiler/javatests/com/google/dart/compiler/end2end/inc/my.merged.app.dart b/compiler/javatests/com/google/dart/compiler/end2end/inc/my.merged.app.dart
index 4a4edf8..afe2335 100644
--- a/compiler/javatests/com/google/dart/compiler/end2end/inc/my.merged.app.dart
+++ b/compiler/javatests/com/google/dart/compiler/end2end/inc/my.merged.app.dart
@@ -1,6 +1,7 @@
// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+library myApp;
import "some.lib.dart";
part "my.dart";
diff --git a/compiler/javatests/com/google/dart/compiler/end2end/inc/my.no5ref.dart b/compiler/javatests/com/google/dart/compiler/end2end/inc/my.no5ref.dart
index 3feac3f..a35149c 100644
--- a/compiler/javatests/com/google/dart/compiler/end2end/inc/my.no5ref.dart
+++ b/compiler/javatests/com/google/dart/compiler/end2end/inc/my.no5ref.dart
@@ -1,6 +1,7 @@
// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+part of myApp;
class Spoo<T> {
Spoo() { }
diff --git a/compiler/javatests/com/google/dart/compiler/end2end/inc/my.nuke5.app.dart b/compiler/javatests/com/google/dart/compiler/end2end/inc/my.nuke5.app.dart
index 113bab8..6d50f3c 100644
--- a/compiler/javatests/com/google/dart/compiler/end2end/inc/my.nuke5.app.dart
+++ b/compiler/javatests/com/google/dart/compiler/end2end/inc/my.nuke5.app.dart
@@ -1,6 +1,7 @@
// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+library myApp;
import "some.lib.dart";
part "my.dart";
diff --git a/compiler/javatests/com/google/dart/compiler/end2end/inc/my.prefixed.app.dart b/compiler/javatests/com/google/dart/compiler/end2end/inc/my.prefixed.app.dart
index 0028c36..e5958dc 100644
--- a/compiler/javatests/com/google/dart/compiler/end2end/inc/my.prefixed.app.dart
+++ b/compiler/javatests/com/google/dart/compiler/end2end/inc/my.prefixed.app.dart
@@ -1,6 +1,7 @@
// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+library myAppPref;
import "some.prefixable.lib.dart" as prefix;
diff --git a/compiler/javatests/com/google/dart/compiler/end2end/inc/my.unprefixed.app.dart b/compiler/javatests/com/google/dart/compiler/end2end/inc/my.unprefixed.app.dart
index b34d3fe..7b36d57 100644
--- a/compiler/javatests/com/google/dart/compiler/end2end/inc/my.unprefixed.app.dart
+++ b/compiler/javatests/com/google/dart/compiler/end2end/inc/my.unprefixed.app.dart
@@ -1,6 +1,7 @@
// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+library myAppUnPref;
import "some.prefixable.lib.dart";
diff --git a/compiler/javatests/com/google/dart/compiler/end2end/inc/mybase.dart b/compiler/javatests/com/google/dart/compiler/end2end/inc/mybase.dart
index 80a3045..f10a5cf 100644
--- a/compiler/javatests/com/google/dart/compiler/end2end/inc/mybase.dart
+++ b/compiler/javatests/com/google/dart/compiler/end2end/inc/mybase.dart
@@ -1,6 +1,7 @@
// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+part of myApp;
class QualifierBase {
Other5 other5;
diff --git a/compiler/javatests/com/google/dart/compiler/end2end/inc/mybase.no5ref.dart b/compiler/javatests/com/google/dart/compiler/end2end/inc/mybase.no5ref.dart
index 53d5a3a..ff7209d 100644
--- a/compiler/javatests/com/google/dart/compiler/end2end/inc/mybase.no5ref.dart
+++ b/compiler/javatests/com/google/dart/compiler/end2end/inc/mybase.no5ref.dart
@@ -1,6 +1,7 @@
// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+part of myApp;
class QualifierBase {
Other6 other6;
diff --git a/compiler/javatests/com/google/dart/compiler/end2end/inc/myother0.dart b/compiler/javatests/com/google/dart/compiler/end2end/inc/myother0.dart
index 0d184ca..cb6e48b 100644
--- a/compiler/javatests/com/google/dart/compiler/end2end/inc/myother0.dart
+++ b/compiler/javatests/com/google/dart/compiler/end2end/inc/myother0.dart
@@ -1,6 +1,7 @@
// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+part of myApp;
class Other0 {
static int value() { return 42; }
diff --git a/compiler/javatests/com/google/dart/compiler/end2end/inc/myother0.fillthehole.dart b/compiler/javatests/com/google/dart/compiler/end2end/inc/myother0.fillthehole.dart
index 26c4290..d0f572a 100644
--- a/compiler/javatests/com/google/dart/compiler/end2end/inc/myother0.fillthehole.dart
+++ b/compiler/javatests/com/google/dart/compiler/end2end/inc/myother0.fillthehole.dart
@@ -1,6 +1,7 @@
// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+part of myApp;
class Other0 {
static int value() { return 42; }
diff --git a/compiler/javatests/com/google/dart/compiler/end2end/inc/myother0.fillthemethodhole.dart b/compiler/javatests/com/google/dart/compiler/end2end/inc/myother0.fillthemethodhole.dart
index 324c0b0..b9a35c8 100644
--- a/compiler/javatests/com/google/dart/compiler/end2end/inc/myother0.fillthemethodhole.dart
+++ b/compiler/javatests/com/google/dart/compiler/end2end/inc/myother0.fillthemethodhole.dart
@@ -1,6 +1,7 @@
// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+part of myApp;
class Other0 {
static int value() { return 42; }
diff --git a/compiler/javatests/com/google/dart/compiler/end2end/inc/myother0.fillthenothole.dart b/compiler/javatests/com/google/dart/compiler/end2end/inc/myother0.fillthenothole.dart
index 4831e5c..005d4a9 100644
--- a/compiler/javatests/com/google/dart/compiler/end2end/inc/myother0.fillthenothole.dart
+++ b/compiler/javatests/com/google/dart/compiler/end2end/inc/myother0.fillthenothole.dart
@@ -1,6 +1,7 @@
// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+part of myApp;
class Other0 {
static int value() { return 42; }
diff --git a/compiler/javatests/com/google/dart/compiler/end2end/inc/myother0.globalfunctionchange.dart b/compiler/javatests/com/google/dart/compiler/end2end/inc/myother0.globalfunctionchange.dart
index 02b894e..c0377a3 100644
--- a/compiler/javatests/com/google/dart/compiler/end2end/inc/myother0.globalfunctionchange.dart
+++ b/compiler/javatests/com/google/dart/compiler/end2end/inc/myother0.globalfunctionchange.dart
@@ -1,6 +1,7 @@
// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+part of myApp;
class Other0 {
static int value() { return 42; }
diff --git a/compiler/javatests/com/google/dart/compiler/end2end/inc/myother0.globalvarchange.dart b/compiler/javatests/com/google/dart/compiler/end2end/inc/myother0.globalvarchange.dart
index ae829c2..ad04968 100644
--- a/compiler/javatests/com/google/dart/compiler/end2end/inc/myother0.globalvarchange.dart
+++ b/compiler/javatests/com/google/dart/compiler/end2end/inc/myother0.globalvarchange.dart
@@ -1,6 +1,7 @@
// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+part of myApp;
class Other0 {
static int value() { return 42; }
diff --git a/compiler/javatests/com/google/dart/compiler/end2end/inc/myother0.newstaticmethod.dart b/compiler/javatests/com/google/dart/compiler/end2end/inc/myother0.newstaticmethod.dart
index bfb73e4..628c947 100644
--- a/compiler/javatests/com/google/dart/compiler/end2end/inc/myother0.newstaticmethod.dart
+++ b/compiler/javatests/com/google/dart/compiler/end2end/inc/myother0.newstaticmethod.dart
@@ -1,6 +1,7 @@
// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+part of myApp;
class Other0 {
static int value() { return 42; }
diff --git a/compiler/javatests/com/google/dart/compiler/end2end/inc/myother0.returntypechange.dart b/compiler/javatests/com/google/dart/compiler/end2end/inc/myother0.returntypechange.dart
index ddd35cb..aa88248 100644
--- a/compiler/javatests/com/google/dart/compiler/end2end/inc/myother0.returntypechange.dart
+++ b/compiler/javatests/com/google/dart/compiler/end2end/inc/myother0.returntypechange.dart
@@ -1,6 +1,7 @@
// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+part of myApp;
class Other0 {
static int value() { return 42; }
diff --git a/compiler/javatests/com/google/dart/compiler/end2end/inc/myother1.change.dart b/compiler/javatests/com/google/dart/compiler/end2end/inc/myother1.change.dart
index 670f9d7..dbe9acd 100644
--- a/compiler/javatests/com/google/dart/compiler/end2end/inc/myother1.change.dart
+++ b/compiler/javatests/com/google/dart/compiler/end2end/inc/myother1.change.dart
@@ -1,6 +1,7 @@
// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+part of myApp;
class Other1 {
static Function FN;
diff --git a/compiler/javatests/com/google/dart/compiler/end2end/inc/myother1.dart b/compiler/javatests/com/google/dart/compiler/end2end/inc/myother1.dart
index 831dc03..cba3e1e 100644
--- a/compiler/javatests/com/google/dart/compiler/end2end/inc/myother1.dart
+++ b/compiler/javatests/com/google/dart/compiler/end2end/inc/myother1.dart
@@ -1,7 +1,7 @@
// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-
+part of myApp;
class Other1 {
diff --git a/compiler/javatests/com/google/dart/compiler/end2end/inc/myother2.change.dart b/compiler/javatests/com/google/dart/compiler/end2end/inc/myother2.change.dart
index 287a13b..f861bbc 100644
--- a/compiler/javatests/com/google/dart/compiler/end2end/inc/myother2.change.dart
+++ b/compiler/javatests/com/google/dart/compiler/end2end/inc/myother2.change.dart
@@ -1,6 +1,7 @@
// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+part of myApp;
class IntBag {
int contents;
diff --git a/compiler/javatests/com/google/dart/compiler/end2end/inc/myother2.dart b/compiler/javatests/com/google/dart/compiler/end2end/inc/myother2.dart
index 25fa306..2ad88e1 100644
--- a/compiler/javatests/com/google/dart/compiler/end2end/inc/myother2.dart
+++ b/compiler/javatests/com/google/dart/compiler/end2end/inc/myother2.dart
@@ -1,6 +1,7 @@
// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+part of myApp;
class IntBag {
int contents;
diff --git a/compiler/javatests/com/google/dart/compiler/end2end/inc/myother3.dart b/compiler/javatests/com/google/dart/compiler/end2end/inc/myother3.dart
index d36fbb8..e81353c 100644
--- a/compiler/javatests/com/google/dart/compiler/end2end/inc/myother3.dart
+++ b/compiler/javatests/com/google/dart/compiler/end2end/inc/myother3.dart
@@ -1,6 +1,7 @@
// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+part of myApp;
class Other3 {
static int field;
diff --git a/compiler/javatests/com/google/dart/compiler/end2end/inc/myother3.newstaticfield.dart b/compiler/javatests/com/google/dart/compiler/end2end/inc/myother3.newstaticfield.dart
index d502c43..8394405 100644
--- a/compiler/javatests/com/google/dart/compiler/end2end/inc/myother3.newstaticfield.dart
+++ b/compiler/javatests/com/google/dart/compiler/end2end/inc/myother3.newstaticfield.dart
@@ -1,6 +1,7 @@
// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+part of myApp;
class Other3 {
static int field;
diff --git a/compiler/javatests/com/google/dart/compiler/end2end/inc/myother34.dart b/compiler/javatests/com/google/dart/compiler/end2end/inc/myother34.dart
index cf25243..767c0a2 100644
--- a/compiler/javatests/com/google/dart/compiler/end2end/inc/myother34.dart
+++ b/compiler/javatests/com/google/dart/compiler/end2end/inc/myother34.dart
@@ -1,6 +1,7 @@
// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+part of myApp;
class Other3 {
static int field;
diff --git a/compiler/javatests/com/google/dart/compiler/end2end/inc/myother4.change.dart b/compiler/javatests/com/google/dart/compiler/end2end/inc/myother4.change.dart
index 7433e99..be9df67 100644
--- a/compiler/javatests/com/google/dart/compiler/end2end/inc/myother4.change.dart
+++ b/compiler/javatests/com/google/dart/compiler/end2end/inc/myother4.change.dart
@@ -1,6 +1,7 @@
// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+part of myApp;
class Other4 {
static int field;
diff --git a/compiler/javatests/com/google/dart/compiler/end2end/inc/myother4.dart b/compiler/javatests/com/google/dart/compiler/end2end/inc/myother4.dart
index 1b71811..3039f16 100644
--- a/compiler/javatests/com/google/dart/compiler/end2end/inc/myother4.dart
+++ b/compiler/javatests/com/google/dart/compiler/end2end/inc/myother4.dart
@@ -1,6 +1,7 @@
// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+part of myApp;
class Other4 {
static int field;
diff --git a/compiler/javatests/com/google/dart/compiler/end2end/inc/myother4.newstaticfield.dart b/compiler/javatests/com/google/dart/compiler/end2end/inc/myother4.newstaticfield.dart
index 7433e99..be9df67 100644
--- a/compiler/javatests/com/google/dart/compiler/end2end/inc/myother4.newstaticfield.dart
+++ b/compiler/javatests/com/google/dart/compiler/end2end/inc/myother4.newstaticfield.dart
@@ -1,6 +1,7 @@
// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+part of myApp;
class Other4 {
static int field;
diff --git a/compiler/javatests/com/google/dart/compiler/end2end/inc/myother5.change.dart b/compiler/javatests/com/google/dart/compiler/end2end/inc/myother5.change.dart
index 54da0a0..899983b 100644
--- a/compiler/javatests/com/google/dart/compiler/end2end/inc/myother5.change.dart
+++ b/compiler/javatests/com/google/dart/compiler/end2end/inc/myother5.change.dart
@@ -1,6 +1,7 @@
// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+part of myApp;
class Other5 {
int field;
diff --git a/compiler/javatests/com/google/dart/compiler/end2end/inc/myother5.dart b/compiler/javatests/com/google/dart/compiler/end2end/inc/myother5.dart
index 00011c4..803faa7 100644
--- a/compiler/javatests/com/google/dart/compiler/end2end/inc/myother5.dart
+++ b/compiler/javatests/com/google/dart/compiler/end2end/inc/myother5.dart
@@ -1,6 +1,7 @@
// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+part of myApp;
class Other5 {
int field;
diff --git a/compiler/javatests/com/google/dart/compiler/end2end/inc/myother6.change.dart b/compiler/javatests/com/google/dart/compiler/end2end/inc/myother6.change.dart
index 989b78e..7ac2378 100644
--- a/compiler/javatests/com/google/dart/compiler/end2end/inc/myother6.change.dart
+++ b/compiler/javatests/com/google/dart/compiler/end2end/inc/myother6.change.dart
@@ -1,6 +1,7 @@
// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+part of myApp;
class Other6 {
Other6() { }
diff --git a/compiler/javatests/com/google/dart/compiler/end2end/inc/myother6.dart b/compiler/javatests/com/google/dart/compiler/end2end/inc/myother6.dart
index b89b75d..b1b9245 100644
--- a/compiler/javatests/com/google/dart/compiler/end2end/inc/myother6.dart
+++ b/compiler/javatests/com/google/dart/compiler/end2end/inc/myother6.dart
@@ -1,6 +1,7 @@
// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+part of myApp;
class Other6 {
Other6() { }
diff --git a/compiler/javatests/com/google/dart/compiler/end2end/inc/myother6.removeclass.dart b/compiler/javatests/com/google/dart/compiler/end2end/inc/myother6.removeclass.dart
index 1885bdb..2a17f79 100644
--- a/compiler/javatests/com/google/dart/compiler/end2end/inc/myother6.removeclass.dart
+++ b/compiler/javatests/com/google/dart/compiler/end2end/inc/myother6.removeclass.dart
@@ -1,6 +1,7 @@
// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+part of myApp;
class Other6 {
Other6() { }
diff --git a/compiler/javatests/com/google/dart/compiler/end2end/inc/myother7.dart b/compiler/javatests/com/google/dart/compiler/end2end/inc/myother7.dart
index c5ebbb4..0ca2c06 100644
--- a/compiler/javatests/com/google/dart/compiler/end2end/inc/myother7.dart
+++ b/compiler/javatests/com/google/dart/compiler/end2end/inc/myother7.dart
@@ -1,6 +1,7 @@
// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+part of myApp;
class Baz {
SomeClass2 sc2;
diff --git a/compiler/javatests/com/google/dart/compiler/end2end/inc/some.dart b/compiler/javatests/com/google/dart/compiler/end2end/inc/some.dart
index 8624331..0bb2c0d 100644
--- a/compiler/javatests/com/google/dart/compiler/end2end/inc/some.dart
+++ b/compiler/javatests/com/google/dart/compiler/end2end/inc/some.dart
@@ -1,13 +1,14 @@
// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+part of some_lib;
-interface SomeClass default SomeClassImpl {
- SomeClass(arg);
+abstract class SomeClass {
+ factory SomeClass(arg) = SomeClassImpl;
get message;
}
-interface SomeInterface2 {
+abstract class SomeInterface2 {
}
// myother7.dart/Baz depends on SomeClass2 which depends on SomeInterface2
diff --git a/compiler/javatests/com/google/dart/compiler/end2end/inc/some.intfchange.dart b/compiler/javatests/com/google/dart/compiler/end2end/inc/some.intfchange.dart
index b3d26c3..a67807e 100644
--- a/compiler/javatests/com/google/dart/compiler/end2end/inc/some.intfchange.dart
+++ b/compiler/javatests/com/google/dart/compiler/end2end/inc/some.intfchange.dart
@@ -1,13 +1,14 @@
// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+part of some_lib;
-interface SomeClass default SomeClassImpl {
- SomeClass(arg);
+abstract class SomeClass {
+ factory SomeClass(arg) = SomeClassImpl;
String get message; // Added return type
}
-interface SomeInterface2 {
+abstract class SomeInterface2 {
}
// myother7.dart/Baz depends on SomeClass2 which depends on SomeInterface2
diff --git a/compiler/javatests/com/google/dart/compiler/end2end/inc/some.newmethod.dart b/compiler/javatests/com/google/dart/compiler/end2end/inc/some.newmethod.dart
index 92d4924..783aeaa 100644
--- a/compiler/javatests/com/google/dart/compiler/end2end/inc/some.newmethod.dart
+++ b/compiler/javatests/com/google/dart/compiler/end2end/inc/some.newmethod.dart
@@ -1,14 +1,15 @@
// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+part of some_lib;
-interface SomeClass default SomeClassImpl {
- SomeClass(arg);
- String get message;
+abstract class SomeClass {
+ factory SomeClass(arg) = SomeClassImpl;
+ get message;
newMethod();
}
-interface SomeInterface2 {
+abstract class SomeInterface2 {
}
// myother7.dart/Baz depends on SomeClass2 which depends on SomeInterface2
diff --git a/compiler/javatests/com/google/dart/compiler/end2end/inc/someimpl.bodychange.dart b/compiler/javatests/com/google/dart/compiler/end2end/inc/someimpl.bodychange.dart
index 1311a06..a3fd2fd 100644
--- a/compiler/javatests/com/google/dart/compiler/end2end/inc/someimpl.bodychange.dart
+++ b/compiler/javatests/com/google/dart/compiler/end2end/inc/someimpl.bodychange.dart
@@ -1,6 +1,7 @@
// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+part of someimpl_dart;
class SomeClassImpl implements SomeClass {
String message_;
diff --git a/compiler/javatests/com/google/dart/compiler/end2end/inc/someimpl.change.dart b/compiler/javatests/com/google/dart/compiler/end2end/inc/someimpl.change.dart
index 4be14ea..667978e 100644
--- a/compiler/javatests/com/google/dart/compiler/end2end/inc/someimpl.change.dart
+++ b/compiler/javatests/com/google/dart/compiler/end2end/inc/someimpl.change.dart
@@ -1,6 +1,7 @@
// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+part of someimpl_dart;
class SomeClassImpl implements SomeClass {
String message_;
diff --git a/compiler/javatests/com/google/dart/compiler/end2end/inc/someimpl.dart b/compiler/javatests/com/google/dart/compiler/end2end/inc/someimpl.dart
index 2be548f..85b6861 100644
--- a/compiler/javatests/com/google/dart/compiler/end2end/inc/someimpl.dart
+++ b/compiler/javatests/com/google/dart/compiler/end2end/inc/someimpl.dart
@@ -1,6 +1,7 @@
// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+part of someimpl_dart;
class SomeClassImpl implements SomeClass {
String message_;
diff --git a/compiler/javatests/com/google/dart/compiler/parser/ClassesInterfaces.dart b/compiler/javatests/com/google/dart/compiler/parser/ClassesInterfaces.dart
index 8001649..9535c88 100644
--- a/compiler/javatests/com/google/dart/compiler/parser/ClassesInterfaces.dart
+++ b/compiler/javatests/com/google/dart/compiler/parser/ClassesInterfaces.dart
@@ -111,16 +111,16 @@
Baz(x, y, z) : super(x, y, z) {}
}
-interface Foo extends D, E {
+abstract class Foo implements D, E {
bar();
}
// Test bounds on type parameters
-interface Bar<K extends Foo, V> extends Foo {
+abstract class Bar<K extends Foo, V> implements Foo {
}
-interface Bar<K extends Foo, V extends Foo> extends Foo {
+abstract class Bar<K extends Foo, V extends Foo> implements Foo {
}
-interface Bar<K, V extends Foo> extends Foo {
+abstract class Bar<K, V extends Foo> implements Foo {
}
diff --git a/compiler/javatests/com/google/dart/compiler/parser/ErrorMessageLocationTest.java b/compiler/javatests/com/google/dart/compiler/parser/ErrorMessageLocationTest.java
index 78e402b..cb1376a 100644
--- a/compiler/javatests/com/google/dart/compiler/parser/ErrorMessageLocationTest.java
+++ b/compiler/javatests/com/google/dart/compiler/parser/ErrorMessageLocationTest.java
@@ -20,7 +20,7 @@
public void testUnexpectedTokenErrorMessage() {
String sourceCode =
"// Empty comment\n" +
- "interface foo while Bar {\n" +
+ "class foo while Bar {\n" +
"}";
DartParserRunner runner = DartParserRunner.parse(getName(), sourceCode);
@@ -30,7 +30,7 @@
DartCompilationError actualError = actualErrors.get(0);
String errorTokenString = "while";
- assertEquals(15, actualError.getColumnNumber());
+ assertEquals(11, actualError.getColumnNumber());
assertEquals(errorTokenString.length(), actualError.getLength());
assertEquals(2, actualError.getLineNumber());
assertEquals(sourceCode.indexOf(errorTokenString), actualError.getStartPosition());
diff --git a/compiler/javatests/com/google/dart/compiler/parser/MethodSignatures.dart b/compiler/javatests/com/google/dart/compiler/parser/MethodSignatures.dart
index bceecd6..6a2b414 100644
--- a/compiler/javatests/com/google/dart/compiler/parser/MethodSignatures.dart
+++ b/compiler/javatests/com/google/dart/compiler/parser/MethodSignatures.dart
@@ -2,7 +2,7 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-interface MethodSignatureSyntax {
+abstract class MethodSignatureSyntax {
a();
b(x);
c(int x);
diff --git a/compiler/javatests/com/google/dart/compiler/parser/NegativeParserTest.java b/compiler/javatests/com/google/dart/compiler/parser/NegativeParserTest.java
index f627314..65a57e1 100644
--- a/compiler/javatests/com/google/dart/compiler/parser/NegativeParserTest.java
+++ b/compiler/javatests/com/google/dart/compiler/parser/NegativeParserTest.java
@@ -21,13 +21,26 @@
* Negative Parser/Syntax tests.
*/
public class NegativeParserTest extends CompilerTestCase {
+ public void test_deprecatedGetterSyntax() {
+ parseExpectErrors("get foo() {}", errEx(ParserErrorCode.DEPRECATED_GETTER, 1, 5, 3));
+ }
+
+ public void test_deprecatedAbstract() {
+ parseExpectWarnings(makeCode(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "abstract class A {",
+ " abstract m();",
+ "}",
+ ""), errEx(ParserErrorCode.DEPRECATED_ABSTRACT_METHOD, 3, 3, 8));
+ }
+
public void testFieldInitializerInRedirectionConstructor1() {
parseExpectErrors(
"class A { A(x) { } A.foo() : this(5), y = 5; var y; }",
errEx(ParserErrorCode.REDIRECTING_CONSTRUCTOR_OTHER, 1, 39, 5),
errEx(ParserErrorCode.REDIRECTING_CONSTRUCTOR_ITSELF, 1, 30, 7));
}
-
+
public void testFieldInitializerInRedirectionConstructor2() {
parseExpectErrors(
"class A { A(x) { } A.foo() : y = 5, this(5); var y; }",
@@ -175,9 +188,15 @@
errEx(ParserErrorCode.DEFAULT_VALUE_CAN_NOT_BE_SPECIFIED_IN_CLOSURE, 1, 41, 5));
}
- public void test_namedParameterValue_inSetter() {
+ public void test_optionalPositionalParameterValue_inSetter() {
parseExpectErrors(
"class A { set f([int b]); }",
+ errEx(ParserErrorCode.OPTIONAL_POSITIONAL_PARAMETER_NOT_ALLOWED, 1, 18, 5));
+ }
+
+ public void test_namedParameterValue_inSetter() {
+ parseExpectErrors(
+ "class A { set f({int b}); }",
errEx(ParserErrorCode.NAMED_PARAMETER_NOT_ALLOWED, 1, 18, 5));
}
@@ -187,9 +206,15 @@
errEx(ParserErrorCode.MISSING_OPTIONAL_PARAMETER_END, 1, 43, 1));
}
- public void test_namedParameterValue_inOperator() {
+ public void test_optionalPositionalParameterValue_inOperator() {
parseExpectErrors(
"class A { operator []=(int a, [int b]); }",
+ errEx(ParserErrorCode.OPTIONAL_POSITIONAL_PARAMETER_NOT_ALLOWED, 1, 32, 5));
+ }
+
+ public void test_namedParameterValue_inOperator() {
+ parseExpectErrors(
+ "class A { operator []=(int a, {int b}); }",
errEx(ParserErrorCode.NAMED_PARAMETER_NOT_ALLOWED, 1, 32, 5));
}
@@ -352,6 +377,7 @@
public void testDeprecatedFactoryInInterface() {
parseExpectWarnings(
"interface foo factory bar {}",
+ errEx(ParserErrorCode.DEPRECATED_INTERFACE, 1, 1, 9),
errEx(ParserErrorCode.DEPRECATED_USE_OF_FACTORY_KEYWORD, 1, 15, 7));
}
@@ -381,8 +407,18 @@
"// filler filler filler filler filler filler filler filler filler filler",
"abstract interface A {",
"}"),
+ errEx(ParserErrorCode.DEPRECATED_INTERFACE, 2, 10, 9),
errEx(ParserErrorCode.ABSTRACT_TOP_LEVEL_ELEMENT, 2, 1, 8));
}
+
+ public void test_deprecatedInterface() {
+ parseExpectErrors(
+ Joiner.on("\n").join(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "interface A {",
+ "}"),
+ errEx(ParserErrorCode.DEPRECATED_INTERFACE, 2, 1, 9));
+ }
public void test_abstractTopLevel_typedef() {
parseExpectErrors(
@@ -396,17 +432,6 @@
errEx(ParserErrorCode.ABSTRACT_TOP_LEVEL_ELEMENT, 1, 1, 8));
}
- public void test_abstractMethodWithBody() {
- parseExpectErrors(
- Joiner.on("\n").join(
- "// filler filler filler filler filler filler filler filler filler filler",
- "class A {",
- " abstract foo() {",
- " }",
- "}"),
- errEx(ParserErrorCode.ABSTRACT_METHOD_WITH_BODY, 3, 12, 3));
- }
-
public void test_incompleteExpressionInInterpolation() {
parseExpectErrors(
"var s = 'fib(3) = ${fib(3}';",
@@ -421,6 +446,7 @@
" foo() {",
" }",
"}"),
+ errEx(ParserErrorCode.DEPRECATED_INTERFACE, 2, 1, 9),
errEx(ParserErrorCode.INTERFACE_METHOD_WITH_BODY, 3, 3, 3));
}
@@ -578,7 +604,7 @@
"class MyClass {}",
"class MyInterface {}",
"topLevelMethod() {}",
- "int get topLevelGetter() {return 0;}",
+ "int get topLevelGetter {return 0;}",
"void set topLevelSetter(int v) {}",
"typedef void MyTypeDef();",
""));
@@ -630,7 +656,7 @@
" }",
"}",
"topLevelMethod() {}",
- "int get topLevelGetter() {return 0;}",
+ "int get topLevelGetter {return 0;}",
"void set topLevelSetter(int setterParam) {}",
"typedef void MyTypeDef();",
""));
@@ -750,6 +776,7 @@
"interface A native 'N' {",
"}",
""),
+ errEx(ParserErrorCode.DEPRECATED_INTERFACE, 2, 1, 9),
errEx(ParserErrorCode.NATIVE_ONLY_CLASS, 2, 13, 6));
}
diff --git a/compiler/javatests/com/google/dart/compiler/parser/ParserRecoveryTest.java b/compiler/javatests/com/google/dart/compiler/parser/ParserRecoveryTest.java
index 6c4f95b..b615cdf 100644
--- a/compiler/javatests/com/google/dart/compiler/parser/ParserRecoveryTest.java
+++ b/compiler/javatests/com/google/dart/compiler/parser/ParserRecoveryTest.java
@@ -48,6 +48,63 @@
// Implemented elsewhere
}
+ public void test_incompleteFunctionExpression() {
+ DartParserRunner parserRunner = parseSource(Joiner.on("\n").join(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "main() {",
+ " var v = (AAA a, BB)",
+ "}"));
+ DartUnit unit = parserRunner.getDartUnit();
+ assertEquals(
+ Joiner.on("\n").join(
+ "// unit test_incompleteFunctionExpression",
+ "",
+ "main() {",
+ " var v = (AAA a, BB) {",
+ " };",
+ "}",
+ ""),
+ unit.toString());
+ }
+
+ public void test_incompleteFunctionExpression_qualifiedType() {
+ DartParserRunner parserRunner = parseSource(Joiner.on("\n").join(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "main() {",
+ " var v = (pref.AAA a, BB)",
+ "}"));
+ DartUnit unit = parserRunner.getDartUnit();
+ assertEquals(
+ Joiner.on("\n").join(
+ "// unit test_incompleteFunctionExpression_qualifiedType",
+ "",
+ "main() {",
+ " var v = (pref.AAA a, BB) {",
+ " };",
+ "}",
+ ""),
+ unit.toString());
+ }
+
+ public void test_incompleteFunctionExpression_typeArguments() {
+ DartParserRunner parserRunner = parseSource(Joiner.on("\n").join(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "main() {",
+ " var v = (AAA<T1, T2<T3, T4>, T5> a, BB)",
+ "}"));
+ DartUnit unit = parserRunner.getDartUnit();
+ assertEquals(
+ Joiner.on("\n").join(
+ "// unit test_incompleteFunctionExpression_typeArguments",
+ "",
+ "main() {",
+ " var v = (AAA<T1, T2<T3, T4>, T5> a, BB) {",
+ " };",
+ "}",
+ ""),
+ unit.toString());
+ }
+
public void testVarOnMethodDefinition() {
// This syntax is illegal, and should produce errors, but since it is a common error,
// we want to make sure it produce a valid AST for editor users
diff --git a/compiler/javatests/com/google/dart/compiler/parser/SyntaxTest.java b/compiler/javatests/com/google/dart/compiler/parser/SyntaxTest.java
index 64474bd..f977713 100644
--- a/compiler/javatests/com/google/dart/compiler/parser/SyntaxTest.java
+++ b/compiler/javatests/com/google/dart/compiler/parser/SyntaxTest.java
@@ -55,6 +55,16 @@
"export 'a.dart';"));
}
+ public void test_hasParseErrors_true() {
+ DartUnit unit = parseSource("garbage").getDartUnit();
+ assertTrue(unit.hasParseErrors());
+ }
+
+ public void test_hasParseErrors_false() {
+ DartUnit unit = parseSource("// empty").getDartUnit();
+ assertFalse(unit.hasParseErrors());
+ }
+
public void test_importDirective_noUri() {
DartUnit unit = parseUnit("test.dart", Joiner.on("\n").join(
"library lib;",
@@ -78,7 +88,7 @@
parseUnit("getter.dart", Joiner.on("\n").join(
"class G {",
" // Old getter syntax",
- " int get g1() => 1;",
+ " int get g1 => 1;",
" // New getter syntax",
" int get g2 => 2;",
"}"));
@@ -1025,11 +1035,10 @@
parseUnit("phony_test_missing_factory_body.dart",
Joiner.on("\n").join(
"class A {",
- " abstract factory A.c();", // error - no body
+ " factory A.c();", // error - no body
" A() {}",
"}"),
- ParserErrorCode.FACTORY_CANNOT_BE_ABSTRACT, 2, 12,
- ParserErrorCode.EXPECTED_FUNCTION_STATEMENT_BODY, 2, 25);
+ ParserErrorCode.EXPECTED_FUNCTION_STATEMENT_BODY, 2, 16);
}
public void test_factoryAbstractStatic() throws Exception {
@@ -1037,25 +1046,10 @@
Joiner.on("\n").join(
"class A {",
" A() {}",
- " abstract factory A.named1() { return new A();}",
+ " factory A.named1() { return new A();}",
" static factory A.named2() { return new A();}",
- " static abstract factory A.named3() { return new A();}",
"}"),
- ParserErrorCode.FACTORY_CANNOT_BE_ABSTRACT, 3, 12,
- ParserErrorCode.FACTORY_CANNOT_BE_STATIC, 4, 10,
- ParserErrorCode.STATIC_MEMBERS_CANNOT_BE_ABSTRACT, 5, 10,
- ParserErrorCode.FACTORY_CANNOT_BE_STATIC, 5, 19);
- }
-
- public void test_staticAbstractMember() throws Exception {
- parseUnit("phony_test_static_abstract_member.dart",
- Joiner.on("\n").join(
- "class A {",
- " static abstract var foo;",
- " static abstract bar();",
- "}"),
- ParserErrorCode.STATIC_MEMBERS_CANNOT_BE_ABSTRACT, 2, 10,
- ParserErrorCode.STATIC_MEMBERS_CANNOT_BE_ABSTRACT, 3, 10);
+ ParserErrorCode.FACTORY_CANNOT_BE_STATIC, 4, 10);
}
public void test_factoryInInterface() throws Exception {
@@ -1064,21 +1058,11 @@
"interface A {",
" factory A();",
"}"),
+ ParserErrorCode.DEPRECATED_INTERFACE, 1, 1,
ParserErrorCode.FACTORY_MEMBER_IN_INTERFACE, 2, 3,
ParserErrorCode.EXPECTED_FUNCTION_STATEMENT_BODY, 2, 14);
}
- public void test_AbstractVar() throws Exception {
- parseUnit("phony_test_abstract_var.dart",
- Joiner.on("\n").join(
- "class A {",
- " abstract var a;",
- " abstract final b;",
- "}"),
- ParserErrorCode.DISALLOWED_ABSTRACT_KEYWORD, 2, 3,
- ParserErrorCode.DISALLOWED_ABSTRACT_KEYWORD, 3, 3);
- }
-
public void test_localVariable_const() {
DartUnit unit = parseUnit("constVar.dart", makeCode(
"main() {",
@@ -1401,11 +1385,10 @@
parseUnit("phony_test_abstract_in_interface.dart",
Joiner.on("\n").join(
"interface A {",
- " abstract var foo;",
- " abstract bar();",
+ " var foo;",
+ " bar();",
"}"),
- ParserErrorCode.ABSTRACT_MEMBER_IN_INTERFACE, 2, 3,
- ParserErrorCode.ABSTRACT_MEMBER_IN_INTERFACE, 3, 3);
+ ParserErrorCode.DEPRECATED_INTERFACE, 1, 1);
}
public void test_voidParameterField() throws Exception {
@@ -1458,6 +1441,7 @@
" static foo();",
" static var bar;",
"}"),
+ ParserErrorCode.DEPRECATED_INTERFACE, 1, 1,
ParserErrorCode.NON_FINAL_STATIC_MEMBER_IN_INTERFACE, 2, 3,
ParserErrorCode.NON_FINAL_STATIC_MEMBER_IN_INTERFACE, 3, 3);
}
@@ -1483,13 +1467,6 @@
ParserErrorCode.EXPECTED_TOKEN, 2, 15);
}
- public void test_abstractMethod_withModifier() {
- parseUnit("test.dart", Joiner.on("\n").join(
- "class C {",
- " abstract m(a, b, c);",
- "}"));
- }
-
public void test_abstractMethod_withoutModifier() {
parseUnit("test.dart", Joiner.on("\n").join(
"class C {",
diff --git a/compiler/javatests/com/google/dart/compiler/parser/TryCatch.dart b/compiler/javatests/com/google/dart/compiler/parser/TryCatch.dart
index ea95022..4708733 100644
--- a/compiler/javatests/com/google/dart/compiler/parser/TryCatch.dart
+++ b/compiler/javatests/com/google/dart/compiler/parser/TryCatch.dart
@@ -2,11 +2,11 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-interface TestException1 {
+abstract class TestException1 {
int foo();
}
-interface TestException2 {
+abstract class TestException2 {
int bar();
}
diff --git a/compiler/javatests/com/google/dart/compiler/resolver/CompileTimeConstantTest.java b/compiler/javatests/com/google/dart/compiler/resolver/CompileTimeConstantTest.java
index 765bab7..ae86c27 100644
--- a/compiler/javatests/com/google/dart/compiler/resolver/CompileTimeConstantTest.java
+++ b/compiler/javatests/com/google/dart/compiler/resolver/CompileTimeConstantTest.java
@@ -865,11 +865,11 @@
Joiner.on("\n").join(
"class Object {}",
"class Function {}",
- "Function get topLevelGetter() => () {};",
+ "Function get topLevelGetter => () {};",
"topLevel([var x = topLevelGetter]) { x(); }",
"main() { topLevel(); }"),
errEx(ResolverErrorCode.EXPECTED_CONSTANT_EXPRESSION, 4, 19, 14),
- errEx(ResolverErrorCode.EXPECTED_CONSTANT_EXPRESSION, 3, 1, 39));
+ errEx(ResolverErrorCode.EXPECTED_CONSTANT_EXPRESSION, 3, 1, 37));
}
/**
@@ -880,7 +880,7 @@
resolveAndTestCtConstExpectErrors(
Joiner.on("\n").join(
"class Object {}",
- "interface int {}",
+ "class int {}",
"class A {",
" const int value1 = (1 << 5) - 1;",
" const int value2 = value1 & 0xFFFF;",
@@ -901,7 +901,7 @@
resolveAndTestCtConstExpectErrors(
Joiner.on("\n").join(
"class Object {}",
- "interface double {}",
+ "class double {}",
"class A {",
" const double value1 = (1.0 * 5.0) - 1.0;",
" const double value2 = value1 + 99.0;",
@@ -922,7 +922,7 @@
resolveAndTestCtConstExpectErrors(
Joiner.on("\n").join(
"class Object {}",
- "interface double {}",
+ "class double {}",
"class A {",
" const double value1 = (1 * 5) - 1.0;",
" const double value2 = value1 + 99.0;",
@@ -943,7 +943,7 @@
resolveAndTestCtConstExpectErrors(
Joiner.on("\n").join(
"class Object {}",
- "interface int {}",
+ "class int {}",
"class A {",
" const int value1 = ('Invalid') - 1;",
" const int value2 = value1 & 0xFFFF;",
@@ -958,7 +958,7 @@
resolveAndTestCtConstExpectErrors(
Joiner.on("\n").join(
"class Object {}",
- "interface int {}",
+ "class int {}",
"class A {",
" const int value3 = ('Invalid') + 1;",
" const int value4 = value3 & 0xFFFF;",
@@ -970,7 +970,7 @@
resolveAndTestCtConstExpectErrors(
Joiner.on("\n").join(
"class Object {}",
- "interface int {}",
+ "class int {}",
"class A {",
" const int value5 = ('Invalid') * 1;",
" const int value6 = value5 & 0xFFFF;",
@@ -982,7 +982,7 @@
resolveAndTestCtConstExpectErrors(
Joiner.on("\n").join(
"class Object {}",
- "interface int {}",
+ "class int {}",
"class A {",
" const int value7 = ('Invalid') / 1;",
" const int value8 = value7 & 0xFFFF;",
diff --git a/compiler/javatests/com/google/dart/compiler/resolver/NegativeResolverTest.java b/compiler/javatests/com/google/dart/compiler/resolver/NegativeResolverTest.java
index bba5949..28d4dc5 100644
--- a/compiler/javatests/com/google/dart/compiler/resolver/NegativeResolverTest.java
+++ b/compiler/javatests/com/google/dart/compiler/resolver/NegativeResolverTest.java
@@ -246,20 +246,6 @@
}
/**
- * Section 7.8: It is a compile-time error if the extends clause of a class C includes a type
- * expression that does not denote a class available in the lexical scope of C.
- */
- public void test_classExtendsInterface() {
- checkSourceErrors(
- makeCode(
- "// filler filler filler filler filler filler filler filler filler filler",
- "interface I {}",
- "class A extends I {",
- "}"),
- errEx(ResolverErrorCode.NOT_A_CLASS, 3, 17, 1));
- }
-
- /**
* Class can implement class, this causes implementation of an implicit interface.
*/
public void test_classImplementsClass() {
@@ -270,17 +256,6 @@
"}"));
}
- /**
- * Interface can extend class, this causes implementation of an implicit interface.
- */
- public void test_interfaceExtendsClass() {
- checkSourceErrors(makeCode(
- "// filler filler filler filler filler filler filler filler filler filler",
- "class A {}",
- "interface B extends A {",
- "}"));
- }
-
public void tesClassImplementsUnknownInterfaceNegativeTest() {
checkNumErrors("ClassImplementsUnknownInterfaceNegativeTest.dart", 1);
}
@@ -341,7 +316,7 @@
checkSourceErrors(
makeCode(
"// filler filler filler filler filler filler filler filler filler filler",
- "get foo() {}",
+ "get foo {}",
"set bar(x) {}",
"class foo {}",
"class bar{}"),
@@ -355,7 +330,7 @@
"// filler filler filler filler filler filler filler filler filler filler",
"class foo {}",
"class bar {}",
- "get foo() {}",
+ "get foo {}",
"set bar(x) {}"),
errEx(ResolverErrorCode.DUPLICATE_TOP_LEVEL_DECLARATION, 2, 7, 3),
errEx(ResolverErrorCode.DUPLICATE_TOP_LEVEL_DECLARATION, 4, 5, 3));
@@ -370,7 +345,7 @@
public void test_nameShadow_topLevel_getter_setter() {
checkSourceErrors(makeCode(
"// filler filler filler filler filler filler filler filler filler filler",
- "get bar() {}",
+ "get bar {}",
"set bar(x) {}"));
}
@@ -378,7 +353,7 @@
checkSourceErrors(makeCode(
"// filler filler filler filler filler filler filler filler filler filler",
"set bar(x) {}",
- "get bar() {}"));
+ "get bar {}"));
}
public void test_nameShadow_topLevel_setter_variable() {
@@ -405,8 +380,8 @@
checkSourceErrors(
makeCode(
"// filler filler filler filler filler filler filler filler filler filler",
- "get bar() {}",
- "get bar() {}"),
+ "get bar {}",
+ "get bar {}"),
errEx(ResolverErrorCode.DUPLICATE_TOP_LEVEL_DECLARATION, 2, 5, 3),
errEx(ResolverErrorCode.DUPLICATE_TOP_LEVEL_DECLARATION, 3, 5, 3));
assertEquals(
@@ -648,7 +623,7 @@
public void test_nameShadow_field_interfaceMethodParameter() {
checkSourceErrors(makeCode(
"// filler filler filler filler filler filler filler filler filler filler",
- "interface A {",
+ "abstract class A {",
" var a;",
" foo(a);",
"}"));
@@ -681,7 +656,7 @@
"// filler filler filler filler filler filler filler filler filler filler",
"class A {",
" set foo(x) {}",
- " get foo() {}",
+ " get foo {}",
" var foo;",
"}"),
errEx(ResolverErrorCode.DUPLICATE_MEMBER, 4, 7, 3),
@@ -737,7 +712,7 @@
"// filler filler filler filler filler filler filler filler filler filler",
"class A {",
" var foo;",
- " get foo() {}",
+ " get foo {}",
"}"),
errEx(ResolverErrorCode.DUPLICATE_MEMBER, 3, 7, 3),
errEx(ResolverErrorCode.DUPLICATE_MEMBER, 4, 7, 3));
@@ -751,9 +726,9 @@
makeCode(
"// filler filler filler filler filler filler filler filler filler filler",
"class A {",
- " get foo() {}",
+ " get foo {}",
" set foo(x) {}",
- " get foo() {}",
+ " get foo {}",
"}"),
errEx(ResolverErrorCode.DUPLICATE_MEMBER, 3, 7, 3),
errEx(ResolverErrorCode.DUPLICATE_MEMBER, 5, 7, 3));
@@ -768,7 +743,7 @@
"// filler filler filler filler filler filler filler filler filler filler",
"class A {",
" set foo(x) {}",
- " get foo() {}",
+ " get foo {}",
" set foo(x) {}",
"}"),
errEx(ResolverErrorCode.DUPLICATE_MEMBER, 3, 7, 3),
@@ -783,7 +758,7 @@
makeCode(
"// filler filler filler filler filler filler filler filler filler filler",
"class A {",
- " get foo() {}",
+ " get foo {}",
" var foo;",
"}"),
errEx(ResolverErrorCode.DUPLICATE_MEMBER, 3, 7, 3),
@@ -864,10 +839,6 @@
errEx(ResolverErrorCode.CONST_CONSTRUCTOR_MUST_CALL_CONST_SUPER, 3, 9, 1));
}
- public void testRawTypesNegativeTest() {
- checkNumErrors("RawTypesNegativeTest.dart", 6);
- }
-
public void testConstConstructorNonFinalFieldsNegativeTest() {
checkSourceErrors(
makeCode(
@@ -881,7 +852,7 @@
" final bar;",
" var baz;",
"}",
- "interface C {",
+ "abstract class C {",
" var x;",
"}"),
errEx(ResolverErrorCode.CONST_CLASS_WITH_NONFINAL_FIELDS, 3, 7, 1),
@@ -1048,17 +1019,6 @@
errEx(ResolverErrorCode.THIS_IN_INITIALIZER_AS_EXPRESSION, 5, 25, 4));
}
- public void testInterfaceWithConcreteConstructorAndDefaultNonImlplementing() throws Exception {
- checkSourceErrors(
- makeCode(
- "// filler filler filler filler filler filler filler filler filler filler",
- "class A {}",
- "interface I default A {",
- " I();",
- "}"),
- errEx(ResolverErrorCode.DEFAULT_CONSTRUCTOR_UNRESOLVED, 4, 3, 4));
- }
-
public void test_resolvedTypeVariableBounds_inFunctionTypeAlias() throws Exception {
DartUnit unit =
parseUnit(
diff --git a/compiler/javatests/com/google/dart/compiler/resolver/RawTypesNegativeTest.dart b/compiler/javatests/com/google/dart/compiler/resolver/RawTypesNegativeTest.dart
deleted file mode 100644
index aaa3bb3..0000000
--- a/compiler/javatests/com/google/dart/compiler/resolver/RawTypesNegativeTest.dart
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-interface Super<T> {}
-
-interface Sub<S> extends Super<S> default SubImplementation<S> {
- Sub();
-}
-
-class SubImplementation<U> implements Sub<U> {
- SubImplementation() {}
-}
-
-class A {
- main() {
- Sub<A, A> s = new Sub();
- Sub<A, A> s2 = new Sub<A>();
- Sub<A, A> s3;
- A<A> s4;
- }
-}
diff --git a/compiler/javatests/com/google/dart/compiler/resolver/ResolverCompilerTest.java b/compiler/javatests/com/google/dart/compiler/resolver/ResolverCompilerTest.java
index 50a93b2..1c71828 100644
--- a/compiler/javatests/com/google/dart/compiler/resolver/ResolverCompilerTest.java
+++ b/compiler/javatests/com/google/dart/compiler/resolver/ResolverCompilerTest.java
@@ -3,11 +3,9 @@
// BSD-style license that can be found in the LICENSE file.
package com.google.dart.compiler.resolver;
-import com.google.common.base.Joiner;
import com.google.common.collect.Lists;
import com.google.common.io.CharStreams;
import com.google.dart.compiler.CompilerTestCase;
-import com.google.dart.compiler.DartCompilationError;
import com.google.dart.compiler.Source;
import com.google.dart.compiler.ast.ASTVisitor;
import com.google.dart.compiler.ast.DartClass;
@@ -49,7 +47,6 @@
public void test_parameters_withFunctionAlias() throws Exception {
AnalyzeLibraryResult libraryResult = analyzeLibrary(
- "Test.dart",
"typedef List<T> TypeAlias<T, U extends List<T>>(List<T> arg, U u);");
assertErrors(libraryResult.getCompilationErrors());
DartUnit unit = libraryResult.getLibraryUnitResult().getUnits().iterator().next();
@@ -75,10 +72,10 @@
* This test succeeds if no exceptions are thrown.
*/
public void test_recursiveTypes() throws Exception {
- analyzeLibrary("test.dart", Joiner.on("\n").join(
+ analyzeLibrary(
"class A extends A implements A {}",
"class B extends C {}",
- "class C extends B {}"));
+ "class C extends B {}");
}
/**
@@ -87,16 +84,13 @@
*/
public void test_resolution_on_class_decls() throws Exception {
AnalyzeLibraryResult libraryResult = analyzeLibrary(
- "Test.dart",
- Joiner.on("\n").join(
"class A {}",
- "interface B<T> default C {}",
+ "abstract class B<T> {}",
"class C<T> extends A implements B<T> {}",
"class D extends C<int> {}",
"class E implements C<int> {}",
"class F<T extends A> {}",
- "class G extends F<C<int>> {}",
- "interface H<T> default C<T> {}"));
+ "class G extends F<C<int>> {}");
assertErrors(libraryResult.getCompilationErrors());
DartUnit unit = libraryResult.getLibraryUnitResult().getUnits().iterator().next();
List<DartNode> nodes = unit.getTopLevelNodes();
@@ -114,8 +108,6 @@
assertEquals("F", F.getClassName());
DartClass G = (DartClass) nodes.get(6);
assertEquals("G", G.getClassName());
- DartClass H = (DartClass) nodes.get(7);
- assertEquals("H", H.getClassName());
// class A
assertNotNull(A.getName().getElement());
@@ -131,8 +123,6 @@
assertNotNull(T.getName().getElement());
assertTrue(T.getName().getElement() instanceof TypeVariableElement);
assertEquals("T", T.getName().getName());
- assertNotNull(B.getDefaultClass().getExpression().getElement());
- assertSame(C.getElement(), B.getDefaultClass().getExpression().getElement());
// class C<T> extends A implements B<T> {}
assertNotNull(C.getName().getElement());
@@ -193,24 +183,6 @@
assertEquals(
"int",
typeArg.getTypeArguments().get(0).getIdentifier().getElement().getOriginalName());
-
- // class H<T> extends C<T> {}",
- assertNotNull(H.getName().getElement());
- assertSame(H.getElement(), H.getName().getElement());
- assertEquals(1, H.getTypeParameters().size());
- T = H.getTypeParameters().get(0);
- assertNotNull(T);
- assertNotNull(T.getName().getElement());
- assertTrue(T.getName().getElement() instanceof TypeVariableElement);
- assertNotNull(H.getDefaultClass().getExpression().getElement());
- assertSame(C.getElement(), H.getDefaultClass().getExpression().getElement());
- // This type parameter T resolves to the Type variable on the default class, so it
- // isn't the same type variable instance specified in this interface declaration,
- // though it must have the same name.
- DartTypeParameter defaultT = H.getDefaultClass().getTypeParameters().get(0);
- assertNotNull(defaultT.getName().getElement());
- assertTrue(defaultT.getName().getElement() instanceof TypeVariableElement);
- assertEquals(T.getName().getElement().getName(), defaultT.getName().getElement().getName());
}
/**
@@ -218,15 +190,13 @@
*/
public void test_resolveConstructor_implicit() throws Exception {
AnalyzeLibraryResult libraryResult = analyzeLibrary(
- "Test.dart",
- Joiner.on("\n").join(
- "class F {",
- "}",
- "class Test {",
- " foo() {",
- " new F();",
- " }",
- "}"));
+ "class F {",
+ "}",
+ "class Test {",
+ " foo() {",
+ " new F();",
+ " }",
+ "}");
assertErrors(libraryResult.getCompilationErrors());
DartUnit unit = libraryResult.getLibraryUnitResult().getUnits().iterator().next();
DartNewExpression newExpression = findNodeBySource(unit, "new F()");
@@ -237,15 +207,13 @@
public void test_resolveConstructor_noSuchConstructor() throws Exception {
AnalyzeLibraryResult libraryResult = analyzeLibrary(
- "Test.dart",
- Joiner.on("\n").join(
- "class A {",
- "}",
- "class Test {",
- " foo() {",
- " new A.foo();",
- " }",
- "}"));
+ "class A {",
+ "}",
+ "class Test {",
+ " foo() {",
+ " new A.foo();",
+ " }",
+ "}");
assertErrors(
libraryResult.getErrors(),
errEx(ResolverErrorCode.NEW_EXPRESSION_NOT_CONSTRUCTOR, 5, 11, 3));
@@ -257,515 +225,32 @@
public void test_resolveConstructor_super_implicitDefault() throws Exception {
AnalyzeLibraryResult libraryResult = analyzeLibrary(
- "Test.dart",
- Joiner.on("\n").join(
- "// filler filler filler filler filler filler filler filler filler filler",
- "class A {",
- "}",
- "class B extends A {",
- " B() : super() {}",
- "}",
- ""));
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "class A {",
+ "}",
+ "class B extends A {",
+ " B() : super() {}",
+ "}",
+ "");
assertErrors(libraryResult.getErrors());
}
public void test_superMethodInvocation_inConstructorInitializer() throws Exception {
AnalyzeLibraryResult libraryResult = analyzeLibrary(
- "Test.dart",
- Joiner.on("\n").join(
- "// filler filler filler filler filler filler filler filler filler filler",
- "class A {",
- " foo() {}",
- "}",
- "class B extends A {",
- " var x;",
- " B() : x = super.foo() {}",
- "}",
- ""));
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "class A {",
+ " foo() {}",
+ "}",
+ "class B extends A {",
+ " var x;",
+ " B() : x = super.foo() {}",
+ "}",
+ "");
assertErrors(
libraryResult.getErrors(),
errEx(ResolverErrorCode.SUPER_METHOD_INVOCATION_IN_CONSTRUCTOR_INITIALIZER, 7, 13, 11));
}
- /**
- * We should be able to resolve implicit default constructor.
- */
- public void test_resolveInterfaceConstructor_implicitDefault_noInterface_noFactory()
- throws Exception {
- AnalyzeLibraryResult libraryResult = analyzeLibrary(
- "Test.dart",
- Joiner.on("\n").join(
- "interface I default F {",
- "}",
- "class F implements I {",
- "}",
- "class Test {",
- " foo() {",
- " new I();",
- " }",
- "}"));
- assertErrors(libraryResult.getCompilationErrors());
- DartUnit unit = libraryResult.getLibraryUnitResult().getUnits().iterator().next();
- DartNewExpression newExpression = findNodeBySource(unit, "new I()");
- ConstructorElement constructorElement = newExpression.getElement();
- assertNotNull(constructorElement);
- assertEquals("", getElementSource(constructorElement));
- }
-
- /**
- * We should be able to resolve implicit default constructor.
- */
- public void test_resolveInterfaceConstructor_implicitDefault_hasInterface_noFactory()
- throws Exception {
- AnalyzeLibraryResult libraryResult = analyzeLibrary(
- "Test.dart",
- Joiner.on("\n").join(
- "interface I default F {",
- "}",
- "class F implements I {",
- "}",
- "class Test {",
- " foo() {",
- " new I();",
- " }",
- "}"));
- assertErrors(libraryResult.getCompilationErrors());
- DartUnit unit = libraryResult.getLibraryUnitResult().getUnits().iterator().next();
- DartNewExpression newExpression = findNodeBySource(unit, "new I()");
- ConstructorElement constructorElement = newExpression.getElement();
- assertNotNull(constructorElement);
- assertEquals("", getElementSource(constructorElement));
- }
-
- /**
- * We should be able to resolve implicit default constructor.
- */
- public void test_resolveInterfaceConstructor_implicitDefault_noInterface_hasFactory()
- throws Exception {
- AnalyzeLibraryResult libraryResult = analyzeLibrary(
- "Test.dart",
- Joiner.on("\n").join(
- "interface I default F {",
- "}",
- "class F implements I {",
- " F();",
- "}",
- "class Test {",
- " foo() {",
- " new I();",
- " }",
- "}"));
- assertErrors(libraryResult.getCompilationErrors());
- DartUnit unit = libraryResult.getLibraryUnitResult().getUnits().iterator().next();
- DartNewExpression newExpression = findNodeBySource(unit, "new I()");
- ConstructorElement constructorElement = newExpression.getElement();
- assertEquals(true, getElementSource(constructorElement).contains("F()"));
- }
-
- /**
- * If "const I()" is used, then constructor should be "const".
- */
- public void test_resolveInterfaceConstructor_const() throws Exception {
- AnalyzeLibraryResult libraryResult = analyzeLibrary(
- "Test.dart",
- Joiner.on("\n").join(
- "interface I default F {",
- " I(int x);",
- "}",
- "class F implements I {",
- " F(int y) {}",
- "}",
- "class Test {",
- " foo() {",
- " const I(0);",
- " }",
- "}"));
- assertErrors(
- libraryResult.getCompilationErrors(),
- errEx(ResolverErrorCode.CONST_AND_NONCONST_CONSTRUCTOR, 9, 5, 10));
- }
-
- /**
- * From specification 0.05, 11/14/2011.
- * <p>
- * A constructor kI of I corresponds to a constructor kF of its factory class F if either
- * <ul>
- * <li>F does not implement I and kI and kF have the same name, OR
- * <li>F implements I and either
- * <ul>
- * <li>kI is named NI and kF is named NF, OR
- * <li>kI is named NI.id and kF is named NF.id.
- * </ul>
- * </ul>
- * <p>
- * http://code.google.com/p/dart/issues/detail?id=521
- */
- public void test_resolveInterfaceConstructor_whenFactoryImplementsInterface_nameIsIdentifier()
- throws Exception {
- AnalyzeLibraryResult libraryResult = analyzeLibrary(
- "Test.dart",
- Joiner.on("\n").join(
- "interface I default F {",
- " I(int x);",
- "}",
- "class F implements I {",
- " F(int y) {}",
- " factory I(int y) {}",
- "}",
- "class Test {",
- " foo() {",
- " new I(0);",
- " }",
- "}"));
- assertErrors(libraryResult.getCompilationErrors());
- DartUnit unit = libraryResult.getLibraryUnitResult().getUnits().iterator().next();
- DartNewExpression newExpression = findNodeBySource(unit, "new I(0)");
- ConstructorElement constructorElement = newExpression.getElement();
- assertEquals(true, getElementSource(constructorElement).contains("F(int y)"));
- }
-
- /**
- * From specification 0.05, 11/14/2011.
- * <p>
- * A constructor kI of I corresponds to a constructor kF of its factory class F if either
- * <ul>
- * <li>F does not implement I and kI and kF have the same name, OR
- * <li>F implements I and either
- * <ul>
- * <li>kI is named NI and kF is named NF , OR
- * <li>kI is named NI.id and kF is named NF.id.
- * </ul>
- * </ul>
- * <p>
- * http://code.google.com/p/dart/issues/detail?id=521
- */
- public void test_resolveInterfaceConstructor_whenFactoryImplementsInterface_nameIsQualified()
- throws Exception {
- AnalyzeLibraryResult libraryResult = analyzeLibrary(
- "Test.dart",
- Joiner.on("\n").join(
- "interface I default F {",
- " I.foo(int x);",
- "}",
- "class F implements I {",
- " F.foo(int y) {}",
- " factory I.foo(int y) {}",
- "}",
- "class Test {",
- " foo() {",
- " new I.foo(0);",
- " }",
- "}"));
- assertErrors(libraryResult.getCompilationErrors());
- DartUnit unit = libraryResult.getLibraryUnitResult().getUnits().iterator().next();
- // "new I.foo()" - good
- {
- DartNewExpression newExpression = findNodeBySource(unit, "new I.foo(0)");
- ConstructorElement constructorElement = newExpression.getElement();
- assertEquals(true, getElementSource(constructorElement).contains("F.foo(int y)"));
- }
- }
-
- /**
- * From specification 0.05, 11/14/2011.
- * <p>
- * A constructor kI of I corresponds to a constructor kF of its factory class F if either
- * <ul>
- * <li>F does not implement I and kI and kF have the same name, OR
- * <li>F implements I and either
- * <ul>
- * <li>kI is named NI and kF is named NF , OR
- * <li>kI is named NI.id and kF is named NF.id.
- * </ul>
- * </ul>
- * <p>
- * http://code.google.com/p/dart/issues/detail?id=521
- */
- public void test_resolveInterfaceConstructor_whenFactoryImplementsInterface_negative()
- throws Exception {
- AnalyzeLibraryResult libraryResult = analyzeLibrary(
- "Test.dart",
- Joiner.on("\n").join(
- "interface I default F {",
- " I(int x);",
- " I.foo(int x);",
- "}",
- "class F implements I {",
- " factory I.foo(int x) {}",
- "}",
- "class Test {",
- " foo() {",
- " new I(0);",
- " new I.foo(0);",
- " }",
- "}"));
- // Check errors.
- {
- List<DartCompilationError> errors = libraryResult.getCompilationErrors();
- assertErrors(
- errors,
- errEx(ResolverErrorCode.DEFAULT_CONSTRUCTOR_UNRESOLVED, 2, 3, 9),
- errEx(ResolverErrorCode.DEFAULT_CONSTRUCTOR_UNRESOLVED, 3, 3, 13),
- errEx(ResolverErrorCode.DEFAULT_CONSTRUCTOR_UNRESOLVED, 10, 9, 1),
- errEx(ResolverErrorCode.DEFAULT_CONSTRUCTOR_UNRESOLVED, 11, 9, 5));
- {
- String message = errors.get(0).getMessage();
- assertTrue(message, message.contains("'F'"));
- assertTrue(message, message.contains("'F'"));
- }
- {
- String message = errors.get(1).getMessage();
- assertTrue(message, message.contains("'F.foo'"));
- assertTrue(message, message.contains("'F'"));
- }
- }
- DartUnit unit = libraryResult.getLibraryUnitResult().getUnits().iterator().next();
- // "new I()" - no such constructor, has other constructors, so no implicit default.
- {
- DartNewExpression newExpression = findNodeBySource(unit, "new I(0)");
- assertEquals(null, newExpression.getElement());
- }
- // "new I.foo()" - would be valid, if not "F implements I", but here invalid
- {
- DartNewExpression newExpression = findNodeBySource(unit, "new I.foo(0)");
- assertEquals(null, newExpression.getElement());
- }
- }
-
- /**
- * From specification 0.05, 11/14/2011.
- * <p>
- * A constructor kI of I corresponds to a constructor kF of its factory class F if either
- * <ul>
- * <li>F does not implement I and kI and kF have the same name, OR
- * <li>F implements I and either
- * <ul>
- * <li>kI is named NI and kF is named NF , OR
- * <li>kI is named NI.id and kF is named NF.id.
- * </ul>
- * </ul>
- * <p>
- * http://code.google.com/p/dart/issues/detail?id=521
- */
- public void test_resolveInterfaceConstructor_noFactoryImplementsInterface() throws Exception {
- AnalyzeLibraryResult libraryResult = analyzeLibrary(
- "Test.dart",
- Joiner.on("\n").join(
- "interface I default F {",
- " I(int x);",
- " I.foo(int x);",
- "}",
- "class F {",
- " F.foo(int y) {}",
- " factory I(int y) {}",
- " factory I.foo(int y) {}",
- "}",
- "class Test {",
- " foo() {",
- " new I(0);",
- " new I.foo(0);",
- " }",
- "}"));
- assertErrors(libraryResult.getCompilationErrors());
- DartUnit unit = libraryResult.getLibraryUnitResult().getUnits().iterator().next();
- // "new I()"
- {
- DartNewExpression newExpression = findNodeBySource(unit, "new I(0)");
- ConstructorElement constructorElement = newExpression.getElement();
- assertEquals(true, getElementSource(constructorElement).contains("I(int y)"));
- }
- // "new I.foo()"
- {
- DartNewExpression newExpression = findNodeBySource(unit, "new I.foo(0)");
- ConstructorElement constructorElement = newExpression.getElement();
- assertEquals(true, getElementSource(constructorElement).contains("I.foo(int y)"));
- }
- }
-
- /**
- * From specification 0.05, 11/14/2011.
- * <p>
- * A constructor kI of I corresponds to a constructor kF of its factory class F if either
- * <ul>
- * <li>F does not implement I and kI and kF have the same name, OR
- * <li>F implements I and either
- * <ul>
- * <li>kI is named NI and kF is named NF , OR
- * <li>kI is named NI.id and kF is named NF.id.
- * </ul>
- * </ul>
- * <p>
- * http://code.google.com/p/dart/issues/detail?id=521
- */
- public void test_resolveInterfaceConstructor_noFactoryImplementsInterface_negative()
- throws Exception {
- AnalyzeLibraryResult libraryResult = analyzeLibrary(
- "Test.dart",
- Joiner.on("\n").join(
- "interface I default F {",
- " I.foo(int x);",
- "}",
- "class F {",
- "}",
- "class Test {",
- " foo() {",
- " new I.foo(0);",
- " }",
- "}"));
- // Check errors.
- {
- List<DartCompilationError> errors = libraryResult.getCompilationErrors();
- assertErrors(
- errors,
- errEx(ResolverErrorCode.DEFAULT_CONSTRUCTOR_UNRESOLVED, 2, 3, 13),
- errEx(ResolverErrorCode.DEFAULT_CONSTRUCTOR_UNRESOLVED, 8, 9, 5));
- {
- String message = errors.get(0).getMessage();
- assertTrue(message, message.contains("'I.foo'"));
- assertTrue(message, message.contains("'F'"));
- }
- }
- DartUnit unit = libraryResult.getLibraryUnitResult().getUnits().iterator().next();
- // "new I.foo()"
- {
- DartNewExpression newExpression = findNodeBySource(unit, "new I.foo(0)");
- assertEquals(null, newExpression.getElement());
- }
- }
-
- /**
- * From specification 0.05, 11/14/2011.
- * <p>
- * It is a compile-time error if kI and kF do not have the same number of required parameters.
- * <p>
- * http://code.google.com/p/dart/issues/detail?id=521
- */
- public void test_resolveInterfaceConstructor_hasByName_negative_notSameNumberOfRequiredParameters()
- throws Exception {
- AnalyzeLibraryResult libraryResult = analyzeLibrary(
- "Test.dart",
- Joiner.on("\n").join(
- "interface I default F {",
- " I.foo(int x);",
- "}",
- "class F implements I {",
- " factory F.foo() {}",
- "}",
- "class Test {",
- " foo() {",
- " new I.foo();",
- " }",
- "}"));
- assertErrors(libraryResult.getTypeErrors());
- // Check errors.
- {
- List<DartCompilationError> errors = libraryResult.getCompilationErrors();
- assertErrors(
- errors,
- errEx(ResolverErrorCode.DEFAULT_CONSTRUCTOR_NUMBER_OF_REQUIRED_PARAMETERS, 2, 3, 13));
- {
- String message = errors.get(0).getMessage();
- assertTrue(message, message.contains("'F.foo'"));
- assertTrue(message, message.contains("'F'"));
- assertTrue(message, message.contains("0"));
- assertTrue(message, message.contains("1"));
- assertTrue(message, message.contains("'F.foo'"));
- }
- }
- DartUnit unit = libraryResult.getLibraryUnitResult().getUnits().iterator().next();
- // "new I.foo()" - resolved, but we produce error.
- {
- DartNewExpression newExpression = findNodeBySource(unit, "new I.foo()");
- ConstructorElement constructorElement = newExpression.getElement();
- assertEquals(true, getElementSource(constructorElement).contains("F.foo()"));
- }
- }
-
- /**
- * From specification 0.05, 11/14/2011.
- * <p>
- * It is a compile-time error if kI and kF do not have identically named optional parameters,
- * declared in the same order.
- * <p>
- * http://code.google.com/p/dart/issues/detail?id=521
- */
- public void test_resolveInterfaceConstructor_hasByName_negative_notSameNamedParameters()
- throws Exception {
- AnalyzeLibraryResult libraryResult = analyzeLibrary(
- "Test.dart",
- Joiner.on("\n").join(
- "interface I default F {",
- " I.foo(int a, [int b, int c]);",
- " I.bar(int a, [int b, int c]);",
- " I.baz(int a, [int b]);",
- "}",
- "class F implements I {",
- " factory F.foo(int any, [int b = 1]) {}",
- " factory F.bar(int any, [int c = 1, int b = 2]) {}",
- " factory F.baz(int any, [int c = 1]) {}",
- "}",
- "class Test {",
- " foo() {",
- " new I.foo(0);",
- " new I.bar(0);",
- " new I.baz(0);",
- " }",
- "}"));
- assertErrors(libraryResult.getTypeErrors());
- // Check errors.
- {
- List<DartCompilationError> errors = libraryResult.getCompilationErrors();
- assertErrors(
- errors,
- errEx(ResolverErrorCode.DEFAULT_CONSTRUCTOR_NAMED_PARAMETERS, 2, 3, 29),
- errEx(ResolverErrorCode.DEFAULT_CONSTRUCTOR_NAMED_PARAMETERS, 3, 3, 29),
- errEx(ResolverErrorCode.DEFAULT_CONSTRUCTOR_NAMED_PARAMETERS, 4, 3, 22));
- {
- String message = errors.get(0).getMessage();
- assertTrue(message, message.contains("'I.foo'"));
- assertTrue(message, message.contains("'F'"));
- assertTrue(message, message.contains("[b]"));
- assertTrue(message, message.contains("[b, c]"));
- assertTrue(message, message.contains("'F.foo'"));
- }
- {
- String message = errors.get(1).getMessage();
- assertTrue(message, message.contains("'I.bar'"));
- assertTrue(message, message.contains("'F'"));
- assertTrue(message, message.contains("[c, b]"));
- assertTrue(message, message.contains("[b, c]"));
- assertTrue(message, message.contains("'F.bar'"));
- }
- {
- String message = errors.get(2).getMessage();
- assertTrue(message, message.contains("'I.baz'"));
- assertTrue(message, message.contains("'F'"));
- assertTrue(message, message.contains("[b]"));
- assertTrue(message, message.contains("[c]"));
- assertTrue(message, message.contains("'F.baz'"));
- }
- }
- DartUnit unit = libraryResult.getLibraryUnitResult().getUnits().iterator().next();
- // "new I.foo()" - resolved, but we produce error.
- {
- DartNewExpression newExpression = findNodeBySource(unit, "new I.foo(0)");
- ConstructorElement constructorElement = newExpression.getElement();
- assertEquals(true, getElementSource(constructorElement).contains("F.foo("));
- }
- // "new I.bar()" - resolved, but we produce error.
- {
- DartNewExpression newExpression = findNodeBySource(unit, "new I.bar(0)");
- ConstructorElement constructorElement = newExpression.getElement();
- assertEquals(true, getElementSource(constructorElement).contains("F.bar("));
- }
- // "new I.baz()" - resolved, but we produce error.
- {
- DartNewExpression newExpression = findNodeBySource(unit, "new I.baz(0)");
- ConstructorElement constructorElement = newExpression.getElement();
- assertEquals(true, getElementSource(constructorElement).contains("F.baz("));
- }
- }
-
private static String getElementSource(Element element) throws Exception {
SourceInfo sourceInfo = element.getSourceInfo();
// TODO(scheglov) When we will remove Source.getNode(), this null check may be removed
@@ -789,12 +274,10 @@
*/
public void test_setElement_forName_inDeclarations() throws Exception {
AnalyzeLibraryResult libraryResult = analyzeLibrary(
- "Test.dart",
- Joiner.on("\n").join(
"// filler filler filler filler filler filler filler filler filler filler",
"class A<B extends A> {",
" var a1;",
- " get a2() {}",
+ " get a2 {}",
" A() {}",
"}",
"var c;",
@@ -805,7 +288,7 @@
" h: d(0);",
"}",
"typedef i();",
- ""));
+ "");
assertErrors(libraryResult.getErrors());
DartUnit unit = libraryResult.getLibraryUnitResult().getUnits().iterator().next();
// in class A
diff --git a/compiler/javatests/com/google/dart/compiler/resolver/ResolverTest.java b/compiler/javatests/com/google/dart/compiler/resolver/ResolverTest.java
index 9192064..75dfde1 100644
--- a/compiler/javatests/com/google/dart/compiler/resolver/ResolverTest.java
+++ b/compiler/javatests/com/google/dart/compiler/resolver/ResolverTest.java
@@ -177,9 +177,9 @@
// but the spec mentions no such error
resolveAndTest(Joiner.on("\n").join(
"class Object {}",
- "interface int {}",
- "interface bool {}",
- "interface I<X> {",
+ "class int {}",
+ "class bool {}",
+ "abstract class I<X> {",
"}",
"class A extends C implements I<int> {}",
"class B extends C implements I<bool> {}",
@@ -198,28 +198,6 @@
*/
}
- public void testImplicitDefaultConstructor_OnInterfaceWithoutFactory() {
- // Check that the implicit constructor is resolved correctly
- resolveAndTest(Joiner.on("\n").join(
- "class Object {}",
- "interface B {}",
- "class C { main() { new B(); } }"),
- ResolverErrorCode.NEW_EXPRESSION_NOT_CONSTRUCTOR);
-
- /*
- * We should check for signature mismatch but that is a TypeAnalyzer issue.
- */
- }
-
- public void testImplicitDefaultConstructor_ThroughFactories() {
- // Check that we generate implicit constructors through factories also.
- resolveAndTest(Joiner.on("\n").join(
- "class Object {}",
- "interface B default C {}",
- "class C {}",
- "class D { main() { new B(); } }"));
- }
-
public void testImplicitDefaultConstructor_WithConstCtor() {
// Check that we generate an error if the implicit constructor would violate const.
resolveAndTest(Joiner.on("\n").join(
@@ -272,33 +250,19 @@
resolveAndTest(Joiner.on("\n").join(
"class Object {}",
- "interface int {}",
- "interface bool {}",
+ "class int {}",
+ "class bool {}",
"class Cyclic extends Cyclic {",
"}",
"class A extends B {",
"}",
"class B extends A {",
"}",
- "interface I extends I {",
- "}",
- "class C implements I1, I {",
- "}",
- "interface I1 {",
- "}",
- "class D implements I1, I2 {",
- "}",
- "interface I2 extends I3 {",
- "}",
- "interface I3 extends I2 {",
+ "class C implements C {",
"}"),
ResolverErrorCode.CYCLIC_CLASS,
ResolverErrorCode.CYCLIC_CLASS,
ResolverErrorCode.CYCLIC_CLASS,
- ResolverErrorCode.CYCLIC_CLASS,
- ResolverErrorCode.CYCLIC_CLASS,
- ResolverErrorCode.CYCLIC_CLASS,
- ResolverErrorCode.CYCLIC_CLASS,
ResolverErrorCode.CYCLIC_CLASS
);
}
@@ -313,265 +277,6 @@
ResolverErrorCode.NO_SUCH_TYPE_CONSTRUCTOR);
}
-
- public void testDefaultTypeArgs1() {
- // Type arguments match
- resolveAndTest(Joiner.on("\n").join(
- "class Object {}",
- "interface int {}",
- "interface A<T> default B<T> {",
- " A();",
- "}",
- "class B<T> implements A<T> {",
- " B() {}",
- "}"));
- }
-
- public void testDefaultTypeArgs2() {
- // Type arguments match
- resolveAndTest(Joiner.on("\n").join(
- "class Object {}",
- "interface A<T> default B<T> {",
- "}",
- "class B<T> {",
- " factory A.construct () {}",
- "}"));
- }
-
- public void testDefaultTypeArgs3() {
- // Type arguments match
- resolveAndTest(Joiner.on("\n").join(
- "class Object {}",
- "interface A<T> default B<T> {",
- "}",
- "class B<T> {",
- " B() {}",
- "}"));
- }
-
- public void testDefaultTypeArgs4() {
- // Type arguments match
- resolveAndTest(Joiner.on("\n").join(
- "class Object {}",
- "interface A<T> default B<T> {",
- "}",
- "class B<T> implements A<T> {",
- " B() {}",
- "}"));
- }
-
- public void testDefaultTypeArgs5() {
- // Invoke constructor in factory method with (wrong) type args
- resolveAndTest(Joiner.on("\n").join(
- "class Object {}",
- "interface int {}",
- "interface A<T> default B {",
- "}",
- "class B<T> {",
- "}"));
- }
-
- public void testDefaultTypeArgs6() {
- // Invoke constructor in factory method with (wrong) type args
- resolveAndTest(Joiner.on("\n").join(
- "class Object {}",
- "interface int {}",
- "interface A<T> default B {",
- "}",
- "class B<T extends int> {",
- "}"));
- }
-
- public void testDefaultTypeArgs7() {
- // Example from spec v0.6
- resolveAndTest(Joiner.on("\n").join(
- "class Object{}",
- "interface Hashable {}",
- "class HashMapImplementation<K extends Hashable, V> {",
- "}",
- "interface Map<K, V> default HashMapImplementation<K extends Hashable, V> {",
- "}"));
- }
-
- public void testDefaultTypeArgs8() {
- resolveAndTest(Joiner.on("\n").join(
- "class Object{}",
- "interface A<K,V> default B<K, V extends K> {",
- "}",
- "class B<K, V extends K> {",
- "}"));
- }
-
- public void testDefaultTypeArgs9() {
- resolveAndTest(Joiner.on("\n").join(
- "class Object{}",
- "interface List<T> {}",
- "interface A<K,V> default B<K, V extends List<K>> {}",
- "class B<K, V extends List<K>> {",
- "}"));
- }
-
- public void testDefaultTypeArgs10() {
- resolveAndTest(Joiner.on("\n").join(
- "class Object{}",
- "interface List<T> {}",
- "class A<T, U, V> {}",
- "interface I2<T> default B<T extends A> {}",
- "class B<T extends A> {}",
- ""));
- }
-
-
- public void testDefaultTypeArgsNew() {
- // Invoke constructor in factory method with type args
- resolveAndTest(Joiner.on("\n").join(
- "class Object {}",
- "interface int {}",
- "interface A<T> default B<T> {",
- " B();",
- "}",
- "class C<T> implements A<T> {}",
- "class B<T> {",
- " factory B() { return new C<T>();}",
- "}"));
- }
-
- public void testFactoryBadTypeArgs1() {
- // Invoke constructor in factory method with (wrong) type args
- resolveAndTest(Joiner.on("\n").join(
- "class Object {}",
- "interface int {}",
- "interface A<T> default B<T> {",
- " A();",
- "}",
- "class C<T> implements A<T> {}",
- "class B<T> {",
- " factory A() { return new C<K>();}",
- "}"),
- TypeErrorCode.NO_SUCH_TYPE);
- }
-
- public void testFactoryBadTypeArgs2() {
- // Invoke constructor in factory method with (wrong) type args
- resolveAndTest(Joiner.on("\n").join(
- "class Object {}",
- "interface int {}",
- "interface A<T> default B {",
- " A();",
- "}",
- "class C<T> implements A<T> {}",
- "class B {",
- " factory A() { return new C<int>();}",
- "}"),
- ResolverErrorCode.DEFAULT_CLASS_MUST_HAVE_SAME_TYPE_PARAMS);
- }
-
- public void testFactoryBadTypeArgs3() {
- // Invoke constructor in factory method with (wrong) type args
- resolveAndTest(Joiner.on("\n").join(
- "class Object {}",
- "interface int {}",
- "interface A<T> default B<K> {",
- " A();",
- "}",
- "class C<T> implements A<T> {}",
- "class B<T> {",
- " factory A() { return new C<T>();}",
- "}"),
- ResolverErrorCode.TYPE_PARAMETERS_MUST_MATCH_EXACTLY);
- }
-
- public void testFactoryBadTypeArgs4() {
- // Invoke constructor in factory method with (wrong) type args
- resolveAndTest(Joiner.on("\n").join(
- "class Object {}",
- "interface int {}",
- "interface A<T> default B<T> {",
- " A();",
- "}",
- "class C<T> implements A<T> {}",
- "class B<K> {",
- " factory A() { return new C<K>();}",
- "}"),
- ResolverErrorCode.TYPE_PARAMETERS_MUST_MATCH_EXACTLY,
- ResolverErrorCode.TYPE_VARIABLE_DOES_NOT_MATCH);
- }
-
- public void testFactoryBadTypeArgs5() {
- // Invoke constructor in factory method with (wrong) type args
- resolveAndTest(Joiner.on("\n").join(
- "class Object {}",
- "interface int {}",
- "interface A<T> default B<T,L> {",
- " A();",
- "}",
- "class C<T> implements A<T> {}",
- "class B<T> {",
- " factory A() { return new C<T>();}",
- "}"),
- ResolverErrorCode.TYPE_PARAMETERS_MUST_MATCH_EXACTLY);
- }
-
- public void testFactoryBadTypeArgs6() {
- // Invoke constructor in factory method with (wrong) type args
- resolveAndTest(Joiner.on("\n").join(
- "class Object {}",
- "interface int {}",
- "interface A<T> default B<K> {",
- " A();",
- "}",
- "class C<T> implements A<T> {}",
- "class B<K> {",
- " factory A() { return new C<K>();}",
- "}"),
- ResolverErrorCode.TYPE_VARIABLE_DOES_NOT_MATCH);
- }
-
- public void testFactoryBadTypeArgs7() {
- // Invoke constructor in factory method with (wrong) type args
- resolveAndTest(Joiner.on("\n").join(
- "class Object {}",
- "interface int {}",
- "interface A<T,K> default B<T,K> {",
- " A();",
- "}",
- "class C<T,K> implements A<T,K> {}",
- "class B<K,T> {",
- " factory A() { return new C<int, Object>();}",
- "}"),
- ResolverErrorCode.TYPE_PARAMETERS_MUST_MATCH_EXACTLY,
- ResolverErrorCode.TYPE_VARIABLE_DOES_NOT_MATCH,
- ResolverErrorCode.TYPE_VARIABLE_DOES_NOT_MATCH);
- }
-
- public void testFactoryBadTypeArgs8() {
- // Invoke constructor in factory method with (wrong) type args
- resolveAndTest(Joiner.on("\n").join(
- "class Object {}",
- "interface int {}",
- "interface A<T> default B<T> {",
- " A();",
- "}",
- "class B<T extends int> {",
- " factory A() {}",
- "}"),
- ResolverErrorCode.TYPE_PARAMETERS_MUST_MATCH_EXACTLY);
- }
-
- public void testFactoryBadTypeArgs9() {
- // Invoke constructor in factory method with (wrong) type args
- resolveAndTest(Joiner.on("\n").join(
- "class Object {}",
- "interface int {}",
- "interface A<T> default B<T extends int> {",
- " A();",
- "}",
- "class B<T> {",
- " factory A() {}",
- "}"),
- ResolverErrorCode.TYPE_PARAMETERS_MUST_MATCH_EXACTLY);
- }
-
public void test_constFactory() throws Exception {
resolveAndTest(Joiner.on("\n").join(
"class Object {}",
@@ -581,44 +286,6 @@
errEx(ResolverErrorCode.FACTORY_CANNOT_BE_CONST, 3, 17, 1));
}
- public void testFactoryBadTypeArgs11() {
- // Invoke constructor in factory method with (wrong) type args
- resolveAndTest(Joiner.on("\n").join(
- "class Object {}",
- "interface int {}",
- "interface A<T> default Bogus {",
- "}",
- "class B<T> {",
- "}"),
- ResolverErrorCode.NO_SUCH_TYPE);
- }
-
- public void testFactoryBadTypeArgs10() {
- // Invoke constructor in factory method with (wrong) type args
- resolveAndTest(Joiner.on("\n").join(
- "class Object {}",
- "interface int {}",
- "interface A<T> default B {",
- " A();",
- "}",
- "class B {",
- " factory A() {}",
- "}"),
- ResolverErrorCode.DEFAULT_CLASS_MUST_HAVE_SAME_TYPE_PARAMS);
- }
-
- public void testBadDefaultTypeArgs11() {
- // Example from spec v0.6
- resolveAndTest(Joiner.on("\n").join(
- "class Object{}",
- "interface Hashable {}",
- "class HashMapImplementation<K extends Hashable, V> {",
- "}",
- "interface Map<K, V> default HashMapImplementation<K, V> {",
- "}"),
- ResolverErrorCode.TYPE_PARAMETERS_MUST_MATCH_EXACTLY);
- }
-
public void testBadGenerativeConstructor1() {
resolveAndTest(Joiner.on("\n").join(
"class Object { }",
@@ -640,18 +307,6 @@
ResolverErrorCode.TOO_MANY_QUALIFIERS_FOR_METHOD);
}
- public void testBadGenerativeConstructor3() {
- resolveAndTest(Joiner.on("\n").join(
- "class Object { }",
- "interface B { }",
- "class A extends B {",
- " var val; ",
- " B.foo() : this.val = 1;",
- "}"),
- ResolverErrorCode.NOT_A_CLASS,
- ResolverErrorCode.CANNOT_DECLARE_NON_FACTORY_CONSTRUCTOR);
- }
-
public void testGenerativeConstructor() {
resolveAndTest(Joiner.on("\n").join(
"class Object {}",
@@ -750,19 +405,6 @@
TypeErrorCode.NO_SUCH_TYPE);
}
- public void testNewExpression6() {
- resolveAndTest(Joiner.on("\n").join(
- "class Object {}",
- "interface int {}",
- "interface A<T> default B<T> {",
- " A.construct(); ",
- "}",
- "class B<T> implements A<T> {",
- " B() { }",
- " factory B.construct() { return new B<T>(); }",
- "}"));
- }
-
public void test_noSuchType_field() throws Exception {
resolveAndTest(Joiner.on("\n").join(
"class Object {}",
@@ -857,7 +499,7 @@
String source =
Joiner.on("\n").join(
"class Object {}",
- "interface Base<T> {}",
+ "abstract class Base<T> {}",
"class MyClass implements Base<Unknown> {",
"}");
List<DartCompilationError> errors = resolveAndTest(source, ResolverErrorCode.NO_SUCH_TYPE);
@@ -1080,8 +722,8 @@
public void test_noSuchType_mapLiteral_num_type_args() throws Exception {
resolveAndTest(Joiner.on("\n").join(
"class Object {}",
- "interface int {}",
- "interface String {}",
+ "class int {}",
+ "class String {}",
"class MyClass {",
" foo() {",
" var map0 = {};",
@@ -1248,7 +890,7 @@
public void testConstClass() {
resolveAndTest(Joiner.on("\n").join(
"class Object {}",
- "interface int {}",
+ "class int {}",
"class GoodBase {",
" const GoodBase() : foo = 1;",
" final foo;",
@@ -1286,7 +928,7 @@
public void testFinalInit1() {
resolveAndTest(Joiner.on("\n").join(
"class Object {}",
- "interface int {}",
+ "class int {}",
"final f1 = 1;",
"final f2;", // error
"class A {",
@@ -1343,18 +985,6 @@
"}"));
}
- public void testFinalInit6() {
- resolveAndTest(Joiner.on("\n").join(
- "class Object {}",
- "interface I1 {",
- " final a;", // not initialized, but in an interface
- "}",
- "interface I2 {",
- " final a;", // not initialized, but in an interface
- " C(arg);",
- "}"));
- }
-
public void testFinalInit7() {
resolveAndTest(Joiner.on("\n").join(
"class Object {}",
@@ -1376,7 +1006,7 @@
resolveAndTest(Joiner.on("\n").join(
"// filler filler filler filler filler filler filler filler filler filler",
"class Object {}",
- "interface int {}",
+ "class int {}",
"const f;",
""),
errEx(ResolverErrorCode.CONST_REQUIRES_VALUE, 4, 7, 1));
@@ -1403,12 +1033,12 @@
public void testNoGetterOrSetter() {
resolveAndTest(Joiner.on("\n").join(
"class Object {}",
- "get getter1() {}",
+ "get getter1 {}",
"set setter1(arg) {}",
"class A {",
- " static get getter2() {}",
+ " static get getter2 {}",
" static set setter2(arg) {}",
- " get getter3() {}",
+ " get getter3 {}",
" set setter3(arg) {}",
"}",
"method() {",
@@ -1434,7 +1064,7 @@
public void testErrorInUnqualifiedInvocation1() {
resolveAndTest(Joiner.on("\n").join(
"class Object {}",
- "interface int {}",
+ "class int {}",
"class Foo {",
" Foo() {}",
"}",
@@ -1447,7 +1077,7 @@
public void testErrorInUnqualifiedInvocation2() {
resolveAndTest(Joiner.on("\n").join(
"class Object {}",
- "interface int {}",
+ "class int {}",
"class Foo {}",
"method() {",
" Foo();",
@@ -1458,7 +1088,7 @@
public void testErrorInUnqualifiedInvocation3() {
resolveAndTest(Joiner.on("\n").join(
"class Object {}",
- "interface int {}",
+ "class int {}",
"class Foo<T> {",
" method() {",
" T();",
@@ -1471,7 +1101,7 @@
public void testErrorInUnqualifiedInvocation4() {
resolveAndTest(Joiner.on("\n").join(
"class Object {}",
- "interface int {}",
+ "class int {}",
"typedef int foo();",
"method() {",
" foo();",
@@ -1482,7 +1112,7 @@
public void testErrorInUnqualifiedInvocation5() {
resolveAndTest(Joiner.on("\n").join(
"class Object {}",
- "interface int {}",
+ "class int {}",
"method() {",
" outer: for(int i = 0; i < 1; i++) {",
" outer();",
@@ -1501,28 +1131,42 @@
// requested to disable this
resolveAndTest(Joiner.on("\n").join(
"class Object {}",
- "method([_foo]) {}",
+ "method({_foo}) {}",
"class Foo {",
" var _bar;",
- " //Foo([this._bar]){}",
- " method([_foo]){}",
+ " //Foo({this._bar}){}",
+ " method({_foo}){}",
"}"),
errEx(ResolverErrorCode.NAMED_PARAMETERS_CANNOT_START_WITH_UNDER, 2, 9, 4),
// errEx(ResolverErrorCode.NAMED_PARAMETERS_CANNOT_START_WITH_UNDER, 5, 8, 9),
errEx(ResolverErrorCode.NAMED_PARAMETERS_CANNOT_START_WITH_UNDER, 6, 11, 4));
}
+
+ public void testUndercoreInOptionalParameterMethodDefinition() {
+ resolveAndTest(Joiner.on("\n").join(
+ "class Object {}",
+ "method([_foo]) {}",
+ "typedef myFuncType([_foo]);",
+ "class Foo {",
+ " var _bar;",
+ " method([_foo]){}",
+ "}"),
+ errEx(ResolverErrorCode.OPTIONAL_PARAMETERS_CANNOT_START_WITH_UNDER, 2, 9, 4),
+ errEx(ResolverErrorCode.OPTIONAL_PARAMETERS_CANNOT_START_WITH_UNDER, 6, 11, 4),
+ errEx(ResolverErrorCode.OPTIONAL_PARAMETERS_CANNOT_START_WITH_UNDER, 3, 21, 4));
+ }
public void testUndercoreInNamedParameterFunctionDefinition() {
resolveAndTest(Joiner.on("\n").join(
"class Object {}",
- "var f = func([_foo]) {};"),
+ "var f = func({_foo}) {};"),
errEx(ResolverErrorCode.NAMED_PARAMETERS_CANNOT_START_WITH_UNDER, 2, 15, 4));
}
public void testUndercoreInNamedParameterFunctionAlias() {
resolveAndTest(Joiner.on("\n").join(
"class Object {}",
- "typedef Object func([_foo]);"),
+ "typedef Object func({_foo});"),
errEx(ResolverErrorCode.NAMED_PARAMETERS_CANNOT_START_WITH_UNDER, 2, 22, 4));
}
@@ -1567,7 +1211,7 @@
public void test_redirectConstructor() {
resolveAndTest(Joiner.on("\n").join(
"class Object {}",
- "interface int {}",
+ "class int {}",
"int topLevel() {}",
"class A {",
" method() {}",
@@ -1613,23 +1257,17 @@
resolveAndTest(Joiner.on("\n").join(
"class Object {}",
"class A {",
- " abstract A();",
- " abstract A.named();",
- "}",
- "class B {",
- " static B() {}",
- " static B.named() {}",
+ " static A() {}",
+ " static A.named() {}",
"}"),
- errEx(ResolverErrorCode.CONSTRUCTOR_CANNOT_BE_ABSTRACT, 3, 12, 1),
- errEx(ResolverErrorCode.CONSTRUCTOR_CANNOT_BE_ABSTRACT, 4, 12, 7),
- errEx(ResolverErrorCode.CONSTRUCTOR_CANNOT_BE_STATIC, 7, 10, 1),
- errEx(ResolverErrorCode.CONSTRUCTOR_CANNOT_BE_STATIC, 8, 10, 7));
+ errEx(ResolverErrorCode.CONSTRUCTOR_CANNOT_BE_STATIC, 3, 10, 1),
+ errEx(ResolverErrorCode.CONSTRUCTOR_CANNOT_BE_STATIC, 4, 10, 7));
}
public void test_illegalConstructorReturnType() throws Exception {
resolveAndTest(Joiner.on("\n").join(
"class Object {}",
- "interface int {}",
+ "class int {}",
"class A {",
" void A();",
" void A.named();",
@@ -1678,18 +1316,6 @@
errEx(ResolverErrorCode.CANNOT_CALL_FUNCTION_TYPE_ALIAS, 4, 3, 6));
}
- public void test_defaultTargetInterface() throws Exception {
- resolveAndTest(Joiner.on("\n").join(
- "class Object {}",
- "interface A default B {",
- " A();",
- "}",
- "interface B {",
- "}"),
- errEx(ResolverErrorCode.DEFAULT_MUST_SPECIFY_CLASS, 2, 21, 1),
- errEx(ResolverErrorCode.DEFAULT_CONSTRUCTOR_UNRESOLVED, 3, 3, 4));
- }
-
public void test_initializerErrors() {
resolveAndTest(Joiner.on("\n").join(
"class Object {}",
@@ -1707,15 +1333,6 @@
errEx(ResolverErrorCode.EXPECTED_FIELD_NOT_TYPE_VAR, 8, 12, 1));
}
- public void test_noDefaultOnInterface() throws Exception {
- resolveAndTest(Joiner.on("\n").join(
- "class Object {}",
- "interface I {",
- " I();",
- "}"),
- errEx(ResolverErrorCode.ILLEGAL_CONSTRUCTOR_NO_DEFAULT_IN_INTERFACE, 3, 3, 1));
- }
-
public void test_illegalAccessFromStatic() throws Exception {
resolveAndTest(Joiner.on("\n").join(
"class Object {}",
diff --git a/compiler/javatests/com/google/dart/compiler/resolver/ResolverTestCase.java b/compiler/javatests/com/google/dart/compiler/resolver/ResolverTestCase.java
index b5f4233..6819987 100644
--- a/compiler/javatests/com/google/dart/compiler/resolver/ResolverTestCase.java
+++ b/compiler/javatests/com/google/dart/compiler/resolver/ResolverTestCase.java
@@ -108,8 +108,8 @@
parameterNodes.add(makeTypeVariable(parameter));
}
List<DartNode> members = Arrays.<DartNode>asList();
- return new DartClass(new DartIdentifier(name), null, supertype,
- interfaces, -1, -1, members, parameterNodes, Modifiers.NONE);
+ return new DartClass(-1, 0, new DartIdentifier(name), null, supertype,
+ -1, interfaces, -1, -1, -1, members, parameterNodes, Modifiers.NONE);
}
static DartClass makeInterface(String name, List<DartTypeNode> interfaces,
@@ -119,8 +119,8 @@
parameterNodes.add(makeTypeVariable(parameter));
}
List<DartNode> members = Arrays.<DartNode> asList();
- return new DartClass(new DartIdentifier(name), null, null, interfaces, -1, -1, members,
- parameterNodes, defaultClass, true, Modifiers.NONE);
+ return new DartClass(-1, 0, new DartIdentifier(name), null, null, -1, interfaces, -1, -1, -1,
+ members, parameterNodes, defaultClass, true, Modifiers.NONE);
}
static DartParameterizedTypeNode makeDefault(String name) {
diff --git a/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java b/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java
index e532d26..445482f 100644
--- a/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java
+++ b/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java
@@ -3,21 +3,14 @@
// BSD-style license that can be found in the LICENSE file.
package com.google.dart.compiler.type;
-import com.google.common.base.Joiner;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import com.google.dart.compiler.CommandLineOptions.CompilerOptions;
import com.google.dart.compiler.CompilerTestCase;
-import com.google.dart.compiler.DartArtifactProvider;
import com.google.dart.compiler.DartCompilationError;
-import com.google.dart.compiler.DartCompiler;
import com.google.dart.compiler.DartCompilerErrorCode;
-import com.google.dart.compiler.DartCompilerListener;
import com.google.dart.compiler.DefaultCompilerConfiguration;
-import com.google.dart.compiler.MockArtifactProvider;
-import com.google.dart.compiler.MockLibrarySource;
import com.google.dart.compiler.ast.ASTVisitor;
import com.google.dart.compiler.ast.DartArrayAccess;
import com.google.dart.compiler.ast.DartBinaryExpression;
@@ -36,7 +29,6 @@
import com.google.dart.compiler.ast.DartMethodInvocation;
import com.google.dart.compiler.ast.DartNewExpression;
import com.google.dart.compiler.ast.DartNode;
-import com.google.dart.compiler.ast.DartParameter;
import com.google.dart.compiler.ast.DartPropertyAccess;
import com.google.dart.compiler.ast.DartTypeNode;
import com.google.dart.compiler.ast.DartUnaryExpression;
@@ -57,8 +49,6 @@
import static com.google.dart.compiler.common.ErrorExpectation.assertErrors;
import static com.google.dart.compiler.common.ErrorExpectation.errEx;
-import java.io.Reader;
-import java.io.StringReader;
import java.net.URI;
import java.util.List;
import java.util.Set;
@@ -174,14 +164,16 @@
"typedef A A();",
"typedef B(B b);",
"typedef C([C c]);",
- "typedef D<T extends D>();",
+ "typedef D({D d});",
+ "typedef E<T extends E>();",
"");
assertErrors(
libraryResult.getErrors(),
errEx(TypeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF, 2, 1, 14),
errEx(TypeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF, 3, 1, 15),
errEx(TypeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF, 4, 1, 17),
- errEx(TypeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF, 5, 1, 25));
+ errEx(TypeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF, 5, 1, 17),
+ errEx(TypeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF, 6, 1, 25));
}
/**
@@ -199,8 +191,10 @@
"typedef B2(A2 a);",
"typedef B3 A3();",
"typedef B3([A3 a]);",
- "typedef A4<T extends B4>();",
- "typedef B4(A4 a);",
+ "typedef B4 A4();",
+ "typedef B4({A4 a});",
+ "typedef A5<T extends B5>();",
+ "typedef B5(A5 a);",
"");
assertErrors(
libraryResult.getErrors(),
@@ -210,8 +204,10 @@
errEx(TypeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF, 5, 1, 17),
errEx(TypeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF, 6, 1, 16),
errEx(TypeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF, 7, 1, 19),
- errEx(TypeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF, 8, 1, 27),
- errEx(TypeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF, 9, 1, 17));
+ errEx(TypeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF, 8, 1, 16),
+ errEx(TypeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF, 9, 1, 19),
+ errEx(TypeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF, 10, 1, 27),
+ errEx(TypeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF, 11, 1, 17));
}
/**
@@ -252,8 +248,6 @@
public void test_resolveClassMethod() throws Exception {
AnalyzeLibraryResult libraryResult =
analyzeLibrary(
- "Test.dart",
- Joiner.on("\n").join(
"class Object {}",
"class Test {",
" foo() {",
@@ -261,7 +255,7 @@
" }",
" f() {",
" }",
- "}"));
+ "}");
DartUnit unit = libraryResult.getLibraryUnitResult().getUnits().iterator().next();
// find f() invocation
DartInvocation invocation = findInvocationSimple(unit, "f()");
@@ -287,16 +281,14 @@
public void test_resolveLocalFunction() throws Exception {
AnalyzeLibraryResult libraryResult =
analyzeLibrary(
- "Test.dart",
- Joiner.on("\n").join(
- "class Object {}",
- "class Test {",
- " foo() {",
- " f() {",
- " }",
- " f();",
- " }",
- "}"));
+ "class Object {}",
+ "class Test {",
+ " foo() {",
+ " f() {",
+ " }",
+ " f();",
+ " }",
+ "}");
DartUnit unit = libraryResult.getLibraryUnitResult().getUnits().iterator().next();
// find f() invocation
DartInvocation invocation = findInvocationSimple(unit, "f()");
@@ -490,7 +482,7 @@
* http://code.google.com/p/dart/issues/detail?id=345
*/
public void test_badTopLevelFactory() throws Exception {
- AnalyzeLibraryResult libraryResult = analyzeLibrary("Test.dart", "factory foo() {}");
+ AnalyzeLibraryResult libraryResult = analyzeLibrary("factory foo() {}");
DartUnit unit = libraryResult.getLibraryUnitResult().getUnits().iterator().next();
DartMethodDefinition factory = (DartMethodDefinition) unit.getTopLevelNodes().get(0);
assertNotNull(factory);
@@ -535,83 +527,6 @@
}
/**
- * From specification 0.05, 11/14/2011.
- * <p>
- * It is a static type warning if the type of the nth required formal parameter of kI is not
- * identical to the type of the nth required formal parameter of kF.
- * <p>
- * It is a static type warning if the types of named optional parameters with the same name differ
- * between kI and kF .
- * <p>
- * http://code.google.com/p/dart/issues/detail?id=521
- */
- public void test_resolveInterfaceConstructor_hasByName_negative_notSameParametersType()
- throws Exception {
- AnalyzeLibraryResult libraryResult =
- analyzeLibrary(
- "Test.dart",
- Joiner.on("\n").join(
- "interface I default F {",
- " I.foo(int a, [int b, int c]);",
- "}",
- "class F implements I {",
- " factory F.foo(num any, [bool b, Object c]) {}",
- "}",
- "class Test {",
- " foo() {",
- " new I.foo(0);",
- " }",
- "}"));
- // No compilation errors.
- assertErrors(libraryResult.getCompilationErrors());
- // Check type warnings.
- {
- List<DartCompilationError> errors = libraryResult.getTypeErrors();
- assertErrors(errors, errEx(TypeErrorCode.DEFAULT_CONSTRUCTOR_TYPES, 2, 3, 29));
- assertEquals(
- "Constructor 'I.foo' in 'I' has parameters types (int,int,int), doesn't match 'F.foo' in 'F' with (num,bool,Object)",
- errors.get(0).getMessage());
- }
- DartUnit unit = libraryResult.getLibraryUnitResult().getUnits().iterator().next();
- // "new I.foo()" - resolved, but we produce error.
- {
- DartNewExpression newExpression = findNodeBySource(unit, "new I.foo(0)");
- DartNode constructorNode = newExpression.getElement().getNode();
- assertEquals(true, constructorNode.toSource().contains("F.foo("));
- }
- }
-
- /**
- * There was problem that <code>this.fieldName</code> constructor parameter had no type, so we
- * produced incompatible interface/default class warning.
- */
- public void test_resolveInterfaceConstructor_sameParametersType_thisFieldParameter()
- throws Exception {
- AnalyzeLibraryResult libraryResult =
- analyzeLibrary(
- "Test.dart",
- Joiner.on("\n").join(
- "interface I default F {",
- " I(int a);",
- "}",
- "class F implements I {",
- " int a;",
- " F(this.a) {}",
- "}"));
- // Check that parameter has resolved type.
- {
- DartUnit unit = libraryResult.getLibraryUnitResult().getUnits().iterator().next();
- DartClass classF = (DartClass) unit.getTopLevelNodes().get(1);
- DartMethodDefinition methodF = (DartMethodDefinition) classF.getMembers().get(1);
- DartParameter parameter = methodF.getFunction().getParameters().get(0);
- assertEquals("int", parameter.getElement().getType().toString());
- }
- // No errors or type warnings.
- assertErrors(libraryResult.getCompilationErrors());
- assertErrors(libraryResult.getTypeErrors());
- }
-
- /**
* In contrast, if A is intended to be concrete, the checker should warn about all unimplemented
* methods, but allow clients to instantiate it freely.
*/
@@ -619,20 +534,18 @@
throws Exception {
AnalyzeLibraryResult libraryResult =
analyzeLibrary(
- getName(),
- makeCode(
- "interface Foo {",
- " int fooA;",
- " void fooB();",
- "}",
- "interface Bar {",
- " void barA();",
- "}",
- "class A implements Foo, Bar {",
- "}",
- "main() {",
- " new A();",
- "}"));
+ "interface Foo {",
+ " int fooA;",
+ " void fooB();",
+ "}",
+ "interface Bar {",
+ " void barA();",
+ "}",
+ "class A implements Foo, Bar {",
+ "}",
+ "main() {",
+ " new A();",
+ "}");
assertErrors(
libraryResult.getTypeErrors(),
errEx(TypeErrorCode.CONTRETE_CLASS_WITH_UNIMPLEMENTED_MEMBERS, 8, 7, 1));
@@ -655,8 +568,6 @@
throws Exception {
AnalyzeLibraryResult libraryResult =
analyzeLibrary(
- getName(),
- makeCode(
"abstract class A {",
" abstract void foo();",
"}",
@@ -664,7 +575,7 @@
"}",
"main() {",
" new B();",
- "}"));
+ "}");
assertErrors(
libraryResult.getTypeErrors(),
errEx(TypeErrorCode.CONTRETE_CLASS_WITH_UNIMPLEMENTED_MEMBERS, 4, 7, 1));
@@ -684,14 +595,12 @@
throws Exception {
AnalyzeLibraryResult libraryResult =
analyzeLibrary(
- getName(),
- makeCode(
- "class A {",
- " abstract void foo();",
- "}",
- "main() {",
- " new A();",
- "}"));
+ "class A {",
+ " abstract void foo();",
+ "}",
+ "main() {",
+ " new A();",
+ "}");
assertErrors(
libraryResult.getTypeErrors(),
errEx(TypeErrorCode.CONTRETE_CLASS_WITH_UNIMPLEMENTED_MEMBERS, 1, 7, 1));
@@ -707,14 +616,12 @@
throws Exception {
AnalyzeLibraryResult libraryResult =
analyzeLibrary(
- getName(),
- makeCode(
"class A {",
- " abstract get x();",
+ " abstract get x;",
"}",
"main() {",
" new A();",
- "}"));
+ "}");
assertErrors(
libraryResult.getTypeErrors(),
errEx(TypeErrorCode.CONTRETE_CLASS_WITH_UNIMPLEMENTED_MEMBERS, 1, 7, 1));
@@ -747,11 +654,11 @@
public void test_warnAbstract_whenInstantiate_implementsOnlyGetter() throws Exception {
AnalyzeLibraryResult libraryResult = analyzeLibrary(
"interface I {",
- " get foo();",
+ " get foo;",
" set foo(x);",
"}",
"class A implements I {",
- " get foo() => 0;",
+ " get foo => 0;",
"}",
"main() {",
" new A();",
@@ -768,15 +675,15 @@
public void test_warnAbstract_whenInstantiate_implementsSetter_inSuperClass() throws Exception {
AnalyzeLibraryResult libraryResult = analyzeLibrary(
"interface I {",
- " get foo();",
+ " get foo;",
" set foo(x);",
"}",
"abstract class A implements I {",
- " abstract get foo();",
+ " abstract get foo;",
" set foo(x) {}",
"}",
"class B extends A {",
- " get foo() => 0;",
+ " get foo => 0;",
"}",
"main() {",
" new B();",
@@ -788,14 +695,12 @@
throws Exception {
AnalyzeLibraryResult libraryResult =
analyzeLibrary(
- getName(),
- makeCode(
- "abstract class A {",
- " abstract void bar();",
- "}",
- "main() {",
- " new A();",
- "}"));
+ "abstract class A {",
+ " abstract void bar();",
+ "}",
+ "main() {",
+ " new A();",
+ "}");
assertErrors(
libraryResult.getTypeErrors(),
errEx(TypeErrorCode.INSTANTIATION_OF_ABSTRACT_CLASS, 5, 7, 1));
@@ -808,22 +713,18 @@
*/
public void test_warnAbstract_onAbstractClass_whenInstantiate_factoryConstructor()
throws Exception {
- AnalyzeLibraryResult libraryResult =
- analyzeLibrary(
- getName(),
- makeCode(
- "abstract class A {", // explicitly abstract
- " factory A() {",
- " return null;",
- " }",
- "}",
- "class C {",
- " foo() {",
- " return new A();", // no error - factory constructor
- " }",
- "}"));
- assertErrors(
- libraryResult.getTypeErrors());
+ AnalyzeLibraryResult libraryResult = analyzeLibrary(
+ "abstract class A {", // explicitly abstract
+ " factory A() {",
+ " return null;",
+ " }",
+ "}",
+ "class C {",
+ " foo() {",
+ " return new A();", // no error - factory constructor
+ " }",
+ "}");
+ assertErrors(libraryResult.getTypeErrors());
}
/**
@@ -835,21 +736,18 @@
throws Exception {
AnalyzeLibraryResult libraryResult =
analyzeLibrary(
- getName(),
- makeCode(
- "abstract class A {", // class is abstract
- " factory A() {",
- " return null;",
- " }",
- " abstract method();",
- "}",
- "class C {",
- " foo() {",
- " return new A();", // no error, factory constructor
- " }",
- "}"));
- assertErrors(
- libraryResult.getTypeErrors());
+ "abstract class A {", // class is abstract
+ " factory A() {",
+ " return null;",
+ " }",
+ " abstract method();",
+ "}",
+ "class C {",
+ " foo() {",
+ " return new A();", // no error, factory constructor
+ " }",
+ "}");
+ assertErrors(libraryResult.getTypeErrors());
}
/**
@@ -858,14 +756,12 @@
public void testWarnOnNonVoidSetter() throws Exception {
AnalyzeLibraryResult libraryResult =
analyzeLibrary(
- getName(),
- makeCode(
"class A {",
" void set foo(bool a) {}",
" set bar(bool a) {}",
" dynamic set baz(bool a) {}",
" bool set bob(bool a) {}",
- "}"));
+ "}");
assertErrors(
libraryResult.getTypeErrors(),
errEx(TypeErrorCode.SETTER_RETURN_TYPE, 4, 3, 7),
@@ -890,14 +786,12 @@
public void test_callFunctionFromField() throws Exception {
AnalyzeLibraryResult libraryResult =
analyzeLibrary(
- getName(),
- makeCode(
- "class WorkElement {",
- " Function run;",
- "}",
- "foo(WorkElement e) {",
- " e.run();",
- "}"));
+ "class WorkElement {",
+ " Function run;",
+ "}",
+ "foo(WorkElement e) {",
+ " e.run();",
+ "}");
assertErrors(libraryResult.getTypeErrors());
}
@@ -925,16 +819,14 @@
*/
public void test_doubleGetterAccess_inForEach() throws Exception {
AnalyzeLibraryResult libraryResult = analyzeLibrary(
- getName(),
- makeCode(
"class Test {",
- " Iterable get iter() {}",
+ " Iterable get iter {}",
"}",
- "Test get test() {}",
+ "Test get test {}",
"f() {",
" for (var v in test.iter) {}",
"}",
- ""));
+ "");
assertErrors(libraryResult.getTypeErrors());
}
@@ -945,8 +837,6 @@
public void test_invocationArguments() throws Exception {
AnalyzeLibraryResult libraryResult =
analyzeLibrary(
- getName(),
- makeCode(
"/* 01 */ foo() {",
"/* 02 */ f_0_0();",
"/* 03 */ f_0_0(-1);",
@@ -963,18 +853,14 @@
"/* 14 */ f_0_1(n1: 1);",
"/* 15 */ f_0_1(x: 1);",
"/* 16 */ f_0_1(n1: 1, n1: 2);",
- "/* 17 */",
- "/* 18 */ f_1_3(-1, 1, n3: 2);",
- "/* 19 */ f_1_3(-1, 1, n1: 1);",
"}",
"",
"f_0_0() {}",
"f_1_0(r1) {}",
"f_2_0(r1, r2) {}",
- "f_0_1([n1]) {}",
- "f_0_2([n1, n2]) {}",
- "f_1_3(r1, [n1, n2, n3]) {}",
- ""));
+ "f_0_1({n1}) {}",
+ "f_0_2({n1, n2}) {}",
+ "");
assertErrors(
libraryResult.getTypeErrors(),
errEx(TypeErrorCode.EXTRA_ARGUMENT, 3, 18, 2),
@@ -982,13 +868,32 @@
errEx(TypeErrorCode.EXTRA_ARGUMENT, 7, 22, 2),
errEx(TypeErrorCode.EXTRA_ARGUMENT, 7, 26, 2),
errEx(TypeErrorCode.MISSING_ARGUMENT, 9, 12, 5),
+ errEx(TypeErrorCode.EXTRA_ARGUMENT, 12, 18, 1),
+ errEx(TypeErrorCode.EXTRA_ARGUMENT, 13, 18, 1),
errEx(TypeErrorCode.EXTRA_ARGUMENT, 13, 21, 1),
- errEx(TypeErrorCode.NO_SUCH_NAMED_PARAMETER, 15, 18, 4),
- errEx(TypeErrorCode.DUPLICATE_NAMED_ARGUMENT, 19, 25, 5));
+ errEx(TypeErrorCode.NO_SUCH_NAMED_PARAMETER, 15, 18, 4));
assertErrors(
libraryResult.getCompilationErrors(),
errEx(ResolverErrorCode.DUPLICATE_NAMED_ARGUMENT, 16, 25, 5));
}
+
+ /**
+ * Test that optional positional and named parameters are handled separately.
+ */
+ public void test_invocationArguments2() throws Exception {
+ AnalyzeLibraryResult libraryResult = analyzeLibrary(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "func([int np1, int np2, int np3]) {}",
+ "main() {",
+ " func(np1: 1, np2: 2, np3: 2);",
+ "}",
+ "");
+ assertErrors(
+ libraryResult.getTypeErrors(),
+ errEx(TypeErrorCode.NO_SUCH_NAMED_PARAMETER, 4, 8, 6),
+ errEx(TypeErrorCode.NO_SUCH_NAMED_PARAMETER, 4, 16, 6),
+ errEx(TypeErrorCode.NO_SUCH_NAMED_PARAMETER, 4, 24, 6));
+ }
/**
* We should return correct {@link Type} for {@link DartNewExpression}.
@@ -996,27 +901,24 @@
public void test_DartNewExpression_getType() throws Exception {
AnalyzeLibraryResult libraryResult =
analyzeLibrary(
- getName(),
- makeCode(
- "// filler filler filler filler filler filler filler filler filler filler",
- "class A {",
- " A() {}",
- " A.foo() {}",
- "}",
- "var a1 = new A();",
- "var a2 = new A.foo();",
- ""));
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "class A {",
+ " A() {}",
+ " A.foo() {}",
+ "}",
+ "var a1 = new A();",
+ "var a2 = new A.foo();",
+ "");
assertErrors(libraryResult.getErrors());
- DartUnit unit = libraryResult.getLibraryUnitResult().getUnit(getName());
// new A()
{
- DartNewExpression newExpression = (DartNewExpression) getTopLevelFieldInitializer(unit, 1);
+ DartNewExpression newExpression = (DartNewExpression) getTopLevelFieldInitializer(testUnit, 1);
Type newType = newExpression.getType();
assertEquals("A", newType.getElement().getName());
}
// new A.foo()
{
- DartNewExpression newExpression = (DartNewExpression) getTopLevelFieldInitializer(unit, 2);
+ DartNewExpression newExpression = (DartNewExpression) getTopLevelFieldInitializer(testUnit, 2);
Type newType = newExpression.getType();
assertEquals("A", newType.getElement().getName());
}
@@ -1041,25 +943,23 @@
public void test_setterOnlyProperty_noGetter() throws Exception {
AnalyzeLibraryResult libraryResult =
analyzeLibrary(
- getName(),
- makeCode(
- "class SetOnly {",
- " set foo(arg) {}",
- "}",
- "class SetOnlyWrapper {",
- " SetOnly setOnly;",
- "}",
- "",
- "main() {",
- " SetOnly setOnly = new SetOnly();",
- " setOnly.foo = 1;", // 10: OK, use setter
- " setOnly.foo += 2;", // 11: ERR, no getter
- " print(setOnly.foo);", // 12: ERR, no getter
- " var bar;",
- " bar = setOnly.foo;", // 14: ERR, assignment, but we are not LHS
- " bar = new SetOnlyWrapper().setOnly.foo;", // 15: ERR, even in chained expression
- " new SetOnlyWrapper().setOnly.foo = 3;", // 16: OK
- "}"));
+ "class SetOnly {",
+ " set foo(arg) {}",
+ "}",
+ "class SetOnlyWrapper {",
+ " SetOnly setOnly;",
+ "}",
+ "",
+ "main() {",
+ " SetOnly setOnly = new SetOnly();",
+ " setOnly.foo = 1;", // 10: OK, use setter
+ " setOnly.foo += 2;", // 11: ERR, no getter
+ " print(setOnly.foo);", // 12: ERR, no getter
+ " var bar;",
+ " bar = setOnly.foo;", // 14: ERR, assignment, but we are not LHS
+ " bar = new SetOnlyWrapper().setOnly.foo;", // 15: ERR, even in chained expression
+ " new SetOnlyWrapper().setOnly.foo = 3;", // 16: OK
+ "}");
assertErrors(
libraryResult.getTypeErrors(),
errEx(TypeErrorCode.FIELD_HAS_NO_GETTER, 11, 11, 3),
@@ -1071,28 +971,24 @@
public void test_setterOnlyProperty_normalField() throws Exception {
AnalyzeLibraryResult libraryResult =
analyzeLibrary(
- getName(),
- makeCode(
- "class A {",
- " var foo;",
- "}",
- "",
- "main() {",
- " A a = new A();",
- " a.foo = 1;",
- " a.foo += 2;",
- " print(a.foo);",
- "}"));
+ "class A {",
+ " var foo;",
+ "}",
+ "",
+ "main() {",
+ " A a = new A();",
+ " a.foo = 1;",
+ " a.foo += 2;",
+ " print(a.foo);",
+ "}");
assertErrors(libraryResult.getTypeErrors());
}
public void test_setterOnlyProperty_getterInSuper() throws Exception {
AnalyzeLibraryResult libraryResult =
analyzeLibrary(
- getName(),
- makeCode(
"class A {",
- " get foo() {}",
+ " get foo {}",
"}",
"class B extends A {",
" set foo(arg) {}",
@@ -1103,17 +999,15 @@
" b.foo = 1;",
" b.foo += 2;",
" print(b.foo);",
- "}"));
+ "}");
assertErrors(libraryResult.getTypeErrors());
}
public void test_setterOnlyProperty_getterInInterface() throws Exception {
AnalyzeLibraryResult libraryResult =
analyzeLibrary(
- getName(),
- makeCode(
"interface A {",
- " get foo() {}",
+ " get foo {}",
"}",
"abstract class B implements A {",
" set foo(arg) {}",
@@ -1124,7 +1018,7 @@
" b.foo = 1;",
" b.foo += 2;",
" print(b.foo);",
- "}"));
+ "}");
assertErrors(
libraryResult.getTypeErrors(),
errEx(TypeErrorCode.INSTANTIATION_OF_ABSTRACT_CLASS, 9, 13, 1));
@@ -1133,10 +1027,8 @@
public void test_getterOnlyProperty_noSetter() throws Exception {
AnalyzeLibraryResult libraryResult =
analyzeLibrary(
- getName(),
- makeCode(
"class GetOnly {",
- " get foo() {}",
+ " get foo {}",
"}",
"class GetOnlyWrapper {",
" GetOnly getOnly;",
@@ -1151,7 +1043,7 @@
" bar = getOnly.foo;", // 14: OK, use getter
" new GetOnlyWrapper().getOnly.foo = 3;", // 15: ERR, no setter
" bar = new GetOnlyWrapper().getOnly.foo;", // 16: OK, use getter
- "}"));
+ "}");
assertErrors(
libraryResult.getTypeErrors(),
errEx(TypeErrorCode.FIELD_HAS_NO_SETTER, 11, 11, 3),
@@ -1162,13 +1054,11 @@
public void test_getterOnlyProperty_setterInSuper() throws Exception {
AnalyzeLibraryResult libraryResult =
analyzeLibrary(
- getName(),
- makeCode(
"class A {",
" set foo(arg) {}",
"}",
"class B extends A {",
- " get foo() {}",
+ " get foo {}",
"}",
"",
"main() {",
@@ -1176,20 +1066,18 @@
" b.foo = 1;",
" b.foo += 2;",
" print(b.foo);",
- "}"));
+ "}");
assertErrors(libraryResult.getTypeErrors());
}
public void test_getterOnlyProperty_setterInInterface() throws Exception {
AnalyzeLibraryResult libraryResult =
analyzeLibrary(
- getName(),
- makeCode(
"interface A {",
" set foo(arg) {}",
"}",
"abstract class B implements A {",
- " get foo() {}",
+ " get foo {}",
"}",
"",
"main() {",
@@ -1197,7 +1085,7 @@
" b.foo = 1;",
" b.foo += 2;",
" print(b.foo);",
- "}"));
+ "}");
assertErrors(
libraryResult.getTypeErrors(),
errEx(TypeErrorCode.INSTANTIATION_OF_ABSTRACT_CLASS, 9, 13, 1));
@@ -1281,18 +1169,16 @@
public void test_finalField_inClass() throws Exception {
AnalyzeLibraryResult libraryResult = analyzeLibrary(
- getName(),
- makeCode(
- "// filler filler filler filler filler filler filler filler filler filler",
- "class A {",
- " final f;",
- "}",
- "main() {",
- " A a = new A();",
- " a.f = 0;", // 6: ERR, is final
- " a.f += 1;", // 7: ERR, is final
- " print(a.f);", // 8: OK, can read
- "}"));
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "class A {",
+ " final f;",
+ "}",
+ "main() {",
+ " A a = new A();",
+ " a.f = 0;", // 6: ERR, is final
+ " a.f += 1;", // 7: ERR, is final
+ " print(a.f);", // 8: OK, can read
+ "}");
assertErrors(
libraryResult.getTypeErrors(),
errEx(TypeErrorCode.FIELD_IS_FINAL, 7, 5, 1),
@@ -1301,21 +1187,19 @@
public void test_finalField_inInterface() throws Exception {
AnalyzeLibraryResult libraryResult = analyzeLibrary(
- getName(),
- makeCode(
- "// filler filler filler filler filler filler filler filler filler filler",
- "interface I default A {",
- " final f;",
- "}",
- "class A implements I {",
- " var f;",
- "}",
- "main() {",
- " I a = new I();",
- " a.f = 0;", // 6: ERR, is final
- " a.f += 1;", // 7: ERR, is final
- " print(a.f);", // 8: OK, can read
- "}"));
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "interface I default A {",
+ " final f;",
+ "}",
+ "class A implements I {",
+ " var f;",
+ "}",
+ "main() {",
+ " I a = new I();",
+ " a.f = 0;", // 6: ERR, is final
+ " a.f += 1;", // 7: ERR, is final
+ " print(a.f);", // 8: OK, can read
+ "}");
assertErrors(
libraryResult.getTypeErrors(),
errEx(TypeErrorCode.FIELD_IS_FINAL, 10, 5, 1),
@@ -1324,43 +1208,39 @@
public void test_notFinalField() throws Exception {
AnalyzeLibraryResult libraryResult = analyzeLibrary(
- getName(),
- makeCode(
- "// filler filler filler filler filler filler filler filler filler filler",
- "interface I default A {",
- " var f;",
- "}",
- "class A implements I {",
- " var f;",
- "}",
- "main() {",
- " I a = new I();",
- " a.f = 0;", // 6: OK, field "f" is not final
- " a.f += 1;", // 7: OK, field "f" is not final
- " print(a.f);", // 8: OK, can read
- "}"));
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "interface I default A {",
+ " var f;",
+ "}",
+ "class A implements I {",
+ " var f;",
+ "}",
+ "main() {",
+ " I a = new I();",
+ " a.f = 0;", // 6: OK, field "f" is not final
+ " a.f += 1;", // 7: OK, field "f" is not final
+ " print(a.f);", // 8: OK, can read
+ "}");
assertErrors(libraryResult.getTypeErrors());
}
public void test_constField() throws Exception {
AnalyzeLibraryResult libraryResult = analyzeLibrary(
- getName(),
- makeCode(
- "// filler filler filler filler filler filler filler filler filler filler",
- "const f = 1;",
- "class A {",
- " const f = 1;",
- " method() {",
- " f = 2;",
- " this.f = 2;",
- " }",
- "}",
- "main() {",
- " f = 2;",
- " A a = new A();",
- " a.f = 2;",
- "}",
- ""));
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "const f = 1;",
+ "class A {",
+ " const f = 1;",
+ " method() {",
+ " f = 2;",
+ " this.f = 2;",
+ " }",
+ "}",
+ "main() {",
+ " f = 2;",
+ " A a = new A();",
+ " a.f = 2;",
+ "}",
+ "");
assertErrors(
libraryResult.getErrors(),
errEx(ResolverErrorCode.CANNOT_ASSIGN_TO_FINAL, 6, 5, 1),
@@ -1371,13 +1251,11 @@
public void test_identicalFunction() throws Exception {
AnalyzeLibraryResult libraryResult = analyzeLibrary(
- getName(),
- makeCode(
- "// filler filler filler filler filler filler filler filler filler filler",
- "const A = 1;",
- "const B = 2;",
- "const C = identical(A, B);",
- ""));
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "const A = 1;",
+ "const B = 2;",
+ "const C = identical(A, B);",
+ "");
assertErrors(libraryResult.getErrors());
}
@@ -1467,55 +1345,48 @@
public void test_methodReturnTypes() throws Exception {
AnalyzeLibraryResult libraryResult =
analyzeLibrary(
- getName(),
- makeCode(
"// filler filler filler filler filler filler filler filler filler filler",
"int fA() {}",
"dynamic fB() {}",
"void fC() {}",
"fD() {}",
- ""));
+ "");
assertErrors(libraryResult.getTypeErrors());
- DartUnit unit = libraryResult.getLibraryUnitResult().getUnit(getName());
{
- DartMethodDefinition fA = (DartMethodDefinition) unit.getTopLevelNodes().get(0);
+ DartMethodDefinition fA = (DartMethodDefinition) testUnit.getTopLevelNodes().get(0);
assertEquals("int", fA.getElement().getReturnType().getElement().getName());
}
{
- DartMethodDefinition fB = (DartMethodDefinition) unit.getTopLevelNodes().get(1);
+ DartMethodDefinition fB = (DartMethodDefinition) testUnit.getTopLevelNodes().get(1);
assertEquals("dynamic", fB.getElement().getReturnType().getElement().getName());
}
{
- DartMethodDefinition fC = (DartMethodDefinition) unit.getTopLevelNodes().get(2);
+ DartMethodDefinition fC = (DartMethodDefinition) testUnit.getTopLevelNodes().get(2);
assertEquals("void", fC.getElement().getReturnType().getElement().getName());
}
{
- DartMethodDefinition fD = (DartMethodDefinition) unit.getTopLevelNodes().get(3);
+ DartMethodDefinition fD = (DartMethodDefinition) testUnit.getTopLevelNodes().get(3);
assertEquals("dynamic", fD.getElement().getReturnType().getElement().getName());
}
}
public void test_bindToLibraryFunctionFirst() throws Exception {
- AnalyzeLibraryResult libraryResult =
- analyzeLibrary(
- getName(),
- makeCode(
- "// filler filler filler filler filler filler filler filler filler filler",
- "foo() {}",
- "class A {",
- " foo() {}",
- "}",
- "class B extends A {",
- " bar() {",
- " foo();",
- " }",
- "}",
- ""));
- DartUnit unit = libraryResult.getLibraryUnitResult().getUnit(getName());
+ analyzeLibrary(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "foo() {}",
+ "class A {",
+ " foo() {}",
+ "}",
+ "class B extends A {",
+ " bar() {",
+ " foo();",
+ " }",
+ "}",
+ "");
// Find foo() invocation.
DartUnqualifiedInvocation invocation;
{
- DartClass classB = (DartClass) unit.getTopLevelNodes().get(2);
+ DartClass classB = (DartClass) testUnit.getTopLevelNodes().get(2);
DartMethodDefinition methodBar = (DartMethodDefinition) classB.getMembers().get(0);
DartExprStmt stmt = (DartExprStmt) methodBar.getFunction().getBody().getStatements().get(0);
invocation = (DartUnqualifiedInvocation) stmt.getExpression();
@@ -1523,7 +1394,7 @@
// Check that unqualified foo() invocation is resolved to the top-level (library) function.
NodeElement element = invocation.getTarget().getElement();
assertNotNull(element);
- assertSame(unit, element.getNode().getParent());
+ assertSame(testUnit, element.getNode().getParent());
}
/**
@@ -1531,13 +1402,12 @@
* as an exception.
*/
public void test_invalidImportUri() throws Exception {
- List<DartCompilationError> errors =
- analyzeLibrarySourceErrors(makeCode(
- "// filler filler filler filler filler filler filler filler filler filler",
- "library test;",
- "import 'badURI';",
- ""));
- assertErrors(errors, errEx(DartCompilerErrorCode.MISSING_SOURCE, 3, 1, 16));
+ AnalyzeLibraryResult libraryResult = analyzeLibrary(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "library test;",
+ "import 'badURI';",
+ "");
+ assertErrors(libraryResult.getErrors(), errEx(DartCompilerErrorCode.MISSING_SOURCE, 3, 1, 16));
}
/**
@@ -1545,49 +1415,20 @@
* as an exception.
*/
public void test_invalidSourceUri() throws Exception {
- List<DartCompilationError> errors =
- analyzeLibrarySourceErrors(makeCode(
- "// filler filler filler filler filler filler filler filler filler filler",
- "library test;",
- "part 'badURI';",
- ""));
- assertErrors(errors, errEx(DartCompilerErrorCode.MISSING_SOURCE, 3, 1, 14));
- }
-
- /**
- * Analyzes source for given library and returns {@link DartCompilationError}s.
- */
- private static List<DartCompilationError> analyzeLibrarySourceErrors(final String code)
- throws Exception {
- MockLibrarySource lib = new MockLibrarySource() {
- @Override
- public Reader getSourceReader() {
- return new StringReader(code);
- }
- };
- DartArtifactProvider provider = new MockArtifactProvider();
- final List<DartCompilationError> errors = Lists.newArrayList();
- DartCompiler.analyzeLibrary(
- lib,
- Maps.<URI, DartUnit>newHashMap(),
- CHECK_ONLY_CONFIGURATION,
- provider,
- new DartCompilerListener.Empty() {
- @Override
- public void onError(DartCompilationError event) {
- errors.add(event);
- }
- });
- return errors;
+ AnalyzeLibraryResult libraryResult = analyzeLibrary(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "library test;",
+ "part 'badURI';",
+ "");
+ assertErrors(libraryResult.getErrors(), errEx(DartCompilerErrorCode.MISSING_SOURCE, 3, 1, 14));
}
public void test_mapLiteralKeysUnique() throws Exception {
- List<DartCompilationError> errors =
- analyzeLibrarySourceErrors(makeCode(
- "// filler filler filler filler filler filler filler filler filler filler",
- "var m = {'a' : 0, 'b': 1, 'a': 2};",
- ""));
- assertErrors(errors, errEx(TypeErrorCode.MAP_LITERAL_KEY_UNIQUE, 2, 27, 3));
+ AnalyzeLibraryResult libraryResult = analyzeLibrary(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "var m = {'a' : 0, 'b': 1, 'a': 2};",
+ "");
+ assertErrors(libraryResult.getErrors(), errEx(TypeErrorCode.MAP_LITERAL_KEY_UNIQUE, 2, 27, 3));
}
/**
@@ -1596,7 +1437,7 @@
public void test_implementsAndOverrides_noRequiredParameter() throws Exception {
AnalyzeLibraryResult result =
analyzeLibrary(
- "interface I {",
+ "abstract class I {",
" foo(x);",
"}",
"class C implements I {",
@@ -1613,26 +1454,26 @@
public void test_implementsAndOverrides_additionalNamedParameter() throws Exception {
AnalyzeLibraryResult result =
analyzeLibrary(
- "interface I {",
- " foo([x]);",
+ "abstract class I {",
+ " foo({x});",
"}",
"class C implements I {",
- " foo([x,y]) {}",
+ " foo({x,y}) {}",
"}");
assertErrors(result.getErrors());
}
-
+
public void test_implementsAndOverrides_lessNamedParameter() throws Exception {
AnalyzeLibraryResult result = analyzeLibrary(
"abstract class A {",
- " abstract foo([x, y]);",
+ " foo({x, y});",
"}",
"abstract class B extends A {",
- " abstract foo([x]);",
+ " foo({x});",
"}");
assertErrors(
result.getErrors(),
- errEx(ResolverErrorCode.CANNOT_OVERRIDE_METHOD_NAMED_PARAMS, 5, 12, 3));
+ errEx(ResolverErrorCode.CANNOT_OVERRIDE_METHOD_NAMED_PARAMS, 5, 3, 3));
}
/**
@@ -1643,10 +1484,10 @@
AnalyzeLibraryResult result =
analyzeLibrary(
"abstract class A {",
- " abstract foo();",
+ " foo();",
"}",
"class B extends A {",
- " foo([x]) {}",
+ " foo({x}) {}",
"}",
"bar() {",
" new B();",
@@ -1655,13 +1496,37 @@
assertErrors(result.getErrors());
}
+ public void test_implementsAndOverrides_lessOptionalPositionalParameter() throws Exception {
+ AnalyzeLibraryResult result = analyzeLibrary(
+ "abstract class A {",
+ " foo([x, y]);",
+ "}",
+ "abstract class B extends A {",
+ " foo([x]);",
+ "}");
+ assertErrors(
+ result.getErrors(),
+ errEx(ResolverErrorCode.CANNOT_OVERRIDE_METHOD_OPTIONAL_PARAMS, 5, 3, 3));
+ }
+
+ public void test_implementsAndOverrides_moreOptionalPositionalParameter() throws Exception {
+ AnalyzeLibraryResult result = analyzeLibrary(
+ "abstract class A {",
+ " foo([x]);",
+ "}",
+ "abstract class B extends A {",
+ " foo([a, b]);",
+ "}");
+ assertErrors(result.getErrors());
+ }
+
/**
* No required parameter "x". Named parameter "x" is not enough.
*/
public void test_implementsAndOverrides_extraRequiredParameter() throws Exception {
AnalyzeLibraryResult result =
analyzeLibrary(
- "interface I {",
+ "abstract class I {",
" foo();",
"}",
"class C implements I {",
@@ -1676,7 +1541,7 @@
* <p>
* http://code.google.com/p/dart/issues/detail?id=3183
*/
- public void test_implementsAndOverrides_differentDefaultValue() throws Exception {
+ public void test_implementsAndOverrides_differentDefaultValue_optional() throws Exception {
AnalyzeLibraryResult result =
analyzeLibrary(
"// filler filler filler filler filler filler filler filler filler filler",
@@ -1699,6 +1564,34 @@
errEx(TypeErrorCode.CANNOT_OVERRIDE_METHOD_DEFAULT_VALUE, 11, 7, 5),
errEx(TypeErrorCode.CANNOT_OVERRIDE_METHOD_DEFAULT_VALUE, 12, 7, 7));
}
+
+ /**
+ * <p>
+ * http://code.google.com/p/dart/issues/detail?id=3183
+ */
+ public void test_implementsAndOverrides_differentDefaultValue_named() throws Exception {
+ AnalyzeLibraryResult result =
+ analyzeLibrary(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "class A {",
+ " f1({x}) {}",
+ " f2({x: 1}) {}",
+ " f3({x: 1}) {}",
+ " f4({x: 1}) {}",
+ "}",
+ "class B extends A {",
+ " f1({x: 2}) {}",
+ " f2({x]) {}",
+ " f3({x: 2}) {}",
+ " f4({x: '2'}) {}",
+ "}",
+ "");
+ assertErrors(
+ result.getErrors(),
+ errEx(TypeErrorCode.CANNOT_OVERRIDE_METHOD_DEFAULT_VALUE, 10, 7, 1),
+ errEx(TypeErrorCode.CANNOT_OVERRIDE_METHOD_DEFAULT_VALUE, 11, 7, 4),
+ errEx(TypeErrorCode.CANNOT_OVERRIDE_METHOD_DEFAULT_VALUE, 12, 7, 6));
+ }
/**
* It is a compile-time error if an instance method m1 overrides an instance member m2 and m1 does
@@ -1709,11 +1602,11 @@
public void test_implementsAndOverrides_noNamedParameter() throws Exception {
AnalyzeLibraryResult result =
analyzeLibrary(
- "interface I {",
- " foo([x,y]);",
+ "abstract class I {",
+ " foo({x,y});",
"}",
"class C implements I {",
- " foo([x]) {}",
+ " foo({x}) {}",
"}");
assertErrors(
result.getErrors(),
@@ -1749,24 +1642,16 @@
errEx(ResolverErrorCode.INVALID_OVERRIDE_METADATA, 6, 3, 3));
}
- /**
- * It is a compile-time error if an instance method m1 overrides an instance member m2 and m1 does
- * not declare all the named parameters declared by m2 in the same order.
- * <p>
- * Here: wrong order.
- */
public void testImplementsAndOverrides5() throws Exception {
AnalyzeLibraryResult result =
analyzeLibrary(
- "interface I {",
- " foo([y,x]);",
+ "abstract class I {",
+ " foo({y,x});",
"}",
"class C implements I {",
- " foo([x,y]) {}",
+ " foo({x,y}) {}",
"}");
- assertErrors(
- result.getErrors(),
- errEx(ResolverErrorCode.CANNOT_OVERRIDE_METHOD_NAMED_PARAMS, 5, 3, 3));
+ assertErrors(result.getErrors());
}
/**
@@ -1794,11 +1679,11 @@
analyzeLibrary(
"// filler filler filler filler filler filler filler filler filler filler",
"class A {",
- " static get field() => 0;",
+ " static get field => 0;",
" set field(var v) {}",
"}",
"class B {",
- " get field() => 0;",
+ " get field => 0;",
" static set field(var v) {}",
"}",
"");
@@ -1820,7 +1705,7 @@
"class C {",
" A getterField; ",
" B setterField; ",
- " A get field() { return getterField; }",
+ " A get field { return getterField; }",
" void set field(B arg) { setterField = arg; }",
"}",
"main() {",
@@ -1841,12 +1726,12 @@
"class A {} ",
"A topGetterField; ",
"var topSetterField; ",
- "A get topField() { return topGetterField; }",
+ "A get topField { return topGetterField; }",
"void set topField(arg) { topSetterField = arg; }",
"class C {",
" A getterField; ",
" var setterField; ",
- " A get field() { return getterField; }",
+ " A get field { return getterField; }",
" void set field(arg) { setterField = arg; }",
"}");
assertErrors(result.getErrors());
@@ -1859,12 +1744,12 @@
"class A {} ",
"var topGetterField; ",
"A topSetterField; ",
- "get topField() { return topGetterField; }",
+ "get topField { return topGetterField; }",
"void set topField(A arg) { topSetterField = arg; }",
"class C {",
" var getterField; ",
" A setterField; ",
- " get field() { return getterField; }",
+ " get field { return getterField; }",
" void set field(A arg) { setterField = arg; }",
"}");
assertErrors(result.getErrors());
@@ -1878,12 +1763,12 @@
"class B {}",
"A topGetterField; ",
"B topSetterField; ",
- "A get topField() { return topGetterField; }",
+ "A get topField { return topGetterField; }",
"void set topField(B arg) { topSetterField = arg; }",
"class C {",
" A getterField; ",
" B setterField; ",
- " A get field() { return getterField; }",
+ " A get field { return getterField; }",
" void set field(B arg) { setterField = arg; }",
"}");
assertErrors(result.getErrors(),
@@ -1948,7 +1833,7 @@
AnalyzeLibraryResult result =
analyzeLibrary(
"// filler filler filler filler filler filler filler filler filler filler",
- "interface I<T extends num> { }",
+ "abstract class I<T extends num> { }",
"class A<T extends num> implements I<T> { }",
"class B<T> implements I<T> { }"); // static type error B.T not assignable to num
assertErrors(result.getErrors(), errEx(TypeErrorCode.TYPE_NOT_ASSIGNMENT_COMPATIBLE, 4, 25, 1));
@@ -1988,7 +1873,7 @@
analyzeLibrary(
"// filler filler filler filler filler filler filler filler filler filler",
"class Base1<T1> {",
- " T1 get val() {}",
+ " T1 get val {}",
"}",
"class Base2<T2> extends Base1<T2> {",
"}",
@@ -2524,8 +2409,7 @@
}
/**
- * When single variable has conflicting type constraints, right now we don't try to unify them,
- * instead we fall back to "dynamic".
+ * When single variable has conflicting type constraints, we use union of types.
*/
public void test_typesPropagation_ifIsType_conflictingTypes() throws Exception {
analyzeLibrary(
@@ -2536,7 +2420,7 @@
" }",
"}",
"");
- assertInferredElementTypeString(testUnit, "v1", "dynamic");
+ assertInferredElementTypeString(testUnit, "v1", "[int, String]");
}
public void test_typesPropagation_ifIsType_negation() throws Exception {
@@ -2884,6 +2768,38 @@
assertInferredElementTypeString(testUnit, "b3", "dynamic");
}
+ /**
+ * When variable has explicit type, we should not fall to 'dynamic', we need to keep this type.
+ * <p>
+ * http://code.google.com/p/dart/issues/detail?id=6399
+ */
+ public void test_typesPropagation_assertIsType_hasExplicitType() throws Exception {
+ analyzeLibrary(
+ "class A {}",
+ "class B extends A {}",
+ "class C extends B {}",
+ "main() {",
+ " B v;",
+ " if (v is A) {",
+ " var v1 = v;",
+ " }",
+ " if (v is B) {",
+ " var v2 = v;",
+ " }",
+ " if (v is C) {",
+ " var v3 = v;",
+ " }",
+ " if (v is String) {",
+ " var v4 = v;",
+ " }",
+ "}",
+ "");
+ assertInferredElementTypeString(testUnit, "v1", "B");
+ assertInferredElementTypeString(testUnit, "v2", "B");
+ assertInferredElementTypeString(testUnit, "v3", "C");
+ assertInferredElementTypeString(testUnit, "v4", "[B, String]");
+ }
+
public void test_typesPropagation_field_inClass_final() throws Exception {
analyzeLibrary(
"// filler filler filler filler filler filler filler filler filler filler",
@@ -3020,7 +2936,7 @@
"// filler filler filler filler filler filler filler filler filler filler",
"class Event {}",
"typedef void EventListener(Event event);",
- "foo([EventListener listener]) {",
+ "foo({EventListener listener}) {",
"}",
"main() {",
" foo(listener: (e) {",
@@ -3140,10 +3056,10 @@
public void test_typesPropagation_conditional() throws Exception {
AnalyzeLibraryResult libraryResult = analyzeLibrary(
"// filler filler filler filler filler filler filler filler filler filler",
- "interface I1 {",
+ "abstract class I1 {",
" f1();",
"}",
- "interface I2 {",
+ "abstract class I2 {",
" f2();",
"}",
"class A implements I1, I2 {",
@@ -3257,8 +3173,8 @@
public void test_getType_getterInNegation() throws Exception {
AnalyzeLibraryResult libraryResult = analyzeLibrary(
"class A {",
- " int get intProperty() => 42;",
- " bool get boolProperty() => true;",
+ " int get intProperty => 42;",
+ " bool get boolProperty => true;",
"}",
"f() {",
" var a = new A();",
@@ -3279,7 +3195,7 @@
AnalyzeLibraryResult libraryResult = analyzeLibrary(
"class A<T> {",
" T field;",
- " T get prop() => null;",
+ " T get prop => null;",
"}",
"f() {",
" var a = new A<bool>();",
@@ -3303,7 +3219,7 @@
public void test_getType_getterInSwitch_default() throws Exception {
AnalyzeLibraryResult libraryResult = analyzeLibrary(
"// filler filler filler filler filler filler filler filler filler filler",
- "int get foo() {}",
+ "int get foo {}",
"f() {",
" switch (true) {",
" default:",
@@ -3321,7 +3237,7 @@
public void test_getType_getterInSwitchExpression_topLevel() throws Exception {
AnalyzeLibraryResult libraryResult = analyzeLibrary(
"// filler filler filler filler filler filler filler filler filler filler",
- "int get foo() => 42;",
+ "int get foo => 42;",
"f() {",
" switch (foo) {",
" case 2:",
@@ -3340,7 +3256,7 @@
AnalyzeLibraryResult libraryResult = analyzeLibrary(
"// filler filler filler filler filler filler filler filler filler filler",
"class A<T> {",
- " T get foo() => null;",
+ " T get foo => null;",
"}",
"f() {",
" A<int> a = new A<int>();",
@@ -3420,9 +3336,8 @@
"}",
"");
assertErrors(libraryResult.getErrors());
- DartUnit unit = libraryResult.getLibraryUnitResult().getUnit(getName());
// find == expression
- DartExpression expression = findNodeBySource(unit, "new C() == new C()");
+ DartExpression expression = findNodeBySource(testUnit, "new C() == new C()");
assertNotNull(expression);
// validate == element
MethodElement equalsElement = (MethodElement) expression.getElement();
@@ -3441,7 +3356,7 @@
" bar();",
"}",
"interface J extends I {",
- " get foo();",
+ " get foo;",
" set bar();",
"}");
assertErrors(libraryResult.getTypeErrors(),
@@ -3534,7 +3449,7 @@
"// filler filler filler filler filler filler filler filler filler filler",
"class A {}",
"interface I {",
- " get foo();",
+ " get foo;",
" set bar();",
"}",
"interface J extends I {",
@@ -3719,7 +3634,7 @@
public void test_incompatibleTypesInHierarchy1() throws Exception {
AnalyzeLibraryResult libraryResult = analyzeLibrary(
"// filler filler filler filler filler filler filler filler filler filler",
- "interface Interface<T> {",
+ "abstract class Interface<T> {",
" T m();",
"}",
"abstract class A implements Interface {",
@@ -3734,7 +3649,7 @@
public void test_incompatibleTypesInHierarchy2() throws Exception {
AnalyzeLibraryResult libraryResult = analyzeLibrary(
"// filler filler filler filler filler filler filler filler filler filler",
- "interface Interface<T> {",
+ "abstract class Interface<T> {",
" T m();",
"}",
"abstract class A implements Interface<String> {",
@@ -3861,7 +3776,7 @@
AnalyzeLibraryResult libraryResult = analyzeLibrary(
"// filler filler filler filler filler filler filler filler filler filler",
"class C {" +
- " get method() { }",
+ " get method { }",
"}",
"main () {",
" new C().method = _() {};",
@@ -3880,7 +3795,7 @@
AnalyzeLibraryResult libraryResult = analyzeLibrary(
"// filler filler filler filler filler filler filler filler filler filler",
"class C {" +
- " get method() { }",
+ " get method { }",
" operator []=(k, v) {}",
"}",
"main () {",
@@ -4232,6 +4147,21 @@
errEx(TypeErrorCode.NOT_A_FUNCTION_TYPE, 10, 3, 3),
errEx(TypeErrorCode.NOT_A_FUNCTION_TYPE, 11, 3, 9));
}
+
+ public void test_invokeNonFunction_getter() throws Exception {
+ AnalyzeLibraryResult libraryResult = analyzeLibrary(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "class A {",
+ " int get foo => 0;",
+ "}",
+ "main() {",
+ " A a = new A();",
+ " a.foo();",
+ "}");
+ assertErrors(
+ libraryResult.getErrors(),
+ errEx(TypeErrorCode.NOT_A_FUNCTION_TYPE_FIELD, 7, 5, 3));
+ }
public void test_wrongOperandTypeForUnaryExpression() throws Exception {
AnalyzeLibraryResult libraryResult = analyzeLibrary(
@@ -4330,7 +4260,7 @@
AnalyzeLibraryResult libraryResult = analyzeLibrary(
"// filler filler filler filler filler filler filler filler filler filler",
"external topFunction();",
- "external get topGetter();",
+ "external get topGetter;",
"external set topSetter(var v);",
"class A {",
" external const A.con();",
@@ -4338,7 +4268,7 @@
" external factory A.named();",
" external classMethod();",
" external static classMethodStatic();",
- " external get classGetter();",
+ " external get classGetter;",
" external set classSetter(var v);",
"}",
"");
@@ -4388,7 +4318,6 @@
" external A() {}",
" external factory A.named() {}",
" external classMethod() {}",
- " external abstract classMethodAbstract();",
"}",
"");
assertErrors(
@@ -4396,8 +4325,18 @@
errEx(ParserErrorCode.EXTERNAL_METHOD_BODY, 2, 24, 2),
errEx(ParserErrorCode.EXTERNAL_METHOD_BODY, 4, 16, 2),
errEx(ParserErrorCode.EXTERNAL_METHOD_BODY, 5, 30, 2),
- errEx(ParserErrorCode.EXTERNAL_METHOD_BODY, 6, 26, 2),
- errEx(ParserErrorCode.EXTERNAL_ABSTRACT, 7, 12, 8));
+ errEx(ParserErrorCode.EXTERNAL_METHOD_BODY, 6, 26, 2));
+ }
+
+ public void test_cascade_type() throws Exception {
+ analyzeLibrary(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "main() {",
+ " String s = '';",
+ " var v = s..length;",
+ "}",
+ "");
+ assertInferredElementTypeString(testUnit, "v", "String");
}
/**
@@ -4481,13 +4420,13 @@
* http://code.google.com/p/dart/issues/detail?id=3084
*/
public void test_unresolvedIdentifier_inStatic_notPropertyAccess() throws Exception {
- AnalyzeLibraryResult libraryResult = analyzeLibrary(makeCode(
+ AnalyzeLibraryResult libraryResult = analyzeLibrary(
"// filler filler filler filler filler filler filler filler filler filler",
"process(x) {}",
"main() {",
" unknown = 0;",
" process(unknown);",
- "}"));
+ "}");
assertErrors(
libraryResult.getErrors(),
errEx(ResolverErrorCode.CANNOT_BE_RESOLVED, 4, 3, 7),
@@ -4501,7 +4440,7 @@
* http://code.google.com/p/dart/issues/detail?id=3084
*/
public void test_unresolvedIdentifier_inInstance_notPropertyAccess() throws Exception {
- AnalyzeLibraryResult libraryResult = analyzeLibrary(makeCode(
+ AnalyzeLibraryResult libraryResult = analyzeLibrary(
"// filler filler filler filler filler filler filler filler filler filler",
"process(x) {}",
"class A {",
@@ -4509,7 +4448,7 @@
" unknown = 0;",
" process(unknown);",
" }",
- "}"));
+ "}");
assertErrors(
libraryResult.getErrors(),
errEx(TypeErrorCode.CANNOT_BE_RESOLVED, 5, 5, 7),
@@ -4521,13 +4460,13 @@
* http://code.google.com/p/dart/issues/detail?id=3084
*/
public void test_unresolvedIdentifier_inStatic_inPropertyAccess() throws Exception {
- AnalyzeLibraryResult libraryResult = analyzeLibrary(makeCode(
+ AnalyzeLibraryResult libraryResult = analyzeLibrary(
"// filler filler filler filler filler filler filler filler filler filler",
"process(x) {}",
"main() {",
" Unknown.foo = 0;",
" process(Unknown.foo);",
- "}"));
+ "}");
assertErrors(
libraryResult.getErrors(),
errEx(TypeErrorCode.CANNOT_BE_RESOLVED, 4, 3, 7),
@@ -4540,7 +4479,7 @@
* http://code.google.com/p/dart/issues/detail?id=3800
*/
public void test_unresolvedConstructor() throws Exception {
- AnalyzeLibraryResult libraryResult = analyzeLibrary(makeCode(
+ AnalyzeLibraryResult libraryResult = analyzeLibrary(
"// filler filler filler filler filler filler filler filler filler filler",
"class A {}",
"main() {",
@@ -4548,7 +4487,7 @@
" new A.noSuchConstructor(); // warning",
" new B(); // warning",
" new B.noSuchConstructor(); // warning",
- "}"));
+ "}");
assertErrors(
libraryResult.getErrors(),
errEx(ResolverErrorCode.NEW_EXPRESSION_NOT_CONSTRUCTOR, 5, 9, 17),
@@ -4578,7 +4517,7 @@
* many other points in the Editor.
*/
public void test_typeForEveryExpression_variable() throws Exception {
- AnalyzeLibraryResult libraryResult = analyzeLibrary(
+ analyzeLibrary(
"// filler filler filler filler filler filler filler filler filler filler",
"class A {}",
"process(x) {}",
@@ -4586,8 +4525,7 @@
" A aaa = new A();",
" process(aaa);",
"}");
- DartUnit unit = libraryResult.getLibraryUnitResult().getUnit(getName());
- unit.accept(new ASTVisitor<Void>() {
+ testUnit.accept(new ASTVisitor<Void>() {
public Void visitIdentifier(DartIdentifier node) {
// ignore declaration
if (node.getParent() instanceof DartDeclaration) {
@@ -4609,7 +4547,7 @@
* many other points in the Editor.
*/
public void test_typeForEveryExpression_typeNode() throws Exception {
- AnalyzeLibraryResult libraryResult = analyzeLibrary(
+ analyzeLibrary(
"// filler filler filler filler filler filler filler filler filler filler",
"class AAA {",
" static foo() {}",
@@ -4617,8 +4555,7 @@
"main() {",
" AAA.foo();",
"}");
- DartUnit unit = libraryResult.getLibraryUnitResult().getUnit(getName());
- unit.accept(new ASTVisitor<Void>() {
+ testUnit.accept(new ASTVisitor<Void>() {
public Void visitIdentifier(DartIdentifier node) {
// ignore declaration
if (node.getParent() instanceof DartDeclaration) {
@@ -4689,7 +4626,6 @@
" method(10, 20, 30, 40);",
"}");
assertErrors(libraryResult.getErrors());
- DartUnit unit = libraryResult.getLibraryUnitResult().getUnit(getName());
new ArgumentsBindingTester() {
@Override
void checkArgs(int invocationIndex) {
@@ -4714,7 +4650,7 @@
}
}
}
- }.doTest(unit);
+ }.doTest(testUnit);
}
public void test_formalParameters_positional_named() throws Exception {
@@ -4728,7 +4664,6 @@
" method(10, 20, d: 40, c: 30);",
"}");
assertErrors(libraryResult.getErrors());
- DartUnit unit = libraryResult.getLibraryUnitResult().getUnit(getName());
new ArgumentsBindingTester() {
@Override
void checkArgs(int invocationIndex) {
@@ -4759,7 +4694,7 @@
}
}
}
- }.doTest(unit);
+ }.doTest(testUnit);
}
/**
@@ -4770,12 +4705,12 @@
* http://code.google.com/p/dart/issues/detail?id=3989
*/
public void test_constructorName_sameAsMemberName() throws Exception {
- AnalyzeLibraryResult libraryResult = analyzeLibrary(makeCode(
+ AnalyzeLibraryResult libraryResult = analyzeLibrary(
"// filler filler filler filler filler filler filler filler filler filler",
"class A {",
" A.foo() {}",
" foo() {}",
- "}"));
+ "}");
assertErrors(
libraryResult.getErrors(),
errEx(ResolverErrorCode.CONSTRUCTOR_WITH_NAME_OF_MEMBER, 3, 3, 5));
@@ -4786,13 +4721,13 @@
* http://code.google.com/p/dart/issues/detail?id=3904
*/
public void test_reifiedClasses() throws Exception {
- AnalyzeLibraryResult libraryResult = analyzeLibrary(makeCode(
+ AnalyzeLibraryResult libraryResult = analyzeLibrary(
"// filler filler filler filler filler filler filler filler filler filler",
"class A {}",
"process(x) {}",
"main() {",
" process(A);",
- "}"));
+ "}");
assertErrors(libraryResult.getErrors());
}
@@ -4801,7 +4736,7 @@
* http://code.google.com/p/dart/issues/detail?id=3968
*/
public void test_redirectingFactoryConstructor() throws Exception {
- AnalyzeLibraryResult libraryResult = analyzeLibrary(makeCode(
+ AnalyzeLibraryResult libraryResult = analyzeLibrary(
"// filler filler filler filler filler filler filler filler filler filler",
"class A {",
" A() {}",
@@ -4812,7 +4747,7 @@
" factory B.foo() = A;",
" factory B.bar() = A.named;",
"}",
- ""));
+ "");
assertErrors(libraryResult.getErrors());
// prepare "class A"
ClassElement elementA = findNode(DartClass.class, "class A").getElement();
@@ -4837,7 +4772,7 @@
}
public void test_redirectingFactoryConstructor_cycle() throws Exception {
- AnalyzeLibraryResult libraryResult = analyzeLibrary(makeCode(
+ AnalyzeLibraryResult libraryResult = analyzeLibrary(
"// filler filler filler filler filler filler filler filler filler filler",
"class A {",
" factory A.nameA() = C.nameC;",
@@ -4848,7 +4783,7 @@
"class C {",
" factory C.nameC() = B.nameB;",
"}",
- ""));
+ "");
assertErrors(
libraryResult.getErrors(),
errEx(ResolverErrorCode.REDIRECTION_CONSTRUCTOR_CYCLE, 3, 11, 7),
@@ -4857,7 +4792,7 @@
}
public void test_redirectingFactoryConstructor_notConst_fromConst() throws Exception {
- AnalyzeLibraryResult libraryResult = analyzeLibrary(makeCode(
+ AnalyzeLibraryResult libraryResult = analyzeLibrary(
"// filler filler filler filler filler filler filler filler filler filler",
"class A {",
" A.named() {}",
@@ -4866,7 +4801,7 @@
"class B {",
" const factory B.bar() = A.named;",
"}",
- ""));
+ "");
assertErrors(
libraryResult.getErrors(),
errEx(ResolverErrorCode.REDIRECTION_CONSTRUCTOR_TARGET_MUST_BE_CONST, 7, 29, 5));
@@ -4877,7 +4812,7 @@
* http://code.google.com/p/dart/issues/detail?id=4778
*/
public void test_unqualifiedAccessToGenericTypeField() throws Exception {
- AnalyzeLibraryResult libraryResult = analyzeLibrary(makeCode(
+ AnalyzeLibraryResult libraryResult = analyzeLibrary(
"// filler filler filler filler filler filler filler filler filler filler",
"class Game {}",
"class GameRenderer<G extends Game> {",
@@ -4891,7 +4826,7 @@
" var a = game.score;",
" }",
"}",
- ""));
+ "");
assertErrors(libraryResult.getErrors());
}
@@ -4922,7 +4857,7 @@
String[] lines = {
"// filler filler filler filler filler filler filler filler filler filler",
"class A {",
- " noSuchMethod(String name, List args) {}",
+ " noSuchMethod(InvocationMirror invocation) {}",
"}",
"class B extends A {}",
"class C {}",
@@ -4964,7 +4899,7 @@
String[] lines = {
"// filler filler filler filler filler filler filler filler filler filler",
"class A {",
- " noSuchMethod(String name, List args) {}",
+ " noSuchMethod(InvocationMirror invocation) {}",
"}",
"class B extends A {}",
"class C {}",
@@ -5028,19 +4963,6 @@
/**
* <p>
- * http://code.google.com/p/dart/issues/detail?id=5084
- */
- public void test_duplicateSuperInterface_okInInterfaceExtends() throws Exception {
- AnalyzeLibraryResult result = analyzeLibrary(
- "// filler filler filler filler filler filler filler filler filler filler",
- "interface A {}",
- "interface B extends A, A {}",
- "");
- assertErrors(result.getErrors());
- }
-
- /**
- * <p>
* http://code.google.com/p/dart/issues/detail?id=5082
*/
public void test_argumentDefinitionTest_type() throws Exception {
@@ -5292,7 +5214,7 @@
AnalyzeLibraryResult result = analyzeLibrary(
"// filler filler filler filler filler filler filler filler filler filler",
"class A {",
- " static get f() => 0;",
+ " static get f => 0;",
"}",
"main() {",
" A.f = 0;",
diff --git a/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerTest.java b/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerTest.java
index 4774c79..c4396fa 100644
--- a/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerTest.java
+++ b/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerTest.java
@@ -303,7 +303,7 @@
public void testCyclicTypeVariable() {
Map<String, ClassNodeElement> classes = loadSource(
- "interface A<T> { }",
+ "abstract class A<T> { }",
"typedef funcType<T>(T arg);",
"class B<T extends T> {}",
"class C<T extends A<T>> {}",
@@ -335,18 +335,6 @@
TypeErrorCode.TYPE_NOT_ASSIGNMENT_COMPATIBLE);
}
- public void testFactory() {
- analyzeClasses(loadSource(
- "interface Foo default Bar {",
- " Foo(String argument);",
- "}",
- "interface Baz {}",
- "class Bar implements Foo, Baz {",
- " Bar(String argument) {}",
- "}"));
- analyzeFail("Baz x = new Foo('');", TypeErrorCode.TYPE_NOT_ASSIGNMENT_COMPATIBLE);
- }
-
public void testFieldAccess() {
ClassElement element = loadFile("class_with_supertypes.dart").get("ClassWithSupertypes");
assertNotNull("unable to locate ClassWithSupertypes", element);
@@ -540,13 +528,13 @@
"}",
"class C<U> {",
"}",
- "interface I<S> extends I2<bool> {",
+ "abstract class I<S> extends I2<bool> {",
"}",
"class G<V> {",
"}",
- "interface I1<W> {",
+ "abstract class I1<W> {",
"}",
- "interface I2<X> {",
+ "abstract class I2<X> {",
"}",
"class D implements I2<int> {",
"}",
@@ -554,7 +542,7 @@
"}");
analyzeClasses(classes);
assertEquals("[]", object.getAllSupertypes().toString());
- assertEquals("[I<int>, I1<String>, I2<bool>, B<String>, C<G<String>>, Object]",
+ assertEquals("[B<String>, I<int>, I1<String>, I2<bool>, C<G<String>>, Object]",
classes.get("A").getAllSupertypes().toString());
assertEquals("[I<int>, I1<B.T>, I2<bool>, C<G<B.T>>, Object]",
classes.get("B").getAllSupertypes().toString());
@@ -564,7 +552,7 @@
assertEquals("[Object]", classes.get("I1").getAllSupertypes().toString());
assertEquals("[Object]", classes.get("I2").getAllSupertypes().toString());
assertEquals("[I2<int>, Object]", classes.get("D").getAllSupertypes().toString());
- assertEquals("[I2<int>, D, Object]", classes.get("E").getAllSupertypes().toString());
+ assertEquals("[I2<int>, D, I2<int>, Object]", classes.get("E").getAllSupertypes().toString());
}
public void testIdentifiers() {
@@ -592,7 +580,7 @@
public void testImplementsAndOverrides() {
analyzeClasses(loadSource(
- "interface Interface {",
+ "abstract class Interface {",
" void foo(int x);",
" void bar();",
"}",
@@ -620,7 +608,7 @@
public void testImplementsAndOverrides2() {
analyzeClasses(loadSource(
- "interface Interface {",
+ "abstract class Interface {",
" void foo(int x);",
"}",
// Abstract class not reported until first instantiation.
@@ -705,27 +693,6 @@
checkSimpleType(string.getType(), "'f${null}sk'");
}
- public void testLoadInterfaces() {
- loadFile("interfaces.dart");
- ClassElement superElement = (ClassElement)coreElements.get("Super");
- assertNotNull("no element for Super", superElement);
- assertEquals(object.getType(), superElement.getSupertype());
- assertEquals(0, superElement.getInterfaces().size());
- ClassElement sub = (ClassElement)coreElements.get("Sub");
- assertNotNull("no element for Sub", sub);
- assertEquals(object.getType(), sub.getSupertype());
- assertEquals(1, sub.getInterfaces().size());
- assertEquals(superElement, sub.getInterfaces().get(0).getElement());
- InterfaceType superString = itype(superElement, itype(string));
- InterfaceType subString = itype(sub, itype(string));
- Types types = getTypes();
- assertEquals("Super<String>", String.valueOf(types.asInstanceOf(superString, superElement)));
- assertEquals("Super<String>", String.valueOf(types.asInstanceOf(subString, superElement)));
- assertEquals("Sub<String>", String.valueOf(types.asInstanceOf(subString, sub)));
- assertNull(types.asInstanceOf(superString, sub));
- }
-
-
public void testMapLiteral() {
analyze("{ var x = {\"key\": 42}; }");
analyze("{ var x = {'key': 42}; }");
@@ -818,52 +785,6 @@
analyze("VoidFunction f = foo() {};");
}
- public void testNewExpression() {
- analyzeClasses(loadSource(
- "class Foo {",
- " Foo(int x) {}",
- " Foo.foo() {}",
- " Foo.bar([int i = null]) {}",
- "}",
- "interface Bar<T> default Baz<T> {",
- " Bar.make();",
- "}",
- "class Baz<T> {",
- " factory Bar.make(T x) { return null; }",
- "}",
- "class Foobar<T extends String> {",
- "}"));
-
- analyze("Foo x = new Foo(0);");
- analyzeFail("Foo x = new Foo();", TypeErrorCode.MISSING_ARGUMENT);
- analyzeFail("Foo x = new Foo('');", TypeErrorCode.TYPE_NOT_ASSIGNMENT_COMPATIBLE);
- analyzeFail("Foo x = new Foo(0, null);", TypeErrorCode.EXTRA_ARGUMENT);
-
- analyze("Foo x = new Foo.foo();");
- analyzeFail("Foo x = new Foo.foo(null);", TypeErrorCode.EXTRA_ARGUMENT);
-
- analyze("Foo x = new Foo.bar();");
- analyze("Foo x = new Foo.bar(0);");
- analyzeFail("Foo x = new Foo.bar('');", TypeErrorCode.TYPE_NOT_ASSIGNMENT_COMPATIBLE);
- analyzeFail("Foo x = new Foo.bar(0, null);", TypeErrorCode.EXTRA_ARGUMENT);
- analyzeFail("var x = new Foobar<num>();", TypeErrorCode.TYPE_NOT_ASSIGNMENT_COMPATIBLE);
- analyze("Bar<String> x = new Bar.make('');");
- }
-
- public void testAssignableTypeArg() {
- analyzeClasses(loadSource(
- "interface Bar<T> default Baz<T> {",
- " Bar.make();",
- "}",
- "class Baz<T> {",
- " Baz(T x) { return null; }",
- " factory Bar.make(T x) { return null; }",
- "}"));
- analyze("Baz<String> x = new Baz<String>('');");
- analyze("Bar<String> x = new Bar.make('');");
- analyze("Bar<String> x = new Bar<String>.make('');");
- }
-
public void testOddStuff() {
Map<String, ClassNodeElement> classes = analyzeClasses(loadSource(
"class Class {",
@@ -939,19 +860,6 @@
}
}
- public void testRawTypes() {
- loadFile("interfaces.dart");
-
- analyze("{ Sub s; }");
- analyze("{ var s = new Sub(); }");
- analyze("{ Sub s = new Sub(); }");
- analyze("{ Sub<String> s = new Sub(); }");
- analyze("{ Sub<String> s; }");
- analyze("{ var s = new Sub<String>(); }");
- analyze("{ Sub s = new Sub<String>(); }");
- analyze("{ Sub<String> s = new Sub<String>(); }");
- }
-
public void testReturn() {
analyzeFail(returnWithType("int", "'string'"),
TypeErrorCode.TYPE_NOT_ASSIGNMENT_COMPATIBLE);
@@ -1058,17 +966,6 @@
analyzeClass(classes.get("B"), 0);
}
- public void testSuperInterfaces() {
- // If this test is failing, first debug any failures in testLoadInterfaces.
- loadFile("interfaces.dart");
- analyze("Super<String> s = new Sub<String>();");
- analyze("Super<Object> o = new Sub<String>();");
- analyzeFail("Super<String> f1 = new Sub<int>();",
- TypeErrorCode.TYPE_NOT_ASSIGNMENT_COMPATIBLE);
- analyzeFail("Sub<String> f2 = new Sub<int>();",
- TypeErrorCode.TYPE_NOT_ASSIGNMENT_COMPATIBLE);
- }
-
public void testSwitch() {
analyze("{ int i = 27; switch(i) { case i: break; } }");
analyzeFail(
@@ -1124,16 +1021,6 @@
analyzeIn(cls, "foo() { T t = true; }()", 1);
}
- public void testDefaultTypeArgs() {
- Map<String, ClassNodeElement> source = loadSource(
- "class Object{}",
- "interface List<T> {}",
- "interface A<K,V> default B<K, V extends List<K>> {}",
- "class B<K, V extends List<K>> {",
- "}");
- analyzeClasses(source);
- }
-
public void testUnaryOperators() {
Map<String, ClassNodeElement> source = loadSource(
"class Foo {",
@@ -1356,25 +1243,10 @@
TypeErrorCode.TYPE_NOT_ASSIGNMENT_COMPATIBLE);
}
- public void testValidateFactoryBounds() {
- Map<String, ClassNodeElement> source = loadSource(
- "class Object {}",
- "interface Foo {}",
- "interface Bar extends Foo {}",
- "interface IA<T> default A<T extends Foo> { IA(); }",
- "class A<T extends Foo> implements IA<T> {",
- " factory A() {}",
- "}");
- analyzeClasses(source);
- analyze("{ var val1 = new IA<Foo>(); }");
- analyze("{ var val1 = new IA<Bar>(); }");
- analyzeFail("{ var val1 = new IA<String>(); }",TypeErrorCode.TYPE_NOT_ASSIGNMENT_COMPATIBLE);
- }
-
public void testStringConcat() {
Map<String, ClassNodeElement> source = loadSource(
"class Object {}",
- "interface Foo {",
+ "abstract class Foo {",
" operator +(arg1);" +
"}",
"Foo a = new Foo();",
diff --git a/compiler/javatests/com/google/dart/compiler/type/class_with_methods.dart b/compiler/javatests/com/google/dart/compiler/type/class_with_methods.dart
index 966b943..5f0f424 100644
--- a/compiler/javatests/com/google/dart/compiler/type/class_with_methods.dart
+++ b/compiler/javatests/com/google/dart/compiler/type/class_with_methods.dart
@@ -2,7 +2,7 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-interface ClassWithMethods {
+abstract class ClassWithMethods {
untypedNoArgumentMethod();
untypedOneArgumentMethod(argument);
untypedTwoArgumentMethod(argument1, argument2);
diff --git a/compiler/javatests/com/google/dart/compiler/type/class_with_supertypes.dart b/compiler/javatests/com/google/dart/compiler/type/class_with_supertypes.dart
index b08a614..32a67a3 100644
--- a/compiler/javatests/com/google/dart/compiler/type/class_with_supertypes.dart
+++ b/compiler/javatests/com/google/dart/compiler/type/class_with_supertypes.dart
@@ -2,7 +2,7 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-interface Interface {
+abstract class Interface {
void methodInInterface();
int fieldInInterface;
static final int staticFieldInInterface = 1;
diff --git a/compiler/javatests/com/google/dart/compiler/type/class_with_type_parameter.dart b/compiler/javatests/com/google/dart/compiler/type/class_with_type_parameter.dart
index 48be4d3..f61bf4a 100644
--- a/compiler/javatests/com/google/dart/compiler/type/class_with_type_parameter.dart
+++ b/compiler/javatests/com/google/dart/compiler/type/class_with_type_parameter.dart
@@ -2,9 +2,9 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-interface A {}
+abstract class A {}
-interface B extends A {}
+abstract class B extends A {}
class ClassWithTypeParameter<T extends B> {
A aField;
diff --git a/compiler/javatests/com/google/dart/compiler/type/covariant_class.dart b/compiler/javatests/com/google/dart/compiler/type/covariant_class.dart
index 4d48597..f38bb42 100644
--- a/compiler/javatests/com/google/dart/compiler/type/covariant_class.dart
+++ b/compiler/javatests/com/google/dart/compiler/type/covariant_class.dart
@@ -2,16 +2,16 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-interface A {
+abstract class A {
}
-interface B extends A {
+abstract class B extends A {
}
-interface C extends A {
+abstract class C extends A {
}
-interface D {
+abstract class D {
}
class Super {
diff --git a/compiler/javatests/com/google/dart/compiler/type/generic_class_with_supertypes.dart b/compiler/javatests/com/google/dart/compiler/type/generic_class_with_supertypes.dart
index b96748f..c0ccbb9 100644
--- a/compiler/javatests/com/google/dart/compiler/type/generic_class_with_supertypes.dart
+++ b/compiler/javatests/com/google/dart/compiler/type/generic_class_with_supertypes.dart
@@ -2,7 +2,7 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-interface Interface<I1, I2> {
+abstract class Interface<I1, I2> {
I1 interfaceField;
I1 interfaceMethod(I2 arg);
}
diff --git a/compiler/javatests/com/google/dart/compiler/type/interfaces.dart b/compiler/javatests/com/google/dart/compiler/type/interfaces.dart
deleted file mode 100644
index deccd20..0000000
--- a/compiler/javatests/com/google/dart/compiler/type/interfaces.dart
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-interface Super<T> {}
-
-interface Sub<S> extends Super<S> default SubImplementation<S> {
- Sub();
-}
-
-class SubImplementation<U> implements Sub<U> {
- SubImplementation() {}
-}
diff --git a/dart.gyp b/dart.gyp
index 589c1d3..3ec8489 100644
--- a/dart.gyp
+++ b/dart.gyp
@@ -30,7 +30,7 @@
'type': 'none',
'dependencies': [
'runtime/dart-runtime.gyp:dart',
- 'dart2js',
+ 'utils/compiler/compiler.gyp:dart2js',
],
'actions': [
{
@@ -99,10 +99,19 @@
'target_name': 'dart2js',
'type': 'none',
'dependencies': [
+ 'third_party/v8/src/d8.gyp:d8',
'utils/compiler/compiler.gyp:dart2js',
],
},
{
+ 'target_name': 'dart2js_bot',
+ 'type': 'none',
+ 'dependencies': [
+ 'third_party/v8/src/d8.gyp:d8',
+ 'create_sdk',
+ ],
+ },
+ {
'target_name': 'api_docs',
'type': 'none',
'dependencies': [
diff --git a/lib/_internal/libraries.dart b/lib/_internal/libraries.dart
index 651afcb..bcd7386 100644
--- a/lib/_internal/libraries.dart
+++ b/lib/_internal/libraries.dart
@@ -22,6 +22,10 @@
*/
const Map<String, LibraryInfo> LIBRARIES = const <LibraryInfo> {
+ "collection": const LibraryInfo(
+ "collection/collection.dart",
+ implementation: true),
+
"core": const LibraryInfo(
"core/core.dart",
dart2jsPatchPath: "compiler/implementation/lib/core_patch.dart"),
@@ -40,9 +44,9 @@
dart2jsPath: "html/dart2js/html_dart2js.dart"),
"io": const LibraryInfo(
- "io/io_runtime.dart",
+ "io/io.dart",
category: "Server",
- dart2jsPath: "compiler/implementation/lib/io.dart"),
+ dart2jsPatchPath: "compiler/implementation/lib/io_patch.dart"),
"isolate": const LibraryInfo(
"isolate/isolate.dart",
diff --git a/lib/coreimpl/arrays.dart b/lib/collection/arrays.dart
similarity index 95%
rename from lib/coreimpl/arrays.dart
rename to lib/collection/arrays.dart
index 2a43a95..7835182 100644
--- a/lib/coreimpl/arrays.dart
+++ b/lib/collection/arrays.dart
@@ -82,12 +82,11 @@
}
if (start < 0 ) {
String message = "$start must be greater than or equal to 0";
- throw new IndexOutOfRangeException(message);
+ throw new RangeError(message);
}
if (start + length > a.length) {
String message = "$start + $length must be in the range [0..${a.length})";
- throw new IndexOutOfRangeException(message);
+ throw new RangeError(message);
}
}
}
-
diff --git a/lib/collection/collection.dart b/lib/collection/collection.dart
new file mode 100644
index 0000000..3112e86
--- /dev/null
+++ b/lib/collection/collection.dart
@@ -0,0 +1,10 @@
+// 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 collection;
+
+part 'arrays.dart';
+part 'collections.dart';
+part 'maps.dart';
+part 'splay_tree.dart';
diff --git a/lib/collection/collection_sources.gypi b/lib/collection/collection_sources.gypi
new file mode 100644
index 0000000..9eea155
--- /dev/null
+++ b/lib/collection/collection_sources.gypi
@@ -0,0 +1,14 @@
+# 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.
+
+# This file contains all sources for the dart:collection library.
+{
+ 'sources': [
+ 'arrays.dart',
+ 'collections.dart',
+ 'maps.dart',
+ 'splay_tree.dart',
+ ],
+}
+
diff --git a/lib/coreimpl/collections.dart b/lib/collection/collections.dart
similarity index 97%
rename from lib/coreimpl/collections.dart
rename to lib/collection/collections.dart
index 873e9cd..2bee21c 100644
--- a/lib/coreimpl/collections.dart
+++ b/lib/collection/collections.dart
@@ -100,7 +100,9 @@
* it allows this method and [_emitMap] to identify recursive collections
* and maps.
*/
- static void _emitCollection(Collection c, StringBuffer result, List visiting) {
+ static void _emitCollection(Collection c,
+ StringBuffer result,
+ List visiting) {
visiting.add(c);
bool isList = c is List;
result.add(isList ? '[' : '{');
diff --git a/lib/coreimpl/maps.dart b/lib/collection/maps.dart
similarity index 100%
rename from lib/coreimpl/maps.dart
rename to lib/collection/maps.dart
diff --git a/lib/coreimpl/splay_tree.dart b/lib/collection/splay_tree.dart
similarity index 100%
rename from lib/coreimpl/splay_tree.dart
rename to lib/collection/splay_tree.dart
diff --git a/lib/compiler/implementation/closure.dart b/lib/compiler/implementation/closure.dart
index 23d5e9e..0465c22 100644
--- a/lib/compiler/implementation/closure.dart
+++ b/lib/compiler/implementation/closure.dart
@@ -45,9 +45,7 @@
return measure(() {
ClosureClassMap nestedClosureData = closureMappingCache[node];
if (nestedClosureData == null) {
- // TODO(floitsch): we can only assume that the reason for not having a
- // closure data here is, because the function is inside an initializer.
- compiler.unimplemented("Closures inside initializers", node: node);
+ compiler.internalError("No closure cache", node: node);
}
return nestedClosureData;
});
@@ -366,8 +364,7 @@
}
visitNewExpression(NewExpression node) {
- TypeAnnotation annotation = node.send.getTypeAnnotation();
- DartType type = elements.getType(annotation);
+ DartType type = elements.getType(node);
bool hasTypeVariable(DartType type) {
if (type is TypeVariableType) {
@@ -611,9 +608,8 @@
// TODO(ahe): This is problematic. The backend should not repeat
// the work of the resolver. It is the resolver's job to create
// parameters, etc. Other phases should only visit statements.
- // TODO(floitsch): we avoid visiting the initializers on purpose so that
- // we get an error-message later in the builder.
if (node.parameters != null) node.parameters.accept(this);
+ if (node.initializers != null) node.initializers.accept(this);
if (node.body != null) node.body.accept(this);
});
}
diff --git a/lib/compiler/implementation/compile_time_constants.dart b/lib/compiler/implementation/compile_time_constants.dart
index 1569de6..0b1a61e 100644
--- a/lib/compiler/implementation/compile_time_constants.dart
+++ b/lib/compiler/implementation/compile_time_constants.dart
@@ -30,7 +30,7 @@
ConstantHandler(Compiler compiler, this.constantSystem)
- : initialVariableValues = new Map<VariableElement, Dynamic>(),
+ : initialVariableValues = new Map<VariableElement, dynamic>(),
compiledConstants = new Set<Constant>(),
pendingVariables = new Set<VariableElement>(),
lazyStatics = new Set<VariableElement>(),
diff --git a/lib/compiler/implementation/compiler.dart b/lib/compiler/implementation/compiler.dart
index 97fad39..0f5fa17 100644
--- a/lib/compiler/implementation/compiler.dart
+++ b/lib/compiler/implementation/compiler.dart
@@ -105,10 +105,6 @@
bool disableInlining = false;
- // TODO(5074): Remove this field once we don't accept the
- // deprecated parameter specification.
- static final bool REJECT_NAMED_ARGUMENT_AS_POSITIONAL = true;
-
final Tracer tracer;
CompilerTask measuredTask;
@@ -132,9 +128,11 @@
ClassElement nullClass;
ClassElement listClass;
ClassElement mapClass;
+ ClassElement jsInvocationMirrorClass;
Element assertMethod;
Element identicalFunction;
Element functionApplyMethod;
+ Element invokeOnMethod;
Element get currentElement => _currentElement;
withCurrentElement(Element element, f()) {
@@ -142,6 +140,13 @@
_currentElement = element;
try {
return f();
+ } on SpannableAssertionFailure catch (ex) {
+ if (!hasCrashed) {
+ SourceSpan span = spanFromSpannable(ex.node);
+ reportDiagnostic(span, ex.message, api.Diagnostic.ERROR);
+ }
+ hasCrashed = true;
+ throw;
} on CompilerCancelledException catch (ex) {
throw;
} on StackOverflowError catch (ex) {
@@ -178,12 +183,15 @@
static const SourceString MAIN = const SourceString('main');
static const SourceString CALL_OPERATOR_NAME = const SourceString('call');
static const SourceString NO_SUCH_METHOD = const SourceString('noSuchMethod');
+ static const int NO_SUCH_METHOD_ARG_COUNT = 1;
+ static const SourceString INVOKE_ON = const SourceString('invokeOn');
static const SourceString RUNTIME_TYPE = const SourceString('runtimeType');
static const SourceString START_ROOT_ISOLATE =
const SourceString('startRootIsolate');
bool enabledNoSuchMethod = false;
bool enabledRuntimeType = false;
bool enabledFunctionApply = false;
+ bool enabledInvokeOn = false;
Stopwatch progress;
@@ -226,8 +234,9 @@
new dart_backend.DartBackend(this, strips);
constantHandler = new ConstantHandler(this, backend.constantSystem);
enqueuer = new EnqueueTask(this);
- tasks = [scanner, dietParser, parser, resolver, closureToClassMapper,
- checker, typesTask, constantHandler, enqueuer];
+ tasks = [scanner, dietParser, parser, patchParser, libraryLoader,
+ resolver, closureToClassMapper, checker, typesTask,
+ constantHandler, enqueuer];
tasks.addAll(backend.tasks);
}
@@ -279,7 +288,7 @@
} else if (token != null) {
span = spanFromTokens(token, token);
} else if (instruction != null) {
- span = spanFromElement(currentElement);
+ span = spanFromHInstruction(instruction);
} else if (element != null) {
span = spanFromElement(element);
} else {
@@ -289,6 +298,20 @@
throw new CompilerCancelledException(reason);
}
+ SourceSpan spanFromSpannable(Spannable node) {
+ if (node is Node) {
+ return spanFromNode(node);
+ } else if (node is Token) {
+ return spanFromTokens(node, node);
+ } else if (node is HInstruction) {
+ return spanFromHInstruction(node);
+ } else if (node is Element) {
+ return spanFromElement(node);
+ } else {
+ throw 'No error location.';
+ }
+ }
+
void reportFatalError(String reason, Element element,
{Node node, Token token, HInstruction instruction}) {
withCurrentElement(element, () {
@@ -325,6 +348,11 @@
Selector selector = new Selector.noSuchMethod();
enqueuer.resolution.registerInvocation(NO_SUCH_METHOD, selector);
enqueuer.codegen.registerInvocation(NO_SUCH_METHOD, selector);
+
+ Element createInvocationMirrorElement =
+ findHelper(const SourceString('createInvocationMirror'));
+ enqueuer.resolution.addToWorkList(createInvocationMirrorElement);
+ enqueuer.codegen.addToWorkList(createInvocationMirrorElement);
}
void enableIsolateSupport(LibraryElement element) {
@@ -376,6 +404,8 @@
functionClass = lookupSpecialClass(const SourceString('Function'));
listClass = lookupSpecialClass(const SourceString('List'));
mapClass = lookupSpecialClass(const SourceString('Map'));
+ jsInvocationMirrorClass =
+ lookupSpecialClass(const SourceString('JSInvocationMirror'));
closureClass = lookupSpecialClass(const SourceString('Closure'));
dynamicClass = lookupSpecialClass(const SourceString('Dynamic_'));
nullClass = lookupSpecialClass(const SourceString('Null'));
@@ -408,6 +438,9 @@
functionClass.ensureResolved(this);
functionApplyMethod =
functionClass.lookupLocalMember(const SourceString('apply'));
+ jsInvocationMirrorClass.ensureResolved(this);
+ invokeOnMethod = jsInvocationMirrorClass.lookupLocalMember(
+ const SourceString('invokeOn'));
}
void loadCoreImplLibrary() {
@@ -538,6 +571,7 @@
internalErrorOnElement(work.element, "Work list is not empty.");
});
}
+ if (!REPORT_EXCESS_RESOLUTION) return;
var resolved = new Set.from(enqueuer.resolution.resolvedElements.keys);
for (Element e in codegenWorld.generatedCode.keys) {
resolved.remove(e);
@@ -566,7 +600,6 @@
}
}
log('Excess resolution work: ${resolved.length}.');
- if (!REPORT_EXCESS_RESOLUTION) return;
for (Element e in resolved) {
SourceSpan span = spanFromElement(e);
reportDiagnostic(span, 'Warning: $e resolved but not compiled.',
@@ -759,6 +792,17 @@
: spanFromTokens(position, position, uri);
}
+ SourceSpan spanFromHInstruction(HInstruction instruction) {
+ Element element = instruction.sourceElement;
+ if (element == null) element = currentElement;
+ var position = instruction.sourcePosition;
+ if (position == null) return spanFromElement(element);
+ Token token = position.token;
+ if (token == null) return spanFromElement(element);
+ Uri uri = element.getCompilationUnit().script.uri;
+ return spanFromTokens(token, token, uri);
+ }
+
Script readScript(Uri uri, [Node node]) {
unimplemented('Compiler.readScript');
}
@@ -864,8 +908,8 @@
if (condition is Function){
condition = condition();
}
- if (!condition && message != null) {
- print('assertion failed: $message');
+ if (spannable == null || !condition) {
+ throw new SpannableAssertionFailure(spannable, message);
}
- return spannable != null && condition;
+ return true;
}
diff --git a/lib/compiler/implementation/dart_backend/backend.dart b/lib/compiler/implementation/dart_backend/backend.dart
index 8f46463..0ac9d3e 100644
--- a/lib/compiler/implementation/dart_backend/backend.dart
+++ b/lib/compiler/implementation/dart_backend/backend.dart
@@ -41,10 +41,10 @@
result : getFirstNotNullResult((e) => e.getSelector(send));
}
- DartType getType(TypeAnnotation annotation) {
- final result = super.getType(annotation);
+ DartType getType(Node node) {
+ final result = super.getType(node);
return result != null ?
- result : getFirstNotNullResult((e) => e.getType(annotation));
+ result : getFirstNotNullResult((e) => e.getType(node));
}
getFirstNotNullResult(f(TreeElements element)) {
@@ -310,6 +310,10 @@
addClass(classElement);
};
+ compiler.resolverWorld.instantiatedClasses.forEach(
+ (ClassElement classElement) {
+ if (shouldOutput(classElement)) addClass(classElement);
+ });
resolvedElements.forEach((element, treeElements) {
if (!shouldOutput(element)) return;
@@ -481,6 +485,14 @@
if (node.receiver != null && renames[node.receiver] == '') return;
super.unparseSendReceiver(node, spacesNeeded: spacesNeeded);
}
+
+ unparseFunctionName(Node name) {
+ if (name != null && renames.containsKey(name)) {
+ sb.add(renames[name]);
+ } else {
+ super.unparseFunctionName(name);
+ }
+ }
}
diff --git a/lib/compiler/implementation/dart_backend/placeholder_collector.dart b/lib/compiler/implementation/dart_backend/placeholder_collector.dart
index 52a578a..c0e51de 100644
--- a/lib/compiler/implementation/dart_backend/placeholder_collector.dart
+++ b/lib/compiler/implementation/dart_backend/placeholder_collector.dart
@@ -24,6 +24,16 @@
}
}
+class ConstructorPlaceholder {
+ final Node node;
+ final DartType type;
+ final bool isRedirectingCall;
+ ConstructorPlaceholder(this.node, this.type)
+ : this.isRedirectingCall = false;
+ ConstructorPlaceholder.redirectingCall(this.node)
+ : this.type = null, this.isRedirectingCall = true;
+}
+
class DeclarationTypePlaceholder {
final TypeAnnotation typeNode;
final bool requiresVar;
@@ -41,7 +51,12 @@
visitForeignSend(Send node) {}
visitSuperSend(Send node) {
- collector.tryMakeMemberPlaceholder(node.selector);
+ Element element = elements[node];
+ if (element != null && element.isConstructor()) {
+ collector.makeRedirectingConstructorPlaceholder(node.selector, element);
+ } else {
+ collector.tryMakeMemberPlaceholder(node.selector);
+ }
}
visitDynamicSend(Send node) {
@@ -98,30 +113,7 @@
if (node.receiver is Identifier
&& node.receiver.asIdentifier().isThis()) {
assert(node.selector is Identifier);
- collector.tryMakeMemberPlaceholder(node.selector);
- }
- // Field names can be exposed as names of optional arguments, e.g.
- // class C {
- // final field;
- // C([this.field]);
- // }
- // Do not forget to rename them as well.
- FunctionElement functionElement = element;
- Link<Element> optionalParameters =
- functionElement.functionSignature.optionalParameters;
- for (final argument in node.argumentsNode) {
- NamedArgument named = argument.asNamedArgument();
- if (named == null) continue;
- Identifier name = named.name;
- String nameAsString = name.source.slowToString();
- for (final parameter in optionalParameters) {
- if (identical(parameter.kind, ElementKind.FIELD_PARAMETER)) {
- if (parameter.name.slowToString() == nameAsString) {
- collector.tryMakeMemberPlaceholder(name);
- break;
- }
- }
- }
+ collector.makeRedirectingConstructorPlaceholder(node.selector, element);
}
return;
}
@@ -136,7 +128,7 @@
}
internalError(String reason, {Node node}) {
- collector.internalError(reason, node);
+ collector.internalError(reason, node: node);
}
}
@@ -146,11 +138,12 @@
final Map<Element, ElementAst> elementAsts;
final Set<Node> nullNodes; // Nodes that should not be in output.
final Set<Identifier> unresolvedNodes;
- final Map<Element, Set<Identifier>> elementNodes;
+ final Map<Element, Set<Node>> elementNodes;
final Map<FunctionElement, FunctionScope> functionScopes;
final Map<LibraryElement, Set<Identifier>> privateNodes;
final List<DeclarationTypePlaceholder> declarationTypePlaceholders;
final Map<String, Set<Identifier>> memberPlaceholders;
+ final Map<Element, List<ConstructorPlaceholder>> constructorPlaceholders;
Map<String, LocalPlaceholder> currentLocalPlaceholders;
Element currentElement;
FunctionElement topmostEnclosingFunction;
@@ -165,59 +158,19 @@
PlaceholderCollector(this.compiler, this.fixedMemberNames, this.elementAsts) :
nullNodes = new Set<Node>(),
unresolvedNodes = new Set<Identifier>(),
- elementNodes = new Map<Element, Set<Identifier>>(),
+ elementNodes = new Map<Element, Set<Node>>(),
functionScopes = new Map<FunctionElement, FunctionScope>(),
privateNodes = new Map<LibraryElement, Set<Identifier>>(),
declarationTypePlaceholders = new List<DeclarationTypePlaceholder>(),
- memberPlaceholders = new Map<String, Set<Identifier>>();
-
- void tryMakeConstructorNamePlaceholder(
- FunctionExpression constructor, ClassElement element) {
- Node nameNode = constructor.name;
- if (nameNode is Send) nameNode = nameNode.receiver;
- if (nameNode.asIdentifier().token.slowToString()
- == element.name.slowToString()) {
- makeElementPlaceholder(nameNode, element);
- }
- }
+ memberPlaceholders = new Map<String, Set<Identifier>>(),
+ constructorPlaceholders =
+ new Map<Element, List<ConstructorPlaceholder>>();
void collectFunctionDeclarationPlaceholders(
FunctionElement element, FunctionExpression node) {
if (element.isGenerativeConstructor() || element.isFactoryConstructor()) {
- // Two complicated cases for class/interface renaming:
- // 1) class which implements constructors of other interfaces, but not
- // implements interfaces themselves:
- // 0.dart: class C { I(); }
- // 1.dart and 2.dart: interface I default C { I(); }
- // now we have to duplicate our I() constructor in C class with
- // proper names.
- // 2) (even worse for us):
- // 0.dart: class C { C(); }
- // 1.dart: interface C default p0.C { C(); }
- // the second case is just a bug now.
- tryMakeConstructorNamePlaceholder(node, element.getEnclosingClass());
-
- // If we have interface constructor, make sure that we put placeholder
- // for its default factory implementation.
- // Example:
- // interface I default C { I();}
- // class C { factory I() {} }
- // 2 cases:
- // Plain interface name. Rename it unless it is the default
- // constructor for enclosing class.
- // Example:
- // interface I { I(); }
- // class C implements I { C(); } don't rename this case.
- // OR I.named() inside C, rename first part.
- if (element.defaultImplementation != null
- && !identical(element.defaultImplementation, element)) {
- FunctionElement implementingFactory = element.defaultImplementation;
- if (implementingFactory is !SynthesizedConstructorElement) {
- tryMakeConstructorNamePlaceholder(
- elementAsts[implementingFactory].ast,
- element.getEnclosingClass());
- }
- }
+ DartType type = element.getEnclosingClass().type.asRaw();
+ makeConstructorPlaceholder(node.name, element, type);
} else if (Elements.isStaticOrTopLevel(element)) {
// Note: this code should only rename private identifiers for class'
// fields/getters/setters/methods. Top-level identifiers are renamed
@@ -331,7 +284,7 @@
nullNodes.add(node);
}
- void makeElementPlaceholder(Identifier node, Element element) {
+ void makeElementPlaceholder(Node node, Element element) {
assert(element != null);
if (identical(element, entryFunction)) return;
if (identical(element.getLibrary(), coreLibrary)) return;
@@ -341,9 +294,9 @@
if (element == compiler.types.dynamicType.element) {
internalError(
'Should never make element placeholder for dynamic type element',
- node);
+ node: node);
}
- elementNodes.putIfAbsent(element, () => new Set<Identifier>()).add(node);
+ elementNodes.putIfAbsent(element, () => new Set<Node>()).add(node);
}
void makePrivateIdentifier(Identifier node) {
@@ -369,6 +322,18 @@
getLocalPlaceholder().nodes.add(identifier);
}
+ void makeConstructorPlaceholder(Node node, Element element, DartType type) {
+ assert(type != null);
+ constructorPlaceholders
+ .putIfAbsent(element, () => <ConstructorPlaceholder>[])
+ .add(new ConstructorPlaceholder(node, type));
+ }
+ void makeRedirectingConstructorPlaceholder(Node node, Element element) {
+ constructorPlaceholders
+ .putIfAbsent(element, () => <ConstructorPlaceholder>[])
+ .add(new ConstructorPlaceholder.redirectingCall(node));
+ }
+
void internalError(String reason, {Node node}) {
compiler.cancel(reason, node: node);
}
@@ -379,6 +344,45 @@
visitNode(Node node) { node.visitChildren(this); } // We must go deeper.
+ visitNewExpression(NewExpression node) {
+ Send send = node.send;
+ InterfaceType type = treeElements.getType(node);
+ assert(type != null);
+ Element constructor = treeElements[send];
+ assert(constructor != null);
+ assert(send.receiver == null);
+ if (constructor is !ErroneousElement) {
+ makeConstructorPlaceholder(node.send.selector, constructor, type);
+ // TODO(smok): Should this be in visitNamedArgument?
+ // Field names can be exposed as names of optional arguments, e.g.
+ // class C {
+ // final field;
+ // C([this.field]);
+ // }
+ // Do not forget to rename them as well.
+ FunctionElement constructorFunction = constructor;
+ Link<Element> optionalParameters =
+ constructorFunction.functionSignature.optionalParameters;
+ for (final argument in send.argumentsNode) {
+ NamedArgument named = argument.asNamedArgument();
+ if (named == null) continue;
+ Identifier name = named.name;
+ String nameAsString = name.source.slowToString();
+ for (final parameter in optionalParameters) {
+ if (identical(parameter.kind, ElementKind.FIELD_PARAMETER)) {
+ if (parameter.name.slowToString() == nameAsString) {
+ tryMakeMemberPlaceholder(name);
+ break;
+ }
+ }
+ }
+ }
+ } else {
+ makeUnresolvedPlaceholder(node.send.selector);
+ }
+ visit(node.send.argumentsNode);
+ }
+
visitSend(Send send) {
new SendVisitor(this, treeElements).visitSend(send);
send.visitChildren(this);
@@ -448,62 +452,21 @@
}
// We call [resolveReturnType] to allow having 'void'.
final type = compiler.resolveReturnType(currentElement, node);
- bool hasPrefix = false;
if (type is InterfaceType || type is TypedefType) {
- Node target = node.typeName;
- if (node.typeName is Send) {
- final send = node.typeName.asSend();
- Identifier receiver = send.receiver;
- Identifier selector = send.selector;
- Element potentialPrefix =
- currentElement.getLibrary().findLocal(receiver.source);
- if (potentialPrefix != null && potentialPrefix.isPrefix()) {
- // prefix.Class case.
- hasPrefix = true;
- } else {
- // Class.namedContructor case.
- target = receiver;
- // If element is unresolved, mark namedConstructor as unresolved.
- if (treeElements[node] == null) {
- makeUnresolvedPlaceholder(selector);
- }
- }
- }
// TODO(antonm): is there a better way to detect unresolved types?
// Corner case: dart:core type with a prefix.
// Most probably there are some additional problems with
// coreLibPrefix.topLevels.
- Element typeElement = type.element;
- Element dynamicTypeElement = compiler.types.dynamicType.element;
- if (hasPrefix &&
- (identical(typeElement.getLibrary(), coreLibrary) ||
- identical(typeElement, dynamicTypeElement))) {
- makeNullPlaceholder(node.typeName.asSend().receiver);
+ if (!identical(type.element, compiler.types.dynamicType.element)) {
+ makeTypePlaceholder(node.typeName, type);
} else {
- if (hasPrefix) {
- assert(node.typeName is Send);
- Send typeName = node.typeName;
- assert(typeName.receiver is Identifier);
- assert(typeName.selector is Identifier);
- makeNullPlaceholder(typeName.receiver);
- }
- if (!identical(typeElement, dynamicTypeElement)) {
- makeTypePlaceholder(target, type);
- } else {
- if (!isDynamicType(node)) makeUnresolvedPlaceholder(target);
- }
+ if (!isDynamicType(node)) makeUnresolvedPlaceholder(node.typeName);
}
}
- // Trying to differentiate new A.foo() and lib.A cases. In the latter case
- // we don't want to go deeper into typeName.
- if (hasPrefix) {
- // Visit only type arguments, otherwise in case of lib.Class type
- // annotation typeName is Send and we go to visitGetterSend, as a result
- // "Class" is added to member placeholders.
- visit(node.typeArguments);
- } else {
- node.visitChildren(this);
- }
+ // Visit only type arguments, otherwise in case of lib.Class type
+ // annotation typeName is Send and we go to visitGetterSend, as a result
+ // "Class" is added to member placeholders.
+ visit(node.typeArguments);
}
visitVariableDefinitions(VariableDefinitions node) {
diff --git a/lib/compiler/implementation/dart_backend/renamer.dart b/lib/compiler/implementation/dart_backend/renamer.dart
index bf35ab3..7b71afa 100644
--- a/lib/compiler/implementation/dart_backend/renamer.dart
+++ b/lib/compiler/implementation/dart_backend/renamer.dart
@@ -77,18 +77,71 @@
}
}
- sortedForEach(Map<Element, Dynamic> map, f) {
+ sortedForEach(Map<Element, dynamic> map, f) {
for (Element element in sortElements(map.keys)) {
f(element, map[element]);
}
}
+ String renameType(DartType type, Function renameElement) {
+ // TODO(smok): Do not rename type if it is in platform library or
+ // js-helpers.
+ StringBuffer result = new StringBuffer(renameElement(type.element));
+ if (type is InterfaceType) {
+ if (!type.arguments.isEmpty) {
+ result.add('<');
+ Link<DartType> argumentsLink = type.arguments;
+ result.add(renameType(argumentsLink.head, renameElement));
+ for (Link<DartType> link = argumentsLink.tail; !link.isEmpty;
+ link = link.tail) {
+ result.add(',');
+ result.add(renameType(link.head, renameElement));
+ }
+ result.add('>');
+ }
+ }
+ return result.toString();
+ }
+
+ String renameConstructor(Element element, ConstructorPlaceholder placeholder,
+ Function renameString, Function renameElement) {
+ assert(element.isConstructor());
+ StringBuffer result = new StringBuffer();
+ String name = element.name.slowToString();
+ if (element.name != element.getEnclosingClass().name) {
+ // Named constructor or factory. Is there a more reliable way to check
+ // this case?
+ if (!placeholder.isRedirectingCall) {
+ result.add(renameType(placeholder.type, renameElement));
+ result.add('.');
+ }
+ String prefix = '${element.getEnclosingClass().name.slowToString()}\$';
+ if (!name.startsWith(prefix)) {
+ // Factory for another interface (that is going away soon).
+ compiler.internalErrorOnElement(element,
+ "Factory constructors for external interfaces are not supported.");
+ }
+ name = name.substring(prefix.length);
+ if (!element.getLibrary().isPlatformLibrary) {
+ name = renameString(element.getLibrary(), name);
+ }
+ result.add(name);
+ } else {
+ assert(!placeholder.isRedirectingCall);
+ result.add(renameType(placeholder.type, renameElement));
+ }
+ return result.toString();
+ }
+
Function makeElementRenamer(rename, generateUniqueName) => (element) {
assert(Elements.isStaticOrTopLevel(element)
|| element is TypeVariableElement);
// TODO(smok): We may want to reuse class static field and method names.
String originalName = element.name.slowToString();
LibraryElement library = element.getLibrary();
+ if (identical(element.getLibrary(), compiler.coreLibrary)) {
+ return originalName;
+ }
if (library.isPlatformLibrary) {
assert(element.isTopLevel());
final prefix =
@@ -108,6 +161,7 @@
// Renamer function that takes library and original name and returns a new
// name for given identifier.
Function rename;
+ Function renameElement;
// A function that takes original identifier name and generates a new unique
// identifier.
Function generateUniqueName;
@@ -119,7 +173,7 @@
generateUniqueName = (_) =>
generator.generate(forbiddenIdentifiers.contains);
rename = makeRenamer(generateUniqueName);
- Function renameElement = makeElementRenamer(rename, generateUniqueName);
+ renameElement = makeElementRenamer(rename, generateUniqueName);
Set<String> allParameterIdentifiers = new Set<String>();
for (var functionScope in placeholderCollector.functionScopes.values) {
@@ -188,7 +242,7 @@
return newName;
};
rename = makeRenamer(generateUniqueName);
- Function renameElement = makeElementRenamer(rename, generateUniqueName);
+ renameElement = makeElementRenamer(rename, generateUniqueName);
// Rename elements.
sortedForEach(placeholderCollector.elementNodes,
(Element element, Set<Node> nodes) {
@@ -230,6 +284,14 @@
});
}
+ // Rename constructors.
+ placeholderCollector.constructorPlaceholders.forEach(
+ (Element constructor, List<ConstructorPlaceholder> placeholders) {
+ for (ConstructorPlaceholder ph in placeholders) {
+ renames[ph.node] =
+ renameConstructor(constructor, ph, rename, renameElement);
+ }
+ });
sortedForEach(placeholderCollector.privateNodes, (library, nodes) {
renameNodes(nodes, (node) => rename(library, node.source.slowToString()));
});
diff --git a/lib/compiler/implementation/elements/elements.dart b/lib/compiler/implementation/elements/elements.dart
index 1fcdac5..82808cf 100644
--- a/lib/compiler/implementation/elements/elements.dart
+++ b/lib/compiler/implementation/elements/elements.dart
@@ -159,6 +159,16 @@
return enclosingElement != null && enclosingElement.isClass();
}
bool isInstanceMember() => false;
+
+ /**
+ * Returns [:true:] if this element is enclosed in a static member or is
+ * itself a static member.
+ */
+ bool isInStaticMember() {
+ Element member = getEnclosingMember();
+ return member != null && member.modifiers.isStatic();
+ }
+
bool isFactoryConstructor() => modifiers.isFactory();
bool isGenerativeConstructor() =>
identical(kind, ElementKind.GENERATIVE_CONSTRUCTOR);
@@ -296,6 +306,10 @@
return null;
}
+ /**
+ * Returns the member enclosing this element or the element itself if it is a
+ * member. If no enclosing element is found, [:null:] is returned.
+ */
Element getEnclosingMember() {
for (Element e = this; e != null; e = e.enclosingElement) {
if (e.isMember()) return e;
@@ -339,6 +353,8 @@
FunctionElement asFunctionElement() => null;
static bool isInvalid(Element e) => e == null || e.isErroneous();
+
+ bool isAbstract(Compiler compiler) => modifiers.isAbstract();
}
/**
@@ -1170,7 +1186,7 @@
return type;
}
- Node parseNode(DiagnosticListener listener) {
+ FunctionExpression parseNode(DiagnosticListener listener) {
if (patch == null) {
if (modifiers.isExternal()) {
listener.cancel("Compiling external function with no implementation.",
@@ -1193,6 +1209,15 @@
return super.toString();
}
}
+
+ bool isAbstract(Compiler compiler) {
+ if (super.isAbstract(compiler)) return true;
+ if (modifiers.isExternal()) return false;
+ if (isFunction() || isAccessor()) {
+ return !parseNode(compiler).hasBody();
+ }
+ return false;
+ }
}
class ConstructorBodyElement extends FunctionElement {
@@ -1263,7 +1288,7 @@
* variables are not set until [element] has been resolved.
*/
static Link<DartType> createTypeVariables(TypeDeclarationElement element,
- NodeList parameters) {
+ NodeList parameters) {
if (parameters == null) return const Link<DartType>();
// Create types and elements for type variable.
diff --git a/lib/compiler/implementation/enqueue.dart b/lib/compiler/implementation/enqueue.dart
index 6ac8d8f..eac0761 100644
--- a/lib/compiler/implementation/enqueue.dart
+++ b/lib/compiler/implementation/enqueue.dart
@@ -105,6 +105,8 @@
compiler.enabledRuntimeType = true;
} else if (element == compiler.functionApplyMethod) {
compiler.enabledFunctionApply = true;
+ } else if (element == compiler.invokeOnMethod) {
+ compiler.enabledInvokeOn = true;
}
// Enable isolate support if we start using something from the
diff --git a/lib/compiler/implementation/js/printer.dart b/lib/compiler/implementation/js/printer.dart
index d2f7fab..eaa8579 100644
--- a/lib/compiler/implementation/js/printer.dart
+++ b/lib/compiler/implementation/js/printer.dart
@@ -13,6 +13,8 @@
bool atStatementBegin = false;
final DanglingElseVisitor danglingElseVisitor;
final Namer namer;
+ bool pendingSemicolon = false;
+ bool pendingSpace = false;
Printer(leg.Compiler compiler)
: shouldCompressOutput = compiler.enableMinification,
@@ -42,6 +44,16 @@
void out(String str) {
if (str != "") {
+ const identifierRegexp = const RegExp(r'^[a-zA-Z_0-9$]');
+ if (pendingSemicolon && (!shouldCompressOutput || str != "}")) {
+ outBuffer.add(";");
+ }
+ if (pendingSpace &&
+ (!shouldCompressOutput || identifierRegexp.hasMatch(str))) {
+ outBuffer.add(" ");
+ }
+ pendingSpace = false;
+ pendingSemicolon = false;
outBuffer.add(str);
lastAddedString = str;
}
@@ -52,6 +64,14 @@
lineOut();
}
+ void outSemicolonLn() {
+ if (shouldCompressOutput) {
+ pendingSemicolon = true;
+ } else {
+ out(";\n");
+ }
+ }
+
void outIndent(String str) { indent(); out(str); }
void outIndentLn(String str) { indent(); outLn(str); }
void indent() {
@@ -143,7 +163,7 @@
indent();
visitNestedExpression(expressionStatement.expression, EXPRESSION,
newInForInit: false, newAtStatementBegin: true);
- outLn(";");
+ outSemicolonLn();
}
visitEmptyStatement(EmptyStatement nop) {
@@ -179,7 +199,7 @@
}
out("else");
if (elsePart is If) {
- out(" ");
+ pendingSpace = true;
ifOut(elsePart, false);
} else {
blockBody(elsePart, needsSeparation: true, needsNewline: true);
@@ -221,7 +241,8 @@
out("(");
visitNestedExpression(loop.leftHandSide, EXPRESSION,
newInForInit: true, newAtStatementBegin: false);
- out(" in ");
+ out(" in");
+ pendingSpace = true;
visitNestedExpression(loop.object, EXPRESSION,
newInForInit: false, newAtStatementBegin: false);
out(")");
@@ -250,41 +271,46 @@
out("(");
visitNestedExpression(loop.condition, EXPRESSION,
newInForInit: false, newAtStatementBegin: false);
- outLn(");");
+ out(")");
+ outSemicolonLn();
}
visitContinue(Continue node) {
if (node.targetLabel == null) {
- outIndentLn("continue;");
+ outIndentLn("continue");
} else {
- outIndentLn("continue ${node.targetLabel};");
+ outIndentLn("continue ${node.targetLabel}");
}
+ pendingSemicolon = true;
}
visitBreak(Break node) {
if (node.targetLabel == null) {
- outIndentLn("break;");
+ outIndentLn("break");
} else {
- outIndentLn("break ${node.targetLabel};");
+ outIndentLn("break ${node.targetLabel}");
}
+ pendingSemicolon = true;
}
visitReturn(Return node) {
if (node.value == null) {
- outIndentLn("return;");
+ outIndentLn("return");
} else {
- outIndent("return ");
+ outIndent("return");
+ pendingSpace = true;
visitNestedExpression(node.value, EXPRESSION,
newInForInit: false, newAtStatementBegin: false);
- outLn(";");
}
+ outSemicolonLn();
}
visitThrow(Throw node) {
- outIndent("throw ");
+ outIndent("throw");
+ pendingSpace = true;
visitNestedExpression(node.expression, EXPRESSION,
newInForInit: false, newAtStatementBegin: false);
- outLn(";");
+ outSemicolonLn();
}
visitTry(Try node) {
@@ -329,7 +355,8 @@
}
visitCase(Case node) {
- outIndent("case ");
+ outIndent("case");
+ pendingSpace = true;
visitNestedExpression(node.expression, EXPRESSION,
newInForInit: false, newAtStatementBegin: false);
outLn(":");
diff --git a/lib/compiler/implementation/js_backend/backend.dart b/lib/compiler/implementation/js_backend/backend.dart
index 9f79fcc..672e4ab 100644
--- a/lib/compiler/implementation/js_backend/backend.dart
+++ b/lib/compiler/implementation/js_backend/backend.dart
@@ -17,8 +17,9 @@
: this.returnType = null,
compiledFunctions = new List<Element>();
- void update(HType type, Recompile recompile) {
- HType newType = returnType != null ? returnType.union(type) : type;
+ 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
@@ -120,14 +121,14 @@
int get length => types.length;
HType operator[](int index) => types[index];
- HTypeList union(HTypeList other) {
+ 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]);
+ 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);
@@ -147,7 +148,7 @@
* is returned. Otherwise a different [HTypeList] object is returned
* with the type union information.
*/
- HTypeList unionWithInvoke(HInvoke node, HTypeMap types) {
+ HTypeList unionWithInvoke(HInvoke node, HTypeMap types, Compiler compiler) {
// Union an all unknown list with something stays all unknown.
if (allUnknown) return this;
@@ -159,7 +160,7 @@
bool onlyUnknown = true;
HTypeList result = this;
for (int i = 0; i < length; i++) {
- HType newType = this[i].union(types[node.inputs[i + 1]]);
+ HType newType = this[i].union(types[node.inputs[i + 1]], compiler);
if (result == this && newType != this[i]) {
// Create a new argument types object with the matching types copied.
result = new HTypeList(length);
@@ -307,7 +308,7 @@
HType newType;
if (oldType != null) {
- newType = oldType.union(type);
+ newType = oldType.union(type, compiler);
} else {
newType = type;
}
@@ -403,7 +404,7 @@
// initializer list.
HType result = constructorType != null ? constructorType : initializerType;
HType type = fieldTypeMap[field];
- if (type != null) result = result.union(type);
+ if (type != null) result = result.union(type, compiler);
return result;
}
@@ -480,7 +481,8 @@
staticTypeMap[element] = new HTypeList.fromStaticInvocation(node, types);
} else {
if (oldTypes.allUnknown) return;
- HTypeList newTypes = oldTypes.unionWithInvoke(node, types);
+ HTypeList newTypes =
+ oldTypes.unionWithInvoke(node, types, backend.compiler);
if (identical(newTypes, oldTypes)) return;
staticTypeMap[element] = newTypes;
if (optimizedStaticFunctions.contains(element)) {
@@ -522,7 +524,8 @@
selectorTypeMap[selector] = providedTypes;
} else {
HTypeList oldTypes = selectorTypeMap[selector];
- HTypeList newTypes = oldTypes.unionWithInvoke(node, types);
+ HTypeList newTypes =
+ oldTypes.unionWithInvoke(node, types, backend.compiler);
if (identical(newTypes, oldTypes)) return;
selectorTypeMap[selector] = newTypes;
}
@@ -589,7 +592,7 @@
defaultValueTypes);
}
assert(types.allUnknown || types.length == signature.parameterCount);
- found = (found == null) ? types : found.union(types);
+ found = (found == null) ? types : found.union(types, compiler);
return !found.allUnknown;
});
return found != null ? found : HTypeList.ALL_UNKNOWN;
@@ -841,7 +844,7 @@
assert(invariant(element, element.isDeclaration));
ReturnInfo info = returnInfo[element];
if (info != null) {
- info.update(returnType, scheduleForRecompilation);
+ info.update(returnType, scheduleForRecompilation, compiler);
} else {
returnInfo[element] = new ReturnInfo(returnType);
}
diff --git a/lib/compiler/implementation/js_backend/emitter.dart b/lib/compiler/implementation/js_backend/emitter.dart
index f164a85..aecbea0 100644
--- a/lib/compiler/implementation/js_backend/emitter.dart
+++ b/lib/compiler/implementation/js_backend/emitter.dart
@@ -443,41 +443,30 @@
void addParameterStubs(FunctionElement member,
DefineMemberFunction defineInstanceMember) {
- // TODO(5074): Update this comment once we remove support for
- // the deprecated parameter specification.
// We fill the lists depending on the selector. For example,
// take method foo:
- // foo(a, b, [c, d]);
+ // foo(a, b, {c, d});
//
// We may have multiple ways of calling foo:
- // (1) foo(1, 2, 3, 4)
- // (2) foo(1, 2);
- // (3) foo(1, 2, 3);
- // (4) foo(1, 2, c: 3);
- // (5) foo(1, 2, d: 4);
- // (6) foo(1, 2, c: 3, d: 4);
- // (7) foo(1, 2, d: 4, c: 3);
+ // (1) foo(1, 2);
+ // (2) foo(1, 2, c: 3);
+ // (3) foo(1, 2, d: 4);
+ // (4) foo(1, 2, c: 3, d: 4);
+ // (5) foo(1, 2, d: 4, c: 3);
//
// What we generate at the call sites are:
- // (1) foo$4(1, 2, 3, 4)
- // (2) foo$2(1, 2);
- // (3) foo$3(1, 2, 3);
- // (4) foo$3$c(1, 2, 3);
- // (5) foo$3$d(1, 2, 4);
- // (6) foo$4$c$d(1, 2, 3, 4);
- // (7) foo$4$c$d(1, 2, 3, 4);
+ // (1) foo$2(1, 2);
+ // (2) foo$3$c(1, 2, 3);
+ // (3) foo$3$d(1, 2, 4);
+ // (4) foo$4$c$d(1, 2, 3, 4);
+ // (5) foo$4$c$d(1, 2, 3, 4);
//
// The stubs we generate are (expressed in Dart):
- // (1) No stub generated, call is direct.
- // (2) foo$2(a, b) => foo$4(a, b, null, null)
- // (3) foo$3(a, b, c) => foo$4(a, b, c, null)
- // (4) foo$3$c(a, b, c) => foo$4(a, b, c, null);
- // (5) foo$3$d(a, b, d) => foo$4(a, b, null, d);
- // (6) foo$4$c$d(a, b, c, d) => foo$4(a, b, c, d);
- // (7) Same as (5).
- //
- // We need to generate a stub for (5) because the order of the
- // stub arguments and the real method may be different.
+ // (1) foo$2(a, b) => foo$4$c$d(a, b, null, null)
+ // (2) foo$3$c(a, b, c) => foo$4$c$d(a, b, c, null);
+ // (3) foo$3$d(a, b, d) => foo$4$c$d(a, b, null, d);
+ // (4) No stub generated, call is direct.
+ // (5) No stub generated, call is direct.
// Keep a cache of which stubs have already been generated, to
// avoid duplicates. Note that even if selectors are
@@ -488,9 +477,6 @@
&& member.name == Namer.CLOSURE_INVOCATION_NAME) {
// If [Function.apply] is called, we pessimistically compile all
// possible stubs for this closure.
- // TODO(5074): This functionality only supports the new
- // parameter specification, and this comment should be removed
- // once the old specification is not supported.
FunctionSignature signature = member.computeSignature(compiler);
Set<Selector> selectors = signature.optionalParametersAreNamed
? computeNamedSelectors(signature, member)
@@ -600,9 +586,8 @@
if (member.isFunction()
|| member.isGenerativeConstructorBody()
- || member.isGetter()
- || member.isSetter()) {
- if (member.modifiers.isAbstract()) return;
+ || member.isAccessor()) {
+ if (member.isAbstract(compiler)) return;
CodeBuffer codeBuffer = compiler.codegenWorld.generatedCode[member];
if (codeBuffer == null) return;
defineInstanceMember(namer.getName(member), codeBuffer);
@@ -1268,8 +1253,8 @@
// Do not generate no such method handlers if there is no class.
if (compiler.codegenWorld.instantiatedClasses.isEmpty) return;
- String noSuchMethodName =
- namer.publicInstanceMethodNameByArity(Compiler.NO_SUCH_METHOD, 2);
+ String noSuchMethodName = namer.publicInstanceMethodNameByArity(
+ Compiler.NO_SUCH_METHOD, Compiler.NO_SUCH_METHOD_ARG_COUNT);
// Keep track of the JavaScript names we've already added so we
// do not introduce duplicates (bad for code size).
@@ -1294,14 +1279,36 @@
}
CodeBuffer generateMethod(String methodName, Selector selector) {
+ // Values match JSInvocationMirror in js-helper library.
+ const int METHOD = 0;
+ const int GETTER = 1;
+ const int SETTER = 2;
+ int type = METHOD;
+ if (selector.isGetter()) {
+ type = GETTER;
+ } else if (selector.isSetter()) {
+ type = SETTER;
+ }
CodeBuffer args = new CodeBuffer();
for (int i = 0; i < selector.argumentCount; i++) {
if (i != 0) args.add(', ');
args.add('\$$i');
}
+ CodeBuffer argNames = new CodeBuffer();
+ List<SourceString> names = selector.getOrderedNamedArguments();
+ for (int i = 0; i < names.length; i++) {
+ if (i != 0) argNames.add(', ');
+ argNames.add('"');
+ argNames.add(names[i].slowToString());
+ argNames.add('"');
+ }
+ String internalName = namer.instanceMethodInvocationName(
+ selector.library, new SourceString(methodName), selector);
CodeBuffer buffer = new CodeBuffer();
buffer.add('function($args) {\n');
- buffer.add(' return this.$noSuchMethodName("$methodName", [$args]);\n');
+ buffer.add(' return this.$noSuchMethodName('
+ '\$.createInvocationMirror("$methodName", "$internalName",'
+ ' $type, [$args], [$argNames]));\n');
buffer.add(' }');
return buffer;
}
@@ -1438,9 +1445,6 @@
// TODO(ngeoffray): These globals are currently required by the isolate
// library. They should be removed.
- String runtimeTypeCache =
- compiler.enabledRuntimeType ? " context.runtimeTypeCache = {}\n" : "";
-
buffer.add("""
var \$globalThis = $currentIsolate;
var \$globalState;
@@ -1452,7 +1456,7 @@
function \$initGlobals(context) {
context.isolateStatics = new ${namer.ISOLATE}();
-$runtimeTypeCache}
+}
function \$setGlobals(context) {
$currentIsolate = context.isolateStatics;
\$globalThis = $currentIsolate;
@@ -1527,9 +1531,6 @@
// constants to be set up.
emitStaticNonFinalFieldInitializations(mainBuffer);
emitLazilyInitializedStaticFields(mainBuffer);
- if (compiler.enabledRuntimeType && !compiler.hasIsolateSupport()) {
- mainBuffer.add('$isolateProperties.runtimeTypeCache = {};\n');
- }
isolateProperties = isolatePropertiesName;
// The following code should not use the short-hand for the
diff --git a/lib/compiler/implementation/lib/core_patch.dart b/lib/compiler/implementation/lib/core_patch.dart
index d458e74..f75c3d7 100644
--- a/lib/compiler/implementation/lib/core_patch.dart
+++ b/lib/compiler/implementation/lib/core_patch.dart
@@ -19,8 +19,11 @@
patch String toString() => Primitives.objectToString(this);
- patch Dynamic noSuchMethod(String name, List args) {
- throw new NoSuchMethodError(this, name, args);
+ patch dynamic noSuchMethod(InvocationMirror invocation) {
+ throw new NoSuchMethodError(this,
+ invocation.memberName,
+ invocation.positionalArguments,
+ invocation.namedArguments);
}
patch Type get runtimeType {
@@ -141,3 +144,71 @@
patch int get weekday => Primitives.getWeekday(this);
}
+
+
+// Patch for Stopwatch implementation.
+patch class _StopwatchImpl {
+ patch static int _frequency() => 1000;
+ patch static int _now() => Primitives.dateNow();
+}
+
+
+// Patch for List implementation.
+patch class _ListImpl<E> {
+ patch factory List([int length]) => Primitives.newList(length);
+
+ patch factory List.from(Iterable<E> other) {
+ var result = new List();
+ for (var element in other) {
+ result.add(element);
+ }
+ return result;
+ }
+}
+
+
+// Patch for String implementation.
+patch class _StringImpl {
+ patch factory String.fromCharCodes(List<int> charCodes) {
+ checkNull(charCodes);
+ if (!isJsArray(charCodes)) {
+ if (charCodes is !List) throw new ArgumentError(charCodes);
+ charCodes = new List.from(charCodes);
+ }
+ return Primitives.stringFromCharCodes(charCodes);
+ }
+
+ patch static String join(List<String> strings, String separator) {
+ checkNull(strings);
+ checkNull(separator);
+ if (separator is !String) throw new ArgumentError(separator);
+ return stringJoinUnchecked(_toJsStringArray(strings), separator);
+ }
+
+ patch static String concatAll(List<String> strings) {
+ return stringJoinUnchecked(_toJsStringArray(strings), "");
+ }
+
+ static List _toJsStringArray(List<String> strings) {
+ checkNull(strings);
+ var array;
+ final length = strings.length;
+ if (isJsArray(strings)) {
+ array = strings;
+ for (int i = 0; i < length; i++) {
+ final string = strings[i];
+ checkNull(string);
+ if (string is !String) throw new ArgumentError(string);
+ }
+ } else {
+ array = new List(length);
+ for (int i = 0; i < length; i++) {
+ final string = strings[i];
+ checkNull(string);
+ if (string is !String) throw new ArgumentError(string);
+ array[i] = string;
+ }
+ }
+ return array;
+ }
+}
diff --git a/lib/compiler/implementation/lib/coreimpl_patch.dart b/lib/compiler/implementation/lib/coreimpl_patch.dart
index ef73b1c..4ef493e 100644
--- a/lib/compiler/implementation/lib/coreimpl_patch.dart
+++ b/lib/compiler/implementation/lib/coreimpl_patch.dart
@@ -4,80 +4,6 @@
// Patch file for dart:coreimpl classes.
-// Patch for String implementation.
-// TODO(ager): Split out into date_patch.dart and allow #source
-// in patch files?
-patch class StringImplementation {
- patch static String _fromCharCodes(List<int> charCodes) {
- checkNull(charCodes);
- if (!isJsArray(charCodes)) {
- if (charCodes is !List) throw new ArgumentError(charCodes);
- charCodes = new List.from(charCodes);
- }
- return Primitives.stringFromCharCodes(charCodes);
- }
-
- patch String join(List<String> strings, String separator) {
- checkNull(strings);
- checkNull(separator);
- if (separator is !String) throw new ArgumentError(separator);
- return stringJoinUnchecked(_toJsStringArray(strings), separator);
- }
-
- patch String concatAll(List<String> strings) {
- return stringJoinUnchecked(_toJsStringArray(strings), "");
- }
-
- static List _toJsStringArray(List<String> strings) {
- checkNull(strings);
- var array;
- final length = strings.length;
- if (isJsArray(strings)) {
- array = strings;
- for (int i = 0; i < length; i++) {
- final string = strings[i];
- checkNull(string);
- if (string is !String) throw new ArgumentError(string);
- }
- } else {
- array = new List(length);
- for (int i = 0; i < length; i++) {
- final string = strings[i];
- checkNull(string);
- if (string is !String) throw new ArgumentError(string);
- array[i] = string;
- }
- }
- return array;
- }
-}
-
-
-// Patch for List implementation.
-// TODO(ager): Split out into date_patch.dart and allow #source
-// in patch files?
-patch class ListImplementation<E> {
- patch factory List([int length]) => Primitives.newList(length);
-
- patch static List _from(Iterable other) {
- List result = new List();
- for (var element in other) {
- result.add(element);
- }
- return result;
- }
-}
-
-
-// Patch for Stopwatch implementation.
-// TODO(ager): Split out into stopwatch_patch.dart and allow #source
-// in patch files?
-patch class StopwatchImplementation {
- patch static int _frequency() => 1000;
- patch static int _now() => Primitives.dateNow();
-}
-
-
// Patch for RegExp implementation.
// TODO(ager): Split out into regexp_patch.dart and allow #source in
// patch files?
diff --git a/lib/compiler/implementation/lib/interceptors.dart b/lib/compiler/implementation/lib/interceptors.dart
index 1467ca8..2fc25a6 100644
--- a/lib/compiler/implementation/lib/interceptors.dart
+++ b/lib/compiler/implementation/lib/interceptors.dart
@@ -4,7 +4,7 @@
#library('dart:_interceptors');
-#import('dart:coreimpl');
+#import('dart:collection');
add$1(var receiver, var value) {
if (isJsArray(receiver)) {
@@ -19,7 +19,7 @@
if (isJsArray(receiver)) {
if (index is !int) throw new ArgumentError(index);
if (index < 0 || index >= receiver.length) {
- throw new IndexOutOfRangeException(index);
+ throw new RangeError.value(index);
}
checkGrowable(receiver, 'removeAt');
return JS("Object", r'#.splice(#, 1)[0]', receiver, index);
@@ -30,7 +30,7 @@
removeLast(var receiver) {
if (isJsArray(receiver)) {
checkGrowable(receiver, 'removeLast');
- if (receiver.length == 0) throw new IndexOutOfRangeException(-1);
+ if (receiver.length == 0) throw new RangeError.value(-1);
return JS('Object', r'#.pop()', receiver);
}
return UNINTERCEPTED(receiver.removeLast());
@@ -56,7 +56,7 @@
if (isJsArray(receiver)) {
checkNull(newLength); // TODO(ahe): This is not specified but co19 tests it.
if (newLength is !int) throw new ArgumentError(newLength);
- if (newLength < 0) throw new IndexOutOfRangeException(newLength);
+ if (newLength < 0) throw new RangeError.value(newLength);
checkGrowable(receiver, 'set length');
JS('void', r'#.length = #', receiver, newLength);
} else {
@@ -93,8 +93,8 @@
charCodeAt(var receiver, int index) {
if (receiver is String) {
if (index is !num) throw new ArgumentError(index);
- if (index < 0) throw new IndexOutOfRangeException(index);
- if (index >= receiver.length) throw new IndexOutOfRangeException(index);
+ if (index < 0) throw new RangeError.value(index);
+ if (index >= receiver.length) throw new RangeError.value(index);
return JS('int', r'#.charCodeAt(#)', receiver, index);
} else {
return UNINTERCEPTED(receiver.charCodeAt(index));
@@ -196,10 +196,10 @@
if (start is !int) throw new ArgumentError(start);
if (length is !int) throw new ArgumentError(length);
if (length < 0) throw new ArgumentError(length);
- if (start < 0) throw new IndexOutOfRangeException(start);
+ if (start < 0) throw new RangeError.value(start);
var end = start + length;
if (end > receiver.length) {
- throw new IndexOutOfRangeException(length);
+ throw new RangeError.value(length);
}
if (length < 0) throw new ArgumentError(length);
return JS('Object', r'#.slice(#, #)', receiver, start, end);
@@ -299,10 +299,10 @@
if (length < 0) throw new ArgumentError(length);
var receiverLength = JS('num', r'#.length', receiver);
if (start < 0 || start >= receiverLength) {
- throw new IndexOutOfRangeException(start);
+ throw new RangeError.value(start);
}
if (start + length > receiverLength) {
- throw new IndexOutOfRangeException(start + length);
+ throw new RangeError.value(start + length);
}
Arrays.copy(receiver,
start + length,
@@ -334,9 +334,9 @@
if (length is !int) throw new ArgumentError(length);
if (startFrom is !int) throw new ArgumentError(startFrom);
if (length < 0) throw new ArgumentError(length);
- if (start < 0) throw new IndexOutOfRangeException(start);
+ if (start < 0) throw new RangeError.value(start);
if (start + length > receiver.length) {
- throw new IndexOutOfRangeException(start + length);
+ throw new RangeError.value(start + length);
}
Arrays.copy(from, startFrom, receiver, start, length);
@@ -596,9 +596,9 @@
var length = receiver.length;
if (endIndex == null) endIndex = length;
checkNum(endIndex);
- if (startIndex < 0 ) throw new IndexOutOfRangeException(startIndex);
- if (startIndex > endIndex) throw new IndexOutOfRangeException(startIndex);
- if (endIndex > length) throw new IndexOutOfRangeException(endIndex);
+ if (startIndex < 0 ) throw new RangeError.value(startIndex);
+ if (startIndex > endIndex) throw new RangeError.value(startIndex);
+ if (endIndex > length) throw new RangeError.value(endIndex);
return substringUnchecked(receiver, startIndex, endIndex);
}
diff --git a/lib/compiler/implementation/lib/io.dart b/lib/compiler/implementation/lib/io.dart
deleted file mode 100644
index aeeff9e..0000000
--- a/lib/compiler/implementation/lib/io.dart
+++ /dev/null
@@ -1,212 +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.
-
-// This is a copy of the VM's dart:io library. This API is not usable
-// when running inside a web browser. Nevertheless, Leg provides a
-// mock version of the dart:io library so that it can statically
-// analyze programs that use dart:io.
-
-// TODO(ahe): Separate API from implementation details.
-
-/**
- * The IO library is used for Dart server applications,
- * which run on a stand-alone Dart VM from the command line.
- * *This library does not work in browser based applications.*
- *
- * This library allows you to work with files, directories,
- * sockets, processes, HTTP servers and clients, and more.
- */
-#library("dart:io");
-#import("dart:coreimpl");
-#import("dart:math");
-#import("dart:isolate");
-// TODO(ahe): Should Leg support this library?
-// #import("dart:nativewrappers");
-#import("dart:uri");
-#import("dart:crypto");
-#import("dart:utf");
-#source('../../../../runtime/bin/buffer_list.dart');
-// Uses native keyword.
-//#source('../../../../runtime/bin/common.dart');
-#source('../../../../runtime/bin/chunked_stream.dart');
-#source('../../../../runtime/bin/directory.dart');
-// Uses native keyword.
-// #source('../../../../runtime/bin/directory_impl.dart');
-// Uses native keyword.
-// #source('../../../../runtime/bin/eventhandler.dart');
-#source('../../../../runtime/bin/file.dart');
-// Uses native keyword.
-// #source('../../../../runtime/bin/file_impl.dart');
-#source('../../../../runtime/bin/http.dart');
-#source('../../../../runtime/bin/http_impl.dart');
-#source('../../../../runtime/bin/http_parser.dart');
-#source('../../../../runtime/bin/http_utils.dart');
-#source('../../../../runtime/bin/input_stream.dart');
-#source('../../../../runtime/bin/list_stream.dart');
-#source('../../../../runtime/bin/list_stream_impl.dart');
-#source('../../../../runtime/bin/output_stream.dart');
-#source('../../../../runtime/bin/path.dart');
-#source('../../../../runtime/bin/path_impl.dart');
-#source('../../../../runtime/bin/platform.dart');
-// Uses native keyword.
-// #source('../../../../runtime/bin/platform_impl.dart');
-#source('../../../../runtime/bin/process.dart');
-// Uses native keyword.
-// #source('../../../../runtime/bin/process_impl.dart');
-#source('../../../../runtime/bin/socket.dart');
-// Uses native keyword.
-// #source('../../../../runtime/bin/socket_impl.dart');
-#source('../../../../runtime/bin/socket_stream.dart');
-#source('../../../../runtime/bin/socket_stream_impl.dart');
-// Uses native keyword.
-// #source('../../../../runtime/bin/stdio.dart');
-#source('../../../../runtime/bin/stream_util.dart');
-#source('../../../../runtime/bin/string_stream.dart');
-#source('../../../../runtime/bin/timer_impl.dart');
-#source('../../../../runtime/bin/websocket.dart');
-#source('../../../../runtime/bin/websocket_impl.dart');
-
-/**
- * An [OSError] object holds information about an error from the
- * operating system.
- */
-class OSError {
- /** Constant used to indicate that no OS error code is available. */
- static const int noErrorCode = -1;
-
- /** Creates an OSError object from a message and an errorCode. */
- const OSError([String this.message = "", int this.errorCode = noErrorCode]);
-
- /** Converts an OSError object to a string representation. */
- String toString() {
- throw new UnsupportedError('OSError.toString');
- }
-
- /**
- * Error message supplied by the operating system. null if no message is
- * associated with the error.
- */
- final String message;
-
- /**
- * Error code supplied by the operating system. Will have the value
- * [noErrorCode] if there is no error code associated with the error.
- */
- final int errorCode;
-}
-
-List _ensureFastAndSerializableBuffer(List buffer, int offset, int bytes) {
- throw new UnsupportedError('_ensureFastAndSerializableBuffer');
-}
-
-class _File {
- factory _File(arg) {
- throw new UnsupportedError('new File($arg)');
- }
-
- factory _File.fromPath(arg) {
- throw new UnsupportedError('new File.fromPath($arg)');
- }
-}
-
-class _Platform {
- static int get numberOfProcessors {
- throw new UnsupportedError('_Platform.numberOfProcessors');
- }
-
- static String get pathSeparator {
- throw new UnsupportedError('_Platform.pathSeparator');
- }
-
- static String get operatingSystem {
- throw new UnsupportedError('_Platform.operatingSystem');
- }
-
- static String get localHostname {
- throw new UnsupportedError('_Platform.localHostname');
- }
-
- static Map<String, String> get environment {
- throw new UnsupportedError('_Platform.environment');
- }
-}
-
-class _Directory {
- factory _Directory(arg) {
- throw new UnsupportedError('new Directory($arg)');
- }
-
- factory _Directory.fromPath(arg) {
- throw new UnsupportedError('new Directory.fromPath($arg)');
- }
-
- factory _Directory.current() {
- throw new UnsupportedError('new Directory.current()');
- }
-}
-
-class _DirectoryLister {
-}
-
-void _exit(int exitCode) {
- throw new UnsupportedError("exit($exitCode)");
-}
-
-class _Process {
- static Future<Process> start(String executable,
- List<String> arguments,
- [ProcessOptions options]) {
- var msg = 'Process.start($executable, $arguments, $options)';
- throw new UnsupportedError(msg);
- }
-
- static Future<ProcessResult> run(String executable,
- List<String> arguments,
- [ProcessOptions options]) {
- var msg = 'Process.run($executable, $arguments, $options)';
- throw new UnsupportedError(msg);
- }
-}
-
-class _ServerSocket {
- factory _ServerSocket(String bindAddress, int port, int backlog) {
- throw new UnsupportedError(
- 'new ServerSocket($bindAddress, $port, $backlog)');
- }
-}
-
-class _Socket {
- factory _Socket(String host, int port) {
- throw new UnsupportedError('new Socket($host, $port)');
- }
-}
-
-class _EventHandler {
- factory _EventHandler() {
- throw new UnsupportedError('new _EventHandler()');
- }
-
- static void _start() {
- throw new UnsupportedError('_EventHandler._start()');
- }
-
- static _sendData(int id, ReceivePort receivePort, int data) {
- var msg = '_EventHandler._sendData($id, $receivePort, $data)';
- throw new UnsupportedError(msg);
- }
-
- static _EventHandler get _eventHandler {
- throw new UnsupportedError('_EventHandler._eventhandler');
- }
-
- static void set _eventHandler(_EventHandler e) {
- throw new UnsupportedError('_EventHandler._eventhandler = $e');
- }
-}
-
-const InputStream stdin = null;
-
-const OutputStream stdout = null;
-
-const OutputStream stderr = null;
diff --git a/lib/compiler/implementation/lib/io_patch.dart b/lib/compiler/implementation/lib/io_patch.dart
new file mode 100644
index 0000000..f603e87
--- /dev/null
+++ b/lib/compiler/implementation/lib/io_patch.dart
@@ -0,0 +1,177 @@
+// 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.
+
+patch class _BufferUtils {
+ patch static bool _isBuiltinList(List buffer) {
+ throw new UnsupportedError("_isBuiltinList");
+ }
+}
+
+patch class _Directory {
+ patch static String _current() {
+ throw new UnsupportedError("Directory._current");
+ }
+ patch static _createTemp(String template) {
+ throw new UnsupportedError("Directory._createTemp");
+ }
+ patch static int _exists(String path) {
+ throw new UnsupportedError("Directory._exists");
+ }
+ patch static _create(String path) {
+ throw new UnsupportedError("Directory._create");
+ }
+ patch static _delete(String path, bool recursive) {
+ throw new UnsupportedError("Directory._delete");
+ }
+ patch static _rename(String path, String newPath) {
+ throw new UnsupportedError("Directory._rename");
+ }
+ patch static SendPort _newServicePort() {
+ throw new UnsupportedError("Directory._newServicePort");
+ }
+}
+
+patch class _EventHandler {
+ patch static void _start() {
+ throw new UnsupportedError("EventHandler._start");
+ }
+
+ patch static _sendData(Object sender,
+ ReceivePort receivePort,
+ int data) {
+ throw new UnsupportedError("EventHandler._sendData");
+ }
+}
+
+patch class _FileUtils {
+ patch static SendPort _newServicePort() {
+ throw new UnsupportedError("FileUtils._newServicePort");
+ }
+}
+
+patch class _File {
+ patch static _exists(String name) {
+ throw new UnsupportedError("File._exists");
+ }
+ patch static _create(String name) {
+ throw new UnsupportedError("File._create");
+ }
+ patch static _delete(String name) {
+ throw new UnsupportedError("File._delete");
+ }
+ patch static _directory(String name) {
+ throw new UnsupportedError("File._directory");
+ }
+ patch static _lengthFromName(String name) {
+ throw new UnsupportedError("File._lengthFromName");
+ }
+ patch static _lastModified(String name) {
+ throw new UnsupportedError("File._lastModified");
+ }
+ patch static _open(String name, int mode) {
+ throw new UnsupportedError("File._open");
+ }
+ patch static int _openStdio(int fd) {
+ throw new UnsupportedError("File._openStdio");
+ }
+ patch static _fullPath(String name) {
+ throw new UnsupportedError("File._fullPath");
+ }
+}
+
+patch class _RandomAccessFile {
+ patch static int _close(int id) {
+ throw new UnsupportedError("RandomAccessFile._close");
+ }
+ patch static _readByte(int id) {
+ throw new UnsupportedError("RandomAccessFile._readByte");
+ }
+ patch static _readList(int id, List<int> buffer, int offset, int bytes) {
+ throw new UnsupportedError("RandomAccessFile._readList");
+ }
+ patch static _writeByte(int id, int value) {
+ throw new UnsupportedError("RandomAccessFile._writeByte");
+ }
+ patch static _writeList(int id, List<int> buffer, int offset, int bytes) {
+ throw new UnsupportedError("RandomAccessFile._writeList");
+ }
+ patch static _position(int id) {
+ throw new UnsupportedError("RandomAccessFile._position");
+ }
+ patch static _setPosition(int id, int position) {
+ throw new UnsupportedError("RandomAccessFile._setPosition");
+ }
+ patch static _truncate(int id, int length) {
+ throw new UnsupportedError("RandomAccessFile._truncate");
+ }
+ patch static _length(int id) {
+ throw new UnsupportedError("RandomAccessFile._length");
+ }
+ patch static _flush(int id) {
+ throw new UnsupportedError("RandomAccessFile._flush");
+ }
+}
+
+patch class _HttpSessionManager {
+ patch static Uint8List _getRandomBytes(int count) {
+ throw new UnsupportedError("HttpSessionManager._getRandomBytes");
+ }
+}
+
+patch class _Platform {
+ patch static int _numberOfProcessors() {
+ throw new UnsupportedError("Platform._numberOfProcessors");
+ }
+ patch static String _pathSeparator() {
+ throw new UnsupportedError("Platform._pathSeparator");
+ }
+ patch static String _operatingSystem() {
+ throw new UnsupportedError("Platform._operatingSystem");
+ }
+ patch static _localHostname() {
+ throw new UnsupportedError("Platform._localHostname");
+ }
+ patch static _environment() {
+ throw new UnsupportedError("Platform._environment");
+ }
+}
+
+patch class _ProcessUtils {
+ patch static _exit(int status) {
+ throw new UnsupportedError("ProcessUtils._exit");
+ }
+}
+
+patch class Process {
+ patch static Future<Process> start(String executable,
+ List<String> arguments,
+ [ProcessOptions options]) {
+ throw new UnsupportedError("Process.start");
+ }
+
+ patch static Future<ProcessResult> run(String executable,
+ List<String> arguments,
+ [ProcessOptions options]) {
+ throw new UnsupportedError("Process.run");
+ }
+}
+
+patch class ServerSocket {
+ patch factory ServerSocket(String bindAddress, int port, int backlog) {
+ return new _ServerSocket(bindAddress, port, backlog);
+ }
+}
+
+patch class Socket {
+ patch factory Socket(String host, int port) => new _Socket(host, port);
+}
+
+patch class _StdIOUtils {
+ patch static _getStdioHandle(Socket socket, int num) {
+ throw new UnsupportedError("StdIOUtils._getStdioHandle");
+ }
+ patch static _getStdioHandleType(int num) {
+ throw new UnsupportedError("StdIOUtils._getStdioHandleType");
+ }
+}
diff --git a/lib/compiler/implementation/lib/js_helper.dart b/lib/compiler/implementation/lib/js_helper.dart
index fcfa49b..56807be 100644
--- a/lib/compiler/implementation/lib/js_helper.dart
+++ b/lib/compiler/implementation/lib/js_helper.dart
@@ -5,6 +5,7 @@
#library('dart:_js_helper');
#import('dart:coreimpl');
+#import('dart:collection');
#source('constant_map.dart');
#source('native_helper.dart');
@@ -299,7 +300,7 @@
if (!identical(index.truncate(), index)) throw new ArgumentError(index);
}
if (index < 0 || index >= a.length) {
- throw new IndexOutOfRangeException(index);
+ throw new RangeError.value(index);
}
return JS('Object', r'#[#]', a, index);
}
@@ -312,7 +313,7 @@
throw new ArgumentError(index);
}
if (index < 0 || index >= a.length) {
- throw new IndexOutOfRangeException(index);
+ throw new RangeError.value(index);
}
checkMutable(a, 'indexed set');
JS('Object', r'#[#] = #', a, index, value);
@@ -352,6 +353,63 @@
}
}
+createInvocationMirror(name, internalName, type, arguments, argumentNames) =>
+ new JSInvocationMirror(name, internalName, type, arguments, argumentNames);
+
+class JSInvocationMirror implements InvocationMirror {
+ static const METHOD = 0;
+ static const GETTER = 1;
+ static const SETTER = 2;
+
+ final String memberName;
+ final String _internalName;
+ final int _kind;
+ final List _arguments;
+ final List _namedArgumentNames;
+ /** Map from argument name to index in _arguments. */
+ Map<String,dynamic> _namedIndices = null;
+
+ JSInvocationMirror(this.memberName,
+ this._internalName,
+ this._kind,
+ this._arguments,
+ this._namedArgumentNames);
+
+ bool get isMethod => _kind == METHOD;
+ bool get isGetter => _kind == GETTER;
+ bool get isSetter => _kind == SETTER;
+ bool get isAccessor => _kind != METHOD;
+
+ List get positionalArguments {
+ if (isGetter) return null;
+ var list = [];
+ var argumentCount =
+ _arguments.length - _namedArgumentNames.length;
+ for (var index = 0 ; index < argumentCount ; index++) {
+ list.add(_arguments[index]);
+ }
+ return list;
+ }
+
+ Map<String,dynamic> get namedArguments {
+ if (isAccessor) return null;
+ var map = <String,dynamic>{};
+ int namedArgumentCount = _namedArgumentNames.length;
+ int namedArgumentsStartIndex = _arguments.length - namedArgumentCount;
+ for (int i = 0; i < namedArgumentCount; i++) {
+ map[_namedArgumentNames[i]] = _arguments[namedArgumentsStartIndex + i];
+ }
+ return map;
+ }
+
+ invokeOn(Object object) {
+ List arguments = _arguments;
+ if (!isJsArray(arguments)) arguments = new List.from(arguments);
+ return JS("var", "#[#].apply(#, #)",
+ object, _internalName, object, arguments);
+ }
+}
+
class Primitives {
static int hashCodeSeed = 0;
@@ -647,7 +705,7 @@
String selectorName = 'call\$$argumentCount$buffer';
var jsFunction = JS('var', '#[#]', function, selectorName);
if (jsFunction == null) {
- throw new NoSuchMethodError(function, selectorName, arguments);
+ throw new NoSuchMethodError(function, selectorName, arguments, {});
}
// We bound 'this' to [function] because of how we compile
// closures: escaped local variables are stored and accessed through
@@ -671,7 +729,7 @@
* access.
*/
ioore(index) {
- throw new IndexOutOfRangeException(index);
+ throw new RangeError.value(index);
}
listInsertRange(receiver, start, length, initialValue) {
@@ -686,7 +744,7 @@
var receiverLength = JS('num', r'#.length', receiver);
if (start < 0 || start > receiverLength) {
- throw new IndexOutOfRangeException(start);
+ throw new RangeError.value(start);
}
receiver.length = receiverLength + length;
Arrays.copy(receiver,
@@ -888,7 +946,7 @@
type == 'non_object_property_load') {
return new NullPointerException();
} else if (type == 'undefined_method') {
- return new NoSuchMethodError('', name, []);
+ return new NoSuchMethodError('', name, [], {});
}
var ieErrorCode = JS('int', '#.number & 0xffff', ex);
@@ -909,7 +967,7 @@
// Object doesn't support property or method 'foo' which sets the error
// code 438 in IE.
// TODO(kasperl): Compute the right name if possible.
- return new NoSuchMethodError('', '<unknown>', []);
+ return new NoSuchMethodError('', '<unknown>', [], {});
}
}
@@ -1375,8 +1433,9 @@
* Called by generated code when a method that must be statically
* resolved cannot be found.
*/
-void throwNoSuchMethod(obj, name, arguments) {
- throw new NoSuchMethodError(obj, name, arguments);
+void throwNoSuchMethod(obj, name, arguments, expectedArgumentNames) {
+ throw new NoSuchMethodError(obj, name, arguments, const {},
+ expectedArgumentNames);
}
/**
@@ -1393,15 +1452,15 @@
toString() => typeName;
}
+var runtimeTypeCache = JS('var', '{}');
+
Type getOrCreateCachedRuntimeType(String key) {
- Type runtimeType =
- JS('Type', r'#.runtimeTypeCache[#]', JS_CURRENT_ISOLATE(), key);
- if (runtimeType == null) {
- runtimeType = new TypeImpl(key);
- JS('void', r'#.runtimeTypeCache[#] = #', JS_CURRENT_ISOLATE(), key,
- runtimeType);
+ Type result = JS('Type', r'#[#]', runtimeTypeCache, key);
+ if (result == null) {
+ result = new TypeImpl(key);
+ JS('var', r'#[#] = #', runtimeTypeCache, key, result);
}
- return runtimeType;
+ return result;
}
String getRuntimeTypeString(var object) {
diff --git a/lib/compiler/implementation/lib/native_helper.dart b/lib/compiler/implementation/lib/native_helper.dart
index 1ff2e1c..3f79e26 100644
--- a/lib/compiler/implementation/lib/native_helper.dart
+++ b/lib/compiler/implementation/lib/native_helper.dart
@@ -7,6 +7,13 @@
if (name == 'Window') return 'DOMWindow';
if (name == 'CanvasPixelArray') return 'Uint8ClampedArray';
if (name == 'WebKitMutationObserver') return 'MutationObserver';
+ if (name == 'AudioChannelMerger') return 'ChannelMergerNode';
+ if (name == 'AudioChannelSplitter') return 'ChannelSplitterNode';
+ if (name == 'AudioGainNode') return 'GainNode';
+ if (name == 'AudioPannerNode') return 'PannerNode';
+ if (name == 'JavaScriptAudioNode') return 'ScriptProcessorNode';
+ if (name == 'Oscillator') return 'OscillatorNode';
+ if (name == 'RealtimeAnalyserNode') return 'AnalyserNode';
return name;
}
@@ -16,6 +23,13 @@
if (name == 'Window') return 'DOMWindow';
if (name == 'CanvasPixelArray') return 'Uint8ClampedArray';
if (name == 'WebKitMutationObserver') return 'MutationObserver';
+ if (name == 'AudioChannelMerger') return 'ChannelMergerNode';
+ if (name == 'AudioChannelSplitter') return 'ChannelSplitterNode';
+ if (name == 'AudioGainNode') return 'GainNode';
+ if (name == 'AudioPannerNode') return 'PannerNode';
+ if (name == 'JavaScriptAudioNode') return 'ScriptProcessorNode';
+ if (name == 'Oscillator') return 'OscillatorNode';
+ if (name == 'RealtimeAnalyserNode') return 'AnalyserNode';
return name;
}
diff --git a/lib/compiler/implementation/lib/string_helper.dart b/lib/compiler/implementation/lib/string_helper.dart
index eaf132c..3a35778 100644
--- a/lib/compiler/implementation/lib/string_helper.dart
+++ b/lib/compiler/implementation/lib/string_helper.dart
@@ -13,7 +13,7 @@
String group(int group_) {
if (group_ != 0) {
- throw new IndexOutOfRangeException(group_);
+ throw new RangeError.value(group_);
}
return pattern;
}
@@ -105,7 +105,7 @@
} else {
checkNull(from);
// TODO(floitsch): implement generic String.replace (with patterns).
- throw "StringImplementation.replaceAll(Pattern) UNIMPLEMENTED";
+ throw "String.replaceAll(Pattern) UNIMPLEMENTED";
}
}
@@ -118,7 +118,7 @@
} else {
checkNull(from);
// TODO(floitsch): implement generic String.replace (with patterns).
- throw "StringImplementation.replace(Pattern) UNIMPLEMENTED";
+ throw "String.replace(Pattern) UNIMPLEMENTED";
}
}
@@ -129,7 +129,7 @@
var re = regExpGetNative(pattern);
return JS('List', r'#.split(#)', receiver, re);
} else {
- throw "StringImplementation.split(Pattern) UNIMPLEMENTED";
+ throw "String.split(Pattern) UNIMPLEMENTED";
}
}
diff --git a/lib/compiler/implementation/resolution/members.dart b/lib/compiler/implementation/resolution/members.dart
index 34cec51..f96bf11 100644
--- a/lib/compiler/implementation/resolution/members.dart
+++ b/lib/compiler/implementation/resolution/members.dart
@@ -333,7 +333,8 @@
TreeElements resolveField(VariableElement element) {
Node tree = element.parseNode(compiler);
if(element.modifiers.isStatic() && element.variables.isTopLevel()) {
- error(element.modifiers.getStatic(), MessageKind.TOP_LEVEL_VARIABLE_DECLARED_STATIC);
+ error(element.modifiers.getStatic(),
+ MessageKind.TOP_LEVEL_VARIABLE_DECLARED_STATIC);
}
ResolverVisitor visitor = visitorFor(element);
initializerDo(tree, visitor.visit);
@@ -1058,23 +1059,21 @@
// flags instead of closures.
// TODO(johnniwinther): Should never return [null] but instead an erroneous
// type.
- DartType resolveTypeAnnotation(TypeAnnotation node,
- {Scope inScope, ClassElement inClass,
- onFailure(Node, MessageKind, [List arguments]),
- whenResolved(Node, Type)}) {
+ DartType resolveTypeAnnotation(
+ TypeAnnotation node,
+ Scope scope,
+ {onFailure(Node node, MessageKind kind, [List arguments]),
+ whenResolved(Node node, DartType type)}) {
if (onFailure == null) {
onFailure = (n, k, [arguments]) {};
}
if (whenResolved == null) {
whenResolved = (n, t) {};
}
- if (inClass != null) {
- inScope = inClass.buildScope();
- }
- if (inScope == null) {
+ if (scope == null) {
compiler.internalError('resolveTypeAnnotation: no scope specified');
}
- return resolveTypeAnnotationInContext(inScope, node, onFailure,
+ return resolveTypeAnnotationInContext(scope, node, onFailure,
whenResolved);
}
@@ -1699,15 +1698,18 @@
Selector selector = mapping.getSelector(node);
if (selector == null) return;
- // 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
- // with the same arguments.
- if (node.isCall &&
- (Elements.isUnresolved(target) ||
- target.isGetter() ||
- Elements.isClosureSend(node, target))) {
- Selector call = new Selector.callClosureFrom(selector);
- world.registerDynamicInvocation(call.name, call);
+ if (node.isCall) {
+ if (Elements.isUnresolved(target) ||
+ target.isGetter() ||
+ Elements.isClosureSend(node, target)) {
+ // 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
+ // with the same arguments.
+ Selector call = new Selector.callClosureFrom(selector);
+ world.registerDynamicInvocation(call.name, call);
+ } else if (!selector.applies(target, compiler)) {
+ warnArgumentMismatch(node, target);
+ }
}
// TODO(ngeoffray): Warn if target is null and the send is
@@ -1717,6 +1719,13 @@
return node.isPropertyAccess ? target : null;
}
+ void warnArgumentMismatch(Send node, Element target) {
+ // TODO(karlklose): we can be more precise about the reason of the
+ // mismatch.
+ warning(node.argumentsNode, MessageKind.INVALID_ARGUMENTS,
+ [target.name]);
+ }
+
visitSendSet(SendSet node) {
Element target = resolveSend(node);
Element setter = target;
@@ -1917,31 +1926,7 @@
* [null], if there is no corresponding constructor, class or library.
*/
FunctionElement resolveConstructor(NewExpression node) {
- // Resolve the constructor that [node] refers to.
- ConstructorResolver visitor =
- new ConstructorResolver(compiler, this, node.isConst());
- FunctionElement constructor = node.accept(visitor);
- // Try to resolve the type that the new-expression constructs.
- TypeAnnotation annotation = node.send.getTypeAnnotation();
- if (Elements.isUnresolved(constructor)) {
- // Resolve the type arguments. We cannot create a type and check the
- // number of type arguments for this annotation, because we do not know
- // the element.
- Link arguments = const Link<Node>();
- if (annotation.typeArguments != null) {
- arguments = annotation.typeArguments.nodes;
- }
- for (Node argument in arguments) {
- resolveTypeRequired(argument);
- }
- } else {
- // Resolve and store the type this annotation resolves to. The type
- // is used in the backend, e.g., for creating runtime type information.
- // TODO(karlklose): This will resolve the class element again. Refactor
- // so we can use the TypeResolver.
- resolveTypeRequired(annotation);
- }
- return constructor;
+ return node.accept(new ConstructorResolver(compiler, this));
}
DartType resolveTypeRequired(TypeAnnotation node) {
@@ -1971,10 +1956,21 @@
}
DartType resolveTypeAnnotation(TypeAnnotation node) {
+ // TODO(johnniwinther): Remove this together with the named arguments
+ // on [TypeResolver.resolveTypeAnnotation].
+ void checkAndUseType(TypeAnnotation annotation, DartType type) {
+ useType(annotation, type);
+ if (type != null &&
+ identical(type.kind, TypeKind.TYPE_VARIABLE) &&
+ enclosingElement.isInStaticMember()) {
+ warning(annotation, MessageKind.TYPE_VARIABLE_WITHIN_STATIC_MEMBER,
+ [type]);
+ }
+ }
+
Function report = typeRequired ? error : warning;
- DartType type = typeResolver.resolveTypeAnnotation(node, inScope: scope,
- onFailure: report,
- whenResolved: useType);
+ DartType type = typeResolver.resolveTypeAnnotation(
+ node, scope, onFailure: report, whenResolved: checkAndUseType);
if (type == null) return null;
if (inCheckContext) {
compiler.enqueuer.resolution.registerIsCheck(type);
@@ -2339,7 +2335,7 @@
TypeVariableElement variableElement = typeVariable.element;
if (typeNode.bound != null) {
DartType boundType = typeResolver.resolveTypeAnnotation(
- typeNode.bound, inScope: scope, onFailure: warning);
+ typeNode.bound, scope, onFailure: warning);
if (boundType != null && boundType.element == variableElement) {
// TODO(johnniwinther): Check for more general cycles, like
// [: <A extends B, B extends C, C extends B> :].
@@ -2868,13 +2864,10 @@
class ConstructorResolver extends CommonResolverVisitor<Element> {
final ResolverVisitor resolver;
- // TODO(ngeoffray): have this context at the call site.
- final bool inConstContext;
+ bool inConstContext = false;
+ DartType type;
- ConstructorResolver(Compiler compiler,
- this.resolver,
- this.inConstContext)
- : super(compiler);
+ ConstructorResolver(Compiler compiler, this.resolver) : super(compiler);
visitNode(Node node) {
throw 'not supported';
@@ -2927,6 +2920,7 @@
}
visitNewExpression(NewExpression node) {
+ inConstContext = node.isConst();
Node selector = node.send.selector;
Element e = visit(selector);
if (!Elements.isUnresolved(e) && identical(e.kind, ElementKind.CLASS)) {
@@ -2937,11 +2931,21 @@
}
e = lookupConstructor(cls, selector, const SourceString(''));
}
+ if (type == null) {
+ if (Elements.isUnresolved(e)) {
+ type = compiler.dynamicClass.computeType(compiler);
+ } else {
+ type = e.getEnclosingClass().computeType(compiler).asRaw();
+ }
+ }
+ resolver.mapping.setType(node, type);
return e;
}
visitTypeAnnotation(TypeAnnotation node) {
- return visit(node.typeName);
+ assert(invariant(node, type == null));
+ type = resolver.resolveTypeRequired(node);
+ return resolver.mapping[node];
}
visitSend(Send node) {
diff --git a/lib/compiler/implementation/scanner/class_element_parser.dart b/lib/compiler/implementation/scanner/class_element_parser.dart
index 39e6d25..8e3c360 100644
--- a/lib/compiler/implementation/scanner/class_element_parser.dart
+++ b/lib/compiler/implementation/scanner/class_element_parser.dart
@@ -132,15 +132,14 @@
addMember(memberElement);
}
- void endFactoryMethod(Token factoryKeyword, Token periodBeforeName,
- Token endToken) {
- super.endFactoryMethod(factoryKeyword, periodBeforeName, endToken);
+ void endFactoryMethod(Token beginToken, Token endToken) {
+ super.endFactoryMethod(beginToken, endToken);
FunctionExpression method = popNode();
pushNode(null);
SourceString name = getMethodNameHack(method.name);
ElementKind kind = ElementKind.FUNCTION;
Element memberElement =
- new PartialFunctionElement(name, factoryKeyword, null, endToken,
+ new PartialFunctionElement(name, beginToken, null, endToken,
kind, method.modifiers, enclosingElement);
addMember(memberElement);
}
diff --git a/lib/compiler/implementation/scanner/listener.dart b/lib/compiler/implementation/scanner/listener.dart
index 8d309ae..ae3453b 100644
--- a/lib/compiler/implementation/scanner/listener.dart
+++ b/lib/compiler/implementation/scanner/listener.dart
@@ -99,8 +99,7 @@
void beginFactoryMethod(Token token) {
}
- void endFactoryMethod(Token startKeyword, Token periodBeforeName,
- Token endToken) {
+ void endFactoryMethod(Token beginToken, Token endToken) {
}
void beginFormalParameter(Token token) {
@@ -408,7 +407,7 @@
void handleConditionalExpression(Token question, Token colon) {
}
- void handleConstExpression(Token token, bool named) {
+ void handleConstExpression(Token token) {
}
void handleFunctionTypedFormalParameter(Token token) {
@@ -474,7 +473,7 @@
void handleNamedArgument(Token colon) {
}
- void handleNewExpression(Token token, bool named) {
+ void handleNewExpression(Token token) {
}
void handleNoArguments(Token token) {
@@ -1388,7 +1387,11 @@
}
void endFunctionBody(int count, Token beginToken, Token endToken) {
- pushNode(new Block(makeNodeList(count, beginToken, endToken, null)));
+ if (count == 0 && beginToken == null) {
+ pushNode(new EmptyStatement(endToken));
+ } else {
+ pushNode(new Block(makeNodeList(count, beginToken, endToken, null)));
+ }
}
void handleNoFunctionBody(Token token) {
@@ -1570,19 +1573,15 @@
pushNode(new Send(receiver, selector, arguments));
}
- void handleNewExpression(Token token, bool named) {
+ void handleNewExpression(Token token) {
NodeList arguments = popNode();
Node name = popNode();
- if (named) {
- TypeAnnotation type = popNode();
- name = new Send(type, name);
- }
pushNode(new NewExpression(token, new Send(null, name, arguments)));
}
- void handleConstExpression(Token token, bool named) {
+ void handleConstExpression(Token token) {
// [token] carries the 'const' information.
- handleNewExpression(token, named);
+ handleNewExpression(token);
}
void handleOperatorName(Token operatorKeyword, Token token) {
@@ -1687,25 +1686,14 @@
pushNode(new EmptyStatement(token));
}
- void endFactoryMethod(Token startKeyword, Token periodBeforeName,
- Token endToken) {
+ void endFactoryMethod(Token beginToken, Token endToken) {
Statement body = popNode();
NodeList formals = popNode();
- // TODO(karlklose): don't throw type parameters away.
- NodeList typeParameters;
- Node name;
- if (periodBeforeName != null) {
- name = popNode();
- typeParameters = popNode();
- // A library prefix was handled in [handleQualified].
- name = new Send(popNode(), name);
- } else {
- typeParameters = popNode();
- name = popNode();
- }
+ Node name = popNode();
+
// TODO(ahe): Move this parsing to the parser.
int modifierCount = 0;
- Token modifier = startKeyword;
+ Token modifier = beginToken;
if (modifier.stringValue == "external") {
handleModifier(modifier);
modifierCount++;
diff --git a/lib/compiler/implementation/scanner/parser.dart b/lib/compiler/implementation/scanner/parser.dart
index 5f3e99a..73e8c0a 100644
--- a/lib/compiler/implementation/scanner/parser.dart
+++ b/lib/compiler/implementation/scanner/parser.dart
@@ -977,21 +977,14 @@
Token factoryKeyword = token;
listener.beginFactoryMethod(factoryKeyword);
token = token.next; // Skip 'factory'.
- token = parseIdentifier(token);
- token = parseQualifiedRestOpt(token);
- token = parseTypeVariablesOpt(token);
- Token period = null;
- if (optional('.', token)) {
- period = token;
- token = parseIdentifier(token.next);
- }
+ token = parseConstructorReference(token);
token = parseFormalParameters(token);
if (optional('=', token)) {
token = parseRedirectingFactoryBody(token);
} else {
token = parseFunctionBody(token, false);
}
- listener.endFactoryMethod(start, period, token);
+ listener.endFactoryMethod(start, token);
return token.next;
}
@@ -1652,22 +1645,22 @@
return false;
}
- Token parseNewExpression(Token token) {
- Token newKeyword = token;
- token = expect('new', token);
- token = parseType(token);
- bool named = false;
- if (optional('.', token)) {
- named = true;
- token = parseIdentifier(token.next);
- }
+ Token parseRequiredArguments(Token token) {
if (optional('(', token)) {
token = parseArguments(token);
} else {
listener.handleNoArguments(token);
token = listener.unexpected(token);
}
- listener.handleNewExpression(newKeyword, named);
+ return token;
+ }
+
+ Token parseNewExpression(Token token) {
+ Token newKeyword = token;
+ token = expect('new', token);
+ token = parseConstructorReference(token);
+ token = parseRequiredArguments(token);
+ listener.handleNewExpression(newKeyword);
return token;
}
@@ -1681,15 +1674,9 @@
(identical(value, '{'))) {
return parseLiteralListOrMap(constKeyword);
}
- token = parseType(token);
- bool named = false;
- if (optional('.', token)) {
- named = true;
- token = parseIdentifier(token.next);
- }
- expect('(', token);
- token = parseArguments(token);
- listener.handleConstExpression(constKeyword, named);
+ token = parseConstructorReference(token);
+ token = parseRequiredArguments(token);
+ listener.handleConstExpression(constKeyword);
return token;
}
diff --git a/lib/compiler/implementation/ssa/bailout.dart b/lib/compiler/implementation/ssa/bailout.dart
index bd6223f..e6423cd 100644
--- a/lib/compiler/implementation/ssa/bailout.dart
+++ b/lib/compiler/implementation/ssa/bailout.dart
@@ -192,7 +192,7 @@
void visitInstruction(HInstruction instruction) {
HType speculativeType = types[instruction];
- HType computedType = instruction.computeTypeFromInputTypes(types);
+ HType computedType = instruction.computeTypeFromInputTypes(types, compiler);
// Currently the type in [types] is the speculative type each instruction
// would like to have. We start by recomputing the type non-speculatively.
// If we add a type guard then the guard will expose the speculative type.
diff --git a/lib/compiler/implementation/ssa/builder.dart b/lib/compiler/implementation/ssa/builder.dart
index 1ef011b..2dbd9a3 100644
--- a/lib/compiler/implementation/ssa/builder.dart
+++ b/lib/compiler/implementation/ssa/builder.dart
@@ -322,15 +322,21 @@
* If the scope (function or loop) [node] has captured variables then this
* method creates a box and sets up the redirections.
*/
- void enterScope(Node node) {
+ void enterScope(Node node, Element element) {
// See if any variable in the top-scope of the function is captured. If yes
// we need to create a box-object.
ClosureScope scopeData = closureData.capturingScopes[node];
if (scopeData != null) {
- // The scope has captured variables. Create a box.
- // TODO(floitsch): Clean up this hack. Should we create a box-object by
- // just creating an empty object literal?
- HInstruction box = createBox();
+ HInstruction box;
+ // The scope has captured variables.
+ if (element != null && element.isGenerativeConstructorBody()) {
+ // The box is passed as a parameter to a generative
+ // constructor body.
+ box = new HParameterValue(scopeData.boxElement);
+ builder.add(box);
+ } else {
+ box = createBox();
+ }
// Add the box to the known locals.
directLocals[scopeData.boxElement] = box;
// Make sure that accesses to the boxed locals go into the box. We also
@@ -398,7 +404,7 @@
});
}
- enterScope(node);
+ enterScope(node, element);
// If the freeVariableMapping is not empty, then this function was a
// nested closure that captures variables. Redirect the captured
@@ -610,7 +616,7 @@
// redirections already now. This way the initializer can write its
// values into the box.
// For other loops the box will be created when entering the body.
- enterScope(node);
+ enterScope(node, null);
}
}
@@ -641,7 +647,7 @@
// If there are no declared boxed loop variables then we did not create the
// box before the initializer and we have to create the box now.
if (!scopeData.hasBoxedLoopVariables()) {
- enterScope(node);
+ enterScope(node, null);
}
}
@@ -867,7 +873,7 @@
HGraph graph;
LocalsHandler localsHandler;
HInstruction rethrowableException;
- Map<Element, HParameterValue> parameters;
+ Map<Element, HInstruction> parameters;
final RuntimeTypeInformation rti;
Map<TargetElement, JumpHandler> jumpTargets;
@@ -907,7 +913,7 @@
stack = new List<HInstruction>(),
activationVariables = new Map<Element, HLocalValue>(),
jumpTargets = new Map<TargetElement, JumpHandler>(),
- parameters = new Map<Element, HParameterValue>(),
+ parameters = new Map<Element, HInstruction>(),
sourceElementStack = <Element>[work.element],
inliningStack = <InliningState>[],
rti = builder.compiler.codegenWorld.rti,
@@ -916,7 +922,7 @@
}
static const MAX_INLINING_DEPTH = 3;
- static const MAX_INLINING_SOURCE_SIZE = 100;
+ static const MAX_INLINING_SOURCE_SIZE = 128;
List<InliningState> inliningStack;
Element returnElement = null;
@@ -970,10 +976,8 @@
if (constructor is SynthesizedConstructorElement) return null;
FunctionExpression node = constructor.parseNode(compiler);
// If we know the body doesn't have any code, we don't generate it.
- if (node.body.asBlock() != null) {
- NodeList statements = node.body.asBlock().statements;
- if (statements.isEmpty) return null;
- }
+ if (!node.hasBody()) return null;
+ if (node.hasEmptyBody()) return null;
ClassElement classElement = constructor.getEnclosingClass();
ConstructorBodyElement bodyElement;
for (Link<Element> backendMembers = classElement.backendMembers;
@@ -1153,6 +1157,10 @@
FunctionSignature params = constructor.computeSignature(compiler);
params.orderedForEachParameter((Element parameter) {
HInstruction argument = compiledArguments[index++];
+ // Because we are inlining the initializer, we must update
+ // what was given as parameter. This will be used in case
+ // there is a parameter check expression in the initializer.
+ parameters[parameter] = argument;
localsHandler.updateLocal(parameter, argument);
// Don't forget to update the field, if the parameter is of the
// form [:this.x:].
@@ -1166,7 +1174,21 @@
TreeElements oldElements = elements;
elements =
compiler.enqueuer.resolution.getCachedElements(constructor);
+
+ ClosureClassMap oldClosureData = localsHandler.closureData;
+ Node node = constructor.parseNode(compiler);
+ localsHandler.closureData =
+ compiler.closureToClassMapper.computeClosureToClassMapping(
+ constructor, node, elements);
+
+ params.orderedForEachParameter((Element parameterElement) {
+ if (elements.isParameterChecked(parameterElement)) {
+ addParameterCheckInstruction(parameterElement);
+ }
+ });
+ localsHandler.enterScope(node, constructor);
buildInitializers(constructor, constructors, fieldValues);
+ localsHandler.closureData = oldClosureData;
elements = oldElements;
});
}
@@ -1354,8 +1376,36 @@
FunctionSignature functionSignature = body.computeSignature(compiler);
int arity = functionSignature.parameterCount;
functionSignature.orderedForEachParameter((parameter) {
+ // TODO(ngeoffray): No need to pass the parameters that are
+ // captured and stored in a box. Because this information is
+ // not trivial to get in codegen.dart, we just pass the
+ // parameters anyway. We need to update both codegen.dart and
+ // builder.dart on how parameters are being passed.
bodyCallInputs.add(localsHandler.readLocal(parameter));
});
+
+ // If parameters are checked, we pass the already computed
+ // boolean to the constructor body.
+ TreeElements elements =
+ compiler.enqueuer.resolution.getCachedElements(constructor);
+ Node node = constructor.parseNode(compiler);
+ ClosureClassMap parameterClosureData =
+ compiler.closureToClassMapper.getMappingForNestedFunction(node);
+ functionSignature.orderedForEachParameter((parameter) {
+ if (elements.isParameterChecked(parameter)) {
+ Element fieldCheck =
+ parameterClosureData.parametersWithSentinel[parameter];
+ bodyCallInputs.add(localsHandler.readLocal(fieldCheck));
+ }
+ });
+
+ // If there are locals that escape (ie used in closures), we
+ // pass the box to the constructor.
+ ClosureScope scopeData = parameterClosureData.capturingScopes[node];
+ if (scopeData != null) {
+ bodyCallInputs.add(localsHandler.readLocal(scopeData.boxElement));
+ }
+
// TODO(ahe): The constructor name is statically resolved. See
// SsaCodeGenerator.visitInvokeDynamicMethod. Is there a cleaner
// way to do this?
@@ -1376,48 +1426,56 @@
}
void addParameterCheckInstruction(Element element) {
- // This is the code we emit for a parameter that is being checked
- // on whether it was given at value at the call site:
- //
- // foo([a = 42) {
- // if (?a) print('parameter passed $a');
- // }
- //
- // foo([a = 42]) {
- // var t1 = a === sentinel;
- // if (t1) a = 42;
- // if (!t1) print('parameter passed ' + a);
- // }
+ HInstruction check;
+ Element checkResultElement =
+ localsHandler.closureData.parametersWithSentinel[element];
+ if (currentElement.isGenerativeConstructorBody()) {
+ // A generative constructor body receives extra parameters that
+ // indicate if a parameter was passed to the factory.
+ check = new HParameterValue(checkResultElement);
+ add(check);
+ } else {
+ // This is the code we emit for a parameter that is being checked
+ // on whether it was given at value at the call site:
+ //
+ // foo([a = 42) {
+ // if (?a) print('parameter passed $a');
+ // }
+ //
+ // foo([a = 42]) {
+ // var t1 = a === sentinel;
+ // if (t1) a = 42;
+ // if (!t1) print('parameter passed ' + a);
+ // }
- // Fetch the original default value of [element];
- ConstantHandler handler = compiler.constantHandler;
- Constant constant = handler.compileVariable(element);
- HConstant defaultValue = constant == null
- ? graph.addConstantNull(constantSystem)
- : graph.addConstant(constant);
+ // Fetch the original default value of [element];
+ ConstantHandler handler = compiler.constantHandler;
+ Constant constant = handler.compileVariable(element);
+ HConstant defaultValue = constant == null
+ ? graph.addConstantNull(constantSystem)
+ : graph.addConstant(constant);
- // Emit the equality check with the sentinel.
- HConstant sentinel = graph.addConstant(SentinelConstant.SENTINEL);
- Element equalsHelper = interceptors.getTripleEqualsInterceptor();
- HInstruction target = new HStatic(equalsHelper);
- add(target);
- HInstruction operand = parameters[element];
- HInstruction check = new HIdentity(target, sentinel, operand);
- add(check);
+ // Emit the equality check with the sentinel.
+ HConstant sentinel = graph.addConstant(SentinelConstant.SENTINEL);
+ Element equalsHelper = interceptors.getTripleEqualsInterceptor();
+ HInstruction target = new HStatic(equalsHelper);
+ add(target);
+ HInstruction operand = parameters[element];
+ check = new HIdentity(target, sentinel, operand);
+ add(check);
- // If the check succeeds, we must update the parameter with the
- // default value.
- handleIf(element.parseNode(compiler),
- () => stack.add(check),
- () => localsHandler.updateLocal(element, defaultValue),
- null);
+ // If the check succeeds, we must update the parameter with the
+ // default value.
+ handleIf(element.parseNode(compiler),
+ () => stack.add(check),
+ () => localsHandler.updateLocal(element, defaultValue),
+ null);
- // Create the instruction that parameter checks will use.
- check = new HNot(check);
- add(check);
+ // Create the instruction that parameter checks will use.
+ check = new HNot(check);
+ add(check);
+ }
- ClosureClassMap closureData = localsHandler.closureData;
- Element checkResultElement = closureData.parametersWithSentinel[element];
localsHandler.updateLocal(checkResultElement, check);
}
@@ -2300,6 +2358,15 @@
push(result);
}
+ void pushInvokeHelper4(Element helper, HInstruction a0, HInstruction a1,
+ HInstruction a2, HInstruction a3) {
+ HInstruction reference = new HStatic(helper);
+ add(reference);
+ List<HInstruction> inputs = <HInstruction>[reference, a0, a1, a2, a3];
+ HInstruction result = new HInvokeStatic(inputs);
+ push(result);
+ }
+
visitOperatorSend(node) {
assert(node.selector is Operator);
if (!methodInterceptionEnabled) {
@@ -2500,6 +2567,12 @@
addDynamicSendArgumentsToList(node, inputs);
+ Element element = elements[node];
+ if (element != null && compiler.world.hasNoOverridingMember(element)) {
+ if (tryInlineMethod(element, selector, node.arguments)) {
+ return;
+ }
+ }
// The first entry in the inputs list is the receiver.
pushWithPosition(new HInvokeDynamicMethod(selector, inputs), node);
@@ -2733,15 +2806,14 @@
} else if (element.isFunction() || element.isGenerativeConstructor()) {
// TODO(5347): Try to avoid the need for calling [implementation] before
// calling [addStaticSendArgumentsToList].
+ FunctionElement function = element.implementation;
bool succeeded = addStaticSendArgumentsToList(selector, node.arguments,
- element.implementation,
- inputs);
+ function, inputs);
if (!succeeded) {
- // TODO(ngeoffray): Match the VM behavior and throw an
- // exception at runtime.
- compiler.cancel('Unimplemented non-matching static call', node: node);
+ generateWrongArgumentCountError(node, element, node.arguments);
+ } else {
+ push(new HInvokeSuper(inputs));
}
- push(new HInvokeSuper(inputs));
} else {
target = new HInvokeSuper(inputs);
add(target);
@@ -2902,7 +2974,7 @@
<HInstruction>[typeInfoSetter, newObject, runtimeInfo]));
}
- visitNewSend(Send node) {
+ visitNewSend(Send node, InterfaceType type) {
bool isListConstructor = false;
computeType(element) {
Element originalElement = elements[node];
@@ -2940,16 +3012,10 @@
constructor.implementation,
inputs);
if (!succeeded) {
- // TODO(ngeoffray): Match the VM behavior and throw an
- // exception at runtime.
- compiler.cancel('Unimplemented non-matching static call', node: node);
+ generateWrongArgumentCountError(node, constructor, node.arguments);
+ return;
}
- TypeAnnotation annotation = node.getTypeAnnotation();
- if (annotation == null) {
- compiler.internalError("malformed send in new expression");
- }
- InterfaceType type = elements.getType(annotation);
if (type.element.modifiers.isAbstract() &&
constructor.isGenerativeConstructor()) {
generateAbstractClassInstantiationError(node, type.name.slowToString());
@@ -2983,7 +3049,8 @@
argumentNodes: node.arguments);
return;
}
- if (identical(element, compiler.assertMethod) && !compiler.enableUserAssertions) {
+ if (identical(element, compiler.assertMethod)
+ && !compiler.enableUserAssertions) {
stack.add(graph.addConstantNull(constantSystem));
return;
}
@@ -3002,9 +3069,8 @@
element.implementation,
inputs);
if (!succeeded) {
- // TODO(ngeoffray): Match the VM behavior and throw an
- // exception at runtime.
- compiler.cancel('Unimplemented non-matching static call', node: node);
+ generateWrongArgumentCountError(node, element, node.arguments);
+ return;
}
// TODO(kasperl): Try to use the general inlining infrastructure for
@@ -3060,7 +3126,8 @@
void generateThrowNoSuchMethod(Node diagnosticNode,
String methodName,
{Link<Node> argumentNodes,
- List<HInstruction> argumentValues}) {
+ List<HInstruction> argumentValues,
+ List<String> existingArguments}) {
Element helper =
compiler.findHelper(const SourceString('throwNoSuchMethod'));
Constant receiverConstant =
@@ -3080,7 +3147,40 @@
}
HInstruction arguments = new HLiteralList(argumentValues);
add(arguments);
- pushInvokeHelper3(helper, receiver, name, arguments);
+ HInstruction existingNamesList;
+ if (existingArguments != null) {
+ List<HInstruction> existingNames = <HInstruction>[];
+ for (String name in existingArguments) {
+ HInstruction nameConstant =
+ graph.addConstantString(new DartString.literal(name),
+ diagnosticNode, constantSystem);
+ existingNames.add(nameConstant);
+ }
+ existingNamesList = new HLiteralList(existingNames);
+ add(existingNamesList);
+ } else {
+ existingNamesList = graph.addConstantNull(constantSystem);
+ }
+ pushInvokeHelper4(helper, receiver, name, arguments, existingNamesList);
+ }
+
+ /**
+ * Generate code to throw a [NoSuchMethodError] exception for calling a
+ * method with a wrong number of arguments or mismatching named optional
+ * arguments.
+ */
+ void generateWrongArgumentCountError(Node diagnosticNode,
+ FunctionElement function,
+ Link<Node> argumentNodes) {
+ List<String> existingArguments = <String>[];
+ FunctionSignature signature = function.computeSignature(compiler);
+ signature.forEachParameter((Element parameter) {
+ existingArguments.add(parameter.name.slowToString());
+ });
+ generateThrowNoSuchMethod(diagnosticNode,
+ function.name.slowToString(),
+ argumentNodes: argumentNodes,
+ existingArguments: existingArguments);
}
visitNewExpression(NewExpression node) {
@@ -3104,7 +3204,7 @@
Constant constant = handler.compileNodeWithDefinitions(node, elements);
stack.add(graph.addConstant(constant));
} else {
- visitNewSend(node.send);
+ visitNewSend(node.send, elements.getType(node));
}
}
diff --git a/lib/compiler/implementation/ssa/codegen.dart b/lib/compiler/implementation/ssa/codegen.dart
index fdf877a..2bf0d51 100644
--- a/lib/compiler/implementation/ssa/codegen.dart
+++ b/lib/compiler/implementation/ssa/codegen.dart
@@ -86,7 +86,7 @@
parameterNames.forEach((element, name) {
parameters.add(new js.Parameter(name));
});
- addTypeParameters(work.element, parameters, parameterNames);
+ addBackendParameters(work.element, parameters, parameterNames);
String parametersString = Strings.join(parameterNames.values, ", ");
SsaOptimizedCodeGenerator codegen = new SsaOptimizedCodeGenerator(
backend, work, parameters, parameterNames);
@@ -117,23 +117,54 @@
});
}
- void addTypeParameters(Element element,
- List<js.Parameter> parameters,
- Map<Element, String> parameterNames) {
- if (!element.isConstructor()) return;
- ClassElement cls = element.enclosingElement;
- if (!compiler.world.needsRti(cls)) return;
- cls.typeVariables.forEach((TypeVariableType typeVariable) {
- String name = typeVariable.element.name.slowToString();
- String prefix = '';
- // Avoid collisions with real parameters of the method.
- do {
- name = JsNames.getValid('$prefix$name');
- prefix = '\$$prefix';
- } while (parameterNames.containsValue(name));
- parameterNames[typeVariable.element] = name;
- parameters.add(new js.Parameter(name));
- });
+ void addBackendParameter(Element element,
+ List<js.Parameter> parameters,
+ Map<Element, String> parameterNames) {
+ String name = element.name.slowToString();
+ String prefix = '';
+ // Avoid collisions with real parameters of the method.
+ do {
+ name = JsNames.getValid('$prefix$name');
+ prefix = '\$$prefix';
+ } while (parameterNames.containsValue(name));
+ parameterNames[element] = name;
+ parameters.add(new js.Parameter(name));
+ }
+
+ void addBackendParameters(Element element,
+ List<js.Parameter> parameters,
+ Map<Element, String> parameterNames) {
+ // TODO(ngeoffray): We should infer this information from the
+ // graph, instead of recomputing what the builder did.
+ if (element.isConstructor()) {
+ // Put the type parameters.
+ ClassElement cls = element.enclosingElement;
+ if (!compiler.world.needsRti(cls)) return;
+ cls.typeVariables.forEach((TypeVariableType typeVariable) {
+ addBackendParameter(typeVariable.element, parameters, parameterNames);
+ });
+ } else if (element.isGenerativeConstructorBody()) {
+ // Put the parameter checks parameters.
+ Node node = element.implementation.parseNode(compiler);
+ ClosureClassMap closureData =
+ compiler.closureToClassMapper.getMappingForNestedFunction(node);
+ FunctionElement functionElement = element;
+ FunctionSignature params = functionElement.computeSignature(compiler);
+ TreeElements elements =
+ compiler.enqueuer.resolution.getCachedElements(element);
+ params.orderedForEachParameter((Element element) {
+ if (elements.isParameterChecked(element)) {
+ Element checkResultElement =
+ closureData.parametersWithSentinel[element];
+ addBackendParameter(checkResultElement, parameters, parameterNames);
+ }
+ });
+ // Put the box parameter.
+ ClosureScope scopeData = closureData.capturingScopes[node];
+ if (scopeData != null) {
+ addBackendParameter(scopeData.boxElement, parameters, parameterNames);
+ }
+ }
}
CodeBuffer generateBailoutMethod(WorkItem work, HGraph graph) {
@@ -145,7 +176,7 @@
parameterNames.forEach((element, name) {
parameters.add(new js.Parameter(name));
});
- addTypeParameters(work.element, parameters, parameterNames);
+ addBackendParameters(work.element, parameters, parameterNames);
SsaUnoptimizedCodeGenerator codegen = new SsaUnoptimizedCodeGenerator(
backend, work, parameters, parameterNames);
@@ -896,7 +927,7 @@
jsCondition = generateExpression(condition);
currentContainer = body;
} else {
- jsCondition = new js.LiteralBool(true);
+ jsCondition = newLiteralBool(true);
currentContainer = body;
generateStatements(condition);
use(condition.conditionExpression);
@@ -1310,7 +1341,7 @@
visitBoolify(HBoolify node) {
assert(node.inputs.length == 1);
use(node.inputs[0]);
- push(new js.Binary('===', pop(), new js.LiteralBool(true)), node);
+ push(new js.Binary('===', pop(), newLiteralBool(true)), node);
}
visitExit(HExit node) {
@@ -1515,6 +1546,12 @@
Selector defaultSelector) {
// TODO(4434): For private members we need to use the untyped selector.
if (defaultSelector.name.isPrivate()) return defaultSelector;
+ // 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) {
+ return defaultSelector;
+ }
HType receiverHType = types[node.inputs[0]];
DartType receiverType = receiverHType.computeType(compiler);
if (receiverType != null) {
@@ -1635,7 +1672,9 @@
// involving only things with guaranteed number types and a given
// field.
bool isSimpleFieldNumberComputation(HInstruction value, HFieldSet node) {
- if (value.guaranteedType.union(HType.NUMBER) == HType.NUMBER) return true;
+ if (value.guaranteedType.union(HType.NUMBER, compiler) == HType.NUMBER) {
+ return true;
+ }
if (value is HBinaryArithmetic) {
return (isSimpleFieldNumberComputation(value.left, node) &&
isSimpleFieldNumberComputation(value.right, node));
@@ -1706,12 +1745,21 @@
push(new js.New(new js.VariableUse(jsClassReference), arguments), node);
}
+ js.Expression newLiteralBool(bool value) {
+ if (compiler.enableMinification) {
+ // Use !0 for true, !1 for false.
+ return new js.Prefix("!", new js.LiteralNumber(value ? "0" : "1"));
+ } else {
+ return new js.LiteralBool(value);
+ }
+ }
+
void generateConstant(Constant constant) {
Namer namer = backend.namer;
// TODO(floitsch): should we use the ConstantVisitor here?
if (!constant.isObject()) {
if (constant.isBool()) {
- push(new js.LiteralBool((constant as BoolConstant).value));
+ push(newLiteralBool(constant.value));
} else if (constant.isNum()) {
// TODO(floitsch): get rid of the code buffer.
CodeBuffer buffer = new CodeBuffer();
@@ -1810,7 +1858,7 @@
if (input is HBoolify && isGenerateAtUseSite(input)) {
use(input.inputs[0]);
- push(new js.Binary("!==", pop(), new js.LiteralBool(true)), input);
+ push(new js.Binary("!==", pop(), newLiteralBool(true)), input);
} else if (canGenerateOptimizedComparison(input) &&
isGenerateAtUseSite(input)) {
Map<String, String> inverseOperator = const <String, String>{
@@ -2307,9 +2355,11 @@
world.registerIsCheck(type);
Element element = type.element;
if (identical(element.kind, ElementKind.TYPE_VARIABLE)) {
- compiler.unimplemented("visitIs for type variables", instruction: node);
+ compiler.unimplemented("visitIs for type variables",
+ instruction: node.expression);
} else if (identical(element.kind, ElementKind.TYPEDEF)) {
- compiler.unimplemented("visitIs for typedefs", instruction: node);
+ compiler.unimplemented("visitIs for typedefs",
+ instruction: node.expression);
}
LibraryElement coreLibrary = compiler.coreLibrary;
ClassElement objectClass = compiler.objectClass;
@@ -2318,7 +2368,7 @@
if (identical(element, objectClass) || identical(element, compiler.dynamicClass)) {
// The constant folder also does this optimization, but we make
// it safe by assuming it may have not run.
- push(new js.LiteralBool(true), node);
+ push(newLiteralBool(true), node);
} else if (element == compiler.stringClass) {
checkString(input, '===');
attachLocationToLast(node);
@@ -2634,7 +2684,7 @@
js.Statement body = currentContainer;
currentContainer = oldContainerStack.removeLast();
body = unwrapStatement(body);
- js.While loop = new js.While(new js.LiteralBool(true), body);
+ js.While loop = new js.While(newLiteralBool(true), body);
HLoopInformation info = block.loopInformation;
attachLocationRange(loop,
@@ -2895,7 +2945,7 @@
js.Statement body = unwrapStatement(currentContainer);
currentContainer = oldContainerStack.removeLast();
- js.Statement result = new js.While(new js.LiteralBool(true), body);
+ js.Statement result = new js.While(newLiteralBool(true), body);
attachLocationRange(result,
info.loopBlockInformation.sourcePosition,
info.loopBlockInformation.endSourcePosition);
diff --git a/lib/compiler/implementation/ssa/nodes.dart b/lib/compiler/implementation/ssa/nodes.dart
index 78e8e74..5e416d1 100644
--- a/lib/compiler/implementation/ssa/nodes.dart
+++ b/lib/compiler/implementation/ssa/nodes.dart
@@ -899,7 +899,7 @@
* the incoming type is already set to integer, the likely type might still
* just return the number type.
*/
- HType computeLikelyType(HTypeMap types) => types[this];
+ HType computeLikelyType(HTypeMap types, Compiler compiler) => types[this];
/**
* Compute the type of the instruction by propagating the input types through
@@ -907,7 +907,9 @@
*
* By default just copy the guaranteed type.
*/
- HType computeTypeFromInputTypes(HTypeMap types) => guaranteedType;
+ HType computeTypeFromInputTypes(HTypeMap types, Compiler compiler) {
+ return guaranteedType;
+ }
/**
* Compute the desired type for the the given [input]. Aside from using
@@ -915,7 +917,9 @@
* the given [types] which, during the invocation of this method,
* represents the desired type of [this].
*/
- HType computeDesiredTypeForInput(HInstruction input, HTypeMap types) {
+ HType computeDesiredTypeForInput(HInstruction input,
+ HTypeMap types,
+ Compiler compiler) {
return HType.UNKNOWN;
}
@@ -1209,7 +1213,7 @@
HBailoutTarget get bailoutTarget => inputs[1];
int get state => bailoutTarget.state;
- HType computeTypeFromInputTypes(HTypeMap types) {
+ HType computeTypeFromInputTypes(HTypeMap types, Compiler compiler) {
return isEnabled ? guardedType : types[guarded];
}
@@ -1261,12 +1265,14 @@
HType get guaranteedType => HType.INTEGER;
- HType computeDesiredTypeForInput(HInstruction input, HTypeMap types) {
+ HType computeDesiredTypeForInput(HInstruction input,
+ HTypeMap types,
+ Compiler compiler) {
// If the desired type of the input is already a number, we want
// to specialize it to an integer.
return input.isNumber(types)
? HType.INTEGER
- : super.computeDesiredTypeForInput(input, types);
+ : super.computeDesiredTypeForInput(input, types, compiler);
}
accept(HVisitor visitor) => visitor.visitIntegerCheck(this);
@@ -1394,14 +1400,17 @@
Element get element => target.element;
HStatic get target => inputs[0];
- HType computeDesiredTypeForInput(HInstruction input, HTypeMap types) {
+ HType computeDesiredTypeForInput(HInstruction input,
+ HTypeMap types,
+ Compiler compiler) {
// TODO(floitsch): we want the target to be a function.
if (input == target) return HType.UNKNOWN;
- return computeDesiredTypeForNonTargetInput(input, types);
+ return computeDesiredTypeForNonTargetInput(input, types, compiler);
}
HType computeDesiredTypeForNonTargetInput(HInstruction input,
- HTypeMap types) {
+ HTypeMap types,
+ Compiler compiler) {
return HType.UNKNOWN;
}
}
@@ -1447,19 +1456,20 @@
return isLengthGetter() && inputs[1].isIndexablePrimitive(types);
}
- HType computeLikelyType(HTypeMap types) {
+ HType computeLikelyType(HTypeMap types, Compiler compiler) {
// In general a length getter or method returns an int.
if (isLengthGetter()) return HType.INTEGER;
return HType.UNKNOWN;
}
- HType computeTypeFromInputTypes(HTypeMap types) {
+ HType computeTypeFromInputTypes(HTypeMap types, Compiler compiler) {
if (isLengthGetterOnStringOrArray(types)) return HType.INTEGER;
return HType.UNKNOWN;
}
HType computeDesiredTypeForNonTargetInput(HInstruction input,
- HTypeMap types) {
+ HTypeMap types,
+ Compiler compiler) {
// If the first argument is a string or an array and we invoke methods
// on it that mutate it, then we want to restrict the incoming type to be
// a mutable array.
@@ -1639,7 +1649,7 @@
bool isBuiltin(HTypeMap types)
=> left.isNumber(types) && right.isNumber(types);
- HType computeTypeFromInputTypes(HTypeMap types) {
+ HType computeTypeFromInputTypes(HTypeMap types, Compiler compiler) {
if (left.isInteger(types) && right.isInteger(types)) return HType.INTEGER;
if (left.isNumber(types)) {
if (left.isDouble(types) || right.isDouble(types)) return HType.DOUBLE;
@@ -1649,7 +1659,8 @@
}
HType computeDesiredTypeForNonTargetInput(HInstruction input,
- HTypeMap types) {
+ HTypeMap types,
+ Compiler compiler) {
HType propagatedType = types[this];
// If the desired output type should be an integer we want to get two
// integers as arguments.
@@ -1671,7 +1682,7 @@
return HType.UNKNOWN;
}
- HType computeLikelyType(HTypeMap types) {
+ HType computeLikelyType(HTypeMap types, Compiler compiler) {
if (left.isTypeUnknown(types)) return HType.NUMBER;
return HType.UNKNOWN;
}
@@ -1696,16 +1707,17 @@
: super(target, left, right);
accept(HVisitor visitor) => visitor.visitDivide(this);
- HType computeTypeFromInputTypes(HTypeMap types) {
+ HType computeTypeFromInputTypes(HTypeMap types, Compiler compiler) {
if (left.isNumber(types)) return HType.DOUBLE;
return HType.UNKNOWN;
}
HType computeDesiredTypeForNonTargetInput(HInstruction input,
- HTypeMap types) {
+ HTypeMap types,
+ Compiler compiler) {
// A division can never return an integer. So don't ask for integer inputs.
if (isInteger(types)) return HType.UNKNOWN;
- return super.computeDesiredTypeForNonTargetInput(input, types);
+ return super.computeDesiredTypeForNonTargetInput(input, types, compiler);
}
BinaryOperation operation(ConstantSystem constantSystem)
@@ -1793,7 +1805,7 @@
HBinaryBitOp(HStatic target, HInstruction left, HInstruction right)
: super(target, left, right);
- HType computeTypeFromInputTypes(HTypeMap types) {
+ HType computeTypeFromInputTypes(HTypeMap types, Compiler compiler) {
// All bitwise operations on primitive types either produce an
// integer or throw an error.
if (left.isPrimitive(types)) return HType.INTEGER;
@@ -1801,7 +1813,8 @@
}
HType computeDesiredTypeForNonTargetInput(HInstruction input,
- HTypeMap types) {
+ HTypeMap types,
+ Compiler compiler) {
HType propagatedType = types[this];
// If the outgoing type should be a number we can get that only if both
// inputs are integers. If we don't know the outgoing type we try to make
@@ -1812,7 +1825,7 @@
return HType.UNKNOWN;
}
- HType computeLikelyType(HTypeMap types) {
+ HType computeLikelyType(HTypeMap types, Compiler compiler) {
if (left.isTypeUnknown(types)) return HType.INTEGER;
return HType.UNKNOWN;
}
@@ -1914,14 +1927,15 @@
bool isBuiltin(HTypeMap types) => operand.isNumber(types);
- HType computeTypeFromInputTypes(HTypeMap types) {
+ HType computeTypeFromInputTypes(HTypeMap types, Compiler compiler) {
HType operandType = types[operand];
if (operandType.isNumber()) return operandType;
return HType.UNKNOWN;
}
HType computeDesiredTypeForNonTargetInput(HInstruction input,
- HTypeMap types) {
+ HTypeMap types,
+ Compiler compiler) {
HType propagatedType = types[this];
// If the outgoing type should be a number (integer, double or both) we
// want the outgoing type to be the input too.
@@ -1931,7 +1945,7 @@
return HType.UNKNOWN;
}
- HType computeLikelyType(HTypeMap types) => HType.NUMBER;
+ HType computeLikelyType(HTypeMap types, Compiler compiler) => HType.NUMBER;
abstract UnaryOperation operation(ConstantSystem constantSystem);
}
@@ -1951,7 +1965,7 @@
HBitNot(HStatic target, HInstruction input) : super(target, input);
accept(HVisitor visitor) => visitor.visitBitNot(this);
- HType computeTypeFromInputTypes(HTypeMap types) {
+ HType computeTypeFromInputTypes(HTypeMap types, Compiler compiler) {
// All bitwise operations on primitive types either produce an
// integer or throw an error.
if (operand.isPrimitive(types)) return HType.INTEGER;
@@ -1959,7 +1973,8 @@
}
HType computeDesiredTypeForNonTargetInput(HInstruction input,
- HTypeMap types) {
+ HTypeMap types,
+ Compiler compiler) {
HType propagatedType = types[this];
// Bit operations only work on integers. If there is no desired output
// type or if it as a number we want to get an integer as input.
@@ -2095,7 +2110,9 @@
HType get guaranteedType => HType.BOOLEAN;
// 'Not' only works on booleans. That's what we want as input.
- HType computeDesiredTypeForInput(HInstruction input, HTypeMap types) {
+ HType computeDesiredTypeForInput(HInstruction input,
+ HTypeMap types,
+ Compiler compiler) {
return HType.BOOLEAN;
}
@@ -2167,7 +2184,9 @@
// have the same known type return it. If any two inputs have
// different known types, we'll return a conflict -- otherwise we'll
// simply return an unknown type.
- HType computeInputsType(bool ignoreUnknowns, HTypeMap types) {
+ HType computeInputsType(bool ignoreUnknowns,
+ HTypeMap types,
+ Compiler compiler) {
HType candidateType = HType.CONFLICTING;
for (int i = 0, length = inputs.length; i < length; i++) {
HType inputType = types[inputs[i]];
@@ -2176,24 +2195,26 @@
// For example, if one incoming edge has type integer and the other has
// type double, then the phi is either an integer or double and thus has
// type number.
- candidateType = candidateType.union(inputType);
+ candidateType = candidateType.union(inputType, compiler);
if (candidateType.isUnknown()) return HType.UNKNOWN;
}
return candidateType;
}
- HType computeTypeFromInputTypes(HTypeMap types) {
- HType inputsType = computeInputsType(false, types);
+ HType computeTypeFromInputTypes(HTypeMap types, Compiler compiler) {
+ HType inputsType = computeInputsType(false, types, compiler);
if (inputsType.isConflicting()) return HType.UNKNOWN;
return inputsType;
}
- HType computeDesiredTypeForInput(HInstruction input, HTypeMap types) {
+ HType computeDesiredTypeForInput(HInstruction input,
+ HTypeMap types,
+ Compiler compiler) {
HType propagatedType = types[this];
// Best case scenario for a phi is, when all inputs have the same type. If
// there is no desired outgoing type we therefore try to unify the input
// types (which is basically the [likelyType]).
- if (propagatedType.isUnknown()) return computeLikelyType(types);
+ if (propagatedType.isUnknown()) return computeLikelyType(types, compiler);
// When the desired outgoing type is conflicting we don't need to give any
// requirements on the inputs.
if (propagatedType.isConflicting()) return HType.UNKNOWN;
@@ -2201,8 +2222,8 @@
return propagatedType;
}
- HType computeLikelyType(HTypeMap types) {
- HType agreedType = computeInputsType(true, types);
+ HType computeLikelyType(HTypeMap types, Compiler compiler) {
+ HType agreedType = computeInputsType(true, types, compiler);
if (agreedType.isConflicting()) return HType.UNKNOWN;
// Don't be too restrictive. If the agreed type is integer or double just
// say that the likely type is number. If more is expected the type will be
@@ -2241,7 +2262,7 @@
}
}
- HType computeTypeFromInputTypes(HTypeMap types) {
+ HType computeTypeFromInputTypes(HTypeMap types, Compiler compiler) {
if (left.isNumber(types) || usesBoolifiedInterceptor) return HType.BOOLEAN;
return HType.UNKNOWN;
}
@@ -2252,7 +2273,8 @@
}
HType computeDesiredTypeForNonTargetInput(HInstruction input,
- HTypeMap types) {
+ HTypeMap types,
+ Compiler compiler) {
HType propagatedType = types[this];
// For all relational operations exept HEquals, we expect to get numbers
// only. With numbers the outgoing type is a boolean. If something else
@@ -2265,7 +2287,7 @@
return HType.UNKNOWN;
}
- HType computeLikelyType(HTypeMap types) => HType.BOOLEAN;
+ HType computeLikelyType(HTypeMap types, Compiler compiler) => HType.BOOLEAN;
bool isBuiltin(HTypeMap types)
=> left.isNumber(types) && right.isNumber(types);
@@ -2285,13 +2307,14 @@
return types[left].isPrimitiveOrNull() || right.isConstantNull();
}
- HType computeTypeFromInputTypes(HTypeMap types) {
+ HType computeTypeFromInputTypes(HTypeMap types, Compiler compiler) {
if (isBuiltin(types) || usesBoolifiedInterceptor) return HType.BOOLEAN;
return HType.UNKNOWN;
}
HType computeDesiredTypeForNonTargetInput(HInstruction input,
- HTypeMap types) {
+ HTypeMap types,
+ Compiler compiler) {
HType propagatedType = types[this];
if (input == left && types[right].isUseful()) {
// All our useful types have === semantics. But we don't want to
@@ -2332,11 +2355,14 @@
bool isBuiltin(HTypeMap types) => true;
HType get guaranteedType => HType.BOOLEAN;
- HType computeTypeFromInputTypes(HTypeMap types)
+ HType computeTypeFromInputTypes(HTypeMap types, Compiler compiler)
=> HType.BOOLEAN;
// Note that the identity operator really does not care for its input types.
- HType computeDesiredTypeForInput(HInstruction input, HTypeMap types)
- => HType.UNKNOWN;
+ HType computeDesiredTypeForInput(HInstruction input,
+ HTypeMap types,
+ Compiler compiler) {
+ return HType.UNKNOWN;
+ }
BinaryOperation operation(ConstantSystem constantSystem)
=> constantSystem.identity;
@@ -2497,7 +2523,8 @@
HInstruction get index => inputs[2];
HType computeDesiredTypeForNonTargetInput(HInstruction input,
- HTypeMap types) {
+ HTypeMap types,
+ Compiler compiler) {
if (input == receiver &&
(index.isTypeUnknown(types) || index.isNumber(types))) {
return HType.INDEXABLE_PRIMITIVE;
@@ -2543,7 +2570,8 @@
// is never used as input.
HType computeDesiredTypeForNonTargetInput(HInstruction input,
- HTypeMap types) {
+ HTypeMap types,
+ Compiler compiler) {
if (input == receiver &&
(index.isTypeUnknown(types) || index.isNumber(types))) {
return HType.MUTABLE_ARRAY;
diff --git a/lib/compiler/implementation/ssa/optimize.dart b/lib/compiler/implementation/ssa/optimize.dart
index 5e2685c..30da6c5 100644
--- a/lib/compiler/implementation/ssa/optimize.dart
+++ b/lib/compiler/implementation/ssa/optimize.dart
@@ -399,7 +399,7 @@
// We don't optimize on numbers to preserve the runtime semantics.
if (!(left.isNumber(types) && right.isNumber(types)) &&
- leftType.intersection(rightType).isConflicting()) {
+ leftType.intersection(rightType, compiler).isConflicting()) {
return graph.addConstantBool(false, constantSystem);
}
@@ -489,7 +489,7 @@
// If the intersection of the types is still the incoming type then
// the incoming type was a subtype of the guarded type, and no check
// is required.
- HType combinedType = types[value].intersection(node.guardedType);
+ HType combinedType = types[value].intersection(node.guardedType, compiler);
return (combinedType == types[value]) ? value : node;
}
@@ -576,7 +576,7 @@
if (types[value].canBeNull() && node.isBooleanConversionCheck) {
return node;
}
- HType combinedType = types[value].intersection(types[node]);
+ HType combinedType = types[value].intersection(types[node], compiler);
return (combinedType == types[value]) ? value : node;
}
@@ -616,7 +616,7 @@
HInstruction visitInvokeDynamicSetter(HInvokeDynamicSetter node) {
Element field =
findConcreteFieldForDynamicAccess(node.receiver, node.selector);
- if (field == null) return node;
+ if (field == null || !field.isAssignable()) return node;
HInstruction value = node.inputs[1];
if (compiler.enableTypeAssertions) {
HInstruction other = value.convertType(
@@ -890,9 +890,13 @@
if (block.isLoopHeader()) {
int changesFlags = loopChangesFlags[block.id];
HLoopInformation info = block.loopInformation;
- HBasicBlock last = info.getLastBackEdge();
- for (int j = block.id; j <= last.id; j++) {
- moveLoopInvariantCodeFromBlock(graph.blocks[j], block, changesFlags);
+ // Iterate over all blocks of this loop. Note that blocks in
+ // inner loops are not visited here, but we know they
+ // were visited before because we are iterating in post-order.
+ // So instructions that are GVN'ed in an inner loop are in their
+ // loop entry, and [info.blocks] contains this loop entry.
+ for (HBasicBlock other in info.blocks) {
+ moveLoopInvariantCodeFromBlock(other, block, changesFlags);
}
}
}
@@ -901,6 +905,7 @@
void moveLoopInvariantCodeFromBlock(HBasicBlock block,
HBasicBlock loopHeader,
int changesFlags) {
+ assert(block.parentLoopHeader == loopHeader);
HBasicBlock preheader = loopHeader.predecessors[0];
int dependsFlags = HInstruction.computeDependsOnFlags(changesFlags);
HInstruction instruction = block.first;
@@ -1256,7 +1261,8 @@
predecessorsFieldSetters.forEach((Element element, HType type) {
HType currentType = currentFieldSetters[element];
if (currentType != null) {
- newFieldSetters[element] = currentType.union(type);
+ newFieldSetters[element] =
+ currentType.union(type, backend.compiler);
}
});
currentFieldSetters = newFieldSetters;
diff --git a/lib/compiler/implementation/ssa/types.dart b/lib/compiler/implementation/ssa/types.dart
index b8277bf..da534d583 100644
--- a/lib/compiler/implementation/ssa/types.dart
+++ b/lib/compiler/implementation/ssa/types.dart
@@ -109,7 +109,7 @@
* An intersection with [UNKNOWN] returns the non-UNKNOWN type. An
* intersection with [CONFLICTING] returns [CONFLICTING].
*/
- abstract HType intersection(HType other);
+ abstract HType intersection(HType other, Compiler compiler);
/**
* The union of two types is the union of its values. For example:
@@ -123,7 +123,7 @@
* A union with [UNKNOWN] returns [UNKNOWN].
* A union of [CONFLICTING] with any other types returns the other type.
*/
- abstract HType union(HType other);
+ abstract HType union(HType other, Compiler compiler);
}
/** Used to represent [HType.UNKNOWN] and [HType.CONFLICTING]. */
@@ -140,8 +140,8 @@
bool canBePrimitive() => true;
bool canBeNull() => true;
- HType union(HType other) => this;
- HType intersection(HType other) => other;
+ HType union(HType other, Compiler compiler) => this;
+ HType intersection(HType other, Compiler compiler) => other;
}
class HConflictingType extends HAnalysisType {
@@ -149,8 +149,8 @@
bool canBePrimitive() => true;
bool canBeNull() => true;
- HType union(HType other) => other;
- HType intersection(HType other) => this;
+ HType union(HType other, Compiler compiler) => other;
+ HType intersection(HType other, Compiler compiler) => this;
}
abstract class HPrimitiveType extends HType {
@@ -168,7 +168,7 @@
DartType computeType(Compiler compiler) => null;
- HType union(HType other) {
+ HType union(HType other, Compiler compiler) {
if (other.isConflicting()) return HType.NULL;
if (other.isUnknown()) return HType.UNKNOWN;
if (other.isString()) return HType.STRING_OR_NULL;
@@ -180,7 +180,7 @@
return other;
}
- HType intersection(HType other) {
+ HType intersection(HType other, Compiler compiler) {
if (other.isUnknown()) return HType.NULL;
if (other.isConflicting()) return HType.CONFLICTING;
if (!other.canBeNull()) return HType.CONFLICTING;
@@ -204,7 +204,7 @@
return compiler.boolClass.computeType(compiler);
}
- HType union(HType other) {
+ HType union(HType other, Compiler compiler) {
if (other.isConflicting()) return HType.BOOLEAN_OR_NULL;
if (other.isUnknown()) return HType.UNKNOWN;
if (other.isBooleanOrNull()) return HType.BOOLEAN_OR_NULL;
@@ -213,7 +213,7 @@
return HType.UNKNOWN;
}
- HType intersection(HType other) {
+ HType intersection(HType other, Compiler compiler) {
if (other.isConflicting()) return HType.CONFLICTING;
if (other.isUnknown()) return HType.BOOLEAN_OR_NULL;
if (other.isBooleanOrNull()) return HType.BOOLEAN_OR_NULL;
@@ -232,7 +232,7 @@
return compiler.boolClass.computeType(compiler);
}
- HType union(HType other) {
+ HType union(HType other, Compiler compiler) {
if (other.isConflicting()) return HType.BOOLEAN;
if (other.isUnknown()) return HType.UNKNOWN;
if (other.isBoolean()) return HType.BOOLEAN;
@@ -241,7 +241,7 @@
return HType.UNKNOWN;
}
- HType intersection(HType other) {
+ HType intersection(HType other, Compiler compiler) {
if (other.isConflicting()) return HType.CONFLICTING;
if (other.isUnknown()) return HType.BOOLEAN;
if (other.isBooleanOrNull()) return HType.BOOLEAN;
@@ -259,7 +259,7 @@
return compiler.numClass.computeType(compiler);
}
- HType union(HType other) {
+ HType union(HType other, Compiler compiler) {
if (other.isConflicting()) return HType.NUMBER_OR_NULL;
if (other.isUnknown()) return HType.UNKNOWN;
if (other.isNumberOrNull()) return HType.NUMBER_OR_NULL;
@@ -268,7 +268,7 @@
return HType.UNKNOWN;
}
- HType intersection(HType other) {
+ HType intersection(HType other, Compiler compiler) {
if (other.isConflicting()) return HType.CONFLICTING;
if (other.isUnknown()) return HType.NUMBER_OR_NULL;
if (other.isInteger()) return HType.INTEGER;
@@ -291,7 +291,7 @@
return compiler.numClass.computeType(compiler);
}
- HType union(HType other) {
+ HType union(HType other, Compiler compiler) {
if (other.isConflicting()) return HType.NUMBER;
if (other.isUnknown()) return HType.UNKNOWN;
if (other.isNumber()) return HType.NUMBER;
@@ -300,7 +300,7 @@
return HType.UNKNOWN;
}
- HType intersection(HType other) {
+ HType intersection(HType other, Compiler compiler) {
if (other.isConflicting()) return HType.CONFLICTING;
if (other.isUnknown()) return HType.NUMBER;
if (other.isNumber()) return other;
@@ -320,7 +320,7 @@
return compiler.intClass.computeType(compiler);
}
- HType union(HType other) {
+ HType union(HType other, Compiler compiler) {
if (other.isConflicting()) return HType.INTEGER_OR_NULL;
if (other.isUnknown()) return HType.UNKNOWN;
if (other.isIntegerOrNull()) return HType.INTEGER_OR_NULL;
@@ -331,7 +331,7 @@
return HType.UNKNOWN;
}
- HType intersection(HType other) {
+ HType intersection(HType other, Compiler compiler) {
if (other.isConflicting()) return HType.CONFLICTING;
if (other.isUnknown()) return HType.INTEGER_OR_NULL;
if (other.isIntegerOrNull()) return HType.INTEGER_OR_NULL;
@@ -354,7 +354,7 @@
return compiler.intClass.computeType(compiler);
}
- HType union(HType other) {
+ HType union(HType other, Compiler compiler) {
if (other.isConflicting()) return HType.INTEGER;
if (other.isUnknown()) return HType.UNKNOWN;
if (other.isInteger()) return HType.INTEGER;
@@ -365,7 +365,7 @@
return HType.UNKNOWN;
}
- HType intersection(HType other) {
+ HType intersection(HType other, Compiler compiler) {
if (other.isConflicting()) return HType.CONFLICTING;
if (other.isUnknown()) return HType.INTEGER;
if (other.isIntegerOrNull()) return HType.INTEGER;
@@ -387,7 +387,7 @@
return compiler.doubleClass.computeType(compiler);
}
- HType union(HType other) {
+ HType union(HType other, Compiler compiler) {
if (other.isConflicting()) return HType.DOUBLE_OR_NULL;
if (other.isUnknown()) return HType.UNKNOWN;
if (other.isDoubleOrNull()) return HType.DOUBLE_OR_NULL;
@@ -398,7 +398,7 @@
return HType.UNKNOWN;
}
- HType intersection(HType other) {
+ HType intersection(HType other, Compiler compiler) {
if (other.isConflicting()) return HType.CONFLICTING;
if (other.isUnknown()) return HType.DOUBLE_OR_NULL;
if (other.isIntegerOrNull()) return HType.NULL;
@@ -421,7 +421,7 @@
return compiler.doubleClass.computeType(compiler);
}
- HType union(HType other) {
+ HType union(HType other, Compiler compiler) {
if (other.isConflicting()) return HType.DOUBLE;
if (other.isUnknown()) return HType.UNKNOWN;
if (other.isDouble()) return HType.DOUBLE;
@@ -432,7 +432,7 @@
return HType.UNKNOWN;
}
- HType intersection(HType other) {
+ HType intersection(HType other, Compiler compiler) {
if (other.isConflicting()) return HType.CONFLICTING;
if (other.isUnknown()) return HType.DOUBLE;
if (other.isIntegerOrNull()) return HType.CONFLICTING;
@@ -455,7 +455,7 @@
return null;
}
- HType union(HType other) {
+ HType union(HType other, Compiler compiler) {
if (other.isConflicting()) return HType.INDEXABLE_PRIMITIVE;
if (other.isUnknown()) return HType.UNKNOWN;
if (other.isIndexablePrimitive()) return HType.INDEXABLE_PRIMITIVE;
@@ -470,7 +470,7 @@
return HType.UNKNOWN;
}
- HType intersection(HType other) {
+ HType intersection(HType other, Compiler compiler) {
if (other.isConflicting()) return HType.CONFLICTING;
if (other.isUnknown()) return HType.INDEXABLE_PRIMITIVE;
if (other.isIndexablePrimitive()) return other;
@@ -489,7 +489,7 @@
return compiler.stringClass.computeType(compiler);
}
- HType union(HType other) {
+ HType union(HType other, Compiler compiler) {
if (other.isConflicting()) return HType.STRING_OR_NULL;
if (other.isUnknown()) return HType.UNKNOWN;
if (other.isString()) return HType.STRING_OR_NULL;
@@ -511,7 +511,7 @@
return HType.UNKNOWN;
}
- HType intersection(HType other) {
+ HType intersection(HType other, Compiler compiler) {
if (other.isConflicting()) return HType.CONFLICTING;
if (other.isUnknown()) return HType.STRING_OR_NULL;
if (other.isString()) return HType.STRING;
@@ -535,7 +535,7 @@
return compiler.stringClass.computeType(compiler);
}
- HType union(HType other) {
+ HType union(HType other, Compiler compiler) {
if (other.isConflicting()) return HType.STRING;
if (other.isUnknown()) return HType.UNKNOWN;
if (other.isString()) return HType.STRING;
@@ -546,7 +546,7 @@
return HType.UNKNOWN;
}
- HType intersection(HType other) {
+ HType intersection(HType other, Compiler compiler) {
if (other.isConflicting()) return HType.CONFLICTING;
if (other.isUnknown()) return HType.STRING;
if (other.isString()) return HType.STRING;
@@ -567,7 +567,7 @@
return compiler.listClass.computeType(compiler);
}
- HType union(HType other) {
+ HType union(HType other, Compiler compiler) {
if (other.isConflicting()) return HType.READABLE_ARRAY;
if (other.isUnknown()) return HType.UNKNOWN;
if (other.isReadableArray()) return HType.READABLE_ARRAY;
@@ -576,7 +576,7 @@
return HType.UNKNOWN;
}
- HType intersection(HType other) {
+ HType intersection(HType other, Compiler compiler) {
if (other.isConflicting()) return HType.CONFLICTING;
if (other.isUnknown()) return HType.READABLE_ARRAY;
if (other.isString()) return HType.CONFLICTING;
@@ -592,7 +592,7 @@
bool isMutableArray() => true;
String toString() => "mutable array";
- HType union(HType other) {
+ HType union(HType other, Compiler compiler) {
if (other.isConflicting()) return HType.MUTABLE_ARRAY;
if (other.isUnknown()) return HType.UNKNOWN;
if (other.isMutableArray()) return HType.MUTABLE_ARRAY;
@@ -602,7 +602,7 @@
return HType.UNKNOWN;
}
- HType intersection(HType other) {
+ HType intersection(HType other, Compiler compiler) {
if (other.isConflicting()) return HType.CONFLICTING;
if (other.isUnknown()) return HType.MUTABLE_ARRAY;
if (other.isMutableArray()) return other;
@@ -618,7 +618,7 @@
bool isFixedArray() => true;
String toString() => "fixed array";
- HType union(HType other) {
+ HType union(HType other, Compiler compiler) {
if (other.isConflicting()) return HType.FIXED_ARRAY;
if (other.isUnknown()) return HType.UNKNOWN;
if (other.isFixedArray()) return HType.FIXED_ARRAY;
@@ -629,7 +629,7 @@
return HType.UNKNOWN;
}
- HType intersection(HType other) {
+ HType intersection(HType other, Compiler compiler) {
if (other.isConflicting()) return HType.CONFLICTING;
if (other.isUnknown()) return HType.FIXED_ARRAY;
if (other.isFixedArray()) return HType.FIXED_ARRAY;
@@ -646,7 +646,7 @@
bool isExtendableArray() => true;
String toString() => "extendable array";
- HType union(HType other) {
+ HType union(HType other, Compiler compiler) {
if (other.isConflicting()) return HType.EXTENDABLE_ARRAY;
if (other.isUnknown()) return HType.UNKNOWN;
if (other.isExtendableArray()) return HType.EXTENDABLE_ARRAY;
@@ -657,7 +657,7 @@
return HType.UNKNOWN;
}
- HType intersection(HType other) {
+ HType intersection(HType other, Compiler compiler) {
if (other.isConflicting()) return HType.CONFLICTING;
if (other.isUnknown()) return HType.EXTENDABLE_ARRAY;
if (other.isExtendableArray()) return HType.EXTENDABLE_ARRAY;
@@ -697,13 +697,17 @@
return classElement.lookupMember(name);
}
- HType intersection(HType other) {
+ HType intersection(HType other, Compiler compiler) {
assert(!(isExact() && canBeNull()));
if (other.isConflicting()) return HType.CONFLICTING;
if (other.isNull()) return canBeNull() ? HType.NULL : HType.CONFLICTING;
+
if (other is HBoundedType) {
HBoundedType temp = other;
if (identical(this.type, temp.type)) {
+ // If the types are the same, we return the [HBoundedType]
+ // that has the most restrictive representation: if it's exact
+ // (eg cannot be a subtype), and if it cannot be null.
if (isExact()) {
return this;
} else if (other.isExact()) {
@@ -713,6 +717,12 @@
} else {
return this;
}
+ // If one type is a subtype of the other, we return the former,
+ // which is the narrower type.
+ } else if (compiler.types.isSubtype(type, other.type)) {
+ return this;
+ } else if (compiler.types.isSubtype(other.type, type)) {
+ return other;
}
}
if (other.isUnknown()) return this;
@@ -723,11 +733,12 @@
bool operator ==(HType other) {
if (other is !HBoundedType) return false;
HBoundedType bounded = other;
- return (identical(type, bounded.type) && identical(canBeNull(), bounded.canBeNull())
- && identical(isExact(), other .isExact()));
+ return (identical(type, bounded.type)
+ && identical(canBeNull(), bounded.canBeNull())
+ && identical(isExact(), other.isExact()));
}
- HType union(HType other) {
+ HType union(HType other, Compiler compiler) {
if (other.isNull()) {
if (canBeNull()) {
return this;
@@ -758,7 +769,7 @@
const HBoundedPotentialPrimitiveNumberOrString(DartType type, bool canBeNull)
: super(type, canBeNull);
- HType union(HType other) {
+ HType union(HType other, Compiler compiler) {
if (other.isNumber()) return this;
if (other.isNumberOrNull()) {
if (canBeNull()) return this;
@@ -776,10 +787,10 @@
return new HBoundedPotentialPrimitiveNumberOrString(type, true);
}
- return super.union(other);
+ return super.union(other, compiler);
}
- HType intersection(HType other) {
+ HType intersection(HType other, Compiler compiler) {
if (other.isNumber()) return other;
if (other.isNumberOrNull()) {
if (!canBeNull()) return HType.NUMBER;
@@ -790,7 +801,7 @@
if (!canBeNull()) return HType.STRING;
return other;
}
- return super.intersection(other);
+ return super.intersection(other, compiler);
}
}
@@ -798,7 +809,7 @@
const HBoundedPotentialPrimitiveArray(DartType type, bool canBeNull)
: super(type, canBeNull);
- HType union(HType other) {
+ HType union(HType other, Compiler compiler) {
if (other.isString()) return HType.UNKNOWN;
if (other.isReadableArray()) return this;
// TODO(ngeoffray): implement union types.
@@ -810,15 +821,15 @@
return new HBoundedPotentialPrimitiveArray(type, true);
}
}
- return super.union(other);
+ return super.union(other, compiler);
}
- HType intersection(HType other) {
+ HType intersection(HType other, Compiler compiler) {
if (other.isConflicting()) return HType.CONFLICTING;
if (other.isString()) return HType.CONFLICTING;
if (other.isReadableArray()) return other;
if (other.isIndexablePrimitive()) return HType.READABLE_ARRAY;
- return super.intersection(other);
+ return super.intersection(other, compiler);
}
}
@@ -828,7 +839,7 @@
bool isPrimitiveOrNull() => true;
- HType union(HType other) {
+ HType union(HType other, Compiler compiler) {
if (other.isString()) return this;
if (other.isStringOrNull()) {
if (canBeNull()) {
@@ -846,10 +857,10 @@
}
// TODO(ngeoffray): implement union types.
if (other.isIndexablePrimitive()) return HType.UNKNOWN;
- return super.union(other);
+ return super.union(other, compiler);
}
- HType intersection(HType other) {
+ HType intersection(HType other, Compiler compiler) {
if (other.isConflicting()) return HType.CONFLICTING;
if (other.isString()) return HType.STRING;
if (other.isStringOrNull()) {
@@ -857,7 +868,7 @@
}
if (other.isReadableArray()) return HType.CONFLICTING;
if (other.isIndexablePrimitive()) return HType.STRING;
- return super.intersection(other);
+ return super.intersection(other, compiler);
}
}
diff --git a/lib/compiler/implementation/ssa/types_propagation.dart b/lib/compiler/implementation/ssa/types_propagation.dart
index e4809c87..b64d2f1 100644
--- a/lib/compiler/implementation/ssa/types_propagation.dart
+++ b/lib/compiler/implementation/ssa/types_propagation.dart
@@ -21,7 +21,7 @@
HType computeType(HInstruction instruction) {
if (instruction.hasGuaranteedType()) return instruction.guaranteedType;
- return instruction.computeTypeFromInputTypes(types);
+ return instruction.computeTypeFromInputTypes(types, compiler);
}
// Re-compute and update the type of the instruction. Returns
@@ -172,7 +172,7 @@
HType desiredType = HType.UNKNOWN;
for (final user in instruction.usedBy) {
HType userType =
- user.computeDesiredTypeForInput(instruction, types);
+ user.computeDesiredTypeForInput(instruction, types, compiler);
// Mainly due to the "if (true)" added by hackAroundPossiblyAbortingBody
// in builder.dart uninitialized variables will propagate a type of null
// which will result in a conflicting type when combined with a primitive
@@ -180,7 +180,7 @@
// TODO(sgjesse): Reconcider this when hackAroundPossiblyAbortingBody
// has been removed.
if (desiredType.isPrimitive() && userType == HType.NULL) continue;
- desiredType = desiredType.intersection(userType);
+ desiredType = desiredType.intersection(userType, compiler);
// No need to continue if two users disagree on the type.
if (desiredType.isConflicting()) break;
}
@@ -203,7 +203,7 @@
// TODO(ngeoffray): Allow speculative optimizations on
// non-primitive types?
if (!desiredType.isPrimitive()) return newType;
- return newType.intersection(desiredType);
+ return newType.intersection(desiredType, compiler);
}
// Do not use speculative argument type optimization for now.
diff --git a/lib/compiler/implementation/ssa/value_range_analyzer.dart b/lib/compiler/implementation/ssa/value_range_analyzer.dart
index 79970b7..6439c96 100644
--- a/lib/compiler/implementation/ssa/value_range_analyzer.dart
+++ b/lib/compiler/implementation/ssa/value_range_analyzer.dart
@@ -4,18 +4,68 @@
part of ssa;
+
+class ValueRangeInfo {
+ final ConstantSystem constantSystem;
+
+ IntValue intZero;
+ IntValue intOne;
+
+ ValueRangeInfo(this.constantSystem) {
+ intZero = newIntValue(0);
+ intOne = newIntValue(1);
+ }
+
+ Value newIntValue(int value) {
+ return new IntValue(value, this);
+ }
+
+ Value newInstructionValue(HInstruction instruction) {
+ return new InstructionValue(instruction, this);
+ }
+
+ Value newLengthValue(HInstruction instruction) {
+ return new LengthValue(instruction, this);
+ }
+
+ Value newAddValue(Value left, Value right) {
+ return new AddValue(left, right, this);
+ }
+
+ Value newSubtractValue(Value left, Value right) {
+ return new SubtractValue(left, right, this);
+ }
+
+ Value newNegateValue(Value value) {
+ return new NegateValue(value, this);
+ }
+
+ Range newRange(Value low, Value up) {
+ return new Range(low, up, this);
+ }
+
+ Range newUnboundRange() {
+ return new Range.unbound(this);
+ }
+
+ Range newNormalizedRange(Value low, Value up) {
+ return new Range.normalize(low, up, this);
+ }
+}
+
/**
* A [Value] represents both symbolic values like the value of a
* parameter, or the length of an array, and concrete values, like
* constants.
*/
abstract class Value {
- const Value();
+ final ValueRangeInfo info;
+ const Value([this.info = null]);
- Value operator +(Value other);
- Value operator -(Value other);
- Value operator -();
- Value operator &(Value other);
+ Value operator +(Value other) => const UnknownValue();
+ Value operator -(Value other) => const UnknownValue();
+ Value operator -() => const UnknownValue();
+ Value operator &(Value other) => const UnknownValue();
Value min(Value other) {
if (this == other) return this;
@@ -47,32 +97,44 @@
*/
class IntValue extends Value {
final int value;
- const IntValue(this.value);
+
+ const IntValue(this.value, info) : super(info);
Value operator +(other) {
if (other.isZero) return this;
if (other is !IntValue) return other + this;
- return new IntValue(value + other.value);
+ ConstantSystem constantSystem = info.constantSystem;
+ var constant = constantSystem.add.fold(
+ constantSystem.createInt(value), constantSystem.createInt(other.value));
+ if (!constant.isInt()) return const UnknownValue();
+ return info.newIntValue(constant.value);
}
Value operator -(other) {
if (other.isZero) return this;
if (other is !IntValue) return -other + this;
- return new IntValue(value - other.value);
+ ConstantSystem constantSystem = info.constantSystem;
+ var constant = constantSystem.subtract.fold(
+ constantSystem.createInt(value), constantSystem.createInt(other.value));
+ if (!constant.isInt()) return const UnknownValue();
+ return info.newIntValue(constant.value);
}
Value operator -() {
if (isZero) return this;
- return new IntValue(-value);
+ ConstantSystem constantSystem = info.constantSystem;
+ var constant = constantSystem.negate.fold(
+ constantSystem.createInt(value));
+ if (!constant.isInt()) return const UnknownValue();
+ return info.newIntValue(constant.value);
}
Value operator &(other) {
- if (other is !IntValue) {
- if (isPositive) return this;
- if (other.isPositive) return new IntValue(-value);
- return const UnknownValue();
- }
- return new IntValue(value & other.value);
+ if (other is !IntValue) return const UnknownValue();
+ ConstantSystem constantSystem = info.constantSystem;
+ var constant = constantSystem.bitAnd.fold(
+ constantSystem.createInt(value), constantSystem.createInt(other.value));
+ return info.newIntValue(constant.value);
}
Value min(other) {
@@ -101,15 +163,10 @@
* which is currently +infinity.
*/
class MaxIntValue extends Value {
- const MaxIntValue();
+ const MaxIntValue() : super(null);
Value operator +(Value other) => this;
Value operator -(Value other) => this;
Value operator -() => const MinIntValue();
- Value operator &(Value other) {
- if (other.isPositive) return other;
- if (other.isNegative) return const IntValue(0);
- return this;
- }
Value min(Value other) => other;
Value max(Value other) => this;
String toString() => 'Max';
@@ -122,14 +179,10 @@
* which is currently -infinity.
*/
class MinIntValue extends Value {
- const MinIntValue();
+ const MinIntValue() : super(null);
Value operator +(Value other) => this;
Value operator -(Value other) => this;
Value operator -() => const MaxIntValue();
- Value operator &(Value other) {
- if (other.isPositive) return const IntValue(0);
- return this;
- }
Value min(Value other) => this;
Value max(Value other) => other;
String toString() => 'Min';
@@ -142,11 +195,10 @@
* operation that could not be done because of too much complexity.
*/
class UnknownValue extends Value {
- const UnknownValue();
+ const UnknownValue() : super(null);
Value operator +(Value other) => const UnknownValue();
Value operator -(Value other) => const UnknownValue();
Value operator -() => const UnknownValue();
- Value operator &(Value other) => const UnknownValue();
Value min(Value other) => const UnknownValue();
Value max(Value other) => const UnknownValue();
bool get isNegative => false;
@@ -159,7 +211,7 @@
*/
class InstructionValue extends Value {
final HInstruction instruction;
- InstructionValue(this.instruction);
+ InstructionValue(this.instruction, info) : super(info);
bool operator ==(other) {
if (other is !InstructionValue) return false;
@@ -170,38 +222,33 @@
if (other.isZero) return this;
if (other is IntValue) {
if (other.isNegative) {
- return new SubtractValue(this, -other);
+ return info.newSubtractValue(this, -other);
}
- return new AddValue(this, other);
+ return info.newAddValue(this, other);
}
if (other is InstructionValue) {
- return new AddValue(this, other);
+ return info.newAddValue(this, other);
}
return other + this;
}
Value operator -(Value other) {
if (other.isZero) return this;
- if (this == other) return const IntValue(0);
+ if (this == other) return info.intZero;
if (other is IntValue) {
if (other.isNegative) {
- return new AddValue(this, -other);
+ return info.newAddValue(this, -other);
}
- return new SubtractValue(this, other);
+ return info.newSubtractValue(this, other);
}
if (other is InstructionValue) {
- return new SubtractValue(this, other);
+ return info.newSubtractValue(this, other);
}
return -other + this;
}
Value operator -() {
- return new NegateValue(this);
- }
-
- Value operator &(Value other) {
- if (other is IntValue) return other & this;
- return this;
+ return info.newNegateValue(this);
}
bool get isNegative => false;
@@ -216,7 +263,7 @@
* the value is positive.
*/
class LengthValue extends InstructionValue {
- LengthValue(HInstruction instruction) : super(instruction);
+ LengthValue(HInstruction instruction, info) : super(instruction, info);
bool get isPositive => true;
String toString() => 'Length: $instruction';
}
@@ -225,18 +272,14 @@
* Represents a binary operation on two [Value], where the operation
* did not yield a canonical value.
*/
-class OperationValue extends Value {
- Operation operation;
-}
-
-class BinaryOperationValue extends OperationValue {
+class BinaryOperationValue extends Value {
final Value left;
final Value right;
- BinaryOperationValue(this.left, this.right);
+ BinaryOperationValue(this.left, this.right, info) : super(info);
}
class AddValue extends BinaryOperationValue {
- AddValue(left, right) : super(left, right);
+ AddValue(left, right, info) : super(left, right, info);
bool operator ==(other) {
if (other is !AddValue) return false;
@@ -244,7 +287,6 @@
|| (left == other.right && right == other.left);
}
- Value operator &(Value other) => const UnknownValue();
Value operator -() => -left - right;
Value operator +(Value other) {
@@ -283,14 +325,13 @@
}
class SubtractValue extends BinaryOperationValue {
- SubtractValue(left, right) : super(left, right);
+ SubtractValue(left, right, info) : super(left, right, info);
bool operator ==(other) {
if (other is !SubtractValue) return false;
return left == other.left && right == other.right;
}
- Value operator &(Value other) => const UnknownValue();
Value operator -() => right - left;
Value operator +(Value other) {
@@ -328,9 +369,9 @@
String toString() => '$left - $right';
}
-class NegateValue extends OperationValue {
+class NegateValue extends Value {
final Value value;
- NegateValue(this.value);
+ NegateValue(this.value, info) : super(info);
bool operator ==(other) {
if (other is !NegateValue) return false;
@@ -339,16 +380,16 @@
Value operator +(other) {
if (other.isZero) return this;
- if (other == value) return const IntValue(0);
+ if (other == value) return info.intZero;
if (other is NegateValue) return this - other.value;
if (other is IntValue) {
if (other.isNegative) {
- return new SubtractValue(this, -other);
+ return info.newSubtractValue(this, -other);
}
- return new SubtractValue(other, value);
+ return info.newSubtractValue(other, value);
}
if (other is InstructionValue) {
- return new SubtractValue(other, value);
+ return info.newSubtractValue(other, value);
}
return other - value;
}
@@ -359,12 +400,12 @@
if (other.isZero) return this;
if (other is IntValue) {
if (other.isNegative) {
- return new SubtractValue(-other, value);
+ return info.newSubtractValue(-other, value);
}
- return new SubtractValue(this, other);
+ return info.newSubtractValue(this, other);
}
if (other is InstructionValue) {
- return new SubtractValue(this, other);
+ return info.newSubtractValue(this, other);
}
if (other is NegateValue) return this + other.value;
return -other - value;
@@ -385,20 +426,22 @@
class Range {
final Value lower;
final Value upper;
- const Range(this.lower, this.upper);
- const Range.unbound()
+ final ValueRangeInfo info;
+ Range(this.lower, this.upper, this.info);
+ Range.unbound(this.info)
: lower = const MinIntValue(),
upper = const MaxIntValue();
/**
* Checks if the given values are unknown, and creates a
* range that does not have any unknown values.
*/
- Range.normalize(Value low, Value up)
+ Range.normalize(Value low, Value up, this.info)
: lower = low == const UnknownValue() ? const MinIntValue() : low,
upper = up == const UnknownValue() ? const MaxIntValue() : up;
Range union(Range other) {
- return new Range.normalize(lower.min(other.lower), upper.max(other.upper));
+ return info.newNormalizedRange(
+ lower.min(other.lower), upper.max(other.upper));
}
intersection(Range other) {
@@ -416,19 +459,19 @@
else if (other.upper is IntValue) up = other.upper;
else up = upper;
}
- return new Range(low, up);
+ return info.newRange(low, up);
}
Range operator +(Range other) {
- return new Range.normalize(lower + other.lower, upper + other.upper);
+ return info.newNormalizedRange(lower + other.lower, upper + other.upper);
}
Range operator -(Range other) {
- return new Range.normalize(lower - other.upper, upper - other.lower);
+ return info.newNormalizedRange(lower - other.upper, upper - other.lower);
}
Range operator -() {
- return new Range.normalize(-upper, -lower);
+ return info.newNormalizedRange(-upper, -lower);
}
Range operator &(Range other) {
@@ -436,7 +479,7 @@
&& other.isSingleValue
&& lower is IntValue
&& other.lower is IntValue) {
- return new Range(lower & other.lower, upper & other.upper);
+ return info.newRange(lower & other.lower, upper & other.upper);
}
if (isPositive && other.isPositive) {
Value up = upper.min(other.upper);
@@ -448,13 +491,13 @@
// or b & a.
if (up is! IntValue && upper != other.upper) up = const MaxIntValue();
}
- return new Range(const IntValue(0), up);
+ return info.newRange(info.intZero, up);
} else if (isPositive) {
- return new Range(const IntValue(0), upper);
+ return info.newRange(info.intZero, upper);
} else if (other.isPositive) {
- return new Range(const IntValue(0), other.upper);
+ return info.newRange(info.intZero, other.upper);
} else {
- return const Range.unbound();
+ return info.newUnboundRange();
}
}
@@ -509,10 +552,14 @@
final ConstantSystem constantSystem;
final HTypeMap types;
+ final ValueRangeInfo info;
+
WorkItem work;
HGraph graph;
- SsaValueRangeAnalyzer(this.constantSystem, this.types, WorkItem this.work);
+ SsaValueRangeAnalyzer(constantSystem, this.types, this.work)
+ : info = new ValueRangeInfo(constantSystem),
+ this.constantSystem = constantSystem;
void visitGraph(HGraph graph) {
this.graph = graph;
@@ -545,20 +592,20 @@
}
Range visitInstruction(HInstruction instruction) {
- return const Range.unbound();
+ return info.newUnboundRange();
}
Range visitParameterValue(HParameterValue parameter) {
- if (!parameter.isInteger(types)) return const Range.unbound();
- Value value = new InstructionValue(parameter);
- return new Range(value, value);
+ if (!parameter.isInteger(types)) return info.newUnboundRange();
+ Value value = info.newInstructionValue(parameter);
+ return info.newRange(value, value);
}
Range visitPhi(HPhi phi) {
- if (!phi.isInteger(types)) return const Range.unbound();
+ if (!phi.isInteger(types)) return info.newUnboundRange();
if (phi.block.isLoopHeader()) {
Range range = tryInferLoopPhiRange(phi);
- if (range == null) return const Range.unbound();
+ if (range == null) return info.newUnboundRange();
return range;
}
@@ -571,27 +618,27 @@
Range tryInferLoopPhiRange(HPhi phi) {
HInstruction update = phi.inputs[1];
- return update.accept(new LoopUpdateRecognizer(phi, ranges, types));
+ return update.accept(new LoopUpdateRecognizer(phi, ranges, types, info));
}
Range visitConstant(HConstant constant) {
- if (!constant.isInteger(types)) return const Range.unbound();
+ if (!constant.isInteger(types)) return info.newUnboundRange();
IntConstant constantInt = constant.constant;
- Value value = new IntValue(constantInt.value);
- return new Range(value, value);
+ Value value = info.newIntValue(constantInt.value);
+ return info.newRange(value, value);
}
Range visitInvokeInterceptor(HInvokeInterceptor interceptor) {
- if (!interceptor.isInteger(types)) return const Range.unbound();
+ if (!interceptor.isInteger(types)) return info.newUnboundRange();
if (!interceptor.isLengthGetterOnStringOrArray(types)) {
return visitInstruction(interceptor);
}
- LengthValue value = new LengthValue(interceptor);
+ LengthValue value = info.newLengthValue(interceptor);
// We know this range is above zero. To simplify the analysis, we
// put the zero value as the lower bound of this range. This
// allows to easily remove the second bound check in the following
// expression: a[1] + a[0].
- return new Range(const IntValue(0), value);
+ return info.newRange(info.intZero, value);
}
Range visitBoundsCheck(HBoundsCheck check) {
@@ -602,7 +649,7 @@
// Check if the index is strictly below the upper bound of the length
// range.
- Value maxIndex = lengthRange.upper - const IntValue(1);
+ Value maxIndex = lengthRange.upper - info.intOne;
bool belowLength = maxIndex != const MaxIntValue()
&& indexRange.upper.min(maxIndex) == indexRange.upper;
@@ -632,7 +679,7 @@
if (low != const UnknownValue()) {
HInstruction instruction =
createRangeConversion(next, check.length);
- ranges[instruction] = new Range(low, lengthRange.upper);
+ ranges[instruction] = info.newRange(low, lengthRange.upper);
}
}
@@ -640,7 +687,7 @@
// Update the range of the index if using the length bounds
// narrows it.
Range newIndexRange = indexRange.intersection(
- new Range(lengthRange.lower, maxIndex));
+ info.newRange(lengthRange.lower, maxIndex));
if (indexRange == newIndexRange) return indexRange;
HInstruction instruction = createRangeConversion(next, check.index);
ranges[instruction] = newIndexRange;
@@ -653,8 +700,8 @@
Range visitRelational(HRelational relational) {
HInstruction right = relational.right;
HInstruction left = relational.left;
- if (!left.isInteger(types)) return const Range.unbound();
- if (!right.isInteger(types)) return const Range.unbound();
+ if (!left.isInteger(types)) return info.newUnboundRange();
+ if (!right.isInteger(types)) return info.newUnboundRange();
BinaryOperation operation = relational.operation(constantSystem);
Range rightRange = ranges[relational.right];
Range leftRange = ranges[relational.left];
@@ -670,7 +717,7 @@
relational, graph.addConstantBool(false, constantSystem));
relational.block.remove(relational);
}
- return const Range.unbound();
+ return info.newUnboundRange();
}
void handleEqualityCheck(HRelational node) {
@@ -684,7 +731,7 @@
}
Range handleBinaryOperation(HBinaryArithmetic instruction) {
- if (!instruction.isInteger(types)) return const Range.unbound();
+ if (!instruction.isInteger(types)) return info.newUnboundRange();
return instruction.operation(constantSystem).apply(
ranges[instruction.left], ranges[instruction.right]);
}
@@ -698,7 +745,7 @@
}
Range visitBitAnd(HBitAnd node) {
- if (!node.isInteger(types)) return const Range.unbound();
+ if (!node.isInteger(types)) return info.newUnboundRange();
HInstruction right = node.right;
HInstruction left = node.left;
if (left.isInteger(types) && right.isInteger(types)) {
@@ -708,11 +755,11 @@
Range tryComputeRange(HInstruction instruction) {
Range range = ranges[instruction];
if (range.isPositive) {
- return new Range(const IntValue(0), range.upper);
+ return info.newRange(info.intZero, range.upper);
} else if (range.isNegative) {
- return new Range(range.lower, const IntValue(0));
+ return info.newRange(range.lower, info.intZero);
}
- return const Range.unbound();
+ return info.newUnboundRange();
}
if (left.isInteger(types)) {
@@ -720,12 +767,12 @@
} else if (right.isInteger(types)) {
return tryComputeRange(right);
}
- return const Range.unbound();
+ return info.newUnboundRange();
}
Range visitCheck(HCheck instruction) {
if (ranges[instruction.checkedInput] == null) {
- return const Range.unbound();
+ return info.newUnboundRange();
}
return ranges[instruction.checkedInput];
}
@@ -758,22 +805,22 @@
}
}
- static Range computeConstrainedRange(BinaryOperation operation,
- Range leftRange,
- Range rightRange) {
+ Range computeConstrainedRange(BinaryOperation operation,
+ Range leftRange,
+ Range rightRange) {
Range range;
if (operation == const LessOperation()) {
- range = new Range(
- const MinIntValue(), rightRange.upper - const IntValue(1));
+ range = info.newRange(
+ const MinIntValue(), rightRange.upper - info.intOne);
} else if (operation == const LessEqualOperation()) {
- range = new Range(const MinIntValue(), rightRange.upper);
+ range = info.newRange(const MinIntValue(), rightRange.upper);
} else if (operation == const GreaterOperation()) {
- range = new Range(
- rightRange.lower + const IntValue(1), const MaxIntValue());
+ range = info.newRange(
+ rightRange.lower + info.intOne, const MaxIntValue());
} else if (operation == const GreaterEqualOperation()) {
- range = new Range(rightRange.lower, const MaxIntValue());
+ range = info.newRange(rightRange.lower, const MaxIntValue());
} else {
- range = const Range.unbound();
+ range = info.newUnboundRange();
}
return range.intersection(leftRange);
}
@@ -781,13 +828,13 @@
Range visitConditionalBranch(HConditionalBranch branch) {
var condition = branch.condition;
// TODO(ngeoffray): Handle complex conditions.
- if (condition is !HRelational) return const Range.unbound();
- if (condition is HEquals) return const Range.unbound();
- if (condition is HIdentity) return const Range.unbound();
+ if (condition is !HRelational) return info.newUnboundRange();
+ if (condition is HEquals) return info.newUnboundRange();
+ if (condition is HIdentity) return info.newUnboundRange();
HInstruction right = condition.right;
HInstruction left = condition.left;
- if (!left.isInteger(types)) return const Range.unbound();
- if (!right.isInteger(types)) return const Range.unbound();
+ if (!left.isInteger(types)) return info.newUnboundRange();
+ if (!right.isInteger(types)) return info.newUnboundRange();
Range rightRange = ranges[right];
Range leftRange = ranges[left];
@@ -835,7 +882,7 @@
}
}
- return const Range.unbound();
+ return info.newUnboundRange();
}
Range visitRangeConversion(HRangeConversion conversion) {
@@ -851,30 +898,31 @@
final HPhi loopPhi;
final Map<HInstruction, Range> ranges;
final HTypeMap types;
- LoopUpdateRecognizer(this.loopPhi, this.ranges, this.types);
+ final ValueRangeInfo info;
+ LoopUpdateRecognizer(this.loopPhi, this.ranges, this.types, this.info);
Range visitAdd(HAdd operation) {
Range range = getRangeForRecognizableOperation(operation);
- if (range == null) return const Range.unbound();
+ if (range == null) return info.newUnboundRange();
Range initial = ranges[loopPhi.inputs[0]];
if (range.isPositive) {
- return new Range(initial.lower, const MaxIntValue());
+ return info.newRange(initial.lower, const MaxIntValue());
} else if (range.isNegative) {
- return new Range(const MinIntValue(), initial.upper);
+ return info.newRange(const MinIntValue(), initial.upper);
}
- return const Range.unbound();
+ return info.newUnboundRange();
}
Range visitSubtract(HSubtract operation) {
Range range = getRangeForRecognizableOperation(operation);
- if (range == null) return const Range.unbound();
+ if (range == null) return info.newUnboundRange();
Range initial = ranges[loopPhi.inputs[0]];
if (range.isPositive) {
- return new Range(const MinIntValue(), initial.upper);
+ return info.newRange(const MinIntValue(), initial.upper);
} else if (range.isNegative) {
- return new Range(initial.lower, const MaxIntValue());
+ return info.newRange(initial.lower, const MaxIntValue());
}
- return const Range.unbound();
+ return info.newUnboundRange();
}
Range visitPhi(HPhi phi) {
@@ -921,8 +969,8 @@
// We currently only handle constants in updates if the
// update does not have a range.
if (other.isConstant()) {
- Value value = new IntValue(other.constant.value);
- return new Range(value, value);
+ Value value = info.newIntValue(other.constant.value);
+ return info.newRange(value, value);
}
return null;
}
diff --git a/lib/compiler/implementation/tree/nodes.dart b/lib/compiler/implementation/tree/nodes.dart
index 3c261ec..9d0be9eb 100644
--- a/lib/compiler/implementation/tree/nodes.dart
+++ b/lib/compiler/implementation/tree/nodes.dart
@@ -93,12 +93,6 @@
return token;
}
-class NodeAssertionFailure implements Exception {
- final Node node;
- final String message;
- NodeAssertionFailure(this.node, this.message);
-}
-
/**
* A node in a syntax tree.
*
@@ -338,22 +332,6 @@
assert(receiver == null);
return new Send(newReceiver, selector, argumentsNode);
}
-
- /**
- * Returns the type annotation of a connstructor call in an object
- * instantiation.
- */
- TypeAnnotation getTypeAnnotation() {
- if (selector is TypeAnnotation) {
- return selector;
- } else if (selector is Send) {
- Send selectorSend = selector;
- if (selectorSend.receiver is TypeAnnotation) {
- return selectorSend.receiver;
- }
- }
- return null;
- }
}
class Postfix extends NodeList {
@@ -657,12 +635,12 @@
if (body != null) body.accept(visitor);
}
- bool hasBody() {
- // TODO(karlklose,ahe): refactor AST nodes (issue 1713).
- if (body.asReturn() != null) return true;
- NodeList statements = body.asBlock().statements;
- return (!statements.nodes.isEmpty ||
- !identical(statements.getBeginToken().kind, $SEMICOLON));
+ bool hasBody() => body.asEmptyStatement() == null;
+
+ bool hasEmptyBody() {
+ Block block = body.asBlock();
+ if (block == null) return false;
+ return block.statements.isEmpty;
}
Token getBeginToken() {
@@ -1304,8 +1282,8 @@
*/
DartString get dartString {
if (isInterpolation) {
- throw new NodeAssertionFailure(this,
- "Getting dartString on interpolation;");
+ throw new SpannableAssertionFailure(
+ this, "Getting dartString on interpolation;");
}
if (dartStringCache == null) {
DartString firstString = first.accept(const GetDartStringVisitor());
diff --git a/lib/compiler/implementation/tree/unparser.dart b/lib/compiler/implementation/tree/unparser.dart
index 9eb2794..1f410c1 100644
--- a/lib/compiler/implementation/tree/unparser.dart
+++ b/lib/compiler/implementation/tree/unparser.dart
@@ -109,26 +109,13 @@
visit(node.function);
}
- visitFunctionExpression(FunctionExpression node) {
- // Check length to not print unnecessary whitespace.
- if (node.modifiers.nodes.length() > 0) {
- visit(node.modifiers);
- sb.add(' ');
- }
- if (node.returnType != null) {
- visit(node.returnType);
- sb.add(' ');
- }
- if (node.getOrSet != null) {
- add(node.getOrSet.value);
- sb.add(' ');
- }
+ void unparseFunctionName(Node name) {
// TODO(antonm): that's a workaround as currently FunctionExpression
// names are modelled with Send and it emits operator[] as only
// operator, without [] which are expected to be emitted with
// arguments.
- if (node.name is Send) {
- Send send = node.name;
+ if (name is Send) {
+ Send send = name;
assert(send is !SendSet);
if (!send.isOperator) {
// Looks like a factory method.
@@ -146,8 +133,25 @@
}
visit(send.selector);
} else {
- visit(node.name);
+ visit(name);
}
+ }
+
+ visitFunctionExpression(FunctionExpression node) {
+ // Check length to not print unnecessary whitespace.
+ if (node.modifiers.nodes.length() > 0) {
+ visit(node.modifiers);
+ sb.add(' ');
+ }
+ if (node.returnType != null) {
+ visit(node.returnType);
+ sb.add(' ');
+ }
+ if (node.getOrSet != null) {
+ add(node.getOrSet.value);
+ sb.add(' ');
+ }
+ unparseFunctionName(node.name);
visit(node.parameters);
visit(node.initializers);
visit(node.body);
diff --git a/lib/compiler/implementation/typechecker.dart b/lib/compiler/implementation/typechecker.dart
index 81d0e23..d9c27ff 100644
--- a/lib/compiler/implementation/typechecker.dart
+++ b/lib/compiler/implementation/typechecker.dart
@@ -26,9 +26,28 @@
}
}
+class TypeKind {
+ final String id;
+
+ const TypeKind(String this.id);
+
+ static const TypeKind FUNCTION = const TypeKind('function');
+ static const TypeKind INTERFACE = const TypeKind('interface');
+ static const TypeKind STATEMENT = const TypeKind('statement');
+ static const TypeKind TYPEDEF = const TypeKind('typedef');
+ static const TypeKind TYPE_VARIABLE = const TypeKind('type variable');
+ static const TypeKind VOID = const TypeKind('void');
+
+ String toString() => id;
+}
+
abstract class DartType {
abstract SourceString get name;
+ abstract TypeKind get kind;
+
+ const DartType();
+
/**
* Returns the [Element] which declared this type.
*
@@ -53,13 +72,17 @@
abstract DartType unalias(Compiler compiler);
abstract bool operator ==(other);
+
+ DartType asRaw() => this;
}
-class TypeVariableType implements DartType {
+class TypeVariableType extends DartType {
final TypeVariableElement element;
TypeVariableType(this.element);
+ TypeKind get kind => TypeKind.TYPE_VARIABLE;
+
SourceString get name => element.name;
DartType unalias(Compiler compiler) => this;
@@ -77,10 +100,13 @@
/**
* A statement type tracks whether a statement returns or may return.
*/
-class StatementType implements DartType {
+class StatementType extends DartType {
final String stringName;
+
Element get element => null;
+ TypeKind get kind => TypeKind.STATEMENT;
+
SourceString get name => new SourceString(stringName);
const StatementType(this.stringName);
@@ -106,9 +132,13 @@
String toString() => stringName;
}
-class VoidType implements DartType {
+class VoidType extends DartType {
const VoidType(this.element);
+
+ TypeKind get kind => TypeKind.VOID;
+
SourceString get name => element.name;
+
final VoidElement element;
DartType unalias(Compiler compiler) => this;
@@ -120,13 +150,15 @@
String toString() => name.slowToString();
}
-class InterfaceType implements DartType {
+class InterfaceType extends DartType {
final Element element;
final Link<DartType> arguments;
const InterfaceType(this.element,
[this.arguments = const Link<DartType>()]);
+ TypeKind get kind => TypeKind.INTERFACE;
+
SourceString get name => element.name;
DartType unalias(Compiler compiler) => this;
@@ -158,9 +190,14 @@
if (!identical(element, other.element)) return false;
return arguments == other.arguments;
}
+
+ InterfaceType asRaw() {
+ if (arguments.isEmpty) return this;
+ return new InterfaceType(element);
+ }
}
-class FunctionType implements DartType {
+class FunctionType extends DartType {
final Element element;
DartType returnType;
Link<DartType> parameterTypes;
@@ -170,6 +207,8 @@
assert(element == null || invariant(element, element.isDeclaration));
}
+ TypeKind get kind => TypeKind.FUNCTION;
+
DartType unalias(Compiler compiler) => this;
String toString() {
@@ -213,13 +252,15 @@
}
}
-class TypedefType implements DartType {
+class TypedefType extends DartType {
final TypedefElement element;
final Link<DartType> typeArguments;
const TypedefType(this.element,
[this.typeArguments = const Link<DartType>()]);
+ TypeKind get kind => TypeKind.TYPEDEF;
+
SourceString get name => element.name;
DartType unalias(Compiler compiler) {
@@ -521,7 +562,7 @@
}
DartType lookupMethodType(Node node, ClassElement classElement,
- SourceString name) {
+ SourceString name) {
Element member = classElement.lookupLocalMember(name);
if (member == null) {
classElement.ensureResolved(compiler);
diff --git a/lib/compiler/implementation/universe/universe.dart b/lib/compiler/implementation/universe/universe.dart
index d9df893..d4a01a5 100644
--- a/lib/compiler/implementation/universe/universe.dart
+++ b/lib/compiler/implementation/universe/universe.dart
@@ -198,7 +198,8 @@
// TODO(kasperl): This belongs somewhere else.
Selector.noSuchMethod()
- : this(SelectorKind.CALL, Compiler.NO_SUCH_METHOD, null, 2);
+ : this(SelectorKind.CALL, Compiler.NO_SUCH_METHOD, null,
+ Compiler.NO_SUCH_METHOD_ARG_COUNT);
bool isGetter() => identical(kind, SelectorKind.GETTER);
bool isSetter() => identical(kind, SelectorKind.SETTER);
@@ -223,6 +224,9 @@
=> appliesUntyped(element, compiler);
bool appliesUntyped(Element element, Compiler compiler) {
+ if (Elements.isUnresolved(element)) return false;
+ if (element.isForeign()) return true;
+
if (element.isSetter()) return isSetter();
if (element.isGetter()) return isGetter() || isCall();
if (element.isField()) return isGetter() || isSetter() || isCall();
@@ -236,18 +240,12 @@
if (positionalArgumentCount < requiredParameterCount) return false;
if (!parameters.optionalParametersAreNamed) {
- // TODO(5074): Remove this check once we don't accept the
- // deprecated parameter specification.
- if (!Compiler.REJECT_NAMED_ARGUMENT_AS_POSITIONAL) {
- return optionalParametersAppliesDEPRECATED(element, compiler);
- } else {
- // We have already checked that the number of arguments are
- // not greater than the number of parameters. Therefore the
- // number of positional arguments are not greater than the
- // number of parameters.
- assert(positionalArgumentCount <= parameters.parameterCount);
- return namedArguments.isEmpty;
- }
+ // We have already checked that the number of arguments are
+ // not greater than the number of parameters. Therefore the
+ // number of positional arguments are not greater than the
+ // number of parameters.
+ assert(positionalArgumentCount <= parameters.parameterCount);
+ return namedArguments.isEmpty;
} else {
if (positionalArgumentCount > requiredParameterCount) return false;
assert(positionalArgumentCount == requiredParameterCount);
@@ -267,98 +265,6 @@
}
}
- // TODO(5074): Remove this method once we don't accept the
- // deprecated parameter specification.
- bool optionalParametersAppliesDEPRECATED(FunctionElement function,
- Compiler compiler) {
- FunctionSignature parameters = function.computeSignature(compiler);
- int requiredParameterCount = parameters.requiredParameterCount;
- int optionalParameterCount = parameters.optionalParameterCount;
-
- bool hasOptionalParameters = !parameters.optionalParameters.isEmpty;
- if (namedArguments.isEmpty) {
- if (!hasOptionalParameters) {
- return requiredParameterCount == argumentCount;
- } else {
- return argumentCount >= requiredParameterCount &&
- argumentCount <= requiredParameterCount + optionalParameterCount;
- }
- } else {
- if (!hasOptionalParameters) return false;
- Link<Element> remainingNamedParameters = parameters.optionalParameters;
- for (int i = requiredParameterCount; i < positionalArgumentCount; i++) {
- remainingNamedParameters = remainingNamedParameters.tail;
- }
- Set<SourceString> nameSet = new Set<SourceString>();
- for (;
- !remainingNamedParameters.isEmpty;
- remainingNamedParameters = remainingNamedParameters.tail) {
- nameSet.add(remainingNamedParameters.head.name);
- }
-
- for (SourceString name in namedArguments) {
- if (!nameSet.contains(name)) {
- return false;
- }
- nameSet.remove(name);
- }
- return true;
- }
- }
-
- // TODO(5074): Remove this method once we don't accept the
- // deprecated parameter specification.
- bool addOptionalArgumentsToListDEPRECATED(Link<Node> arguments,
- List list,
- FunctionElement element,
- compileArgument(Node argument),
- compileConstant(Element element),
- Compiler compiler) {
- assert(invariant(element, element.isImplementation));
- // If there are named arguments, provide them in the order
- // expected by the called function, which is the source order.
- FunctionSignature parameters = element.computeSignature(compiler);
-
- // Visit positional arguments and add them to the list.
- for (int i = parameters.requiredParameterCount;
- i < positionalArgumentCount;
- arguments = arguments.tail, i++) {
- list.add(compileArgument(arguments.head));
- }
-
- // Visit named arguments and add them into a temporary list.
- List compiledNamedArguments = [];
- for (; !arguments.isEmpty; arguments = arguments.tail) {
- NamedArgument namedArgument = arguments.head;
- compiledNamedArguments.add(compileArgument(namedArgument.expression));
- }
-
- Link<Element> remainingNamedParameters = parameters.optionalParameters;
- // Skip the optional parameters that have been given in the
- // positional arguments.
- for (int i = parameters.requiredParameterCount;
- i < positionalArgumentCount;
- i++) {
- remainingNamedParameters = remainingNamedParameters.tail;
- }
-
- // Loop over the remaining named parameters, and try to find
- // their values: either in the temporary list or using the
- // default value.
- for (;
- !remainingNamedParameters.isEmpty;
- remainingNamedParameters = remainingNamedParameters.tail) {
- Element parameter = remainingNamedParameters.head;
- int foundIndex = namedArguments.indexOf(parameter.name);
- if (foundIndex != -1) {
- list.add(compiledNamedArguments[foundIndex]);
- } else {
- list.add(compileConstant(parameter));
- }
- }
- }
-
-
/**
* Returns [:true:] if the selector and the [element] match; [:false:]
* otherwise.
@@ -381,22 +287,14 @@
});
if (!parameters.optionalParametersAreNamed) {
- // TODO(5074): Remove this check once we don't accept the
- // deprecated parameter specification.
- if (!Compiler.REJECT_NAMED_ARGUMENT_AS_POSITIONAL) {
- addOptionalArgumentsToListDEPRECATED(
- arguments, list, element, compileArgument, compileConstant,
- compiler);
- } else {
- parameters.forEachOptionalParameter((element) {
- if (!arguments.isEmpty) {
- list.add(compileArgument(arguments.head));
- arguments = arguments.tail;
- } else {
- list.add(compileConstant(element));
- }
- });
- }
+ parameters.forEachOptionalParameter((element) {
+ if (!arguments.isEmpty) {
+ list.add(compileArgument(arguments.head));
+ arguments = arguments.tail;
+ } else {
+ list.add(compileConstant(element));
+ }
+ });
} else {
// Visit named arguments and add them into a temporary list.
List compiledNamedArguments = [];
@@ -510,6 +408,8 @@
}
bool applies(Element element, Compiler compiler) {
+ // [TypedSelector] are only used when compiling.
+ assert(compiler.phase == Compiler.PHASE_COMPILING);
if (!element.isMember()) return false;
// A closure can be called through any typed selector:
@@ -523,7 +423,10 @@
}
ClassElement self = receiverType.element;
- if (other.implementsInterface(self) || other.isSubclassOf(self)) {
+
+ if (other.implementsInterface(self)
+ || other.isSubclassOf(self)
+ || compiler.world.hasAnySubclassThatImplements(other, receiverType)) {
return appliesUntyped(element, compiler);
}
diff --git a/lib/compiler/implementation/util/util.dart b/lib/compiler/implementation/util/util.dart
index ef3b0f6..b39bd46 100644
--- a/lib/compiler/implementation/util/util.dart
+++ b/lib/compiler/implementation/util/util.dart
@@ -12,4 +12,13 @@
* Tagging interface for classes from which source spans can be generated.
*/
// TODO(johnniwinther): Find a better name.
+// TODO(ahe): How about "Bolt"?
abstract class Spannable {}
+
+class SpannableAssertionFailure {
+ final Spannable node;
+ final String message;
+ SpannableAssertionFailure(this.node, this.message);
+
+ String toString() => 'compiler crashed.';
+}
diff --git a/lib/compiler/implementation/warnings.dart b/lib/compiler/implementation/warnings.dart
index f1198a2..97df27f 100644
--- a/lib/compiler/implementation/warnings.dart
+++ b/lib/compiler/implementation/warnings.dart
@@ -141,6 +141,8 @@
'cannot use type variable as constructor');
static const DUPLICATE_TYPE_VARIABLE_NAME = const MessageKind(
'type variable #{1} already declared');
+ static const TYPE_VARIABLE_WITHIN_STATIC_MEMBER = const MessageKind(
+ 'cannot refer to type variable #{1} within a static member');
static const INVALID_BREAK = const MessageKind(
'target of break is not a statement');
static const INVALID_USE_OF_SUPER = const MessageKind(
diff --git a/lib/compiler/implementation/world.dart b/lib/compiler/implementation/world.dart
index 836d47c..bea9547 100644
--- a/lib/compiler/implementation/world.dart
+++ b/lib/compiler/implementation/world.dart
@@ -7,6 +7,7 @@
class World {
final Compiler compiler;
final Map<ClassElement, Set<ClassElement>> subtypes;
+ final Map<ClassElement, Set<ClassElement>> typesImplementedBySubclasses;
final Set<ClassElement> classesNeedingRti;
final Map<ClassElement, Set<ClassElement>> rtiDependencies;
final FunctionSet userDefinedGetters;
@@ -14,6 +15,8 @@
World(Compiler compiler)
: subtypes = new Map<ClassElement, Set<ClassElement>>(),
+ typesImplementedBySubclasses =
+ new Map<ClassElement, Set<ClassElement>>(),
userDefinedGetters = new FunctionSet(compiler),
userDefinedSetters = new FunctionSet(compiler),
classesNeedingRti = new Set<ClassElement>(),
@@ -26,11 +29,26 @@
compiler.internalErrorOnElement(
cls, 'Class "${cls.name.slowToString()}" is not resolved.');
}
+
for (DartType type in cls.allSupertypes) {
Set<Element> subtypesOfCls =
subtypes.putIfAbsent(type.element, () => new Set<ClassElement>());
subtypesOfCls.add(cls);
}
+
+ // Walk through the superclasses, and record the types
+ // implemented by that type on the superclasses.
+ DartType type = cls.supertype;
+ while (type != null) {
+ Set<Element> typesImplementedBySubclassesOfCls =
+ typesImplementedBySubclasses.putIfAbsent(
+ type.element, () => new Set<ClassElement>());
+ for (DartType current in cls.allSupertypes) {
+ typesImplementedBySubclassesOfCls.add(current.element);
+ }
+ ClassElement classElement = type.element;
+ type = classElement.supertype;
+ }
}
compiler.resolverWorld.instantiatedClasses.forEach(addSubtypes);
@@ -106,6 +124,23 @@
return userDefinedSetters.hasAnyElementMatchingSelector(selector);
}
+ // Returns whether a subclass of [superclass] implements [type].
+ bool hasAnySubclassThatImplements(ClassElement superclass, DartType type) {
+ Set<ClassElement> typesImplementedBySubclasses =
+ typesImplementedBySubclasses[superclass];
+ if (typesImplementedBySubclasses == null) return false;
+ return typesImplementedBySubclasses.contains(type.element);
+ }
+
+ bool hasNoOverridingMember(Element element) {
+ ClassElement cls = element.getEnclosingClass();
+ Set<ClassElement> subclasses = compiler.world.subtypes[cls];
+ // TODO(ngeoffray): Implement the full thing.
+ return subclasses == null || subclasses.isEmpty;
+ }
+
+
+
void registerUsedElement(Element element) {
if (element.isMember()) {
if (element.isGetter()) {
diff --git a/lib/core/core.dart b/lib/core/core.dart
index f602943..bf9af27 100644
--- a/lib/core/core.dart
+++ b/lib/core/core.dart
@@ -5,6 +5,7 @@
#library("dart:core");
#import("dart:coreimpl");
+#import("dart:collection");
#source("bool.dart");
#source("collection.dart");
diff --git a/lib/core/errors.dart b/lib/core/errors.dart
index 9a16d83..c516426 100644
--- a/lib/core/errors.dart
+++ b/lib/core/errors.dart
@@ -42,6 +42,36 @@
}
/**
+ * Exception thrown because of an index outside of the valid range.
+ *
+ * Temporarily extends [Exception] for backwards compatiblity.
+ */
+class RangeError extends ArgumentError implements Exception {
+ // TODO(lrn): This constructor should be called only with string values.
+ // It currently isn't in all cases.
+ /** Create a new [RangeError] with the given [message]. */
+ RangeError(var message) : super("$message");
+
+ /** Create a new [RangeError] with a message for the given [value]. */
+ RangeError.value(num value) : super("value $value");
+
+ String toString() => "RangeError: $message";
+}
+
+/**
+ * Temporary backwards compatibilty class.
+ *
+ * This class allows code throwing the old [IndexOutOfRangeException] to
+ * work until they change to the new [RangeError] name.
+ * Code **catching** IndexOutOfRangeException will fail to catch
+ * the [RangeError] objects that are now thrown.
+ */
+class IndexOutOfRangeException extends ArgumentError {
+ IndexOutOfRangeException(var message) : super(message);
+}
+
+
+/**
* Temporary backwards compatibility class.
*
* Removed when users have had time to change to using [ArgumentError].
@@ -73,39 +103,56 @@
*/
class NoSuchMethodError implements Error {
final Object _receiver;
- final String _functionName;
+ final String _memberName;
final List _arguments;
+ final Map<String,Dynamic> _namedArguments;
final List _existingArgumentNames;
/**
* Create a [NoSuchMethodError] corresponding to a failed method call.
*
- * The first parameter is the receiver of the method call.
- * The second parameter is the name of the called method.
- * The third parameter is the positional arguments that the method was
- * called with.
+ * The first parameter to this constructor is the receiver of the method call.
+ * That is, the object on which the method was attempted called.
+ * The second parameter is the name of the called method or accessor.
+ * The third parameter is a list of the positional arguments that the method
+ * was called with.
+ * The fourth parameter is a map from [String] names to the values of named
+ * arguments that the method was called with.
* The optional [exisitingArgumentNames] is the expected parameters of a
* method with the same name on the receiver, if available. This is
* the method that would have been called if the parameters had matched.
- *
- * TODO(lrn): This will be rewritten to use mirrors when they are available.
*/
const NoSuchMethodError(Object this._receiver,
- String this._functionName,
+ String this._memberName,
List this._arguments,
+ Map<String,Dynamic> this._namedArguments,
[List existingArgumentNames = null])
: this._existingArgumentNames = existingArgumentNames;
String toString() {
StringBuffer sb = new StringBuffer();
- for (int i = 0; i < _arguments.length; i++) {
- if (i > 0) {
- sb.add(", ");
+ int i = 0;
+ if (_arguments != null) {
+ for (; i < _arguments.length; i++) {
+ if (i > 0) {
+ sb.add(", ");
+ }
+ sb.add(safeToString(_arguments[i]));
}
- sb.add(safeToString(_arguments[i]));
+ }
+ if (_namedArguments != null) {
+ _namedArguments.forEach((String key, var value) {
+ if (i > 0) {
+ sb.add(", ");
+ }
+ sb.add(key);
+ sb.add(": ");
+ sb.add(safeToString(value));
+ i++;
+ });
}
if (_existingArgumentNames === null) {
- return "NoSuchMethodError : method not found: '$_functionName'\n"
+ return "NoSuchMethodError : method not found: '$_memberName'\n"
"Receiver: ${safeToString(_receiver)}\n"
"Arguments: [$sb]";
} else {
@@ -119,10 +166,10 @@
}
String formalParameters = sb.toString();
return "NoSuchMethodError: incorrect number of arguments passed to "
- "method named '$_functionName'\n"
+ "method named '$_memberName'\n"
"Receiver: ${safeToString(_receiver)}\n"
- "Tried calling: $_functionName($actualParameters)\n"
- "Found: $_functionName($formalParameters)";
+ "Tried calling: $_memberName($actualParameters)\n"
+ "Found: $_memberName($formalParameters)";
}
}
@@ -156,7 +203,7 @@
class UnsupportedError implements Error {
final String message;
UnsupportedError(this.message);
- String toString() => "Unsupported operation: message";
+ String toString() => "Unsupported operation: $message";
}
/**
@@ -168,7 +215,7 @@
class StateError implements Error {
final String message;
StateError(this.message);
- String toString() => "Bad state: message";
+ String toString() => "Bad state: $message";
}
diff --git a/lib/core/exceptions.dart b/lib/core/exceptions.dart
index c1774ef..e498567 100644
--- a/lib/core/exceptions.dart
+++ b/lib/core/exceptions.dart
@@ -24,18 +24,6 @@
/**
- * Exception thrown because of an index outside of the valid range.
- */
-class IndexOutOfRangeException implements Exception {
- const IndexOutOfRangeException(this._value);
-
- String toString() => "IndexOutOfRangeException: $_value";
-
- final _value;
-}
-
-
-/**
* Exception thrown when a string or some other data does not have an expected
* format and cannot be parsed or processed.
*/
diff --git a/lib/core/expect.dart b/lib/core/expect.dart
index adf0604..b26ddc5 100644
--- a/lib/core/expect.dart
+++ b/lib/core/expect.dart
@@ -264,13 +264,16 @@
String reason = null]) {
try {
f();
- } catch (e) {
+ } catch (e, s) {
if (check !== null) {
- Expect.isTrue(check(e));
+ if (!check(e)) {
+ String msg = reason == null ? "" : reason;
+ _fail("Expect.throws($msg): Unexpected '$e'\n$s");
+ }
}
return;
}
- String msg = _getMessage(reason);
+ String msg = reason == null ? "" : reason;
_fail('Expect.throws($msg) fails');
}
diff --git a/lib/core/list.dart b/lib/core/list.dart
index 6dd841f..b4948a3 100644
--- a/lib/core/list.dart
+++ b/lib/core/list.dart
@@ -7,7 +7,7 @@
* fixed size or extendable.
*/
interface List<E> extends Collection<E>, Sequence<E>
- default ListImplementation<E> {
+ default _ListImpl<E> {
/**
* Creates a list of the given [length].
*
@@ -27,13 +27,13 @@
/**
* Returns the element at the given [index] in the list or throws
- * an [IndexOutOfRangeException] if [index] is out of bounds.
+ * an [RangeError] if [index] is out of bounds.
*/
E operator [](int index);
/**
* Sets the entry at the given [index] in the list to [value].
- * Throws an [IndexOutOfRangeException] if [index] is out of bounds.
+ * Throws an [RangeError] if [index] is out of bounds.
*/
void operator []=(int index, E value);
@@ -108,7 +108,7 @@
* down by one position.
* Returns the removed element.
* Throws an [ArgumentError] if [index] is not an [int].
- * Throws an [IndexOutOfRangeException] if the [index] does not point inside
+ * Throws an [RangeError] if the [index] does not point inside
* the list.
* Throws an [UnsupportedError], and doesn't remove the element,
* if the length of the list cannot be changed.
@@ -133,7 +133,7 @@
* starting at [start].
* Returns an empty list if [length] is 0.
* Throws an [ArgumentError] if [length] is negative.
- * Throws an [IndexOutOfRangeException] if [start] or
+ * Throws an [RangeError] if [start] or
* [:start + length - 1:] are out of range.
*/
List<E> getRange(int start, int length);
@@ -143,7 +143,7 @@
* at [startFrom], into the list, starting at [start].
* If [length] is 0, this method does not do anything.
* Throws an [ArgumentError] if [length] is negative.
- * Throws an [IndexOutOfRangeException] if [start] or
+ * Throws an [RangeError] if [start] or
* [:start + length - 1:] are out of range for [:this:], or if
* [startFrom] or [:startFrom + length - 1:] are out of range for [from].
*/
@@ -155,7 +155,7 @@
* not extendable.
* If [length] is 0, this method does not do anything.
* Throws an [ArgumentError] if [length] is negative.
- * Throws an [IndexOutOfRangeException] if [start] or
+ * Throws an [RangeError] if [start] or
* [:start + length: - 1] are out of range.
*/
void removeRange(int start, int length);
@@ -169,8 +169,25 @@
* If [start] is the length of the list, this method inserts the
* range at the end of the list.
* Throws an [ArgumentError] if [length] is negative.
- * Throws an [IndexOutOfRangeException] if [start] is negative or if
+ * Throws an [RangeError] if [start] is negative or if
* [start] is greater than the length of the list.
*/
void insertRange(int start, int length, [E initialValue]);
}
+
+class _ListImpl<E> {
+ /**
+ * Factory implementation of List().
+ *
+ * Creates a list of the given [length].
+ */
+ external factory List([int length]);
+
+ /**
+ * Factory implementation of List.from().
+ *
+ * Creates a list with the elements of [other]. The order in
+ * the list will be the order provided by the iterator of [other].
+ */
+ external factory List.from(Iterable<E> other);
+}
diff --git a/lib/core/object.dart b/lib/core/object.dart
index ba41cb8..4ab04bca 100644
--- a/lib/core/object.dart
+++ b/lib/core/object.dart
@@ -48,14 +48,15 @@
/**
* [noSuchMethod] is invoked when users invoke a non-existant method
* on an object. The name of the method and the arguments of the
- * invocation are passed to [noSuchMethod]. If [noSuchMethod]
- * returns a value, that value becomes the result of the original
- * invocation.
+ * invocation are passed to [noSuchMethod] in an [InvocationMirror].
+ * If [noSuchMethod] returns a value, that value becomes the result of
+ * the original invocation.
*
* The default behavior of [noSuchMethod] is to throw a
* [noSuchMethodError].
*/
- external Dynamic noSuchMethod(String name, List args);
+ external dynamic noSuchMethod(InvocationMirror invocation);
+
/**
* A representation of the runtime type of the object.
*/
diff --git a/lib/core/queue.dart b/lib/core/queue.dart
index ecdfe36..bf1e49c 100644
--- a/lib/core/queue.dart
+++ b/lib/core/queue.dart
@@ -70,3 +70,269 @@
*/
void clear();
}
+
+
+/**
+ * An entry in a doubly linked list. It contains a pointer to the next
+ * entry, the previous entry, and the boxed element.
+ *
+ * WARNING: This class is temporary located in dart:core. It'll be removed
+ * at some point in the near future.
+ */
+class DoubleLinkedQueueEntry<E> {
+ DoubleLinkedQueueEntry<E> _previous;
+ DoubleLinkedQueueEntry<E> _next;
+ E _element;
+
+ DoubleLinkedQueueEntry(E e) {
+ _element = e;
+ }
+
+ void _link(DoubleLinkedQueueEntry<E> p,
+ DoubleLinkedQueueEntry<E> n) {
+ _next = n;
+ _previous = p;
+ p._next = this;
+ n._previous = this;
+ }
+
+ void append(E e) {
+ new DoubleLinkedQueueEntry<E>(e)._link(this, _next);
+ }
+
+ void prepend(E e) {
+ new DoubleLinkedQueueEntry<E>(e)._link(_previous, this);
+ }
+
+ E remove() {
+ _previous._next = _next;
+ _next._previous = _previous;
+ _next = null;
+ _previous = null;
+ return _element;
+ }
+
+ DoubleLinkedQueueEntry<E> _asNonSentinelEntry() {
+ return this;
+ }
+
+ DoubleLinkedQueueEntry<E> previousEntry() {
+ return _previous._asNonSentinelEntry();
+ }
+
+ DoubleLinkedQueueEntry<E> nextEntry() {
+ return _next._asNonSentinelEntry();
+ }
+
+ E get element {
+ return _element;
+ }
+
+ void set element(E e) {
+ _element = e;
+ }
+}
+
+/**
+ * A sentinel in a double linked list is used to manipulate the list
+ * at both ends. A double linked list has exactly one sentinel, which
+ * is the only entry when the list is constructed. Initially, a
+ * sentinel has its next and previous entry point to itself. A
+ * sentinel does not box any user element.
+ */
+class _DoubleLinkedQueueEntrySentinel<E> extends DoubleLinkedQueueEntry<E> {
+ _DoubleLinkedQueueEntrySentinel() : super(null) {
+ _link(this, this);
+ }
+
+ E remove() {
+ throw new StateError("Empty queue");
+ }
+
+ DoubleLinkedQueueEntry<E> _asNonSentinelEntry() {
+ return null;
+ }
+
+ void set element(E e) {
+ // This setter is unreachable.
+ assert(false);
+ }
+
+ E get element {
+ throw new StateError("Empty queue");
+ }
+}
+
+/**
+ * Implementation of a double linked list that box list elements into
+ * DoubleLinkedQueueEntry objects.
+ *
+ * WARNING: This class is temporary located in dart:core. It'll be removed
+ * at some point in the near future.
+ */
+class DoubleLinkedQueue<E> implements Queue<E> {
+ _DoubleLinkedQueueEntrySentinel<E> _sentinel;
+
+ DoubleLinkedQueue() {
+ _sentinel = new _DoubleLinkedQueueEntrySentinel<E>();
+ }
+
+ factory DoubleLinkedQueue.from(Iterable<E> other) {
+ Queue<E> list = new DoubleLinkedQueue();
+ for (final e in other) {
+ list.addLast(e);
+ }
+ return list;
+ }
+
+ void addLast(E value) {
+ _sentinel.prepend(value);
+ }
+
+ void addFirst(E value) {
+ _sentinel.append(value);
+ }
+
+ void add(E value) {
+ addLast(value);
+ }
+
+ void addAll(Collection<E> collection) {
+ for (final e in collection) {
+ add(e);
+ }
+ }
+
+ E removeLast() {
+ return _sentinel._previous.remove();
+ }
+
+ E removeFirst() {
+ return _sentinel._next.remove();
+ }
+
+ E get first {
+ return _sentinel._next.element;
+ }
+
+ E get last {
+ return _sentinel._previous.element;
+ }
+
+ DoubleLinkedQueueEntry<E> lastEntry() {
+ return _sentinel.previousEntry();
+ }
+
+ DoubleLinkedQueueEntry<E> firstEntry() {
+ return _sentinel.nextEntry();
+ }
+
+ int get length {
+ int counter = 0;
+ forEach(void _(E element) { counter++; });
+ return counter;
+ }
+
+ bool get isEmpty {
+ return (_sentinel._next === _sentinel);
+ }
+
+ void clear() {
+ _sentinel._next = _sentinel;
+ _sentinel._previous = _sentinel;
+ }
+
+ void forEach(void f(E element)) {
+ DoubleLinkedQueueEntry<E> entry = _sentinel._next;
+ while (entry !== _sentinel) {
+ DoubleLinkedQueueEntry<E> nextEntry = entry._next;
+ f(entry._element);
+ entry = nextEntry;
+ }
+ }
+
+ void forEachEntry(void f(DoubleLinkedQueueEntry<E> element)) {
+ DoubleLinkedQueueEntry<E> entry = _sentinel._next;
+ while (entry !== _sentinel) {
+ DoubleLinkedQueueEntry<E> nextEntry = entry._next;
+ f(entry);
+ entry = nextEntry;
+ }
+ }
+
+ bool every(bool f(E element)) {
+ DoubleLinkedQueueEntry<E> entry = _sentinel._next;
+ while (entry !== _sentinel) {
+ DoubleLinkedQueueEntry<E> nextEntry = entry._next;
+ if (!f(entry._element)) return false;
+ entry = nextEntry;
+ }
+ return true;
+ }
+
+ bool some(bool f(E element)) {
+ DoubleLinkedQueueEntry<E> entry = _sentinel._next;
+ while (entry !== _sentinel) {
+ DoubleLinkedQueueEntry<E> nextEntry = entry._next;
+ if (f(entry._element)) return true;
+ entry = nextEntry;
+ }
+ return false;
+ }
+
+ Queue map(f(E element)) {
+ Queue other = new Queue();
+ DoubleLinkedQueueEntry<E> entry = _sentinel._next;
+ while (entry !== _sentinel) {
+ DoubleLinkedQueueEntry<E> nextEntry = entry._next;
+ other.addLast(f(entry._element));
+ entry = nextEntry;
+ }
+ return other;
+ }
+
+ Dynamic reduce(Dynamic initialValue,
+ Dynamic combine(Dynamic previousValue, E element)) {
+ return Collections.reduce(this, initialValue, combine);
+ }
+
+ Queue<E> filter(bool f(E element)) {
+ Queue<E> other = new Queue<E>();
+ DoubleLinkedQueueEntry<E> entry = _sentinel._next;
+ while (entry !== _sentinel) {
+ DoubleLinkedQueueEntry<E> nextEntry = entry._next;
+ if (f(entry._element)) other.addLast(entry._element);
+ entry = nextEntry;
+ }
+ return other;
+ }
+
+ _DoubleLinkedQueueIterator<E> iterator() {
+ return new _DoubleLinkedQueueIterator<E>(_sentinel);
+ }
+
+ String toString() {
+ return Collections.collectionToString(this);
+ }
+}
+
+class _DoubleLinkedQueueIterator<E> implements Iterator<E> {
+ final _DoubleLinkedQueueEntrySentinel<E> _sentinel;
+ DoubleLinkedQueueEntry<E> _currentEntry;
+
+ _DoubleLinkedQueueIterator(_DoubleLinkedQueueEntrySentinel this._sentinel) {
+ _currentEntry = _sentinel;
+ }
+
+ bool get hasNext {
+ return _currentEntry._next !== _sentinel;
+ }
+
+ E next() {
+ if (!hasNext) {
+ throw new StateError("No more elements");
+ }
+ _currentEntry = _currentEntry._next;
+ return _currentEntry.element;
+ }
+}
diff --git a/lib/core/stopwatch.dart b/lib/core/stopwatch.dart
index 2cb77a7..79e08c9 100644
--- a/lib/core/stopwatch.dart
+++ b/lib/core/stopwatch.dart
@@ -14,7 +14,7 @@
*
* Stopwatch stopwatch = new Stopwatch()..start();
*/
- factory Stopwatch() => new StopwatchImplementation();
+ factory Stopwatch() => new _StopwatchImpl();
/**
* Starts the [Stopwatch]. The [elapsed] count is increasing monotonically.
@@ -62,3 +62,69 @@
*/
int get frequency;
}
+
+class _StopwatchImpl implements Stopwatch {
+ // The _start and _stop fields capture the time when [start] and [stop]
+ // are called respectively.
+ // If _start is null, then the [Stopwatch] has not been started yet.
+ // If _stop is null, then the [Stopwatch] has not been stopped yet,
+ // or is running.
+ int _start;
+ int _stop;
+
+ _StopwatchImpl() : _start = null, _stop = null {}
+
+ void start() {
+ if (_start === null) {
+ // This stopwatch has never been started.
+ _start = _now();
+ } else {
+ if (_stop === null) {
+ return;
+ }
+ // Restarting this stopwatch. Prepend the elapsed time to the current
+ // start time.
+ _start = _now() - (_stop - _start);
+ _stop = null;
+ }
+ }
+
+ void stop() {
+ if (_start === null || _stop !== null) {
+ return;
+ }
+ _stop = _now();
+ }
+
+ void reset() {
+ if (_start === null) return;
+ // If [_start] is not null, then the stopwatch had already been started. It
+ // may running right now.
+ _start = _now();
+ if (_stop !== null) {
+ // The watch is not running. So simply set the [_stop] to [_start] thus
+ // having an elapsed time of 0.
+ _stop = _start;
+ }
+ }
+
+ int get elapsedTicks {
+ if (_start === null) {
+ return 0;
+ }
+ return (_stop === null) ? (_now() - _start) : (_stop - _start);
+ }
+
+ int get elapsedMicroseconds {
+ return (elapsedTicks * 1000000) ~/ frequency;
+ }
+
+ int get elapsedMilliseconds {
+ return (elapsedTicks * 1000) ~/ frequency;
+ }
+
+ int get frequency => _frequency();
+
+ external static int _frequency();
+ external static int _now();
+}
diff --git a/lib/core/string.dart b/lib/core/string.dart
index 801e415..ad4aefe 100644
--- a/lib/core/string.dart
+++ b/lib/core/string.dart
@@ -10,7 +10,7 @@
*/
interface String
extends Comparable, Pattern, Sequence<String>
- default StringImplementation {
+ default _StringImpl {
/**
* Allocates a new String for the specified [charCodes].
*/
@@ -131,3 +131,22 @@
*/
String toUpperCase();
}
+
+class _StringImpl {
+ /**
+ * Factory implementation of String.fromCharCodes:
+ * Allocates a new String for the specified [charCodes].
+ */
+ external factory String.fromCharCodes(List<int> charCodes);
+
+ /**
+ * Joins all the given strings to create a new string.
+ */
+ external static String join(List<String> strings, String separator);
+
+ /**
+ * Concatenates all the given strings to create a new string.
+ */
+ external static String concatAll(List<String> strings);
+
+}
diff --git a/lib/core/string_buffer.dart b/lib/core/string_buffer.dart
index 7530cdb..0561d83 100644
--- a/lib/core/string_buffer.dart
+++ b/lib/core/string_buffer.dart
@@ -117,7 +117,7 @@
String toString() {
if (_buffer.length === 0) return "";
if (_buffer.length === 1) return _buffer[0];
- String result = StringImplementation.concatAll(_buffer);
+ String result = _StringImpl.concatAll(_buffer);
_buffer.clear();
_buffer.add(result);
// Since we track the length at each add operation, there is no
diff --git a/lib/core/strings.dart b/lib/core/strings.dart
index e8cbcc0..86655e9 100644
--- a/lib/core/strings.dart
+++ b/lib/core/strings.dart
@@ -7,13 +7,13 @@
* Joins all the given strings to create a new string.
*/
static String join(List<String> strings, String separator) {
- return StringImplementation.join(strings, separator);
+ return _StringImpl.join(strings, separator);
}
/**
* Concatenates all the given strings to create a new string.
*/
static String concatAll(List<String> strings) {
- return StringImplementation.concatAll(strings);
+ return _StringImpl.concatAll(strings);
}
}
diff --git a/lib/coreimpl/coreimpl.dart b/lib/coreimpl/coreimpl.dart
index 7e5b7ec..c28a72b 100644
--- a/lib/coreimpl/coreimpl.dart
+++ b/lib/coreimpl/coreimpl.dart
@@ -4,14 +4,8 @@
#library("dart:coreimpl");
-#source("arrays.dart");
-#source("collections.dart");
+#import("dart:collection");
+
#source("hash_map_set.dart");
#source("linked_hash_map.dart");
-#source("list.dart");
-#source("maps.dart");
-#source("queue.dart");
#source("regexp.dart");
-#source("splay_tree.dart");
-#source("stopwatch_implementation.dart");
-#source("string.dart");
diff --git a/lib/coreimpl/corelib_impl_sources.gypi b/lib/coreimpl/corelib_impl_sources.gypi
index 0ff6644..82531db 100644
--- a/lib/coreimpl/corelib_impl_sources.gypi
+++ b/lib/coreimpl/corelib_impl_sources.gypi
@@ -4,16 +4,8 @@
{
'sources': [
- 'arrays.dart',
- 'collections.dart',
'hash_map_set.dart',
'linked_hash_map.dart',
- 'list.dart',
- 'maps.dart',
- 'queue.dart',
'regexp.dart',
- 'splay_tree.dart',
- 'stopwatch_implementation.dart',
- 'string.dart',
],
}
diff --git a/lib/coreimpl/list.dart b/lib/coreimpl/list.dart
deleted file mode 100644
index f162140..0000000
--- a/lib/coreimpl/list.dart
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-/**
- * A [List] is an indexable collection with a length. It can be of
- * fixed size or extendable.
- */
-class ListImplementation<E> {
- /**
- * Factory implementation of List().
- *
- * Creates a list of the given [length].
- */
- external factory List([int length]);
-
- /**
- * Factory implementation of List.from().
- *
- * Creates a list with the elements of [other]. The order in
- * the list will be the order provided by the iterator of [other].
- */
- factory List.from(Iterable<E> other) {
- // TODO(ajohnsen): Make external once the vm can handle it, so we don't
- // lose generic type information.
- // Issue: #4727
- return _from(other);
- }
-
- external static List _from(Iterable other);
-}
diff --git a/lib/coreimpl/queue.dart b/lib/coreimpl/queue.dart
deleted file mode 100644
index b56d7d1..0000000
--- a/lib/coreimpl/queue.dart
+++ /dev/null
@@ -1,263 +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.
-
-
-/**
- * An entry in a doubly linked list. It contains a pointer to the next
- * entry, the previous entry, and the boxed element.
- */
-class DoubleLinkedQueueEntry<E> {
- DoubleLinkedQueueEntry<E> _previous;
- DoubleLinkedQueueEntry<E> _next;
- E _element;
-
- DoubleLinkedQueueEntry(E e) {
- _element = e;
- }
-
- void _link(DoubleLinkedQueueEntry<E> p,
- DoubleLinkedQueueEntry<E> n) {
- _next = n;
- _previous = p;
- p._next = this;
- n._previous = this;
- }
-
- void append(E e) {
- new DoubleLinkedQueueEntry<E>(e)._link(this, _next);
- }
-
- void prepend(E e) {
- new DoubleLinkedQueueEntry<E>(e)._link(_previous, this);
- }
-
- E remove() {
- _previous._next = _next;
- _next._previous = _previous;
- _next = null;
- _previous = null;
- return _element;
- }
-
- DoubleLinkedQueueEntry<E> _asNonSentinelEntry() {
- return this;
- }
-
- DoubleLinkedQueueEntry<E> previousEntry() {
- return _previous._asNonSentinelEntry();
- }
-
- DoubleLinkedQueueEntry<E> nextEntry() {
- return _next._asNonSentinelEntry();
- }
-
- E get element {
- return _element;
- }
-
- void set element(E e) {
- _element = e;
- }
-}
-
-/**
- * A sentinel in a double linked list is used to manipulate the list
- * at both ends. A double linked list has exactly one sentinel, which
- * is the only entry when the list is constructed. Initially, a
- * sentinel has its next and previous entry point to itself. A
- * sentinel does not box any user element.
- */
-class _DoubleLinkedQueueEntrySentinel<E> extends DoubleLinkedQueueEntry<E> {
- _DoubleLinkedQueueEntrySentinel() : super(null) {
- _link(this, this);
- }
-
- E remove() {
- throw new StateError("Empty queue");
- }
-
- DoubleLinkedQueueEntry<E> _asNonSentinelEntry() {
- return null;
- }
-
- void set element(E e) {
- // This setter is unreachable.
- assert(false);
- }
-
- E get element {
- throw new StateError("Empty queue");
- }
-}
-
-/**
- * Implementation of a double linked list that box list elements into
- * DoubleLinkedQueueEntry objects.
- */
-class DoubleLinkedQueue<E> implements Queue<E> {
- _DoubleLinkedQueueEntrySentinel<E> _sentinel;
-
- DoubleLinkedQueue() {
- _sentinel = new _DoubleLinkedQueueEntrySentinel<E>();
- }
-
- factory DoubleLinkedQueue.from(Iterable<E> other) {
- Queue<E> list = new DoubleLinkedQueue();
- for (final e in other) {
- list.addLast(e);
- }
- return list;
- }
-
- void addLast(E value) {
- _sentinel.prepend(value);
- }
-
- void addFirst(E value) {
- _sentinel.append(value);
- }
-
- void add(E value) {
- addLast(value);
- }
-
- void addAll(Collection<E> collection) {
- for (final e in collection) {
- add(e);
- }
- }
-
- E removeLast() {
- return _sentinel._previous.remove();
- }
-
- E removeFirst() {
- return _sentinel._next.remove();
- }
-
- E get first {
- return _sentinel._next.element;
- }
-
- E get last {
- return _sentinel._previous.element;
- }
-
- DoubleLinkedQueueEntry<E> lastEntry() {
- return _sentinel.previousEntry();
- }
-
- DoubleLinkedQueueEntry<E> firstEntry() {
- return _sentinel.nextEntry();
- }
-
- int get length {
- int counter = 0;
- forEach(void _(E element) { counter++; });
- return counter;
- }
-
- bool get isEmpty {
- return (_sentinel._next === _sentinel);
- }
-
- void clear() {
- _sentinel._next = _sentinel;
- _sentinel._previous = _sentinel;
- }
-
- void forEach(void f(E element)) {
- DoubleLinkedQueueEntry<E> entry = _sentinel._next;
- while (entry !== _sentinel) {
- DoubleLinkedQueueEntry<E> nextEntry = entry._next;
- f(entry._element);
- entry = nextEntry;
- }
- }
-
- void forEachEntry(void f(DoubleLinkedQueueEntry<E> element)) {
- DoubleLinkedQueueEntry<E> entry = _sentinel._next;
- while (entry !== _sentinel) {
- DoubleLinkedQueueEntry<E> nextEntry = entry._next;
- f(entry);
- entry = nextEntry;
- }
- }
-
- bool every(bool f(E element)) {
- DoubleLinkedQueueEntry<E> entry = _sentinel._next;
- while (entry !== _sentinel) {
- DoubleLinkedQueueEntry<E> nextEntry = entry._next;
- if (!f(entry._element)) return false;
- entry = nextEntry;
- }
- return true;
- }
-
- bool some(bool f(E element)) {
- DoubleLinkedQueueEntry<E> entry = _sentinel._next;
- while (entry !== _sentinel) {
- DoubleLinkedQueueEntry<E> nextEntry = entry._next;
- if (f(entry._element)) return true;
- entry = nextEntry;
- }
- return false;
- }
-
- Queue map(f(E element)) {
- Queue other = new Queue();
- DoubleLinkedQueueEntry<E> entry = _sentinel._next;
- while (entry !== _sentinel) {
- DoubleLinkedQueueEntry<E> nextEntry = entry._next;
- other.addLast(f(entry._element));
- entry = nextEntry;
- }
- return other;
- }
-
- Dynamic reduce(Dynamic initialValue,
- Dynamic combine(Dynamic previousValue, E element)) {
- return Collections.reduce(this, initialValue, combine);
- }
-
- Queue<E> filter(bool f(E element)) {
- Queue<E> other = new Queue<E>();
- DoubleLinkedQueueEntry<E> entry = _sentinel._next;
- while (entry !== _sentinel) {
- DoubleLinkedQueueEntry<E> nextEntry = entry._next;
- if (f(entry._element)) other.addLast(entry._element);
- entry = nextEntry;
- }
- return other;
- }
-
- _DoubleLinkedQueueIterator<E> iterator() {
- return new _DoubleLinkedQueueIterator<E>(_sentinel);
- }
-
- String toString() {
- return Collections.collectionToString(this);
- }
-}
-
-class _DoubleLinkedQueueIterator<E> implements Iterator<E> {
- final _DoubleLinkedQueueEntrySentinel<E> _sentinel;
- DoubleLinkedQueueEntry<E> _currentEntry;
-
- _DoubleLinkedQueueIterator(_DoubleLinkedQueueEntrySentinel this._sentinel) {
- _currentEntry = _sentinel;
- }
-
- bool get hasNext {
- return _currentEntry._next !== _sentinel;
- }
-
- E next() {
- if (!hasNext) {
- throw new StateError("No more elements");
- }
- _currentEntry = _currentEntry._next;
- return _currentEntry.element;
- }
-}
diff --git a/lib/coreimpl/stopwatch_implementation.dart b/lib/coreimpl/stopwatch_implementation.dart
deleted file mode 100644
index 30b4ca2..0000000
--- a/lib/coreimpl/stopwatch_implementation.dart
+++ /dev/null
@@ -1,72 +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.
-
-/**
- * A simple implementation of the [Stopwatch] interface.
- */
-class StopwatchImplementation implements Stopwatch {
- // The _start and _stop fields capture the time when [start] and [stop]
- // are called respectively.
- // If _start is null, then the [Stopwatch] has not been started yet.
- // If _stop is null, then the [Stopwatch] has not been stopped yet,
- // or is running.
- int _start;
- int _stop;
-
- StopwatchImplementation() : _start = null, _stop = null {}
-
- void start() {
- if (_start === null) {
- // This stopwatch has never been started.
- _start = _now();
- } else {
- if (_stop === null) {
- return;
- }
- // Restarting this stopwatch. Prepend the elapsed time to the current
- // start time.
- _start = _now() - (_stop - _start);
- _stop = null;
- }
- }
-
- void stop() {
- if (_start === null || _stop !== null) {
- return;
- }
- _stop = _now();
- }
-
- void reset() {
- if (_start === null) return;
- // If [_start] is not null, then the stopwatch had already been started. It
- // may running right now.
- _start = _now();
- if (_stop !== null) {
- // The watch is not running. So simply set the [_stop] to [_start] thus
- // having an elapsed time of 0.
- _stop = _start;
- }
- }
-
- int get elapsedTicks {
- if (_start === null) {
- return 0;
- }
- return (_stop === null) ? (_now() - _start) : (_stop - _start);
- }
-
- int get elapsedMicroseconds {
- return (elapsedTicks * 1000000) ~/ frequency;
- }
-
- int get elapsedMilliseconds {
- return (elapsedTicks * 1000) ~/ frequency;
- }
-
- int get frequency => _frequency();
-
- external static int _frequency();
- external static int _now();
-}
diff --git a/lib/coreimpl/string.dart b/lib/coreimpl/string.dart
deleted file mode 100644
index 4e23e67..0000000
--- a/lib/coreimpl/string.dart
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-class StringImplementation {
- /**
- * Factory implementation of String.fromCharCodes:
- * Allocates a new String for the specified [charCodes].
- */
- factory String.fromCharCodes(List<int> charCodes) {
- return _fromCharCodes(charCodes);
- }
-
- external static String _fromCharCodes(List<int> charCodes);
-
- /**
- * Joins all the given strings to create a new string.
- */
- external static String join(List<String> strings, String separator);
-
- /**
- * Concatenates all the given strings to create a new string.
- */
- external static String concatAll(List<String> strings);
-
-}
diff --git a/lib/html/dart2js/html_dart2js.dart b/lib/html/dart2js/html_dart2js.dart
index 738c5d4..663b0c0 100644
--- a/lib/html/dart2js/html_dart2js.dart
+++ b/lib/html/dart2js/html_dart2js.dart
@@ -97,6 +97,58 @@
// WARNING: Do not edit - generated code.
+/// @domName AnalyserNode
+abstract class AnalyserNode implements AudioNode {
+
+ /** @domName AnalyserNode.fftSize */
+ int fftSize;
+
+ /** @domName AnalyserNode.frequencyBinCount */
+ int get frequencyBinCount;
+
+ /** @domName AnalyserNode.maxDecibels */
+ num maxDecibels;
+
+ /** @domName AnalyserNode.minDecibels */
+ num minDecibels;
+
+ /** @domName AnalyserNode.smoothingTimeConstant */
+ num smoothingTimeConstant;
+
+ /** @domName AnalyserNode.getByteFrequencyData */
+ void getByteFrequencyData(Uint8Array array);
+
+ /** @domName AnalyserNode.getByteTimeDomainData */
+ void getByteTimeDomainData(Uint8Array array);
+
+ /** @domName AnalyserNode.getFloatFrequencyData */
+ void getFloatFrequencyData(Float32Array array);
+}
+
+class _AnalyserNodeImpl extends _AudioNodeImpl implements AnalyserNode native "*AnalyserNode" {
+
+ int fftSize;
+
+ final int frequencyBinCount;
+
+ num maxDecibels;
+
+ num minDecibels;
+
+ num smoothingTimeConstant;
+
+ void getByteFrequencyData(_Uint8ArrayImpl array) native;
+
+ void getByteTimeDomainData(_Uint8ArrayImpl array) native;
+
+ void getFloatFrequencyData(_Float32ArrayImpl array) 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.
+
+// WARNING: Do not edit - generated code.
+
/// @domName HTMLAnchorElement
abstract class AnchorElement implements Element {
@@ -631,8 +683,11 @@
/** @domName AudioBufferSourceNode.loop */
bool loop;
- /** @domName AudioBufferSourceNode.looping */
- bool looping;
+ /** @domName AudioBufferSourceNode.loopEnd */
+ num loopEnd;
+
+ /** @domName AudioBufferSourceNode.loopStart */
+ num loopStart;
/** @domName AudioBufferSourceNode.playbackRate */
AudioParam get playbackRate;
@@ -688,7 +743,9 @@
bool loop;
- bool looping;
+ num loopEnd;
+
+ num loopStart;
final _AudioParamImpl playbackRate;
@@ -701,30 +758,6 @@
// WARNING: Do not edit - generated code.
-/// @domName AudioChannelMerger
-abstract class AudioChannelMerger implements AudioNode {
-}
-
-class _AudioChannelMergerImpl extends _AudioNodeImpl implements AudioChannelMerger native "*AudioChannelMerger" {
-}
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-// WARNING: Do not edit - generated code.
-
-/// @domName AudioChannelSplitter
-abstract class AudioChannelSplitter implements AudioNode {
-}
-
-class _AudioChannelSplitterImpl extends _AudioNodeImpl implements AudioChannelSplitter native "*AudioChannelSplitter" {
-}
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-// WARNING: Do not edit - generated code.
-
/// @domName AudioContext
abstract class AudioContext implements EventTarget {
@@ -751,7 +784,7 @@
num get sampleRate;
/** @domName AudioContext.createAnalyser */
- RealtimeAnalyserNode createAnalyser();
+ AnalyserNode createAnalyser();
/** @domName AudioContext.createBiquadFilter */
BiquadFilterNode createBiquadFilter();
@@ -763,25 +796,22 @@
AudioBufferSourceNode createBufferSource();
/** @domName AudioContext.createChannelMerger */
- AudioChannelMerger createChannelMerger([int numberOfInputs]);
+ ChannelMergerNode createChannelMerger([int numberOfInputs]);
/** @domName AudioContext.createChannelSplitter */
- AudioChannelSplitter createChannelSplitter([int numberOfOutputs]);
+ ChannelSplitterNode createChannelSplitter([int numberOfOutputs]);
/** @domName AudioContext.createConvolver */
ConvolverNode createConvolver();
- /** @domName AudioContext.createDelayNode */
- DelayNode createDelayNode([num maxDelayTime]);
+ /** @domName AudioContext.createDelay */
+ DelayNode createDelay([num maxDelayTime]);
/** @domName AudioContext.createDynamicsCompressor */
DynamicsCompressorNode createDynamicsCompressor();
- /** @domName AudioContext.createGainNode */
- AudioGainNode createGainNode();
-
- /** @domName AudioContext.createJavaScriptNode */
- JavaScriptAudioNode createJavaScriptNode(int bufferSize, [int numberOfInputChannels, int numberOfOutputChannels]);
+ /** @domName AudioContext.createGain */
+ GainNode createGain();
/** @domName AudioContext.createMediaElementSource */
MediaElementAudioSourceNode createMediaElementSource(MediaElement mediaElement);
@@ -790,10 +820,13 @@
MediaStreamAudioSourceNode createMediaStreamSource(MediaStream mediaStream);
/** @domName AudioContext.createOscillator */
- Oscillator createOscillator();
+ OscillatorNode createOscillator();
/** @domName AudioContext.createPanner */
- AudioPannerNode createPanner();
+ PannerNode createPanner();
+
+ /** @domName AudioContext.createScriptProcessor */
+ ScriptProcessorNode createScriptProcessor(int bufferSize, [int numberOfInputChannels, int numberOfOutputChannels]);
/** @domName AudioContext.createWaveShaper */
WaveShaperNode createWaveShaper();
@@ -828,7 +861,7 @@
final num sampleRate;
- _RealtimeAnalyserNodeImpl createAnalyser() native;
+ _AnalyserNodeImpl createAnalyser() native;
_BiquadFilterNodeImpl createBiquadFilter() native;
@@ -836,27 +869,27 @@
_AudioBufferSourceNodeImpl createBufferSource() native;
- _AudioChannelMergerImpl createChannelMerger([int numberOfInputs]) native;
+ _ChannelMergerNodeImpl createChannelMerger([int numberOfInputs]) native;
- _AudioChannelSplitterImpl createChannelSplitter([int numberOfOutputs]) native;
+ _ChannelSplitterNodeImpl createChannelSplitter([int numberOfOutputs]) native;
_ConvolverNodeImpl createConvolver() native;
- _DelayNodeImpl createDelayNode([num maxDelayTime]) native;
+ _DelayNodeImpl createDelay([num maxDelayTime]) native;
_DynamicsCompressorNodeImpl createDynamicsCompressor() native;
- _AudioGainNodeImpl createGainNode() native;
-
- _JavaScriptAudioNodeImpl createJavaScriptNode(int bufferSize, [int numberOfInputChannels, int numberOfOutputChannels]) native;
+ _GainNodeImpl createGain() native;
_MediaElementAudioSourceNodeImpl createMediaElementSource(_MediaElementImpl mediaElement) native;
_MediaStreamAudioSourceNodeImpl createMediaStreamSource(_MediaStreamImpl mediaStream) native;
- _OscillatorImpl createOscillator() native;
+ _OscillatorNodeImpl createOscillator() native;
- _AudioPannerNodeImpl createPanner() native;
+ _PannerNodeImpl createPanner() native;
+
+ _ScriptProcessorNodeImpl createScriptProcessor(int bufferSize, [int numberOfInputChannels, int numberOfOutputChannels]) native;
_WaveShaperNodeImpl createWaveShaper() native;
@@ -926,23 +959,6 @@
// WARNING: Do not edit - generated code.
-/// @domName AudioGainNode
-abstract class AudioGainNode implements AudioNode {
-
- /** @domName AudioGainNode.gain */
- AudioGain get gain;
-}
-
-class _AudioGainNodeImpl extends _AudioNodeImpl implements AudioGainNode native "*AudioGainNode" {
-
- final _AudioGainImpl gain;
-}
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-// WARNING: Do not edit - generated code.
-
/// @domName AudioListener
abstract class AudioListener {
@@ -1017,95 +1033,6 @@
// WARNING: Do not edit - generated code.
-/// @domName AudioPannerNode
-abstract class AudioPannerNode implements AudioNode {
-
- static const int EQUALPOWER = 0;
-
- static const int EXPONENTIAL_DISTANCE = 2;
-
- static const int HRTF = 1;
-
- static const int INVERSE_DISTANCE = 1;
-
- static const int LINEAR_DISTANCE = 0;
-
- static const int SOUNDFIELD = 2;
-
- /** @domName AudioPannerNode.coneGain */
- AudioGain get coneGain;
-
- /** @domName AudioPannerNode.coneInnerAngle */
- num coneInnerAngle;
-
- /** @domName AudioPannerNode.coneOuterAngle */
- num coneOuterAngle;
-
- /** @domName AudioPannerNode.coneOuterGain */
- num coneOuterGain;
-
- /** @domName AudioPannerNode.distanceGain */
- AudioGain get distanceGain;
-
- /** @domName AudioPannerNode.distanceModel */
- int distanceModel;
-
- /** @domName AudioPannerNode.maxDistance */
- num maxDistance;
-
- /** @domName AudioPannerNode.panningModel */
- int panningModel;
-
- /** @domName AudioPannerNode.refDistance */
- num refDistance;
-
- /** @domName AudioPannerNode.rolloffFactor */
- num rolloffFactor;
-
- /** @domName AudioPannerNode.setOrientation */
- void setOrientation(num x, num y, num z);
-
- /** @domName AudioPannerNode.setPosition */
- void setPosition(num x, num y, num z);
-
- /** @domName AudioPannerNode.setVelocity */
- void setVelocity(num x, num y, num z);
-}
-
-class _AudioPannerNodeImpl extends _AudioNodeImpl implements AudioPannerNode native "*AudioPannerNode" {
-
- final _AudioGainImpl coneGain;
-
- num coneInnerAngle;
-
- num coneOuterAngle;
-
- num coneOuterGain;
-
- final _AudioGainImpl distanceGain;
-
- int distanceModel;
-
- num maxDistance;
-
- int panningModel;
-
- num refDistance;
-
- num rolloffFactor;
-
- void setOrientation(num x, num y, num z) native;
-
- void setPosition(num x, num y, num z) native;
-
- void setVelocity(num x, num y, num z) native;
-}
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-// WARNING: Do not edit - generated code.
-
/// @domName AudioParam
abstract class AudioParam {
@@ -1136,8 +1063,8 @@
/** @domName AudioParam.linearRampToValueAtTime */
void linearRampToValueAtTime(num value, num time);
- /** @domName AudioParam.setTargetValueAtTime */
- void setTargetValueAtTime(num targetValue, num time, num timeConstant);
+ /** @domName AudioParam.setTargetAtTime */
+ void setTargetAtTime(num target, num time, num timeConstant);
/** @domName AudioParam.setValueAtTime */
void setValueAtTime(num value, num time);
@@ -1166,7 +1093,7 @@
void linearRampToValueAtTime(num value, num time) native;
- void setTargetValueAtTime(num targetValue, num time, num timeConstant) native;
+ void setTargetAtTime(num target, num time, num timeConstant) native;
void setValueAtTime(num value, num time) native;
@@ -7823,6 +7750,30 @@
// WARNING: Do not edit - generated code.
+/// @domName ChannelMergerNode
+abstract class ChannelMergerNode implements AudioNode {
+}
+
+class _ChannelMergerNodeImpl extends _AudioNodeImpl implements ChannelMergerNode native "*ChannelMergerNode" {
+}
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// WARNING: Do not edit - generated code.
+
+/// @domName ChannelSplitterNode
+abstract class ChannelSplitterNode implements AudioNode {
+}
+
+class _ChannelSplitterNodeImpl extends _AudioNodeImpl implements ChannelSplitterNode native "*ChannelSplitterNode" {
+}
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// WARNING: Do not edit - generated code.
+
/// @domName CharacterData
abstract class CharacterData implements Node {
@@ -8259,6 +8210,9 @@
/** @domName HTMLContentElement.select */
String select;
+
+ /** @domName HTMLContentElement.getDistributedNodes */
+ List<Node> getDistributedNodes();
}
class _ContentElementImpl extends _ElementImpl implements ContentElement native "*HTMLContentElement" {
@@ -8266,6 +8220,8 @@
bool resetStyleInheritance;
String select;
+
+ List<Node> getDistributedNodes() 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
@@ -9313,7 +9269,7 @@
String toString();
/** @domName DOMTokenList.toggle */
- bool toggle(String token);
+ bool toggle(String token, [bool force]);
}
class _DOMTokenListImpl implements DOMTokenList native "*DOMTokenList" {
@@ -9326,7 +9282,7 @@
String toString() native;
- bool toggle(String token) native;
+ bool toggle(String token, [bool force]) 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
@@ -14484,6 +14440,23 @@
// WARNING: Do not edit - generated code.
+/// @domName GainNode
+abstract class GainNode implements AudioNode {
+
+ /** @domName GainNode.gain */
+ AudioGain get gain;
+}
+
+class _GainNodeImpl extends _AudioNodeImpl implements GainNode native "*GainNode" {
+
+ final _AudioGainImpl gain;
+}
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// WARNING: Do not edit - generated code.
+
/// @domName Gamepad
abstract class Gamepad {
@@ -15047,7 +15020,7 @@
_HttpRequestFactoryProvider.createHttpRequest_get(url, onSuccess);
factory HttpRequest.getWithCredentials(String url, onSuccess(HttpRequest request)) =>
- _HttpRequestFactoryProvider.createHttpRequestgetWithCredentials(url, onSuccess);
+ _HttpRequestFactoryProvider.createHttpRequest_getWithCredentials(url, onSuccess);
factory HttpRequest() => _HttpRequestFactoryProvider.createHttpRequest();
@@ -15359,10 +15332,10 @@
String get direction;
/** @domName IDBCursor.key */
- dynamic get key;
+ Object get key;
/** @domName IDBCursor.primaryKey */
- dynamic get primaryKey;
+ Object get primaryKey;
/** @domName IDBCursor.source */
dynamic get source;
@@ -15384,11 +15357,9 @@
final String direction;
- dynamic get key => _convertNativeToDart_IDBKey(this._key);
- dynamic get _key => JS("dynamic", "#.key", this);
+ final Object key;
- dynamic get primaryKey => _convertNativeToDart_IDBKey(this._primaryKey);
- dynamic get _primaryKey => JS("dynamic", "#.primaryKey", this);
+ final Object primaryKey;
final dynamic source;
@@ -15424,13 +15395,12 @@
abstract class IDBCursorWithValue implements IDBCursor {
/** @domName IDBCursorWithValue.value */
- dynamic get value;
+ Object get value;
}
class _IDBCursorWithValueImpl extends _IDBCursorImpl implements IDBCursorWithValue native "*IDBCursorWithValue" {
- dynamic get value => _convertNativeToDart_IDBAny(this._value);
- dynamic get _value => JS("dynamic", "#.value", this);
+ final Object value;
}
// 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
@@ -16191,14 +16161,6 @@
_IDBOpenDBRequestEventsImpl get on =>
new _IDBOpenDBRequestEventsImpl(this);
-
- // From EventTarget
-
- void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native "addEventListener";
-
- bool $dom_dispatchEvent(_EventImpl event) native "dispatchEvent";
-
- void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native "removeEventListener";
}
class _IDBOpenDBRequestEventsImpl extends _IDBRequestEventsImpl implements IDBOpenDBRequestEvents {
@@ -16442,14 +16404,6 @@
_IDBVersionChangeRequestEventsImpl get on =>
new _IDBVersionChangeRequestEventsImpl(this);
-
- // From EventTarget
-
- void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native "addEventListener";
-
- bool $dom_dispatchEvent(_EventImpl event) native "dispatchEvent";
-
- void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native "removeEventListener";
}
class _IDBVersionChangeRequestEventsImpl extends _IDBRequestEventsImpl implements IDBVersionChangeRequestEvents {
@@ -16761,6 +16715,9 @@
/** @domName HTMLInputElement.defaultValue */
String defaultValue;
+ /** @domName HTMLInputElement.dirName */
+ String dirName;
+
/** @domName HTMLInputElement.disabled */
bool disabled;
@@ -16893,6 +16850,9 @@
/** @domName HTMLInputElement.setCustomValidity */
void setCustomValidity(String error);
+ /** @domName HTMLInputElement.setRangeText */
+ void setRangeText(String replacement, [int start, int end, String selectionMode]);
+
/** @domName HTMLInputElement.setSelectionRange */
void setSelectionRange(int start, int end, [String direction]);
@@ -16929,6 +16889,8 @@
String defaultValue;
+ String dirName;
+
bool disabled;
_FileListImpl files;
@@ -17017,6 +16979,8 @@
void setCustomValidity(String error) native;
+ void setRangeText(String replacement, [int start, int end, String selectionMode]) native;
+
void setSelectionRange(int start, int end, [String direction]) native;
void stepDown([int n]) native;
@@ -17392,50 +17356,6 @@
// WARNING: Do not edit - generated code.
-/// @domName JavaScriptAudioNode
-abstract class JavaScriptAudioNode implements AudioNode, EventTarget {
-
- /**
- * @domName EventTarget.addEventListener, EventTarget.removeEventListener, EventTarget.dispatchEvent
- */
- JavaScriptAudioNodeEvents get on;
-
- /** @domName JavaScriptAudioNode.bufferSize */
- int get bufferSize;
-}
-
-abstract class JavaScriptAudioNodeEvents implements Events {
-
- EventListenerList get audioProcess;
-}
-
-class _JavaScriptAudioNodeImpl extends _AudioNodeImpl implements JavaScriptAudioNode native "*JavaScriptAudioNode" {
-
- _JavaScriptAudioNodeEventsImpl get on =>
- new _JavaScriptAudioNodeEventsImpl(this);
-
- final int bufferSize;
-
- // From EventTarget
-
- void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native "addEventListener";
-
- bool $dom_dispatchEvent(_EventImpl event) native "dispatchEvent";
-
- void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native "removeEventListener";
-}
-
-class _JavaScriptAudioNodeEventsImpl extends _EventsImpl implements JavaScriptAudioNodeEvents {
- _JavaScriptAudioNodeEventsImpl(_ptr) : super(_ptr);
-
- EventListenerList get audioProcess => this['audioprocess'];
-}
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-// WARNING: Do not edit - generated code.
-
/// @domName JavaScriptCallFrame
abstract class JavaScriptCallFrame {
@@ -17929,14 +17849,6 @@
class _LocalMediaStreamImpl extends _MediaStreamImpl implements LocalMediaStream native "*LocalMediaStream" {
void stop() native;
-
- // From EventTarget
-
- void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native "addEventListener";
-
- bool $dom_dispatchEvent(_EventImpl event) native "dispatchEvent";
-
- void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native "removeEventListener";
}
// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
@@ -21863,6 +21775,18 @@
// WARNING: Do not edit - generated code.
+/// @domName OESElementIndexUint
+abstract class OESElementIndexUint {
+}
+
+class _OESElementIndexUintImpl implements OESElementIndexUint native "*OESElementIndexUint" {
+}
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// WARNING: Do not edit - generated code.
+
/// @domName OESStandardDerivatives
abstract class OESStandardDerivatives {
@@ -22185,8 +22109,8 @@
// WARNING: Do not edit - generated code.
-/// @domName Oscillator
-abstract class Oscillator implements AudioSourceNode {
+/// @domName OscillatorNode
+abstract class OscillatorNode implements AudioSourceNode {
static const int CUSTOM = 4;
@@ -22206,29 +22130,29 @@
static const int UNSCHEDULED_STATE = 0;
- /** @domName Oscillator.detune */
+ /** @domName OscillatorNode.detune */
AudioParam get detune;
- /** @domName Oscillator.frequency */
+ /** @domName OscillatorNode.frequency */
AudioParam get frequency;
- /** @domName Oscillator.playbackState */
+ /** @domName OscillatorNode.playbackState */
int get playbackState;
- /** @domName Oscillator.type */
+ /** @domName OscillatorNode.type */
int type;
- /** @domName Oscillator.setWaveTable */
+ /** @domName OscillatorNode.setWaveTable */
void setWaveTable(WaveTable waveTable);
- /** @domName Oscillator.start */
+ /** @domName OscillatorNode.start */
void start(num when);
- /** @domName Oscillator.stop */
+ /** @domName OscillatorNode.stop */
void stop(num when);
}
-class _OscillatorImpl extends _AudioSourceNodeImpl implements Oscillator native "*Oscillator" {
+class _OscillatorNodeImpl extends _AudioSourceNodeImpl implements OscillatorNode native "*OscillatorNode" {
final _AudioParamImpl detune;
@@ -22396,6 +22320,95 @@
// WARNING: Do not edit - generated code.
+/// @domName PannerNode
+abstract class PannerNode implements AudioNode {
+
+ static const int EQUALPOWER = 0;
+
+ static const int EXPONENTIAL_DISTANCE = 2;
+
+ static const int HRTF = 1;
+
+ static const int INVERSE_DISTANCE = 1;
+
+ static const int LINEAR_DISTANCE = 0;
+
+ static const int SOUNDFIELD = 2;
+
+ /** @domName PannerNode.coneGain */
+ AudioGain get coneGain;
+
+ /** @domName PannerNode.coneInnerAngle */
+ num coneInnerAngle;
+
+ /** @domName PannerNode.coneOuterAngle */
+ num coneOuterAngle;
+
+ /** @domName PannerNode.coneOuterGain */
+ num coneOuterGain;
+
+ /** @domName PannerNode.distanceGain */
+ AudioGain get distanceGain;
+
+ /** @domName PannerNode.distanceModel */
+ int distanceModel;
+
+ /** @domName PannerNode.maxDistance */
+ num maxDistance;
+
+ /** @domName PannerNode.panningModel */
+ int panningModel;
+
+ /** @domName PannerNode.refDistance */
+ num refDistance;
+
+ /** @domName PannerNode.rolloffFactor */
+ num rolloffFactor;
+
+ /** @domName PannerNode.setOrientation */
+ void setOrientation(num x, num y, num z);
+
+ /** @domName PannerNode.setPosition */
+ void setPosition(num x, num y, num z);
+
+ /** @domName PannerNode.setVelocity */
+ void setVelocity(num x, num y, num z);
+}
+
+class _PannerNodeImpl extends _AudioNodeImpl implements PannerNode native "*PannerNode" {
+
+ final _AudioGainImpl coneGain;
+
+ num coneInnerAngle;
+
+ num coneOuterAngle;
+
+ num coneOuterGain;
+
+ final _AudioGainImpl distanceGain;
+
+ int distanceModel;
+
+ num maxDistance;
+
+ int panningModel;
+
+ num refDistance;
+
+ num rolloffFactor;
+
+ void setOrientation(num x, num y, num z) native;
+
+ void setPosition(num x, num y, num z) native;
+
+ void setVelocity(num x, num y, num z) native;
+}
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// WARNING: Do not edit - generated code.
+
/// @domName HTMLParagraphElement
abstract class ParagraphElement implements Element {
@@ -23277,7 +23290,7 @@
void addIceCandidate(RTCIceCandidate candidate);
/** @domName RTCPeerConnection.addStream */
- void addStream(MediaStream stream, Map mediaConstraints);
+ void addStream(MediaStream stream, [Map mediaConstraints]);
/** @domName RTCPeerConnection.close */
void close();
@@ -23286,7 +23299,7 @@
void createAnswer(RTCSessionDescriptionCallback successCallback, [RTCErrorCallback failureCallback, Map mediaConstraints]);
/** @domName RTCPeerConnection.createDataChannel */
- RTCDataChannel createDataChannel(String label, Map options);
+ RTCDataChannel createDataChannel(String label, [Map options]);
/** @domName RTCPeerConnection.createOffer */
void createOffer(RTCSessionDescriptionCallback successCallback, [RTCErrorCallback failureCallback, Map mediaConstraints]);
@@ -23310,7 +23323,7 @@
void setRemoteDescription(RTCSessionDescription description, [VoidCallback successCallback, RTCErrorCallback failureCallback]);
/** @domName RTCPeerConnection.updateIce */
- void updateIce(Map configuration, Map mediaConstraints);
+ void updateIce([Map configuration, Map mediaConstraints]);
}
abstract class RTCPeerConnectionEvents implements Events {
@@ -23351,34 +23364,53 @@
void addIceCandidate(_RTCIceCandidateImpl candidate) native;
- void addStream(_MediaStreamImpl stream, Map mediaConstraints) {
- var mediaConstraints_1 = _convertDartToNative_Dictionary(mediaConstraints);
- _addStream_1(stream, mediaConstraints_1);
+ void addStream(_MediaStreamImpl stream, [mediaConstraints]) {
+ if (?mediaConstraints) {
+ var mediaConstraints_1 = _convertDartToNative_Dictionary(mediaConstraints);
+ _addStream_1(stream, mediaConstraints_1);
+ return;
+ }
+ _addStream_2(stream);
return;
}
void _addStream_1(_MediaStreamImpl stream, mediaConstraints) native "addStream";
+ void _addStream_2(_MediaStreamImpl stream) native "addStream";
void close() native;
void createAnswer(RTCSessionDescriptionCallback successCallback, [failureCallback, mediaConstraints]) {
- var mediaConstraints_1 = _convertDartToNative_Dictionary(mediaConstraints);
- _createAnswer_1(successCallback, failureCallback, mediaConstraints_1);
+ if (?mediaConstraints) {
+ var mediaConstraints_1 = _convertDartToNative_Dictionary(mediaConstraints);
+ _createAnswer_1(successCallback, failureCallback, mediaConstraints_1);
+ return;
+ }
+ _createAnswer_2(successCallback, failureCallback);
return;
}
void _createAnswer_1(RTCSessionDescriptionCallback successCallback, RTCErrorCallback failureCallback, mediaConstraints) native "createAnswer";
+ void _createAnswer_2(RTCSessionDescriptionCallback successCallback, RTCErrorCallback failureCallback) native "createAnswer";
- _RTCDataChannelImpl createDataChannel(String label, Map options) {
- var options_1 = _convertDartToNative_Dictionary(options);
- return _createDataChannel_1(label, options_1);
+ _RTCDataChannelImpl createDataChannel(String label, [options]) {
+ if (?options) {
+ var options_1 = _convertDartToNative_Dictionary(options);
+ return _createDataChannel_1(label, options_1);
+ }
+ return _createDataChannel_2(label);
}
_RTCDataChannelImpl _createDataChannel_1(label, options) native "createDataChannel";
+ _RTCDataChannelImpl _createDataChannel_2(label) native "createDataChannel";
void createOffer(RTCSessionDescriptionCallback successCallback, [failureCallback, mediaConstraints]) {
- var mediaConstraints_1 = _convertDartToNative_Dictionary(mediaConstraints);
- _createOffer_1(successCallback, failureCallback, mediaConstraints_1);
+ if (?mediaConstraints) {
+ var mediaConstraints_1 = _convertDartToNative_Dictionary(mediaConstraints);
+ _createOffer_1(successCallback, failureCallback, mediaConstraints_1);
+ return;
+ }
+ _createOffer_2(successCallback, failureCallback);
return;
}
void _createOffer_1(RTCSessionDescriptionCallback successCallback, RTCErrorCallback failureCallback, mediaConstraints) native "createOffer";
+ void _createOffer_2(RTCSessionDescriptionCallback successCallback, RTCErrorCallback failureCallback) native "createOffer";
bool $dom_dispatchEvent(_EventImpl event) native "dispatchEvent";
@@ -23392,13 +23424,24 @@
void setRemoteDescription(_RTCSessionDescriptionImpl description, [VoidCallback successCallback, RTCErrorCallback failureCallback]) native;
- void updateIce(Map configuration, Map mediaConstraints) {
- var configuration_1 = _convertDartToNative_Dictionary(configuration);
- var mediaConstraints_2 = _convertDartToNative_Dictionary(mediaConstraints);
- _updateIce_1(configuration_1, mediaConstraints_2);
+ void updateIce([configuration, mediaConstraints]) {
+ if (?mediaConstraints) {
+ var configuration_1 = _convertDartToNative_Dictionary(configuration);
+ var mediaConstraints_2 = _convertDartToNative_Dictionary(mediaConstraints);
+ _updateIce_1(configuration_1, mediaConstraints_2);
+ return;
+ }
+ if (?configuration) {
+ var configuration_3 = _convertDartToNative_Dictionary(configuration);
+ _updateIce_2(configuration_3);
+ return;
+ }
+ _updateIce_3();
return;
}
void _updateIce_1(configuration, mediaConstraints) native "updateIce";
+ void _updateIce_2(configuration) native "updateIce";
+ void _updateIce_3() native "updateIce";
}
class _RTCPeerConnectionEventsImpl extends _EventsImpl implements RTCPeerConnectionEvents {
@@ -23761,58 +23804,6 @@
// WARNING: Do not edit - generated code.
-/// @domName RealtimeAnalyserNode
-abstract class RealtimeAnalyserNode implements AudioNode {
-
- /** @domName RealtimeAnalyserNode.fftSize */
- int fftSize;
-
- /** @domName RealtimeAnalyserNode.frequencyBinCount */
- int get frequencyBinCount;
-
- /** @domName RealtimeAnalyserNode.maxDecibels */
- num maxDecibels;
-
- /** @domName RealtimeAnalyserNode.minDecibels */
- num minDecibels;
-
- /** @domName RealtimeAnalyserNode.smoothingTimeConstant */
- num smoothingTimeConstant;
-
- /** @domName RealtimeAnalyserNode.getByteFrequencyData */
- void getByteFrequencyData(Uint8Array array);
-
- /** @domName RealtimeAnalyserNode.getByteTimeDomainData */
- void getByteTimeDomainData(Uint8Array array);
-
- /** @domName RealtimeAnalyserNode.getFloatFrequencyData */
- void getFloatFrequencyData(Float32Array array);
-}
-
-class _RealtimeAnalyserNodeImpl extends _AudioNodeImpl implements RealtimeAnalyserNode native "*RealtimeAnalyserNode" {
-
- int fftSize;
-
- final int frequencyBinCount;
-
- num maxDecibels;
-
- num minDecibels;
-
- num smoothingTimeConstant;
-
- void getByteFrequencyData(_Uint8ArrayImpl array) native;
-
- void getByteTimeDomainData(_Uint8ArrayImpl array) native;
-
- void getFloatFrequencyData(_Float32ArrayImpl array) 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.
-
-// WARNING: Do not edit - generated code.
-
/// @domName Rect
abstract class Rect {
@@ -24149,19 +24140,9 @@
final _SVGAnimatedStringImpl target;
- // From SVGURIReference
+ // From SVGExternalResourcesRequired
- final _SVGAnimatedStringImpl href;
-
- // From SVGTests
-
- final _SVGStringListImpl requiredExtensions;
-
- final _SVGStringListImpl requiredFeatures;
-
- final _SVGStringListImpl systemLanguage;
-
- bool hasExtension(String extension) native;
+ final _SVGAnimatedBooleanImpl externalResourcesRequired;
// From SVGLangSpace
@@ -24169,23 +24150,6 @@
String xmlspace;
- // From SVGExternalResourcesRequired
-
- final _SVGAnimatedBooleanImpl externalResourcesRequired;
-
- // From SVGStylable
-
- _SVGAnimatedStringImpl get $dom_svgClassName => JS("_SVGAnimatedStringImpl", "#.className", this);
-
- // Use implementation from Element.
- // final _CSSStyleDeclarationImpl style;
-
- _CSSValueImpl getPresentationAttribute(String name) native;
-
- // From SVGTransformable
-
- final _SVGAnimatedTransformListImpl transform;
-
// From SVGLocatable
final _SVGElementImpl farthestViewportElement;
@@ -24199,6 +24163,33 @@
_SVGMatrixImpl getScreenCTM() native;
_SVGMatrixImpl getTransformToElement(_SVGElementImpl element) native;
+
+ // From SVGStylable
+
+ _SVGAnimatedStringImpl get $dom_svgClassName => JS("_SVGAnimatedStringImpl", "#.className", this);
+
+ // Use implementation from Element.
+ // final _CSSStyleDeclarationImpl style;
+
+ _CSSValueImpl getPresentationAttribute(String name) native;
+
+ // From SVGTests
+
+ final _SVGStringListImpl requiredExtensions;
+
+ final _SVGStringListImpl requiredFeatures;
+
+ final _SVGStringListImpl systemLanguage;
+
+ bool hasExtension(String extension) native;
+
+ // From SVGTransformable
+
+ final _SVGAnimatedTransformListImpl transform;
+
+ // From SVGURIReference
+
+ final _SVGAnimatedStringImpl href;
}
// 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
@@ -24895,20 +24886,6 @@
num getStartTime() native;
- // From SVGTests
-
- final _SVGStringListImpl requiredExtensions;
-
- final _SVGStringListImpl requiredFeatures;
-
- final _SVGStringListImpl systemLanguage;
-
- bool hasExtension(String extension) native;
-
- // From SVGExternalResourcesRequired
-
- final _SVGAnimatedBooleanImpl externalResourcesRequired;
-
// From ElementTimeControl
void beginElement() native;
@@ -24918,6 +24895,20 @@
void endElement() native;
void endElementAt(num offset) native;
+
+ // From SVGExternalResourcesRequired
+
+ final _SVGAnimatedBooleanImpl externalResourcesRequired;
+
+ // From SVGTests
+
+ final _SVGStringListImpl requiredExtensions;
+
+ final _SVGStringListImpl requiredFeatures;
+
+ final _SVGStringListImpl systemLanguage;
+
+ bool hasExtension(String extension) native;
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
@@ -24946,15 +24937,9 @@
final _SVGAnimatedLengthImpl r;
- // From SVGTests
+ // From SVGExternalResourcesRequired
- final _SVGStringListImpl requiredExtensions;
-
- final _SVGStringListImpl requiredFeatures;
-
- final _SVGStringListImpl systemLanguage;
-
- bool hasExtension(String extension) native;
+ final _SVGAnimatedBooleanImpl externalResourcesRequired;
// From SVGLangSpace
@@ -24962,23 +24947,6 @@
String xmlspace;
- // From SVGExternalResourcesRequired
-
- final _SVGAnimatedBooleanImpl externalResourcesRequired;
-
- // From SVGStylable
-
- _SVGAnimatedStringImpl get $dom_svgClassName => JS("_SVGAnimatedStringImpl", "#.className", this);
-
- // Use implementation from Element.
- // final _CSSStyleDeclarationImpl style;
-
- _CSSValueImpl getPresentationAttribute(String name) native;
-
- // From SVGTransformable
-
- final _SVGAnimatedTransformListImpl transform;
-
// From SVGLocatable
final _SVGElementImpl farthestViewportElement;
@@ -24992,6 +24960,29 @@
_SVGMatrixImpl getScreenCTM() native;
_SVGMatrixImpl getTransformToElement(_SVGElementImpl element) native;
+
+ // From SVGStylable
+
+ _SVGAnimatedStringImpl get $dom_svgClassName => JS("_SVGAnimatedStringImpl", "#.className", this);
+
+ // Use implementation from Element.
+ // final _CSSStyleDeclarationImpl style;
+
+ _CSSValueImpl getPresentationAttribute(String name) native;
+
+ // From SVGTests
+
+ final _SVGStringListImpl requiredExtensions;
+
+ final _SVGStringListImpl requiredFeatures;
+
+ final _SVGStringListImpl systemLanguage;
+
+ bool hasExtension(String extension) native;
+
+ // From SVGTransformable
+
+ final _SVGAnimatedTransformListImpl transform;
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
@@ -25010,15 +25001,9 @@
final _SVGAnimatedEnumerationImpl clipPathUnits;
- // From SVGTests
+ // From SVGExternalResourcesRequired
- final _SVGStringListImpl requiredExtensions;
-
- final _SVGStringListImpl requiredFeatures;
-
- final _SVGStringListImpl systemLanguage;
-
- bool hasExtension(String extension) native;
+ final _SVGAnimatedBooleanImpl externalResourcesRequired;
// From SVGLangSpace
@@ -25026,23 +25011,6 @@
String xmlspace;
- // From SVGExternalResourcesRequired
-
- final _SVGAnimatedBooleanImpl externalResourcesRequired;
-
- // From SVGStylable
-
- _SVGAnimatedStringImpl get $dom_svgClassName => JS("_SVGAnimatedStringImpl", "#.className", this);
-
- // Use implementation from Element.
- // final _CSSStyleDeclarationImpl style;
-
- _CSSValueImpl getPresentationAttribute(String name) native;
-
- // From SVGTransformable
-
- final _SVGAnimatedTransformListImpl transform;
-
// From SVGLocatable
final _SVGElementImpl farthestViewportElement;
@@ -25056,6 +25024,29 @@
_SVGMatrixImpl getScreenCTM() native;
_SVGMatrixImpl getTransformToElement(_SVGElementImpl element) native;
+
+ // From SVGStylable
+
+ _SVGAnimatedStringImpl get $dom_svgClassName => JS("_SVGAnimatedStringImpl", "#.className", this);
+
+ // Use implementation from Element.
+ // final _CSSStyleDeclarationImpl style;
+
+ _CSSValueImpl getPresentationAttribute(String name) native;
+
+ // From SVGTests
+
+ final _SVGStringListImpl requiredExtensions;
+
+ final _SVGStringListImpl requiredFeatures;
+
+ final _SVGStringListImpl systemLanguage;
+
+ bool hasExtension(String extension) native;
+
+ // From SVGTransformable
+
+ final _SVGAnimatedTransformListImpl transform;
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
@@ -25183,9 +25174,9 @@
final _SVGAnimatedLengthImpl y;
- // From SVGURIReference
+ // From SVGExternalResourcesRequired
- final _SVGAnimatedStringImpl href;
+ final _SVGAnimatedBooleanImpl externalResourcesRequired;
// From SVGTests
@@ -25197,9 +25188,9 @@
bool hasExtension(String extension) native;
- // From SVGExternalResourcesRequired
+ // From SVGURIReference
- final _SVGAnimatedBooleanImpl externalResourcesRequired;
+ final _SVGAnimatedStringImpl href;
}
// 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
@@ -25213,15 +25204,9 @@
class _SVGDefsElementImpl extends _SVGElementImpl implements SVGDefsElement native "*SVGDefsElement" {
- // From SVGTests
+ // From SVGExternalResourcesRequired
- final _SVGStringListImpl requiredExtensions;
-
- final _SVGStringListImpl requiredFeatures;
-
- final _SVGStringListImpl systemLanguage;
-
- bool hasExtension(String extension) native;
+ final _SVGAnimatedBooleanImpl externalResourcesRequired;
// From SVGLangSpace
@@ -25229,23 +25214,6 @@
String xmlspace;
- // From SVGExternalResourcesRequired
-
- final _SVGAnimatedBooleanImpl externalResourcesRequired;
-
- // From SVGStylable
-
- _SVGAnimatedStringImpl get $dom_svgClassName => JS("_SVGAnimatedStringImpl", "#.className", this);
-
- // Use implementation from Element.
- // final _CSSStyleDeclarationImpl style;
-
- _CSSValueImpl getPresentationAttribute(String name) native;
-
- // From SVGTransformable
-
- final _SVGAnimatedTransformListImpl transform;
-
// From SVGLocatable
final _SVGElementImpl farthestViewportElement;
@@ -25259,6 +25227,29 @@
_SVGMatrixImpl getScreenCTM() native;
_SVGMatrixImpl getTransformToElement(_SVGElementImpl element) native;
+
+ // From SVGStylable
+
+ _SVGAnimatedStringImpl get $dom_svgClassName => JS("_SVGAnimatedStringImpl", "#.className", this);
+
+ // Use implementation from Element.
+ // final _CSSStyleDeclarationImpl style;
+
+ _CSSValueImpl getPresentationAttribute(String name) native;
+
+ // From SVGTests
+
+ final _SVGStringListImpl requiredExtensions;
+
+ final _SVGStringListImpl requiredFeatures;
+
+ final _SVGStringListImpl systemLanguage;
+
+ bool hasExtension(String extension) native;
+
+ // From SVGTransformable
+
+ final _SVGAnimatedTransformListImpl transform;
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
@@ -25754,15 +25745,9 @@
final _SVGAnimatedLengthImpl ry;
- // From SVGTests
+ // From SVGExternalResourcesRequired
- final _SVGStringListImpl requiredExtensions;
-
- final _SVGStringListImpl requiredFeatures;
-
- final _SVGStringListImpl systemLanguage;
-
- bool hasExtension(String extension) native;
+ final _SVGAnimatedBooleanImpl externalResourcesRequired;
// From SVGLangSpace
@@ -25770,23 +25755,6 @@
String xmlspace;
- // From SVGExternalResourcesRequired
-
- final _SVGAnimatedBooleanImpl externalResourcesRequired;
-
- // From SVGStylable
-
- _SVGAnimatedStringImpl get $dom_svgClassName => JS("_SVGAnimatedStringImpl", "#.className", this);
-
- // Use implementation from Element.
- // final _CSSStyleDeclarationImpl style;
-
- _CSSValueImpl getPresentationAttribute(String name) native;
-
- // From SVGTransformable
-
- final _SVGAnimatedTransformListImpl transform;
-
// From SVGLocatable
final _SVGElementImpl farthestViewportElement;
@@ -25800,6 +25768,29 @@
_SVGMatrixImpl getScreenCTM() native;
_SVGMatrixImpl getTransformToElement(_SVGElementImpl element) native;
+
+ // From SVGStylable
+
+ _SVGAnimatedStringImpl get $dom_svgClassName => JS("_SVGAnimatedStringImpl", "#.className", this);
+
+ // Use implementation from Element.
+ // final _CSSStyleDeclarationImpl style;
+
+ _CSSValueImpl getPresentationAttribute(String name) native;
+
+ // From SVGTests
+
+ final _SVGStringListImpl requiredExtensions;
+
+ final _SVGStringListImpl requiredFeatures;
+
+ final _SVGStringListImpl systemLanguage;
+
+ bool hasExtension(String extension) native;
+
+ // From SVGTransformable
+
+ final _SVGAnimatedTransformListImpl transform;
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
@@ -26552,16 +26543,6 @@
final _SVGAnimatedPreserveAspectRatioImpl preserveAspectRatio;
- // From SVGURIReference
-
- final _SVGAnimatedStringImpl href;
-
- // From SVGLangSpace
-
- String xmllang;
-
- String xmlspace;
-
// From SVGExternalResourcesRequired
final _SVGAnimatedBooleanImpl externalResourcesRequired;
@@ -26578,6 +26559,12 @@
final _SVGAnimatedLengthImpl y;
+ // From SVGLangSpace
+
+ String xmllang;
+
+ String xmlspace;
+
// From SVGStylable
_SVGAnimatedStringImpl get $dom_svgClassName => JS("_SVGAnimatedStringImpl", "#.className", this);
@@ -26586,6 +26573,10 @@
// final _CSSStyleDeclarationImpl style;
_CSSValueImpl getPresentationAttribute(String name) native;
+
+ // From SVGURIReference
+
+ final _SVGAnimatedStringImpl href;
}
// 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
@@ -27051,9 +27042,9 @@
void setFilterRes(int filterResX, int filterResY) native;
- // From SVGURIReference
+ // From SVGExternalResourcesRequired
- final _SVGAnimatedStringImpl href;
+ final _SVGAnimatedBooleanImpl externalResourcesRequired;
// From SVGLangSpace
@@ -27061,10 +27052,6 @@
String xmlspace;
- // From SVGExternalResourcesRequired
-
- final _SVGAnimatedBooleanImpl externalResourcesRequired;
-
// From SVGStylable
_SVGAnimatedStringImpl get $dom_svgClassName => JS("_SVGAnimatedStringImpl", "#.className", this);
@@ -27073,6 +27060,10 @@
// final _CSSStyleDeclarationImpl style;
_CSSValueImpl getPresentationAttribute(String name) native;
+
+ // From SVGURIReference
+
+ final _SVGAnimatedStringImpl href;
}
// 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
@@ -27217,15 +27208,9 @@
final _SVGAnimatedLengthImpl y;
- // From SVGTests
+ // From SVGExternalResourcesRequired
- final _SVGStringListImpl requiredExtensions;
-
- final _SVGStringListImpl requiredFeatures;
-
- final _SVGStringListImpl systemLanguage;
-
- bool hasExtension(String extension) native;
+ final _SVGAnimatedBooleanImpl externalResourcesRequired;
// From SVGLangSpace
@@ -27233,23 +27218,6 @@
String xmlspace;
- // From SVGExternalResourcesRequired
-
- final _SVGAnimatedBooleanImpl externalResourcesRequired;
-
- // From SVGStylable
-
- _SVGAnimatedStringImpl get $dom_svgClassName => JS("_SVGAnimatedStringImpl", "#.className", this);
-
- // Use implementation from Element.
- // final _CSSStyleDeclarationImpl style;
-
- _CSSValueImpl getPresentationAttribute(String name) native;
-
- // From SVGTransformable
-
- final _SVGAnimatedTransformListImpl transform;
-
// From SVGLocatable
final _SVGElementImpl farthestViewportElement;
@@ -27263,6 +27231,29 @@
_SVGMatrixImpl getScreenCTM() native;
_SVGMatrixImpl getTransformToElement(_SVGElementImpl element) native;
+
+ // From SVGStylable
+
+ _SVGAnimatedStringImpl get $dom_svgClassName => JS("_SVGAnimatedStringImpl", "#.className", this);
+
+ // Use implementation from Element.
+ // final _CSSStyleDeclarationImpl style;
+
+ _CSSValueImpl getPresentationAttribute(String name) native;
+
+ // From SVGTests
+
+ final _SVGStringListImpl requiredExtensions;
+
+ final _SVGStringListImpl requiredFeatures;
+
+ final _SVGStringListImpl systemLanguage;
+
+ bool hasExtension(String extension) native;
+
+ // From SVGTransformable
+
+ final _SVGAnimatedTransformListImpl transform;
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
@@ -27276,15 +27267,9 @@
class _SVGGElementImpl extends _SVGElementImpl implements SVGGElement native "*SVGGElement" {
- // From SVGTests
+ // From SVGExternalResourcesRequired
- final _SVGStringListImpl requiredExtensions;
-
- final _SVGStringListImpl requiredFeatures;
-
- final _SVGStringListImpl systemLanguage;
-
- bool hasExtension(String extension) native;
+ final _SVGAnimatedBooleanImpl externalResourcesRequired;
// From SVGLangSpace
@@ -27292,23 +27277,6 @@
String xmlspace;
- // From SVGExternalResourcesRequired
-
- final _SVGAnimatedBooleanImpl externalResourcesRequired;
-
- // From SVGStylable
-
- _SVGAnimatedStringImpl get $dom_svgClassName => JS("_SVGAnimatedStringImpl", "#.className", this);
-
- // Use implementation from Element.
- // final _CSSStyleDeclarationImpl style;
-
- _CSSValueImpl getPresentationAttribute(String name) native;
-
- // From SVGTransformable
-
- final _SVGAnimatedTransformListImpl transform;
-
// From SVGLocatable
final _SVGElementImpl farthestViewportElement;
@@ -27322,6 +27290,29 @@
_SVGMatrixImpl getScreenCTM() native;
_SVGMatrixImpl getTransformToElement(_SVGElementImpl element) native;
+
+ // From SVGStylable
+
+ _SVGAnimatedStringImpl get $dom_svgClassName => JS("_SVGAnimatedStringImpl", "#.className", this);
+
+ // Use implementation from Element.
+ // final _CSSStyleDeclarationImpl style;
+
+ _CSSValueImpl getPresentationAttribute(String name) native;
+
+ // From SVGTests
+
+ final _SVGStringListImpl requiredExtensions;
+
+ final _SVGStringListImpl requiredFeatures;
+
+ final _SVGStringListImpl systemLanguage;
+
+ bool hasExtension(String extension) native;
+
+ // From SVGTransformable
+
+ final _SVGAnimatedTransformListImpl transform;
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
@@ -27377,10 +27368,6 @@
num y;
- // From SVGURIReference
-
- final _SVGAnimatedStringImpl href;
-
// From SVGStylable
_SVGAnimatedStringImpl get $dom_svgClassName => JS("_SVGAnimatedStringImpl", "#.className", this);
@@ -27389,6 +27376,10 @@
// final _CSSStyleDeclarationImpl style;
_CSSValueImpl getPresentationAttribute(String name) native;
+
+ // From SVGURIReference
+
+ final _SVGAnimatedStringImpl href;
}
// 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
@@ -27425,10 +27416,6 @@
final _SVGAnimatedEnumerationImpl spreadMethod;
- // From SVGURIReference
-
- final _SVGAnimatedStringImpl href;
-
// From SVGExternalResourcesRequired
final _SVGAnimatedBooleanImpl externalResourcesRequired;
@@ -27441,6 +27428,10 @@
// final _CSSStyleDeclarationImpl style;
_CSSValueImpl getPresentationAttribute(String name) native;
+
+ // From SVGURIReference
+
+ final _SVGAnimatedStringImpl href;
}
// 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
@@ -27491,19 +27482,9 @@
final _SVGAnimatedLengthImpl y;
- // From SVGURIReference
+ // From SVGExternalResourcesRequired
- final _SVGAnimatedStringImpl href;
-
- // From SVGTests
-
- final _SVGStringListImpl requiredExtensions;
-
- final _SVGStringListImpl requiredFeatures;
-
- final _SVGStringListImpl systemLanguage;
-
- bool hasExtension(String extension) native;
+ final _SVGAnimatedBooleanImpl externalResourcesRequired;
// From SVGLangSpace
@@ -27511,23 +27492,6 @@
String xmlspace;
- // From SVGExternalResourcesRequired
-
- final _SVGAnimatedBooleanImpl externalResourcesRequired;
-
- // From SVGStylable
-
- _SVGAnimatedStringImpl get $dom_svgClassName => JS("_SVGAnimatedStringImpl", "#.className", this);
-
- // Use implementation from Element.
- // final _CSSStyleDeclarationImpl style;
-
- _CSSValueImpl getPresentationAttribute(String name) native;
-
- // From SVGTransformable
-
- final _SVGAnimatedTransformListImpl transform;
-
// From SVGLocatable
final _SVGElementImpl farthestViewportElement;
@@ -27541,6 +27505,33 @@
_SVGMatrixImpl getScreenCTM() native;
_SVGMatrixImpl getTransformToElement(_SVGElementImpl element) native;
+
+ // From SVGStylable
+
+ _SVGAnimatedStringImpl get $dom_svgClassName => JS("_SVGAnimatedStringImpl", "#.className", this);
+
+ // Use implementation from Element.
+ // final _CSSStyleDeclarationImpl style;
+
+ _CSSValueImpl getPresentationAttribute(String name) native;
+
+ // From SVGTests
+
+ final _SVGStringListImpl requiredExtensions;
+
+ final _SVGStringListImpl requiredFeatures;
+
+ final _SVGStringListImpl systemLanguage;
+
+ bool hasExtension(String extension) native;
+
+ // From SVGTransformable
+
+ final _SVGAnimatedTransformListImpl transform;
+
+ // From SVGURIReference
+
+ final _SVGAnimatedStringImpl href;
}
// 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
@@ -27788,15 +27779,9 @@
final _SVGAnimatedLengthImpl y2;
- // From SVGTests
+ // From SVGExternalResourcesRequired
- final _SVGStringListImpl requiredExtensions;
-
- final _SVGStringListImpl requiredFeatures;
-
- final _SVGStringListImpl systemLanguage;
-
- bool hasExtension(String extension) native;
+ final _SVGAnimatedBooleanImpl externalResourcesRequired;
// From SVGLangSpace
@@ -27804,23 +27789,6 @@
String xmlspace;
- // From SVGExternalResourcesRequired
-
- final _SVGAnimatedBooleanImpl externalResourcesRequired;
-
- // From SVGStylable
-
- _SVGAnimatedStringImpl get $dom_svgClassName => JS("_SVGAnimatedStringImpl", "#.className", this);
-
- // Use implementation from Element.
- // final _CSSStyleDeclarationImpl style;
-
- _CSSValueImpl getPresentationAttribute(String name) native;
-
- // From SVGTransformable
-
- final _SVGAnimatedTransformListImpl transform;
-
// From SVGLocatable
final _SVGElementImpl farthestViewportElement;
@@ -27834,6 +27802,29 @@
_SVGMatrixImpl getScreenCTM() native;
_SVGMatrixImpl getTransformToElement(_SVGElementImpl element) native;
+
+ // From SVGStylable
+
+ _SVGAnimatedStringImpl get $dom_svgClassName => JS("_SVGAnimatedStringImpl", "#.className", this);
+
+ // Use implementation from Element.
+ // final _CSSStyleDeclarationImpl style;
+
+ _CSSValueImpl getPresentationAttribute(String name) native;
+
+ // From SVGTests
+
+ final _SVGStringListImpl requiredExtensions;
+
+ final _SVGStringListImpl requiredFeatures;
+
+ final _SVGStringListImpl systemLanguage;
+
+ bool hasExtension(String extension) native;
+
+ // From SVGTransformable
+
+ final _SVGAnimatedTransformListImpl transform;
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
@@ -27906,13 +27897,13 @@
class _SVGMPathElementImpl extends _SVGElementImpl implements SVGMPathElement native "*SVGMPathElement" {
- // From SVGURIReference
-
- final _SVGAnimatedStringImpl href;
-
// From SVGExternalResourcesRequired
final _SVGAnimatedBooleanImpl externalResourcesRequired;
+
+ // From SVGURIReference
+
+ final _SVGAnimatedStringImpl href;
}
// 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
@@ -27983,16 +27974,22 @@
void setOrientToAuto() native;
+ // From SVGExternalResourcesRequired
+
+ final _SVGAnimatedBooleanImpl externalResourcesRequired;
+
+ // From SVGFitToViewBox
+
+ final _SVGAnimatedPreserveAspectRatioImpl preserveAspectRatio;
+
+ final _SVGAnimatedRectImpl viewBox;
+
// From SVGLangSpace
String xmllang;
String xmlspace;
- // From SVGExternalResourcesRequired
-
- final _SVGAnimatedBooleanImpl externalResourcesRequired;
-
// From SVGStylable
_SVGAnimatedStringImpl get $dom_svgClassName => JS("_SVGAnimatedStringImpl", "#.className", this);
@@ -28001,12 +27998,6 @@
// final _CSSStyleDeclarationImpl style;
_CSSValueImpl getPresentationAttribute(String name) native;
-
- // From SVGFitToViewBox
-
- final _SVGAnimatedPreserveAspectRatioImpl preserveAspectRatio;
-
- final _SVGAnimatedRectImpl viewBox;
}
// 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
@@ -28050,15 +28041,9 @@
final _SVGAnimatedLengthImpl y;
- // From SVGTests
+ // From SVGExternalResourcesRequired
- final _SVGStringListImpl requiredExtensions;
-
- final _SVGStringListImpl requiredFeatures;
-
- final _SVGStringListImpl systemLanguage;
-
- bool hasExtension(String extension) native;
+ final _SVGAnimatedBooleanImpl externalResourcesRequired;
// From SVGLangSpace
@@ -28066,10 +28051,6 @@
String xmlspace;
- // From SVGExternalResourcesRequired
-
- final _SVGAnimatedBooleanImpl externalResourcesRequired;
-
// From SVGStylable
_SVGAnimatedStringImpl get $dom_svgClassName => JS("_SVGAnimatedStringImpl", "#.className", this);
@@ -28078,6 +28059,16 @@
// final _CSSStyleDeclarationImpl style;
_CSSValueImpl getPresentationAttribute(String name) native;
+
+ // From SVGTests
+
+ final _SVGStringListImpl requiredExtensions;
+
+ final _SVGStringListImpl requiredFeatures;
+
+ final _SVGStringListImpl systemLanguage;
+
+ bool hasExtension(String extension) native;
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
@@ -28551,15 +28542,9 @@
num getTotalLength() native;
- // From SVGTests
+ // From SVGExternalResourcesRequired
- final _SVGStringListImpl requiredExtensions;
-
- final _SVGStringListImpl requiredFeatures;
-
- final _SVGStringListImpl systemLanguage;
-
- bool hasExtension(String extension) native;
+ final _SVGAnimatedBooleanImpl externalResourcesRequired;
// From SVGLangSpace
@@ -28567,23 +28552,6 @@
String xmlspace;
- // From SVGExternalResourcesRequired
-
- final _SVGAnimatedBooleanImpl externalResourcesRequired;
-
- // From SVGStylable
-
- _SVGAnimatedStringImpl get $dom_svgClassName => JS("_SVGAnimatedStringImpl", "#.className", this);
-
- // Use implementation from Element.
- // final _CSSStyleDeclarationImpl style;
-
- _CSSValueImpl getPresentationAttribute(String name) native;
-
- // From SVGTransformable
-
- final _SVGAnimatedTransformListImpl transform;
-
// From SVGLocatable
final _SVGElementImpl farthestViewportElement;
@@ -28597,6 +28565,29 @@
_SVGMatrixImpl getScreenCTM() native;
_SVGMatrixImpl getTransformToElement(_SVGElementImpl element) native;
+
+ // From SVGStylable
+
+ _SVGAnimatedStringImpl get $dom_svgClassName => JS("_SVGAnimatedStringImpl", "#.className", this);
+
+ // Use implementation from Element.
+ // final _CSSStyleDeclarationImpl style;
+
+ _CSSValueImpl getPresentationAttribute(String name) native;
+
+ // From SVGTests
+
+ final _SVGStringListImpl requiredExtensions;
+
+ final _SVGStringListImpl requiredFeatures;
+
+ final _SVGStringListImpl systemLanguage;
+
+ bool hasExtension(String extension) native;
+
+ // From SVGTransformable
+
+ final _SVGAnimatedTransformListImpl transform;
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
@@ -29360,9 +29351,30 @@
final _SVGAnimatedLengthImpl y;
- // From SVGURIReference
+ // From SVGExternalResourcesRequired
- final _SVGAnimatedStringImpl href;
+ final _SVGAnimatedBooleanImpl externalResourcesRequired;
+
+ // From SVGFitToViewBox
+
+ final _SVGAnimatedPreserveAspectRatioImpl preserveAspectRatio;
+
+ final _SVGAnimatedRectImpl viewBox;
+
+ // From SVGLangSpace
+
+ String xmllang;
+
+ String xmlspace;
+
+ // From SVGStylable
+
+ _SVGAnimatedStringImpl get $dom_svgClassName => JS("_SVGAnimatedStringImpl", "#.className", this);
+
+ // Use implementation from Element.
+ // final _CSSStyleDeclarationImpl style;
+
+ _CSSValueImpl getPresentationAttribute(String name) native;
// From SVGTests
@@ -29374,30 +29386,9 @@
bool hasExtension(String extension) native;
- // From SVGLangSpace
+ // From SVGURIReference
- String xmllang;
-
- String xmlspace;
-
- // From SVGExternalResourcesRequired
-
- final _SVGAnimatedBooleanImpl externalResourcesRequired;
-
- // From SVGStylable
-
- _SVGAnimatedStringImpl get $dom_svgClassName => JS("_SVGAnimatedStringImpl", "#.className", this);
-
- // Use implementation from Element.
- // final _CSSStyleDeclarationImpl style;
-
- _CSSValueImpl getPresentationAttribute(String name) native;
-
- // From SVGFitToViewBox
-
- final _SVGAnimatedPreserveAspectRatioImpl preserveAspectRatio;
-
- final _SVGAnimatedRectImpl viewBox;
+ final _SVGAnimatedStringImpl href;
}
// 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
@@ -29500,15 +29491,9 @@
final _SVGPointListImpl points;
- // From SVGTests
+ // From SVGExternalResourcesRequired
- final _SVGStringListImpl requiredExtensions;
-
- final _SVGStringListImpl requiredFeatures;
-
- final _SVGStringListImpl systemLanguage;
-
- bool hasExtension(String extension) native;
+ final _SVGAnimatedBooleanImpl externalResourcesRequired;
// From SVGLangSpace
@@ -29516,23 +29501,6 @@
String xmlspace;
- // From SVGExternalResourcesRequired
-
- final _SVGAnimatedBooleanImpl externalResourcesRequired;
-
- // From SVGStylable
-
- _SVGAnimatedStringImpl get $dom_svgClassName => JS("_SVGAnimatedStringImpl", "#.className", this);
-
- // Use implementation from Element.
- // final _CSSStyleDeclarationImpl style;
-
- _CSSValueImpl getPresentationAttribute(String name) native;
-
- // From SVGTransformable
-
- final _SVGAnimatedTransformListImpl transform;
-
// From SVGLocatable
final _SVGElementImpl farthestViewportElement;
@@ -29546,6 +29514,29 @@
_SVGMatrixImpl getScreenCTM() native;
_SVGMatrixImpl getTransformToElement(_SVGElementImpl element) native;
+
+ // From SVGStylable
+
+ _SVGAnimatedStringImpl get $dom_svgClassName => JS("_SVGAnimatedStringImpl", "#.className", this);
+
+ // Use implementation from Element.
+ // final _CSSStyleDeclarationImpl style;
+
+ _CSSValueImpl getPresentationAttribute(String name) native;
+
+ // From SVGTests
+
+ final _SVGStringListImpl requiredExtensions;
+
+ final _SVGStringListImpl requiredFeatures;
+
+ final _SVGStringListImpl systemLanguage;
+
+ bool hasExtension(String extension) native;
+
+ // From SVGTransformable
+
+ final _SVGAnimatedTransformListImpl transform;
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
@@ -29569,15 +29560,9 @@
final _SVGPointListImpl points;
- // From SVGTests
+ // From SVGExternalResourcesRequired
- final _SVGStringListImpl requiredExtensions;
-
- final _SVGStringListImpl requiredFeatures;
-
- final _SVGStringListImpl systemLanguage;
-
- bool hasExtension(String extension) native;
+ final _SVGAnimatedBooleanImpl externalResourcesRequired;
// From SVGLangSpace
@@ -29585,23 +29570,6 @@
String xmlspace;
- // From SVGExternalResourcesRequired
-
- final _SVGAnimatedBooleanImpl externalResourcesRequired;
-
- // From SVGStylable
-
- _SVGAnimatedStringImpl get $dom_svgClassName => JS("_SVGAnimatedStringImpl", "#.className", this);
-
- // Use implementation from Element.
- // final _CSSStyleDeclarationImpl style;
-
- _CSSValueImpl getPresentationAttribute(String name) native;
-
- // From SVGTransformable
-
- final _SVGAnimatedTransformListImpl transform;
-
// From SVGLocatable
final _SVGElementImpl farthestViewportElement;
@@ -29615,6 +29583,29 @@
_SVGMatrixImpl getScreenCTM() native;
_SVGMatrixImpl getTransformToElement(_SVGElementImpl element) native;
+
+ // From SVGStylable
+
+ _SVGAnimatedStringImpl get $dom_svgClassName => JS("_SVGAnimatedStringImpl", "#.className", this);
+
+ // Use implementation from Element.
+ // final _CSSStyleDeclarationImpl style;
+
+ _CSSValueImpl getPresentationAttribute(String name) native;
+
+ // From SVGTests
+
+ final _SVGStringListImpl requiredExtensions;
+
+ final _SVGStringListImpl requiredFeatures;
+
+ final _SVGStringListImpl systemLanguage;
+
+ bool hasExtension(String extension) native;
+
+ // From SVGTransformable
+
+ final _SVGAnimatedTransformListImpl transform;
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
@@ -29771,15 +29762,9 @@
final _SVGAnimatedLengthImpl y;
- // From SVGTests
+ // From SVGExternalResourcesRequired
- final _SVGStringListImpl requiredExtensions;
-
- final _SVGStringListImpl requiredFeatures;
-
- final _SVGStringListImpl systemLanguage;
-
- bool hasExtension(String extension) native;
+ final _SVGAnimatedBooleanImpl externalResourcesRequired;
// From SVGLangSpace
@@ -29787,23 +29772,6 @@
String xmlspace;
- // From SVGExternalResourcesRequired
-
- final _SVGAnimatedBooleanImpl externalResourcesRequired;
-
- // From SVGStylable
-
- _SVGAnimatedStringImpl get $dom_svgClassName => JS("_SVGAnimatedStringImpl", "#.className", this);
-
- // Use implementation from Element.
- // final _CSSStyleDeclarationImpl style;
-
- _CSSValueImpl getPresentationAttribute(String name) native;
-
- // From SVGTransformable
-
- final _SVGAnimatedTransformListImpl transform;
-
// From SVGLocatable
final _SVGElementImpl farthestViewportElement;
@@ -29817,6 +29785,29 @@
_SVGMatrixImpl getScreenCTM() native;
_SVGMatrixImpl getTransformToElement(_SVGElementImpl element) native;
+
+ // From SVGStylable
+
+ _SVGAnimatedStringImpl get $dom_svgClassName => JS("_SVGAnimatedStringImpl", "#.className", this);
+
+ // Use implementation from Element.
+ // final _CSSStyleDeclarationImpl style;
+
+ _CSSValueImpl getPresentationAttribute(String name) native;
+
+ // From SVGTests
+
+ final _SVGStringListImpl requiredExtensions;
+
+ final _SVGStringListImpl requiredFeatures;
+
+ final _SVGStringListImpl systemLanguage;
+
+ bool hasExtension(String extension) native;
+
+ // From SVGTransformable
+
+ final _SVGAnimatedTransformListImpl transform;
}
class _SVGRectImpl implements SVGRect native "*SVGRect" {
@@ -30057,15 +30048,15 @@
void unsuspendRedrawAll() native;
- // From SVGTests
+ // From SVGExternalResourcesRequired
- final _SVGStringListImpl requiredExtensions;
+ final _SVGAnimatedBooleanImpl externalResourcesRequired;
- final _SVGStringListImpl requiredFeatures;
+ // From SVGFitToViewBox
- final _SVGStringListImpl systemLanguage;
+ final _SVGAnimatedPreserveAspectRatioImpl preserveAspectRatio;
- bool hasExtension(String extension) native;
+ final _SVGAnimatedRectImpl viewBox;
// From SVGLangSpace
@@ -30073,19 +30064,6 @@
String xmlspace;
- // From SVGExternalResourcesRequired
-
- final _SVGAnimatedBooleanImpl externalResourcesRequired;
-
- // From SVGStylable
-
- _SVGAnimatedStringImpl get $dom_svgClassName => JS("_SVGAnimatedStringImpl", "#.className", this);
-
- // Use implementation from Element.
- // final _CSSStyleDeclarationImpl style;
-
- _CSSValueImpl getPresentationAttribute(String name) native;
-
// From SVGLocatable
final _SVGElementImpl farthestViewportElement;
@@ -30100,11 +30078,24 @@
_SVGMatrixImpl getTransformToElement(_SVGElementImpl element) native;
- // From SVGFitToViewBox
+ // From SVGStylable
- final _SVGAnimatedPreserveAspectRatioImpl preserveAspectRatio;
+ _SVGAnimatedStringImpl get $dom_svgClassName => JS("_SVGAnimatedStringImpl", "#.className", this);
- final _SVGAnimatedRectImpl viewBox;
+ // Use implementation from Element.
+ // final _CSSStyleDeclarationImpl style;
+
+ _CSSValueImpl getPresentationAttribute(String name) native;
+
+ // From SVGTests
+
+ final _SVGStringListImpl requiredExtensions;
+
+ final _SVGStringListImpl requiredFeatures;
+
+ final _SVGStringListImpl systemLanguage;
+
+ bool hasExtension(String extension) native;
// From SVGZoomAndPan
@@ -30127,13 +30118,13 @@
String type;
- // From SVGURIReference
-
- final _SVGAnimatedStringImpl href;
-
// From SVGExternalResourcesRequired
final _SVGAnimatedBooleanImpl externalResourcesRequired;
+
+ // From SVGURIReference
+
+ final _SVGAnimatedStringImpl href;
}
// 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
@@ -30381,15 +30372,9 @@
class _SVGSwitchElementImpl extends _SVGElementImpl implements SVGSwitchElement native "*SVGSwitchElement" {
- // From SVGTests
+ // From SVGExternalResourcesRequired
- final _SVGStringListImpl requiredExtensions;
-
- final _SVGStringListImpl requiredFeatures;
-
- final _SVGStringListImpl systemLanguage;
-
- bool hasExtension(String extension) native;
+ final _SVGAnimatedBooleanImpl externalResourcesRequired;
// From SVGLangSpace
@@ -30397,23 +30382,6 @@
String xmlspace;
- // From SVGExternalResourcesRequired
-
- final _SVGAnimatedBooleanImpl externalResourcesRequired;
-
- // From SVGStylable
-
- _SVGAnimatedStringImpl get $dom_svgClassName => JS("_SVGAnimatedStringImpl", "#.className", this);
-
- // Use implementation from Element.
- // final _CSSStyleDeclarationImpl style;
-
- _CSSValueImpl getPresentationAttribute(String name) native;
-
- // From SVGTransformable
-
- final _SVGAnimatedTransformListImpl transform;
-
// From SVGLocatable
final _SVGElementImpl farthestViewportElement;
@@ -30427,6 +30395,29 @@
_SVGMatrixImpl getScreenCTM() native;
_SVGMatrixImpl getTransformToElement(_SVGElementImpl element) native;
+
+ // From SVGStylable
+
+ _SVGAnimatedStringImpl get $dom_svgClassName => JS("_SVGAnimatedStringImpl", "#.className", this);
+
+ // Use implementation from Element.
+ // final _CSSStyleDeclarationImpl style;
+
+ _CSSValueImpl getPresentationAttribute(String name) native;
+
+ // From SVGTests
+
+ final _SVGStringListImpl requiredExtensions;
+
+ final _SVGStringListImpl requiredFeatures;
+
+ final _SVGStringListImpl systemLanguage;
+
+ bool hasExtension(String extension) native;
+
+ // From SVGTransformable
+
+ final _SVGAnimatedTransformListImpl transform;
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
@@ -30440,16 +30431,22 @@
class _SVGSymbolElementImpl extends _SVGElementImpl implements SVGSymbolElement native "*SVGSymbolElement" {
+ // From SVGExternalResourcesRequired
+
+ final _SVGAnimatedBooleanImpl externalResourcesRequired;
+
+ // From SVGFitToViewBox
+
+ final _SVGAnimatedPreserveAspectRatioImpl preserveAspectRatio;
+
+ final _SVGAnimatedRectImpl viewBox;
+
// From SVGLangSpace
String xmllang;
String xmlspace;
- // From SVGExternalResourcesRequired
-
- final _SVGAnimatedBooleanImpl externalResourcesRequired;
-
// From SVGStylable
_SVGAnimatedStringImpl get $dom_svgClassName => JS("_SVGAnimatedStringImpl", "#.className", this);
@@ -30458,12 +30455,6 @@
// final _CSSStyleDeclarationImpl style;
_CSSValueImpl getPresentationAttribute(String name) native;
-
- // From SVGFitToViewBox
-
- final _SVGAnimatedPreserveAspectRatioImpl preserveAspectRatio;
-
- final _SVGAnimatedRectImpl viewBox;
}
// 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
@@ -30587,15 +30578,9 @@
void selectSubString(int offset, int length) native;
- // From SVGTests
+ // From SVGExternalResourcesRequired
- final _SVGStringListImpl requiredExtensions;
-
- final _SVGStringListImpl requiredFeatures;
-
- final _SVGStringListImpl systemLanguage;
-
- bool hasExtension(String extension) native;
+ final _SVGAnimatedBooleanImpl externalResourcesRequired;
// From SVGLangSpace
@@ -30603,10 +30588,6 @@
String xmlspace;
- // From SVGExternalResourcesRequired
-
- final _SVGAnimatedBooleanImpl externalResourcesRequired;
-
// From SVGStylable
_SVGAnimatedStringImpl get $dom_svgClassName => JS("_SVGAnimatedStringImpl", "#.className", this);
@@ -30615,6 +30596,16 @@
// final _CSSStyleDeclarationImpl style;
_CSSValueImpl getPresentationAttribute(String name) native;
+
+ // From SVGTests
+
+ final _SVGStringListImpl requiredExtensions;
+
+ final _SVGStringListImpl requiredFeatures;
+
+ final _SVGStringListImpl systemLanguage;
+
+ bool hasExtension(String extension) native;
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
@@ -30628,10 +30619,6 @@
class _SVGTextElementImpl extends _SVGTextPositioningElementImpl implements SVGTextElement native "*SVGTextElement" {
- // From SVGTransformable
-
- final _SVGAnimatedTransformListImpl transform;
-
// From SVGLocatable
final _SVGElementImpl farthestViewportElement;
@@ -30645,6 +30632,10 @@
_SVGMatrixImpl getScreenCTM() native;
_SVGMatrixImpl getTransformToElement(_SVGElementImpl element) native;
+
+ // From SVGTransformable
+
+ final _SVGAnimatedTransformListImpl transform;
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
@@ -31053,19 +31044,9 @@
final _SVGAnimatedLengthImpl y;
- // From SVGURIReference
+ // From SVGExternalResourcesRequired
- final _SVGAnimatedStringImpl href;
-
- // From SVGTests
-
- final _SVGStringListImpl requiredExtensions;
-
- final _SVGStringListImpl requiredFeatures;
-
- final _SVGStringListImpl systemLanguage;
-
- bool hasExtension(String extension) native;
+ final _SVGAnimatedBooleanImpl externalResourcesRequired;
// From SVGLangSpace
@@ -31073,23 +31054,6 @@
String xmlspace;
- // From SVGExternalResourcesRequired
-
- final _SVGAnimatedBooleanImpl externalResourcesRequired;
-
- // From SVGStylable
-
- _SVGAnimatedStringImpl get $dom_svgClassName => JS("_SVGAnimatedStringImpl", "#.className", this);
-
- // Use implementation from Element.
- // final _CSSStyleDeclarationImpl style;
-
- _CSSValueImpl getPresentationAttribute(String name) native;
-
- // From SVGTransformable
-
- final _SVGAnimatedTransformListImpl transform;
-
// From SVGLocatable
final _SVGElementImpl farthestViewportElement;
@@ -31103,6 +31067,33 @@
_SVGMatrixImpl getScreenCTM() native;
_SVGMatrixImpl getTransformToElement(_SVGElementImpl element) native;
+
+ // From SVGStylable
+
+ _SVGAnimatedStringImpl get $dom_svgClassName => JS("_SVGAnimatedStringImpl", "#.className", this);
+
+ // Use implementation from Element.
+ // final _CSSStyleDeclarationImpl style;
+
+ _CSSValueImpl getPresentationAttribute(String name) native;
+
+ // From SVGTests
+
+ final _SVGStringListImpl requiredExtensions;
+
+ final _SVGStringListImpl requiredFeatures;
+
+ final _SVGStringListImpl systemLanguage;
+
+ bool hasExtension(String extension) native;
+
+ // From SVGTransformable
+
+ final _SVGAnimatedTransformListImpl transform;
+
+ // From SVGURIReference
+
+ final _SVGAnimatedStringImpl href;
}
// 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
@@ -31371,6 +31362,42 @@
// WARNING: Do not edit - generated code.
+/// @domName ScriptProcessorNode
+abstract class ScriptProcessorNode implements AudioNode, EventTarget {
+
+ /**
+ * @domName EventTarget.addEventListener, EventTarget.removeEventListener, EventTarget.dispatchEvent
+ */
+ ScriptProcessorNodeEvents get on;
+
+ /** @domName ScriptProcessorNode.bufferSize */
+ int get bufferSize;
+}
+
+abstract class ScriptProcessorNodeEvents implements Events {
+
+ EventListenerList get audioProcess;
+}
+
+class _ScriptProcessorNodeImpl extends _AudioNodeImpl implements ScriptProcessorNode native "*ScriptProcessorNode" {
+
+ _ScriptProcessorNodeEventsImpl get on =>
+ new _ScriptProcessorNodeEventsImpl(this);
+
+ final int bufferSize;
+}
+
+class _ScriptProcessorNodeEventsImpl extends _EventsImpl implements ScriptProcessorNodeEvents {
+ _ScriptProcessorNodeEventsImpl(_ptr) : super(_ptr);
+
+ EventListenerList get audioProcess => this['audioprocess'];
+}
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// WARNING: Do not edit - generated code.
+
/// @domName ScriptProfile
abstract class ScriptProfile {
@@ -33395,6 +33422,9 @@
/** @domName HTMLTextAreaElement.defaultValue */
String defaultValue;
+ /** @domName HTMLTextAreaElement.dirName */
+ String dirName;
+
/** @domName HTMLTextAreaElement.disabled */
bool disabled;
@@ -33461,6 +33491,9 @@
/** @domName HTMLTextAreaElement.setCustomValidity */
void setCustomValidity(String error);
+ /** @domName HTMLTextAreaElement.setRangeText */
+ void setRangeText(String replacement, [int start, int end, String selectionMode]);
+
/** @domName HTMLTextAreaElement.setSelectionRange */
void setSelectionRange(int start, int end, [String direction]);
}
@@ -33473,6 +33506,8 @@
String defaultValue;
+ String dirName;
+
bool disabled;
final _FormElementImpl form;
@@ -33517,6 +33552,8 @@
void setCustomValidity(String error) native;
+ void setRangeText(String replacement, [int start, int end, String selectionMode]) native;
+
void setSelectionRange(int start, int end, [String direction]) native;
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
@@ -36148,7 +36185,7 @@
int getError();
/** @domName WebGLRenderingContext.getExtension */
- void getExtension(String name);
+ Object getExtension(String name);
/** @domName WebGLRenderingContext.getFramebufferAttachmentParameter */
Object getFramebufferAttachmentParameter(int target, int attachment, int pname);
@@ -36504,7 +36541,7 @@
int getError() native;
- void getExtension(String name) native;
+ Object getExtension(String name) native;
Object getFramebufferAttachmentParameter(int target, int attachment, int pname) native;
@@ -40857,14 +40894,13 @@
* [:start + length:].
* Returns an empty list if [length] is 0.
* Throws an [ArgumentError] if [length] is negative.
- * Throws an [IndexOutOfRangeException] if [start] or
- * [:start + length:] are out of range.
+ * Throws a [RangeError] if [start] or [:start + length:] are out of range.
*/
static List getRange(List a, int start, int length, List accumulator) {
if (length < 0) throw new ArgumentError('length');
- if (start < 0) throw new IndexOutOfRangeException(start);
+ if (start < 0) throw new RangeError.value(start);
int end = start + length;
- if (end > a.length) throw new IndexOutOfRangeException(end);
+ if (end > a.length) throw new RangeError.value(end);
for (int i = start; i < end; i++) {
accumulator.add(a[i]);
}
diff --git a/lib/html/dartium/html_dartium.dart b/lib/html/dartium/html_dartium.dart
index c9d103a..88f1eef 100644
--- a/lib/html/dartium/html_dartium.dart
+++ b/lib/html/dartium/html_dartium.dart
@@ -119,6 +119,72 @@
// WARNING: Do not edit - generated code.
+/// @domName AnalyserNode
+abstract class AnalyserNode implements AudioNode {
+
+ /** @domName AnalyserNode.fftSize */
+ int fftSize;
+
+ /** @domName AnalyserNode.frequencyBinCount */
+ int get frequencyBinCount;
+
+ /** @domName AnalyserNode.maxDecibels */
+ num maxDecibels;
+
+ /** @domName AnalyserNode.minDecibels */
+ num minDecibels;
+
+ /** @domName AnalyserNode.smoothingTimeConstant */
+ num smoothingTimeConstant;
+
+ /** @domName AnalyserNode.getByteFrequencyData */
+ void getByteFrequencyData(Uint8Array array);
+
+ /** @domName AnalyserNode.getByteTimeDomainData */
+ void getByteTimeDomainData(Uint8Array array);
+
+ /** @domName AnalyserNode.getFloatFrequencyData */
+ void getFloatFrequencyData(Float32Array array);
+}
+// 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.
+
+class _AnalyserNodeImpl extends _AudioNodeImpl implements AnalyserNode {
+
+ int get fftSize native "AnalyserNode_fftSize_Getter";
+
+ void set fftSize(int value) native "AnalyserNode_fftSize_Setter";
+
+ int get frequencyBinCount native "AnalyserNode_frequencyBinCount_Getter";
+
+ num get maxDecibels native "AnalyserNode_maxDecibels_Getter";
+
+ void set maxDecibels(num value) native "AnalyserNode_maxDecibels_Setter";
+
+ num get minDecibels native "AnalyserNode_minDecibels_Getter";
+
+ void set minDecibels(num value) native "AnalyserNode_minDecibels_Setter";
+
+ num get smoothingTimeConstant native "AnalyserNode_smoothingTimeConstant_Getter";
+
+ void set smoothingTimeConstant(num value) native "AnalyserNode_smoothingTimeConstant_Setter";
+
+ void getByteFrequencyData(Uint8Array array) native "AnalyserNode_getByteFrequencyData_Callback";
+
+ void getByteTimeDomainData(Uint8Array array) native "AnalyserNode_getByteTimeDomainData_Callback";
+
+ void getFloatFrequencyData(Float32Array array) native "AnalyserNode_getFloatFrequencyData_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.
+
/// @domName HTMLAnchorElement
abstract class AnchorElement implements Element {
@@ -796,8 +862,11 @@
/** @domName AudioBufferSourceNode.loop */
bool loop;
- /** @domName AudioBufferSourceNode.looping */
- bool looping;
+ /** @domName AudioBufferSourceNode.loopEnd */
+ num loopEnd;
+
+ /** @domName AudioBufferSourceNode.loopStart */
+ num loopStart;
/** @domName AudioBufferSourceNode.playbackRate */
AudioParam get playbackRate;
@@ -829,9 +898,13 @@
void set loop(bool value) native "AudioBufferSourceNode_loop_Setter";
- bool get looping native "AudioBufferSourceNode_looping_Getter";
+ num get loopEnd native "AudioBufferSourceNode_loopEnd_Getter";
- void set looping(bool value) native "AudioBufferSourceNode_looping_Setter";
+ void set loopEnd(num value) native "AudioBufferSourceNode_loopEnd_Setter";
+
+ num get loopStart native "AudioBufferSourceNode_loopStart_Getter";
+
+ void set loopStart(num value) native "AudioBufferSourceNode_loopStart_Setter";
AudioParam get playbackRate native "AudioBufferSourceNode_playbackRate_Getter";
@@ -862,42 +935,6 @@
// WARNING: Do not edit - generated code.
-/// @domName AudioChannelMerger
-abstract class AudioChannelMerger implements AudioNode {
-}
-// 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.
-
-class _AudioChannelMergerImpl extends _AudioNodeImpl implements AudioChannelMerger {
-
-}
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-// WARNING: Do not edit - generated code.
-
-/// @domName AudioChannelSplitter
-abstract class AudioChannelSplitter implements AudioNode {
-}
-// 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.
-
-class _AudioChannelSplitterImpl extends _AudioNodeImpl implements AudioChannelSplitter {
-
-}
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-// WARNING: Do not edit - generated code.
-
/// @domName AudioContext
abstract class AudioContext implements EventTarget {
@@ -924,7 +961,7 @@
num get sampleRate;
/** @domName AudioContext.createAnalyser */
- RealtimeAnalyserNode createAnalyser();
+ AnalyserNode createAnalyser();
/** @domName AudioContext.createBiquadFilter */
BiquadFilterNode createBiquadFilter();
@@ -936,25 +973,22 @@
AudioBufferSourceNode createBufferSource();
/** @domName AudioContext.createChannelMerger */
- AudioChannelMerger createChannelMerger([int numberOfInputs]);
+ ChannelMergerNode createChannelMerger([int numberOfInputs]);
/** @domName AudioContext.createChannelSplitter */
- AudioChannelSplitter createChannelSplitter([int numberOfOutputs]);
+ ChannelSplitterNode createChannelSplitter([int numberOfOutputs]);
/** @domName AudioContext.createConvolver */
ConvolverNode createConvolver();
- /** @domName AudioContext.createDelayNode */
- DelayNode createDelayNode([num maxDelayTime]);
+ /** @domName AudioContext.createDelay */
+ DelayNode createDelay([num maxDelayTime]);
/** @domName AudioContext.createDynamicsCompressor */
DynamicsCompressorNode createDynamicsCompressor();
- /** @domName AudioContext.createGainNode */
- AudioGainNode createGainNode();
-
- /** @domName AudioContext.createJavaScriptNode */
- JavaScriptAudioNode createJavaScriptNode(int bufferSize, [int numberOfInputChannels, int numberOfOutputChannels]);
+ /** @domName AudioContext.createGain */
+ GainNode createGain();
/** @domName AudioContext.createMediaElementSource */
MediaElementAudioSourceNode createMediaElementSource(MediaElement mediaElement);
@@ -963,10 +997,13 @@
MediaStreamAudioSourceNode createMediaStreamSource(MediaStream mediaStream);
/** @domName AudioContext.createOscillator */
- Oscillator createOscillator();
+ OscillatorNode createOscillator();
/** @domName AudioContext.createPanner */
- AudioPannerNode createPanner();
+ PannerNode createPanner();
+
+ /** @domName AudioContext.createScriptProcessor */
+ ScriptProcessorNode createScriptProcessor(int bufferSize, [int numberOfInputChannels, int numberOfOutputChannels]);
/** @domName AudioContext.createWaveShaper */
WaveShaperNode createWaveShaper();
@@ -1006,7 +1043,7 @@
num get sampleRate native "AudioContext_sampleRate_Getter";
- RealtimeAnalyserNode createAnalyser() native "AudioContext_createAnalyser_Callback";
+ AnalyserNode createAnalyser() native "AudioContext_createAnalyser_Callback";
BiquadFilterNode createBiquadFilter() native "AudioContext_createBiquadFilter_Callback";
@@ -1026,68 +1063,68 @@
AudioBufferSourceNode createBufferSource() native "AudioContext_createBufferSource_Callback";
- AudioChannelMerger createChannelMerger([/*unsigned long*/ numberOfInputs]) {
+ ChannelMergerNode createChannelMerger([/*unsigned long*/ numberOfInputs]) {
if (?numberOfInputs) {
return _createChannelMerger_1(numberOfInputs);
}
return _createChannelMerger_2();
}
- AudioChannelMerger _createChannelMerger_1(numberOfInputs) native "AudioContext_createChannelMerger_1_Callback";
+ ChannelMergerNode _createChannelMerger_1(numberOfInputs) native "AudioContext_createChannelMerger_1_Callback";
- AudioChannelMerger _createChannelMerger_2() native "AudioContext_createChannelMerger_2_Callback";
+ ChannelMergerNode _createChannelMerger_2() native "AudioContext_createChannelMerger_2_Callback";
- AudioChannelSplitter createChannelSplitter([/*unsigned long*/ numberOfOutputs]) {
+ ChannelSplitterNode createChannelSplitter([/*unsigned long*/ numberOfOutputs]) {
if (?numberOfOutputs) {
return _createChannelSplitter_1(numberOfOutputs);
}
return _createChannelSplitter_2();
}
- AudioChannelSplitter _createChannelSplitter_1(numberOfOutputs) native "AudioContext_createChannelSplitter_1_Callback";
+ ChannelSplitterNode _createChannelSplitter_1(numberOfOutputs) native "AudioContext_createChannelSplitter_1_Callback";
- AudioChannelSplitter _createChannelSplitter_2() native "AudioContext_createChannelSplitter_2_Callback";
+ ChannelSplitterNode _createChannelSplitter_2() native "AudioContext_createChannelSplitter_2_Callback";
ConvolverNode createConvolver() native "AudioContext_createConvolver_Callback";
- DelayNode createDelayNode([/*double*/ maxDelayTime]) {
+ DelayNode createDelay([/*double*/ maxDelayTime]) {
if (?maxDelayTime) {
- return _createDelayNode_1(maxDelayTime);
+ return _createDelay_1(maxDelayTime);
}
- return _createDelayNode_2();
+ return _createDelay_2();
}
- DelayNode _createDelayNode_1(maxDelayTime) native "AudioContext_createDelayNode_1_Callback";
+ DelayNode _createDelay_1(maxDelayTime) native "AudioContext_createDelay_1_Callback";
- DelayNode _createDelayNode_2() native "AudioContext_createDelayNode_2_Callback";
+ DelayNode _createDelay_2() native "AudioContext_createDelay_2_Callback";
DynamicsCompressorNode createDynamicsCompressor() native "AudioContext_createDynamicsCompressor_Callback";
- AudioGainNode createGainNode() native "AudioContext_createGainNode_Callback";
-
- JavaScriptAudioNode createJavaScriptNode(/*unsigned long*/ bufferSize, [/*unsigned long*/ numberOfInputChannels, /*unsigned long*/ numberOfOutputChannels]) {
- if (?numberOfOutputChannels) {
- return _createJavaScriptNode_1(bufferSize, numberOfInputChannels, numberOfOutputChannels);
- }
- if (?numberOfInputChannels) {
- return _createJavaScriptNode_2(bufferSize, numberOfInputChannels);
- }
- return _createJavaScriptNode_3(bufferSize);
- }
-
- JavaScriptAudioNode _createJavaScriptNode_1(bufferSize, numberOfInputChannels, numberOfOutputChannels) native "AudioContext_createJavaScriptNode_1_Callback";
-
- JavaScriptAudioNode _createJavaScriptNode_2(bufferSize, numberOfInputChannels) native "AudioContext_createJavaScriptNode_2_Callback";
-
- JavaScriptAudioNode _createJavaScriptNode_3(bufferSize) native "AudioContext_createJavaScriptNode_3_Callback";
+ GainNode createGain() native "AudioContext_createGain_Callback";
MediaElementAudioSourceNode createMediaElementSource(MediaElement mediaElement) native "AudioContext_createMediaElementSource_Callback";
MediaStreamAudioSourceNode createMediaStreamSource(MediaStream mediaStream) native "AudioContext_createMediaStreamSource_Callback";
- Oscillator createOscillator() native "AudioContext_createOscillator_Callback";
+ OscillatorNode createOscillator() native "AudioContext_createOscillator_Callback";
- AudioPannerNode createPanner() native "AudioContext_createPanner_Callback";
+ PannerNode createPanner() native "AudioContext_createPanner_Callback";
+
+ ScriptProcessorNode createScriptProcessor(/*unsigned long*/ bufferSize, [/*unsigned long*/ numberOfInputChannels, /*unsigned long*/ numberOfOutputChannels]) {
+ if (?numberOfOutputChannels) {
+ return _createScriptProcessor_1(bufferSize, numberOfInputChannels, numberOfOutputChannels);
+ }
+ if (?numberOfInputChannels) {
+ return _createScriptProcessor_2(bufferSize, numberOfInputChannels);
+ }
+ return _createScriptProcessor_3(bufferSize);
+ }
+
+ ScriptProcessorNode _createScriptProcessor_1(bufferSize, numberOfInputChannels, numberOfOutputChannels) native "AudioContext_createScriptProcessor_1_Callback";
+
+ ScriptProcessorNode _createScriptProcessor_2(bufferSize, numberOfInputChannels) native "AudioContext_createScriptProcessor_2_Callback";
+
+ ScriptProcessorNode _createScriptProcessor_3(bufferSize) native "AudioContext_createScriptProcessor_3_Callback";
WaveShaperNode createWaveShaper() native "AudioContext_createWaveShaper_Callback";
@@ -1176,29 +1213,6 @@
// WARNING: Do not edit - generated code.
-/// @domName AudioGainNode
-abstract class AudioGainNode implements AudioNode {
-
- /** @domName AudioGainNode.gain */
- AudioGain get gain;
-}
-// 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.
-
-class _AudioGainNodeImpl extends _AudioNodeImpl implements AudioGainNode {
-
- AudioGain get gain native "AudioGainNode_gain_Getter";
-
-}
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-// WARNING: Do not edit - generated code.
-
/// @domName AudioListener
abstract class AudioListener {
@@ -1303,117 +1317,6 @@
// WARNING: Do not edit - generated code.
-/// @domName AudioPannerNode
-abstract class AudioPannerNode implements AudioNode {
-
- static const int EQUALPOWER = 0;
-
- static const int EXPONENTIAL_DISTANCE = 2;
-
- static const int HRTF = 1;
-
- static const int INVERSE_DISTANCE = 1;
-
- static const int LINEAR_DISTANCE = 0;
-
- static const int SOUNDFIELD = 2;
-
- /** @domName AudioPannerNode.coneGain */
- AudioGain get coneGain;
-
- /** @domName AudioPannerNode.coneInnerAngle */
- num coneInnerAngle;
-
- /** @domName AudioPannerNode.coneOuterAngle */
- num coneOuterAngle;
-
- /** @domName AudioPannerNode.coneOuterGain */
- num coneOuterGain;
-
- /** @domName AudioPannerNode.distanceGain */
- AudioGain get distanceGain;
-
- /** @domName AudioPannerNode.distanceModel */
- int distanceModel;
-
- /** @domName AudioPannerNode.maxDistance */
- num maxDistance;
-
- /** @domName AudioPannerNode.panningModel */
- int panningModel;
-
- /** @domName AudioPannerNode.refDistance */
- num refDistance;
-
- /** @domName AudioPannerNode.rolloffFactor */
- num rolloffFactor;
-
- /** @domName AudioPannerNode.setOrientation */
- void setOrientation(num x, num y, num z);
-
- /** @domName AudioPannerNode.setPosition */
- void setPosition(num x, num y, num z);
-
- /** @domName AudioPannerNode.setVelocity */
- void setVelocity(num x, num y, num z);
-}
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-// WARNING: Do not edit - generated code.
-
-class _AudioPannerNodeImpl extends _AudioNodeImpl implements AudioPannerNode {
-
- AudioGain get coneGain native "AudioPannerNode_coneGain_Getter";
-
- num get coneInnerAngle native "AudioPannerNode_coneInnerAngle_Getter";
-
- void set coneInnerAngle(num value) native "AudioPannerNode_coneInnerAngle_Setter";
-
- num get coneOuterAngle native "AudioPannerNode_coneOuterAngle_Getter";
-
- void set coneOuterAngle(num value) native "AudioPannerNode_coneOuterAngle_Setter";
-
- num get coneOuterGain native "AudioPannerNode_coneOuterGain_Getter";
-
- void set coneOuterGain(num value) native "AudioPannerNode_coneOuterGain_Setter";
-
- AudioGain get distanceGain native "AudioPannerNode_distanceGain_Getter";
-
- int get distanceModel native "AudioPannerNode_distanceModel_Getter";
-
- void set distanceModel(int value) native "AudioPannerNode_distanceModel_Setter";
-
- num get maxDistance native "AudioPannerNode_maxDistance_Getter";
-
- void set maxDistance(num value) native "AudioPannerNode_maxDistance_Setter";
-
- int get panningModel native "AudioPannerNode_panningModel_Getter";
-
- void set panningModel(int value) native "AudioPannerNode_panningModel_Setter";
-
- num get refDistance native "AudioPannerNode_refDistance_Getter";
-
- void set refDistance(num value) native "AudioPannerNode_refDistance_Setter";
-
- num get rolloffFactor native "AudioPannerNode_rolloffFactor_Getter";
-
- void set rolloffFactor(num value) native "AudioPannerNode_rolloffFactor_Setter";
-
- void setOrientation(num x, num y, num z) native "AudioPannerNode_setOrientation_Callback";
-
- void setPosition(num x, num y, num z) native "AudioPannerNode_setPosition_Callback";
-
- void setVelocity(num x, num y, num z) native "AudioPannerNode_setVelocity_Callback";
-
-}
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-// WARNING: Do not edit - generated code.
-
/// @domName AudioParam
abstract class AudioParam {
@@ -1444,8 +1347,8 @@
/** @domName AudioParam.linearRampToValueAtTime */
void linearRampToValueAtTime(num value, num time);
- /** @domName AudioParam.setTargetValueAtTime */
- void setTargetValueAtTime(num targetValue, num time, num timeConstant);
+ /** @domName AudioParam.setTargetAtTime */
+ void setTargetAtTime(num target, num time, num timeConstant);
/** @domName AudioParam.setValueAtTime */
void setValueAtTime(num value, num time);
@@ -1481,7 +1384,7 @@
void linearRampToValueAtTime(num value, num time) native "AudioParam_linearRampToValueAtTime_Callback";
- void setTargetValueAtTime(num targetValue, num time, num timeConstant) native "AudioParam_setTargetValueAtTime_Callback";
+ void setTargetAtTime(num target, num time, num timeConstant) native "AudioParam_setTargetAtTime_Callback";
void setValueAtTime(num value, num time) native "AudioParam_setValueAtTime_Callback";
@@ -8687,6 +8590,42 @@
// WARNING: Do not edit - generated code.
+/// @domName ChannelMergerNode
+abstract class ChannelMergerNode implements AudioNode {
+}
+// 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.
+
+class _ChannelMergerNodeImpl extends _AudioNodeImpl implements ChannelMergerNode {
+
+}
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// WARNING: Do not edit - generated code.
+
+/// @domName ChannelSplitterNode
+abstract class ChannelSplitterNode implements AudioNode {
+}
+// 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.
+
+class _ChannelSplitterNodeImpl extends _AudioNodeImpl implements ChannelSplitterNode {
+
+}
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// WARNING: Do not edit - generated code.
+
/// @domName CharacterData
abstract class CharacterData implements Node {
@@ -9170,6 +9109,9 @@
/** @domName HTMLContentElement.select */
String select;
+
+ /** @domName HTMLContentElement.getDistributedNodes */
+ List<Node> getDistributedNodes();
}
// 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
@@ -9187,6 +9129,8 @@
void set select(String value) native "HTMLContentElement_select_Setter";
+ List<Node> getDistributedNodes() native "HTMLContentElement_getDistributedNodes_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
@@ -10362,7 +10306,7 @@
String toString();
/** @domName DOMTokenList.toggle */
- bool toggle(String token);
+ bool toggle(String token, [bool force]);
}
// 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
@@ -10380,7 +10324,16 @@
String toString() native "DOMTokenList_toString_Callback";
- bool toggle(String token) native "DOMTokenList_toggle_Callback";
+ bool toggle(/*DOMString*/ token, [/*boolean*/ force]) {
+ if (?force) {
+ return _toggle_1(token, force);
+ }
+ return _toggle_2(token);
+ }
+
+ bool _toggle_1(token, force) native "DOMTokenList_toggle_1_Callback";
+
+ bool _toggle_2(token) native "DOMTokenList_toggle_2_Callback";
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
@@ -11075,29 +11028,9 @@
DirectoryReader createReader() native "DirectoryEntry_createReader_Callback";
- void getDirectory(/*DOMString*/ path, {/*Dictionary*/ options, /*EntryCallback*/ successCallback, /*ErrorCallback*/ errorCallback}) {
- if (?options) {
- _getDirectory_1(path, options, successCallback, errorCallback);
- return;
- }
- _getDirectory_2(path);
- }
+ void getDirectory(String path, {Map options, EntryCallback successCallback, ErrorCallback errorCallback}) native "DirectoryEntry_getDirectory_Callback";
- void _getDirectory_1(path, options, successCallback, errorCallback) native "DirectoryEntry_getDirectory_1_Callback";
-
- void _getDirectory_2(path) native "DirectoryEntry_getDirectory_2_Callback";
-
- void getFile(/*DOMString*/ path, {/*Dictionary*/ options, /*EntryCallback*/ successCallback, /*ErrorCallback*/ errorCallback}) {
- if (?options) {
- _getFile_1(path, options, successCallback, errorCallback);
- return;
- }
- _getFile_2(path);
- }
-
- void _getFile_1(path, options, successCallback, errorCallback) native "DirectoryEntry_getFile_1_Callback";
-
- void _getFile_2(path) native "DirectoryEntry_getFile_2_Callback";
+ void getFile(String path, {Map options, EntryCallback successCallback, ErrorCallback errorCallback}) native "DirectoryEntry_getFile_Callback";
void removeRecursively(VoidCallback successCallback, [ErrorCallback errorCallback]) native "DirectoryEntry_removeRecursively_Callback";
@@ -13421,11 +13354,18 @@
// Hooks to support custom WebComponents.
var xtag;
- noSuchMethod(String name, List args) {
+ noSuchMethod(InvocationMirror invocation) {
if (dynamicUnknownElementDispatcher == null) {
- throw new NoSuchMethodError(this, name, args);
+ throw new NoSuchMethodError(this, invocation.memberName,
+ invocation.positionalArguments,
+ invocation.namedArguments);
} else {
- return dynamicUnknownElementDispatcher(this, name, args);
+ String hackedName = invocation.memberName;
+ if (invocation.isGetter) hackedName = "get:$hackedName";
+ if (invocation.isSetter) hackedName = "set:$hackedName";
+ return dynamicUnknownElementDispatcher(this,
+ hackedName,
+ invocation.positionalArguments);
}
}
@@ -16060,6 +16000,29 @@
// WARNING: Do not edit - generated code.
+/// @domName GainNode
+abstract class GainNode implements AudioNode {
+
+ /** @domName GainNode.gain */
+ AudioGain get gain;
+}
+// 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.
+
+class _GainNodeImpl extends _AudioNodeImpl implements GainNode {
+
+ AudioGain get gain native "GainNode_gain_Getter";
+
+}
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// WARNING: Do not edit - generated code.
+
/// @domName Gamepad
abstract class Gamepad {
@@ -16708,7 +16671,7 @@
_HttpRequestFactoryProvider.createHttpRequest_get(url, onSuccess);
factory HttpRequest.getWithCredentials(String url, onSuccess(HttpRequest request)) =>
- _HttpRequestFactoryProvider.createHttpRequestgetWithCredentials(url, onSuccess);
+ _HttpRequestFactoryProvider.createHttpRequest_getWithCredentials(url, onSuccess);
factory HttpRequest() => _HttpRequestFactoryProvider.createHttpRequest();
@@ -17054,10 +17017,10 @@
String get direction;
/** @domName IDBCursor.key */
- dynamic get key;
+ Object get key;
/** @domName IDBCursor.primaryKey */
- dynamic get primaryKey;
+ Object get primaryKey;
/** @domName IDBCursor.source */
dynamic get source;
@@ -17084,9 +17047,9 @@
String get direction native "IDBCursor_direction_Getter";
- dynamic get key native "IDBCursor_key_Getter";
+ Object get key native "IDBCursor_key_Getter";
- dynamic get primaryKey native "IDBCursor_primaryKey_Getter";
+ Object get primaryKey native "IDBCursor_primaryKey_Getter";
dynamic get source native "IDBCursor_source_Getter";
@@ -17119,7 +17082,7 @@
abstract class IDBCursorWithValue implements IDBCursor {
/** @domName IDBCursorWithValue.value */
- dynamic get value;
+ Object get value;
}
// 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
@@ -17129,7 +17092,7 @@
class _IDBCursorWithValueImpl extends _IDBCursorImpl implements IDBCursorWithValue {
- dynamic get value native "IDBCursorWithValue_value_Getter";
+ Object get value native "IDBCursorWithValue_value_Getter";
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
@@ -17273,16 +17236,7 @@
void close() native "IDBDatabase_close_Callback";
- IDBObjectStore createObjectStore(/*DOMString*/ name, [/*Dictionary*/ options]) {
- if (?options) {
- return _createObjectStore_1(name, options);
- }
- return _createObjectStore_2(name);
- }
-
- IDBObjectStore _createObjectStore_1(name, options) native "IDBDatabase_createObjectStore_1_Callback";
-
- IDBObjectStore _createObjectStore_2(name) native "IDBDatabase_createObjectStore_2_Callback";
+ IDBObjectStore createObjectStore(String name, [Map options]) native "IDBDatabase_createObjectStore_Callback";
void deleteObjectStore(String name) native "IDBDatabase_deleteObjectStore_Callback";
@@ -17355,7 +17309,7 @@
IDBVersionChangeRequest deleteDatabase(String name) native "IDBFactory_deleteDatabase_Callback";
- IDBOpenDBRequest open(/*DOMString*/ name, [/*unsigned long long*/ version]) {
+ IDBOpenDBRequest open(/*DOMString*/ name, [/*long long*/ version]) {
if (?version) {
return _open_1(name, version);
}
@@ -17433,9 +17387,7 @@
if ((key_OR_range is IDBKeyRange || key_OR_range == null)) {
return _count_2(key_OR_range);
}
- if ((key_OR_range is dynamic || key_OR_range == null)) {
- return _count_3(key_OR_range);
- }
+ return _count_3(key_OR_range);
throw "Incorrect number or type of arguments";
}
@@ -17449,9 +17401,7 @@
if ((key is IDBKeyRange || key == null)) {
return _get_1(key);
}
- if ((key is dynamic || key == null)) {
- return _get_2(key);
- }
+ return _get_2(key);
throw "Incorrect number or type of arguments";
}
@@ -17463,9 +17413,7 @@
if ((key is IDBKeyRange || key == null)) {
return _getKey_1(key);
}
- if ((key is dynamic || key == null)) {
- return _getKey_2(key);
- }
+ return _getKey_2(key);
throw "Incorrect number or type of arguments";
}
@@ -17483,10 +17431,10 @@
if ((key_OR_range is IDBKeyRange || key_OR_range == null) && (direction is String || direction == null)) {
return _openCursor_3(key_OR_range, direction);
}
- if ((key_OR_range is dynamic || key_OR_range == null) && !?direction) {
+ if (!?direction) {
return _openCursor_4(key_OR_range);
}
- if ((key_OR_range is dynamic || key_OR_range == null) && (direction is String || direction == null)) {
+ if ((direction is String || direction == null)) {
return _openCursor_5(key_OR_range, direction);
}
throw "Incorrect number or type of arguments";
@@ -17512,10 +17460,10 @@
if ((key_OR_range is IDBKeyRange || key_OR_range == null) && (direction is String || direction == null)) {
return _openKeyCursor_3(key_OR_range, direction);
}
- if ((key_OR_range is dynamic || key_OR_range == null) && !?direction) {
+ if (!?direction) {
return _openKeyCursor_4(key_OR_range);
}
- if ((key_OR_range is dynamic || key_OR_range == null) && (direction is String || direction == null)) {
+ if ((direction is String || direction == null)) {
return _openKeyCursor_5(key_OR_range, direction);
}
throw "Incorrect number or type of arguments";
@@ -17760,9 +17708,7 @@
if ((key_OR_range is IDBKeyRange || key_OR_range == null)) {
return _count_2(key_OR_range);
}
- if ((key_OR_range is dynamic || key_OR_range == null)) {
- return _count_3(key_OR_range);
- }
+ return _count_3(key_OR_range);
throw "Incorrect number or type of arguments";
}
@@ -17773,36 +17719,24 @@
IDBRequest _count_3(key_OR_range) native "IDBObjectStore_count_3_Callback";
IDBIndex createIndex(/*DOMString*/ name, keyPath, [/*Dictionary*/ options]) {
- if ((name is String || name == null) && (keyPath is List<String> || keyPath == null) && !?options) {
- return _createIndex_1(name, keyPath);
- }
if ((name is String || name == null) && (keyPath is List<String> || keyPath == null) && (options is Map || options == null)) {
- return _createIndex_2(name, keyPath, options);
- }
- if ((name is String || name == null) && (keyPath is String || keyPath == null) && !?options) {
- return _createIndex_3(name, keyPath);
+ return _createIndex_1(name, keyPath, options);
}
if ((name is String || name == null) && (keyPath is String || keyPath == null) && (options is Map || options == null)) {
- return _createIndex_4(name, keyPath, options);
+ return _createIndex_2(name, keyPath, options);
}
throw "Incorrect number or type of arguments";
}
- IDBIndex _createIndex_1(name, keyPath) native "IDBObjectStore_createIndex_1_Callback";
+ IDBIndex _createIndex_1(name, keyPath, options) native "IDBObjectStore_createIndex_1_Callback";
IDBIndex _createIndex_2(name, keyPath, options) native "IDBObjectStore_createIndex_2_Callback";
- IDBIndex _createIndex_3(name, keyPath) native "IDBObjectStore_createIndex_3_Callback";
-
- IDBIndex _createIndex_4(name, keyPath, options) native "IDBObjectStore_createIndex_4_Callback";
-
IDBRequest delete(key_OR_keyRange) {
if ((key_OR_keyRange is IDBKeyRange || key_OR_keyRange == null)) {
return _delete_1(key_OR_keyRange);
}
- if ((key_OR_keyRange is dynamic || key_OR_keyRange == null)) {
- return _delete_2(key_OR_keyRange);
- }
+ return _delete_2(key_OR_keyRange);
throw "Incorrect number or type of arguments";
}
@@ -17816,9 +17750,7 @@
if ((key is IDBKeyRange || key == null)) {
return _get_1(key);
}
- if ((key is dynamic || key == null)) {
- return _get_2(key);
- }
+ return _get_2(key);
throw "Incorrect number or type of arguments";
}
@@ -17838,10 +17770,10 @@
if ((key_OR_range is IDBKeyRange || key_OR_range == null) && (direction is String || direction == null)) {
return _openCursor_3(key_OR_range, direction);
}
- if ((key_OR_range is dynamic || key_OR_range == null) && !?direction) {
+ if (!?direction) {
return _openCursor_4(key_OR_range);
}
- if ((key_OR_range is dynamic || key_OR_range == null) && (direction is String || direction == null)) {
+ if ((direction is String || direction == null)) {
return _openCursor_5(key_OR_range, direction);
}
throw "Incorrect number or type of arguments";
@@ -17901,12 +17833,6 @@
_IDBOpenDBRequestEventsImpl get on =>
new _IDBOpenDBRequestEventsImpl(this);
- void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native "IDBOpenDBRequest_addEventListener_Callback";
-
- bool $dom_dispatchEvent(Event event) native "IDBOpenDBRequest_dispatchEvent_Callback";
-
- void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native "IDBOpenDBRequest_removeEventListener_Callback";
-
}
class _IDBOpenDBRequestEventsImpl extends _IDBRequestEventsImpl implements IDBOpenDBRequestEvents {
@@ -18179,12 +18105,6 @@
_IDBVersionChangeRequestEventsImpl get on =>
new _IDBVersionChangeRequestEventsImpl(this);
- void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native "IDBVersionChangeRequest_addEventListener_Callback";
-
- bool $dom_dispatchEvent(Event event) native "IDBVersionChangeRequest_dispatchEvent_Callback";
-
- void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native "IDBVersionChangeRequest_removeEventListener_Callback";
-
}
class _IDBVersionChangeRequestEventsImpl extends _IDBRequestEventsImpl implements IDBVersionChangeRequestEvents {
@@ -18571,6 +18491,9 @@
/** @domName HTMLInputElement.defaultValue */
String defaultValue;
+ /** @domName HTMLInputElement.dirName */
+ String dirName;
+
/** @domName HTMLInputElement.disabled */
bool disabled;
@@ -18703,6 +18626,9 @@
/** @domName HTMLInputElement.setCustomValidity */
void setCustomValidity(String error);
+ /** @domName HTMLInputElement.setRangeText */
+ void setRangeText(String replacement, [int start, int end, String selectionMode]);
+
/** @domName HTMLInputElement.setSelectionRange */
void setSelectionRange(int start, int end, [String direction]);
@@ -18760,6 +18686,10 @@
void set defaultValue(String value) native "HTMLInputElement_defaultValue_Setter";
+ String get dirName native "HTMLInputElement_dirName_Getter";
+
+ void set dirName(String value) native "HTMLInputElement_dirName_Setter";
+
bool get disabled native "HTMLInputElement_disabled_Getter";
void set disabled(bool value) native "HTMLInputElement_disabled_Setter";
@@ -18916,6 +18846,22 @@
void setCustomValidity(String error) native "HTMLInputElement_setCustomValidity_Callback";
+ void setRangeText(/*DOMString*/ replacement, [/*unsigned long*/ start, /*unsigned long*/ end, /*DOMString*/ selectionMode]) {
+ if ((replacement is String || replacement == null) && !?start && !?end && !?selectionMode) {
+ _setRangeText_1(replacement);
+ return;
+ }
+ if ((replacement is String || replacement == null) && (start is int || start == null) && (end is int || end == null) && (selectionMode is String || selectionMode == null)) {
+ _setRangeText_2(replacement, start, end, selectionMode);
+ return;
+ }
+ throw "Incorrect number or type of arguments";
+ }
+
+ void _setRangeText_1(replacement) native "HTMLInputElement_setRangeText_1_Callback";
+
+ void _setRangeText_2(replacement, start, end, selectionMode) native "HTMLInputElement_setRangeText_2_Callback";
+
void setSelectionRange(int start, int end, [String direction]) native "HTMLInputElement_setSelectionRange_Callback";
void stepDown([/*long*/ n]) {
@@ -19357,54 +19303,6 @@
// WARNING: Do not edit - generated code.
-/// @domName JavaScriptAudioNode
-abstract class JavaScriptAudioNode implements AudioNode, EventTarget {
-
- /**
- * @domName EventTarget.addEventListener, EventTarget.removeEventListener, EventTarget.dispatchEvent
- */
- JavaScriptAudioNodeEvents get on;
-
- /** @domName JavaScriptAudioNode.bufferSize */
- int get bufferSize;
-}
-
-abstract class JavaScriptAudioNodeEvents implements Events {
-
- EventListenerList get audioProcess;
-}
-// 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.
-
-class _JavaScriptAudioNodeImpl extends _AudioNodeImpl implements JavaScriptAudioNode {
-
- _JavaScriptAudioNodeEventsImpl get on =>
- new _JavaScriptAudioNodeEventsImpl(this);
-
- int get bufferSize native "JavaScriptAudioNode_bufferSize_Getter";
-
- void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native "JavaScriptAudioNode_addEventListener_Callback";
-
- bool $dom_dispatchEvent(Event event) native "JavaScriptAudioNode_dispatchEvent_Callback";
-
- void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native "JavaScriptAudioNode_removeEventListener_Callback";
-
-}
-
-class _JavaScriptAudioNodeEventsImpl extends _EventsImpl implements JavaScriptAudioNodeEvents {
- _JavaScriptAudioNodeEventsImpl(_ptr) : super(_ptr);
-
- EventListenerList get audioProcess => this['audioprocess'];
-}
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-// WARNING: Do not edit - generated code.
-
/// @domName JavaScriptCallFrame
abstract class JavaScriptCallFrame {
@@ -20012,12 +19910,6 @@
void stop() native "LocalMediaStream_stop_Callback";
- void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native "LocalMediaStream_addEventListener_Callback";
-
- bool $dom_dispatchEvent(Event event) native "LocalMediaStream_dispatchEvent_Callback";
-
- void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native "LocalMediaStream_removeEventListener_Callback";
-
}
// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
@@ -24125,6 +24017,24 @@
// WARNING: Do not edit - generated code.
+/// @domName OESElementIndexUint
+abstract class OESElementIndexUint {
+}
+// 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.
+
+class _OESElementIndexUintImpl extends NativeFieldWrapperClass1 implements OESElementIndexUint {
+
+}
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// WARNING: Do not edit - generated code.
+
/// @domName OESStandardDerivatives
abstract class OESStandardDerivatives {
@@ -24549,8 +24459,8 @@
// WARNING: Do not edit - generated code.
-/// @domName Oscillator
-abstract class Oscillator implements AudioSourceNode {
+/// @domName OscillatorNode
+abstract class OscillatorNode implements AudioSourceNode {
static const int CUSTOM = 4;
@@ -24570,25 +24480,25 @@
static const int UNSCHEDULED_STATE = 0;
- /** @domName Oscillator.detune */
+ /** @domName OscillatorNode.detune */
AudioParam get detune;
- /** @domName Oscillator.frequency */
+ /** @domName OscillatorNode.frequency */
AudioParam get frequency;
- /** @domName Oscillator.playbackState */
+ /** @domName OscillatorNode.playbackState */
int get playbackState;
- /** @domName Oscillator.type */
+ /** @domName OscillatorNode.type */
int type;
- /** @domName Oscillator.setWaveTable */
+ /** @domName OscillatorNode.setWaveTable */
void setWaveTable(WaveTable waveTable);
- /** @domName Oscillator.start */
+ /** @domName OscillatorNode.start */
void start(num when);
- /** @domName Oscillator.stop */
+ /** @domName OscillatorNode.stop */
void stop(num when);
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
@@ -24597,23 +24507,23 @@
// WARNING: Do not edit - generated code.
-class _OscillatorImpl extends _AudioSourceNodeImpl implements Oscillator {
+class _OscillatorNodeImpl extends _AudioSourceNodeImpl implements OscillatorNode {
- AudioParam get detune native "Oscillator_detune_Getter";
+ AudioParam get detune native "OscillatorNode_detune_Getter";
- AudioParam get frequency native "Oscillator_frequency_Getter";
+ AudioParam get frequency native "OscillatorNode_frequency_Getter";
- int get playbackState native "Oscillator_playbackState_Getter";
+ int get playbackState native "OscillatorNode_playbackState_Getter";
- int get type native "Oscillator_type_Getter";
+ int get type native "OscillatorNode_type_Getter";
- void set type(int value) native "Oscillator_type_Setter";
+ void set type(int value) native "OscillatorNode_type_Setter";
- void setWaveTable(WaveTable waveTable) native "Oscillator_setWaveTable_Callback";
+ void setWaveTable(WaveTable waveTable) native "OscillatorNode_setWaveTable_Callback";
- void start(num when) native "Oscillator_start_Callback";
+ void start(num when) native "OscillatorNode_start_Callback";
- void stop(num when) native "Oscillator_stop_Callback";
+ void stop(num when) native "OscillatorNode_stop_Callback";
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
@@ -24800,6 +24710,117 @@
// WARNING: Do not edit - generated code.
+/// @domName PannerNode
+abstract class PannerNode implements AudioNode {
+
+ static const int EQUALPOWER = 0;
+
+ static const int EXPONENTIAL_DISTANCE = 2;
+
+ static const int HRTF = 1;
+
+ static const int INVERSE_DISTANCE = 1;
+
+ static const int LINEAR_DISTANCE = 0;
+
+ static const int SOUNDFIELD = 2;
+
+ /** @domName PannerNode.coneGain */
+ AudioGain get coneGain;
+
+ /** @domName PannerNode.coneInnerAngle */
+ num coneInnerAngle;
+
+ /** @domName PannerNode.coneOuterAngle */
+ num coneOuterAngle;
+
+ /** @domName PannerNode.coneOuterGain */
+ num coneOuterGain;
+
+ /** @domName PannerNode.distanceGain */
+ AudioGain get distanceGain;
+
+ /** @domName PannerNode.distanceModel */
+ int distanceModel;
+
+ /** @domName PannerNode.maxDistance */
+ num maxDistance;
+
+ /** @domName PannerNode.panningModel */
+ int panningModel;
+
+ /** @domName PannerNode.refDistance */
+ num refDistance;
+
+ /** @domName PannerNode.rolloffFactor */
+ num rolloffFactor;
+
+ /** @domName PannerNode.setOrientation */
+ void setOrientation(num x, num y, num z);
+
+ /** @domName PannerNode.setPosition */
+ void setPosition(num x, num y, num z);
+
+ /** @domName PannerNode.setVelocity */
+ void setVelocity(num x, num y, num z);
+}
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// WARNING: Do not edit - generated code.
+
+class _PannerNodeImpl extends _AudioNodeImpl implements PannerNode {
+
+ AudioGain get coneGain native "PannerNode_coneGain_Getter";
+
+ num get coneInnerAngle native "PannerNode_coneInnerAngle_Getter";
+
+ void set coneInnerAngle(num value) native "PannerNode_coneInnerAngle_Setter";
+
+ num get coneOuterAngle native "PannerNode_coneOuterAngle_Getter";
+
+ void set coneOuterAngle(num value) native "PannerNode_coneOuterAngle_Setter";
+
+ num get coneOuterGain native "PannerNode_coneOuterGain_Getter";
+
+ void set coneOuterGain(num value) native "PannerNode_coneOuterGain_Setter";
+
+ AudioGain get distanceGain native "PannerNode_distanceGain_Getter";
+
+ int get distanceModel native "PannerNode_distanceModel_Getter";
+
+ void set distanceModel(int value) native "PannerNode_distanceModel_Setter";
+
+ num get maxDistance native "PannerNode_maxDistance_Getter";
+
+ void set maxDistance(num value) native "PannerNode_maxDistance_Setter";
+
+ int get panningModel native "PannerNode_panningModel_Getter";
+
+ void set panningModel(int value) native "PannerNode_panningModel_Setter";
+
+ num get refDistance native "PannerNode_refDistance_Getter";
+
+ void set refDistance(num value) native "PannerNode_refDistance_Setter";
+
+ num get rolloffFactor native "PannerNode_rolloffFactor_Getter";
+
+ void set rolloffFactor(num value) native "PannerNode_rolloffFactor_Setter";
+
+ void setOrientation(num x, num y, num z) native "PannerNode_setOrientation_Callback";
+
+ void setPosition(num x, num y, num z) native "PannerNode_setPosition_Callback";
+
+ void setVelocity(num x, num y, num z) native "PannerNode_setVelocity_Callback";
+
+}
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// WARNING: Do not edit - generated code.
+
/// @domName HTMLParagraphElement
abstract class ParagraphElement implements Element {
@@ -25005,41 +25026,13 @@
void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native "PeerConnection00_addEventListener_Callback";
- void addStream(/*MediaStream*/ stream, [/*Dictionary*/ mediaStreamHints]) {
- if (?mediaStreamHints) {
- _addStream_1(stream, mediaStreamHints);
- return;
- }
- _addStream_2(stream);
- }
-
- void _addStream_1(stream, mediaStreamHints) native "PeerConnection00_addStream_1_Callback";
-
- void _addStream_2(stream) native "PeerConnection00_addStream_2_Callback";
+ void addStream(MediaStream stream, [Map mediaStreamHints]) native "PeerConnection00_addStream_Callback";
void close() native "PeerConnection00_close_Callback";
- SessionDescription createAnswer(/*DOMString*/ offer, [/*Dictionary*/ mediaHints]) {
- if (?mediaHints) {
- return _createAnswer_1(offer, mediaHints);
- }
- return _createAnswer_2(offer);
- }
+ SessionDescription createAnswer(String offer, [Map mediaHints]) native "PeerConnection00_createAnswer_Callback";
- SessionDescription _createAnswer_1(offer, mediaHints) native "PeerConnection00_createAnswer_1_Callback";
-
- SessionDescription _createAnswer_2(offer) native "PeerConnection00_createAnswer_2_Callback";
-
- SessionDescription createOffer([/*Dictionary*/ mediaHints]) {
- if (?mediaHints) {
- return _createOffer_1(mediaHints);
- }
- return _createOffer_2();
- }
-
- SessionDescription _createOffer_1(mediaHints) native "PeerConnection00_createOffer_1_Callback";
-
- SessionDescription _createOffer_2() native "PeerConnection00_createOffer_2_Callback";
+ SessionDescription createOffer([Map mediaHints]) native "PeerConnection00_createOffer_Callback";
bool $dom_dispatchEvent(Event event) native "PeerConnection00_dispatchEvent_Callback";
@@ -25053,17 +25046,7 @@
void setRemoteDescription(int action, SessionDescription desc) native "PeerConnection00_setRemoteDescription_Callback";
- void startIce([/*Dictionary*/ iceOptions]) {
- if (?iceOptions) {
- _startIce_1(iceOptions);
- return;
- }
- _startIce_2();
- }
-
- void _startIce_1(iceOptions) native "PeerConnection00_startIce_1_Callback";
-
- void _startIce_2() native "PeerConnection00_startIce_2_Callback";
+ void startIce([Map iceOptions]) native "PeerConnection00_startIce_Callback";
}
@@ -25851,7 +25834,7 @@
void addIceCandidate(RTCIceCandidate candidate);
/** @domName RTCPeerConnection.addStream */
- void addStream(MediaStream stream, Map mediaConstraints);
+ void addStream(MediaStream stream, [Map mediaConstraints]);
/** @domName RTCPeerConnection.close */
void close();
@@ -25860,7 +25843,7 @@
void createAnswer(RTCSessionDescriptionCallback successCallback, [RTCErrorCallback failureCallback, Map mediaConstraints]);
/** @domName RTCPeerConnection.createDataChannel */
- RTCDataChannel createDataChannel(String label, Map options);
+ RTCDataChannel createDataChannel(String label, [Map options]);
/** @domName RTCPeerConnection.createOffer */
void createOffer(RTCSessionDescriptionCallback successCallback, [RTCErrorCallback failureCallback, Map mediaConstraints]);
@@ -25884,7 +25867,7 @@
void setRemoteDescription(RTCSessionDescription description, [VoidCallback successCallback, RTCErrorCallback failureCallback]);
/** @domName RTCPeerConnection.updateIce */
- void updateIce(Map configuration, Map mediaConstraints);
+ void updateIce([Map configuration, Map mediaConstraints]);
}
abstract class RTCPeerConnectionEvents implements Events {
@@ -25930,13 +25913,13 @@
void addIceCandidate(RTCIceCandidate candidate) native "RTCPeerConnection_addIceCandidate_Callback";
- void addStream(MediaStream stream, Map mediaConstraints) native "RTCPeerConnection_addStream_Callback";
+ void addStream(MediaStream stream, [Map mediaConstraints]) native "RTCPeerConnection_addStream_Callback";
void close() native "RTCPeerConnection_close_Callback";
void createAnswer(RTCSessionDescriptionCallback successCallback, [RTCErrorCallback failureCallback, Map mediaConstraints]) native "RTCPeerConnection_createAnswer_Callback";
- RTCDataChannel createDataChannel(String label, Map options) native "RTCPeerConnection_createDataChannel_Callback";
+ RTCDataChannel createDataChannel(String label, [Map options]) native "RTCPeerConnection_createDataChannel_Callback";
void createOffer(RTCSessionDescriptionCallback successCallback, [RTCErrorCallback failureCallback, Map mediaConstraints]) native "RTCPeerConnection_createOffer_Callback";
@@ -25952,7 +25935,7 @@
void setRemoteDescription(RTCSessionDescription description, [VoidCallback successCallback, RTCErrorCallback failureCallback]) native "RTCPeerConnection_setRemoteDescription_Callback";
- void updateIce(Map configuration, Map mediaConstraints) native "RTCPeerConnection_updateIce_Callback";
+ void updateIce([Map configuration, Map mediaConstraints]) native "RTCPeerConnection_updateIce_Callback";
}
@@ -26364,72 +26347,6 @@
// WARNING: Do not edit - generated code.
-/// @domName RealtimeAnalyserNode
-abstract class RealtimeAnalyserNode implements AudioNode {
-
- /** @domName RealtimeAnalyserNode.fftSize */
- int fftSize;
-
- /** @domName RealtimeAnalyserNode.frequencyBinCount */
- int get frequencyBinCount;
-
- /** @domName RealtimeAnalyserNode.maxDecibels */
- num maxDecibels;
-
- /** @domName RealtimeAnalyserNode.minDecibels */
- num minDecibels;
-
- /** @domName RealtimeAnalyserNode.smoothingTimeConstant */
- num smoothingTimeConstant;
-
- /** @domName RealtimeAnalyserNode.getByteFrequencyData */
- void getByteFrequencyData(Uint8Array array);
-
- /** @domName RealtimeAnalyserNode.getByteTimeDomainData */
- void getByteTimeDomainData(Uint8Array array);
-
- /** @domName RealtimeAnalyserNode.getFloatFrequencyData */
- void getFloatFrequencyData(Float32Array array);
-}
-// 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.
-
-class _RealtimeAnalyserNodeImpl extends _AudioNodeImpl implements RealtimeAnalyserNode {
-
- int get fftSize native "RealtimeAnalyserNode_fftSize_Getter";
-
- void set fftSize(int value) native "RealtimeAnalyserNode_fftSize_Setter";
-
- int get frequencyBinCount native "RealtimeAnalyserNode_frequencyBinCount_Getter";
-
- num get maxDecibels native "RealtimeAnalyserNode_maxDecibels_Getter";
-
- void set maxDecibels(num value) native "RealtimeAnalyserNode_maxDecibels_Setter";
-
- num get minDecibels native "RealtimeAnalyserNode_minDecibels_Getter";
-
- void set minDecibels(num value) native "RealtimeAnalyserNode_minDecibels_Setter";
-
- num get smoothingTimeConstant native "RealtimeAnalyserNode_smoothingTimeConstant_Getter";
-
- void set smoothingTimeConstant(num value) native "RealtimeAnalyserNode_smoothingTimeConstant_Setter";
-
- void getByteFrequencyData(Uint8Array array) native "RealtimeAnalyserNode_getByteFrequencyData_Callback";
-
- void getByteTimeDomainData(Uint8Array array) native "RealtimeAnalyserNode_getByteTimeDomainData_Callback";
-
- void getFloatFrequencyData(Float32Array array) native "RealtimeAnalyserNode_getFloatFrequencyData_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.
-
/// @domName Rect
abstract class Rect {
@@ -26810,15 +26727,7 @@
SVGAnimatedString get target native "SVGAElement_target_Getter";
- SVGAnimatedString get href native "SVGAElement_href_Getter";
-
- SVGStringList get requiredExtensions native "SVGAElement_requiredExtensions_Getter";
-
- SVGStringList get requiredFeatures native "SVGAElement_requiredFeatures_Getter";
-
- SVGStringList get systemLanguage native "SVGAElement_systemLanguage_Getter";
-
- bool hasExtension(String extension) native "SVGAElement_hasExtension_Callback";
+ SVGAnimatedBoolean get externalResourcesRequired native "SVGAElement_externalResourcesRequired_Getter";
String get xmllang native "SVGAElement_xmllang_Getter";
@@ -26828,16 +26737,6 @@
void set xmlspace(String value) native "SVGAElement_xmlspace_Setter";
- SVGAnimatedBoolean get externalResourcesRequired native "SVGAElement_externalResourcesRequired_Getter";
-
- SVGAnimatedString get $dom_svgClassName native "SVGAElement_className_Getter";
-
- CSSStyleDeclaration get style native "SVGAElement_style_Getter";
-
- CSSValue getPresentationAttribute(String name) native "SVGAElement_getPresentationAttribute_Callback";
-
- SVGAnimatedTransformList get transform native "SVGAElement_transform_Getter";
-
SVGElement get farthestViewportElement native "SVGAElement_farthestViewportElement_Getter";
SVGElement get nearestViewportElement native "SVGAElement_nearestViewportElement_Getter";
@@ -26850,6 +26749,24 @@
SVGMatrix getTransformToElement(SVGElement element) native "SVGAElement_getTransformToElement_Callback";
+ SVGAnimatedString get $dom_svgClassName native "SVGAElement_className_Getter";
+
+ CSSStyleDeclaration get style native "SVGAElement_style_Getter";
+
+ CSSValue getPresentationAttribute(String name) native "SVGAElement_getPresentationAttribute_Callback";
+
+ SVGStringList get requiredExtensions native "SVGAElement_requiredExtensions_Getter";
+
+ SVGStringList get requiredFeatures native "SVGAElement_requiredFeatures_Getter";
+
+ SVGStringList get systemLanguage native "SVGAElement_systemLanguage_Getter";
+
+ bool hasExtension(String extension) native "SVGAElement_hasExtension_Callback";
+
+ SVGAnimatedTransformList get transform native "SVGAElement_transform_Getter";
+
+ SVGAnimatedString get href native "SVGAElement_href_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
@@ -27689,16 +27606,6 @@
num getStartTime() native "SVGAnimationElement_getStartTime_Callback";
- SVGStringList get requiredExtensions native "SVGAnimationElement_requiredExtensions_Getter";
-
- SVGStringList get requiredFeatures native "SVGAnimationElement_requiredFeatures_Getter";
-
- SVGStringList get systemLanguage native "SVGAnimationElement_systemLanguage_Getter";
-
- bool hasExtension(String extension) native "SVGAnimationElement_hasExtension_Callback";
-
- SVGAnimatedBoolean get externalResourcesRequired native "SVGAnimationElement_externalResourcesRequired_Getter";
-
void beginElement() native "SVGAnimationElement_beginElement_Callback";
void beginElementAt(num offset) native "SVGAnimationElement_beginElementAt_Callback";
@@ -27707,6 +27614,16 @@
void endElementAt(num offset) native "SVGAnimationElement_endElementAt_Callback";
+ SVGAnimatedBoolean get externalResourcesRequired native "SVGAnimationElement_externalResourcesRequired_Getter";
+
+ SVGStringList get requiredExtensions native "SVGAnimationElement_requiredExtensions_Getter";
+
+ SVGStringList get requiredFeatures native "SVGAnimationElement_requiredFeatures_Getter";
+
+ SVGStringList get systemLanguage native "SVGAnimationElement_systemLanguage_Getter";
+
+ bool hasExtension(String extension) native "SVGAnimationElement_hasExtension_Callback";
+
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
@@ -27740,13 +27657,7 @@
SVGAnimatedLength get r native "SVGCircleElement_r_Getter";
- SVGStringList get requiredExtensions native "SVGCircleElement_requiredExtensions_Getter";
-
- SVGStringList get requiredFeatures native "SVGCircleElement_requiredFeatures_Getter";
-
- SVGStringList get systemLanguage native "SVGCircleElement_systemLanguage_Getter";
-
- bool hasExtension(String extension) native "SVGCircleElement_hasExtension_Callback";
+ SVGAnimatedBoolean get externalResourcesRequired native "SVGCircleElement_externalResourcesRequired_Getter";
String get xmllang native "SVGCircleElement_xmllang_Getter";
@@ -27756,16 +27667,6 @@
void set xmlspace(String value) native "SVGCircleElement_xmlspace_Setter";
- SVGAnimatedBoolean get externalResourcesRequired native "SVGCircleElement_externalResourcesRequired_Getter";
-
- SVGAnimatedString get $dom_svgClassName native "SVGCircleElement_className_Getter";
-
- CSSStyleDeclaration get style native "SVGCircleElement_style_Getter";
-
- CSSValue getPresentationAttribute(String name) native "SVGCircleElement_getPresentationAttribute_Callback";
-
- SVGAnimatedTransformList get transform native "SVGCircleElement_transform_Getter";
-
SVGElement get farthestViewportElement native "SVGCircleElement_farthestViewportElement_Getter";
SVGElement get nearestViewportElement native "SVGCircleElement_nearestViewportElement_Getter";
@@ -27778,6 +27679,22 @@
SVGMatrix getTransformToElement(SVGElement element) native "SVGCircleElement_getTransformToElement_Callback";
+ SVGAnimatedString get $dom_svgClassName native "SVGCircleElement_className_Getter";
+
+ CSSStyleDeclaration get style native "SVGCircleElement_style_Getter";
+
+ CSSValue getPresentationAttribute(String name) native "SVGCircleElement_getPresentationAttribute_Callback";
+
+ SVGStringList get requiredExtensions native "SVGCircleElement_requiredExtensions_Getter";
+
+ SVGStringList get requiredFeatures native "SVGCircleElement_requiredFeatures_Getter";
+
+ SVGStringList get systemLanguage native "SVGCircleElement_systemLanguage_Getter";
+
+ bool hasExtension(String extension) native "SVGCircleElement_hasExtension_Callback";
+
+ SVGAnimatedTransformList get transform native "SVGCircleElement_transform_Getter";
+
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
@@ -27801,13 +27718,7 @@
SVGAnimatedEnumeration get clipPathUnits native "SVGClipPathElement_clipPathUnits_Getter";
- SVGStringList get requiredExtensions native "SVGClipPathElement_requiredExtensions_Getter";
-
- SVGStringList get requiredFeatures native "SVGClipPathElement_requiredFeatures_Getter";
-
- SVGStringList get systemLanguage native "SVGClipPathElement_systemLanguage_Getter";
-
- bool hasExtension(String extension) native "SVGClipPathElement_hasExtension_Callback";
+ SVGAnimatedBoolean get externalResourcesRequired native "SVGClipPathElement_externalResourcesRequired_Getter";
String get xmllang native "SVGClipPathElement_xmllang_Getter";
@@ -27817,16 +27728,6 @@
void set xmlspace(String value) native "SVGClipPathElement_xmlspace_Setter";
- SVGAnimatedBoolean get externalResourcesRequired native "SVGClipPathElement_externalResourcesRequired_Getter";
-
- SVGAnimatedString get $dom_svgClassName native "SVGClipPathElement_className_Getter";
-
- CSSStyleDeclaration get style native "SVGClipPathElement_style_Getter";
-
- CSSValue getPresentationAttribute(String name) native "SVGClipPathElement_getPresentationAttribute_Callback";
-
- SVGAnimatedTransformList get transform native "SVGClipPathElement_transform_Getter";
-
SVGElement get farthestViewportElement native "SVGClipPathElement_farthestViewportElement_Getter";
SVGElement get nearestViewportElement native "SVGClipPathElement_nearestViewportElement_Getter";
@@ -27839,6 +27740,22 @@
SVGMatrix getTransformToElement(SVGElement element) native "SVGClipPathElement_getTransformToElement_Callback";
+ SVGAnimatedString get $dom_svgClassName native "SVGClipPathElement_className_Getter";
+
+ CSSStyleDeclaration get style native "SVGClipPathElement_style_Getter";
+
+ CSSValue getPresentationAttribute(String name) native "SVGClipPathElement_getPresentationAttribute_Callback";
+
+ SVGStringList get requiredExtensions native "SVGClipPathElement_requiredExtensions_Getter";
+
+ SVGStringList get requiredFeatures native "SVGClipPathElement_requiredFeatures_Getter";
+
+ SVGStringList get systemLanguage native "SVGClipPathElement_systemLanguage_Getter";
+
+ bool hasExtension(String extension) native "SVGClipPathElement_hasExtension_Callback";
+
+ SVGAnimatedTransformList get transform native "SVGClipPathElement_transform_Getter";
+
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
@@ -27983,7 +27900,7 @@
SVGAnimatedLength get y native "SVGCursorElement_y_Getter";
- SVGAnimatedString get href native "SVGCursorElement_href_Getter";
+ SVGAnimatedBoolean get externalResourcesRequired native "SVGCursorElement_externalResourcesRequired_Getter";
SVGStringList get requiredExtensions native "SVGCursorElement_requiredExtensions_Getter";
@@ -27993,7 +27910,7 @@
bool hasExtension(String extension) native "SVGCursorElement_hasExtension_Callback";
- SVGAnimatedBoolean get externalResourcesRequired native "SVGCursorElement_externalResourcesRequired_Getter";
+ SVGAnimatedString get href native "SVGCursorElement_href_Getter";
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
@@ -28013,13 +27930,7 @@
class _SVGDefsElementImpl extends _SVGElementImpl implements SVGDefsElement {
- SVGStringList get requiredExtensions native "SVGDefsElement_requiredExtensions_Getter";
-
- SVGStringList get requiredFeatures native "SVGDefsElement_requiredFeatures_Getter";
-
- SVGStringList get systemLanguage native "SVGDefsElement_systemLanguage_Getter";
-
- bool hasExtension(String extension) native "SVGDefsElement_hasExtension_Callback";
+ SVGAnimatedBoolean get externalResourcesRequired native "SVGDefsElement_externalResourcesRequired_Getter";
String get xmllang native "SVGDefsElement_xmllang_Getter";
@@ -28029,16 +27940,6 @@
void set xmlspace(String value) native "SVGDefsElement_xmlspace_Setter";
- SVGAnimatedBoolean get externalResourcesRequired native "SVGDefsElement_externalResourcesRequired_Getter";
-
- SVGAnimatedString get $dom_svgClassName native "SVGDefsElement_className_Getter";
-
- CSSStyleDeclaration get style native "SVGDefsElement_style_Getter";
-
- CSSValue getPresentationAttribute(String name) native "SVGDefsElement_getPresentationAttribute_Callback";
-
- SVGAnimatedTransformList get transform native "SVGDefsElement_transform_Getter";
-
SVGElement get farthestViewportElement native "SVGDefsElement_farthestViewportElement_Getter";
SVGElement get nearestViewportElement native "SVGDefsElement_nearestViewportElement_Getter";
@@ -28051,6 +27952,22 @@
SVGMatrix getTransformToElement(SVGElement element) native "SVGDefsElement_getTransformToElement_Callback";
+ SVGAnimatedString get $dom_svgClassName native "SVGDefsElement_className_Getter";
+
+ CSSStyleDeclaration get style native "SVGDefsElement_style_Getter";
+
+ CSSValue getPresentationAttribute(String name) native "SVGDefsElement_getPresentationAttribute_Callback";
+
+ SVGStringList get requiredExtensions native "SVGDefsElement_requiredExtensions_Getter";
+
+ SVGStringList get requiredFeatures native "SVGDefsElement_requiredFeatures_Getter";
+
+ SVGStringList get systemLanguage native "SVGDefsElement_systemLanguage_Getter";
+
+ bool hasExtension(String extension) native "SVGDefsElement_hasExtension_Callback";
+
+ SVGAnimatedTransformList get transform native "SVGDefsElement_transform_Getter";
+
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
@@ -28573,13 +28490,7 @@
SVGAnimatedLength get ry native "SVGEllipseElement_ry_Getter";
- SVGStringList get requiredExtensions native "SVGEllipseElement_requiredExtensions_Getter";
-
- SVGStringList get requiredFeatures native "SVGEllipseElement_requiredFeatures_Getter";
-
- SVGStringList get systemLanguage native "SVGEllipseElement_systemLanguage_Getter";
-
- bool hasExtension(String extension) native "SVGEllipseElement_hasExtension_Callback";
+ SVGAnimatedBoolean get externalResourcesRequired native "SVGEllipseElement_externalResourcesRequired_Getter";
String get xmllang native "SVGEllipseElement_xmllang_Getter";
@@ -28589,16 +28500,6 @@
void set xmlspace(String value) native "SVGEllipseElement_xmlspace_Setter";
- SVGAnimatedBoolean get externalResourcesRequired native "SVGEllipseElement_externalResourcesRequired_Getter";
-
- SVGAnimatedString get $dom_svgClassName native "SVGEllipseElement_className_Getter";
-
- CSSStyleDeclaration get style native "SVGEllipseElement_style_Getter";
-
- CSSValue getPresentationAttribute(String name) native "SVGEllipseElement_getPresentationAttribute_Callback";
-
- SVGAnimatedTransformList get transform native "SVGEllipseElement_transform_Getter";
-
SVGElement get farthestViewportElement native "SVGEllipseElement_farthestViewportElement_Getter";
SVGElement get nearestViewportElement native "SVGEllipseElement_nearestViewportElement_Getter";
@@ -28611,6 +28512,22 @@
SVGMatrix getTransformToElement(SVGElement element) native "SVGEllipseElement_getTransformToElement_Callback";
+ SVGAnimatedString get $dom_svgClassName native "SVGEllipseElement_className_Getter";
+
+ CSSStyleDeclaration get style native "SVGEllipseElement_style_Getter";
+
+ CSSValue getPresentationAttribute(String name) native "SVGEllipseElement_getPresentationAttribute_Callback";
+
+ SVGStringList get requiredExtensions native "SVGEllipseElement_requiredExtensions_Getter";
+
+ SVGStringList get requiredFeatures native "SVGEllipseElement_requiredFeatures_Getter";
+
+ SVGStringList get systemLanguage native "SVGEllipseElement_systemLanguage_Getter";
+
+ bool hasExtension(String extension) native "SVGEllipseElement_hasExtension_Callback";
+
+ SVGAnimatedTransformList get transform native "SVGEllipseElement_transform_Getter";
+
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
@@ -29414,16 +29331,6 @@
SVGAnimatedPreserveAspectRatio get preserveAspectRatio native "SVGFEImageElement_preserveAspectRatio_Getter";
- SVGAnimatedString get href native "SVGFEImageElement_href_Getter";
-
- String get xmllang native "SVGFEImageElement_xmllang_Getter";
-
- void set xmllang(String value) native "SVGFEImageElement_xmllang_Setter";
-
- String get xmlspace native "SVGFEImageElement_xmlspace_Getter";
-
- void set xmlspace(String value) native "SVGFEImageElement_xmlspace_Setter";
-
SVGAnimatedBoolean get externalResourcesRequired native "SVGFEImageElement_externalResourcesRequired_Getter";
SVGAnimatedLength get height native "SVGFEImageElement_height_Getter";
@@ -29436,12 +29343,22 @@
SVGAnimatedLength get y native "SVGFEImageElement_y_Getter";
+ String get xmllang native "SVGFEImageElement_xmllang_Getter";
+
+ void set xmllang(String value) native "SVGFEImageElement_xmllang_Setter";
+
+ String get xmlspace native "SVGFEImageElement_xmlspace_Getter";
+
+ void set xmlspace(String value) native "SVGFEImageElement_xmlspace_Setter";
+
SVGAnimatedString get $dom_svgClassName native "SVGFEImageElement_className_Getter";
CSSStyleDeclaration get style native "SVGFEImageElement_style_Getter";
CSSValue getPresentationAttribute(String name) native "SVGFEImageElement_getPresentationAttribute_Callback";
+ SVGAnimatedString get href native "SVGFEImageElement_href_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
@@ -29936,7 +29853,7 @@
void setFilterRes(int filterResX, int filterResY) native "SVGFilterElement_setFilterRes_Callback";
- SVGAnimatedString get href native "SVGFilterElement_href_Getter";
+ SVGAnimatedBoolean get externalResourcesRequired native "SVGFilterElement_externalResourcesRequired_Getter";
String get xmllang native "SVGFilterElement_xmllang_Getter";
@@ -29946,14 +29863,14 @@
void set xmlspace(String value) native "SVGFilterElement_xmlspace_Setter";
- SVGAnimatedBoolean get externalResourcesRequired native "SVGFilterElement_externalResourcesRequired_Getter";
-
SVGAnimatedString get $dom_svgClassName native "SVGFilterElement_className_Getter";
CSSStyleDeclaration get style native "SVGFilterElement_style_Getter";
CSSValue getPresentationAttribute(String name) native "SVGFilterElement_getPresentationAttribute_Callback";
+ SVGAnimatedString get href native "SVGFilterElement_href_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
@@ -30139,13 +30056,7 @@
SVGAnimatedLength get y native "SVGForeignObjectElement_y_Getter";
- SVGStringList get requiredExtensions native "SVGForeignObjectElement_requiredExtensions_Getter";
-
- SVGStringList get requiredFeatures native "SVGForeignObjectElement_requiredFeatures_Getter";
-
- SVGStringList get systemLanguage native "SVGForeignObjectElement_systemLanguage_Getter";
-
- bool hasExtension(String extension) native "SVGForeignObjectElement_hasExtension_Callback";
+ SVGAnimatedBoolean get externalResourcesRequired native "SVGForeignObjectElement_externalResourcesRequired_Getter";
String get xmllang native "SVGForeignObjectElement_xmllang_Getter";
@@ -30155,16 +30066,6 @@
void set xmlspace(String value) native "SVGForeignObjectElement_xmlspace_Setter";
- SVGAnimatedBoolean get externalResourcesRequired native "SVGForeignObjectElement_externalResourcesRequired_Getter";
-
- SVGAnimatedString get $dom_svgClassName native "SVGForeignObjectElement_className_Getter";
-
- CSSStyleDeclaration get style native "SVGForeignObjectElement_style_Getter";
-
- CSSValue getPresentationAttribute(String name) native "SVGForeignObjectElement_getPresentationAttribute_Callback";
-
- SVGAnimatedTransformList get transform native "SVGForeignObjectElement_transform_Getter";
-
SVGElement get farthestViewportElement native "SVGForeignObjectElement_farthestViewportElement_Getter";
SVGElement get nearestViewportElement native "SVGForeignObjectElement_nearestViewportElement_Getter";
@@ -30177,6 +30078,22 @@
SVGMatrix getTransformToElement(SVGElement element) native "SVGForeignObjectElement_getTransformToElement_Callback";
+ SVGAnimatedString get $dom_svgClassName native "SVGForeignObjectElement_className_Getter";
+
+ CSSStyleDeclaration get style native "SVGForeignObjectElement_style_Getter";
+
+ CSSValue getPresentationAttribute(String name) native "SVGForeignObjectElement_getPresentationAttribute_Callback";
+
+ SVGStringList get requiredExtensions native "SVGForeignObjectElement_requiredExtensions_Getter";
+
+ SVGStringList get requiredFeatures native "SVGForeignObjectElement_requiredFeatures_Getter";
+
+ SVGStringList get systemLanguage native "SVGForeignObjectElement_systemLanguage_Getter";
+
+ bool hasExtension(String extension) native "SVGForeignObjectElement_hasExtension_Callback";
+
+ SVGAnimatedTransformList get transform native "SVGForeignObjectElement_transform_Getter";
+
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
@@ -30195,13 +30112,7 @@
class _SVGGElementImpl extends _SVGElementImpl implements SVGGElement {
- SVGStringList get requiredExtensions native "SVGGElement_requiredExtensions_Getter";
-
- SVGStringList get requiredFeatures native "SVGGElement_requiredFeatures_Getter";
-
- SVGStringList get systemLanguage native "SVGGElement_systemLanguage_Getter";
-
- bool hasExtension(String extension) native "SVGGElement_hasExtension_Callback";
+ SVGAnimatedBoolean get externalResourcesRequired native "SVGGElement_externalResourcesRequired_Getter";
String get xmllang native "SVGGElement_xmllang_Getter";
@@ -30211,16 +30122,6 @@
void set xmlspace(String value) native "SVGGElement_xmlspace_Setter";
- SVGAnimatedBoolean get externalResourcesRequired native "SVGGElement_externalResourcesRequired_Getter";
-
- SVGAnimatedString get $dom_svgClassName native "SVGGElement_className_Getter";
-
- CSSStyleDeclaration get style native "SVGGElement_style_Getter";
-
- CSSValue getPresentationAttribute(String name) native "SVGGElement_getPresentationAttribute_Callback";
-
- SVGAnimatedTransformList get transform native "SVGGElement_transform_Getter";
-
SVGElement get farthestViewportElement native "SVGGElement_farthestViewportElement_Getter";
SVGElement get nearestViewportElement native "SVGGElement_nearestViewportElement_Getter";
@@ -30233,6 +30134,22 @@
SVGMatrix getTransformToElement(SVGElement element) native "SVGGElement_getTransformToElement_Callback";
+ SVGAnimatedString get $dom_svgClassName native "SVGGElement_className_Getter";
+
+ CSSStyleDeclaration get style native "SVGGElement_style_Getter";
+
+ CSSValue getPresentationAttribute(String name) native "SVGGElement_getPresentationAttribute_Callback";
+
+ SVGStringList get requiredExtensions native "SVGGElement_requiredExtensions_Getter";
+
+ SVGStringList get requiredFeatures native "SVGGElement_requiredFeatures_Getter";
+
+ SVGStringList get systemLanguage native "SVGGElement_systemLanguage_Getter";
+
+ bool hasExtension(String extension) native "SVGGElement_hasExtension_Callback";
+
+ SVGAnimatedTransformList get transform native "SVGGElement_transform_Getter";
+
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
@@ -30311,14 +30228,14 @@
void set y(num value) native "SVGGlyphRefElement_y_Setter";
- SVGAnimatedString get href native "SVGGlyphRefElement_href_Getter";
-
SVGAnimatedString get $dom_svgClassName native "SVGGlyphRefElement_className_Getter";
CSSStyleDeclaration get style native "SVGGlyphRefElement_style_Getter";
CSSValue getPresentationAttribute(String name) native "SVGGlyphRefElement_getPresentationAttribute_Callback";
+ SVGAnimatedString get href native "SVGGlyphRefElement_href_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
@@ -30360,8 +30277,6 @@
SVGAnimatedEnumeration get spreadMethod native "SVGGradientElement_spreadMethod_Getter";
- SVGAnimatedString get href native "SVGGradientElement_href_Getter";
-
SVGAnimatedBoolean get externalResourcesRequired native "SVGGradientElement_externalResourcesRequired_Getter";
SVGAnimatedString get $dom_svgClassName native "SVGGradientElement_className_Getter";
@@ -30370,6 +30285,8 @@
CSSValue getPresentationAttribute(String name) native "SVGGradientElement_getPresentationAttribute_Callback";
+ SVGAnimatedString get href native "SVGGradientElement_href_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
@@ -30431,15 +30348,7 @@
SVGAnimatedLength get y native "SVGImageElement_y_Getter";
- SVGAnimatedString get href native "SVGImageElement_href_Getter";
-
- SVGStringList get requiredExtensions native "SVGImageElement_requiredExtensions_Getter";
-
- SVGStringList get requiredFeatures native "SVGImageElement_requiredFeatures_Getter";
-
- SVGStringList get systemLanguage native "SVGImageElement_systemLanguage_Getter";
-
- bool hasExtension(String extension) native "SVGImageElement_hasExtension_Callback";
+ SVGAnimatedBoolean get externalResourcesRequired native "SVGImageElement_externalResourcesRequired_Getter";
String get xmllang native "SVGImageElement_xmllang_Getter";
@@ -30449,16 +30358,6 @@
void set xmlspace(String value) native "SVGImageElement_xmlspace_Setter";
- SVGAnimatedBoolean get externalResourcesRequired native "SVGImageElement_externalResourcesRequired_Getter";
-
- SVGAnimatedString get $dom_svgClassName native "SVGImageElement_className_Getter";
-
- CSSStyleDeclaration get style native "SVGImageElement_style_Getter";
-
- CSSValue getPresentationAttribute(String name) native "SVGImageElement_getPresentationAttribute_Callback";
-
- SVGAnimatedTransformList get transform native "SVGImageElement_transform_Getter";
-
SVGElement get farthestViewportElement native "SVGImageElement_farthestViewportElement_Getter";
SVGElement get nearestViewportElement native "SVGImageElement_nearestViewportElement_Getter";
@@ -30471,6 +30370,24 @@
SVGMatrix getTransformToElement(SVGElement element) native "SVGImageElement_getTransformToElement_Callback";
+ SVGAnimatedString get $dom_svgClassName native "SVGImageElement_className_Getter";
+
+ CSSStyleDeclaration get style native "SVGImageElement_style_Getter";
+
+ CSSValue getPresentationAttribute(String name) native "SVGImageElement_getPresentationAttribute_Callback";
+
+ SVGStringList get requiredExtensions native "SVGImageElement_requiredExtensions_Getter";
+
+ SVGStringList get requiredFeatures native "SVGImageElement_requiredFeatures_Getter";
+
+ SVGStringList get systemLanguage native "SVGImageElement_systemLanguage_Getter";
+
+ bool hasExtension(String extension) native "SVGImageElement_hasExtension_Callback";
+
+ SVGAnimatedTransformList get transform native "SVGImageElement_transform_Getter";
+
+ SVGAnimatedString get href native "SVGImageElement_href_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
@@ -30741,13 +30658,7 @@
SVGAnimatedLength get y2 native "SVGLineElement_y2_Getter";
- SVGStringList get requiredExtensions native "SVGLineElement_requiredExtensions_Getter";
-
- SVGStringList get requiredFeatures native "SVGLineElement_requiredFeatures_Getter";
-
- SVGStringList get systemLanguage native "SVGLineElement_systemLanguage_Getter";
-
- bool hasExtension(String extension) native "SVGLineElement_hasExtension_Callback";
+ SVGAnimatedBoolean get externalResourcesRequired native "SVGLineElement_externalResourcesRequired_Getter";
String get xmllang native "SVGLineElement_xmllang_Getter";
@@ -30757,16 +30668,6 @@
void set xmlspace(String value) native "SVGLineElement_xmlspace_Setter";
- SVGAnimatedBoolean get externalResourcesRequired native "SVGLineElement_externalResourcesRequired_Getter";
-
- SVGAnimatedString get $dom_svgClassName native "SVGLineElement_className_Getter";
-
- CSSStyleDeclaration get style native "SVGLineElement_style_Getter";
-
- CSSValue getPresentationAttribute(String name) native "SVGLineElement_getPresentationAttribute_Callback";
-
- SVGAnimatedTransformList get transform native "SVGLineElement_transform_Getter";
-
SVGElement get farthestViewportElement native "SVGLineElement_farthestViewportElement_Getter";
SVGElement get nearestViewportElement native "SVGLineElement_nearestViewportElement_Getter";
@@ -30779,6 +30680,22 @@
SVGMatrix getTransformToElement(SVGElement element) native "SVGLineElement_getTransformToElement_Callback";
+ SVGAnimatedString get $dom_svgClassName native "SVGLineElement_className_Getter";
+
+ CSSStyleDeclaration get style native "SVGLineElement_style_Getter";
+
+ CSSValue getPresentationAttribute(String name) native "SVGLineElement_getPresentationAttribute_Callback";
+
+ SVGStringList get requiredExtensions native "SVGLineElement_requiredExtensions_Getter";
+
+ SVGStringList get requiredFeatures native "SVGLineElement_requiredFeatures_Getter";
+
+ SVGStringList get systemLanguage native "SVGLineElement_systemLanguage_Getter";
+
+ bool hasExtension(String extension) native "SVGLineElement_hasExtension_Callback";
+
+ SVGAnimatedTransformList get transform native "SVGLineElement_transform_Getter";
+
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
@@ -30862,10 +30779,10 @@
class _SVGMPathElementImpl extends _SVGElementImpl implements SVGMPathElement {
- SVGAnimatedString get href native "SVGMPathElement_href_Getter";
-
SVGAnimatedBoolean get externalResourcesRequired native "SVGMPathElement_externalResourcesRequired_Getter";
+ SVGAnimatedString get href native "SVGMPathElement_href_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
@@ -30941,6 +30858,12 @@
void setOrientToAuto() native "SVGMarkerElement_setOrientToAuto_Callback";
+ SVGAnimatedBoolean get externalResourcesRequired native "SVGMarkerElement_externalResourcesRequired_Getter";
+
+ SVGAnimatedPreserveAspectRatio get preserveAspectRatio native "SVGMarkerElement_preserveAspectRatio_Getter";
+
+ SVGAnimatedRect get viewBox native "SVGMarkerElement_viewBox_Getter";
+
String get xmllang native "SVGMarkerElement_xmllang_Getter";
void set xmllang(String value) native "SVGMarkerElement_xmllang_Setter";
@@ -30949,18 +30872,12 @@
void set xmlspace(String value) native "SVGMarkerElement_xmlspace_Setter";
- SVGAnimatedBoolean get externalResourcesRequired native "SVGMarkerElement_externalResourcesRequired_Getter";
-
SVGAnimatedString get $dom_svgClassName native "SVGMarkerElement_className_Getter";
CSSStyleDeclaration get style native "SVGMarkerElement_style_Getter";
CSSValue getPresentationAttribute(String name) native "SVGMarkerElement_getPresentationAttribute_Callback";
- SVGAnimatedPreserveAspectRatio get preserveAspectRatio native "SVGMarkerElement_preserveAspectRatio_Getter";
-
- SVGAnimatedRect get viewBox native "SVGMarkerElement_viewBox_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
@@ -31009,13 +30926,7 @@
SVGAnimatedLength get y native "SVGMaskElement_y_Getter";
- SVGStringList get requiredExtensions native "SVGMaskElement_requiredExtensions_Getter";
-
- SVGStringList get requiredFeatures native "SVGMaskElement_requiredFeatures_Getter";
-
- SVGStringList get systemLanguage native "SVGMaskElement_systemLanguage_Getter";
-
- bool hasExtension(String extension) native "SVGMaskElement_hasExtension_Callback";
+ SVGAnimatedBoolean get externalResourcesRequired native "SVGMaskElement_externalResourcesRequired_Getter";
String get xmllang native "SVGMaskElement_xmllang_Getter";
@@ -31025,14 +30936,20 @@
void set xmlspace(String value) native "SVGMaskElement_xmlspace_Setter";
- SVGAnimatedBoolean get externalResourcesRequired native "SVGMaskElement_externalResourcesRequired_Getter";
-
SVGAnimatedString get $dom_svgClassName native "SVGMaskElement_className_Getter";
CSSStyleDeclaration get style native "SVGMaskElement_style_Getter";
CSSValue getPresentationAttribute(String name) native "SVGMaskElement_getPresentationAttribute_Callback";
+ SVGStringList get requiredExtensions native "SVGMaskElement_requiredExtensions_Getter";
+
+ SVGStringList get requiredFeatures native "SVGMaskElement_requiredFeatures_Getter";
+
+ SVGStringList get systemLanguage native "SVGMaskElement_systemLanguage_Getter";
+
+ bool hasExtension(String extension) native "SVGMaskElement_hasExtension_Callback";
+
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
@@ -31561,13 +31478,7 @@
num getTotalLength() native "SVGPathElement_getTotalLength_Callback";
- SVGStringList get requiredExtensions native "SVGPathElement_requiredExtensions_Getter";
-
- SVGStringList get requiredFeatures native "SVGPathElement_requiredFeatures_Getter";
-
- SVGStringList get systemLanguage native "SVGPathElement_systemLanguage_Getter";
-
- bool hasExtension(String extension) native "SVGPathElement_hasExtension_Callback";
+ SVGAnimatedBoolean get externalResourcesRequired native "SVGPathElement_externalResourcesRequired_Getter";
String get xmllang native "SVGPathElement_xmllang_Getter";
@@ -31577,16 +31488,6 @@
void set xmlspace(String value) native "SVGPathElement_xmlspace_Setter";
- SVGAnimatedBoolean get externalResourcesRequired native "SVGPathElement_externalResourcesRequired_Getter";
-
- SVGAnimatedString get $dom_svgClassName native "SVGPathElement_className_Getter";
-
- CSSStyleDeclaration get style native "SVGPathElement_style_Getter";
-
- CSSValue getPresentationAttribute(String name) native "SVGPathElement_getPresentationAttribute_Callback";
-
- SVGAnimatedTransformList get transform native "SVGPathElement_transform_Getter";
-
SVGElement get farthestViewportElement native "SVGPathElement_farthestViewportElement_Getter";
SVGElement get nearestViewportElement native "SVGPathElement_nearestViewportElement_Getter";
@@ -31599,6 +31500,22 @@
SVGMatrix getTransformToElement(SVGElement element) native "SVGPathElement_getTransformToElement_Callback";
+ SVGAnimatedString get $dom_svgClassName native "SVGPathElement_className_Getter";
+
+ CSSStyleDeclaration get style native "SVGPathElement_style_Getter";
+
+ CSSValue getPresentationAttribute(String name) native "SVGPathElement_getPresentationAttribute_Callback";
+
+ SVGStringList get requiredExtensions native "SVGPathElement_requiredExtensions_Getter";
+
+ SVGStringList get requiredFeatures native "SVGPathElement_requiredFeatures_Getter";
+
+ SVGStringList get systemLanguage native "SVGPathElement_systemLanguage_Getter";
+
+ bool hasExtension(String extension) native "SVGPathElement_hasExtension_Callback";
+
+ SVGAnimatedTransformList get transform native "SVGPathElement_transform_Getter";
+
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
@@ -32609,15 +32526,11 @@
SVGAnimatedLength get y native "SVGPatternElement_y_Getter";
- SVGAnimatedString get href native "SVGPatternElement_href_Getter";
+ SVGAnimatedBoolean get externalResourcesRequired native "SVGPatternElement_externalResourcesRequired_Getter";
- SVGStringList get requiredExtensions native "SVGPatternElement_requiredExtensions_Getter";
+ SVGAnimatedPreserveAspectRatio get preserveAspectRatio native "SVGPatternElement_preserveAspectRatio_Getter";
- SVGStringList get requiredFeatures native "SVGPatternElement_requiredFeatures_Getter";
-
- SVGStringList get systemLanguage native "SVGPatternElement_systemLanguage_Getter";
-
- bool hasExtension(String extension) native "SVGPatternElement_hasExtension_Callback";
+ SVGAnimatedRect get viewBox native "SVGPatternElement_viewBox_Getter";
String get xmllang native "SVGPatternElement_xmllang_Getter";
@@ -32627,17 +32540,21 @@
void set xmlspace(String value) native "SVGPatternElement_xmlspace_Setter";
- SVGAnimatedBoolean get externalResourcesRequired native "SVGPatternElement_externalResourcesRequired_Getter";
-
SVGAnimatedString get $dom_svgClassName native "SVGPatternElement_className_Getter";
CSSStyleDeclaration get style native "SVGPatternElement_style_Getter";
CSSValue getPresentationAttribute(String name) native "SVGPatternElement_getPresentationAttribute_Callback";
- SVGAnimatedPreserveAspectRatio get preserveAspectRatio native "SVGPatternElement_preserveAspectRatio_Getter";
+ SVGStringList get requiredExtensions native "SVGPatternElement_requiredExtensions_Getter";
- SVGAnimatedRect get viewBox native "SVGPatternElement_viewBox_Getter";
+ SVGStringList get requiredFeatures native "SVGPatternElement_requiredFeatures_Getter";
+
+ SVGStringList get systemLanguage native "SVGPatternElement_systemLanguage_Getter";
+
+ bool hasExtension(String extension) native "SVGPatternElement_hasExtension_Callback";
+
+ SVGAnimatedString get href native "SVGPatternElement_href_Getter";
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
@@ -32762,13 +32679,7 @@
SVGPointList get points native "SVGPolygonElement_points_Getter";
- SVGStringList get requiredExtensions native "SVGPolygonElement_requiredExtensions_Getter";
-
- SVGStringList get requiredFeatures native "SVGPolygonElement_requiredFeatures_Getter";
-
- SVGStringList get systemLanguage native "SVGPolygonElement_systemLanguage_Getter";
-
- bool hasExtension(String extension) native "SVGPolygonElement_hasExtension_Callback";
+ SVGAnimatedBoolean get externalResourcesRequired native "SVGPolygonElement_externalResourcesRequired_Getter";
String get xmllang native "SVGPolygonElement_xmllang_Getter";
@@ -32778,16 +32689,6 @@
void set xmlspace(String value) native "SVGPolygonElement_xmlspace_Setter";
- SVGAnimatedBoolean get externalResourcesRequired native "SVGPolygonElement_externalResourcesRequired_Getter";
-
- SVGAnimatedString get $dom_svgClassName native "SVGPolygonElement_className_Getter";
-
- CSSStyleDeclaration get style native "SVGPolygonElement_style_Getter";
-
- CSSValue getPresentationAttribute(String name) native "SVGPolygonElement_getPresentationAttribute_Callback";
-
- SVGAnimatedTransformList get transform native "SVGPolygonElement_transform_Getter";
-
SVGElement get farthestViewportElement native "SVGPolygonElement_farthestViewportElement_Getter";
SVGElement get nearestViewportElement native "SVGPolygonElement_nearestViewportElement_Getter";
@@ -32800,6 +32701,22 @@
SVGMatrix getTransformToElement(SVGElement element) native "SVGPolygonElement_getTransformToElement_Callback";
+ SVGAnimatedString get $dom_svgClassName native "SVGPolygonElement_className_Getter";
+
+ CSSStyleDeclaration get style native "SVGPolygonElement_style_Getter";
+
+ CSSValue getPresentationAttribute(String name) native "SVGPolygonElement_getPresentationAttribute_Callback";
+
+ SVGStringList get requiredExtensions native "SVGPolygonElement_requiredExtensions_Getter";
+
+ SVGStringList get requiredFeatures native "SVGPolygonElement_requiredFeatures_Getter";
+
+ SVGStringList get systemLanguage native "SVGPolygonElement_systemLanguage_Getter";
+
+ bool hasExtension(String extension) native "SVGPolygonElement_hasExtension_Callback";
+
+ SVGAnimatedTransformList get transform native "SVGPolygonElement_transform_Getter";
+
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
@@ -32828,13 +32745,7 @@
SVGPointList get points native "SVGPolylineElement_points_Getter";
- SVGStringList get requiredExtensions native "SVGPolylineElement_requiredExtensions_Getter";
-
- SVGStringList get requiredFeatures native "SVGPolylineElement_requiredFeatures_Getter";
-
- SVGStringList get systemLanguage native "SVGPolylineElement_systemLanguage_Getter";
-
- bool hasExtension(String extension) native "SVGPolylineElement_hasExtension_Callback";
+ SVGAnimatedBoolean get externalResourcesRequired native "SVGPolylineElement_externalResourcesRequired_Getter";
String get xmllang native "SVGPolylineElement_xmllang_Getter";
@@ -32844,16 +32755,6 @@
void set xmlspace(String value) native "SVGPolylineElement_xmlspace_Setter";
- SVGAnimatedBoolean get externalResourcesRequired native "SVGPolylineElement_externalResourcesRequired_Getter";
-
- SVGAnimatedString get $dom_svgClassName native "SVGPolylineElement_className_Getter";
-
- CSSStyleDeclaration get style native "SVGPolylineElement_style_Getter";
-
- CSSValue getPresentationAttribute(String name) native "SVGPolylineElement_getPresentationAttribute_Callback";
-
- SVGAnimatedTransformList get transform native "SVGPolylineElement_transform_Getter";
-
SVGElement get farthestViewportElement native "SVGPolylineElement_farthestViewportElement_Getter";
SVGElement get nearestViewportElement native "SVGPolylineElement_nearestViewportElement_Getter";
@@ -32866,6 +32767,22 @@
SVGMatrix getTransformToElement(SVGElement element) native "SVGPolylineElement_getTransformToElement_Callback";
+ SVGAnimatedString get $dom_svgClassName native "SVGPolylineElement_className_Getter";
+
+ CSSStyleDeclaration get style native "SVGPolylineElement_style_Getter";
+
+ CSSValue getPresentationAttribute(String name) native "SVGPolylineElement_getPresentationAttribute_Callback";
+
+ SVGStringList get requiredExtensions native "SVGPolylineElement_requiredExtensions_Getter";
+
+ SVGStringList get requiredFeatures native "SVGPolylineElement_requiredFeatures_Getter";
+
+ SVGStringList get systemLanguage native "SVGPolylineElement_systemLanguage_Getter";
+
+ bool hasExtension(String extension) native "SVGPolylineElement_hasExtension_Callback";
+
+ SVGAnimatedTransformList get transform native "SVGPolylineElement_transform_Getter";
+
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
@@ -33043,13 +32960,7 @@
SVGAnimatedLength get y native "SVGRectElement_y_Getter";
- SVGStringList get requiredExtensions native "SVGRectElement_requiredExtensions_Getter";
-
- SVGStringList get requiredFeatures native "SVGRectElement_requiredFeatures_Getter";
-
- SVGStringList get systemLanguage native "SVGRectElement_systemLanguage_Getter";
-
- bool hasExtension(String extension) native "SVGRectElement_hasExtension_Callback";
+ SVGAnimatedBoolean get externalResourcesRequired native "SVGRectElement_externalResourcesRequired_Getter";
String get xmllang native "SVGRectElement_xmllang_Getter";
@@ -33059,16 +32970,6 @@
void set xmlspace(String value) native "SVGRectElement_xmlspace_Setter";
- SVGAnimatedBoolean get externalResourcesRequired native "SVGRectElement_externalResourcesRequired_Getter";
-
- SVGAnimatedString get $dom_svgClassName native "SVGRectElement_className_Getter";
-
- CSSStyleDeclaration get style native "SVGRectElement_style_Getter";
-
- CSSValue getPresentationAttribute(String name) native "SVGRectElement_getPresentationAttribute_Callback";
-
- SVGAnimatedTransformList get transform native "SVGRectElement_transform_Getter";
-
SVGElement get farthestViewportElement native "SVGRectElement_farthestViewportElement_Getter";
SVGElement get nearestViewportElement native "SVGRectElement_nearestViewportElement_Getter";
@@ -33081,6 +32982,22 @@
SVGMatrix getTransformToElement(SVGElement element) native "SVGRectElement_getTransformToElement_Callback";
+ SVGAnimatedString get $dom_svgClassName native "SVGRectElement_className_Getter";
+
+ CSSStyleDeclaration get style native "SVGRectElement_style_Getter";
+
+ CSSValue getPresentationAttribute(String name) native "SVGRectElement_getPresentationAttribute_Callback";
+
+ SVGStringList get requiredExtensions native "SVGRectElement_requiredExtensions_Getter";
+
+ SVGStringList get requiredFeatures native "SVGRectElement_requiredFeatures_Getter";
+
+ SVGStringList get systemLanguage native "SVGRectElement_systemLanguage_Getter";
+
+ bool hasExtension(String extension) native "SVGRectElement_hasExtension_Callback";
+
+ SVGAnimatedTransformList get transform native "SVGRectElement_transform_Getter";
+
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
@@ -33352,13 +33269,11 @@
void unsuspendRedrawAll() native "SVGSVGElement_unsuspendRedrawAll_Callback";
- SVGStringList get requiredExtensions native "SVGSVGElement_requiredExtensions_Getter";
+ SVGAnimatedBoolean get externalResourcesRequired native "SVGSVGElement_externalResourcesRequired_Getter";
- SVGStringList get requiredFeatures native "SVGSVGElement_requiredFeatures_Getter";
+ SVGAnimatedPreserveAspectRatio get preserveAspectRatio native "SVGSVGElement_preserveAspectRatio_Getter";
- SVGStringList get systemLanguage native "SVGSVGElement_systemLanguage_Getter";
-
- bool hasExtension(String extension) native "SVGSVGElement_hasExtension_Callback";
+ SVGAnimatedRect get viewBox native "SVGSVGElement_viewBox_Getter";
String get xmllang native "SVGSVGElement_xmllang_Getter";
@@ -33368,14 +33283,6 @@
void set xmlspace(String value) native "SVGSVGElement_xmlspace_Setter";
- SVGAnimatedBoolean get externalResourcesRequired native "SVGSVGElement_externalResourcesRequired_Getter";
-
- SVGAnimatedString get $dom_svgClassName native "SVGSVGElement_className_Getter";
-
- CSSStyleDeclaration get style native "SVGSVGElement_style_Getter";
-
- CSSValue getPresentationAttribute(String name) native "SVGSVGElement_getPresentationAttribute_Callback";
-
SVGElement get farthestViewportElement native "SVGSVGElement_farthestViewportElement_Getter";
SVGElement get nearestViewportElement native "SVGSVGElement_nearestViewportElement_Getter";
@@ -33388,9 +33295,19 @@
SVGMatrix getTransformToElement(SVGElement element) native "SVGSVGElement_getTransformToElement_Callback";
- SVGAnimatedPreserveAspectRatio get preserveAspectRatio native "SVGSVGElement_preserveAspectRatio_Getter";
+ SVGAnimatedString get $dom_svgClassName native "SVGSVGElement_className_Getter";
- SVGAnimatedRect get viewBox native "SVGSVGElement_viewBox_Getter";
+ CSSStyleDeclaration get style native "SVGSVGElement_style_Getter";
+
+ CSSValue getPresentationAttribute(String name) native "SVGSVGElement_getPresentationAttribute_Callback";
+
+ SVGStringList get requiredExtensions native "SVGSVGElement_requiredExtensions_Getter";
+
+ SVGStringList get requiredFeatures native "SVGSVGElement_requiredFeatures_Getter";
+
+ SVGStringList get systemLanguage native "SVGSVGElement_systemLanguage_Getter";
+
+ bool hasExtension(String extension) native "SVGSVGElement_hasExtension_Callback";
int get zoomAndPan native "SVGSVGElement_zoomAndPan_Getter";
@@ -33421,10 +33338,10 @@
void set type(String value) native "SVGScriptElement_type_Setter";
- SVGAnimatedString get href native "SVGScriptElement_href_Getter";
-
SVGAnimatedBoolean get externalResourcesRequired native "SVGScriptElement_externalResourcesRequired_Getter";
+ SVGAnimatedString get href native "SVGScriptElement_href_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
@@ -33703,13 +33620,7 @@
class _SVGSwitchElementImpl extends _SVGElementImpl implements SVGSwitchElement {
- SVGStringList get requiredExtensions native "SVGSwitchElement_requiredExtensions_Getter";
-
- SVGStringList get requiredFeatures native "SVGSwitchElement_requiredFeatures_Getter";
-
- SVGStringList get systemLanguage native "SVGSwitchElement_systemLanguage_Getter";
-
- bool hasExtension(String extension) native "SVGSwitchElement_hasExtension_Callback";
+ SVGAnimatedBoolean get externalResourcesRequired native "SVGSwitchElement_externalResourcesRequired_Getter";
String get xmllang native "SVGSwitchElement_xmllang_Getter";
@@ -33719,16 +33630,6 @@
void set xmlspace(String value) native "SVGSwitchElement_xmlspace_Setter";
- SVGAnimatedBoolean get externalResourcesRequired native "SVGSwitchElement_externalResourcesRequired_Getter";
-
- SVGAnimatedString get $dom_svgClassName native "SVGSwitchElement_className_Getter";
-
- CSSStyleDeclaration get style native "SVGSwitchElement_style_Getter";
-
- CSSValue getPresentationAttribute(String name) native "SVGSwitchElement_getPresentationAttribute_Callback";
-
- SVGAnimatedTransformList get transform native "SVGSwitchElement_transform_Getter";
-
SVGElement get farthestViewportElement native "SVGSwitchElement_farthestViewportElement_Getter";
SVGElement get nearestViewportElement native "SVGSwitchElement_nearestViewportElement_Getter";
@@ -33741,6 +33642,22 @@
SVGMatrix getTransformToElement(SVGElement element) native "SVGSwitchElement_getTransformToElement_Callback";
+ SVGAnimatedString get $dom_svgClassName native "SVGSwitchElement_className_Getter";
+
+ CSSStyleDeclaration get style native "SVGSwitchElement_style_Getter";
+
+ CSSValue getPresentationAttribute(String name) native "SVGSwitchElement_getPresentationAttribute_Callback";
+
+ SVGStringList get requiredExtensions native "SVGSwitchElement_requiredExtensions_Getter";
+
+ SVGStringList get requiredFeatures native "SVGSwitchElement_requiredFeatures_Getter";
+
+ SVGStringList get systemLanguage native "SVGSwitchElement_systemLanguage_Getter";
+
+ bool hasExtension(String extension) native "SVGSwitchElement_hasExtension_Callback";
+
+ SVGAnimatedTransformList get transform native "SVGSwitchElement_transform_Getter";
+
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
@@ -33759,6 +33676,12 @@
class _SVGSymbolElementImpl extends _SVGElementImpl implements SVGSymbolElement {
+ SVGAnimatedBoolean get externalResourcesRequired native "SVGSymbolElement_externalResourcesRequired_Getter";
+
+ SVGAnimatedPreserveAspectRatio get preserveAspectRatio native "SVGSymbolElement_preserveAspectRatio_Getter";
+
+ SVGAnimatedRect get viewBox native "SVGSymbolElement_viewBox_Getter";
+
String get xmllang native "SVGSymbolElement_xmllang_Getter";
void set xmllang(String value) native "SVGSymbolElement_xmllang_Setter";
@@ -33767,18 +33690,12 @@
void set xmlspace(String value) native "SVGSymbolElement_xmlspace_Setter";
- SVGAnimatedBoolean get externalResourcesRequired native "SVGSymbolElement_externalResourcesRequired_Getter";
-
SVGAnimatedString get $dom_svgClassName native "SVGSymbolElement_className_Getter";
CSSStyleDeclaration get style native "SVGSymbolElement_style_Getter";
CSSValue getPresentationAttribute(String name) native "SVGSymbolElement_getPresentationAttribute_Callback";
- SVGAnimatedPreserveAspectRatio get preserveAspectRatio native "SVGSymbolElement_preserveAspectRatio_Getter";
-
- SVGAnimatedRect get viewBox native "SVGSymbolElement_viewBox_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
@@ -33917,13 +33834,7 @@
void selectSubString(int offset, int length) native "SVGTextContentElement_selectSubString_Callback";
- SVGStringList get requiredExtensions native "SVGTextContentElement_requiredExtensions_Getter";
-
- SVGStringList get requiredFeatures native "SVGTextContentElement_requiredFeatures_Getter";
-
- SVGStringList get systemLanguage native "SVGTextContentElement_systemLanguage_Getter";
-
- bool hasExtension(String extension) native "SVGTextContentElement_hasExtension_Callback";
+ SVGAnimatedBoolean get externalResourcesRequired native "SVGTextContentElement_externalResourcesRequired_Getter";
String get xmllang native "SVGTextContentElement_xmllang_Getter";
@@ -33933,14 +33844,20 @@
void set xmlspace(String value) native "SVGTextContentElement_xmlspace_Setter";
- SVGAnimatedBoolean get externalResourcesRequired native "SVGTextContentElement_externalResourcesRequired_Getter";
-
SVGAnimatedString get $dom_svgClassName native "SVGTextContentElement_className_Getter";
CSSStyleDeclaration get style native "SVGTextContentElement_style_Getter";
CSSValue getPresentationAttribute(String name) native "SVGTextContentElement_getPresentationAttribute_Callback";
+ SVGStringList get requiredExtensions native "SVGTextContentElement_requiredExtensions_Getter";
+
+ SVGStringList get requiredFeatures native "SVGTextContentElement_requiredFeatures_Getter";
+
+ SVGStringList get systemLanguage native "SVGTextContentElement_systemLanguage_Getter";
+
+ bool hasExtension(String extension) native "SVGTextContentElement_hasExtension_Callback";
+
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
@@ -33959,8 +33876,6 @@
class _SVGTextElementImpl extends _SVGTextPositioningElementImpl implements SVGTextElement {
- SVGAnimatedTransformList get transform native "SVGTextElement_transform_Getter";
-
SVGElement get farthestViewportElement native "SVGTextElement_farthestViewportElement_Getter";
SVGElement get nearestViewportElement native "SVGTextElement_nearestViewportElement_Getter";
@@ -33973,6 +33888,8 @@
SVGMatrix getTransformToElement(SVGElement element) native "SVGTextElement_getTransformToElement_Callback";
+ SVGAnimatedTransformList get transform native "SVGTextElement_transform_Getter";
+
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
@@ -34419,15 +34336,7 @@
SVGAnimatedLength get y native "SVGUseElement_y_Getter";
- SVGAnimatedString get href native "SVGUseElement_href_Getter";
-
- SVGStringList get requiredExtensions native "SVGUseElement_requiredExtensions_Getter";
-
- SVGStringList get requiredFeatures native "SVGUseElement_requiredFeatures_Getter";
-
- SVGStringList get systemLanguage native "SVGUseElement_systemLanguage_Getter";
-
- bool hasExtension(String extension) native "SVGUseElement_hasExtension_Callback";
+ SVGAnimatedBoolean get externalResourcesRequired native "SVGUseElement_externalResourcesRequired_Getter";
String get xmllang native "SVGUseElement_xmllang_Getter";
@@ -34437,16 +34346,6 @@
void set xmlspace(String value) native "SVGUseElement_xmlspace_Setter";
- SVGAnimatedBoolean get externalResourcesRequired native "SVGUseElement_externalResourcesRequired_Getter";
-
- SVGAnimatedString get $dom_svgClassName native "SVGUseElement_className_Getter";
-
- CSSStyleDeclaration get style native "SVGUseElement_style_Getter";
-
- CSSValue getPresentationAttribute(String name) native "SVGUseElement_getPresentationAttribute_Callback";
-
- SVGAnimatedTransformList get transform native "SVGUseElement_transform_Getter";
-
SVGElement get farthestViewportElement native "SVGUseElement_farthestViewportElement_Getter";
SVGElement get nearestViewportElement native "SVGUseElement_nearestViewportElement_Getter";
@@ -34459,6 +34358,24 @@
SVGMatrix getTransformToElement(SVGElement element) native "SVGUseElement_getTransformToElement_Callback";
+ SVGAnimatedString get $dom_svgClassName native "SVGUseElement_className_Getter";
+
+ CSSStyleDeclaration get style native "SVGUseElement_style_Getter";
+
+ CSSValue getPresentationAttribute(String name) native "SVGUseElement_getPresentationAttribute_Callback";
+
+ SVGStringList get requiredExtensions native "SVGUseElement_requiredExtensions_Getter";
+
+ SVGStringList get requiredFeatures native "SVGUseElement_requiredFeatures_Getter";
+
+ SVGStringList get systemLanguage native "SVGUseElement_systemLanguage_Getter";
+
+ bool hasExtension(String extension) native "SVGUseElement_hasExtension_Callback";
+
+ SVGAnimatedTransformList get transform native "SVGUseElement_transform_Getter";
+
+ SVGAnimatedString get href native "SVGUseElement_href_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
@@ -34777,6 +34694,48 @@
// WARNING: Do not edit - generated code.
+/// @domName ScriptProcessorNode
+abstract class ScriptProcessorNode implements AudioNode, EventTarget {
+
+ /**
+ * @domName EventTarget.addEventListener, EventTarget.removeEventListener, EventTarget.dispatchEvent
+ */
+ ScriptProcessorNodeEvents get on;
+
+ /** @domName ScriptProcessorNode.bufferSize */
+ int get bufferSize;
+}
+
+abstract class ScriptProcessorNodeEvents implements Events {
+
+ EventListenerList get audioProcess;
+}
+// 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.
+
+class _ScriptProcessorNodeImpl extends _AudioNodeImpl implements ScriptProcessorNode {
+
+ _ScriptProcessorNodeEventsImpl get on =>
+ new _ScriptProcessorNodeEventsImpl(this);
+
+ int get bufferSize native "ScriptProcessorNode_bufferSize_Getter";
+
+}
+
+class _ScriptProcessorNodeEventsImpl extends _EventsImpl implements ScriptProcessorNodeEvents {
+ _ScriptProcessorNodeEventsImpl(_ptr) : super(_ptr);
+
+ EventListenerList get audioProcess => this['audioprocess'];
+}
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// WARNING: Do not edit - generated code.
+
/// @domName ScriptProfile
abstract class ScriptProfile {
@@ -37138,6 +37097,9 @@
/** @domName HTMLTextAreaElement.defaultValue */
String defaultValue;
+ /** @domName HTMLTextAreaElement.dirName */
+ String dirName;
+
/** @domName HTMLTextAreaElement.disabled */
bool disabled;
@@ -37204,6 +37166,9 @@
/** @domName HTMLTextAreaElement.setCustomValidity */
void setCustomValidity(String error);
+ /** @domName HTMLTextAreaElement.setRangeText */
+ void setRangeText(String replacement, [int start, int end, String selectionMode]);
+
/** @domName HTMLTextAreaElement.setSelectionRange */
void setSelectionRange(int start, int end, [String direction]);
}
@@ -37227,6 +37192,10 @@
void set defaultValue(String value) native "HTMLTextAreaElement_defaultValue_Setter";
+ String get dirName native "HTMLTextAreaElement_dirName_Getter";
+
+ void set dirName(String value) native "HTMLTextAreaElement_dirName_Setter";
+
bool get disabled native "HTMLTextAreaElement_disabled_Getter";
void set disabled(bool value) native "HTMLTextAreaElement_disabled_Setter";
@@ -37295,6 +37264,22 @@
void setCustomValidity(String error) native "HTMLTextAreaElement_setCustomValidity_Callback";
+ void setRangeText(/*DOMString*/ replacement, [/*unsigned long*/ start, /*unsigned long*/ end, /*DOMString*/ selectionMode]) {
+ if ((replacement is String || replacement == null) && !?start && !?end && !?selectionMode) {
+ _setRangeText_1(replacement);
+ return;
+ }
+ if ((replacement is String || replacement == null) && (start is int || start == null) && (end is int || end == null) && (selectionMode is String || selectionMode == null)) {
+ _setRangeText_2(replacement, start, end, selectionMode);
+ return;
+ }
+ throw "Incorrect number or type of arguments";
+ }
+
+ void _setRangeText_1(replacement) native "HTMLTextAreaElement_setRangeText_1_Callback";
+
+ void _setRangeText_2(replacement, start, end, selectionMode) native "HTMLTextAreaElement_setRangeText_2_Callback";
+
void setSelectionRange(/*long*/ start, /*long*/ end, [/*DOMString*/ direction]) {
if (?direction) {
_setSelectionRange_1(start, end, direction);
@@ -40264,7 +40249,7 @@
int getError();
/** @domName WebGLRenderingContext.getExtension */
- void getExtension(String name);
+ Object getExtension(String name);
/** @domName WebGLRenderingContext.getFramebufferAttachmentParameter */
Object getFramebufferAttachmentParameter(int target, int attachment, int pname);
@@ -40659,7 +40644,7 @@
int getError() native "WebGLRenderingContext_getError_Callback";
- void getExtension(String name) native "WebGLRenderingContext_getExtension_Callback";
+ Object getExtension(String name) native "WebGLRenderingContext_getExtension_Callback";
Object getFramebufferAttachmentParameter(int target, int attachment, int pname) native "WebGLRenderingContext_getFramebufferAttachmentParameter_Callback";
@@ -41972,56 +41957,49 @@
// BSD-style license that can be found in the LICENSE file.
class _ArrayBufferFactoryProvider {
- static ArrayBuffer createArrayBuffer(int length) => _createArrayBuffer(length);
- static ArrayBuffer _createArrayBuffer(int length) native "ArrayBuffer_constructor_Callback";
+ static ArrayBuffer createArrayBuffer(int length) native "ArrayBuffer_constructor_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.
class _AudioElementFactoryProvider {
- static AudioElement createAudioElement([String src]) => _createAudioElement(src);
- static AudioElement _createAudioElement([String src]) native "HTMLAudioElement_constructor_Callback";
+ static AudioElement createAudioElement([String src]) native "HTMLAudioElement_constructor_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.
class _BlobFactoryProvider {
- static Blob createBlob(List blobParts, [String type, String endings]) => _createBlob(blobParts, type, endings);
- static Blob _createBlob(List blobParts, [String type, String endings]) native "Blob_constructor_Callback";
+ static Blob createBlob(List blobParts, [String type, String endings]) native "Blob_constructor_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.
class _CSSMatrixFactoryProvider {
- static CSSMatrix createCSSMatrix([String cssValue]) => _createCSSMatrix(cssValue);
- static CSSMatrix _createCSSMatrix([String cssValue]) native "WebKitCSSMatrix_constructor_Callback";
+ static CSSMatrix createCSSMatrix([String cssValue]) native "WebKitCSSMatrix_constructor_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.
class _DOMParserFactoryProvider {
- static DOMParser createDOMParser() => _createDOMParser();
- static DOMParser _createDOMParser() native "DOMParser_constructor_Callback";
+ static DOMParser createDOMParser() native "DOMParser_constructor_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.
class _DOMURLFactoryProvider {
- static DOMURL createDOMURL() => _createDOMURL();
- static DOMURL _createDOMURL() native "DOMURL_constructor_Callback";
+ static DOMURL createDOMURL() native "DOMURL_constructor_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.
class _DataViewFactoryProvider {
- static DataView createDataView(ArrayBuffer buffer, [int byteOffset, int byteLength]) => _createDataView(buffer, byteOffset, byteLength);
- static DataView _createDataView(ArrayBuffer buffer, [int byteOffset, int byteLength]) native "DataView_constructor_Callback";
+ static DataView createDataView(ArrayBuffer buffer, [int byteOffset, int byteLength]) native "DataView_constructor_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
@@ -42333,32 +42311,28 @@
// BSD-style license that can be found in the LICENSE file.
class _EventSourceFactoryProvider {
- static EventSource createEventSource(String scriptUrl) => _createEventSource(scriptUrl);
- static EventSource _createEventSource(String scriptUrl) native "EventSource_constructor_Callback";
+ static EventSource createEventSource(String scriptUrl) native "EventSource_constructor_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.
class _FileReaderFactoryProvider {
- static FileReader createFileReader() => _createFileReader();
- static FileReader _createFileReader() native "FileReader_constructor_Callback";
+ static FileReader createFileReader() native "FileReader_constructor_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.
class _FileReaderSyncFactoryProvider {
- static FileReaderSync createFileReaderSync() => _createFileReaderSync();
- static FileReaderSync _createFileReaderSync() native "FileReaderSync_constructor_Callback";
+ static FileReaderSync createFileReaderSync() native "FileReaderSync_constructor_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.
class _FormDataFactoryProvider {
- static FormData createFormData([FormElement form]) => _createFormData(form);
- static FormData _createFormData([FormElement form]) native "DOMFormData_constructor_Callback";
+ static FormData createFormData([FormElement form]) native "DOMFormData_constructor_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
@@ -42381,184 +42355,161 @@
// BSD-style license that can be found in the LICENSE file.
class _IceCandidateFactoryProvider {
- static IceCandidate createIceCandidate(String label, String candidateLine) => _createIceCandidate(label, candidateLine);
- static IceCandidate _createIceCandidate(String label, String candidateLine) native "IceCandidate_constructor_Callback";
+ static IceCandidate createIceCandidate(String label, String candidateLine) native "IceCandidate_constructor_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.
class _MediaControllerFactoryProvider {
- static MediaController createMediaController() => _createMediaController();
- static MediaController _createMediaController() native "MediaController_constructor_Callback";
+ static MediaController createMediaController() native "MediaController_constructor_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.
class _MediaSourceFactoryProvider {
- static MediaSource createMediaSource() => _createMediaSource();
- static MediaSource _createMediaSource() native "MediaSource_constructor_Callback";
+ static MediaSource createMediaSource() native "MediaSource_constructor_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.
class _MediaStreamFactoryProvider {
- static MediaStream createMediaStream(MediaStreamTrackList audioTracks, MediaStreamTrackList videoTracks) => _createMediaStream(audioTracks, videoTracks);
- static MediaStream _createMediaStream(MediaStreamTrackList audioTracks, MediaStreamTrackList videoTracks) native "MediaStream_constructor_Callback";
+ static MediaStream createMediaStream(MediaStreamTrackList audioTracks, MediaStreamTrackList videoTracks) native "MediaStream_constructor_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.
class _MessageChannelFactoryProvider {
- static MessageChannel createMessageChannel() => _createMessageChannel();
- static MessageChannel _createMessageChannel() native "MessageChannel_constructor_Callback";
+ static MessageChannel createMessageChannel() native "MessageChannel_constructor_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.
class _MutationObserverFactoryProvider {
- static MutationObserver createMutationObserver(MutationCallback callback) => _createMutationObserver(callback);
- static MutationObserver _createMutationObserver(MutationCallback callback) native "MutationObserver_constructor_Callback";
+ static MutationObserver createMutationObserver(MutationCallback callback) native "MutationObserver_constructor_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.
class _NotificationFactoryProvider {
- static Notification createNotification(String title, [Map options]) => _createNotification(title, options);
- static Notification _createNotification(String title, [Map options]) native "Notification_constructor_Callback";
+ static Notification createNotification(String title, [Map options]) native "Notification_constructor_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.
class _OptionElementFactoryProvider {
- static OptionElement createOptionElement([String data, String value, bool defaultSelected, bool selected]) => _createOptionElement(data, value, defaultSelected, selected);
- static OptionElement _createOptionElement([String data, String value, bool defaultSelected, bool selected]) native "HTMLOptionElement_constructor_Callback";
+ static OptionElement createOptionElement([String data, String value, bool defaultSelected, bool selected]) native "HTMLOptionElement_constructor_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.
class _PeerConnection00FactoryProvider {
- static PeerConnection00 createPeerConnection00(String serverConfiguration, IceCallback iceCallback) => _createPeerConnection00(serverConfiguration, iceCallback);
- static PeerConnection00 _createPeerConnection00(String serverConfiguration, IceCallback iceCallback) native "PeerConnection00_constructor_Callback";
+ static PeerConnection00 createPeerConnection00(String serverConfiguration, IceCallback iceCallback) native "PeerConnection00_constructor_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.
class _RTCIceCandidateFactoryProvider {
- static RTCIceCandidate createRTCIceCandidate(Map dictionary) => _createRTCIceCandidate(dictionary);
- static RTCIceCandidate _createRTCIceCandidate(Map dictionary) native "RTCIceCandidate_constructor_Callback";
+ static RTCIceCandidate createRTCIceCandidate(Map dictionary) native "RTCIceCandidate_constructor_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.
class _RTCPeerConnectionFactoryProvider {
- static RTCPeerConnection createRTCPeerConnection(Map rtcIceServers, [Map mediaConstraints]) => _createRTCPeerConnection(rtcIceServers, mediaConstraints);
- static RTCPeerConnection _createRTCPeerConnection(Map rtcIceServers, [Map mediaConstraints]) native "RTCPeerConnection_constructor_Callback";
+ static RTCPeerConnection createRTCPeerConnection(Map rtcIceServers, [Map mediaConstraints]) native "RTCPeerConnection_constructor_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.
class _RTCSessionDescriptionFactoryProvider {
- static RTCSessionDescription createRTCSessionDescription(Map dictionary) => _createRTCSessionDescription(dictionary);
- static RTCSessionDescription _createRTCSessionDescription(Map dictionary) native "RTCSessionDescription_constructor_Callback";
+ static RTCSessionDescription createRTCSessionDescription(Map dictionary) native "RTCSessionDescription_constructor_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.
class _SessionDescriptionFactoryProvider {
- static SessionDescription createSessionDescription(String sdp) => _createSessionDescription(sdp);
- static SessionDescription _createSessionDescription(String sdp) native "SessionDescription_constructor_Callback";
+ static SessionDescription createSessionDescription(String sdp) native "SessionDescription_constructor_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.
class _ShadowRootFactoryProvider {
- static ShadowRoot createShadowRoot(Element host) => _createShadowRoot(host);
- static ShadowRoot _createShadowRoot(Element host) native "ShadowRoot_constructor_Callback";
+ static ShadowRoot createShadowRoot(Element host) native "ShadowRoot_constructor_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.
class _SharedWorkerFactoryProvider {
- static SharedWorker createSharedWorker(String scriptURL, [String name]) => _createSharedWorker(scriptURL, name);
- static SharedWorker _createSharedWorker(String scriptURL, [String name]) native "SharedWorker_constructor_Callback";
+ static SharedWorker createSharedWorker(String scriptURL, [String name]) native "SharedWorker_constructor_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.
class _SpeechGrammarFactoryProvider {
- static SpeechGrammar createSpeechGrammar() => _createSpeechGrammar();
- static SpeechGrammar _createSpeechGrammar() native "SpeechGrammar_constructor_Callback";
+ static SpeechGrammar createSpeechGrammar() native "SpeechGrammar_constructor_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.
class _SpeechGrammarListFactoryProvider {
- static SpeechGrammarList createSpeechGrammarList() => _createSpeechGrammarList();
- static SpeechGrammarList _createSpeechGrammarList() native "SpeechGrammarList_constructor_Callback";
+ static SpeechGrammarList createSpeechGrammarList() native "SpeechGrammarList_constructor_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.
class _SpeechRecognitionFactoryProvider {
- static SpeechRecognition createSpeechRecognition() => _createSpeechRecognition();
- static SpeechRecognition _createSpeechRecognition() native "SpeechRecognition_constructor_Callback";
+ static SpeechRecognition createSpeechRecognition() native "SpeechRecognition_constructor_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.
class _TextTrackCueFactoryProvider {
- static TextTrackCue createTextTrackCue(num startTime, num endTime, String text) => _createTextTrackCue(startTime, endTime, text);
- static TextTrackCue _createTextTrackCue(num startTime, num endTime, String text) native "TextTrackCue_constructor_Callback";
+ static TextTrackCue createTextTrackCue(num startTime, num endTime, String text) native "TextTrackCue_constructor_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.
class _WorkerFactoryProvider {
- static Worker createWorker(String scriptUrl) => _createWorker(scriptUrl);
- static Worker _createWorker(String scriptUrl) native "Worker_constructor_Callback";
+ static Worker createWorker(String scriptUrl) native "Worker_constructor_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.
class _XMLSerializerFactoryProvider {
- static XMLSerializer createXMLSerializer() => _createXMLSerializer();
- static XMLSerializer _createXMLSerializer() native "XMLSerializer_constructor_Callback";
+ static XMLSerializer createXMLSerializer() native "XMLSerializer_constructor_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.
class _XPathEvaluatorFactoryProvider {
- static XPathEvaluator createXPathEvaluator() => _createXPathEvaluator();
- static XPathEvaluator _createXPathEvaluator() native "XPathEvaluator_constructor_Callback";
+ static XPathEvaluator createXPathEvaluator() native "XPathEvaluator_constructor_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.
class _XSLTProcessorFactoryProvider {
- static XSLTProcessor createXSLTProcessor() => _createXSLTProcessor();
- static XSLTProcessor _createXSLTProcessor() native "XSLTProcessor_constructor_Callback";
+ static XSLTProcessor createXSLTProcessor() native "XSLTProcessor_constructor_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
@@ -44263,14 +44214,13 @@
* [:start + length:].
* Returns an empty list if [length] is 0.
* Throws an [ArgumentError] if [length] is negative.
- * Throws an [IndexOutOfRangeException] if [start] or
- * [:start + length:] are out of range.
+ * Throws a [RangeError] if [start] or [:start + length:] are out of range.
*/
static List getRange(List a, int start, int length, List accumulator) {
if (length < 0) throw new ArgumentError('length');
- if (start < 0) throw new IndexOutOfRangeException(start);
+ if (start < 0) throw new RangeError.value(start);
int end = start + length;
- if (end > a.length) throw new IndexOutOfRangeException(end);
+ if (end > a.length) throw new RangeError.value(end);
for (int i = start; i < end; i++) {
accumulator.add(a[i]);
}
diff --git a/lib/html/idl/dart/dart.idl b/lib/html/idl/dart/dart.idl
index 0790ad1..9fa23a0 100644
--- a/lib/html/idl/dart/dart.idl
+++ b/lib/html/idl/dart/dart.idl
@@ -117,7 +117,9 @@
// TBD
// void glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision);
- DOMString[] getSupportedExtensions();
+ [Custom] any getExtension(DOMString name);
+ [Suppressed, StrictTypeChecking, Custom] void getExtension(DOMString name);
+ [Custom] DOMString[] getSupportedExtensions();
[Suppressed, StrictTypeChecking, Custom] void getSupportedExtensions();
[Custom] any getTexParameter(in unsigned long target, in unsigned long pname) raises(DOMException);
diff --git a/lib/html/scripts/htmlrenamer.py b/lib/html/scripts/htmlrenamer.py
index 83057fe..79f187d 100644
--- a/lib/html/scripts/htmlrenamer.py
+++ b/lib/html/scripts/htmlrenamer.py
@@ -215,12 +215,10 @@
"HtmlElement.manifest",
"Document.version",
"Document.manifest",
- "InputElement.dirName",
"HTMLIsIndexElement.*",
"HTMLOptionsCollection.*",
"HTMLPropertiesCollection.*",
"SelectElement.remove",
- "TextAreaElement.dirName",
"NamedNodeMap.*",
"Node.isEqualNode",
"Node.get:TEXT_NODE",
diff --git a/lib/html/scripts/systemhtml.py b/lib/html/scripts/systemhtml.py
index 1528ccf..44553c4 100644
--- a/lib/html/scripts/systemhtml.py
+++ b/lib/html/scripts/systemhtml.py
@@ -410,7 +410,7 @@
# defined in the current interface as well as a parent. In that case we
# avoid making a duplicate definition and pray that the signatures match.
secondary_parents = self._TransitiveSecondaryParents(interface)
- for parent_interface in secondary_parents:
+ for parent_interface in sorted(secondary_parents):
if isinstance(parent_interface, str): # IsDartCollectionType(parent_interface)
continue
for attr in sorted(parent_interface.attributes, ConstantOutputOrder):
@@ -554,11 +554,16 @@
"""
def walk(parents):
for parent in parents:
- if IsDartCollectionType(parent.type.id):
- result.append(parent.type.id)
+ parent_name = parent.type.id
+ if parent_name == 'EventTarget':
+ # Currently EventTarget is implemented as a mixin, not a proper
+ # super interface---ignore its members.
continue
- if self._database.HasInterface(parent.type.id):
- parent_interface = self._database.GetInterface(parent.type.id)
+ if IsDartCollectionType(parent_name):
+ result.append(parent_name)
+ continue
+ if self._database.HasInterface(parent_name):
+ parent_interface = self._database.GetInterface(parent_name)
result.append(parent_interface)
walk(parent_interface.parents)
@@ -910,7 +915,6 @@
temp_version = [0]
def GenerateCall(operation, argument_count, checks):
- checks = filter(lambda e: e != 'true', checks)
if checks:
(stmts_emitter, call_emitter) = body.Emit(
' if ($CHECKS) {\n$!STMTS$!CALL }\n',
@@ -976,18 +980,17 @@
NATIVE=info.declared_name)
def GenerateChecksAndCall(operation, argument_count):
- checks = ['!?%s' % name for name in parameter_names]
+ checks = []
for i in range(0, argument_count):
argument = operation.arguments[i]
parameter_name = parameter_names[i]
test_type = self._DartType(argument.type.id)
if test_type in ['dynamic', 'Object']:
- checks[i] = '?%s' % parameter_name
- elif test_type == parameter_types[i]:
- checks[i] = 'true'
- else:
- checks[i] = '(%s is %s || %s == null)' % (
- parameter_name, test_type, parameter_name)
+ checks.append('?%s' % parameter_name)
+ elif test_type != parameter_types[i]:
+ checks.append('(%s is %s || %s == null)' % (
+ parameter_name, test_type, parameter_name))
+ checks.extend(['!?%s' % name for name in parameter_names[argument_count:]])
# There can be multiple presence checks. We need them all since a later
# optional argument could have been passed by name, leaving 'holes'.
GenerateCall(operation, argument_count, checks)
diff --git a/lib/html/scripts/systemnative.py b/lib/html/scripts/systemnative.py
index 5b8c5b6..55477de 100644
--- a/lib/html/scripts/systemnative.py
+++ b/lib/html/scripts/systemnative.py
@@ -68,7 +68,7 @@
'{\n'
' if (!m_callback.isIsolateAlive())\n'
' return false;\n'
- ' DartIsolate::Scope scope(m_callback.isolate());\n'
+ ' DartIsolateScope scope(m_callback.isolate());\n'
' DartApiScope apiScope;\n'
' $ARGUMENTS_DECLARATION;\n'
' return m_callback.handleEvent($ARGUMENT_COUNT, arguments);\n'
@@ -499,12 +499,14 @@
self._GenerateOperationNativeCallback(operation, operation.arguments[:argument_count], cpp_callback_name)
def GenerateChecksAndCall(operation, argument_count):
- checks = ['!?%s' % name for name in argument_names]
+ checks = []
for i in range(0, argument_count):
argument = operation.arguments[i]
argument_name = argument_names[i]
- checks[i] = '(%s is %s || %s == null)' % (
- argument_name, self._DartType(argument.type.id), argument_name)
+ type = self._DartType(argument.type.id)
+ if type not in ['dynamic', 'Object']:
+ checks.append('(%s is %s || %s == null)' % (argument_name, type, argument_name))
+ checks.extend(['!?%s' % name for name in argument_names[argument_count:]])
GenerateCall(operation, argument_count, checks)
# TODO: Optimize the dispatch to avoid repeated checks.
@@ -600,7 +602,7 @@
self._cpp_impl_includes.add('"DOMWindow.h"')
runtime_check = emitter.Format(
' if (!ContextFeatures::$(FEATURE)Enabled(DartUtilities::domWindowForCurrentIsolate()->document())) {\n'
- ' exception = Dart_NewString("Feature $FEATURE is not enabled");\n'
+ ' exception = Dart_NewStringFromCString("Feature $FEATURE is not enabled");\n'
' goto fail;\n'
' }',
FEATURE=v8EnabledPerContext)
@@ -610,7 +612,7 @@
self._cpp_impl_includes.add('"RuntimeEnabledFeatures.h"')
runtime_check = emitter.Format(
' if (!RuntimeEnabledFeatures::$(FEATURE)Enabled()) {\n'
- ' exception = Dart_NewString("Feature $FEATURE is not enabled");\n'
+ ' exception = Dart_NewStringFromCString("Feature $FEATURE is not enabled");\n'
' goto fail;\n'
' }',
FEATURE=self._ToWebKitName(v8EnabledAtRuntime))
@@ -652,7 +654,7 @@
body_emitter.Emit(
' ScriptExecutionContext* context = DartUtilities::scriptExecutionContext();\n'
' if (!context) {\n'
- ' exception = Dart_NewString("Failed to retrieve a context");\n'
+ ' exception = Dart_NewStringFromCString("Failed to retrieve a context");\n'
' goto fail;\n'
' }\n\n')
@@ -661,7 +663,7 @@
body_emitter.Emit(
' DOMWindow* domWindow = DartUtilities::domWindowForCurrentIsolate();\n'
' if (!domWindow) {\n'
- ' exception = Dart_NewString("Failed to fetch domWindow");\n'
+ ' exception = Dart_NewStringFromCString("Failed to fetch domWindow");\n'
' goto fail;\n'
' }\n'
' Document* document = domWindow->document();\n')
@@ -805,6 +807,8 @@
# as it's a single instance.
if self._interface.id == 'CSSStyleDeclaration' and operation.id == 'setProperty' and argument.id == 'priority':
return False
+ if argument.type.id == 'Dictionary':
+ return False
return True
def _GenerateCPPIncludes(self, includes):
diff --git a/lib/html/src/_Lists.dart b/lib/html/src/_Lists.dart
index 712600c..75d7905 100644
--- a/lib/html/src/_Lists.dart
+++ b/lib/html/src/_Lists.dart
@@ -52,14 +52,13 @@
* [:start + length:].
* Returns an empty list if [length] is 0.
* Throws an [ArgumentError] if [length] is negative.
- * Throws an [IndexOutOfRangeException] if [start] or
- * [:start + length:] are out of range.
+ * Throws a [RangeError] if [start] or [:start + length:] are out of range.
*/
static List getRange(List a, int start, int length, List accumulator) {
if (length < 0) throw new ArgumentError('length');
- if (start < 0) throw new IndexOutOfRangeException(start);
+ if (start < 0) throw new RangeError.value(start);
int end = start + length;
- if (end > a.length) throw new IndexOutOfRangeException(end);
+ if (end > a.length) throw new RangeError.value(end);
for (int i = start; i < end; i++) {
accumulator.add(a[i]);
}
diff --git a/lib/html/templates/html/dartium/factoryprovider.darttemplate b/lib/html/templates/html/dartium/factoryprovider.darttemplate
index 1b0b5d5..d36e7f4 100644
--- a/lib/html/templates/html/dartium/factoryprovider.darttemplate
+++ b/lib/html/templates/html/dartium/factoryprovider.darttemplate
@@ -3,6 +3,5 @@
// BSD-style license that can be found in the LICENSE file.
class $FACTORYPROVIDER {
- static $INTERFACE create$INTERFACE($PARAMETERS) => _create$INTERFACE($ARGUMENTS);
- static $INTERFACE _create$INTERFACE($PARAMETERS) native "$NATIVE_NAME";
+ static $INTERFACE create$INTERFACE($PARAMETERS) native "$NATIVE_NAME";
}
diff --git a/lib/html/templates/html/impl/impl_Element.darttemplate b/lib/html/templates/html/impl/impl_Element.darttemplate
index 6be2882..e8b9ed5 100644
--- a/lib/html/templates/html/impl/impl_Element.darttemplate
+++ b/lib/html/templates/html/impl/impl_Element.darttemplate
@@ -738,11 +738,18 @@
var xtag;
$if DARTIUM
- noSuchMethod(String name, List args) {
+ noSuchMethod(InvocationMirror invocation) {
if (dynamicUnknownElementDispatcher == null) {
- throw new NoSuchMethodError(this, name, args);
+ throw new NoSuchMethodError(this, invocation.memberName,
+ invocation.positionalArguments,
+ invocation.namedArguments);
} else {
- return dynamicUnknownElementDispatcher(this, name, args);
+ String hackedName = invocation.memberName;
+ if (invocation.isGetter) hackedName = "get:$hackedName";
+ if (invocation.isSetter) hackedName = "set:$hackedName";
+ return dynamicUnknownElementDispatcher(this,
+ hackedName,
+ invocation.positionalArguments);
}
}
$else
diff --git a/lib/html/templates/html/interface/interface_HttpRequest.darttemplate b/lib/html/templates/html/interface/interface_HttpRequest.darttemplate
index faea09e..5faa590 100644
--- a/lib/html/templates/html/interface/interface_HttpRequest.darttemplate
+++ b/lib/html/templates/html/interface/interface_HttpRequest.darttemplate
@@ -12,5 +12,5 @@
_$(ID)FactoryProvider.create$(ID)_get(url, onSuccess);
factory $ID.getWithCredentials(String url, onSuccess($ID request)) =>
- _$(ID)FactoryProvider.create$(ID)getWithCredentials(url, onSuccess);
+ _$(ID)FactoryProvider.create$(ID)_getWithCredentials(url, onSuccess);
$!MEMBERS}
diff --git a/runtime/bin/base64.dart b/lib/io/base64.dart
similarity index 97%
rename from runtime/bin/base64.dart
rename to lib/io/base64.dart
index 14ef242..905d177 100644
--- a/runtime/bin/base64.dart
+++ b/lib/io/base64.dart
@@ -3,7 +3,7 @@
// BSD-style license that can be found in the LICENSE file.
class _Base64 {
- static const List<int> _encodingTable = const [
+ static const List<String> _encodingTable = const [
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd',
'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's',
diff --git a/runtime/bin/buffer_list.dart b/lib/io/buffer_list.dart
similarity index 100%
rename from runtime/bin/buffer_list.dart
rename to lib/io/buffer_list.dart
diff --git a/runtime/bin/chunked_stream.dart b/lib/io/chunked_stream.dart
similarity index 100%
rename from runtime/bin/chunked_stream.dart
rename to lib/io/chunked_stream.dart
diff --git a/runtime/bin/common.dart b/lib/io/common.dart
similarity index 83%
rename from runtime/bin/common.dart
rename to lib/io/common.dart
index 33ce2a5..687d2ed 100644
--- a/runtime/bin/common.dart
+++ b/lib/io/common.dart
@@ -55,12 +55,6 @@
}
-// Check if a List is a builtin VM List type. Returns true
-// if the List is a builtin VM List type and false if it is
-// a user defined List type.
-bool _isBuiltinList(List buffer) native "Common_IsBuiltinList";
-
-
// Object for holding a buffer and an offset.
class _BufferAndOffset {
_BufferAndOffset(List this.buffer, int this.offset);
@@ -68,14 +62,13 @@
int offset;
}
-
// Ensure that the input List can be serialized through a native port.
// Only builtin Lists can be serialized through. If user-defined Lists
// get here, the contents is copied to a Uint8List. This has the added
// benefit that it is faster to access from the C code as well.
_BufferAndOffset _ensureFastAndSerializableBuffer(
List buffer, int offset, int bytes) {
- if (buffer is Uint8List || _isBuiltinList(buffer)) {
+ if (buffer is Uint8List || _BufferUtils._isBuiltinList(buffer)) {
return new _BufferAndOffset(buffer, offset);
}
var newBuffer = new Uint8List(bytes);
@@ -83,10 +76,20 @@
for (int i = 0; i < bytes; i++) {
int value = buffer[j];
if (value is! int) {
- throw new FileIOException("List element is not an integer at index $j");
+ throw new ArgumentError("List element is not an integer at index $j");
}
newBuffer[i] = value;
j++;
}
return new _BufferAndOffset(newBuffer, 0);
}
+
+
+// TODO(ager): The only reason for the class here is that
+// we cannot patch a top-level function.
+class _BufferUtils {
+ // Check if a List is a builtin VM List type. Returns true
+ // if the List is a builtin VM List type and false if it is
+ // a user defined List type.
+ external static bool _isBuiltinList(List buffer);
+}
diff --git a/runtime/bin/directory.dart b/lib/io/directory.dart
similarity index 100%
rename from runtime/bin/directory.dart
rename to lib/io/directory.dart
diff --git a/runtime/bin/directory_impl.dart b/lib/io/directory_impl.dart
similarity index 89%
rename from runtime/bin/directory_impl.dart
rename to lib/io/directory_impl.dart
index f4b43f1..cbfa945 100644
--- a/runtime/bin/directory_impl.dart
+++ b/lib/io/directory_impl.dart
@@ -19,13 +19,13 @@
_Directory.fromPath(Path path) : this(path.toNativePath());
_Directory.current() : this(_current());
- static String _current() native "Directory_Current";
- static _createTemp(String template) native "Directory_CreateTemp";
- static int _exists(String path) native "Directory_Exists";
- static _create(String path) native "Directory_Create";
- static _delete(String path, bool recursive) native "Directory_Delete";
- static _rename(String path, String newPath) native "Directory_Rename";
- static SendPort _newServicePort() native "Directory_NewServicePort";
+ external static String _current();
+ external static _createTemp(String template);
+ external static int _exists(String path);
+ external static _create(String path);
+ external static _delete(String path, bool recursive);
+ external static _rename(String path, String newPath);
+ external static SendPort _newServicePort();
Future<bool> exists() {
_ensureDirectoryService();
@@ -34,7 +34,7 @@
request[1] = _path;
return _directoryService.call(request).transform((response) {
if (_isErrorResponse(response)) {
- throw _exceptionFromResponse(response, "Exists failed");
+ throw _exceptionOrErrorFromResponse(response, "Exists failed");
}
return response == 1;
});
@@ -58,7 +58,7 @@
request[1] = _path;
return _directoryService.call(request).transform((response) {
if (_isErrorResponse(response)) {
- throw _exceptionFromResponse(response, "Creation failed");
+ throw _exceptionOrErrorFromResponse(response, "Creation failed");
}
return this;
});
@@ -81,8 +81,8 @@
request[1] = _path;
return _directoryService.call(request).transform((response) {
if (_isErrorResponse(response)) {
- throw _exceptionFromResponse(response,
- "Creation of temporary directory failed");
+ throw _exceptionOrErrorFromResponse(response,
+ "Creation of temporary directory failed");
}
return new Directory(response);
});
@@ -109,11 +109,10 @@
request[2] = recursive;
return _directoryService.call(request).transform((response) {
if (_isErrorResponse(response)) {
- throw _exceptionFromResponse(response, errorMsg);
+ throw _exceptionOrErrorFromResponse(response, errorMsg);
}
return this;
});
- return completer.future;
}
Future<Directory> delete() {
@@ -152,7 +151,7 @@
request[2] = newPath;
return _directoryService.call(request).transform((response) {
if (_isErrorResponse(response)) {
- throw _exceptionFromResponse(response, "Rename failed");
+ throw _exceptionOrErrorFromResponse(response, "Rename failed");
}
return new Directory(newPath);
});
@@ -179,7 +178,7 @@
return response is List && response[0] != _SUCCESS_RESPONSE;
}
- Exception _exceptionFromResponse(response, String message) {
+ _exceptionOrErrorFromResponse(response, String message) {
assert(_isErrorResponse(response));
switch (response[_ERROR_RESPONSE_ERROR_TYPE]) {
case _ILLEGAL_ARGUMENT_RESPONSE:
diff --git a/lib/io/eventhandler.dart b/lib/io/eventhandler.dart
new file mode 100644
index 0000000..f925b01
--- /dev/null
+++ b/lib/io/eventhandler.dart
@@ -0,0 +1,8 @@
+// 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.
+
+class _EventHandler {
+ external static void _start();
+ external static _sendData(Object sender, ReceivePort receivePort, int data);
+}
diff --git a/runtime/bin/file.dart b/lib/io/file.dart
similarity index 100%
rename from runtime/bin/file.dart
rename to lib/io/file.dart
diff --git a/runtime/bin/file_impl.dart b/lib/io/file_impl.dart
similarity index 91%
rename from runtime/bin/file_impl.dart
rename to lib/io/file_impl.dart
index 0aa31fb..05126a8 100644
--- a/runtime/bin/file_impl.dart
+++ b/lib/io/file_impl.dart
@@ -198,7 +198,7 @@
// A copy is required by the interface.
var length = buffer.length - offset;
if (len != null) {
- if (len > length) throw new IndexOutOfRangeException(len);
+ if (len > length) throw new RangeError.value(len);
length = len;
}
var copy = new Uint8List(length);
@@ -321,7 +321,6 @@
const int _WRITE_BYTE_REQUEST = 15;
const int _READ_LIST_REQUEST = 16;
const int _WRITE_LIST_REQUEST = 17;
-const int _WRITE_STRING_REQUEST = 18;
// Base class for _File and _RandomAccessFile with shared functions.
class _FileBase {
@@ -329,7 +328,7 @@
return response is List && response[0] != _SUCCESS_RESPONSE;
}
- Exception _exceptionFromResponse(response, String message) {
+ _exceptionFromResponse(response, String message) {
assert(_isErrorResponse(response));
switch (response[_ERROR_RESPONSE_ERROR_TYPE]) {
case _ILLEGAL_ARGUMENT_RESPONSE:
@@ -346,7 +345,12 @@
}
}
-SendPort _newServicePort() native "File_NewServicePort";
+// TODO(ager): The only reason for this class is that the patching
+// mechanism doesn't seem to like patching a private top level
+// function.
+class _FileUtils {
+ external static SendPort _newServicePort();
+}
// Class for encapsulating the native implementation of files.
class _File extends _FileBase implements File {
@@ -374,8 +378,7 @@
});
}
-
- static _exists(String name) native "File_Exists";
+ external static _exists(String name);
bool existsSync() {
var result = _exists(_name);
@@ -396,7 +399,7 @@
});
}
- static _create(String name) native "File_Create";
+ external static _create(String name);
void createSync() {
var result = _create(_name);
@@ -416,7 +419,7 @@
});
}
- static _delete(String name) native "File_Delete";
+ external static _delete(String name);
void deleteSync() {
var result = _delete(_name);
@@ -438,7 +441,7 @@
});
}
- static _directory(String name) native "File_Directory";
+ external static _directory(String name);
Directory directorySync() {
var result = _directory(name);
@@ -485,7 +488,7 @@
}
- static _lengthFromName(String name) native "File_LengthFromName";
+ external static _lengthFromName(String name);
int lengthSync() {
var result = _lengthFromName(_name);
@@ -508,7 +511,7 @@
});
}
- static _lastModified(String name) native "File_LastModified";
+ external static _lastModified(String name);
Date lastModifiedSync() {
var ms = _lastModified(name);
@@ -516,7 +519,7 @@
return new Date.fromMillisecondsSinceEpoch(ms);
}
- static _open(String name, int mode) native "File_Open";
+ external static _open(String name, int mode);
RandomAccessFile openSync([FileMode mode = FileMode.READ]) {
if (mode != FileMode.READ &&
@@ -530,7 +533,7 @@
return new _RandomAccessFile(id, _name);
}
- static int _openStdio(int fd) native "File_OpenStdio";
+ external static int _openStdio(int fd);
static RandomAccessFile _openStdioSync(int fd) {
var id = _openStdio(fd);
@@ -555,7 +558,7 @@
});
}
- static _fullPath(String name) native "File_FullPath";
+ external static _fullPath(String name);
String fullPathSync() {
var result = _fullPath(_name);
@@ -661,7 +664,7 @@
void _ensureFileService() {
if (_fileService == null) {
- _fileService = _newServicePort();
+ _fileService = _FileUtils._newServicePort();
}
}
@@ -700,7 +703,7 @@
});
}
- static int _close(int id) native "File_Close";
+ external static int _close(int id);
void closeSync() {
_checkNotClosed();
@@ -727,7 +730,7 @@
});
}
- static _readByte(int id) native "File_ReadByte";
+ external static _readByte(int id);
int readByteSync() {
_checkNotClosed();
@@ -769,15 +772,14 @@
}
static void _checkReadWriteListArguments(int length, int offset, int bytes) {
- if (offset < 0) throw new IndexOutOfRangeException(offset);
- if (bytes < 0) throw new IndexOutOfRangeException(bytes);
+ if (offset < 0) throw new RangeError.value(offset);
+ if (bytes < 0) throw new RangeError.value(bytes);
if ((offset + bytes) > length) {
- throw new IndexOutOfRangeException(offset + bytes);
+ throw new RangeError.value(offset + bytes);
}
}
- static _readList(int id, List<int> buffer, int offset, int bytes)
- native "File_ReadList";
+ external static _readList(int id, List<int> buffer, int offset, int bytes);
int readListSync(List<int> buffer, int offset, int bytes) {
_checkNotClosed();
@@ -822,7 +824,7 @@
});
}
- static _writeByte(int id, int value) native "File_WriteByte";
+ external static _writeByte(int id, int value);
int writeByteSync(int value) {
_checkNotClosed();
@@ -879,8 +881,7 @@
});
}
- static _writeList(int id, List<int> buffer, int offset, int bytes)
- native "File_WriteList";
+ external static _writeList(int id, List<int> buffer, int offset, int bytes);
int writeListSync(List<int> buffer, int offset, int bytes) {
_checkNotClosed();
@@ -902,32 +903,25 @@
Future<RandomAccessFile> writeString(String string,
[Encoding encoding = Encoding.UTF_8]) {
- _ensureFileService();
- Completer<RandomAccessFile> completer = new Completer<RandomAccessFile>();
- if (closed) return _completeWithClosedException(completer);
- List request = new List(3);
- request[0] = _WRITE_STRING_REQUEST;
- request[1] = _id;
- request[2] = string;
- return _fileService.call(request).transform((response) {
- if (_isErrorResponse(response)) {
- throw _exceptionFromResponse(response,
- "writeString failed for file '$_name'");
- }
- return this;
- });
+ if (encoding is! Encoding) {
+ var completer = new Completer();
+ new Timer(0, (t) {
+ completer.completeException(new FileIOException(
+ "Invalid encoding in writeString: $encoding"));
+ });
+ return completer.future;
+ }
+ var data = _StringEncoders.encoder(encoding).encodeString(string);
+ return writeList(data, 0, data.length);
}
- static _writeString(int id, String string) native "File_WriteString";
-
int writeStringSync(String string, [Encoding encoding = Encoding.UTF_8]) {
- _checkNotClosed();
- if (string is !String) throw new ArgumentError();
- var result = _writeString(_id, string);
- if (result is OSError) {
- throw new FileIOException("writeString failed for file '$_name'");
+ if (encoding is! Encoding) {
+ throw new FileIOException(
+ "Invalid encoding in writeStringSync: $encoding");
}
- return result;
+ var data = _StringEncoders.encoder(encoding).encodeString(string);
+ return writeListSync(data, 0, data.length);
}
Future<int> position() {
@@ -946,7 +940,7 @@
});
}
- static _position(int id) native "File_Position";
+ external static _position(int id);
int positionSync() {
_checkNotClosed();
@@ -974,7 +968,7 @@
});
}
- static _setPosition(int id, int position) native "File_SetPosition";
+ external static _setPosition(int id, int position);
void setPositionSync(int position) {
_checkNotClosed();
@@ -1001,7 +995,7 @@
});
}
- static _truncate(int id, int length) native "File_Truncate";
+ external static _truncate(int id, int length);
void truncateSync(int length) {
_checkNotClosed();
@@ -1027,7 +1021,7 @@
});
}
- static _length(int id) native "File_Length";
+ external static _length(int id);
int lengthSync() {
_checkNotClosed();
@@ -1054,7 +1048,7 @@
});
}
- static _flush(int id) native "File_Flush";
+ external static _flush(int id);
void flushSync() {
_checkNotClosed();
@@ -1068,7 +1062,7 @@
void _ensureFileService() {
if (_fileService == null) {
- _fileService = _newServicePort();
+ _fileService = _FileUtils._newServicePort();
}
}
diff --git a/runtime/bin/http.dart b/lib/io/http.dart
similarity index 93%
rename from runtime/bin/http.dart
rename to lib/io/http.dart
index 13b28dc..79d16af 100644
--- a/runtime/bin/http.dart
+++ b/lib/io/http.dart
@@ -66,7 +66,7 @@
* setup. See [addRequestHandler] and [defaultRequestHandler] for
* information on how incoming HTTP requests are handled.
*/
- void listen(String host, int port, [int backlog]);
+ void listen(String host, int port, {int backlog: 128});
/**
* Attach the HTTP server to an existing [:ServerSocket:]. If the
@@ -116,7 +116,7 @@
* Set the timeout, in seconds, for sessions of this HTTP server. Default
* is 20 minutes.
*/
- int set sessionTimeout(int timeout);
+ set sessionTimeout(int timeout);
}
@@ -370,8 +370,10 @@
* Creates a new header value object from parsing a header value
* string with both value and optional parameters.
*/
- factory HeaderValue.fromString(String value) {
- return new _HeaderValue.fromString(value);
+ factory HeaderValue.fromString(String value,
+ {String parameterSeparator: ";"}) {
+ return new _HeaderValue.fromString(
+ value, parameterSeparator: parameterSeparator);
}
/**
@@ -401,7 +403,7 @@
/**
* Access the user-data associated with the session.
*/
- Dynamic data;
+ dynamic data;
/**
* Destroy the session. This will terminate the session and any further
@@ -747,6 +749,29 @@
HttpClientConnection postUrl(Uri url);
/**
+ * Sets the function to be called when a site is requesting
+ * authentication. The URL requested and the security realm from the
+ * server are passed in the arguments [url] and [realm].
+ *
+ * The function returns a [Future] which should complete when the
+ * authentication has been resolved. If credentials cannot be
+ * provided the [Future] should complete with [false]. If
+ * credentials are available the function should add these using
+ * [addCredentials] before completing the [Future] with the value
+ * [true].
+ *
+ * If the [Future] completes with true the request will be retried
+ * using the updated credentials. Otherwise response processing will
+ * continue normally.
+ */
+ set authenticate(Future<bool> f(Uri url, String scheme, String realm));
+
+ /**
+ * Add credentials to be used for authorizing HTTP requests.
+ */
+ void addCredentials(Uri url, String realm, HttpClientCredentials credentials);
+
+ /**
* Sets the function used to resolve the proxy server to be used for
* opening a HTTP connection to the specified [url]. If this
* function is not set, direct connections will always be used.
@@ -942,6 +967,28 @@
InputStream get inputStream;
}
+
+abstract class HttpClientCredentials { }
+
+
+/**
+ * Represent credentials for basic authentication.
+ */
+abstract class HttpClientBasicCredentials extends HttpClientCredentials {
+ factory HttpClientBasicCredentials(String username, String password) =>
+ new _HttpClientBasicCredentials(username, password);
+}
+
+
+/**
+ * Represent credentials for digest authentication.
+ */
+abstract class HttpClientDigestCredentials extends HttpClientCredentials {
+ factory HttpClientDigestCredentials(String username, String password) =>
+ new _HttpClientDigestCredentials(username, password);
+}
+
+
/**
* Connection information.
*/
diff --git a/runtime/bin/http_impl.dart b/lib/io/http_impl.dart
similarity index 87%
rename from runtime/bin/http_impl.dart
rename to lib/io/http_impl.dart
index 68e2f52..740dc36 100644
--- a/runtime/bin/http_impl.dart
+++ b/lib/io/http_impl.dart
@@ -308,7 +308,7 @@
class _HeaderValue implements HeaderValue {
_HeaderValue([String this.value = ""]);
- _HeaderValue.fromString(String value) {
+ _HeaderValue.fromString(String value, {this.parameterSeparator: ";"}) {
// Parse the string.
_parse(value);
}
@@ -347,20 +347,25 @@
String parseValue() {
int start = index;
while (!done()) {
- if (s[index] == " " || s[index] == "\t" || s[index] == ";") break;
+ if (s[index] == " " ||
+ s[index] == "\t" ||
+ s[index] == parameterSeparator) break;
index++;
}
return s.substring(start, index).toLowerCase();
}
void expect(String expected) {
- if (done()) throw new HttpException("Failed to parse header value [$s]");
- if (s[index] != expected) {
- throw new HttpException("Failed to parse header value [$s]");
+ if (done() || s[index] != expected) {
+ throw new HttpException("Failed to parse header value");
}
index++;
}
+ void maybeExpect(String expected) {
+ if (s[index] == expected) index++;
+ }
+
void parseParameters() {
_parameters = new Map<String, String>();
@@ -381,7 +386,7 @@
while (!done()) {
if (s[index] == "\\") {
if (index + 1 == s.length) {
- throw new HttpException("Failed to parse header value [$s]");
+ throw new HttpException("Failed to parse header value");
}
index++;
} else if (s[index] == "\"") {
@@ -409,7 +414,7 @@
_parameters[name] = value;
skipWS();
if (done()) return;
- expect(";");
+ expect(parameterSeparator);
}
}
@@ -417,11 +422,12 @@
value = parseValue();
skipWS();
if (done()) return;
- expect(";");
+ maybeExpect(parameterSeparator);
parseParameters();
}
String value;
+ String parameterSeparator;
Map<String, String> _parameters;
}
@@ -642,7 +648,7 @@
bool _write(List<int> data, bool copyBuffer) {
- if (_headResponse) return;
+ if (_headResponse) return true;
_ensureHeadersSent();
bool allWritten = true;
if (data.length > 0) {
@@ -661,7 +667,7 @@
}
bool _writeList(List<int> data, int offset, int count) {
- if (_headResponse) return;
+ if (_headResponse) return true;
_ensureHeadersSent();
bool allWritten = true;
if (count > 0) {
@@ -690,9 +696,12 @@
}
assert(_headResponse || _bodyBytesWritten == _contentLength);
}
- // If we are done writing the response and the client has closed
- // or the connection is not persistent we can close.
- if (!persistentConnection || _httpConnection._closing) {
+ // If we are done writing the response, and either the client has
+ // closed or the connection is not persistent, we can close. Also
+ // if using HTTP 1.0 and the content length was not known we must
+ // close to indicate end of body.
+ if (!persistentConnection || _httpConnection._closing ||
+ (_protocolVersion == "1.0" && _contentLength < 0)) {
_httpConnection._close();
}
return allWritten;
@@ -890,8 +899,11 @@
}
}
- _headers._mutable = false;
+ // Get parsed content length.
+ _contentLength = _httpConnection._httpParser.contentLength;
+
// Prepare for receiving data.
+ _headers._mutable = false;
_buffer = new _BufferList();
}
@@ -1022,6 +1034,10 @@
return _writeList(buffer, offset, len);
}
+ void _streamFlush() {
+ _httpConnection._flush();
+ }
+
void _streamClose() {
_responseEnd();
}
@@ -1098,11 +1114,6 @@
bool _writeHeader() {
List<int> data;
- // HTTP/1.0 does not support chunked.
- if (_protocolVersion == "1.0" && _contentLength < 0) {
- throw new HttpException("Content length required for HTTP 1.0");
- }
-
// Write status line.
if (_protocolVersion == "1.1") {
_httpConnection._write(_Const.HTTP11);
@@ -1118,10 +1129,11 @@
_writeCRLF();
// Determine the value of the "Transfer-Encoding" header based on
- // whether the content length is known.
+ // whether the content length is known. HTTP/1.0 does not support
+ // chunked.
if (_contentLength >= 0) {
_headers.set(HttpHeaders.CONTENT_LENGTH, _contentLength.toString());
- } else if (_contentLength < 0) {
+ } else if (_contentLength < 0 && _protocolVersion == "1.1") {
_headers.set(HttpHeaders.TRANSFER_ENCODING, "chunked");
}
@@ -1131,7 +1143,7 @@
bool found = false;
for (int i = 0; i < cookies.length; i++) {
if (cookies[i].name.toUpperCase() == _DART_SESSION_ID) {
- cookie.value = session.id;
+ cookies[i].value = session.id;
found = true;
break;
}
@@ -1189,10 +1201,6 @@
return result;
}
- void flush() {
- // Nothing to do on a HTTP output stream.
- }
-
void _close() {
// TODO(sgjesse): Handle this.
}
@@ -1216,6 +1224,10 @@
return _requestOrResponse._streamWriteFrom(buffer, offset, len);
}
+ void flush() {
+ _requestOrResponse._streamFlush();
+ }
+
void close() {
_requestOrResponse._streamClose();
}
@@ -1242,9 +1254,8 @@
}
-class _HttpConnectionBase {
- _HttpConnectionBase() : _sendBuffers = new Queue(),
- _httpParser = new _HttpParser(),
+abstract class _HttpConnectionBase {
+ _HttpConnectionBase() : _httpParser = new _HttpParser(),
hashCode = _nextHashCode {
_nextHashCode = (_nextHashCode + 1) & 0xFFFFFFF;
}
@@ -1272,6 +1283,10 @@
}
}
+ bool _flush() {
+ _socket.outputStream.flush();
+ }
+
bool _close() {
_closing = true;
_socket.outputStream.close();
@@ -1340,8 +1355,8 @@
return null;
}
- abstract void _onConnectionClosed(e);
- abstract void _responseDone();
+ void _onConnectionClosed(e);
+ void _responseDone();
void set _onNoPendingWrites(void callback()) {
if (!_error) {
@@ -1354,8 +1369,6 @@
bool _error = false; // Is the socket closed due to an error?
_HttpParser _httpParser;
- Queue _sendBuffers;
-
Function onDetach;
// Hash code for HTTP connection. Currently this is just a counter.
@@ -1551,7 +1564,7 @@
_onError = callback;
}
- int set sessionTimeout(int timeout) {
+ set sessionTimeout(int timeout) {
_sessionManager.sessionTimeout = timeout;
}
@@ -1642,6 +1655,10 @@
return _writeList(buffer, offset, len);
}
+ void _streamFlush() {
+ _httpConnection._flush();
+ }
+
void _streamClose() {
_ensureHeadersSent();
_state = DONE;
@@ -1695,7 +1712,7 @@
// Determine the value of the "Transfer-Encoding" header based on
// whether the content length is known. If there is no content
- // neither "Content-Length" nor "Transfer-Encoding" is set
+ // neither "Content-Length" nor "Transfer-Encoding" is set.
if (_contentLength > 0) {
_headers.set(HttpHeaders.CONTENT_LENGTH, _contentLength.toString());
} else if (_contentLength < 0) {
@@ -1775,14 +1792,89 @@
void _onHeaderReceived(String name, String value) {
_headers.add(name, value);
- if (name == "content-length") {
- _contentLength = parseInt(value);
+ }
+
+ void _handleUnauthorized() {
+
+ void retryRequest(_Credentials cr) {
+ if (cr != null) {
+ // Drain body and retry.
+ // TODO(sgjesse): Support digest.
+ if (cr.scheme == _AuthenticationScheme.BASIC) {
+ inputStream.onData = inputStream.read;
+ inputStream.onClosed = _connection.retry;
+ return;
+ }
+ }
+
+ // Fall through to here to perform normal response handling if
+ // there is no sensible authorization handling.
+ if (_connection._onResponse != null) {
+ _connection._onResponse(this);
+ }
+ }
+
+ // Only try to authenticate if there is a challenge in the response.
+ List<String> challenge = _headers[HttpHeaders.WWW_AUTHENTICATE];
+ if (challenge != null && challenge.length == 1) {
+ _HeaderValue header =
+ new _HeaderValue.fromString(challenge[0], parameterSeparator: ",");
+ _AuthenticationScheme scheme =
+ new _AuthenticationScheme.fromString(header.value);
+ String realm = header.parameters["realm"];
+
+ // See if any credentials are available.
+ _Credentials cr =
+ _connection._client._findCredentials(
+ _connection._request._uri, scheme);
+
+ // Ask for more credentials if none found or the one found has
+ // already been used. If it has already been used it must now be
+ // invalid and is removed.
+ if (cr == null || cr.used) {
+ if (cr != null) {
+ _connection._client._removeCredentials(cr);
+ }
+ cr = null;
+ if (_connection._client._authenticate != null) {
+ Future authComplete =
+ _connection._client._authenticate(
+ _connection._request._uri, scheme.toString(), realm);
+ authComplete.then((credsAvailable) {
+ if (credsAvailable) {
+ cr = _connection._client._findCredentials(
+ _connection._request._uri, scheme);
+ retryRequest(cr);
+ } else {
+ if (_connection._onResponse != null) {
+ _connection._onResponse(this);
+ }
+ }
+ });
+ return;
+ }
+ } else {
+ // If credentials found prepare for retrying the request.
+ retryRequest(cr);
+ return;
+ }
+ }
+
+ // Fall through to here to perform normal response handling if
+ // there is no sensible authorization handling.
+ if (_connection._onResponse != null) {
+ _connection._onResponse(this);
}
}
void _onHeadersComplete() {
+ // Get parsed content length.
+ _contentLength = _httpConnection._httpParser.contentLength;
+
+ // Prepare for receiving data.
_headers._mutable = false;
_buffer = new _BufferList();
+
if (isRedirect && _connection.followRedirects) {
if (_connection._redirects == null ||
_connection._redirects.length < _connection.maxRedirects) {
@@ -1808,6 +1900,8 @@
} else {
throw new RedirectLimitExceededException(_connection._redirects);
}
+ } else if (statusCode == HttpStatus.UNAUTHORIZED) {
+ _handleUnauthorized();
} else if (_connection._onResponse != null) {
_connection._onResponse(this);
}
@@ -1962,6 +2056,14 @@
_onErrorCallback = callback;
}
+ void retry() {
+ if (_socketConn != null) {
+ throw new HttpException("Cannot retry with body data pending");
+ }
+ // Retry the URL using the same connection instance.
+ _client._openUrl(_method, _request._uri, this);
+ }
+
void redirect([String method, Uri url]) {
if (_socketConn != null) {
throw new HttpException("Cannot redirect with body data pending");
@@ -2086,6 +2188,7 @@
_HttpClient() : _openSockets = new Map(),
_activeSockets = new Set(),
+ credentials = new List<_Credentials>(),
_shutdown = false;
HttpClientConnection open(
@@ -2116,9 +2219,6 @@
if (url.scheme != "http") {
throw new HttpException("Unsupported URL scheme ${url.scheme}");
}
- if (url.userInfo != "") {
- throw new HttpException("Unsupported user info ${url.userInfo}");
- }
return _open(method, url, connection);
}
@@ -2134,6 +2234,15 @@
HttpClientConnection postUrl(Uri url) => _openUrl("POST", url);
+ set authenticate(Future<bool> f(Uri url, String scheme, String realm)) {
+ _authenticate = f;
+ }
+
+ void addCredentials(
+ Uri url, String realm, HttpClientCredentials cr) {
+ credentials.add(new _Credentials(url, realm, cr));
+ }
+
set findProxy(String f(Uri uri)) => _findProxy = f;
void shutdown() {
@@ -2177,6 +2286,20 @@
HttpClientRequest request = connection.open(method, url);
request.headers.host = host;
request.headers.port = port;
+ if (url.userInfo != null && !url.userInfo.isEmpty) {
+ // If the URL contains user information use that for basic
+ // authorization
+ _UTF8Encoder encoder = new _UTF8Encoder();
+ String auth =
+ CryptoUtils.bytesToBase64(encoder.encodeString(url.userInfo));
+ request.headers.set(HttpHeaders.AUTHORIZATION, "Basic $auth");
+ } else {
+ // Look for credentials.
+ _Credentials cr = _findCredentials(url);
+ if (cr != null) {
+ cr.authorize(request);
+ }
+ }
if (connection._onRequest != null) {
connection._onRequest(request);
} else {
@@ -2320,11 +2443,34 @@
sockets.addFirst(socketConn);
}
+ _Credentials _findCredentials(Uri url, [_AuthenticationScheme scheme]) {
+ // Look for credentials.
+ _Credentials cr =
+ credentials.reduce(null, (_Credentials prev, _Credentials value) {
+ if (value.applies(url, scheme)) {
+ if (prev == null) return value;
+ return value.uri.path.length > prev.uri.path.length ? value : prev;
+ } else {
+ return prev;
+ }
+ });
+ return cr;
+ }
+
+ void _removeCredentials(_Credentials cr) {
+ int index = credentials.indexOf(cr);
+ if (index != -1) {
+ credentials.removeAt(index);
+ }
+ }
+
Function _onOpen;
Map<String, Queue<_SocketConnection>> _openSockets;
Set<_SocketConnection> _activeSockets;
+ List<_Credentials> credentials;
Timer _evictionTimer;
Function _findProxy;
+ Function _authenticate;
bool _shutdown; // Has this HTTP client been shutdown?
}
@@ -2345,6 +2491,109 @@
}
+class _AuthenticationScheme {
+ static const UNKNOWN = const _AuthenticationScheme(-1);
+ static const BASIC = const _AuthenticationScheme(0);
+ static const DIGEST = const _AuthenticationScheme(1);
+
+ const _AuthenticationScheme(this._scheme);
+
+ factory _AuthenticationScheme.fromString(String scheme) {
+ if (scheme.toLowerCase() == "basic") return BASIC;
+ if (scheme.toLowerCase() == "digest") return DIGEST;
+ return UNKNOWN;
+ }
+
+ String toString() {
+ if (this == BASIC) return "Basic";
+ if (this == DIGEST) return "Digest";
+ return "Unknown";
+ }
+
+ final int _scheme;
+}
+
+
+class _Credentials {
+ _Credentials(this.uri, this.realm, this.credentials);
+
+ _AuthenticationScheme get scheme => credentials.scheme;
+
+ bool applies(Uri uri, _AuthenticationScheme scheme) {
+ if (scheme != null && credentials.scheme != scheme) return false;
+ if (uri.domain != this.uri.domain) return false;
+ int thisPort =
+ this.uri.port == 0 ? HttpClient.DEFAULT_HTTP_PORT : this.uri.port;
+ int otherPort = uri.port == 0 ? HttpClient.DEFAULT_HTTP_PORT : uri.port;
+ if (otherPort != thisPort) return false;
+ return uri.path.startsWith(this.uri.path);
+ }
+
+ void authorize(HttpClientRequest request) {
+ credentials.authorize(this, request);
+ used = true;
+ }
+
+ bool used = false;
+ Uri uri;
+ String realm;
+ HttpClientCredentials credentials;
+
+ // Digest specific fields.
+ String nonce;
+ String algorithm;
+ String qop;
+}
+
+
+abstract class _HttpClientCredentials implements HttpClientCredentials {
+ _AuthenticationScheme get scheme;
+ void authorize(HttpClientRequest request);
+}
+
+
+class _HttpClientBasicCredentials implements HttpClientBasicCredentials {
+ _HttpClientBasicCredentials(this.username,
+ this.password);
+
+ _AuthenticationScheme get scheme => _AuthenticationScheme.BASIC;
+
+ void authorize(_Credentials _, HttpClientRequest request) {
+ // There is no mentioning of username/password encoding in RFC
+ // 2617. However there is an open draft for adding an additional
+ // accept-charset parameter to the WWW-Authenticate and
+ // Proxy-Authenticate headers, see
+ // http://tools.ietf.org/html/draft-reschke-basicauth-enc-06. For
+ // now always use UTF-8 encoding.
+ _UTF8Encoder encoder = new _UTF8Encoder();
+ String auth =
+ CryptoUtils.bytesToBase64(encoder.encodeString(
+ "$username:$password"));
+ request.headers.set(HttpHeaders.AUTHORIZATION, "Basic $auth");
+ }
+
+ String username;
+ String password;
+}
+
+
+class _HttpClientDigestCredentials implements HttpClientDigestCredentials {
+ _HttpClientDigestCredentials(this.username,
+ this.password);
+
+ _AuthenticationScheme get scheme => _AuthenticationScheme.DIGEST;
+
+ void authorize(_Credentials credentials, HttpClientRequest request) {
+ // TODO(sgjesse): Implement!!!
+ throw new UnsupportedOperationException();
+ }
+
+ String username;
+ String password;
+}
+
+
+
class _RedirectInfo implements RedirectInfo {
const _RedirectInfo(int this.statusCode,
String this.method,
diff --git a/runtime/bin/http_parser.dart b/lib/io/http_parser.dart
similarity index 98%
rename from runtime/bin/http_parser.dart
rename to lib/io/http_parser.dart
index 571ce70..a5549c5 100644
--- a/runtime/bin/http_parser.dart
+++ b/lib/io/http_parser.dart
@@ -428,6 +428,14 @@
case _State.HEADER_ENDING:
_expect(byte, _CharCode.LF);
+ // If a request message has neither Content-Length nor
+ // Transfer-Encoding the message must not have a body (RFC
+ // 2616 section 4.3).
+ if (_messageType == _MessageType.REQUEST &&
+ _contentLength < 0 &&
+ _chunked == false) {
+ _contentLength = 0;
+ }
if (_connectionUpgrade) {
_state = _State.UPGRADED;
_unparsedData =
@@ -439,8 +447,6 @@
_state = _State.CHUNK_SIZE;
_remainingContent = 0;
} else if (_contentLength == 0 ||
- (_messageType == _MessageType.REQUEST &&
- _contentLength == -1) ||
(_messageType == _MessageType.RESPONSE &&
(_noMessageBody || _responseToMethod == "HEAD"))) {
// If there is no message body get ready to process the
diff --git a/runtime/bin/http_session.dart b/lib/io/http_session.dart
similarity index 97%
rename from runtime/bin/http_session.dart
rename to lib/io/http_session.dart
index f1d5eaf..d214613 100644
--- a/runtime/bin/http_session.dart
+++ b/lib/io/http_session.dart
@@ -154,7 +154,6 @@
_HttpSession _tail;
Timer _timer;
- static Uint8List _getRandomBytes(int count)
- native "Crypto_GetRandomBytes";
+ external static Uint8List _getRandomBytes(int count);
}
diff --git a/runtime/bin/http_utils.dart b/lib/io/http_utils.dart
similarity index 100%
rename from runtime/bin/http_utils.dart
rename to lib/io/http_utils.dart
diff --git a/runtime/bin/input_stream.dart b/lib/io/input_stream.dart
similarity index 98%
rename from runtime/bin/input_stream.dart
rename to lib/io/input_stream.dart
index 755f54e..a59f603 100644
--- a/runtime/bin/input_stream.dart
+++ b/lib/io/input_stream.dart
@@ -60,7 +60,7 @@
* `false` for the optional argument [close] keeps the output
* stream open after writing all data from the input stream.
*/
- void pipe(OutputStream output, [bool close = true]);
+ void pipe(OutputStream output, {bool close: true});
/**
* Close the underlying communication channel to avoid getting any
diff --git a/lib/io/io.dart b/lib/io/io.dart
new file mode 100644
index 0000000..92f044b
--- /dev/null
+++ b/lib/io/io.dart
@@ -0,0 +1,53 @@
+// 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.
+
+/**
+ * The IO library is used for Dart server applications,
+ * which run on a stand-alone Dart VM from the command line.
+ * *This library does not work in browser based applications.*
+ *
+ * This library allows you to work with files, directories,
+ * sockets, processes, HTTP servers and clients, and more.
+ */
+#library('dart:io');
+
+#import('dart:crypto');
+#import('dart:isolate');
+#import('dart:math');
+#import('dart:uri');
+#import('dart:utf');
+#import('dart:scalarlist');
+
+#source('base64.dart');
+#source('buffer_list.dart');
+#source('chunked_stream.dart');
+#source('common.dart');
+#source('directory.dart');
+#source('directory_impl.dart');
+#source('eventhandler.dart');
+#source('file.dart');
+#source('file_impl.dart');
+#source('http.dart');
+#source('http_impl.dart');
+#source('http_parser.dart');
+#source('http_session.dart');
+#source('http_utils.dart');
+#source('input_stream.dart');
+#source('list_stream.dart');
+#source('list_stream_impl.dart');
+#source('mime_multipart_parser.dart');
+#source('output_stream.dart');
+#source('path.dart');
+#source('path_impl.dart');
+#source('platform.dart');
+#source('platform_impl.dart');
+#source('process.dart');
+#source('socket.dart');
+#source('socket_stream_impl.dart');
+#source('stdio.dart');
+#source('stream_util.dart');
+#source('string_stream.dart');
+#source('timer_impl.dart');
+#source('websocket.dart');
+#source('websocket_impl.dart');
diff --git a/lib/io/iolib_sources.gypi b/lib/io/iolib_sources.gypi
new file mode 100644
index 0000000..55a9bcf
--- /dev/null
+++ b/lib/io/iolib_sources.gypi
@@ -0,0 +1,40 @@
+# 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.
+
+{
+ 'sources': [
+ 'base64.dart',
+ 'buffer_list.dart',
+ 'chunked_stream.dart',
+ 'common.dart',
+ 'directory.dart',
+ 'directory_impl.dart',
+ 'eventhandler.dart',
+ 'file.dart',
+ 'file_impl.dart',
+ 'http.dart',
+ 'http_impl.dart',
+ 'http_parser.dart',
+ 'http_session.dart',
+ 'http_utils.dart',
+ 'input_stream.dart',
+ 'list_stream.dart',
+ 'list_stream_impl.dart',
+ 'mime_multipart_parser.dart',
+ 'output_stream.dart',
+ 'path.dart',
+ 'path_impl.dart',
+ 'platform.dart',
+ 'platform_impl.dart',
+ 'process.dart',
+ 'socket.dart',
+ 'socket_stream_impl.dart',
+ 'stdio.dart',
+ 'stream_util.dart',
+ 'string_stream.dart',
+ 'timer_impl.dart',
+ 'websocket.dart',
+ 'websocket_impl.dart',
+ ],
+}
diff --git a/runtime/bin/list_stream.dart b/lib/io/list_stream.dart
similarity index 100%
rename from runtime/bin/list_stream.dart
rename to lib/io/list_stream.dart
diff --git a/runtime/bin/list_stream_impl.dart b/lib/io/list_stream_impl.dart
similarity index 100%
rename from runtime/bin/list_stream_impl.dart
rename to lib/io/list_stream_impl.dart
diff --git a/runtime/bin/mime_multipart_parser.dart b/lib/io/mime_multipart_parser.dart
similarity index 100%
rename from runtime/bin/mime_multipart_parser.dart
rename to lib/io/mime_multipart_parser.dart
diff --git a/runtime/bin/output_stream.dart b/lib/io/output_stream.dart
similarity index 100%
rename from runtime/bin/output_stream.dart
rename to lib/io/output_stream.dart
diff --git a/runtime/bin/path.dart b/lib/io/path.dart
similarity index 100%
rename from runtime/bin/path.dart
rename to lib/io/path.dart
diff --git a/runtime/bin/path_impl.dart b/lib/io/path_impl.dart
similarity index 100%
rename from runtime/bin/path_impl.dart
rename to lib/io/path_impl.dart
diff --git a/runtime/bin/platform.dart b/lib/io/platform.dart
similarity index 100%
rename from runtime/bin/platform.dart
rename to lib/io/platform.dart
diff --git a/runtime/bin/platform_impl.dart b/lib/io/platform_impl.dart
similarity index 82%
rename from runtime/bin/platform_impl.dart
rename to lib/io/platform_impl.dart
index 8949f79..f8e0411 100644
--- a/runtime/bin/platform_impl.dart
+++ b/lib/io/platform_impl.dart
@@ -3,11 +3,11 @@
// BSD-style license that can be found in the LICENSE file.
class _Platform {
- static int _numberOfProcessors() native "Platform_NumberOfProcessors";
- static String _pathSeparator() native "Platform_PathSeparator";
- static String _operatingSystem() native "Platform_OperatingSystem";
- static _localHostname() native "Platform_LocalHostname";
- static _environment() native "Platform_Environment";
+ external static int _numberOfProcessors();
+ external static String _pathSeparator();
+ external static String _operatingSystem();
+ external static _localHostname();
+ external static _environment();
static int get numberOfProcessors {
return _numberOfProcessors();
diff --git a/runtime/bin/process.dart b/lib/io/process.dart
similarity index 84%
rename from runtime/bin/process.dart
rename to lib/io/process.dart
index 806fe48..8d6d9f2 100644
--- a/runtime/bin/process.dart
+++ b/lib/io/process.dart
@@ -2,19 +2,25 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+// TODO(ager): The only reason for this class is that we
+// cannot patch a top-level at this point.
+class _ProcessUtils {
+ external static _exit(int status);
+}
+
/** Exit the Dart VM process with the given [status] code. */
void exit(int status) {
if (status is !int) {
throw new ArgumentError("int status expected");
}
- _exit(status);
+ _ProcessUtils._exit(status);
}
/**
* [Process] is used to start new processes using the static
* [start] and [run] methods.
*/
-class Process {
+abstract class Process {
/**
* Starts a process running the [executable] with the specified
* [arguments]. Returns a [:Future<Process>:] that completes with a
@@ -25,12 +31,15 @@
*
* An optional [ProcessOptions] object can be passed to specify
* options other than the executable and the arguments.
+ *
+ * Users must read all data coming on the [stdout] and [stderr]
+ * streams of processes started with [:Process.start:]. If the user
+ * does not read all data on the streams the underlying system
+ * resources will not be freed since there is still pending data.
*/
- static Future<Process> start(String executable,
- List<String> arguments,
- [ProcessOptions options]) {
- return _Process.start(executable, arguments, options);
- }
+ external static Future<Process> start(String executable,
+ List<String> arguments,
+ [ProcessOptions options]);
/**
* Starts a process and runs it non-interactively to completion. The
@@ -43,11 +52,9 @@
* result of running the process, i.e., exit code, standard out and
* standard in.
*/
- static Future<ProcessResult> run(String executable,
- List<String> arguments,
- [ProcessOptions options]) {
- return _Process.run(executable, arguments, options);
- }
+ external static Future<ProcessResult> run(String executable,
+ List<String> arguments,
+ [ProcessOptions options]);
/**
* Returns an input stream of the process stdout.
@@ -55,7 +62,7 @@
* Throws an [UnsupportedError] if the process is
* non-interactive.
*/
- abstract InputStream get stdout;
+ InputStream get stdout;
/**
* Returns an input stream of the process stderr.
@@ -63,7 +70,7 @@
* Throws an [UnsupportedError] if the process is
* non-interactive.
*/
- abstract InputStream get stderr;
+ InputStream get stderr;
/**
* Returns an output stream to the process stdin.
@@ -71,7 +78,7 @@
* Throws an [UnsupportedError] if the process is
* non-interactive.
*/
- abstract OutputStream get stdin;
+ OutputStream get stdin;
/**
* Sets an exit handler which gets invoked when the process
@@ -80,7 +87,7 @@
* Throws an [UnsupportedError] if the process is
* non-interactive.
*/
- abstract void set onExit(void callback(int exitCode));
+ void set onExit(void callback(int exitCode));
/**
* On Windows, [kill] kills the process, ignoring the [signal]
@@ -95,18 +102,7 @@
* a [:false:] return value from kill means that the process is
* already dead.
*/
- abstract bool kill([ProcessSignal signal = ProcessSignal.SIGTERM]);
-
- /**
- * Terminates the streams of a process. [close] must be called on a
- * process to free the system resources associated with it if not all
- * data on the stdout and stderr streams have been read. Usually,
- * close should be called in [onExit], but care must be taken to actually
- * wait on the stderr and stdout streams to close if all data is required.
- * Once a process has been closed it can no longer be killed and [onExit]
- * is detached so the application is not notified of process termination.
- */
- abstract void close();
+ bool kill([ProcessSignal signal = ProcessSignal.SIGTERM]);
}
diff --git a/runtime/bin/socket.dart b/lib/io/socket.dart
similarity index 89%
rename from runtime/bin/socket.dart
rename to lib/io/socket.dart
index fcc1e44..19fc0eb 100644
--- a/runtime/bin/socket.dart
+++ b/lib/io/socket.dart
@@ -7,9 +7,7 @@
* Constructs a new server socket, binds it to a given address and port,
* and listens on it.
*/
- factory ServerSocket(String bindAddress, int port, int backlog) {
- return new _ServerSocket(bindAddress, port, backlog);
- }
+ external factory ServerSocket(String bindAddress, int port, int backlog);
/**
* The connection handler gets called when there is a new incoming
@@ -40,7 +38,7 @@
* host on the given port. The returned socket is not yet connected
* but ready for registration of callbacks.
*/
- factory Socket(String host, int port) => new _Socket(host, port);
+ external factory Socket(String host, int port);
/**
* Returns the number of received and non-read bytes in the socket that
@@ -49,6 +47,15 @@
int available();
/**
+ * Read up to [len] bytes from the socket. This function is
+ * non-blocking and will only return data if data is available. The
+ * number of bytes read can be less then [len] if fewer bytes are
+ * available for immediate reading. If no data is available [null]
+ * is returned.
+ */
+ List<int> read([int len]);
+
+ /**
* Reads up to [count] bytes of data from the socket and stores them into
* buffer after buffer offset [offset]. The number of successfully read
* bytes is returned. This function is non-blocking and will only read data
diff --git a/runtime/bin/socket_stream_impl.dart b/lib/io/socket_stream_impl.dart
similarity index 82%
rename from runtime/bin/socket_stream_impl.dart
rename to lib/io/socket_stream_impl.dart
index c0ad221..c8799b1 100644
--- a/runtime/bin/socket_stream_impl.dart
+++ b/lib/io/socket_stream_impl.dart
@@ -2,37 +2,14 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-class _SocketInputStream implements SocketInputStream {
+class _SocketInputStream implements InputStream {
_SocketInputStream(Socket socket) : _socket = socket {
if (_socket._closed) _closed = true;
_socket.onClosed = _onClosed;
}
List<int> read([int len]) {
- int bytesToRead = available();
- if (bytesToRead == 0) return null;
- if (len !== null) {
- if (len <= 0) {
- throw new StreamException("Illegal length $len");
- } else if (bytesToRead > len) {
- bytesToRead = len;
- }
- }
- List<int> buffer = new Uint8List(bytesToRead);
- int bytesRead = _socket.readList(buffer, 0, bytesToRead);
- if (bytesRead == 0) {
- // On MacOS when reading from a tty Ctrl-D will result in one
- // byte reported as available. Attempting to read it out will
- // result in zero bytes read. When that happens there is no data
- // which is indicated by a null return value.
- return null;
- } else if (bytesRead < bytesToRead) {
- List<int> newBuffer = new Uint8List(bytesRead);
- newBuffer.setRange(0, bytesRead, buffer);
- return newBuffer;
- } else {
- return buffer;
- }
+ return _socket.read(len);
}
int readInto(List<int> buffer, [int offset = 0, int len]) {
@@ -77,7 +54,7 @@
}
}
- void _onSocketError(e) {
+ bool _onSocketError(e) {
close();
if (_onError != null) {
_onError(e);
@@ -95,7 +72,7 @@
class _SocketOutputStream
- extends _BaseOutputStream implements SocketOutputStream {
+ extends _BaseOutputStream implements OutputStream {
_SocketOutputStream(Socket socket)
: _socket = socket, _pendingWrites = new _BufferList();
diff --git a/runtime/bin/stdio.dart b/lib/io/stdio.dart
similarity index 84%
rename from runtime/bin/stdio.dart
rename to lib/io/stdio.dart
index 727c375..e080526 100644
--- a/runtime/bin/stdio.dart
+++ b/lib/io/stdio.dart
@@ -15,12 +15,12 @@
InputStream _getStdioInputStream() {
- switch (_getStdioHandleType(0)) {
+ switch (_StdIOUtils._getStdioHandleType(0)) {
case _STDIO_HANDLE_TYPE_TERMINAL:
case _STDIO_HANDLE_TYPE_PIPE:
case _STDIO_HANDLE_TYPE_SOCKET:
Socket s = new _Socket._internalReadOnly();
- _getStdioHandle(s, 0);
+ _StdIOUtils._getStdioHandle(s, 0);
s._closed = false;
return s.inputStream;
case _STDIO_HANDLE_TYPE_FILE:
@@ -33,12 +33,12 @@
OutputStream _getStdioOutputStream(int fd) {
assert(fd == 1 || fd == 2);
- switch (_getStdioHandleType(fd)) {
+ switch (_StdIOUtils._getStdioHandleType(fd)) {
case _STDIO_HANDLE_TYPE_TERMINAL:
case _STDIO_HANDLE_TYPE_PIPE:
case _STDIO_HANDLE_TYPE_SOCKET:
Socket s = new _Socket._internalWriteOnly();
- _getStdioHandle(s, fd);
+ _StdIOUtils._getStdioHandle(s, fd);
s._closed = false;
return s.outputStream;
case _STDIO_HANDLE_TYPE_FILE:
@@ -72,5 +72,8 @@
return _stderr;
}
-_getStdioHandle(Socket socket, int num) native "Socket_GetStdioHandle";
-_getStdioHandleType(int num) native "File_GetStdioHandleType";
+
+class _StdIOUtils {
+ external static _getStdioHandle(Socket socket, int num);
+ external static _getStdioHandleType(int num);
+}
diff --git a/runtime/bin/stream_util.dart b/lib/io/stream_util.dart
similarity index 97%
rename from runtime/bin/stream_util.dart
rename to lib/io/stream_util.dart
index fc6ee1f..1500181 100644
--- a/runtime/bin/stream_util.dart
+++ b/lib/io/stream_util.dart
@@ -2,8 +2,8 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-class _BaseDataInputStream {
- abstract int available();
+abstract class _BaseDataInputStream {
+ int available();
List<int> read([int len]) {
if (_closeCallbackCalled || _scheduledCloseCallback != null) return null;
@@ -65,7 +65,7 @@
}
}
- abstract List<int> _read(int bytesToRead);
+ List<int> _read(int bytesToRead);
void _dataReceived() {
// More data has been received asynchronously. Perform the data
diff --git a/runtime/bin/string_stream.dart b/lib/io/string_stream.dart
similarity index 95%
rename from runtime/bin/string_stream.dart
rename to lib/io/string_stream.dart
index 9cb9e29..5d71af4 100644
--- a/runtime/bin/string_stream.dart
+++ b/lib/io/string_stream.dart
@@ -30,6 +30,9 @@
// no line break is present. The line break character sequence is
// discarded.
String get decodedLine;
+
+ // Set the handler that will be called if an error ocurs while decoding.
+ void set onError(Function callback);
}
@@ -61,7 +64,7 @@
// Utility class for decoding UTF-8 from data delivered as a stream of
// bytes.
-class _StringDecoderBase implements _StringDecoder {
+abstract class _StringDecoderBase implements _StringDecoder {
_StringDecoderBase()
: _bufferList = new _BufferList(),
_result = new List<int>(),
@@ -154,7 +157,7 @@
_resultOffset = 0;
}
- abstract bool _processNext();
+ bool _processNext();
_BufferList _bufferList;
int _resultOffset = 0;
@@ -166,6 +169,7 @@
int _charOffset = 0; // Character number of the first character in the list.
int _charCount = 0; // Total number of characters decoded.
int _lastCharCode = -1;
+ Function onError;
final int LF = 10;
final int CR = 13;
@@ -221,7 +225,13 @@
while (_bufferList.length > 0) {
int byte = _bufferList.next();
if (byte > 127) {
- throw new DecoderException("Illegal ASCII character $byte");
+ var error = new DecoderException("Illegal ASCII character $byte");
+ if (onError != null) {
+ onError(error);
+ return false;
+ } else {
+ throw error;
+ }
}
addChar(byte);
}
@@ -409,6 +419,11 @@
void set onError(void callback(e)) {
_input.onError = callback;
+ _decoder.onError = (e) {
+ _clientCloseHandler = null;
+ _input.close();
+ callback(e);
+ };
}
void _onData() {
@@ -425,9 +440,8 @@
void _onClosed() {
_inputClosed = true;
- if (_decoder.isEmpty && _clientCloseHandler != null) {
+ if (_decoder.isEmpty && _clientCloseHandler != null) {
_clientCloseHandler();
- _closed = true;
} else {
_checkScheduleCallback();
}
diff --git a/runtime/bin/timer_impl.dart b/lib/io/timer_impl.dart
similarity index 100%
rename from runtime/bin/timer_impl.dart
rename to lib/io/timer_impl.dart
diff --git a/runtime/bin/websocket.dart b/lib/io/websocket.dart
similarity index 100%
rename from runtime/bin/websocket.dart
rename to lib/io/websocket.dart
diff --git a/runtime/bin/websocket_impl.dart b/lib/io/websocket_impl.dart
similarity index 99%
rename from runtime/bin/websocket_impl.dart
rename to lib/io/websocket_impl.dart
index 0d2089d..dfeb2ec 100644
--- a/runtime/bin/websocket_impl.dart
+++ b/lib/io/websocket_impl.dart
@@ -208,6 +208,7 @@
// Hack - as we always do index++ below.
index--;
+ break;
}
// Move to the next byte.
diff --git a/lib/mirrors/mirrors.dart b/lib/mirrors/mirrors.dart
index 88d9a7d..9a0fe0f 100644
--- a/lib/mirrors/mirrors.dart
+++ b/lib/mirrors/mirrors.dart
@@ -42,7 +42,7 @@
IsolateMirror get isolate;
/**
- * A mirror on the [:Dynamic:] type.
+ * A mirror on the [:dynamic:] type.
*/
TypeMirror get dynamicType;
diff --git a/lib/scalarlist/byte_arrays.dart b/lib/scalarlist/byte_arrays.dart
index cb3dd12..8789ec4 100644
--- a/lib/scalarlist/byte_arrays.dart
+++ b/lib/scalarlist/byte_arrays.dart
@@ -34,7 +34,7 @@
* changes to the returned byte array are visible in this byte array
* and vice-versa.
*
- * Throws [IndexOutOfRangeException] if [start] or [length] are negative, or
+ * Throws [RangeError] if [start] or [length] are negative, or
* if `start + length` is greater than the length of this byte array.
*
* Throws [ArgumentError] if [length] is negative.
@@ -46,7 +46,7 @@
* specified [byteOffset] in this byte array, in two's complement binary
* representation. The return value will be between -128 and 127, inclusive.
*
- * Throws [IndexOutOfRangeException] if [byteOffset] is negative, or
+ * Throws [RangeError] if [byteOffset] is negative, or
* greater than or equal to the length of this byte array.
*/
int getInt8(int byteOffset);
@@ -61,7 +61,7 @@
* array after the byte that was set by this call. This return value can
* be passed as the [byteOffset] parameter to a subsequent `setXxx` call.
*
- * Throws [IndexOutOfRangeException] if [byteOffset] is negative, or
+ * Throws [RangeError] if [byteOffset] is negative, or
* greater than or equal to the length of this byte array.
*
* Throws [ArgumentError] if [value] is less than -128 or
@@ -74,7 +74,7 @@
* [byteOffset] in this byte array, in unsigned binary form. The
* return value will be between 0 and 255, inclusive.
*
- * Throws [IndexOutOfRangeException] if [byteOffset] is negative, or
+ * Throws [RangeError] if [byteOffset] is negative, or
* greater than or equal to the length of this byte array.
*/
int getUint8(int byteOffset);
@@ -89,7 +89,7 @@
* array after the byte that was set by this call. This return value can
* be passed as the [byteOffset] parameter to a subsequent `setXxx` call.
*
- * Throws [IndexOutOfRangeException] if [byteOffset] is negative,
+ * Throws [RangeError] if [byteOffset] is negative,
* or greater than or equal to the length of this byte array.
*
* Throws [ArgumentError] if [value] is negative or
@@ -103,7 +103,7 @@
* form. The return value will be between 2<sup>15</sup> and 2<sup>15 - 1,
* inclusive.
*
- * Throws [IndexOutOfRangeException] if [byteOffset] is negative, or
+ * Throws [RangeError] if [byteOffset] is negative, or
* `byteOffset + 2` is greater than the length of this byte array.
*/
int getInt16(int byteOffset);
@@ -118,7 +118,7 @@
* array after the last byte that was set by this call. This return value can
* be passed as the [byteOffset] parameter to a subsequent `setXxx` call.
*
- * Throws [IndexOutOfRangeException] if [byteOffset] is negative, or
+ * Throws [RangeError] if [byteOffset] is negative, or
* `byteOffset + 2` is greater than the length of this byte array.
*
* Throws [ArgumentError] if [value] is less than 2<sup>15</sup>
@@ -131,7 +131,7 @@
* at the specified [byteOffset] in this byte array, in unsigned binary
* form. The return value will be between 0 and 2<sup>16 - 1, inclusive.
*
- * Throws [IndexOutOfRangeException] if [byteOffset] is negative, or
+ * Throws [RangeError] if [byteOffset] is negative, or
* `byteOffset + 2` is greater than the length of this byte array.
*/
int getUint16(int byteOffset);
@@ -146,7 +146,7 @@
* array after the last byte that was set by this call. This return value can
* be passed as the [byteOffset] parameter to a subsequent `setXxx` call.
*
- * Throws [IndexOutOfRangeException] if [byteOffset] is negative, or
+ * Throws [RangeError] if [byteOffset] is negative, or
* `byteOffset + 2` is greater than the length of this byte array.
*
* Throws [ArgumentError] if [value] is negative or
@@ -160,7 +160,7 @@
* form. The return value will be between 2<sup>31</sup> and 2<sup>31 - 1,
* inclusive.
*
- * Throws [IndexOutOfRangeException] if [byteOffset] is negative, or
+ * Throws [RangeError] if [byteOffset] is negative, or
* `byteOffset + 4` is greater than the length of this byte array.
*/
int getInt32(int byteOffset);
@@ -175,7 +175,7 @@
* array after the last byte that was set by this call. This return value can
* be passed as the [byteOffset] parameter to a subsequent `setXxx` call.
*
- * Throws [IndexOutOfRangeException] if [byteOffset] is negative, or
+ * Throws [RangeError] if [byteOffset] is negative, or
* `byteOffset + 4` is greater than the length of this byte array.
*
* Throws [ArgumentError] if [value] is less than 2<sup>31</sup>
@@ -201,7 +201,7 @@
* array after the last byte that was set by this call. This return value can
* be passed as the [byteOffset] parameter to a subsequent `setXxx` call.
*
- * Throws [IndexOutOfRangeException] if [byteOffset] is negative, or
+ * Throws [RangeError] if [byteOffset] is negative, or
* `byteOffset + 4` is greater than the length of this byte array.
*
* Throws [ArgumentError] if [value] is negative or
@@ -215,7 +215,7 @@
* form. The return value will be between 2<sup>63</sup> and 2<sup>63 - 1,
* inclusive.
*
- * Throws [IndexOutOfRangeException] if [byteOffset] is negative, or
+ * Throws [RangeError] if [byteOffset] is negative, or
* `byteOffset + 8` is greater than the length of this byte array.
*/
int getInt64(int byteOffset);
@@ -230,7 +230,7 @@
* array after the last byte that was set by this call. This return value can
* be passed as the [byteOffset] parameter to a subsequent `setXxx` call.
*
- * Throws [IndexOutOfRangeException] if [byteOffset] is negative, or
+ * Throws [RangeError] if [byteOffset] is negative, or
* `byteOffset + 8` is greater than the length of this byte array.
*
* Throws [ArgumentError] if [value] is less than 2<sup>63</sup>
@@ -243,7 +243,7 @@
* at the specified [byteOffset] in this byte array, in unsigned binary
* form. The return value will be between 0 and 2<sup>64 - 1, inclusive.
*
- * Throws [IndexOutOfRangeException] if [byteOffset] is negative, or
+ * Throws [RangeError] if [byteOffset] is negative, or
* `byteOffset + 8` is greater than the length of this byte array.
*/
int getUint64(int byteOffset);
@@ -258,7 +258,7 @@
* array after the last byte that was set by this call. This return value can
* be passed as the [byteOffset] parameter to a subsequent `setXxx` call.
*
- * Throws [IndexOutOfRangeException] if [byteOffset] is negative, or
+ * Throws [RangeError] if [byteOffset] is negative, or
* `byteOffset + 8` is greater than the length of this byte array.
*
* Throws [ArgumentError] if [value] is negative or
@@ -271,7 +271,7 @@
* the specified [byteOffset] in this byte array, in IEEE 754
* single-precision binary floating-point format (binary32).
*
- * Throws [IndexOutOfRangeException] if [byteOffset] is negative, or
+ * Throws [RangeError] if [byteOffset] is negative, or
* `byteOffset + 4` is greater than the length of this byte array.
*/
double getFloat32(int byteOffset);
@@ -294,7 +294,7 @@
* array after the last byte that was set by this call. This return value can
* be passed as the [byteOffset] parameter to a subsequent `setXxx` call.
*
- * Throws [IndexOutOfRangeException] if [byteOffset] is negative, or
+ * Throws [RangeError] if [byteOffset] is negative, or
* `byteOffset + 4` is greater than the length of this byte array.
*/
int setFloat32(int byteOffset, double value);
@@ -304,7 +304,7 @@
* the specified [byteOffset] in this byte array, in IEEE 754
* double-precision binary floating-point format (binary64).
*
- * Throws [IndexOutOfRangeException] if [byteOffset] is negative, or
+ * Throws [RangeError] if [byteOffset] is negative, or
* `byteOffset + 8` is greater than the length of this byte array.
*/
double getFloat64(int byteOffset);
@@ -318,7 +318,7 @@
* array after the last byte that was set by this call. This return value can
* be passed as the [byteOffset] parameter to a subsequent `setXxx` call.
*
- * Throws [IndexOutOfRangeException] if [byteOffset] is negative, or
+ * Throws [RangeError] if [byteOffset] is negative, or
* `byteOffset + 8` is greater than the length of this byte array.
*/
int setFloat64(int byteOffset, double value);
diff --git a/lib/utf/utf_core.dart b/lib/utf/utf_core.dart
index 2cf5110..fb9e0e4 100644
--- a/lib/utf/utf_core.dart
+++ b/lib/utf/utf_core.dart
@@ -219,13 +219,13 @@
this._offset = offset,
this._length = (length == null ? source.length - offset : length) {
if (_offset < 0 || _offset > _source.length) {
- throw new IndexOutOfRangeException(_offset);
+ throw new RangeError.value(_offset);
}
if (_length != null && (_length < 0)) {
- throw new IndexOutOfRangeException(_length);
+ throw new RangeError.value(_length);
}
if (_length + _offset > _source.length) {
- throw new IndexOutOfRangeException(_length + _offset);
+ throw new RangeError.value(_length + _offset);
}
}
diff --git a/pkg/dartdoc/bin/dartdoc.dart b/pkg/dartdoc/bin/dartdoc.dart
old mode 100644
new mode 100755
index 5e7a9b0..25fc655
--- a/pkg/dartdoc/bin/dartdoc.dart
+++ b/pkg/dartdoc/bin/dartdoc.dart
@@ -14,13 +14,13 @@
* members, finds the associated doc comments and builds crosslinked docs from
* them.
*/
-#library('dartdoc');
+library dartdoc;
-#import('dart:io');
+import 'dart:io';
// TODO(rnystrom): Use "package:" URL (#4968).
-#import('../lib/dartdoc.dart');
-#import('../../args/lib/args.dart');
+import '../lib/dartdoc.dart';
+import '../../args/lib/args.dart';
/**
* Run this from the `pkg/dartdoc` directory.
diff --git a/pkg/dartdoc/lib/classify.dart b/pkg/dartdoc/lib/classify.dart
index ce25044..0532a1e 100644
--- a/pkg/dartdoc/lib/classify.dart
+++ b/pkg/dartdoc/lib/classify.dart
@@ -2,11 +2,11 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-#library('classify');
+library classify;
-#import('../../../lib/compiler/implementation/scanner/scannerlib.dart');
+import '../../../lib/compiler/implementation/scanner/scannerlib.dart';
// TODO(rnystrom): Use "package:" URL (#4968).
-#import('markdown.dart', prefix: 'md');
+import 'markdown.dart' as md;
/**
* Kinds of tokens that we care to highlight differently. The values of the
@@ -184,11 +184,11 @@
// Color keyword token. Most are colored as keywords.
case HASH_TOKEN:
case KEYWORD_TOKEN:
- if (token.stringValue === 'void') {
+ if (token.stringValue == 'void') {
// Color "void" as a type.
return Classification.TYPE_IDENTIFIER;
}
- if (token.stringValue === 'this' || token.stringValue === 'super') {
+ if (token.stringValue == 'this' || token.stringValue == 'super') {
// Color "this" and "super" as identifiers.
return Classification.SPECIAL_IDENTIFIER;
}
diff --git a/pkg/dartdoc/lib/dartdoc.dart b/pkg/dartdoc/lib/dartdoc.dart
index 0fb159e..b4bdecb 100644
--- a/pkg/dartdoc/lib/dartdoc.dart
+++ b/pkg/dartdoc/lib/dartdoc.dart
@@ -14,27 +14,26 @@
* members, finds the associated doc comments and builds crosslinked docs from
* them.
*/
-#library('dartdoc');
+library dartdoc;
-#import('dart:io');
-#import('dart:math');
-#import('dart:uri');
-#import('dart:json');
+import 'dart:io';
+import 'dart:math';
+import 'dart:uri';
+import 'dart:json';
// TODO(rnystrom): Use "package:" URL (#4968).
-#import('mirrors.dart');
-#import('mirrors_util.dart');
-#import('src/mirrors/dart2js_mirror.dart', prefix: 'dart2js');
-#import('classify.dart');
-#import('markdown.dart', prefix: 'md');
-#import('../../../lib/compiler/implementation/scanner/scannerlib.dart',
- prefix: 'dart2js');
-#import('../../../lib/_internal/libraries.dart');
+import 'mirrors.dart';
+import 'mirrors_util.dart';
+import 'src/mirrors/dart2js_mirror.dart' as dart2js;
+import 'classify.dart';
+import 'markdown.dart' as md;
+import '../../../lib/compiler/implementation/scanner/scannerlib.dart' as dart2js;
+import '../../../lib/_internal/libraries.dart';
// TODO(rnystrom): Use "package:" URL (#4968).
-#source('src/dartdoc/comment_map.dart');
-#source('src/dartdoc/nav.dart');
-#source('src/dartdoc/utils.dart');
+part 'src/dartdoc/comment_map.dart';
+part 'src/dartdoc/nav.dart';
+part 'src/dartdoc/utils.dart';
/**
* Generates completely static HTML containing everything you need to browse
@@ -227,7 +226,7 @@
LibraryMirror _currentLibrary;
/** The type that we're currently generating docs for. */
- InterfaceMirror _currentType;
+ ClassMirror _currentType;
/** The member that we're currently generating docs for. */
MemberMirror _currentMember;
@@ -580,13 +579,13 @@
void docLibraryNavigationJson(LibraryMirror library, List libraryList) {
var libraryInfo = {};
libraryInfo[NAME] = displayName(library);
- final List members = docMembersJson(library.declaredMembers);
+ final List members = docMembersJson(library.members);
if (!members.isEmpty) {
libraryInfo[MEMBERS] = members;
}
final types = [];
- for (InterfaceMirror type in orderByName(library.types.values)) {
+ for (ClassMirror type in orderByName(library.classes.values)) {
if (!showPrivate && type.isPrivate) continue;
var typeInfo = {};
@@ -599,14 +598,14 @@
assert(type.isTypedef);
typeInfo[KIND] = TYPEDEF;
}
- final List typeMembers = docMembersJson(type.declaredMembers);
+ final List typeMembers = docMembersJson(type.members);
if (!typeMembers.isEmpty) {
typeInfo[MEMBERS] = typeMembers;
}
- if (!type.declaration.typeVariables.isEmpty) {
+ if (!type.originalDeclaration.typeVariables.isEmpty) {
final typeVariables = [];
- for (final typeVariable in type.declaration.typeVariables) {
+ for (final typeVariable in type.originalDeclaration.typeVariables) {
typeVariables.add(typeVariable.displayName);
}
typeInfo[ARGS] = Strings.join(typeVariables, ', ');
@@ -681,10 +680,10 @@
/** Writes the navigation for the types contained by the given library. */
void docLibraryNavigation(LibraryMirror library) {
// Show the exception types separately.
- final types = <InterfaceMirror>[];
- final exceptions = <InterfaceMirror>[];
+ final types = <ClassMirror>[];
+ final exceptions = <ClassMirror>[];
- for (InterfaceMirror type in orderByName(library.types.values)) {
+ for (ClassMirror type in orderByName(library.classes.values)) {
if (!showPrivate && type.isPrivate) continue;
if (isException(type)) {
@@ -703,7 +702,7 @@
}
/** Writes a linked navigation list item for the given type. */
- void docTypeNavigation(InterfaceMirror type) {
+ void docTypeNavigation(ClassMirror type) {
var icon = 'interface';
if (type.simpleName.endsWith('Exception')) {
icon = 'exception';
@@ -745,18 +744,23 @@
docMembers(library);
// Document the types.
- final classes = <InterfaceMirror>[];
- final interfaces = <InterfaceMirror>[];
+ final interfaces = <ClassMirror>[];
+ final abstractClasses = <ClassMirror>[];
+ final classes = <ClassMirror>[];
final typedefs = <TypedefMirror>[];
- final exceptions = <InterfaceMirror>[];
+ final exceptions = <ClassMirror>[];
- for (InterfaceMirror type in orderByName(library.types.values)) {
+ for (ClassMirror type in orderByName(library.classes.values)) {
if (!showPrivate && type.isPrivate) continue;
if (isException(type)) {
exceptions.add(type);
} else if (type.isClass) {
- classes.add(type);
+ if (type.isAbstract) {
+ abstractClasses.add(type);
+ } else {
+ classes.add(type);
+ }
} else if (type.isInterface){
interfaces.add(type);
} else if (type is TypedefMirror) {
@@ -766,15 +770,16 @@
}
}
- docTypes(classes, 'Classes');
docTypes(interfaces, 'Interfaces');
+ docTypes(abstractClasses, 'Abstract Classes');
+ docTypes(classes, 'Classes');
docTypes(typedefs, 'Typedefs');
docTypes(exceptions, 'Exceptions');
writeFooter();
endFile();
- for (final type in library.types.values) {
+ for (final type in library.classes.values) {
if (!showPrivate && type.isPrivate) continue;
docType(type);
@@ -800,7 +805,7 @@
writeln('</div>');
}
- void docType(InterfaceMirror type) {
+ void docType(ClassMirror type) {
if (verbose) {
print('- ${type.simpleName}');
}
@@ -859,7 +864,7 @@
* an icon and the type's name. It's similar to how types appear in the
* navigation, but is suitable for inline (as opposed to in a `<ul>`) use.
*/
- void typeSpan(InterfaceMirror type) {
+ void typeSpan(ClassMirror type) {
var icon = 'interface';
if (type.simpleName.endsWith('Exception')) {
icon = 'exception';
@@ -881,7 +886,7 @@
* subclasses, superclasses, subinterfaces, superinferfaces, and default
* class.
*/
- void docInheritance(InterfaceMirror type) {
+ void docInheritance(ClassMirror type) {
// Don't show the inheritance details for Object. It doesn't have any base
// class (obviously) and it has too many subclasses to be useful.
if (type.isObject) return;
@@ -940,15 +945,15 @@
}
listTypes(subtypes, 'Subclasses');
- listTypes(type.interfaces, 'Implements');
+ listTypes(type.superinterfaces, 'Implements');
} else {
// Show the default class.
- if (type.defaultType != null) {
- listTypes([type.defaultType], 'Default class');
+ if (type.defaultFactory != null) {
+ listTypes([type.defaultFactory], 'Default class');
}
// List extended interfaces.
- listTypes(type.interfaces, 'Extends');
+ listTypes(type.superinterfaces, 'Extends');
// List subinterfaces and implementing classes.
final subinterfaces = [];
@@ -981,7 +986,7 @@
}
write('typedef ');
- annotateType(type, type.definition, type.simpleName);
+ annotateType(type, type.value, type.simpleName);
write(''' <a class="anchor-link" href="#${type.simpleName}"
title="Permalink to ${type.simpleName}">#</a>''');
@@ -1012,7 +1017,7 @@
return map;
}();
- void docMembers(ObjectMirror host) {
+ void docMembers(ContainerMirror host) {
// Collect the different kinds of members.
final staticMethods = [];
final staticGetters = new Map<String,MemberMirror>();
@@ -1024,7 +1029,7 @@
final instanceSetters = new Map<String,MemberMirror>();
final constructors = [];
- host.declaredMembers.forEach((_, MemberMirror member) {
+ host.members.forEach((_, MemberMirror member) {
if (!showPrivate && member.isPrivate) return;
if (host is LibraryMirror || member.isStatic) {
if (member is MethodMirror) {
@@ -1035,23 +1040,23 @@
} else {
staticMethods.add(member);
}
- } else if (member is FieldMirror) {
+ } else if (member is VariableMirror) {
staticGetters[member.displayName] = member;
}
}
});
- if (host is InterfaceMirror) {
+ if (host is ClassMirror) {
var iterable = new HierarchyIterable(host, includeType: true);
- for (InterfaceMirror type in iterable) {
+ for (ClassMirror type in iterable) {
if (!host.isObject && !inheritFromObject && type.isObject) continue;
- type.declaredMembers.forEach((_, MemberMirror member) {
+ type.members.forEach((_, MemberMirror member) {
if (member.isStatic) return;
if (!showPrivate && member.isPrivate) return;
bool inherit = true;
- if (type !== host) {
+ if (type != host) {
if (member.isPrivate) {
// Don't inherit private members.
inherit = false;
@@ -1083,28 +1088,28 @@
if (member is MethodMirror) {
if (member.isGetter) {
instanceGetters[member.displayName] = member;
- if (member.surroundingDeclaration == host) {
+ if (member.owner == host) {
allPropertiesInherited = false;
}
} else if (member.isSetter) {
instanceSetters[member.displayName] = member;
- if (member.surroundingDeclaration == host) {
+ if (member.owner == host) {
allPropertiesInherited = false;
}
} else if (member.isOperator) {
instanceOperators.add(member);
- if (member.surroundingDeclaration == host) {
+ if (member.owner == host) {
allOperatorsInherited = false;
}
} else {
instanceMethods.add(member);
- if (member.surroundingDeclaration == host) {
+ if (member.owner == host) {
allMethodsInherited = false;
}
}
- } else if (member is FieldMirror) {
+ } else if (member is VariableMirror) {
instanceGetters[member.displayName] = member;
- if (member.surroundingDeclaration == host) {
+ if (member.owner == host) {
allPropertiesInherited = false;
}
}
@@ -1135,7 +1140,7 @@
/**
* Documents fields, getters, and setters as properties.
*/
- void docProperties(ObjectMirror host, String title,
+ void docProperties(ContainerMirror host, String title,
Map<String,MemberMirror> getters,
Map<String,MemberMirror> setters,
{bool allInherited}) {
@@ -1154,7 +1159,7 @@
MemberMirror getter = getters[name];
MemberMirror setter = setters[name];
if (setter == null) {
- if (getter is FieldMirror) {
+ if (getter is VariableMirror) {
// We have a field.
docField(host, getter);
} else {
@@ -1169,17 +1174,17 @@
} else {
DocComment getterComment = getMemberComment(getter);
DocComment setterComment = getMemberComment(setter);
- if (getter.surroundingDeclaration !== setter.surroundingDeclaration ||
+ if (getter.owner != setter.owner ||
getterComment != null && setterComment != null) {
// Both have comments or are not declared in the same class
// => Documents separately.
- if (getter is FieldMirror) {
+ if (getter is VariableMirror) {
// Document field as a getter (setter is inherited).
docField(host, getter, asGetter: true);
} else {
docMethod(host, getter);
}
- if (setter is FieldMirror) {
+ if (setter is VariableMirror) {
// Document field as a setter (getter is inherited).
docField(host, setter, asSetter: true);
} else {
@@ -1194,7 +1199,7 @@
writeln('</div>');
}
- void docMethods(ObjectMirror host, String title, List<MethodMirror> methods,
+ void docMethods(ContainerMirror host, String title, List<MethodMirror> methods,
{bool allInherited}) {
if (methods.length > 0) {
writeln('<div${allInherited ? ' class="inherited"' : ''}>');
@@ -1212,14 +1217,14 @@
* [FieldMirror] it is documented as a getter or setter depending upon the
* value of [asGetter].
*/
- void docMethod(ObjectMirror host, MemberMirror member,
+ void docMethod(ContainerMirror host, MemberMirror member,
{bool asGetter: false}) {
_totalMembers++;
_currentMember = member;
bool isAbstract = false;
String name = member.displayName;
- if (member is FieldMirror) {
+ if (member is VariableMirror) {
if (asGetter) {
// Getter.
name = 'get $name';
@@ -1240,7 +1245,7 @@
}
bool showCode = includeSource && !isAbstract;
- bool inherited = host != member.surroundingDeclaration;
+ bool inherited = host != member.owner;
writeln('<div class="method${inherited ? ' inherited': ''}">'
'<h4 id="${memberAnchor(member)}">');
@@ -1251,10 +1256,10 @@
if (member is MethodMirror) {
if (member.isConstructor) {
- if (member.isFactory) {
+ if (member.isFactoryConstructor) {
write('factory ');
} else {
- write(member.isConst ? 'const ' : 'new ');
+ write(member.isConstConstructor ? 'const ' : 'new ');
}
} else if (member.isAbstract) {
write('abstract ');
@@ -1264,7 +1269,7 @@
annotateType(host, member.returnType);
}
} else {
- assert(member is FieldMirror);
+ assert(member is VariableMirror);
if (asGetter) {
annotateType(host, member.type);
} else {
@@ -1279,7 +1284,7 @@
docParamList(host, member.parameters);
}
} else {
- assert(member is FieldMirror);
+ assert(member is VariableMirror);
if (!asGetter) {
write('(');
annotateType(host, member.type);
@@ -1294,7 +1299,7 @@
if (inherited) {
write('<div class="inherited-from">inherited from ');
- annotateType(host, member.surroundingDeclaration);
+ annotateType(host, member.owner);
write('</div>');
}
@@ -1308,7 +1313,7 @@
writeln('</div>');
}
- void docField(ObjectMirror host, FieldMirror field,
+ void docField(ContainerMirror host, VariableMirror field,
{bool asGetter: false, bool asSetter: false}) {
if (asGetter) {
docMethod(host, field, asGetter: true);
@@ -1325,13 +1330,13 @@
* Otherwise, if [getter] is a [MethodMirror], the property is considered
* final if [setter] is [:null:].
*/
- void docProperty(ObjectMirror host,
+ void docProperty(ContainerMirror host,
MemberMirror getter, MemberMirror setter) {
assert(getter != null);
_totalMembers++;
_currentMember = getter;
- bool inherited = host != getter.surroundingDeclaration;
+ bool inherited = host != getter.owner;
writeln('<div class="field${inherited ? ' inherited' : ''}">'
'<h4 id="${memberAnchor(getter)}">');
@@ -1343,7 +1348,7 @@
bool isConst = false;
bool isFinal;
TypeMirror type;
- if (getter is FieldMirror) {
+ if (getter is VariableMirror) {
assert(setter == null);
isConst = getter.isConst;
isFinal = getter.isFinal;
@@ -1374,7 +1379,7 @@
if (inherited) {
write('<div class="inherited-from">inherited from ');
- annotateType(host, getter.surroundingDeclaration);
+ annotateType(host, getter.owner);
write('</div>');
}
@@ -1393,16 +1398,18 @@
writeln('</div>');
}
- void docParamList(ObjectMirror enclosingType,
+ void docParamList(ContainerMirror enclosingType,
List<ParameterMirror> parameters) {
write('(');
bool first = true;
bool inOptionals = false;
+ bool isNamed = false;
for (final parameter in parameters) {
if (!first) write(', ');
if (!inOptionals && parameter.isOptional) {
- write('[');
+ isNamed = parameter.isNamed;
+ write(isNamed ? '{' : '[');
inOptionals = true;
}
@@ -1410,20 +1417,22 @@
// Show the default value for named optional parameters.
if (parameter.isOptional && parameter.hasDefaultValue) {
- write(' = ');
+ write(isNamed ? ': ' : ' = ');
write(parameter.defaultValue);
}
first = false;
}
- if (inOptionals) write(']');
+ if (inOptionals) {
+ write(isNamed ? '}' : ']');
+ }
write(')');
}
- void docComment(ObjectMirror host, DocComment comment) {
+ void docComment(ContainerMirror host, DocComment comment) {
if (comment != null) {
- if (comment.inheritedFrom !== null) {
+ if (comment.inheritedFrom != null) {
writeln('<div class="inherited">');
writeln(comment.html);
write('<div class="docs-inherited-from">docs inherited from ');
@@ -1439,7 +1448,7 @@
/**
* Documents the source code contained within [location].
*/
- void docCode(Location location) {
+ void docCode(SourceLocation location) {
if (includeSource) {
writeln('<pre class="source">');
writeln(md.escapeHtml(unindentCode(location)));
@@ -1447,7 +1456,7 @@
}
}
- DocComment createDocComment(String text, [InterfaceMirror inheritedFrom]) =>
+ DocComment createDocComment(String text, [ClassMirror inheritedFrom]) =>
new DocComment(text, inheritedFrom);
@@ -1475,14 +1484,14 @@
*/
DocComment getMemberComment(MemberMirror member) {
String comment = _comments.find(member.location);
- InterfaceMirror inheritedFrom = null;
+ ClassMirror inheritedFrom = null;
if (comment == null) {
- if (member.surroundingDeclaration is InterfaceMirror) {
+ if (member.owner is ClassMirror) {
var iterable =
- new HierarchyIterable(member.surroundingDeclaration,
+ new HierarchyIterable(member.owner,
includeType: false);
- for (InterfaceMirror type in iterable) {
- var inheritedMember = type.declaredMembers[member.simpleName];
+ for (ClassMirror type in iterable) {
+ var inheritedMember = type.members[member.simpleName];
if (inheritedMember is MemberMirror) {
comment = _comments.find(inheritedMember.location);
if (comment != null) {
@@ -1525,7 +1534,7 @@
}
/** Gets the URL for the documentation for [type]. */
- String typeUrl(ObjectMirror type) {
+ String typeUrl(ContainerMirror type) {
if (type is LibraryMirror) {
return '${sanitize(type.simpleName)}.html';
}
@@ -1534,12 +1543,12 @@
// arguments. If the type isn't generic, genericType returns `this`, so it
// works for non-generic types too.
return '${sanitize(displayName(type.library))}/'
- '${type.declaration.simpleName}.html';
+ '${type.originalDeclaration.simpleName}.html';
}
/** Gets the URL for the documentation for [member]. */
String memberUrl(MemberMirror member) {
- String url = typeUrl(member.surroundingDeclaration);
+ String url = typeUrl(member.owner);
return '$url#${memberAnchor(member)}';
}
@@ -1562,17 +1571,17 @@
/**
* Writes a type annotation for the given type and (optional) parameter name.
*/
- annotateType(ObjectMirror enclosingType,
+ annotateType(ContainerMirror enclosingType,
TypeMirror type,
[String paramName = null]) {
// Don't bother explicitly displaying Dynamic.
if (type.isDynamic) {
- if (paramName !== null) write(paramName);
+ if (paramName != null) write(paramName);
return;
}
// For parameters, handle non-typedefed function types.
- if (paramName !== null && type is FunctionTypeMirror) {
+ if (paramName != null && type is FunctionTypeMirror) {
annotateType(enclosingType, type.returnType);
write(paramName);
@@ -1583,11 +1592,11 @@
linkToType(enclosingType, type);
write(' ');
- if (paramName !== null) write(paramName);
+ if (paramName != null) write(paramName);
}
/** Writes a link to a human-friendly string representation for a type. */
- linkToType(ObjectMirror enclosingType, TypeMirror type) {
+ linkToType(ContainerMirror enclosingType, TypeMirror type) {
if (type.isVoid) {
// Do not generate links for void.
// TODO(johnniwinter): Generate span for specific style?
@@ -1607,7 +1616,7 @@
return;
}
- assert(type is InterfaceMirror);
+ assert(type is ClassMirror);
// Link to the type.
if (shouldLinkToPublicApi(type.library)) {
@@ -1618,7 +1627,7 @@
write(type.simpleName);
}
- if (type.isDeclaration) {
+ if (type.isOriginalDeclaration) {
// Avoid calling [:typeArguments():] on a declaration.
return;
}
@@ -1638,10 +1647,10 @@
}
/** Creates a linked cross reference to [type]. */
- typeReference(InterfaceMirror type) {
+ typeReference(ClassMirror type) {
// TODO(rnystrom): Do we need to handle ParameterTypes here like
// annotation() does?
- return a(typeUrl(type), typeName(type), css: 'crossref');
+ return a(typeUrl(type), typeName(type), 'crossref');
}
/** Generates a human-friendly string representation for a type. */
@@ -1652,16 +1661,16 @@
if (type is TypeVariableMirror) {
return type.simpleName;
}
- assert(type is InterfaceMirror);
+ assert(type is ClassMirror);
// See if it's a generic type.
- if (type.isDeclaration) {
+ if (type.isOriginalDeclaration) {
final typeParams = [];
- for (final typeParam in type.declaration.typeVariables) {
+ for (final typeParam in type.originalDeclaration.typeVariables) {
if (showBounds &&
- (typeParam.bound != null) &&
- !typeParam.bound.isObject) {
- final bound = typeName(typeParam.bound, showBounds: true);
+ (typeParam.upperBound != null) &&
+ !typeParam.upperBound.isObject) {
+ final bound = typeName(typeParam.upperBound, showBounds: true);
typeParams.add('${typeParam.simpleName} extends $bound');
} else {
typeParams.add(typeParam.simpleName);
@@ -1678,7 +1687,7 @@
final typeArgs = type.typeArguments;
if (typeArgs.length > 0) {
final args = Strings.join(typeArgs.map((arg) => typeName(arg)), ', ');
- return '${type.declaration.simpleName}<$args>';
+ return '${type.originalDeclaration.simpleName}<$args>';
}
// Regular type.
@@ -1688,7 +1697,7 @@
/**
* Remove leading indentation to line up with first line.
*/
- unindentCode(Location span) {
+ unindentCode(SourceLocation span) {
final column = getLocationColumn(span);
final lines = span.text.split('\n');
// TODO(rnystrom): Dirty hack.
@@ -1703,7 +1712,7 @@
/**
* Takes a string of Dart code and turns it into sanitized HTML.
*/
- formatCode(Location span) {
+ formatCode(SourceLocation span) {
final code = unindentCode(span);
// Syntax highlight.
@@ -1717,7 +1726,7 @@
*/
md.Node resolveNameReference(String name,
{MemberMirror currentMember,
- ObjectMirror currentType,
+ ContainerMirror currentType,
LibraryMirror currentLibrary}) {
makeLink(String href) {
final anchor = new md.Element.text('a', name);
@@ -1739,7 +1748,7 @@
// See if it's another member of the current type.
if (currentType != null) {
- final foundMember = currentType.declaredMembers[name];
+ final foundMember = currentType.members[name];
if (foundMember != null) {
return makeLink(memberUrl(foundMember));
}
@@ -1754,7 +1763,7 @@
new RegExp(r'new ([\w$]+)(?:\.([\w$]+))?').firstMatch(name);
if (match == null) return;
String typeName = match[1];
- InterfaceMirror foundtype = currentLibrary.types[typeName];
+ ClassMirror foundtype = currentLibrary.classes[typeName];
if (foundtype == null) return;
String constructorName =
(match[2] == null) ? typeName : '$typeName.${match[2]}';
@@ -1769,21 +1778,21 @@
final foreignMemberLink = (() {
final match = new RegExp(r'([\w$]+)\.([\w$]+)').firstMatch(name);
if (match == null) return;
- InterfaceMirror foundtype = currentLibrary.types[match[1]];
+ ClassMirror foundtype = currentLibrary.classes[match[1]];
if (foundtype == null) return;
- MemberMirror foundMember = foundtype.declaredMembers[match[2]];
+ MemberMirror foundMember = foundtype.members[match[2]];
if (foundMember == null) return;
return makeLink(memberUrl(foundMember));
})();
if (foreignMemberLink != null) return foreignMemberLink;
- InterfaceMirror foundType = currentLibrary.types[name];
+ ClassMirror foundType = currentLibrary.classes[name];
if (foundType != null) {
return makeLink(typeUrl(foundType));
}
// See if it's a top-level member in the current library.
- MemberMirror foundMember = currentLibrary.declaredMembers[name];
+ MemberMirror foundMember = currentLibrary.members[name];
if (foundMember != null) {
return makeLink(memberUrl(foundMember));
}
@@ -1834,7 +1843,8 @@
* Returns [:true:] if [type] should be regarded as an exception.
*/
bool isException(TypeMirror type) {
- return type.simpleName.endsWith('Exception');
+ return type.simpleName.endsWith('Exception') ||
+ type.simpleName.endsWith('Error');
}
}
@@ -1854,7 +1864,7 @@
/**
* Non-null if the comment is inherited from another declaration.
*/
- final InterfaceMirror inheritedFrom;
+ final ClassMirror inheritedFrom;
DocComment(this.text, [this.inheritedFrom = null]) {
assert(text != null && !text.trim().isEmpty);
diff --git a/pkg/dartdoc/lib/markdown.dart b/pkg/dartdoc/lib/markdown.dart
index b58b1fd..8a3bd55 100644
--- a/pkg/dartdoc/lib/markdown.dart
+++ b/pkg/dartdoc/lib/markdown.dart
@@ -3,13 +3,13 @@
// BSD-style license that can be found in the LICENSE file.
/// Parses text in a markdown-like format and renders to HTML.
-#library('markdown');
+library markdown;
// TODO(rnystrom): Use "package:" URL (#4968).
-#source('src/markdown/ast.dart');
-#source('src/markdown/block_parser.dart');
-#source('src/markdown/html_renderer.dart');
-#source('src/markdown/inline_parser.dart');
+part 'src/markdown/ast.dart';
+part 'src/markdown/block_parser.dart';
+part 'src/markdown/html_renderer.dart';
+part 'src/markdown/inline_parser.dart';
/// Converts the given string of markdown to HTML.
String markdownToHtml(String markdown) {
diff --git a/pkg/dartdoc/lib/mirrors.dart b/pkg/dartdoc/lib/mirrors.dart
index d6a8010..6f49c95 100644
--- a/pkg/dartdoc/lib/mirrors.dart
+++ b/pkg/dartdoc/lib/mirrors.dart
@@ -2,18 +2,18 @@
// for 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('mirrors');
+library mirrors;
-#import('dart:io');
-#import('dart:uri');
+import 'dart:io';
+import 'dart:uri';
// TODO(rnystrom): Use "package:" URL (#4968).
-#import('src/mirrors/dart2js_mirror.dart');
+import 'src/mirrors/dart2js_mirror.dart';
/**
* [Compilation] encapsulates the compilation of a program.
*/
-class Compilation {
+abstract class Compilation {
/**
* Creates a new compilation which has [script] as its entry point.
*/
@@ -45,7 +45,7 @@
/**
* Returns a future for the compiled JavaScript code.
*/
- abstract Future<String> compileToJavaScript();
+ Future<String> compileToJavaScript();
}
/**
@@ -56,6 +56,16 @@
* Returns an unmodifiable map of all libraries in this mirror system.
*/
Map<String, LibraryMirror> get libraries;
+
+ /**
+ * A mirror on the [:dynamic:] type.
+ */
+ TypeMirror get dynamicType;
+
+ /**
+ * A mirror on the [:void:] type.
+ */
+ TypeMirror get voidType;
}
@@ -66,6 +76,13 @@
static const String UNARY_MINUS = 'unary-';
/**
+ * Returns the mirror system which contains this mirror.
+ */
+ MirrorSystem get mirrors;
+}
+
+abstract class DeclarationMirror implements Mirror {
+ /**
* The simple name of the entity. The simple name is unique within the
* scope of the entity declaration.
*
@@ -97,41 +114,88 @@
String get qualifiedName;
/**
- * Returns the mirror system which contains this mirror.
+ * The source location of this Dart language entity.
*/
- MirrorSystem get system;
+ SourceLocation get location;
+
+ /**
+ * A mirror on the owner of this function. This is the declaration immediately
+ * surrounding the reflectee.
+ *
+ * Note that for libraries, the owner will be [:null:].
+ */
+ DeclarationMirror get owner;
+
+ /**
+ * Is this declaration private?
+ *
+ * Note that for libraries, this will be [:false:].
+ */
+ bool get isPrivate;
+
+ /**
+ * Is this declaration top-level?
+ *
+ * This is defined to be equivalent to:
+ * [:mirror.owner != null && mirror.owner is LibraryMirror:]
+ */
+ bool get isTopLevel;
}
/**
- * Common interface for interface types and libraries.
+ * Common interface for classes and libraries.
*/
-abstract class ObjectMirror implements Mirror {
+abstract class ContainerMirror implements Mirror {
/**
- * Returns an unmodifiable map of the members of declared in this type or
- * library.
+ * An immutable map from from names to mirrors for all members in this
+ * container.
*/
- Map<String, MemberMirror> get declaredMembers;
+ Map<String, MemberMirror> get members;
}
/**
* A library.
*/
-abstract class LibraryMirror extends ObjectMirror {
+abstract class LibraryMirror implements ContainerMirror, DeclarationMirror {
/**
- * The name of the library, as given in #library().
+ * An immutable map from from names to mirrors for all members in this
+ * library.
+ *
+ * The members of a library are its top-level classes, functions, variables,
+ * getters, and setters.
*/
- String get simpleName;
+ Map<String, MemberMirror> get members;
/**
- * Returns an iterable over all types in the library.
+ * An immutable map from names to mirrors for all class
+ * declarations in this library.
*/
- Map<String, InterfaceMirror> get types;
+ Map<String, ClassMirror> get classes;
/**
- * Returns the source location for this library.
+ * An immutable map from names to mirrors for all function, getter,
+ * and setter declarations in this library.
*/
- Location get location;
+ Map<String, MethodMirror> get functions;
+
+ /**
+ * An immutable map from names to mirrors for all getter
+ * declarations in this library.
+ */
+ Map<String, MethodMirror> get getters;
+
+ /**
+ * An immutable map from names to mirrors for all setter
+ * declarations in this library.
+ */
+ Map<String, MethodMirror> get setters;
+
+ /**
+ * An immutable map from names to mirrors for all variable
+ * declarations in this library.
+ */
+ Map<String, VariableMirror> get variables;
/**
* Returns the canonical URI for this library.
@@ -142,12 +206,7 @@
/**
* Common interface for classes, interfaces, typedefs and type variables.
*/
-abstract class TypeMirror implements Mirror {
- /**
- * Returns the source location for this type.
- */
- Location get location;
-
+abstract class TypeMirror implements DeclarationMirror {
/**
* Returns the library in which this member resides.
*/
@@ -159,7 +218,7 @@
bool get isObject;
/**
- * Is [:true:] iff this type is the [:Dynamic:] type.
+ * Is [:true:] iff this type is the [:dynamic:] type.
*/
bool get isDynamic;
@@ -187,22 +246,28 @@
/**
* A class or interface type.
*/
-abstract class InterfaceMirror implements TypeMirror, ObjectMirror {
+abstract class ClassMirror implements TypeMirror, ContainerMirror {
/**
- * Returns the defining type, i.e. declaration of a type.
+ * A mirror on the original declaration of this type.
+ *
+ * For most classes, they are their own original declaration. For
+ * generic classes, however, there is a distinction between the
+ * original class declaration, which has unbound type variables, and
+ * the instantiations of generic classes, which have bound type
+ * variables.
*/
- InterfaceMirror get declaration;
+ ClassMirror get originalDeclaration;
/**
* Returns the super class of this type, or null if this type is [Object] or a
* typedef.
*/
- InterfaceMirror get superclass;
+ ClassMirror get superclass;
/**
* Returns a list of the interfaces directly implemented by this type.
*/
- List<InterfaceMirror> get interfaces;
+ List<ClassMirror> get superinterfaces;
/**
* Is [:true:] iff this type is a class.
@@ -215,14 +280,15 @@
bool get isInterface;
/**
- * Is [:true:] if this type is private.
+ * Is this the original declaration of this type?
+ *
+ * For most classes, they are their own original declaration. For
+ * generic classes, however, there is a distinction between the
+ * original class declaration, which has unbound type variables, and
+ * the instantiations of generic classes, which have bound type
+ * variables.
*/
- bool get isPrivate;
-
- /**
- * Is [:true:] if this type is the declaration of a type.
- */
- bool get isDeclaration;
+ bool get isOriginalDeclaration;
/**
* Is [:true:] if this class is declared abstract.
@@ -240,14 +306,52 @@
List<TypeVariableMirror> get typeVariables;
/**
- * Returns an immutable map of the constructors in this interface.
+ * An immutable map from from names to mirrors for all members of
+ * this type.
+ *
+ * The members of a type are its methods, fields, getters, and
+ * setters. Note that constructors and type variables are not
+ * considered to be members of a type.
+ *
+ * This does not include inherited members.
+ */
+ Map<String, MemberMirror> get members;
+
+ /**
+ * An immutable map from names to mirrors for all method,
+ * declarations for this type. This does not include getters and
+ * setters.
+ */
+ Map<String, MethodMirror> get methods;
+
+ /**
+ * An immutable map from names to mirrors for all getter
+ * declarations for this type.
+ */
+ Map<String, MethodMirror> get getters;
+
+ /**
+ * An immutable map from names to mirrors for all setter
+ * declarations for this type.
+ */
+ Map<String, MethodMirror> get setters;
+
+ /**
+ * An immutable map from names to mirrors for all variable
+ * declarations for this type.
+ */
+ Map<String, VariableMirror> get variables;
+
+ /**
+ * An immutable map from names to mirrors for all constructor
+ * declarations for this type.
*/
Map<String, MethodMirror> get constructors;
/**
* Returns the default type for this interface.
*/
- InterfaceMirror get defaultType;
+ ClassMirror get defaultFactory;
}
/**
@@ -255,24 +359,15 @@
*/
abstract class TypeVariableMirror implements TypeMirror {
/**
- * Return a mirror on the class, interface, or typedef that declared the
- * type variable.
- */
- // Should not be called [declaration] as we then would have two [TypeMirror]
- // subtypes ([InterfaceMirror] and [TypeVariableMirror]) which have
- // [declaration()] methods but with different semantics.
- InterfaceMirror get declarer;
-
- /**
* Returns the bound of the type parameter.
*/
- TypeMirror get bound;
+ TypeMirror get upperBound;
}
/**
* A function type.
*/
-abstract class FunctionTypeMirror implements InterfaceMirror {
+abstract class FunctionTypeMirror implements ClassMirror {
/**
* Returns the return type of this function type.
*/
@@ -292,35 +387,19 @@
/**
* A typedef.
*/
-abstract class TypedefMirror implements InterfaceMirror {
+abstract class TypedefMirror implements ClassMirror {
/**
- * Returns the defining type for this typedef. For instance [:void f(int):]
- * for a [:typedef void f(int):].
+ * The defining type for this typedef.
+ *
+ * For instance [:void f(int):] for a [:typedef void f(int):].
*/
- TypeMirror get definition;
+ TypeMirror get value;
}
/**
* A member of a type, i.e. a field, method or constructor.
*/
-abstract class MemberMirror implements Mirror {
- /**
- * Returns the source location for this member.
- */
- Location get location;
-
- /**
- * Returns a mirror on the declaration immediately surrounding the reflectee.
- * This could be a class, interface, library or another method or function.
- */
- ObjectMirror get surroundingDeclaration;
-
- /**
- * Returns true if this is a top level member, i.e. a member not within a
- * type.
- */
- bool get isTopLevel;
-
+abstract class MemberMirror implements DeclarationMirror {
/**
* Returns true if this member is a constructor.
*/
@@ -337,11 +416,6 @@
bool get isMethod;
/**
- * Returns true if this member is private.
- */
- bool get isPrivate;
-
- /**
* Returns true if this member is static.
*/
bool get isStatic;
@@ -350,7 +424,7 @@
/**
* A field.
*/
-abstract class FieldMirror implements MemberMirror {
+abstract class VariableMirror implements MemberMirror {
/**
* Returns true if this field is final.
@@ -384,19 +458,38 @@
TypeMirror get returnType;
/**
- * Is [:true:] if this method is declared abstract.
+ * Is the reflectee abstract?
*/
bool get isAbstract;
/**
- * Is [:true:] if this method is a constant constructor.
+ * Is the reflectee a regular function or method?
+ *
+ * A function or method is regular if it is not a getter, setter, or
+ * constructor. Note that operators, by this definition, are
+ * regular methods.
*/
- bool get isConst;
+ bool get isRegularMethod;
/**
- * Is [:true:] if this method is a factory method.
+ * Is the reflectee a const constructor?
*/
- bool get isFactory;
+ bool get isConstConstructor;
+
+ /**
+ * Is the reflectee a generative constructor?
+ */
+ bool get isGenerativeConstructor;
+
+ /**
+ * Is the reflectee a redirecting constructor?
+ */
+ bool get isRedirectingConstructor;
+
+ /**
+ * Is the reflectee a factory constructor?
+ */
+ bool get isFactoryConstructor;
/**
* Returns the constructor name for named constructors and factory methods,
@@ -429,7 +522,7 @@
/**
* A formal parameter.
*/
-abstract class ParameterMirror implements Mirror {
+abstract class ParameterMirror implements VariableMirror {
/**
* Returns the type of this parameter.
*/
@@ -441,16 +534,21 @@
String get defaultValue;
/**
- * Returns true if this parameter has a default value.
+ * Does this parameter have a default value?
*/
bool get hasDefaultValue;
/**
- * Returns true if this parameter is optional.
+ * Is this parameter optional?
*/
bool get isOptional;
/**
+ * Is this parameter named?
+ */
+ bool get isNamed;
+
+ /**
* Returns [:true:] iff this parameter is an initializing formal of a
* constructor. That is, if it is of the form [:this.x:] where [:x:] is a
* field.
@@ -460,15 +558,15 @@
/**
* Returns the initialized field, if this parameter is an initializing formal.
*/
- FieldMirror get initializedField;
+ VariableMirror get initializedField;
}
/**
- * A [Location] describes the span of an entity in Dart source code.
- * A [Location] should be the minimum span that encloses the declaration of the
- * mirrored entity.
+ * A [SourceLocation] describes the span of an entity in Dart source code.
+ * A [SourceLocation] should be the minimum span that encloses the declaration
+ * of the mirrored entity.
*/
-abstract class Location {
+abstract class SourceLocation {
/**
* The character position where the location begins.
*/
@@ -480,7 +578,7 @@
int get end;
/**
- * Returns the [Source] in which this [Location] indexes.
+ * Returns the [Source] in which this [SourceLocation] indexes.
* If [:loc:] is a location, [:loc.source().text()[loc.start]:] is where it
* starts, and [:loc.source().text()[loc.end]:] is where it ends.
*/
diff --git a/pkg/dartdoc/lib/mirrors_util.dart b/pkg/dartdoc/lib/mirrors_util.dart
index 5ba6021..35fc16d 100644
--- a/pkg/dartdoc/lib/mirrors_util.dart
+++ b/pkg/dartdoc/lib/mirrors_util.dart
@@ -2,11 +2,11 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-#library('mirrors.util');
+library mirrors_util;
// TODO(rnystrom): Use "package:" URL (#4968).
-#import('mirrors.dart');
-#import('../../../lib/compiler/implementation/util/characters.dart');
+import 'mirrors.dart';
+import '../../../lib/compiler/implementation/util/characters.dart';
//------------------------------------------------------------------------------
// Utility functions for using the Mirror API
@@ -16,24 +16,24 @@
* Returns an iterable over the type declarations directly inheriting from
* the declaration of this type.
*/
-Iterable<InterfaceMirror> computeSubdeclarations(InterfaceMirror type) {
- type = type.declaration;
- var subtypes = <InterfaceMirror>[];
- type.system.libraries.forEach((_, library) {
- for (InterfaceMirror otherType in library.types.values) {
+Iterable<ClassMirror> computeSubdeclarations(ClassMirror type) {
+ type = type.originalDeclaration;
+ var subtypes = <ClassMirror>[];
+ type.mirrors.libraries.forEach((_, library) {
+ for (ClassMirror otherType in library.classes.values) {
var superClass = otherType.superclass;
- if (superClass !== null) {
- superClass = superClass.declaration;
- if (type.library === superClass.library) {
+ if (superClass != null) {
+ superClass = superClass.originalDeclaration;
+ if (type.library == superClass.library) {
if (superClass == type) {
subtypes.add(otherType);
}
}
}
- final superInterfaces = otherType.interfaces;
- for (InterfaceMirror superInterface in superInterfaces) {
- superInterface = superInterface.declaration;
- if (type.library === superInterface.library) {
+ final superInterfaces = otherType.superinterfaces;
+ for (ClassMirror superInterface in superInterfaces) {
+ superInterface = superInterface.originalDeclaration;
+ if (type.library == superInterface.library) {
if (superInterface == type) {
subtypes.add(otherType);
}
@@ -45,7 +45,7 @@
}
LibraryMirror findLibrary(MemberMirror member) {
- ObjectMirror owner = member.surroundingDeclaration;
+ ContainerMirror owner = member.owner;
if (owner is LibraryMirror) {
return owner;
} else if (owner is TypeMirror) {
@@ -58,7 +58,7 @@
/**
* Returns the column of the start of a location.
*/
-int getLocationColumn(Location location) {
+int getLocationColumn(SourceLocation location) {
String text = location.source.text;
int index = location.start-1;
var column = 0;
@@ -73,14 +73,14 @@
return column;
}
-class HierarchyIterable implements Iterable<InterfaceMirror> {
+class HierarchyIterable implements Iterable<ClassMirror> {
final bool includeType;
- final InterfaceMirror type;
+ final ClassMirror type;
HierarchyIterable(this.type, {bool includeType})
: this.includeType = includeType;
- Iterator<InterfaceMirror> iterator() =>
+ Iterator<ClassMirror> iterator() =>
new HierarchyIterator(type, includeType: includeType);
}
@@ -93,11 +93,11 @@
* visited in breadth first order and a superinterface is visited more than once
* if implemented through multiple supertypes.
*/
-class HierarchyIterator implements Iterator<InterfaceMirror> {
- final Queue<InterfaceMirror> queue = new Queue<InterfaceMirror>();
- InterfaceMirror object;
+class HierarchyIterator implements Iterator<ClassMirror> {
+ final Queue<ClassMirror> queue = new Queue<ClassMirror>();
+ ClassMirror object;
- HierarchyIterator(InterfaceMirror type, {bool includeType}) {
+ HierarchyIterator(ClassMirror type, {bool includeType}) {
if (includeType) {
queue.add(type);
} else {
@@ -105,22 +105,22 @@
}
}
- InterfaceMirror push(InterfaceMirror type) {
- if (type.superclass !== null) {
+ ClassMirror push(ClassMirror type) {
+ if (type.superclass != null) {
if (type.superclass.isObject) {
object = type.superclass;
} else {
queue.addFirst(type.superclass);
}
}
- queue.addAll(type.interfaces);
+ queue.addAll(type.superinterfaces);
return type;
}
- InterfaceMirror next() {
- InterfaceMirror type;
+ ClassMirror next() {
+ ClassMirror type;
if (queue.isEmpty) {
- if (object === null) {
+ if (object == null) {
throw new StateError("No more elements");
}
type = object;
@@ -131,5 +131,5 @@
}
}
- bool get hasNext => !queue.isEmpty || object !== null;
+ bool get hasNext => !queue.isEmpty || object != null;
}
diff --git a/pkg/dartdoc/lib/src/client/client-live-nav.dart b/pkg/dartdoc/lib/src/client/client-live-nav.dart
index b3f405c..e1e8bfc 100644
--- a/pkg/dartdoc/lib/src/client/client-live-nav.dart
+++ b/pkg/dartdoc/lib/src/client/client-live-nav.dart
@@ -3,20 +3,20 @@
// BSD-style license that can be found in the LICENSE file.
/** Provides client-side behavior for generated docs. */
-#library('client-live-nav');
+library client_live_nav;
-#import('dart:html');
-#import('dart:json');
-#import('../../../../../lib/compiler/implementation/source_file.dart');
+import 'dart:html';
+import 'dart:json';
+import '../../../../../lib/compiler/implementation/source_file.dart';
// TODO(rnystrom): Use "package:" URL (#4968).
-#import('../../classify.dart');
-#import('../../markdown.dart', prefix: 'md');
+import '../../classify.dart';
+import '../../markdown.dart' as md;
// TODO(rnystrom): Use "package:" URL (#4968).
-#source('dropdown.dart');
-#source('search.dart');
-#source('../dartdoc/nav.dart');
-#source('client-shared.dart');
+part 'dropdown.dart';
+part 'search.dart';
+part '../dartdoc/nav.dart';
+part 'client-shared.dart';
main() {
setup();
diff --git a/pkg/dartdoc/lib/src/client/client-shared.dart b/pkg/dartdoc/lib/src/client/client-shared.dart
index a448ae2..03bb64c 100644
--- a/pkg/dartdoc/lib/src/client/client-shared.dart
+++ b/pkg/dartdoc/lib/src/client/client-shared.dart
@@ -2,6 +2,8 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+part of client_live_nav;
+
// Code shared between the different client-side libraries.
// The names of the library and type that this page documents.
diff --git a/pkg/dartdoc/lib/src/client/client-static.dart b/pkg/dartdoc/lib/src/client/client-static.dart
index ceda35e..5bca3b2 100644
--- a/pkg/dartdoc/lib/src/client/client-static.dart
+++ b/pkg/dartdoc/lib/src/client/client-static.dart
@@ -3,20 +3,20 @@
// BSD-style license that can be found in the LICENSE file.
/** Provides client-side behavior for generated docs using the static mode. */
-#library('client-static');
+library client_static;
-#import('dart:html');
-#import('dart:json');
-#import('../../../../../lib/compiler/implementation/source_file.dart');
+import 'dart:html';
+import 'dart:json';
+import '../../../../../lib/compiler/implementation/source_file.dart';
// TODO(rnystrom): Use "package:" URL (#4968).
-#import('../../classify.dart');
+import '../../classify.dart';
// TODO(rnystrom): Use "package:" URL (#4968).
-#source('dropdown.dart');
-#source('search.dart');
-#source('../dartdoc/nav.dart');
-#source('client-shared.dart');
-#source('../../../tmp/nav.dart');
+part 'dropdown.dart';
+part 'search.dart';
+part '../dartdoc/nav.dart';
+part 'client-shared.dart';
+part '../../../tmp/nav.dart';
main() {
setup();
diff --git a/pkg/dartdoc/lib/src/client/dropdown.dart b/pkg/dartdoc/lib/src/client/dropdown.dart
index 30d63fe..18a2320 100644
--- a/pkg/dartdoc/lib/src/client/dropdown.dart
+++ b/pkg/dartdoc/lib/src/client/dropdown.dart
@@ -2,6 +2,8 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+part of client_live_nav;
+
List libraryList;
InputElement searchInput;
DivElement dropdown;
@@ -44,7 +46,7 @@
} else {
// Search all entities.
var searchText = new SearchText(text);
- for (Map<String,Dynamic> library in libraryList) {
+ for (Map<String,dynamic> library in libraryList) {
matchLibrary(results, searchText, library);
matchLibraryMembers(results, searchText, library);
matchTypes(results, searchText, library);
@@ -81,13 +83,13 @@
void matchAllMembers(List<Result> results, String memberText) {
var searchText = new SearchText(memberText);
- for (Map<String,Dynamic> library in libraryList) {
+ for (Map<String,dynamic> library in libraryList) {
String libraryName = library[NAME];
if (library.containsKey(TYPES)) {
- for (Map<String,Dynamic> type in library[TYPES]) {
+ for (Map<String,dynamic> type in library[TYPES]) {
String typeName = type[NAME];
if (type.containsKey(MEMBERS)) {
- for (Map<String,Dynamic> member in type[MEMBERS]) {
+ for (Map<String,dynamic> member in type[MEMBERS]) {
StringMatch memberMatch = obtainMatch(searchText, member[NAME]);
if (memberMatch != null) {
results.add(new Result(memberMatch, member[KIND],
@@ -106,15 +108,15 @@
String typeText, String memberText) {
var searchText = new SearchText(typeText);
var emptyText = new SearchText(memberText);
- for (Map<String,Dynamic> library in libraryList) {
+ for (Map<String,dynamic> library in libraryList) {
String libraryName = library[NAME];
if (library.containsKey(TYPES)) {
- for (Map<String,Dynamic> type in library[TYPES]) {
+ for (Map<String,dynamic> type in library[TYPES]) {
String typeName = type[NAME];
StringMatch typeMatch = obtainMatch(searchText, typeName);
if (typeMatch != null) {
if (type.containsKey(MEMBERS)) {
- for (Map<String,Dynamic> member in type[MEMBERS]) {
+ for (Map<String,dynamic> member in type[MEMBERS]) {
StringMatch memberMatch = obtainMatch(emptyText,
member[NAME]);
results.add(new Result(memberMatch, member[KIND],
@@ -134,15 +136,15 @@
var searchText = new SearchText(text);
var typeSearchText = new SearchText(typeText);
var memberSearchText = new SearchText(memberText);
- for (Map<String,Dynamic> library in libraryList) {
+ for (Map<String,dynamic> library in libraryList) {
String libraryName = library[NAME];
if (library.containsKey(TYPES)) {
- for (Map<String,Dynamic> type in library[TYPES]) {
+ for (Map<String,dynamic> type in library[TYPES]) {
String typeName = type[NAME];
StringMatch typeMatch = obtainMatch(typeSearchText, typeName);
if (typeMatch != null) {
if (type.containsKey(MEMBERS)) {
- for (Map<String,Dynamic> member in type[MEMBERS]) {
+ for (Map<String,dynamic> member in type[MEMBERS]) {
// Check for constructor match.
StringMatch constructorMatch = obtainMatch(searchText,
member[NAME]);
@@ -182,7 +184,7 @@
Map library) {
if (library.containsKey(MEMBERS)) {
String libraryName = library[NAME];
- for (Map<String,Dynamic> member in library[MEMBERS]) {
+ for (Map<String,dynamic> member in library[MEMBERS]) {
StringMatch memberMatch = obtainMatch(searchText, member[NAME]);
if (memberMatch != null) {
results.add(new Result(memberMatch, member[KIND],
@@ -197,7 +199,7 @@
Map library) {
if (library.containsKey(TYPES)) {
String libraryName = library[NAME];
- for (Map<String,Dynamic> type in library[TYPES]) {
+ for (Map<String,dynamic> type in library[TYPES]) {
String typeName = type[NAME];
matchType(results, searchText, libraryName, type);
matchTypeMembers(results, searchText, libraryName, type);
@@ -220,7 +222,7 @@
String libraryName, Map type) {
if (type.containsKey(MEMBERS)) {
String typeName = type[NAME];
- for (Map<String,Dynamic> member in type[MEMBERS]) {
+ for (Map<String,dynamic> member in type[MEMBERS]) {
StringMatch memberMatch = obtainMatch(searchText, member[NAME]);
if (memberMatch != null) {
results.add(new Result(memberMatch, member[KIND],
diff --git a/pkg/dartdoc/lib/src/client/search.dart b/pkg/dartdoc/lib/src/client/search.dart
index d9b0da1..22d283d 100644
--- a/pkg/dartdoc/lib/src/client/search.dart
+++ b/pkg/dartdoc/lib/src/client/search.dart
@@ -2,6 +2,8 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+part of client_live_nav;
+
/**
* [SearchText] represent the search field text. The text is viewed in three
* ways: [text] holds the original search text, used for performing
diff --git a/pkg/dartdoc/lib/src/dartdoc/comment_map.dart b/pkg/dartdoc/lib/src/dartdoc/comment_map.dart
index f4ddf5f..25240d4 100644
--- a/pkg/dartdoc/lib/src/dartdoc/comment_map.dart
+++ b/pkg/dartdoc/lib/src/dartdoc/comment_map.dart
@@ -2,6 +2,8 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+part of dartdoc;
+
/**
* The cached lookup-table to associate doc comments with spans. The outer map
* is from filenames to doc comments in that file. The inner map maps from the
@@ -28,7 +30,7 @@
*
* If a comment is returned, it is guaranteed to be non-empty.
*/
- String find(Location span) {
+ String find(SourceLocation span) {
if (span == null) return null;
_ensureFileParsed(span.source);
diff --git a/pkg/dartdoc/lib/src/dartdoc/nav.dart b/pkg/dartdoc/lib/src/dartdoc/nav.dart
index 9bb7668..ec9c7f9 100644
--- a/pkg/dartdoc/lib/src/dartdoc/nav.dart
+++ b/pkg/dartdoc/lib/src/dartdoc/nav.dart
@@ -2,6 +2,8 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+part of dartdoc;
+
/*
* Constant values used for encoding navigation info.
*
diff --git a/pkg/dartdoc/lib/src/dartdoc/utils.dart b/pkg/dartdoc/lib/src/dartdoc/utils.dart
index c70e166..cb52f96 100644
--- a/pkg/dartdoc/lib/src/dartdoc/utils.dart
+++ b/pkg/dartdoc/lib/src/dartdoc/utils.dart
@@ -2,6 +2,8 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+part of dartdoc;
+
// Generic utility functions.
/** Turns [name] into something that's safe to use as a file name. */
@@ -29,7 +31,7 @@
final buffer = new StringBuffer();
for (int i = 0; i < count; i++) {
buffer.add(text);
- if ((i < count - 1) && (separator !== null)) buffer.add(separator);
+ if ((i < count - 1) && (separator != null)) buffer.add(separator);
}
return buffer.toString();
diff --git a/pkg/dartdoc/lib/src/markdown/ast.dart b/pkg/dartdoc/lib/src/markdown/ast.dart
index 103e46d..c966cea 100644
--- a/pkg/dartdoc/lib/src/markdown/ast.dart
+++ b/pkg/dartdoc/lib/src/markdown/ast.dart
@@ -2,6 +2,8 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+part of markdown;
+
/// Base class for any AST item. Roughly corresponds to Node in the DOM. Will
/// be either an Element or Text.
abstract class Node {
diff --git a/pkg/dartdoc/lib/src/markdown/block_parser.dart b/pkg/dartdoc/lib/src/markdown/block_parser.dart
index 79d9e69..3487900 100644
--- a/pkg/dartdoc/lib/src/markdown/block_parser.dart
+++ b/pkg/dartdoc/lib/src/markdown/block_parser.dart
@@ -2,6 +2,8 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+part of markdown;
+
/// The line contains only whitespace or is empty.
const _RE_EMPTY = const RegExp(r'^([ \t]*)$');
@@ -80,7 +82,7 @@
}
}
-class BlockSyntax {
+abstract class BlockSyntax {
/// Gets the collection of built-in block parsers. To turn a series of lines
/// into blocks, each of these will be tried in turn. Order matters here.
static List<BlockSyntax> get syntaxes {
@@ -114,7 +116,7 @@
return pattern.firstMatch(parser.current) != null;
}
- abstract Node parse(BlockParser parser);
+ Node parse(BlockParser parser);
List<String> parseChildLines(BlockParser parser) {
// Grab all of the lines that form the blockquote, stripping off the ">".
@@ -259,10 +261,10 @@
}
/// Base class for both ordered and unordered lists.
-class ListSyntax extends BlockSyntax {
+abstract class ListSyntax extends BlockSyntax {
bool get canEndBlock => false;
- abstract String get listTag;
+ String get listTag;
Node parse(BlockParser parser) {
final items = <ListItem>[];
diff --git a/pkg/dartdoc/lib/src/markdown/html_renderer.dart b/pkg/dartdoc/lib/src/markdown/html_renderer.dart
index 70d4239..c25db6f 100644
--- a/pkg/dartdoc/lib/src/markdown/html_renderer.dart
+++ b/pkg/dartdoc/lib/src/markdown/html_renderer.dart
@@ -2,6 +2,8 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+part of markdown;
+
String renderToHtml(List<Node> nodes) => new HtmlRenderer().render(nodes);
/// Translates a parsed AST to HTML.
diff --git a/pkg/dartdoc/lib/src/markdown/inline_parser.dart b/pkg/dartdoc/lib/src/markdown/inline_parser.dart
index a958888..af42e3e 100644
--- a/pkg/dartdoc/lib/src/markdown/inline_parser.dart
+++ b/pkg/dartdoc/lib/src/markdown/inline_parser.dart
@@ -2,6 +2,8 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+part of markdown;
+
/// Maintains the internal state needed to parse inline span elements in
/// markdown.
class InlineParser {
@@ -148,7 +150,7 @@
}
/// Represents one kind of markdown tag that can be parsed.
-class InlineSyntax {
+abstract class InlineSyntax {
final RegExp pattern;
InlineSyntax(String pattern)
@@ -168,7 +170,7 @@
return false;
}
- abstract bool onMatch(InlineParser parser, Match match);
+ bool onMatch(InlineParser parser, Match match);
}
/// Matches stuff that should just be passed through as straight text.
diff --git a/pkg/dartdoc/lib/src/mirrors/dart2js_mirror.dart b/pkg/dartdoc/lib/src/mirrors/dart2js_mirror.dart
index 995fcba..7523ad6 100644
--- a/pkg/dartdoc/lib/src/mirrors/dart2js_mirror.dart
+++ b/pkg/dartdoc/lib/src/mirrors/dart2js_mirror.dart
@@ -42,13 +42,14 @@
Link<Element> link = signature.requiredParameters;
while (!link.isEmpty) {
parameters.add(new Dart2JsParameterMirror(
- system, method, link.head, false));
+ system, method, link.head, false, false));
link = link.tail;
}
link = signature.optionalParameters;
+ bool isNamed = signature.optionalParametersAreNamed;
while (!link.isEmpty) {
parameters.add(new Dart2JsParameterMirror(
- system, method, link.head, true));
+ system, method, link.head, true, isNamed));
link = link.tail;
}
return parameters;
@@ -59,10 +60,10 @@
DartType type,
InterfaceType defaultType,
[FunctionSignature functionSignature]) {
- if (type === null) {
+ if (type == null) {
return new Dart2JsInterfaceTypeMirror(system, defaultType);
} else if (type is InterfaceType) {
- if (type === system.compiler.types.dynamicType) {
+ if (type == system.compiler.types.dynamicType) {
return new Dart2JsDynamicMirror(system, type);
} else {
return new Dart2JsInterfaceTypeMirror(system, type);
@@ -80,7 +81,7 @@
}
Collection<Dart2JsMemberMirror> _convertElementMemberToMemberMirrors(
- Dart2JsObjectMirror library, Element element) {
+ Dart2JsContainerMirror library, Element element) {
if (element is SynthesizedConstructorElement) {
return const <Dart2JsMemberMirror>[];
} else if (element is VariableElement) {
@@ -89,10 +90,10 @@
return <Dart2JsMemberMirror>[new Dart2JsMethodMirror(library, element)];
} else if (element is AbstractFieldElement) {
var members = <Dart2JsMemberMirror>[];
- if (element.getter !== null) {
+ if (element.getter != null) {
members.add(new Dart2JsMethodMirror(library, element.getter));
}
- if (element.setter !== null) {
+ if (element.setter != null) {
members.add(new Dart2JsMethodMirror(library, element.setter));
}
return members;
@@ -101,7 +102,7 @@
"Unexpected member type $element ${element.kind}");
}
-MethodMirror _convertElementMethodToMethodMirror(Dart2JsObjectMirror library,
+MethodMirror _convertElementMethodToMethodMirror(Dart2JsContainerMirror library,
Element element) {
if (element is FunctionElement) {
return new Dart2JsMethodMirror(library, element);
@@ -111,9 +112,11 @@
}
class Dart2JsMethodKind {
- static const Dart2JsMethodKind NORMAL = const Dart2JsMethodKind("normal");
- static const Dart2JsMethodKind CONSTRUCTOR
- = const Dart2JsMethodKind("constructor");
+ static const Dart2JsMethodKind REGULAR = const Dart2JsMethodKind("regular");
+ static const Dart2JsMethodKind GENERATIVE =
+ const Dart2JsMethodKind("generative");
+ static const Dart2JsMethodKind REDIRECTING =
+ const Dart2JsMethodKind("redirecting");
static const Dart2JsMethodKind CONST = const Dart2JsMethodKind("const");
static const Dart2JsMethodKind FACTORY = const Dart2JsMethodKind("factory");
static const Dart2JsMethodKind GETTER = const Dart2JsMethodKind("getter");
@@ -151,7 +154,7 @@
'or': '|',
};
String newName = mapping[name];
- if (newName === null) {
+ if (newName == null) {
throw new Exception('Unhandled operator name: $name');
}
return newName;
@@ -317,9 +320,9 @@
String message, diagnostics.Diagnostic kind) {
if (isAborting) return;
bool fatal =
- kind === diagnostics.Diagnostic.CRASH ||
- kind === diagnostics.Diagnostic.ERROR;
- if (uri === null) {
+ kind == diagnostics.Diagnostic.CRASH ||
+ kind == diagnostics.Diagnostic.ERROR;
+ if (uri == null) {
if (!fatal) {
return;
}
@@ -337,7 +340,7 @@
: cwd = getCurrentDirectory(), sourceFiles = <String, SourceFile>{} {
var libraryUri = cwd.resolve(libraryRoot.toString());
var packageUri;
- if (packageRoot !== null) {
+ if (packageRoot != null) {
packageUri = cwd.resolve(packageRoot.toString());
} else {
packageUri = libraryUri;
@@ -354,7 +357,7 @@
: cwd = getCurrentDirectory(), sourceFiles = <String, SourceFile>{} {
var libraryUri = cwd.resolve(libraryRoot.toString());
var packageUri;
- if (packageRoot !== null) {
+ if (packageRoot != null) {
packageUri = cwd.resolve(packageRoot.toString());
} else {
packageUri = libraryUri;
@@ -381,43 +384,63 @@
//------------------------------------------------------------------------------
abstract class Dart2JsMirror implements Mirror {
- Dart2JsMirrorSystem get system;
+ Dart2JsMirrorSystem get mirrors;
}
-abstract class Dart2JsMemberMirror implements Dart2JsMirror, MemberMirror {
+abstract class Dart2JsDeclarationMirror
+ implements Dart2JsMirror, DeclarationMirror {
+
+ bool get isTopLevel => owner != null && owner is LibraryMirror;
+
+ bool get isPrivate => _isPrivate(simpleName);
+}
+
+abstract class Dart2JsMemberMirror extends Dart2JsElementMirror
+ implements MemberMirror {
+
+ Dart2JsMemberMirror(Dart2JsMirrorSystem system, Element element)
+ : super(system, element);
+
+ bool get isConstructor => false;
+
+ bool get isField => false;
+
+ bool get isMethod => false;
+
+ bool get isStatic => false;
+}
+
+abstract class Dart2JsTypeMirror extends Dart2JsDeclarationMirror
+ implements TypeMirror {
}
-abstract class Dart2JsTypeMirror implements Dart2JsMirror, TypeMirror {
-
-}
-
-abstract class Dart2JsElementMirror implements Dart2JsMirror {
- final Dart2JsMirrorSystem system;
+abstract class Dart2JsElementMirror extends Dart2JsDeclarationMirror {
+ final Dart2JsMirrorSystem mirrors;
final Element _element;
- Dart2JsElementMirror(this.system, this._element) {
- assert (system !== null);
- assert (_element !== null);
+ Dart2JsElementMirror(this.mirrors, this._element) {
+ assert (mirrors != null);
+ assert (_element != null);
}
String get simpleName => _element.name.slowToString();
String get displayName => simpleName;
- Location get location => new Dart2JsLocation(
+ SourceLocation get location => new Dart2JsLocation(
_element.getCompilationUnit().script,
- system.compiler.spanFromElement(_element));
+ mirrors.compiler.spanFromElement(_element));
String toString() => _element.toString();
int get hashCode => qualifiedName.hashCode;
}
-abstract class Dart2JsProxyMirror implements Dart2JsMirror {
- final Dart2JsMirrorSystem system;
+abstract class Dart2JsProxyMirror extends Dart2JsDeclarationMirror {
+ final Dart2JsMirrorSystem mirrors;
- Dart2JsProxyMirror(this.system);
+ Dart2JsProxyMirror(this.mirrors);
String get displayName => simpleName;
@@ -440,7 +463,7 @@
if (_libraries == null) {
_libraries = <String, Dart2JsLibraryMirror>{};
compiler.libraries.forEach((_, LibraryElement v) {
- var mirror = new Dart2JsLibraryMirror(system, v);
+ var mirror = new Dart2JsLibraryMirror(mirrors, v);
_libraries[mirror.simpleName] = mirror;
_libraryMap[v] = mirror;
});
@@ -452,30 +475,66 @@
return new ImmutableMapWrapper<String, LibraryMirror>(_libraries);
}
- Dart2JsLibraryMirror getLibrary(LibraryElement element) {
- return _libraryMap[element];
+ Dart2JsLibraryMirror _getLibrary(LibraryElement element) =>
+ _libraryMap[element];
+
+ Dart2JsMirrorSystem get mirrors => this;
+
+ TypeMirror get dynamicType =>
+ _convertTypeToTypeMirror(this, compiler.types.dynamicType, null);
+
+ TypeMirror get voidType =>
+ _convertTypeToTypeMirror(this, compiler.types.voidType, null);
+}
+
+abstract class Dart2JsContainerMirror extends Dart2JsElementMirror
+ implements ContainerMirror {
+ Map<String, MemberMirror> _members;
+
+ Dart2JsContainerMirror(Dart2JsMirrorSystem system, Element element)
+ : super(system, element);
+
+ void _ensureMembers();
+
+ Map<String, MemberMirror> get members {
+ _ensureMembers();
+ return new ImmutableMapWrapper<String, MemberMirror>(_members);
}
- Dart2JsMirrorSystem get system => this;
+ Map<String, MethodMirror> get functions {
+ _ensureMembers();
+ return new AsFilteredImmutableMap<String, MemberMirror, MethodMirror>(
+ _members,
+ (MemberMirror member) => member is MethodMirror);
+ }
- String get simpleName => "mirror";
- String get displayName => simpleName;
- String get qualifiedName => simpleName;
+ Map<String, MethodMirror> get getters {
+ _ensureMembers();
+ return new AsFilteredImmutableMap<String, MemberMirror, MethodMirror>(
+ _members,
+ (MemberMirror member) =>
+ member is MethodMirror && (member as MethodMirror).isGetter);
+ }
- // TODO(johnniwinther): Hack! Dart2JsMirrorSystem need not be a Mirror.
- int get hashCode => qualifiedName.hashCode;
+ Map<String, MethodMirror> get setters {
+ _ensureMembers();
+ return new AsFilteredImmutableMap<String, MemberMirror, MethodMirror>(
+ _members,
+ (MemberMirror member) =>
+ member is MethodMirror && (member as MethodMirror).isSetter);
+ }
+
+ Map<String, VariableMirror> get variables {
+ _ensureMembers();
+ return new AsFilteredImmutableMap<String, MemberMirror, VariableMirror>(
+ _members,
+ (MemberMirror member) => member is VariableMirror);
+ }
}
-abstract class Dart2JsObjectMirror extends Dart2JsElementMirror
- implements ObjectMirror {
- Dart2JsObjectMirror(Dart2JsMirrorSystem system, Element element)
- : super(system, element);
-}
-
-class Dart2JsLibraryMirror extends Dart2JsObjectMirror
+class Dart2JsLibraryMirror extends Dart2JsContainerMirror
implements LibraryMirror {
- Map<String, InterfaceMirror> _types;
- Map<String, MemberMirror> _members;
+ Map<String, ClassMirror> _classes;
Dart2JsLibraryMirror(Dart2JsMirrorSystem system, LibraryElement library)
: super(system, library);
@@ -484,6 +543,10 @@
Uri get uri => _library.uri;
+ DeclarationMirror get owner => null;
+
+ bool get isPrivate => false;
+
LibraryMirror library() => this;
/**
@@ -492,10 +555,10 @@
* provide a 'library name' for scripts, to use for instance in dartdoc.
*/
String get simpleName {
- if (_library.libraryTag !== null) {
+ if (_library.libraryTag != null) {
// TODO(ahe): Remove StringNode check when old syntax is removed.
StringNode name = _library.libraryTag.name.asStringNode();
- if (name !== null) {
+ if (name != null) {
return name.dartString.slowToString();
} else {
return _library.libraryTag.name.toString();
@@ -509,24 +572,25 @@
String get qualifiedName => simpleName;
- void _ensureTypes() {
- if (_types == null) {
- _types = <String, InterfaceMirror>{};
+ void _ensureClasses() {
+ if (_classes == null) {
+ _classes = <String, ClassMirror>{};
_library.forEachLocalMember((Element e) {
if (e.isClass()) {
- e.ensureResolved(system.compiler);
- var type = new Dart2JsInterfaceMirror.fromLibrary(this, e);
- assert(invariant(_library, !_types.containsKey(type.simpleName),
+ ClassElement classElement = e;
+ classElement.ensureResolved(mirrors.compiler);
+ var type = new Dart2JsClassMirror.fromLibrary(this, classElement);
+ assert(invariant(_library, !_classes.containsKey(type.simpleName),
message: "Type name '${type.simpleName}' "
"is not unique in $_library."));
- _types[type.simpleName] = type;
+ _classes[type.simpleName] = type;
} else if (e.isTypedef()) {
var type = new Dart2JsTypedefMirror.fromLibrary(this,
- e.computeType(system.compiler));
- assert(invariant(_library, !_types.containsKey(type.simpleName),
+ e.computeType(mirrors.compiler));
+ assert(invariant(_library, !_classes.containsKey(type.simpleName),
message: "Type name '${type.simpleName}' "
"is not unique in $_library."));
- _types[type.simpleName] = type;
+ _classes[type.simpleName] = type;
}
});
}
@@ -546,17 +610,12 @@
}
}
- Map<String, MemberMirror> get declaredMembers {
- _ensureMembers();
- return new ImmutableMapWrapper<String, MemberMirror>(_members);
+ Map<String, ClassMirror> get classes {
+ _ensureClasses();
+ return new ImmutableMapWrapper<String, ClassMirror>(_classes);
}
- Map<String, InterfaceMirror> get types {
- _ensureTypes();
- return new ImmutableMapWrapper<String, InterfaceMirror>(_types);
- }
-
- Location get location {
+ SourceLocation get location {
var script = _library.getCompilationUnit().script;
return new Dart2JsLocation(
script,
@@ -564,7 +623,7 @@
}
}
-class Dart2JsLocation implements Location {
+class Dart2JsLocation implements SourceLocation {
Script _script;
SourceSpan _span;
@@ -589,38 +648,48 @@
String get text => _script.text;
}
-class Dart2JsParameterMirror extends Dart2JsElementMirror
+class Dart2JsParameterMirror extends Dart2JsMemberMirror
implements ParameterMirror {
final MethodMirror _method;
final bool isOptional;
+ final bool isNamed;
factory Dart2JsParameterMirror(Dart2JsMirrorSystem system,
MethodMirror method,
VariableElement element,
- bool isOptional) {
+ bool isOptional,
+ bool isNamed) {
if (element is FieldParameterElement) {
return new Dart2JsFieldParameterMirror(system,
- method, element, isOptional);
+ method, element, isOptional, isNamed);
}
return new Dart2JsParameterMirror._normal(system,
- method, element, isOptional);
+ method, element, isOptional, isNamed);
}
Dart2JsParameterMirror._normal(Dart2JsMirrorSystem system,
this._method,
VariableElement element,
- this.isOptional)
+ this.isOptional,
+ this.isNamed)
: super(system, element);
+ DeclarationMirror get owner => _method;
+
VariableElement get _variableElement => _element;
String get qualifiedName => '${_method.qualifiedName}#${simpleName}';
- TypeMirror get type => _convertTypeToTypeMirror(system,
- _variableElement.computeType(system.compiler),
- system.compiler.types.dynamicType,
+ TypeMirror get type => _convertTypeToTypeMirror(mirrors,
+ _variableElement.computeType(mirrors.compiler),
+ mirrors.compiler.types.dynamicType,
_variableElement.variables.functionSignature);
+
+ bool get isFinal => false;
+
+ bool get isConst => false;
+
String get defaultValue {
if (hasDefaultValue) {
SendSet expression = _variableElement.cachedNode.asSendSet();
@@ -628,14 +697,15 @@
}
return null;
}
+
bool get hasDefaultValue {
- return _variableElement.cachedNode !== null &&
+ return _variableElement.cachedNode != null &&
_variableElement.cachedNode is SendSet;
}
bool get isInitializingFormal => false;
- FieldMirror get initializedField => null;
+ VariableMirror get initializedField => null;
}
class Dart2JsFieldParameterMirror extends Dart2JsParameterMirror {
@@ -643,55 +713,57 @@
Dart2JsFieldParameterMirror(Dart2JsMirrorSystem system,
MethodMirror method,
FieldParameterElement element,
- bool isOptional)
- : super._normal(system, method, element, isOptional);
+ bool isOptional,
+ bool isNamed)
+ : super._normal(system, method, element, isOptional, isNamed);
FieldParameterElement get _fieldParameterElement => _element;
TypeMirror get type {
- if (_fieldParameterElement.variables.cachedNode.type !== null) {
+ if (_fieldParameterElement.variables.cachedNode.type != null) {
return super.type;
}
- return _convertTypeToTypeMirror(system,
- _fieldParameterElement.fieldElement.computeType(system.compiler),
- system.compiler.types.dynamicType,
+ return _convertTypeToTypeMirror(mirrors,
+ _fieldParameterElement.fieldElement.computeType(mirrors.compiler),
+ mirrors.compiler.types.dynamicType,
_variableElement.variables.functionSignature);
}
bool get isInitializingFormal => true;
- FieldMirror get initializedField => new Dart2JsFieldMirror(
- _method.surroundingDeclaration, _fieldParameterElement.fieldElement);
+ VariableMirror get initializedField => new Dart2JsFieldMirror(
+ _method.owner, _fieldParameterElement.fieldElement);
}
//------------------------------------------------------------------------------
// Declarations
//------------------------------------------------------------------------------
-class Dart2JsInterfaceMirror extends Dart2JsObjectMirror
- implements Dart2JsTypeMirror, InterfaceMirror {
+class Dart2JsClassMirror extends Dart2JsContainerMirror
+ implements Dart2JsTypeMirror, ClassMirror {
final Dart2JsLibraryMirror library;
- Map<String, Dart2JsMemberMirror> _members;
List<TypeVariableMirror> _typeVariables;
- Dart2JsInterfaceMirror(Dart2JsMirrorSystem system, ClassElement _class)
- : this.library = system.getLibrary(_class.getLibrary()),
+ Dart2JsClassMirror(Dart2JsMirrorSystem system, ClassElement _class)
+ : this.library = system._getLibrary(_class.getLibrary()),
super(system, _class);
ClassElement get _class => _element;
- Dart2JsInterfaceMirror.fromLibrary(Dart2JsLibraryMirror library,
+ Dart2JsClassMirror.fromLibrary(Dart2JsLibraryMirror library,
ClassElement _class)
: this.library = library,
- super(library.system, _class);
+ super(library.mirrors, _class);
+
+ DeclarationMirror get owner => library;
String get qualifiedName => '${library.qualifiedName}.${simpleName}';
- Location get location {
+ SourceLocation get location {
if (_class is PartialClassElement) {
- var node = _class.parseNode(system.compiler);
- if (node !== null) {
+ var node = _class.parseNode(mirrors.compiler);
+ if (node != null) {
var script = _class.getCompilationUnit().script;
- var span = system.compiler.spanFromNode(node, script.uri);
+ var span = mirrors.compiler.spanFromNode(node, script.uri);
return new Dart2JsLocation(script, span);
}
}
@@ -710,12 +782,15 @@
}
}
- Map<String, MemberMirror> get declaredMembers {
+ Map<String, MethodMirror> get methods => functions;
+
+ Map<String, MethodMirror> get constructors {
_ensureMembers();
- return new ImmutableMapWrapper<String, MemberMirror>(_members);
+ return new AsFilteredImmutableMap<String, MemberMirror, MethodMirror>(
+ _members, (m) => m.isConstructor ? m : null);
}
- bool get isObject => _class == system.compiler.objectClass;
+ bool get isObject => _class == mirrors.compiler.objectClass;
bool get isDynamic => false;
@@ -727,21 +802,21 @@
bool get isFunction => false;
- InterfaceMirror get declaration => this;
+ ClassMirror get originalDeclaration => this;
- InterfaceMirror get superclass {
+ ClassMirror get superclass {
if (_class.supertype != null) {
- return new Dart2JsInterfaceTypeMirror(system, _class.supertype);
+ return new Dart2JsInterfaceTypeMirror(mirrors, _class.supertype);
}
return null;
}
- List<InterfaceMirror> get interfaces {
- var list = <InterfaceMirror>[];
+ List<ClassMirror> get superinterfaces {
+ var list = <ClassMirror>[];
Link<DartType> link = _class.interfaces;
while (!link.isEmpty) {
- var type = _convertTypeToTypeMirror(system, link.head,
- system.compiler.types.dynamicType);
+ var type = _convertTypeToTypeMirror(mirrors, link.head,
+ mirrors.compiler.types.dynamicType);
list.add(type);
link = link.tail;
}
@@ -754,9 +829,7 @@
bool get isAbstract => _class.modifiers.isAbstract();
- bool get isPrivate => _isPrivate(simpleName);
-
- bool get isDeclaration => true;
+ bool get isOriginalDeclaration => true;
List<TypeMirror> get typeArguments {
throw new UnsupportedError(
@@ -766,42 +839,36 @@
List<TypeVariableMirror> get typeVariables {
if (_typeVariables == null) {
_typeVariables = <TypeVariableMirror>[];
- _class.ensureResolved(system.compiler);
+ _class.ensureResolved(mirrors.compiler);
for (TypeVariableType typeVariable in _class.typeVariables) {
_typeVariables.add(
- new Dart2JsTypeVariableMirror(system, typeVariable));
+ new Dart2JsTypeVariableMirror(mirrors, typeVariable));
}
}
return _typeVariables;
}
- Map<String, MethodMirror> get constructors {
- _ensureMembers();
- return new AsFilteredImmutableMap<String, MemberMirror, MethodMirror>(
- _members, (m) => m.isConstructor ? m : null);
- }
-
/**
* Returns the default type for this interface.
*/
- InterfaceMirror get defaultType {
+ ClassMirror get defaultFactory {
if (_class.defaultClass != null) {
- return new Dart2JsInterfaceTypeMirror(system, _class.defaultClass);
+ return new Dart2JsInterfaceTypeMirror(mirrors, _class.defaultClass);
}
return null;
}
bool operator ==(Object other) {
- if (this === other) {
+ if (identical(this, other)) {
return true;
}
- if (other is! InterfaceMirror) {
+ if (other is! ClassMirror) {
return false;
}
if (library != other.library) {
return false;
}
- if (isDeclaration !== other.isDeclaration) {
+ if (!identical(isOriginalDeclaration, other.isOriginalDeclaration)) {
return false;
}
return qualifiedName == other.qualifiedName;
@@ -815,23 +882,23 @@
TypeMirror _definition;
Dart2JsTypedefMirror(Dart2JsMirrorSystem system, TypedefType _typedef)
- : this._library = system.getLibrary(_typedef.element.getLibrary()),
+ : this._library = system._getLibrary(_typedef.element.getLibrary()),
super(system, _typedef);
Dart2JsTypedefMirror.fromLibrary(Dart2JsLibraryMirror library,
TypedefType _typedef)
: this._library = library,
- super(library.system, _typedef);
+ super(library.mirrors, _typedef);
TypedefType get _typedef => _type;
String get qualifiedName => '${library.qualifiedName}.${simpleName}';
- Location get location {
+ SourceLocation get location {
var node = _typedef.element.parseNode(_diagnosticListener);
- if (node !== null) {
+ if (node != null) {
var script = _typedef.element.getCompilationUnit().script;
- var span = system.compiler.spanFromNode(node, script.uri);
+ var span = mirrors.compiler.spanFromNode(node, script.uri);
return new Dart2JsLocation(script, span);
}
return super.location;
@@ -851,75 +918,65 @@
_typeVariables = <TypeVariableMirror>[];
for (TypeVariableType typeVariable in _typedef.typeArguments) {
_typeVariables.add(
- new Dart2JsTypeVariableMirror(system, typeVariable));
+ new Dart2JsTypeVariableMirror(mirrors, typeVariable));
}
}
return _typeVariables;
}
- TypeMirror get definition {
- if (_definition === null) {
+ TypeMirror get value {
+ if (_definition == null) {
// TODO(johnniwinther): Should be [ensureResolved].
- system.compiler.resolveTypedef(_typedef.element);
+ mirrors.compiler.resolveTypedef(_typedef.element);
_definition = _convertTypeToTypeMirror(
- system,
+ mirrors,
_typedef.element.alias,
- system.compiler.types.dynamicType,
+ mirrors.compiler.types.dynamicType,
_typedef.element.functionSignature);
}
return _definition;
}
- Map<String, MemberMirror> get declaredMembers =>
- const <String, MemberMirror>{};
-
- InterfaceMirror get declaration => this;
+ ClassMirror get originalDeclaration => this;
// TODO(johnniwinther): How should a typedef respond to these?
- InterfaceMirror get superclass => null;
+ ClassMirror get superclass => null;
- List<InterfaceMirror> get interfaces => const <InterfaceMirror>[];
+ List<ClassMirror> get superinterfaces => const <ClassMirror>[];
bool get isClass => false;
bool get isInterface => false;
- bool get isPrivate => _isPrivate(simpleName);
-
- bool get isDeclaration => true;
+ bool get isOriginalDeclaration => true;
bool get isAbstract => false;
-
- Map<String, MethodMirror> get constructors =>
- const <String, MethodMirror>{};
-
- InterfaceMirror get defaultType => null;
}
class Dart2JsTypeVariableMirror extends Dart2JsTypeElementMirror
implements TypeVariableMirror {
final TypeVariableType _typeVariableType;
- InterfaceMirror _declarer;
+ ClassMirror _declarer;
Dart2JsTypeVariableMirror(Dart2JsMirrorSystem system,
TypeVariableType typeVariableType)
: this._typeVariableType = typeVariableType,
super(system, typeVariableType) {
- assert(_typeVariableType !== null);
+ assert(_typeVariableType != null);
}
String get qualifiedName => '${declarer.qualifiedName}.${simpleName}';
- InterfaceMirror get declarer {
- if (_declarer === null) {
+ ClassMirror get declarer {
+ if (_declarer == null) {
if (_typeVariableType.element.enclosingElement.isClass()) {
- _declarer = new Dart2JsInterfaceMirror(system,
+ _declarer = new Dart2JsClassMirror(mirrors,
_typeVariableType.element.enclosingElement);
} else if (_typeVariableType.element.enclosingElement.isTypedef()) {
- _declarer = new Dart2JsTypedefMirror(system,
+ _declarer = new Dart2JsTypedefMirror(mirrors,
_typeVariableType.element.enclosingElement.computeType(
- system.compiler));
+ mirrors.compiler));
}
}
return _declarer;
@@ -927,15 +984,17 @@
LibraryMirror get library => declarer.library;
+ DeclarationMirror get owner => declarer;
+
bool get isTypeVariable => true;
- TypeMirror get bound => _convertTypeToTypeMirror(
- system,
+ TypeMirror get upperBound => _convertTypeToTypeMirror(
+ mirrors,
_typeVariableType.element.bound,
- system.compiler.objectClass.computeType(system.compiler));
+ mirrors.compiler.objectClass.computeType(mirrors.compiler));
bool operator ==(Object other) {
- if (this === other) {
+ if (identical(this, other)) {
return true;
}
if (other is! TypeVariableMirror) {
@@ -962,14 +1021,16 @@
String get simpleName => _type.name.slowToString();
- Location get location {
+ SourceLocation get location {
var script = _type.element.getCompilationUnit().script;
return new Dart2JsLocation(script,
- system.compiler.spanFromElement(_type.element));
+ mirrors.compiler.spanFromElement(_type.element));
}
+ DeclarationMirror get owner => library;
+
LibraryMirror get library {
- return system.getLibrary(_type.element.getLibrary());
+ return mirrors._getLibrary(_type.element.getLibrary());
}
bool get isObject => false;
@@ -985,10 +1046,24 @@
bool get isFunction => false;
String toString() => _type.element.toString();
+
+ Map<String, MemberMirror> get members => const <String, MemberMirror>{};
+
+ Map<String, MethodMirror> get constructors => const <String, MethodMirror>{};
+
+ Map<String, MethodMirror> get methods => const <String, MethodMirror>{};
+
+ Map<String, MethodMirror> get getters => const <String, MethodMirror>{};
+
+ Map<String, MethodMirror> get setters => const <String, MethodMirror>{};
+
+ Map<String, VariableMirror> get variables => const <String, VariableMirror>{};
+
+ ClassMirror get defaultFactory => null;
}
class Dart2JsInterfaceTypeMirror extends Dart2JsTypeElementMirror
- implements InterfaceMirror {
+ implements ClassMirror {
List<TypeMirror> _typeArguments;
Dart2JsInterfaceTypeMirror(Dart2JsMirrorSystem system,
@@ -997,66 +1072,80 @@
InterfaceType get _interfaceType => _type;
- String get qualifiedName => declaration.qualifiedName;
+ String get qualifiedName => originalDeclaration.qualifiedName;
// TODO(johnniwinther): Substitute type arguments for type variables.
- Map<String, MemberMirror> get declaredMembers => declaration.declaredMembers;
+ Map<String, MemberMirror> get members => originalDeclaration.members;
- bool get isObject => system.compiler.objectClass == _type.element;
+ bool get isObject => mirrors.compiler.objectClass == _type.element;
- bool get isDynamic => system.compiler.dynamicClass == _type.element;
+ bool get isDynamic => mirrors.compiler.dynamicClass == _type.element;
- InterfaceMirror get declaration
- => new Dart2JsInterfaceMirror(system, _type.element);
+ ClassMirror get originalDeclaration
+ => new Dart2JsClassMirror(mirrors, _type.element);
// TODO(johnniwinther): Substitute type arguments for type variables.
- InterfaceMirror get superclass => declaration.superclass;
+ ClassMirror get superclass => originalDeclaration.superclass;
// TODO(johnniwinther): Substitute type arguments for type variables.
- List<InterfaceMirror> get interfaces => declaration.interfaces;
+ List<ClassMirror> get superinterfaces => originalDeclaration.superinterfaces;
- bool get isClass => declaration.isClass;
+ bool get isClass => originalDeclaration.isClass;
- bool get isInterface => declaration.isInterface;
+ bool get isInterface => originalDeclaration.isInterface;
- bool get isAbstract => declaration.isAbstract;
+ bool get isAbstract => originalDeclaration.isAbstract;
- bool get isPrivate => declaration.isPrivate;
+ bool get isPrivate => originalDeclaration.isPrivate;
- bool get isDeclaration => false;
+ bool get isOriginalDeclaration => false;
List<TypeMirror> get typeArguments {
if (_typeArguments == null) {
_typeArguments = <TypeMirror>[];
Link<DartType> type = _interfaceType.arguments;
while (type != null && type.head != null) {
- _typeArguments.add(_convertTypeToTypeMirror(system, type.head,
- system.compiler.types.dynamicType));
+ _typeArguments.add(_convertTypeToTypeMirror(mirrors, type.head,
+ mirrors.compiler.types.dynamicType));
type = type.tail;
}
}
return _typeArguments;
}
- List<TypeVariableMirror> get typeVariables => declaration.typeVariables;
+ List<TypeVariableMirror> get typeVariables =>
+ originalDeclaration.typeVariables;
// TODO(johnniwinther): Substitute type arguments for type variables.
- Map<String, MethodMirror> get constructors => declaration.constructors;
+ Map<String, MethodMirror> get constructors =>
+ originalDeclaration.constructors;
+
+ // TODO(johnniwinther): Substitute type arguments for type variables.
+ Map<String, MethodMirror> get methods => originalDeclaration.methods;
+
+ // TODO(johnniwinther): Substitute type arguments for type variables.
+ Map<String, MethodMirror> get setters => originalDeclaration.setters;
+
+ // TODO(johnniwinther): Substitute type arguments for type variables.
+ Map<String, MethodMirror> get getters => originalDeclaration.getters;
+
+ // TODO(johnniwinther): Substitute type arguments for type variables.
+ Map<String, VariableMirror> get variables => originalDeclaration.variables;
// TODO(johnniwinther): Substitute type arguments for type variables?
- InterfaceMirror get defaultType => declaration.defaultType;
+ ClassMirror get defaultFactory => originalDeclaration.defaultFactory;
bool operator ==(Object other) {
- if (this === other) {
+ if (identical(this, other)) {
return true;
}
- if (other is! InterfaceMirror) {
+ if (other is! ClassMirror) {
return false;
}
- if (other.isDeclaration) {
+ if (other.isOriginalDeclaration) {
return false;
}
- if (declaration != other.declaration) {
+ if (originalDeclaration != other.originalDeclaration) {
return false;
}
var thisTypeArguments = typeArguments.iterator();
@@ -1079,69 +1168,66 @@
Dart2JsFunctionTypeMirror(Dart2JsMirrorSystem system,
FunctionType functionType, this._functionSignature)
: super(system, functionType) {
- assert (_functionSignature !== null);
+ assert (_functionSignature != null);
}
FunctionType get _functionType => _type;
// TODO(johnniwinther): Is this the qualified name of a function type?
- String get qualifiedName => declaration.qualifiedName;
+ String get qualifiedName => originalDeclaration.qualifiedName;
// TODO(johnniwinther): Substitute type arguments for type variables.
- Map<String, MemberMirror> get declaredMembers {
+ Map<String, MemberMirror> get members {
var method = callMethod;
- if (method !== null) {
+ if (method != null) {
var map = new Map<String, MemberMirror>.from(
- declaration.declaredMembers);
+ originalDeclaration.members);
var name = method.qualifiedName;
assert(!map.containsKey(name));
map[name] = method;
return new ImmutableMapWrapper<String, MemberMirror>(map);
}
- return declaration.declaredMembers;
+ return originalDeclaration.members;
}
bool get isFunction => true;
MethodMirror get callMethod => _convertElementMethodToMethodMirror(
- system.getLibrary(_functionType.element.getLibrary()),
+ mirrors._getLibrary(_functionType.element.getLibrary()),
_functionType.element);
- InterfaceMirror get declaration
- => new Dart2JsInterfaceMirror(system, system.compiler.functionClass);
+ ClassMirror get originalDeclaration
+ => new Dart2JsClassMirror(mirrors, mirrors.compiler.functionClass);
// TODO(johnniwinther): Substitute type arguments for type variables.
- InterfaceMirror get superclass => declaration.superclass;
+ ClassMirror get superclass => originalDeclaration.superclass;
// TODO(johnniwinther): Substitute type arguments for type variables.
- List<InterfaceMirror> get interfaces => declaration.interfaces;
+ List<ClassMirror> get superinterfaces => originalDeclaration.superinterfaces;
- bool get isClass => declaration.isClass;
+ bool get isClass => originalDeclaration.isClass;
- bool get isInterface => declaration.isInterface;
+ bool get isInterface => originalDeclaration.isInterface;
- bool get isPrivate => declaration.isPrivate;
+ bool get isPrivate => originalDeclaration.isPrivate;
- bool get isDeclaration => false;
+ bool get isOriginalDeclaration => false;
bool get isAbstract => false;
List<TypeMirror> get typeArguments => const <TypeMirror>[];
- List<TypeVariableMirror> get typeVariables => declaration.typeVariables;
-
- Map<String, MethodMirror> get constructors => <String, MethodMirror>{};
-
- InterfaceMirror get defaultType => null;
+ List<TypeVariableMirror> get typeVariables =>
+ originalDeclaration.typeVariables;
TypeMirror get returnType {
- return _convertTypeToTypeMirror(system, _functionType.returnType,
- system.compiler.types.dynamicType);
+ return _convertTypeToTypeMirror(mirrors, _functionType.returnType,
+ mirrors.compiler.types.dynamicType);
}
List<ParameterMirror> get parameters {
- if (_parameters === null) {
- _parameters = _parametersFromFunctionSignature(system, callMethod,
+ if (_parameters == null) {
+ _parameters = _parametersFromFunctionSignature(mirrors, callMethod,
_functionSignature);
}
return _parameters;
@@ -1160,7 +1246,7 @@
/**
* The void type has no location.
*/
- Location get location => null;
+ SourceLocation get location => null;
/**
* The void type has no library.
@@ -1170,7 +1256,7 @@
bool get isVoid => true;
bool operator ==(Object other) {
- if (this === other) {
+ if (identical(this, other)) {
return true;
}
if (other is! TypeMirror) {
@@ -1192,7 +1278,7 @@
/**
* The dynamic type has no location.
*/
- Location get location => null;
+ SourceLocation get location => null;
/**
* The dynamic type has no library.
@@ -1202,7 +1288,7 @@
bool get isDynamic => true;
bool operator ==(Object other) {
- if (this === other) {
+ if (identical(this, other)) {
return true;
}
if (other is! TypeMirror) {
@@ -1216,19 +1302,19 @@
// Member mirrors implementation.
//------------------------------------------------------------------------------
-class Dart2JsMethodMirror extends Dart2JsElementMirror
- implements Dart2JsMemberMirror, MethodMirror {
- final Dart2JsObjectMirror _objectMirror;
+class Dart2JsMethodMirror extends Dart2JsMemberMirror
+ implements MethodMirror {
+ final Dart2JsContainerMirror _objectMirror;
String _simpleName;
String _displayName;
String _constructorName;
String _operatorName;
Dart2JsMethodKind _kind;
- Dart2JsMethodMirror(Dart2JsObjectMirror objectMirror,
+ Dart2JsMethodMirror(Dart2JsContainerMirror objectMirror,
FunctionElement function)
: this._objectMirror = objectMirror,
- super(objectMirror.system, function) {
+ super(objectMirror.mirrors, function) {
_simpleName = _element.name.slowToString();
if (_function.kind == ElementKind.GETTER) {
_kind = Dart2JsMethodKind.GETTER;
@@ -1238,6 +1324,7 @@
_displayName = _simpleName;
_simpleName = '$_simpleName=';
} else if (_function.kind == ElementKind.GENERATIVE_CONSTRUCTOR) {
+ // TODO(johnniwinther): Support detection of redirecting constructors.
_constructorName = '';
int dollarPos = _simpleName.indexOf('\$');
if (dollarPos != -1) {
@@ -1251,7 +1338,7 @@
if (_function.modifiers.isConst()) {
_kind = Dart2JsMethodKind.CONST;
} else {
- _kind = Dart2JsMethodKind.CONSTRUCTOR;
+ _kind = Dart2JsMethodKind.GENERATIVE;
}
_displayName = _simpleName;
} else if (_function.modifiers.isFactory()) {
@@ -1282,7 +1369,7 @@
// Display name is 'operator operatorName'.
_displayName = 'operator $_operatorName';
} else {
- _kind = Dart2JsMethodKind.NORMAL;
+ _kind = Dart2JsMethodKind.REGULAR;
_displayName = _simpleName;
}
}
@@ -1294,16 +1381,15 @@
String get displayName => _displayName;
String get qualifiedName
- => '${surroundingDeclaration.qualifiedName}.$simpleName';
+ => '${owner.qualifiedName}.$simpleName';
- ObjectMirror get surroundingDeclaration => _objectMirror;
+ DeclarationMirror get owner => _objectMirror;
bool get isTopLevel => _objectMirror is LibraryMirror;
bool get isConstructor
- => _kind == Dart2JsMethodKind.CONSTRUCTOR || isConst || isFactory;
-
- bool get isField => false;
+ => isGenerativeConstructor || isConstConstructor ||
+ isFactoryConstructor || isRedirectingConstructor;
bool get isMethod => !isConstructor;
@@ -1313,19 +1399,25 @@
bool get isStatic => _function.modifiers.isStatic();
List<ParameterMirror> get parameters {
- return _parametersFromFunctionSignature(system, this,
- _function.computeSignature(system.compiler));
+ return _parametersFromFunctionSignature(mirrors, this,
+ _function.computeSignature(mirrors.compiler));
}
TypeMirror get returnType => _convertTypeToTypeMirror(
- system, _function.computeSignature(system.compiler).returnType,
- system.compiler.types.dynamicType);
+ mirrors, _function.computeSignature(mirrors.compiler).returnType,
+ mirrors.compiler.types.dynamicType);
- bool get isAbstract => _function.modifiers.isAbstract();
+ bool get isAbstract => _function.isAbstract(mirrors.compiler);
- bool get isConst => _kind == Dart2JsMethodKind.CONST;
+ bool get isRegularMethod => !(isGetter || isSetter || isConstructor);
- bool get isFactory => _kind == Dart2JsMethodKind.FACTORY;
+ bool get isConstConstructor => _kind == Dart2JsMethodKind.CONST;
+
+ bool get isGenerativeConstructor => _kind == Dart2JsMethodKind.GENERATIVE;
+
+ bool get isRedirectingConstructor => _kind == Dart2JsMethodKind.REDIRECTING;
+
+ bool get isFactoryConstructor => _kind == Dart2JsMethodKind.FACTORY;
String get constructorName => _constructorName;
@@ -1337,11 +1429,11 @@
String get operatorName => _operatorName;
- Location get location {
+ SourceLocation get location {
var node = _function.parseNode(_diagnosticListener);
- if (node !== null) {
+ if (node != null) {
var script = _function.getCompilationUnit().script;
- var span = system.compiler.spanFromNode(node, script.uri);
+ var span = mirrors.compiler.spanFromNode(node, script.uri);
return new Dart2JsLocation(script, span);
}
return super.location;
@@ -1349,50 +1441,43 @@
}
-class Dart2JsFieldMirror extends Dart2JsElementMirror
- implements Dart2JsMemberMirror, FieldMirror {
- Dart2JsObjectMirror _objectMirror;
+class Dart2JsFieldMirror extends Dart2JsMemberMirror implements VariableMirror {
+ Dart2JsContainerMirror _objectMirror;
VariableElement _variable;
- Dart2JsFieldMirror(Dart2JsObjectMirror objectMirror,
+ Dart2JsFieldMirror(Dart2JsContainerMirror objectMirror,
VariableElement variable)
: this._objectMirror = objectMirror,
this._variable = variable,
- super(objectMirror.system, variable);
+ super(objectMirror.mirrors, variable);
String get qualifiedName
- => '${surroundingDeclaration.qualifiedName}.$simpleName';
+ => '${owner.qualifiedName}.$simpleName';
- ObjectMirror get surroundingDeclaration => _objectMirror;
+ DeclarationMirror get owner => _objectMirror;
bool get isTopLevel => _objectMirror is LibraryMirror;
- bool get isConstructor => false;
-
bool get isField => true;
- bool get isMethod => false;
-
- bool get isPrivate => _isPrivate(simpleName);
-
bool get isStatic => _variable.modifiers.isStatic();
bool get isFinal => _variable.modifiers.isFinal();
bool get isConst => _variable.modifiers.isConst();
- TypeMirror get type => _convertTypeToTypeMirror(system,
- _variable.computeType(system.compiler),
- system.compiler.types.dynamicType);
+ TypeMirror get type => _convertTypeToTypeMirror(mirrors,
+ _variable.computeType(mirrors.compiler),
+ mirrors.compiler.types.dynamicType);
- Location get location {
+ SourceLocation get location {
var script = _variable.getCompilationUnit().script;
var node = _variable.variables.parseNode(_diagnosticListener);
- if (node !== null) {
- var span = system.compiler.spanFromNode(node, script.uri);
+ if (node != null) {
+ var span = mirrors.compiler.spanFromNode(node, script.uri);
return new Dart2JsLocation(script, span);
} else {
- var span = system.compiler.spanFromElement(_variable);
+ var span = mirrors.compiler.spanFromElement(_variable);
return new Dart2JsLocation(script, span);
}
}
diff --git a/pkg/dartdoc/lib/src/mirrors/util.dart b/pkg/dartdoc/lib/src/mirrors/util.dart
index 755b78f..3470211 100644
--- a/pkg/dartdoc/lib/src/mirrors/util.dart
+++ b/pkg/dartdoc/lib/src/mirrors/util.dart
@@ -2,7 +2,7 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-#library('util');
+library util;
/**
* An abstract map implementation. This class can be used as a superclass for
diff --git a/pkg/intl/example/basic/basic_example.dart b/pkg/intl/example/basic/basic_example.dart
index 87223d0..76380e9 100644
--- a/pkg/intl/example/basic/basic_example.dart
+++ b/pkg/intl/example/basic/basic_example.dart
@@ -15,14 +15,14 @@
* formatted appropriately for the locale.
*/
-#library('intl_basic_example');
+library intl_basic_example;
// These can be replaced with package:intl/... references if using this in
// a separate package.
// TODO(alanknight): Replace these with package: once pub works in buildbots.
-#import('../../lib/date_symbol_data_local.dart');
-#import('../../lib/intl.dart');
-#import('../../lib/message_lookup_local.dart');
-#import('messages_all.dart');
+import '../../lib/date_symbol_data_local.dart';
+import '../../lib/intl.dart';
+import '../../lib/message_lookup_local.dart';
+import 'messages_all.dart';
Function doThisWithTheOutput;
diff --git a/pkg/intl/example/basic/basic_example_runner.dart b/pkg/intl/example/basic/basic_example_runner.dart
index 004a5b2..91bbfdd 100644
--- a/pkg/intl/example/basic/basic_example_runner.dart
+++ b/pkg/intl/example/basic/basic_example_runner.dart
@@ -7,7 +7,7 @@
* that as a library that can also be run by tests.
*/
-#import('basic_example.dart');
+import 'basic_example.dart';
main() {
setup(runProgram, print);
diff --git a/pkg/intl/example/basic/messages_all.dart b/pkg/intl/example/basic/messages_all.dart
index 7fc412b..43629f2 100644
--- a/pkg/intl/example/basic/messages_all.dart
+++ b/pkg/intl/example/basic/messages_all.dart
@@ -8,7 +8,7 @@
* all of them. In this example there's only one program file, so it doesn't
* make very much difference.
*/
-#library('messages_all.dart');
+library messages_all;
-#import('messages_th_th.dart', prefix: 'th_TH');
-#import('messages_de.dart', prefix: 'de');
+import 'messages_th_th.dart' as th_TH;
+import 'messages_de.dart' as de;
diff --git a/pkg/intl/example/basic/messages_de.dart b/pkg/intl/example/basic/messages_de.dart
index 98fcc75..07e8331 100644
--- a/pkg/intl/example/basic/messages_de.dart
+++ b/pkg/intl/example/basic/messages_de.dart
@@ -9,8 +9,8 @@
* up based on a naming convention.
*/
-#library('messages_de');
-#import('../../lib/intl.dart');
+library messages_de;
+import '../../lib/intl.dart';
runAt(time, day) => Intl.message('Ausgedruckt am $time am $day.', name: 'runAt',
args: [time, day]);
diff --git a/pkg/intl/example/basic/messages_th_th.dart b/pkg/intl/example/basic/messages_th_th.dart
index ef29df0..899399d 100644
--- a/pkg/intl/example/basic/messages_th_th.dart
+++ b/pkg/intl/example/basic/messages_th_th.dart
@@ -9,8 +9,8 @@
* up based on a naming convention.
*/
-#library('messages_th_TH');
-#import('../../lib/intl.dart');
+library messages_th_TH;
+import '../../lib/intl.dart';
runAt(time, day) =>
Intl.message('วิ่ง $time on $day.', name: 'runAt', args: [time, day]);
diff --git a/pkg/intl/lib/bidi_formatter.dart b/pkg/intl/lib/bidi_formatter.dart
index 7a52fac..ae7b908 100644
--- a/pkg/intl/lib/bidi_formatter.dart
+++ b/pkg/intl/lib/bidi_formatter.dart
@@ -2,6 +2,8 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+part of intl;
+
/**
* Bidi stands for Bi-directional text.
* According to [Wikipedia](http://en.wikipedia.org/wiki/Bi-directional_text):
diff --git a/pkg/intl/lib/bidi_utils.dart b/pkg/intl/lib/bidi_utils.dart
index e456c32..782148b 100644
--- a/pkg/intl/lib/bidi_utils.dart
+++ b/pkg/intl/lib/bidi_utils.dart
@@ -2,6 +2,8 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+part of intl;
+
/**
* Bidi stands for Bi-directional text.
* According to http://en.wikipedia.org/wiki/Bi-directional_text:
@@ -357,7 +359,7 @@
int index = 0;
while (sum >= 0 || index > str.length) {
int char = str.charCodeAt(index);
- if (char == '('.charCodeAt(0)) sum++;
+ if (char == '('.charCodeAt(0)) sum++;
else if (char == ')'.charCodeAt(0)) sum--;
index++;
}
diff --git a/pkg/intl/lib/date_format.dart b/pkg/intl/lib/date_format.dart
index f387f06..7a5ccdb 100644
--- a/pkg/intl/lib/date_format.dart
+++ b/pkg/intl/lib/date_format.dart
@@ -2,6 +2,8 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+part of intl;
+
/**
* DateFormat is for formatting and parsing dates in a locale-sensitive
* manner.
diff --git a/pkg/intl/lib/date_symbol_data_file.dart b/pkg/intl/lib/date_symbol_data_file.dart
index 1071ebb..2a5e200 100644
--- a/pkg/intl/lib/date_symbol_data_file.dart
+++ b/pkg/intl/lib/date_symbol_data_file.dart
@@ -7,15 +7,15 @@
* locale data from files in the file system.
*/
-#library('date_symbol_data_json');
+library date_symbol_data_json;
-#import("date_symbols.dart");
-#import("src/lazy_locale_data.dart");
-#import('src/date_format_internal.dart');
-#import('src/file_data_reader.dart');
-#import('dart:io');
+import "date_symbols.dart";
+import "src/lazy_locale_data.dart";
+import 'src/date_format_internal.dart';
+import 'src/file_data_reader.dart';
+import 'dart:io';
-#source("src/data/dates/localeList.dart");
+part "src/data/dates/localeList.dart";
/**
* This should be called for at least one [locale] before any date formatting
diff --git a/pkg/intl/lib/date_symbol_data_http_request.dart b/pkg/intl/lib/date_symbol_data_http_request.dart
index 8214c8f..b56c990 100644
--- a/pkg/intl/lib/date_symbol_data_http_request.dart
+++ b/pkg/intl/lib/date_symbol_data_http_request.dart
@@ -6,14 +6,14 @@
* This file should be imported, along with date_format.dart in order to read
* locale data via http requests to a web server..
*/
-#library('date_symbol_data_json');
+library date_symbol_data_json;
-#import("date_symbols.dart");
-#import("src/lazy_locale_data.dart");
-#import('src/date_format_internal.dart');
-#import('src/http_request_data_reader.dart');
+import "date_symbols.dart";
+import "src/lazy_locale_data.dart";
+import 'src/date_format_internal.dart';
+import 'src/http_request_data_reader.dart';
-#source("src/data/dates/localeList.dart");
+part "src/data/dates/localeList.dart";
/**
* This should be called for at least one [locale] before any date formatting
diff --git a/pkg/intl/lib/date_symbol_data_local.dart b/pkg/intl/lib/date_symbol_data_local.dart
index 264ac54..6474b5a 100644
--- a/pkg/intl/lib/date_symbol_data_local.dart
+++ b/pkg/intl/lib/date_symbol_data_local.dart
@@ -14,10 +14,10 @@
* removed after those changes land to CLDR.
*/
-#library("date_symbol_data");
-#import("date_symbols.dart");
-#import("src/date_format_internal.dart");
-#import("date_time_patterns.dart");
+library date_symbol_data;
+import "date_symbols.dart";
+import "src/date_format_internal.dart";
+import "date_time_patterns.dart";
/**
* This should be called for at least one [locale] before any date
diff --git a/pkg/intl/lib/date_symbols.dart b/pkg/intl/lib/date_symbols.dart
index 5c2f8df..acbd988 100644
--- a/pkg/intl/lib/date_symbols.dart
+++ b/pkg/intl/lib/date_symbols.dart
@@ -1,7 +1,7 @@
// 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("date_symbols");
+library date_symbols;
/**
* This holds onto information about how a particular locale formats dates. It
diff --git a/pkg/intl/lib/date_time_patterns.dart b/pkg/intl/lib/date_time_patterns.dart
index 5a8c157..8c92c70 100644
--- a/pkg/intl/lib/date_time_patterns.dart
+++ b/pkg/intl/lib/date_time_patterns.dart
@@ -9,7 +9,7 @@
* 'http://go/generate_datetime_pattern_dart.cc' (Google internal)
*/
-#library('date_time_patterns');
+library date_time_patterns;
/**
* Returns a Map from locale names to another Map that goes from skeletons
diff --git a/pkg/intl/lib/intl.dart b/pkg/intl/lib/intl.dart
index 3b6c5b8..e2cd831 100644
--- a/pkg/intl/lib/intl.dart
+++ b/pkg/intl/lib/intl.dart
@@ -14,18 +14,18 @@
* There is also a simple example application that can be found in the
* `example/basic` directory.
*/
-#library('intl');
+library intl;
-#import('src/intl_helpers.dart');
-#import('dart:math');
-#import('date_symbols.dart');
-#import('src/date_format_internal.dart');
+import 'src/intl_helpers.dart';
+import 'dart:math';
+import 'date_symbols.dart';
+import 'src/date_format_internal.dart';
-#source('date_format.dart');
-#source('src/date_format_field.dart');
-#source('src/date_format_helpers.dart');
-#source('bidi_formatter.dart');
-#source('bidi_utils.dart');
+part 'date_format.dart';
+part 'src/date_format_field.dart';
+part 'src/date_format_helpers.dart';
+part 'bidi_formatter.dart';
+part 'bidi_utils.dart';
/**
* The Intl class provides a common entry point for internationalization
diff --git a/pkg/intl/lib/intl_browser.dart b/pkg/intl/lib/intl_browser.dart
index c0dc952..f0af08d 100644
--- a/pkg/intl/lib/intl_browser.dart
+++ b/pkg/intl/lib/intl_browser.dart
@@ -9,10 +9,10 @@
* ability to find the default locale from the browser.
*/
-#library("intl_browser");
+library intl_browser;
-#import("dart:html");
-#import("intl.dart");
+import "dart:html";
+import "intl.dart";
// TODO(alanknight): The need to do this by forcing the user to specially
// import a particular library is a horrible hack, only done because there
diff --git a/pkg/intl/lib/intl_standalone.dart b/pkg/intl/lib/intl_standalone.dart
index ecede7a..6d42b5e 100644
--- a/pkg/intl/lib/intl_standalone.dart
+++ b/pkg/intl/lib/intl_standalone.dart
@@ -9,10 +9,10 @@
* the operating system locale.
*/
-#library("intl_standalone");
+library intl_standalone;
-#import("dart:io");
-#import("intl.dart");
+import "dart:io";
+import "intl.dart";
// TODO(alanknight): The need to do this by forcing the user to specially
// import a particular library is a horrible hack, only done because there
diff --git a/pkg/intl/lib/message_lookup_local.dart b/pkg/intl/lib/message_lookup_local.dart
index 1871c87..9c62fb3 100644
--- a/pkg/intl/lib/message_lookup_local.dart
+++ b/pkg/intl/lib/message_lookup_local.dart
@@ -13,11 +13,11 @@
*/
//TODO(efortuna): documentation example involving the offset parameter?
-#library('message_lookup_local');
+library message_lookup_local;
-#import('intl.dart');
-#import('src/intl_helpers.dart');
-#import('dart:mirrors');
+import 'intl.dart';
+import 'src/intl_helpers.dart';
+import 'dart:mirrors';
/**
* Initialize the user messages for [localeName]. Note that this is an ASYNC
diff --git a/pkg/intl/lib/number_format.dart b/pkg/intl/lib/number_format.dart
index 00373d2..4f75d63 100644
--- a/pkg/intl/lib/number_format.dart
+++ b/pkg/intl/lib/number_format.dart
@@ -2,13 +2,13 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-#library("number_format");
+library number_format;
-#import('dart:math');
+import 'dart:math';
-#import("intl.dart");
-#import("number_symbols.dart");
-#import("number_symbols_data.dart");
+import "intl.dart";
+import "number_symbols.dart";
+import "number_symbols_data.dart";
class NumberFormat {
/** Variables to determine how number printing behaves. */
diff --git a/pkg/intl/lib/number_symbols.dart b/pkg/intl/lib/number_symbols.dart
index 2d51362..6b2e616 100644
--- a/pkg/intl/lib/number_symbols.dart
+++ b/pkg/intl/lib/number_symbols.dart
@@ -1,7 +1,7 @@
// 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("number_symbols");
+library number_symbols;
/**
* This holds onto information about how a particular locale formats numbers. It
diff --git a/pkg/intl/lib/number_symbols_data.dart b/pkg/intl/lib/number_symbols_data.dart
index e555c95..1c11791 100644
--- a/pkg/intl/lib/number_symbols_data.dart
+++ b/pkg/intl/lib/number_symbols_data.dart
@@ -14,8 +14,8 @@
* removed after those changes land to CLDR.
*/
-#library("number_symbol_data");
-#import("number_symbols.dart");
+library number_symbol_data;
+import "number_symbols.dart";
Map numberFormatSymbols = const {
/**
diff --git a/pkg/intl/lib/src/data/dates/localeList.dart b/pkg/intl/lib/src/data/dates/localeList.dart
index 67e2b4d..6325924 100644
--- a/pkg/intl/lib/src/data/dates/localeList.dart
+++ b/pkg/intl/lib/src/data/dates/localeList.dart
@@ -2,6 +2,8 @@
// for details. All rights reserved. Use of this sourcecode is governed by a
// BSD-style license that can be found in the LICENSE file.
+part of date_symbol_data_json;
+
/// Hard-coded list of all available locales for dates.
final availableLocalesForDateFormatting = const ["en_ISO",
"af",
diff --git a/pkg/intl/lib/src/date_format_field.dart b/pkg/intl/lib/src/date_format_field.dart
index 489e4f8..3e7c6cf 100644
--- a/pkg/intl/lib/src/date_format_field.dart
+++ b/pkg/intl/lib/src/date_format_field.dart
@@ -2,6 +2,8 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+part of intl;
+
/**
* This is a private class internal to DateFormat which is used for formatting
* particular fields in a template. e.g. if the format is hh:mm:ss then the
diff --git a/pkg/intl/lib/src/date_format_helpers.dart b/pkg/intl/lib/src/date_format_helpers.dart
index 3478d0b..7def10b 100644
--- a/pkg/intl/lib/src/date_format_helpers.dart
+++ b/pkg/intl/lib/src/date_format_helpers.dart
@@ -2,6 +2,9 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+
+part of intl;
+
/**
* A class for holding onto the data for a date so that it can be built
* up incrementally.
@@ -71,7 +74,7 @@
bool atEnd() => index >= contents.length;
- Dynamic next() => contents[index++];
+ next() => contents[index++];
/**
* Return the next [howMany] items, or as many as there are remaining.
diff --git a/pkg/intl/lib/src/date_format_internal.dart b/pkg/intl/lib/src/date_format_internal.dart
index 54c45fc..9205dfb 100644
--- a/pkg/intl/lib/src/date_format_internal.dart
+++ b/pkg/intl/lib/src/date_format_internal.dart
@@ -12,8 +12,8 @@
* `initializeDateFormatting` method exposed there.
*/
-#library('date_format_internal');
-#import('intl_helpers.dart');
+library date_format_internal;
+import 'intl_helpers.dart';
/**
* This holds the symbols to be used for date/time formatting, indexed
diff --git a/pkg/intl/lib/src/file_data_reader.dart b/pkg/intl/lib/src/file_data_reader.dart
index b6c7e96..e5d3e51 100644
--- a/pkg/intl/lib/src/file_data_reader.dart
+++ b/pkg/intl/lib/src/file_data_reader.dart
@@ -7,10 +7,10 @@
* be run in the browser.
*/
-#library('file_data_reader');
+library file_data_reader;
-#import('dart:io');
-#import('intl_helpers.dart');
+import 'dart:io';
+import 'intl_helpers.dart';
class FileDataReader implements LocaleDataReader {
diff --git a/pkg/intl/lib/src/http_request_data_reader.dart b/pkg/intl/lib/src/http_request_data_reader.dart
index c79569d..b6d2e35 100644
--- a/pkg/intl/lib/src/http_request_data_reader.dart
+++ b/pkg/intl/lib/src/http_request_data_reader.dart
@@ -7,10 +7,10 @@
* facility, and thus works only in the web browser.
*/
-#library('http_request_data_reader');
+library http_request_data_reader;
-#import('dart:html');
-#import('intl_helpers.dart');
+import 'dart:html';
+import 'intl_helpers.dart';
class HTTPRequestDataReader implements LocaleDataReader {
diff --git a/pkg/intl/lib/src/intl_helpers.dart b/pkg/intl/lib/src/intl_helpers.dart
index 95facfd..128acd8 100644
--- a/pkg/intl/lib/src/intl_helpers.dart
+++ b/pkg/intl/lib/src/intl_helpers.dart
@@ -7,7 +7,7 @@
* rather than confined to specific parts of it.
*/
-#library("intl_helpers");
+library intl_helpers;
/**
* This is used as a marker for a locale data map that hasn't been initialized,
@@ -39,7 +39,7 @@
* An abstract superclass for data readers to keep the type system happy.
*/
abstract class LocaleDataReader {
- abstract Future read(String locale);
+ Future read(String locale);
}
/**
diff --git a/pkg/intl/lib/src/lazy_locale_data.dart b/pkg/intl/lib/src/lazy_locale_data.dart
index 6a42025..66acbdf 100644
--- a/pkg/intl/lib/src/lazy_locale_data.dart
+++ b/pkg/intl/lib/src/lazy_locale_data.dart
@@ -8,10 +8,10 @@
* local files or via HTTP request.
*/
-#library('lazy_locale_data');
-#import('dart:uri');
-#import('intl_helpers.dart');
-#import('dart:json');
+library lazy_locale_data;
+import 'dart:uri';
+import 'intl_helpers.dart';
+import 'dart:json';
/**
* This implements the very basic map-type operations which are used
diff --git a/pkg/intl/test/bidi_format_test.dart b/pkg/intl/test/bidi_format_test.dart
index 1aa77ab..6b26672 100644
--- a/pkg/intl/test/bidi_format_test.dart
+++ b/pkg/intl/test/bidi_format_test.dart
@@ -3,10 +3,10 @@
// BSD-style license that can be found in the LICENSE file.
-#library('bidi_format_test');
+library bidi_format_test;
-#import('../lib/intl.dart');
-#import('../../../pkg/unittest/unittest.dart');
+import '../lib/intl.dart';
+import '../../../pkg/unittest/unittest.dart';
/**
* Tests the bidirectional text formatting library.
diff --git a/pkg/intl/test/bidi_utils_test.dart b/pkg/intl/test/bidi_utils_test.dart
index 027e54c..e65a241 100644
--- a/pkg/intl/test/bidi_utils_test.dart
+++ b/pkg/intl/test/bidi_utils_test.dart
@@ -3,10 +3,10 @@
// BSD-style license that can be found in the LICENSE file.
-#library('bidi_utils_test');
+library bidi_utils_test;
-#import('../lib/intl.dart');
-#import('../../../pkg/unittest/unittest.dart');
+import '../lib/intl.dart';
+import '../../../pkg/unittest/unittest.dart';
/**
* Tests the bidi utilities library.
diff --git a/pkg/intl/test/data_directory.dart b/pkg/intl/test/data_directory.dart
index e75a466..b2e23da 100644
--- a/pkg/intl/test/data_directory.dart
+++ b/pkg/intl/test/data_directory.dart
@@ -7,9 +7,9 @@
* simple cases) for file-dependent programs being run from different
* directories.
*/
-#library('data_directory');
+library data_directory;
-#import('dart:io');
+import 'dart:io';
String get _sep => Platform.pathSeparator;
diff --git a/pkg/intl/test/date_time_format_file_even_test.dart b/pkg/intl/test/date_time_format_file_even_test.dart
index 1070f1e..ca9daee 100644
--- a/pkg/intl/test/date_time_format_file_even_test.dart
+++ b/pkg/intl/test/date_time_format_file_even_test.dart
@@ -8,9 +8,9 @@
* of them takes long enough that it may cause timeouts in the test bots.
*/
-#library('date_time_format_file_test_2');
-#import('date_time_format_file_test_stub.dart');
-#import('date_time_format_test_core.dart');
+library date_time_format_file_test_2;
+import 'date_time_format_file_test_stub.dart';
+import 'date_time_format_test_core.dart';
main() {
runWith(evenLocales);
diff --git a/pkg/intl/test/date_time_format_file_odd_test.dart b/pkg/intl/test/date_time_format_file_odd_test.dart
index 10c957e..fbf05bd 100644
--- a/pkg/intl/test/date_time_format_file_odd_test.dart
+++ b/pkg/intl/test/date_time_format_file_odd_test.dart
@@ -8,9 +8,9 @@
* of them takes long enough that it may cause timeouts in the test bots.
*/
-#library('date_time_format_file_test_1');
-#import('date_time_format_file_test_stub.dart');
-#import('date_time_format_test_core.dart');
+library date_time_format_file_test_1;
+import 'date_time_format_file_test_stub.dart';
+import 'date_time_format_test_core.dart';
main() {
runWith(oddLocales);
diff --git a/pkg/intl/test/date_time_format_file_test_stub.dart b/pkg/intl/test/date_time_format_file_test_stub.dart
index 480f95c..4a09ccf 100644
--- a/pkg/intl/test/date_time_format_file_test_stub.dart
+++ b/pkg/intl/test/date_time_format_file_test_stub.dart
@@ -7,14 +7,14 @@
* local file system.
*/
-#library('date_time_format_file_test');
+library date_time_format_file_test;
-#import('../lib/intl.dart');
-#import('../lib/date_symbol_data_file.dart');
-#import('dart:io');
-#import('date_time_format_test_core.dart');
-#import('data_directory.dart');
-#import('../../../pkg/unittest/unittest.dart');
+import '../lib/intl.dart';
+import '../lib/date_symbol_data_file.dart';
+import 'dart:io';
+import 'date_time_format_test_core.dart';
+import 'data_directory.dart';
+import '../../../pkg/unittest/unittest.dart';
runWith([Function getSubset]) {
// Initialize one locale just so we know what the list is.
diff --git a/pkg/intl/test/date_time_format_http_request_test.dart b/pkg/intl/test/date_time_format_http_request_test.dart
index be7c93e..d0b9062 100644
--- a/pkg/intl/test/date_time_format_http_request_test.dart
+++ b/pkg/intl/test/date_time_format_http_request_test.dart
@@ -7,13 +7,13 @@
* to a server.
*/
-#library('date_time_format_http_request_test');
+library date_time_format_http_request_test;
-#import('../lib/intl.dart');
-#import('../lib/date_symbol_data_http_request.dart');
-#import('date_time_format_test_core.dart');
-#import('dart:html');
-#import('../../../pkg/unittest/unittest.dart');
+import '../lib/intl.dart';
+import '../lib/date_symbol_data_http_request.dart';
+import 'date_time_format_test_core.dart';
+import 'dart:html';
+import '../../../pkg/unittest/unittest.dart';
var url = "http://localhost:9876/pkg/intl/lib/src/data/dates/";
diff --git a/pkg/intl/test/date_time_format_local_even_test.dart b/pkg/intl/test/date_time_format_local_even_test.dart
index c22967a..3516cda 100644
--- a/pkg/intl/test/date_time_format_local_even_test.dart
+++ b/pkg/intl/test/date_time_format_local_even_test.dart
@@ -9,9 +9,9 @@
* the test bots.
*/
-#library('date_time_format_test_2');
-#import('date_time_format_local_test_stub.dart');
-#import('date_time_format_test_core.dart');
+library date_time_format_test_2;
+import 'date_time_format_local_test_stub.dart';
+import 'date_time_format_test_core.dart';
main() {
runWith(evenLocales);
diff --git a/pkg/intl/test/date_time_format_local_odd_test.dart b/pkg/intl/test/date_time_format_local_odd_test.dart
index fd2d042..ef55b44 100644
--- a/pkg/intl/test/date_time_format_local_odd_test.dart
+++ b/pkg/intl/test/date_time_format_local_odd_test.dart
@@ -9,9 +9,9 @@
* the test bots.
*/
-#library('date_time_format_test_1');
-#import('date_time_format_local_test_stub.dart');
-#import('date_time_format_test_core.dart');
+library date_time_format_test_1;
+import 'date_time_format_local_test_stub.dart';
+import 'date_time_format_test_core.dart';
main() {
runWith(oddLocales);
diff --git a/pkg/intl/test/date_time_format_local_test_stub.dart b/pkg/intl/test/date_time_format_local_test_stub.dart
index 08fdd09..862832e 100644
--- a/pkg/intl/test/date_time_format_local_test_stub.dart
+++ b/pkg/intl/test/date_time_format_local_test_stub.dart
@@ -7,12 +7,12 @@
* directly in the program as a constant.
*/
-#library('date_time_format_test');
+library date_time_format_test;
-#import('../lib/intl.dart');
-#import('../lib/date_time_patterns.dart');
-#import('../lib/date_symbol_data_local.dart');
-#import('date_time_format_test_core.dart');
+import '../lib/intl.dart';
+import '../lib/date_time_patterns.dart';
+import '../lib/date_symbol_data_local.dart';
+import 'date_time_format_test_core.dart';
runWith([Function getSubset]) {
// Initialize one locale just so we know what the list is.
diff --git a/pkg/intl/test/date_time_format_test_core.dart b/pkg/intl/test/date_time_format_test_core.dart
index 36d35b9..8be3aab 100644
--- a/pkg/intl/test/date_time_format_test_core.dart
+++ b/pkg/intl/test/date_time_format_test_core.dart
@@ -8,12 +8,12 @@
* be run on its own, but rather to be imported and run from another test file.
*/
-#library('date_time_format_tests');
+library date_time_format_tests;
-#import('../../../pkg/unittest/unittest.dart');
-#import('date_time_format_test_data.dart');
-#import('../lib/intl.dart');
-#import('../lib/src/date_format_internal.dart');
+import '../../../pkg/unittest/unittest.dart';
+import 'date_time_format_test_data.dart';
+import '../lib/intl.dart';
+import '../lib/src/date_format_internal.dart';
var formatsToTest = const [
DateFormat.DAY,
@@ -258,8 +258,9 @@
// Workaround for a dartj2 issue that treats the keys as immutable
symbols = new List.from(symbols);
symbols.sort(compare);
- for (var i = 0; i < patterns.length; i++)
+ for (var i = 0; i < patterns.length; i++) {
expect(patterns[i], equals(symbols[i]));
+ }
expect(patterns.length, equals(symbols.length));
});
diff --git a/pkg/intl/test/date_time_format_test_data.dart b/pkg/intl/test/date_time_format_test_data.dart
index ee542cc..eae473c 100644
--- a/pkg/intl/test/date_time_format_test_data.dart
+++ b/pkg/intl/test/date_time_format_test_data.dart
@@ -11,7 +11,7 @@
// TODO(alanknight): Test more locales and a wider variety of test data,
// possibly by generating test data out of ICU.
-#library('date_time_format_test_data');
+library date_time_format_test_data;
var English = const {
"DAY" : "27",
diff --git a/pkg/intl/test/find_default_locale_browser_test.dart b/pkg/intl/test/find_default_locale_browser_test.dart
index b44a347..29b6523 100644
--- a/pkg/intl/test/find_default_locale_browser_test.dart
+++ b/pkg/intl/test/find_default_locale_browser_test.dart
@@ -2,11 +2,11 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-#library('find_default_locale_browser_test');
+library find_default_locale_browser_test;
-#import('../lib/intl.dart');
-#import('../lib/intl_browser.dart');
-#import('../../unittest/unittest.dart');
+import '../lib/intl.dart';
+import '../lib/intl_browser.dart';
+import '../../unittest/unittest.dart';
main() {
test("Find system locale in browser", () {
diff --git a/pkg/intl/test/find_default_locale_standalone_test.dart b/pkg/intl/test/find_default_locale_standalone_test.dart
index f0d231e..0e3a150 100644
--- a/pkg/intl/test/find_default_locale_standalone_test.dart
+++ b/pkg/intl/test/find_default_locale_standalone_test.dart
@@ -2,11 +2,11 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-#library('find_default_locale_browser_test');
+library find_default_locale_browser_test;
-#import('../lib/intl.dart');
-#import('../lib/intl_standalone.dart');
-#import('../../unittest/unittest.dart');
+import '../lib/intl.dart';
+import '../lib/intl_standalone.dart';
+import '../../unittest/unittest.dart';
main() {
test("Find system locale standalone", () {
diff --git a/pkg/intl/test/intl_message_basic_example_test.dart b/pkg/intl/test/intl_message_basic_example_test.dart
index 47c1817..3bf4ce6 100644
--- a/pkg/intl/test/intl_message_basic_example_test.dart
+++ b/pkg/intl/test/intl_message_basic_example_test.dart
@@ -5,13 +5,13 @@
/**
* Tests internationalization of messages using the basic example as a template.
*/
-#library('intl_message_test_2');
+library intl_message_test_2;
-#import('../lib/date_symbol_data_local.dart');
-#import('../lib/intl.dart');
-#import('../lib/message_lookup_local.dart');
-#import('../example/basic/basic_example.dart');
-#import('../../unittest/unittest.dart');
+import '../lib/date_symbol_data_local.dart';
+import '../lib/intl.dart';
+import '../lib/message_lookup_local.dart';
+import '../example/basic/basic_example.dart';
+import '../../unittest/unittest.dart';
List list;
diff --git a/pkg/intl/test/intl_message_test.dart b/pkg/intl/test/intl_message_test.dart
index 62ddde5..c15ee5b 100644
--- a/pkg/intl/test/intl_message_test.dart
+++ b/pkg/intl/test/intl_message_test.dart
@@ -2,11 +2,11 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-#library('intl_message_test');
+library intl_message_test;
-#import('../lib/intl.dart');
-#import('../../unittest/unittest.dart');
-#import('../lib/message_lookup_local.dart');
+import '../lib/intl.dart';
+import '../../unittest/unittest.dart';
+import '../lib/message_lookup_local.dart';
/** Tests the MessageFormat library in dart. */
diff --git a/pkg/intl/test/intl_test.dart b/pkg/intl/test/intl_test.dart
index acf959a..519497d 100644
--- a/pkg/intl/test/intl_test.dart
+++ b/pkg/intl/test/intl_test.dart
@@ -2,12 +2,12 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-#library('intl_test');
+library intl_test;
-#import('../lib/intl.dart');
+import '../lib/intl.dart';
// TODO(rnystrom): Use "package:" import when test.dart supports it (#4968).
-#import('../../unittest/unittest.dart');
-#import('../lib/date_symbol_data_local.dart');
+import '../../unittest/unittest.dart';
+import '../lib/date_symbol_data_local.dart';
main() {
test("Locale setting doesn't verify the core locale", () {
diff --git a/pkg/intl/test/number_format_test.dart b/pkg/intl/test/number_format_test.dart
index 2504ae9..b0baf21 100644
--- a/pkg/intl/test/number_format_test.dart
+++ b/pkg/intl/test/number_format_test.dart
@@ -4,11 +4,11 @@
* BSD-style license that can be found in the LICENSE file.
*/
-#library('number_format_test');
+library number_format_test;
-#import('../../../pkg/unittest/unittest.dart');
-#import('../lib/number_format.dart');
-#import('../lib/intl.dart');
+import '../../../pkg/unittest/unittest.dart';
+import '../lib/number_format.dart';
+import '../lib/intl.dart';
/**
* Tests the Numeric formatting library in dart.
diff --git a/pkg/intl/tool/generate_locale_data_files.dart b/pkg/intl/tool/generate_locale_data_files.dart
index 6cec6ac..81521f9 100644
--- a/pkg/intl/tool/generate_locale_data_files.dart
+++ b/pkg/intl/tool/generate_locale_data_files.dart
@@ -12,13 +12,13 @@
* which is sourced by the date_symbol_data... files.
*/
-#import('../lib/date_symbols.dart');
-#import('../lib/date_symbol_data_local.dart');
-#import('../lib/date_time_patterns.dart');
-#import('../lib/intl.dart');
-#import('dart:io');
-#import('dart:json');
-#import('../test/data_directory.dart');
+import '../lib/date_symbols.dart';
+import '../lib/date_symbol_data_local.dart';
+import '../lib/date_time_patterns.dart';
+import '../lib/intl.dart';
+import 'dart:io';
+import 'dart:json';
+import '../test/data_directory.dart';
main() {
initializeDateFormatting("en_IGNORED", null);
@@ -72,6 +72,6 @@
outputStream.close();
}
-void writeToJSON(Dynamic data, OutputStream out) {
+void writeToJSON(dynamic data, OutputStream out) {
out.writeString(JSON.stringify(data.serializeToMap()));
}
\ No newline at end of file
diff --git a/pkg/logging/test/logging_test.dart b/pkg/logging/test/logging_test.dart
index e975dbd..a3e1cd5d 100644
--- a/pkg/logging/test/logging_test.dart
+++ b/pkg/logging/test/logging_test.dart
@@ -12,21 +12,21 @@
main() {
test('level comparison is a valid comparator', () {
var level1 = const Level('NOT_REAL1', 253);
- expect(level1 == level1);
- expect(level1 <= level1);
- expect(level1 >= level1);
+ expect(level1 == level1, isTrue);
+ expect(level1 <= level1, isTrue);
+ expect(level1 >= level1, isTrue);
expect(level1 < level1, isFalse);
expect(level1 > level1, isFalse);
var level2 = const Level('NOT_REAL2', 455);
- expect(level1 <= level2);
- expect(level1 < level2);
- expect(level2 >= level1);
- expect(level2 > level1);
+ expect(level1 <= level2, isTrue);
+ expect(level1 < level2, isTrue);
+ expect(level2 >= level1, isTrue);
+ expect(level2 > level1, isTrue);
var level3 = const Level('NOT_REAL3', 253);
- expect(level1 !== level3); // different instances
- expect(level1 == level3); // same value.
+ expect(level1 !== level3, isTrue); // different instances
+ expect(level1 == level3, isTrue); // same value.
});
test('default levels are in order', () {
@@ -37,7 +37,7 @@
for (int i = 0; i < levels.length; i++) {
for (int j = i + 1; j < levels.length; j++) {
- expect(levels[i] < levels[j]);
+ expect(levels[i] < levels[j], isTrue);
}
}
});
@@ -91,10 +91,10 @@
Logger a = new Logger('a');
Logger b = new Logger('a.b');
Logger c = new Logger('a.c');
- expect(a == b.parent);
- expect(a == c.parent);
- expect(a.children['b'] == b);
- expect(a.children['c'] == c);
+ expect(a == b.parent, isTrue);
+ expect(a == c.parent, isTrue);
+ expect(a.children['b'] == b, isTrue);
+ expect(a.children['c'] == c, isTrue);
});
test('loggers are singletons', () {
@@ -102,10 +102,10 @@
Logger a2 = new Logger('a');
Logger b = new Logger('a.b');
Logger root = Logger.root;
- expect(a1 === a2);
- expect(a1 === b.parent);
- expect(root === a1.parent);
- expect(root === new Logger(''));
+ expect(a1 === a2, isTrue);
+ expect(a1 === b.parent, isTrue);
+ expect(root === a1.parent, isTrue);
+ expect(root === new Logger(''), isTrue);
});
group('mutating levels', () {
@@ -172,12 +172,12 @@
c.level = Level.ALL;
e.level = Level.OFF;
- expect(root.isLoggable(Level.SHOUT));
- expect(root.isLoggable(Level.SEVERE));
- expect(!root.isLoggable(Level.WARNING));
- expect(c.isLoggable(Level.FINEST));
- expect(c.isLoggable(Level.FINE));
- expect(!e.isLoggable(Level.SHOUT));
+ expect(root.isLoggable(Level.SHOUT), isTrue);
+ expect(root.isLoggable(Level.SEVERE), isTrue);
+ expect(root.isLoggable(Level.WARNING), isFalse);
+ expect(c.isLoggable(Level.FINEST), isTrue);
+ expect(c.isLoggable(Level.FINE), isTrue);
+ expect(!e.isLoggable(Level.SHOUT), isTrue);
});
test('add/remove handlers - no hierarchy', () {
diff --git a/pkg/pkg.status b/pkg/pkg.status
index 9c6ef9a..4d2c5e5 100644
--- a/pkg/pkg.status
+++ b/pkg/pkg.status
@@ -4,7 +4,7 @@
# Run this test manually to verify that the fixnum library produces
# the same results as native ints on a set of directed and random inputs.
-# Skip it when runnimng automated tests because it times out. This
+# Skip it when running automated tests because it times out. This
# test only makes sense on runtimes that support 64-bit integer
# arithmetic natively, i.e., the VM.
fixnum/test/int_64_vm_test: Skip
@@ -26,11 +26,23 @@
[ $runtime == vm ]
intl/test/find_default_locale_browser_test: Skip
intl/test/date_time_format_http_request_test: Skip
+unittest/test/mock_test: Fail # noSuchMethod InvocationMirror not correct yet.
-# Skip http request tests on Dartium while resolving an odd
-# error there that causes the tests to timeout.
-[ $runtime == dartium || $runtime == drt ]
-intl/test/date_time_format_http_request_test: Skip
+# Skip http request tests on Dartium while resolving an odd
+# error there that causes the tests to timeout.
+[ $runtime == dartium || $runtime == drt ]
+intl/test/date_time_format_http_request_test: Skip
+
+[ $runtime == drt && $compiler == none ]
+intl/test/bidi_format_test: Fail # New import syntax is not supported by test frameowrk
+intl/test/bidi_utils_test: Fail # New import syntax is not supported by test frameowrk
+intl/test/date_time_format_local_even_test: Fail # New import syntax is not supported by test frameowrk
+intl/test/date_time_format_local_odd_test: Fail # New import syntax is not supported by test frameowrk
+intl/test/find_default_locale_browser_test: Fail # New import syntax is not supported by test frameowrk
+intl/test/intl_message_basic_example_test: Fail # New import syntax is not supported by test frameowrk
+intl/test/intl_message_test: Fail # New import syntax is not supported by test frameowrk
+intl/test/intl_test: Fail # New import syntax is not supported by test frameowrk
+intl/test/number_format_test: Fail # New import syntax is not supported by test frameowrk
# Skip intl_message tests that use mirrors on dart2js until it's been
# implemented there.
@@ -42,9 +54,17 @@
unittest/test/mock_regexp_negative_test: Fail
unittest/test/mock_stepwise_negative_test: Fail
+# pkg issue 6340
+fixnum/test/int_32_test: Fail, OK
+fixnum/test/int_64_test: Fail, OK
+unittest/test/matchers_test: Fail, OK
+
+
[ $compiler == dart2js || $compiler == dartc ]
unittest/test/instance_test: Skip
[ $compiler == none && $runtime == drt ]
dartdoc/test/dartdoc_test: Skip # See dartbug.com/4541.
+[ $compiler == none && ($runtime == dartium || $runtime == drt) ]
+unittest/test/mock_test: Fail
diff --git a/pkg/unittest/collection_matchers.dart b/pkg/unittest/collection_matchers.dart
index 9fe854f..4f8de3b 100644
--- a/pkg/unittest/collection_matchers.dart
+++ b/pkg/unittest/collection_matchers.dart
@@ -6,6 +6,9 @@
* Returns a matcher which matches [Collection]s in which all elements
* match the given [matcher].
*/
+
+part of unittest;
+
Matcher everyElement(matcher) => new _EveryElement(wrapMatcher(matcher));
class _EveryElement extends _CollectionMatcher {
diff --git a/pkg/unittest/config.dart b/pkg/unittest/config.dart
index 5a8b4bc..5dda552 100644
--- a/pkg/unittest/config.dart
+++ b/pkg/unittest/config.dart
@@ -2,7 +2,7 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-/** This file is sourced by unitest.dart. */
+part of unittest;
/**
* Hooks to configure the unittest library for different platforms. This class
@@ -10,6 +10,7 @@
* advantage of the platform can create a subclass and override methods from
* this class.
*/
+
class Configuration {
TestCase currentTestCase = null;
diff --git a/pkg/unittest/core_matchers.dart b/pkg/unittest/core_matchers.dart
index a84db59..fc40400 100644
--- a/pkg/unittest/core_matchers.dart
+++ b/pkg/unittest/core_matchers.dart
@@ -2,6 +2,7 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+part of unittest;
/**
* Returns a matcher that matches empty strings, maps or collections.
@@ -215,6 +216,11 @@
* Type wrapper; e.g.:
*
* expect(bar, new isInstanceOf<Foo>('Foo'));
+ *
+ * Note that this does not currently work in dart2js; it will
+ * match any type, and isNot(new isInstanceof<T>()) will always
+ * fail. This is because dart2js currently ignores template type
+ * parameters.
*/
class isInstanceOf<T> extends BaseMatcher {
final String _name;
@@ -280,7 +286,7 @@
// completes.
item.onComplete(expectAsync1((future) {
if (future.hasValue) {
- expect(false, isTrue,
+ expect(false, isTrue, reason:
"Expected future to fail, but succeeded with '${future.value}'.");
} else if (_matcher != null) {
var reason;
@@ -289,7 +295,7 @@
stackTrace = " ${stackTrace.replaceAll("\n", "\n ")}";
reason = "Actual exception trace:\n$stackTrace";
}
- expect(future.exception, _matcher, reason);
+ expect(future.exception, _matcher, reason: reason);
}
}));
@@ -393,9 +399,9 @@
* for each exception type.
*/
-abstract class ExceptionMatcher extends BaseMatcher {
+abstract class TypeMatcher extends BaseMatcher {
final String _name;
- const ExceptionMatcher(this._name);
+ const TypeMatcher(this._name);
Description describe(Description description) =>
description.add(_name);
}
@@ -403,11 +409,11 @@
/** A matcher for FormatExceptions. */
const isFormatException = const _FormatException();
-/** A matcher for functions that throw FormatException */
+/** A matcher for functions that throw FormatException. */
const Matcher throwsFormatException =
const Throws(isFormatException);
-class _FormatException extends ExceptionMatcher {
+class _FormatException extends TypeMatcher {
const _FormatException() : super("FormatException");
bool matches(item, MatchState matchState) => item is FormatException;
}
@@ -415,10 +421,10 @@
/** A matcher for Exceptions. */
const isException = const _Exception();
-/** A matcher for functions that throw Exception */
+/** A matcher for functions that throw Exception. */
const Matcher throwsException = const Throws(isException);
-class _Exception extends ExceptionMatcher {
+class _Exception extends TypeMatcher {
const _Exception() : super("Exception");
bool matches(item, MatchState matchState) => item is Exception;
}
@@ -426,11 +432,11 @@
/** A matcher for ArgumentErrors. */
const isArgumentError = const _ArgumentError();
-/** A matcher for functions that throw ArgumentError */
+/** A matcher for functions that throw ArgumentError. */
const Matcher throwsArgumentError =
const Throws(isArgumentError);
-class _ArgumentError extends ExceptionMatcher {
+class _ArgumentError extends TypeMatcher {
const _ArgumentError() : super("ArgumentError");
bool matches(item, MatchState matchState) => item is ArgumentError;
}
@@ -438,35 +444,35 @@
/** A matcher for IllegalJSRegExpExceptions. */
const isIllegalJSRegExpException = const _IllegalJSRegExpException();
-/** A matcher for functions that throw IllegalJSRegExpException */
+/** A matcher for functions that throw IllegalJSRegExpException. */
const Matcher throwsIllegalJSRegExpException =
const Throws(isIllegalJSRegExpException);
-class _IllegalJSRegExpException extends ExceptionMatcher {
+class _IllegalJSRegExpException extends TypeMatcher {
const _IllegalJSRegExpException() : super("IllegalJSRegExpException");
bool matches(item, MatchState matchState) => item is IllegalJSRegExpException;
}
-/** A matcher for IndexOutOfRangeExceptions. */
-const isIndexOutOfRangeException = const _IndexOutOfRangeException();
+/** A matcher for RangeErrors. */
+const isRangeError = const _RangeError();
-/** A matcher for functions that throw IndexOutOfRangeException */
-const Matcher throwsIndexOutOfRangeException =
- const Throws(isIndexOutOfRangeException);
+/** A matcher for functions that throw RangeError */
+const Matcher throwsRangeError =
+ const Throws(isRangeError);
-class _IndexOutOfRangeException extends ExceptionMatcher {
- const _IndexOutOfRangeException() : super("IndexOutOfRangeException");
- bool matches(item, MatchState matchState) => item is IndexOutOfRangeException;
+class _RangeError extends TypeMatcher {
+ const _RangeError() : super("RangeError");
+ bool matches(item, MatchState matchState) => item is RangeError;
}
/** A matcher for NoSuchMethodErrors. */
const isNoSuchMethodError = const _NoSuchMethodError();
-/** A matcher for functions that throw NoSuchMethodError */
+/** A matcher for functions that throw NoSuchMethodError. */
const Matcher throwsNoSuchMethodError =
const Throws(isNoSuchMethodError);
-class _NoSuchMethodError extends ExceptionMatcher {
+class _NoSuchMethodError extends TypeMatcher {
const _NoSuchMethodError() : super("NoSuchMethodError");
bool matches(item, MatchState matchState) => item is NoSuchMethodError;
}
@@ -474,11 +480,11 @@
/** A matcher for NotImplementedExceptions. */
const isNotImplementedException = const _NotImplementedException();
-/** A matcher for functions that throw Exception */
+/** A matcher for functions that throw Exception. */
const Matcher throwsNotImplementedException =
const Throws(isNotImplementedException);
-class _NotImplementedException extends ExceptionMatcher {
+class _NotImplementedException extends TypeMatcher {
const _NotImplementedException() : super("NotImplementedException");
bool matches(item, MatchState matchState) => item is NotImplementedException;
}
@@ -486,27 +492,41 @@
/** A matcher for NullPointerExceptions. */
const isNullPointerException = const _NullPointerException();
-/** A matcher for functions that throw NotNullPointerException */
+/** A matcher for functions that throw NotNullPointerException. */
const Matcher throwsNullPointerException =
const Throws(isNullPointerException);
-class _NullPointerException extends ExceptionMatcher {
+class _NullPointerException extends TypeMatcher {
const _NullPointerException() : super("NullPointerException");
bool matches(item, MatchState matchState) => item is NullPointerException;
}
-/** A matcher for UnsupportedErrors. */
+/** A matcher for UnsupportedError. */
const isUnsupportedError = const _UnsupportedError();
-/** A matcher for functions that throw UnsupportedError */
-const Matcher throwsUnsupportedError =
- const Throws(isUnsupportedError);
+/** A matcher for functions that throw UnsupportedError. */
+const Matcher throwsUnsupportedError = const Throws(isUnsupportedError);
-class _UnsupportedError extends ExceptionMatcher {
+class _UnsupportedError extends TypeMatcher {
const _UnsupportedError() :
super("UnsupportedError");
- bool matches(item, MatchState matchState) =>
- item is UnsupportedError;
+ bool matches(item, MatchState matchState) => item is UnsupportedError;
+}
+
+/** A matcher for Map types. */
+const isMap = const _IsMap();
+
+class _IsMap extends TypeMatcher {
+ const _IsMap() : super("Map");
+ bool matches(item, MatchState matchState) => item is Map;
+}
+
+/** A matcher for List types. */
+const isList = const _IsList();
+
+class _IsList extends TypeMatcher {
+ const _IsList() : super("List");
+ bool matches(item, MatchState matchState) => item is List;
}
/**
@@ -610,7 +630,7 @@
* Returns a matcher that uses an arbitrary function that returns
* true or false for the actual value.
*/
-Matcher predicate(f, {description: 'satisfies function'}) =>
+Matcher predicate(f, [description ='satisfies function']) =>
new _Predicate(f, description);
class _Predicate extends BaseMatcher {
@@ -647,7 +667,7 @@
*
* expect(inventoryItem, new HasPrice(greaterThan(0)));
*/
-abstract class CustomMatcher extends BaseMatcher {
+class CustomMatcher extends BaseMatcher {
final String _featureDescription;
final String _featureName;
final Matcher _matcher;
@@ -655,8 +675,8 @@
const CustomMatcher(this._featureDescription, this._featureName,
this._matcher);
- /** Implement this to extract the interesting feature.*/
- featureValueOf(actual);
+ /** Override this to extract the interesting feature.*/
+ featureValueOf(actual) => actual;
bool matches(item, MatchState matchState) {
var f = featureValueOf(item);
diff --git a/pkg/unittest/description.dart b/pkg/unittest/description.dart
index 7b9f023..6652e6b 100644
--- a/pkg/unittest/description.dart
+++ b/pkg/unittest/description.dart
@@ -7,6 +7,8 @@
* could be supported.
*/
+part of unittest;
+
class StringDescription implements Description {
var _out;
diff --git a/pkg/unittest/expect.dart b/pkg/unittest/expect.dart
index 4ef7a56..1269493 100644
--- a/pkg/unittest/expect.dart
+++ b/pkg/unittest/expect.dart
@@ -2,14 +2,13 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+part of unittest;
+
/**
* This is the main assertion function. It asserts that [actual]
- * matches the [matcher]. [matcher] is optional and defaults to isTrue,
- * so expect can be used with a single predicate argument. [reason]
- * is optional and is typically not supplied if a reasonable matcher is
- * explicitly provided, as a reason can be generated from the matcher.
- * If [reason] is included it is appended to the reason generated
- * by the matcher.
+ * matches the [matcher]. [reason] is optional and is typically not
+ * supplied, as a reason is generated from the matcher; if [reason]
+ * is included it is appended to the reason generated by the matcher.
*
* [matcher] can be a value in which case it will be wrapped in an
* [equals] matcher.
@@ -33,9 +32,8 @@
* [Hamcrest] http://code.google.com/p/hamcrest/
* [dart-matchers] https://github.com/Ladicek/dart-matchers
*/
-void expect(actual, [matcher = isTrue, String reason = null,
- FailureHandler failureHandler = null,
- bool verbose = false]) {
+void expect(actual, matcher, {String reason, FailureHandler failureHandler,
+ bool verbose : false}) {
matcher = wrapMatcher(matcher);
bool doesMatch;
var matchState = new MatchState();
diff --git a/pkg/unittest/future_matchers.dart b/pkg/unittest/future_matchers.dart
index c72037e..87d30f2 100644
--- a/pkg/unittest/future_matchers.dart
+++ b/pkg/unittest/future_matchers.dart
@@ -11,6 +11,9 @@
* To test that a Future completes with an exception, you can use [throws] and
* [throwsA].
*/
+
+part of unittest;
+
Matcher completes = const _Completes(null);
/**
@@ -41,7 +44,7 @@
reason = '$reason\nStack trace:\n$stackTrace';
}
- expect(future.hasValue, isTrue, reason);
+ expect(future.hasValue, isTrue, reason: reason);
if (_matcher != null) expect(future.value, _matcher);
}));
diff --git a/pkg/unittest/html_config.dart b/pkg/unittest/html_config.dart
index ffac7f5..e7a5dbd 100644
--- a/pkg/unittest/html_config.dart
+++ b/pkg/unittest/html_config.dart
@@ -5,7 +5,7 @@
/**
* A simple unit test library for running tests in a browser.
*/
-#library('unittest');
+#library('unittest_html_config');
#import('dart:html');
#import('unittest.dart');
diff --git a/pkg/unittest/html_enhanced_config.dart b/pkg/unittest/html_enhanced_config.dart
index af88f4b..65d0e47 100644
--- a/pkg/unittest/html_enhanced_config.dart
+++ b/pkg/unittest/html_enhanced_config.dart
@@ -8,7 +8,7 @@
* Provides enhanced HTML output with collapsible group headers
* and other at-a-glance information about the test results.
*/
-#library('unittest');
+#library('unittest_html_enhanced_config');
#import('dart:html');
#import('unittest.dart');
diff --git a/pkg/unittest/interactive_html_config.dart b/pkg/unittest/interactive_html_config.dart
index 3780ea1..f8f3a81 100644
--- a/pkg/unittest/interactive_html_config.dart
+++ b/pkg/unittest/interactive_html_config.dart
@@ -9,7 +9,7 @@
* config that manages all the tests, and a 'child' config for the
* IFrame that runs the individual tests.
*/
-#library('interactive_config');
+#library('unittest_interactive_html_config');
// TODO(gram) - add options for: remove IFrame on done/keep
// IFrame for failed tests/keep IFrame for all tests.
diff --git a/pkg/unittest/interfaces.dart b/pkg/unittest/interfaces.dart
index 5423efa..42c498b 100644
--- a/pkg/unittest/interfaces.dart
+++ b/pkg/unittest/interfaces.dart
@@ -13,6 +13,9 @@
* is replaced it may be desirable to replace the [stringDescription]
* error formatter with another.
*/
+
+part of unittest;
+
typedef String ErrorFormatter(actual, Matcher matcher, String reason,
MatchState matchState, bool verbose);
@@ -25,19 +28,19 @@
*/
abstract class Description {
/** Change the value of the description. */
- abstract Description replace(String text);
+ Description replace(String text);
/** This is used to add arbitrary text to the description. */
- abstract Description add(String text);
+ Description add(String text);
/** This is used to add a meaningful description of a value. */
- abstract Description addDescriptionOf(value);
+ Description addDescriptionOf(value);
/**
* This is used to add a description of an [Iterable] [list],
* with appropriate [start] and [end] markers and inter-element [separator].
*/
- abstract Description addAll(String start, String separator, String end,
+ Description addAll(String start, String separator, String end,
Iterable list);
}
@@ -56,10 +59,10 @@
* and may be used to add details about the mismatch that are too
* costly to determine in [describeMismatch].
*/
- abstract bool matches(item, MatchState matchState);
+ bool matches(item, MatchState matchState);
/** This builds a textual description of the matcher. */
- abstract Description describe(Description description);
+ Description describe(Description description);
/**
* This builds a textual description of a specific mismatch. [item]
@@ -71,7 +74,7 @@
* information that is not typically included but can be of help in
* diagnosing failures, such as stack traces.
*/
- abstract Description describeMismatch(item, Description mismatchDescription,
+ Description describeMismatch(item, Description mismatchDescription,
MatchState matchState, bool verbose);
}
@@ -83,7 +86,7 @@
*/
abstract class FailureHandler {
/** This handles failures given a textual decription */
- abstract void fail(String reason);
+ void fail(String reason);
/**
* This handles failures given the actual [value], the [matcher]
@@ -93,7 +96,7 @@
* these to create a detailed error message (typically by calling
* an [ErrorFormatter]) and then call [fail] with this message.
*/
- abstract void failMatch(actual, Matcher matcher, String reason,
+ void failMatch(actual, Matcher matcher, String reason,
MatchState matchState, bool verbose);
}
diff --git a/pkg/unittest/map_matchers.dart b/pkg/unittest/map_matchers.dart
index 96edb34..e4b40ba 100644
--- a/pkg/unittest/map_matchers.dart
+++ b/pkg/unittest/map_matchers.dart
@@ -5,6 +5,9 @@
/**
* Returns a matcher which matches maps containing the given [value].
*/
+
+part of unittest;
+
Matcher containsValue(value) => new _ContainsValue(value);
class _ContainsValue extends BaseMatcher {
diff --git a/pkg/unittest/matcher.dart b/pkg/unittest/matcher.dart
index 1f910f0..1c430f1 100644
--- a/pkg/unittest/matcher.dart
+++ b/pkg/unittest/matcher.dart
@@ -13,6 +13,9 @@
* state, if set, will typically be a [Map] with a number of key-value
* pairs containing relevant state information.
*/
+
+part of unittest;
+
class MatchState {
var state = null;
@@ -35,13 +38,13 @@
* [matchState] may be used to return additional info for
* the use of [describeMismatch].
*/
- abstract bool matches(item, MatchState matchState);
+ bool matches(item, MatchState matchState);
/**
* Creates a textual description of a matcher,
* by appending to [mismatchDescription].
*/
- abstract Description describe(Description mismatchDescription);
+ Description describe(Description mismatchDescription);
/**
* Generates a description of the matcher failed for a particular
diff --git a/pkg/unittest/mock.dart b/pkg/unittest/mock.dart
index dd2ae53..f0f5765 100644
--- a/pkg/unittest/mock.dart
+++ b/pkg/unittest/mock.dart
@@ -2,6 +2,8 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+part of unittest;
+
/**
* The error formatter for mocking is a bit different from the default one
* for unit testing; instead of the third argument being a 'reason'
@@ -432,7 +434,7 @@
_mockFailureHandler =
new _MockFailureHandler(getOrCreateExpectFailureHandler());
}
- expect(logs, matcher, filter, _mockFailureHandler);
+ expect(logs, matcher, reason:filter, failureHandler: _mockFailureHandler);
return this;
}
@@ -1274,10 +1276,17 @@
* return value. If we find no [Behavior] to apply an exception is
* thrown.
*/
- noSuchMethod(String method, List args) {
- if (method.startsWith('get:')) {
- method = 'get ${method.substring(4)}';
+ noSuchMethod(InvocationMirror invocation) {
+ String method = invocation.memberName;
+ // Remove this when InvocationMirror works correctly.
+ if (method.startsWith("get:")) method = method.substring(4);
+
+ if (invocation.isGetter) {
+ method = 'get $method';
}
+ List args = invocation.positionalArguments;
+ // TODO: Handle named arguments too.
+
bool matchedMethodName = false;
MatchState matchState = new MatchState();
for (String k in _behaviors.keys) {
diff --git a/pkg/unittest/numeric_matchers.dart b/pkg/unittest/numeric_matchers.dart
index 3093a1e..bb4cb96 100644
--- a/pkg/unittest/numeric_matchers.dart
+++ b/pkg/unittest/numeric_matchers.dart
@@ -6,6 +6,9 @@
* Returns a matcher which matches if the match argument is greater
* than the given [value].
*/
+
+part of unittest;
+
Matcher greaterThan(value) =>
new _OrderingComparison(value, false, false, true, 'a value greater than');
diff --git a/pkg/unittest/operator_matchers.dart b/pkg/unittest/operator_matchers.dart
index 5295500..183be06 100644
--- a/pkg/unittest/operator_matchers.dart
+++ b/pkg/unittest/operator_matchers.dart
@@ -2,6 +2,8 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+part of unittest;
+
/**
* This returns a matcher that inverts [matcher] to its logical negation.
*/
diff --git a/pkg/unittest/string_matchers.dart b/pkg/unittest/string_matchers.dart
index 40fe5a0..8899379 100644
--- a/pkg/unittest/string_matchers.dart
+++ b/pkg/unittest/string_matchers.dart
@@ -6,6 +6,9 @@
* Returns a matcher which matches if the match argument is a string and
* is equal to [value] when compared case-insensitively.
*/
+
+part of unittest;
+
Matcher equalsIgnoringCase(String value) => new _IsEqualIgnoringCase(value);
class _IsEqualIgnoringCase extends _StringMatcher {
@@ -127,6 +130,7 @@
* For example, `stringContainsInOrder(["a", "e", "i", "o", "u"])` will match
* "abcdefghijklmnopqrstuvwxyz".
*/
+
Matcher stringContainsInOrder(substrings) =>
new _StringContainsInOrder(substrings);
diff --git a/pkg/unittest/test/matchers_test.dart b/pkg/unittest/test/matchers_test.dart
index 9736c75..fe400f0 100644
--- a/pkg/unittest/test/matchers_test.dart
+++ b/pkg/unittest/test/matchers_test.dart
@@ -125,14 +125,14 @@
"IllegalJSRegExpException.");
});
- test('throwsIndexOutOfRangeException', () {
- shouldPass(() { throw new IndexOutOfRangeException(0); },
- throwsIndexOutOfRangeException);
+ test('throwsRangeError', () {
+ shouldPass(() { throw new RangeError.value(0); },
+ throwsRangeError);
shouldFail(() { throw new Exception(); },
- throwsIndexOutOfRangeException,
- "Expected: throws an exception which matches IndexOutOfRangeException "
+ throwsRangeError,
+ "Expected: throws an exception which matches RangeError "
"but: exception <Exception> does not match "
- "IndexOutOfRangeException.");
+ "RangeError.");
});
test('throwsNoSuchMethodError', () {
@@ -170,8 +170,7 @@
throwsUnsupportedError);
shouldFail(() { throw new Exception(); },
throwsUnsupportedError,
- "Expected: throws an exception which matches "
- "UnsupportedError "
+ "Expected: throws an exception which matches UnsupportedError "
"but: exception <Exception> does not match "
"UnsupportedError.");
});
@@ -527,11 +526,9 @@
group('Predicate Matchers', () {
test('isInstanceOf', () {
- shouldFail(0, predicate((x) => x is String,
- description: "an instance of String"),
+ shouldFail(0, predicate((x) => x is String, "an instance of String"),
"Expected: an instance of String but: was <0>.");
- shouldPass('cow', predicate((x) => x is String,
- description: "an instance of String"));
+ shouldPass('cow', predicate((x) => x is String, "an instance of String"));
});
});
diff --git a/pkg/unittest/test/unittest_test.dart b/pkg/unittest/test/unittest_test.dart
index ba85f39..ecf6c89 100644
--- a/pkg/unittest/test/unittest_test.dart
+++ b/pkg/unittest/test/unittest_test.dart
@@ -133,8 +133,8 @@
test('testOne', () {
var f = expectAsync0(() {});
_defer(protectAsync0(() {
- _defer(protectAsync0(() => expect(false)));
- expect(false);
+ _defer(protectAsync0(() => expect(false, isTrue)));
+ expect(false, isTrue);
}));
});
test('testTwo', () {
diff --git a/pkg/unittest/test_case.dart b/pkg/unittest/test_case.dart
index f39d045..bf4f1a2 100644
--- a/pkg/unittest/test_case.dart
+++ b/pkg/unittest/test_case.dart
@@ -8,6 +8,9 @@
*/
/** Summarizes information about a single test case. */
+
+part of unittest;
+
class TestCase {
/** Identifier for this test. */
final int id;
diff --git a/pkg/unittest/test_controller.js b/pkg/unittest/test_controller.js
index 2f46fe1..94c9f2f 100644
--- a/pkg/unittest/test_controller.js
+++ b/pkg/unittest/test_controller.js
@@ -7,6 +7,17 @@
* DumpRenderTree.
*/
+// Clear the console before every test run - this is Firebug specific code.
+if (typeof console == "object" && typeof console.clear == "function") {
+ console.clear();
+}
+// Set window onerror to make sure that we catch test harness errors across all
+// browsers.
+window.onerror = function (message, url, lineNumber) {
+ showErrorAndExit("\n\n" + url + ":" + lineNumber + ":\n" + message + "\n\n");
+ window.postMessage('unittest-suite-external-error', '*');
+};
+
if (navigator.webkitStartDart) {
navigator.webkitStartDart();
}
diff --git a/pkg/unittest/unittest.dart b/pkg/unittest/unittest.dart
index 29a18c8..4f7bdf0 100644
--- a/pkg/unittest/unittest.dart
+++ b/pkg/unittest/unittest.dart
@@ -5,8 +5,18 @@
/**
* A library for writing dart unit tests.
*
- * To import this library, specify the relative path to
- * pkg/unittest/unittest.dart.
+ * To import this library, use the pub package manager.
+ * Create a pubspec.yaml file in your project and add
+ * a dependency on unittest with the following lines:
+ * dependencies:
+ * unittest:
+ * sdk: unittest
+ *
+ * Then run 'pub install' from your project directory or using
+ * the DartEditor.
+ *
+ * Please see [Pub Getting Started](http://pub.dartlang.org/doc)
+ * for more details about the pub package manager.
*
* ##Concepts##
*
@@ -24,7 +34,7 @@
*
* A trivial test:
*
- * #import('path-to-dart/pkg/unittest/unitest.dart');
+ * import 'package:unittest/unittest.dart';
* main() {
* test('this is a test', () {
* int x = 2 + 3;
@@ -34,7 +44,7 @@
*
* Multiple tests:
*
- * #import('path-to-dart/pkg/unittest/unitest.dart');
+ * import 'package:unittest/unittest.dart';
* main() {
* test('this is a test', () {
* int x = 2 + 3;
@@ -48,7 +58,7 @@
*
* Multiple tests, grouped by category:
*
- * #import('path-to-dart/pkg/unittest/unitest.dart');
+ * import 'package:unittest/unittest.dart';
* main() {
* group('group A', () {
* test('test A.1', () {
@@ -74,25 +84,25 @@
* that callback is run. A count argument can be provided to specify the number
* of times the callback should be called (the default is 1).
*
- * #import('path-to-dart/pkg/unittest/unitest.dart');
- * #import('dart:html');
+ * import 'package:unittest/unittest.dart';
+ * import 'dart:isolate';
* main() {
- * test('calllback is executed once', () {
+ * test('callback is executed once', () {
* // wrap the callback of an asynchronous call with [expectAsync0] if
* // the callback takes 0 arguments...
- * window.setTimeout(expectAsync0(() {
+ * var timer = new Timer(0, (_) => expectAsync0(() {
* int x = 2 + 3;
* expect(x, equals(5));
- * }), 0);
+ * }));
* });
*
- * test('calllback is executed twice', () {
- * var callback = expectAsync0(() {
+ * test('callback is executed twice', () {
+ * var callback = (_) => expectAsync0(() {
* int x = 2 + 3;
* expect(x, equals(5));
* }, count: 2); // <-- we can indicate multiplicity to [expectAsync0]
- * window.setTimeout(callback, 0);
- * window.setTimeout(callback, 0);
+ * new Timer(0, callback);
+ * new Timer(0, callback);
* });
* }
*
@@ -115,43 +125,44 @@
* arguments or that take named parameters. (this is not implemented yet,
* but will be coming here soon).
*
- * #import('path-to-dart/pkg/unittest/unitest.dart');
- * #import('dart:html');
+ * import 'package:unittest/unittest.dart';
+ * import 'dart:isolate';
* main() {
- * test('calllback is executed', () {
+ * test('callback is executed', () {
* // indicate ahead of time that an async callback is expected.
* var async = startAsync();
- * window.setTimeout(() {
+ * new Timer(0, (_) {
* // Guard the body of the callback, so errors are propagated
- * // correctly
+ * // correctly.
* guardAsync(() {
* int x = 2 + 3;
* expect(x, equals(5));
* });
* // indicate that the asynchronous callback was invoked.
* async.complete();
- * }), 0);
+ * });
* });
+ * }
*
*/
-#library('unittest');
+library unittest;
-#import('dart:isolate');
+import 'dart:isolate';
-#source('collection_matchers.dart');
-#source('config.dart');
-#source('core_matchers.dart');
-#source('description.dart');
-#source('expect.dart');
-#source('future_matchers.dart');
-#source('interfaces.dart');
-#source('map_matchers.dart');
-#source('matcher.dart');
-#source('mock.dart');
-#source('numeric_matchers.dart');
-#source('operator_matchers.dart');
-#source('string_matchers.dart');
-#source('test_case.dart');
+part 'collection_matchers.dart';
+part 'config.dart';
+part 'core_matchers.dart';
+part 'description.dart';
+part 'expect.dart';
+part 'future_matchers.dart';
+part 'interfaces.dart';
+part 'map_matchers.dart';
+part 'matcher.dart';
+part 'mock.dart';
+part 'numeric_matchers.dart';
+part 'operator_matchers.dart';
+part 'string_matchers.dart';
+part 'test_case.dart';
/** [Configuration] used by the unittest library. */
Configuration _config = null;
@@ -366,7 +377,7 @@
_after() {
if (_isDone()) {
- _handleCallbackFunctionComplete();
+ _handleCallbackFunctionComplete(_testNum);
}
}
@@ -635,7 +646,7 @@
* Called when one of the callback functions is done with all expected
* calls.
*/
-void _handleCallbackFunctionComplete() {
+void _handleCallbackFunctionComplete(testNum) {
// TODO (gram): we defer this to give the nextBatch recursive
// stack a chance to unwind. This is a temporary hack but
// really a bunch of code here needs to be fixed. We have a
@@ -643,6 +654,12 @@
// which is recursively invoked in the case of async tests that
// run synchronously. Bad things can then happen.
_defer(() {
+ if (_currentTest != testNum) {
+ if (_tests[testNum].result == PASS) {
+ _tests[testNum].error("Unexpected extra callbacks", '');
+ }
+ return; // Extraneous callback.
+ }
if (_currentTest < _tests.length) {
final testCase = _tests[_currentTest];
--testCase.callbackFunctionsOutstanding;
@@ -672,7 +689,7 @@
* TODO(gram) remove this when WebKit tests are working with new framework
*/
void callbackDone() {
- _handleCallbackFunctionComplete();
+ _handleCallbackFunctionComplete(_currentTest);
}
/**
diff --git a/pkg/unittest/vm_config.dart b/pkg/unittest/vm_config.dart
index 73bfc0e..e77f293 100644
--- a/pkg/unittest/vm_config.dart
+++ b/pkg/unittest/vm_config.dart
@@ -5,7 +5,7 @@
/**
* A simple unit test library for running tests on the VM.
*/
-#library('unittest');
+#library('unittest_vm_config');
#import('dart:io');
#import('unittest.dart');
diff --git a/runtime/bin/bin.gypi b/runtime/bin/bin.gypi
index 4aff04b..c851c97 100644
--- a/runtime/bin/bin.gypi
+++ b/runtime/bin/bin.gypi
@@ -6,6 +6,7 @@
'variables': {
'crypto_cc_file': '<(SHARED_INTERMEDIATE_DIR)/crypto_gen.cc',
'io_cc_file': '<(SHARED_INTERMEDIATE_DIR)/io_gen.cc',
+ 'io_patch_cc_file': '<(SHARED_INTERMEDIATE_DIR)/io_patch_gen.cc',
'json_cc_file': '<(SHARED_INTERMEDIATE_DIR)/json_gen.cc',
'uri_cc_file': '<(SHARED_INTERMEDIATE_DIR)/uri_gen.cc',
'utf_cc_file': '<(SHARED_INTERMEDIATE_DIR)/utf_gen.cc',
@@ -79,8 +80,11 @@
{
'target_name': 'generate_io_cc_file',
'type': 'none',
+ 'sources': [
+ 'io.dart',
+ ],
'includes': [
- 'io_sources.gypi',
+ '../../lib/io/iolib_sources.gypi',
],
'actions': [
{
@@ -107,6 +111,36 @@
]
},
{
+ 'target_name': 'generate_io_patch_cc_file',
+ 'type': 'none',
+ 'includes': [
+ 'io_sources.gypi',
+ ],
+ 'actions': [
+ {
+ 'action_name': 'generate_io_patch_cc',
+ 'inputs': [
+ '../tools/create_string_literal.py',
+ '<(builtin_in_cc_file)',
+ '<@(_sources)',
+ ],
+ 'outputs': [
+ '<(io_patch_cc_file)',
+ ],
+ 'action': [
+ 'python',
+ 'tools/create_string_literal.py',
+ '--output', '<(io_patch_cc_file)',
+ '--input_cc', '<(builtin_in_cc_file)',
+ '--include', 'bin/builtin.h',
+ '--var_name', 'Builtin::io_patch_',
+ '<@(_sources)',
+ ],
+ 'message': 'Generating ''<(io_patch_cc_file)'' file.'
+ },
+ ]
+ },
+ {
'target_name': 'generate_json_cc_file',
'type': 'none',
'includes': [
@@ -222,6 +256,7 @@
'generate_builtin_cc_file',
'generate_crypto_cc_file',
'generate_io_cc_file',
+ 'generate_io_patch_cc_file',
'generate_json_cc_file',
'generate_uri_cc_file',
'generate_utf_cc_file',
@@ -306,6 +341,7 @@
'<(builtin_cc_file)',
'<(crypto_cc_file)',
'<(io_cc_file)',
+ '<(io_patch_cc_file)',
'<(json_cc_file)',
'<(uri_cc_file)',
'<(utf_cc_file)',
@@ -425,6 +461,7 @@
'<(builtin_cc_file)',
'<(crypto_cc_file)',
'<(io_cc_file)',
+ '<(io_patch_cc_file)',
'<(json_cc_file)',
'<(uri_cc_file)',
'<(utf_cc_file)',
@@ -463,6 +500,7 @@
'<(builtin_cc_file)',
'<(crypto_cc_file)',
'<(io_cc_file)',
+ '<(io_patch_cc_file)',
'<(json_cc_file)',
'<(uri_cc_file)',
'<(utf_cc_file)',
diff --git a/runtime/bin/builtin.cc b/runtime/bin/builtin.cc
index 3112628..f6d297e 100644
--- a/runtime/bin/builtin.cc
+++ b/runtime/bin/builtin.cc
@@ -11,13 +11,14 @@
Builtin::builtin_lib_props Builtin::builtin_libraries_[] = {
- /* url_ source_ has_natives_ */
- { DartUtils::kBuiltinLibURL, builtin_source_, true },
- { DartUtils::kJsonLibURL, json_source_, false },
- { DartUtils::kUriLibURL, uri_source_, false },
- { DartUtils::kCryptoLibURL, crypto_source_, false },
- { DartUtils::kIOLibURL, io_source_, true },
- { DartUtils::kUtfLibURL, utf_source_, false }
+ /* { url_, source_, patch_url_, patch_source_, has_natives_ } */
+ { DartUtils::kBuiltinLibURL, builtin_source_, NULL, NULL, true },
+ { DartUtils::kJsonLibURL, json_source_, NULL, NULL, false },
+ { DartUtils::kUriLibURL, uri_source_, NULL, NULL, false },
+ { DartUtils::kCryptoLibURL, crypto_source_, NULL, NULL, false },
+ { DartUtils::kIOLibURL, io_source_,
+ DartUtils::kIOLibPatchURL, io_patch_, true },
+ { DartUtils::kUtfLibURL, utf_source_, NULL, NULL, false }
};
@@ -25,7 +26,7 @@
ASSERT((sizeof(builtin_libraries_) / sizeof(builtin_lib_props)) ==
kInvalidLibrary);
ASSERT(id >= kBuiltinLibrary && id < kInvalidLibrary);
- return Dart_NewString(builtin_libraries_[id].source_);
+ return DartUtils::NewString(builtin_libraries_[id].source_);
}
@@ -38,7 +39,7 @@
ASSERT((sizeof(builtin_libraries_) / sizeof(builtin_lib_props)) ==
kInvalidLibrary);
ASSERT(id >= kBuiltinLibrary && id < kInvalidLibrary);
- Dart_Handle url = Dart_NewString(builtin_libraries_[id].url_);
+ Dart_Handle url = DartUtils::NewString(builtin_libraries_[id].url_);
Dart_Handle library = Dart_LookupLibrary(url);
if (Dart_IsError(library)) {
library = Dart_LoadLibrary(url, Source(id));
@@ -46,6 +47,14 @@
// Setup the native resolver for built in library functions.
DART_CHECK_VALID(Dart_SetNativeResolver(library, NativeLookup));
}
+ if (builtin_libraries_[id].patch_url_ != NULL) {
+ ASSERT(builtin_libraries_[id].patch_source_ != NULL);
+ Dart_Handle patch_url =
+ DartUtils::NewString(builtin_libraries_[id].patch_url_);
+ Dart_Handle patch_source =
+ DartUtils::NewString(builtin_libraries_[id].patch_source_);
+ DART_CHECK_VALID(Dart_LoadPatch(library, patch_url, patch_source));
+ }
}
DART_CHECK_VALID(library);
return library;
diff --git a/runtime/bin/builtin.h b/runtime/bin/builtin.h
index 8dc8ec3..a46fbdb 100644
--- a/runtime/bin/builtin.h
+++ b/runtime/bin/builtin.h
@@ -46,6 +46,7 @@
static const char builtin_source_[];
static const char crypto_source_[];
static const char io_source_[];
+ static const char io_patch_[];
static const char json_source_[];
static const char uri_source_[];
static const char utf_source_[];
@@ -54,6 +55,8 @@
typedef struct {
const char* url_;
const char* source_;
+ const char* patch_url_;
+ const char* patch_source_;
bool has_natives_;
} builtin_lib_props;
static builtin_lib_props builtin_libraries_[];
diff --git a/runtime/bin/builtin_impl_sources.gypi b/runtime/bin/builtin_impl_sources.gypi
index 297d4b0..ad64eac 100644
--- a/runtime/bin/builtin_impl_sources.gypi
+++ b/runtime/bin/builtin_impl_sources.gypi
@@ -6,6 +6,8 @@
# libraries.
{
'sources': [
+ 'io_buffer.cc',
+ 'io_buffer.h',
'common.cc',
'crypto.cc',
'crypto_android.cc',
diff --git a/runtime/bin/builtin_natives.cc b/runtime/bin/builtin_natives.cc
index 045f800..995207c 100644
--- a/runtime/bin/builtin_natives.cc
+++ b/runtime/bin/builtin_natives.cc
@@ -32,7 +32,6 @@
V(File_Close, 1) \
V(File_ReadByte, 1) \
V(File_WriteByte, 2) \
- V(File_WriteString, 2) \
V(File_ReadList, 4) \
V(File_WriteList, 4) \
V(File_Position, 1) \
@@ -61,6 +60,7 @@
V(ServerSocket_Accept, 2) \
V(Socket_CreateConnect, 3) \
V(Socket_Available, 1) \
+ V(Socket_Read, 2) \
V(Socket_ReadList, 4) \
V(Socket_WriteList, 4) \
V(Socket_GetPort, 1) \
@@ -103,9 +103,9 @@
// test/debug functionality in standalone dart mode.
void Builtin::PrintString(FILE* out, Dart_Handle str) {
- const uint8_t* characters = NULL;
- intptr_t length;
- Dart_Handle result = Dart_StringToBytes(str, &characters, &length);
+ const char* chars = NULL;
+
+ Dart_Handle result = Dart_StringToCString(str, &chars);
if (Dart_IsError(result)) {
// TODO(turnidge): Consider propagating some errors here. What if
// an isolate gets interrupted by the embedder in the middle of
@@ -113,7 +113,8 @@
// interrupt.
fputs(Dart_GetError(result), out);
} else {
- fwrite(characters, sizeof(*characters), length, out);
+ intptr_t length = strlen(chars);
+ fwrite(chars, sizeof(*chars), length, out);
}
fputc('\n', out);
fflush(out);
diff --git a/runtime/bin/builtin_nolib.cc b/runtime/bin/builtin_nolib.cc
index 1ba537b..77428c7 100644
--- a/runtime/bin/builtin_nolib.cc
+++ b/runtime/bin/builtin_nolib.cc
@@ -11,13 +11,13 @@
Builtin::builtin_lib_props Builtin::builtin_libraries_[] = {
- /* url_ source_ has_natives_ */
- { DartUtils::kBuiltinLibURL, NULL, true },
- { DartUtils::kJsonLibURL, NULL, false },
- { DartUtils::kUriLibURL, NULL, false },
- { DartUtils::kCryptoLibURL, NULL, false },
- { DartUtils::kIOLibURL, NULL, true },
- { DartUtils::kUtfLibURL, NULL, false }
+ /* { url_, source_, patch_url_, patch_source_, has_natives_ } */
+ { DartUtils::kBuiltinLibURL, NULL, NULL, NULL, true },
+ { DartUtils::kJsonLibURL, NULL, NULL, NULL, false },
+ { DartUtils::kUriLibURL, NULL, NULL, NULL, false },
+ { DartUtils::kCryptoLibURL, NULL, NULL, NULL, false },
+ { DartUtils::kIOLibURL, NULL, NULL, NULL, true },
+ { DartUtils::kUtfLibURL, NULL, NULL, NULL, false }
};
@@ -33,7 +33,7 @@
kInvalidLibrary);
ASSERT(id >= kBuiltinLibrary && id < kInvalidLibrary);
if (builtin_libraries_[id].has_natives_) {
- Dart_Handle url = Dart_NewString(builtin_libraries_[id].url_);
+ Dart_Handle url = DartUtils::NewString(builtin_libraries_[id].url_);
Dart_Handle library = Dart_LookupLibrary(url);
ASSERT(!Dart_IsError(library));
// Setup the native resolver for built in library functions.
@@ -46,7 +46,7 @@
ASSERT((sizeof(builtin_libraries_) / sizeof(builtin_lib_props)) ==
kInvalidLibrary);
ASSERT(id >= kBuiltinLibrary && id < kInvalidLibrary);
- Dart_Handle url = Dart_NewString(builtin_libraries_[id].url_);
+ Dart_Handle url = DartUtils::NewString(builtin_libraries_[id].url_);
Dart_Handle library = Dart_LookupLibrary(url);
if (Dart_IsError(library)) {
ASSERT(id > kUtfLibrary);
diff --git a/runtime/bin/common.cc b/runtime/bin/common.cc
index 5a98342..261557d 100644
--- a/runtime/bin/common.cc
+++ b/runtime/bin/common.cc
@@ -23,17 +23,17 @@
// If we have not cached the class pointers in the isolate data,
// look them up and cache them now.
if (object_array_class == NULL) {
- Dart_Handle coreimpl_lib =
- Dart_LookupLibrary(Dart_NewString("dart:coreimpl"));
- ASSERT(!Dart_IsError(coreimpl_lib));
+ Dart_Handle core_lib =
+ Dart_LookupLibrary(Dart_NewStringFromCString("dart:core"));
+ ASSERT(!Dart_IsError(core_lib));
object_array_class =
- Dart_GetClass(coreimpl_lib, Dart_NewString("_ObjectArray"));
+ Dart_GetClass(core_lib, Dart_NewStringFromCString("_ObjectArray"));
ASSERT(!Dart_IsError(object_array_class));
immutable_array_class =
- Dart_GetClass(coreimpl_lib, Dart_NewString("_ImmutableArray"));
+ Dart_GetClass(core_lib, Dart_NewStringFromCString("_ImmutableArray"));
ASSERT(!Dart_IsError(immutable_array_class));
- growable_object_array_class =
- Dart_GetClass(coreimpl_lib, Dart_NewString("_GrowableObjectArray"));
+ growable_object_array_class = Dart_GetClass(
+ core_lib, Dart_NewStringFromCString("_GrowableObjectArray"));
ASSERT(!Dart_IsError(growable_object_array_class));
// Update the cache.
isolate_data->object_array_class =
diff --git a/runtime/bin/common_patch.dart b/runtime/bin/common_patch.dart
new file mode 100644
index 0000000..1c878aa
--- /dev/null
+++ b/runtime/bin/common_patch.dart
@@ -0,0 +1,10 @@
+// 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.
+
+patch class _BufferUtils {
+ /* patch */ static bool _isBuiltinList(List buffer)
+ native "Common_IsBuiltinList";
+}
+
+
diff --git a/runtime/bin/crypto.cc b/runtime/bin/crypto.cc
index 97984a2..e4db17c 100644
--- a/runtime/bin/crypto.cc
+++ b/runtime/bin/crypto.cc
@@ -13,7 +13,8 @@
Dart_Handle count_obj = Dart_GetNativeArgument(args, 0);
int64_t count = 0;
if (!DartUtils::GetInt64Value(count_obj, &count)) {
- Dart_Handle error = Dart_NewString("Invalid argument, must be an int.");
+ Dart_Handle error =
+ DartUtils::NewString("Invalid argument, must be an int.");
Dart_ThrowException(error);
}
uint8_t* buffer = new uint8_t[count];
@@ -25,7 +26,7 @@
Dart_Handle result = Dart_NewByteArray(count);
if (Dart_IsError(result)) {
delete[] buffer;
- Dart_Handle error = Dart_NewString("Failed to allocate storage.");
+ Dart_Handle error = DartUtils::NewString("Failed to allocate storage.");
Dart_ThrowException(error);
}
Dart_ListSetAsBytes(result, 0, buffer, count);
@@ -33,4 +34,3 @@
delete[] buffer;
Dart_ExitScope();
}
-
diff --git a/runtime/bin/dartutils.cc b/runtime/bin/dartutils.cc
index 3e40dede..3740b7e 100644
--- a/runtime/bin/dartutils.cc
+++ b/runtime/bin/dartutils.cc
@@ -19,6 +19,7 @@
const char* DartUtils::kCoreImplLibURL = "dart:coreimpl";
const char* DartUtils::kCryptoLibURL = "dart:crypto";
const char* DartUtils::kIOLibURL = "dart:io";
+const char* DartUtils::kIOLibPatchURL = "dart:io-patch";
const char* DartUtils::kJsonLibURL = "dart:json";
const char* DartUtils::kUriLibURL = "dart:uri";
const char* DartUtils::kUtfLibURL = "dart:utf";
@@ -98,15 +99,15 @@
const char* name,
intptr_t val) {
Dart_Handle result = Dart_SetField(handle,
- Dart_NewString(name),
+ NewString(name),
Dart_NewInteger(val));
ASSERT(!Dart_IsError(result));
}
intptr_t DartUtils::GetIntegerField(Dart_Handle handle,
- const char* name) {
- Dart_Handle result = Dart_GetField(handle, Dart_NewString(name));
+ const char* name) {
+ Dart_Handle result = Dart_GetField(handle, NewString(name));
ASSERT(!Dart_IsError(result));
intptr_t value = DartUtils::GetIntegerValue(result);
return value;
@@ -116,9 +117,7 @@
void DartUtils::SetStringField(Dart_Handle handle,
const char* name,
const char* val) {
- Dart_Handle result = Dart_SetField(handle,
- Dart_NewString(name),
- Dart_NewString(val));
+ Dart_Handle result = Dart_SetField(handle, NewString(name), NewString(val));
ASSERT(!Dart_IsError(result));
}
@@ -173,7 +172,7 @@
if (Dart_IsError(library_url)) {
return Dart_Error("accessing library url failed");
}
- if (!Dart_IsString8(library_url)) {
+ if (!Dart_IsString(library_url)) {
return Dart_Error("library url is not a string");
}
const char* library_url_str = NULL;
@@ -190,7 +189,7 @@
}
// Calculate the canonical path.
const char* canon_url_str = GetCanonicalPath(library_url_str, url_str);
- Dart_Handle canon_url = Dart_NewString(canon_url_str);
+ Dart_Handle canon_url = NewString(canon_url_str);
free(const_cast<char*>(canon_url_str));
return canon_url;
@@ -209,18 +208,18 @@
return Dart_Error(error_msg);
}
intptr_t len = file->Length();
- char* text_buffer = reinterpret_cast<char*>(malloc(len + 1));
+ uint8_t* text_buffer = reinterpret_cast<uint8_t*>(malloc(len));
if (text_buffer == NULL) {
delete file;
return Dart_Error("Unable to allocate buffer");
}
if (!file->ReadFully(text_buffer, len)) {
delete file;
+ free(text_buffer);
return Dart_Error("Unable to fully read contents");
}
- text_buffer[len] = '\0';
delete file;
- Dart_Handle str = Dart_NewString(text_buffer);
+ Dart_Handle str = Dart_NewStringFromUTF8(text_buffer, len);
free(text_buffer);
return str;
}
@@ -230,11 +229,13 @@
Dart_Handle builtin_lib) {
const int kNumArgs = 3;
Dart_Handle dart_args[kNumArgs];
- dart_args[0] = Dart_NewString(DartUtils::original_working_directory);
+ dart_args[0] = DartUtils::NewString(DartUtils::original_working_directory);
dart_args[1] = script_uri;
dart_args[2] = (IsWindowsHost() ? Dart_True() : Dart_False());
- return Dart_Invoke(
- builtin_lib, Dart_NewString("_resolveScriptUri"), kNumArgs, dart_args);
+ return Dart_Invoke(builtin_lib,
+ DartUtils::NewString("_resolveScriptUri"),
+ kNumArgs,
+ dart_args);
}
@@ -245,7 +246,10 @@
dart_args[0] = script_uri;
dart_args[1] = (IsWindowsHost() ? Dart_True() : Dart_False());
Dart_Handle script_path = Dart_Invoke(
- builtin_lib, Dart_NewString("_filePathFromUri"), kNumArgs, dart_args);
+ builtin_lib,
+ DartUtils::NewString("_filePathFromUri"),
+ kNumArgs,
+ dart_args);
return script_path;
}
@@ -256,7 +260,7 @@
if (!Dart_IsLibrary(library)) {
return Dart_Error("not a library");
}
- if (!Dart_IsString8(url)) {
+ if (!Dart_IsString(url)) {
return Dart_Error("url is not a string");
}
const char* url_string = NULL;
@@ -284,7 +288,7 @@
dart_args[0] = library_url;
dart_args[1] = url;
return Dart_Invoke(
- builtin_lib, Dart_NewString("_resolveUri"), kNumArgs, dart_args);
+ builtin_lib, NewString("_resolveUri"), kNumArgs, dart_args);
}
if (is_dart_scheme_url) {
ASSERT(tag == kImportTag);
@@ -345,8 +349,7 @@
Dart_Handle DartUtils::LoadScript(const char* script_uri,
Dart_Handle builtin_lib) {
Dart_Handle resolved_script_uri;
- resolved_script_uri = ResolveScriptUri(Dart_NewString(script_uri),
- builtin_lib);
+ resolved_script_uri = ResolveScriptUri(NewString(script_uri), builtin_lib);
if (Dart_IsError(resolved_script_uri)) {
return resolved_script_uri;
}
@@ -391,35 +394,35 @@
Dart_Handle DartUtils::PrepareForScriptLoading(const char* package_root,
Dart_Handle builtin_lib) {
// Setup the corelib 'print' function.
- Dart_Handle print =
- Dart_Invoke(builtin_lib, Dart_NewString("_getPrintClosure"), 0, 0);
- Dart_Handle corelib = Dart_LookupLibrary(Dart_NewString("dart:core"));
+ Dart_Handle print = Dart_Invoke(
+ builtin_lib, NewString("_getPrintClosure"), 0, 0);
+ Dart_Handle corelib = Dart_LookupLibrary(NewString("dart:core"));
Dart_Handle result = Dart_SetField(corelib,
- Dart_NewString("_printClosure"), print);
+ NewString("_printClosure"),
+ print);
// Setup the 'timer' factory.
- Dart_Handle url = Dart_NewString(kIsolateLibURL);
+ Dart_Handle url = NewString(kIsolateLibURL);
DART_CHECK_VALID(url);
Dart_Handle isolate_lib = Dart_LookupLibrary(url);
DART_CHECK_VALID(isolate_lib);
Dart_Handle io_lib = Builtin::LoadAndCheckLibrary(Builtin::kIOLibrary);
Dart_Handle timer_closure =
- Dart_Invoke(io_lib, Dart_NewString("_getTimerFactoryClosure"), 0, NULL);
+ Dart_Invoke(io_lib, NewString("_getTimerFactoryClosure"), 0, NULL);
Dart_Handle args[1];
args[0] = timer_closure;
- DART_CHECK_VALID(Dart_Invoke(isolate_lib,
- Dart_NewString("_setTimerFactoryClosure"),
- 1, args));
+ DART_CHECK_VALID(Dart_Invoke(
+ isolate_lib, NewString("_setTimerFactoryClosure"), 1, args));
// Set up package root if specified.
if (package_root != NULL) {
- result = Dart_NewString(package_root);
+ result = NewString(package_root);
if (!Dart_IsError(result)) {
const int kNumArgs = 1;
Dart_Handle dart_args[kNumArgs];
dart_args[0] = result;
return Dart_Invoke(builtin_lib,
- Dart_NewString("_setPackageRoot"),
+ NewString("_setPackageRoot"),
kNumArgs,
dart_args);
}
@@ -491,16 +494,16 @@
Dart_Handle DartUtils::NewDartOSError(OSError* os_error) {
// Create a Dart OSError object with the information retrieved from the OS.
- Dart_Handle url = Dart_NewString("dart:io");
+ Dart_Handle url = NewString("dart:io");
if (Dart_IsError(url)) return url;
Dart_Handle lib = Dart_LookupLibrary(url);
if (Dart_IsError(lib)) return lib;
- Dart_Handle class_name = Dart_NewString("OSError");
+ Dart_Handle class_name = NewString("OSError");
if (Dart_IsError(class_name)) return class_name;
Dart_Handle clazz = Dart_GetClass(lib, class_name);
if (Dart_IsError(clazz)) return clazz;
Dart_Handle args[2];
- args[0] = Dart_NewString(os_error->message());
+ args[0] = NewString(os_error->message());
if (Dart_IsError(args[0])) return args[0];
args[1] = Dart_NewInteger(os_error->code());
if (Dart_IsError(args[1])) return args[1];
diff --git a/runtime/bin/dartutils.h b/runtime/bin/dartutils.h
index 57f168f..93f7001 100644
--- a/runtime/bin/dartutils.h
+++ b/runtime/bin/dartutils.h
@@ -110,6 +110,13 @@
// Create a new Dart OSError object with the provided OS error.
static Dart_Handle NewDartOSError(OSError* os_error);
+ // Create a new Dart String object from a C String.
+ static Dart_Handle NewString(const char* str) {
+ ASSERT((str != NULL) && (strlen(str) != 0));
+ return Dart_NewStringFromUTF8(reinterpret_cast<const uint8_t*>(str),
+ strlen(str));
+ }
+
static void SetOriginalWorkingDirectory();
// Global state that stores the original working directory..
@@ -122,6 +129,7 @@
static const char* kCoreImplLibURL;
static const char* kCryptoLibURL;
static const char* kIOLibURL;
+ static const char* kIOLibPatchURL;
static const char* kJsonLibURL;
static const char* kUriLibURL;
static const char* kUtfLibURL;
diff --git a/runtime/bin/dbg_message.cc b/runtime/bin/dbg_message.cc
index ae7edf5..43fa850 100644
--- a/runtime/bin/dbg_message.cc
+++ b/runtime/bin/dbg_message.cc
@@ -109,11 +109,11 @@
intptr_t str_len = 0;
Dart_Handle res = Dart_StringLength(str, &str_len);
ASSERT_NOT_ERROR(res);
- uint32_t* codepoints =
- reinterpret_cast<uint32_t*>(malloc(str_len * sizeof(uint32_t)));
+ uint16_t* codepoints =
+ reinterpret_cast<uint16_t*>(malloc(str_len * sizeof(uint16_t)));
ASSERT(codepoints != NULL);
intptr_t actual_len = str_len;
- res = Dart_StringGet32(str, codepoints, &actual_len);
+ res = Dart_StringToUTF16(str, codepoints, &actual_len);
ASSERT_NOT_ERROR(res);
ASSERT(str_len == actual_len);
buf->AddChar('\"');
@@ -692,7 +692,7 @@
intptr_t lib_id = msg_parser.GetIntParam("libraryId");
char* url_chars = msg_parser.GetStringParam("url");
ASSERT(url_chars != NULL);
- Dart_Handle url = Dart_NewString(url_chars);
+ Dart_Handle url = DartUtils::NewString(url_chars);
ASSERT_NOT_ERROR(url);
free(url_chars);
url_chars = NULL;
@@ -732,7 +732,7 @@
int msg_id = msg_parser.MessageId();
char* url_chars = msg_parser.GetStringParam("url");
ASSERT(url_chars != NULL);
- Dart_Handle url = Dart_NewString(url_chars);
+ Dart_Handle url = DartUtils::NewString(url_chars);
ASSERT_NOT_ERROR(url);
free(url_chars);
url_chars = NULL;
diff --git a/runtime/bin/directory.cc b/runtime/bin/directory.cc
index 9f82527..cc37c28 100644
--- a/runtime/bin/directory.cc
+++ b/runtime/bin/directory.cc
@@ -18,7 +18,7 @@
Dart_EnterScope();
char* current = Directory::Current();
if (current != NULL) {
- Dart_SetReturnValue(args, Dart_NewString(current));
+ Dart_SetReturnValue(args, DartUtils::NewString(current));
free(current);
}
Dart_ExitScope();
@@ -64,7 +64,7 @@
Dart_Handle path = Dart_GetNativeArgument(args, 0);
char* result = Directory::CreateTemp(DartUtils::GetStringValue(path));
if (result != NULL) {
- Dart_SetReturnValue(args, Dart_NewString(result));
+ Dart_SetReturnValue(args, DartUtils::NewString(result));
free(result);
} else {
Dart_Handle err = DartUtils::NewDartOSError();
diff --git a/runtime/bin/directory_patch.dart b/runtime/bin/directory_patch.dart
new file mode 100644
index 0000000..6d42f8b
--- /dev/null
+++ b/runtime/bin/directory_patch.dart
@@ -0,0 +1,16 @@
+// 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.
+
+patch class _Directory {
+ /* patch */ static String _current() native "Directory_Current";
+ /* patch */ static _createTemp(String template) native "Directory_CreateTemp";
+ /* patch */ static int _exists(String path) native "Directory_Exists";
+ /* patch */ static _create(String path) native "Directory_Create";
+ /* patch */ static _delete(String path, bool recursive)
+ native "Directory_Delete";
+ /* patch */ static _rename(String path, String newPath)
+ native "Directory_Rename";
+ /* patch */ static SendPort _newServicePort()
+ native "Directory_NewServicePort";
+}
diff --git a/runtime/bin/eventhandler.dart b/runtime/bin/eventhandler.dart
deleted file mode 100644
index 2e0a8fc..0000000
--- a/runtime/bin/eventhandler.dart
+++ /dev/null
@@ -1,27 +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.
-
-class _EventHandler extends NativeFieldWrapperClass1 {
- _EventHandler() { }
-
- static void _start() {
- if (_eventHandler === null) {
- _eventHandler = new _EventHandler();
- _eventHandler._doStart();
- }
- }
-
- void _doStart() native "EventHandler_Start";
-
- static _sendData(Object sender, ReceivePort receivePort, int data) {
- if (_eventHandler !== null) {
- _eventHandler._doSendData(sender, receivePort, data);
- }
- }
-
- void _doSendData(Object sender, ReceivePort receivePort, int data)
- native "EventHandler_SendData";
-
- static _EventHandler _eventHandler;
-}
diff --git a/runtime/bin/eventhandler_patch.dart b/runtime/bin/eventhandler_patch.dart
new file mode 100644
index 0000000..f1e3a25
--- /dev/null
+++ b/runtime/bin/eventhandler_patch.dart
@@ -0,0 +1,30 @@
+// 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.
+
+patch class _EventHandler {
+ /* patch */ static void _start() {
+ if (_eventHandler === null) {
+ _eventHandler = new _EventHandlerImpl();
+ _eventHandler._start();
+ }
+ }
+
+ /* patch */ static _sendData(Object sender,
+ ReceivePort receivePort,
+ int data) {
+ if (_eventHandler !== null) {
+ _eventHandler._sendData(sender, receivePort, data);
+ }
+ }
+
+ static _EventHandlerImpl _eventHandler;
+}
+
+
+class _EventHandlerImpl extends NativeFieldWrapperClass1 {
+ _EventHandlerImpl() { }
+ void _start() native "EventHandler_Start";
+ void _sendData(Object sender, ReceivePort receivePort, int data)
+ native "EventHandler_SendData";
+}
diff --git a/runtime/bin/file.cc b/runtime/bin/file.cc
index d74dced..88d0ef4 100644
--- a/runtime/bin/file.cc
+++ b/runtime/bin/file.cc
@@ -158,27 +158,6 @@
}
-void FUNCTION_NAME(File_WriteString)(Dart_NativeArguments args) {
- Dart_EnterScope();
- intptr_t value =
- DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 0));
- File* file = reinterpret_cast<File*>(value);
- ASSERT(file != NULL);
- const char* str =
- DartUtils::GetStringValue(Dart_GetNativeArgument(args, 1));
- int bytes_written = file->Write(reinterpret_cast<const void*>(str),
- strlen(str));
- if (bytes_written >= 0) {
- Dart_SetReturnValue(args, Dart_NewInteger(bytes_written));
- } else {
- Dart_Handle err = DartUtils::NewDartOSError();
- if (Dart_IsError(err)) Dart_PropagateError(err);
- Dart_SetReturnValue(args, err);
- }
- Dart_ExitScope();
-}
-
-
void FUNCTION_NAME(File_ReadList)(Dart_NativeArguments args) {
Dart_EnterScope();
intptr_t value =
@@ -432,7 +411,7 @@
char* path = File::GetContainingDirectory(str_copy);
free(str_copy);
if (path != NULL) {
- Dart_SetReturnValue(args, Dart_NewString(path));
+ Dart_SetReturnValue(args, DartUtils::NewString(path));
free(path);
} else {
Dart_Handle err = DartUtils::NewDartOSError();
@@ -449,7 +428,7 @@
DartUtils::GetStringValue(Dart_GetNativeArgument(args, 0));
char* path = File::GetCanonicalPath(str);
if (path != NULL) {
- Dart_SetReturnValue(args, Dart_NewString(path));
+ Dart_SetReturnValue(args, DartUtils::NewString(path));
free(path);
} else {
Dart_Handle err = DartUtils::NewDartOSError();
@@ -861,25 +840,6 @@
}
-static CObject* FileWriteStringRequest(const CObjectArray& request) {
- if (request.Length() == 3 &&
- request[1]->IsIntptr() &&
- request[2]->IsString()) {
- File* file = CObjectToFilePointer(request[1]);
- ASSERT(file != NULL);
- if (!file->IsClosed()) {
- CObjectString str(request[2]);
- const void* buffer = reinterpret_cast<const void*>(str.CString());
- int64_t bytes_written = file->Write(buffer, str.Length());
- return new CObjectInt64(CObject::NewInt64(bytes_written));
- } else {
- return CObject::FileClosedError();
- }
- }
- return CObject::IllegalArgumentError();
-}
-
-
void FileService(Dart_Port dest_port_id,
Dart_Port reply_port_id,
Dart_CObject* message) {
@@ -943,9 +903,6 @@
case File::kWriteListRequest:
response = FileWriteListRequest(request);
break;
- case File::kWriteStringRequest:
- response = FileWriteStringRequest(request);
- break;
default:
UNREACHABLE();
}
diff --git a/runtime/bin/file.h b/runtime/bin/file.h
index 7b6ea8c..4fbd9cf 100644
--- a/runtime/bin/file.h
+++ b/runtime/bin/file.h
@@ -68,8 +68,7 @@
kReadByteRequest = 14,
kWriteByteRequest = 15,
kReadListRequest = 16,
- kWriteListRequest = 17,
- kWriteStringRequest = 18
+ kWriteListRequest = 17
};
~File();
@@ -109,8 +108,6 @@
// Returns whether the file has been closed.
bool IsClosed();
- const char* name() const { return name_; }
-
// Open the file with the given name. The file is always opened for
// reading. If mode contains kWrite the file is opened for both
// reading and writing. If mode contains kWrite and the file does
@@ -139,12 +136,11 @@
static Dart_Port GetServicePort();
private:
- File(const char* name, FileHandle* handle) : name_(name), handle_(handle) { }
+ explicit File(FileHandle* handle) : handle_(handle) { }
void Close();
static const int kClosedFd = -1;
- const char* name_;
// FileHandle is an OS specific class which stores data about the file.
FileHandle* handle_; // OS specific handle for the file.
diff --git a/runtime/bin/file_android.cc b/runtime/bin/file_android.cc
index a6f04d4..77665e6 100644
--- a/runtime/bin/file_android.cc
+++ b/runtime/bin/file_android.cc
@@ -125,13 +125,13 @@
return NULL;
}
}
- return new File(name, new FileHandle(fd));
+ return new File(new FileHandle(fd));
}
File* File::OpenStdio(int fd) {
if (fd < 0 || 2 < fd) return NULL;
- return new File(NULL, new FileHandle(fd));
+ return new File(new FileHandle(fd));
}
diff --git a/runtime/bin/file_linux.cc b/runtime/bin/file_linux.cc
index a6f04d4..77665e6 100644
--- a/runtime/bin/file_linux.cc
+++ b/runtime/bin/file_linux.cc
@@ -125,13 +125,13 @@
return NULL;
}
}
- return new File(name, new FileHandle(fd));
+ return new File(new FileHandle(fd));
}
File* File::OpenStdio(int fd) {
if (fd < 0 || 2 < fd) return NULL;
- return new File(NULL, new FileHandle(fd));
+ return new File(new FileHandle(fd));
}
diff --git a/runtime/bin/file_macos.cc b/runtime/bin/file_macos.cc
index 835b441..09138cf 100644
--- a/runtime/bin/file_macos.cc
+++ b/runtime/bin/file_macos.cc
@@ -126,13 +126,13 @@
return NULL;
}
}
- return new File(name, new FileHandle(fd));
+ return new File(new FileHandle(fd));
}
File* File::OpenStdio(int fd) {
if (fd < 0 || 2 < fd) return NULL;
- return new File(NULL, new FileHandle(fd));
+ return new File(new FileHandle(fd));
}
diff --git a/runtime/bin/file_patch.dart b/runtime/bin/file_patch.dart
new file mode 100644
index 0000000..4ca5733
--- /dev/null
+++ b/runtime/bin/file_patch.dart
@@ -0,0 +1,35 @@
+// 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.
+
+patch class _FileUtils {
+ /* patch */ static SendPort _newServicePort() native "File_NewServicePort";
+}
+
+patch class _File {
+ /* patch */ static _exists(String name) native "File_Exists";
+ /* patch */ static _create(String name) native "File_Create";
+ /* patch */ static _delete(String name) native "File_Delete";
+ /* patch */ static _directory(String name) native "File_Directory";
+ /* patch */ static _lengthFromName(String name) native "File_LengthFromName";
+ /* patch */ static _lastModified(String name) native "File_LastModified";
+ /* patch */ static _open(String name, int mode) native "File_Open";
+ /* patch */ static int _openStdio(int fd) native "File_OpenStdio";
+ /* patch */ static _fullPath(String name) native "File_FullPath";
+}
+
+patch class _RandomAccessFile {
+ /* patch */ static int _close(int id) native "File_Close";
+ /* patch */ static _readByte(int id) native "File_ReadByte";
+ /* patch */ static _readList(int id, List<int> buffer, int offset, int bytes)
+ native "File_ReadList";
+ /* patch */ static _writeByte(int id, int value) native "File_WriteByte";
+ /* patch */ static _writeList(int id, List<int> buffer, int offset, int bytes)
+ native "File_WriteList";
+ /* patch */ static _position(int id) native "File_Position";
+ /* patch */ static _setPosition(int id, int position)
+ native "File_SetPosition";
+ /* patch */ static _truncate(int id, int length) native "File_Truncate";
+ /* patch */ static _length(int id) native "File_Length";
+ /* patch */ static _flush(int id) native "File_Flush";
+}
diff --git a/runtime/bin/file_test.cc b/runtime/bin/file_test.cc
index da97b24..5765cf2 100644
--- a/runtime/bin/file_test.cc
+++ b/runtime/bin/file_test.cc
@@ -24,7 +24,6 @@
const char* kFilename = GetFileName("runtime/bin/file_test.cc");
File* file = File::Open(kFilename, File::kRead);
EXPECT(file != NULL);
- EXPECT_STREQ(kFilename, file->name());
char buffer[16];
buffer[0] = '\0';
EXPECT(file->ReadFully(buffer, 13)); // ReadFully returns true.
diff --git a/runtime/bin/file_win.cc b/runtime/bin/file_win.cc
index 9076d7a..d32d107 100644
--- a/runtime/bin/file_win.cc
+++ b/runtime/bin/file_win.cc
@@ -114,7 +114,7 @@
return NULL;
}
}
- return new File(name, new FileHandle(fd));
+ return new File(new FileHandle(fd));
}
diff --git a/runtime/bin/gen_snapshot.cc b/runtime/bin/gen_snapshot.cc
index 6e2e6c7..b3513e4 100644
--- a/runtime/bin/gen_snapshot.cc
+++ b/runtime/bin/gen_snapshot.cc
@@ -153,7 +153,7 @@
if (!Dart_IsLibrary(library)) {
return Dart_Error("not a library");
}
- if (!Dart_IsString8(url)) {
+ if (!Dart_IsString(url)) {
return Dart_Error("url is not a string");
}
const char* url_string = NULL;
@@ -183,7 +183,7 @@
if (Dart_IsError(source)) {
return source; // source contains the error string.
}
- Dart_Handle url = Dart_NewString(script_name);
+ Dart_Handle url = DartUtils::NewString(script_name);
return Dart_LoadScript(url, source);
}
diff --git a/runtime/bin/http_patch.dart b/runtime/bin/http_patch.dart
new file mode 100644
index 0000000..fc3da60
--- /dev/null
+++ b/runtime/bin/http_patch.dart
@@ -0,0 +1,8 @@
+// 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.
+
+patch class _HttpSessionManager {
+ /* patch */ static Uint8List _getRandomBytes(int count)
+ native "Crypto_GetRandomBytes";
+}
diff --git a/runtime/bin/io.dart b/runtime/bin/io.dart
index 36d02bb..f260f68 100644
--- a/runtime/bin/io.dart
+++ b/runtime/bin/io.dart
@@ -2,11 +2,11 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// The dart:io library is the concatenation of all the files in
-// io_sources.gypi. This file needs to be the first file in that
-// concatenation.
+// We should be able to get rid of this file. This is used to set up
+// the dart:io library for the VM because it cannot use the actual library
+// file which is in lib/io/io.dart.
-#library("io");
+#library("dart:io");
#import("dart:coreimpl");
#import("dart:crypto");
#import("dart:isolate");
diff --git a/runtime/bin/io_buffer.cc b/runtime/bin/io_buffer.cc
new file mode 100644
index 0000000..8ff95a0
--- /dev/null
+++ b/runtime/bin/io_buffer.cc
@@ -0,0 +1,26 @@
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+#include "bin/io_buffer.h"
+
+static void BufferFree(void* buffer) {
+ delete[] reinterpret_cast<uint8_t*>(buffer);
+}
+
+
+Dart_Handle IOBuffer::Allocate(intptr_t size, uint8_t **buffer) {
+ uint8_t* data = new uint8_t[size];
+ Dart_Handle result = Dart_NewExternalByteArray(data,
+ size,
+ data,
+ BufferFree);
+ if (Dart_IsError(result)) {
+ BufferFree(data);
+ Dart_PropagateError(result);
+ }
+ if (buffer != NULL) {
+ *buffer = data;
+ }
+ return result;
+}
diff --git a/runtime/bin/io_buffer.h b/runtime/bin/io_buffer.h
new file mode 100644
index 0000000..c9a7287
--- /dev/null
+++ b/runtime/bin/io_buffer.h
@@ -0,0 +1,21 @@
+// 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.
+
+#ifndef IO_BUFFER_H_
+#define IO_BUFFER_H_
+
+#include "platform/globals.h"
+
+#include "include/dart_api.h"
+
+class IOBuffer {
+ public:
+ static Dart_Handle Allocate(intptr_t size, uint8_t **buffer);
+
+ private:
+ DISALLOW_ALLOCATION();
+ DISALLOW_IMPLICIT_CONSTRUCTORS(IOBuffer);
+};
+
+#endif // IO_BUFFER_H_
diff --git a/runtime/bin/io_sources.gypi b/runtime/bin/io_sources.gypi
index 435c254..f74d58d 100644
--- a/runtime/bin/io_sources.gypi
+++ b/runtime/bin/io_sources.gypi
@@ -5,46 +5,14 @@
# This file contains all sources for the dart:io library.
{
'sources': [
- # The io.dart file needs to be the first source file. It contains
- # the library and import directives for the dart:io library. The
- # dart:io library is created by concatenating the files listed here
- # in the order they are listed.
- 'io.dart',
-
- 'base64.dart',
- 'buffer_list.dart',
- 'chunked_stream.dart',
- 'common.dart',
- 'directory.dart',
- 'directory_impl.dart',
- 'eventhandler.dart',
- 'file.dart',
- 'file_impl.dart',
- 'http.dart',
- 'http_impl.dart',
- 'http_parser.dart',
- 'http_session.dart',
- 'http_utils.dart',
- 'input_stream.dart',
- 'list_stream.dart',
- 'list_stream_impl.dart',
- 'mime_multipart_parser.dart',
- 'output_stream.dart',
- 'path.dart',
- 'path_impl.dart',
- 'platform.dart',
- 'platform_impl.dart',
- 'process.dart',
- 'process_impl.dart',
- 'socket.dart',
- 'socket_impl.dart',
- 'socket_stream.dart',
- 'socket_stream_impl.dart',
- 'stdio.dart',
- 'stream_util.dart',
- 'string_stream.dart',
- 'timer_impl.dart',
- 'websocket.dart',
- 'websocket_impl.dart',
+ 'common_patch.dart',
+ 'directory_patch.dart',
+ 'eventhandler_patch.dart',
+ 'file_patch.dart',
+ 'http_patch.dart',
+ 'platform_patch.dart',
+ 'process_patch.dart',
+ 'socket_patch.dart',
+ 'stdio_patch.dart',
],
}
diff --git a/runtime/bin/main.cc b/runtime/bin/main.cc
index 3c4a8c8..7cc8f0c 100644
--- a/runtime/bin/main.cc
+++ b/runtime/bin/main.cc
@@ -300,11 +300,11 @@
const char* executable_name,
const char* script_name) {
int options_count = options->count();
- Dart_Handle dart_executable = Dart_NewString(executable_name);
+ Dart_Handle dart_executable = DartUtils::NewString(executable_name);
if (Dart_IsError(dart_executable)) {
return dart_executable;
}
- Dart_Handle dart_script = Dart_NewString(script_name);
+ Dart_Handle dart_script = DartUtils::NewString(script_name);
if (Dart_IsError(dart_script)) {
return dart_script;
}
@@ -313,7 +313,8 @@
return dart_arguments;
}
for (int i = 0; i < options_count; i++) {
- Dart_Handle argument_value = Dart_NewString(options->GetArgument(i));
+ Dart_Handle argument_value =
+ DartUtils::NewString(options->GetArgument(i));
if (Dart_IsError(argument_value)) {
return argument_value;
}
@@ -322,7 +323,7 @@
return result;
}
}
- Dart_Handle core_lib_url = Dart_NewString("dart:core");
+ Dart_Handle core_lib_url = DartUtils::NewString("dart:core");
if (Dart_IsError(core_lib_url)) {
return core_lib_url;
}
@@ -330,7 +331,8 @@
if (Dart_IsError(core_lib)) {
return core_lib;
}
- Dart_Handle runtime_options_class_name = Dart_NewString("_OptionsImpl");
+ Dart_Handle runtime_options_class_name =
+ DartUtils::NewString("_OptionsImpl");
if (Dart_IsError(runtime_options_class_name)) {
return runtime_options_class_name;
}
@@ -339,7 +341,8 @@
if (Dart_IsError(runtime_options_class)) {
return runtime_options_class;
}
- Dart_Handle executable_name_name = Dart_NewString("_nativeExecutable");
+ Dart_Handle executable_name_name =
+ DartUtils::NewString("_nativeExecutable");
if (Dart_IsError(executable_name_name)) {
return executable_name_name;
}
@@ -350,7 +353,7 @@
if (Dart_IsError(set_executable_name)) {
return set_executable_name;
}
- Dart_Handle script_name_name = Dart_NewString("_nativeScript");
+ Dart_Handle script_name_name = DartUtils::NewString("_nativeScript");
if (Dart_IsError(script_name_name)) {
return script_name_name;
}
@@ -359,7 +362,7 @@
if (Dart_IsError(set_script_name)) {
return set_script_name;
}
- Dart_Handle native_name = Dart_NewString("_nativeArguments");
+ Dart_Handle native_name = DartUtils::NewString("_nativeArguments");
if (Dart_IsError(native_name)) {
return native_name;
}
@@ -554,7 +557,7 @@
char* colon = strchr(bpt_line, ':');
ASSERT(colon != NULL);
*colon = '\0';
- Dart_Handle url = Dart_NewString(bpt_line);
+ Dart_Handle url = DartUtils::NewString(bpt_line);
Dart_Handle line_number = Dart_NewInteger(atoi(colon + 1));
free(bpt_line);
Dart_Breakpoint bpt;
@@ -565,12 +568,12 @@
Dart_Handle function_name;
char* dot = strchr(bpt_function, '.');
if (dot == NULL) {
- class_name = Dart_NewString("");
- function_name = Dart_NewString(breakpoint_at);
+ class_name = DartUtils::NewString("");
+ function_name = DartUtils::NewString(breakpoint_at);
} else {
*dot = '\0';
- class_name = Dart_NewString(bpt_function);
- function_name = Dart_NewString(dot + 1);
+ class_name = DartUtils::NewString(bpt_function);
+ function_name = DartUtils::NewString(dot + 1);
}
free(bpt_function);
Dart_Breakpoint bpt;
@@ -727,7 +730,7 @@
}
// Lookup and invoke the top level main function.
- result = Dart_Invoke(library, Dart_NewString("main"), 0, NULL);
+ result = Dart_Invoke(library, DartUtils::NewString("main"), 0, NULL);
if (Dart_IsError(result)) {
return ErrorExit("%s\n", Dart_GetError(result));
}
diff --git a/runtime/bin/platform.cc b/runtime/bin/platform.cc
index 34c2910..80ed277 100644
--- a/runtime/bin/platform.cc
+++ b/runtime/bin/platform.cc
@@ -16,14 +16,15 @@
void FUNCTION_NAME(Platform_OperatingSystem)(Dart_NativeArguments args) {
Dart_EnterScope();
- Dart_SetReturnValue(args, Dart_NewString(Platform::OperatingSystem()));
+ Dart_SetReturnValue(args,
+ Dart_NewStringFromCString(Platform::OperatingSystem()));
Dart_ExitScope();
}
void FUNCTION_NAME(Platform_PathSeparator)(Dart_NativeArguments args) {
Dart_EnterScope();
- Dart_SetReturnValue(args, Dart_NewString(File::PathSeparator()));
+ Dart_SetReturnValue(args, Dart_NewStringFromCString(File::PathSeparator()));
Dart_ExitScope();
}
@@ -33,7 +34,7 @@
const intptr_t HOSTNAME_LENGTH = 256;
char hostname[HOSTNAME_LENGTH];
if (Platform::LocalHostname(hostname, HOSTNAME_LENGTH)) {
- Dart_SetReturnValue(args, Dart_NewString(hostname));
+ Dart_SetReturnValue(args, Dart_NewStringFromCString(hostname));
} else {
Dart_SetReturnValue(args, DartUtils::NewDartOSError());
}
@@ -56,7 +57,7 @@
Dart_PropagateError(result);
}
for (intptr_t i = 0; i < count; i++) {
- Dart_Handle str = Dart_NewString(env[i]);
+ Dart_Handle str = Dart_NewStringFromCString(env[i]);
if (Dart_IsError(str)) {
Dart_PropagateError(str);
}
diff --git a/runtime/bin/platform_patch.dart b/runtime/bin/platform_patch.dart
new file mode 100644
index 0000000..02ba129
--- /dev/null
+++ b/runtime/bin/platform_patch.dart
@@ -0,0 +1,13 @@
+// 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.
+
+patch class _Platform {
+ /* patch */ static int _numberOfProcessors()
+ native "Platform_NumberOfProcessors";
+ /* patch */ static String _pathSeparator() native "Platform_PathSeparator";
+ /* patch */ static String _operatingSystem()
+ native "Platform_OperatingSystem";
+ /* patch */ static _localHostname() native "Platform_LocalHostname";
+ /* patch */ static _environment() native "Platform_Environment";
+}
diff --git a/runtime/bin/process_linux.cc b/runtime/bin/process_linux.cc
index bfaf4d4..ffc5c88 100644
--- a/runtime/bin/process_linux.cc
+++ b/runtime/bin/process_linux.cc
@@ -17,6 +17,7 @@
#include "bin/fdutils.h"
#include "bin/thread.h"
+extern char **environ;
// ProcessInfo is used to map a process id to the file descriptor for
// the pipe used to communicate the exit code of the process to Dart.
@@ -461,15 +462,13 @@
ReportChildError(exec_control[1]);
}
- if (environment != NULL) {
- TEMP_FAILURE_RETRY(
- execve(path,
- const_cast<char* const*>(program_arguments),
- program_environment));
- } else {
- TEMP_FAILURE_RETRY(
- execvp(path, const_cast<char* const*>(program_arguments)));
+ if (program_environment != NULL) {
+ environ = program_environment;
}
+
+ TEMP_FAILURE_RETRY(
+ execvp(path, const_cast<char* const*>(program_arguments)));
+
ReportChildError(exec_control[1]);
}
diff --git a/runtime/bin/process_macos.cc b/runtime/bin/process_macos.cc
index b23ab16..11aac9f 100644
--- a/runtime/bin/process_macos.cc
+++ b/runtime/bin/process_macos.cc
@@ -16,6 +16,7 @@
#include "bin/fdutils.h"
#include "bin/thread.h"
+extern char **environ;
// ProcessInfo is used to map a process id to the file descriptor for
// the pipe used to communicate the exit code of the process to Dart.
@@ -460,15 +461,13 @@
ReportChildError(exec_control[1]);
}
- if (environment != NULL) {
- TEMP_FAILURE_RETRY(
- execve(path,
- const_cast<char* const*>(program_arguments),
- program_environment));
- } else {
- TEMP_FAILURE_RETRY(
- execvp(path, const_cast<char* const*>(program_arguments)));
+ if (program_environment != NULL) {
+ environ = program_environment;
}
+
+ TEMP_FAILURE_RETRY(
+ execvp(path, const_cast<char* const*>(program_arguments)));
+
ReportChildError(exec_control[1]);
}
diff --git a/runtime/bin/process_impl.dart b/runtime/bin/process_patch.dart
similarity index 88%
rename from runtime/bin/process_impl.dart
rename to runtime/bin/process_patch.dart
index 48670e4..1dd8bf6 100644
--- a/runtime/bin/process_impl.dart
+++ b/runtime/bin/process_patch.dart
@@ -2,7 +2,26 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-_exit(int status) native "Exit";
+patch class Process {
+ /* patch */ static Future<Process> start(String executable,
+ List<String> arguments,
+ [ProcessOptions options]) {
+ _ProcessImpl process = new _ProcessImpl(executable, arguments, options);
+ return process._start();
+ }
+
+ /* patch */ static Future<ProcessResult> run(String executable,
+ List<String> arguments,
+ [ProcessOptions options]) {
+ return new _NonInteractiveProcess(executable, arguments, options)._result;
+ }
+}
+
+
+patch class _ProcessUtils {
+ /* patch */ static _exit(int status) native "Exit";
+}
+
class _ProcessStartStatus {
int _errorCode; // Set to OS error code if process start failed.
@@ -10,21 +29,8 @@
}
-class _Process extends NativeFieldWrapperClass1 implements Process {
- static Future<ProcessResult> run(String path,
- List<String> arguments,
- [ProcessOptions options]) {
- return new _NonInteractiveProcess(path, arguments, options)._result;
- }
-
- static Future<Process> start(String path,
- List<String> arguments,
- ProcessOptions options) {
- _Process process = new _Process(path, arguments, options);
- return process._start();
- }
-
- _Process(String path, List<String> arguments, ProcessOptions options) {
+class _ProcessImpl extends NativeFieldWrapperClass1 implements Process {
+ _ProcessImpl(String path, List<String> arguments, ProcessOptions options) {
if (path is !String) {
throw new ArgumentError("Path is not a String: $path");
}
@@ -73,7 +79,6 @@
_out = new _Socket._internalWriteOnly(); // stdin going to process.
_err = new _Socket._internalReadOnly(); // stderr coming from process.
_exitHandler = new _Socket._internalReadOnly();
- _closed = false;
_ended = false;
_started = false;
_onExit = null;
@@ -148,7 +153,10 @@
_exitHandler,
status);
if (!success) {
- close();
+ _in.close();
+ _out.close();
+ _err.close();
+ _exitHandler.close();
completer.completeException(
new ProcessException(status._errorMessage, status._errorCode));
return;
@@ -185,11 +193,15 @@
if (_onExit !== null) {
_onExit(exitCode(exitDataBuffer));
}
+ _out.close();
}
exitDataRead += _exitHandler.inputStream.readInto(
exitDataBuffer, exitDataRead, EXIT_DATA_SIZE - exitDataRead);
- if (exitDataRead == EXIT_DATA_SIZE) handleExit();
+ if (exitDataRead == EXIT_DATA_SIZE) {
+ _exitHandler.close();
+ handleExit();
+ }
};
completer.complete(this);
@@ -208,23 +220,14 @@
_ProcessStartStatus status) native "Process_Start";
InputStream get stdout {
- if (_closed) {
- throw new ProcessException("Process closed");
- }
return _in.inputStream;
}
InputStream get stderr {
- if (_closed) {
- throw new ProcessException("Process closed");
- }
return _err.inputStream;
}
OutputStream get stdin {
- if (_closed) {
- throw new ProcessException("Process closed");
- }
return _out.outputStream;
}
@@ -240,21 +243,7 @@
bool _kill(Process p, int signal) native "Process_Kill";
- void close() {
- if (_closed) {
- throw new ProcessException("Process closed");
- }
- _in.close();
- _out.close();
- _err.close();
- _exitHandler.close();
- _closed = true;
- }
-
void set onExit(void callback(int exitCode)) {
- if (_closed) {
- throw new ProcessException("Process closed");
- }
if (_ended) {
throw new ProcessException("Process killed");
}
@@ -270,7 +259,6 @@
_Socket _out;
_Socket _err;
Socket _exitHandler;
- bool _closed;
bool _ended;
bool _started;
Function _onExit;
@@ -307,7 +295,7 @@
}
// Start the underlying process.
- var processFuture = new _Process(path, arguments, options)._start();
+ var processFuture = new _ProcessImpl(path, arguments, options)._start();
processFuture.then((Process p) {
// Make sure the process stdin is closed.
diff --git a/runtime/bin/socket.cc b/runtime/bin/socket.cc
index 0f1c99a..8f8d4c9 100644
--- a/runtime/bin/socket.cc
+++ b/runtime/bin/socket.cc
@@ -2,6 +2,7 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+#include "bin/io_buffer.h"
#include "bin/socket.h"
#include "bin/dartutils.h"
#include "bin/thread.h"
@@ -58,6 +59,52 @@
}
+void FUNCTION_NAME(Socket_Read)(Dart_NativeArguments args) {
+ Dart_EnterScope();
+ Dart_Handle socket_obj = Dart_GetNativeArgument(args, 0);
+ intptr_t socket = 0;
+ Socket::GetSocketIdNativeField(socket_obj, &socket);
+ intptr_t available = Socket::Available(socket);
+ if (available > 0) {
+ int64_t length = 0;
+ Dart_Handle length_obj = Dart_GetNativeArgument(args, 1);
+ if (DartUtils::GetInt64Value(length_obj, &length)) {
+ if (length == -1 || available < length) {
+ length = available;
+ }
+ uint8_t* buffer = NULL;
+ Dart_Handle result = IOBuffer::Allocate(length, &buffer);
+ if (Dart_IsError(result)) Dart_PropagateError(result);
+ ASSERT(buffer != NULL);
+ intptr_t bytes_read = Socket::Read(socket, buffer, length);
+ if (bytes_read == length) {
+ Dart_SetReturnValue(args, result);
+ } else if (bytes_read == 0) {
+ // On MacOS when reading from a tty Ctrl-D will result in one
+ // byte reported as available. Attempting to read it out will
+ // result in zero bytes read. When that happens there is no
+ // data which is indicated by a null return value.
+ Dart_SetReturnValue(args, Dart_Null());
+ } else {
+ ASSERT(bytes_read == -1);
+ Dart_SetReturnValue(args, DartUtils::NewDartOSError());
+ }
+ } else {
+ OSError os_error(-1, "Invalid argument", OSError::kUnknown);
+ Dart_Handle err = DartUtils::NewDartOSError(&os_error);
+ if (Dart_IsError(err)) Dart_PropagateError(err);
+ Dart_SetReturnValue(args, err);
+ }
+ } else if (available == 0) {
+ Dart_SetReturnValue(args, Dart_Null());
+ } else {
+ Dart_SetReturnValue(args, DartUtils::NewDartOSError());
+ }
+
+ Dart_ExitScope();
+}
+
+
void FUNCTION_NAME(Socket_ReadList)(Dart_NativeArguments args) {
Dart_EnterScope();
Dart_Handle socket_obj = Dart_GetNativeArgument(args, 0);
@@ -129,28 +176,38 @@
length = (length + 1) / 2;
}
- // Send data in chunks of maximum 16KB.
- const intptr_t max_chunk_length =
- dart::Utils::Minimum(length, static_cast<intptr_t>(16 * KB));
- uint8_t* buffer = new uint8_t[max_chunk_length];
intptr_t total_bytes_written = 0;
intptr_t bytes_written = 0;
- do {
- intptr_t chunk_length =
- dart::Utils::Minimum(max_chunk_length, length - total_bytes_written);
- result = Dart_ListGetAsBytes(buffer_obj,
- offset + total_bytes_written,
- buffer,
- chunk_length);
+ if (Dart_IsByteArrayExternal(buffer_obj)) {
+ void* buffer = NULL;
+ result = Dart_ExternalByteArrayGetData(buffer_obj, &buffer);
if (Dart_IsError(result)) {
- delete[] buffer;
Dart_PropagateError(result);
}
- bytes_written =
- Socket::Write(socket, reinterpret_cast<void*>(buffer), chunk_length);
- total_bytes_written += bytes_written;
- } while (bytes_written > 0 && total_bytes_written < length);
- delete[] buffer;
+ bytes_written = Socket::Write(socket, buffer, length);
+ total_bytes_written = bytes_written;
+ } else {
+ // Send data in chunks of maximum 16KB.
+ const intptr_t max_chunk_length =
+ dart::Utils::Minimum(length, static_cast<intptr_t>(16 * KB));
+ uint8_t* buffer = new uint8_t[max_chunk_length];
+ do {
+ intptr_t chunk_length =
+ dart::Utils::Minimum(max_chunk_length, length - total_bytes_written);
+ result = Dart_ListGetAsBytes(buffer_obj,
+ offset + total_bytes_written,
+ buffer,
+ chunk_length);
+ if (Dart_IsError(result)) {
+ delete[] buffer;
+ Dart_PropagateError(result);
+ }
+ bytes_written =
+ Socket::Write(socket, reinterpret_cast<void*>(buffer), chunk_length);
+ total_bytes_written += bytes_written;
+ } while (bytes_written > 0 && total_bytes_written < length);
+ delete[] buffer;
+ }
if (bytes_written >= 0) {
Dart_SetReturnValue(args, Dart_NewInteger(total_bytes_written));
} else {
@@ -186,7 +243,7 @@
char host[INET_ADDRSTRLEN];
if (Socket::GetRemotePeer(socket, host, &port)) {
Dart_Handle list = Dart_NewList(2);
- Dart_ListSetAt(list, 0, Dart_NewString(host));
+ Dart_ListSetAt(list, 0, Dart_NewStringFromCString(host));
Dart_ListSetAt(list, 1, Dart_NewInteger(port));
Dart_SetReturnValue(args, list);
} else {
diff --git a/runtime/bin/socket_impl.dart b/runtime/bin/socket_patch.dart
similarity index 93%
rename from runtime/bin/socket_impl.dart
rename to runtime/bin/socket_patch.dart
index b262cee..2b22877 100644
--- a/runtime/bin/socket_impl.dart
+++ b/runtime/bin/socket_patch.dart
@@ -2,6 +2,17 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+patch class ServerSocket {
+ /* patch */ factory ServerSocket(String bindAddress, int port, int backlog) {
+ return new _ServerSocket(bindAddress, port, backlog);
+ }
+}
+
+
+patch class Socket {
+ /* patch */ factory Socket(String host, int port) => new _Socket(host, port);
+}
+
class _SocketBase extends NativeFieldWrapperClass1 {
// Bit flags used when communicating between the eventhandler and
@@ -97,6 +108,7 @@
}
OSError _getError() native "Socket_GetError";
+
int _getPort() native "Socket_GetPort";
void set onError(void callback(e)) {
@@ -363,19 +375,33 @@
_available() native "Socket_Available";
+ List<int> read([int len]) {
+ if (len != null && len <= 0) {
+ throw new SocketIOException("Illegal length $len");
+ }
+ var result = _read(len == null ? -1 : len);
+ if (result is OSError) {
+ _reportError(result, "Read failed");
+ return null;
+ }
+ return result;
+ }
+
+ _read(int len) native "Socket_Read";
+
int readList(List<int> buffer, int offset, int bytes) {
if (!_closed) {
if (bytes == 0) {
return 0;
}
if (offset < 0) {
- throw new IndexOutOfRangeException(offset);
+ throw new RangeError.value(offset);
}
if (bytes < 0) {
- throw new IndexOutOfRangeException(bytes);
+ throw new RangeError.value(bytes);
}
if ((offset + bytes) > buffer.length) {
- throw new IndexOutOfRangeException(offset + bytes);
+ throw new RangeError.value(offset + bytes);
}
var result = _readList(buffer, offset, bytes);
if (result is OSError) {
@@ -400,13 +426,13 @@
return 0;
}
if (offset < 0) {
- throw new IndexOutOfRangeException(offset);
+ throw new RangeError.value(offset);
}
if (bytes < 0) {
- throw new IndexOutOfRangeException(bytes);
+ throw new RangeError.value(bytes);
}
if ((offset + bytes) > buffer.length) {
- throw new IndexOutOfRangeException(offset + bytes);
+ throw new RangeError.value(offset + bytes);
}
_BufferAndOffset bufferAndOffset =
_ensureFastAndSerializableBuffer(buffer, offset, bytes);
@@ -423,8 +449,7 @@
throw new SocketIOException("writeList failed - invalid socket handle");
}
- _writeList(List<int> buffer, int offset, int bytes)
- native "Socket_WriteList";
+ _writeList(List<int> buffer, int offset, int bytes) native "Socket_WriteList";
bool _isErrorResponse(response) {
return response is List && response[0] != _SUCCESS_RESPONSE;
@@ -475,7 +500,7 @@
throw new StreamException(
"Cannot get input stream when socket handlers are used");
}
- _inputStream = new SocketInputStream(this);
+ _inputStream = new _SocketInputStream(this);
}
return _inputStream;
}
@@ -486,7 +511,7 @@
throw new StreamException(
"Cannot get input stream when socket handlers are used");
}
- _outputStream = new SocketOutputStream(this);
+ _outputStream = new _SocketOutputStream(this);
}
return _outputStream;
}
@@ -574,8 +599,8 @@
bool _pipe = false;
Function _clientConnectHandler;
Function _clientWriteHandler;
- SocketInputStream _inputStream;
- SocketOutputStream _outputStream;
+ _SocketInputStream _inputStream;
+ _SocketOutputStream _outputStream;
String _remoteHost;
int _remotePort;
static SendPort _socketService;
diff --git a/runtime/bin/socket_stream.dart b/runtime/bin/socket_stream.dart
deleted file mode 100644
index 668cfe0..0000000
--- a/runtime/bin/socket_stream.dart
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-/**
- * [SocketInputStream] makes it possible to stream over data received
- * from a [Socket].
- */
-abstract class SocketInputStream implements InputStream {
- /**
- * Create a [SocketInputStream] for streaming from a [Socket].
- */
- factory SocketInputStream(Socket socket) => new _SocketInputStream(socket);
-}
-
-/**
- * [SocketOutputStream] makes it possible to stream data to a
- * [Socket].
- */
-abstract class SocketOutputStream implements OutputStream {
- /**
- * Create a [SocketOutputStream] for streaming to a [Socket].
- */
- factory SocketOutputStream(Socket socket) => new _SocketOutputStream(socket);
-}
diff --git a/runtime/bin/stdio_patch.dart b/runtime/bin/stdio_patch.dart
new file mode 100644
index 0000000..bcdc671
--- /dev/null
+++ b/runtime/bin/stdio_patch.dart
@@ -0,0 +1,10 @@
+// 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.
+
+patch class _StdIOUtils {
+ /* patch */ static _getStdioHandle(Socket socket, int num)
+ native "Socket_GetStdioHandle";
+ /* patch */ static _getStdioHandleType(int num)
+ native "File_GetStdioHandleType";
+}
diff --git a/runtime/bin/test_extension.cc b/runtime/bin/test_extension.cc
index 623e151..000728f 100644
--- a/runtime/bin/test_extension.cc
+++ b/runtime/bin/test_extension.cc
@@ -26,7 +26,7 @@
}
Dart_NativeFunction ResolveName(Dart_Handle name, int argc) {
- assert(Dart_IsString8(name));
+ assert(Dart_IsString(name));
const char* cname;
Dart_Handle check_error;
diff --git a/runtime/include/dart_api.h b/runtime/include/dart_api.h
index be97d76..17c2dc0 100755
--- a/runtime/include/dart_api.h
+++ b/runtime/include/dart_api.h
@@ -1324,14 +1324,9 @@
DART_EXPORT bool Dart_IsString(Dart_Handle object);
/**
- * Is this object a String whose codepoints all fit into 8 bits?
+ * Is this object an ASCII String?
*/
-DART_EXPORT bool Dart_IsString8(Dart_Handle object);
-
-/**
- * Is this object a String whose codepoints all fit into 16 bits?
- */
-DART_EXPORT bool Dart_IsString16(Dart_Handle object);
+DART_EXPORT bool Dart_IsAsciiString(Dart_Handle object);
/**
* Gets the length of a String.
@@ -1345,51 +1340,54 @@
/**
* Returns a String built from the provided C string
+ * (There is an implicit assumption that the C string passed in contains
+ * UTF-8 encoded characters and '\0' is considered as a termination
+ * character).
*
* \param value A C String
*
* \return The String object if no error occurs. Otherwise returns
* an error handle.
*/
-DART_EXPORT Dart_Handle Dart_NewString(const char* str);
+DART_EXPORT Dart_Handle Dart_NewStringFromCString(const char* str);
// TODO(turnidge): Document what happens when we run out of memory
// during this call.
/**
- * Returns a String built from an array of 8-bit codepoints.
+ * Returns a String built from an array of UTF-8 encoded characters.
*
- * \param value An array of 8-bit codepoints.
+ * \param utf8_array An array of UTF-8 encoded characters.
* \param length The length of the codepoints array.
*
* \return The String object if no error occurs. Otherwise returns
* an error handle.
*/
-DART_EXPORT Dart_Handle Dart_NewString8(const uint8_t* codepoints,
- intptr_t length);
+DART_EXPORT Dart_Handle Dart_NewStringFromUTF8(const uint8_t* utf8_array,
+ intptr_t length);
/**
- * Returns a String built from an array of 16-bit codepoints.
+ * Returns a String built from an array of UTF-16 encoded characters.
*
- * \param value An array of 16-bit codepoints.
+ * \param utf16_array An array of UTF-16 encoded characters.
* \param length The length of the codepoints array.
*
* \return The String object if no error occurs. Otherwise returns
* an error handle.
*/
-DART_EXPORT Dart_Handle Dart_NewString16(const uint16_t* codepoints,
- intptr_t length);
+DART_EXPORT Dart_Handle Dart_NewStringFromUTF16(const uint16_t* utf16_array,
+ intptr_t length);
/**
- * Returns a String built from an array of 32-bit codepoints.
+ * Returns a String built from an array of UTF-32 encoded characters.
*
- * \param value An array of 32-bit codepoints.
+ * \param utf32_array An array of UTF-32 encoded characters.
* \param length The length of the codepoints array.
*
* \return The String object if no error occurs. Otherwise returns
* an error handle.
*/
-DART_EXPORT Dart_Handle Dart_NewString32(const uint32_t* codepoints,
- intptr_t length);
+DART_EXPORT Dart_Handle Dart_NewStringFromUTF32(const uint32_t* utf32_array,
+ intptr_t length);
/**
* Is this object an external String?
@@ -1405,136 +1403,85 @@
DART_EXPORT Dart_Handle Dart_ExternalStringGetPeer(Dart_Handle object,
void** peer);
-
/**
- * Returns a String which references an external array of 8-bit codepoints.
+ * Returns a String which references an external array of UTF-8 encoded
+ * characters.
*
- * \param value An array of 8-bit codepoints. This array must not move.
- * \param length The length of the codepoints array.
+ * \param utf8_array An array of UTF-8 encoded characters. This must not move.
+ * \param length The length of the characters array.
* \param peer An external pointer to associate with this string.
- * \param callback A callback to be called when this string is finalized.
+ * \param cback A callback to be called when this string is finalized.
*
* \return The String object if no error occurs. Otherwise returns
* an error handle.
*/
-DART_EXPORT Dart_Handle Dart_NewExternalString8(const uint8_t* codepoints,
- intptr_t length,
- void* peer,
- Dart_PeerFinalizer callback);
+DART_EXPORT Dart_Handle Dart_NewExternalUTF8String(const uint8_t* utf8_array,
+ intptr_t length,
+ void* peer,
+ Dart_PeerFinalizer cback);
/**
- * Returns a String which references an external array of 16-bit codepoints.
+ * Returns a String which references an external array of UTF-16 encoded
+ * characters.
*
- * \param value An array of 16-bit codepoints. This array must not move.
- * \param length The length of the codepoints array.
+ * \param utf16_array An array of UTF-16 encoded characters. This must not move.
+ * \param length The length of the characters array.
* \param peer An external pointer to associate with this string.
- * \param callback A callback to be called when this string is finalized.
+ * \param cback A callback to be called when this string is finalized.
*
* \return The String object if no error occurs. Otherwise returns
* an error handle.
*/
-DART_EXPORT Dart_Handle Dart_NewExternalString16(const uint16_t* codepoints,
- intptr_t length,
- void* peer,
- Dart_PeerFinalizer callback);
+DART_EXPORT Dart_Handle Dart_NewExternalUTF16String(const uint16_t* utf16_array,
+ intptr_t length,
+ void* peer,
+ Dart_PeerFinalizer cback);
/**
- * Returns a String which references an external array of 32-bit codepoints.
- *
- * \param value An array of 32-bit codepoints. This array must not move.
- * \param length The length of the codepoints array.
- * \param peer An external pointer to associate with this string.
- * \param callback A callback to be called when this string is finalized.
- *
- * \return The String object if no error occurs. Otherwise returns
- * an error handle.
- */
-DART_EXPORT Dart_Handle Dart_NewExternalString32(const uint32_t* codepoints,
- intptr_t length,
- void* peer,
- Dart_PeerFinalizer callback);
-
-/**
- * Gets the codepoints from a String.
- *
- * This function is only valid on strings for which Dart_IsString8 is
- * true. Otherwise an error occurs.
+ * Gets the C string representation of a String.
+ * (It is a sequence of UTF-8 encoded values with a '\0' termination.)
*
* \param str A string.
- * \param codepoints An array allocated by the caller, used to return
- * the array of codepoints.
- * \param length Used to pass in the length of the provided array.
- * Used to return the length of the array which was actually used.
- *
- * \return A valid handle if no error occurs during the operation.
- */
-DART_EXPORT Dart_Handle Dart_StringGet8(Dart_Handle str,
- uint8_t* codepoints,
- intptr_t* length);
-// TODO(turnidge): Rename to GetString8 to be consistent with the Is*
-// and New* functions above?
-
-/**
- * Gets the codepoints from a String.
- *
- * This function is only valid on strings for which Dart_IsString8 or
- * Dart_IsString16 is true. Otherwise an error occurs.
- *
- * \param str A string.
- * \param codepoints An array allocated by the caller, used to return
- * the array of codepoints.
- * \param length Used to pass in the length of the provided array.
- * Used to return the length of the array which was actually used.
- *
- * \return A valid handle if no error occurs during the operation.
- */
-DART_EXPORT Dart_Handle Dart_StringGet16(Dart_Handle str,
- uint16_t* codepoints,
- intptr_t* length);
-
-/**
- * Gets the codepoints from a String
- *
- * \param str A string.
- * \param codepoints An array allocated by the caller, used to return
- * the array of codepoints.
- * \param length Used to pass in the length of the provided array.
- * Used to return the length of the array which was actually used.
- *
- * \return A valid handle if no error occurs during the operation.
- */
-DART_EXPORT Dart_Handle Dart_StringGet32(Dart_Handle str,
- uint32_t* codepoints,
- intptr_t* length);
-
-/**
- * Gets the utf8 encoded representation of a String.
- *
- * \param str A string.
- * \param utf8 Returns the String represented as a utf8 encoded C
- * string. This C string is scope allocated and is only valid until
+ * \param cstr Returns the String represented as a C string.
+ * This C string is scope allocated and is only valid until
* the next call to Dart_ExitScope.
*
* \return A valid handle if no error occurs during the operation.
*/
DART_EXPORT Dart_Handle Dart_StringToCString(Dart_Handle str,
- const char** utf8);
+ const char** cstr);
/**
* Gets a UTF-8 encoded representation of a String.
*
* \param str A string.
- * \param bytes Returns the String represented as an array of UTF-8
- * code units. This array is scope allocated and is only valid until
- * the next call to Dart_ExitScope.
- * \param length Returns the length of the code units array, in bytes.
+ * \param utf8_array An array allocated by the caller, used to return
+ * the array of UTF-8 encoded characters.
+ * \param length Used to pass in the length of the provided array.
+ * Used to return the length of the array which was actually used.
*
* \return A valid handle if no error occurs during the operation.
*/
-DART_EXPORT Dart_Handle Dart_StringToBytes(Dart_Handle str,
- const uint8_t** bytes,
+DART_EXPORT Dart_Handle Dart_StringToUTF8(Dart_Handle str,
+ uint8_t* utf8_array,
+ intptr_t* length);
+
+/**
+ * Gets the UTF-16 encoded representation of a string.
+ *
+ * \param str A string.
+ * \param utf16_array An array allocated by the caller, used to return
+ * the array of UTF-16 encoded characters.
+ * \param length Used to pass in the length of the provided array.
+ * Used to return the length of the array which was actually used.
+ *
+ * \return A valid handle if no error occurs during the operation.
+ */
+DART_EXPORT Dart_Handle Dart_StringToUTF16(Dart_Handle str,
+ uint16_t* utf16_array,
intptr_t* length);
+
// --- Lists ---
/**
@@ -1621,6 +1568,14 @@
DART_EXPORT bool Dart_IsByteArray(Dart_Handle object);
/**
+ * Is this object an external ByteArray?
+ *
+ * An external ByteArray is a ByteArray which references a fixed array of
+ * bytes which is external to the Dart heap.
+ */
+DART_EXPORT bool Dart_IsByteArrayExternal(Dart_Handle object);
+
+/**
* Returns a ByteArray of the desired length.
*
* \param length The length of the array.
@@ -1646,6 +1601,12 @@
Dart_PeerFinalizer callback);
/**
+ * Retrieves the data pointer associated with an external ByteArray.
+ */
+DART_EXPORT Dart_Handle Dart_ExternalByteArrayGetData(Dart_Handle object,
+ void** data);
+
+/**
* Retrieves the peer pointer associated with an external ByteArray.
*/
DART_EXPORT Dart_Handle Dart_ExternalByteArrayGetPeer(Dart_Handle object,
diff --git a/runtime/lib/array.cc b/runtime/lib/array.cc
index 67d2363..4d96793 100644
--- a/runtime/lib/array.cc
+++ b/runtime/lib/array.cc
@@ -39,7 +39,7 @@
if ((index.Value() < 0) || (index.Value() >= array.Length())) {
GrowableArray<const Object*> arguments;
arguments.Add(&index);
- Exceptions::ThrowByType(Exceptions::kIndexOutOfRange, arguments);
+ Exceptions::ThrowByType(Exceptions::kRange, arguments);
}
return array.At(index.Value());
}
@@ -52,7 +52,7 @@
if ((index.Value() < 0) || (index.Value() >= array.Length())) {
GrowableArray<const Object*> arguments;
arguments.Add(&index);
- Exceptions::ThrowByType(Exceptions::kIndexOutOfRange, arguments);
+ Exceptions::ThrowByType(Exceptions::kRange, arguments);
}
array.SetAt(index.Value(), value);
return Object::null();
@@ -85,12 +85,12 @@
if ((isrc_start < 0) || ((isrc_start + icount) > source.Length())) {
GrowableArray<const Object*> arguments;
arguments.Add(&src_start);
- Exceptions::ThrowByType(Exceptions::kIndexOutOfRange, arguments);
+ Exceptions::ThrowByType(Exceptions::kRange, arguments);
}
if ((idst_start < 0) || ((idst_start + icount) > dest.Length())) {
GrowableArray<const Object*> arguments;
arguments.Add(&dst_start);
- Exceptions::ThrowByType(Exceptions::kIndexOutOfRange, arguments);
+ Exceptions::ThrowByType(Exceptions::kRange, arguments);
}
Object& src_obj = Object::Handle();
diff --git a/runtime/lib/array_patch.dart b/runtime/lib/array_patch.dart
index b84904b..08ef482 100644
--- a/runtime/lib/array_patch.dart
+++ b/runtime/lib/array_patch.dart
@@ -5,7 +5,7 @@
// Note that the optimizing compiler depends on the algorithm which
// returns a _GrowableObjectArray if length is null, otherwise returns
// fixed size array.
-patch class ListImplementation<E> {
+patch class _ListImpl<E> {
/* patch */ factory List([int length = null]) {
if (length === null) {
return new _GrowableObjectArray<E>();
@@ -14,8 +14,8 @@
}
}
- /* patch */ static _from(Iterable other) {
- _GrowableObjectArray list = new _GrowableObjectArray();
+ /* patch */ factory List.from(Iterable<E> other) {
+ _GrowableObjectArray<E> list = new _GrowableObjectArray<E>();
for (final e in other) {
list.add(e);
}
diff --git a/runtime/lib/byte_array.cc b/runtime/lib/byte_array.cc
index 10d9a89..06efeee 100644
--- a/runtime/lib/byte_array.cc
+++ b/runtime/lib/byte_array.cc
@@ -15,7 +15,7 @@
// Checks to see if (index * num_bytes) is in the range
// [0..array.ByteLength()). without the risk of integer overflow. If
-// the index is out of range, then an IndexOutOfRangeException is thrown.
+// the index is out of range, then a RangeError is thrown.
static void RangeCheck(const ByteArray& array,
intptr_t index,
intptr_t num_bytes) {
@@ -25,7 +25,7 @@
index, (array.ByteLength() / num_bytes)));
GrowableArray<const Object*> args;
args.Add(&error);
- Exceptions::ThrowByType(Exceptions::kIndexOutOfRange, args);
+ Exceptions::ThrowByType(Exceptions::kRange, args);
}
}
diff --git a/runtime/lib/byte_array.dart b/runtime/lib/byte_array.dart
index cec964c..a455050 100644
--- a/runtime/lib/byte_array.dart
+++ b/runtime/lib/byte_array.dart
@@ -308,13 +308,13 @@
void _rangeCheck(int listLength, int start, int length) {
if (length < 0) {
- throw new IndexOutOfRangeException(length);
+ throw new RangeError.value(length);
}
if (start < 0) {
- throw new IndexOutOfRangeException(start);
+ throw new RangeError.value(start);
}
if (start + length > listLength) {
- throw new IndexOutOfRangeException(start + length);
+ throw new RangeError.value(start + length);
}
}
@@ -1717,7 +1717,7 @@
int operator[](int index) {
if (index < 0 || index >= _length) {
String message = "$index must be in the range [0..$_length)";
- throw new IndexOutOfRangeException(message);
+ throw new RangeError(message);
}
return _array.getInt8(_offset + (index * _BYTES_PER_ELEMENT));
}
@@ -1725,7 +1725,7 @@
void operator[]=(int index, int value) {
if (index < 0 || index >= _length) {
String message = "$index must be in the range [0..$_length)";
- throw new IndexOutOfRangeException(message);
+ throw new RangeError(message);
}
_array.setInt8(_offset + (index * _BYTES_PER_ELEMENT), _toInt8(value));
}
@@ -1789,7 +1789,7 @@
int operator[](int index) {
if (index < 0 || index >= _length) {
String message = "$index must be in the range [0..$_length)";
- throw new IndexOutOfRangeException(message);
+ throw new RangeError(message);
}
return _array.getUint8(_offset + (index * _BYTES_PER_ELEMENT));
}
@@ -1797,7 +1797,7 @@
void operator[]=(int index, int value) {
if (index < 0 || index >= _length) {
String message = "$index must be in the range [0..$_length)";
- throw new IndexOutOfRangeException(message);
+ throw new RangeError(message);
}
_array.setUint8(_offset + (index * _BYTES_PER_ELEMENT), _toUint8(value));
}
@@ -1861,7 +1861,7 @@
int operator[](int index) {
if (index < 0 || index >= _length) {
String message = "$index must be in the range [0..$_length)";
- throw new IndexOutOfRangeException(message);
+ throw new RangeError(message);
}
return _array.getInt16(_offset + (index * _BYTES_PER_ELEMENT));
}
@@ -1869,7 +1869,7 @@
void operator[]=(int index, int value) {
if (index < 0 || index >= _length) {
String message = "$index must be in the range [0..$_length)";
- throw new IndexOutOfRangeException(message);
+ throw new RangeError(message);
}
_array.setInt16(_offset + (index * _BYTES_PER_ELEMENT), _toInt16(value));
}
@@ -1933,7 +1933,7 @@
int operator[](int index) {
if (index < 0 || index >= _length) {
String message = "$index must be in the range [0..$_length)";
- throw new IndexOutOfRangeException(message);
+ throw new RangeError(message);
}
return _array.getUint16(_offset + (index * _BYTES_PER_ELEMENT));
}
@@ -1941,7 +1941,7 @@
void operator[]=(int index, int value) {
if (index < 0 || index >= _length) {
String message = "$index must be in the range [0..$_length)";
- throw new IndexOutOfRangeException(message);
+ throw new RangeError(message);
}
_array.setUint16(_offset + (index * _BYTES_PER_ELEMENT), _toUint16(value));
}
@@ -2005,7 +2005,7 @@
int operator[](int index) {
if (index < 0 || index >= _length) {
String message = "$index must be in the range [0..$_length)";
- throw new IndexOutOfRangeException(message);
+ throw new RangeError(message);
}
return _array.getInt32(_offset + (index * _BYTES_PER_ELEMENT));
}
@@ -2013,7 +2013,7 @@
void operator[]=(int index, int value) {
if (index < 0 || index >= _length) {
String message = "$index must be in the range [0..$_length)";
- throw new IndexOutOfRangeException(message);
+ throw new RangeError(message);
}
_array.setInt32(_offset + (index * _BYTES_PER_ELEMENT), _toInt32(value));
}
@@ -2077,7 +2077,7 @@
int operator[](int index) {
if (index < 0 || index >= _length) {
String message = "$index must be in the range [0..$_length)";
- throw new IndexOutOfRangeException(message);
+ throw new RangeError(message);
}
return _array.getUint32(_offset + (index * _BYTES_PER_ELEMENT));
}
@@ -2085,7 +2085,7 @@
void operator[]=(int index, int value) {
if (index < 0 || index >= _length) {
String message = "$index must be in the range [0..$_length)";
- throw new IndexOutOfRangeException(message);
+ throw new RangeError(message);
}
_array.setUint32(_offset + (index * _BYTES_PER_ELEMENT), _toUint32(value));
}
@@ -2149,7 +2149,7 @@
int operator[](int index) {
if (index < 0 || index >= _length) {
String message = "$index must be in the range [0..$_length)";
- throw new IndexOutOfRangeException(message);
+ throw new RangeError(message);
}
return _array.getInt64(_offset + (index * _BYTES_PER_ELEMENT));
}
@@ -2157,7 +2157,7 @@
void operator[]=(int index, int value) {
if (index < 0 || index >= _length) {
String message = "$index must be in the range [0..$_length)";
- throw new IndexOutOfRangeException(message);
+ throw new RangeError(message);
}
_array.setInt64(_offset + (index * _BYTES_PER_ELEMENT), _toInt64(value));
}
@@ -2221,7 +2221,7 @@
int operator[](int index) {
if (index < 0 || index >= _length) {
String message = "$index must be in the range [0..$_length)";
- throw new IndexOutOfRangeException(message);
+ throw new RangeError(message);
}
return _array.getUint64(_offset + (index * _BYTES_PER_ELEMENT));
}
@@ -2229,7 +2229,7 @@
void operator[]=(int index, int value) {
if (index < 0 || index >= _length) {
String message = "$index must be in the range [0..$_length)";
- throw new IndexOutOfRangeException(message);
+ throw new RangeError(message);
}
_array.setUint64(_offset + (index * _BYTES_PER_ELEMENT), _toUint64(value));
}
@@ -2293,7 +2293,7 @@
double operator[](int index) {
if (index < 0 || index >= _length) {
String message = "$index must be in the range [0..$_length)";
- throw new IndexOutOfRangeException(message);
+ throw new RangeError(message);
}
return _array.getFloat32(_offset + (index * _BYTES_PER_ELEMENT));
}
@@ -2301,7 +2301,7 @@
void operator[]=(int index, double value) {
if (index < 0 || index >= _length) {
String message = "$index must be in the range [0..$_length)";
- throw new IndexOutOfRangeException(message);
+ throw new RangeError(message);
}
_array.setFloat32(_offset + (index * _BYTES_PER_ELEMENT), value);
}
@@ -2365,7 +2365,7 @@
double operator[](int index) {
if (index < 0 || index >= _length) {
String message = "$index must be in the range [0..$_length)";
- throw new IndexOutOfRangeException(message);
+ throw new RangeError(message);
}
return _array.getFloat64(_offset + (index * _BYTES_PER_ELEMENT));
}
@@ -2373,7 +2373,7 @@
void operator[]=(int index, double value) {
if (index < 0 || index >= _length) {
String message = "$index must be in the range [0..$_length)";
- throw new IndexOutOfRangeException(message);
+ throw new RangeError(message);
}
_array.setFloat64(_offset + (index * _BYTES_PER_ELEMENT), value);
}
diff --git a/runtime/lib/errors_patch.dart b/runtime/lib/errors_patch.dart
index 7894ae3..d09dc3d 100644
--- a/runtime/lib/errors_patch.dart
+++ b/runtime/lib/errors_patch.dart
@@ -8,15 +8,3 @@
}
}
-// Exceptions that should be NoSuchMethodError instead.
-
-class _ClosureArgumentMismatchException implements Exception {
- const _ClosureArgumentMismatchException();
- String toString() => "Closure argument mismatch";
-}
-
-
-class _ObjectNotClosureException implements Exception {
- const _ObjectNotClosureException();
- String toString() => "Object is not closure";
-}
diff --git a/runtime/lib/growable_array.cc b/runtime/lib/growable_array.cc
index 8ffd3d2..c3b6f5e 100644
--- a/runtime/lib/growable_array.cc
+++ b/runtime/lib/growable_array.cc
@@ -22,7 +22,7 @@
const Integer& index = Integer::Handle(Integer::New(data.Length()));
GrowableArray<const Object*> args;
args.Add(&index);
- Exceptions::ThrowByType(Exceptions::kIndexOutOfRange, args);
+ Exceptions::ThrowByType(Exceptions::kRange, args);
}
const GrowableObjectArray& new_array =
GrowableObjectArray::Handle(GrowableObjectArray::New(data));
@@ -38,7 +38,7 @@
if ((index.Value() < 0) || (index.Value() >= array.Length())) {
GrowableArray<const Object*> args;
args.Add(&index);
- Exceptions::ThrowByType(Exceptions::kIndexOutOfRange, args);
+ Exceptions::ThrowByType(Exceptions::kRange, args);
}
const Instance& obj = Instance::CheckedHandle(array.At(index.Value()));
return obj.raw();
@@ -52,7 +52,7 @@
if ((index.Value() < 0) || (index.Value() >= array.Length())) {
GrowableArray<const Object*> args;
args.Add(&index);
- Exceptions::ThrowByType(Exceptions::kIndexOutOfRange, args);
+ Exceptions::ThrowByType(Exceptions::kRange, args);
}
GET_NATIVE_ARGUMENT(Instance, value, arguments->At(2));
array.SetAt(index.Value(), value);
@@ -81,7 +81,7 @@
if ((length.Value() < 0) || (length.Value() > array.Capacity())) {
GrowableArray<const Object*> args;
args.Add(&length);
- Exceptions::ThrowByType(Exceptions::kIndexOutOfRange, args);
+ Exceptions::ThrowByType(Exceptions::kRange, args);
}
array.SetLength(length.Value());
return Object::null();
diff --git a/runtime/lib/growable_array.dart b/runtime/lib/growable_array.dart
index c648fb5..a8462a3 100644
--- a/runtime/lib/growable_array.dart
+++ b/runtime/lib/growable_array.dart
@@ -49,7 +49,7 @@
throw new ArgumentError("invalid length specified $length");
}
if (start < 0 || start > this.length) {
- throw new IndexOutOfRangeException(start);
+ throw new RangeError.value(start);
}
var old_length = this.length;
this.length = old_length + length; // Will expand if needed.
diff --git a/runtime/lib/invocation_mirror_patch.dart b/runtime/lib/invocation_mirror_patch.dart
index 5bf4e42..5eedca0 100644
--- a/runtime/lib/invocation_mirror_patch.dart
+++ b/runtime/lib/invocation_mirror_patch.dart
@@ -7,13 +7,17 @@
static final int GETTER = 1;
static final int SETTER = 2;
- final String methodName;
+ final String memberName;
final List positionalArguments;
final Map<String,dynamic> namedArguments = null;
final int _type;
- _InvocationMirror(this.methodName, this._type, this.positionalArguments);
+ _InvocationMirror(this.memberName, this._type, this.positionalArguments);
+
+ static _allocateInvocationMirror(name, arguments) {
+ return new _InvocationMirror(name, METHOD, arguments);
+ }
bool get isMethod => _type == METHOD;
bool get isAccessor => _type != METHOD;
diff --git a/runtime/lib/lib_impl_sources.gypi b/runtime/lib/lib_impl_sources.gypi
index 090635d..9df2c1a 100644
--- a/runtime/lib/lib_impl_sources.gypi
+++ b/runtime/lib/lib_impl_sources.gypi
@@ -6,13 +6,6 @@
{
'sources': [
- 'array.cc',
- 'array.dart',
- 'array_patch.dart',
- 'growable_array.cc',
- 'growable_array.dart',
- 'immutable_map.dart',
- 'literal_factory.dart',
'math.dart',
'math.cc',
'object.cc',
@@ -20,9 +13,5 @@
'regexp_jsc.cc',
'regexp_jsc.h',
'regexp_patch.dart',
- 'stopwatch_patch.dart',
- 'string.cc',
- 'string_base.dart',
- 'string_patch.dart',
],
}
diff --git a/runtime/lib/lib_sources.gypi b/runtime/lib/lib_sources.gypi
index 9ddcd3b..3d3cf07 100644
--- a/runtime/lib/lib_sources.gypi
+++ b/runtime/lib/lib_sources.gypi
@@ -8,6 +8,9 @@
'sources': [
'date.cc',
'date_patch.dart',
+ 'array.cc',
+ 'array.dart',
+ 'array_patch.dart',
'double.cc',
'double.dart',
'double_patch.dart',
@@ -17,13 +20,21 @@
'error.h',
'expando_patch.dart',
'function_patch.dart',
+ 'growable_array.cc',
+ 'growable_array.dart',
+ 'immutable_map.dart',
'integers.cc',
'integers.dart',
'integers_patch.dart',
'invocation_mirror_patch.dart',
+ 'literal_factory.dart',
'object_patch.dart',
'print_patch.dart',
+ 'stopwatch_patch.dart',
'stopwatch.cc',
+ 'string.cc',
+ 'string_base.dart',
+ 'string_patch.dart',
'type_patch.dart',
'weak_property.dart',
'weak_property.cc',
diff --git a/runtime/lib/math_patch.dart b/runtime/lib/math_patch.dart
index 9327560..0612d3d 100644
--- a/runtime/lib/math_patch.dart
+++ b/runtime/lib/math_patch.dart
@@ -33,16 +33,20 @@
class _Random implements Random {
// Internal state of the random number generator.
- var _state;
+ var _state_lo;
+ var _state_hi;
- _Random._internal(this._state);
+ _Random._internal(state)
+ : _state_lo = (state & _MASK_32), _state_hi = (state >> 32);
// The algorithm used here is Multiply with Carry (MWC) with a Base b = 2^32.
// http://en.wikipedia.org/wiki/Multiply-with-carry
// The constant A is selected from "Numerical Recipes 3rd Edition" p.348 B1.
int _nextInt32() {
- _state = ((_A * (_state & _MASK_32)) + (_state >> 32)) & _MASK_64;
- return _state & _MASK_32;
+ var state = ((_A * (_state_lo)) + _state_hi) & _MASK_64;
+ _state_lo = state & _MASK_32;
+ _state_hi = state >> 32;
+ return _state_lo;
}
int nextInt(int max) {
@@ -89,7 +93,6 @@
_prng = new Random(new Date.now().millisecondsSinceEpoch);
}
// Trigger the PRNG once to change the internal state.
- _prng._nextInt32();
- return _prng._state;
+ return _prng._nextInt32();
}
}
diff --git a/runtime/lib/mirrors.cc b/runtime/lib/mirrors.cc
index 179264b..c7990b4 100644
--- a/runtime/lib/mirrors.cc
+++ b/runtime/lib/mirrors.cc
@@ -14,6 +14,11 @@
namespace dart {
+inline Dart_Handle NewString(const char* str) {
+ return Dart_NewStringFromCString(str);
+}
+
+
DEFINE_NATIVE_ENTRY(Mirrors_isLocalPort, 1) {
GET_NATIVE_ARGUMENT(Instance, port, arguments->At(0));
@@ -34,14 +39,14 @@
// TODO(turnidge): Add Map support to the dart embedding api instead
// of implementing it here.
static Dart_Handle CoreLib() {
- Dart_Handle core_lib_name = Dart_NewString("dart:core");
+ Dart_Handle core_lib_name = NewString("dart:core");
return Dart_LookupLibrary(core_lib_name);
}
static Dart_Handle MapNew() {
// TODO(turnidge): Switch to an order-preserving map type.
- Dart_Handle cls = Dart_GetClass(CoreLib(), Dart_NewString("Map"));
+ Dart_Handle cls = Dart_GetClass(CoreLib(), NewString("Map"));
if (Dart_IsError(cls)) {
return cls;
}
@@ -51,18 +56,18 @@
static Dart_Handle MapAdd(Dart_Handle map, Dart_Handle key, Dart_Handle value) {
Dart_Handle args[] = { key, value };
- return Dart_Invoke(map, Dart_NewString("[]="), ARRAY_SIZE(args), args);
+ return Dart_Invoke(map, NewString("[]="), ARRAY_SIZE(args), args);
}
static Dart_Handle MirrorLib() {
- Dart_Handle mirror_lib_name = Dart_NewString("dart:mirrors");
+ Dart_Handle mirror_lib_name = NewString("dart:mirrors");
return Dart_LookupLibrary(mirror_lib_name);
}
static Dart_Handle IsMirror(Dart_Handle object, bool* is_mirror) {
- Dart_Handle cls_name = Dart_NewString("Mirror");
+ Dart_Handle cls_name = NewString("Mirror");
Dart_Handle cls = Dart_GetClass(MirrorLib(), cls_name);
if (Dart_IsError(cls)) {
return cls;
@@ -92,7 +97,7 @@
static Dart_Handle CreateVMReference(Dart_Handle handle) {
// Create the VMReference object.
- Dart_Handle cls_name = Dart_NewString("VMReference");
+ Dart_Handle cls_name = NewString("VMReference");
Dart_Handle cls = Dart_GetClass(MirrorLib(), cls_name);
if (Dart_IsError(cls)) {
return cls;
@@ -148,7 +153,7 @@
static Dart_Handle UnwrapMirror(Dart_Handle mirror) {
- Dart_Handle field_name = Dart_NewString("_reference");
+ Dart_Handle field_name = NewString("_reference");
Dart_Handle vm_ref = Dart_GetField(mirror, field_name);
if (Dart_IsError(vm_ref)) {
return vm_ref;
@@ -213,7 +218,7 @@
return result;
}
- Dart_Handle param_cls_name = Dart_NewString("_LocalParameterMirrorImpl");
+ Dart_Handle param_cls_name = NewString("_LocalParameterMirrorImpl");
Dart_Handle param_cls = Dart_GetClass(MirrorLib(), param_cls_name);
if (Dart_IsError(param_cls)) {
return param_cls;
@@ -248,7 +253,7 @@
}
if (Dart_IsLibrary(target)) {
- Dart_Handle cls_name = Dart_NewString("_LazyLibraryMirror");
+ Dart_Handle cls_name = NewString("_LazyLibraryMirror");
Dart_Handle cls = Dart_GetClass(MirrorLib(), cls_name);
Dart_Handle args[] = { Dart_LibraryName(target) };
return Dart_New(cls, Dart_Null(), ARRAY_SIZE(args), args);
@@ -256,7 +261,7 @@
if (Dart_IsClass(target) || Dart_IsInterface(target)) {
if (Dart_ClassIsFunctionType(target)) {
- Dart_Handle cls_name = Dart_NewString("_LazyFunctionTypeMirror");
+ Dart_Handle cls_name = NewString("_LazyFunctionTypeMirror");
Dart_Handle cls = Dart_GetClass(MirrorLib(), cls_name);
Dart_Handle sig = Dart_ClassGetFunctionTypeSignature(target);
@@ -271,7 +276,7 @@
};
return Dart_New(cls, Dart_Null(), ARRAY_SIZE(args), args);
} else {
- Dart_Handle cls_name = Dart_NewString("_LazyTypeMirror");
+ Dart_Handle cls_name = NewString("_LazyTypeMirror");
Dart_Handle cls = Dart_GetClass(MirrorLib(), cls_name);
Dart_Handle lib = Dart_ClassGetLibrary(target);
Dart_Handle lib_name;
@@ -290,7 +295,7 @@
Dart_Handle owner = Dart_TypeVariableOwner(target);
Dart_Handle owner_mirror = CreateLazyMirror(owner);
- Dart_Handle cls_name = Dart_NewString("_LazyTypeVariableMirror");
+ Dart_Handle cls_name = NewString("_LazyTypeVariableMirror");
Dart_Handle cls = Dart_GetClass(MirrorLib(), cls_name);
Dart_Handle args[] = { var_name, owner_mirror };
@@ -336,7 +341,7 @@
Dart_Handle type_var_name,
Dart_Handle owner_mirror) {
ASSERT(Dart_IsTypeVariable(type_var));
- Dart_Handle cls_name = Dart_NewString("_LocalTypeVariableMirrorImpl");
+ Dart_Handle cls_name = NewString("_LocalTypeVariableMirrorImpl");
Dart_Handle cls = Dart_GetClass(MirrorLib(), cls_name);
if (Dart_IsError(cls)) {
return cls;
@@ -400,7 +405,7 @@
Dart_Handle cls_name,
Dart_Handle owner,
Dart_Handle owner_mirror) {
- Dart_Handle mirror_cls_name = Dart_NewString("_LocalTypedefMirrorImpl");
+ Dart_Handle mirror_cls_name = NewString("_LocalTypedefMirrorImpl");
Dart_Handle mirror_cls = Dart_GetClass(MirrorLib(), mirror_cls_name);
if (Dart_IsError(mirror_cls)) {
return mirror_cls;
@@ -438,7 +443,7 @@
return CreateTypedefMirror(intf, intf_name, lib, lib_mirror);
}
- Dart_Handle cls_name = Dart_NewString("_LocalClassMirrorImpl");
+ Dart_Handle cls_name = NewString("_LocalClassMirrorImpl");
Dart_Handle cls = Dart_GetClass(MirrorLib(), cls_name);
if (Dart_IsError(cls)) {
return cls;
@@ -447,7 +452,7 @@
// TODO(turnidge): Why am I getting Null when I expect Object?
Dart_Handle super_class = Dart_GetSuperclass(intf);
if (Dart_IsNull(super_class)) {
- super_class = Dart_GetClass(CoreLib(), Dart_NewString("Object"));
+ super_class = Dart_GetClass(CoreLib(), NewString("Object"));
}
Dart_Handle default_class = Dart_ClassGetDefault(intf);
@@ -489,7 +494,7 @@
Dart_Handle func_name,
Dart_Handle owner_mirror) {
ASSERT(Dart_IsFunction(func));
- Dart_Handle mirror_cls_name = Dart_NewString("_LocalMethodMirrorImpl");
+ Dart_Handle mirror_cls_name = NewString("_LocalMethodMirrorImpl");
Dart_Handle mirror_cls = Dart_GetClass(MirrorLib(), mirror_cls_name);
if (Dart_IsError(mirror_cls)) {
return mirror_cls;
@@ -562,7 +567,7 @@
Dart_Handle var_name,
Dart_Handle lib_mirror) {
ASSERT(Dart_IsVariable(var));
- Dart_Handle cls_name = Dart_NewString("_LocalVariableMirrorImpl");
+ Dart_Handle cls_name = NewString("_LocalVariableMirrorImpl");
Dart_Handle cls = Dart_GetClass(MirrorLib(), cls_name);
if (Dart_IsError(cls)) {
return cls;
@@ -795,7 +800,7 @@
static Dart_Handle CreateLibraryMirror(Dart_Handle lib) {
- Dart_Handle cls_name = Dart_NewString("_LocalLibraryMirrorImpl");
+ Dart_Handle cls_name = NewString("_LocalLibraryMirrorImpl");
Dart_Handle cls = Dart_GetClass(MirrorLib(), cls_name);
if (Dart_IsError(cls)) {
return cls;
@@ -855,7 +860,7 @@
static Dart_Handle CreateIsolateMirror() {
- Dart_Handle cls_name = Dart_NewString("_LocalIsolateMirrorImpl");
+ Dart_Handle cls_name = NewString("_LocalIsolateMirrorImpl");
Dart_Handle cls = Dart_GetClass(MirrorLib(), cls_name);
if (Dart_IsError(cls)) {
return cls;
@@ -869,7 +874,7 @@
static Dart_Handle CreateMirrorSystem() {
- Dart_Handle cls_name = Dart_NewString("_LocalMirrorSystemImpl");
+ Dart_Handle cls_name = NewString("_LocalMirrorSystemImpl");
Dart_Handle cls = Dart_GetClass(MirrorLib(), cls_name);
if (Dart_IsError(cls)) {
return cls;
@@ -894,14 +899,14 @@
static Dart_Handle CreateNullMirror() {
- Dart_Handle cls_name = Dart_NewString("_LocalInstanceMirrorImpl");
+ Dart_Handle cls_name = NewString("_LocalInstanceMirrorImpl");
Dart_Handle cls = Dart_GetClass(MirrorLib(), cls_name);
if (Dart_IsError(cls)) {
return cls;
}
// TODO(turnidge): This is wrong. The Null class is distinct from object.
- Dart_Handle object_class = Dart_GetClass(CoreLib(), Dart_NewString("Object"));
+ Dart_Handle object_class = Dart_GetClass(CoreLib(), NewString("Object"));
Dart_Handle args[] = {
CreateVMReference(Dart_Null()),
@@ -925,7 +930,7 @@
}
if (Dart_IsClosure(instance)) {
- Dart_Handle cls_name = Dart_NewString("_LocalClosureMirrorImpl");
+ Dart_Handle cls_name = NewString("_LocalClosureMirrorImpl");
Dart_Handle cls = Dart_GetClass(MirrorLib(), cls_name);
if (Dart_IsError(cls)) {
return cls;
@@ -938,7 +943,7 @@
}
// TODO(turnidge): Why not use the real function name here?
- Dart_Handle func_name = Dart_NewString("call");
+ Dart_Handle func_name = NewString("call");
Dart_Handle func_owner = Dart_FunctionOwner(func);
if (Dart_IsError(func_owner)) {
return func_owner;
@@ -960,7 +965,7 @@
return Dart_New(cls, Dart_Null(), ARRAY_SIZE(args), args);
} else {
- Dart_Handle cls_name = Dart_NewString("_LocalInstanceMirrorImpl");
+ Dart_Handle cls_name = NewString("_LocalInstanceMirrorImpl");
Dart_Handle cls = Dart_GetClass(MirrorLib(), cls_name);
if (Dart_IsError(cls)) {
return cls;
@@ -995,7 +1000,7 @@
if (Dart_IsError(stack)) {
return stack;
}
- Dart_Handle cls_name = Dart_NewString("MirroredUncaughtExceptionError");
+ Dart_Handle cls_name = NewString("MirroredUncaughtExceptionError");
Dart_Handle cls = Dart_GetClass(MirrorLib(), cls_name);
Dart_Handle args[] = {
CreateInstanceMirror(exc),
@@ -1007,9 +1012,9 @@
return Dart_NewUnhandledExceptionError(mirrored_exc);
} else if (Dart_IsApiError(error) ||
Dart_IsCompilationError(error)) {
- Dart_Handle cls_name = Dart_NewString("MirroredCompilationError");
+ Dart_Handle cls_name = NewString("MirroredCompilationError");
Dart_Handle cls = Dart_GetClass(MirrorLib(), cls_name);
- Dart_Handle args[] = { Dart_NewString(Dart_GetError(error)) };
+ Dart_Handle args[] = { NewString(Dart_GetError(error)) };
Dart_Handle mirrored_exc =
Dart_New(cls, Dart_Null(), ARRAY_SIZE(args), args);
return Dart_NewUnhandledExceptionError(mirrored_exc);
diff --git a/runtime/lib/object.cc b/runtime/lib/object.cc
index 9593ba0..24b4dfb 100644
--- a/runtime/lib/object.cc
+++ b/runtime/lib/object.cc
@@ -27,10 +27,12 @@
args.Add(&func_args);
Exceptions::ThrowByType(Exceptions::kNullPointer, args);
}
+ const Object& null_object = Object::Handle(Object::null());
GrowableArray<const Object*> dart_arguments(3);
dart_arguments.Add(&instance);
dart_arguments.Add(&function_name);
dart_arguments.Add(&func_args);
+ dart_arguments.Add(&null_object);
// Report if a function with same name (but different arguments) has been
// found.
diff --git a/runtime/lib/object_patch.dart b/runtime/lib/object_patch.dart
index 603e14e..401d94f 100644
--- a/runtime/lib/object_patch.dart
+++ b/runtime/lib/object_patch.dart
@@ -23,8 +23,14 @@
// A statically dispatched version of Object.toString.
static String _toString(obj) native "Object_toString";
- /* patch */ Dynamic noSuchMethod(String functionName, List args)
+ dynamic _noSuchMethod(String functionName, List args)
native "Object_noSuchMethod";
+ /* patch */ dynamic noSuchMethod(InvocationMirror invocation) {
+ var methodName = invocation.memberName;
+ var args = invocation.positionalArguments;
+ return _noSuchMethod(methodName, args);
+ }
+
/* patch */ Type get runtimeType native "Object_runtimeType";
}
diff --git a/runtime/lib/regexp_patch.dart b/runtime/lib/regexp_patch.dart
index 936a7fe..115dd45 100644
--- a/runtime/lib/regexp_patch.dart
+++ b/runtime/lib/regexp_patch.dart
@@ -18,7 +18,7 @@
String group(int groupIdx) {
if (groupIdx < 0 || groupIdx > regexp._groupCount) {
- throw new IndexOutOfRangeException(groupIdx);
+ throw new RangeError.value(groupIdx);
}
int startIndex = _start(groupIdx);
int endIndex = _end(groupIdx);
@@ -26,7 +26,8 @@
assert(endIndex == -1);
return null;
}
- return str._substringUnchecked(startIndex, endIndex);
+ // TODO(ajohnsen): Use _substringUnchecked when regexp is in core.
+ return str.substring(startIndex, endIndex);
}
String operator [](int groupIdx) {
@@ -98,7 +99,8 @@
if (match === null) {
return null;
}
- return str._substringUnchecked(match[0], match[1]);
+ // TODO(ajohnsen): Use _substringUnchecked when regexp is in core.
+ return str.substring(match[0], match[1]);
}
/* patch */ String get pattern native "JSSyntaxRegExp_getPattern";
diff --git a/runtime/lib/stopwatch_patch.dart b/runtime/lib/stopwatch_patch.dart
index b81b8b0..19645d1 100644
--- a/runtime/lib/stopwatch_patch.dart
+++ b/runtime/lib/stopwatch_patch.dart
@@ -4,7 +4,7 @@
// A VM patch of the stopwatch part of dart:core.
-patch class StopwatchImplementation {
+patch class _StopwatchImpl {
// Returns the current clock tick.
/* patch */ static int _now() native "Stopwatch_now";
diff --git a/runtime/lib/string.cc b/runtime/lib/string.cc
index 2d5bd91..7707ed6 100644
--- a/runtime/lib/string.cc
+++ b/runtime/lib/string.cc
@@ -15,14 +15,14 @@
GET_NATIVE_ARGUMENT(Array, a, arguments->At(0));
// TODO(srdjan): Check that parameterized type is an int.
Zone* zone = isolate->current_zone();
- intptr_t len = a.Length();
+ intptr_t array_len = a.Length();
// Unbox the array and determine the maximum element width.
bool is_one_byte_string = true;
- bool is_two_byte_string = true;
- uint32_t* temp = zone->Alloc<uint32_t>(len);
+ intptr_t utf16_len = array_len;
+ uint32_t* utf32_array = zone->Alloc<uint32_t>(array_len);
Object& index_object = Object::Handle(isolate);
- for (intptr_t i = 0; i < len; i++) {
+ for (intptr_t i = 0; i < array_len; i++) {
index_object = a.At(i);
if (!index_object.IsSmi()) {
GrowableArray<const Object*> args;
@@ -33,21 +33,20 @@
if (value < 0) {
GrowableArray<const Object*> args;
Exceptions::ThrowByType(Exceptions::kArgument, args);
- } else if (value > 0xFFFF) {
- is_one_byte_string = false;
- is_two_byte_string = false;
- } else if (value > 0xFF) {
- is_one_byte_string = false;
+ } else {
+ if (value > 0x7F) {
+ is_one_byte_string = false;
+ }
+ if (value > 0xFFFF) {
+ utf16_len += 1;
+ }
}
- temp[i] = value;
+ utf32_array[i] = value;
}
if (is_one_byte_string) {
- return OneByteString::New(temp, len, Heap::kNew);
- } else if (is_two_byte_string) {
- return TwoByteString::New(temp, len, Heap::kNew);
- } else {
- return FourByteString::New(temp, len, Heap::kNew);
+ return OneByteString::New(utf32_array, array_len, Heap::kNew);
}
+ return TwoByteString::New(utf16_len, utf32_array, array_len, Heap::kNew);
}
@@ -85,14 +84,14 @@
if ((index < 0) || (index >= str.Length())) {
GrowableArray<const Object*> arguments;
arguments.Add(&smi);
- Exceptions::ThrowByType(Exceptions::kIndexOutOfRange, arguments);
+ Exceptions::ThrowByType(Exceptions::kRange, arguments);
}
return str.CharAt(index);
} else {
// An index larger than Smi is always illegal.
GrowableArray<const Object*> arguments;
arguments.Add(&index);
- Exceptions::ThrowByType(Exceptions::kIndexOutOfRange, arguments);
+ Exceptions::ThrowByType(Exceptions::kRange, arguments);
return 0;
}
}
diff --git a/runtime/lib/string_base.dart b/runtime/lib/string_base.dart
index 792940d..11b594e 100644
--- a/runtime/lib/string_base.dart
+++ b/runtime/lib/string_base.dart
@@ -33,7 +33,7 @@
return _createFromCodePoints(objectArray);
}
- static String _createFromCodePoints(_ObjectArray<int> codePoints)
+ static String _createFromCodePoints(List<int> codePoints)
native "StringBase_createFromCodePoints";
String operator [](int index) native "String_charAt";
@@ -144,13 +144,13 @@
if (endIndex === null) endIndex = this.length;
if ((startIndex < 0) || (startIndex > this.length)) {
- throw new IndexOutOfRangeException(startIndex);
+ throw new RangeError.value(startIndex);
}
if ((endIndex < 0) || (endIndex > this.length)) {
- throw new IndexOutOfRangeException(endIndex);
+ throw new RangeError.value(endIndex);
}
if (startIndex > endIndex) {
- throw new IndexOutOfRangeException(startIndex);
+ throw new RangeError.value(startIndex);
}
return _substringUnchecked(startIndex, endIndex);
}
@@ -232,7 +232,7 @@
*/
static String _interpolate(List values) {
int numValues = values.length;
- var stringList = new _ObjectArray(numValues);
+ var stringList = new List(numValues);
for (int i = 0; i < numValues; i++) {
stringList[i] = values[i].toString();
}
@@ -349,7 +349,7 @@
return _concatAll(stringsArray);
}
- static String _concatAll(_ObjectArray<String> strings)
+ static String _concatAll(List<String> strings)
native "Strings_concatAll";
}
@@ -468,7 +468,7 @@
String group(int group) {
if (group != 0) {
- throw new IndexOutOfRangeException(group);
+ throw new RangeError.value(group);
}
return pattern;
}
diff --git a/runtime/lib/string_patch.dart b/runtime/lib/string_patch.dart
index b59e06a..2704c5f 100644
--- a/runtime/lib/string_patch.dart
+++ b/runtime/lib/string_patch.dart
@@ -2,8 +2,8 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-patch class StringImplementation {
- /* patch */ static String _fromCharCodes(List<int> charCodes) {
+patch class _StringImpl {
+ /* patch */ factory String.fromCharCodes(List<int> charCodes) {
return _StringBase.createFromCharCodes(charCodes);
}
diff --git a/runtime/tests/vm/dart/byte_array_test.dart b/runtime/tests/vm/dart/byte_array_test.dart
index 701669a..d148888 100644
--- a/runtime/tests/vm/dart/byte_array_test.dart
+++ b/runtime/tests/vm/dart/byte_array_test.dart
@@ -20,13 +20,13 @@
0, 0, 0, 0, 0],
array);
Expect.throws(() { array[-1] = 0; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { return array[-1]; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { array[10]; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { array[10] = 0; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { array.add(0); },
(e) { return e is UnsupportedError; });
Expect.throws(() { array.addAll([0]); },
@@ -104,13 +104,13 @@
0, 0, 0, 0, 0],
array);
Expect.throws(() { array[-1] = 0; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { return array[-1]; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { array[10]; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { array[10] = 0; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { array.add(0); },
(e) { return e is UnsupportedError; });
Expect.throws(() { array.addAll([0]); },
@@ -176,13 +176,13 @@
0, 0, 0, 0, 0],
array);
Expect.throws(() { array[-1] = 0; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { return array[-1]; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { array[10]; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { array[10] = 0; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { array.add(0); },
(e) { return e is UnsupportedError; });
Expect.throws(() { array.addAll([0]); },
@@ -260,13 +260,13 @@
0, 0, 0, 0, 0],
array);
Expect.throws(() { array[-1] = 0; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { return array[-1]; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { array[10]; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { array[10] = 0; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { array.add(0); },
(e) { return e is UnsupportedError; });
Expect.throws(() { array.addAll([0]); },
@@ -332,13 +332,13 @@
0, 0, 0, 0, 0],
array);
Expect.throws(() { array[-1] = 0; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { return array[-1]; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { array[10]; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { array[10] = 0; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { array.add(0); },
(e) { return e is UnsupportedError; });
Expect.throws(() { array.addAll([0]); },
@@ -422,13 +422,13 @@
0, 0, 0, 0, 0],
array);
Expect.throws(() { array[-1] = 0; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { return array[-1]; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { array[10]; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { array[10] = 0; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { array.add(0); },
(e) { return e is UnsupportedError; });
Expect.throws(() { array.addAll([0]); },
@@ -497,13 +497,13 @@
0, 0, 0, 0, 0],
array);
Expect.throws(() { array[-1] = 0; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { return array[-1]; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { array[10]; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { array[10] = 0; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { array.add(0); },
(e) { return e is UnsupportedError; });
Expect.throws(() { array.addAll([0]); },
@@ -588,13 +588,13 @@
0, 0, 0, 0, 0],
array);
Expect.throws(() { array[-1] = 0; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { return array[-1]; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { array[10]; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { array[10] = 0; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { array.add(0); },
(e) { return e is UnsupportedError; });
Expect.throws(() { array.addAll([0]); },
@@ -663,13 +663,13 @@
0.0, 0.0, 0.0, 0.0, 0.0],
array);
Expect.throws(() { array[-1] = 0.0; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { return array[-1]; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { array[10]; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { array[10] = 0.0; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { array.add(0.0); },
(e) { return e is UnsupportedError; });
Expect.throws(() { array.addAll([0]); },
@@ -725,13 +725,13 @@
0.0, 0.0, 0.0, 0.0, 0.0],
array);
Expect.throws(() { array[-1] = 0.0; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { return array[-1]; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { array[10]; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { array[10] = 0.0; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { array.add(0.0); },
(e) { return e is UnsupportedError; });
Expect.throws(() { array.addAll([0]); },
@@ -782,85 +782,85 @@
var byte_array = array.asByteArray(0, array.lengthInBytes());
Expect.equals(8, byte_array.lengthInBytes());
Expect.throws(() { byte_array.getInt8(-1); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { byte_array.getUint8(-1); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { byte_array.getInt16(-1); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { byte_array.getUint16(-1); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { byte_array.getInt32(-1); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { byte_array.getUint32(-1); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { byte_array.getInt64(-1); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { byte_array.getUint64(-1); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { byte_array.getFloat32(-1); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { byte_array.getFloat64(-1); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { byte_array.setInt8(-1, 0); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { byte_array.setUint8(-1, 0); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { byte_array.setInt16(-1, 0); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { byte_array.setUint16(-1, 0); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { byte_array.setInt32(-1, 0); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { byte_array.setUint32(-1, 0); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { byte_array.setInt64(-1, 0); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { byte_array.setUint64(-1, 0); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { byte_array.setFloat32(-1, 0.0); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { byte_array.setFloat64(-1, 0.0); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { byte_array.getInt8(8); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { byte_array.getUint8(8); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { byte_array.getInt16(8); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { byte_array.getUint16(8); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { byte_array.getInt32(8); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { byte_array.getUint32(8); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { byte_array.getInt64(8); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { byte_array.getUint64(8); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { byte_array.getFloat32(8); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { byte_array.getFloat64(8); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { byte_array.setInt8(8, 0); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { byte_array.setUint8(8, 0); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { byte_array.setInt16(8, 0); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { byte_array.setUint16(8, 0); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { byte_array.setInt32(8, 0); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { byte_array.setUint32(8, 0); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { byte_array.setInt64(8, 0); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { byte_array.setUint64(8, 0); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { byte_array.setFloat32(8, 0.0); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { byte_array.setFloat64(8, 0.0); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.equals(0, byte_array.getInt8(0));
Expect.equals(0, byte_array.getUint8(0));
Expect.equals(0, byte_array.getInt16(0));
@@ -929,18 +929,18 @@
array[i] = 0xFF;
}
Expect.throws(() { new Int8List.view(array.asByteArray(), -1); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { new Int8List.view(array.asByteArray(), 0, -1); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { new Int8List.view(array.asByteArray(),
array.lengthInBytes() + 1); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { new Int8List.view(array.asByteArray(),
0, array.length + 1); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { new Int8List.view(array.asByteArray(),
array.length - 1, 2); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
var empty = new Int8List.view(array.asByteArray(),
array.lengthInBytes());
Expect.isTrue(empty is List<int>);
@@ -960,13 +960,13 @@
-1, -1, -1, -1, -1],
view);
Expect.throws(() { view[-1] = 0; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { return view[-1]; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { view[view.length]; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { view[10] = 0; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { view.add(0); },
(e) { return e is UnsupportedError; });
Expect.throws(() { view.addAll([0]); },
@@ -1057,18 +1057,18 @@
array[i] = -1;
}
Expect.throws(() { new Uint8List.view(array.asByteArray(), -1); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { new Uint8List.view(array.asByteArray(), 0, -1); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { new Uint8List.view(array.asByteArray(),
array.lengthInBytes() + 1); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { new Uint8List.view(array.asByteArray(),
0, array.length + 1); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { new Uint8List.view(array.asByteArray(),
array.length - 1, 2); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
var empty = new Uint8List.view(array.asByteArray(),
array.lengthInBytes());
Expect.isTrue(empty is List<int>);
@@ -1088,13 +1088,13 @@
0xFF, 0xFF, 0xFF, 0xFF, 0xFF],
view);
Expect.throws(() { view[-1] = 0; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { return view[-1]; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { view[view.length]; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { view[view.length] = 0; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { view.add(0); },
(e) { return e is UnsupportedError; });
Expect.throws(() { view.addAll([0]); },
@@ -1164,18 +1164,18 @@
array[i] = 0xFF;
}
Expect.throws(() { new Int16List.view(array.asByteArray(), -1); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { new Int16List.view(array.asByteArray(), 0, -1); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { new Int16List.view(array.asByteArray(),
array.lengthInBytes() + 1); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { new Int16List.view(array.asByteArray(),
0, array.length + 1); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { new Int16List.view(array.asByteArray(),
array.length - 1, 2); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
var empty = new Int16List.view(array.asByteArray(),
array.lengthInBytes());
Expect.isTrue(empty is List<int>);
@@ -1195,13 +1195,13 @@
-1, -1, -1, -1, -1],
view);
Expect.throws(() { view[-1] = 0; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { return view[-1]; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { view[view.length]; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { view[10] = 0; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { view.add(0); },
(e) { return e is UnsupportedError; });
Expect.throws(() { view.addAll([0]); },
@@ -1299,18 +1299,18 @@
array[i] = -1;
}
Expect.throws(() { new Uint16List.view(array.asByteArray(), -1); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { new Uint16List.view(array.asByteArray(), 0, -1); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { new Uint16List.view(array.asByteArray(),
array.lengthInBytes() + 1); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { new Uint16List.view(array.asByteArray(),
0, array.length + 1); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { new Uint16List.view(array.asByteArray(),
array.length - 1, 2); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
var empty = new Uint16List.view(array.asByteArray(),
array.lengthInBytes());
Expect.isTrue(empty is List<int>);
@@ -1330,13 +1330,13 @@
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF],
view);
Expect.throws(() { view[-1] = 0; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { return view[-1]; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { view[view.length]; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { view[view.length] = 0; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { view.add(0); },
(e) { return e is UnsupportedError; });
Expect.throws(() { view.addAll([0]); },
@@ -1411,18 +1411,18 @@
array[i] = 0xFF;
}
Expect.throws(() { new Int32List.view(array.asByteArray(), -1); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { new Int32List.view(array.asByteArray(), 0, -1); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { new Int32List.view(array.asByteArray(),
array.lengthInBytes() + 1); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { new Int32List.view(array.asByteArray(),
0, array.length + 1); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { new Int32List.view(array.asByteArray(),
array.length - 1, 2); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
var empty = new Int32List.view(array.asByteArray(),
array.lengthInBytes());
Expect.isTrue(empty is List<int>);
@@ -1442,13 +1442,13 @@
-1, -1, -1, -1, -1],
view);
Expect.throws(() { view[-1] = 0; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { return view[-1]; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { view[view.length]; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { view[10] = 0; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { view.add(0); },
(e) { return e is UnsupportedError; });
Expect.throws(() { view.addAll([0]); },
@@ -1570,18 +1570,18 @@
array[i] = -1;
}
Expect.throws(() { new Uint32List.view(array.asByteArray(), -1); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { new Uint32List.view(array.asByteArray(), 0, -1); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { new Uint32List.view(array.asByteArray(),
array.lengthInBytes() + 1); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { new Uint32List.view(array.asByteArray(),
0, array.length + 1); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { new Uint32List.view(array.asByteArray(),
array.length - 1, 2); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
var empty = new Uint32List.view(array.asByteArray(),
array.lengthInBytes());
Expect.isTrue(empty is List<int>);
@@ -1601,13 +1601,13 @@
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF],
view);
Expect.throws(() { view[-1] = 0; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { return view[-1]; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { view[view.length]; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { view[view.length] = 0; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { view.add(0); },
(e) { return e is UnsupportedError; });
Expect.throws(() { view.addAll([0]); },
@@ -1699,18 +1699,18 @@
array[i] = 0xFF;
}
Expect.throws(() { new Int64List.view(array.asByteArray(), -1); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { new Int64List.view(array.asByteArray(), 0, -1); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { new Int64List.view(array.asByteArray(),
array.lengthInBytes() + 1); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { new Int64List.view(array.asByteArray(),
0, array.length + 1); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { new Int64List.view(array.asByteArray(),
array.length - 1, 2); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
var empty = new Int64List.view(array.asByteArray(),
array.lengthInBytes());
Expect.isTrue(empty is List<int>);
@@ -1730,13 +1730,13 @@
-1, -1, -1, -1, -1],
view);
Expect.throws(() { view[-1] = 0; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { return view[-1]; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { view[view.length]; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { view[10] = 0; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { view.add(0); },
(e) { return e is UnsupportedError; });
Expect.throws(() { view.addAll([0]); },
@@ -1895,18 +1895,18 @@
array[i] = -1;
}
Expect.throws(() { new Uint64List.view(array.asByteArray(), -1); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { new Uint64List.view(array.asByteArray(), 0, -1); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { new Uint64List.view(array.asByteArray(),
array.lengthInBytes() + 1); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { new Uint64List.view(array.asByteArray(),
0, array.length + 1); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { new Uint64List.view(array.asByteArray(),
array.length - 1, 2); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
var empty = new Uint64List.view(array.asByteArray(),
array.lengthInBytes());
Expect.isTrue(empty is List<int>);
@@ -1929,13 +1929,13 @@
0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF],
view);
Expect.throws(() { view[-1] = 0; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { return view[-1]; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { view[view.length]; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { view[view.length] = 0; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { view.add(0); },
(e) { return e is UnsupportedError; });
Expect.throws(() { view.addAll([0]); },
@@ -2052,18 +2052,18 @@
array[i] = 0xBF800000;
}
Expect.throws(() { new Float32List.view(array.asByteArray(), -1); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { new Float32List.view(array.asByteArray(), 0, -1); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { new Float32List.view(array.asByteArray(),
array.lengthInBytes() + 1); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { new Float32List.view(array.asByteArray(),
0, array.lengthInBytes() + 1); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { new Float32List.view(array.asByteArray(),
array.lengthInBytes() - 1, 2); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
var empty = new Float32List.view(array.asByteArray(),
array.lengthInBytes());
Expect.isTrue(empty is List<double>);
@@ -2083,13 +2083,13 @@
-1.0, -1.0, -1.0, -1.0, -1.0],
view);
Expect.throws(() { view[-1] = 0.0; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { return view[-1]; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { view[10]; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { view[10] = 0.0; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { array.add(0.0); },
(e) { return e is UnsupportedError; });
Expect.throws(() { array.addAll([0]); },
@@ -2155,18 +2155,18 @@
array[i] = 0xBFF0000000000000;
}
Expect.throws(() { new Float64List.view(array.asByteArray(), -1); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { new Float64List.view(array.asByteArray(), 0, -1); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { new Float64List.view(array.asByteArray(),
array.lengthInBytes() + 1); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { new Float64List.view(array.asByteArray(),
0, array.lengthInBytes() + 1); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { new Float64List.view(array.asByteArray(),
array.lengthInBytes() - 1, 2); },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
var empty = new Float64List.view(array.asByteArray(),
array.lengthInBytes());
Expect.isTrue(empty is List<double>);
@@ -2186,13 +2186,13 @@
-1.0, -1.0, -1.0, -1.0, -1.0],
view);
Expect.throws(() { view[-1] = 0.0; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { return view[-1]; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { view[10]; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { view[10] = 0.0; },
- (e) { return e is IndexOutOfRangeException; });
+ (e) { return e is RangeError; });
Expect.throws(() { array.add(0.0); },
(e) { return e is UnsupportedError; });
Expect.throws(() { array.addAll([0]); },
diff --git a/runtime/tests/vm/dart/isolate_mirror_local_test.dart b/runtime/tests/vm/dart/isolate_mirror_local_test.dart
index 185e043..a34c4e2 100644
--- a/runtime/tests/vm/dart/isolate_mirror_local_test.dart
+++ b/runtime/tests/vm/dart/isolate_mirror_local_test.dart
@@ -304,7 +304,7 @@
Expect.equals('dart:core.List', list_intf.qualifiedName);
Expect.isFalse(list_intf.isPrivate);
Expect.equals('Object', list_intf.superclass.simpleName);
- Expect.equals('ListImplementation', list_intf.defaultFactory.simpleName);
+ Expect.equals('_ListImpl', list_intf.defaultFactory.simpleName);
Expect.equals('dart:core', list_intf.owner.simpleName);
Expect.isFalse(list_intf.isClass);
Expect.equals('Collection', list_intf.superinterfaces[0].simpleName);
diff --git a/runtime/tools/android_finder.py b/runtime/tools/android_finder.py
index 48d5517..93c53fc 100755
--- a/runtime/tools/android_finder.py
+++ b/runtime/tools/android_finder.py
@@ -174,7 +174,9 @@
continue
match = line_re.match(line)
if match is None:
- raise utils.Error('Match failed')
+ sys.stderr.write('Match fail %s\n' % str(line))
+ continue
+ #raise utils.Error('Match failed')
entry[match.group(1)] = match.group(2)
if len(entry) > 0:
result.append(entry)
diff --git a/runtime/tools/make_version.py b/runtime/tools/make_version.py
index e3d8a70..3066873 100644
--- a/runtime/tools/make_version.py
+++ b/runtime/tools/make_version.py
@@ -20,37 +20,29 @@
def getVersionPart(version_file, part):
command = ['awk', '$1 == "%s" {print $2}' % (part), version_file]
- debugLog("Getting version part: %s Running command %s" % (part, command))
proc = subprocess.Popen(command,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
result = proc.communicate()[0].split('\n')[0]
- debugLog("Got result: %s" % result)
return result
def getRevision():
- debugLog("Getting revision")
is_svn = True
if os.path.exists('.svn'):
- debugLog("Using svn to get revision")
cmd = ['svn', 'info']
else:
git_proc = subprocess.Popen(
['git', 'branch', '-r'],
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
if 'git-svn' in git_proc.communicate()[0]:
- debugLog("Using git svn to get revision")
cmd = ['git', 'svn', 'info']
else:
# Cannot get revision because we are not in svn or
# git svn checkout.
- debugLog("Could not get revision: not an svn or git-svn checkout?")
return ''
- debugLog("Running command to get revision: %s" % cmd)
proc = subprocess.Popen(cmd,
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
revision = proc.communicate()[0].split('\n')[4].split(' ')[1]
- debugLog("Got revision: %s" % revision)
return revision
def makeVersionString(version_file):
@@ -73,14 +65,11 @@
return version_string
def makeFile(output_file, input_file, version_file):
- debugLog("Making version file")
version_cc_text = open(input_file).read()
version_string = makeVersionString(version_file)
- debugLog("Writing version to version_cc file: %s" % version_string)
version_cc_text = version_cc_text.replace("{{VERSION_STR}}",
version_string)
version_time = time.ctime(time.time())
- debugLog("Writing time to version_cc file: %s" % version_time)
version_cc_text = version_cc_text.replace("{{BUILD_TIME}}",
version_time)
open(output_file, 'w').write(version_cc_text)
@@ -126,7 +115,5 @@
return -1
if __name__ == '__main__':
- debugLog('starting make_version.py')
exit_code = main(sys.argv)
- debugLog('exiting make_version.py (exit code: %s)' % exit_code)
sys.exit(exit_code)
diff --git a/runtime/vm/ast.cc b/runtime/vm/ast.cc
index d63dd7f..9c68a9b 100644
--- a/runtime/vm/ast.cc
+++ b/runtime/vm/ast.cc
@@ -315,6 +315,9 @@
AstNode* LoadStaticFieldNode::MakeAssignmentNode(AstNode* rhs) {
+ if (field().is_final()) {
+ return NULL;
+ }
return new StoreStaticFieldNode(token_pos(), field(), rhs);
}
@@ -325,7 +328,8 @@
AstNode* LoadIndexedNode::MakeAssignmentNode(AstNode* rhs) {
- return new StoreIndexedNode(token_pos(), array(), index_expr(), rhs);
+ return new StoreIndexedNode(token_pos(), array(), index_expr(),
+ rhs, super_class());
}
@@ -361,6 +365,9 @@
const Field& field =
Field::ZoneHandle(cls().LookupStaticField(field_name()));
if (!field.IsNull()) {
+ if (field.is_final()) {
+ return NULL;
+ }
#if defined(DEBUG)
const String& getter_name =
String::Handle(Field::GetterName(field_name()));
diff --git a/runtime/vm/ast.h b/runtime/vm/ast.h
index 83182c0..96ff9af 100644
--- a/runtime/vm/ast.h
+++ b/runtime/vm/ast.h
@@ -458,6 +458,10 @@
const Object& primary() const { return primary_; }
+ bool IsSuper() const {
+ return primary().IsString() && (primary().raw() == Symbols::Super());
+ }
+
virtual void VisitChildren(AstNodeVisitor* visitor) const;
DECLARE_COMMON_NODE_FUNCTIONS(PrimaryNode);
@@ -1114,14 +1118,23 @@
class LoadIndexedNode : public AstNode {
public:
- LoadIndexedNode(intptr_t token_pos, AstNode* array, AstNode* index)
- : AstNode(token_pos), array_(array), index_expr_(index) {
+ LoadIndexedNode(intptr_t token_pos,
+ AstNode* array,
+ AstNode* index,
+ const Class& super_class)
+ : AstNode(token_pos),
+ array_(array),
+ index_expr_(index),
+ super_class_(super_class) {
ASSERT(array_ != NULL);
ASSERT(index_expr_ != NULL);
+ ASSERT(super_class_.IsZoneHandle());
}
AstNode* array() const { return array_; }
AstNode* index_expr() const { return index_expr_; }
+ const Class& super_class() const { return super_class_; }
+ bool IsSuperLoad() const { return !super_class_.IsNull(); }
virtual void VisitChildren(AstNodeVisitor* visitor) const {
array()->Visit(visitor);
@@ -1135,6 +1148,7 @@
private:
AstNode* array_;
AstNode* index_expr_;
+ const Class& super_class_;
DISALLOW_IMPLICIT_CONSTRUCTORS(LoadIndexedNode);
};
@@ -1142,16 +1156,26 @@
class StoreIndexedNode : public AstNode {
public:
StoreIndexedNode(intptr_t token_pos,
- AstNode* array, AstNode* index, AstNode* value)
- : AstNode(token_pos), array_(array), index_expr_(index), value_(value) {
+ AstNode* array,
+ AstNode* index,
+ AstNode* value,
+ const Class& super_class)
+ : AstNode(token_pos),
+ array_(array),
+ index_expr_(index),
+ value_(value),
+ super_class_(super_class) {
ASSERT(array_ != NULL);
ASSERT(index_expr_ != NULL);
ASSERT(value_ != NULL);
+ ASSERT(super_class_.IsZoneHandle());
}
AstNode* array() const { return array_; }
AstNode* index_expr() const { return index_expr_; }
AstNode* value() const { return value_; }
+ const Class& super_class() const { return super_class_; }
+ bool IsSuperStore() const { return !super_class_.IsNull(); }
virtual void VisitChildren(AstNodeVisitor* visitor) const {
array()->Visit(visitor);
@@ -1165,6 +1189,7 @@
AstNode* array_;
AstNode* index_expr_;
AstNode* value_;
+ const Class& super_class_;
DISALLOW_IMPLICIT_CONSTRUCTORS(StoreIndexedNode);
};
diff --git a/runtime/vm/ast_printer.cc b/runtime/vm/ast_printer.cc
index e286325..d4d3c32 100644
--- a/runtime/vm/ast_printer.cc
+++ b/runtime/vm/ast_printer.cc
@@ -326,12 +326,16 @@
void AstPrinter::VisitLoadIndexedNode(LoadIndexedNode* node) {
- VisitGenericAstNode(node);
+ OS::Print("(%s%s ", node->Name(), node->IsSuperLoad() ? " super" : "");
+ node->VisitChildren(this);
+ OS::Print(")");
}
void AstPrinter::VisitStoreIndexedNode(StoreIndexedNode* node) {
- VisitGenericAstNode(node);
+ OS::Print("(%s%s ", node->Name(), node->IsSuperStore() ? " super" : "");
+ node->VisitChildren(this);
+ OS::Print(")");
}
diff --git a/runtime/vm/benchmark_test.cc b/runtime/vm/benchmark_test.cc
index c23c54e..ccc840c 100644
--- a/runtime/vm/benchmark_test.cc
+++ b/runtime/vm/benchmark_test.cc
@@ -173,26 +173,18 @@
// Create a native wrapper class with native fields.
Dart_Handle result = Dart_CreateNativeWrapperClass(
- lib,
- Dart_NewString("NativeFieldsWrapper"),
- 1);
+ lib, NewString("NativeFieldsWrapper"), 1);
EXPECT_VALID(result);
Dart_Handle args[1];
args[0] = Dart_NewInteger(kNumIterations);
// Warmup first to avoid compilation jitters.
- Dart_Invoke(lib,
- Dart_NewString("benchmark"),
- 1,
- args);
+ Dart_Invoke(lib, NewString("benchmark"), 1, args);
Timer timer(true, "UseDartApi benchmark");
timer.Start();
- Dart_Invoke(lib,
- Dart_NewString("benchmark"),
- 1,
- args);
+ Dart_Invoke(lib, NewString("benchmark"), 1, args);
timer.Stop();
int64_t elapsed_time = timer.TotalElapsedTime();
benchmark->set_score(elapsed_time);
@@ -211,17 +203,15 @@
// Create strings.
uint8_t data8[] = { 'o', 'n', 'e', 0xFF };
int external_peer_data = 123;
- Dart_Handle external_string = Dart_NewExternalString8(data8,
- ARRAY_SIZE(data8),
- &external_peer_data,
- NULL);
- Dart_Handle internal_string = Dart_NewString("two");
+ Dart_Handle external_string = Dart_NewExternalUTF8String(data8,
+ ARRAY_SIZE(data8),
+ &external_peer_data,
+ NULL);
+ Dart_Handle internal_string = NewString("two");
// Run benchmark.
for (int64_t i = 0; i < kNumIterations; i++) {
EXPECT(Dart_IsString(internal_string));
- EXPECT(Dart_IsString8(internal_string));
- EXPECT(Dart_IsString16(internal_string));
EXPECT(!Dart_IsExternalString(internal_string));
EXPECT_VALID(external_string);
EXPECT(Dart_IsExternalString(external_string));
@@ -387,8 +377,8 @@
Dart_Handle lib = TestCase::LoadTestScript(
kScriptChars,
reinterpret_cast<Dart_NativeEntryResolver>(StackFrameNativeResolver));
- Dart_Handle cls = Dart_GetClass(lib, Dart_NewString("StackFrameTest"));
- Dart_Handle result = Dart_Invoke(cls, Dart_NewString("testMain"), 0, NULL);
+ Dart_Handle cls = Dart_GetClass(lib, NewString("StackFrameTest"));
+ Dart_Handle result = Dart_Invoke(cls, NewString("testMain"), 0, NULL);
EXPECT_VALID(result);
int64_t elapsed_time = 0;
result = Dart_IntegerToInt64(result, &elapsed_time);
diff --git a/runtime/vm/benchmark_test.h b/runtime/vm/benchmark_test.h
index 91043b7..ce7f2d0 100644
--- a/runtime/vm/benchmark_test.h
+++ b/runtime/vm/benchmark_test.h
@@ -35,6 +35,11 @@
static void Dart_BenchmarkHelper##name(Benchmark* benchmark)
+inline Dart_Handle NewString(const char* str) {
+ return Dart_NewStringFromCString(str);
+}
+
+
class Benchmark {
public:
typedef void (RunEntry)(Benchmark* benchmark);
diff --git a/runtime/vm/bootstrap.cc b/runtime/vm/bootstrap.cc
index 1e1ddd7..f71cf5a 100644
--- a/runtime/vm/bootstrap.cc
+++ b/runtime/vm/bootstrap.cc
@@ -42,6 +42,13 @@
}
+RawScript* Bootstrap::LoadCollectionScript(bool patch) {
+ const char* url = patch ? "dart:collection-patch" : "dart:collection";
+ const char* source = patch ? collection_source_ : collection_source_;
+ return LoadScript(url, source, patch);
+}
+
+
RawScript* Bootstrap::LoadMathScript(bool patch) {
const char* url = patch ? "dart:math-patch" : "dart:math";
const char* source = patch ? math_patch_ : math_source_;
diff --git a/runtime/vm/bootstrap.h b/runtime/vm/bootstrap.h
index 0b7412a..9f7f4e1 100644
--- a/runtime/vm/bootstrap.h
+++ b/runtime/vm/bootstrap.h
@@ -19,6 +19,7 @@
public:
static RawScript* LoadCoreScript(bool patch);
static RawScript* LoadCoreImplScript(bool patch);
+ static RawScript* LoadCollectionScript(bool patch);
static RawScript* LoadMathScript(bool patch);
static RawScript* LoadIsolateScript(bool patch);
static RawScript* LoadMirrorsScript(bool patch);
@@ -33,6 +34,7 @@
static const char corelib_patch_[];
static const char corelib_impl_source_[];
static const char corelib_impl_patch_[];
+ static const char collection_source_[];
static const char math_source_[];
static const char math_patch_[];
static const char isolate_source_[];
diff --git a/runtime/vm/bootstrap_natives.cc b/runtime/vm/bootstrap_natives.cc
index fa368b6..319a0cc 100644
--- a/runtime/vm/bootstrap_natives.cc
+++ b/runtime/vm/bootstrap_natives.cc
@@ -64,6 +64,10 @@
ASSERT(!library.IsNull());
library.set_native_entry_resolver(resolver);
+ library = Library::CollectionLibrary();
+ ASSERT(!library.IsNull());
+ library.set_native_entry_resolver(resolver);
+
library = Library::MirrorsLibrary();
ASSERT(!library.IsNull());
library.set_native_entry_resolver(resolver);
diff --git a/runtime/vm/bootstrap_nocorelib.cc b/runtime/vm/bootstrap_nocorelib.cc
index dca7e2e..26847f4 100644
--- a/runtime/vm/bootstrap_nocorelib.cc
+++ b/runtime/vm/bootstrap_nocorelib.cc
@@ -27,6 +27,12 @@
}
+RawScript* Bootstrap::LoadCollectionScript(bool is_patch) {
+ UNREACHABLE();
+ return Script::null();
+}
+
+
RawScript* Bootstrap::LoadMathScript(bool is_patch) {
UNREACHABLE();
return Script::null();
diff --git a/runtime/vm/class_finalizer.cc b/runtime/vm/class_finalizer.cc
index ce87b6b..dec72be 100644
--- a/runtime/vm/class_finalizer.cc
+++ b/runtime/vm/class_finalizer.cc
@@ -127,14 +127,10 @@
ASSERT(OneByteString::InstanceSize() == cls.instance_size());
cls = object_store->two_byte_string_class();
ASSERT(TwoByteString::InstanceSize() == cls.instance_size());
- cls = object_store->four_byte_string_class();
- ASSERT(FourByteString::InstanceSize() == cls.instance_size());
cls = object_store->external_one_byte_string_class();
ASSERT(ExternalOneByteString::InstanceSize() == cls.instance_size());
cls = object_store->external_two_byte_string_class();
ASSERT(ExternalTwoByteString::InstanceSize() == cls.instance_size());
- cls = object_store->external_four_byte_string_class();
- ASSERT(ExternalFourByteString::InstanceSize() == cls.instance_size());
cls = object_store->double_class();
ASSERT(Double::InstanceSize() == cls.instance_size());
cls = object_store->bool_class();
@@ -269,10 +265,8 @@
case kDoubleCid:
case kOneByteStringCid:
case kTwoByteStringCid:
- case kFourByteStringCid:
case kExternalOneByteStringCid:
case kExternalTwoByteStringCid:
- case kExternalFourByteStringCid:
case kBoolCid:
case kArrayCid:
case kImmutableArrayCid:
diff --git a/runtime/vm/code_generator.cc b/runtime/vm/code_generator.cc
index 90a9813..718e9a4 100644
--- a/runtime/vm/code_generator.cc
+++ b/runtime/vm/code_generator.cc
@@ -1190,7 +1190,46 @@
return; // Return closure object.
}
}
- Exceptions::ThrowByType(Exceptions::kObjectNotClosure, invoke_arguments);
+ // The result instance is not a closure, try to invoke method "call" before
+ // throwing a NoSuchMethodError.
+
+ // TODO(regis): Factorize the following code.
+
+ // TODO(regis): Args should be passed.
+ const Array& function_args = Array::Handle();
+ const String& function_name = String::Handle(Symbols::Call());
+ GrowableArray<const Object*> dart_arguments(5);
+
+ // TODO(regis): Resolve and invoke "call" method, if existing.
+
+ const Object& null_object = Object::Handle();
+ dart_arguments.Add(&result);
+ dart_arguments.Add(&function_name);
+ dart_arguments.Add(&function_args);
+ dart_arguments.Add(&null_object);
+
+ // Report if a function "call" with different arguments has been found.
+ {
+ Class& instance_class = Class::Handle(result.clazz());
+ Function& function =
+ Function::Handle(instance_class.LookupDynamicFunction(function_name));
+ while (function.IsNull()) {
+ instance_class = instance_class.SuperClass();
+ if (instance_class.IsNull()) break;
+ function = instance_class.LookupDynamicFunction(function_name);
+ }
+ if (!function.IsNull()) {
+ const int total_num_parameters = function.NumParameters();
+ const Array& array = Array::Handle(Array::New(total_num_parameters - 1));
+ // Skip receiver.
+ for (int i = 1; i < total_num_parameters; i++) {
+ array.SetAt(i - 1, String::Handle(function.ParameterNameAt(i)));
+ }
+ dart_arguments.Add(&array);
+ }
+ }
+ Exceptions::ThrowByType(Exceptions::kNoSuchMethod, dart_arguments);
+ UNREACHABLE();
}
@@ -1244,7 +1283,7 @@
named_arg_pos = Smi::New(named_arg_pos.Value() - 1);
adjusted_arg_descriptor.SetAt(index + 1, named_arg_pos);
}
- adjusted_arg_descriptor.SetAt(len - 1, Object::Handle(Object::null()));
+ adjusted_arg_descriptor.SetAt(len - 1, Object::Handle());
// It is too late to share the descriptor by canonicalizing it. However, it is
// important that the argument names are canonicalized (i.e. are symbols).
@@ -1282,23 +1321,43 @@
const String& original_function_name = String::Handle(ic_data.target_name());
ASSERT(!Array::CheckedHandle(arguments.At(2)).IsNull());
const Array& orig_arguments = Array::CheckedHandle(arguments.At(3));
- // TODO(regis): The signature of the "noSuchMethod" method has to change from
- // noSuchMethod(String name, Array arguments) to something like
- // noSuchMethod(InvocationMirror call).
- const int kNumArguments = 3;
- const int kNumNamedArguments = 0;
+ // Allocate an InvocationMirror object.
+ // TODO(regis): Fill in the InvocationMirror object correctly at
+ // this point we do not deal with named arguments and treat them
+ // all as positional.
+ const Library& core_lib = Library::Handle(Library::CoreLibrary());
+ const String& invocation_mirror_name = String::Handle(
+ Symbols::InvocationMirror());
+ Class& invocation_mirror_class = Class::Handle(
+ core_lib.LookupClassAllowPrivate(invocation_mirror_name));
+ ASSERT(!invocation_mirror_class.IsNull());
+ const String& allocation_function_name = String::Handle(
+ Symbols::AllocateInvocationMirror());
+ const Function& allocation_function = Function::ZoneHandle(
+ Resolver::ResolveStaticByName(invocation_mirror_class,
+ allocation_function_name,
+ Resolver::kIsQualified));
+ ASSERT(!allocation_function.IsNull());
+ GrowableArray<const Object*> allocation_arguments(2);
+ allocation_arguments.Add(&original_function_name);
+ allocation_arguments.Add(&orig_arguments);
const Array& kNoArgumentNames = Array::Handle();
- const String& function_name =
- String::Handle(Symbols::NoSuchMethod());
+ const Object& invocation_mirror = Object::Handle(
+ DartEntry::InvokeStatic(allocation_function,
+ allocation_arguments,
+ kNoArgumentNames));
+
+ const int kNumArguments = 2;
+ const int kNumNamedArguments = 0;
+ const String& function_name = String::Handle(Symbols::NoSuchMethod());
const Function& function = Function::ZoneHandle(
Resolver::ResolveDynamic(receiver,
function_name,
kNumArguments,
kNumNamedArguments));
ASSERT(!function.IsNull());
- GrowableArray<const Object*> invoke_arguments(2);
- invoke_arguments.Add(&original_function_name);
- invoke_arguments.Add(&orig_arguments);
+ GrowableArray<const Object*> invoke_arguments(1);
+ invoke_arguments.Add(&invocation_mirror);
const Object& result = Object::Handle(
DartEntry::InvokeDynamic(receiver,
function,
@@ -1309,27 +1368,73 @@
}
-// Report that an object is not a closure.
+// A non-closure object was invoked as a closure, so call the "call" method
+// on it.
// Arg0: non-closure object.
// Arg1: arguments array.
+// TODO(regis): Rename this entry?
DEFINE_RUNTIME_ENTRY(ReportObjectNotClosure, 2) {
ASSERT(arguments.Count() ==
kReportObjectNotClosureRuntimeEntry.argument_count());
- const Instance& bad_closure = Instance::CheckedHandle(arguments.At(0));
- if (bad_closure.IsNull()) {
- GrowableArray<const Object*> args;
- Exceptions::ThrowByType(Exceptions::kObjectNotClosure, args);
+ const Instance& instance = Instance::CheckedHandle(arguments.At(0));
+ const Array& function_args = Array::CheckedHandle(arguments.At(1));
+ const String& function_name = String::Handle(Symbols::Call());
+ GrowableArray<const Object*> dart_arguments(5);
+ if (instance.IsNull()) {
+ dart_arguments.Add(&function_name);
+ dart_arguments.Add(&function_args);
+ Exceptions::ThrowByType(Exceptions::kNullPointer, dart_arguments);
+ UNREACHABLE();
}
- GrowableArray<const Object*> args;
- Exceptions::ThrowByType(Exceptions::kObjectNotClosure, args);
+
+ // TODO(regis): Resolve and invoke "call" method, if existing.
+
+ const Object& null_object = Object::Handle();
+ dart_arguments.Add(&instance);
+ dart_arguments.Add(&function_name);
+ dart_arguments.Add(&function_args);
+ dart_arguments.Add(&null_object);
+
+ // Report if a function "call" with different arguments has been found.
+ Class& instance_class = Class::Handle(instance.clazz());
+ Function& function =
+ Function::Handle(instance_class.LookupDynamicFunction(function_name));
+ while (function.IsNull()) {
+ instance_class = instance_class.SuperClass();
+ if (instance_class.IsNull()) break;
+ function = instance_class.LookupDynamicFunction(function_name);
+ }
+ if (!function.IsNull()) {
+ const int total_num_parameters = function.NumParameters();
+ const Array& array = Array::Handle(Array::New(total_num_parameters - 1));
+ // Skip receiver.
+ for (int i = 1; i < total_num_parameters; i++) {
+ array.SetAt(i - 1, String::Handle(function.ParameterNameAt(i)));
+ }
+ dart_arguments.Add(&array);
+ }
+ Exceptions::ThrowByType(Exceptions::kNoSuchMethod, dart_arguments);
+ UNREACHABLE();
}
+// A closure object was invoked with incompatible arguments.
+// TODO(regis): Deprecated. This case should be handled by a noSuchMethod call.
DEFINE_RUNTIME_ENTRY(ClosureArgumentMismatch, 0) {
ASSERT(arguments.Count() ==
kClosureArgumentMismatchRuntimeEntry.argument_count());
- GrowableArray<const Object*> args;
- Exceptions::ThrowByType(Exceptions::kClosureArgumentMismatch, args);
+ const Instance& instance = Instance::Handle(); // Incorrect. OK for now.
+ const Array& function_args = Array::Handle(); // Incorrect. OK for now.
+ const String& function_name = String::Handle(Symbols::Call());
+ GrowableArray<const Object*> dart_arguments(5);
+
+ const Object& null_object = Object::Handle();
+ dart_arguments.Add(&instance);
+ dart_arguments.Add(&function_name);
+ dart_arguments.Add(&function_args);
+ dart_arguments.Add(&null_object);
+ Exceptions::ThrowByType(Exceptions::kNoSuchMethod, dart_arguments);
+ UNREACHABLE();
}
@@ -1664,7 +1769,7 @@
const intptr_t num_args =
function.HasOptionalParameters() ? 0 : function.num_fixed_parameters();
intptr_t unoptimized_stack_size =
- + deopt_info.Length() - num_args
+ + deopt_info.TranslationLength() - num_args
- 2; // Subtract caller FP and PC.
return unoptimized_stack_size * kWordSize;
}
@@ -1675,12 +1780,11 @@
static intptr_t DeoptimizeWithDeoptInfo(const Code& code,
const DeoptInfo& deopt_info,
const StackFrame& caller_frame) {
- const intptr_t len = deopt_info.Length();
+ const intptr_t len = deopt_info.TranslationLength();
GrowableArray<DeoptInstr*> deopt_instructions(len);
- for (intptr_t i = 0; i < len; i++) {
- deopt_instructions.Add(DeoptInstr::Create(deopt_info.Instruction(i),
- deopt_info.FromIndex(i)));
- }
+ const Array& deopt_table = Array::Handle(code.deopt_info_array());
+ ASSERT(!deopt_table.IsNull());
+ deopt_info.ToInstructions(deopt_table, &deopt_instructions);
intptr_t* start = reinterpret_cast<intptr_t*>(caller_frame.sp() - kWordSize);
const Function& function = Function::Handle(code.function());
diff --git a/runtime/vm/compiler.cc b/runtime/vm/compiler.cc
index 13cbfc0..7007b6a 100644
--- a/runtime/vm/compiler.cc
+++ b/runtime/vm/compiler.cc
@@ -353,7 +353,8 @@
Smi& reason = Smi::Handle();
for (intptr_t i = 0; i < deopt_table_length; ++i) {
DeoptTable::GetEntry(deopt_table, i, &offset, &info, &reason);
- OS::Print("0x%"Px" %s (%s)\n",
+ OS::Print("%4"Pd": 0x%"Px" %s (%s)\n",
+ i,
start + offset.Value(),
info.ToCString(),
DeoptReasonToText(reason.Value()));
diff --git a/runtime/vm/custom_isolate_test.cc b/runtime/vm/custom_isolate_test.cc
index d767b30..2090a7d 100644
--- a/runtime/vm/custom_isolate_test.cc
+++ b/runtime/vm/custom_isolate_test.cc
@@ -179,10 +179,10 @@
Dart_Handle recv_port = Dart_GetReceivePort(Dart_GetMainPortId());
EXPECT_VALID(recv_port);
- result = Dart_SetField(lib, Dart_NewString("mainPort"), recv_port);
+ result = Dart_SetField(lib, NewString("mainPort"), recv_port);
EXPECT_VALID(result);
- result = Dart_Invoke(lib, Dart_NewString(main_), 0, NULL);
+ result = Dart_Invoke(lib, NewString(main_), 0, NULL);
EXPECT_VALID(result);
free(const_cast<char*>(main_));
main_ = NULL;
@@ -317,7 +317,7 @@
EXPECT_VALID(lib);
// Run main.
- result = Dart_Invoke(lib, Dart_NewString("main"), 0, NULL);
+ result = Dart_Invoke(lib, NewString("main"), 0, NULL);
EXPECT_VALID(result);
EXPECT(Dart_IsString(result));
const char* result_str = NULL;
diff --git a/runtime/vm/dart_api_impl.cc b/runtime/vm/dart_api_impl.cc
index f1acf1c..7194b57 100644
--- a/runtime/vm/dart_api_impl.cc
+++ b/runtime/vm/dart_api_impl.cc
@@ -273,13 +273,6 @@
*peer = data->peer();
return true;
}
- case kExternalFourByteStringCid: {
- RawExternalFourByteString* raw_string =
- reinterpret_cast<RawExternalFourByteString*>(raw_obj)->ptr();
- ExternalStringData<uint32_t>* data = raw_string->external_data_;
- *peer = data->peer();
- return true;
- }
}
return false;
}
@@ -1522,16 +1515,11 @@
}
-DART_EXPORT bool Dart_IsString8(Dart_Handle object) {
+DART_EXPORT bool Dart_IsAsciiString(Dart_Handle object) {
return RawObject::IsOneByteStringClassId(Api::ClassId(object));
}
-DART_EXPORT bool Dart_IsString16(Dart_Handle object) {
- return RawObject::IsTwoByteStringClassId(Api::ClassId(object));
-}
-
-
DART_EXPORT Dart_Handle Dart_StringLength(Dart_Handle str, intptr_t* len) {
Isolate* isolate = Isolate::Current();
DARTSCOPE(isolate);
@@ -1544,53 +1532,53 @@
}
-DART_EXPORT Dart_Handle Dart_NewString(const char* str) {
+DART_EXPORT Dart_Handle Dart_NewStringFromCString(const char* str) {
Isolate* isolate = Isolate::Current();
DARTSCOPE(isolate);
if (str == NULL) {
RETURN_NULL_ERROR(str);
}
- if (!Utf8::IsValid(str)) {
- return Api::NewError("%s expects argument 'str' to be valid UTF-8.",
- CURRENT_FUNC);
- }
return Api::NewHandle(isolate, String::New(str));
}
-DART_EXPORT Dart_Handle Dart_NewString8(const uint8_t* codepoints,
- intptr_t length) {
+DART_EXPORT Dart_Handle Dart_NewStringFromUTF8(const uint8_t* utf8_array,
+ intptr_t length) {
Isolate* isolate = Isolate::Current();
DARTSCOPE(isolate);
- if (codepoints == NULL && length != 0) {
- RETURN_NULL_ERROR(codepoints);
+ if (utf8_array == NULL && length != 0) {
+ RETURN_NULL_ERROR(utf8_array);
}
CHECK_LENGTH(length, String::kMaxElements);
- return Api::NewHandle(isolate, String::New(codepoints, length));
+ if (!Utf8::IsValid(utf8_array, length)) {
+ return Api::NewError("%s expects argument 'str' to be valid UTF-8.",
+ CURRENT_FUNC);
+ }
+ return Api::NewHandle(isolate, String::New(utf8_array, length));
}
-DART_EXPORT Dart_Handle Dart_NewString16(const uint16_t* codepoints,
- intptr_t length) {
+DART_EXPORT Dart_Handle Dart_NewStringFromUTF16(const uint16_t* utf16_array,
+ intptr_t length) {
Isolate* isolate = Isolate::Current();
DARTSCOPE(isolate);
- if (codepoints == NULL && length != 0) {
- RETURN_NULL_ERROR(codepoints);
+ if (utf16_array == NULL && length != 0) {
+ RETURN_NULL_ERROR(utf16_array);
}
CHECK_LENGTH(length, String::kMaxElements);
- return Api::NewHandle(isolate, String::New(codepoints, length));
+ return Api::NewHandle(isolate, String::New(utf16_array, length));
}
-DART_EXPORT Dart_Handle Dart_NewString32(const uint32_t* codepoints,
- intptr_t length) {
+DART_EXPORT Dart_Handle Dart_NewStringFromUTF32(const uint32_t* utf32_array,
+ intptr_t length) {
Isolate* isolate = Isolate::Current();
DARTSCOPE(isolate);
- if (codepoints == NULL && length != 0) {
- RETURN_NULL_ERROR(codepoints);
+ if (utf32_array == NULL && length != 0) {
+ RETURN_NULL_ERROR(utf32_array);
}
CHECK_LENGTH(length, String::kMaxElements);
- return Api::NewHandle(isolate, String::New(codepoints, length));
+ return Api::NewHandle(isolate, String::New(utf32_array, length));
}
@@ -1610,8 +1598,6 @@
}
// It's not an external string, return appropriate error.
- // Note: this is invoked outside of the NoGCScope'd block above, since
- // error messages allocate new handles.
if (!RawObject::IsStringClassId(Api::ClassId(object))) {
RETURN_TYPE_ERROR(Isolate::Current(), object, String);
} else {
@@ -1623,113 +1609,38 @@
}
-DART_EXPORT Dart_Handle Dart_NewExternalString8(const uint8_t* codepoints,
- intptr_t length,
- void* peer,
- Dart_PeerFinalizer callback) {
+DART_EXPORT Dart_Handle Dart_NewExternalUTF8String(const uint8_t* utf8_array,
+ intptr_t length,
+ void* peer,
+ Dart_PeerFinalizer cback) {
Isolate* isolate = Isolate::Current();
DARTSCOPE(isolate);
- if (codepoints == NULL && length != 0) {
- RETURN_NULL_ERROR(codepoints);
+ if (utf8_array == NULL && length != 0) {
+ RETURN_NULL_ERROR(utf8_array);
}
CHECK_LENGTH(length, String::kMaxElements);
- return Api::NewHandle(
- isolate, String::NewExternal(codepoints, length, peer, callback));
+ return Api::NewHandle(isolate,
+ String::NewExternal(utf8_array, length, peer, cback));
}
-DART_EXPORT Dart_Handle Dart_NewExternalString16(const uint16_t* codepoints,
- intptr_t length,
- void* peer,
- Dart_PeerFinalizer callback) {
+DART_EXPORT Dart_Handle Dart_NewExternalUTF16String(const uint16_t* utf16_array,
+ intptr_t length,
+ void* peer,
+ Dart_PeerFinalizer cback) {
Isolate* isolate = Isolate::Current();
DARTSCOPE(isolate);
- if (codepoints == NULL && length != 0) {
- RETURN_NULL_ERROR(codepoints);
+ if (utf16_array == NULL && length != 0) {
+ RETURN_NULL_ERROR(utf16_array);
}
CHECK_LENGTH(length, String::kMaxElements);
- return Api::NewHandle(
- isolate, String::NewExternal(codepoints, length, peer, callback));
-}
-
-
-DART_EXPORT Dart_Handle Dart_NewExternalString32(const uint32_t* codepoints,
- intptr_t length,
- void* peer,
- Dart_PeerFinalizer callback) {
- Isolate* isolate = Isolate::Current();
- DARTSCOPE(isolate);
- if (codepoints == NULL && length != 0) {
- RETURN_NULL_ERROR(codepoints);
- }
- CHECK_LENGTH(length, String::kMaxElements);
- return Api::NewHandle(
- isolate, String::NewExternal(codepoints, length, peer, callback));
-}
-
-
-DART_EXPORT Dart_Handle Dart_StringGet8(Dart_Handle str,
- uint8_t* codepoints,
- intptr_t* length) {
- Isolate* isolate = Isolate::Current();
- DARTSCOPE(isolate);
- const OneByteString& str_obj = Api::UnwrapOneByteStringHandle(isolate, str);
- if (str_obj.IsNull()) {
- RETURN_TYPE_ERROR(isolate, str, String8);
- }
- intptr_t str_len = str_obj.Length();
- intptr_t copy_len = (str_len > *length) ? *length : str_len;
- for (intptr_t i = 0; i < copy_len; i++) {
- codepoints[i] = static_cast<uint8_t>(str_obj.CharAt(i));
- }
- *length= copy_len;
- return Api::Success(isolate);
-}
-
-
-DART_EXPORT Dart_Handle Dart_StringGet16(Dart_Handle str,
- uint16_t* codepoints,
- intptr_t* length) {
- Isolate* isolate = Isolate::Current();
- DARTSCOPE(isolate);
- const String& str_obj = Api::UnwrapStringHandle(isolate, str);
- if (str_obj.IsNull()) {
- RETURN_TYPE_ERROR(isolate, str, String);
- }
- if (str_obj.CharSize() > String::kTwoByteChar) {
- return Api::NewError("Object is not a String16 or String8");
- }
- intptr_t str_len = str_obj.Length();
- intptr_t copy_len = (str_len > *length) ? *length : str_len;
- for (intptr_t i = 0; i < copy_len; i++) {
- codepoints[i] = static_cast<uint16_t>(str_obj.CharAt(i));
- }
- *length = copy_len;
- return Api::Success(isolate);
-}
-
-
-DART_EXPORT Dart_Handle Dart_StringGet32(Dart_Handle str,
- uint32_t* codepoints,
- intptr_t* length) {
- Isolate* isolate = Isolate::Current();
- DARTSCOPE(isolate);
- const String& str_obj = Api::UnwrapStringHandle(isolate, str);
- if (str_obj.IsNull()) {
- RETURN_TYPE_ERROR(isolate, str, String);
- }
- intptr_t str_len = str_obj.Length();
- intptr_t copy_len = (str_len > *length) ? *length : str_len;
- for (intptr_t i = 0; i < copy_len; i++) {
- codepoints[i] = static_cast<uint32_t>(str_obj.CharAt(i));
- }
- *length = copy_len;
- return Api::Success(isolate);
+ return Api::NewHandle(isolate,
+ String::NewExternal(utf16_array, length, peer, cback));
}
DART_EXPORT Dart_Handle Dart_StringToCString(Dart_Handle object,
- const char** result) {
+ const char** cstr) {
Isolate* isolate = Isolate::Current();
DARTSCOPE(isolate);
const String& str_obj = Api::UnwrapStringHandle(isolate, object);
@@ -1744,34 +1655,45 @@
const char* string_value = str_obj.ToCString();
memmove(res, string_value, string_length + 1);
ASSERT(res[string_length] == '\0');
- *result = res;
+ *cstr = res;
return Api::Success(isolate);
}
-DART_EXPORT Dart_Handle Dart_StringToBytes(Dart_Handle object,
- const uint8_t** bytes,
- intptr_t *length) {
+DART_EXPORT Dart_Handle Dart_StringToUTF8(Dart_Handle str,
+ uint8_t* utf8_array,
+ intptr_t* length) {
Isolate* isolate = Isolate::Current();
DARTSCOPE(isolate);
- const String& str = Api::UnwrapStringHandle(isolate, object);
- if (str.IsNull()) {
- RETURN_TYPE_ERROR(isolate, object, String);
+ const String& str_obj = Api::UnwrapStringHandle(isolate, str);
+ if (str_obj.IsNull()) {
+ RETURN_TYPE_ERROR(isolate, str, String);
}
- if (bytes == NULL) {
- RETURN_NULL_ERROR(bytes);
+ intptr_t str_len = str_obj.Length();
+ if (str_len > *length) {
+ return Api::NewError("Input array is not large enough to hold the result");
}
- if (length == NULL) {
- RETURN_NULL_ERROR(length);
+ str_obj.ToUTF8(utf8_array, str_len);
+ *length= str_len;
+ return Api::Success(isolate);
+}
+
+
+DART_EXPORT Dart_Handle Dart_StringToUTF16(Dart_Handle str,
+ uint16_t* utf16_array,
+ intptr_t* length) {
+ Isolate* isolate = Isolate::Current();
+ DARTSCOPE(isolate);
+ const String& str_obj = Api::UnwrapStringHandle(isolate, str);
+ if (str_obj.IsNull()) {
+ RETURN_TYPE_ERROR(isolate, str, String);
}
- const char* cstring = str.ToCString();
- *length = Utf8::Length(str);
- uint8_t* result = Api::TopScope(isolate)->zone()->Alloc<uint8_t>(*length);
- if (result == NULL) {
- return Api::NewError("Unable to allocate memory");
+ intptr_t str_len = str_obj.Length();
+ intptr_t copy_len = (str_len > *length) ? *length : str_len;
+ for (intptr_t i = 0; i < copy_len; i++) {
+ utf16_array[i] = static_cast<uint16_t>(str_obj.CharAt(i));
}
- memmove(result, cstring, *length);
- *bytes = result;
+ *length = copy_len;
return Api::Success(isolate);
}
@@ -2171,6 +2093,11 @@
}
+DART_EXPORT bool Dart_IsByteArrayExternal(Dart_Handle object) {
+ return RawObject::IsExternalByteArrayClassId(Api::ClassId(object));
+}
+
+
DART_EXPORT Dart_Handle Dart_NewByteArray(intptr_t length) {
Isolate* isolate = Isolate::Current();
DARTSCOPE(isolate);
@@ -2194,6 +2121,23 @@
}
+DART_EXPORT Dart_Handle Dart_ExternalByteArrayGetData(Dart_Handle object,
+ void** data) {
+ Isolate* isolate = Isolate::Current();
+ DARTSCOPE(isolate);
+ const ExternalUint8Array& array =
+ Api::UnwrapExternalUint8ArrayHandle(isolate, object);
+ if (array.IsNull()) {
+ RETURN_TYPE_ERROR(isolate, object, ExternalUint8Array);
+ }
+ if (data == NULL) {
+ RETURN_NULL_ERROR(data);
+ }
+ *data = array.GetData();
+ return Api::Success(isolate);
+}
+
+
DART_EXPORT Dart_Handle Dart_ExternalByteArrayGetPeer(Dart_Handle object,
void** peer) {
Isolate* isolate = Isolate::Current();
diff --git a/runtime/vm/dart_api_impl_test.cc b/runtime/vm/dart_api_impl_test.cc
index fe8c400..8ab263a 100644
--- a/runtime/vm/dart_api_impl_test.cc
+++ b/runtime/vm/dart_api_impl_test.cc
@@ -31,7 +31,7 @@
Dart_Handle instance = Dart_True();
Dart_Handle error = Api::NewError("myerror");
Dart_Handle exception = Dart_Invoke(lib,
- Dart_NewString("testMain"),
+ NewString("testMain"),
0,
NULL);
@@ -66,10 +66,10 @@
const String& compile_message = String::Handle(String::New("CompileError"));
const String& fatal_message = String::Handle(String::New("FatalError"));
- Dart_Handle not_error = Dart_NewString("NotError");
+ Dart_Handle not_error = NewString("NotError");
Dart_Handle api_error = Dart_NewApiError("Api%s", "Error");
Dart_Handle exception_error =
- Dart_NewUnhandledExceptionError(Dart_NewString("ExceptionError"));
+ Dart_NewUnhandledExceptionError(NewString("ExceptionError"));
Dart_Handle compile_error =
Api::NewHandle(isolate, LanguageError::New(compile_message));
Dart_Handle fatal_error =
@@ -155,12 +155,12 @@
kScriptChars, &PropagateError_native_lookup);
Dart_Handle result;
- result = Dart_Invoke(lib, Dart_NewString("Func1"), 0, NULL);
+ result = Dart_Invoke(lib, NewString("Func1"), 0, NULL);
EXPECT(Dart_IsError(result));
EXPECT(!Dart_ErrorHasException(result));
EXPECT_SUBSTRING("semicolon expected", Dart_GetError(result));
- result = Dart_Invoke(lib, Dart_NewString("Func2"), 0, NULL);
+ result = Dart_Invoke(lib, NewString("Func2"), 0, NULL);
EXPECT(Dart_IsError(result));
EXPECT(Dart_ErrorHasException(result));
EXPECT_SUBSTRING("myException", Dart_GetError(result));
@@ -181,16 +181,16 @@
EXPECT_VALID(null);
EXPECT(Dart_IsNull(null));
- Dart_Handle str = Dart_NewString("test");
+ Dart_Handle str = NewString("test");
EXPECT_VALID(str);
EXPECT(!Dart_IsNull(str));
}
TEST_CASE(IdentityEquals) {
- Dart_Handle five = Dart_NewString("5");
- Dart_Handle five_again = Dart_NewString("5");
- Dart_Handle seven = Dart_NewString("7");
+ Dart_Handle five = NewString("5");
+ Dart_Handle five_again = NewString("5");
+ Dart_Handle seven = NewString("7");
// Same objects.
EXPECT(Dart_IdentityEquals(five, five));
@@ -220,9 +220,9 @@
TEST_CASE(ObjectEquals) {
bool equal = false;
- Dart_Handle five = Dart_NewString("5");
- Dart_Handle five_again = Dart_NewString("5");
- Dart_Handle seven = Dart_NewString("7");
+ Dart_Handle five = NewString("5");
+ Dart_Handle five_again = NewString("5");
+ Dart_Handle seven = NewString("7");
// Same objects.
EXPECT_VALID(Dart_ObjectEquals(five, five, &equal));
@@ -241,7 +241,7 @@
TEST_CASE(InstanceValues) {
- EXPECT(Dart_IsInstance(Dart_NewString("test")));
+ EXPECT(Dart_IsInstance(NewString("test")));
EXPECT(Dart_IsInstance(Dart_True()));
// By convention, our Is*() functions exclude null.
@@ -276,7 +276,7 @@
TEST_CASE(BooleanValues) {
- Dart_Handle str = Dart_NewString("test");
+ Dart_Handle str = NewString("test");
EXPECT(!Dart_IsBoolean(str));
bool value = false;
@@ -351,22 +351,22 @@
Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
// Check int case.
- result = Dart_Invoke(lib, Dart_NewString("getInt"), 0, NULL);
+ result = Dart_Invoke(lib, NewString("getInt"), 0, NULL);
EXPECT_VALID(result);
EXPECT(Dart_IsNumber(result));
// Check double case.
- result = Dart_Invoke(lib, Dart_NewString("getDouble"), 0, NULL);
+ result = Dart_Invoke(lib, NewString("getDouble"), 0, NULL);
EXPECT_VALID(result);
EXPECT(Dart_IsNumber(result));
// Check bool case.
- result = Dart_Invoke(lib, Dart_NewString("getBool"), 0, NULL);
+ result = Dart_Invoke(lib, NewString("getBool"), 0, NULL);
EXPECT_VALID(result);
EXPECT(!Dart_IsNumber(result));
// Check null case.
- result = Dart_Invoke(lib, Dart_NewString("getNull"), 0, NULL);
+ result = Dart_Invoke(lib, NewString("getNull"), 0, NULL);
EXPECT_VALID(result);
EXPECT(!Dart_IsNumber(result));
}
@@ -478,7 +478,7 @@
TEST_CASE(ArrayValues) {
const int kArrayLength = 10;
- Dart_Handle str = Dart_NewString("test");
+ Dart_Handle str = NewString("test");
EXPECT(!Dart_IsList(str));
Dart_Handle val = Dart_NewList(kArrayLength);
EXPECT(Dart_IsList(val));
@@ -513,76 +513,61 @@
TEST_CASE(IsString) {
- uint8_t data8[] = { 'o', 'n', 'e', 0xFF };
+ uint8_t data8[] = { 'o', 'n', 'e', 0x7F };
- Dart_Handle str8 = Dart_NewString8(data8, ARRAY_SIZE(data8));
+ Dart_Handle str8 = Dart_NewStringFromUTF8(data8, ARRAY_SIZE(data8));
EXPECT_VALID(str8);
EXPECT(Dart_IsString(str8));
- EXPECT(Dart_IsString8(str8));
- EXPECT(Dart_IsString16(str8));
+ EXPECT(Dart_IsAsciiString(str8));
EXPECT(!Dart_IsExternalString(str8));
- Dart_Handle ext8 = Dart_NewExternalString8(data8, ARRAY_SIZE(data8),
- NULL, NULL);
+ Dart_Handle ext8 = Dart_NewExternalUTF8String(data8, ARRAY_SIZE(data8),
+ NULL, NULL);
EXPECT_VALID(ext8);
EXPECT(Dart_IsString(ext8));
- EXPECT(Dart_IsString8(ext8));
- EXPECT(Dart_IsString16(ext8));
EXPECT(Dart_IsExternalString(ext8));
uint16_t data16[] = { 't', 'w', 'o', 0xFFFF };
- Dart_Handle str16 = Dart_NewString16(data16, ARRAY_SIZE(data16));
+ Dart_Handle str16 = Dart_NewStringFromUTF16(data16, ARRAY_SIZE(data16));
EXPECT_VALID(str16);
EXPECT(Dart_IsString(str16));
- EXPECT(!Dart_IsString8(str16));
- EXPECT(Dart_IsString16(str16));
+ EXPECT(!Dart_IsAsciiString(str16));
EXPECT(!Dart_IsExternalString(str16));
- Dart_Handle ext16 = Dart_NewExternalString16(data16, ARRAY_SIZE(data16),
- NULL, NULL);
+ Dart_Handle ext16 = Dart_NewExternalUTF16String(data16, ARRAY_SIZE(data16),
+ NULL, NULL);
EXPECT_VALID(ext16);
EXPECT(Dart_IsString(ext16));
- EXPECT(!Dart_IsString8(ext16));
- EXPECT(Dart_IsString16(ext16));
EXPECT(Dart_IsExternalString(ext16));
uint32_t data32[] = { 'f', 'o', 'u', 'r', 0x10FFFF };
- Dart_Handle str32 = Dart_NewString32(data32, ARRAY_SIZE(data32));
+ Dart_Handle str32 = Dart_NewStringFromUTF32(data32, ARRAY_SIZE(data32));
EXPECT_VALID(str32);
EXPECT(Dart_IsString(str32));
- EXPECT(!Dart_IsString8(str32));
- EXPECT(!Dart_IsString16(str32));
EXPECT(!Dart_IsExternalString(str32));
-
- Dart_Handle ext32 = Dart_NewExternalString32(data32, ARRAY_SIZE(data32),
- NULL, NULL);
- EXPECT_VALID(ext32);
- EXPECT(Dart_IsString(ext32));
- EXPECT(!Dart_IsString8(ext32));
- EXPECT(!Dart_IsString16(ext32));
- EXPECT(Dart_IsExternalString(ext32));
}
TEST_CASE(NewString) {
const char* ascii = "string";
- Dart_Handle ascii_str = Dart_NewString(ascii);
+ Dart_Handle ascii_str = NewString(ascii);
EXPECT_VALID(ascii_str);
EXPECT(Dart_IsString(ascii_str));
const char* null = NULL;
- Dart_Handle null_str = Dart_NewString(null);
+ Dart_Handle null_str = NewString(null);
EXPECT(Dart_IsError(null_str));
- const char* utf8 = "\xE4\xBA\x8C"; // U+4E8C
- Dart_Handle utf8_str = Dart_NewString(utf8);
+ uint8_t data[] = { 0xE4, 0xBA, 0x8c }; // U+4E8C.
+ Dart_Handle utf8_str = Dart_NewStringFromUTF8(data, ARRAY_SIZE(data));
EXPECT_VALID(utf8_str);
EXPECT(Dart_IsString(utf8_str));
- const char* invalid = "\xE4\xBA"; // underflow
- Dart_Handle invalid_str = Dart_NewString(invalid);
+ uint8_t invalid[] = { 0xE4, 0xBA }; // underflow.
+ Dart_Handle invalid_str = Dart_NewStringFromUTF8(invalid,
+ ARRAY_SIZE(invalid));
EXPECT(Dart_IsError(invalid_str));
}
@@ -590,13 +575,13 @@
TEST_CASE(ExternalStringGetPeer) {
Dart_Handle result;
- uint8_t data8[] = { 'o', 'n', 'e', 0xFF };
+ uint8_t data8[] = { 'o', 'n', 'e', 0x7F };
int peer_data = 123;
void* peer = NULL;
// Success.
- Dart_Handle ext8 = Dart_NewExternalString8(data8, ARRAY_SIZE(data8),
- &peer_data, NULL);
+ Dart_Handle ext8 = Dart_NewExternalUTF8String(data8, ARRAY_SIZE(data8),
+ &peer_data, NULL);
EXPECT_VALID(ext8);
result = Dart_ExternalStringGetPeer(ext8, &peer);
@@ -611,7 +596,7 @@
// String is not external.
peer = NULL;
- Dart_Handle str8 = Dart_NewString8(data8, ARRAY_SIZE(data8));
+ Dart_Handle str8 = Dart_NewStringFromUTF8(data8, ARRAY_SIZE(data8));
EXPECT_VALID(str8);
result = Dart_ExternalStringGetPeer(str8, &peer);
EXPECT(Dart_IsError(result));
@@ -640,13 +625,12 @@
TEST_CASE(ExternalStringCallback) {
int peer8 = 40;
int peer16 = 41;
- int peer32 = 42;
{
Dart_EnterScope();
uint8_t data8[] = { 'h', 'e', 'l', 'l', 'o' };
- Dart_Handle obj8 = Dart_NewExternalString8(
+ Dart_Handle obj8 = Dart_NewExternalUTF8String(
data8,
ARRAY_SIZE(data8),
&peer8,
@@ -657,7 +641,7 @@
EXPECT_EQ(api_peer8, &peer8);
uint16_t data16[] = { 'h', 'e', 'l', 'l', 'o' };
- Dart_Handle obj16 = Dart_NewExternalString16(
+ Dart_Handle obj16 = Dart_NewExternalUTF16String(
data16,
ARRAY_SIZE(data16),
&peer16,
@@ -667,31 +651,17 @@
EXPECT_VALID(Dart_ExternalStringGetPeer(obj16, &api_peer16));
EXPECT_EQ(api_peer16, &peer16);
- uint32_t data32[] = { 'h', 'e', 'l', 'l', 'o' };
- Dart_Handle obj32 = Dart_NewExternalString32(
- data32,
- ARRAY_SIZE(data32),
- &peer32,
- ExternalStringCallbackFinalizer);
- EXPECT_VALID(obj32);
- void* api_peer32 = NULL;
- EXPECT_VALID(Dart_ExternalStringGetPeer(obj32, &api_peer32));
- EXPECT_EQ(api_peer32, &peer32);
-
Dart_ExitScope();
}
EXPECT_EQ(40, peer8);
EXPECT_EQ(41, peer16);
- EXPECT_EQ(42, peer32);
Isolate::Current()->heap()->CollectGarbage(Heap::kOld);
EXPECT_EQ(40, peer8);
EXPECT_EQ(41, peer16);
- EXPECT_EQ(42, peer32);
Isolate::Current()->heap()->CollectGarbage(Heap::kNew);
EXPECT_EQ(80, peer8);
EXPECT_EQ(82, peer16);
- EXPECT_EQ(84, peer32);
}
@@ -710,7 +680,7 @@
Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
// Invoke a function which returns an object of type List.
- result = Dart_Invoke(lib, Dart_NewString("testMain"), 0, NULL);
+ result = Dart_Invoke(lib, NewString("testMain"), 0, NULL);
EXPECT_VALID(result);
// First ensure that the returned object is an array.
@@ -810,6 +780,7 @@
Dart_Handle byte_array1 = Dart_NewByteArray(10);
EXPECT_VALID(byte_array1);
EXPECT(Dart_IsByteArray(byte_array1));
+ EXPECT(!Dart_IsByteArrayExternal(byte_array1));
EXPECT(Dart_IsList(byte_array1));
intptr_t length = 0;
@@ -1103,8 +1074,13 @@
Dart_Handle obj = Dart_NewExternalByteArray(data, data_length, NULL, NULL);
EXPECT_VALID(obj);
EXPECT(Dart_IsByteArray(obj));
+ EXPECT(Dart_IsByteArrayExternal(obj));
EXPECT(Dart_IsList(obj));
+ void* raw_data = NULL;
+ EXPECT_VALID(Dart_ExternalByteArrayGetData(obj, &raw_data));
+ EXPECT(raw_data == data);
+
void* peer = &data; // just a non-NULL value
EXPECT_VALID(Dart_ExternalByteArrayGetPeer(obj, &peer));
EXPECT(peer == NULL);
@@ -1327,7 +1303,7 @@
Dart_EnterScope();
// Create an object in new space.
- Dart_Handle new_ref = Dart_NewString("new string");
+ Dart_Handle new_ref = NewString("new string");
EXPECT_VALID(new_ref);
// Create an object in old space.
@@ -1425,7 +1401,7 @@
int peer = 0;
{
Dart_EnterScope();
- Dart_Handle obj = Dart_NewString("new string");
+ Dart_Handle obj = NewString("new string");
EXPECT_VALID(obj);
weak_ref = Dart_NewWeakPersistentHandle(obj, &peer,
WeakPersistentHandlePeerFinalizer);
@@ -1447,7 +1423,7 @@
int peer = 0;
{
Dart_EnterScope();
- Dart_Handle obj = Dart_NewString("new string");
+ Dart_Handle obj = NewString("new string");
EXPECT_VALID(obj);
weak_ref = Dart_NewWeakPersistentHandle(obj, &peer,
WeakPersistentHandlePeerFinalizer);
@@ -2364,8 +2340,8 @@
"interface MyInterface default MyDefault {\n"
"}\n";
Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
- Dart_Handle cls = Dart_GetClass(lib, Dart_NewString("MyClass"));
- Dart_Handle interface = Dart_GetClass(lib, Dart_NewString("MyInterface"));
+ Dart_Handle cls = Dart_GetClass(lib, NewString("MyClass"));
+ Dart_Handle interface = Dart_GetClass(lib, NewString("MyInterface"));
// Test Dart_IsClass and Dart_IsInterface.
EXPECT(Dart_IsClass(cls));
@@ -2434,9 +2410,9 @@
"typedef void SomeHandler(String a);\n";
Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
EXPECT_VALID(lib);
- Dart_Handle normal_cls = Dart_GetClass(lib, Dart_NewString("SomeClass"));
+ Dart_Handle normal_cls = Dart_GetClass(lib, NewString("SomeClass"));
EXPECT_VALID(normal_cls);
- Dart_Handle typedef_cls = Dart_GetClass(lib, Dart_NewString("SomeHandler"));
+ Dart_Handle typedef_cls = Dart_GetClass(lib, NewString("SomeHandler"));
EXPECT_VALID(typedef_cls);
EXPECT(Dart_IsClass(normal_cls));
@@ -2506,11 +2482,11 @@
"}\n";
Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
- Dart_Handle cls0 = Dart_GetClass(lib, Dart_NewString("MyClass0"));
- Dart_Handle cls1 = Dart_GetClass(lib, Dart_NewString("MyClass1"));
- Dart_Handle cls2 = Dart_GetClass(lib, Dart_NewString("MyClass2"));
- Dart_Handle intf0 = Dart_GetClass(lib, Dart_NewString("MyInterface0"));
- Dart_Handle intf1 = Dart_GetClass(lib, Dart_NewString("MyInterface1"));
+ Dart_Handle cls0 = Dart_GetClass(lib, NewString("MyClass0"));
+ Dart_Handle cls1 = Dart_GetClass(lib, NewString("MyClass1"));
+ Dart_Handle cls2 = Dart_GetClass(lib, NewString("MyClass2"));
+ Dart_Handle intf0 = Dart_GetClass(lib, NewString("MyInterface0"));
+ Dart_Handle intf1 = Dart_GetClass(lib, NewString("MyInterface1"));
intptr_t len = -1;
EXPECT_VALID(Dart_ClassGetInterfaceCount(cls0, &len));
@@ -2574,7 +2550,7 @@
OS::SNPrint(buffer, 256, "Expected%d", ++counter);
// Try to change the field value.
- result = Dart_SetField(container, name, Dart_NewString(buffer));
+ result = Dart_SetField(container, name, NewString(buffer));
if (final) {
EXPECT(Dart_IsError(result));
} else {
@@ -2687,163 +2663,163 @@
// Shared setup.
Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
- Dart_Handle cls = Dart_GetClass(lib, Dart_NewString("Fields"));
+ Dart_Handle cls = Dart_GetClass(lib, NewString("Fields"));
EXPECT_VALID(cls);
- Dart_Handle instance = Dart_Invoke(lib, Dart_NewString("test"), 0, NULL);
+ Dart_Handle instance = Dart_Invoke(lib, NewString("test"), 0, NULL);
EXPECT_VALID(instance);
Dart_Handle name;
// Load imported lib.
- Dart_Handle url = Dart_NewString("library_url");
- Dart_Handle source = Dart_NewString(kImportedScriptChars);
+ Dart_Handle url = NewString("library_url");
+ Dart_Handle source = NewString(kImportedScriptChars);
Dart_Handle imported_lib = Dart_LoadLibrary(url, source);
- Dart_Handle prefix = Dart_NewString("");
+ Dart_Handle prefix = NewString("");
EXPECT_VALID(imported_lib);
Dart_Handle result = Dart_LibraryImportLibrary(lib, imported_lib, prefix);
EXPECT_VALID(result);
- result = Dart_Invoke(imported_lib, Dart_NewString("test2"), 0, NULL);
+ result = Dart_Invoke(imported_lib, NewString("test2"), 0, NULL);
EXPECT_VALID(result);
// Instance field.
- name = Dart_NewString("instance_fld");
+ name = NewString("instance_fld");
TestFieldNotFound(lib, name);
TestFieldNotFound(cls, name);
TestFieldOk(instance, name, false, "instance");
// Hidden instance field.
- name = Dart_NewString("_instance_fld");
+ name = NewString("_instance_fld");
TestFieldNotFound(lib, name);
TestFieldNotFound(cls, name);
TestFieldOk(instance, name, false, "hidden instance");
// Final instance field.
- name = Dart_NewString("final_instance_fld");
+ name = NewString("final_instance_fld");
TestFieldNotFound(lib, name);
TestFieldNotFound(cls, name);
TestFieldOk(instance, name, true, "final instance");
// Hidden final instance field.
- name = Dart_NewString("_final_instance_fld");
+ name = NewString("_final_instance_fld");
TestFieldNotFound(lib, name);
TestFieldNotFound(cls, name);
TestFieldOk(instance, name, true, "hidden final instance");
// Inherited field.
- name = Dart_NewString("inherited_fld");
+ name = NewString("inherited_fld");
TestFieldNotFound(lib, name);
TestFieldNotFound(cls, name);
TestFieldOk(instance, name, false, "inherited");
// Instance get/set field.
- name = Dart_NewString("instance_getset_fld");
+ name = NewString("instance_getset_fld");
TestFieldNotFound(lib, name);
TestFieldNotFound(cls, name);
TestFieldOk(instance, name, false, "instance getset");
// Hidden instance get/set field.
- name = Dart_NewString("_instance_getset_fld");
+ name = NewString("_instance_getset_fld");
TestFieldNotFound(lib, name);
TestFieldNotFound(cls, name);
TestFieldOk(instance, name, false, "hidden instance getset");
// Static field.
- name = Dart_NewString("static_fld");
+ name = NewString("static_fld");
TestFieldNotFound(lib, name);
TestFieldNotFound(instance, name);
TestFieldOk(cls, name, false, "static");
// Hidden static field.
- name = Dart_NewString("_static_fld");
+ name = NewString("_static_fld");
TestFieldNotFound(lib, name);
TestFieldNotFound(instance, name);
TestFieldOk(cls, name, false, "hidden static");
// Static final field.
- name = Dart_NewString("const_static_fld");
+ name = NewString("const_static_fld");
TestFieldNotFound(lib, name);
TestFieldNotFound(instance, name);
TestFieldOk(cls, name, true, "const static");
// Hidden static const field.
- name = Dart_NewString("_const_static_fld");
+ name = NewString("_const_static_fld");
TestFieldNotFound(lib, name);
TestFieldNotFound(instance, name);
TestFieldOk(cls, name, true, "hidden const static");
// Static non-inherited field. Not found at any level.
- name = Dart_NewString("non_inherited_fld");
+ name = NewString("non_inherited_fld");
TestFieldNotFound(lib, name);
TestFieldNotFound(instance, name);
TestFieldNotFound(cls, name);
// Static get/set field.
- name = Dart_NewString("static_getset_fld");
+ name = NewString("static_getset_fld");
TestFieldNotFound(lib, name);
TestFieldNotFound(instance, name);
TestFieldOk(cls, name, false, "static getset");
// Hidden static get/set field.
- name = Dart_NewString("_static_getset_fld");
+ name = NewString("_static_getset_fld");
TestFieldNotFound(lib, name);
TestFieldNotFound(instance, name);
TestFieldOk(cls, name, false, "hidden static getset");
// Top-Level field.
- name = Dart_NewString("top_fld");
+ name = NewString("top_fld");
TestFieldNotFound(cls, name);
TestFieldNotFound(instance, name);
TestFieldOk(lib, name, false, "top");
// Hidden top-level field.
- name = Dart_NewString("_top_fld");
+ name = NewString("_top_fld");
TestFieldNotFound(cls, name);
TestFieldNotFound(instance, name);
TestFieldOk(lib, name, false, "hidden top");
// Top-Level final field.
- name = Dart_NewString("const_top_fld");
+ name = NewString("const_top_fld");
TestFieldNotFound(cls, name);
TestFieldNotFound(instance, name);
TestFieldOk(lib, name, true, "const top");
// Hidden top-level final field.
- name = Dart_NewString("_const_top_fld");
+ name = NewString("_const_top_fld");
TestFieldNotFound(cls, name);
TestFieldNotFound(instance, name);
TestFieldOk(lib, name, true, "hidden const top");
// Top-Level get/set field.
- name = Dart_NewString("top_getset_fld");
+ name = NewString("top_getset_fld");
TestFieldNotFound(cls, name);
TestFieldNotFound(instance, name);
TestFieldOk(lib, name, false, "top getset");
// Hidden top-level get/set field.
- name = Dart_NewString("_top_getset_fld");
+ name = NewString("_top_getset_fld");
TestFieldNotFound(cls, name);
TestFieldNotFound(instance, name);
TestFieldOk(lib, name, false, "hidden top getset");
// Imported top-Level field.
- name = Dart_NewString("imported_fld");
+ name = NewString("imported_fld");
TestFieldNotFound(cls, name);
TestFieldNotFound(instance, name);
TestFieldOk(lib, name, false, "imported");
// Hidden imported top-level field. Not found at any level.
- name = Dart_NewString("_imported_fld");
+ name = NewString("_imported_fld");
TestFieldNotFound(cls, name);
TestFieldNotFound(instance, name);
TestFieldNotFound(lib, name);
// Imported top-Level get/set field.
- name = Dart_NewString("imported_getset_fld");
+ name = NewString("imported_getset_fld");
TestFieldNotFound(cls, name);
TestFieldNotFound(instance, name);
TestFieldOk(lib, name, false, "imported getset");
// Hidden imported top-level get/set field. Not found at any level.
- name = Dart_NewString("_imported_getset_fld");
+ name = NewString("_imported_getset_fld");
TestFieldNotFound(cls, name);
TestFieldNotFound(instance, name);
TestFieldNotFound(lib, name);
@@ -2855,7 +2831,7 @@
"var top;\n";
Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
- Dart_Handle name = Dart_NewString("top");
+ Dart_Handle name = NewString("top");
bool value;
// Test that you can set the field to a good value.
@@ -2920,13 +2896,13 @@
// Create a native wrapper class with native fields.
result = Dart_CreateNativeWrapperClass(
lib,
- Dart_NewString("NativeFieldsWrapper"),
+ NewString("NativeFieldsWrapper"),
kNumNativeFields);
// Load up a test script in the test library.
// Invoke a function which returns an object of type NativeFields.
- result = Dart_Invoke(lib, Dart_NewString("testMain"), 0, NULL);
+ result = Dart_Invoke(lib, NewString("testMain"), 0, NULL);
EXPECT_VALID(result);
DARTSCOPE_NOCHECKS(Isolate::Current());
Instance& obj = Instance::Handle();
@@ -2963,7 +2939,7 @@
Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
// Invoke a function which returns an object of type NativeFields.
- result = Dart_Invoke(lib, Dart_NewString("testMain"), 0, NULL);
+ result = Dart_Invoke(lib, NewString("testMain"), 0, NULL);
// We expect this to fail as class "NativeFields" extends
// "NativeFieldsWrapper" and there is no definition of it either
@@ -2994,7 +2970,7 @@
native_field_lookup);
// Invoke a function which returns an object of type NativeFields.
- result = Dart_Invoke(lib, Dart_NewString("testMain"), 0, NULL);
+ result = Dart_Invoke(lib, NewString("testMain"), 0, NULL);
EXPECT_VALID(result);
DARTSCOPE_NOCHECKS(Isolate::Current());
Instance& obj = Instance::Handle();
@@ -3032,7 +3008,7 @@
Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
// Invoke a function which returns an object of type NativeFields.
- result = Dart_Invoke(lib, Dart_NewString("testMain"), 0, NULL);
+ result = Dart_Invoke(lib, NewString("testMain"), 0, NULL);
// We expect the test script to fail finalization with the error below:
EXPECT(Dart_IsError(result));
@@ -3064,7 +3040,7 @@
Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, native_field_lookup);
// Invoke a function which returns an object of type NativeFields.
- result = Dart_Invoke(lib, Dart_NewString("testMain"), 0, NULL);
+ result = Dart_Invoke(lib, NewString("testMain"), 0, NULL);
EXPECT_VALID(result);
EXPECT(Dart_IsInteger(result));
@@ -3077,29 +3053,29 @@
static void TestNativeFields(Dart_Handle retobj) {
// Access and set various instance fields of the object.
- Dart_Handle result = Dart_GetField(retobj, Dart_NewString("fld3"));
+ Dart_Handle result = Dart_GetField(retobj, NewString("fld3"));
EXPECT(Dart_IsError(result));
- result = Dart_GetField(retobj, Dart_NewString("fld0"));
+ result = Dart_GetField(retobj, NewString("fld0"));
EXPECT_VALID(result);
EXPECT(Dart_IsNull(result));
- result = Dart_GetField(retobj, Dart_NewString("fld1"));
+ result = Dart_GetField(retobj, NewString("fld1"));
EXPECT_VALID(result);
int64_t value = 0;
result = Dart_IntegerToInt64(result, &value);
EXPECT_EQ(10, value);
- result = Dart_GetField(retobj, Dart_NewString("fld2"));
+ result = Dart_GetField(retobj, NewString("fld2"));
EXPECT_VALID(result);
result = Dart_IntegerToInt64(result, &value);
EXPECT_EQ(20, value);
result = Dart_SetField(retobj,
- Dart_NewString("fld2"),
+ NewString("fld2"),
Dart_NewInteger(40));
EXPECT(Dart_IsError(result));
result = Dart_SetField(retobj,
- Dart_NewString("fld1"),
+ NewString("fld1"),
Dart_NewInteger(40));
EXPECT_VALID(result);
- result = Dart_GetField(retobj, Dart_NewString("fld1"));
+ result = Dart_GetField(retobj, NewString("fld1"));
EXPECT_VALID(result);
result = Dart_IntegerToInt64(result, &value);
EXPECT_EQ(40, value);
@@ -3144,11 +3120,11 @@
// Now re-access various dart instance fields of the returned object
// to ensure that there was no corruption while setting native fields.
- result = Dart_GetField(retobj, Dart_NewString("fld1"));
+ result = Dart_GetField(retobj, NewString("fld1"));
EXPECT_VALID(result);
result = Dart_IntegerToInt64(result, &value);
EXPECT_EQ(40, value);
- result = Dart_GetField(retobj, Dart_NewString("fld2"));
+ result = Dart_GetField(retobj, NewString("fld2"));
EXPECT_VALID(result);
result = Dart_IntegerToInt64(result, &value);
EXPECT_EQ(20, value);
@@ -3178,14 +3154,14 @@
// Create a native wrapper class with native fields.
Dart_Handle result = Dart_CreateNativeWrapperClass(
lib,
- Dart_NewString("NativeFieldsWrapper"),
+ NewString("NativeFieldsWrapper"),
kNumNativeFields);
EXPECT_VALID(result);
// Load up a test script in it.
// Invoke a function which returns an object of type NativeFields.
- Dart_Handle retobj = Dart_Invoke(lib, Dart_NewString("testMain"), 0, NULL);
+ Dart_Handle retobj = Dart_Invoke(lib, NewString("testMain"), 0, NULL);
EXPECT_VALID(retobj);
// Now access and set various instance fields of the returned object.
@@ -3225,7 +3201,7 @@
native_field_lookup);
// Invoke a function which returns an object of type NativeFields.
- Dart_Handle retobj = Dart_Invoke(lib, Dart_NewString("testMain"), 0, NULL);
+ Dart_Handle retobj = Dart_Invoke(lib, NewString("testMain"), 0, NULL);
EXPECT_VALID(retobj);
// Now access and set various instance fields of the returned object.
@@ -3256,7 +3232,7 @@
Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
// Invoke a function which returns an object of type NativeFields.
- Dart_Handle retobj = Dart_Invoke(lib, Dart_NewString("testMain1"), 0, NULL);
+ Dart_Handle retobj = Dart_Invoke(lib, NewString("testMain1"), 0, NULL);
EXPECT_VALID(retobj);
// Now access and set various native instance fields of the returned object.
@@ -3284,7 +3260,7 @@
EXPECT(Dart_IsError(result));
// Invoke a function which returns a closure object.
- retobj = Dart_Invoke(lib, Dart_NewString("testMain2"), 0, NULL);
+ retobj = Dart_Invoke(lib, NewString("testMain2"), 0, NULL);
EXPECT_VALID(retobj);
result = Dart_GetNativeInstanceField(retobj, kNativeFld4, &value);
@@ -3315,33 +3291,33 @@
Dart_Handle result;
// Create a test library and Load up a test script in it.
Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
- Dart_Handle cls = Dart_GetClass(lib, Dart_NewString("TestClass"));
+ Dart_Handle cls = Dart_GetClass(lib, NewString("TestClass"));
EXPECT_VALID(cls);
// Invoke a function which returns an object.
- result = Dart_Invoke(cls, Dart_NewString("testMain"), 0, NULL);
+ result = Dart_Invoke(cls, NewString("testMain"), 0, NULL);
EXPECT_VALID(result);
// For uninitialized fields, the getter is returned
- result = Dart_GetField(cls, Dart_NewString("fld1"));
+ result = Dart_GetField(cls, NewString("fld1"));
EXPECT_VALID(result);
int64_t value = 0;
result = Dart_IntegerToInt64(result, &value);
EXPECT_EQ(7, value);
- result = Dart_GetField(cls, Dart_NewString("fld2"));
+ result = Dart_GetField(cls, NewString("fld2"));
EXPECT_VALID(result);
result = Dart_IntegerToInt64(result, &value);
EXPECT_EQ(11, value);
// Overwrite fld2
result = Dart_SetField(cls,
- Dart_NewString("fld2"),
+ NewString("fld2"),
Dart_NewInteger(13));
EXPECT_VALID(result);
// We now get the new value for fld2, not the initializer
- result = Dart_GetField(cls, Dart_NewString("fld2"));
+ result = Dart_GetField(cls, NewString("fld2"));
EXPECT_VALID(result);
result = Dart_IntegerToInt64(result, &value);
EXPECT_EQ(13, value);
@@ -3392,13 +3368,13 @@
"}\n";
Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
- Dart_Handle cls = Dart_GetClass(lib, Dart_NewString("MyClass"));
+ Dart_Handle cls = Dart_GetClass(lib, NewString("MyClass"));
EXPECT_VALID(cls);
- Dart_Handle cls2 = Dart_GetClass(lib, Dart_NewString("MyClass2"));
+ Dart_Handle cls2 = Dart_GetClass(lib, NewString("MyClass2"));
EXPECT_VALID(cls2);
- Dart_Handle intf = Dart_GetClass(lib, Dart_NewString("MyInterface"));
+ Dart_Handle intf = Dart_GetClass(lib, NewString("MyInterface"));
EXPECT_VALID(intf);
- Dart_Handle intf2 = Dart_GetClass(lib, Dart_NewString("MyInterface2"));
+ Dart_Handle intf2 = Dart_GetClass(lib, NewString("MyInterface2"));
EXPECT_VALID(intf2);
Dart_Handle args[1];
args[0] = Dart_NewInteger(11);
@@ -3412,79 +3388,79 @@
EXPECT_VALID(Dart_ObjectIsType(result, cls, &instanceof));
EXPECT(instanceof);
int64_t int_value = 0;
- Dart_Handle foo = Dart_GetField(result, Dart_NewString("foo"));
+ Dart_Handle foo = Dart_GetField(result, NewString("foo"));
EXPECT_VALID(Dart_IntegerToInt64(foo, &int_value));
EXPECT_EQ(7, int_value);
// Invoke the unnamed constructor with an empty string.
- result = Dart_New(cls, Dart_NewString(""), 0, NULL);
+ result = Dart_New(cls, NewString(""), 0, NULL);
EXPECT_VALID(result);
instanceof = false;
EXPECT_VALID(Dart_ObjectIsType(result, cls, &instanceof));
EXPECT(instanceof);
int_value = 0;
- foo = Dart_GetField(result, Dart_NewString("foo"));
+ foo = Dart_GetField(result, NewString("foo"));
EXPECT_VALID(Dart_IntegerToInt64(foo, &int_value));
EXPECT_EQ(7, int_value);
// Invoke a named constructor.
- result = Dart_New(cls, Dart_NewString("named"), 1, args);
+ result = Dart_New(cls, NewString("named"), 1, args);
EXPECT_VALID(result);
EXPECT_VALID(Dart_ObjectIsType(result, cls, &instanceof));
EXPECT(instanceof);
int_value = 0;
- foo = Dart_GetField(result, Dart_NewString("foo"));
+ foo = Dart_GetField(result, NewString("foo"));
EXPECT_VALID(Dart_IntegerToInt64(foo, &int_value));
EXPECT_EQ(11, int_value);
// Invoke a hidden named constructor.
- result = Dart_New(cls, Dart_NewString("_hidden"), 1, args);
+ result = Dart_New(cls, NewString("_hidden"), 1, args);
EXPECT_VALID(result);
EXPECT_VALID(Dart_ObjectIsType(result, cls, &instanceof));
EXPECT(instanceof);
int_value = 0;
- foo = Dart_GetField(result, Dart_NewString("foo"));
+ foo = Dart_GetField(result, NewString("foo"));
EXPECT_VALID(Dart_IntegerToInt64(foo, &int_value));
EXPECT_EQ(-11, int_value);
// Invoke a factory constructor.
- result = Dart_New(cls, Dart_NewString("multiply"), 1, args);
+ result = Dart_New(cls, NewString("multiply"), 1, args);
EXPECT_VALID(result);
EXPECT_VALID(Dart_ObjectIsType(result, cls, &instanceof));
EXPECT(instanceof);
int_value = 0;
- foo = Dart_GetField(result, Dart_NewString("foo"));
+ foo = Dart_GetField(result, NewString("foo"));
EXPECT_VALID(Dart_IntegerToInt64(foo, &int_value));
EXPECT_EQ(1100, int_value);
// Invoke a factory constructor which returns null.
- result = Dart_New(cls, Dart_NewString("nullo"), 0, NULL);
+ result = Dart_New(cls, NewString("nullo"), 0, NULL);
EXPECT_VALID(result);
EXPECT(Dart_IsNull(result));
// Pass an error class object. Error is passed through.
- result = Dart_New(Dart_Error("myerror"), Dart_NewString("named"), 1, args);
+ result = Dart_New(Dart_Error("myerror"), NewString("named"), 1, args);
EXPECT_ERROR(result, "myerror");
// Pass a bad class object.
- result = Dart_New(Dart_Null(), Dart_NewString("named"), 1, args);
+ result = Dart_New(Dart_Null(), NewString("named"), 1, args);
EXPECT_ERROR(result, "Dart_New expects argument 'clazz' to be non-null.");
// Pass a negative arg count.
- result = Dart_New(cls, Dart_NewString("named"), -1, args);
+ result = Dart_New(cls, NewString("named"), -1, args);
EXPECT_ERROR(
result,
"Dart_New expects argument 'number_of_arguments' to be non-negative.");
// Pass the wrong arg count.
- result = Dart_New(cls, Dart_NewString("named"), 0, NULL);
+ result = Dart_New(cls, NewString("named"), 0, NULL);
EXPECT_ERROR(
result,
"Dart_New: wrong argument count for constructor 'MyClass.named': "
"0 passed, 1 expected.");
// Pass a bad argument. Error is passed through.
- result = Dart_New(cls, Dart_NewString("named"), 1, bad_args);
+ result = Dart_New(cls, NewString("named"), 1, bad_args);
EXPECT_ERROR(result, "myerror");
// Pass a bad constructor name.
@@ -3494,12 +3470,12 @@
"Dart_New expects argument 'constructor_name' to be of type String.");
// Invoke a missing constructor.
- result = Dart_New(cls, Dart_NewString("missing"), 1, args);
+ result = Dart_New(cls, NewString("missing"), 1, args);
EXPECT_ERROR(result,
"Dart_New: could not find constructor 'MyClass.missing'.");
// Invoke a constructor which throws an exception.
- result = Dart_New(cls, Dart_NewString("exception"), 1, args);
+ result = Dart_New(cls, NewString("exception"), 1, args);
EXPECT_ERROR(result, "ConstructorDeath");
// MyInterface has default class MyClass.
@@ -3515,23 +3491,23 @@
// MyClass.foo() from the class MyClass.
// Invoke an interface constructor.
- result = Dart_New(intf, Dart_NewString("named"), 1, args);
+ result = Dart_New(intf, NewString("named"), 1, args);
EXPECT_VALID(result);
EXPECT_VALID(Dart_ObjectIsType(result, cls, &instanceof));
EXPECT(instanceof);
int_value = 0;
- foo = Dart_GetField(result, Dart_NewString("foo"));
+ foo = Dart_GetField(result, NewString("foo"));
EXPECT_VALID(Dart_IntegerToInt64(foo, &int_value));
EXPECT_EQ(11, int_value);
// Invoke an interface constructor which in turn calls a factory
// constructor.
- result = Dart_New(intf, Dart_NewString("multiply"), 1, args);
+ result = Dart_New(intf, NewString("multiply"), 1, args);
EXPECT_VALID(result);
EXPECT_VALID(Dart_ObjectIsType(result, cls, &instanceof));
EXPECT(instanceof);
int_value = 0;
- foo = Dart_GetField(result, Dart_NewString("foo"));
+ foo = Dart_GetField(result, NewString("foo"));
EXPECT_VALID(Dart_IntegerToInt64(foo, &int_value));
EXPECT_EQ(1100, int_value);
@@ -3543,7 +3519,7 @@
// Invoke a constructor that is present in the interface but missing
// in the default class.
- result = Dart_New(intf, Dart_NewString("notfound"), 1, args);
+ result = Dart_New(intf, NewString("notfound"), 1, args);
EXPECT_ERROR(result,
"Dart_New: could not find constructor 'MyClass.notfound'.");
@@ -3561,24 +3537,24 @@
// Invoke an interface constructor which in turn calls a factory
// constructor.
- result = Dart_New(intf2, Dart_NewString("multiply"), 1, args);
+ result = Dart_New(intf2, NewString("multiply"), 1, args);
EXPECT_VALID(result);
EXPECT_VALID(Dart_ObjectIsType(result, cls2, &instanceof));
EXPECT(instanceof);
int_value = 0;
- Dart_Handle bar = Dart_GetField(result, Dart_NewString("bar"));
+ Dart_Handle bar = Dart_GetField(result, NewString("bar"));
EXPECT_VALID(Dart_IntegerToInt64(bar, &int_value));
EXPECT_EQ(110000, int_value);
// Invoke a constructor that is missing in the interface but present
// in the default class.
- result = Dart_New(intf2, Dart_NewString("unused"), 1, args);
+ result = Dart_New(intf2, NewString("unused"), 1, args);
EXPECT_ERROR(result,
"Dart_New: could not find constructor 'MyInterface2.unused'.");
// Invoke a constructor that is present in the interface but missing
// in the default class.
- result = Dart_New(intf2, Dart_NewString("notfound"), 1, args);
+ result = Dart_New(intf2, NewString("notfound"), 1, args);
EXPECT_ERROR(result,
"Dart_New: could not find factory 'MyInterface2.notfound' "
"in class 'MyClass'.");
@@ -3589,9 +3565,9 @@
// Issue 2971: We were unable to use Dart_New to construct an
// instance of List, due to problems implementing interface
// factories.
- Dart_Handle core_lib = Dart_LookupLibrary(Dart_NewString("dart:core"));
+ Dart_Handle core_lib = Dart_LookupLibrary(NewString("dart:core"));
EXPECT_VALID(core_lib);
- Dart_Handle list_class = Dart_GetClass(core_lib, Dart_NewString("List"));
+ Dart_Handle list_class = Dart_GetClass(core_lib, NewString("List"));
EXPECT_VALID(list_class);
const int kNumArgs = 1;
@@ -3626,21 +3602,21 @@
// Shared setup.
Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
- Dart_Handle cls = Dart_GetClass(lib, Dart_NewString("Methods"));
+ Dart_Handle cls = Dart_GetClass(lib, NewString("Methods"));
EXPECT_VALID(cls);
- Dart_Handle instance = Dart_Invoke(lib, Dart_NewString("test"), 0, NULL);
+ Dart_Handle instance = Dart_Invoke(lib, NewString("test"), 0, NULL);
EXPECT_VALID(instance);
Dart_Handle args[1];
- args[0] = Dart_NewString("!!!");
+ args[0] = NewString("!!!");
Dart_Handle bad_args[2];
- bad_args[0] = Dart_NewString("bad1");
- bad_args[1] = Dart_NewString("bad2");
+ bad_args[0] = NewString("bad1");
+ bad_args[1] = NewString("bad2");
Dart_Handle result;
Dart_Handle name;
const char* str;
// Instance method.
- name = Dart_NewString("instanceMethod");
+ name = NewString("instanceMethod");
EXPECT(Dart_IsError(Dart_Invoke(lib, name, 1, args)));
EXPECT(Dart_IsError(Dart_Invoke(cls, name, 1, args)));
result = Dart_Invoke(instance, name, 1, args);
@@ -3653,7 +3629,7 @@
"did not find instance method 'Methods.instanceMethod'");
// Hidden instance method.
- name = Dart_NewString("_instanceMethod");
+ name = NewString("_instanceMethod");
EXPECT(Dart_IsError(Dart_Invoke(lib, name, 1, args)));
EXPECT(Dart_IsError(Dart_Invoke(cls, name, 1, args)));
result = Dart_Invoke(instance, name, 1, args);
@@ -3662,7 +3638,7 @@
EXPECT_STREQ("hidden instance !!!", str);
// Inherited method.
- name = Dart_NewString("inheritedMethod");
+ name = NewString("inheritedMethod");
EXPECT(Dart_IsError(Dart_Invoke(lib, name, 1, args)));
EXPECT(Dart_IsError(Dart_Invoke(cls, name, 1, args)));
result = Dart_Invoke(instance, name, 1, args);
@@ -3671,7 +3647,7 @@
EXPECT_STREQ("inherited !!!", str);
// Static method.
- name = Dart_NewString("staticMethod");
+ name = NewString("staticMethod");
EXPECT(Dart_IsError(Dart_Invoke(lib, name, 1, args)));
EXPECT(Dart_IsError(Dart_Invoke(instance, name, 1, args)));
result = Dart_Invoke(cls, name, 1, args);
@@ -3684,7 +3660,7 @@
"did not find static method 'Methods.staticMethod'");
// Hidden static method.
- name = Dart_NewString("_staticMethod");
+ name = NewString("_staticMethod");
EXPECT(Dart_IsError(Dart_Invoke(lib, name, 1, args)));
EXPECT(Dart_IsError(Dart_Invoke(instance, name, 1, args)));
result = Dart_Invoke(cls, name, 1, args);
@@ -3693,13 +3669,13 @@
EXPECT_STREQ("hidden static !!!", str);
// Static non-inherited method. Not found at any level.
- name = Dart_NewString("non_inheritedMethod");
+ name = NewString("non_inheritedMethod");
EXPECT(Dart_IsError(Dart_Invoke(lib, name, 1, args)));
EXPECT(Dart_IsError(Dart_Invoke(instance, name, 1, args)));
EXPECT(Dart_IsError(Dart_Invoke(cls, name, 1, args)));
// Top-Level method.
- name = Dart_NewString("topMethod");
+ name = NewString("topMethod");
EXPECT(Dart_IsError(Dart_Invoke(cls, name, 1, args)));
EXPECT(Dart_IsError(Dart_Invoke(instance, name, 1, args)));
result = Dart_Invoke(lib, name, 1, args);
@@ -3713,7 +3689,7 @@
"2 passed, 1 expected.");
// Hidden top-level method.
- name = Dart_NewString("_topMethod");
+ name = NewString("_topMethod");
EXPECT(Dart_IsError(Dart_Invoke(cls, name, 1, args)));
EXPECT(Dart_IsError(Dart_Invoke(instance, name, 1, args)));
result = Dart_Invoke(lib, name, 1, args);
@@ -3728,12 +3704,12 @@
"test(arg) => 'hello $arg';\n";
Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
- Dart_Handle func_name = Dart_NewString("test");
+ Dart_Handle func_name = NewString("test");
Dart_Handle args[1];
const char* str;
// Make sure that valid args yield valid results.
- args[0] = Dart_NewString("!!!");
+ args[0] = NewString("!!!");
Dart_Handle result = Dart_Invoke(lib, func_name, 1, args);
EXPECT_VALID(result);
result = Dart_StringToCString(result, &str);
@@ -3774,7 +3750,7 @@
TEST_CASE(Invoke_Null) {
Dart_Handle result = Dart_Invoke(Dart_Null(),
- Dart_NewString("toString"),
+ NewString("toString"),
0,
NULL);
EXPECT_VALID(result);
@@ -3786,7 +3762,7 @@
// Should throw a NullPointerException. Disabled due to bug 5415268.
/*
- Dart_Handle function_name2 = Dart_NewString("NoNoNo");
+ Dart_Handle function_name2 = NewString("NoNoNo");
result = Dart_Invoke(null_receiver,
function_name2,
number_of_arguments,
@@ -3807,14 +3783,14 @@
"void _imported() {}\n";
// Load lib1
- Dart_Handle url = Dart_NewString("library1_url");
- Dart_Handle source = Dart_NewString(kLibrary1Chars);
+ Dart_Handle url = NewString("library1_url");
+ Dart_Handle source = NewString(kLibrary1Chars);
Dart_Handle lib1 = Dart_LoadLibrary(url, source);
EXPECT_VALID(lib1);
// Load lib2
- url = Dart_NewString("library2_url");
- source = Dart_NewString(kLibrary2Chars);
+ url = NewString("library2_url");
+ source = NewString(kLibrary2Chars);
Dart_Handle lib2 = Dart_LoadLibrary(url, source);
EXPECT_VALID(lib2);
@@ -3823,12 +3799,12 @@
EXPECT_VALID(result);
// We can invoke both private and non-private local functions.
- EXPECT_VALID(Dart_Invoke(lib1, Dart_NewString("local"), 0, NULL));
- EXPECT_VALID(Dart_Invoke(lib1, Dart_NewString("_local"), 0, NULL));
+ EXPECT_VALID(Dart_Invoke(lib1, NewString("local"), 0, NULL));
+ EXPECT_VALID(Dart_Invoke(lib1, NewString("_local"), 0, NULL));
// We can only invoke non-private imported functions.
- EXPECT_VALID(Dart_Invoke(lib1, Dart_NewString("imported"), 0, NULL));
- EXPECT_ERROR(Dart_Invoke(lib1, Dart_NewString("_imported"), 0, NULL),
+ EXPECT_VALID(Dart_Invoke(lib1, NewString("imported"), 0, NULL));
+ EXPECT_ERROR(Dart_Invoke(lib1, NewString("_imported"), 0, NULL),
"did not find top-level function '_imported'");
}
@@ -3871,11 +3847,11 @@
// Create a test library and Load up a test script in it.
Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
EXPECT_VALID(lib);
- Dart_Handle cls = Dart_GetClass(lib, Dart_NewString("Foo"));
+ Dart_Handle cls = Dart_GetClass(lib, NewString("Foo"));
EXPECT_VALID(cls);
// Invoke a function which returns a closure.
- Dart_Handle retobj = Dart_Invoke(lib, Dart_NewString("getClosure"), 0, NULL);
+ Dart_Handle retobj = Dart_Invoke(lib, NewString("getClosure"), 0, NULL);
EXPECT_VALID(retobj);
EXPECT(Dart_IsClosure(retobj));
@@ -3887,7 +3863,7 @@
EXPECT(Dart_IsFunction(result));
owner = Dart_FunctionOwner(result);
EXPECT_VALID(owner);
- defining_function = Dart_LookupFunction(lib, Dart_NewString("getClosure"));
+ defining_function = Dart_LookupFunction(lib, NewString("getClosure"));
EXPECT(Dart_IdentityEquals(owner, defining_function));
int64_t fixed_param_count = -999;
int64_t opt_param_count = -999;
@@ -3903,7 +3879,7 @@
EXPECT(Dart_IsError(result));
// Invoke a function which returns an "instance" closure.
- retobj = Dart_Invoke(lib, Dart_NewString("getInstanceClosure"), 0, NULL);
+ retobj = Dart_Invoke(lib, NewString("getInstanceClosure"), 0, NULL);
EXPECT_VALID(retobj);
EXPECT(Dart_IsClosure(retobj));
@@ -3914,7 +3890,7 @@
owner = Dart_FunctionOwner(result);
EXPECT_VALID(owner);
defining_function = Dart_LookupFunction(cls,
- Dart_NewString("getInstanceClosure"));
+ NewString("getInstanceClosure"));
EXPECT(Dart_IdentityEquals(owner, defining_function));
// -999: We want to distinguish between a non-answer and a wrong answer, and
// -1 has been a previous wrong answer
@@ -3929,7 +3905,7 @@
// Invoke a function which returns an "instance" closure with arguments.
retobj = Dart_Invoke(lib,
- Dart_NewString("getInstanceClosureWithArgs"),
+ NewString("getInstanceClosureWithArgs"),
0,
NULL);
EXPECT_VALID(retobj);
@@ -3942,7 +3918,7 @@
owner = Dart_FunctionOwner(result);
EXPECT_VALID(owner);
defining_function =
- Dart_LookupFunction(cls, Dart_NewString("getInstanceClosureWithArgs"));
+ Dart_LookupFunction(cls, NewString("getInstanceClosureWithArgs"));
EXPECT(Dart_IdentityEquals(owner, defining_function));
// -999: We want to distinguish between a non-answer and a wrong answer, and
// -1 has been a previous wrong answer
@@ -3956,7 +3932,7 @@
EXPECT_EQ(1, opt_param_count);
// Invoke a function which returns a "static" closure.
- retobj = Dart_Invoke(lib, Dart_NewString("getStaticClosure"), 0, NULL);
+ retobj = Dart_Invoke(lib, NewString("getStaticClosure"), 0, NULL);
EXPECT_VALID(retobj);
EXPECT(Dart_IsClosure(retobj));
@@ -3967,7 +3943,7 @@
owner = Dart_FunctionOwner(result);
EXPECT_VALID(owner);
defining_function = Dart_LookupFunction(cls,
- Dart_NewString("getStaticClosure"));
+ NewString("getStaticClosure"));
EXPECT(Dart_IdentityEquals(owner, defining_function));
// -999: We want to distinguish between a non-answer and a wrong answer, and
// -1 has been a previous wrong answer
@@ -3983,7 +3959,7 @@
// Invoke a function which returns a "static" closure with arguments.
retobj = Dart_Invoke(lib,
- Dart_NewString("getStaticClosureWithArgs"),
+ NewString("getStaticClosureWithArgs"),
0,
NULL);
EXPECT_VALID(retobj);
@@ -3996,7 +3972,7 @@
owner = Dart_FunctionOwner(result);
EXPECT_VALID(owner);
defining_function =
- Dart_LookupFunction(cls, Dart_NewString("getStaticClosureWithArgs"));
+ Dart_LookupFunction(cls, NewString("getStaticClosureWithArgs"));
EXPECT(Dart_IdentityEquals(owner, defining_function));
// -999: We want to distinguish between a non-answer and a wrong answer, and
// -1 has been a previous wrong answer
@@ -4040,7 +4016,7 @@
Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
// Invoke a function which returns a closure.
- Dart_Handle retobj = Dart_Invoke(lib, Dart_NewString("testMain1"), 0, NULL);
+ Dart_Handle retobj = Dart_Invoke(lib, NewString("testMain1"), 0, NULL);
EXPECT_VALID(retobj);
EXPECT(Dart_IsClosure(retobj));
@@ -4062,11 +4038,11 @@
EXPECT(Dart_ErrorHasException(result));
// Invoke a function which returns a closure.
- retobj = Dart_Invoke(lib, Dart_NewString("testMain2"), 0, NULL);
+ retobj = Dart_Invoke(lib, NewString("testMain2"), 0, NULL);
EXPECT_VALID(retobj);
EXPECT(Dart_IsClosure(retobj));
- EXPECT(!Dart_IsClosure(Dart_NewString("abcdef")));
+ EXPECT(!Dart_IsClosure(NewString("abcdef")));
// Now invoke the closure and check the result (should be an exception).
dart_arguments[0] = Dart_NewInteger(1);
@@ -4078,7 +4054,7 @@
void ExceptionNative(Dart_NativeArguments args) {
Dart_EnterScope();
- Dart_ThrowException(Dart_NewString("Hello from ExceptionNative!"));
+ Dart_ThrowException(NewString("Hello from ExceptionNative!"));
UNREACHABLE();
}
@@ -4105,12 +4081,12 @@
reinterpret_cast<Dart_NativeEntryResolver>(native_lookup));
// Throwing an exception here should result in an error.
- result = Dart_ThrowException(Dart_NewString("This doesn't work"));
+ result = Dart_ThrowException(NewString("This doesn't work"));
EXPECT_ERROR(result, "No Dart frames on stack, cannot throw exception");
EXPECT(!Dart_ErrorHasException(result));
// Invoke 'test' and check for an uncaught exception.
- result = Dart_Invoke(lib, Dart_NewString("test"), 0, NULL);
+ result = Dart_Invoke(lib, NewString("test"), 0, NULL);
EXPECT_ERROR(result, "Hello from ExceptionNative!");
EXPECT(Dart_ErrorHasException(result));
@@ -4146,7 +4122,7 @@
kScriptChars,
reinterpret_cast<Dart_NativeEntryResolver>(gnac_lookup));
- Dart_Handle result = Dart_Invoke(lib, Dart_NewString("testMain"), 0, NULL);
+ Dart_Handle result = Dart_Invoke(lib, NewString("testMain"), 0, NULL);
EXPECT_VALID(result);
EXPECT(Dart_IsInteger(result));
@@ -4170,31 +4146,31 @@
Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
// Lookup a class.
- Dart_Handle cls = Dart_GetClass(lib, Dart_NewString("Class"));
+ Dart_Handle cls = Dart_GetClass(lib, NewString("Class"));
EXPECT_VALID(cls);
- Dart_Handle name = Dart_GetField(cls, Dart_NewString("name"));
+ Dart_Handle name = Dart_GetField(cls, NewString("name"));
EXPECT_VALID(name);
const char* name_cstr = "";
EXPECT_VALID(Dart_StringToCString(name, &name_cstr));
EXPECT_STREQ("Class", name_cstr);
// Lookup a private class.
- cls = Dart_GetClass(lib, Dart_NewString("_Class"));
+ cls = Dart_GetClass(lib, NewString("_Class"));
EXPECT_VALID(cls);
- name = Dart_GetField(cls, Dart_NewString("name"));
+ name = Dart_GetField(cls, NewString("name"));
EXPECT_VALID(name);
name_cstr = "";
EXPECT_VALID(Dart_StringToCString(name, &name_cstr));
EXPECT_STREQ("_Class", name_cstr);
// Lookup a class that does not exist.
- cls = Dart_GetClass(lib, Dart_NewString("DoesNotExist"));
+ cls = Dart_GetClass(lib, NewString("DoesNotExist"));
EXPECT(Dart_IsError(cls));
EXPECT_STREQ("Class 'DoesNotExist' not found in library 'dart:test-lib'.",
Dart_GetError(cls));
// Lookup a class from an error library. The error propagates.
- cls = Dart_GetClass(Api::NewError("myerror"), Dart_NewString("Class"));
+ cls = Dart_GetClass(Api::NewError("myerror"), NewString("Class"));
EXPECT(Dart_IsError(cls));
EXPECT_STREQ("myerror", Dart_GetError(cls));
@@ -4292,14 +4268,14 @@
Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
EXPECT_VALID(lib);
- Dart_Handle cls = Dart_GetClass(lib, Dart_NewString("MyClass"));
+ Dart_Handle cls = Dart_GetClass(lib, NewString("MyClass"));
EXPECT_VALID(cls);
- Dart_Handle private_cls = Dart_GetClass(lib, Dart_NewString("_PrivateClass"));
+ Dart_Handle private_cls = Dart_GetClass(lib, NewString("_PrivateClass"));
EXPECT_VALID(private_cls);
TextBuffer buffer(128);
// Lookup a top-level function.
- Dart_Handle func = Dart_LookupFunction(lib, Dart_NewString("a"));
+ Dart_Handle func = Dart_LookupFunction(lib, NewString("a"));
EXPECT_VALID(func);
EXPECT(Dart_IsFunction(func));
BuildFunctionDescription(&buffer, func);
@@ -4310,7 +4286,7 @@
EXPECT(Dart_IdentityEquals(owner, lib));
// Lookup a private top-level function.
- func = Dart_LookupFunction(lib, Dart_NewString("_b"));
+ func = Dart_LookupFunction(lib, NewString("_b"));
EXPECT_VALID(func);
EXPECT(Dart_IsFunction(func));
BuildFunctionDescription(&buffer, func);
@@ -4320,7 +4296,7 @@
EXPECT(Dart_IdentityEquals(owner, lib));
// Lookup a top-level getter.
- func = Dart_LookupFunction(lib, Dart_NewString("c"));
+ func = Dart_LookupFunction(lib, NewString("c"));
EXPECT_VALID(func);
EXPECT(Dart_IsFunction(func));
BuildFunctionDescription(&buffer, func);
@@ -4330,7 +4306,7 @@
EXPECT(Dart_IdentityEquals(owner, lib));
// Lookup a top-level setter.
- func = Dart_LookupFunction(lib, Dart_NewString("d="));
+ func = Dart_LookupFunction(lib, NewString("d="));
EXPECT_VALID(func);
EXPECT(Dart_IsFunction(func));
BuildFunctionDescription(&buffer, func);
@@ -4340,7 +4316,7 @@
EXPECT(Dart_IdentityEquals(owner, lib));
// Lookup a private top-level getter.
- func = Dart_LookupFunction(lib, Dart_NewString("_e"));
+ func = Dart_LookupFunction(lib, NewString("_e"));
EXPECT_VALID(func);
EXPECT(Dart_IsFunction(func));
BuildFunctionDescription(&buffer, func);
@@ -4350,7 +4326,7 @@
EXPECT(Dart_IdentityEquals(owner, lib));
// Lookup a private top-level setter.
- func = Dart_LookupFunction(lib, Dart_NewString("_f="));
+ func = Dart_LookupFunction(lib, NewString("_f="));
EXPECT_VALID(func);
EXPECT(Dart_IsFunction(func));
BuildFunctionDescription(&buffer, func);
@@ -4360,7 +4336,7 @@
EXPECT(Dart_IdentityEquals(owner, lib));
// Lookup an unnamed constructor
- func = Dart_LookupFunction(cls, Dart_NewString("MyClass"));
+ func = Dart_LookupFunction(cls, NewString("MyClass"));
EXPECT_VALID(func);
EXPECT(Dart_IsFunction(func));
BuildFunctionDescription(&buffer, func);
@@ -4370,7 +4346,7 @@
EXPECT(Dart_IdentityEquals(owner, cls));
// Lookup a named constructor
- func = Dart_LookupFunction(cls, Dart_NewString("MyClass.named"));
+ func = Dart_LookupFunction(cls, NewString("MyClass.named"));
EXPECT_VALID(func);
EXPECT(Dart_IsFunction(func));
BuildFunctionDescription(&buffer, func);
@@ -4380,7 +4356,7 @@
EXPECT(Dart_IdentityEquals(owner, cls));
// Lookup an private unnamed constructor
- func = Dart_LookupFunction(private_cls, Dart_NewString("_PrivateClass"));
+ func = Dart_LookupFunction(private_cls, NewString("_PrivateClass"));
EXPECT_VALID(func);
EXPECT(Dart_IsFunction(func));
BuildFunctionDescription(&buffer, func);
@@ -4391,7 +4367,7 @@
// Lookup a private named constructor
func = Dart_LookupFunction(private_cls,
- Dart_NewString("_PrivateClass.named"));
+ NewString("_PrivateClass.named"));
EXPECT_VALID(func);
EXPECT(Dart_IsFunction(func));
BuildFunctionDescription(&buffer, func);
@@ -4401,7 +4377,7 @@
EXPECT(Dart_IdentityEquals(owner, private_cls));
// Lookup a method.
- func = Dart_LookupFunction(cls, Dart_NewString("a"));
+ func = Dart_LookupFunction(cls, NewString("a"));
EXPECT_VALID(func);
EXPECT(Dart_IsFunction(func));
BuildFunctionDescription(&buffer, func);
@@ -4411,7 +4387,7 @@
EXPECT(Dart_IdentityEquals(owner, cls));
// Lookup a private method.
- func = Dart_LookupFunction(cls, Dart_NewString("_b"));
+ func = Dart_LookupFunction(cls, NewString("_b"));
EXPECT_VALID(func);
EXPECT(Dart_IsFunction(func));
BuildFunctionDescription(&buffer, func);
@@ -4421,7 +4397,7 @@
EXPECT(Dart_IdentityEquals(owner, cls));
// Lookup a instance getter.
- func = Dart_LookupFunction(cls, Dart_NewString("c"));
+ func = Dart_LookupFunction(cls, NewString("c"));
EXPECT_VALID(func);
EXPECT(Dart_IsFunction(func));
BuildFunctionDescription(&buffer, func);
@@ -4431,7 +4407,7 @@
EXPECT(Dart_IdentityEquals(owner, cls));
// Lookup a instance setter.
- func = Dart_LookupFunction(cls, Dart_NewString("d="));
+ func = Dart_LookupFunction(cls, NewString("d="));
EXPECT_VALID(func);
EXPECT(Dart_IsFunction(func));
BuildFunctionDescription(&buffer, func);
@@ -4441,7 +4417,7 @@
EXPECT(Dart_IdentityEquals(owner, cls));
// Lookup a private instance getter.
- func = Dart_LookupFunction(cls, Dart_NewString("_e"));
+ func = Dart_LookupFunction(cls, NewString("_e"));
EXPECT_VALID(func);
EXPECT(Dart_IsFunction(func));
BuildFunctionDescription(&buffer, func);
@@ -4451,7 +4427,7 @@
EXPECT(Dart_IdentityEquals(owner, cls));
// Lookup a private instance setter.
- func = Dart_LookupFunction(cls, Dart_NewString("_f="));
+ func = Dart_LookupFunction(cls, NewString("_f="));
EXPECT_VALID(func);
EXPECT(Dart_IsFunction(func));
BuildFunctionDescription(&buffer, func);
@@ -4461,7 +4437,7 @@
EXPECT(Dart_IdentityEquals(owner, cls));
// Lookup a static method.
- func = Dart_LookupFunction(cls, Dart_NewString("g"));
+ func = Dart_LookupFunction(cls, NewString("g"));
EXPECT_VALID(func);
EXPECT(Dart_IsFunction(func));
BuildFunctionDescription(&buffer, func);
@@ -4471,7 +4447,7 @@
EXPECT(Dart_IdentityEquals(owner, cls));
// Lookup a private static method.
- func = Dart_LookupFunction(cls, Dart_NewString("_h"));
+ func = Dart_LookupFunction(cls, NewString("_h"));
EXPECT_VALID(func);
EXPECT(Dart_IsFunction(func));
BuildFunctionDescription(&buffer, func);
@@ -4481,7 +4457,7 @@
EXPECT(Dart_IdentityEquals(owner, cls));
// Lookup a static getter.
- func = Dart_LookupFunction(cls, Dart_NewString("i"));
+ func = Dart_LookupFunction(cls, NewString("i"));
EXPECT_VALID(func);
EXPECT(Dart_IsFunction(func));
BuildFunctionDescription(&buffer, func);
@@ -4491,7 +4467,7 @@
EXPECT(Dart_IdentityEquals(owner, cls));
// Lookup a static setter.
- func = Dart_LookupFunction(cls, Dart_NewString("j="));
+ func = Dart_LookupFunction(cls, NewString("j="));
EXPECT_VALID(func);
EXPECT(Dart_IsFunction(func));
BuildFunctionDescription(&buffer, func);
@@ -4501,7 +4477,7 @@
EXPECT(Dart_IdentityEquals(owner, cls));
// Lookup a private static getter.
- func = Dart_LookupFunction(cls, Dart_NewString("_k"));
+ func = Dart_LookupFunction(cls, NewString("_k"));
EXPECT_VALID(func);
EXPECT(Dart_IsFunction(func));
BuildFunctionDescription(&buffer, func);
@@ -4511,7 +4487,7 @@
EXPECT(Dart_IdentityEquals(owner, cls));
// Lookup a private static setter.
- func = Dart_LookupFunction(cls, Dart_NewString("_l="));
+ func = Dart_LookupFunction(cls, NewString("_l="));
EXPECT_VALID(func);
EXPECT(Dart_IsFunction(func));
BuildFunctionDescription(&buffer, func);
@@ -4521,7 +4497,7 @@
EXPECT(Dart_IdentityEquals(owner, cls));
// Lookup an abstract method.
- func = Dart_LookupFunction(cls, Dart_NewString("m"));
+ func = Dart_LookupFunction(cls, NewString("m"));
EXPECT_VALID(func);
EXPECT(Dart_IsFunction(func));
BuildFunctionDescription(&buffer, func);
@@ -4531,7 +4507,7 @@
EXPECT(Dart_IdentityEquals(owner, cls));
// Lookup a private abstract method.
- func = Dart_LookupFunction(cls, Dart_NewString("_n"));
+ func = Dart_LookupFunction(cls, NewString("_n"));
EXPECT_VALID(func);
EXPECT(Dart_IsFunction(func));
BuildFunctionDescription(&buffer, func);
@@ -4541,7 +4517,7 @@
EXPECT(Dart_IdentityEquals(owner, cls));
// Lookup a abstract getter.
- func = Dart_LookupFunction(cls, Dart_NewString("o"));
+ func = Dart_LookupFunction(cls, NewString("o"));
EXPECT_VALID(func);
EXPECT(Dart_IsFunction(func));
BuildFunctionDescription(&buffer, func);
@@ -4551,7 +4527,7 @@
EXPECT(Dart_IdentityEquals(owner, cls));
// Lookup a abstract setter.
- func = Dart_LookupFunction(cls, Dart_NewString("p="));
+ func = Dart_LookupFunction(cls, NewString("p="));
EXPECT_VALID(func);
EXPECT(Dart_IsFunction(func));
BuildFunctionDescription(&buffer, func);
@@ -4561,7 +4537,7 @@
EXPECT(Dart_IdentityEquals(owner, cls));
// Lookup a private abstract getter.
- func = Dart_LookupFunction(cls, Dart_NewString("_q"));
+ func = Dart_LookupFunction(cls, NewString("_q"));
EXPECT_VALID(func);
EXPECT(Dart_IsFunction(func));
BuildFunctionDescription(&buffer, func);
@@ -4571,7 +4547,7 @@
EXPECT(Dart_IdentityEquals(owner, cls));
// Lookup a private abstract setter.
- func = Dart_LookupFunction(cls, Dart_NewString("_r="));
+ func = Dart_LookupFunction(cls, NewString("_r="));
EXPECT_VALID(func);
EXPECT(Dart_IsFunction(func));
BuildFunctionDescription(&buffer, func);
@@ -4581,7 +4557,7 @@
EXPECT(Dart_IdentityEquals(owner, cls));
// Lookup a method with fixed and optional parameters.
- func = Dart_LookupFunction(cls, Dart_NewString("s"));
+ func = Dart_LookupFunction(cls, NewString("s"));
EXPECT_VALID(func);
EXPECT(Dart_IsFunction(func));
BuildFunctionDescription(&buffer, func);
@@ -4591,7 +4567,7 @@
EXPECT(Dart_IdentityEquals(owner, cls));
// Lookup a method with only optional parameters.
- func = Dart_LookupFunction(cls, Dart_NewString("t"));
+ func = Dart_LookupFunction(cls, NewString("t"));
EXPECT_VALID(func);
EXPECT(Dart_IsFunction(func));
BuildFunctionDescription(&buffer, func);
@@ -4601,7 +4577,7 @@
EXPECT(Dart_IdentityEquals(owner, cls));
// Lookup an operator
- func = Dart_LookupFunction(cls, Dart_NewString("=="));
+ func = Dart_LookupFunction(cls, NewString("=="));
EXPECT_VALID(func);
EXPECT(Dart_IsFunction(func));
BuildFunctionDescription(&buffer, func);
@@ -4611,11 +4587,11 @@
EXPECT(Dart_IdentityEquals(owner, cls));
// Lookup a function that does not exist from a library.
- func = Dart_LookupFunction(lib, Dart_NewString("DoesNotExist"));
+ func = Dart_LookupFunction(lib, NewString("DoesNotExist"));
EXPECT(Dart_IsNull(func));
// Lookup a function that does not exist from a class.
- func = Dart_LookupFunction(cls, Dart_NewString("DoesNotExist"));
+ func = Dart_LookupFunction(cls, NewString("DoesNotExist"));
EXPECT(Dart_IsNull(func));
// Lookup a class using an error class name. The error propagates.
@@ -4623,7 +4599,7 @@
EXPECT_ERROR(func, "myerror");
// Lookup a class from an error library. The error propagates.
- func = Dart_LookupFunction(Api::NewError("myerror"), Dart_NewString("foo"));
+ func = Dart_LookupFunction(Api::NewError("myerror"), NewString("foo"));
EXPECT_ERROR(func, "myerror");
}
@@ -4635,7 +4611,7 @@
Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
EXPECT_VALID(lib);
- Dart_Handle func = Dart_LookupFunction(lib, Dart_NewString("func"));
+ Dart_Handle func = Dart_LookupFunction(lib, NewString("func"));
EXPECT_VALID(func);
EXPECT(Dart_IsFunction(func));
@@ -4664,7 +4640,7 @@
EXPECT_VALID(Dart_StringToCString(cls_name, &cls_name_cstr));
EXPECT_STREQ("String", cls_name_cstr);
- Dart_Handle var = Dart_LookupVariable(lib, Dart_NewString("variable"));
+ Dart_Handle var = Dart_LookupVariable(lib, NewString("variable"));
EXPECT_VALID(var);
EXPECT(Dart_IsVariable(var));
@@ -4722,104 +4698,104 @@
Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
EXPECT_VALID(lib);
- Dart_Handle cls = Dart_GetClass(lib, Dart_NewString("MyClass"));
+ Dart_Handle cls = Dart_GetClass(lib, NewString("MyClass"));
EXPECT_VALID(cls);
TextBuffer buffer(128);
// Lookup a top-level variable.
- Dart_Handle var = Dart_LookupVariable(lib, Dart_NewString("a"));
+ Dart_Handle var = Dart_LookupVariable(lib, NewString("a"));
EXPECT_VALID(var);
EXPECT(Dart_IsVariable(var));
BuildVariableDescription(&buffer, var);
EXPECT_STREQ("a static", buffer.buf());
// Lookup a private top-level variable.
- var = Dart_LookupVariable(lib, Dart_NewString("_b"));
+ var = Dart_LookupVariable(lib, NewString("_b"));
EXPECT_VALID(var);
EXPECT(Dart_IsVariable(var));
BuildVariableDescription(&buffer, var);
EXPECT_STREQ("_b static", buffer.buf());
// Lookup a const top-level variable.
- var = Dart_LookupVariable(lib, Dart_NewString("c"));
+ var = Dart_LookupVariable(lib, NewString("c"));
EXPECT_VALID(var);
EXPECT(Dart_IsVariable(var));
BuildVariableDescription(&buffer, var);
EXPECT_STREQ("c static final", buffer.buf());
// Lookup a private const top-level variable.
- var = Dart_LookupVariable(lib, Dart_NewString("_d"));
+ var = Dart_LookupVariable(lib, NewString("_d"));
EXPECT_VALID(var);
EXPECT(Dart_IsVariable(var));
BuildVariableDescription(&buffer, var);
EXPECT_STREQ("_d static final", buffer.buf());
// Lookup a instance variable.
- var = Dart_LookupVariable(cls, Dart_NewString("a"));
+ var = Dart_LookupVariable(cls, NewString("a"));
EXPECT_VALID(var);
EXPECT(Dart_IsVariable(var));
BuildVariableDescription(&buffer, var);
EXPECT_STREQ("a", buffer.buf());
// Lookup a private instance variable.
- var = Dart_LookupVariable(cls, Dart_NewString("_b"));
+ var = Dart_LookupVariable(cls, NewString("_b"));
EXPECT_VALID(var);
EXPECT(Dart_IsVariable(var));
BuildVariableDescription(&buffer, var);
EXPECT_STREQ("_b", buffer.buf());
// Lookup a final instance variable.
- var = Dart_LookupVariable(cls, Dart_NewString("c"));
+ var = Dart_LookupVariable(cls, NewString("c"));
EXPECT_VALID(var);
EXPECT(Dart_IsVariable(var));
BuildVariableDescription(&buffer, var);
EXPECT_STREQ("c final", buffer.buf());
// Lookup a private final instance variable.
- var = Dart_LookupVariable(cls, Dart_NewString("_d"));
+ var = Dart_LookupVariable(cls, NewString("_d"));
EXPECT_VALID(var);
EXPECT(Dart_IsVariable(var));
BuildVariableDescription(&buffer, var);
EXPECT_STREQ("_d final", buffer.buf());
// Lookup a static variable.
- var = Dart_LookupVariable(cls, Dart_NewString("e"));
+ var = Dart_LookupVariable(cls, NewString("e"));
EXPECT_VALID(var);
EXPECT(Dart_IsVariable(var));
BuildVariableDescription(&buffer, var);
EXPECT_STREQ("e static", buffer.buf());
// Lookup a private static variable.
- var = Dart_LookupVariable(cls, Dart_NewString("_f"));
+ var = Dart_LookupVariable(cls, NewString("_f"));
EXPECT_VALID(var);
EXPECT(Dart_IsVariable(var));
BuildVariableDescription(&buffer, var);
EXPECT_STREQ("_f static", buffer.buf());
// Lookup a const static variable.
- var = Dart_LookupVariable(cls, Dart_NewString("g"));
+ var = Dart_LookupVariable(cls, NewString("g"));
EXPECT_VALID(var);
EXPECT(Dart_IsVariable(var));
BuildVariableDescription(&buffer, var);
EXPECT_STREQ("g static final", buffer.buf());
// Lookup a private const static variable.
- var = Dart_LookupVariable(cls, Dart_NewString("_h"));
+ var = Dart_LookupVariable(cls, NewString("_h"));
EXPECT_VALID(var);
EXPECT(Dart_IsVariable(var));
BuildVariableDescription(&buffer, var);
EXPECT_STREQ("_h static final", buffer.buf());
// Lookup a variable that does not exist from a library.
- var = Dart_LookupVariable(lib, Dart_NewString("DoesNotExist"));
+ var = Dart_LookupVariable(lib, NewString("DoesNotExist"));
EXPECT(Dart_IsNull(var));
// Lookup a variable that does not exist from a class.
- var = Dart_LookupVariable(cls, Dart_NewString("DoesNotExist"));
+ var = Dart_LookupVariable(cls, NewString("DoesNotExist"));
EXPECT(Dart_IsNull(var));
// Lookup a class from an error library. The error propagates.
- var = Dart_LookupVariable(Api::NewError("myerror"), Dart_NewString("foo"));
+ var = Dart_LookupVariable(Api::NewError("myerror"), NewString("foo"));
EXPECT_ERROR(var, "myerror");
// Lookup a class using an error class name. The error propagates.
@@ -4837,7 +4813,7 @@
"}\n";
Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
- Dart_Handle cls = Dart_GetClass(lib, Dart_NewString("GenericClass"));
+ Dart_Handle cls = Dart_GetClass(lib, NewString("GenericClass"));
EXPECT_VALID(cls);
// Test Dart_GetTypeVariableNames.
@@ -4850,7 +4826,7 @@
EXPECT_STREQ("[U, T]", cstr);
// Test variable U.
- Dart_Handle type_var = Dart_LookupTypeVariable(cls, Dart_NewString("U"));
+ Dart_Handle type_var = Dart_LookupTypeVariable(cls, NewString("U"));
EXPECT_VALID(type_var);
EXPECT(Dart_IsTypeVariable(type_var));
Dart_Handle type_var_name = Dart_TypeVariableName(type_var);
@@ -4866,7 +4842,7 @@
EXPECT_STREQ("Object", cstr);
// Test variable T.
- type_var = Dart_LookupTypeVariable(cls, Dart_NewString("T"));
+ type_var = Dart_LookupTypeVariable(cls, NewString("T"));
EXPECT_VALID(type_var);
EXPECT(Dart_IsTypeVariable(type_var));
type_var_name = Dart_TypeVariableName(type_var);
@@ -4899,12 +4875,12 @@
Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
// Fetch InstanceOfTest class.
- Dart_Handle cls = Dart_GetClass(lib, Dart_NewString("InstanceOfTest"));
+ Dart_Handle cls = Dart_GetClass(lib, NewString("InstanceOfTest"));
EXPECT_VALID(cls);
// Invoke a function which returns an object of type InstanceOf..
Dart_Handle instanceOfTestObj =
- Dart_Invoke(cls, Dart_NewString("testMain"), 0, NULL);
+ Dart_Invoke(cls, NewString("testMain"), 0, NULL);
EXPECT_VALID(instanceOfTestObj);
// Now check instanceOfTestObj reported as an instance of
@@ -4915,7 +4891,7 @@
EXPECT(is_instance);
// Fetch OtherClass and check if instanceOfTestObj is instance of it.
- Dart_Handle otherClass = Dart_GetClass(lib, Dart_NewString("OtherClass"));
+ Dart_Handle otherClass = Dart_GetClass(lib, NewString("OtherClass"));
EXPECT_VALID(otherClass);
result = Dart_ObjectIsType(instanceOfTestObj, otherClass, &is_instance);
@@ -4923,7 +4899,7 @@
EXPECT(!is_instance);
// Check that primitives are not instances of InstanceOfTest class.
- result = Dart_ObjectIsType(Dart_NewString("a string"), otherClass,
+ result = Dart_ObjectIsType(NewString("a string"), otherClass,
&is_instance);
EXPECT_VALID(result);
EXPECT(!is_instance);
@@ -4938,7 +4914,7 @@
// Check that null is not an instance of InstanceOfTest class.
Dart_Handle null = Dart_Invoke(otherClass,
- Dart_NewString("returnNull"),
+ NewString("returnNull"),
0,
NULL);
EXPECT_VALID(null);
@@ -4968,8 +4944,8 @@
"main() {"
" return 12345;"
"}";
- Dart_Handle url = Dart_NewString(TestCase::url());
- Dart_Handle source = Dart_NewString(kScriptChars);
+ Dart_Handle url = NewString(TestCase::url());
+ Dart_Handle source = NewString(kScriptChars);
Dart_Handle error = Dart_Error("incoming error");
Dart_Handle result;
@@ -5009,7 +4985,7 @@
result = Dart_LoadScript(url, source);
EXPECT_VALID(result);
- result = Dart_Invoke(result, Dart_NewString("main"), 0, NULL);
+ result = Dart_Invoke(result, NewString("main"), 0, NULL);
EXPECT_VALID(result);
EXPECT(Dart_IsInteger(result));
int64_t value = 0;
@@ -5036,8 +5012,8 @@
EXPECT(Dart_IsNull(root_lib));
// Load a script.
- Dart_Handle url = Dart_NewString(TestCase::url());
- Dart_Handle source = Dart_NewString(kScriptChars);
+ Dart_Handle url = NewString(TestCase::url());
+ Dart_Handle source = NewString(kScriptChars);
EXPECT_VALID(Dart_LoadScript(url, source));
root_lib = Dart_RootLibrary();
@@ -5090,8 +5066,8 @@
TEST_CASE(LoadScript_CompileError) {
const char* kScriptChars =
")";
- Dart_Handle url = Dart_NewString(TestCase::url());
- Dart_Handle source = Dart_NewString(kScriptChars);
+ Dart_Handle url = NewString(TestCase::url());
+ Dart_Handle source = NewString(kScriptChars);
Dart_Handle result = Dart_SetLibraryTagHandler(import_library_handler);
EXPECT_VALID(result);
result = Dart_LoadScript(url, source);
@@ -5109,15 +5085,15 @@
"#import('library2.dart');";
// Create a test library and Load up a test script in it.
- Dart_Handle url = Dart_NewString(TestCase::url());
- Dart_Handle source = Dart_NewString(kScriptChars);
+ Dart_Handle url = NewString(TestCase::url());
+ Dart_Handle source = NewString(kScriptChars);
Dart_Handle result = Dart_SetLibraryTagHandler(library_handler);
EXPECT_VALID(result);
result = Dart_LoadScript(url, source);
EXPECT_VALID(result);
- url = Dart_NewString("library1.dart");
- source = Dart_NewString(kLibrary1Chars);
+ url = NewString("library1.dart");
+ source = NewString(kLibrary1Chars);
result = Dart_LoadLibrary(url, source);
EXPECT_VALID(result);
@@ -5139,7 +5115,7 @@
EXPECT(Dart_IsError(result));
EXPECT_STREQ("incoming error", Dart_GetError(result));
- url = Dart_NewString("noodles.dart");
+ url = NewString("noodles.dart");
result = Dart_LookupLibrary(url);
EXPECT(Dart_IsError(result));
EXPECT_STREQ("Dart_LookupLibrary: library 'noodles.dart' not found.",
@@ -5150,8 +5126,8 @@
TEST_CASE(LibraryName) {
const char* kLibrary1Chars =
"#library('library1_name');";
- Dart_Handle url = Dart_NewString("library1_url");
- Dart_Handle source = Dart_NewString(kLibrary1Chars);
+ Dart_Handle url = NewString("library1_url");
+ Dart_Handle source = NewString(kLibrary1Chars);
Dart_Handle lib = Dart_LoadLibrary(url, source);
Dart_Handle error = Dart_Error("incoming error");
EXPECT_VALID(lib);
@@ -5183,8 +5159,8 @@
TEST_CASE(LibraryUrl) {
const char* kLibrary1Chars =
"#library('library1_name');";
- Dart_Handle url = Dart_NewString("library1_url");
- Dart_Handle source = Dart_NewString(kLibrary1Chars);
+ Dart_Handle url = NewString("library1_url");
+ Dart_Handle source = NewString(kLibrary1Chars);
Dart_Handle lib = Dart_LoadLibrary(url, source);
Dart_Handle error = Dart_Error("incoming error");
EXPECT_VALID(lib);
@@ -5227,8 +5203,8 @@
"_compare(String a, String b) => a.compareTo(b);\n"
"sort(list) => list.sort(_compare);\n";
- Dart_Handle url = Dart_NewString("library_url");
- Dart_Handle source = Dart_NewString(kLibraryChars);
+ Dart_Handle url = NewString("library_url");
+ Dart_Handle source = NewString(kLibraryChars);
Dart_Handle lib = Dart_LoadLibrary(url, source);
EXPECT_VALID(lib);
@@ -5240,7 +5216,7 @@
const int kNumArgs = 1;
Dart_Handle args[1];
args[0] = list;
- EXPECT_VALID(Dart_Invoke(lib, Dart_NewString("sort"), kNumArgs, args));
+ EXPECT_VALID(Dart_Invoke(lib, NewString("sort"), kNumArgs, args));
Dart_Handle list_string = Dart_ToString(list);
EXPECT_VALID(list_string);
@@ -5278,8 +5254,8 @@
"sort(list) => list.sort(_compare);\n";
// Get the functions from a library.
- Dart_Handle url = Dart_NewString("library_url");
- Dart_Handle source = Dart_NewString(kLibraryChars);
+ Dart_Handle url = NewString("library_url");
+ Dart_Handle source = NewString(kLibraryChars);
Dart_Handle lib = Dart_LoadLibrary(url, source);
EXPECT_VALID(lib);
@@ -5291,7 +5267,7 @@
const int kNumArgs = 1;
Dart_Handle args[1];
args[0] = list;
- EXPECT_VALID(Dart_Invoke(lib, Dart_NewString("sort"), kNumArgs, args));
+ EXPECT_VALID(Dart_Invoke(lib, NewString("sort"), kNumArgs, args));
Dart_Handle list_string = Dart_ToString(list);
EXPECT_VALID(list_string);
@@ -5300,7 +5276,7 @@
EXPECT_STREQ("[A, B, C=, _A, _B, _C=, _compare, sort]", list_cstr);
// Get the functions from a class.
- Dart_Handle cls = Dart_GetClass(lib, Dart_NewString("MyClass"));
+ Dart_Handle cls = Dart_GetClass(lib, NewString("MyClass"));
EXPECT_VALID(cls);
list = Dart_GetFunctionNames(cls);
@@ -5309,7 +5285,7 @@
// Sort the list.
args[0] = list;
- EXPECT_VALID(Dart_Invoke(lib, Dart_NewString("sort"), kNumArgs, args));
+ EXPECT_VALID(Dart_Invoke(lib, NewString("sort"), kNumArgs, args));
// Check list contents.
list_string = Dart_ToString(list);
@@ -5342,8 +5318,8 @@
"sort(list) => list.sort(_compare);\n";
// Get the variables from a library.
- Dart_Handle url = Dart_NewString("library_url");
- Dart_Handle source = Dart_NewString(kLibraryChars);
+ Dart_Handle url = NewString("library_url");
+ Dart_Handle source = NewString(kLibraryChars);
Dart_Handle lib = Dart_LoadLibrary(url, source);
EXPECT_VALID(lib);
@@ -5355,7 +5331,7 @@
const int kNumArgs = 1;
Dart_Handle args[1];
args[0] = list;
- EXPECT_VALID(Dart_Invoke(lib, Dart_NewString("sort"), kNumArgs, args));
+ EXPECT_VALID(Dart_Invoke(lib, NewString("sort"), kNumArgs, args));
// Check list contents.
Dart_Handle list_string = Dart_ToString(list);
@@ -5365,7 +5341,7 @@
EXPECT_STREQ("[A, _A]", list_cstr);
// Get the variables from a class.
- Dart_Handle cls = Dart_GetClass(lib, Dart_NewString("MyClass"));
+ Dart_Handle cls = Dart_GetClass(lib, NewString("MyClass"));
EXPECT_VALID(cls);
list = Dart_GetVariableNames(cls);
@@ -5374,7 +5350,7 @@
// Sort the list.
args[0] = list;
- EXPECT_VALID(Dart_Invoke(lib, Dart_NewString("sort"), kNumArgs, args));
+ EXPECT_VALID(Dart_Invoke(lib, NewString("sort"), kNumArgs, args));
// Check list contents.
list_string = Dart_ToString(list);
@@ -5393,13 +5369,13 @@
Dart_Handle error = Dart_Error("incoming error");
Dart_Handle result;
- Dart_Handle url = Dart_NewString("library1_url");
- Dart_Handle source = Dart_NewString(kLibrary1Chars);
+ Dart_Handle url = NewString("library1_url");
+ Dart_Handle source = NewString(kLibrary1Chars);
Dart_Handle lib1 = Dart_LoadLibrary(url, source);
EXPECT_VALID(lib1);
- url = Dart_NewString("library2_url");
- source = Dart_NewString(kLibrary2Chars);
+ url = NewString("library2_url");
+ source = NewString(kLibrary2Chars);
Dart_Handle lib2 = Dart_LoadLibrary(url, source);
EXPECT_VALID(lib2);
@@ -5444,8 +5420,8 @@
const char* kLibrary1Chars =
"#library('library1_name');"
"int bar() => 42;";
- Dart_Handle url1 = Dart_NewString("library1_url");
- Dart_Handle source1 = Dart_NewString(kLibrary1Chars);
+ Dart_Handle url1 = NewString("library1_url");
+ Dart_Handle source1 = NewString(kLibrary1Chars);
Dart_Handle lib1 = Dart_LoadLibrary(url1, source1);
EXPECT_VALID(lib1);
EXPECT(Dart_IsLibrary(lib1));
@@ -5453,24 +5429,24 @@
const char* kLibrary2Chars =
"#library('library2_name');"
"int foobar() => foo.bar();";
- Dart_Handle url2 = Dart_NewString("library2_url");
- Dart_Handle source2 = Dart_NewString(kLibrary2Chars);
+ Dart_Handle url2 = NewString("library2_url");
+ Dart_Handle source2 = NewString(kLibrary2Chars);
Dart_Handle lib2 = Dart_LoadLibrary(url2, source2);
EXPECT_VALID(lib2);
EXPECT(Dart_IsLibrary(lib2));
- Dart_Handle prefix = Dart_NewString("foo");
+ Dart_Handle prefix = NewString("foo");
Dart_Handle result = Dart_LibraryImportLibrary(lib2, lib1, prefix);
EXPECT_VALID(result);
// Lib1 is imported under a library prefix and therefore 'foo' should
// not be found directly in lib2.
- Dart_Handle method_name = Dart_NewString("foo");
+ Dart_Handle method_name = NewString("foo");
result = Dart_Invoke(lib2, method_name, 0, NULL);
EXPECT_ERROR(result, "Dart_Invoke: did not find top-level function 'foo'");
// Check that lib1 is available under the prefix in lib2.
- method_name = Dart_NewString("foobar");
+ method_name = NewString("foobar");
result = Dart_Invoke(lib2, method_name, 0, NULL);
EXPECT_VALID(result);
EXPECT(Dart_IsInteger(result));
@@ -5487,8 +5463,8 @@
Dart_Handle error = Dart_Error("incoming error");
Dart_Handle result;
- Dart_Handle url = Dart_NewString("library1_url");
- Dart_Handle source = Dart_NewString(kLibrary1Chars);
+ Dart_Handle url = NewString("library1_url");
+ Dart_Handle source = NewString(kLibrary1Chars);
result = Dart_LoadLibrary(Dart_Null(), source);
EXPECT(Dart_IsError(result));
@@ -5537,8 +5513,8 @@
const char* kLibrary1Chars =
"#library('library1_name');"
")";
- Dart_Handle url = Dart_NewString("library1_url");
- Dart_Handle source = Dart_NewString(kLibrary1Chars);
+ Dart_Handle url = NewString("library1_url");
+ Dart_Handle source = NewString(kLibrary1Chars);
Dart_Handle result = Dart_LoadLibrary(url, source);
EXPECT(Dart_IsError(result));
EXPECT(strstr(Dart_GetError(result), "unexpected token ')'"));
@@ -5556,14 +5532,14 @@
Dart_Handle result;
// Load up a library.
- Dart_Handle url = Dart_NewString("library1_url");
- Dart_Handle source = Dart_NewString(kLibrary1Chars);
+ Dart_Handle url = NewString("library1_url");
+ Dart_Handle source = NewString(kLibrary1Chars);
Dart_Handle lib = Dart_LoadLibrary(url, source);
EXPECT_VALID(lib);
EXPECT(Dart_IsLibrary(lib));
- url = Dart_NewString("source_url");
- source = Dart_NewString(kSourceChars);
+ url = NewString("source_url");
+ source = NewString(kSourceChars);
result = Dart_LoadSource(Dart_Null(), url, source);
EXPECT(Dart_IsError(result));
@@ -5622,7 +5598,7 @@
EXPECT(Dart_IdentityEquals(lib, result));
// Language errors are detected.
- source = Dart_NewString(kBadSourceChars);
+ source = NewString(kBadSourceChars);
result = Dart_LoadSource(lib, url, source);
EXPECT(Dart_IsError(result));
}
@@ -5638,17 +5614,17 @@
"class NewClass extends OldClass{\n"
" bar() => 'bar';\n"
"}\n";
- Dart_Handle url = Dart_NewString("library1_url");
- Dart_Handle source = Dart_NewString(kLibrary1Chars);
+ Dart_Handle url = NewString("library1_url");
+ Dart_Handle source = NewString(kLibrary1Chars);
Dart_Handle lib = Dart_LoadLibrary(url, source);
EXPECT_VALID(lib);
EXPECT(Dart_IsLibrary(lib));
// Call a dynamic function on OldClass.
- Dart_Handle cls = Dart_GetClass(lib, Dart_NewString("OldClass"));
+ Dart_Handle cls = Dart_GetClass(lib, NewString("OldClass"));
EXPECT_VALID(cls);
Dart_Handle recv = Dart_New(cls, Dart_Null(), 0, NULL);
- Dart_Handle result = Dart_Invoke(recv, Dart_NewString("foo"), 0, NULL);
+ Dart_Handle result = Dart_Invoke(recv, NewString("foo"), 0, NULL);
EXPECT_VALID(result);
EXPECT(Dart_IsString(result));
const char* result_cstr = "";
@@ -5656,15 +5632,15 @@
EXPECT_STREQ("foo", result_cstr);
// Load a source file late.
- url = Dart_NewString("source_url");
- source = Dart_NewString(kSourceChars);
+ url = NewString("source_url");
+ source = NewString(kSourceChars);
EXPECT_VALID(Dart_LoadSource(lib, url, source));
// Call a dynamic function on NewClass in the updated library.
- cls = Dart_GetClass(lib, Dart_NewString("NewClass"));
+ cls = Dart_GetClass(lib, NewString("NewClass"));
EXPECT_VALID(cls);
recv = Dart_New(cls, Dart_Null(), 0, NULL);
- result = Dart_Invoke(recv, Dart_NewString("bar"), 0, NULL);
+ result = Dart_Invoke(recv, NewString("bar"), 0, NULL);
EXPECT_VALID(result);
EXPECT(Dart_IsString(result));
result_cstr = "";
@@ -5682,25 +5658,25 @@
"patch int foo() => 42;";
// Load up a library.
- Dart_Handle url = Dart_NewString("library1_url");
- Dart_Handle source = Dart_NewString(kLibrary1Chars);
+ Dart_Handle url = NewString("library1_url");
+ Dart_Handle source = NewString(kLibrary1Chars);
Dart_Handle lib = Dart_LoadLibrary(url, source);
EXPECT_VALID(lib);
EXPECT(Dart_IsLibrary(lib));
- url = Dart_NewString("source_url");
- source = Dart_NewString(kSourceChars);
+ url = NewString("source_url");
+ source = NewString(kSourceChars);
Dart_Handle result = Dart_LoadSource(lib, url, source);
EXPECT_VALID(result);
- url = Dart_NewString("patch_url");
- source = Dart_NewString(kPatchChars);
+ url = NewString("patch_url");
+ source = NewString(kPatchChars);
result = Dart_LoadPatch(lib, url, source);
EXPECT_VALID(result);
- result = Dart_Invoke(lib, Dart_NewString("foo"), 0, NULL);
+ result = Dart_Invoke(lib, NewString("foo"), 0, NULL);
EXPECT_VALID(result);
EXPECT(Dart_IsInteger(result));
int64_t value = 0;
@@ -5789,8 +5765,8 @@
Dart_Handle result = Dart_SetLibraryTagHandler(library_handler);
EXPECT_VALID(result);
- Dart_Handle url = Dart_NewString("theLibrary");
- Dart_Handle source = Dart_NewString(kLibraryChars);
+ Dart_Handle url = NewString("theLibrary");
+ Dart_Handle source = NewString(kLibraryChars);
result = Dart_LoadLibrary(url, source);
EXPECT_VALID(result);
@@ -5809,8 +5785,8 @@
result = Dart_SetNativeResolver(result, &PatchNativeResolver);
EXPECT_VALID(result);
- Dart_Handle script_url = Dart_NewString("theScript");
- source = Dart_NewString(kScriptChars);
+ Dart_Handle script_url = NewString("theScript");
+ source = NewString(kScriptChars);
Dart_Handle test_script = Dart_LoadScript(script_url, source);
EXPECT_VALID(test_script);
@@ -5818,43 +5794,43 @@
result = Dart_CompileAll();
EXPECT_VALID(result);
- result = Dart_Invoke(test_script, Dart_NewString("e1"), 0, NULL);
+ result = Dart_Invoke(test_script, NewString("e1"), 0, NULL);
EXPECT_ERROR(result, "No such method: 'unpatched'");
int64_t value = 0;
- result = Dart_Invoke(test_script, Dart_NewString("m1"), 0, NULL);
+ result = Dart_Invoke(test_script, NewString("m1"), 0, NULL);
EXPECT_VALID(result);
EXPECT(Dart_IsInteger(result));
EXPECT_VALID(Dart_IntegerToInt64(result, &value));
EXPECT_EQ(4, value);
value = 0;
- result = Dart_Invoke(test_script, Dart_NewString("m2"), 0, NULL);
+ result = Dart_Invoke(test_script, NewString("m2"), 0, NULL);
EXPECT_VALID(result);
EXPECT(Dart_IsInteger(result));
EXPECT_VALID(Dart_IntegerToInt64(result, &value));
EXPECT_EQ(40, value);
value = 0;
- result = Dart_Invoke(test_script, Dart_NewString("m3"), 0, NULL);
+ result = Dart_Invoke(test_script, NewString("m3"), 0, NULL);
EXPECT_VALID(result);
EXPECT(Dart_IsInteger(result));
EXPECT_VALID(Dart_IntegerToInt64(result, &value));
EXPECT_EQ(21, value);
value = 0;
- result = Dart_Invoke(test_script, Dart_NewString("m4"), 0, NULL);
+ result = Dart_Invoke(test_script, NewString("m4"), 0, NULL);
EXPECT_VALID(result);
EXPECT(Dart_IsInteger(result));
EXPECT_VALID(Dart_IntegerToInt64(result, &value));
EXPECT_EQ(-25, value);
- result = Dart_Invoke(test_script, Dart_NewString("m5"), 0, NULL);
+ result = Dart_Invoke(test_script, NewString("m5"), 0, NULL);
EXPECT_VALID(result);
EXPECT(Dart_IsNull(result));
value = 0;
- result = Dart_Invoke(test_script, Dart_NewString("m6"), 0, NULL);
+ result = Dart_Invoke(test_script, NewString("m6"), 0, NULL);
EXPECT_VALID(result);
EXPECT(Dart_IsInteger(result));
EXPECT_VALID(Dart_IntegerToInt64(result, &value));
@@ -5899,14 +5875,14 @@
Dart_Handle result;
// Load a test script.
- Dart_Handle url = Dart_NewString(TestCase::url());
- Dart_Handle source = Dart_NewString(kScriptChars);
+ Dart_Handle url = NewString(TestCase::url());
+ Dart_Handle source = NewString(kScriptChars);
result = Dart_SetLibraryTagHandler(library_handler);
EXPECT_VALID(result);
Dart_Handle lib = Dart_LoadScript(url, source);
EXPECT_VALID(lib);
EXPECT(Dart_IsLibrary(lib));
- Dart_Handle cls = Dart_GetClass(lib, Dart_NewString("Test"));
+ Dart_Handle cls = Dart_GetClass(lib, NewString("Test"));
EXPECT_VALID(cls);
result = Dart_SetNativeResolver(Dart_Null(), &MyNativeResolver1);
@@ -5929,7 +5905,7 @@
EXPECT_VALID(result);
// Call a function and make sure native resolution works.
- result = Dart_Invoke(cls, Dart_NewString("foo"), 0, NULL);
+ result = Dart_Invoke(cls, NewString("foo"), 0, NULL);
EXPECT_VALID(result);
EXPECT(Dart_IsInteger(result));
int64_t value = 0;
@@ -5941,7 +5917,7 @@
EXPECT_VALID(result);
// 'foo' has already been resolved so gets the old value.
- result = Dart_Invoke(cls, Dart_NewString("foo"), 0, NULL);
+ result = Dart_Invoke(cls, NewString("foo"), 0, NULL);
EXPECT_VALID(result);
EXPECT(Dart_IsInteger(result));
value = 0;
@@ -5949,7 +5925,7 @@
EXPECT_EQ(654321, value);
// 'bar' has not yet been resolved so gets the new value.
- result = Dart_Invoke(cls, Dart_NewString("bar"), 0, NULL);
+ result = Dart_Invoke(cls, NewString("bar"), 0, NULL);
EXPECT_VALID(result);
EXPECT(Dart_IsInteger(result));
value = 0;
@@ -5960,7 +5936,7 @@
result = Dart_SetNativeResolver(lib, NULL);
EXPECT_VALID(result);
- EXPECT_ERROR(Dart_Invoke(cls, Dart_NewString("baz"), 0, NULL),
+ EXPECT_ERROR(Dart_Invoke(cls, NewString("baz"), 0, NULL),
"native function 'SomeNativeFunction3' cannot be found");
}
@@ -5982,21 +5958,21 @@
"var foo;\n";
Dart_Handle result;
// Create a test library and Load up a test script in it.
- Dart_Handle url = Dart_NewString(TestCase::url());
- Dart_Handle source = Dart_NewString(kScriptChars);
+ Dart_Handle url = NewString(TestCase::url());
+ Dart_Handle source = NewString(kScriptChars);
result = Dart_SetLibraryTagHandler(library_handler);
EXPECT_VALID(result);
result = Dart_LoadScript(url, source);
- url = Dart_NewString("library1.dart");
- source = Dart_NewString(kLibrary1Chars);
+ url = NewString("library1.dart");
+ source = NewString(kLibrary1Chars);
Dart_LoadLibrary(url, source);
- url = Dart_NewString("library2.dart");
- source = Dart_NewString(kLibrary2Chars);
+ url = NewString("library2.dart");
+ source = NewString(kLibrary2Chars);
Dart_LoadLibrary(url, source);
- result = Dart_Invoke(result, Dart_NewString("main"), 0, NULL);
+ result = Dart_Invoke(result, NewString("main"), 0, NULL);
EXPECT_VALID(result);
}
@@ -6018,22 +5994,22 @@
Dart_Handle result;
// Create a test library and Load up a test script in it.
- Dart_Handle url = Dart_NewString(TestCase::url());
- Dart_Handle source = Dart_NewString(kScriptChars);
+ Dart_Handle url = NewString(TestCase::url());
+ Dart_Handle source = NewString(kScriptChars);
result = Dart_SetLibraryTagHandler(library_handler);
EXPECT_VALID(result);
result = Dart_LoadScript(url, source);
EXPECT_VALID(result);
- url = Dart_NewString("library2.dart");
- source = Dart_NewString(kLibrary2Chars);
+ url = NewString("library2.dart");
+ source = NewString(kLibrary2Chars);
Dart_LoadLibrary(url, source);
- url = Dart_NewString("library1.dart");
- source = Dart_NewString(kLibrary1Chars);
+ url = NewString("library1.dart");
+ source = NewString(kLibrary1Chars);
Dart_LoadLibrary(url, source);
- result = Dart_Invoke(result, Dart_NewString("main"), 0, NULL);
+ result = Dart_Invoke(result, NewString("main"), 0, NULL);
EXPECT(Dart_IsError(result));
EXPECT_SUBSTRING("ambiguous reference: 'foo'", Dart_GetError(result));
}
@@ -6055,22 +6031,22 @@
Dart_Handle result;
// Create a test library and Load up a test script in it.
- Dart_Handle url = Dart_NewString(TestCase::url());
- Dart_Handle source = Dart_NewString(kScriptChars);
+ Dart_Handle url = NewString(TestCase::url());
+ Dart_Handle source = NewString(kScriptChars);
result = Dart_SetLibraryTagHandler(library_handler);
EXPECT_VALID(result);
result = Dart_LoadScript(url, source);
EXPECT_VALID(result);
- url = Dart_NewString("library2.dart");
- source = Dart_NewString(kLibrary2Chars);
+ url = NewString("library2.dart");
+ source = NewString(kLibrary2Chars);
Dart_LoadLibrary(url, source);
- url = Dart_NewString("library1.dart");
- source = Dart_NewString(kLibrary1Chars);
+ url = NewString("library1.dart");
+ source = NewString(kLibrary1Chars);
Dart_LoadLibrary(url, source);
- result = Dart_Invoke(result, Dart_NewString("main"), 0, NULL);
+ result = Dart_Invoke(result, NewString("main"), 0, NULL);
EXPECT_VALID(result);
}
@@ -6090,17 +6066,17 @@
Dart_Handle result;
// Create a test library and Load up a test script in it.
- Dart_Handle url = Dart_NewString(TestCase::url());
- Dart_Handle source = Dart_NewString(kScriptChars);
+ Dart_Handle url = NewString(TestCase::url());
+ Dart_Handle source = NewString(kScriptChars);
result = Dart_SetLibraryTagHandler(library_handler);
EXPECT_VALID(result);
result = Dart_LoadScript(url, source);
- url = Dart_NewString("lib.dart");
- source = Dart_NewString(kLibraryChars);
+ url = NewString("lib.dart");
+ source = NewString(kLibraryChars);
Dart_LoadLibrary(url, source);
- result = Dart_Invoke(result, Dart_NewString("main"), 0, NULL);
+ result = Dart_Invoke(result, NewString("main"), 0, NULL);
EXPECT_VALID(result);
}
@@ -6170,7 +6146,7 @@
Dart_Handle dart_args[1];
dart_args[0] = send_port1;
Dart_Handle result =
- Dart_Invoke(lib, Dart_NewString("callPort"), 1, dart_args);
+ Dart_Invoke(lib, NewString("callPort"), 1, dart_args);
EXPECT_VALID(result);
result = Dart_RunLoop();
EXPECT(Dart_IsError(result));
@@ -6179,7 +6155,7 @@
// result second port.
dart_args[0] = send_port2;
- result = Dart_Invoke(lib, Dart_NewString("callPort"), 1, dart_args);
+ result = Dart_Invoke(lib, NewString("callPort"), 1, dart_args);
EXPECT_VALID(result);
result = Dart_RunLoop();
EXPECT(Dart_IsError(result));
@@ -6226,8 +6202,8 @@
Dart_Isolate isolate = TestCase::CreateTestIsolate();
ASSERT(isolate != NULL);
Dart_EnterScope();
- Dart_Handle url = Dart_NewString(TestCase::url());
- Dart_Handle source = Dart_NewString(kScriptChars);
+ Dart_Handle url = NewString(TestCase::url());
+ Dart_Handle source = NewString(kScriptChars);
Dart_Handle result = Dart_SetLibraryTagHandler(TestCase::library_handler);
EXPECT_VALID(result);
Dart_Handle lib = Dart_LoadScript(url, source);
@@ -6245,14 +6221,14 @@
RunLoopTestCallback(NULL, NULL, NULL, NULL);
Dart_EnterScope();
- Dart_Handle lib = Dart_LookupLibrary(Dart_NewString(TestCase::url()));
+ Dart_Handle lib = Dart_LookupLibrary(NewString(TestCase::url()));
EXPECT_VALID(lib);
Dart_Handle result;
Dart_Handle args[2];
args[0] = (throw_exception_child ? Dart_True() : Dart_False());
args[1] = (throw_exception_parent ? Dart_True() : Dart_False());
- result = Dart_Invoke(lib, Dart_NewString("main"), 2, args);
+ result = Dart_Invoke(lib, NewString("main"), 2, args);
EXPECT_VALID(result);
result = Dart_RunLoop();
if (throw_exception_parent) {
@@ -6329,8 +6305,8 @@
shared_isolate = Dart_CreateIsolate(NULL, NULL, NULL, NULL, &error);
EXPECT(shared_isolate != NULL);
Dart_EnterScope();
- Dart_Handle url = Dart_NewString(TestCase::url());
- Dart_Handle source = Dart_NewString(kScriptChars);
+ Dart_Handle url = NewString(TestCase::url());
+ Dart_Handle source = NewString(kScriptChars);
Dart_Handle result = Dart_SetLibraryTagHandler(TestCase::library_handler);
EXPECT_VALID(result);
lib = Dart_LoadScript(url, source);
@@ -6342,7 +6318,7 @@
sync->Exit();
}
- Dart_Handle result = Dart_Invoke(lib, Dart_NewString("main"), 0, NULL);
+ Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, NULL);
EXPECT(Dart_IsError(result));
EXPECT(Dart_ErrorHasException(result));
EXPECT_SUBSTRING("Unhandled exception:\nfoo\n",
@@ -6374,9 +6350,9 @@
}
if (interrupt_count == kInterruptCount) {
Dart_EnterScope();
- Dart_Handle lib = Dart_LookupLibrary(Dart_NewString(TestCase::url()));
+ Dart_Handle lib = Dart_LookupLibrary(NewString(TestCase::url()));
EXPECT_VALID(lib);
- Dart_Handle exc = Dart_NewString("foo");
+ Dart_Handle exc = NewString("foo");
EXPECT_VALID(exc);
Dart_Handle result = Dart_ThrowException(exc);
EXPECT_VALID(result);
@@ -6597,8 +6573,8 @@
Dart_Handle result;
// Load a test script.
- Dart_Handle url = Dart_NewString(TestCase::url());
- Dart_Handle source = Dart_NewString(kScriptChars);
+ Dart_Handle url = NewString(TestCase::url());
+ Dart_Handle source = NewString(kScriptChars);
result = Dart_SetLibraryTagHandler(library_handler);
EXPECT_VALID(result);
Dart_Handle lib = Dart_LoadScript(url, source);
@@ -6607,7 +6583,7 @@
result = Dart_SetNativeResolver(lib, &MyNativeClosureResolver);
EXPECT_VALID(result);
- result = Dart_Invoke(lib, Dart_NewString("testMain"), 0, NULL);
+ result = Dart_Invoke(lib, NewString("testMain"), 0, NULL);
EXPECT_VALID(result);
EXPECT(Dart_IsInteger(result));
int64_t value = 0;
@@ -6735,8 +6711,8 @@
Dart_Handle result;
// Load a test script.
- Dart_Handle url = Dart_NewString(TestCase::url());
- Dart_Handle source = Dart_NewString(kScriptChars);
+ Dart_Handle url = NewString(TestCase::url());
+ Dart_Handle source = NewString(kScriptChars);
result = Dart_SetLibraryTagHandler(library_handler);
EXPECT_VALID(result);
Dart_Handle lib = Dart_LoadScript(url, source);
@@ -6745,7 +6721,7 @@
result = Dart_SetNativeResolver(lib, &MyStaticNativeClosureResolver);
EXPECT_VALID(result);
- result = Dart_Invoke(lib, Dart_NewString("testMain"), 0, NULL);
+ result = Dart_Invoke(lib, NewString("testMain"), 0, NULL);
EXPECT_VALID(result);
EXPECT(Dart_IsInteger(result));
int64_t value = 0;
@@ -6763,37 +6739,37 @@
"expects argument 'length' to be in the range");
EXPECT_ERROR(Dart_NewList(Array::kMaxElements+1),
"expects argument 'length' to be in the range");
- EXPECT_ERROR(Dart_NewString8(chars8, -1),
+ EXPECT_ERROR(Dart_NewStringFromUTF8(chars8, -1),
"expects argument 'length' to be in the range");
- EXPECT_ERROR(Dart_NewString8(chars8, OneByteString::kMaxElements+1),
+ EXPECT_ERROR(Dart_NewStringFromUTF8(chars8, OneByteString::kMaxElements+1),
"expects argument 'length' to be in the range");
- EXPECT_ERROR(Dart_NewString16(chars16, -1),
+ EXPECT_ERROR(Dart_NewStringFromUTF16(chars16, -1),
"expects argument 'length' to be in the range");
- EXPECT_ERROR(Dart_NewString16(chars16, TwoByteString::kMaxElements+1),
+ EXPECT_ERROR(Dart_NewStringFromUTF16(chars16, TwoByteString::kMaxElements+1),
"expects argument 'length' to be in the range");
- EXPECT_ERROR(Dart_NewString32(chars32, -1),
+ EXPECT_ERROR(Dart_NewStringFromUTF32(chars32, -1),
"expects argument 'length' to be in the range");
- EXPECT_ERROR(Dart_NewString32(chars32, FourByteString::kMaxElements+1),
+ EXPECT_ERROR(Dart_NewStringFromUTF32(chars32, TwoByteString::kMaxElements+1),
"expects argument 'length' to be in the range");
}
TEST_CASE(NewString_Null) {
- Dart_Handle str = Dart_NewString8(NULL, 0);
+ Dart_Handle str = Dart_NewStringFromUTF8(NULL, 0);
EXPECT_VALID(str);
EXPECT(Dart_IsString(str));
intptr_t len = -1;
EXPECT_VALID(Dart_StringLength(str, &len));
EXPECT_EQ(0, len);
- str = Dart_NewString16(NULL, 0);
+ str = Dart_NewStringFromUTF16(NULL, 0);
EXPECT_VALID(str);
EXPECT(Dart_IsString(str));
len = -1;
EXPECT_VALID(Dart_StringLength(str, &len));
EXPECT_EQ(0, len);
- str = Dart_NewString32(NULL, 0);
+ str = Dart_NewStringFromUTF32(NULL, 0);
EXPECT_VALID(str);
EXPECT(Dart_IsString(str));
len = -1;
@@ -6839,7 +6815,7 @@
// by one.
TEST_CASE(OneNewSpacePeer) {
Isolate* isolate = Isolate::Current();
- Dart_Handle str = Dart_NewString("a string");
+ Dart_Handle str = NewString("a string");
EXPECT_VALID(str);
EXPECT(Dart_IsString(str));
EXPECT_EQ(0, isolate->heap()->PeerCount());
@@ -6868,7 +6844,7 @@
Dart_EnterScope();
{
DARTSCOPE_NOCHECKS(isolate);
- Dart_Handle str = Dart_NewString("a string");
+ Dart_Handle str = NewString("a string");
EXPECT_VALID(str);
EXPECT(Dart_IsString(str));
EXPECT_EQ(0, isolate->heap()->PeerCount());
@@ -6898,7 +6874,7 @@
// by two.
TEST_CASE(TwoNewSpacePeers) {
Isolate* isolate = Isolate::Current();
- Dart_Handle s1 = Dart_NewString("s1");
+ Dart_Handle s1 = NewString("s1");
EXPECT_VALID(s1);
EXPECT(Dart_IsString(s1));
void* o1 = &o1;
@@ -6910,7 +6886,7 @@
EXPECT_EQ(1, isolate->heap()->PeerCount());
EXPECT_VALID(Dart_GetPeer(s1, &o1));
EXPECT(o1 == reinterpret_cast<void*>(&p1));
- Dart_Handle s2 = Dart_NewString("a string");
+ Dart_Handle s2 = NewString("a string");
EXPECT_VALID(s2);
EXPECT(Dart_IsString(s2));
EXPECT_EQ(1, isolate->heap()->PeerCount());
@@ -6941,7 +6917,7 @@
Dart_EnterScope();
{
DARTSCOPE_NOCHECKS(isolate);
- Dart_Handle s1 = Dart_NewString("s1");
+ Dart_Handle s1 = NewString("s1");
EXPECT_VALID(s1);
EXPECT(Dart_IsString(s1));
EXPECT_EQ(0, isolate->heap()->PeerCount());
@@ -6953,7 +6929,7 @@
EXPECT_EQ(1, isolate->heap()->PeerCount());
EXPECT_VALID(Dart_GetPeer(s1, &o1));
EXPECT(o1 == reinterpret_cast<void*>(&p1));
- Dart_Handle s2 = Dart_NewString("s2");
+ Dart_Handle s2 = NewString("s2");
EXPECT_VALID(s2);
EXPECT(Dart_IsString(s2));
EXPECT_EQ(1, isolate->heap()->PeerCount());
@@ -6979,7 +6955,7 @@
Isolate* isolate = Isolate::Current();
Dart_Handle s[kPeerCount];
for (int i = 0; i < kPeerCount; ++i) {
- s[i] = Dart_NewString("a string");
+ s[i] = NewString("a string");
EXPECT_VALID(s[i]);
EXPECT(Dart_IsString(s[i]));
void* o = &o;
@@ -7008,7 +6984,7 @@
// of peer objects is decremented by one.
TEST_CASE(OnePromotedPeer) {
Isolate* isolate = Isolate::Current();
- Dart_Handle str = Dart_NewString("a string");
+ Dart_Handle str = NewString("a string");
EXPECT_VALID(str);
EXPECT(Dart_IsString(str));
EXPECT_EQ(0, isolate->heap()->PeerCount());
diff --git a/runtime/vm/dart_api_message.cc b/runtime/vm/dart_api_message.cc
index 9c12280..7541536 100644
--- a/runtime/vm/dart_api_message.cc
+++ b/runtime/vm/dart_api_message.cc
@@ -358,9 +358,6 @@
case kTwoByteStringCid:
// Two byte strings not supported.
return AllocateDartCObjectUnsupported();
- case kFourByteStringCid:
- // Four byte strings not supported.
- return AllocateDartCObjectUnsupported();
case kUint8ArrayCid: {
intptr_t len = ReadSmiValue();
Dart_CObject* object = AllocateDartCObjectUint8Array(len);
diff --git a/runtime/vm/debugger_api_impl_test.cc b/runtime/vm/debugger_api_impl_test.cc
index 3a3a366..4bf3e9c 100644
--- a/runtime/vm/debugger_api_impl_test.cc
+++ b/runtime/vm/debugger_api_impl_test.cc
@@ -31,8 +31,8 @@
ASSERT(Dart_IsLibrary(script_lib));
Dart_Breakpoint bpt;
Dart_Handle res = Dart_SetBreakpointAtEntry(script_lib,
- Dart_NewString(cname),
- Dart_NewString(fname),
+ NewString(cname),
+ NewString(fname),
&bpt);
EXPECT_VALID(res);
}
@@ -42,7 +42,7 @@
ASSERT(script_lib != NULL);
ASSERT(!Dart_IsError(script_lib));
ASSERT(Dart_IsLibrary(script_lib));
- return Dart_Invoke(script_lib, Dart_NewString(func_name), 0, NULL);
+ return Dart_Invoke(script_lib, NewString(func_name), 0, NULL);
}
@@ -632,9 +632,9 @@
Dart_StackTrace trace) {
static const char* expected_trace[] = {"add", "main"};
Dart_Handle add_locals = Dart_NewList(4);
- Dart_ListSetAt(add_locals, 0, Dart_NewString("a"));
+ Dart_ListSetAt(add_locals, 0, NewString("a"));
Dart_ListSetAt(add_locals, 1, Dart_NewInteger(10));
- Dart_ListSetAt(add_locals, 2, Dart_NewString("b"));
+ Dart_ListSetAt(add_locals, 2, NewString("b"));
Dart_ListSetAt(add_locals, 3, Dart_NewInteger(20));
Dart_Handle expected_locals[] = {add_locals, Dart_Null()};
breakpoint_hit_counter++;
@@ -657,7 +657,7 @@
LoadScript(kScriptChars);
Dart_SetBreakpointHandler(&ExprClosureBreakpointHandler);
- Dart_Handle script_url = Dart_NewString(TestCase::url());
+ Dart_Handle script_url = NewString(TestCase::url());
intptr_t line_no = 5; // In closure 'add'.
Dart_Handle res = Dart_SetBreakpoint(script_url, line_no);
EXPECT_VALID(res);
@@ -723,7 +723,7 @@
LoadScript(kScriptChars);
- Dart_Handle script_url = Dart_NewString(TestCase::url());
+ Dart_Handle script_url = NewString(TestCase::url());
intptr_t line_no = 4; // In function 'foo'.
Dart_SetBreakpointHandler(&DeleteBreakpointHandler);
@@ -751,7 +751,7 @@
ASSERT(script_lib != NULL);
ASSERT(!Dart_IsError(script_lib));
ASSERT(Dart_IsLibrary(script_lib));
- Dart_Handle class_A = Dart_GetClass(script_lib, Dart_NewString("A"));
+ Dart_Handle class_A = Dart_GetClass(script_lib, NewString("A"));
EXPECT_VALID(class_A);
const int expected_num_fields = 2;
@@ -1015,7 +1015,7 @@
}
}
- Dart_Handle lib_url = Dart_NewString(TestCase::url());
+ Dart_Handle lib_url = NewString(TestCase::url());
Dart_Handle source = Dart_GetScriptSource(lib_url, lib_url);
EXPECT(Dart_IsString(source));
char const* source_chars;
@@ -1040,8 +1040,8 @@
EXPECT_NOTSUBSTRING(TestCase::url(), list_cstr);
// Load a script.
- Dart_Handle url = Dart_NewString(TestCase::url());
- Dart_Handle source = Dart_NewString(kScriptChars);
+ Dart_Handle url = NewString(TestCase::url());
+ Dart_Handle source = NewString(kScriptChars);
EXPECT_VALID(Dart_LoadScript(url, source));
lib_list = Dart_GetLibraryURLs();
diff --git a/runtime/vm/deopt_instructions.cc b/runtime/vm/deopt_instructions.cc
index bb15671..9442a46 100644
--- a/runtime/vm/deopt_instructions.cc
+++ b/runtime/vm/deopt_instructions.cc
@@ -11,6 +11,9 @@
namespace dart {
+DEFINE_FLAG(bool, compress_deopt_info, true,
+ "Compress the size of the deoptimization info for optimized code.");
+
DeoptimizationContext::DeoptimizationContext(intptr_t* to_frame_start,
intptr_t to_frame_size,
const Array& object_table,
@@ -61,7 +64,7 @@
}
virtual intptr_t from_index() const { return stack_slot_index_; }
- virtual DeoptInstr::Kind kind() const { return kCopyStackSlot; }
+ virtual DeoptInstr::Kind kind() const { return kStackSlot; }
virtual const char* ToCString() const {
const char* format = "s%"Pd"";
@@ -94,7 +97,7 @@
}
virtual intptr_t from_index() const { return stack_slot_index_; }
- virtual DeoptInstr::Kind kind() const { return kCopyDoubleStackSlot; }
+ virtual DeoptInstr::Kind kind() const { return kDoubleStackSlot; }
virtual const char* ToCString() const {
const char* format = "ds%"Pd"";
@@ -130,7 +133,7 @@
}
virtual intptr_t from_index() const { return stack_slot_index_; }
- virtual DeoptInstr::Kind kind() const { return kCopyInt64StackSlot; }
+ virtual DeoptInstr::Kind kind() const { return kInt64StackSlot; }
virtual const char* ToCString() const {
const char* format = "ms%"Pd"";
@@ -166,15 +169,15 @@
// Deoptimization instruction creating return address using function and
// deopt-id stored at 'object_table_index'. Uses the deopt-after
// continuation point.
-class DeoptRetAddrAfterInstr : public DeoptInstr {
+class DeoptRetAfterAddressInstr : public DeoptInstr {
public:
- DeoptRetAddrAfterInstr(intptr_t object_table_index, intptr_t deopt_id)
+ DeoptRetAfterAddressInstr(intptr_t object_table_index, intptr_t deopt_id)
: object_table_index_(object_table_index), deopt_id_(deopt_id) {
ASSERT(object_table_index >= 0);
ASSERT(deopt_id >= 0);
}
- explicit DeoptRetAddrAfterInstr(intptr_t from_index)
+ explicit DeoptRetAfterAddressInstr(intptr_t from_index)
: object_table_index_(ObjectTableIndex::decode(from_index)),
deopt_id_(DeoptId::decode(from_index)) {
}
@@ -183,7 +186,7 @@
return ObjectTableIndex::encode(object_table_index_) |
DeoptId::encode(deopt_id_);
}
- virtual DeoptInstr::Kind kind() const { return kSetRetAfterAddress; }
+ virtual DeoptInstr::Kind kind() const { return kRetAfterAddress; }
virtual const char* ToCString() const {
const char* format = "ret aft oti:%"Pd"(%"Pd")";
@@ -211,22 +214,22 @@
const intptr_t object_table_index_;
const intptr_t deopt_id_;
- DISALLOW_COPY_AND_ASSIGN(DeoptRetAddrAfterInstr);
+ DISALLOW_COPY_AND_ASSIGN(DeoptRetAfterAddressInstr);
};
// Deoptimization instruction creating return address using function and
// deopt-id stored at 'object_table_index'. Uses the deopt-before
// continuation point.
-class DeoptRetAddrBeforeInstr : public DeoptInstr {
+class DeoptRetBeforeAddressInstr : public DeoptInstr {
public:
- DeoptRetAddrBeforeInstr(intptr_t object_table_index, intptr_t deopt_id)
+ DeoptRetBeforeAddressInstr(intptr_t object_table_index, intptr_t deopt_id)
: object_table_index_(object_table_index), deopt_id_(deopt_id) {
ASSERT(object_table_index >= 0);
- ASSERT(deopt_id_ >= 0);
+ ASSERT(deopt_id >= 0);
}
- explicit DeoptRetAddrBeforeInstr(intptr_t from_index)
+ explicit DeoptRetBeforeAddressInstr(intptr_t from_index)
: object_table_index_(ObjectTableIndex::decode(from_index)),
deopt_id_(DeoptId::decode(from_index)) {
}
@@ -235,7 +238,7 @@
return ObjectTableIndex::encode(object_table_index_) |
DeoptId::encode(deopt_id_);
}
- virtual DeoptInstr::Kind kind() const { return kSetRetBeforeAddress; }
+ virtual DeoptInstr::Kind kind() const { return kRetBeforeAddress; }
virtual const char* ToCString() const {
const char* format = "ret bef oti:%"Pd"(%"Pd")";
@@ -263,7 +266,7 @@
const intptr_t object_table_index_;
const intptr_t deopt_id_;
- DISALLOW_COPY_AND_ASSIGN(DeoptRetAddrBeforeInstr);
+ DISALLOW_COPY_AND_ASSIGN(DeoptRetBeforeAddressInstr);
};
@@ -276,7 +279,7 @@
}
virtual intptr_t from_index() const { return object_table_index_; }
- virtual DeoptInstr::Kind kind() const { return kCopyConstant; }
+ virtual DeoptInstr::Kind kind() const { return kConstant; }
virtual const char* ToCString() const {
const char* format = "const oti:%"Pd"";
@@ -308,7 +311,7 @@
: reg_(static_cast<Register>(reg_as_int)) {}
virtual intptr_t from_index() const { return static_cast<intptr_t>(reg_); }
- virtual DeoptInstr::Kind kind() const { return kCopyRegister; }
+ virtual DeoptInstr::Kind kind() const { return kRegister; }
virtual const char* ToCString() const {
return Assembler::RegisterName(reg_);
@@ -334,7 +337,7 @@
: reg_(static_cast<XmmRegister>(reg_as_int)) {}
virtual intptr_t from_index() const { return static_cast<intptr_t>(reg_); }
- virtual DeoptInstr::Kind kind() const { return kCopyXmmRegister; }
+ virtual DeoptInstr::Kind kind() const { return kXmmRegister; }
virtual const char* ToCString() const {
return Assembler::XmmRegisterName(reg_);
@@ -361,7 +364,7 @@
: reg_(static_cast<XmmRegister>(reg_as_int)) {}
virtual intptr_t from_index() const { return static_cast<intptr_t>(reg_); }
- virtual DeoptInstr::Kind kind() const { return kCopyInt64XmmRegister; }
+ virtual DeoptInstr::Kind kind() const { return kInt64XmmRegister; }
virtual const char* ToCString() const {
const char* format = "%s(m)";
@@ -402,7 +405,7 @@
}
virtual intptr_t from_index() const { return object_table_index_; }
- virtual DeoptInstr::Kind kind() const { return kSetPcMarker; }
+ virtual DeoptInstr::Kind kind() const { return kPcMarker; }
virtual const char* ToCString() const {
const char* format = "pcmark oti:%"Pd"";
@@ -444,7 +447,7 @@
DeoptCallerFpInstr() {}
virtual intptr_t from_index() const { return 0; }
- virtual DeoptInstr::Kind kind() const { return kSetCallerFp; }
+ virtual DeoptInstr::Kind kind() const { return kCallerFp; }
virtual const char* ToCString() const {
return "callerfp";
@@ -469,7 +472,7 @@
DeoptCallerPcInstr() {}
virtual intptr_t from_index() const { return 0; }
- virtual DeoptInstr::Kind kind() const { return kSetCallerPc; }
+ virtual DeoptInstr::Kind kind() const { return kCallerPc; }
virtual const char* ToCString() const {
return "callerpc";
@@ -486,28 +489,128 @@
};
+// Deoptimization instruction that indicates the rest of this DeoptInfo is a
+// suffix of another one. The suffix contains the info number (0 based
+// index in the deopt table of the DeoptInfo to share) and the length of the
+// suffix.
+class DeoptSuffixInstr : public DeoptInstr {
+ public:
+ DeoptSuffixInstr(intptr_t info_number, intptr_t suffix_length)
+ : info_number_(info_number), suffix_length_(suffix_length) {
+ ASSERT(info_number >= 0);
+ ASSERT(suffix_length >= 0);
+ }
+
+ explicit DeoptSuffixInstr(intptr_t from_index)
+ : info_number_(InfoNumber::decode(from_index)),
+ suffix_length_(SuffixLength::decode(from_index)) {
+ }
+
+ virtual intptr_t from_index() const {
+ return InfoNumber::encode(info_number_) |
+ SuffixLength::encode(suffix_length_);
+ }
+ virtual DeoptInstr::Kind kind() const { return kSuffix; }
+
+ virtual const char* ToCString() const {
+ const char* format = "suffix %"Pd":%"Pd;
+ intptr_t len = OS::SNPrint(NULL, 0, format, info_number_, suffix_length_);
+ char* chars = Isolate::Current()->current_zone()->Alloc<char>(len + 1);
+ OS::SNPrint(chars, len + 1, format, info_number_, suffix_length_);
+ return chars;
+ }
+
+ void Execute(DeoptimizationContext* deopt_context, intptr_t to_index) {
+ // The deoptimization info is uncompresses by translating away suffixes
+ // before executing the instructions.
+ UNREACHABLE();
+ }
+
+ private:
+ // Static decoder functions in DeoptInstr have access to the bitfield
+ // definitions.
+ friend class DeoptInstr;
+
+ static const intptr_t kFieldWidth = kBitsPerWord / 2;
+ class InfoNumber : public BitField<intptr_t, 0, kFieldWidth> { };
+ class SuffixLength : public BitField<intptr_t, kFieldWidth, kFieldWidth> { };
+
+ const intptr_t info_number_;
+ const intptr_t suffix_length_;
+
+ DISALLOW_COPY_AND_ASSIGN(DeoptSuffixInstr);
+};
+
+
+intptr_t DeoptInstr::DecodeSuffix(intptr_t from_index, intptr_t* info_number) {
+ *info_number = DeoptSuffixInstr::InfoNumber::decode(from_index);
+ return DeoptSuffixInstr::SuffixLength::decode(from_index);
+}
+
+
DeoptInstr* DeoptInstr::Create(intptr_t kind_as_int, intptr_t from_index) {
Kind kind = static_cast<Kind>(kind_as_int);
switch (kind) {
- case kCopyStackSlot: return new DeoptStackSlotInstr(from_index);
- case kCopyDoubleStackSlot: return new DeoptDoubleStackSlotInstr(from_index);
- case kCopyInt64StackSlot: return new DeoptInt64StackSlotInstr(from_index);
- case kSetRetAfterAddress: return new DeoptRetAddrAfterInstr(from_index);
- case kSetRetBeforeAddress: return new DeoptRetAddrBeforeInstr(from_index);
- case kCopyConstant: return new DeoptConstantInstr(from_index);
- case kCopyRegister: return new DeoptRegisterInstr(from_index);
- case kCopyXmmRegister: return new DeoptXmmRegisterInstr(from_index);
- case kCopyInt64XmmRegister:
- return new DeoptInt64XmmRegisterInstr(from_index);
- case kSetPcMarker: return new DeoptPcMarkerInstr(from_index);
- case kSetCallerFp: return new DeoptCallerFpInstr();
- case kSetCallerPc: return new DeoptCallerPcInstr();
+ case kStackSlot: return new DeoptStackSlotInstr(from_index);
+ case kDoubleStackSlot: return new DeoptDoubleStackSlotInstr(from_index);
+ case kInt64StackSlot: return new DeoptInt64StackSlotInstr(from_index);
+ case kRetAfterAddress: return new DeoptRetAfterAddressInstr(from_index);
+ case kRetBeforeAddress: return new DeoptRetBeforeAddressInstr(from_index);
+ case kConstant: return new DeoptConstantInstr(from_index);
+ case kRegister: return new DeoptRegisterInstr(from_index);
+ case kXmmRegister: return new DeoptXmmRegisterInstr(from_index);
+ case kInt64XmmRegister: return new DeoptInt64XmmRegisterInstr(from_index);
+ case kPcMarker: return new DeoptPcMarkerInstr(from_index);
+ case kCallerFp: return new DeoptCallerFpInstr();
+ case kCallerPc: return new DeoptCallerPcInstr();
+ case kSuffix: return new DeoptSuffixInstr(from_index);
}
UNREACHABLE();
return NULL;
}
+class DeoptInfoBuilder::TrieNode : public ZoneAllocated {
+ public:
+ // Construct the root node representing the implicit "shared" terminator
+ // at the end of each deopt info.
+ TrieNode() : instruction_(NULL), info_number_(-1), children_(16) { }
+
+ // Construct a node representing a written instruction.
+ TrieNode(DeoptInstr* instruction, intptr_t info_number)
+ : instruction_(instruction), info_number_(info_number), children_(4) { }
+
+ intptr_t info_number() const { return info_number_; }
+
+ void AddChild(TrieNode* child) {
+ if (child != NULL) children_.Add(child);
+ }
+
+ TrieNode* FindChild(const DeoptInstr& instruction) {
+ for (intptr_t i = 0; i < children_.length(); ++i) {
+ TrieNode* child = children_[i];
+ if (child->instruction_->Equals(instruction)) return child;
+ }
+ return NULL;
+ }
+
+ private:
+ const DeoptInstr* instruction_; // Instruction that was written.
+ const intptr_t info_number_; // Index of the deopt info it was written to.
+
+ GrowableArray<TrieNode*> children_;
+};
+
+
+DeoptInfoBuilder::DeoptInfoBuilder(const intptr_t num_args)
+ : instructions_(),
+ object_table_(GrowableObjectArray::Handle(GrowableObjectArray::New())),
+ num_args_(num_args),
+ trie_root_(new TrieNode()),
+ current_info_number_(0) {
+}
+
+
intptr_t DeoptInfoBuilder::FindOrAddObjectInTable(const Object& obj) const {
for (intptr_t i = 0; i < object_table_.Length(); i++) {
if (object_table_.At(i) == obj.raw()) {
@@ -526,7 +629,8 @@
intptr_t to_index) {
const intptr_t object_table_index = FindOrAddObjectInTable(function);
ASSERT(to_index == instructions_.length());
- instructions_.Add(new DeoptRetAddrBeforeInstr(object_table_index, deopt_id));
+ instructions_.Add(new DeoptRetBeforeAddressInstr(object_table_index,
+ deopt_id));
}
@@ -535,7 +639,8 @@
intptr_t to_index) {
const intptr_t object_table_index = FindOrAddObjectInTable(function);
ASSERT(to_index == instructions_.length());
- instructions_.Add(new DeoptRetAddrAfterInstr(object_table_index, deopt_id));
+ instructions_.Add(new DeoptRetAfterAddressInstr(object_table_index,
+ deopt_id));
}
@@ -601,13 +706,47 @@
}
-RawDeoptInfo* DeoptInfoBuilder::CreateDeoptInfo() const {
- const intptr_t len = instructions_.length();
- const DeoptInfo& deopt_info = DeoptInfo::Handle(DeoptInfo::New(len));
- for (intptr_t i = 0; i < len; i++) {
+RawDeoptInfo* DeoptInfoBuilder::CreateDeoptInfo() {
+ intptr_t length = instructions_.length();
+
+ // Count the number of instructions that are a shared suffix of some deopt
+ // info already written.
+ TrieNode* suffix = trie_root_;
+ intptr_t suffix_length = 0;
+ if (FLAG_compress_deopt_info) {
+ for (intptr_t i = length - 1; i >= 0; --i) {
+ TrieNode* node = suffix->FindChild(*instructions_[i]);
+ if (node == NULL) break;
+ suffix = node;
+ ++suffix_length;
+ }
+ }
+
+ // Allocate space for the translation. If the shared suffix is longer
+ // than one instruction, we replace it with a single suffix instruction.
+ if (suffix_length > 1) length -= (suffix_length - 1);
+ const DeoptInfo& deopt_info = DeoptInfo::Handle(DeoptInfo::New(length));
+
+ // Write the unshared instructions and build their sub-tree.
+ TrieNode* node = NULL;
+ intptr_t write_count = (suffix_length > 1) ? length - 1 : length;
+ for (intptr_t i = 0; i < write_count; ++i) {
DeoptInstr* instr = instructions_[i];
deopt_info.SetAt(i, instr->kind(), instr->from_index());
+ TrieNode* child = node;
+ node = new TrieNode(instr, current_info_number_);
+ node->AddChild(child);
}
+ suffix->AddChild(node);
+
+ if (suffix_length > 1) {
+ DeoptInstr* instr =
+ new DeoptSuffixInstr(suffix->info_number(), suffix_length);
+ deopt_info.SetAt(length - 1, instr->kind(), instr->from_index());
+ }
+
+ instructions_.Clear();
+ ++current_info_number_;
return deopt_info.raw();
}
diff --git a/runtime/vm/deopt_instructions.h b/runtime/vm/deopt_instructions.h
index 603fab2..79c9f23 100644
--- a/runtime/vm/deopt_instructions.h
+++ b/runtime/vm/deopt_instructions.h
@@ -84,6 +84,22 @@
// the deopt-info array.
class DeoptInstr : public ZoneAllocated {
public:
+ enum Kind {
+ kRetAfterAddress,
+ kRetBeforeAddress,
+ kConstant,
+ kRegister,
+ kXmmRegister,
+ kInt64XmmRegister,
+ kStackSlot,
+ kDoubleStackSlot,
+ kInt64StackSlot,
+ kPcMarker,
+ kCallerFp,
+ kCallerPc,
+ kSuffix,
+ };
+
static DeoptInstr* Create(intptr_t kind_as_int, intptr_t from_index);
DeoptInstr() {}
@@ -94,22 +110,15 @@
virtual void Execute(DeoptimizationContext* deopt_context,
intptr_t to_index) = 0;
- protected:
- enum Kind {
- kSetRetAfterAddress,
- kSetRetBeforeAddress,
- kCopyConstant,
- kCopyRegister,
- kCopyXmmRegister,
- kCopyInt64XmmRegister,
- kCopyStackSlot,
- kCopyDoubleStackSlot,
- kCopyInt64StackSlot,
- kSetPcMarker,
- kSetCallerFp,
- kSetCallerPc,
- };
+ bool Equals(const DeoptInstr& other) const {
+ return (kind() == other.kind()) && (from_index() == other.from_index());
+ }
+ // Decode the payload of a suffix command. Return the suffix length and
+ // set the output parameter info_number to the index of the shared suffix.
+ static intptr_t DecodeSuffix(intptr_t from_index, intptr_t* info_number);
+
+ protected:
virtual DeoptInstr::Kind kind() const = 0;
virtual intptr_t from_index() const = 0;
@@ -120,18 +129,18 @@
};
-// Builds one instance of DeoptInfo. Call AddXXX methods in the order of
-// their target, starting wih deoptimized code continuation pc and ending with
-// the first argument of the deoptimized code.
+// Builds a deoptimization info table, one DeoptInfo at a time. Call AddXXX
+// methods in the order of their target, starting wih deoptimized code
+// continuation pc and ending with the first argument of the deoptimized
+// code. Call CreateDeoptInfo to write the accumulated instructions into
+// the heap and reset the builder's internal state for the next DeoptInfo.
class DeoptInfoBuilder : public ValueObject {
public:
+ explicit DeoptInfoBuilder(const intptr_t num_args);
+
// 'object_table' holds all objects referred to by DeoptInstr in
// all DeoptInfo instances for a single Code object.
- DeoptInfoBuilder(const GrowableObjectArray& object_table,
- const intptr_t num_args)
- : instructions_(),
- object_table_(object_table),
- num_args_(num_args) {}
+ const GrowableObjectArray& object_table() { return object_table_; }
// Return address before instruction.
void AddReturnAddressBefore(const Function& function,
@@ -151,15 +160,21 @@
void AddCallerFp(intptr_t to_index);
void AddCallerPc(intptr_t to_index);
- RawDeoptInfo* CreateDeoptInfo() const;
+ RawDeoptInfo* CreateDeoptInfo();
private:
+ class TrieNode;
+
intptr_t FindOrAddObjectInTable(const Object& obj) const;
GrowableArray<DeoptInstr*> instructions_;
const GrowableObjectArray& object_table_;
const intptr_t num_args_;
+ // Used to compress entries by sharing suffixes.
+ TrieNode* trie_root_;
+ intptr_t current_info_number_;
+
DISALLOW_COPY_AND_ASSIGN(DeoptInfoBuilder);
};
diff --git a/runtime/vm/exceptions.cc b/runtime/vm/exceptions.cc
index 9ec5686..2a77c53 100644
--- a/runtime/vm/exceptions.cc
+++ b/runtime/vm/exceptions.cc
@@ -396,9 +396,9 @@
Library& library = Library::Handle();
String& class_name = String::Handle();
switch (type) {
- case kIndexOutOfRange:
+ case kRange:
library = Library::CoreLibrary();
- class_name = Symbols::New("IndexOutOfRangeException");
+ class_name = Symbols::New("RangeError");
break;
case kArgument:
library = Library::CoreLibrary();
@@ -408,14 +408,6 @@
library = Library::CoreLibrary();
class_name = Symbols::New("NoSuchMethodError");
break;
- case kClosureArgumentMismatch:
- library = Library::CoreLibrary();
- class_name = Symbols::New("_ClosureArgumentMismatchException");
- break;
- case kObjectNotClosure:
- library = Library::CoreLibrary();
- class_name = Symbols::New("_ObjectNotClosureException");
- break;
case kFormat:
library = Library::CoreLibrary();
class_name = Symbols::New("FormatException");
diff --git a/runtime/vm/exceptions.h b/runtime/vm/exceptions.h
index edb3c2c..50500f9 100644
--- a/runtime/vm/exceptions.h
+++ b/runtime/vm/exceptions.h
@@ -48,11 +48,9 @@
const String& malformed_error);
enum ExceptionType {
- kIndexOutOfRange,
+ kRange,
kArgument,
kNoSuchMethod,
- kClosureArgumentMismatch,
- kObjectNotClosure,
kFormat,
kStackOverflow,
kOutOfMemory,
diff --git a/runtime/vm/exceptions_test.cc b/runtime/vm/exceptions_test.cc
index 9111615..ef319de 100644
--- a/runtime/vm/exceptions_test.cc
+++ b/runtime/vm/exceptions_test.cc
@@ -30,9 +30,9 @@
void FUNCTION_NAME(Unhandled_invoke)(Dart_NativeArguments args) {
// Invoke the specified entry point.
- Dart_Handle cls = Dart_GetClass(TestCase::lib(), Dart_NewString("Second"));
+ Dart_Handle cls = Dart_GetClass(TestCase::lib(), NewString("Second"));
Dart_Handle result = Dart_Invoke(cls,
- Dart_NewString("method2"),
+ NewString("method2"),
0,
NULL);
ASSERT(Dart_IsError(result));
@@ -43,9 +43,9 @@
void FUNCTION_NAME(Unhandled_invoke2)(Dart_NativeArguments args) {
// Invoke the specified entry point.
- Dart_Handle cls = Dart_GetClass(TestCase::lib(), Dart_NewString("Second"));
+ Dart_Handle cls = Dart_GetClass(TestCase::lib(), NewString("Second"));
Dart_Handle result = Dart_Invoke(cls,
- Dart_NewString("method2"),
+ NewString("method2"),
0,
NULL);
ASSERT(Dart_IsError(result));
@@ -127,7 +127,7 @@
Dart_Handle lib = TestCase::LoadTestScript(
kScriptChars,
reinterpret_cast<Dart_NativeEntryResolver>(native_lookup));
- EXPECT_VALID(Dart_Invoke(lib, Dart_NewString("testMain"), 0, NULL));
+ EXPECT_VALID(Dart_Invoke(lib, NewString("testMain"), 0, NULL));
}
#endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64).
diff --git a/runtime/vm/flow_graph.cc b/runtime/vm/flow_graph.cc
index 95961cb..26e2eb1 100644
--- a/runtime/vm/flow_graph.cc
+++ b/runtime/vm/flow_graph.cc
@@ -475,8 +475,7 @@
}
while (!worklist.is_empty()) {
- BlockEntryInstr* current = worklist.Last();
- worklist.RemoveLast();
+ BlockEntryInstr* current = worklist.RemoveLast();
// Ensure a phi for each block in the dominance frontier of current.
for (BitVector::Iterator it(dom_frontier[current->preorder_number()]);
!it.Done();
@@ -584,8 +583,7 @@
// Update expression stack.
ASSERT(env->length() > variable_count());
- Definition* reaching_defn = env->Last();
- env->RemoveLast();
+ Definition* reaching_defn = env->RemoveLast();
Definition* input_defn = v->definition();
if (input_defn->IsLoadLocal() || input_defn->IsStoreLocal()) {
@@ -682,8 +680,7 @@
void FlowGraph::MarkLivePhis(GrowableArray<PhiInstr*>* live_phis) {
while (!live_phis->is_empty()) {
- PhiInstr* phi = live_phis->Last();
- live_phis->RemoveLast();
+ PhiInstr* phi = live_phis->RemoveLast();
for (intptr_t i = 0; i < phi->InputCount(); i++) {
Value* val = phi->InputAt(i);
PhiInstr* used_phi = val->definition()->AsPhi();
@@ -712,8 +709,7 @@
}
while (!stack.is_empty()) {
- BlockEntryInstr* p = stack.Last();
- stack.RemoveLast();
+ BlockEntryInstr* p = stack.RemoveLast();
for (intptr_t i = 0; i < p->PredecessorCount(); ++i) {
BlockEntryInstr* q = p->PredecessorAt(i);
if (!loop->Contains(q->preorder_number())) {
diff --git a/runtime/vm/flow_graph_allocator.cc b/runtime/vm/flow_graph_allocator.cc
index ccc22c2..0097c72 100644
--- a/runtime/vm/flow_graph_allocator.cc
+++ b/runtime/vm/flow_graph_allocator.cc
@@ -1982,8 +1982,7 @@
#endif
while (!unallocated_.is_empty()) {
- LiveRange* range = unallocated_.Last();
- unallocated_.RemoveLast();
+ LiveRange* range = unallocated_.RemoveLast();
const intptr_t start = range->Start();
TRACE_ALLOC(OS::Print("Processing live range for vreg %"Pd" "
"starting at %"Pd"\n",
diff --git a/runtime/vm/flow_graph_builder.cc b/runtime/vm/flow_graph_builder.cc
index 856ee44..5684503 100644
--- a/runtime/vm/flow_graph_builder.cc
+++ b/runtime/vm/flow_graph_builder.cc
@@ -1668,22 +1668,52 @@
}
-static intptr_t GetResultCidOfConstructor(ConstructorCallNode* node) {
- if (node->constructor().IsFactory()) {
- const Function& function = node->constructor();
- const Library& core_impl_lib = Library::Handle(Library::CoreImplLibrary());
- const Class& function_class = Class::Handle(function.Owner());
+static bool IsRecognizedConstructor(const Function& function,
+ const String& expected) {
+ const Class& clazz = Class::Handle(function.Owner());
+ const Library& lib = Library::Handle(clazz.library());
- if (function_class.library() == core_impl_lib.raw()) {
- if (function_class.Name() == Symbols::ListImplementation()) {
- if (function.name() == Symbols::ListFactory()) {
- if (node->arguments()->length() == 0) {
- return kGrowableObjectArrayCid;
- } else {
- ASSERT(node->arguments()->length() == 1);
- return kArrayCid;
- }
- }
+ const String& expected_class_name =
+ String::Handle(lib.PrivateName(expected));
+ if (!String::Handle(clazz.Name()).Equals(expected_class_name)) {
+ return false;
+ }
+
+ const String& function_name = String::Handle(function.name());
+ const String& expected_function_name = String::Handle(
+ String::Concat(expected_class_name, String::Handle(Symbols::Dot())));
+ return function_name.Equals(expected_function_name);
+}
+
+
+static intptr_t GetResultCidOfConstructor(ConstructorCallNode* node) {
+ const Function& function = node->constructor();
+ const Class& function_class = Class::Handle(function.Owner());
+ const Library& core_lib = Library::Handle(Library::CoreLibrary());
+
+ if (function_class.library() != core_lib.raw()) {
+ return kDynamicCid;
+ }
+
+ if (node->constructor().IsFactory()) {
+ if ((function_class.Name() == Symbols::ListImplementation()) &&
+ (function.name() == Symbols::ListFactory())) {
+ // If there are no arguments then the result is guaranteed to be a
+ // GrowableObjectArray. However if there is an argument the result
+ // is not guaranteed to be a fixed size array because the argument
+ // can be null.
+ if (node->arguments()->length() == 0) {
+ return kGrowableObjectArrayCid;
+ }
+ } else {
+ if (IsRecognizedConstructor(function,
+ String::Handle(Symbols::ObjectArray())) &&
+ (node->arguments()->length() == 1)) {
+ return kArrayCid;
+ } else if (IsRecognizedConstructor(function,
+ String::Handle(Symbols::GrowableObjectArray())) &&
+ (node->arguments()->length() == 0)) {
+ return kGrowableObjectArrayCid;
}
}
}
@@ -1707,7 +1737,9 @@
node->arguments()->names(),
arguments);
// List factories return kArrayCid or kGrowableObjectArrayCid.
- call->set_result_cid(GetResultCidOfConstructor(node));
+ const intptr_t result_cid = GetResultCidOfConstructor(node);
+ call->set_result_cid(result_cid);
+ call->set_is_known_constructor(result_cid != kDynamicCid);
ReturnDefinition(call);
return;
}
@@ -2002,7 +2034,7 @@
if (node->is_super_getter()) {
// Statically resolved instance getter, i.e. "super getter".
getter_function =
- Resolver::ResolveDynamicAnyArgs(node->cls(), getter_name);
+ Resolver::ResolveDynamicAnyArgs(node->cls(), getter_name);
ASSERT(!getter_function.IsNull());
ASSERT(node->receiver() != NULL);
ValueGraphVisitor receiver_value(owner(), temp_index());
@@ -2037,7 +2069,7 @@
const String& cls_name = String::Handle(Symbols::NoSuchMethodError());
const String& func_name = String::Handle(Symbols::ThrowNew());
const Class& cls = Class::Handle(
- Library::Handle(Library::CoreImplLibrary()).LookupClass(cls_name));
+ Library::Handle(Library::CoreLibrary()).LookupClass(cls_name));
ASSERT(!cls.IsNull());
getter_function = Resolver::ResolveStatic(cls,
func_name,
@@ -2265,6 +2297,28 @@
void EffectGraphVisitor::VisitLoadIndexedNode(LoadIndexedNode* node) {
+ Function* super_function = NULL;
+ if (node->IsSuperLoad()) {
+ // Resolve the load indexed operator in the super class.
+ const String& index_operator_name =
+ String::ZoneHandle(Symbols::IndexToken());
+ super_function = &Function::ZoneHandle(
+ Resolver::ResolveDynamicAnyArgs(node->super_class(),
+ index_operator_name));
+ if (super_function->IsNull()) {
+ // Could not resolve super operator. Generate call noSuchMethod() of the
+ // super class instead.
+ ArgumentListNode* arguments = new ArgumentListNode(node->token_pos());
+ arguments->Add(node->index_expr());
+ StaticCallInstr* call =
+ BuildStaticNoSuchMethodCall(node->super_class(),
+ node->array(),
+ index_operator_name,
+ arguments);
+ ReturnDefinition(call);
+ return;
+ }
+ }
ZoneGrowableArray<PushArgumentInstr*>* arguments =
new ZoneGrowableArray<PushArgumentInstr*>(2);
ValueGraphVisitor for_array(owner(), temp_index());
@@ -2277,22 +2331,67 @@
Append(for_index);
arguments->Add(PushArgument(for_index.value()));
- const intptr_t checked_argument_count = 1;
- const String& name =
- String::ZoneHandle(Symbols::New(Token::Str(Token::kINDEX)));
- InstanceCallInstr* load = new InstanceCallInstr(node->token_pos(),
- name,
- Token::kINDEX,
- arguments,
- Array::ZoneHandle(),
- checked_argument_count);
- ReturnDefinition(load);
+ if (super_function != NULL) {
+ // Generate static call to super operator.
+ StaticCallInstr* load = new StaticCallInstr(node->token_pos(),
+ *super_function,
+ Array::ZoneHandle(),
+ arguments);
+ ReturnDefinition(load);
+ } else {
+ // Generate dynamic call to index operator.
+ const intptr_t checked_argument_count = 1;
+ const String& name = String::ZoneHandle(Symbols::IndexToken());
+ InstanceCallInstr* load = new InstanceCallInstr(node->token_pos(),
+ name,
+ Token::kINDEX,
+ arguments,
+ Array::ZoneHandle(),
+ checked_argument_count);
+ ReturnDefinition(load);
+ }
}
Definition* EffectGraphVisitor::BuildStoreIndexedValues(
StoreIndexedNode* node,
bool result_is_needed) {
+ Function* super_function = NULL;
+ if (node->IsSuperStore()) {
+ // Resolve the store indexed operator in the super class.
+ const String& store_index_op_name =
+ String::ZoneHandle(Symbols::AssignIndexToken());
+ super_function = &Function::ZoneHandle(
+ Resolver::ResolveDynamicAnyArgs(node->super_class(),
+ store_index_op_name));
+ if (super_function->IsNull()) {
+ // Could not resolve super operator. Generate call noSuchMethod() of the
+ // super class instead.
+ if (result_is_needed) {
+ // Even though noSuchMethod most likely does not return,
+ // we save the stored value if the result is needed.
+ ValueGraphVisitor for_value(owner(), temp_index());
+ node->value()->Visit(&for_value);
+ Append(for_value);
+ Bind(BuildStoreExprTemp(for_value.value()));
+ }
+ ArgumentListNode* arguments = new ArgumentListNode(node->token_pos());
+ arguments->Add(node->index_expr());
+ arguments->Add(node->value());
+ StaticCallInstr* call =
+ BuildStaticNoSuchMethodCall(node->super_class(),
+ node->array(),
+ store_index_op_name,
+ arguments);
+ if (result_is_needed) {
+ Do(call);
+ return BuildLoadExprTemp();
+ } else {
+ return call;
+ }
+ }
+ }
+
ZoneGrowableArray<PushArgumentInstr*>* arguments =
new ZoneGrowableArray<PushArgumentInstr*>(3);
ValueGraphVisitor for_array(owner(), temp_index());
@@ -2316,20 +2415,38 @@
}
arguments->Add(PushArgument(value));
- const intptr_t checked_argument_count = 3;
- const String& name =
- String::ZoneHandle(Symbols::New(Token::Str(Token::kASSIGN_INDEX)));
- InstanceCallInstr* store = new InstanceCallInstr(node->token_pos(),
- name,
- Token::kASSIGN_INDEX,
- arguments,
- Array::ZoneHandle(),
- checked_argument_count);
- if (result_is_needed) {
- Do(store);
- return BuildLoadExprTemp();
+ if (super_function != NULL) {
+ // Generate static call to super operator []=.
+
+ StaticCallInstr* store =
+ new StaticCallInstr(node->token_pos(),
+ *super_function,
+ Array::ZoneHandle(),
+ arguments);
+ if (result_is_needed) {
+ Do(store);
+ return BuildLoadExprTemp();
+ } else {
+ return store;
+ }
} else {
- return store;
+ // Generate dynamic call to operator []=.
+ const intptr_t checked_argument_count = 3;
+ const String& name =
+ String::ZoneHandle(Symbols::New(Token::Str(Token::kASSIGN_INDEX)));
+ InstanceCallInstr* store =
+ new InstanceCallInstr(node->token_pos(),
+ name,
+ Token::kASSIGN_INDEX,
+ arguments,
+ Array::ZoneHandle(),
+ checked_argument_count);
+ if (result_is_needed) {
+ Do(store);
+ return BuildLoadExprTemp();
+ } else {
+ return store;
+ }
}
}
@@ -2583,6 +2700,75 @@
}
+// Looks up dynamic method noSuchMethod in target_class
+// (including its super class chain) and builds a static call to it.
+StaticCallInstr* EffectGraphVisitor::BuildStaticNoSuchMethodCall(
+ const Class& target_class,
+ AstNode* receiver,
+ const String& method_name,
+ ArgumentListNode* method_arguments) {
+ // Build the graph to allocate an InvocationMirror object by calling
+ // the static allocation method.
+ const String& mirror_name = String::Handle(Symbols::InvocationMirror());
+ const Library& corelib = Library::Handle(Library::CoreLibrary());
+ const Class& mirror_class = Class::Handle(
+ corelib.LookupClassAllowPrivate(mirror_name));
+ ASSERT(!mirror_class.IsNull());
+ const String& function_name = String::Handle(
+ Symbols::AllocateInvocationMirror());
+ const Function& allocation_function = Function::ZoneHandle(
+ Resolver::ResolveStaticByName(mirror_class,
+ function_name,
+ Resolver::kIsQualified));
+ ASSERT(!allocation_function.IsNull());
+
+ // Evaluate the receiver before the arguments. This will be used
+ // as an argument to the noSuchMethod call.
+ ValueGraphVisitor for_receiver(owner(), temp_index());
+ receiver->Visit(&for_receiver);
+ Append(for_receiver);
+ PushArgumentInstr* push_receiver = PushArgument(for_receiver.value());
+
+ // Allocate the arguments and pass them into the construction
+ // of the InvocationMirror.
+ const intptr_t args_pos = method_arguments->token_pos();
+ ArgumentListNode* arguments = new ArgumentListNode(args_pos);
+ // The first argument is the original method name.
+ arguments->Add(new LiteralNode(args_pos, method_name));
+ // The second argument is an array containing the original method arguments.
+ ArrayNode* args_array =
+ new ArrayNode(args_pos, Type::ZoneHandle(Type::ListInterface()));
+ for (intptr_t i = 0; i < method_arguments->length(); i++) {
+ args_array->AddElement(method_arguments->NodeAt(i));
+ }
+ arguments->Add(args_array);
+ ZoneGrowableArray<PushArgumentInstr*>* allocation_args =
+ new ZoneGrowableArray<PushArgumentInstr*>(arguments->length());
+ BuildPushArguments(*arguments, allocation_args);
+ StaticCallInstr* allocation = new StaticCallInstr(args_pos,
+ allocation_function,
+ Array::ZoneHandle(),
+ allocation_args);
+ Value* invocation_mirror = Bind(allocation);
+ PushArgumentInstr* push_invocation_mirror = PushArgument(invocation_mirror);
+ // Lookup noSuchMethod and call it with the receiver and the InvocationMirror.
+ const String& no_such_method_name =
+ String::ZoneHandle(Symbols::NoSuchMethod());
+ const Function& no_such_method_func = Function::ZoneHandle(
+ Resolver::ResolveDynamicAnyArgs(target_class, no_such_method_name));
+ // We are guaranteed to find noSuchMethod of class Object.
+ ASSERT(!no_such_method_func.IsNull());
+ ZoneGrowableArray<PushArgumentInstr*>* args =
+ new ZoneGrowableArray<PushArgumentInstr*>(2);
+ args->Add(push_receiver);
+ args->Add(push_invocation_mirror);
+ return new StaticCallInstr(args_pos,
+ no_such_method_func,
+ Array::ZoneHandle(),
+ args);
+}
+
+
void EffectGraphVisitor::BuildThrowNode(ThrowNode* node) {
// TODO(kmillikin) non-local control flow is not handled correctly
// by the inliner.
diff --git a/runtime/vm/flow_graph_builder.h b/runtime/vm/flow_graph_builder.h
index 7c93796..9c675af 100644
--- a/runtime/vm/flow_graph_builder.h
+++ b/runtime/vm/flow_graph_builder.h
@@ -252,6 +252,12 @@
void BuildThrowNode(ThrowNode* node);
+ StaticCallInstr* BuildStaticNoSuchMethodCall(
+ const Class& target_class,
+ AstNode* receiver,
+ const String& method_name,
+ ArgumentListNode* method_arguments);
+
void BuildStaticSetter(StaticSetterNode* node, bool result_is_needed);
Definition* BuildStoreStaticField(StoreStaticFieldNode* node,
bool result_is_needed);
diff --git a/runtime/vm/flow_graph_compiler.cc b/runtime/vm/flow_graph_compiler.cc
index b26df19..57e02d4 100644
--- a/runtime/vm/flow_graph_compiler.cc
+++ b/runtime/vm/flow_graph_compiler.cc
@@ -26,11 +26,11 @@
DECLARE_FLAG(bool, code_comments);
DECLARE_FLAG(bool, enable_type_checks);
DECLARE_FLAG(bool, intrinsify);
+DECLARE_FLAG(bool, propagate_ic_data);
DECLARE_FLAG(bool, report_usage_count);
DECLARE_FLAG(bool, trace_functions);
DECLARE_FLAG(int, optimization_counter_threshold);
-
void CompilerDeoptInfo::BuildReturnAddress(DeoptInfoBuilder* builder,
const Function& function,
intptr_t slot_ix) {
@@ -62,77 +62,73 @@
}
-RawDeoptInfo* CompilerDeoptInfo::CreateDeoptInfo(FlowGraphCompiler* compiler) {
+RawDeoptInfo* CompilerDeoptInfo::CreateDeoptInfo(FlowGraphCompiler* compiler,
+ DeoptInfoBuilder* builder) {
if (deoptimization_env_ == NULL) return DeoptInfo::null();
intptr_t stack_height = compiler->StackSize();
AllocateIncomingParametersRecursive(deoptimization_env_, &stack_height);
- const Function& function = compiler->parsed_function().function();
- // For functions with optional arguments, all incoming arguments are copied
- // to spill slots. The deoptimization environment does not track them.
- const intptr_t incoming_arg_count =
- function.HasOptionalParameters() ? 0 : function.num_fixed_parameters();
- DeoptInfoBuilder builder(compiler->object_table(), incoming_arg_count);
-
intptr_t slot_ix = 0;
- Environment* inner = deoptimization_env_;
+ Environment* current = deoptimization_env_;
// For the innermost environment, call the virtual return builder.
- BuildReturnAddress(&builder, inner->function(), slot_ix++);
+ BuildReturnAddress(builder, current->function(), slot_ix++);
// For the innermost environment, set outgoing arguments and the locals.
- for (intptr_t i = inner->Length() - 1;
- i >= inner->fixed_parameter_count();
+ for (intptr_t i = current->Length() - 1;
+ i >= current->fixed_parameter_count();
i--) {
- builder.AddCopy(inner->LocationAt(i), *inner->ValueAt(i), slot_ix++);
+ builder->AddCopy(current->LocationAt(i), *current->ValueAt(i), slot_ix++);
}
// PC marker and caller FP.
- builder.AddPcMarker(inner->function(), slot_ix++);
- builder.AddCallerFp(slot_ix++);
+ builder->AddPcMarker(current->function(), slot_ix++);
+ builder->AddCallerFp(slot_ix++);
- while (inner->outer() != NULL) {
- // Write the frame for an outer environment.
- const Environment* current = inner->outer();
-
+ Environment* previous = current;
+ current = current->outer();
+ while (current != NULL) {
// For any outer environment the deopt id is that of the call instruction
// which is recorded in the outer environment.
- builder.AddReturnAddressAfter(current->function(),
- current->deopt_id(),
- slot_ix++);
+ builder->AddReturnAddressAfter(current->function(),
+ current->deopt_id(),
+ slot_ix++);
// The values of outgoing arguments can be changed from the inlined call so
- // we must read them from the inner environment.
- for (intptr_t i = inner->fixed_parameter_count() - 1; i >= 0; i--) {
- builder.AddCopy(inner->LocationAt(i), *inner->ValueAt(i), slot_ix++);
+ // we must read them from the previous environment.
+ for (intptr_t i = previous->fixed_parameter_count() - 1; i >= 0; i--) {
+ builder->AddCopy(previous->LocationAt(i), *previous->ValueAt(i),
+ slot_ix++);
}
// Set the locals, note that outgoing arguments are not in the environment.
for (intptr_t i = current->Length() - 1;
i >= current->fixed_parameter_count();
i--) {
- builder.AddCopy(current->LocationAt(i), *current->ValueAt(i), slot_ix++);
+ builder->AddCopy(current->LocationAt(i), *current->ValueAt(i), slot_ix++);
}
// PC marker and caller FP.
- builder.AddPcMarker(current->function(), slot_ix++);
- builder.AddCallerFp(slot_ix++);
+ builder->AddPcMarker(current->function(), slot_ix++);
+ builder->AddCallerFp(slot_ix++);
// Iterate on the outer environment.
- inner = inner->outer();
+ previous = current;
+ current = current->outer();
}
- ASSERT(inner != NULL); // The inner pointer is now the outermost environment.
+ // The previous pointer is now the outermost environment.
+ ASSERT(previous != NULL);
// For the outermost environment, set caller PC.
- builder.AddCallerPc(slot_ix++);
+ builder->AddCallerPc(slot_ix++);
// For the outermost environment, set the incoming arguments.
- for (intptr_t i = inner->fixed_parameter_count() - 1; i >= 0; i--) {
- builder.AddCopy(inner->LocationAt(i), *inner->ValueAt(i), slot_ix++);
+ for (intptr_t i = previous->fixed_parameter_count() - 1; i >= 0; i--) {
+ builder->AddCopy(previous->LocationAt(i), *previous->ValueAt(i), slot_ix++);
}
- const DeoptInfo& deopt_info = DeoptInfo::Handle(builder.CreateDeoptInfo());
+ const DeoptInfo& deopt_info = DeoptInfo::Handle(builder->CreateDeoptInfo());
return deopt_info.raw();
}
@@ -150,7 +146,6 @@
is_optimizing ? new StackmapTableBuilder() : NULL),
block_info_(block_order_.length()),
deopt_infos_(),
- object_table_(GrowableObjectArray::Handle(GrowableObjectArray::New())),
is_optimizing_(is_optimizing),
bool_true_(Bool::ZoneHandle(Bool::True())),
bool_false_(Bool::ZoneHandle(Bool::False())),
@@ -380,6 +375,13 @@
void FlowGraphCompiler::FinalizeDeoptInfo(const Code& code) {
+ // For functions with optional arguments, all incoming arguments are copied
+ // to spill slots. The deoptimization environment does not track them.
+ const Function& function = parsed_function().function();
+ const intptr_t incoming_arg_count =
+ function.HasOptionalParameters() ? 0 : function.num_fixed_parameters();
+ DeoptInfoBuilder builder(incoming_arg_count);
+
const Array& array =
Array::Handle(Array::New(DeoptTable::SizeFor(deopt_infos_.length()),
Heap::kOld));
@@ -388,12 +390,13 @@
Smi& reason = Smi::Handle();
for (intptr_t i = 0; i < deopt_infos_.length(); i++) {
offset = Smi::New(deopt_infos_[i]->pc_offset());
- info = deopt_infos_[i]->CreateDeoptInfo(this);
+ info = deopt_infos_[i]->CreateDeoptInfo(this, &builder);
reason = Smi::New(deopt_infos_[i]->reason());
DeoptTable::SetEntry(array, i, offset, info, reason);
}
code.set_deopt_info_array(array);
- const Array& object_array = Array::Handle(Array::MakeArray(object_table()));
+ const Array& object_array =
+ Array::Handle(Array::MakeArray(builder.object_table()));
code.set_object_table(object_array);
}
@@ -465,23 +468,21 @@
}
-const ICData& FlowGraphCompiler::GenerateInstanceCall(
+void FlowGraphCompiler::GenerateInstanceCall(
intptr_t deopt_id,
intptr_t token_pos,
- const String& function_name,
intptr_t argument_count,
const Array& argument_names,
- intptr_t checked_argument_count,
- LocationSummary* locs) {
- ICData& ic_data =
- ICData::ZoneHandle(ICData::New(parsed_function().function(),
- function_name,
- deopt_id,
- checked_argument_count));
+ LocationSummary* locs,
+ const ICData& ic_data) {
+ ASSERT(!ic_data.IsNull());
+ ASSERT(FLAG_propagate_ic_data || (ic_data.NumberOfChecks() == 0));
+ // Because optimized code should not waste time.
+ ASSERT(!is_optimizing() || ic_data.num_args_tested() == 1);
const Array& arguments_descriptor =
DartEntry::ArgumentsDescriptor(argument_count, argument_names);
uword label_address = 0;
- switch (checked_argument_count) {
+ switch (ic_data.num_args_tested()) {
case 1:
label_address = StubCode::OneArgCheckInlineCacheEntryPoint();
break;
@@ -498,7 +499,6 @@
EmitInstanceCall(&target_label, ic_data, arguments_descriptor, argument_count,
deopt_id, token_pos, locs);
- return ic_data;
}
@@ -540,10 +540,8 @@
GrowableArray<intptr_t> args;
args.Add(kOneByteStringCid);
args.Add(kTwoByteStringCid);
- args.Add(kFourByteStringCid);
args.Add(kExternalOneByteStringCid);
args.Add(kExternalTwoByteStringCid);
- args.Add(kExternalFourByteStringCid);
CheckClassIds(kClassIdReg, args, is_instance_lbl, is_not_instance_lbl);
}
diff --git a/runtime/vm/flow_graph_compiler.h b/runtime/vm/flow_graph_compiler.h
index 8caf5b7..1a12f6f 100644
--- a/runtime/vm/flow_graph_compiler.h
+++ b/runtime/vm/flow_graph_compiler.h
@@ -67,7 +67,8 @@
reason_(reason),
deoptimization_env_(NULL) {}
- RawDeoptInfo* CreateDeoptInfo(FlowGraphCompiler* compiler);
+ RawDeoptInfo* CreateDeoptInfo(FlowGraphCompiler* compiler,
+ DeoptInfoBuilder* builder);
void AllocateIncomingParametersRecursive(Environment* env,
intptr_t* stack_height);
diff --git a/runtime/vm/flow_graph_compiler_ia32.cc b/runtime/vm/flow_graph_compiler_ia32.cc
index babcc50..06d767e 100644
--- a/runtime/vm/flow_graph_compiler_ia32.cc
+++ b/runtime/vm/flow_graph_compiler_ia32.cc
@@ -20,7 +20,6 @@
DECLARE_FLAG(bool, print_ast);
DECLARE_FLAG(bool, print_scopes);
-DECLARE_FLAG(bool, reject_named_argument_as_positional);
DECLARE_FLAG(bool, trace_functions);
DEFINE_FLAG(bool, trap_on_deoptimization, false, "Trap on deoptimization.");
DEFINE_FLAG(bool, unbox_mints, true, "Optimize 64-bit integer arithmetic.");
@@ -695,11 +694,6 @@
__ j(POSITIVE, &loop, Assembler::kNearJump);
// Copy or initialize optional named arguments.
-
- if (!FLAG_reject_named_argument_as_positional) {
- // Treat optional positional parameters as optional named parameters.
- num_opt_named_params += num_opt_pos_params;
- }
const Immediate raw_null =
Immediate(reinterpret_cast<intptr_t>(Object::null()));
Label all_arguments_processed;
@@ -735,13 +729,6 @@
for (int i = 0; i < num_opt_named_params; i++) {
Label load_default_value, assign_optional_parameter, next_parameter;
const int param_pos = opt_param_position[i];
- if (!FLAG_reject_named_argument_as_positional) {
- // Handle this optional parameter only if k or fewer positional
- // arguments have been passed, where k is the position of this optional
- // parameter in the formal parameter list.
- __ cmpl(ECX, Immediate(param_pos));
- __ j(GREATER, &next_parameter, Assembler::kNearJump);
- }
// Check if this named parameter was passed in.
__ movl(EAX, Address(EDI, 0)); // Load EAX with the name of the argument.
ASSERT(opt_param[i]->name().IsSymbol());
@@ -778,7 +765,6 @@
__ cmpl(Address(EDI, 0), raw_null);
__ j(EQUAL, &all_arguments_processed, Assembler::kNearJump);
} else if (num_opt_pos_params > 0) {
- ASSERT(FLAG_reject_named_argument_as_positional);
// Number of positional args is the second Smi in descriptor array (EDX).
__ movl(ECX, FieldAddress(EDX, Array::data_offset() + (1 * kWordSize)));
__ SmiUntag(ECX);
@@ -826,6 +812,7 @@
// dropped the spill slots.
BitmapBuilder* empty_stack_bitmap = new BitmapBuilder();
if (function.IsClosureFunction()) {
+ // TODO(regis): Call NoSuchMethod with "call" as name of original function.
// We do not use GenerateCallRuntime because of the non-standard (empty)
// stackmap used here.
__ CallRuntime(kClosureArgumentMismatchRuntimeEntry);
@@ -973,6 +960,8 @@
__ cmpl(EAX, Immediate(Smi::RawValue(num_fixed_params)));
__ j(EQUAL, &argc_in_range, Assembler::kNearJump);
if (function.IsClosureFunction()) {
+ // TODO(regis): Call NoSuchMethod with "call" as name of original
+ // function.
GenerateCallRuntime(function.token_pos(),
kClosureArgumentMismatchRuntimeEntry,
prologue_locs);
diff --git a/runtime/vm/flow_graph_compiler_ia32.h b/runtime/vm/flow_graph_compiler_ia32.h
index c15ac7b..9e75d91 100644
--- a/runtime/vm/flow_graph_compiler_ia32.h
+++ b/runtime/vm/flow_graph_compiler_ia32.h
@@ -42,9 +42,6 @@
DescriptorList* pc_descriptors_list() const {
return pc_descriptors_list_;
}
- const GrowableObjectArray& object_table() {
- return object_table_;
- }
BlockEntryInstr* current_block() const { return current_block_; }
void set_current_block(BlockEntryInstr* value) {
current_block_ = value;
@@ -102,14 +99,12 @@
bool negate_result,
LocationSummary* locs);
- // Returns ICData used in the instance call.
- const ICData& GenerateInstanceCall(intptr_t deopt_id,
- intptr_t token_pos,
- const String& function_name,
- intptr_t argument_count,
- const Array& argument_names,
- intptr_t checked_argument_count,
- LocationSummary* locs);
+ void GenerateInstanceCall(intptr_t deopt_id,
+ intptr_t token_pos,
+ intptr_t argument_count,
+ const Array& argument_names,
+ LocationSummary* locs,
+ const ICData& ic_data);
void GenerateStaticCall(intptr_t deopt_id,
intptr_t token_pos,
@@ -315,7 +310,6 @@
GrowableArray<BlockInfo*> block_info_;
GrowableArray<CompilerDeoptInfo*> deopt_infos_;
GrowableArray<SlowPathCode*> slow_path_code_;
- const GrowableObjectArray& object_table_;
const bool is_optimizing_;
const Bool& bool_true_;
diff --git a/runtime/vm/flow_graph_compiler_x64.cc b/runtime/vm/flow_graph_compiler_x64.cc
index 62b01d6..9aa1a06 100644
--- a/runtime/vm/flow_graph_compiler_x64.cc
+++ b/runtime/vm/flow_graph_compiler_x64.cc
@@ -20,7 +20,6 @@
DECLARE_FLAG(bool, print_ast);
DECLARE_FLAG(bool, print_scopes);
-DECLARE_FLAG(bool, reject_named_argument_as_positional);
DECLARE_FLAG(bool, trace_functions);
DECLARE_FLAG(bool, use_sse41);
DEFINE_FLAG(bool, trap_on_deoptimization, false, "Trap on deoptimization.");
@@ -698,11 +697,6 @@
__ j(POSITIVE, &loop, Assembler::kNearJump);
// Copy or initialize optional named arguments.
-
- if (!FLAG_reject_named_argument_as_positional) {
- // Treat optional positional parameters as optional named parameters.
- num_opt_named_params += num_opt_pos_params;
- }
const Immediate raw_null =
Immediate(reinterpret_cast<intptr_t>(Object::null()));
Label all_arguments_processed;
@@ -738,13 +732,6 @@
for (int i = 0; i < num_opt_named_params; i++) {
Label load_default_value, assign_optional_parameter, next_parameter;
const int param_pos = opt_param_position[i];
- if (!FLAG_reject_named_argument_as_positional) {
- // Handle this optional parameter only if k or fewer positional
- // arguments have been passed, where k is the position of this optional
- // parameter in the formal parameter list.
- __ cmpq(RCX, Immediate(param_pos));
- __ j(GREATER, &next_parameter, Assembler::kNearJump);
- }
// Check if this named parameter was passed in.
__ movq(RAX, Address(RDI, 0)); // Load RAX with the name of the argument.
ASSERT(opt_param[i]->name().IsSymbol());
@@ -781,7 +768,6 @@
__ cmpq(Address(RDI, 0), raw_null);
__ j(EQUAL, &all_arguments_processed, Assembler::kNearJump);
} else if (num_opt_pos_params > 0) {
- ASSERT(FLAG_reject_named_argument_as_positional);
// Number of positional args is the second Smi in descriptor array (R10).
__ movq(RCX, FieldAddress(R10, Array::data_offset() + (1 * kWordSize)));
__ SmiUntag(RCX);
@@ -829,6 +815,7 @@
// dropped the spill slots.
BitmapBuilder* empty_stack_bitmap = new BitmapBuilder();
if (function.IsClosureFunction()) {
+ // TODO(regis): Call NoSuchMethod with "call" as name of original function.
// We do not use GenerateCallRuntime because of the non-standard (empty)
// stackmap used here.
__ CallRuntime(kClosureArgumentMismatchRuntimeEntry);
@@ -977,6 +964,8 @@
__ cmpq(RAX, Immediate(Smi::RawValue(num_fixed_params)));
__ j(EQUAL, &argc_in_range, Assembler::kNearJump);
if (function.IsClosureFunction()) {
+ // TODO(regis): Call NoSuchMethod with "call" as name of original
+ // function.
GenerateCallRuntime(function.token_pos(),
kClosureArgumentMismatchRuntimeEntry,
prologue_locs);
diff --git a/runtime/vm/flow_graph_compiler_x64.h b/runtime/vm/flow_graph_compiler_x64.h
index 54ca7e4..8bda052 100644
--- a/runtime/vm/flow_graph_compiler_x64.h
+++ b/runtime/vm/flow_graph_compiler_x64.h
@@ -42,9 +42,6 @@
DescriptorList* pc_descriptors_list() const {
return pc_descriptors_list_;
}
- const GrowableObjectArray& object_table() {
- return object_table_;
- }
BlockEntryInstr* current_block() const { return current_block_; }
void set_current_block(BlockEntryInstr* value) {
current_block_ = value;
@@ -102,14 +99,12 @@
bool negate_result,
LocationSummary* locs);
- // Returns ICData used in the instance call.
- const ICData& GenerateInstanceCall(intptr_t deopt_id,
- intptr_t token_pos,
- const String& function_name,
- intptr_t argument_count,
- const Array& argument_names,
- intptr_t checked_argument_count,
- LocationSummary* locs);
+ void GenerateInstanceCall(intptr_t deopt_id,
+ intptr_t token_pos,
+ intptr_t argument_count,
+ const Array& argument_names,
+ LocationSummary* locs,
+ const ICData& ic_data);
void GenerateStaticCall(intptr_t deopt_id,
intptr_t token_pos,
@@ -315,7 +310,6 @@
GrowableArray<BlockInfo*> block_info_;
GrowableArray<CompilerDeoptInfo*> deopt_infos_;
GrowableArray<SlowPathCode*> slow_path_code_;
- const GrowableObjectArray& object_table_;
const bool is_optimizing_;
const Bool& bool_true_;
diff --git a/runtime/vm/flow_graph_inliner.cc b/runtime/vm/flow_graph_inliner.cc
index 6aee0ad..74cc804 100644
--- a/runtime/vm/flow_graph_inliner.cc
+++ b/runtime/vm/flow_graph_inliner.cc
@@ -29,7 +29,6 @@
DECLARE_FLAG(int, deoptimization_counter_threshold);
DECLARE_FLAG(bool, verify_compiler);
DECLARE_FLAG(bool, compiler_stats);
-DECLARE_FLAG(bool, reject_named_argument_as_positional);
#define TRACE_INLINING(statement) \
do { \
@@ -280,16 +279,6 @@
return false;
}
- // Abort if we are running legacy support for optional parameters.
- if (!FLAG_reject_named_argument_as_positional &&
- function.HasOptionalPositionalParameters() &&
- (!argument_names.IsNull() && (argument_names.Length() > 0))) {
- function.set_is_inlinable(false);
- TRACE_INLINING(OS::Print(
- " Bailout: named optional positional parameter\n"));
- return false;
- }
-
Isolate* isolate = Isolate::Current();
// Save and clear IC data.
const Array& prev_ic_data = Array::Handle(isolate->ic_data_array());
diff --git a/runtime/vm/flow_graph_optimizer.cc b/runtime/vm/flow_graph_optimizer.cc
index cc887c7..e82a9e4 100644
--- a/runtime/vm/flow_graph_optimizer.cc
+++ b/runtime/vm/flow_graph_optimizer.cc
@@ -27,9 +27,11 @@
DEFINE_FLAG(bool, load_cse, true, "Use redundant load elimination.");
DEFINE_FLAG(bool, trace_range_analysis, false, "Trace range analysis progress");
DEFINE_FLAG(bool, trace_constant_propagation, false,
- "Print constant propagation and useless code elimination.");
+ "Print constant propagation and useless code elimination.");
DEFINE_FLAG(bool, array_bounds_check_elimination, true,
- "Eliminate redundant bounds checks.");
+ "Eliminate redundant bounds checks.");
+DEFINE_FLAG(int, max_polymorphic_checks, 4,
+ "Maximum number of polymorphic check, otherwise it is megamorphic.");
void FlowGraphOptimizer::ApplyICData() {
@@ -1121,60 +1123,67 @@
// Tries to optimize instance call by replacing it with a faster instruction
// (e.g, binary op, field load, ..).
void FlowGraphOptimizer::VisitInstanceCall(InstanceCallInstr* instr) {
- if (instr->HasICData() && (instr->ic_data()->NumberOfChecks() > 0)) {
- const Token::Kind op_kind = instr->token_kind();
- if ((op_kind == Token::kASSIGN_INDEX) &&
- TryReplaceWithStoreIndexed(instr)) {
- return;
- }
- if ((op_kind == Token::kINDEX) && TryReplaceWithLoadIndexed(instr)) {
- return;
- }
- if (Token::IsBinaryOperator(op_kind) &&
- TryReplaceWithBinaryOp(instr, op_kind)) {
- return;
- }
- if (Token::IsPrefixOperator(op_kind) &&
- TryReplaceWithUnaryOp(instr, op_kind)) {
- return;
- }
- if ((op_kind == Token::kGET) && TryInlineInstanceGetter(instr)) {
- return;
- }
- if ((op_kind == Token::kSET) && TryInlineInstanceSetter(instr)) {
- return;
- }
- if (TryInlineInstanceMethod(instr)) {
- return;
- }
- const ICData& unary_checks =
- ICData::ZoneHandle(instr->ic_data()->AsUnaryClassChecks());
- if (!InstanceCallNeedsClassCheck(instr)) {
- const bool call_with_checks = false;
- PolymorphicInstanceCallInstr* call =
- new PolymorphicInstanceCallInstr(instr, unary_checks,
- call_with_checks);
- instr->ReplaceWith(call, current_iterator());
- return;
- }
- const intptr_t kMaxChecks = 4;
- if (instr->ic_data()->NumberOfChecks() <= kMaxChecks) {
- bool call_with_checks;
- if (unary_checks.HasOneTarget()) {
- // Type propagation has not run yet, we cannot eliminate the check.
- AddCheckClass(instr, instr->ArgumentAt(0)->value()->Copy());
- // Call can still deoptimize, do not detach environment from instr.
- call_with_checks = false;
- } else {
- call_with_checks = true;
- }
- PolymorphicInstanceCallInstr* call =
- new PolymorphicInstanceCallInstr(instr, unary_checks,
- call_with_checks);
- instr->ReplaceWith(call, current_iterator());
- }
+ if (!instr->HasICData() || (instr->ic_data()->NumberOfChecks() == 0)) {
+ // An instance call without ICData will trigger deoptimization.
+ return;
}
- // An instance call without ICData will trigger deoptimization.
+
+ const ICData& unary_checks =
+ ICData::ZoneHandle(instr->ic_data()->AsUnaryClassChecks());
+ if ((unary_checks.NumberOfChecks() > FLAG_max_polymorphic_checks) &&
+ InstanceCallNeedsClassCheck(instr)) {
+ // Too many checks, leave it megamorphic.
+ return;
+ }
+
+ const Token::Kind op_kind = instr->token_kind();
+ if ((op_kind == Token::kASSIGN_INDEX) &&
+ TryReplaceWithStoreIndexed(instr)) {
+ return;
+ }
+ if ((op_kind == Token::kINDEX) && TryReplaceWithLoadIndexed(instr)) {
+ return;
+ }
+ if (Token::IsBinaryOperator(op_kind) &&
+ TryReplaceWithBinaryOp(instr, op_kind)) {
+ return;
+ }
+ if (Token::IsPrefixOperator(op_kind) &&
+ TryReplaceWithUnaryOp(instr, op_kind)) {
+ return;
+ }
+ if ((op_kind == Token::kGET) && TryInlineInstanceGetter(instr)) {
+ return;
+ }
+ if ((op_kind == Token::kSET) && TryInlineInstanceSetter(instr)) {
+ return;
+ }
+ if (TryInlineInstanceMethod(instr)) {
+ return;
+ }
+ if (!InstanceCallNeedsClassCheck(instr)) {
+ const bool call_with_checks = false;
+ PolymorphicInstanceCallInstr* call =
+ new PolymorphicInstanceCallInstr(instr, unary_checks,
+ call_with_checks);
+ instr->ReplaceWith(call, current_iterator());
+ return;
+ }
+ if (unary_checks.NumberOfChecks() <= FLAG_max_polymorphic_checks) {
+ bool call_with_checks;
+ if (unary_checks.HasOneTarget()) {
+ // Type propagation has not run yet, we cannot eliminate the check.
+ AddCheckClass(instr, instr->ArgumentAt(0)->value()->Copy());
+ // Call can still deoptimize, do not detach environment from instr.
+ call_with_checks = false;
+ } else {
+ call_with_checks = true;
+ }
+ PolymorphicInstanceCallInstr* call =
+ new PolymorphicInstanceCallInstr(instr, unary_checks,
+ call_with_checks);
+ instr->ReplaceWith(call, current_iterator());
+ }
}
@@ -1251,33 +1260,39 @@
static void HandleRelationalOp(FlowGraphOptimizer* optimizer,
RelationalOpInstr* comp,
Instruction* instr) {
- if (!comp->HasICData()) return;
-
+ if (!comp->HasICData() || (comp->ic_data()->NumberOfChecks() == 0)) {
+ return;
+ }
const ICData& ic_data = *comp->ic_data();
- if (ic_data.NumberOfChecks() == 0) return;
- // TODO(srdjan): Add multiple receiver type support.
- if (ic_data.NumberOfChecks() != 1) return;
- ASSERT(ic_data.HasOneTarget());
-
- if (HasOnlyTwoSmis(ic_data)) {
- optimizer->InsertBefore(
- instr,
- new CheckSmiInstr(comp->left()->Copy(), comp->deopt_id()),
- instr->env(),
- Definition::kEffect);
- optimizer->InsertBefore(
- instr,
- new CheckSmiInstr(comp->right()->Copy(), comp->deopt_id()),
- instr->env(),
- Definition::kEffect);
- comp->set_operands_class_id(kSmiCid);
- } else if (ShouldSpecializeForDouble(ic_data)) {
- comp->set_operands_class_id(kDoubleCid);
- } else if (comp->ic_data()->AllReceiversAreNumbers()) {
- comp->set_operands_class_id(kNumberCid);
+ if (ic_data.NumberOfChecks() == 1) {
+ ASSERT(ic_data.HasOneTarget());
+ if (HasOnlyTwoSmis(ic_data)) {
+ optimizer->InsertBefore(
+ instr,
+ new CheckSmiInstr(comp->left()->Copy(), comp->deopt_id()),
+ instr->env(),
+ Definition::kEffect);
+ optimizer->InsertBefore(
+ instr,
+ new CheckSmiInstr(comp->right()->Copy(), comp->deopt_id()),
+ instr->env(),
+ Definition::kEffect);
+ comp->set_operands_class_id(kSmiCid);
+ } else if (ShouldSpecializeForDouble(ic_data)) {
+ comp->set_operands_class_id(kDoubleCid);
+ } else if (HasTwoMintOrSmi(*comp->ic_data()) &&
+ FlowGraphCompiler::SupportsUnboxedMints()) {
+ comp->set_operands_class_id(kMintCid);
+ } else {
+ ASSERT(comp->operands_class_id() == kIllegalCid);
+ }
+ } else if (HasTwoMintOrSmi(*comp->ic_data()) &&
+ FlowGraphCompiler::SupportsUnboxedMints()) {
+ comp->set_operands_class_id(kMintCid);
}
}
+
void FlowGraphOptimizer::VisitRelationalOp(RelationalOpInstr* instr) {
HandleRelationalOp(this, instr, instr);
}
@@ -1333,8 +1348,6 @@
} else if (HasTwoMintOrSmi(*comp->ic_data()) &&
FlowGraphCompiler::SupportsUnboxedMints()) {
comp->set_receiver_class_id(kMintCid);
- } else if (comp->ic_data()->AllReceiversAreNumbers()) {
- comp->set_receiver_class_id(kNumberCid);
}
if (comp->receiver_class_id() != kIllegalCid) {
@@ -1455,9 +1468,8 @@
PhiInstr* SminessPropagator::RemoveLastFromWorklist() {
- PhiInstr* phi = worklist_.Last();
+ PhiInstr* phi = worklist_.RemoveLast();
ASSERT(in_worklist_->Contains(phi->ssa_temp_index()));
- worklist_.RemoveLast();
in_worklist_->Remove(phi->ssa_temp_index());
return phi;
}
@@ -1618,6 +1630,13 @@
Range* constraint,
Instruction* after);
+ void ConstrainValueAfterBranch(Definition* defn, Value* use);
+ void ConstrainValueAfterCheckArrayBound(Definition* defn,
+ CheckArrayBoundInstr* check);
+ Definition* LoadArrayLength(CheckArrayBoundInstr* check);
+
+
+
// Replace uses of the definition def that are dominated by instruction dom
// with uses of other definition.
void RenameDominatedUses(Definition* def,
@@ -1676,6 +1695,42 @@
GrowableArray<Definition*> worklist_;
BitVector* marked_defns_;
+ class ArrayLengthData : public ValueObject {
+ public:
+ ArrayLengthData(Definition* array, Definition* array_length)
+ : array_(array), array_length_(array_length) { }
+
+ Definition* array() const { return array_; }
+ Definition* array_length() const { return array_length_; }
+
+ typedef Definition* Value;
+ typedef Definition* Key;
+ typedef class ArrayLengthData Pair;
+
+ // KeyValueTrait members.
+ static Key KeyOf(const ArrayLengthData& data) {
+ return data.array();
+ }
+
+ static Value ValueOf(const ArrayLengthData& data) {
+ return data.array_length();
+ }
+
+ static inline intptr_t Hashcode(Key key) {
+ return reinterpret_cast<intptr_t>(key);
+ }
+
+ static inline bool IsKeyEqual(const ArrayLengthData& kv, Key key) {
+ return kv.array() == key;
+ }
+
+ private:
+ Definition* array_;
+ Definition* array_length_;
+ };
+
+ DirectChainedHashMap<ArrayLengthData> array_lengths_;
+
DISALLOW_COPY_AND_ASSIGN(RangeAnalysis);
};
@@ -1864,53 +1919,111 @@
}
+void RangeAnalysis::ConstrainValueAfterBranch(Definition* defn, Value* use) {
+ BranchInstr* branch = use->instruction()->AsBranch();
+ RelationalOpInstr* rel_op = branch->comparison()->AsRelationalOp();
+ if ((rel_op != NULL) && (rel_op->operands_class_id() == kSmiCid)) {
+ // Found comparison of two smis. Constrain defn at true and false
+ // successors using the other operand as a boundary.
+ Definition* boundary;
+ Token::Kind op_kind;
+ if (use->use_index() == 0) { // Left operand.
+ boundary = rel_op->InputAt(1)->definition();
+ op_kind = rel_op->kind();
+ } else {
+ ASSERT(use->use_index() == 1); // Right operand.
+ boundary = rel_op->InputAt(0)->definition();
+ // InsertConstraintFor assumes that defn is left operand of a
+ // comparison if it is right operand flip the comparison.
+ op_kind = FlipComparison(rel_op->kind());
+ }
+
+ // Constrain definition at the true successor.
+ ConstraintInstr* true_constraint =
+ InsertConstraintFor(defn,
+ ConstraintRange(op_kind, boundary),
+ branch->true_successor());
+ // Mark true_constraint an artificial use of boundary. This ensures
+ // that constraint's range is recalculated if boundary's range changes.
+ if (true_constraint != NULL) true_constraint->AddDependency(boundary);
+
+ // Constrain definition with a negated condition at the false successor.
+ ConstraintInstr* false_constraint =
+ InsertConstraintFor(
+ defn,
+ ConstraintRange(NegateComparison(op_kind), boundary),
+ branch->false_successor());
+ // Mark false_constraint an artificial use of boundary. This ensures
+ // that constraint's range is recalculated if boundary's range changes.
+ if (false_constraint != NULL) false_constraint->AddDependency(boundary);
+ }
+}
+
void RangeAnalysis::InsertConstraintsFor(Definition* defn) {
for (Value* use = defn->input_use_list();
use != NULL;
use = use->next_use()) {
if (use->instruction()->IsBranch()) {
- BranchInstr* branch = use->instruction()->AsBranch();
- RelationalOpInstr* rel_op = branch->comparison()->AsRelationalOp();
- if ((rel_op != NULL) && (rel_op->operands_class_id() == kSmiCid)) {
- // Found comparison of two smis. Constrain defn at true and false
- // successors using the other operand as a boundary.
- Definition* boundary;
- Token::Kind op_kind;
- if (use->use_index() == 0) { // Left operand.
- boundary = rel_op->InputAt(1)->definition();
- op_kind = rel_op->kind();
- } else {
- ASSERT(use->use_index() == 1); // Right operand.
- boundary = rel_op->InputAt(0)->definition();
- // InsertConstraintFor assumes that defn is left operand of a
- // comparison if it is right operand flip the comparison.
- op_kind = FlipComparison(rel_op->kind());
- }
-
- // Constrain definition at the true successor.
- ConstraintInstr* true_constraint =
- InsertConstraintFor(defn,
- ConstraintRange(op_kind, boundary),
- branch->true_successor());
- // Mark true_constraint an artificial use of boundary. This ensures
- // that constraint's range is recalculated if boundary's range changes.
- if (true_constraint != NULL) true_constraint->AddDependency(boundary);
-
- // Constrain definition with a negated condition at the false successor.
- ConstraintInstr* false_constraint =
- InsertConstraintFor(
- defn,
- ConstraintRange(NegateComparison(op_kind), boundary),
- branch->false_successor());
- // Mark false_constraint an artificial use of boundary. This ensures
- // that constraint's range is recalculated if boundary's range changes.
- if (false_constraint != NULL) false_constraint->AddDependency(boundary);
- }
+ ConstrainValueAfterBranch(defn, use);
+ } else if (use->instruction()->IsCheckArrayBound()) {
+ ConstrainValueAfterCheckArrayBound(
+ defn,
+ use->instruction()->AsCheckArrayBound());
}
}
}
+Definition* RangeAnalysis::LoadArrayLength(CheckArrayBoundInstr* check) {
+ Definition* array = check->array()->definition();
+
+ Definition* length = array_lengths_.Lookup(array);
+ if (length != NULL) return length;
+
+ StaticCallInstr* allocation = array->AsStaticCall();
+ if ((allocation != NULL) &&
+ allocation->is_known_constructor() &&
+ (allocation->ResultCid() == kArrayCid)) {
+ // For fixed length arrays check if array is the result of a constructor
+ // call. In this case we can use the length passed to the constructor
+ // instead of loading it from array itself.
+ length = allocation->ArgumentAt(1)->value()->definition();
+ } else {
+ // Load length from the array. Do not insert instruction into the graph.
+ // It will only be used in range boundaries.
+ LoadFieldInstr* length_load = new LoadFieldInstr(
+ check->array()->Copy(),
+ Array::length_offset(),
+ Type::ZoneHandle(Type::SmiType()),
+ true); // Immutable.
+ length_load->set_recognized_kind(MethodRecognizer::kObjectArrayLength);
+ length_load->set_result_cid(kSmiCid);
+ length_load->set_ssa_temp_index(flow_graph_->alloc_ssa_temp_index());
+ length = length_load;
+ }
+
+ ASSERT(length != NULL);
+ array_lengths_.Insert(ArrayLengthData(array, length));
+ return length;
+}
+
+
+void RangeAnalysis::ConstrainValueAfterCheckArrayBound(
+ Definition* defn, CheckArrayBoundInstr* check) {
+ if ((check->array_type() != kArrayCid) &&
+ (check->array_type() != kImmutableArrayCid)) {
+ return;
+ }
+
+ Definition* length = LoadArrayLength(check);
+
+ Range* constraint_range = new Range(
+ RangeBoundary::FromConstant(0),
+ RangeBoundary::FromDefinition(length, -1));
+ InsertConstraintFor(defn, constraint_range, check);
+}
+
+
void RangeAnalysis::InsertConstraints() {
for (intptr_t i = 0; i < smi_checks_.length(); i++) {
CheckSmiInstr* check = smi_checks_[i];
@@ -1978,8 +2091,7 @@
ResetWorklist();
MarkDefinition(var);
while (!worklist_.is_empty()) {
- Definition* defn = worklist_.Last();
- worklist_.RemoveLast();
+ Definition* defn = worklist_.RemoveLast();
if (defn->IsPhi()) {
PhiInstr* phi = defn->AsPhi();
@@ -2097,9 +2209,11 @@
smi_definitions_->Contains(defn->ssa_temp_index())) {
defn->InferRange();
} else if (FLAG_array_bounds_check_elimination &&
- current->IsCheckArrayBound() &&
- current->AsCheckArrayBound()->IsRedundant()) {
- it.RemoveCurrentFromGraph();
+ current->IsCheckArrayBound()) {
+ CheckArrayBoundInstr* check = current->AsCheckArrayBound();
+ RangeBoundary array_length =
+ RangeBoundary::FromDefinition(LoadArrayLength(check));
+ if (check->IsRedundant(array_length)) it.RemoveCurrentFromGraph();
}
}
@@ -2547,7 +2661,7 @@
static intptr_t NumberLoadExpressions(FlowGraph* graph) {
- DirectChainedHashMap<Definition*> map;
+ DirectChainedHashMap<PointerKeyValueTrait<Definition> > map;
intptr_t expr_id = 0;
for (BlockIterator it = graph->reverse_postorder_iterator();
!it.Done();
@@ -2737,7 +2851,7 @@
}
}
- DirectChainedHashMap<Instruction*> map;
+ DirectChainedHashMap<PointerKeyValueTrait<Instruction> > map;
changed = OptimizeRecursive(graph->graph_entry(), &map) || changed;
return changed;
@@ -2746,7 +2860,7 @@
bool DominatorBasedCSE::OptimizeRecursive(
BlockEntryInstr* block,
- DirectChainedHashMap<Instruction*>* map) {
+ DirectChainedHashMap<PointerKeyValueTrait<Instruction> >* map) {
bool changed = false;
for (ForwardInstructionIterator it(block); !it.Done(); it.Advance()) {
Instruction* current = it.Current();
@@ -2766,7 +2880,8 @@
for (intptr_t i = 0; i < num_children; ++i) {
BlockEntryInstr* child = block->dominated_blocks()[i];
if (i < num_children - 1) {
- DirectChainedHashMap<Instruction*> child_map(*map); // Copy map.
+ // Copy map.
+ DirectChainedHashMap<PointerKeyValueTrait<Instruction> > child_map(*map);
changed = OptimizeRecursive(child, &child_map) || changed;
} else {
// Reuse map for the last child.
@@ -3066,8 +3181,18 @@
void ConstantPropagator::VisitStrictCompare(StrictCompareInstr* instr) {
const Object& left = instr->left()->definition()->constant_value();
const Object& right = instr->right()->definition()->constant_value();
+
if (IsNonConstant(left) || IsNonConstant(right)) {
- SetValue(instr, non_constant_);
+ // TODO(vegorov): incorporate nullability information into the lattice.
+ if ((left.IsNull() && (instr->right()->ResultCid() != kDynamicCid)) ||
+ (right.IsNull() && (instr->left()->ResultCid() != kDynamicCid))) {
+ bool result = left.IsNull() ? (instr->right()->ResultCid() == kNullCid)
+ : (instr->left()->ResultCid() == kNullCid);
+ if (instr->kind() == Token::kNE_STRICT) result = !result;
+ SetValue(instr, Bool::ZoneHandle(Bool::Get(result)));
+ } else {
+ SetValue(instr, non_constant_);
+ }
} else if (IsConstant(left) && IsConstant(right)) {
bool result = (left.raw() == right.raw());
if (instr->kind() == Token::kNE_STRICT) result = !result;
@@ -3380,8 +3505,7 @@
while (true) {
if (block_worklist_.is_empty()) {
if (definition_worklist_.is_empty()) break;
- Definition* definition = definition_worklist_.Last();
- definition_worklist_.RemoveLast();
+ Definition* definition = definition_worklist_.RemoveLast();
definition_marks_->Remove(definition->ssa_temp_index());
Value* use = definition->input_use_list();
while (use != NULL) {
@@ -3389,8 +3513,7 @@
use = use->next_use();
}
} else {
- BlockEntryInstr* block = block_worklist_.Last();
- block_worklist_.RemoveLast();
+ BlockEntryInstr* block = block_worklist_.RemoveLast();
block->Accept(this);
}
}
@@ -3404,6 +3527,8 @@
printer.PrintBlocks();
}
+ GrowableArray<PhiInstr*> redundant_phis(10);
+
// We will recompute dominators, block ordering, block ids, block last
// instructions, previous pointers, predecessors, etc. after eliminating
// unreachable code. We do not maintain those properties during the
@@ -3446,6 +3571,7 @@
PhiInstr* phi = (*phis)[phi_idx];
if (phi == NULL) continue;
phi->inputs_.TruncateTo(live_count);
+ if (live_count == 1) redundant_phis.Add(phi);
}
}
}
@@ -3521,6 +3647,12 @@
graph_->ComputeDominators(&dominance_frontier);
graph_->ComputeUseLists();
+ for (intptr_t i = 0; i < redundant_phis.length(); i++) {
+ PhiInstr* phi = redundant_phis[i];
+ phi->ReplaceUsesWith(phi->InputAt(0)->definition());
+ phi->mark_dead();
+ }
+
if (FLAG_trace_constant_propagation) {
OS::Print("\n==== After constant propagation ====\n");
FlowGraphPrinter printer(*graph_);
diff --git a/runtime/vm/flow_graph_optimizer.h b/runtime/vm/flow_graph_optimizer.h
index 7d86ac1..cd0cda1 100644
--- a/runtime/vm/flow_graph_optimizer.h
+++ b/runtime/vm/flow_graph_optimizer.h
@@ -12,6 +12,7 @@
template <typename T> class GrowableArray;
template <typename T> class DirectChainedHashMap;
+template <typename T> class PointerKeyValueTrait;
class FlowGraphOptimizer : public FlowGraphVisitor {
public:
@@ -163,7 +164,7 @@
private:
static bool OptimizeRecursive(
BlockEntryInstr* entry,
- DirectChainedHashMap<Instruction*>* map);
+ DirectChainedHashMap<PointerKeyValueTrait<Instruction> >* map);
};
diff --git a/runtime/vm/growable_array.h b/runtime/vm/growable_array.h
index 91c95c2..a8aa2d3 100644
--- a/runtime/vm/growable_array.h
+++ b/runtime/vm/growable_array.h
@@ -46,9 +46,11 @@
Last() = value;
}
- void RemoveLast() {
+ T& RemoveLast() {
ASSERT(length_ > 0);
+ T& result = operator[](length_ - 1);
length_--;
+ return result;
}
T& operator[](int index) const {
diff --git a/runtime/vm/hash_map.h b/runtime/vm/hash_map.h
index 0c41f12..22efc32 100644
--- a/runtime/vm/hash_map.h
+++ b/runtime/vm/hash_map.h
@@ -7,7 +7,7 @@
namespace dart {
-template <typename T>
+template <typename KeyValueTrait>
class DirectChainedHashMap: public ValueObject {
public:
DirectChainedHashMap() : array_size_(0),
@@ -22,16 +22,16 @@
DirectChainedHashMap(const DirectChainedHashMap& other);
- void Insert(T value);
+ void Insert(typename KeyValueTrait::Pair kv);
- T Lookup(T value) const;
+ typename KeyValueTrait::Value Lookup(typename KeyValueTrait::Key key) const;
bool IsEmpty() const { return count_ == 0; }
private:
// A linked list of T values. Stored in arrays.
struct HashMapListElement {
- T value;
+ typename KeyValueTrait::Pair kv;
intptr_t next; // Index in the array of the next list element.
};
static const intptr_t kNil = -1; // The end of a linked list
@@ -53,15 +53,22 @@
};
-template <typename T>
-T DirectChainedHashMap<T>::Lookup(T value) const {
- uword hash = static_cast<uword>(value->Hashcode());
+template <typename KeyValueTrait>
+typename KeyValueTrait::Value
+ DirectChainedHashMap<KeyValueTrait>::
+ Lookup(typename KeyValueTrait::Key key) const {
+ uword hash = static_cast<uword>(KeyValueTrait::Hashcode(key));
uword pos = Bound(hash);
- if (array_[pos].value != NULL) {
- if (array_[pos].value->Equals(value)) return array_[pos].value;
+ if (KeyValueTrait::ValueOf(array_[pos].kv) != NULL) {
+ if (KeyValueTrait::IsKeyEqual(array_[pos].kv, key)) {
+ return KeyValueTrait::ValueOf(array_[pos].kv);
+ }
+
intptr_t next = array_[pos].next;
while (next != kNil) {
- if (lists_[next].value->Equals(value)) return lists_[next].value;
+ if (KeyValueTrait::IsKeyEqual(lists_[next].kv, key)) {
+ return KeyValueTrait::ValueOf(lists_[next].kv);
+ }
next = lists_[next].next;
}
}
@@ -69,8 +76,9 @@
}
-template <typename T>
-DirectChainedHashMap<T>::DirectChainedHashMap(const DirectChainedHashMap& other)
+template <typename KeyValueTrait>
+DirectChainedHashMap<KeyValueTrait>::
+ DirectChainedHashMap(const DirectChainedHashMap& other)
: ValueObject(),
array_size_(other.array_size_),
lists_size_(other.lists_size_),
@@ -85,8 +93,8 @@
}
-template <typename T>
-void DirectChainedHashMap<T>::Resize(intptr_t new_size) {
+template <typename KeyValueTrait>
+void DirectChainedHashMap<KeyValueTrait>::Resize(intptr_t new_size) {
ASSERT(new_size > count_);
// Hashing the values into the new array has no more collisions than in the
// old hash map, so we can use the existing lists_ array, if we are careful.
@@ -111,17 +119,17 @@
if (old_array != NULL) {
// Iterate over all the elements in lists, rehashing them.
for (intptr_t i = 0; i < old_size; ++i) {
- if (old_array[i].value != NULL) {
+ if (KeyValueTrait::ValueOf(old_array[i].kv) != NULL) {
intptr_t current = old_array[i].next;
while (current != kNil) {
- Insert(lists_[current].value);
+ Insert(lists_[current].kv);
intptr_t next = lists_[current].next;
lists_[current].next = free_list_head_;
free_list_head_ = current;
current = next;
}
// Rehash the directly stored value.
- Insert(old_array[i].value);
+ Insert(old_array[i].kv);
}
}
}
@@ -155,16 +163,18 @@
}
-template <typename T>
-void DirectChainedHashMap<T>::Insert(T value) {
- ASSERT(value != NULL);
+template <typename KeyValueTrait>
+void DirectChainedHashMap<KeyValueTrait>::
+ Insert(typename KeyValueTrait::Pair kv) {
+ ASSERT(KeyValueTrait::ValueOf(kv) != NULL);
// Resizing when half of the hashtable is filled up.
if (count_ >= array_size_ >> 1) Resize(array_size_ << 1);
ASSERT(count_ < array_size_);
count_++;
- uword pos = Bound(static_cast<uword>(value->Hashcode()));
- if (array_[pos].value == NULL) {
- array_[pos].value = value;
+ uword pos = Bound(
+ static_cast<uword>(KeyValueTrait::Hashcode(KeyValueTrait::KeyOf(kv))));
+ if (KeyValueTrait::ValueOf(array_[pos].kv) == NULL) {
+ array_[pos].kv = kv;
array_[pos].next = kNil;
} else {
if (free_list_head_ == kNil) {
@@ -173,13 +183,39 @@
intptr_t new_element_pos = free_list_head_;
ASSERT(new_element_pos != kNil);
free_list_head_ = lists_[free_list_head_].next;
- lists_[new_element_pos].value = value;
+ lists_[new_element_pos].kv = kv;
lists_[new_element_pos].next = array_[pos].next;
- ASSERT(array_[pos].next == kNil || lists_[array_[pos].next].value != NULL);
+ ASSERT(array_[pos].next == kNil ||
+ KeyValueTrait::ValueOf(lists_[array_[pos].next].kv) != NULL);
array_[pos].next = new_element_pos;
}
}
+
+template<typename T>
+class PointerKeyValueTrait {
+ public:
+ typedef T* Value;
+ typedef T* Key;
+ typedef T* Pair;
+
+ static Key KeyOf(Pair kv) {
+ return kv;
+ }
+
+ static Value ValueOf(Pair kv) {
+ return kv;
+ }
+
+ static inline intptr_t Hashcode(Key key) {
+ return key->Hashcode();
+ }
+
+ static inline bool IsKeyEqual(Pair kv, Key key) {
+ return kv->Equals(key);
+ }
+};
+
} // namespace dart
#endif // VM_HASH_MAP_H_
diff --git a/runtime/vm/hash_map_test.cc b/runtime/vm/hash_map_test.cc
index a5b4afe..522ff7c 100644
--- a/runtime/vm/hash_map_test.cc
+++ b/runtime/vm/hash_map_test.cc
@@ -19,7 +19,7 @@
TEST_CASE(DirectChainedHashMap) {
- DirectChainedHashMap<TestValue*> map;
+ DirectChainedHashMap<PointerKeyValueTrait<TestValue> > map;
EXPECT(map.IsEmpty());
TestValue v1(0);
TestValue v2(1);
@@ -30,7 +30,7 @@
EXPECT(map.Lookup(&v1) == &v1);
EXPECT(map.Lookup(&v2) == &v2);
EXPECT(map.Lookup(&v3) == &v1);
- DirectChainedHashMap<TestValue*> map2(map);
+ DirectChainedHashMap<PointerKeyValueTrait<TestValue> > map2(map);
EXPECT(map2.Lookup(&v1) == &v1);
EXPECT(map2.Lookup(&v2) == &v2);
EXPECT(map2.Lookup(&v3) == &v1);
diff --git a/runtime/vm/heap_profiler.cc b/runtime/vm/heap_profiler.cc
index e595067..f218a81 100644
--- a/runtime/vm/heap_profiler.cc
+++ b/runtime/vm/heap_profiler.cc
@@ -278,10 +278,8 @@
}
case kOneByteStringCid:
case kTwoByteStringCid:
- case kFourByteStringCid:
case kExternalOneByteStringCid:
- case kExternalTwoByteStringCid:
- case kExternalFourByteStringCid: {
+ case kExternalTwoByteStringCid: {
WriteInstanceDump(StringId(reinterpret_cast<const RawString*>(raw_obj)));
break;
}
@@ -355,7 +353,8 @@
int32_t ch = onestr->ptr()->data_[i];
j += Utf8::Encode(ch, &characters[j]);
}
- } else if (class_id == kTwoByteStringCid) {
+ } else {
+ ASSERT(class_id == kTwoByteStringCid);
const RawTwoByteString* twostr =
reinterpret_cast<const RawTwoByteString*>(raw_string);
for (intptr_t i = 0; i < Smi::Value(twostr->ptr()->length_); ++i) {
@@ -366,18 +365,6 @@
int32_t ch = twostr->ptr()->data_[i];
j += Utf8::Encode(ch, &characters[j]);
}
- } else {
- ASSERT(class_id == kFourByteStringCid);
- const RawFourByteString* fourstr =
- reinterpret_cast<const RawFourByteString*>(raw_string);
- for (intptr_t i = 0; i < Smi::Value(fourstr->ptr()->length_); ++i) {
- length += Utf8::Length(fourstr->ptr()->data_[i]);
- }
- characters = new char[length];
- for (intptr_t i = 0, j = 0; i < Smi::Value(fourstr->ptr()->length_); ++i) {
- int32_t ch = fourstr->ptr()->data_[i];
- j += Utf8::Encode(ch, &characters[j]);
- }
}
Record record(kStringInUtf8, this);
record.WritePointer(ObjectId(raw_string));
diff --git a/runtime/vm/heap_test.cc b/runtime/vm/heap_test.cc
index 440cdda..0a487e5 100644
--- a/runtime/vm/heap_test.cc
+++ b/runtime/vm/heap_test.cc
@@ -18,9 +18,7 @@
"}\n";
FLAG_verbose_gc = true;
Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
- Dart_Handle result = Dart_Invoke(lib,
- Dart_NewString("main"),
- 0, NULL);
+ Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, NULL);
EXPECT_VALID(result);
EXPECT(!Dart_IsNull(result));
@@ -39,9 +37,7 @@
FLAG_verbose_gc = true;
Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
Dart_EnterScope();
- Dart_Handle result = Dart_Invoke(lib,
- Dart_NewString("main"),
- 0, NULL);
+ Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, NULL);
EXPECT_VALID(result);
EXPECT(!Dart_IsNull(result));
diff --git a/runtime/vm/intermediate_language.cc b/runtime/vm/intermediate_language.cc
index a6f5fc5..97fd838 100644
--- a/runtime/vm/intermediate_language.cc
+++ b/runtime/vm/intermediate_language.cc
@@ -20,8 +20,10 @@
namespace dart {
+DEFINE_FLAG(bool, propagate_ic_data, true,
+ "Propagate IC data from unoptimized to optimized IC calls.");
DECLARE_FLAG(bool, enable_type_checks);
-
+DECLARE_FLAG(int, max_polymorphic_checks);
Definition::Definition()
: range_(NULL),
@@ -1074,6 +1076,13 @@
}
+bool EqualityCompareInstr::IsPolymorphic() const {
+ return HasICData() &&
+ (ic_data()->NumberOfChecks() > 0) &&
+ (ic_data()->NumberOfChecks() <= FLAG_max_polymorphic_checks);
+}
+
+
RawAbstractType* RelationalOpInstr::CompileType() const {
if ((operands_class_id() == kSmiCid) ||
(operands_class_id() == kDoubleCid) ||
@@ -1839,31 +1848,39 @@
void InstanceCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
+ ICData& call_ic_data = ICData::ZoneHandle(ic_data()->raw());
+ if (!FLAG_propagate_ic_data || !compiler->is_optimizing()) {
+ call_ic_data = ICData::New(compiler->parsed_function().function(),
+ function_name(),
+ deopt_id(),
+ checked_argument_count());
+ }
if (compiler->is_optimizing()) {
if (HasICData() && (ic_data()->NumberOfChecks() > 0)) {
+ const ICData& unary_ic_data =
+ ICData::ZoneHandle(ic_data()->AsUnaryClassChecks());
compiler->GenerateInstanceCall(deopt_id(),
token_pos(),
- function_name(),
ArgumentCount(),
argument_names(),
- checked_argument_count(),
- locs());
+ locs(),
+ unary_ic_data);
} else {
Label* deopt =
compiler->AddDeoptStub(deopt_id(), kDeoptInstanceCallNoICData);
__ jmp(deopt);
}
} else {
+ ASSERT(!HasICData());
compiler->AddCurrentDescriptor(PcDescriptors::kDeoptBefore,
deopt_id(),
token_pos());
compiler->GenerateInstanceCall(deopt_id(),
token_pos(),
- function_name(),
ArgumentCount(),
argument_names(),
- checked_argument_count(),
- locs());
+ locs(),
+ call_ic_data);
}
}
@@ -2117,13 +2134,15 @@
}
+static bool AreEqualDefinitions(Definition* a, Definition* b) {
+ return (a == b) || (!a->AffectedBySideEffect() && a->Equals(b));
+}
+
+
// Returns true if two range boundaries refer to the same symbol.
static bool DependOnSameSymbol(const RangeBoundary& a, const RangeBoundary& b) {
- if (!a.IsSymbol() || !b.IsSymbol()) return false;
- if (a.symbol() == b.symbol()) return true;
-
- return !a.symbol()->AffectedBySideEffect() &&
- a.symbol()->Equals(b.symbol());
+ return a.IsSymbol() && b.IsSymbol() &&
+ AreEqualDefinitions(a.symbol(), b.symbol());
}
@@ -2449,12 +2468,6 @@
}
-static bool IsLengthOf(Definition* defn, Definition* array) {
- return IsArrayLength(defn) &&
- (defn->AsLoadField()->value()->definition() == array);
-}
-
-
void BinarySmiOpInstr::InferRange() {
// TODO(vegorov): canonicalize BinarySmiOp to always have constant on the
// right and a non-constant on the left.
@@ -2513,6 +2526,23 @@
}
break;
+ case Token::kBIT_AND:
+ if (Range::ConstantMin(right_range).value() >= 0) {
+ min = RangeBoundary::FromConstant(0);
+ max = Range::ConstantMax(right_range);
+ break;
+ }
+ if (Range::ConstantMin(left_range).value() >= 0) {
+ min = RangeBoundary::FromConstant(0);
+ max = Range::ConstantMax(left_range);
+ break;
+ }
+
+ if (range_ == NULL) {
+ range_ = Range::Unknown();
+ }
+ return;
+
default:
if (range_ == NULL) {
range_ = Range::Unknown();
@@ -2530,7 +2560,15 @@
}
-bool CheckArrayBoundInstr::IsRedundant() {
+// Inclusive.
+bool Range::IsWithin(intptr_t min_int, intptr_t max_int) const {
+ if (min().LowerBound().value() < min_int) return false;
+ if (max().UpperBound().value() > max_int) return false;
+ return true;
+}
+
+
+bool CheckArrayBoundInstr::IsRedundant(RangeBoundary length) {
// Check that array has an immutable length.
if ((array_type() != kArrayCid) && (array_type() != kImmutableArrayCid)) {
return false;
@@ -2546,13 +2584,21 @@
RangeBoundary max = CanonicalizeBoundary(index_range->max(),
RangeBoundary::OverflowedMaxSmi());
+
+ if (max.Overflowed()) return false;
+
+ // Try to compare constant boundaries.
+ if (max.UpperBound().value() < length.LowerBound().value()) {
+ return true;
+ }
+
+ length = CanonicalizeBoundary(length, RangeBoundary::OverflowedMaxSmi());
+ if (length.Overflowed()) return false;
+
+ // Try symbolic comparison.
do {
- if (max.IsSymbol() &&
- (max.offset() < 0) &&
- IsLengthOf(max.symbol(), array()->definition())) {
- return true;
- }
- } while (CanonicalizeMaxBoundary(&max));
+ if (DependOnSameSymbol(max, length)) return max.offset() < length.offset();
+ } while (CanonicalizeMaxBoundary(&max) || CanonicalizeMinBoundary(&length));
// Failed to prove that maximum is bounded with array length.
return false;
diff --git a/runtime/vm/intermediate_language.h b/runtime/vm/intermediate_language.h
index 646eeba..0bd4fde 100644
--- a/runtime/vm/intermediate_language.h
+++ b/runtime/vm/intermediate_language.h
@@ -1177,6 +1177,7 @@
// Phi is alive if it reaches a non-environment use.
bool is_alive() const { return is_alive_; }
void mark_alive() { is_alive_ = true; }
+ void mark_dead() { is_alive_ = false; }
virtual Representation RequiredInputRepresentation(intptr_t i) const {
return representation_;
@@ -1606,7 +1607,7 @@
static RangeBoundary Max(RangeBoundary a, RangeBoundary b);
bool Overflowed() const {
- return !Smi::IsValid(value());
+ return IsConstant() && !Smi::IsValid(value());
}
RangeBoundary Clamp() const {
@@ -1690,8 +1691,8 @@
void PrintTo(BufferFormatter* f) const;
static const char* ToCString(Range* range);
- const RangeBoundary& min() { return min_; }
- const RangeBoundary& max() { return max_; }
+ const RangeBoundary& min() const { return min_; }
+ const RangeBoundary& max() const { return max_; }
bool Equals(Range* other) {
return min_.Equals(other->min_) && max_.Equals(other->max_);
@@ -1707,6 +1708,9 @@
return range->max().UpperBound();
}
+ // Inclusive.
+ bool IsWithin(intptr_t min_int, intptr_t max_int) const;
+
private:
RangeBoundary min_;
RangeBoundary max_;
@@ -2281,6 +2285,8 @@
return kTagged;
}
+ bool IsPolymorphic() const;
+
private:
const ICData* ic_data_;
const intptr_t token_pos_;
@@ -2325,10 +2331,12 @@
virtual bool CanDeoptimize() const {
return (operands_class_id() != kDoubleCid)
+ && (operands_class_id() != kMintCid)
&& (operands_class_id() != kSmiCid);
}
virtual bool HasSideEffect() const {
return (operands_class_id() != kDoubleCid)
+ && (operands_class_id() != kMintCid)
&& (operands_class_id() != kSmiCid);
}
@@ -2344,7 +2352,9 @@
virtual Representation RequiredInputRepresentation(intptr_t idx) const {
ASSERT((idx == 0) || (idx == 1));
- return (operands_class_id() == kDoubleCid) ? kUnboxedDouble : kTagged;
+ if (operands_class_id() == kDoubleCid) return kUnboxedDouble;
+ if (operands_class_id() == kMintCid) return kUnboxedMint;
+ return kTagged;
}
private:
@@ -2366,7 +2376,8 @@
function_(function),
argument_names_(argument_names),
arguments_(arguments),
- result_cid_(kDynamicCid) {
+ result_cid_(kDynamicCid),
+ is_known_constructor_(false) {
ASSERT(function.IsZoneHandle());
ASSERT(argument_names.IsZoneHandle());
}
@@ -2393,6 +2404,11 @@
virtual intptr_t ResultCid() const { return result_cid_; }
void set_result_cid(intptr_t value) { result_cid_ = value; }
+ bool is_known_constructor() const { return is_known_constructor_; }
+ void set_is_known_constructor(bool is_known_constructor) {
+ is_known_constructor_ = is_known_constructor;
+ }
+
private:
const intptr_t token_pos_;
const Function& function_;
@@ -2400,6 +2416,10 @@
ZoneGrowableArray<PushArgumentInstr*>* arguments_;
intptr_t result_cid_; // For some library functions we know the result.
+ // Some library constructors have known semantics.
+ bool is_known_constructor_;
+
+
DISALLOW_COPY_AND_ASSIGN(StaticCallInstr);
};
@@ -3955,7 +3975,7 @@
intptr_t array_type() const { return array_type_; }
- bool IsRedundant();
+ bool IsRedundant(RangeBoundary length);
private:
intptr_t array_type_;
diff --git a/runtime/vm/intermediate_language_ia32.cc b/runtime/vm/intermediate_language_ia32.cc
index b1e67f4..cabafbe 100644
--- a/runtime/vm/intermediate_language_ia32.cc
+++ b/runtime/vm/intermediate_language_ia32.cc
@@ -21,6 +21,7 @@
DECLARE_FLAG(int, optimization_counter_threshold);
DECLARE_FLAG(bool, trace_functions);
+DECLARE_FLAG(bool, propagate_ic_data);
// Generic summary for call instructions that have all arguments pushed
// on the stack and return the result in a fixed register EAX.
@@ -310,7 +311,7 @@
locs->set_out(Location::RequiresRegister());
return locs;
}
- if (HasICData() && (ic_data()->NumberOfChecks() > 0)) {
+ if (IsPolymorphic()) {
const intptr_t kNumTemps = 1;
LocationSummary* locs =
new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall);
@@ -335,7 +336,8 @@
intptr_t deopt_id,
intptr_t token_pos,
Token::Kind kind,
- LocationSummary* locs) {
+ LocationSummary* locs,
+ const ICData& original_ic_data) {
if (!compiler->is_optimizing()) {
compiler->AddCurrentDescriptor(PcDescriptors::kDeoptBefore,
deopt_id,
@@ -354,27 +356,56 @@
__ cmpl(Address(ESP, 1 * kWordSize), raw_null);
__ j(EQUAL, &check_identity, Assembler::kNearJump);
- const ICData& ic_data = compiler->GenerateInstanceCall(deopt_id,
- token_pos,
- operator_name,
- kNumberOfArguments,
- kNoArgumentNames,
- kNumArgumentsChecked,
- locs);
+ ICData& equality_ic_data = ICData::ZoneHandle();
+ if (compiler->is_optimizing() && FLAG_propagate_ic_data) {
+ ASSERT(!original_ic_data.IsNull());
+ equality_ic_data = original_ic_data.AsUnaryClassChecks();
+ } else {
+ equality_ic_data = ICData::New(compiler->parsed_function().function(),
+ operator_name,
+ deopt_id,
+ kNumArgumentsChecked);
+ }
+ compiler->GenerateInstanceCall(deopt_id,
+ token_pos,
+ kNumberOfArguments,
+ kNoArgumentNames,
+ locs,
+ equality_ic_data);
Label check_ne;
__ jmp(&check_ne);
__ Bind(&check_identity);
- // Call stub, load IC data in register. The stub will update ICData if
- // necessary.
- Register ic_data_reg = locs->temp(0).reg();
- ASSERT(ic_data_reg == ECX); // Stub depends on it.
- __ LoadObject(ic_data_reg, ic_data);
- compiler->GenerateCall(token_pos,
- &StubCode::EqualityWithNullArgLabel(),
- PcDescriptors::kOther,
- locs);
- __ Drop(2);
+ Label equality_done;
+ if (compiler->is_optimizing()) {
+ // No need to update IC data.
+ Label is_true;
+ __ popl(EAX);
+ __ popl(EDX);
+ __ cmpl(EAX, EDX);
+ __ j(EQUAL, &is_true);
+ __ LoadObject(EAX, (kind == Token::kEQ) ? compiler->bool_false()
+ : compiler->bool_true());
+ __ jmp(&equality_done);
+ __ Bind(&is_true);
+ __ LoadObject(EAX, (kind == Token::kEQ) ? compiler->bool_true()
+ : compiler->bool_false());
+ if (kind == Token::kNE) {
+ // Skip not-equal result conversion.
+ __ jmp(&equality_done);
+ }
+ } else {
+ // Call stub, load IC data in register. The stub will update ICData if
+ // necessary.
+ Register ic_data_reg = locs->temp(0).reg();
+ ASSERT(ic_data_reg == ECX); // Stub depends on it.
+ __ LoadObject(ic_data_reg, equality_ic_data);
+ compiler->GenerateCall(token_pos,
+ &StubCode::EqualityWithNullArgLabel(),
+ PcDescriptors::kOther,
+ locs);
+ __ Drop(2);
+ }
__ Bind(&check_ne);
if (kind == Token::kNE) {
Label false_label, true_label, done;
@@ -388,6 +419,7 @@
__ LoadObject(EAX, compiler->bool_false());
__ Bind(&done);
}
+ __ Bind(&equality_done);
}
@@ -645,8 +677,12 @@
switch (kind) {
case Token::kEQ: return EQUAL;
case Token::kNE: return NOT_EQUAL;
+ case Token::kLT: return LESS;
+ case Token::kGT: return GREATER;
+ case Token::kLTE: return LESS_EQUAL;
+ case Token::kGTE: return GREATER_EQUAL;
default:
- UNIMPLEMENTED();
+ UNREACHABLE();
return OVERFLOW;
}
}
@@ -682,6 +718,71 @@
}
+static void EmitUnboxedMintComparisonOp(FlowGraphCompiler* compiler,
+ const LocationSummary& locs,
+ Token::Kind kind,
+ BranchInstr* branch) {
+ XmmRegister left = locs.in(0).xmm_reg();
+ XmmRegister right = locs.in(1).xmm_reg();
+ Register left_tmp = locs.temp(0).reg();
+ Register right_tmp = locs.temp(1).reg();
+ Register result = branch == NULL ? locs.out().reg() : kNoRegister;
+
+ Condition hi_cond = OVERFLOW, lo_cond = OVERFLOW;
+ switch (kind) {
+ case Token::kLT:
+ hi_cond = LESS;
+ lo_cond = BELOW;
+ break;
+ case Token::kGT:
+ hi_cond = GREATER;
+ lo_cond = ABOVE;
+ break;
+ case Token::kLTE:
+ hi_cond = LESS;
+ lo_cond = BELOW_EQUAL;
+ break;
+ case Token::kGTE:
+ hi_cond = GREATER;
+ lo_cond = ABOVE_EQUAL;
+ break;
+ default:
+ break;
+ }
+ ASSERT(hi_cond != OVERFLOW && lo_cond != OVERFLOW);
+ Label is_true, is_false;
+ // Compare upper halves first.
+ __ pextrd(left_tmp, left, Immediate(1));
+ __ pextrd(right_tmp, right, Immediate(1));
+ __ cmpl(left_tmp, right_tmp);
+ if (branch != NULL) {
+ __ j(hi_cond, compiler->GetBlockLabel(branch->true_successor()));
+ __ j(FlowGraphCompiler::FlipCondition(hi_cond),
+ compiler->GetBlockLabel(branch->false_successor()));
+ } else {
+ __ j(hi_cond, &is_true);
+ __ j(FlowGraphCompiler::FlipCondition(hi_cond), &is_false);
+ }
+
+ // If upper is equal, compare lower half.
+ __ pextrd(left_tmp, left, Immediate(0));
+ __ pextrd(right_tmp, right, Immediate(0));
+ __ cmpl(left_tmp, right_tmp);
+ if (branch != NULL) {
+ branch->EmitBranchOnCondition(compiler, lo_cond);
+ } else {
+ Label done;
+ __ j(lo_cond, &is_true);
+ __ Bind(&is_false);
+ __ LoadObject(result, compiler->bool_false());
+ __ jmp(&done);
+ __ Bind(&is_true);
+ __ LoadObject(result, compiler->bool_true());
+ __ Bind(&done);
+ }
+}
+
+
static Condition TokenKindToDoubleCondition(Token::Kind kind) {
switch (kind) {
case Token::kEQ: return EQUAL;
@@ -738,7 +839,7 @@
deopt_id());
return;
}
- if (HasICData() && (ic_data()->NumberOfChecks() > 0)) {
+ if (IsPolymorphic()) {
EmitGenericEqualityCompare(compiler, locs(), kind(), kNoBranch, *ic_data(),
deopt_id(), token_pos());
return;
@@ -747,7 +848,12 @@
Register right = locs()->in(1).reg();
__ pushl(left);
__ pushl(right);
- EmitEqualityAsInstanceCall(compiler, deopt_id(), token_pos(), kind(), locs());
+ EmitEqualityAsInstanceCall(compiler,
+ deopt_id(),
+ token_pos(),
+ kind(),
+ locs(),
+ *ic_data());
ASSERT(locs()->out().reg() == EAX);
}
@@ -775,7 +881,7 @@
deopt_id());
return;
}
- if (HasICData() && (ic_data()->NumberOfChecks() > 0)) {
+ if (IsPolymorphic()) {
EmitGenericEqualityCompare(compiler, locs(), kind(), branch, *ic_data(),
deopt_id(), token_pos());
return;
@@ -788,7 +894,8 @@
deopt_id(),
token_pos(),
Token::kEQ, // kNE reverse occurs at branch.
- locs());
+ locs(),
+ *ic_data());
if (branch->is_checked()) {
EmitAssertBoolean(EAX, token_pos(), locs(), compiler);
}
@@ -801,6 +908,17 @@
LocationSummary* RelationalOpInstr::MakeLocationSummary() const {
const intptr_t kNumInputs = 2;
const intptr_t kNumTemps = 0;
+ if (operands_class_id() == kMintCid) {
+ const intptr_t kNumTemps = 2;
+ LocationSummary* locs =
+ new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
+ locs->set_in(0, Location::RequiresXmmRegister());
+ locs->set_in(1, Location::RequiresXmmRegister());
+ locs->set_temp(0, Location::RequiresRegister());
+ locs->set_temp(1, Location::RequiresRegister());
+ locs->set_out(Location::RequiresRegister());
+ return locs;
+ }
if (operands_class_id() == kDoubleCid) {
LocationSummary* summary =
new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
@@ -831,6 +949,10 @@
EmitSmiComparisonOp(compiler, *locs(), kind(), NULL);
return;
}
+ if (operands_class_id() == kMintCid) {
+ EmitUnboxedMintComparisonOp(compiler, *locs(), kind(), NULL);
+ return;
+ }
if (operands_class_id() == kDoubleCid) {
EmitDoubleComparisonOp(compiler, *locs(), kind(), NULL);
return;
@@ -874,13 +996,22 @@
}
const intptr_t kNumArguments = 2;
const intptr_t kNumArgsChecked = 2; // Type-feedback.
+ ICData& relational_ic_data = ICData::ZoneHandle(ic_data()->raw());
+ if (compiler->is_optimizing() && FLAG_propagate_ic_data) {
+ ASSERT(!ic_data()->IsNull());
+ relational_ic_data = ic_data()->AsUnaryClassChecks();
+ } else {
+ relational_ic_data = ICData::New(compiler->parsed_function().function(),
+ function_name,
+ deopt_id(),
+ kNumArgsChecked);
+ }
compiler->GenerateInstanceCall(deopt_id(),
token_pos(),
- function_name,
kNumArguments,
Array::ZoneHandle(), // No optional arguments.
- kNumArgsChecked,
- locs());
+ locs(),
+ relational_ic_data);
}
@@ -890,6 +1021,10 @@
EmitSmiComparisonOp(compiler, *locs(), kind(), branch);
return;
}
+ if (operands_class_id() == kMintCid) {
+ EmitUnboxedMintComparisonOp(compiler, *locs(), kind(), branch);
+ return;
+ }
if (operands_class_id() == kDoubleCid) {
EmitDoubleComparisonOp(compiler, *locs(), kind(), branch);
return;
@@ -1738,9 +1873,14 @@
Label call_method, done;
// Check if count too large for handling it inlined.
__ movl(temp, left);
- __ cmpl(right,
+ Range* right_range = this->right()->definition()->range();
+ const bool right_needs_check =
+ (right_range == NULL) || !right_range->IsWithin(0, (Smi::kBits - 1));
+ if (right_needs_check) {
+ __ cmpl(right,
Immediate(reinterpret_cast<int32_t>(Smi::New(Smi::kBits))));
- __ j(ABOVE_EQUAL, &call_method, Assembler::kNearJump);
+ __ j(ABOVE_EQUAL, &call_method, Assembler::kNearJump);
+ }
Register right_temp = locs()->temp(1).reg();
ASSERT(right_temp == ECX); // Count must be in ECX
__ movl(right_temp, right);
@@ -2444,8 +2584,8 @@
Label* deopt = compiler->AddDeoptStub(deopt_id(),
kDeoptBinaryMintOp);
Label done, overflow;
- __ pextrd(lo, right, Immediate(0)); // Lower half left
- __ pextrd(hi, right, Immediate(1)); // Upper half left
+ __ pextrd(lo, right, Immediate(0)); // Lower half
+ __ pextrd(hi, right, Immediate(1)); // Upper half
__ subl(ESP, Immediate(2 * kWordSize));
__ movq(Address(ESP, 0), left);
if (op_kind() == Token::kADD) {
diff --git a/runtime/vm/intermediate_language_x64.cc b/runtime/vm/intermediate_language_x64.cc
index be5de5f..07e4cb4 100644
--- a/runtime/vm/intermediate_language_x64.cc
+++ b/runtime/vm/intermediate_language_x64.cc
@@ -21,6 +21,7 @@
DECLARE_FLAG(int, optimization_counter_threshold);
DECLARE_FLAG(bool, trace_functions);
+DECLARE_FLAG(bool, propagate_ic_data);
// Generic summary for call instructions that have all arguments pushed
// on the stack and return the result in a fixed register RAX.
@@ -308,7 +309,7 @@
locs->set_out(Location::RequiresRegister());
return locs;
}
- if (HasICData() && (ic_data()->NumberOfChecks() > 0)) {
+ if (IsPolymorphic()) {
const intptr_t kNumTemps = 1;
LocationSummary* locs =
new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall);
@@ -333,7 +334,8 @@
intptr_t deopt_id,
intptr_t token_pos,
Token::Kind kind,
- LocationSummary* locs) {
+ LocationSummary* locs,
+ const ICData& original_ic_data) {
if (!compiler->is_optimizing()) {
compiler->AddCurrentDescriptor(PcDescriptors::kDeoptBefore,
deopt_id,
@@ -351,27 +353,57 @@
__ j(EQUAL, &check_identity, Assembler::kNearJump);
__ cmpq(Address(RSP, 1 * kWordSize), raw_null);
__ j(EQUAL, &check_identity, Assembler::kNearJump);
- const ICData& ic_data = compiler->GenerateInstanceCall(deopt_id,
- token_pos,
- operator_name,
- kNumberOfArguments,
- kNoArgumentNames,
- kNumArgumentsChecked,
- locs);
+
+ ICData& equality_ic_data = ICData::ZoneHandle(original_ic_data.raw());
+ if (compiler->is_optimizing() && FLAG_propagate_ic_data) {
+ ASSERT(!original_ic_data.IsNull());
+ equality_ic_data = original_ic_data.AsUnaryClassChecks();
+ } else {
+ equality_ic_data = ICData::New(compiler->parsed_function().function(),
+ operator_name,
+ deopt_id,
+ kNumArgumentsChecked);
+ }
+ compiler->GenerateInstanceCall(deopt_id,
+ token_pos,
+ kNumberOfArguments,
+ kNoArgumentNames,
+ locs,
+ equality_ic_data);
Label check_ne;
__ jmp(&check_ne);
__ Bind(&check_identity);
- // Call stub, load IC data in register. The stub will update ICData if
- // necessary.
- Register ic_data_reg = locs->temp(0).reg();
- ASSERT(ic_data_reg == RBX); // Stub depends on it.
- __ LoadObject(ic_data_reg, ic_data);
- compiler->GenerateCall(token_pos,
- &StubCode::EqualityWithNullArgLabel(),
- PcDescriptors::kOther,
- locs);
- __ Drop(2);
+ Label equality_done;
+ if (compiler->is_optimizing()) {
+ // No need to update IC data.
+ Label is_true;
+ __ popq(RAX);
+ __ popq(RDX);
+ __ cmpq(RAX, RDX);
+ __ j(EQUAL, &is_true);
+ __ LoadObject(RAX, (kind == Token::kEQ) ? compiler->bool_false()
+ : compiler->bool_true());
+ __ jmp(&equality_done);
+ __ Bind(&is_true);
+ __ LoadObject(RAX, (kind == Token::kEQ) ? compiler->bool_true()
+ : compiler->bool_false());
+ if (kind == Token::kNE) {
+ // Skip not-equal result conversion.
+ __ jmp(&equality_done);
+ }
+ } else {
+ // Call stub, load IC data in register. The stub will update ICData if
+ // necessary.
+ Register ic_data_reg = locs->temp(0).reg();
+ ASSERT(ic_data_reg == RBX); // Stub depends on it.
+ __ LoadObject(ic_data_reg, equality_ic_data);
+ compiler->GenerateCall(token_pos,
+ &StubCode::EqualityWithNullArgLabel(),
+ PcDescriptors::kOther,
+ locs);
+ __ Drop(2);
+ }
__ Bind(&check_ne);
if (kind == Token::kNE) {
Label false_label, true_label, done;
@@ -385,6 +417,7 @@
__ LoadObject(RAX, compiler->bool_false());
__ Bind(&done);
}
+ __ Bind(&equality_done);
}
@@ -692,7 +725,7 @@
deopt_id());
return;
}
- if (HasICData() && (ic_data()->NumberOfChecks() > 0)) {
+ if (IsPolymorphic()) {
EmitGenericEqualityCompare(compiler, locs(), kind(), kNoBranch, *ic_data(),
deopt_id(), token_pos());
return;
@@ -705,7 +738,8 @@
deopt_id(),
token_pos(),
kind(),
- locs());
+ locs(),
+ *ic_data());
ASSERT(locs()->out().reg() == RAX);
}
@@ -730,7 +764,7 @@
deopt_id());
return;
}
- if (HasICData() && (ic_data()->NumberOfChecks() > 0)) {
+ if (IsPolymorphic()) {
EmitGenericEqualityCompare(compiler, locs(), kind(), branch, *ic_data(),
deopt_id(), token_pos());
return;
@@ -743,7 +777,8 @@
deopt_id(),
token_pos(),
Token::kEQ, // kNE reverse occurs at branch.
- locs());
+ locs(),
+ *ic_data());
if (branch->is_checked()) {
EmitAssertBoolean(RAX, token_pos(), locs(), compiler);
}
@@ -830,13 +865,22 @@
}
const intptr_t kNumArguments = 2;
const intptr_t kNumArgsChecked = 2; // Type-feedback.
+ ICData& relational_ic_data = ICData::ZoneHandle(ic_data()->raw());
+ if (compiler->is_optimizing() && FLAG_propagate_ic_data) {
+ ASSERT(!ic_data()->IsNull());
+ relational_ic_data = ic_data()->AsUnaryClassChecks();
+ } else {
+ relational_ic_data = ICData::New(compiler->parsed_function().function(),
+ function_name,
+ deopt_id(),
+ kNumArgsChecked);
+ }
compiler->GenerateInstanceCall(deopt_id(),
token_pos(),
- function_name,
kNumArguments,
Array::ZoneHandle(), // No optional arguments.
- kNumArgsChecked,
- locs());
+ locs(),
+ relational_ic_data);
}
@@ -1703,9 +1747,14 @@
Label call_method, done;
// Check if count too large for handling it inlined.
__ movq(temp, left);
- __ cmpq(right,
- Immediate(reinterpret_cast<int64_t>(Smi::New(Smi::kBits))));
- __ j(ABOVE_EQUAL, &call_method, Assembler::kNearJump);
+ Range* right_range = this->right()->definition()->range();
+ const bool right_needs_check =
+ (right_range == NULL) || !right_range->IsWithin(0, (Smi::kBits - 1));
+ if (right_needs_check) {
+ __ cmpq(right,
+ Immediate(reinterpret_cast<int64_t>(Smi::New(Smi::kBits))));
+ __ j(ABOVE_EQUAL, &call_method, Assembler::kNearJump);
+ }
Register right_temp = locs()->temp(1).reg();
ASSERT(right_temp == RCX); // Count must be in RCX
__ movq(right_temp, right);
diff --git a/runtime/vm/intrinsifier_ia32.cc b/runtime/vm/intrinsifier_ia32.cc
index afdfff7..cf47309 100644
--- a/runtime/vm/intrinsifier_ia32.cc
+++ b/runtime/vm/intrinsifier_ia32.cc
@@ -175,9 +175,9 @@
static intptr_t ComputeObjectArrayTypeArgumentsOffset() {
const String& class_name = String::Handle(Symbols::New("_ObjectArray"));
- const Library& coreimpl_lib = Library::Handle(Library::CoreImplLibrary());
+ const Library& core_lib = Library::Handle(Library::CoreLibrary());
const Class& cls =
- Class::Handle(coreimpl_lib.LookupClassAllowPrivate(class_name));
+ Class::Handle(core_lib.LookupClassAllowPrivate(class_name));
ASSERT(!cls.IsNull());
ASSERT(cls.HasTypeArguments());
ASSERT(cls.NumTypeArguments() == 1);
@@ -252,9 +252,9 @@
const char* field_name_p) {
const String& class_name = String::Handle(Symbols::New(class_name_p));
const String& field_name = String::Handle(Symbols::New(field_name_p));
- const Library& coreimpl_lib = Library::Handle(Library::CoreImplLibrary());
+ const Library& core_lib = Library::Handle(Library::CoreLibrary());
const Class& cls =
- Class::Handle(coreimpl_lib.LookupClassAllowPrivate(class_name));
+ Class::Handle(core_lib.LookupClassAllowPrivate(class_name));
ASSERT(!cls.IsNull());
const Field& field = Field::ZoneHandle(cls.LookupInstanceField(field_name));
ASSERT(!field.IsNull());
diff --git a/runtime/vm/intrinsifier_x64.cc b/runtime/vm/intrinsifier_x64.cc
index affbf67..5f3f96d 100644
--- a/runtime/vm/intrinsifier_x64.cc
+++ b/runtime/vm/intrinsifier_x64.cc
@@ -1409,9 +1409,9 @@
const char* field_name_p) {
const String& class_name = String::Handle(Symbols::New(class_name_p));
const String& field_name = String::Handle(Symbols::New(field_name_p));
- const Library& coreimpl_lib = Library::Handle(Library::CoreImplLibrary());
+ const Library& core_lib = Library::Handle(Library::CoreLibrary());
const Class& cls =
- Class::Handle(coreimpl_lib.LookupClassAllowPrivate(class_name));
+ Class::Handle(core_lib.LookupClassAllowPrivate(class_name));
ASSERT(!cls.IsNull());
const Field& field = Field::ZoneHandle(cls.LookupInstanceField(field_name));
ASSERT(!field.IsNull());
diff --git a/runtime/vm/isolate.cc b/runtime/vm/isolate.cc
index df2b538..84263f5 100644
--- a/runtime/vm/isolate.cc
+++ b/runtime/vm/isolate.cc
@@ -311,12 +311,12 @@
ICData* Isolate::GetICDataForDeoptId(intptr_t deopt_id) const {
if (ic_data_array() == Array::null()) {
- return NULL;
+ return &ICData::ZoneHandle();
}
const Array& array_handle = Array::Handle(ic_data_array());
if (deopt_id >= array_handle.Length()) {
// For computations being added in the optimizing compiler.
- return NULL;
+ return &ICData::ZoneHandle();
}
ICData& ic_data_handle = ICData::ZoneHandle();
ic_data_handle ^= array_handle.At(deopt_id);
diff --git a/runtime/vm/isolate_test.cc b/runtime/vm/isolate_test.cc
index 3d626f7..2aadf6d 100644
--- a/runtime/vm/isolate_test.cc
+++ b/runtime/vm/isolate_test.cc
@@ -34,7 +34,7 @@
" return 0;\n"
"}\n";
Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
- Dart_Handle result = Dart_Invoke(lib, Dart_NewString("testMain"), 0, NULL);
+ Dart_Handle result = Dart_Invoke(lib, NewString("testMain"), 0, NULL);
EXPECT_ERROR(result, "Null callback specified for isolate creation");
EXPECT(Dart_ErrorHasException(result));
Dart_Handle exception_result = Dart_ErrorGetException(result);
diff --git a/runtime/vm/message.cc b/runtime/vm/message.cc
index 7051bd9..807de7e 100644
--- a/runtime/vm/message.cc
+++ b/runtime/vm/message.cc
@@ -6,8 +6,6 @@
namespace dart {
-DECLARE_FLAG(bool, trace_isolates);
-
MessageQueue::MessageQueue() {
head_ = NULL;
tail_ = NULL;
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index b8cb196..342bbca 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -37,9 +37,6 @@
DEFINE_FLAG(bool, generate_gdb_symbols, false,
"Generate symbols of generated dart functions for debugging with GDB");
-DEFINE_FLAG(bool, reject_named_argument_as_positional, true,
- "Enforce new rules for optional parameters and disallow passing of named "
- "arguments to optional positional formal parameters");
DEFINE_FLAG(bool, show_internal_names, false,
"Show names of internal classes (e.g. \"OneByteString\") in error messages "
"instead of showing the corresponding interface names (e.g. \"String\")");
@@ -588,12 +585,12 @@
cls = object_store->array_class(); // Was allocated above.
name = Symbols::ObjectArray();
- RegisterPrivateClass(cls, name, core_impl_lib);
+ RegisterPrivateClass(cls, name, core_lib);
pending_classes.Add(cls, Heap::kOld);
cls = object_store->growable_object_array_class(); // Was allocated above.
name = Symbols::GrowableObjectArray();
- RegisterPrivateClass(cls, name, core_impl_lib);
+ RegisterPrivateClass(cls, name, core_lib);
pending_classes.Add(cls, Heap::kOld);
cls = Class::New<ImmutableArray>();
@@ -601,42 +598,30 @@
cls.set_type_arguments_instance_field_offset(Array::type_arguments_offset());
ASSERT(object_store->immutable_array_class() != object_store->array_class());
name = Symbols::ImmutableArray();
- RegisterPrivateClass(cls, name, core_impl_lib);
+ RegisterPrivateClass(cls, name, core_lib);
pending_classes.Add(cls, Heap::kOld);
cls = object_store->one_byte_string_class(); // Was allocated above.
name = Symbols::OneByteString();
- RegisterPrivateClass(cls, name, core_impl_lib);
+ RegisterPrivateClass(cls, name, core_lib);
pending_classes.Add(cls, Heap::kOld);
cls = Class::New<TwoByteString>();
object_store->set_two_byte_string_class(cls);
name = Symbols::TwoByteString();
- RegisterPrivateClass(cls, name, core_impl_lib);
- pending_classes.Add(cls, Heap::kOld);
-
- cls = Class::New<FourByteString>();
- object_store->set_four_byte_string_class(cls);
- name = Symbols::FourByteString();
- RegisterPrivateClass(cls, name, core_impl_lib);
+ RegisterPrivateClass(cls, name, core_lib);
pending_classes.Add(cls, Heap::kOld);
cls = Class::New<ExternalOneByteString>();
object_store->set_external_one_byte_string_class(cls);
name = Symbols::ExternalOneByteString();
- RegisterPrivateClass(cls, name, core_impl_lib);
+ RegisterPrivateClass(cls, name, core_lib);
pending_classes.Add(cls, Heap::kOld);
cls = Class::New<ExternalTwoByteString>();
object_store->set_external_two_byte_string_class(cls);
name = Symbols::ExternalTwoByteString();
- RegisterPrivateClass(cls, name, core_impl_lib);
- pending_classes.Add(cls, Heap::kOld);
-
- cls = Class::New<ExternalFourByteString>();
- object_store->set_external_four_byte_string_class(cls);
- name = Symbols::ExternalFourByteString();
- RegisterPrivateClass(cls, name, core_impl_lib);
+ RegisterPrivateClass(cls, name, core_lib);
pending_classes.Add(cls, Heap::kOld);
cls = Class::New<Stacktrace>();
@@ -925,6 +910,15 @@
if (!error.IsNull()) {
return error.raw();
}
+ const Script& collection_script =
+ Script::Handle(Bootstrap::LoadCollectionScript(false));
+ const Library& collection_lib =
+ Library::Handle(Library::CollectionLibrary());
+ ASSERT(!collection_lib.IsNull());
+ error = Bootstrap::Compile(collection_lib, collection_script);
+ if (!error.IsNull()) {
+ return error.raw();
+ }
const Script& math_script = Script::Handle(Bootstrap::LoadMathScript(false));
const Library& math_lib = Library::Handle(Library::MathLibrary());
ASSERT(!math_lib.IsNull());
@@ -1097,18 +1091,12 @@
cls = Class::New<TwoByteString>();
object_store->set_two_byte_string_class(cls);
- cls = Class::New<FourByteString>();
- object_store->set_four_byte_string_class(cls);
-
cls = Class::New<ExternalOneByteString>();
object_store->set_external_one_byte_string_class(cls);
cls = Class::New<ExternalTwoByteString>();
object_store->set_external_two_byte_string_class(cls);
- cls = Class::New<ExternalFourByteString>();
- object_store->set_external_four_byte_string_class(cls);
-
cls = Class::New<Bool>();
object_store->set_bool_class(cls);
@@ -1241,10 +1229,8 @@
return Symbols::New("double");
case kOneByteStringCid:
case kTwoByteStringCid:
- case kFourByteStringCid:
case kExternalOneByteStringCid:
case kExternalTwoByteStringCid:
- case kExternalFourByteStringCid:
return Symbols::New("String");
case kArrayCid:
case kImmutableArrayCid:
@@ -3413,80 +3399,23 @@
bool Function::AreValidArgumentCounts(int num_arguments,
int num_named_arguments,
String* error_message) const {
- if (FLAG_reject_named_argument_as_positional) {
- if (num_named_arguments > NumOptionalNamedParameters()) {
- if (error_message != NULL) {
- const intptr_t kMessageBufferSize = 64;
- char message_buffer[kMessageBufferSize];
- OS::SNPrint(message_buffer,
- kMessageBufferSize,
- "%d named passed, at most %"Pd" expected",
- num_named_arguments,
- NumOptionalNamedParameters());
- *error_message = String::New(message_buffer);
- }
- return false; // Too many named arguments.
- }
- const int num_pos_args = num_arguments - num_named_arguments;
- const int num_opt_pos_params = NumOptionalPositionalParameters();
- const int num_pos_params = num_fixed_parameters() + num_opt_pos_params;
- if (num_pos_args > num_pos_params) {
- if (error_message != NULL) {
- const intptr_t kMessageBufferSize = 64;
- char message_buffer[kMessageBufferSize];
- // Hide implicit parameters to the user.
- const intptr_t num_hidden_params = NumImplicitParameters();
- OS::SNPrint(message_buffer,
- kMessageBufferSize,
- "%"Pd"%s passed, %s%"Pd" expected",
- num_pos_args - num_hidden_params,
- num_opt_pos_params > 0 ? " positional" : "",
- num_opt_pos_params > 0 ? "at most " : "",
- num_pos_params - num_hidden_params);
- *error_message = String::New(message_buffer);
- }
- return false; // Too many fixed and/or positional arguments.
- }
- if (num_pos_args < num_fixed_parameters()) {
- if (error_message != NULL) {
- const intptr_t kMessageBufferSize = 64;
- char message_buffer[kMessageBufferSize];
- // Hide implicit parameters to the user.
- const intptr_t num_hidden_params = NumImplicitParameters();
- OS::SNPrint(message_buffer,
- kMessageBufferSize,
- "%"Pd"%s passed, %s%"Pd" expected",
- num_pos_args - num_hidden_params,
- num_opt_pos_params > 0 ? " positional" : "",
- num_opt_pos_params > 0 ? "at least " : "",
- num_fixed_parameters() - num_hidden_params);
- *error_message = String::New(message_buffer);
- }
- return false; // Too few fixed and/or positional arguments.
- }
- return true;
- }
-
- // TODO(regis): Remove the following code once the flag is removed.
-
- if (num_arguments > NumParameters()) {
+ if (num_named_arguments > NumOptionalNamedParameters()) {
if (error_message != NULL) {
const intptr_t kMessageBufferSize = 64;
char message_buffer[kMessageBufferSize];
- // Hide implicit parameters to the user.
- const intptr_t num_hidden_params = NumImplicitParameters();
OS::SNPrint(message_buffer,
kMessageBufferSize,
- "%"Pd" passed, %s%"Pd" expected",
- num_arguments - num_hidden_params,
- HasOptionalParameters() ? "at most " : "",
- NumParameters() - num_hidden_params);
+ "%d named passed, at most %"Pd" expected",
+ num_named_arguments,
+ NumOptionalNamedParameters());
*error_message = String::New(message_buffer);
}
- return false; // Too many arguments.
+ return false; // Too many named arguments.
}
- const int num_positional_args = num_arguments - num_named_arguments;
- if (num_positional_args < num_fixed_parameters()) {
+ const int num_pos_args = num_arguments - num_named_arguments;
+ const int num_opt_pos_params = NumOptionalPositionalParameters();
+ const int num_pos_params = num_fixed_parameters() + num_opt_pos_params;
+ if (num_pos_args > num_pos_params) {
if (error_message != NULL) {
const intptr_t kMessageBufferSize = 64;
char message_buffer[kMessageBufferSize];
@@ -3494,13 +3423,31 @@
const intptr_t num_hidden_params = NumImplicitParameters();
OS::SNPrint(message_buffer,
kMessageBufferSize,
- "%"Pd" %spassed, %"Pd" expected",
- num_positional_args - num_hidden_params,
- HasOptionalParameters() ? "positional " : "",
+ "%"Pd"%s passed, %s%"Pd" expected",
+ num_pos_args - num_hidden_params,
+ num_opt_pos_params > 0 ? " positional" : "",
+ num_opt_pos_params > 0 ? "at most " : "",
+ num_pos_params - num_hidden_params);
+ *error_message = String::New(message_buffer);
+ }
+ return false; // Too many fixed and/or positional arguments.
+ }
+ if (num_pos_args < num_fixed_parameters()) {
+ if (error_message != NULL) {
+ const intptr_t kMessageBufferSize = 64;
+ char message_buffer[kMessageBufferSize];
+ // Hide implicit parameters to the user.
+ const intptr_t num_hidden_params = NumImplicitParameters();
+ OS::SNPrint(message_buffer,
+ kMessageBufferSize,
+ "%"Pd"%s passed, %s%"Pd" expected",
+ num_pos_args - num_hidden_params,
+ num_opt_pos_params > 0 ? " positional" : "",
+ num_opt_pos_params > 0 ? "at least " : "",
num_fixed_parameters() - num_hidden_params);
*error_message = String::New(message_buffer);
}
- return false; // Too few arguments.
+ return false; // Too few fixed and/or positional arguments.
}
return true;
}
@@ -3616,63 +3563,35 @@
// compatible although it has an additional phase parameter.
const intptr_t num_ignored_params =
(other.IsRedirectingFactory() && IsConstructor()) ? 1 : 0;
- if (FLAG_reject_named_argument_as_positional) {
- // The default values of optional parameters can differ.
- if (((num_fixed_params - num_ignored_params) != other_num_fixed_params) ||
- (num_opt_pos_params < other_num_opt_pos_params) ||
- (num_opt_named_params < other_num_opt_named_params)) {
- return false;
- }
- if (other_num_opt_named_params == 0) {
- return true;
- }
- // Check that for each optional named parameter of the other function there
- // exists an optional named parameter of this function with an identical
- // name.
- // Note that SetParameterNameAt() guarantees that names are symbols, so we
- // can compare their raw pointers.
- const int num_params = num_fixed_params + num_opt_named_params;
- const int other_num_params =
- other_num_fixed_params + other_num_opt_named_params;
- bool found_param_name;
- String& other_param_name = String::Handle();
- for (intptr_t i = other_num_fixed_params; i < other_num_params; i++) {
- other_param_name = other.ParameterNameAt(i);
- found_param_name = false;
- for (intptr_t j = num_fixed_params; j < num_params; j++) {
- if (ParameterNameAt(j) == other_param_name.raw()) {
- found_param_name = true;
- break;
- }
- }
- if (!found_param_name) {
- return false;
- }
- }
- return true;
- }
-
- // TODO(regis): Remove the following code once the flag is removed.
-
// The default values of optional parameters can differ.
- const intptr_t num_opt_params = num_opt_pos_params + num_opt_named_params;
- const intptr_t other_num_opt_params =
- other_num_opt_pos_params + other_num_opt_named_params;
if (((num_fixed_params - num_ignored_params) != other_num_fixed_params) ||
- (num_opt_params < other_num_opt_params)) {
+ (num_opt_pos_params < other_num_opt_pos_params) ||
+ (num_opt_named_params < other_num_opt_named_params)) {
return false;
}
- // Check that for each optional named parameter of the other function there is
- // a corresponding optional named parameter of this function with an identical
- // name at the same position.
- // Note that SetParameterNameAt() guarantees that names are symbols, so we can
- // compare their raw pointers.
- const int other_num_params = other_num_fixed_params + other_num_opt_params;
+ if (other_num_opt_named_params == 0) {
+ return true;
+ }
+ // Check that for each optional named parameter of the other function there
+ // exists an optional named parameter of this function with an identical
+ // name.
+ // Note that SetParameterNameAt() guarantees that names are symbols, so we
+ // can compare their raw pointers.
+ const int num_params = num_fixed_params + num_opt_named_params;
+ const int other_num_params =
+ other_num_fixed_params + other_num_opt_named_params;
+ bool found_param_name;
+ String& other_param_name = String::Handle();
for (intptr_t i = other_num_fixed_params; i < other_num_params; i++) {
- const String& other_param_name = String::Handle(other.ParameterNameAt(i));
- ASSERT(other_param_name.IsSymbol());
- ASSERT(String::Handle(ParameterNameAt(i)).IsSymbol());
- if (ParameterNameAt(i) != other_param_name.raw()) {
+ other_param_name = other.ParameterNameAt(i);
+ found_param_name = false;
+ for (intptr_t j = num_fixed_params; j < num_params; j++) {
+ if (ParameterNameAt(j) == other_param_name.raw()) {
+ found_param_name = true;
+ break;
+ }
+ }
+ if (!found_param_name) {
return false;
}
}
@@ -3770,83 +3689,48 @@
}
}
}
- if (FLAG_reject_named_argument_as_positional) {
- // Check the types of fixed and optional positional parameters.
- for (intptr_t i = 0; i < num_fixed_params + other_num_opt_pos_params; i++) {
- if (!TestParameterType(test_kind,
- i, i, type_arguments, other, other_type_arguments,
- malformed_error)) {
- return false;
- }
- }
- // Check the names and types of optional named parameters.
- if (other_num_opt_named_params == 0) {
- return true;
- }
- // Check that for each optional named parameter of type T of the other
- // function type, there exists an optional named parameter of this function
- // type with an identical name and with a type S that is a either a subtype
- // or supertype of T (if test_kind == kIsSubtypeOf) or that is more specific
- // than T (if test_kind == kIsMoreSpecificThan).
- // Note that SetParameterNameAt() guarantees that names are symbols, so we
- // can compare their raw pointers.
- const int num_params = num_fixed_params + num_opt_named_params;
- const int other_num_params =
- other_num_fixed_params + other_num_opt_named_params;
- bool found_param_name;
- String& other_param_name = String::Handle();
- for (intptr_t i = other_num_fixed_params; i < other_num_params; i++) {
- other_param_name = other.ParameterNameAt(i);
- ASSERT(other_param_name.IsSymbol());
- found_param_name = false;
- for (intptr_t j = num_fixed_params; j < num_params; j++) {
- ASSERT(String::Handle(ParameterNameAt(j)).IsSymbol());
- if (ParameterNameAt(j) == other_param_name.raw()) {
- found_param_name = true;
- if (!TestParameterType(test_kind,
- j, i,
- type_arguments, other, other_type_arguments,
- malformed_error)) {
- return false;
- }
- break;
- }
- }
- if (!found_param_name) {
- return false;
- }
- }
- }
-
- // TODO(regis): Remove the following code once the flag is removed.
-
- // Check the types of fixed parameters.
- for (intptr_t i = 0; i < num_fixed_params; i++) {
+ // Check the types of fixed and optional positional parameters.
+ for (intptr_t i = 0; i < num_fixed_params + other_num_opt_pos_params; i++) {
if (!TestParameterType(test_kind,
i, i, type_arguments, other, other_type_arguments,
malformed_error)) {
return false;
}
}
- // Check the names and types of optional parameters.
+ // Check the names and types of optional named parameters.
+ if (other_num_opt_named_params == 0) {
+ return true;
+ }
// Check that for each optional named parameter of type T of the other
- // function type, there is a corresponding optional named parameter of this
- // function at the same position with an identical name and with a type S
- // that is a either a subtype or supertype of T (if test_kind == kIsSubtypeOf)
- // or that is more specific than T (if test_kind == kIsMoreSpecificThan).
+ // function type, there exists an optional named parameter of this function
+ // type with an identical name and with a type S that is a either a subtype
+ // or supertype of T (if test_kind == kIsSubtypeOf) or that is more specific
+ // than T (if test_kind == kIsMoreSpecificThan).
// Note that SetParameterNameAt() guarantees that names are symbols, so we
// can compare their raw pointers.
- const intptr_t other_num_params = other_num_fixed_params +
- other_num_opt_pos_params + other_num_opt_named_params;
+ const int num_params = num_fixed_params + num_opt_named_params;
+ const int other_num_params =
+ other_num_fixed_params + other_num_opt_named_params;
+ bool found_param_name;
String& other_param_name = String::Handle();
for (intptr_t i = other_num_fixed_params; i < other_num_params; i++) {
other_param_name = other.ParameterNameAt(i);
ASSERT(other_param_name.IsSymbol());
- ASSERT(String::Handle(ParameterNameAt(i)).IsSymbol());
- if ((ParameterNameAt(i) != other_param_name.raw()) ||
- !TestParameterType(test_kind,
- i, i, type_arguments, other, other_type_arguments,
- malformed_error)) {
+ found_param_name = false;
+ for (intptr_t j = num_fixed_params; j < num_params; j++) {
+ ASSERT(String::Handle(ParameterNameAt(j)).IsSymbol());
+ if (ParameterNameAt(j) == other_param_name.raw()) {
+ found_param_name = true;
+ if (!TestParameterType(test_kind,
+ j, i,
+ type_arguments, other, other_type_arguments,
+ malformed_error)) {
+ return false;
+ }
+ break;
+ }
+ }
+ if (!found_param_name) {
return false;
}
}
@@ -4017,14 +3901,15 @@
const String& kCommaSpace = String::Handle(Symbols::New(", "));
const String& kColonSpace = String::Handle(Symbols::New(": "));
const String& kLParen = String::Handle(Symbols::New("("));
- const String& kRParen = String::Handle(Symbols::New(") => "));
+ const String& kRParenArrow = String::Handle(Symbols::New(") => "));
const String& kLBracket = String::Handle(Symbols::New("["));
const String& kRBracket = String::Handle(Symbols::New("]"));
const String& kLBrace = String::Handle(Symbols::New("{"));
const String& kRBrace = String::Handle(Symbols::New("}"));
String& name = String::Handle();
- if (!instantiate && !is_static()) {
- // Prefix the signature with its type parameters, if any (e.g. "<K, V>").
+ if (!instantiate && !is_static() && (name_visibility == kInternalName)) {
+ // Prefix the signature with its class and type parameters, if any (e.g.
+ // "Map<K, V>(K) => bool").
// The signature of static functions cannot be type parameterized.
const String& kSpaceExtendsSpace =
String::Handle(Symbols::New(" extends "));
@@ -4035,6 +3920,8 @@
const TypeArguments& type_parameters = TypeArguments::Handle(
function_class.type_parameters());
if (!type_parameters.IsNull()) {
+ const String& function_class_name = String::Handle(function_class.Name());
+ pieces.Add(function_class_name);
intptr_t num_type_parameters = type_parameters.Length();
pieces.Add(kLAngleBracket);
TypeParameter& type_parameter = TypeParameter::Handle();
@@ -4044,7 +3931,7 @@
name = type_parameter.name();
pieces.Add(name);
bound = type_parameter.bound();
- if (!bound.IsNull() && !bound.IsDynamicType()) {
+ if (!bound.IsNull() && !bound.IsObjectType()) {
pieces.Add(kSpaceExtendsSpace);
name = bound.BuildName(name_visibility);
pieces.Add(name);
@@ -4085,8 +3972,7 @@
for (intptr_t i = num_fixed_params; i < num_params; i++) {
// The parameter name of an optional positional parameter does not need
// to be part of the signature, since it is not used.
- if (!FLAG_reject_named_argument_as_positional ||
- (num_opt_named_params > 0)) {
+ if (num_opt_named_params > 0) {
name = ParameterNameAt(i);
pieces.Add(name);
pieces.Add(kColonSpace);
@@ -4108,7 +3994,7 @@
pieces.Add(kRBrace);
}
}
- pieces.Add(kRParen);
+ pieces.Add(kRParenArrow);
AbstractType& res_type = AbstractType::Handle(result_type());
if (instantiate && !res_type.IsInstantiated()) {
res_type = res_type.InstantiateFrom(instantiator);
@@ -5941,8 +5827,15 @@
const Library& math_lib = Library::Handle(Library::MathLibrary());
const Namespace& math_ns = Namespace::Handle(
Namespace::New(math_lib, Array::Handle(), Array::Handle()));
+ Library::InitCollectionLibrary(isolate);
+ const Library& collection_lib =
+ Library::Handle(Library::CollectionLibrary());
+ const Namespace& collection_ns = Namespace::Handle(
+ Namespace::New(collection_lib, Array::Handle(), Array::Handle()));
core_lib.AddImport(math_ns);
core_impl_lib.AddImport(math_ns);
+ core_lib.AddImport(collection_ns);
+ core_impl_lib.AddImport(collection_ns);
isolate->object_store()->set_root_library(Library::Handle());
// Hook up predefined classes without setting their library pointers. These
@@ -5953,6 +5846,18 @@
}
+void Library::InitCollectionLibrary(Isolate* isolate) {
+ const String& url = String::Handle(Symbols::New("dart:collection"));
+ const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true));
+ lib.Register();
+ const Library& math_lib = Library::Handle(Library::MathLibrary());
+ const Namespace& math_ns = Namespace::Handle(
+ Namespace::New(math_lib, Array::Handle(), Array::Handle()));
+ lib.AddImport(math_ns);
+ isolate->object_store()->set_collection_library(lib);
+}
+
+
void Library::InitMathLibrary(Isolate* isolate) {
const String& url = String::Handle(Symbols::New("dart:math"));
const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true));
@@ -5994,10 +5899,11 @@
const String& url = String::Handle(Symbols::New("dart:scalarlist"));
const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true));
lib.Register();
- const Library& core_impl_lib = Library::Handle(Library::CoreImplLibrary());
- const Namespace& impl_ns = Namespace::Handle(
- Namespace::New(core_impl_lib, Array::Handle(), Array::Handle()));
- lib.AddImport(impl_ns);
+ const Library& collection_lib =
+ Library::Handle(Library::CollectionLibrary());
+ const Namespace& collection_ns = Namespace::Handle(
+ Namespace::New(collection_lib, Array::Handle(), Array::Handle()));
+ lib.AddImport(collection_ns);
isolate->object_store()->set_scalarlist_library(lib);
}
@@ -6115,6 +6021,11 @@
}
+RawLibrary* Library::CollectionLibrary() {
+ return Isolate::Current()->object_store()->collection_library();
+}
+
+
RawLibrary* Library::MathLibrary() {
return Isolate::Current()->object_store()->math_library();
}
@@ -6840,6 +6751,47 @@
}
+intptr_t DeoptInfo::TranslationLength() const {
+ intptr_t length = Length();
+ if (Instruction(length - 1) != DeoptInstr::kSuffix) return length;
+
+ // If the last command is a suffix, add in the length of the suffix and
+ // do not count the suffix command as a translation command.
+ intptr_t ignored = 0;
+ intptr_t suffix_length =
+ DeoptInstr::DecodeSuffix(FromIndex(length - 1), &ignored);
+ return length + suffix_length - 1;
+}
+
+
+void DeoptInfo::ToInstructions(const Array& table,
+ GrowableArray<DeoptInstr*>* instructions) const {
+ ASSERT(instructions->is_empty());
+ Smi& offset = Smi::Handle();
+ DeoptInfo& info = DeoptInfo::Handle(raw());
+ Smi& reason = Smi::Handle();
+ intptr_t index = 0;
+ intptr_t length = TranslationLength();
+ while (index < length) {
+ intptr_t instruction = info.Instruction(index);
+ intptr_t from_index = info.FromIndex(index);
+ if (instruction == DeoptInstr::kSuffix) {
+ // Suffix instructions cause us to 'jump' to another translation,
+ // changing info, length and index.
+ intptr_t info_number = 0;
+ intptr_t suffix_length =
+ DeoptInstr::DecodeSuffix(from_index, &info_number);
+ DeoptTable::GetEntry(table, info_number, &offset, &info, &reason);
+ length = info.TranslationLength();
+ index = length - suffix_length;
+ } else {
+ instructions->Add(DeoptInstr::Create(instruction, from_index));
+ ++index;
+ }
+ }
+}
+
+
const char* DeoptInfo::ToCString() const {
if (Length() == 0) {
return "No DeoptInfo";
@@ -9851,17 +9803,22 @@
bool String::Equals(const char* str) const {
+ ASSERT(str != NULL);
+ intptr_t len = strlen(str);
for (intptr_t i = 0; i < this->Length(); ++i) {
if (*str == '\0') {
// Lengths don't match.
return false;
}
int32_t ch;
- intptr_t consumed = Utf8::Decode(str, &ch);
+ intptr_t consumed = Utf8::Decode(reinterpret_cast<const uint8_t*>(str),
+ len,
+ &ch);
if (consumed == 0 || this->CharAt(i) != ch) {
return false;
}
str += consumed;
+ len -= consumed;
}
return *str == '\0';
}
@@ -9955,76 +9912,70 @@
RawString* String::New(const char* str, Heap::Space space) {
- intptr_t width = 0;
- intptr_t len = Utf8::CodePointCount(str, &width);
- if (width == 1) {
- const OneByteString& onestr
+ ASSERT(str != NULL);
+ intptr_t array_len = strlen(str);
+ const uint8_t* utf8_array = reinterpret_cast<const uint8_t*>(str);
+ return String::New(utf8_array, array_len, space);
+}
+
+
+RawString* String::New(const uint8_t* utf8_array,
+ intptr_t array_len,
+ Heap::Space space) {
+ Utf8::Type type;
+ intptr_t len = Utf8::CodePointCount(utf8_array, array_len, &type);
+ if (type == Utf8::kAscii) {
+ const OneByteString& strobj
= OneByteString::Handle(OneByteString::New(len, space));
if (len > 0) {
NoGCScope no_gc;
- Utf8::Decode(str, onestr.CharAddr(0), len);
+ Utf8::DecodeToAscii(utf8_array, array_len, strobj.CharAddr(0), len);
}
- return onestr.raw();
- } else if (width == 2) {
- const TwoByteString& twostr =
- TwoByteString::Handle(TwoByteString::New(len, space));
- NoGCScope no_gc;
- Utf8::Decode(str, twostr.CharAddr(0), len);
- return twostr.raw();
+ return strobj.raw();
}
- ASSERT(width == 4);
- const FourByteString& fourstr =
- FourByteString::Handle(FourByteString::New(len, space));
+ ASSERT((type == Utf8::kBMP) || (type == Utf8::kSMP));
+ const TwoByteString& strobj =
+ TwoByteString::Handle(TwoByteString::New(len, space));
NoGCScope no_gc;
- Utf8::Decode(str, fourstr.CharAddr(0), len);
- return fourstr.raw();
+ Utf8::DecodeToUTF16(utf8_array, array_len, strobj.CharAddr(0), len);
+ return strobj.raw();
}
-RawString* String::New(const uint8_t* characters,
- intptr_t len,
- Heap::Space space) {
- return OneByteString::New(characters, len, space);
-}
-
-
-RawString* String::New(const uint16_t* characters,
- intptr_t len,
+RawString* String::New(const uint16_t* utf16_array,
+ intptr_t array_len,
Heap::Space space) {
bool is_one_byte_string = true;
- for (intptr_t i = 0; i < len; ++i) {
- if (characters[i] > 0xFF) {
+ for (intptr_t i = 0; i < array_len; ++i) {
+ if (utf16_array[i] > 0x7F) {
is_one_byte_string = false;
break;
}
}
if (is_one_byte_string) {
- return OneByteString::New(characters, len, space);
+ return OneByteString::New(utf16_array, array_len, space);
}
- return TwoByteString::New(characters, len, space);
+ return TwoByteString::New(utf16_array, array_len, space);
}
-RawString* String::New(const uint32_t* characters,
- intptr_t len,
+RawString* String::New(const uint32_t* utf32_array,
+ intptr_t array_len,
Heap::Space space) {
bool is_one_byte_string = true;
- bool is_two_byte_string = true;
- for (intptr_t i = 0; i < len; ++i) {
- if (characters[i] > 0xFFFF) {
- is_two_byte_string = false;
+ intptr_t utf16_len = array_len;
+ for (intptr_t i = 0; i < array_len; ++i) {
+ if (utf32_array[i] > 0x7F) {
is_one_byte_string = false;
- break;
- } else if (characters[i] > 0xFF) {
- is_one_byte_string = false;
+ }
+ if (utf32_array[i] > 0xFFFF) {
+ utf16_len += 1;
}
}
if (is_one_byte_string) {
- return OneByteString::New(characters, len, space);
- } else if (is_two_byte_string) {
- return TwoByteString::New(characters, len, space);
+ return OneByteString::New(utf32_array, array_len, space);
}
- return FourByteString::New(characters, len, space);
+ return TwoByteString::New(utf16_len, utf32_array, array_len, space);
}
@@ -10038,11 +9989,9 @@
intptr_t char_size = str.CharSize();
if (char_size == kOneByteChar) {
result ^= OneByteString::New(len, space);
- } else if (char_size == kTwoByteChar) {
- result ^= TwoByteString::New(len, space);
} else {
- ASSERT(char_size == kFourByteChar);
- result ^= FourByteString::New(len, space);
+ ASSERT(char_size == kTwoByteChar);
+ result ^= TwoByteString::New(len, space);
}
String::Copy(result, 0, str, 0, len);
return result.raw();
@@ -10067,15 +10016,6 @@
}
-RawString* String::NewExternal(const uint32_t* characters,
- intptr_t len,
- void* peer,
- Dart_PeerFinalizer callback,
- Heap::Space space) {
- return ExternalFourByteString::New(characters, len, peer, callback, space);
-}
-
-
void String::Copy(const String& dst, intptr_t dst_offset,
const uint8_t* characters,
intptr_t len) {
@@ -10094,73 +10034,29 @@
for (intptr_t i = 0; i < len; ++i) {
*twostr.CharAddr(i + dst_offset) = characters[i];
}
- } else {
- ASSERT(dst.IsFourByteString());
- const FourByteString& fourstr = FourByteString::Cast(dst);
- NoGCScope no_gc;
- for (intptr_t i = 0; i < len; ++i) {
- *fourstr.CharAddr(i + dst_offset) = characters[i];
- }
}
}
void String::Copy(const String& dst, intptr_t dst_offset,
- const uint16_t* characters,
- intptr_t len) {
+ const uint16_t* utf16_array,
+ intptr_t array_len) {
ASSERT(dst_offset >= 0);
- ASSERT(len >= 0);
- ASSERT(len <= (dst.Length() - dst_offset));
+ ASSERT(array_len >= 0);
+ ASSERT(array_len <= (dst.Length() - dst_offset));
if (dst.IsOneByteString()) {
const OneByteString& onestr = OneByteString::Cast(dst);
NoGCScope no_gc;
- for (intptr_t i = 0; i < len; ++i) {
- ASSERT(characters[i] <= 0xFF);
- *onestr.CharAddr(i + dst_offset) = characters[i];
- }
- } else if (dst.IsTwoByteString()) {
- const TwoByteString& twostr = TwoByteString::Cast(dst);
- NoGCScope no_gc;
- if (len > 0) {
- memmove(twostr.CharAddr(dst_offset), characters, len * 2);
+ for (intptr_t i = 0; i < array_len; ++i) {
+ ASSERT(utf16_array[i] <= 0x7F);
+ *onestr.CharAddr(i + dst_offset) = utf16_array[i];
}
} else {
- ASSERT(dst.IsFourByteString());
- const FourByteString& fourstr = FourByteString::Cast(dst);
- NoGCScope no_gc;
- for (intptr_t i = 0; i < len; ++i) {
- *fourstr.CharAddr(i + dst_offset) = characters[i];
- }
- }
-}
-
-
-void String::Copy(const String& dst, intptr_t dst_offset,
- const uint32_t* characters,
- intptr_t len) {
- ASSERT(dst_offset >= 0);
- ASSERT(len >= 0);
- ASSERT(len <= (dst.Length() - dst_offset));
- if (dst.IsOneByteString()) {
- const OneByteString& onestr = OneByteString::Cast(dst);
- NoGCScope no_gc;
- for (intptr_t i = 0; i < len; ++i) {
- ASSERT(characters[i] <= 0xFF);
- *onestr.CharAddr(i + dst_offset) = characters[i];
- }
- } else if (dst.IsTwoByteString()) {
+ ASSERT(dst.IsTwoByteString());
const TwoByteString& twostr = TwoByteString::Cast(dst);
NoGCScope no_gc;
- for (intptr_t i = 0; i < len; ++i) {
- ASSERT(characters[i] <= 0xFFFF);
- *twostr.CharAddr(i + dst_offset) = characters[i];
- }
- } else {
- ASSERT(dst.IsFourByteString());
- const FourByteString& fourstr = FourByteString::Cast(dst);
- NoGCScope no_gc;
- if (len > 0) {
- memmove(fourstr.CharAddr(dst_offset), characters, len * 4);
+ if (array_len > 0) {
+ memmove(twostr.CharAddr(dst_offset), utf16_array, (array_len * 2));
}
}
}
@@ -10187,7 +10083,8 @@
NoGCScope no_gc;
String::Copy(dst, dst_offset, onestr.CharAddr(0) + src_offset, len);
}
- } else if (char_size == kTwoByteChar) {
+ } else {
+ ASSERT(char_size == kTwoByteChar);
if (src.IsTwoByteString()) {
const TwoByteString& twostr = TwoByteString::Cast(src);
NoGCScope no_gc;
@@ -10198,19 +10095,6 @@
NoGCScope no_gc;
String::Copy(dst, dst_offset, twostr.CharAddr(0) + src_offset, len);
}
- } else {
- ASSERT(char_size == kFourByteChar);
- if (src.IsFourByteString()) {
- const FourByteString& fourstr = FourByteString::Cast(src);
- NoGCScope no_gc;
- String::Copy(dst, dst_offset, fourstr.CharAddr(0) + src_offset, len);
- } else {
- ASSERT(src.IsExternalFourByteString());
- const ExternalFourByteString& fourstr =
- ExternalFourByteString::Cast(src);
- NoGCScope no_gc;
- String::Copy(dst, dst_offset, fourstr.CharAddr(0) + src_offset, len);
- }
}
}
}
@@ -10221,13 +10105,9 @@
const OneByteString& onestr = OneByteString::Cast(str);
return onestr.EscapeSpecialCharacters(raw_str);
}
- if (str.IsTwoByteString()) {
- const TwoByteString& twostr = TwoByteString::Cast(str);
- return twostr.EscapeSpecialCharacters(raw_str);
- }
- ASSERT(str.IsFourByteString());
- const FourByteString& fourstr = FourByteString::Cast(str);
- return fourstr.EscapeSpecialCharacters(raw_str);
+ ASSERT(str.IsTwoByteString());
+ const TwoByteString& twostr = TwoByteString::Cast(str);
+ return twostr.EscapeSpecialCharacters(raw_str);
}
@@ -10260,9 +10140,6 @@
Heap::Space space) {
ASSERT(!str1.IsNull() && !str2.IsNull());
intptr_t char_size = Utils::Maximum(str1.CharSize(), str2.CharSize());
- if (char_size == kFourByteChar) {
- return FourByteString::Concat(str1, str2, space);
- }
if (char_size == kTwoByteChar) {
return TwoByteString::Concat(str1, str2, space);
}
@@ -10284,11 +10161,9 @@
}
if (char_size == kOneByteChar) {
return OneByteString::ConcatAll(strings, result_len, space);
- } else if (char_size == kTwoByteChar) {
- return TwoByteString::ConcatAll(strings, result_len, space);
}
- ASSERT(char_size == kFourByteChar);
- return FourByteString::ConcatAll(strings, result_len, space);
+ ASSERT(char_size == kTwoByteChar);
+ return TwoByteString::ConcatAll(strings, result_len, space);
}
@@ -10318,32 +10193,19 @@
}
String& result = String::Handle();
bool is_one_byte_string = true;
- bool is_two_byte_string = true;
intptr_t char_size = str.CharSize();
if (char_size == kTwoByteChar) {
for (intptr_t i = begin_index; i < begin_index + length; ++i) {
- if (str.CharAt(i) > 0xFF) {
+ if (str.CharAt(i) > 0x7F) {
is_one_byte_string = false;
break;
}
}
- } else if (char_size == kFourByteChar) {
- for (intptr_t i = begin_index; i < begin_index + length; ++i) {
- if (str.CharAt(i) > 0xFFFF) {
- is_one_byte_string = false;
- is_two_byte_string = false;
- break;
- } else if (str.CharAt(i) > 0xFF) {
- is_one_byte_string = false;
- }
- }
}
if (is_one_byte_string) {
result ^= OneByteString::New(length, space);
- } else if (is_two_byte_string) {
- result ^= TwoByteString::New(length, space);
} else {
- result ^= FourByteString::New(length, space);
+ result ^= TwoByteString::New(length, space);
}
String::Copy(result, 0, str, begin_index, length);
return result.raw();
@@ -10353,10 +10215,24 @@
const char* String::ToCString() const {
intptr_t len = Utf8::Length(*this);
Zone* zone = Isolate::Current()->current_zone();
- char* result = zone->Alloc<char>(len + 1);
- Utf8::Encode(*this, result, len);
+ uint8_t* result = zone->Alloc<uint8_t>(len + 1);
+ ToUTF8(result, len);
result[len] = 0;
- return result;
+ return reinterpret_cast<const char*>(result);
+}
+
+
+void String::ToUTF8(uint8_t* utf8_array, intptr_t array_len) const {
+ if (CharSize() == kOneByteChar) {
+ const OneByteString& obj = OneByteString::Cast(*this);
+ ASSERT(array_len >= obj.Length());
+ if (obj.Length() > 0) {
+ memmove(utf8_array, obj.CharAddr(0), obj.Length());
+ }
+ } else {
+ ASSERT(array_len >= Utf8::Length(*this));
+ Utf8::Encode(*this, reinterpret_cast<char*>(utf8_array), array_len);
+ }
}
@@ -10379,14 +10255,11 @@
if (!has_mapping) {
return str.raw();
}
- if (dst_max <= 0xFF) {
+ if (dst_max <= 0x7F) {
return OneByteString::Transform(mapping, str, space);
}
- if (dst_max <= 0xFFFF) {
- return TwoByteString::Transform(mapping, str, space);
- }
- ASSERT(dst_max > 0xFFFF);
- return FourByteString::Transform(mapping, str, space);
+ ASSERT(dst_max > 0x7F);
+ return TwoByteString::Transform(mapping, str, space);
}
@@ -10517,7 +10390,10 @@
Heap::Space space) {
const OneByteString& result =
OneByteString::Handle(OneByteString::New(len, space));
- String::Copy(result, 0, characters, len);
+ if (len > 0) {
+ NoGCScope no_gc;
+ memmove(result.CharAddr(0), characters, len);
+ }
return result.raw();
}
@@ -10527,7 +10403,10 @@
Heap::Space space) {
const OneByteString& result =
OneByteString::Handle(OneByteString::New(len, space));
- String::Copy(result, 0, characters, len);
+ for (intptr_t i = 0; i < len; ++i) {
+ ASSERT(characters[i] <= 0x7F);
+ *result.CharAddr(i) = characters[i];
+ }
return result.raw();
}
@@ -10537,7 +10416,10 @@
Heap::Space space) {
const OneByteString& result =
OneByteString::Handle(OneByteString::New(len, space));
- String::Copy(result, 0, characters, len);
+ for (intptr_t i = 0; i < len; ++i) {
+ ASSERT(characters[i] <= 0x7F);
+ *result.CharAddr(i) = characters[i];
+ }
return result.raw();
}
@@ -10593,7 +10475,7 @@
OneByteString::Handle(OneByteString::New(len, space));
for (intptr_t i = 0; i < len; ++i) {
int32_t ch = mapping(str.CharAt(i));
- ASSERT(ch >= 0 && ch <= 0xFF);
+ ASSERT(ch >= 0 && ch <= 0x7F);
*result.CharAddr(i) = ch;
}
return result.raw();
@@ -10659,22 +10541,42 @@
}
-RawTwoByteString* TwoByteString::New(const uint16_t* characters,
- intptr_t len,
+RawTwoByteString* TwoByteString::New(const uint16_t* utf16_array,
+ intptr_t array_len,
Heap::Space space) {
+ ASSERT(array_len > 0);
const TwoByteString& result =
- TwoByteString::Handle(TwoByteString::New(len, space));
- String::Copy(result, 0, characters, len);
+ TwoByteString::Handle(TwoByteString::New(array_len, space));
+ {
+ NoGCScope no_gc;
+ memmove(result.CharAddr(0), utf16_array, (array_len * 2));
+ }
return result.raw();
}
-RawTwoByteString* TwoByteString::New(const uint32_t* characters,
- intptr_t len,
+RawTwoByteString* TwoByteString::New(intptr_t utf16_len,
+ const uint32_t* utf32_array,
+ intptr_t array_len,
Heap::Space space) {
+ ASSERT((array_len > 0) && (utf16_len >= array_len));
const TwoByteString& result =
- TwoByteString::Handle(TwoByteString::New(len, space));
- String::Copy(result, 0, characters, len);
+ TwoByteString::Handle(TwoByteString::New(utf16_len, space));
+ {
+ NoGCScope no_gc;
+ intptr_t j = 0;
+ for (intptr_t i = 0; i < array_len; ++i) {
+ if (utf32_array[i] > 0xffff) {
+ ASSERT(j < (utf16_len - 1));
+ Utf8::ConvertUTF32ToUTF16(utf32_array[i], result.CharAddr(j));
+ j += 2;
+ } else {
+ ASSERT(j < utf16_len);
+ *result.CharAddr(j) = utf32_array[i];
+ j += 1;
+ }
+ }
+ }
return result.raw();
}
@@ -10742,132 +10644,6 @@
}
-RawFourByteString* FourByteString::EscapeSpecialCharacters(bool raw_str) const {
- intptr_t len = Length();
- if (len > 0) {
- intptr_t num_escapes = 0;
- intptr_t index = 0;
- for (intptr_t i = 0; i < len; i++) {
- if (IsSpecialCharacter(*CharAddr(i)) ||
- (!raw_str && (*CharAddr(i) == '\\'))) {
- num_escapes += 1;
- }
- }
- const FourByteString& dststr = FourByteString::Handle(
- FourByteString::New(len + num_escapes, Heap::kNew));
- for (intptr_t i = 0; i < len; i++) {
- if (IsSpecialCharacter(*CharAddr(i))) {
- *(dststr.CharAddr(index)) = '\\';
- *(dststr.CharAddr(index + 1)) = SpecialCharacter(*CharAddr(i));
- index += 2;
- } else if (!raw_str && (*CharAddr(i) == '\\')) {
- *(dststr.CharAddr(index)) = '\\';
- *(dststr.CharAddr(index + 1)) = '\\';
- index += 2;
- } else {
- *(dststr.CharAddr(index)) = *CharAddr(i);
- index += 1;
- }
- }
- return dststr.raw();
- }
- return FourByteString::null();
-}
-
-
-RawFourByteString* FourByteString::New(intptr_t len,
- Heap::Space space) {
- ASSERT(Isolate::Current()->object_store()->four_byte_string_class() !=
- Class::null());
- if (len < 0 || len > kMaxElements) {
- // This should be caught before we reach here.
- FATAL1("Fatal error in FourByteString::New: invalid len %"Pd"\n", len);
- }
- FourByteString& result = FourByteString::Handle();
- {
- RawObject* raw = Object::Allocate(FourByteString::kClassId,
- FourByteString::InstanceSize(len),
- space);
- NoGCScope no_gc;
- result ^= raw;
- result.SetLength(len);
- result.SetHash(0);
- }
- return result.raw();
-}
-
-
-RawFourByteString* FourByteString::New(const uint32_t* characters,
- intptr_t len,
- Heap::Space space) {
- const FourByteString& result =
- FourByteString::Handle(FourByteString::New(len, space));
- String::Copy(result, 0, characters, len);
- return result.raw();
-}
-
-
-RawFourByteString* FourByteString::New(const FourByteString& str,
- Heap::Space space) {
- return FourByteString::New(str.CharAddr(0), str.Length(), space);
-}
-
-
-RawFourByteString* FourByteString::Concat(const String& str1,
- const String& str2,
- Heap::Space space) {
- intptr_t len1 = str1.Length();
- intptr_t len2 = str2.Length();
- intptr_t len = len1 + len2;
- const FourByteString& result =
- FourByteString::Handle(FourByteString::New(len, space));
- String::Copy(result, 0, str1, 0, len1);
- String::Copy(result, len1, str2, 0, len2);
- return result.raw();
-}
-
-
-RawFourByteString* FourByteString::ConcatAll(const Array& strings,
- intptr_t len,
- Heap::Space space) {
- const FourByteString& result =
- FourByteString::Handle(FourByteString::New(len, space));
- String& str = String::Handle();
- {
- intptr_t strings_len = strings.Length();
- intptr_t pos = 0;
- for (intptr_t i = 0; i < strings_len; i++) {
- str ^= strings.At(i);
- intptr_t str_len = str.Length();
- String::Copy(result, pos, str, 0, str_len);
- pos += str_len;
- }
- }
- return result.raw();
-}
-
-
-RawFourByteString* FourByteString::Transform(int32_t (*mapping)(int32_t ch),
- const String& str,
- Heap::Space space) {
- ASSERT(!str.IsNull());
- intptr_t len = str.Length();
- const FourByteString& result =
- FourByteString::Handle(FourByteString::New(len, space));
- for (intptr_t i = 0; i < len; ++i) {
- int32_t ch = mapping(str.CharAt(i));
- ASSERT(ch >= 0 && ch <= 0x10FFFF);
- *result.CharAddr(i) = ch;
- }
- return result.raw();
-}
-
-
-const char* FourByteString::ToCString() const {
- return String::ToCString();
-}
-
-
static void AddFinalizer(const Object& referent,
void* peer,
Dart_WeakPersistentHandleFinalizer callback) {
@@ -10976,48 +10752,6 @@
}
-RawExternalFourByteString* ExternalFourByteString::New(
- const uint32_t* data,
- intptr_t len,
- void* peer,
- Dart_PeerFinalizer callback,
- Heap::Space space) {
- ASSERT(Isolate::Current()->object_store()->
- external_four_byte_string_class() != Class::null());
- if (len < 0 || len > kMaxElements) {
- // This should be caught before we reach here.
- FATAL1("Fatal error in ExternalFourByteString::New: invalid len %"Pd"\n",
- len);
- }
- ExternalFourByteString& result = ExternalFourByteString::Handle();
- ExternalStringData<uint32_t>* external_data =
- new ExternalStringData<uint32_t>(data, peer, callback);
- {
- RawObject* raw = Object::Allocate(ExternalFourByteString::kClassId,
- ExternalFourByteString::InstanceSize(),
- space);
- NoGCScope no_gc;
- result ^= raw;
- result.SetLength(len);
- result.SetHash(0);
- result.SetExternalData(external_data);
- }
- AddFinalizer(result, external_data, ExternalFourByteString::Finalize);
- return result.raw();
-}
-
-
-void ExternalFourByteString::Finalize(Dart_Handle handle, void* peer) {
- delete reinterpret_cast<ExternalStringData<uint32_t>*>(peer);
- DeleteWeakPersistentHandle(handle);
-}
-
-
-const char* ExternalFourByteString::ToCString() const {
- return String::ToCString();
-}
-
-
RawBool* Bool::True() {
return Isolate::Current()->object_store()->true_value();
}
diff --git a/runtime/vm/object.h b/runtime/vm/object.h
index b8bb4dd..27dc8d1 100644
--- a/runtime/vm/object.h
+++ b/runtime/vm/object.h
@@ -29,6 +29,7 @@
class Assembler;
class Closure;
class Code;
+class DeoptInstr;
class LocalScope;
class Symbols;
@@ -1061,17 +1062,18 @@
RawString* QualifiedUserVisibleName() const;
virtual RawString* DictionaryName() const { return name(); }
- // Build a string of the form '<T, R>(T, [b: B, c: C]) => R' representing the
- // internal signature of the given function.
+ // Build a string of the form 'C<T, R>(T, {b: B, c: C}) => R' representing the
+ // internal signature of the given function. In this example, T and R are
+ // type parameters of class C, the owner of the function.
RawString* Signature() const {
const bool instantiate = false;
return BuildSignature(instantiate, kInternalName, TypeArguments::Handle());
}
- // Build a string of the form '(A, [b: B, c: C]) => D' representing the
+ // Build a string of the form '(A, {b: B, c: C}) => D' representing the
// signature of the given function, where all generic types (e.g. '<T, R>' in
- // '<T, R>(T, [b: B, c: C]) => R') are instantiated using the given
- // instantiator type argument vector (e.g. '<A, D>').
+ // 'C<T, R>(T, {b: B, c: C}) => R') are instantiated using the given
+ // instantiator type argument vector of a C instance (e.g. '<A, D>').
RawString* InstantiatedSignatureFrom(
const AbstractTypeArguments& instantiator,
NameVisibility name_visibility) const {
@@ -1909,6 +1911,7 @@
static bool IsKeyUsed(intptr_t key);
static void InitCoreLibrary(Isolate* isolate);
+ static void InitCollectionLibrary(Isolate* isolate);
static void InitMathLibrary(Isolate* isolate);
static void InitIsolateLibrary(Isolate* isolate);
static void InitMirrorsLibrary(Isolate* isolate);
@@ -1917,6 +1920,7 @@
static RawLibrary* CoreLibrary();
static RawLibrary* CoreImplLibrary();
+ static RawLibrary* CollectionLibrary();
static RawLibrary* MathLibrary();
static RawLibrary* IsolateLibrary();
static RawLibrary* MirrorsLibrary();
@@ -2328,8 +2332,13 @@
};
public:
+ // The number of instructions.
intptr_t Length() const;
+ // The number of real (non-suffix) instructions needed to execute the
+ // deoptimization translation.
+ intptr_t TranslationLength() const;
+
static RawDeoptInfo* New(intptr_t num_commands);
static const intptr_t kBytesPerElement = (kNumberOfEntries * kWordSize);
@@ -2357,6 +2366,11 @@
return index;
}
+ // Unpack the entire translation into an array of deoptimization
+ // instructions. This copies any shared suffixes into the array.
+ void ToInstructions(const Array& table,
+ GrowableArray<DeoptInstr*>* instructions) const;
+
private:
intptr_t* EntryAddr(intptr_t index, intptr_t entry_offset) const {
ASSERT((index >=0) && (index < Length()));
@@ -3612,13 +3626,12 @@
static const intptr_t kOneByteChar = 1;
static const intptr_t kTwoByteChar = 2;
- static const intptr_t kFourByteChar = 4;
// All strings share the same maximum element count to keep things
// simple. We choose a value that will prevent integer overflow for
- // 4 byte strings, since it is the worst case.
+ // 2 byte strings, since it is the worst case.
static const intptr_t kSizeofRawString = sizeof(RawObject) + (2 * kWordSize);
- static const intptr_t kMaxElements = kSmiMax / kFourByteChar;
+ static const intptr_t kMaxElements = kSmiMax / kTwoByteChar;
intptr_t Length() const { return Smi::Value(raw_ptr()->length_); }
static intptr_t length_offset() { return OFFSET_OF(RawString, length_); }
@@ -3659,30 +3672,42 @@
return NULL;
}
- static RawString* New(const char* str, Heap::Space space = Heap::kNew);
- static RawString* New(const uint8_t* characters,
- intptr_t len,
+ void ToUTF8(uint8_t* utf8_array, intptr_t array_len) const;
+
+ // Creates a new String object from a C string that is assumed to contain
+ // UTF-8 encoded characters and '\0' is considered a termination character.
+ static RawString* New(const char* cstr, Heap::Space space = Heap::kNew);
+
+ // Creates a new String object from an array of UTF-8 encoded characters.
+ static RawString* New(const uint8_t* utf8_array,
+ intptr_t array_len,
Heap::Space space = Heap::kNew);
- static RawString* New(const uint16_t* characters,
- intptr_t len,
+
+ // Creates a new String object from an array of UTF-16 encoded characters.
+ static RawString* New(const uint16_t* utf16_array,
+ intptr_t array_len,
Heap::Space space = Heap::kNew);
- static RawString* New(const uint32_t* characters,
- intptr_t len,
+
+ // Creates a new String object from an array of UTF-32 encoded characters.
+ static RawString* New(const uint32_t* utf32_array,
+ intptr_t array_len,
Heap::Space space = Heap::kNew);
+
+ // Create a new String object from another Dart String instance.
static RawString* New(const String& str, Heap::Space space = Heap::kNew);
- static RawString* NewExternal(const uint8_t* characters,
- intptr_t len,
+ // Creates a new External String object using the specified array of
+ // UTF-8 encoded characters as the external reference.
+ static RawString* NewExternal(const uint8_t* utf8_array,
+ intptr_t array_len,
void* peer,
Dart_PeerFinalizer callback,
Heap::Space = Heap::kNew);
- static RawString* NewExternal(const uint16_t* characters,
- intptr_t len,
- void* peer,
- Dart_PeerFinalizer callback,
- Heap::Space = Heap::kNew);
- static RawString* NewExternal(const uint32_t* characters,
- intptr_t len,
+
+ // Creates a new External String object using the specified array of
+ // UTF-16 encoded characters as the external reference.
+ static RawString* NewExternal(const uint16_t* utf16_array,
+ intptr_t array_len,
void* peer,
Dart_PeerFinalizer callback,
Heap::Space = Heap::kNew);
@@ -3697,10 +3722,6 @@
intptr_t len);
static void Copy(const String& dst,
intptr_t dst_offset,
- const uint32_t* characters,
- intptr_t len);
- static void Copy(const String& dst,
- intptr_t dst_offset,
const String& src,
intptr_t src_offset,
intptr_t len);
@@ -3874,7 +3895,8 @@
static RawTwoByteString* New(const uint16_t* characters,
intptr_t len,
Heap::Space space);
- static RawTwoByteString* New(const uint32_t* characters,
+ static RawTwoByteString* New(intptr_t utf16_len,
+ const uint32_t* characters,
intptr_t len,
Heap::Space space);
static RawTwoByteString* New(const TwoByteString& str,
@@ -3903,64 +3925,6 @@
};
-class FourByteString : public String {
- public:
- virtual int32_t CharAt(intptr_t index) const {
- return *CharAddr(index);
- }
-
- virtual intptr_t CharSize() const {
- return kFourByteChar;
- }
-
- RawFourByteString* EscapeSpecialCharacters(bool raw_str) const;
-
- static const intptr_t kBytesPerElement = 4;
- static const intptr_t kMaxElements = String::kMaxElements;
-
- static intptr_t InstanceSize() {
- ASSERT(sizeof(RawFourByteString) == OFFSET_OF(RawFourByteString, data_));
- return 0;
- }
-
- static intptr_t InstanceSize(intptr_t len) {
- ASSERT(sizeof(RawTwoByteString) == kSizeofRawString);
- ASSERT(0 <= len && len <= kMaxElements);
- return RoundedAllocationSize(
- sizeof(RawFourByteString) + (len * kBytesPerElement));
- }
-
- static RawFourByteString* New(intptr_t len,
- Heap::Space space);
- static RawFourByteString* New(const uint32_t* characters,
- intptr_t len,
- Heap::Space space);
- static RawFourByteString* New(const FourByteString& str,
- Heap::Space space);
-
- static RawFourByteString* Concat(const String& str1,
- const String& str2,
- Heap::Space space);
- static RawFourByteString* ConcatAll(const Array& strings,
- intptr_t len,
- Heap::Space space);
-
- static RawFourByteString* Transform(int32_t (*mapping)(int32_t ch),
- const String& str,
- Heap::Space space);
-
- private:
- uint32_t* CharAddr(intptr_t index) const {
- ASSERT((index >= 0) && (index < Length()));
- return &raw_ptr()->data_[index];
- }
-
- HEAP_OBJECT_IMPLEMENTATION(FourByteString, String);
- friend class Class;
- friend class String;
-};
-
-
class ExternalOneByteString : public String {
public:
virtual int32_t CharAt(intptr_t index) const {
@@ -4057,54 +4021,6 @@
};
-class ExternalFourByteString : public String {
- public:
- virtual int32_t CharAt(intptr_t index) const {
- return *CharAddr(index);
- }
-
- virtual intptr_t CharSize() const {
- return kFourByteChar;
- }
-
- virtual bool IsExternal() const { return true; }
- virtual void* GetPeer() const {
- return raw_ptr()->external_data_->peer();
- }
-
- // We use the same maximum elements for all strings.
- static const intptr_t kBytesPerElement = 4;
- static const intptr_t kMaxElements = String::kMaxElements;
-
- static intptr_t InstanceSize() {
- return RoundedAllocationSize(sizeof(RawExternalFourByteString));
- }
-
- static RawExternalFourByteString* New(const uint32_t* characters,
- intptr_t len,
- void* peer,
- Dart_PeerFinalizer callback,
- Heap::Space space = Heap::kNew);
-
- private:
- const uint32_t* CharAddr(intptr_t index) const {
- // TODO(iposva): Determine if we should throw an exception here.
- ASSERT((index >= 0) && (index < Length()));
- return &(raw_ptr()->external_data_->data()[index]);
- }
-
- void SetExternalData(ExternalStringData<uint32_t>* data) {
- raw_ptr()->external_data_ = data;
- }
-
- static void Finalize(Dart_Handle handle, void* peer);
-
- HEAP_OBJECT_IMPLEMENTATION(ExternalFourByteString, String);
- friend class Class;
- friend class String;
-};
-
-
// Class Bool implements Dart core class bool.
class Bool : public Instance {
public:
@@ -4930,6 +4846,10 @@
raw_ptr()->external_data_->data()[index] = value;
}
+ void* GetData() const {
+ return raw_ptr()->external_data_->data();
+ }
+
void* GetPeer() const {
return raw_ptr()->external_data_->peer();
}
@@ -4984,6 +4904,10 @@
raw_ptr()->external_data_->data()[index] = value;
}
+ void* GetData() const {
+ return raw_ptr()->external_data_->data();
+ }
+
void* GetPeer() const {
return raw_ptr()->external_data_->peer();
}
@@ -5039,6 +4963,10 @@
raw_ptr()->external_data_->data()[index] = value;
}
+ void* GetData() const {
+ return raw_ptr()->external_data_->data();
+ }
+
void* GetPeer() const {
return raw_ptr()->external_data_->peer();
}
@@ -5093,6 +5021,10 @@
raw_ptr()->external_data_->data()[index] = value;
}
+ void* GetData() const {
+ return raw_ptr()->external_data_->data();
+ }
+
void* GetPeer() const {
return raw_ptr()->external_data_->peer();
}
@@ -5147,6 +5079,10 @@
raw_ptr()->external_data_->data()[index] = value;
}
+ void* GetData() const {
+ return raw_ptr()->external_data_->data();
+ }
+
void* GetPeer() const {
return raw_ptr()->external_data_->peer();
}
@@ -5201,6 +5137,10 @@
raw_ptr()->external_data_->data()[index] = value;
}
+ void* GetData() const {
+ return raw_ptr()->external_data_->data();
+ }
+
void* GetPeer() const {
return raw_ptr()->external_data_->peer();
}
@@ -5255,6 +5195,10 @@
raw_ptr()->external_data_->data()[index] = value;
}
+ void* GetData() const {
+ return raw_ptr()->external_data_->data();
+ }
+
void* GetPeer() const {
return raw_ptr()->external_data_->peer();
}
@@ -5309,6 +5253,10 @@
raw_ptr()->external_data_->data()[index] = value;
}
+ void* GetData() const {
+ return raw_ptr()->external_data_->data();
+ }
+
void* GetPeer() const {
return raw_ptr()->external_data_->peer();
}
@@ -5363,6 +5311,10 @@
raw_ptr()->external_data_->data()[index] = value;
}
+ void* GetData() const {
+ return raw_ptr()->external_data_->data();
+ }
+
void* GetPeer() const {
return raw_ptr()->external_data_->peer();
}
@@ -5417,6 +5369,10 @@
raw_ptr()->external_data_->data()[index] = value;
}
+ void* GetData() const {
+ return raw_ptr()->external_data_->data();
+ }
+
void* GetPeer() const {
return raw_ptr()->external_data_->peer();
}
diff --git a/runtime/vm/object_store.cc b/runtime/vm/object_store.cc
index 63ea281..970ad17 100644
--- a/runtime/vm/object_store.cc
+++ b/runtime/vm/object_store.cc
@@ -30,10 +30,8 @@
string_interface_(Type::null()),
one_byte_string_class_(Class::null()),
two_byte_string_class_(Class::null()),
- four_byte_string_class_(Class::null()),
external_one_byte_string_class_(Class::null()),
external_two_byte_string_class_(Class::null()),
- external_four_byte_string_class_(Class::null()),
bool_type_(Type::null()),
bool_class_(Class::null()),
list_interface_(Type::null()),
diff --git a/runtime/vm/object_store.h b/runtime/vm/object_store.h
index 301293e..f59d78c 100644
--- a/runtime/vm/object_store.h
+++ b/runtime/vm/object_store.h
@@ -117,11 +117,6 @@
two_byte_string_class_ = value.raw();
}
- RawClass* four_byte_string_class() const { return four_byte_string_class_; }
- void set_four_byte_string_class(const Class& value) {
- four_byte_string_class_ = value.raw();
- }
-
RawClass* external_one_byte_string_class() const {
return external_one_byte_string_class_;
}
@@ -136,13 +131,6 @@
external_two_byte_string_class_ = value.raw();
}
- RawClass* external_four_byte_string_class() const {
- return external_four_byte_string_class_;
- }
- void set_external_four_byte_string_class(const Class& value) {
- external_four_byte_string_class_ = value.raw();
- }
-
RawType* bool_type() const { return bool_type_; }
void set_bool_type(const Type& value) { bool_type_ = value.raw(); }
@@ -362,6 +350,13 @@
core_impl_library_ = value.raw();
}
+ RawLibrary* collection_library() const {
+ return collection_library_;
+ }
+ void set_collection_library(const Library& value) {
+ collection_library_ = value.raw();
+ }
+
RawLibrary* math_library() const {
return math_library_;
}
@@ -487,10 +482,8 @@
RawType* string_interface_;
RawClass* one_byte_string_class_;
RawClass* two_byte_string_class_;
- RawClass* four_byte_string_class_;
RawClass* external_one_byte_string_class_;
RawClass* external_two_byte_string_class_;
- RawClass* external_four_byte_string_class_;
RawType* bool_type_;
RawClass* bool_class_;
RawType* list_interface_;
@@ -526,6 +519,7 @@
RawArray* canonical_type_arguments_;
RawLibrary* core_library_;
RawLibrary* core_impl_library_;
+ RawLibrary* collection_library_;
RawLibrary* math_library_;
RawLibrary* isolate_library_;
RawLibrary* mirrors_library_;
diff --git a/runtime/vm/object_test.cc b/runtime/vm/object_test.cc
index 6bcf17c..9347a56 100644
--- a/runtime/vm/object_test.cc
+++ b/runtime/vm/object_test.cc
@@ -470,7 +470,6 @@
EXPECT(str.IsString());
EXPECT(str.IsOneByteString());
EXPECT(!str.IsTwoByteString());
- EXPECT(!str.IsFourByteString());
EXPECT(!str.IsNumber());
EXPECT_EQ(hello_len, str.Length());
EXPECT_EQ('H', str.CharAt(0));
@@ -515,23 +514,23 @@
EXPECT(empty1.Equals(empty2, 0, 0));
const intptr_t kCharsLen = 8;
- const uint8_t chars[kCharsLen] = { 1, 2, 127, 128, 192, 0, 255, -1 };
+ const uint8_t chars[kCharsLen] = { 1, 2, 127, 64, 92, 0, 55, 55 };
const String& str8 = String::Handle(String::New(chars, kCharsLen));
EXPECT_EQ(kCharsLen, str8.Length());
EXPECT_EQ(1, str8.CharAt(0));
EXPECT_EQ(127, str8.CharAt(2));
- EXPECT_EQ(128, str8.CharAt(3));
+ EXPECT_EQ(64, str8.CharAt(3));
EXPECT_EQ(0, str8.CharAt(5));
- EXPECT_EQ(255, str8.CharAt(6));
- EXPECT_EQ(255, str8.CharAt(7));
+ EXPECT_EQ(55, str8.CharAt(6));
+ EXPECT_EQ(55, str8.CharAt(7));
const intptr_t kCharsIndex = 3;
const String& sub1 = String::Handle(String::SubString(str8, kCharsIndex));
EXPECT_EQ((kCharsLen - kCharsIndex), sub1.Length());
- EXPECT_EQ(128, sub1.CharAt(0));
- EXPECT_EQ(192, sub1.CharAt(1));
+ EXPECT_EQ(64, sub1.CharAt(0));
+ EXPECT_EQ(92, sub1.CharAt(1));
EXPECT_EQ(0, sub1.CharAt(2));
- EXPECT_EQ(255, sub1.CharAt(3));
- EXPECT_EQ(255, sub1.CharAt(4));
+ EXPECT_EQ(55, sub1.CharAt(3));
+ EXPECT_EQ(55, sub1.CharAt(4));
const intptr_t kWideCharsLen = 7;
uint16_t wide_chars[kWideCharsLen] = { 'H', 'e', 'l', 'l', 'o', 256, '!' };
@@ -541,7 +540,6 @@
EXPECT(two_str.IsString());
EXPECT(two_str.IsTwoByteString());
EXPECT(!two_str.IsOneByteString());
- EXPECT(!two_str.IsFourByteString());
EXPECT_EQ(kWideCharsLen, two_str.Length());
EXPECT_EQ('H', two_str.CharAt(0));
EXPECT_EQ(256, two_str.CharAt(5));
@@ -564,40 +562,38 @@
const uint32_t four_chars[] = { 'C', 0xFF, 'h', 0xFFFF, 'a', 0x10FFFF, 'r' };
const String& four_str = String::Handle(String::New(four_chars, 7));
EXPECT_EQ(four_str.Hash(), four_str.Hash());
- EXPECT(!four_str.IsTwoByteString());
+ EXPECT(four_str.IsTwoByteString());
EXPECT(!four_str.IsOneByteString());
- EXPECT(four_str.IsFourByteString());
- EXPECT_EQ(7, four_str.Length());
+ EXPECT_EQ(8, four_str.Length());
EXPECT_EQ('C', four_str.CharAt(0));
EXPECT_EQ(0xFF, four_str.CharAt(1));
EXPECT_EQ('h', four_str.CharAt(2));
EXPECT_EQ(0xFFFF, four_str.CharAt(3));
EXPECT_EQ('a', four_str.CharAt(4));
- EXPECT_EQ(0x10FFFF, four_str.CharAt(5));
- EXPECT_EQ('r', four_str.CharAt(6));
+ EXPECT_EQ(0xDBFF, four_str.CharAt(5));
+ EXPECT_EQ(0xDFFF, four_str.CharAt(6));
+ EXPECT_EQ('r', four_str.CharAt(7));
// Create a 1-byte string from an array of 2-byte elements.
{
- const uint16_t char16[] = { 0x00, 0x7F, 0xFF };
+ const uint16_t char16[] = { 0x00, 0x1F, 0x7F };
const String& str8 = String::Handle(String::New(char16, 3));
EXPECT(str8.IsOneByteString());
EXPECT(!str8.IsTwoByteString());
- EXPECT(!str8.IsFourByteString());
EXPECT_EQ(0x00, str8.CharAt(0));
- EXPECT_EQ(0x7F, str8.CharAt(1));
- EXPECT_EQ(0xFF, str8.CharAt(2));
+ EXPECT_EQ(0x1F, str8.CharAt(1));
+ EXPECT_EQ(0x7F, str8.CharAt(2));
}
// Create a 1-byte string from an array of 4-byte elements.
{
- const uint32_t char32[] = { 0x00, 0x7F, 0xFF };
+ const uint32_t char32[] = { 0x00, 0x1F, 0x7F };
const String& str8 = String::Handle(String::New(char32, 3));
EXPECT(str8.IsOneByteString());
EXPECT(!str8.IsTwoByteString());
- EXPECT(!str8.IsFourByteString());
EXPECT_EQ(0x00, str8.CharAt(0));
- EXPECT_EQ(0x7F, str8.CharAt(1));
- EXPECT_EQ(0xFF, str8.CharAt(2));
+ EXPECT_EQ(0x1F, str8.CharAt(1));
+ EXPECT_EQ(0x7F, str8.CharAt(2));
}
// Create a 2-byte string from an array of 4-byte elements.
@@ -606,7 +602,6 @@
const String& str16 = String::Handle(String::New(char32, 3));
EXPECT(!str16.IsOneByteString());
EXPECT(str16.IsTwoByteString());
- EXPECT(!str16.IsFourByteString());
EXPECT_EQ(0x0000, str16.CharAt(0));
EXPECT_EQ(0x7FFF, str16.CharAt(1));
EXPECT_EQ(0xFFFF, str16.CharAt(2));
@@ -622,7 +617,6 @@
EXPECT(str.IsString());
EXPECT(str.IsOneByteString());
EXPECT(!str.IsTwoByteString());
- EXPECT(!str.IsFourByteString());
EXPECT(!str.IsNumber());
EXPECT(str.Equals(hello_str));
}
@@ -943,7 +937,7 @@
EXPECT(str6.Equals(two_one_two, two_one_two_len));
}
- // Concatenated emtpy and non-empty 4-byte strings.
+ // Concatenated emtpy and non-empty strings built from 4-byte elements.
{
const String& str1 = String::Handle(String::New(""));
EXPECT(str1.IsOneByteString());
@@ -951,19 +945,20 @@
uint32_t four[] = { 0x1D4D5, 0x1D4DE, 0x1D4E4, 0x1D4E1 };
intptr_t four_len = sizeof(four) / sizeof(four[0]);
+ intptr_t expected_len = (four_len * 2);
const String& str2 = String::Handle(String::New(four, four_len));
- EXPECT(str2.IsFourByteString());
- EXPECT_EQ(4, str2.Length());
+ EXPECT(str2.IsTwoByteString());
+ EXPECT_EQ(expected_len, str2.Length());
// Concat
const String& str3 = String::Handle(String::Concat(str1, str2));
- EXPECT_EQ(four_len, str3.Length());
+ EXPECT_EQ(expected_len, str3.Length());
EXPECT(str3.Equals(str2));
const String& str4 = String::Handle(String::Concat(str2, str1));
- EXPECT(str4.IsFourByteString());
- EXPECT_EQ(four_len, str4.Length());
+ EXPECT(str4.IsTwoByteString());
+ EXPECT_EQ(expected_len, str4.Length());
EXPECT(str4.Equals(str2));
// ConcatAll
@@ -973,8 +968,8 @@
array1.SetAt(0, str1);
array1.SetAt(1, str2);
const String& str5 = String::Handle(String::ConcatAll(array1));
- EXPECT(str5.IsFourByteString());
- EXPECT_EQ(four_len, str5.Length());
+ EXPECT(str5.IsTwoByteString());
+ EXPECT_EQ(expected_len, str5.Length());
EXPECT(str5.Equals(str2));
const Array& array2 = Array::Handle(Array::New(2));
@@ -982,8 +977,8 @@
array2.SetAt(0, str1);
array2.SetAt(1, str2);
const String& str6 = String::Handle(String::ConcatAll(array2));
- EXPECT(str6.IsFourByteString());
- EXPECT_EQ(four_len, str6.Length());
+ EXPECT(str6.IsTwoByteString());
+ EXPECT_EQ(expected_len, str6.Length());
EXPECT(str6.Equals(str2));
const Array& array3 = Array::Handle(Array::New(3));
@@ -992,45 +987,51 @@
array3.SetAt(1, str1);
array3.SetAt(2, str2);
const String& str7 = String::Handle(String::ConcatAll(array3));
- EXPECT(str7.IsFourByteString());
+ EXPECT(str7.IsTwoByteString());
uint32_t fourfour[] = { 0x1D4D5, 0x1D4DE, 0x1D4E4, 0x1D4E1,
0x1D4D5, 0x1D4DE, 0x1D4E4, 0x1D4E1 };
intptr_t fourfour_len = sizeof(fourfour) / sizeof(fourfour[0]);
- EXPECT_EQ(fourfour_len, str7.Length());
- EXPECT(str7.Equals(fourfour, fourfour_len));
+ EXPECT_EQ((fourfour_len * 2), str7.Length());
+ const String& fourfour_str =
+ String::Handle(String::New(fourfour, fourfour_len));
+ EXPECT(str7.Equals(fourfour_str));
}
- // Concatenate non-empty 4-byte strings.
+ // Concatenate non-empty strings built from 4-byte elements.
{
const uint32_t one[] = { 0x105D0, 0x105D9, 0x105D9, 0x105DF };
intptr_t one_len = sizeof(one) / sizeof(one[0]);
const String& onestr = String::Handle(String::New(one, one_len));
- EXPECT(onestr.IsFourByteString());
- EXPECT_EQ(one_len, onestr.Length());
+ EXPECT(onestr.IsTwoByteString());
+ EXPECT_EQ((one_len *2), onestr.Length());
const uint32_t two[] = { 0x105E6, 0x105D5, 0x105D5, 0x105D9, 0x105D9 };
intptr_t two_len = sizeof(two) / sizeof(two[0]);
const String& twostr = String::Handle(String::New(two, two_len));
- EXPECT(twostr.IsFourByteString());
- EXPECT_EQ(two_len, twostr.Length());
+ EXPECT(twostr.IsTwoByteString());
+ EXPECT_EQ((two_len * 2), twostr.Length());
// Concat
const String& str1 = String::Handle(String::Concat(onestr, twostr));
- EXPECT(str1.IsFourByteString());
+ EXPECT(str1.IsTwoByteString());
const uint32_t one_two[] = { 0x105D0, 0x105D9, 0x105D9, 0x105DF,
0x105E6, 0x105D5, 0x105D5, 0x105D9, 0x105D9 };
intptr_t one_two_len = sizeof(one_two) / sizeof(one_two[0]);
- EXPECT_EQ(one_two_len, str1.Length());
- EXPECT(str1.Equals(one_two, one_two_len));
+ EXPECT_EQ((one_two_len * 2), str1.Length());
+ const String& one_two_str =
+ String::Handle(String::New(one_two, one_two_len));
+ EXPECT(str1.Equals(one_two_str));
const String& str2 = String::Handle(String::Concat(twostr, onestr));
- EXPECT(str2.IsFourByteString());
+ EXPECT(str2.IsTwoByteString());
const uint32_t two_one[] = { 0x105E6, 0x105D5, 0x105D5, 0x105D9, 0x105D9,
0x105D0, 0x105D9, 0x105D9, 0x105DF };
intptr_t two_one_len = sizeof(two_one) / sizeof(two_one[0]);
- EXPECT_EQ(two_one_len, str2.Length());
- EXPECT(str2.Equals(two_one, two_one_len));
+ EXPECT_EQ((two_one_len * 2), str2.Length());
+ const String& two_one_str =
+ String::Handle(String::New(two_one, two_one_len));
+ EXPECT(str2.Equals(two_one_str));
// ConcatAll
@@ -1039,18 +1040,18 @@
array1.SetAt(0, onestr);
array1.SetAt(1, twostr);
const String& str3 = String::Handle(String::ConcatAll(array1));
- EXPECT(str3.IsFourByteString());
- EXPECT_EQ(one_two_len, str3.Length());
- EXPECT(str3.Equals(one_two, one_two_len));
+ EXPECT(str3.IsTwoByteString());
+ EXPECT_EQ((one_two_len * 2), str3.Length());
+ EXPECT(str3.Equals(one_two_str));
const Array& array2 = Array::Handle(Array::New(2));
EXPECT_EQ(2, array2.Length());
array2.SetAt(0, twostr);
array2.SetAt(1, onestr);
const String& str4 = String::Handle(String::ConcatAll(array2));
- EXPECT(str4.IsFourByteString());
- EXPECT_EQ(two_one_len, str4.Length());
- EXPECT(str4.Equals(two_one, two_one_len));
+ EXPECT(str4.IsTwoByteString());
+ EXPECT_EQ((two_one_len * 2), str4.Length());
+ EXPECT(str4.Equals(two_one_str));
const Array& array3 = Array::Handle(Array::New(3));
EXPECT_EQ(3, array3.Length());
@@ -1058,14 +1059,16 @@
array3.SetAt(1, twostr);
array3.SetAt(2, onestr);
const String& str5 = String::Handle(String::ConcatAll(array3));
- EXPECT(str5.IsFourByteString());
+ EXPECT(str5.IsTwoByteString());
const uint32_t one_two_one[] = { 0x105D0, 0x105D9, 0x105D9, 0x105DF,
0x105E6, 0x105D5, 0x105D5, 0x105D9,
0x105D9,
0x105D0, 0x105D9, 0x105D9, 0x105DF };
intptr_t one_two_one_len = sizeof(one_two_one) / sizeof(one_two_one[0]);
- EXPECT_EQ(one_two_one_len, str5.Length());
- EXPECT(str5.Equals(one_two_one, one_two_one_len));
+ EXPECT_EQ((one_two_one_len * 2), str5.Length());
+ const String& one_two_one_str =
+ String::Handle(String::New(one_two_one, one_two_one_len));
+ EXPECT(str5.Equals(one_two_one_str));
const Array& array4 = Array::Handle(Array::New(3));
EXPECT_EQ(3, array4.Length());
@@ -1073,15 +1076,17 @@
array4.SetAt(1, onestr);
array4.SetAt(2, twostr);
const String& str6 = String::Handle(String::ConcatAll(array4));
- EXPECT(str6.IsFourByteString());
+ EXPECT(str6.IsTwoByteString());
const uint32_t two_one_two[] = { 0x105E6, 0x105D5, 0x105D5, 0x105D9,
0x105D9,
0x105D0, 0x105D9, 0x105D9, 0x105DF,
0x105E6, 0x105D5, 0x105D5, 0x105D9,
0x105D9 };
intptr_t two_one_two_len = sizeof(two_one_two) / sizeof(two_one_two[0]);
- EXPECT_EQ(two_one_two_len, str6.Length());
- EXPECT(str6.Equals(two_one_two, two_one_two_len));
+ EXPECT_EQ((two_one_two_len * 2), str6.Length());
+ const String& two_one_two_str =
+ String::Handle(String::New(two_one_two, two_one_two_len));
+ EXPECT(str6.Equals(two_one_two_str));
}
// Concatenate 1-byte strings and 2-byte strings.
@@ -1148,192 +1153,6 @@
intptr_t two_one_two_len = sizeof(two_one_two) / sizeof(two_one_two[0]);
EXPECT(two_one_two_str.Equals(two_one_two, two_one_two_len));
}
-
- // Concatenate 1-byte strings and 4-byte strings.
- {
- const uint8_t one[] = { 'o', 'n', 'e', ' ', 'b', 'y', 't', 'e' };
- intptr_t one_len = sizeof(one) / sizeof(one[0]);
- const String& onestr = String::Handle(String::New(one, one_len));
- EXPECT(onestr.IsOneByteString());
- EXPECT_EQ(one_len, onestr.Length());
- EXPECT(onestr.Equals(one, one_len));
-
- uint32_t four[] = { 0x1D4D5, 0x1D4DE, 0x1D4E4, 0x1D4E1 };
- intptr_t four_len = sizeof(four) / sizeof(four[0]);
- const String& fourstr = String::Handle(String::New(four, four_len));
- EXPECT(fourstr.IsFourByteString());
- EXPECT_EQ(four_len, fourstr.Length());
- EXPECT(fourstr.Equals(four, four_len));
-
- // Concat
-
- const String& one_four_str = String::Handle(String::Concat(onestr,
- fourstr));
- EXPECT(one_four_str.IsFourByteString());
- uint32_t one_four[] = { 'o', 'n', 'e', ' ', 'b', 'y', 't', 'e',
- 0x1D4D5, 0x1D4DE, 0x1D4E4, 0x1D4E1 };
- intptr_t one_four_len = sizeof(one_four) / sizeof(one_four[0]);
- EXPECT_EQ(one_four_len, one_four_str.Length());
- EXPECT(one_four_str.Equals(one_four, one_four_len));
-
- const String& four_one_str = String::Handle(String::Concat(fourstr,
- onestr));
- EXPECT(four_one_str.IsFourByteString());
- uint32_t four_one[] = { 0x1D4D5, 0x1D4DE, 0x1D4E4, 0x1D4E1,
- 'o', 'n', 'e', ' ', 'b', 'y', 't', 'e' };
- intptr_t four_one_len = sizeof(four_one) / sizeof(four_one[0]);
- EXPECT_EQ(four_one_len, four_one_str.Length());
- EXPECT(four_one_str.Equals(four_one, four_one_len));
-
- // ConcatAll
-
- const Array& array1 = Array::Handle(Array::New(3));
- EXPECT_EQ(3, array1.Length());
- array1.SetAt(0, onestr);
- array1.SetAt(1, fourstr);
- array1.SetAt(2, onestr);
- const String& one_four_one = String::Handle(String::ConcatAll(array1));
- EXPECT(one_four_one.IsFourByteString());
- EXPECT_EQ(onestr.Length()*2 + fourstr.Length(), one_four_one.Length());
-
- const Array& array2 = Array::Handle(Array::New(3));
- EXPECT_EQ(3, array2.Length());
- array2.SetAt(0, fourstr);
- array2.SetAt(1, onestr);
- array2.SetAt(2, fourstr);
- const String& four_one_four = String::Handle(String::ConcatAll(array2));
- EXPECT(four_one_four.IsFourByteString());
- EXPECT_EQ(fourstr.Length()*2 + onestr.Length(), four_one_four.Length());
- }
-
- // Concatenate 2-byte strings and 4-byte strings.
- {
- uint16_t two[] = { 0x05E6, 0x05D5, 0x05D5, 0x05D9, 0x05D9 };
- intptr_t two_len = sizeof(two) / sizeof(two[0]);
- const String& twostr = String::Handle(String::New(two, two_len));
- EXPECT(twostr.IsTwoByteString());
- EXPECT_EQ(two_len, twostr.Length());
- EXPECT(twostr.Equals(two, two_len));
-
- uint32_t four[] = { 0x1D4D5, 0x1D4DE, 0x1D4E4, 0x1D4E1 };
- intptr_t four_len = sizeof(four) / sizeof(four[0]);
- const String& fourstr = String::Handle(String::New(four, four_len));
- EXPECT(fourstr.IsFourByteString());
- EXPECT_EQ(four_len, fourstr.Length());
- EXPECT(fourstr.Equals(four, four_len));
-
- // Concat
-
- const String& two_four_str = String::Handle(String::Concat(twostr,
- fourstr));
- EXPECT(two_four_str.IsFourByteString());
- uint32_t two_four[] = { 0x05E6, 0x05D5, 0x05D5, 0x05D9, 0x05D9,
- 0x1D4D5, 0x1D4DE, 0x1D4E4, 0x1D4E1 };
- intptr_t two_four_len = sizeof(two_four) / sizeof(two_four[0]);
- EXPECT_EQ(two_four_len, two_four_str.Length());
- EXPECT(two_four_str.Equals(two_four, two_four_len));
-
- const String& four_two_str = String::Handle(String::Concat(fourstr,
- twostr));
- EXPECT(four_two_str.IsFourByteString());
- uint32_t four_two[] = { 0x1D4D5, 0x1D4DE, 0x1D4E4, 0x1D4E1,
- 0x05E6, 0x05D5, 0x05D5, 0x05D9, 0x05D9 };
- intptr_t four_two_len = sizeof(four_two) / sizeof(four_two[0]);
- EXPECT_EQ(four_two_len, four_two_str.Length());
- EXPECT(four_two_str.Equals(four_two, four_two_len));
-
- // ConcatAll
-
- const Array& array1 = Array::Handle(Array::New(3));
- EXPECT_EQ(3, array1.Length());
- array1.SetAt(0, twostr);
- array1.SetAt(1, fourstr);
- array1.SetAt(2, twostr);
- const String& two_four_two_str = String::Handle(String::ConcatAll(array1));
- EXPECT(two_four_two_str.IsFourByteString());
- EXPECT_EQ(twostr.Length()*2 + fourstr.Length(), two_four_two_str.Length());
-
- const Array& array2 = Array::Handle(Array::New(3));
- EXPECT_EQ(3, array2.Length());
- array2.SetAt(0, fourstr);
- array2.SetAt(1, twostr);
- array2.SetAt(2, fourstr);
- const String& four_two_four_str = String::Handle(String::ConcatAll(array2));
- EXPECT(four_two_four_str.IsFourByteString());
- EXPECT_EQ(fourstr.Length()*2 + twostr.Length(), four_two_four_str.Length());
- }
-
- // Concatenate 1-byte, 2-byte and 4-byte strings.
- {
- const uint8_t one[] = { 'o', 'n', 'e', ' ', 'b', 'y', 't', 'e' };
- intptr_t one_len = sizeof(one) / sizeof(one[0]);
- const String& onestr = String::Handle(String::New(one, one_len));
- EXPECT(onestr.IsOneByteString());
- EXPECT_EQ(one_len, onestr.Length());
- EXPECT(onestr.Equals(one, one_len));
-
- uint16_t two[] = { 0x05E6, 0x05D5, 0x05D5, 0x05D9, 0x05D9 };
- intptr_t two_len = sizeof(two) / sizeof(two[0]);
- const String& twostr = String::Handle(String::New(two, two_len));
- EXPECT(twostr.IsTwoByteString());
- EXPECT_EQ(two_len, twostr.Length());
- EXPECT(twostr.Equals(two, two_len));
-
- uint32_t four[] = { 0x1D4D5, 0x1D4DE, 0x1D4E4, 0x1D4E1 };
- intptr_t four_len = sizeof(four) / sizeof(four[0]);
- const String& fourstr = String::Handle(String::New(four, four_len));
- EXPECT(fourstr.IsFourByteString());
- EXPECT_EQ(four_len, fourstr.Length());
- EXPECT(fourstr.Equals(four, four_len));
-
- // Last element is a 4-byte string.
- const Array& array1 = Array::Handle(Array::New(3));
- EXPECT_EQ(3, array1.Length());
- array1.SetAt(0, onestr);
- array1.SetAt(1, twostr);
- array1.SetAt(2, fourstr);
- const String& one_two_four_str = String::Handle(String::ConcatAll(array1));
- EXPECT(one_two_four_str.IsFourByteString());
- EXPECT_EQ(onestr.Length() + twostr.Length() + fourstr.Length(),
- one_two_four_str.Length());
- uint32_t one_two_four[] = { 'o', 'n', 'e', ' ', 'b', 'y', 't', 'e',
- 0x05E6, 0x05D5, 0x05D5, 0x05D9, 0x05D9,
- 0x1D4D5, 0x1D4DE, 0x1D4E4, 0x1D4E1 };
- intptr_t one_two_four_len = sizeof(one_two_four) / sizeof(one_two_four[0]);
- EXPECT(one_two_four_str.Equals(one_two_four, one_two_four_len));
-
- // Middle element is a 4-byte string.
- const Array& array2 = Array::Handle(Array::New(3));
- EXPECT_EQ(3, array2.Length());
- array2.SetAt(0, onestr);
- array2.SetAt(1, fourstr);
- array2.SetAt(2, twostr);
- const String& one_four_two_str = String::Handle(String::ConcatAll(array2));
- EXPECT(one_four_two_str.IsFourByteString());
- EXPECT_EQ(onestr.Length() + fourstr.Length() + twostr.Length(),
- one_four_two_str.Length());
- uint32_t one_four_two[] = { 'o', 'n', 'e', ' ', 'b', 'y', 't', 'e',
- 0x1D4D5, 0x1D4DE, 0x1D4E4, 0x1D4E1,
- 0x05E6, 0x05D5, 0x05D5, 0x05D9, 0x05D9 };
- intptr_t one_four_two_len = sizeof(one_four_two) / sizeof(one_four_two[0]);
- EXPECT(one_four_two_str.Equals(one_four_two, one_four_two_len));
-
- // First element is a 4-byte string.
- const Array& array3 = Array::Handle(Array::New(3));
- EXPECT_EQ(3, array3.Length());
- array3.SetAt(0, fourstr);
- array3.SetAt(1, onestr);
- array3.SetAt(2, twostr);
- const String& four_one_two_str = String::Handle(String::ConcatAll(array3));
- EXPECT(one_four_two_str.IsFourByteString());
- EXPECT_EQ(onestr.Length() + fourstr.Length() + twostr.Length(),
- one_four_two_str.Length());
- uint32_t four_one_two[] = { 0x1D4D5, 0x1D4DE, 0x1D4E4, 0x1D4E1,
- 'o', 'n', 'e', ' ', 'b', 'y', 't', 'e',
- 0x05E6, 0x05D5, 0x05D5, 0x05D9, 0x05D9 };
- intptr_t four_one_two_len = sizeof(four_one_two) / sizeof(four_one_two[0]);
- EXPECT(four_one_two_str.Equals(four_one_two, four_one_two_len));
- }
}
@@ -1344,16 +1163,18 @@
const String& onestr = String::Handle(String::New(onechars));
EXPECT(!onestr.IsNull());
- EXPECT(onestr.IsOneByteString());
+ EXPECT(!onestr.IsOneByteString());
+ EXPECT(onestr.IsTwoByteString());
const String& onesub = String::Handle(String::SubString(onestr, 0));
EXPECT(!onesub.IsNull());
- EXPECT(onestr.IsOneByteString());
+ EXPECT(!onestr.IsOneByteString());
+ EXPECT(onestr.IsTwoByteString());
EXPECT_EQ(onesub.Length(), 3);
// Create 1- and 2-byte substrings from a 2-byte source string.
const char* twochars =
- "\xC3\xB6\xC3\xB1\xC3\xA9"
+ "\x1f\x2f\x3f"
"\xE1\xB9\xAB\xE1\xBA\x85\xE1\xB9\x93";
const String& twostr = String::Handle(String::New(twochars));
@@ -1370,15 +1191,15 @@
EXPECT(twosub2.IsTwoByteString());
EXPECT_EQ(twosub2.Length(), 3);
- // Create 1-, 2-, and 4-byte substrings from a 4-byte source string.
+ // Create substrings from a string built using 1-, 2- and 4-byte elements.
const char* fourchars =
- "\xC3\xB6\xC3\xB1\xC3\xA9"
+ "\x1f\x2f\x3f"
"\xE1\xB9\xAB\xE1\xBA\x85\xE1\xB9\x93"
"\xF0\x9D\x96\xBF\xF0\x9D\x97\x88\xF0\x9D\x97\x8E\xF0\x9D\x97\x8B";
const String& fourstr = String::Handle(String::New(fourchars));
EXPECT(!fourstr.IsNull());
- EXPECT(fourstr.IsFourByteString());
+ EXPECT(fourstr.IsTwoByteString());
const String& foursub1 = String::Handle(String::SubString(fourstr, 0, 3));
EXPECT(!foursub1.IsNull());
@@ -1391,9 +1212,9 @@
EXPECT_EQ(foursub2.Length(), 3);
const String& foursub4 = String::Handle(String::SubString(fourstr, 6));
- EXPECT_EQ(foursub4.Length(), 4);
+ EXPECT_EQ(foursub4.Length(), 8);
EXPECT(!foursub4.IsNull());
- EXPECT(foursub4.IsFourByteString());
+ EXPECT(foursub4.IsTwoByteString());
}
@@ -1440,7 +1261,7 @@
0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF,
};
const String& str = String::Handle(String::New(src));
- EXPECT(str.IsOneByteString());
+ EXPECT(str.IsTwoByteString());
intptr_t expected_length = sizeof(expected);
EXPECT_EQ(expected_length, str.Length());
for (int i = 0; i < str.Length(); ++i) {
@@ -1466,7 +1287,7 @@
}
}
- // Create a 2-byte string from UTF-8 encoded 1- and 2-byte
+ // Create a BMP 2-byte string from UTF-8 encoded 1- and 2-byte
// characters.
{
const char* src =
@@ -1491,22 +1312,23 @@
}
}
- // Create a 4-byte string from a UTF-8 string literal.
+ // Create a SMP 2-byte string from a UTF-8 string literal.
{
const char* src =
"\xF0\x9D\x91\xA0\xF0\x9D\x91\xA1"
"\xF0\x9D\x91\xA2\xF0\x9D\x91\xA3";
- const intptr_t expected[] = { 0x1D460, 0x1D461, 0x1D462, 0x1D463 };
+ const intptr_t expected[] = { 0xd835, 0xdc60, 0xd835, 0xdc61,
+ 0xd835, 0xdc62, 0xd835, 0xdc63 };
const String& str = String::Handle(String::New(src));
- EXPECT(str.IsFourByteString());
- intptr_t expected_size = sizeof(expected) / sizeof(expected[0]);
+ EXPECT(str.IsTwoByteString());
+ intptr_t expected_size = (sizeof(expected) / sizeof(expected[0]));
EXPECT_EQ(expected_size, str.Length());
for (int i = 0; i < str.Length(); ++i) {
EXPECT_EQ(expected[i], str.CharAt(i));
}
}
- // Create a 4-byte string from UTF-8 encoded 2- and 4-byte
+ // Create a 2-byte string from UTF-8 encoded 2- and 4-byte
// characters.
{
const char* src =
@@ -1519,10 +1341,11 @@
"\xF0\x9E\x80\x80\xF0\x9F\x80\x80";
const intptr_t expected[] = {
0x0A00, 0x0B00, 0x0C00, 0x0D00, 0x0E00, 0x0F00, 0xA000, 0xB000, 0xC000,
- 0xD000, 0xE000, 0xF000, 0x1A000, 0x1B000, 0x1D000, 0x1E000, 0x1F000
+ 0xD000, 0xE000, 0xF000, 0xD828, 0xDC00, 0xD82c, 0xDC00, 0xD834, 0xDC00,
+ 0xD838, 0xDC00, 0xD83c, 0xDC00,
};
const String& str = String::Handle(String::New(src));
- EXPECT(str.IsFourByteString());
+ EXPECT(str.IsTwoByteString());
intptr_t expected_size = sizeof(expected) / sizeof(expected[0]);
EXPECT_EQ(expected_size, str.Length());
for (int i = 0; i < str.Length(); ++i) {
@@ -1530,7 +1353,7 @@
}
}
- // Create a 4-byte string from UTF-8 encoded 1-, 2- and 4-byte
+ // Create a 2-byte string from UTF-8 encoded 1-, 2- and 4-byte
// characters.
{
const char* src =
@@ -1548,10 +1371,11 @@
0x000A, 0x000B, 0x000D, 0x000C, 0x000E, 0x000F, 0x00A0, 0x00B0,
0x00C0, 0x00D0, 0x00E0, 0x00F0, 0x0A00, 0x0B00, 0x0C00, 0x0D00,
0x0E00, 0x0F00, 0xA000, 0xB000, 0xC000, 0xD000, 0xE000, 0xF000,
- 0x1A000, 0x1B000, 0x1D000, 0x1E000, 0x1F000
+ 0xD828, 0xDC00, 0xD82c, 0xDC00, 0xD834, 0xDC00, 0xD838, 0xDC00,
+ 0xD83c, 0xDC00,
};
const String& str = String::Handle(String::New(src));
- EXPECT(str.IsFourByteString());
+ EXPECT(str.IsTwoByteString());
intptr_t expected_size = sizeof(expected) / sizeof(expected[0]);
EXPECT_EQ(expected_size, str.Length());
for (int i = 0; i < str.Length(); ++i) {
@@ -1626,42 +1450,6 @@
}
-TEST_CASE(ExternalFourByteString) {
- uint32_t characters[] = { 0x1D5BF, 0x1D5C8, 0x1D5CE, 0x1D5CB };
- intptr_t len = ARRAY_SIZE(characters);
-
- const String& str =
- String::Handle(
- ExternalFourByteString::New(characters, len, NULL, NULL, Heap::kNew));
- EXPECT(!str.IsFourByteString());
- EXPECT(str.IsExternalFourByteString());
- EXPECT_EQ(str.Length(), len);
- EXPECT(str.Equals("\xF0\x9D\x96\xBF\xF0\x9D\x97\x88"
- "\xF0\x9D\x97\x8E\xF0\x9D\x97\x8B"));
-
- const String& copy = String::Handle(String::SubString(str, 0, len));
- EXPECT(!copy.IsExternalFourByteString());
- EXPECT(copy.IsFourByteString());
- EXPECT_EQ(len, copy.Length());
- EXPECT(copy.Equals(str));
-
- const String& concat = String::Handle(String::Concat(str, str));
- EXPECT(!concat.IsExternalFourByteString());
- EXPECT(concat.IsFourByteString());
- EXPECT_EQ(len * 2, concat.Length());
- EXPECT(concat.Equals("\xF0\x9D\x96\xBF\xF0\x9D\x97\x88"
- "\xF0\x9D\x97\x8E\xF0\x9D\x97\x8B"
- "\xF0\x9D\x96\xBF\xF0\x9D\x97\x88"
- "\xF0\x9D\x97\x8E\xF0\x9D\x97\x8B"));
-
- const String& substr = String::Handle(String::SubString(str, 1, 2));
- EXPECT(!substr.IsExternalFourByteString());
- EXPECT(substr.IsFourByteString());
- EXPECT_EQ(2, substr.Length());
- EXPECT(substr.Equals("\xF0\x9D\x97\x88\xF0\x9D\x97\x8E"));
-}
-
-
TEST_CASE(Symbol) {
const String& one = String::Handle(Symbols::New("Eins"));
EXPECT(one.IsSymbol());
@@ -2846,7 +2634,7 @@
"}\n";
Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
EXPECT_VALID(lib);
- Dart_Handle result = Dart_Invoke(lib, Dart_NewString("main"), 0, NULL);
+ Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, NULL);
EXPECT_ERROR(
result,
"Unhandled exception:\n"
diff --git a/runtime/vm/parser.cc b/runtime/vm/parser.cc
index ef5e8ae..49a088d 100644
--- a/runtime/vm/parser.cc
+++ b/runtime/vm/parser.cc
@@ -976,16 +976,13 @@
token_stack.Add(token);
break;
case Token::kRBRACE:
- is_match = token_stack.Last() == Token::kLBRACE;
- token_stack.RemoveLast();
+ is_match = token_stack.RemoveLast() == Token::kLBRACE;
break;
case Token::kRPAREN:
- is_match = token_stack.Last() == Token::kLPAREN;
- token_stack.RemoveLast();
+ is_match = token_stack.RemoveLast() == Token::kLPAREN;
break;
case Token::kRBRACK:
- is_match = token_stack.Last() == Token::kLBRACK;
- token_stack.RemoveLast();
+ is_match = token_stack.RemoveLast() == Token::kLBRACK;
break;
case Token::kEOS:
unexpected_token_found = true;
@@ -1302,37 +1299,61 @@
}
-// Lookup class in the coreimpl lib which also contains various VM
+// Lookup class in the core lib which also contains various VM
// helper methods and classes. Allow look up of private classes.
-static RawClass* LookupCoreImplClass(const String& class_name) {
- const Library& coreimpl_lib = Library::Handle(Library::CoreImplLibrary());
+static RawClass* LookupCoreClass(const String& class_name) {
+ const Library& core_lib = Library::Handle(Library::CoreLibrary());
String& name = String::Handle(class_name.raw());
if (class_name.CharAt(0) == Scanner::kPrivateIdentifierStart) {
// Private identifiers are mangled on a per script basis.
- name = String::Concat(name, String::Handle(coreimpl_lib.private_key()));
+ name = String::Concat(name, String::Handle(core_lib.private_key()));
name = Symbols::New(name);
}
- return coreimpl_lib.LookupClass(name);
+ return core_lib.LookupClass(name);
}
-ArgumentListNode* Parser::BuildNoSuchMethodArguments(
+StaticCallNode* Parser::BuildInvocationMirrorAllocation(
+ intptr_t call_pos,
const String& function_name,
const ArgumentListNode& function_args) {
- ASSERT(function_args.length() >= 1); // The receiver is the first argument.
const intptr_t args_pos = function_args.token_pos();
+ // Build arguments to the call to the static
+ // InvocationMirror._allocateInvocationMirror method.
ArgumentListNode* arguments = new ArgumentListNode(args_pos);
- arguments->Add(function_args.NodeAt(0));
- // The second argument is the original function name.
- // TODO(regis): This will change once mirrors are supported.
+ // The first argument is the original function name.
arguments->Add(new LiteralNode(args_pos, function_name));
- // The third argument is an array containing the original function arguments.
+ // The second argument is an array containing the original function arguments.
ArrayNode* args_array = new ArrayNode(
args_pos, Type::ZoneHandle(Type::ListInterface()));
for (intptr_t i = 1; i < function_args.length(); i++) {
args_array->AddElement(function_args.NodeAt(i));
}
arguments->Add(args_array);
+ // Lookup the static InvocationMirror._allocateInvocationMirror method.
+ const Class& mirror_class = Class::Handle(
+ LookupCoreClass(String::Handle(Symbols::InvocationMirror())));
+ ASSERT(!mirror_class.IsNull());
+ const String& allocation_function_name =
+ String::Handle(Symbols::AllocateInvocationMirror());
+ const Function& allocation_function = Function::ZoneHandle(
+ mirror_class.LookupStaticFunction(allocation_function_name));
+ ASSERT(!allocation_function.IsNull());
+ return new StaticCallNode(call_pos, allocation_function, arguments);
+}
+
+
+ArgumentListNode* Parser::BuildNoSuchMethodArguments(
+ intptr_t call_pos,
+ const String& function_name,
+ const ArgumentListNode& function_args) {
+ ASSERT(function_args.length() >= 1); // The receiver is the first argument.
+ const intptr_t args_pos = function_args.token_pos();
+ ArgumentListNode* arguments = new ArgumentListNode(args_pos);
+ arguments->Add(function_args.NodeAt(0));
+ // The second argument is the invocation mirror.
+ arguments->Add(BuildInvocationMirrorAllocation(
+ call_pos, function_name, function_args));
return arguments;
}
@@ -1368,7 +1389,8 @@
arguments->Add(receiver);
ParseActualParameters(arguments, kAllowConst);
if (is_no_such_method) {
- arguments = BuildNoSuchMethodArguments(function_name, *arguments);
+ arguments = BuildNoSuchMethodArguments(
+ supercall_pos, function_name, *arguments);
}
return new StaticCallNode(supercall_pos, super_function, arguments);
}
@@ -1386,6 +1408,38 @@
}
+AstNode* Parser::BuildUnarySuperOperator(Token::Kind op, PrimaryNode* super) {
+ ASSERT(super->IsSuper());
+ AstNode* super_op = NULL;
+ const intptr_t super_pos = super->token_pos();
+ if ((op == Token::kNEGATE) ||
+ (op == Token::kBIT_NOT)) {
+ // Resolve the operator function in the superclass.
+ const String& operator_function_name =
+ String::ZoneHandle(Symbols::New(Token::Str(op)));
+ const bool kResolveGetter = false;
+ bool is_no_such_method = false;
+ const Function& super_operator = Function::ZoneHandle(
+ GetSuperFunction(super_pos,
+ operator_function_name,
+ kResolveGetter,
+ &is_no_such_method));
+ ArgumentListNode* op_arguments = new ArgumentListNode(super_pos);
+ AstNode* receiver = LoadReceiver(super_pos);
+ op_arguments->Add(receiver);
+ CheckFunctionIsCallable(super_pos, super_operator);
+ if (is_no_such_method) {
+ op_arguments = BuildNoSuchMethodArguments(
+ super_pos, operator_function_name, *op_arguments);
+ }
+ super_op = new StaticCallNode(super_pos, super_operator, op_arguments);
+ } else {
+ ErrorMsg(super_pos, "illegal super operator call");
+ }
+ return super_op;
+}
+
+
AstNode* Parser::ParseSuperOperator() {
TRACE_PARSER("ParseSuperOperator");
AstNode* super_op = NULL;
@@ -1395,74 +1449,11 @@
ConsumeToken();
AstNode* index_expr = ParseExpr(kAllowConst, kConsumeCascades);
ExpectToken(Token::kRBRACK);
-
- if (Token::IsAssignmentOperator(CurrentToken()) &&
- (CurrentToken() != Token::kASSIGN)) {
- // Compound assignment. Ensure side effects in index expression
- // only execute once. If the index is not a local variable or an
- // literal, evaluate and save in a temporary local.
- if (!IsSimpleLocalOrLiteralNode(index_expr)) {
- LocalVariable* temp =
- CreateTempConstVariable(operator_pos, "lix");
- AstNode* save = new StoreLocalNode(operator_pos, temp, index_expr);
- current_block_->statements->Add(save);
- index_expr = new LoadLocalNode(operator_pos, temp);
- }
- }
-
- // Resolve the [] operator function in the superclass.
- const String& index_operator_name =
- String::ZoneHandle(Symbols::IndexToken());
- const bool kResolveGetter = false;
- bool is_no_such_method = false;
- const Function& index_operator = Function::ZoneHandle(
- GetSuperFunction(operator_pos,
- index_operator_name,
- kResolveGetter,
- &is_no_such_method));
-
- ArgumentListNode* index_op_arguments = new ArgumentListNode(operator_pos);
AstNode* receiver = LoadReceiver(operator_pos);
- index_op_arguments->Add(receiver);
- index_op_arguments->Add(index_expr);
-
- if (is_no_such_method) {
- index_op_arguments = BuildNoSuchMethodArguments(index_operator_name,
- *index_op_arguments);
- }
- super_op = new StaticCallNode(
- operator_pos, index_operator, index_op_arguments);
-
- if (Token::IsAssignmentOperator(CurrentToken())) {
- Token::Kind assignment_op = CurrentToken();
- ConsumeToken();
- AstNode* value = ParseExpr(kAllowConst, kConsumeCascades);
-
- value = ExpandAssignableOp(operator_pos, assignment_op, super_op, value);
-
- // Resolve the []= operator function in the superclass.
- const String& assign_index_operator_name =
- String::ZoneHandle(Symbols::AssignIndexToken());
- const bool kResolveGetter = false;
- bool is_no_such_method = false;
- const Function& assign_index_operator = Function::ZoneHandle(
- GetSuperFunction(operator_pos,
- assign_index_operator_name,
- kResolveGetter,
- &is_no_such_method));
-
- ArgumentListNode* operator_args = new ArgumentListNode(operator_pos);
- operator_args->Add(LoadReceiver(operator_pos));
- operator_args->Add(index_expr);
- operator_args->Add(value);
-
- if (is_no_such_method) {
- operator_args = BuildNoSuchMethodArguments(assign_index_operator_name,
- *operator_args);
- }
- super_op = new StaticCallNode(
- operator_pos, assign_index_operator, operator_args);
- }
+ const Class& super_class = Class::ZoneHandle(current_class().SuperClass());
+ ASSERT(!super_class.IsNull());
+ super_op =
+ new LoadIndexedNode(operator_pos, receiver, index_expr, super_class);
} else if (Token::CanBeOverloaded(CurrentToken()) ||
(CurrentToken() == Token::kNE)) {
Token::Kind op = CurrentToken();
@@ -1495,8 +1486,8 @@
CheckFunctionIsCallable(operator_pos, super_operator);
if (is_no_such_method) {
- op_arguments = BuildNoSuchMethodArguments(operator_function_name,
- *op_arguments);
+ op_arguments = BuildNoSuchMethodArguments(
+ operator_pos, operator_function_name, *op_arguments);
}
super_op = new StaticCallNode(operator_pos, super_operator, op_arguments);
if (negate_result) {
@@ -3110,7 +3101,7 @@
const intptr_t class_pos = TokenPos();
ExpectToken(Token::kCLASS);
const intptr_t classname_pos = TokenPos();
- String& class_name = *ExpectClassIdentifier("class name expected");
+ String& class_name = *ExpectUserDefinedTypeIdentifier("class name expected");
if (FLAG_trace_parser) {
OS::Print("TopLevel parsing class '%s'\n", class_name.ToCString());
}
@@ -3354,7 +3345,7 @@
const intptr_t alias_name_pos = TokenPos();
const String* alias_name =
- ExpectClassIdentifier("function alias name expected");
+ ExpectUserDefinedTypeIdentifier("function alias name expected");
// Parse the type parameters of the function type.
ParseTypeParameters(alias_owner);
@@ -3436,7 +3427,8 @@
const intptr_t interface_pos = TokenPos();
ExpectToken(Token::kINTERFACE);
const intptr_t interfacename_pos = TokenPos();
- String& interface_name = *ExpectClassIdentifier("interface name expected");
+ String& interface_name =
+ *ExpectUserDefinedTypeIdentifier("interface name expected");
if (FLAG_trace_parser) {
OS::Print("TopLevel parsing interface '%s'\n", interface_name.ToCString());
}
@@ -3623,21 +3615,18 @@
do {
ConsumeToken();
SkipMetadata();
- if (CurrentToken() != Token::kIDENT) {
- ErrorMsg("type parameter name expected");
- }
- String& type_parameter_name = *CurrentLiteral();
const intptr_t type_parameter_pos = TokenPos();
+ String& type_parameter_name =
+ *ExpectUserDefinedTypeIdentifier("type parameter expected");
// Check for duplicate type parameters.
for (intptr_t i = 0; i < index; i++) {
existing_type_parameter ^= type_parameters_array.At(i);
existing_type_parameter_name = existing_type_parameter.name();
if (existing_type_parameter_name.Equals(type_parameter_name)) {
- ErrorMsg("duplicate type parameter '%s'",
+ ErrorMsg(type_parameter_pos, "duplicate type parameter '%s'",
type_parameter_name.ToCString());
}
}
- ConsumeToken();
if (CurrentToken() == Token::kEXTENDS) {
ConsumeToken();
// A bound may refer to the owner of the type parameter it applies to,
@@ -5837,7 +5826,7 @@
AstNode* Parser::MakeStaticCall(const String& cls_name,
const String& func_name,
ArgumentListNode* arguments) {
- const Class& cls = Class::Handle(LookupImplClass(cls_name));
+ const Class& cls = Class::Handle(LookupCoreClass(cls_name));
ASSERT(!cls.IsNull());
const Function& func = Function::ZoneHandle(
Resolver::ResolveStatic(cls,
@@ -6618,7 +6607,7 @@
}
-String* Parser::ExpectClassIdentifier(const char* msg) {
+String* Parser::ExpectUserDefinedTypeIdentifier(const char* msg) {
if (CurrentToken() != Token::kIDENT) {
ErrorMsg("%s", msg);
}
@@ -6720,6 +6709,10 @@
TRACE_PARSER("ParseBinaryExpr");
ASSERT(min_preced >= 4);
AstNode* left_operand = ParseUnaryExpr();
+ if (left_operand->IsPrimaryNode() &&
+ (left_operand->AsPrimaryNode()->IsSuper())) {
+ ErrorMsg(left_operand->token_pos(), "illegal use of 'super'");
+ }
if (IsLiteral("as")) { // Not a reserved word.
token_kind_ = Token::kAS;
}
@@ -6783,12 +6776,13 @@
bool Parser::IsAssignableExpr(AstNode* expr) {
- return expr->IsPrimaryNode()
- || (expr->IsLoadLocalNode() && !expr->AsLoadLocalNode()->HasPseudo())
+ return (expr->IsLoadLocalNode() && !expr->AsLoadLocalNode()->HasPseudo()
+ && (!expr->AsLoadLocalNode()->local().is_final()))
|| expr->IsLoadStaticFieldNode()
|| expr->IsStaticGetterNode()
|| expr->IsInstanceGetterNode()
- || expr->IsLoadIndexedNode();
+ || expr->IsLoadIndexedNode()
+ || (expr->IsPrimaryNode() && !expr->AsPrimaryNode()->IsSuper());
}
@@ -6936,11 +6930,14 @@
CreateTempConstVariable(token_pos, "lia");
StoreLocalNode* save =
new StoreLocalNode(token_pos, temp, left_node->array());
- left_node =
- new LoadIndexedNode(token_pos, save, left_node->index_expr());
+ left_node = new LoadIndexedNode(token_pos,
+ save,
+ left_node->index_expr(),
+ left_node->super_class());
right_node = new LoadIndexedNode(token_pos,
new LoadLocalNode(token_pos, temp),
- right_node->index_expr());
+ right_node->index_expr(),
+ right_node->super_class());
}
if (!IsSimpleLocalOrLiteralNode(left_node->index_expr())) {
LocalVariable* temp =
@@ -6949,10 +6946,12 @@
new StoreLocalNode(token_pos, temp, left_node->index_expr());
left_node = new LoadIndexedNode(token_pos,
left_node->array(),
- save);
+ save,
+ left_node->super_class());
right_node = new LoadIndexedNode(token_pos,
right_node->array(),
- new LoadLocalNode(token_pos, temp));
+ new LoadLocalNode(token_pos, temp),
+ right_node->super_class());
}
*expr = right_node;
return left_node;
@@ -6989,6 +6988,9 @@
Field::SetterSymbol(original->AsStaticGetterNode()->field_name()));
result = ThrowNoSuchMethodError(original->token_pos(), setter_name);
}
+ // TODO(hausner): if we decide to throw a no such method error on
+ // assignment to a final variable, we need to do the same as in the
+ // StaticGetterNode above.
if ((result != NULL) &&
(result->IsStoreIndexedNode() ||
result->IsInstanceSetterNode() ||
@@ -7140,6 +7142,8 @@
ErrorMsg(op_pos, "unexpected operator '+'");
}
// Expression is the literal itself.
+ } else if (expr->IsPrimaryNode() && (expr->AsPrimaryNode()->IsSuper())) {
+ expr = BuildUnarySuperOperator(unary_op, expr->AsPrimaryNode());
} else {
expr = UnaryOpNode::UnaryOpOrLiteral(op_pos, unary_op, expr);
}
@@ -7160,6 +7164,7 @@
expr,
new LiteralNode(op_pos, Smi::ZoneHandle(Smi::New(1))));
AstNode* store = CreateAssignmentNode(left_expr, add);
+ ASSERT(store != NULL);
expr = store;
} else {
expr = ParsePostfixExpr();
@@ -7407,6 +7412,9 @@
}
PrimaryNode* primary = node->AsPrimaryNode();
if (primary->primary().IsString()) {
+ if (primary->IsSuper()) {
+ return primary;
+ }
// In a static method, evaluation of an unresolved identifier causes a
// NoSuchMethodError to be thrown.
// In an instance method, we convert this into a getter call
@@ -7458,6 +7466,9 @@
if (left->AsPrimaryNode()->primary().IsFunction()) {
left = LoadClosure(left->AsPrimaryNode());
} else {
+ // Super field access handled in ParseSuperFieldAccess(),
+ // super calls handled in ParseSuperCall().
+ ASSERT(!left->AsPrimaryNode()->IsSuper());
left = LoadFieldIfUnresolved(left);
}
}
@@ -7495,6 +7506,9 @@
}
}
} else if (CurrentToken() == Token::kLBRACK) {
+ // Super index operator handled in ParseSuperOperator().
+ ASSERT(!left->IsPrimaryNode() || !left->AsPrimaryNode()->IsSuper());
+
const intptr_t bracket_pos = TokenPos();
ConsumeToken();
left = LoadFieldIfUnresolved(left);
@@ -7513,7 +7527,10 @@
UNREACHABLE(); // Internal parser error.
}
}
- selector = new LoadIndexedNode(bracket_pos, array, index);
+ selector = new LoadIndexedNode(bracket_pos,
+ array,
+ index,
+ Class::ZoneHandle());
} else if (CurrentToken() == Token::kLPAREN) {
if (left->IsPrimaryNode()) {
PrimaryNode* primary = left->AsPrimaryNode();
@@ -7537,6 +7554,9 @@
}
} else if (primary->primary().IsString()) {
// Primary is an unresolved name.
+ if (primary->IsSuper()) {
+ ErrorMsg(primary->token_pos(), "illegal use of super");
+ }
String& name = String::CheckedZoneHandle(primary->primary().raw());
if (current_function().is_static()) {
selector = ThrowNoSuchMethodError(primary->token_pos(), name);
@@ -7571,6 +7591,10 @@
ErrorMsg(left->token_pos(),
"illegal use of class name '%s'",
cls_name.ToCString());
+ } else if (primary->IsSuper()) {
+ // Return "super" to handle unary super operator calls,
+ // or to report illegal use of "super" otherwise.
+ left = primary;
} else {
UNREACHABLE(); // Internal parser error.
}
@@ -8645,7 +8669,7 @@
String& list_literal_factory_class_name = String::Handle(
Symbols::ListLiteralFactoryClass());
const Class& list_literal_factory_class =
- Class::Handle(LookupCoreImplClass(list_literal_factory_class_name));
+ Class::Handle(LookupCoreClass(list_literal_factory_class_name));
ASSERT(!list_literal_factory_class.IsNull());
const String& list_literal_factory_name =
String::Handle(Symbols::ListLiteralFactory());
@@ -8870,7 +8894,7 @@
String& map_literal_factory_class_name = String::Handle(
Symbols::MapLiteralFactoryClass());
const Class& map_literal_factory_class =
- Class::Handle(LookupCoreImplClass(map_literal_factory_class_name));
+ Class::Handle(LookupCoreClass(map_literal_factory_class_name));
ASSERT(!map_literal_factory_class.IsNull());
const String& map_literal_factory_name =
String::Handle(Symbols::MapLiteralFactory());
@@ -9251,7 +9275,7 @@
String& Parser::Interpolate(ArrayNode* values) {
const String& class_name = String::Handle(Symbols::StringBase());
- const Class& cls = Class::Handle(LookupImplClass(class_name));
+ const Class& cls = Class::Handle(LookupCoreClass(class_name));
ASSERT(!cls.IsNull());
const String& func_name = String::Handle(Symbols::Interpolate());
const Function& func =
@@ -9509,6 +9533,10 @@
if (current_function().is_static()) {
ErrorMsg("cannot access superclass from static method");
}
+ if (current_class().SuperClass() == Class::null()) {
+ ErrorMsg("class '%s' does not have a superclass",
+ String::Handle(current_class().Name()).ToCString());
+ }
ConsumeToken();
if (CurrentToken() == Token::kPERIOD) {
ConsumeToken();
@@ -9523,7 +9551,8 @@
(CurrentToken() == Token::kNE)) {
primary = ParseSuperOperator();
} else {
- ErrorMsg("illegal super call");
+ primary = new PrimaryNode(TokenPos(),
+ String::ZoneHandle(Symbols::Super()));
}
} else if (CurrentToken() == Token::kCONDITIONAL) {
primary = ParseArgumentDefinitionTest();
diff --git a/runtime/vm/parser.h b/runtime/vm/parser.h
index 12c1302..69d27af 100644
--- a/runtime/vm/parser.h
+++ b/runtime/vm/parser.h
@@ -219,7 +219,7 @@
void ExpectToken(Token::Kind token_expected);
void ExpectSemicolon();
void UnexpectedToken();
- String* ExpectClassIdentifier(const char* msg);
+ String* ExpectUserDefinedTypeIdentifier(const char* msg);
String* ExpectIdentifier(const char* msg);
bool IsLiteral(const char* literal);
@@ -357,8 +357,14 @@
void AddInterfaces(intptr_t interfaces_pos,
const Class& cls,
const Array& interfaces);
+ StaticCallNode* BuildInvocationMirrorAllocation(
+ intptr_t call_pos,
+ const String& function_name,
+ const ArgumentListNode& function_args);
ArgumentListNode* BuildNoSuchMethodArguments(
- const String& function_name, const ArgumentListNode& function_args);
+ intptr_t call_pos,
+ const String& function_name,
+ const ArgumentListNode& function_args);
RawFunction* GetSuperFunction(intptr_t token_pos,
const String& name,
bool resolve_getter,
@@ -366,6 +372,7 @@
AstNode* ParseSuperCall(const String& function_name);
AstNode* ParseSuperFieldAccess(const String& field_name);
AstNode* ParseSuperOperator();
+ AstNode* BuildUnarySuperOperator(Token::Kind op, PrimaryNode* super);
static void SetupDefaultsForOptionalParams(const ParamList* params,
Array& default_values);
diff --git a/runtime/vm/raw_object.cc b/runtime/vm/raw_object.cc
index 2d41d74..582c649 100644
--- a/runtime/vm/raw_object.cc
+++ b/runtime/vm/raw_object.cc
@@ -101,13 +101,6 @@
instance_size = TwoByteString::InstanceSize(string_length);
break;
}
- case kFourByteStringCid: {
- const RawFourByteString* raw_string =
- reinterpret_cast<const RawFourByteString*>(this);
- intptr_t string_length = Smi::Value(raw_string->ptr()->length_);
- instance_size = FourByteString::InstanceSize(string_length);
- break;
- }
case kArrayCid:
case kImmutableArrayCid: {
const RawArray* raw_array = reinterpret_cast<const RawArray*>(this);
@@ -688,14 +681,6 @@
}
-intptr_t RawFourByteString::VisitFourByteStringPointers(
- RawFourByteString* raw_obj, ObjectPointerVisitor* visitor) {
- intptr_t length = Smi::Value(raw_obj->ptr()->length_);
- visitor->VisitPointers(raw_obj->from(), raw_obj->to());
- return FourByteString::InstanceSize(length);
-}
-
-
intptr_t RawExternalOneByteString::VisitExternalOneByteStringPointers(
RawExternalOneByteString* raw_obj, ObjectPointerVisitor* visitor) {
// Make sure that we got here with the tagged pointer as this.
@@ -714,15 +699,6 @@
}
-intptr_t RawExternalFourByteString::VisitExternalFourByteStringPointers(
- RawExternalFourByteString* raw_obj, ObjectPointerVisitor* visitor) {
- // Make sure that we got here with the tagged pointer as this.
- ASSERT(raw_obj->IsHeapObject());
- visitor->VisitPointers(raw_obj->from(), raw_obj->to());
- return ExternalFourByteString::InstanceSize();
-}
-
-
intptr_t RawBool::VisitBoolPointers(RawBool* raw_obj,
ObjectPointerVisitor* visitor) {
// Make sure that we got here with the tagged pointer as this.
diff --git a/runtime/vm/raw_object.h b/runtime/vm/raw_object.h
index 09a4c2c..18ae342 100644
--- a/runtime/vm/raw_object.h
+++ b/runtime/vm/raw_object.h
@@ -59,10 +59,8 @@
V(String) \
V(OneByteString) \
V(TwoByteString) \
- V(FourByteString) \
V(ExternalOneByteString) \
V(ExternalTwoByteString) \
- V(ExternalFourByteString) \
V(Bool) \
V(Array) \
V(ImmutableArray) \
@@ -340,6 +338,7 @@
static bool IsExternalStringClassId(intptr_t index);
static bool IsBuiltinListClassId(intptr_t index);
static bool IsByteArrayClassId(intptr_t index);
+ static bool IsExternalByteArrayClassId(intptr_t index);
protected:
uword tags_; // Various object tags (bits).
@@ -1031,7 +1030,7 @@
}
RawClass* parameterized_class_;
RawString* name_;
- RawAbstractType* bound_; // DynamicType if no explicit bound specified.
+ RawAbstractType* bound_; // ObjectType if no explicit bound specified.
RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->bound_); }
intptr_t index_;
intptr_t token_pos_;
@@ -1125,16 +1124,6 @@
};
-class RawFourByteString : public RawString {
- RAW_HEAP_OBJECT_IMPLEMENTATION(FourByteString);
-
- // Variable length data follows here.
- uint32_t data_[0];
-
- friend class SnapshotReader;
-};
-
-
template<typename T>
class ExternalStringData {
public:
@@ -1175,14 +1164,6 @@
};
-class RawExternalFourByteString : public RawString {
- RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalFourByteString);
-
- ExternalStringData<uint32_t>* external_data_;
- friend class Api;
-};
-
-
class RawBool : public RawInstance {
RAW_HEAP_OBJECT_IMPLEMENTATION(Bool);
@@ -1473,6 +1454,7 @@
uint8_t data_[0];
};
+
class RawWeakProperty : public RawInstance {
RAW_HEAP_OBJECT_IMPLEMENTATION(WeakProperty);
@@ -1491,6 +1473,7 @@
friend class ScavengerVisitor;
};
+
// Class Id predicates.
inline bool RawObject::IsErrorClassId(intptr_t index) {
@@ -1503,6 +1486,7 @@
return (index >= kErrorCid && index < kInstanceCid);
}
+
inline bool RawObject::IsNumberClassId(intptr_t index) {
// Make sure this function is updated when new Number types are added.
ASSERT(kIntegerCid == kNumberCid + 1 &&
@@ -1514,6 +1498,7 @@
return (index >= kNumberCid && index < kStringCid);
}
+
inline bool RawObject::IsIntegerClassId(intptr_t index) {
// Make sure this function is updated when new Integer types are added.
ASSERT(kSmiCid == kIntegerCid + 1 &&
@@ -1523,59 +1508,55 @@
return (index >= kIntegerCid && index < kDoubleCid);
}
+
inline bool RawObject::IsStringClassId(intptr_t index) {
// Make sure this function is updated when new StringCid types are added.
ASSERT(kOneByteStringCid == kStringCid + 1 &&
kTwoByteStringCid == kStringCid + 2 &&
- kFourByteStringCid == kStringCid + 3 &&
- kExternalOneByteStringCid == kStringCid + 4 &&
- kExternalTwoByteStringCid == kStringCid + 5 &&
- kExternalFourByteStringCid == kStringCid + 6 &&
- kBoolCid == kStringCid + 7);
+ kExternalOneByteStringCid == kStringCid + 3 &&
+ kExternalTwoByteStringCid == kStringCid + 4 &&
+ kBoolCid == kStringCid + 5);
return (index >= kStringCid && index < kBoolCid);
}
+
inline bool RawObject::IsOneByteStringClassId(intptr_t index) {
// Make sure this function is updated when new StringCid types are added.
ASSERT(kOneByteStringCid == kStringCid + 1 &&
kTwoByteStringCid == kStringCid + 2 &&
- kFourByteStringCid == kStringCid + 3 &&
- kExternalOneByteStringCid == kStringCid + 4 &&
- kExternalTwoByteStringCid == kStringCid + 5 &&
- kExternalFourByteStringCid == kStringCid + 6 &&
- kBoolCid == kStringCid + 7);
+ kExternalOneByteStringCid == kStringCid + 3 &&
+ kExternalTwoByteStringCid == kStringCid + 4 &&
+ kBoolCid == kStringCid + 5);
return (index == kOneByteStringCid || index == kExternalOneByteStringCid);
}
+
inline bool RawObject::IsTwoByteStringClassId(intptr_t index) {
// Make sure this function is updated when new StringCid types are added.
ASSERT(kOneByteStringCid == kStringCid + 1 &&
kTwoByteStringCid == kStringCid + 2 &&
- kFourByteStringCid == kStringCid + 3 &&
- kExternalOneByteStringCid == kStringCid + 4 &&
- kExternalTwoByteStringCid == kStringCid + 5 &&
- kExternalFourByteStringCid == kStringCid + 6 &&
- kBoolCid == kStringCid + 7);
+ kExternalOneByteStringCid == kStringCid + 3 &&
+ kExternalTwoByteStringCid == kStringCid + 4 &&
+ kBoolCid == kStringCid + 5);
return (index == kOneByteStringCid ||
index == kTwoByteStringCid ||
index == kExternalOneByteStringCid ||
index == kExternalTwoByteStringCid);
}
+
inline bool RawObject::IsExternalStringClassId(intptr_t index) {
// Make sure this function is updated when new StringCid types are added.
ASSERT(kOneByteStringCid == kStringCid + 1 &&
kTwoByteStringCid == kStringCid + 2 &&
- kFourByteStringCid == kStringCid + 3 &&
- kExternalOneByteStringCid == kStringCid + 4 &&
- kExternalTwoByteStringCid == kStringCid + 5 &&
- kExternalFourByteStringCid == kStringCid + 6 &&
- kBoolCid == kStringCid + 7);
+ kExternalOneByteStringCid == kStringCid + 3 &&
+ kExternalTwoByteStringCid == kStringCid + 4 &&
+ kBoolCid == kStringCid + 5);
return (index == kExternalOneByteStringCid ||
- index == kExternalTwoByteStringCid ||
- index == kExternalFourByteStringCid);
+ index == kExternalTwoByteStringCid);
}
+
inline bool RawObject::IsBuiltinListClassId(intptr_t index) {
// Make sure this function is updated when new builtin List types are added.
ASSERT(kImmutableArrayCid == kArrayCid + 1 &&
@@ -1585,6 +1566,7 @@
IsByteArrayClassId(index);
}
+
inline bool RawObject::IsByteArrayClassId(intptr_t index) {
// Make sure this function is updated when new ByteArray types are added.
ASSERT(kInt8ArrayCid == kByteArrayCid + 1 &&
@@ -1611,6 +1593,21 @@
return (index >= kByteArrayCid && index <= kExternalFloat64ArrayCid);
}
+inline bool RawObject::IsExternalByteArrayClassId(intptr_t index) {
+ // Make sure this function is updated when new ByteArray types are added.
+ ASSERT(kExternalUint8ArrayCid == kExternalInt8ArrayCid + 1 &&
+ kExternalInt16ArrayCid == kExternalInt8ArrayCid + 2 &&
+ kExternalUint16ArrayCid == kExternalInt8ArrayCid + 3 &&
+ kExternalInt32ArrayCid == kExternalInt8ArrayCid + 4 &&
+ kExternalUint32ArrayCid == kExternalInt8ArrayCid + 5 &&
+ kExternalInt64ArrayCid == kExternalInt8ArrayCid + 6 &&
+ kExternalUint64ArrayCid == kExternalInt8ArrayCid + 7 &&
+ kExternalFloat32ArrayCid == kExternalInt8ArrayCid + 8 &&
+ kExternalFloat64ArrayCid == kExternalInt8ArrayCid + 9 &&
+ kStacktraceCid == kExternalInt8ArrayCid + 10);
+ return (index >= kExternalInt8ArrayCid && index <= kExternalFloat64ArrayCid);
+}
+
} // namespace dart
#endif // VM_RAW_OBJECT_H_
diff --git a/runtime/vm/raw_object_snapshot.cc b/runtime/vm/raw_object_snapshot.cc
index 842b1a5..fd67149 100644
--- a/runtime/vm/raw_object_snapshot.cc
+++ b/runtime/vm/raw_object_snapshot.cc
@@ -1715,37 +1715,6 @@
}
-RawFourByteString* FourByteString::ReadFrom(SnapshotReader* reader,
- intptr_t object_id,
- intptr_t tags,
- Snapshot::Kind kind) {
- // Read the length so that we can determine instance size to allocate.
- ASSERT(reader != NULL);
- intptr_t len = reader->ReadSmiValue();
- intptr_t hash = reader->ReadSmiValue();
- FourByteString& str_obj = FourByteString::ZoneHandle(reader->isolate(),
- FourByteString::null());
-
- if (kind == Snapshot::kFull) {
- RawFourByteString* obj = reader->NewFourByteString(len);
- str_obj = obj;
- str_obj.set_tags(tags);
- obj->ptr()->hash_ = Smi::New(hash);
- uint32_t* raw_ptr = (len > 0)? str_obj.CharAddr(0) : NULL;
- for (intptr_t i = 0; i < len; i++) {
- ASSERT(str_obj.CharAddr(i) == raw_ptr); // Will trigger assertions.
- *raw_ptr = reader->Read<uint32_t>();
- raw_ptr += 1;
- }
- ASSERT(String::Hash(str_obj, 0, str_obj.Length()) == hash);
- } else {
- ReadFromImpl<FourByteString, uint32_t>(reader, &str_obj, len, tags, kind);
- }
- reader->AddBackRef(object_id, &str_obj, kIsDeserialized);
- return str_obj.raw();
-}
-
-
template<typename T>
static void StringWriteTo(SnapshotWriter* writer,
intptr_t object_id,
@@ -1812,20 +1781,6 @@
}
-void RawFourByteString::WriteTo(SnapshotWriter* writer,
- intptr_t object_id,
- Snapshot::Kind kind) {
- StringWriteTo(writer,
- object_id,
- kind,
- kFourByteStringCid,
- writer->GetObjectTags(this),
- ptr()->length_,
- ptr()->hash_,
- ptr()->data_);
-}
-
-
RawExternalOneByteString* ExternalOneByteString::ReadFrom(
SnapshotReader* reader,
intptr_t object_id,
@@ -1846,16 +1801,6 @@
}
-RawExternalFourByteString* ExternalFourByteString::ReadFrom(
- SnapshotReader* reader,
- intptr_t object_id,
- intptr_t tags,
- Snapshot::Kind kind) {
- UNREACHABLE();
- return ExternalFourByteString::null();
-}
-
-
void RawExternalOneByteString::WriteTo(SnapshotWriter* writer,
intptr_t object_id,
Snapshot::Kind kind) {
@@ -1886,21 +1831,6 @@
}
-void RawExternalFourByteString::WriteTo(SnapshotWriter* writer,
- intptr_t object_id,
- Snapshot::Kind kind) {
- // Serialize as a non-external four byte string.
- StringWriteTo(writer,
- object_id,
- kind,
- kFourByteStringCid,
- writer->GetObjectTags(this),
- ptr()->length_,
- ptr()->hash_,
- ptr()->external_data_->data());
-}
-
-
RawBool* Bool::ReadFrom(SnapshotReader* reader,
intptr_t object_id,
intptr_t tags,
@@ -2113,13 +2043,14 @@
#undef EXTERNALARRAY_READ_FROM
+template<typename ElementT>
static void ByteArrayWriteTo(SnapshotWriter* writer,
intptr_t object_id,
Snapshot::Kind kind,
intptr_t byte_array_kind,
intptr_t tags,
RawSmi* length,
- uint8_t* data) {
+ ElementT* data) {
ASSERT(writer != NULL);
intptr_t len = Smi::Value(length);
@@ -2157,7 +2088,7 @@
k##name##ArrayCid, \
writer->GetObjectTags(this), \
ptr()->length_, \
- reinterpret_cast<uint8_t*>(ptr()->data_)); \
+ ptr()->data_); \
} \
@@ -2175,7 +2106,7 @@
k##name##ArrayCid, \
writer->GetObjectTags(this), \
ptr()->length_, \
- reinterpret_cast<uint8_t*>(ptr()->external_data_->data())); \
+ ptr()->external_data_->data()); \
} \
diff --git a/runtime/vm/scavenger.cc b/runtime/vm/scavenger.cc
index b5696a1..e1b4326 100644
--- a/runtime/vm/scavenger.cc
+++ b/runtime/vm/scavenger.cc
@@ -50,6 +50,21 @@
}
+class BoolScope : public ValueObject {
+ public:
+ BoolScope(bool* addr, bool value) : _addr(addr), _value(*addr) {
+ *_addr = value;
+ }
+ ~BoolScope() {
+ *_addr = _value;
+ }
+
+ private:
+ bool* _addr;
+ bool _value;
+};
+
+
class ScavengerVisitor : public ObjectPointerVisitor {
public:
explicit ScavengerVisitor(Isolate* isolate, Scavenger* scavenger)
@@ -57,7 +72,9 @@
scavenger_(scavenger),
heap_(scavenger->heap_),
vm_heap_(Dart::vm_isolate()->heap()),
- visiting_old_pointers_(false) {}
+ delayed_weak_stack_(),
+ visiting_old_pointers_(false),
+ in_scavenge_pointer_(false) {}
void VisitPointers(RawObject** first, RawObject** last) {
for (RawObject** current = first; current <= last; current++) {
@@ -65,7 +82,11 @@
}
}
- void VisitingOldPointers(bool value) { visiting_old_pointers_ = value; }
+ GrowableArray<RawObject*>* DelayedWeakStack() {
+ return &delayed_weak_stack_;
+ }
+
+ bool* VisitingOldPointersAddr() { return &visiting_old_pointers_; }
void DelayWeakProperty(RawWeakProperty* raw_weak) {
RawObject* raw_key = raw_weak->ptr()->key_;
@@ -99,6 +120,10 @@
}
void ScavengePointer(RawObject** p) {
+ // ScavengePointer cannot be called recursively.
+ ASSERT(!in_scavenge_pointer_);
+ BoolScope bs(&in_scavenge_pointer_, true);
+
RawObject* raw_obj = *p;
// Fast exit if the raw object is a Smi or an old object.
@@ -122,26 +147,21 @@
if (IsForwarding(header)) {
// Get the new location of the object.
new_addr = ForwardedAddr(header);
- } else if (raw_obj->IsWatched()) {
- // Forward the object by scavenging its watchers.
- raw_obj->ClearWatchedBit();
- std::pair<DelaySet::iterator, DelaySet::iterator> ret;
- // Visit all elements with a key equal to raw_obj.
- ret = delay_set_.equal_range(raw_obj);
- for (DelaySet::iterator it = ret.first; it != ret.second; ++it) {
- // Scavenge the delayed WeakProperty. These objects have been
- // forwarded but have not been scavenged because their key
- // object was not known to be reachable. Now that the key
- // object is known to be reachable we can scavenge the key and
- // value pointers.
- it->second->VisitPointers(this);
- }
- delay_set_.erase(ret.first, ret.second);
- // Reread the header word to get the new location of the object.
- header = *reinterpret_cast<uword*>(raw_addr);
- ASSERT(IsForwarding(header));
- new_addr = ForwardedAddr(header);
} else {
+ if (raw_obj->IsWatched()) {
+ raw_obj->ClearWatchedBit();
+ std::pair<DelaySet::iterator, DelaySet::iterator> ret;
+ // Visit all elements with a key equal to this raw_obj.
+ ret = delay_set_.equal_range(raw_obj);
+ for (DelaySet::iterator it = ret.first; it != ret.second; ++it) {
+ // Remember the delayed WeakProperty. These objects have been
+ // forwarded, but have not been scavenged because their key was not
+ // known to be reachable. Now that the key object is known to be
+ // reachable, we need to visit its key and value pointers.
+ delayed_weak_stack_.Add(it->second);
+ }
+ delay_set_.erase(ret.first, ret.second);
+ }
intptr_t size = raw_obj->Size();
// Check whether object should be promoted.
if (scavenger_->survivor_end_ <= raw_addr) {
@@ -190,8 +210,10 @@
Heap* vm_heap_;
typedef std::multimap<RawObject*, RawWeakProperty*> DelaySet;
DelaySet delay_set_;
+ GrowableArray<RawObject*> delayed_weak_stack_;
bool visiting_old_pointers_;
+ bool in_scavenge_pointer_;
DISALLOW_COPY_AND_ASSIGN(ScavengerVisitor);
};
@@ -325,7 +347,7 @@
void Scavenger::IterateStoreBuffers(Isolate* isolate,
ScavengerVisitor* visitor) {
// Iterating through the store buffers.
- visitor->VisitingOldPointers(true);
+ BoolScope bs(visitor->VisitingOldPointersAddr(), true);
// Grab the deduplication sets out of the store buffer.
StoreBuffer::DedupSet* pending = isolate->store_buffer()->DedupSets();
intptr_t entries = 0;
@@ -381,8 +403,6 @@
OS::PrintErr("StoreBufferBlock: %"Pd", %"Pd" (entries, dups)\n",
entries, duplicates);
}
- // Done iterating through the store buffers.
- visitor->VisitingOldPointers(false);
}
@@ -479,8 +499,12 @@
void Scavenger::ProcessToSpace(ScavengerVisitor* visitor) {
+ GrowableArray<RawObject*>* delayed_weak_stack = visitor->DelayedWeakStack();
+
// Iterate until all work has been drained.
- while ((resolved_top_ < top_) || PromotedStackHasMore()) {
+ while ((resolved_top_ < top_) ||
+ PromotedStackHasMore() ||
+ !delayed_weak_stack->is_empty()) {
while (resolved_top_ < top_) {
RawObject* raw_obj = RawObject::FromAddr(resolved_top_);
intptr_t class_id = raw_obj->GetClassId();
@@ -491,15 +515,21 @@
resolved_top_ += ProcessWeakProperty(raw_weak, visitor);
}
}
- visitor->VisitingOldPointers(true);
- while (PromotedStackHasMore()) {
- RawObject* raw_object = RawObject::FromAddr(PopFromPromotedStack());
- // Resolve or copy all objects referred to by the current object. This
- // can potentially push more objects on this stack as well as add more
- // objects to be resolved in the to space.
- raw_object->VisitPointers(visitor);
+ {
+ BoolScope bs(visitor->VisitingOldPointersAddr(), true);
+ while (PromotedStackHasMore()) {
+ RawObject* raw_object = RawObject::FromAddr(PopFromPromotedStack());
+ // Resolve or copy all objects referred to by the current object. This
+ // can potentially push more objects on this stack as well as add more
+ // objects to be resolved in the to space.
+ raw_object->VisitPointers(visitor);
+ }
}
- visitor->VisitingOldPointers(false);
+ while (!delayed_weak_stack->is_empty()) {
+ // Pop the delayed weak object from the stack and visit its pointers.
+ RawObject* weak_property = delayed_weak_stack->RemoveLast();
+ weak_property->VisitPointers(visitor);
+ }
}
}
diff --git a/runtime/vm/snapshot.cc b/runtime/vm/snapshot.cc
index 12aad9e..77204f3 100644
--- a/runtime/vm/snapshot.cc
+++ b/runtime/vm/snapshot.cc
@@ -387,13 +387,6 @@
}
-RawFourByteString* SnapshotReader::NewFourByteString(intptr_t len) {
- ALLOC_NEW_OBJECT_WITH_LEN(FourByteString,
- object_store()->four_byte_string_class(),
- len);
-}
-
-
RawTypeArguments* SnapshotReader::NewTypeArguments(intptr_t len) {
ALLOC_NEW_OBJECT_WITH_LEN(TypeArguments,
Object::type_arguments_class(),
diff --git a/runtime/vm/snapshot.h b/runtime/vm/snapshot.h
index 44c19fe..fba122a 100644
--- a/runtime/vm/snapshot.h
+++ b/runtime/vm/snapshot.h
@@ -36,7 +36,6 @@
class RawContext;
class RawDouble;
class RawField;
-class RawFourByteString;
class RawClosureData;
class RawRedirectionData;
class RawFunction;
@@ -239,7 +238,6 @@
RawImmutableArray* NewImmutableArray(intptr_t len);
RawOneByteString* NewOneByteString(intptr_t len);
RawTwoByteString* NewTwoByteString(intptr_t len);
- RawFourByteString* NewFourByteString(intptr_t len);
RawTypeArguments* NewTypeArguments(intptr_t len);
RawTokenStream* NewTokenStream(intptr_t len);
RawContext* NewContext(intptr_t num_variables);
diff --git a/runtime/vm/snapshot_test.cc b/runtime/vm/snapshot_test.cc
index e7d127a..3e84b59 100644
--- a/runtime/vm/snapshot_test.cc
+++ b/runtime/vm/snapshot_test.cc
@@ -627,6 +627,77 @@
}
+#define TEST_TYPED_ARRAY(darttype, ctype) \
+ { \
+ StackZone zone(Isolate::Current()); \
+ uint8_t* buffer; \
+ MessageWriter writer(&buffer, &zone_allocator); \
+ const int kArrayLength = 127; \
+ darttype& array = darttype::Handle(darttype::New(kArrayLength)); \
+ for (int i = 0; i < kArrayLength; i++) { \
+ array.SetAt(i, i); \
+ } \
+ writer.WriteMessage(array); \
+ intptr_t buffer_len = writer.BytesWritten(); \
+ SnapshotReader reader(buffer, buffer_len, \
+ Snapshot::kMessage, Isolate::Current()); \
+ darttype& serialized_array = darttype::Handle(); \
+ serialized_array ^= reader.ReadObject(); \
+ for (int i = 0; i < kArrayLength; i++) { \
+ EXPECT_EQ(static_cast<ctype>(i), serialized_array.At(i)); \
+ } \
+ }
+
+
+#define TEST_EXTERNAL_TYPED_ARRAY(darttype, ctype) \
+ { \
+ StackZone zone(Isolate::Current()); \
+ ctype data[] = { 0, 11, 22, 33, 44, 55, 66, 77 }; \
+ intptr_t length = ARRAY_SIZE(data); \
+ External##darttype& array = External##darttype::Handle( \
+ External##darttype::New(data, length, NULL, NULL)); \
+ uint8_t* buffer; \
+ MessageWriter writer(&buffer, &zone_allocator); \
+ writer.WriteMessage(array); \
+ intptr_t buffer_len = writer.BytesWritten(); \
+ SnapshotReader reader(buffer, buffer_len, \
+ Snapshot::kMessage, Isolate::Current()); \
+ darttype& serialized_array = darttype::Handle(); \
+ serialized_array ^= reader.ReadObject(); \
+ for (int i = 0; i < length; i++) { \
+ EXPECT_EQ(static_cast<ctype>(data[i]), serialized_array.At(i)); \
+ } \
+ }
+
+
+TEST_CASE(SerializeTypedArray) {
+ TEST_TYPED_ARRAY(Int8Array, int8_t);
+ TEST_TYPED_ARRAY(Uint8Array, uint8_t);
+ TEST_TYPED_ARRAY(Int16Array, int16_t);
+ TEST_TYPED_ARRAY(Uint16Array, uint16_t);
+ TEST_TYPED_ARRAY(Int32Array, int32_t);
+ TEST_TYPED_ARRAY(Uint32Array, uint32_t);
+ TEST_TYPED_ARRAY(Int64Array, int64_t);
+ TEST_TYPED_ARRAY(Uint64Array, uint64_t);
+ TEST_TYPED_ARRAY(Float32Array, float);
+ TEST_TYPED_ARRAY(Float64Array, double);
+}
+
+
+TEST_CASE(SerializeExternalTypedArray) {
+ TEST_EXTERNAL_TYPED_ARRAY(Int8Array, int8_t);
+ TEST_EXTERNAL_TYPED_ARRAY(Uint8Array, uint8_t);
+ TEST_EXTERNAL_TYPED_ARRAY(Int16Array, int16_t);
+ TEST_EXTERNAL_TYPED_ARRAY(Uint16Array, uint16_t);
+ TEST_EXTERNAL_TYPED_ARRAY(Int32Array, int32_t);
+ TEST_EXTERNAL_TYPED_ARRAY(Uint32Array, uint32_t);
+ TEST_EXTERNAL_TYPED_ARRAY(Int64Array, int64_t);
+ TEST_EXTERNAL_TYPED_ARRAY(Uint64Array, uint64_t);
+ TEST_EXTERNAL_TYPED_ARRAY(Float32Array, float);
+ TEST_EXTERNAL_TYPED_ARRAY(Float64Array, double);
+}
+
+
TEST_CASE(SerializeEmptyByteArray) {
StackZone zone(Isolate::Current());
@@ -874,8 +945,8 @@
// Invoke a function which returns an object.
Dart_Handle cls =
- Dart_GetClass(TestCase::lib(), Dart_NewString("FieldsTest"));
- result = Dart_Invoke(cls, Dart_NewString("testMain"), 0, NULL);
+ Dart_GetClass(TestCase::lib(), NewString("FieldsTest"));
+ result = Dart_Invoke(cls, NewString("testMain"), 0, NULL);
EXPECT_VALID(result);
Dart_ExitScope();
}
@@ -916,8 +987,8 @@
writer.WriteFullSnapshot();
// Invoke a function which returns an object.
- Dart_Handle cls = Dart_GetClass(lib, Dart_NewString("FieldsTest"));
- Dart_Handle result = Dart_Invoke(cls, Dart_NewString("testMain"), 0, NULL);
+ Dart_Handle cls = Dart_GetClass(lib, NewString("FieldsTest"));
+ Dart_Handle result = Dart_Invoke(cls, NewString("testMain"), 0, NULL);
EXPECT_VALID(result);
}
@@ -933,8 +1004,8 @@
// Invoke a function which returns an object.
Dart_Handle cls = Dart_GetClass(TestCase::lib(),
- Dart_NewString("FieldsTest"));
- Dart_Handle result = Dart_Invoke(cls, Dart_NewString("testMain"), 0, NULL);
+ NewString("FieldsTest"));
+ Dart_Handle result = Dart_Invoke(cls, NewString("testMain"), 0, NULL);
if (Dart_IsError(result)) {
// Print the error. It is probably an unhandled exception.
fprintf(stderr, "%s\n", Dart_GetError(result));
@@ -1014,8 +1085,8 @@
Dart_EnterScope(); // Start a Dart API scope for invoking API functions.
// Load the library.
- Dart_Handle import_lib = Dart_LoadLibrary(Dart_NewString("dart:import-lib"),
- Dart_NewString(kLibScriptChars));
+ Dart_Handle import_lib = Dart_LoadLibrary(NewString("dart:import-lib"),
+ NewString(kLibScriptChars));
EXPECT_VALID(import_lib);
// Create a test library and Load up a test script in it.
@@ -1058,8 +1129,8 @@
EXPECT_EQ(expected_num_libs, actual_num_libs);
// Invoke a function which returns an object.
- Dart_Handle cls = Dart_GetClass(result, Dart_NewString("FieldsTest"));
- result = Dart_Invoke(cls, Dart_NewString("testMain"), 0, NULL);
+ Dart_Handle cls = Dart_GetClass(result, NewString("FieldsTest"));
+ result = Dart_Invoke(cls, NewString("testMain"), 0, NULL);
EXPECT_VALID(result);
Dart_ExitScope();
}
@@ -1099,7 +1170,7 @@
static Dart_CObject* GetDeserializedDartMessage(Dart_Handle lib,
const char* dart_function) {
Dart_Handle result;
- result = Dart_Invoke(lib, Dart_NewString(dart_function), 0, NULL);
+ result = Dart_Invoke(lib, NewString(dart_function), 0, NULL);
EXPECT_VALID(result);
// Serialize the list into a message.
@@ -1139,13 +1210,13 @@
NULL);
EXPECT_VALID(lib);
Dart_Handle smi_result;
- smi_result = Dart_Invoke(lib, Dart_NewString("getSmi"), 0, NULL);
+ smi_result = Dart_Invoke(lib, NewString("getSmi"), 0, NULL);
EXPECT_VALID(smi_result);
Dart_Handle bigint_result;
- bigint_result = Dart_Invoke(lib, Dart_NewString("getBigint"), 0, NULL);
+ bigint_result = Dart_Invoke(lib, NewString("getBigint"), 0, NULL);
EXPECT_VALID(bigint_result);
Dart_Handle string_result;
- string_result = Dart_Invoke(lib, Dart_NewString("getString"), 0, NULL);
+ string_result = Dart_Invoke(lib, NewString("getString"), 0, NULL);
EXPECT_VALID(string_result);
EXPECT(Dart_IsString(string_result));
@@ -1903,9 +1974,9 @@
Dart_EnterScope();
// xxx
- Dart_Handle send_port = Dart_Invoke(lib, Dart_NewString("main"), 0, NULL);
+ Dart_Handle send_port = Dart_Invoke(lib, NewString("main"), 0, NULL);
EXPECT_VALID(send_port);
- Dart_Handle result = Dart_GetField(send_port, Dart_NewString("_id"));
+ Dart_Handle result = Dart_GetField(send_port, NewString("_id"));
ASSERT(!Dart_IsError(result));
ASSERT(Dart_IsInteger(result));
int64_t send_port_id;
diff --git a/runtime/vm/stack_frame_test.cc b/runtime/vm/stack_frame_test.cc
index 910a1a0..4348fc6 100644
--- a/runtime/vm/stack_frame_test.cc
+++ b/runtime/vm/stack_frame_test.cc
@@ -240,8 +240,8 @@
Dart_Handle lib = TestCase::LoadTestScript(
kScriptChars,
reinterpret_cast<Dart_NativeEntryResolver>(native_lookup));
- Dart_Handle cls = Dart_GetClass(lib, Dart_NewString("StackFrameTest"));
- EXPECT_VALID(Dart_Invoke(cls, Dart_NewString("testMain"), 0, NULL));
+ Dart_Handle cls = Dart_GetClass(lib, NewString("StackFrameTest"));
+ EXPECT_VALID(Dart_Invoke(cls, NewString("testMain"), 0, NULL));
}
@@ -257,7 +257,7 @@
"} "
"class StackFrame2Test {"
" StackFrame2Test() {}"
- " noSuchMethod(var function_name, var args) {"
+ " noSuchMethod(InvocationMirror im) {"
" /* We should have 8 general frames and 3 dart frames as follows:"
" * exit frame"
" * dart frame corresponding to StackFrame.frameCount"
@@ -283,8 +283,8 @@
Dart_Handle lib = TestCase::LoadTestScript(
kScriptChars,
reinterpret_cast<Dart_NativeEntryResolver>(native_lookup));
- Dart_Handle cls = Dart_GetClass(lib, Dart_NewString("StackFrame2Test"));
- EXPECT_VALID(Dart_Invoke(cls, Dart_NewString("testMain"), 0, NULL));
+ Dart_Handle cls = Dart_GetClass(lib, NewString("StackFrame2Test"));
+ EXPECT_VALID(Dart_Invoke(cls, NewString("testMain"), 0, NULL));
}
#endif // TARGET_ARCH_IA32 || TARGET_ARCH_X64.
diff --git a/runtime/vm/stub_code_ia32.cc b/runtime/vm/stub_code_ia32.cc
index b92645d..9be505a 100644
--- a/runtime/vm/stub_code_ia32.cc
+++ b/runtime/vm/stub_code_ia32.cc
@@ -1557,8 +1557,18 @@
// - Match not found -> jump to IC miss.
void StubCode::GenerateNArgsCheckInlineCacheStub(Assembler* assembler,
intptr_t num_args) {
- const Immediate raw_null =
- Immediate(reinterpret_cast<intptr_t>(Object::null()));
+ ASSERT(num_args > 0);
+#if defined(DEBUG)
+ { Label ok;
+ // Check that the IC data array has NumberOfArgumentsChecked() == num_args.
+ // 'num_args_tested' is stored as an untagged int.
+ __ movl(EBX, FieldAddress(ECX, ICData::num_args_tested_offset()));
+ __ cmpl(EBX, Immediate(num_args));
+ __ j(EQUAL, &ok, Assembler::kNearJump);
+ __ Stop("Incorrect stub for IC data");
+ __ Bind(&ok);
+ }
+#endif // DEBUG
__ movl(EBX, FieldAddress(ECX, ICData::function_offset()));
Label is_hot;
@@ -1580,70 +1590,63 @@
__ incl(FieldAddress(EBX, Function::usage_counter_offset()));
__ Bind(&is_hot);
- ASSERT(num_args > 0);
- // Get receiver (first read number of arguments from argument descriptor array
- // and then access the receiver from the stack).
- __ movl(EAX, FieldAddress(EDX, Array::data_offset()));
- __ movl(EAX, Address(ESP, EAX, TIMES_2, 0)); // EAX (argument_count) is Smi.
-
- Label get_class_id_as_smi, ic_miss;
- // ECX: IC data array.
-
-#if defined(DEBUG)
- { Label ok;
- // Check that the IC data array has NumberOfArgumentsChecked() == num_args.
- // 'num_args_tested' is stored as an untagged int.
- __ movl(EBX, FieldAddress(ECX, ICData::num_args_tested_offset()));
- __ cmpl(EBX, Immediate(num_args));
- __ j(EQUAL, &ok, Assembler::kNearJump);
- __ Stop("Incorrect stub for IC data");
- __ Bind(&ok);
- }
-#endif // DEBUG
-
// Loop that checks if there is an IC data match.
+ Label loop, update, test, found, get_class_id_as_smi;
// ECX: IC data object (preserved).
__ movl(EBX, FieldAddress(ECX, ICData::ic_data_offset()));
// EBX: ic_data_array with check entries: classes and target functions.
__ leal(EBX, FieldAddress(EBX, Array::data_offset()));
// EBX: points directly to the first ic data array element.
- Label loop, found;
- if (num_args == 1) {
- __ call(&get_class_id_as_smi);
- // EAX: receiver's class id Smi.
- __ Bind(&loop);
- __ movl(EDI, Address(EBX, 0)); // Get class id (Smi) to check.
- __ cmpl(EAX, EDI); // Class id match?
- __ j(EQUAL, &found, Assembler::kNearJump);
- __ addl(EBX, Immediate(kWordSize * 2)); // Next element (class + target).
- __ cmpl(EDI, Immediate(Smi::RawValue(kIllegalCid))); // Done?
- __ j(NOT_EQUAL, &loop, Assembler::kNearJump);
- } else {
- Label no_match;
- __ Bind(&loop);
- for (int i = 0; i < num_args; i++) {
+
+ // Get the receiver's class ID (first read number of arguments from
+ // argument descriptor array and then access the receiver from the stack).
+ __ movl(EAX, FieldAddress(EDX, Array::data_offset()));
+ __ movl(EAX, Address(ESP, EAX, TIMES_2, 0)); // EAX (argument_count) is smi.
+ __ call(&get_class_id_as_smi);
+ // EAX: receiver's class ID (smi).
+ __ movl(EDI, Address(EBX, 0)); // First class id (smi) to check.
+ __ jmp(&test);
+
+ __ Bind(&loop);
+ for (int i = 0; i < num_args; i++) {
+ if (i > 0) {
+ // If not the first, load the next argument's class ID.
__ movl(EAX, FieldAddress(EDX, Array::data_offset()));
__ movl(EAX, Address(ESP, EAX, TIMES_2, - i * kWordSize));
__ call(&get_class_id_as_smi);
+ // EAX: next argument class ID (smi).
__ movl(EDI, Address(EBX, i * kWordSize));
- __ cmpl(EAX, EDI); // Class id match?
- if (i < (num_args - 1)) {
- __ j(NOT_EQUAL, &no_match);
- } else {
- // Last check, all checks before matched.
- __ j(EQUAL, &found, Assembler::kNearJump);
- }
+ // EDI: next class ID to check (smi).
}
- __ Bind(&no_match);
- // Each test entry has (1 + num_args) array elements.
- __ addl(EBX, Immediate(kWordSize * (1 + num_args))); // Next element.
- __ cmpl(EDI, Immediate(Smi::RawValue(kIllegalCid))); // Done?
- __ j(NOT_EQUAL, &loop, Assembler::kNearJump);
+ __ cmpl(EAX, EDI); // Class id match?
+ if (i < (num_args - 1)) {
+ __ j(NOT_EQUAL, &update); // Continue.
+ } else {
+ // Last check, all checks before matched.
+ __ j(EQUAL, &found, Assembler::kNearJump); // Break.
+ }
}
+ __ Bind(&update);
+ // Reload receiver class ID. It has not been destroyed when num_args == 1.
+ if (num_args > 1) {
+ __ movl(EAX, FieldAddress(EDX, Array::data_offset()));
+ __ movl(EAX, Address(ESP, EAX, TIMES_2, 0));
+ __ call(&get_class_id_as_smi);
+ }
+ // Each test entry has (1 + num_args) array elements.
+ const intptr_t entry_size = (num_args + 1) * kWordSize;
+ __ addl(EBX, Immediate(entry_size)); // Next entry.
+ __ movl(EDI, Address(EBX, 0)); // Next class ID.
- __ Bind(&ic_miss);
- // Compute address of arguments (first read number of arguments from argument
- // descriptor array and then compute address on the stack).
+ __ Bind(&test);
+ __ cmpl(EDI, Immediate(Smi::RawValue(kIllegalCid))); // Done?
+ __ j(NOT_EQUAL, &loop, Assembler::kNearJump);
+
+ // IC miss.
+ const Immediate raw_null =
+ Immediate(reinterpret_cast<intptr_t>(Object::null()));
+ // Compute address of arguments (first read number of arguments from
+ // argument descriptor array and then compute address on the stack).
__ movl(EAX, FieldAddress(EDX, Array::data_offset()));
__ leal(EAX, Address(ESP, EAX, TIMES_2, 0)); // EAX is Smi.
// Create a stub frame as we are pushing some objects on the stack before
diff --git a/runtime/vm/stub_code_x64.cc b/runtime/vm/stub_code_x64.cc
index 1e81cfe..a1dbf92 100644
--- a/runtime/vm/stub_code_x64.cc
+++ b/runtime/vm/stub_code_x64.cc
@@ -1537,8 +1537,21 @@
// - Match not found -> jump to IC miss.
void StubCode::GenerateNArgsCheckInlineCacheStub(Assembler* assembler,
intptr_t num_args) {
+ ASSERT(num_args > 0);
+#if defined(DEBUG)
+ { Label ok;
+ // Check that the IC data array has NumberOfArgumentsChecked() == num_args.
+ // 'num_args_tested' is stored as an untagged int.
+ __ movq(RCX, FieldAddress(RBX, ICData::num_args_tested_offset()));
+ __ cmpq(RCX, Immediate(num_args));
+ __ j(EQUAL, &ok, Assembler::kNearJump);
+ __ Stop("Incorrect stub for IC data");
+ __ Bind(&ok);
+ }
+#endif // DEBUG
+
__ movq(RCX, FieldAddress(RBX, ICData::function_offset()));
- Label is_hot;
+ Label is_hot;
if (FlowGraphCompiler::CanOptimize()) {
ASSERT(FLAG_optimization_counter_threshold > 1);
// The usage_counter is always less than FLAG_optimization_counter_threshold
@@ -1557,72 +1570,63 @@
__ incq(FieldAddress(RCX, Function::usage_counter_offset()));
__ Bind(&is_hot);
- ASSERT(num_args > 0);
- // Get receiver (first read number of arguments from argument descriptor array
- // and then access the receiver from the stack).
- __ movq(RAX, FieldAddress(R10, Array::data_offset()));
- __ movq(RAX, Address(RSP, RAX, TIMES_4, 0)); // RAX (argument count) is Smi.
-
- Label get_class_id_as_smi, ic_miss;
- // RBX: IC data array.
-
-#if defined(DEBUG)
- { Label ok;
- // Check that the IC data array has NumberOfArgumentsChecked() == num_args.
- // 'num_args_tested' is stored as an untagged int.
- __ movq(RCX, FieldAddress(RBX, ICData::num_args_tested_offset()));
- __ cmpq(RCX, Immediate(num_args));
- __ j(EQUAL, &ok, Assembler::kNearJump);
- __ Stop("Incorrect stub for IC data");
- __ Bind(&ok);
- }
-#endif // DEBUG
-
// Loop that checks if there is an IC data match.
+ Label loop, update, test, found, get_class_id_as_smi;
// RBX: IC data object (preserved).
__ movq(R12, FieldAddress(RBX, ICData::ic_data_offset()));
// R12: ic_data_array with check entries: classes and target functions.
__ leaq(R12, FieldAddress(R12, Array::data_offset()));
// R12: points directly to the first ic data array element.
- const Immediate raw_null =
- Immediate(reinterpret_cast<intptr_t>(Object::null()));
- Label loop, found;
- if (num_args == 1) {
- __ call(&get_class_id_as_smi);
- // RAX: receiver's class id as Smi.
- __ Bind(&loop);
- __ movq(R13, Address(R12, 0)); // Get class if (Smi) to check.
- __ cmpq(RAX, R13); // Match?
- __ j(EQUAL, &found, Assembler::kNearJump);
- __ addq(R12, Immediate(kWordSize * 2)); // Next element (class + target).
- __ cmpq(R13, Immediate(Smi::RawValue(kIllegalCid))); // Done?
- __ j(NOT_EQUAL, &loop, Assembler::kNearJump);
- } else {
- Label no_match;
- __ Bind(&loop);
- for (int i = 0; i < num_args; i++) {
+
+ // Get the receiver's class ID (first read number of arguments from
+ // argument descriptor array and then access the receiver from the stack).
+ __ movq(RAX, FieldAddress(R10, Array::data_offset()));
+ __ movq(RAX, Address(RSP, RAX, TIMES_4, 0)); // RAX (argument count) is Smi.
+ __ call(&get_class_id_as_smi);
+ // RAX: receiver's class ID as smi.
+ __ movq(R13, Address(R12, 0)); // First class ID (Smi) to check.
+ __ jmp(&test);
+
+ __ Bind(&loop);
+ for (int i = 0; i < num_args; i++) {
+ if (i > 0) {
+ // If not the first, load the next argument's class ID.
__ movq(RAX, FieldAddress(R10, Array::data_offset()));
__ movq(RAX, Address(RSP, RAX, TIMES_4, - i * kWordSize));
__ call(&get_class_id_as_smi);
+ // RAX: next argument class ID (smi).
__ movq(R13, Address(R12, i * kWordSize));
- __ cmpq(RAX, R13); // Class id match?
- if (i < (num_args - 1)) {
- __ j(NOT_EQUAL, &no_match);
- } else {
- // Last check, all checks before matched.
- __ j(EQUAL, &found);
- }
+ // R13: next class ID to check (smi).
}
- __ Bind(&no_match);
- // Each test entry has (1 + num_args) array elements.
- __ addq(R12, Immediate(kWordSize * (1 + num_args))); // Next element.
- __ cmpq(R13, Immediate(Smi::RawValue(kIllegalCid))); // Done?
- __ j(NOT_EQUAL, &loop, Assembler::kNearJump);
+ __ cmpq(RAX, R13); // Class id match?
+ if (i < (num_args - 1)) {
+ __ j(NOT_EQUAL, &update); // Continue.
+ } else {
+ // Last check, all checks before matched.
+ __ j(EQUAL, &found); // Break.
+ }
}
+ __ Bind(&update);
+ // Reload receiver class ID. It has not been destroyed when num_args == 1.
+ if (num_args > 1) {
+ __ movq(RAX, FieldAddress(R10, Array::data_offset()));
+ __ movq(RAX, Address(RSP, RAX, TIMES_4, 0));
+ __ call(&get_class_id_as_smi);
+ }
+ // Each test entry has (1 + num_args) array elements.
+ const intptr_t entry_size = (num_args + 1) * kWordSize;
+ __ addq(R12, Immediate(entry_size)); // Next entry.
+ __ movq(R13, Address(R12, 0)); // Next class ID.
- __ Bind(&ic_miss);
- // Compute address of arguments (first read number of arguments from argument
- // descriptor array and then compute address on the stack).
+ __ Bind(&test);
+ __ cmpq(R13, Immediate(Smi::RawValue(kIllegalCid))); // Done?
+ __ j(NOT_EQUAL, &loop, Assembler::kNearJump);
+
+ // IC miss.
+ const Immediate raw_null =
+ Immediate(reinterpret_cast<intptr_t>(Object::null()));
+ // Compute address of arguments (first read number of arguments from
+ // argument descriptor array and then compute address on the stack).
__ movq(RAX, FieldAddress(R10, Array::data_offset()));
__ leaq(RAX, Address(RSP, RAX, TIMES_4, 0)); // RAX is Smi.
AssemblerMacros::EnterStubFrame(assembler);
diff --git a/runtime/vm/symbols.cc b/runtime/vm/symbols.cc
index bfb2bea..3547f87 100644
--- a/runtime/vm/symbols.cc
+++ b/runtime/vm/symbols.cc
@@ -94,23 +94,23 @@
RawString* Symbols::New(const char* str) {
- intptr_t width = 0;
- intptr_t len = Utf8::CodePointCount(str, &width);
+ ASSERT(str != NULL);
+ Utf8::Type type;
+ intptr_t str_len = strlen(str);
+ const uint8_t* utf8_array = reinterpret_cast<const uint8_t*>(str);
+ intptr_t len = Utf8::CodePointCount(utf8_array, str_len, &type);
Zone* zone = Isolate::Current()->current_zone();
if (len == 0) {
return Symbols::New(reinterpret_cast<uint8_t*>(NULL), 0);
- } else if (width == 1) {
+ }
+ if (type == Utf8::kAscii) {
uint8_t* characters = zone->Alloc<uint8_t>(len);
- Utf8::Decode(str, characters, len);
- return New(characters, len);
- } else if (width == 2) {
- uint16_t* characters = zone->Alloc<uint16_t>(len);
- Utf8::Decode(str, characters, len);
+ Utf8::DecodeToAscii(utf8_array, str_len, characters, len);
return New(characters, len);
}
- ASSERT(width == 4);
- uint32_t* characters = zone->Alloc<uint32_t>(len);
- Utf8::Decode(str, characters, len);
+ ASSERT((type == Utf8::kBMP) || (type == Utf8::kSMP));
+ uint16_t* characters = zone->Alloc<uint16_t>(len);
+ Utf8::DecodeToUTF16(utf8_array, str_len, characters, len);
return New(characters, len);
}
diff --git a/runtime/vm/symbols.h b/runtime/vm/symbols.h
index 31d01d8..8fb33eb 100644
--- a/runtime/vm/symbols.h
+++ b/runtime/vm/symbols.h
@@ -25,6 +25,8 @@
V(TopLevel, "::") \
V(DefaultLabel, ":L") \
V(This, "this") \
+ V(Super, "super") \
+ V(Call, "call") \
V(HasNext, "hasNext") \
V(Next, "next") \
V(Value, "value") \
@@ -41,7 +43,7 @@
V(ThrowNew, "_throwNew") \
V(ListLiteralFactoryClass, "_ListLiteralFactory") \
V(ListLiteralFactory, "List.fromLiteral") \
- V(ListImplementation, "ListImplementation") \
+ V(ListImplementation, "_ListImpl") \
V(ListFactory, "List.") \
V(MapLiteralFactoryClass, "_MapLiteralFactory") \
V(MapLiteralFactory, "Map.fromLiteral") \
@@ -108,10 +110,8 @@
V(ImmutableArray, "_ImmutableArray") \
V(OneByteString, "_OneByteString") \
V(TwoByteString, "_TwoByteString") \
- V(FourByteString, "_FourByteString") \
V(ExternalOneByteString, "_ExternalOneByteString") \
V(ExternalTwoByteString, "_ExternalTwoByteString") \
- V(ExternalFourByteString, "_ExternalFourByteString") \
V(Stacktrace, "Stacktrace") \
V(JSSyntaxRegExp, "JSSyntaxRegExp") \
V(Object, "Object") \
@@ -136,6 +136,8 @@
V(_ExternalFloat32Array, "_ExternalFloat32Array") \
V(_ExternalFloat64Array, "_ExternalFloat64Array") \
V(_WeakProperty, "_WeakProperty") \
+ V(InvocationMirror, "_InvocationMirror") \
+ V(AllocateInvocationMirror, "_allocateInvocationMirror") \
// Contains a list of frequently used strings in a canonicalized form. This
// list is kept in the vm_isolate in order to share the copy across isolates
diff --git a/runtime/vm/unicode.cc b/runtime/vm/unicode.cc
index d9dca3e..42cd426 100644
--- a/runtime/vm/unicode.cc
+++ b/runtime/vm/unicode.cc
@@ -10,7 +10,7 @@
namespace dart {
-static const uint8_t kTrailBytes[256] = {
+static const int8_t kTrailBytes[256] = {
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
@@ -58,6 +58,18 @@
}
+static bool IsAsciiSequenceStart(uint8_t code_unit) {
+ // Check is codepoint is <= U+007F
+ return (code_unit <= Utf8::kMaxOneByteChar);
+}
+
+
+static bool IsSmpSequenceStart(uint8_t code_unit) {
+ // Check is codepoint is >= U+10000.
+ return (code_unit >= 0xF0);
+}
+
+
// Returns true if the code point is a high- or low-surrogate.
static bool IsSurrogate(uint32_t code_point) {
return (code_point & 0xfffff800) == 0xd800;
@@ -66,7 +78,7 @@
// Returns true if the code point value is above Plane 17.
static bool IsOutOfRange(uint32_t code_point) {
- return code_point > 0x10FFFF;
+ return (code_point > 0x10FFFF);
}
@@ -76,47 +88,51 @@
}
+void Utf8::ConvertUTF32ToUTF16(int32_t codepoint, uint16_t* dst) {
+ ASSERT(codepoint > kMaxBmpCodepoint);
+ ASSERT(dst != NULL);
+ dst[0] = (Utf8::kLeadOffset + (codepoint >> 10));
+ dst[1] = (0xDC00 + (codepoint & 0x3FF));
+}
+
+
// Returns a count of the number of UTF-8 trail bytes.
-intptr_t Utf8::CodePointCount(const char* str, intptr_t* width) {
- bool is_two_byte_string = false;
- bool is_four_byte_string = false;
+intptr_t Utf8::CodePointCount(const uint8_t* utf8_array,
+ intptr_t array_len,
+ Type* type) {
intptr_t len = 0;
- for (; *str != '\0'; ++str) {
- uint8_t code_unit = *str;
+ Type char_type = kAscii;
+ for (intptr_t i = 0; i < array_len; i++) {
+ uint8_t code_unit = utf8_array[i];
if (!IsTrailByte(code_unit)) {
++len;
}
- if (code_unit > 0xC3) { // > U+00FF
- if (code_unit < 0xF0) { // < U+10000
- is_two_byte_string = true;
- } else {
- is_four_byte_string = true;
+ if (!IsAsciiSequenceStart(code_unit)) { // > U+007F
+ if (IsSmpSequenceStart(code_unit)) { // >= U+10000
+ char_type = kSMP;
+ ++len;
+ } else if (char_type == kAscii) {
+ char_type = kBMP;
}
}
}
- if (is_four_byte_string) {
- *width = 4;
- } else if (is_two_byte_string) {
- *width = 2;
- } else {
- *width = 1;
- }
+ *type = char_type;
return len;
}
// Returns true if str is a valid NUL-terminated UTF-8 string.
-bool Utf8::IsValid(const char* str) {
+bool Utf8::IsValid(const uint8_t* utf8_array, intptr_t array_len) {
intptr_t i = 0;
- while (str[i] != '\0') {
- uint32_t ch = str[i] & 0xFF;
+ while (i < array_len) {
+ uint32_t ch = utf8_array[i] & 0xFF;
intptr_t j = 1;
if (ch >= 0x80) {
- uint8_t num_trail_bytes = kTrailBytes[ch];
+ int8_t num_trail_bytes = kTrailBytes[ch];
bool is_malformed = false;
for (; j < num_trail_bytes; ++j) {
- if (str[i + j] != '\0') {
- uint8_t code_unit = str[i + j];
+ if ((i + j) < array_len) {
+ uint8_t code_unit = utf8_array[i + j];
is_malformed |= !IsTrailByte(code_unit);
ch = (ch << 6) + code_unit;
} else {
@@ -202,15 +218,17 @@
}
-intptr_t Utf8::Decode(const char* src, int32_t* dst) {
- uint32_t ch = src[0] & 0xFF;
- uint32_t i = 1;
+intptr_t Utf8::Decode(const uint8_t* utf8_array,
+ intptr_t array_len,
+ int32_t* dst) {
+ uint32_t ch = utf8_array[0] & 0xFF;
+ intptr_t i = 1;
if (ch >= 0x80) {
- uint32_t num_trail_bytes = kTrailBytes[ch];
+ int32_t num_trail_bytes = kTrailBytes[ch];
bool is_malformed = false;
for (; i < num_trail_bytes; ++i) {
- if (src[i] != '\0') {
- uint8_t code_unit = src[i];
+ if (i < array_len) {
+ uint8_t code_unit = utf8_array[i];
is_malformed |= !IsTrailByte(code_unit);
ch = (ch << 6) + code_unit;
} else {
@@ -233,38 +251,70 @@
}
-template<typename T>
-static bool DecodeImpl(const char* src, T* dst, intptr_t len) {
+bool Utf8::DecodeToAscii(const uint8_t* utf8_array,
+ intptr_t array_len,
+ uint8_t* dst,
+ intptr_t len) {
+ if (len < array_len) {
+ return false; // output overflow
+ }
+#ifdef DEBUG
+ for (intptr_t i = 0; i < array_len; i++) {
+ ASSERT(IsAsciiSequenceStart(utf8_array[i]));
+ }
+#endif
+ memmove(dst, utf8_array, array_len);
+ return true; // success
+}
+
+
+bool Utf8::DecodeToUTF16(const uint8_t* utf8_array,
+ intptr_t array_len,
+ uint16_t* dst,
+ intptr_t len) {
intptr_t i = 0;
intptr_t j = 0;
intptr_t num_bytes;
- for (; src[i] != '\0' && j < len; i += num_bytes, ++j) {
+ for (; (i < array_len) && (j < len); i += num_bytes, ++j) {
int32_t ch;
- num_bytes = Utf8::Decode(&src[i], &ch);
+ bool is_smp = IsSmpSequenceStart(utf8_array[i]);
+ num_bytes = Utf8::Decode(&utf8_array[i], (array_len - i), &ch);
if (ch == -1) {
return false; // invalid input
}
- dst[j] = ch;
+ if (is_smp) {
+ ConvertUTF32ToUTF16(ch, &(dst[j]));
+ j = j + 1;
+ } else {
+ dst[j] = ch;
+ }
}
- if (src[i] != '\0' && j == len) {
+ if ((i < array_len) && (j == len)) {
return false; // output overflow
}
return true; // success
}
-bool Utf8::Decode(const char* src, uint8_t* dst, intptr_t len) {
- return DecodeImpl(src, dst, len);
-}
-
-
-bool Utf8::Decode(const char* src, uint16_t* dst, intptr_t len) {
- return DecodeImpl(src, dst, len);
-}
-
-
-bool Utf8::Decode(const char* src, uint32_t* dst, intptr_t len) {
- return DecodeImpl(src, dst, len);
+bool Utf8::DecodeToUTF32(const uint8_t* utf8_array,
+ intptr_t array_len,
+ uint32_t* dst,
+ intptr_t len) {
+ intptr_t i = 0;
+ intptr_t j = 0;
+ intptr_t num_bytes;
+ for (; (i < array_len) && (j < len); i += num_bytes, ++j) {
+ int32_t ch;
+ num_bytes = Utf8::Decode(&utf8_array[i], (array_len - i), &ch);
+ if (ch == -1) {
+ return false; // invalid input
+ }
+ dst[j] = ch;
+ }
+ if ((i < array_len) && (j == len)) {
+ return false; // output overflow
+ }
+ return true; // success
}
} // namespace dart
diff --git a/runtime/vm/unicode.h b/runtime/vm/unicode.h
index ef6b1e3..ce572dc 100644
--- a/runtime/vm/unicode.h
+++ b/runtime/vm/unicode.h
@@ -14,14 +14,27 @@
class Utf8 : AllStatic {
public:
+ enum Type {
+ kAscii = 0, // ASCII character set.
+ kBMP, // Basic Multilingual Plane.
+ kSMP, // Supplementary Multilingual Plane.
+ };
+
static const intptr_t kMaxOneByteChar = 0x7F;
static const intptr_t kMaxTwoByteChar = 0x7FF;
static const intptr_t kMaxThreeByteChar = 0xFFFF;
static const intptr_t kMaxFourByteChar = 0x10FFFF;
+ static const intptr_t kMaxBmpCodepoint = 0xffff;
+ static const int32_t kLeadOffset = (0xD800 - (0x10000 >> 10));
+ static const int32_t kSurrogateOffset = (0x10000 - (0xD800 << 10) - 0xDC00);
- static intptr_t CodePointCount(const char* str, intptr_t* width);
+ static void ConvertUTF32ToUTF16(int32_t codepoint, uint16_t* dst);
+ static intptr_t CodePointCount(const uint8_t* utf8_array,
+ intptr_t array_len,
+ Type* type);
- static bool IsValid(const char* src);
+ // Returns true if 'utf8_array' is a valid UTF-8 string.
+ static bool IsValid(const uint8_t* utf8_array, intptr_t array_len);
static intptr_t Length(int32_t ch);
static intptr_t Length(const String& str);
@@ -29,10 +42,30 @@
static intptr_t Encode(int32_t ch, char* dst);
static intptr_t Encode(const String& src, char* dst, intptr_t len);
- static intptr_t Decode(const char*, int32_t* ch);
- static bool Decode(const char* src, uint8_t* dst, intptr_t len);
- static bool Decode(const char* src, uint16_t* dst, intptr_t len);
- static bool Decode(const char* src, uint32_t* dst, intptr_t len);
+ static intptr_t Decode(const uint8_t* utf8_array,
+ intptr_t array_len,
+ int32_t* ch);
+
+ static bool DecodeToAscii(const uint8_t* utf8_array,
+ intptr_t array_len,
+ uint8_t* dst,
+ intptr_t len);
+ static bool DecodeToUTF16(const uint8_t* utf8_array,
+ intptr_t array_len,
+ uint16_t* dst,
+ intptr_t len);
+ static bool DecodeToUTF32(const uint8_t* utf8_array,
+ intptr_t array_len,
+ uint32_t* dst,
+ intptr_t len);
+ static bool DecodeCStringToUTF32(const char* str,
+ uint32_t* dst,
+ intptr_t len) {
+ ASSERT(str != NULL);
+ intptr_t array_len = strlen(str);
+ const uint8_t* utf8_array = reinterpret_cast<const uint8_t*>(str);
+ return DecodeToUTF32(utf8_array, array_len, dst, len);
+ }
};
diff --git a/runtime/vm/unicode_test.cc b/runtime/vm/unicode_test.cc
index 92c09f7..967e9ca 100644
--- a/runtime/vm/unicode_test.cc
+++ b/runtime/vm/unicode_test.cc
@@ -15,7 +15,7 @@
uint32_t expected[] = { 0x41, 0xF1, 0x42 };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(is_valid);
EXPECT(!memcmp(expected, dst, sizeof(expected)));
}
@@ -25,7 +25,7 @@
uint32_t expected[] = { 0x4D };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(is_valid);
EXPECT(!memcmp(expected, dst, sizeof(expected)));
}
@@ -35,7 +35,7 @@
uint32_t expected[] = { 0x430 };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(is_valid);
EXPECT(!memcmp(expected, dst, sizeof(expected)));
}
@@ -45,7 +45,7 @@
uint32_t expected[] = { 0x4E8C };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(is_valid);
EXPECT(!memcmp(expected, dst, sizeof(expected)));
}
@@ -55,7 +55,7 @@
uint32_t expected[] = { 0x10302 };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(is_valid);
EXPECT(!memcmp(expected, dst, sizeof(expected)));
}
@@ -65,7 +65,7 @@
uint32_t expected[] = { 0x4D, 0x430, 0x4E8C, 0x10302 };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(is_valid);
EXPECT(!memcmp(expected, dst, sizeof(expected)));
}
@@ -80,7 +80,7 @@
0x5D1, 0x5E8, 0x5DB, 0x5D4 };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(is_valid);
EXPECT(!memcmp(expected, dst, sizeof(expected)));
}
@@ -93,7 +93,7 @@
uint32_t expected[] = { 0x3BA, 0x1F79, 0x3C3, 0x3BC, 0x3B5 };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(is_valid);
EXPECT(!memcmp(expected, dst, sizeof(expected)));
}
@@ -108,7 +108,7 @@
uint32_t expected[] = { 0x0 };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0xFF, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(is_valid);
EXPECT(memcmp(expected, dst, sizeof(expected)));
}
@@ -119,7 +119,7 @@
uint32_t expected[] = { 0x80 };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(is_valid);
EXPECT(!memcmp(expected, dst, sizeof(expected)));
}
@@ -130,7 +130,7 @@
uint32_t expected[] = { 0x800 };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(is_valid);
EXPECT(!memcmp(expected, dst, sizeof(expected)));
}
@@ -141,7 +141,7 @@
uint32_t expected[] = { 0x10000 };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(is_valid);
EXPECT(!memcmp(expected, dst, sizeof(expected)));
}
@@ -152,7 +152,7 @@
uint32_t expected[] = { 0x200000 };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(!is_valid);
EXPECT(memcmp(expected, dst, sizeof(expected)));
}
@@ -163,7 +163,7 @@
uint32_t expected[] = { 0x400000 };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(!is_valid);
EXPECT(memcmp(expected, dst, sizeof(expected)));
}
@@ -176,7 +176,7 @@
uint32_t expected[] = { 0x7F };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(is_valid);
EXPECT(!memcmp(expected, dst, sizeof(expected)));
}
@@ -187,7 +187,7 @@
uint32_t expected[] = { 0x7FF };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(is_valid);
EXPECT(!memcmp(expected, dst, sizeof(expected)));
}
@@ -198,7 +198,7 @@
uint32_t expected[] = { 0xFFFF };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(is_valid);
EXPECT(!memcmp(expected, dst, sizeof(expected)));
}
@@ -209,7 +209,7 @@
uint32_t expected[] = { 0x1FFFF };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(!is_valid);
EXPECT(memcmp(expected, dst, sizeof(expected)));
}
@@ -220,7 +220,7 @@
uint32_t expected[] = { 0x3FFFFFF };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(!is_valid);
EXPECT(memcmp(expected, dst, sizeof(expected)));
}
@@ -231,7 +231,7 @@
uint32_t expected[] = { 0x7FFFFFF };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(!is_valid);
EXPECT(memcmp(expected, dst, sizeof(expected)));
}
@@ -244,7 +244,7 @@
uint32_t expected[] = { 0xD7FF };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(is_valid);
EXPECT(!memcmp(expected, dst, sizeof(expected)));
}
@@ -255,7 +255,7 @@
uint32_t expected[] = { 0xE000 };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(is_valid);
EXPECT(!memcmp(expected, dst, sizeof(expected)));
}
@@ -266,7 +266,7 @@
uint32_t expected[] = { 0xFFFD };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(is_valid);
EXPECT(!memcmp(expected, dst, sizeof(expected)));
}
@@ -277,7 +277,7 @@
uint32_t expected[] = { 0x10FFFF };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(is_valid);
EXPECT(!memcmp(expected, dst, sizeof(expected)));
}
@@ -288,7 +288,7 @@
uint32_t expected[] = { 0x110000 };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(!is_valid);
EXPECT(memcmp(expected, dst, sizeof(expected)));
}
@@ -303,7 +303,7 @@
uint32_t expected[] = { 0x80 };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(!is_valid);
EXPECT(memcmp(expected, dst, sizeof(expected)));
}
@@ -314,7 +314,7 @@
uint32_t expected[] = { 0xBF };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(!is_valid);
EXPECT(memcmp(expected, dst, sizeof(expected)));
}
@@ -325,7 +325,7 @@
uint32_t expected[] = { 0x80, 0xBF };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(!is_valid);
EXPECT(memcmp(expected, dst, sizeof(expected)));
}
@@ -336,7 +336,7 @@
uint32_t expected[] = { 0x80, 0xBF, 0x80 };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(!is_valid);
EXPECT(memcmp(expected, dst, sizeof(expected)));
}
@@ -347,7 +347,7 @@
uint32_t expected[] = { 0x80, 0xBF, 0x80, 0xBF };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(!is_valid);
EXPECT(memcmp(expected, dst, sizeof(expected)));
}
@@ -358,7 +358,7 @@
uint32_t expected[] = { 0x80, 0xBF, 0x80, 0xBF, 0x80 };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(!is_valid);
EXPECT(memcmp(expected, dst, sizeof(expected)));
}
@@ -369,7 +369,7 @@
uint32_t expected[] = { 0x80, 0xBF, 0x80, 0xBF, 0x80, 0xBF };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(!is_valid);
EXPECT(memcmp(expected, dst, sizeof(expected)));
}
@@ -380,7 +380,7 @@
uint32_t expected[] = { 0x80, 0xBF, 0x80, 0xBF, 0x80, 0xBF, 0x80 };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(!is_valid);
EXPECT(memcmp(expected, dst, sizeof(expected)));
}
@@ -399,7 +399,7 @@
uint32_t dst[ARRAY_SIZE(expected)];
for (size_t i = 0; i < strlen(src); ++i) {
memset(dst, 0xFF, sizeof(dst));
- bool is_valid = Utf8::Decode(&src[i], dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(&src[i], dst, ARRAY_SIZE(dst));
EXPECT(!is_valid);
EXPECT(memcmp(expected, dst, sizeof(expected)));
}
@@ -422,7 +422,7 @@
uint32_t dst[ARRAY_SIZE(expected)];
for (size_t i = 0; i < strlen(src); i += 2) {
memset(dst, 0xFF, sizeof(dst));
- bool is_valid = Utf8::Decode(&src[i], dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(&src[i], dst, ARRAY_SIZE(dst));
EXPECT(!is_valid);
EXPECT(memcmp(expected, dst, sizeof(expected)));
}
@@ -439,7 +439,7 @@
uint32_t dst[ARRAY_SIZE(expected)];
for (size_t i = 0; i < strlen(src); i += 2) {
memset(dst, 0xFF, sizeof(dst));
- bool is_valid = Utf8::Decode(&src[i], dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(&src[i], dst, ARRAY_SIZE(dst));
EXPECT(!is_valid);
EXPECT(memcmp(expected, dst, sizeof(expected)));
}
@@ -454,7 +454,7 @@
uint32_t dst[ARRAY_SIZE(expected)];
for (size_t i = 0; i < strlen(src); i += 2) {
memset(dst, 0xFF, sizeof(dst));
- bool is_valid = Utf8::Decode(&src[i], dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(&src[i], dst, ARRAY_SIZE(dst));
EXPECT(!is_valid);
EXPECT(memcmp(expected, dst, sizeof(expected)));
}
@@ -468,7 +468,7 @@
uint32_t dst[ARRAY_SIZE(expected)];
for (size_t i = 0; i < strlen(src); i += 2) {
memset(dst, 0xFF, sizeof(dst));
- bool is_valid = Utf8::Decode(&src[i], dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(&src[i], dst, ARRAY_SIZE(dst));
EXPECT(!is_valid);
EXPECT(memcmp(expected, dst, sizeof(expected)));
}
@@ -482,7 +482,7 @@
uint32_t dst[ARRAY_SIZE(expected)];
for (size_t i = 0; i < strlen(src); i += 2) {
memset(dst, 0xFF, sizeof(dst));
- bool is_valid = Utf8::Decode(&src[i], dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(&src[i], dst, ARRAY_SIZE(dst));
EXPECT(!is_valid);
EXPECT(memcmp(expected, dst, sizeof(expected)));
}
@@ -496,7 +496,7 @@
uint32_t expected[] = { 0x0 };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0xFF, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(!is_valid);
EXPECT(memcmp(expected, dst, sizeof(expected)));
}
@@ -507,7 +507,7 @@
uint32_t expected[] = { 0x0 };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0xFF, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(!is_valid);
EXPECT(memcmp(expected, dst, sizeof(expected)));
}
@@ -518,7 +518,7 @@
uint32_t expected[] = { 0x0 };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0xFF, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(!is_valid);
EXPECT(memcmp(expected, dst, sizeof(expected)));
}
@@ -529,7 +529,7 @@
uint32_t expected[] = { 0x0 };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0xFF, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(!is_valid);
EXPECT(memcmp(expected, dst, sizeof(expected)));
}
@@ -541,7 +541,7 @@
uint32_t expected[] = { 0x0 };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0xFF, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(!is_valid);
EXPECT(memcmp(expected, dst, sizeof(expected)));
}
@@ -552,7 +552,7 @@
uint32_t expected[] = { 0x0 };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0xFF, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(!is_valid);
EXPECT(memcmp(expected, dst, sizeof(expected)));
}
@@ -563,7 +563,7 @@
uint32_t expected[] = { 0x0 };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0xFF, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(!is_valid);
EXPECT(memcmp(expected, dst, sizeof(expected)));
}
@@ -574,7 +574,7 @@
uint32_t expected[] = { 0x0 };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0xFF, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(!is_valid);
EXPECT(memcmp(expected, dst, sizeof(expected)));
}
@@ -586,7 +586,7 @@
uint32_t expected[] = { 0x0 };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0xFF, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(!is_valid);
EXPECT(memcmp(expected, dst, sizeof(expected)));
}
@@ -598,7 +598,7 @@
uint32_t expected[] = { 0x0 };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0xFF, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(!is_valid);
EXPECT(memcmp(expected, dst, sizeof(expected)));
}
@@ -615,7 +615,8 @@
for (size_t i = 0; i < strlen(src); ++i) {
for (size_t j = 1; j < (strlen(src) - i); ++j) {
memset(dst, 0xFF, sizeof(dst));
- bool is_valid = Utf8::Decode(&src[i], dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(&src[i],
+ dst, ARRAY_SIZE(dst));
EXPECT(!is_valid);
EXPECT(memcmp(expected, dst, sizeof(expected)));
}
@@ -630,7 +631,7 @@
uint32_t expected[] = { 0xFE };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(!is_valid);
EXPECT(memcmp(expected, dst, sizeof(expected)));
}
@@ -641,7 +642,7 @@
uint32_t expected[] = { 0xFF };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(!is_valid);
EXPECT(memcmp(expected, dst, sizeof(expected)));
}
@@ -652,7 +653,7 @@
uint32_t expected[] = { 0xFF };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(!is_valid);
EXPECT(memcmp(expected, dst, sizeof(expected)));
}
@@ -667,7 +668,7 @@
uint32_t expected[] = { 0x2F };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(!is_valid);
EXPECT(memcmp(expected, dst, sizeof(expected)));
}
@@ -678,7 +679,7 @@
uint32_t expected[] = { 0x2F };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(!is_valid);
EXPECT(memcmp(expected, dst, sizeof(expected)));
}
@@ -689,7 +690,7 @@
uint32_t expected[] = { 0x2F };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(!is_valid);
EXPECT(memcmp(expected, dst, sizeof(expected)));
}
@@ -700,7 +701,7 @@
uint32_t expected[] = { 0x2F };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(!is_valid);
EXPECT(memcmp(expected, dst, sizeof(expected)));
}
@@ -711,7 +712,7 @@
uint32_t expected[] = { 0x2F };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(!is_valid);
EXPECT(memcmp(expected, dst, sizeof(expected)));
}
@@ -724,7 +725,7 @@
uint32_t expected[] = { 0x7F };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(!is_valid);
EXPECT(memcmp(expected, dst, sizeof(expected)));
}
@@ -735,7 +736,7 @@
uint32_t expected[] = { 0x7FF };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(!is_valid);
EXPECT(memcmp(expected, dst, sizeof(expected)));
}
@@ -746,7 +747,7 @@
uint32_t expected[] = { 0xFFFF };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(!is_valid);
EXPECT(memcmp(expected, dst, sizeof(expected)));
}
@@ -757,7 +758,7 @@
uint32_t expected[] = { 0x1FFFFF };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(!is_valid);
EXPECT(memcmp(expected, dst, sizeof(expected)));
}
@@ -768,7 +769,7 @@
uint32_t expected[] = { 0x3FFFFFF };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(!is_valid);
EXPECT(memcmp(expected, dst, sizeof(expected)));
}
@@ -781,7 +782,7 @@
uint32_t expected[] = { 0x0 };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0xFF, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(!is_valid);
EXPECT(memcmp(expected, dst, sizeof(expected)));
}
@@ -792,7 +793,7 @@
uint32_t expected[] = { 0x0 };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0xFF, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(!is_valid);
EXPECT(memcmp(expected, dst, sizeof(expected)));
}
@@ -803,7 +804,7 @@
uint32_t expected[] = { 0x0 };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0xFF, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(!is_valid);
EXPECT(memcmp(expected, dst, sizeof(expected)));
}
@@ -814,7 +815,7 @@
uint32_t expected[] = { 0x0 };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0xFF, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(!is_valid);
EXPECT(memcmp(expected, dst, sizeof(expected)));
}
@@ -825,7 +826,7 @@
uint32_t expected[] = { 0x0 };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0xFF, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(!is_valid);
EXPECT(memcmp(expected, dst, sizeof(expected)));
}
@@ -838,7 +839,7 @@
uint32_t expected[] = { 0xD800 };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(!is_valid);
EXPECT(memcmp(expected, dst, sizeof(expected)));
}
@@ -849,7 +850,7 @@
uint32_t expected[] = { 0xDB7F };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(!is_valid);
EXPECT(memcmp(expected, dst, sizeof(expected)));
}
@@ -860,7 +861,7 @@
uint32_t expected[] = { 0xDB80 };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(!is_valid);
EXPECT(memcmp(expected, dst, sizeof(expected)));
}
@@ -871,7 +872,7 @@
uint32_t expected[] = { 0xDBFF };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(!is_valid);
EXPECT(memcmp(expected, dst, sizeof(expected)));
}
@@ -882,7 +883,7 @@
uint32_t expected[] = { 0xDC00 };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(!is_valid);
EXPECT(memcmp(expected, dst, sizeof(expected)));
}
@@ -893,7 +894,7 @@
uint32_t expected[] = { 0xDF80 };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(!is_valid);
EXPECT(memcmp(expected, dst, sizeof(expected)));
}
@@ -904,7 +905,7 @@
uint32_t expected[] = { 0xDFFF };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(!is_valid);
EXPECT(memcmp(expected, dst, sizeof(expected)));
}
@@ -917,7 +918,7 @@
uint32_t expected[] = { 0xD800, 0xDC00 };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(!is_valid);
EXPECT(memcmp(expected, dst, sizeof(expected)));
}
@@ -928,7 +929,7 @@
uint32_t expected[] = { 0xD800, 0xDFFF };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(!is_valid);
EXPECT(memcmp(expected, dst, sizeof(expected)));
}
@@ -939,7 +940,7 @@
uint32_t expected[] = { 0xDB7F, 0xDC00 };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(!is_valid);
EXPECT(memcmp(expected, dst, sizeof(expected)));
}
@@ -950,7 +951,7 @@
uint32_t expected[] = { 0xDB7F, 0xDFFF };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(!is_valid);
EXPECT(memcmp(expected, dst, sizeof(expected)));
}
@@ -961,7 +962,7 @@
uint32_t expected[] = { 0xDB80, 0xDC00 };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(!is_valid);
EXPECT(memcmp(expected, dst, sizeof(expected)));
}
@@ -972,7 +973,7 @@
uint32_t expected[] = { 0xDB80, 0xDFFF };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(!is_valid);
EXPECT(memcmp(expected, dst, sizeof(expected)));
}
@@ -983,7 +984,7 @@
uint32_t expected[] = { 0xDBFF, 0xDC00 };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(!is_valid);
EXPECT(memcmp(expected, dst, sizeof(expected)));
}
@@ -994,7 +995,7 @@
uint32_t expected[] = { 0xDBFF, 0xDFFF };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(!is_valid);
EXPECT(memcmp(expected, dst, sizeof(expected)));
}
@@ -1007,7 +1008,7 @@
uint32_t expected[] = { 0xFFFE };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(is_valid);
EXPECT(!memcmp(expected, dst, sizeof(expected)));
}
@@ -1018,7 +1019,7 @@
uint32_t expected[] = { 0xFFFF };
uint32_t dst[ARRAY_SIZE(expected)];
memset(dst, 0, sizeof(dst));
- bool is_valid = Utf8::Decode(src, dst, ARRAY_SIZE(dst));
+ bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
EXPECT(is_valid);
EXPECT(!memcmp(expected, dst, sizeof(expected)));
}
diff --git a/runtime/vm/unit_test.cc b/runtime/vm/unit_test.cc
index 4f10eae..6b0594f 100644
--- a/runtime/vm/unit_test.cc
+++ b/runtime/vm/unit_test.cc
@@ -53,7 +53,7 @@
if (!Dart_IsLibrary(library)) {
return Dart_Error("not a library");
}
- if (!Dart_IsString8(url)) {
+ if (!Dart_IsString(url)) {
return Dart_Error("url is not a string");
}
const char* url_chars = NULL;
@@ -100,8 +100,8 @@
Dart_Handle TestCase::LoadTestScript(const char* script,
Dart_NativeEntryResolver resolver) {
- Dart_Handle url = Dart_NewString(TestCase::url());
- Dart_Handle source = Dart_NewString(script);
+ Dart_Handle url = NewString(TestCase::url());
+ Dart_Handle source = NewString(script);
Dart_Handle result = Dart_SetLibraryTagHandler(LibraryTagHandler);
EXPECT_VALID(result);
EXPECT_VALID(result);
@@ -114,7 +114,7 @@
Dart_Handle TestCase::lib() {
- Dart_Handle url = Dart_NewString(TestCase::url());
+ Dart_Handle url = NewString(TestCase::url());
Dart_Handle lib = Dart_LookupLibrary(url);
DART_CHECK_VALID(lib);
ASSERT(Dart_IsLibrary(lib));
diff --git a/runtime/vm/unit_test.h b/runtime/vm/unit_test.h
index 1a21e38..713c272 100644
--- a/runtime/vm/unit_test.h
+++ b/runtime/vm/unit_test.h
@@ -132,6 +132,11 @@
}
+inline Dart_Handle NewString(const char* str) {
+ return Dart_NewStringFromCString(str);
+}
+
+
namespace dart {
// Forward declarations.
diff --git a/runtime/vm/vm.gypi b/runtime/vm/vm.gypi
index 8b8776e..f84916f 100644
--- a/runtime/vm/vm.gypi
+++ b/runtime/vm/vm.gypi
@@ -9,6 +9,7 @@
'corelib_patch_cc_file': '<(SHARED_INTERMEDIATE_DIR)/corelib_patch_gen.cc',
'corelib_impl_cc_file': '<(SHARED_INTERMEDIATE_DIR)/corelib_impl_gen.cc',
'corelib_impl_patch_cc_file': '<(SHARED_INTERMEDIATE_DIR)/corelib_impl_patch_gen.cc',
+ 'collection_cc_file': '<(SHARED_INTERMEDIATE_DIR)/collection_gen.cc',
'math_cc_file': '<(SHARED_INTERMEDIATE_DIR)/math_gen.cc',
'math_patch_cc_file': '<(SHARED_INTERMEDIATE_DIR)/math_patch_gen.cc',
'mirrors_cc_file': '<(SHARED_INTERMEDIATE_DIR)/mirrors_gen.cc',
@@ -68,6 +69,7 @@
'generate_corelib_patch_cc_file',
'generate_corelib_impl_cc_file',
'generate_corelib_impl_patch_cc_file',
+ 'generate_collection_cc_file',
'generate_math_cc_file',
'generate_math_patch_cc_file',
'generate_isolate_cc_file',
@@ -91,6 +93,7 @@
'<(corelib_patch_cc_file)',
'<(corelib_impl_cc_file)',
'<(corelib_impl_patch_cc_file)',
+ '<(collection_cc_file)',
'<(math_cc_file)',
'<(math_patch_cc_file)',
'<(isolate_cc_file)',
@@ -274,6 +277,44 @@
]
},
{
+ 'target_name': 'generate_collection_cc_file',
+ 'type': 'none',
+ 'includes': [
+ # Load the shared collection library sources.
+ '../../lib/collection/collection_sources.gypi',
+ ],
+ 'sources/': [
+ # Exclude all .[cc|h] files.
+ # This is only here for reference. Excludes happen after
+ # variable expansion, so the script has to do its own
+ # exclude processing of the sources being passed.
+ ['exclude', '\\.cc|h$'],
+ ],
+ 'actions': [
+ {
+ 'action_name': 'generate_collection_cc',
+ 'inputs': [
+ '../tools/create_string_literal.py',
+ '<(builtin_in_cc_file)',
+ '<@(_sources)',
+ ],
+ 'outputs': [
+ '<(collection_cc_file)',
+ ],
+ 'action': [
+ 'python',
+ 'tools/create_string_literal.py',
+ '--output', '<(collection_cc_file)',
+ '--input_cc', '<(builtin_in_cc_file)',
+ '--include', 'vm/bootstrap.h',
+ '--var_name', 'dart::Bootstrap::collection_source_',
+ '<@(_sources)',
+ ],
+ 'message': 'Generating ''<(collection_cc_file)'' file.'
+ },
+ ]
+ },
+ {
'target_name': 'generate_math_cc_file',
'type': 'none',
'includes': [
diff --git a/tests/benchmark_smoke/benchmark_smoke.status b/tests/benchmark_smoke/benchmark_smoke.status
index 52cbda4..0616efe 100644
--- a/tests/benchmark_smoke/benchmark_smoke.status
+++ b/tests/benchmark_smoke/benchmark_smoke.status
@@ -16,9 +16,3 @@
[ $compiler == dart2js && $runtime == none ]
*: Fail, Pass # TODO(ahe): Triage these tests.
-
-[ $compiler == dart2js && $runtime == drt && $checked ]
-benchmark_smoke_test: Fail # TypeError: Object #<HTMLParagraphElement> has no method 'get$text'
-
-[ $runtime == ie9 && $compiler == dart2js && $checked ]
-benchmark_smoke_test: Fail
diff --git a/tests/co19/co19-compiler.status b/tests/co19/co19-compiler.status
index 631e9a4..25470a6 100644
--- a/tests/co19/co19-compiler.status
+++ b/tests/co19/co19-compiler.status
@@ -3,6 +3,7 @@
# BSD-style license that can be found in the LICENSE file.
[ $compiler == dartc ]
+Language/03_Overview/1_Scoping_A02_t05: Fail # TODO(analyzer-team): Please triage this failure.
Language/03_Overview/1_Scoping_A02_t06: Fail # TODO(analyzer-team): Please triage this failure.
Language/03_Overview/2_Privacy_A01_t04: Fail # TODO(analyzer-team): Please triage this failure.
Language/03_Overview/2_Privacy_A01_t05: Fail # TODO(analyzer-team): Please triage this failure.
@@ -10,93 +11,85 @@
Language/03_Overview/2_Privacy_A01_t10: Fail # TODO(analyzer-team): Please triage this failure.
Language/03_Overview/2_Privacy_A01_t19: Fail # TODO(analyzer-team): Please triage this failure.
Language/03_Overview/2_Privacy_A01_t20: Fail # TODO(analyzer-team): Please triage this failure.
-Language/05_Variables/05_Variables_A03_t11: Fail # TODO(analyzer-team): Please triage this failure.
-Language/05_Variables/05_Variables_A03_t12: Fail # TODO(analyzer-team): Please triage this failure.
-Language/05_Variables/05_Variables_A03_t13: Fail # TODO(analyzer-team): Please triage this failure.
-Language/05_Variables/05_Variables_A03_t14: Fail # TODO(analyzer-team): Please triage this failure.
-Language/05_Variables/05_Variables_A03_t15: Fail # TODO(analyzer-team): Please triage this failure.
+Language/05_Variables/05_Variables_A05_t11: Fail # TODO(analyzer-team): Please triage this failure.
+Language/05_Variables/05_Variables_A05_t12: Fail # TODO(analyzer-team): Please triage this failure.
+Language/05_Variables/05_Variables_A05_t13: Fail # TODO(analyzer-team): Please triage this failure.
+Language/05_Variables/05_Variables_A05_t14: Fail # TODO(analyzer-team): Please triage this failure.
+Language/05_Variables/05_Variables_A05_t15: Fail # TODO(analyzer-team): Please triage this failure.
+Language/05_Variables/05_Variables_A06_t01: Fail # TODO(analyzer-team): Please triage this failure.
+Language/05_Variables/05_Variables_A11_t01: Fail # TODO(analyzer-team): Please triage this failure.
Language/05_Variables/1_Evaluation_of_Implicit_Variable_Getters_A01_t05: Fail # TODO(analyzer-team): Please triage this failure.
Language/06_Functions/1_Function_Declaration_A02_t03: Fail # TODO(analyzer-team): Please triage this failure.
Language/06_Functions/1_Function_Declaration_A03_t03: Fail # TODO(analyzer-team): Please triage this failure.
Language/06_Functions/2_Formal_Parameters_A02_t01: Fail # TODO(analyzer-team): Please triage this failure.
-Language/07_Classes/1_Instance_Methods_A02_t03: Fail # TODO(analyzer-team): Please triage this failure.
-Language/07_Classes/1_Instance_Methods_A02_t04: Fail # TODO(analyzer-team): Please triage this failure.
-Language/07_Classes/1_Instance_Methods_A02_t06: Fail # TODO(analyzer-team): Please triage this failure.
-Language/07_Classes/4_Abstract_Instance_Members_A04_t02: Fail # TODO(analyzer-team): Please triage this failure.
-Language/07_Classes/4_Abstract_Instance_Members_A04_t04: Fail # TODO(analyzer-team): Please triage this failure.
Language/07_Classes/6_Constructors/2_Factories_A05_t02: Fail # TODO(analyzer-team): Please triage this failure.
Language/07_Classes/6_Constructors/2_Factories_A05_t04: Fail # TODO(analyzer-team): Please triage this failure.
Language/08_Interfaces/5_Superinterfaces_A01_t02: Fail # TODO(analyzer-team): Please triage this failure.
-Language/10_Expressions/01_Constants_A03_t01: Fail # TODO(analyzer-team): Please triage this failure.
-Language/10_Expressions/01_Constants_A05_t01: Fail # TODO(analyzer-team): Please triage this failure.
-Language/10_Expressions/01_Constants_A14_t01: Fail # TODO(analyzer-team): Please triage this failure.
-Language/10_Expressions/05_Strings/1_String_Interpolation_A01_t06: Fail # TODO(analyzer-team): Please triage this failure.
-Language/10_Expressions/05_Strings/1_String_Interpolation_A01_t07: Fail # TODO(analyzer-team): Please triage this failure.
-Language/10_Expressions/05_Strings/1_String_Interpolation_A01_t13: Fail # TODO(analyzer-team): Please triage this failure.
-Language/10_Expressions/08_Throw_A05_t01: Fail # TODO(analyzer-team): Please triage this failure.
-Language/10_Expressions/09_Function_Expressions_A03_t02: Fail # TODO(analyzer-team): Please triage this failure.
-Language/10_Expressions/09_Function_Expressions_A04_t02: Fail # TODO(analyzer-team): Please triage this failure.
-Language/10_Expressions/11_Instance_Creation/1_New_A02_t07: Fail # TODO(analyzer-team): Please triage this failure.
-Language/10_Expressions/11_Instance_Creation/1_New_A06_t06: Fail # TODO(analyzer-team): Please triage this failure.
-Language/10_Expressions/11_Instance_Creation/2_Const_A10_t01: Fail # TODO(analyzer-team): Please triage this failure.
-Language/10_Expressions/11_Instance_Creation_A02_t01: Fail # TODO(analyzer-team): Please triage this failure.
-Language/10_Expressions/17_Getter_Invocation_A02_t01: Fail # TODO(analyzer-team): Please triage this failure.
-Language/10_Expressions/17_Getter_Invocation_A02_t02: Fail # TODO(analyzer-team): Please triage this failure.
-Language/10_Expressions/18_Assignment_A05_t02: Fail # TODO(analyzer-team): Please triage this failure.
-Language/10_Expressions/18_Assignment_A05_t04: Fail # TODO(analyzer-team): Please triage this failure.
-Language/10_Expressions/18_Assignment_A05_t05: Fail # TODO(analyzer-team): Please triage this failure.
-Language/10_Expressions/18_Assignment_A08_t04: Fail # TODO(analyzer-team): Please triage this failure.
-Language/10_Expressions/19_Conditional_A01_t14: Fail # TODO(analyzer-team): Please triage this failure.
-Language/10_Expressions/19_Conditional_A01_t15: Fail # TODO(analyzer-team): Please triage this failure.
-Language/10_Expressions/20_Logical_Boolean_Expressions_A01_t14: Fail # TODO(analyzer-team): Please triage this failure.
-Language/10_Expressions/21_Bitwise_Expressions_A01_t16: Fail # TODO(analyzer-team): Please triage this failure.
-Language/10_Expressions/21_Bitwise_Expressions_A01_t17: Fail # TODO(analyzer-team): Please triage this failure.
-Language/10_Expressions/22_Equality_A01_t23: Fail # TODO(analyzer-team): Please triage this failure.
-Language/10_Expressions/22_Equality_A01_t24: Fail # TODO(analyzer-team): Please triage this failure.
-Language/10_Expressions/23_Relational_Expressions_A01_t22: Fail # TODO(analyzer-team): Please triage this failure.
-Language/10_Expressions/23_Relational_Expressions_A01_t23: Fail # TODO(analyzer-team): Please triage this failure.
-Language/10_Expressions/24_Shift_A01_t13: Fail # TODO(analyzer-team): Please triage this failure.
-Language/10_Expressions/24_Shift_A01_t14: Fail # TODO(analyzer-team): Please triage this failure.
-Language/10_Expressions/25_Additive_Expressions_A01_t11: Fail # TODO(analyzer-team): Please triage this failure.
-Language/10_Expressions/25_Additive_Expressions_A01_t12: Fail # TODO(analyzer-team): Please triage this failure.
-Language/10_Expressions/25_Additive_Expressions_A01_t13: Fail # TODO(analyzer-team): Please triage this failure.
-Language/10_Expressions/25_Additive_Expressions_A01_t14: Fail # TODO(analyzer-team): Please triage this failure.
-Language/10_Expressions/26_Multiplicative_Expressions_A01_t14: Fail # TODO(analyzer-team): Please triage this failure.
-Language/10_Expressions/26_Multiplicative_Expressions_A01_t15: Fail # TODO(analyzer-team): Please triage this failure.
-Language/10_Expressions/26_Multiplicative_Expressions_A01_t16: Fail # TODO(analyzer-team): Please triage this failure.
-Language/10_Expressions/26_Multiplicative_Expressions_A01_t17: Fail # TODO(analyzer-team): Please triage this failure.
-Language/10_Expressions/27_Unary_Expressions_A01_t04: Fail # TODO(analyzer-team): Please triage this failure.
-Language/10_Expressions/27_Unary_Expressions_A01_t05: Fail # TODO(analyzer-team): Please triage this failure.
-Language/10_Expressions/27_Unary_Expressions_A01_t17: Fail # TODO(analyzer-team): Please triage this failure.
-Language/10_Expressions/27_Unary_Expressions_A01_t18: Fail # TODO(analyzer-team): Please triage this failure.
-Language/10_Expressions/27_Unary_Expressions_A01_t19: Fail # TODO(analyzer-team): Please triage this failure.
-Language/10_Expressions/27_Unary_Expressions_A01_t20: Fail # TODO(analyzer-team): Please triage this failure.
-Language/10_Expressions/27_Unary_Expressions_A01_t21: Fail # TODO(analyzer-team): Please triage this failure.
-Language/10_Expressions/27_Unary_Expressions_A01_t22: Fail # TODO(analyzer-team): Please triage this failure.
-Language/10_Expressions/28_Postfix_Expressions_A01_t02: Fail # TODO(analyzer-team): Please triage this failure.
-Language/10_Expressions/28_Postfix_Expressions_A01_t05: Fail # TODO(analyzer-team): Please triage this failure.
-Language/10_Expressions/29_Assignable_Expressions_A01_t08: Fail # TODO(analyzer-team): Please triage this failure.
-Language/10_Expressions/29_Assignable_Expressions_A01_t09: Fail # TODO(analyzer-team): Please triage this failure.
-Language/10_Expressions/30_Identifier_Reference_A05_t04: Fail # TODO(analyzer-team): Please triage this failure.
-Language/10_Expressions/30_Identifier_Reference_A06_t02: Fail # TODO(analyzer-team): Please triage this failure.
-Language/10_Expressions/30_Identifier_Reference_A07_t01: Fail # TODO(analyzer-team): Please triage this failure.
-Language/10_Expressions/30_Identifier_Reference_A13_t01: Fail # TODO(analyzer-team): Please triage this failure.
-Language/10_Expressions/31_Type_Test_A01_t02: Fail # TODO(analyzer-team): Please triage this failure.
-Language/10_Expressions/31_Type_Test_A01_t04: Fail # TODO(analyzer-team): Please triage this failure.
-Language/10_Expressions/32_Type_Cast_A01_t04: Fail # TODO(analyzer-team): Please triage this failure.
-Language/11_Statements/02_Expression_Statements_A01_t12: Fail # TODO(analyzer-team): Please triage this failure.
-Language/11_Statements/03_Variable_Declaration_A01_t05: Fail # TODO(analyzer-team): Please triage this failure.
-Language/11_Statements/03_Variable_Declaration_A01_t06: Fail # TODO(analyzer-team): Please triage this failure.
-Language/11_Statements/03_Variable_Declaration_A01_t09: Fail # TODO(analyzer-team): Please triage this failure.
-Language/11_Statements/03_Variable_Declaration_A01_t10: Fail # TODO(analyzer-team): Please triage this failure.
-Language/11_Statements/03_Variable_Declaration_A01_t16: Fail # TODO(analyzer-team): Please triage this failure.
-Language/11_Statements/03_Variable_Declaration_A01_t17: Fail # TODO(analyzer-team): Please triage this failure.
-Language/11_Statements/03_Variable_Declaration_A01_t18: Fail # TODO(analyzer-team): Please triage this failure.
-Language/11_Statements/03_Variable_Declaration_A01_t19: Fail # TODO(analyzer-team): Please triage this failure.
-Language/11_Statements/06_For_A01_t07: Fail # TODO(analyzer-team): Please triage this failure.
-Language/11_Statements/06_For_A01_t11: Fail # TODO(analyzer-team): Please triage this failure.
-Language/11_Statements/09_Switch_A02_t03: Fail # TODO(analyzer-team): Please triage this failure.
-Language/11_Statements/09_Switch_A06_t02: Fail # TODO(analyzer-team): Please triage this failure.
+Language/09_Generics/09_Generics_A05_t01: Fail # TODO(analyzer-team): Please triage this failure.
+Language/09_Generics/09_Generics_A05_t02: Fail # TODO(analyzer-team): Please triage this failure.
+Language/11_Expressions/01_Constants_A03_t01: Fail # TODO(analyzer-team): Please triage this failure.
+Language/11_Expressions/01_Constants_A05_t01: Fail # TODO(analyzer-team): Please triage this failure.
+Language/11_Expressions/01_Constants_A14_t01: Fail # TODO(analyzer-team): Please triage this failure.
+Language/11_Expressions/05_Strings/1_String_Interpolation_A01_t06: Fail # TODO(analyzer-team): Please triage this failure.
+Language/11_Expressions/05_Strings/1_String_Interpolation_A01_t07: Fail # TODO(analyzer-team): Please triage this failure.
+Language/11_Expressions/05_Strings/1_String_Interpolation_A01_t13: Fail # TODO(analyzer-team): Please triage this failure.
+Language/11_Expressions/08_Throw_A05_t01: Fail # TODO(analyzer-team): Please triage this failure.
+Language/11_Expressions/11_Instance_Creation/1_New_A02_t07: Fail # TODO(analyzer-team): Please triage this failure.
+Language/11_Expressions/11_Instance_Creation/1_New_A06_t06: Fail # TODO(analyzer-team): Please triage this failure.
+Language/11_Expressions/11_Instance_Creation/2_Const_A10_t01: Fail # TODO(analyzer-team): Please triage this failure.
+Language/11_Expressions/11_Instance_Creation_A02_t01: Fail # TODO(analyzer-team): Please triage this failure.
+Language/11_Expressions/18_Assignment_A05_t05: Fail # TODO(analyzer-team): Please triage this failure.
+Language/11_Expressions/19_Conditional_A01_t14: Fail # TODO(analyzer-team): Please triage this failure.
+Language/11_Expressions/19_Conditional_A01_t15: Fail # TODO(analyzer-team): Please triage this failure.
+Language/11_Expressions/20_Logical_Boolean_Expressions_A01_t14: Fail # TODO(analyzer-team): Please triage this failure.
+Language/11_Expressions/21_Bitwise_Expressions_A01_t16: Fail # TODO(analyzer-team): Please triage this failure.
+Language/11_Expressions/21_Bitwise_Expressions_A01_t17: Fail # TODO(analyzer-team): Please triage this failure.
+Language/11_Expressions/22_Equality_A01_t23: Fail # TODO(analyzer-team): Please triage this failure.
+Language/11_Expressions/22_Equality_A01_t24: Fail # TODO(analyzer-team): Please triage this failure.
+Language/11_Expressions/23_Relational_Expressions_A01_t22: Fail # TODO(analyzer-team): Please triage this failure.
+Language/11_Expressions/23_Relational_Expressions_A01_t23: Fail # TODO(analyzer-team): Please triage this failure.
+Language/11_Expressions/24_Shift_A01_t13: Fail # TODO(analyzer-team): Please triage this failure.
+Language/11_Expressions/24_Shift_A01_t14: Fail # TODO(analyzer-team): Please triage this failure.
+Language/11_Expressions/25_Additive_Expressions_A01_t11: Fail # TODO(analyzer-team): Please triage this failure.
+Language/11_Expressions/25_Additive_Expressions_A01_t12: Fail # TODO(analyzer-team): Please triage this failure.
+Language/11_Expressions/25_Additive_Expressions_A01_t13: Fail # TODO(analyzer-team): Please triage this failure.
+Language/11_Expressions/25_Additive_Expressions_A01_t14: Fail # TODO(analyzer-team): Please triage this failure.
+Language/11_Expressions/26_Multiplicative_Expressions_A01_t14: Fail # TODO(analyzer-team): Please triage this failure.
+Language/11_Expressions/26_Multiplicative_Expressions_A01_t15: Fail # TODO(analyzer-team): Please triage this failure.
+Language/11_Expressions/26_Multiplicative_Expressions_A01_t16: Fail # TODO(analyzer-team): Please triage this failure.
+Language/11_Expressions/26_Multiplicative_Expressions_A01_t17: Fail # TODO(analyzer-team): Please triage this failure.
+Language/11_Expressions/27_Unary_Expressions_A01_t04: Fail # TODO(analyzer-team): Please triage this failure.
+Language/11_Expressions/27_Unary_Expressions_A01_t05: Fail # TODO(analyzer-team): Please triage this failure.
+Language/11_Expressions/27_Unary_Expressions_A01_t17: Fail # TODO(analyzer-team): Please triage this failure.
+Language/11_Expressions/27_Unary_Expressions_A01_t18: Fail # TODO(analyzer-team): Please triage this failure.
+Language/11_Expressions/27_Unary_Expressions_A01_t19: Fail # TODO(analyzer-team): Please triage this failure.
+Language/11_Expressions/27_Unary_Expressions_A01_t20: Fail # TODO(analyzer-team): Please triage this failure.
+Language/11_Expressions/27_Unary_Expressions_A01_t21: Fail # TODO(analyzer-team): Please triage this failure.
+Language/11_Expressions/27_Unary_Expressions_A01_t22: Fail # TODO(analyzer-team): Please triage this failure.
+Language/11_Expressions/28_Postfix_Expressions_A01_t02: Fail # TODO(analyzer-team): Please triage this failure.
+Language/11_Expressions/28_Postfix_Expressions_A01_t05: Fail # TODO(analyzer-team): Please triage this failure.
+Language/11_Expressions/29_Assignable_Expressions_A01_t08: Fail # TODO(analyzer-team): Please triage this failure.
+Language/11_Expressions/29_Assignable_Expressions_A01_t09: Fail # TODO(analyzer-team): Please triage this failure.
+Language/11_Expressions/30_Identifier_Reference_A05_t04: Fail # TODO(analyzer-team): Please triage this failure.
+Language/11_Expressions/30_Identifier_Reference_A06_t02: Fail # TODO(analyzer-team): Please triage this failure.
+Language/11_Expressions/30_Identifier_Reference_A07_t01: Fail # TODO(analyzer-team): Please triage this failure.
+Language/11_Expressions/30_Identifier_Reference_A13_t01: Fail # TODO(analyzer-team): Please triage this failure.
+Language/11_Expressions/31_Type_Test_A01_t02: Fail # TODO(analyzer-team): Please triage this failure.
+Language/11_Expressions/31_Type_Test_A01_t04: Fail # TODO(analyzer-team): Please triage this failure.
+Language/11_Expressions/32_Type_Cast_A01_t04: Fail # TODO(analyzer-team): Please triage this failure.
+Language/12_Statements/02_Expression_Statements_A01_t12: Fail # TODO(analyzer-team): Please triage this failure.
+Language/12_Statements/03_Variable_Declaration_A01_t05: Fail # TODO(analyzer-team): Please triage this failure.
+Language/12_Statements/03_Variable_Declaration_A01_t06: Fail # TODO(analyzer-team): Please triage this failure.
+Language/12_Statements/03_Variable_Declaration_A01_t09: Fail # TODO(analyzer-team): Please triage this failure.
+Language/12_Statements/03_Variable_Declaration_A01_t10: Fail # TODO(analyzer-team): Please triage this failure.
+Language/12_Statements/03_Variable_Declaration_A01_t16: Fail # TODO(analyzer-team): Please triage this failure.
+Language/12_Statements/03_Variable_Declaration_A01_t17: Fail # TODO(analyzer-team): Please triage this failure.
+Language/12_Statements/03_Variable_Declaration_A01_t18: Fail # TODO(analyzer-team): Please triage this failure.
+Language/12_Statements/03_Variable_Declaration_A01_t19: Fail # TODO(analyzer-team): Please triage this failure.
+Language/12_Statements/06_For_A01_t07: Fail # TODO(analyzer-team): Please triage this failure.
+Language/12_Statements/06_For_A01_t11: Fail # TODO(analyzer-team): Please triage this failure.
+Language/12_Statements/09_Switch_A02_t03: Fail # TODO(analyzer-team): Please triage this failure.
+Language/12_Statements/09_Switch_A06_t02: Fail # TODO(analyzer-team): Please triage this failure.
Language/13_Libraries_and_Scripts/1_Imports_A01_t51: Fail # TODO(analyzer-team): Please triage this failure.
Language/13_Libraries_and_Scripts/1_Imports_A01_t52: Fail # TODO(analyzer-team): Please triage this failure.
Language/13_Libraries_and_Scripts/1_Imports_A02_t03: Fail # TODO(analyzer-team): Please triage this failure.
@@ -137,37 +130,36 @@
Language/06_Functions/4_External_Functions_A01_t01: pass # http://dartbug.com/5179
Language/07_Classes/10_Superinterfaces_A07_t01: pass # http://dartbug.com/5179
Language/08_Interfaces/5_Superinterfaces/1_Inheritance_and_Overriding_A01_t02: pass # http://dartbug.com/5179
-Language/10_Expressions/05_Strings/1_String_Interpolation_A03_t02: pass # http://dartbug.com/5179
-Language/10_Expressions/05_Strings/1_String_Interpolation_A04_t02: pass # http://dartbug.com/5179
-Language/10_Expressions/14_Function_Invocation/3_Unqualified_Invocation_A01_t03: pass # http://dartbug.com/5179
-Language/10_Expressions/14_Function_Invocation/3_Unqualified_Invocation_A01_t04: pass # http://dartbug.com/5179
-Language/10_Expressions/14_Function_Invocation/3_Unqualified_Invocation_A01_t05: pass # http://dartbug.com/5179
-Language/10_Expressions/14_Function_Invocation/3_Unqualified_Invocation_A01_t07: pass # http://dartbug.com/5179
-Language/10_Expressions/14_Function_Invocation/4_Function_Expression_Invocation_A02_t01: pass # http://dartbug.com/5179
-Language/10_Expressions/14_Function_Invocation/4_Function_Expression_Invocation_A03_t01: pass # http://dartbug.com/5179
-Language/10_Expressions/14_Function_Invocation/4_Function_Expression_Invocation_A05_t02: pass # http://dartbug.com/5179
-Language/10_Expressions/15_Method_Invocation/1_Ordinary_Invocation_A05_t07: pass # http://dartbug.com/5179
-Language/10_Expressions/15_Method_Invocation/1_Ordinary_Invocation_A08_t01: pass # http://dartbug.com/5179
-Language/10_Expressions/15_Method_Invocation/2_Cascaded_Invocation_A02_t02: pass # http://dartbug.com/5179
-Language/10_Expressions/15_Method_Invocation/3_Static_Invocation_A04_t02: pass # http://dartbug.com/5179
-Language/10_Expressions/15_Method_Invocation/3_Static_Invocation_A04_t03: pass # http://dartbug.com/5179
-Language/10_Expressions/15_Method_Invocation/3_Static_Invocation_A04_t07: pass # http://dartbug.com/5179
-Language/10_Expressions/15_Method_Invocation/3_Static_Invocation_A04_t08: pass # http://dartbug.com/5179
-Language/10_Expressions/15_Method_Invocation/3_Static_Invocation_A05_t01: pass # http://dartbug.com/5179
-Language/10_Expressions/15_Method_Invocation/3_Static_Invocation_A06_t02: pass # http://dartbug.com/5179
-Language/10_Expressions/15_Method_Invocation/4_Super_Invocation_A02_t04: pass # http://dartbug.com/5179
-Language/10_Expressions/15_Method_Invocation/4_Super_Invocation_A03_t02: pass # http://dartbug.com/5179
-Language/10_Expressions/15_Method_Invocation/4_Super_Invocation_A03_t03: pass # http://dartbug.com/5179
-Language/10_Expressions/15_Method_Invocation/4_Super_Invocation_A06_t01: pass # http://dartbug.com/5179
-Language/10_Expressions/15_Method_Invocation/4_Super_Invocation_A06_t02: pass # http://dartbug.com/5179
-Language/10_Expressions/15_Method_Invocation/4_Super_Invocation_A07_t01: pass # http://dartbug.com/5179
-Language/10_Expressions/15_Method_Invocation/4_Super_Invocation_A08_t02: pass # http://dartbug.com/5179
-Language/10_Expressions/30_Identifier_Reference_A04_t05: pass # http://dartbug.com/5179
-Language/10_Expressions/30_Identifier_Reference_A04_t07: pass # http://dartbug.com/5179
-Language/10_Expressions/30_Identifier_Reference_A05_t06: pass # http://dartbug.com/5179
+Language/11_Expressions/05_Strings/1_String_Interpolation_A03_t02: pass # http://dartbug.com/5179
+Language/11_Expressions/05_Strings/1_String_Interpolation_A04_t02: pass # http://dartbug.com/5179
+Language/11_Expressions/14_Function_Invocation/3_Unqualified_Invocation_A01_t03: pass # http://dartbug.com/5179
+Language/11_Expressions/14_Function_Invocation/3_Unqualified_Invocation_A01_t04: pass # http://dartbug.com/5179
+Language/11_Expressions/14_Function_Invocation/3_Unqualified_Invocation_A01_t05: pass # http://dartbug.com/5179
+Language/11_Expressions/14_Function_Invocation/3_Unqualified_Invocation_A01_t07: pass # http://dartbug.com/5179
+Language/11_Expressions/14_Function_Invocation/4_Function_Expression_Invocation_A02_t01: pass # http://dartbug.com/5179
+Language/11_Expressions/14_Function_Invocation/4_Function_Expression_Invocation_A03_t01: pass # http://dartbug.com/5179
+Language/11_Expressions/14_Function_Invocation/4_Function_Expression_Invocation_A05_t02: pass # http://dartbug.com/5179
+Language/11_Expressions/15_Method_Invocation/1_Ordinary_Invocation_A05_t07: pass # http://dartbug.com/5179
+Language/11_Expressions/15_Method_Invocation/1_Ordinary_Invocation_A08_t01: pass # http://dartbug.com/5179
+Language/11_Expressions/15_Method_Invocation/2_Cascaded_Invocation_A02_t02: pass # http://dartbug.com/5179
+Language/11_Expressions/15_Method_Invocation/3_Static_Invocation_A04_t02: pass # http://dartbug.com/5179
+Language/11_Expressions/15_Method_Invocation/3_Static_Invocation_A04_t03: pass # http://dartbug.com/5179
+Language/11_Expressions/15_Method_Invocation/3_Static_Invocation_A04_t07: pass # http://dartbug.com/5179
+Language/11_Expressions/15_Method_Invocation/3_Static_Invocation_A04_t08: pass # http://dartbug.com/5179
+Language/11_Expressions/15_Method_Invocation/3_Static_Invocation_A05_t01: pass # http://dartbug.com/5179
+Language/11_Expressions/15_Method_Invocation/3_Static_Invocation_A06_t02: pass # http://dartbug.com/5179
+Language/11_Expressions/15_Method_Invocation/4_Super_Invocation_A02_t04: pass # http://dartbug.com/5179
+Language/11_Expressions/15_Method_Invocation/4_Super_Invocation_A03_t02: pass # http://dartbug.com/5179
+Language/11_Expressions/15_Method_Invocation/4_Super_Invocation_A03_t03: pass # http://dartbug.com/5179
+Language/11_Expressions/15_Method_Invocation/4_Super_Invocation_A06_t01: pass # http://dartbug.com/5179
+Language/11_Expressions/15_Method_Invocation/4_Super_Invocation_A06_t02: pass # http://dartbug.com/5179
+Language/11_Expressions/15_Method_Invocation/4_Super_Invocation_A07_t01: pass # http://dartbug.com/5179
+Language/11_Expressions/15_Method_Invocation/4_Super_Invocation_A08_t02: pass # http://dartbug.com/5179
+Language/11_Expressions/30_Identifier_Reference_A04_t05: pass # http://dartbug.com/5179
+Language/11_Expressions/30_Identifier_Reference_A04_t07: pass # http://dartbug.com/5179
+Language/11_Expressions/30_Identifier_Reference_A05_t06: pass # http://dartbug.com/5179
Language/13_Libraries_and_Scripts/13_Libraries_and_Scripts_A05_t01: pass # http://dartbug.com/5179
-Language/07_Classes/2_Getters_A01_t05: Fail # No issue: waiting to remove old getter syntax
Language/07_Classes/3_Setters_A04_t03: Fail, OK # getter and method with the same name
Language/07_Classes/3_Setters_A04_t06: Fail OK # getter and method with the same name
@@ -175,17 +167,66 @@
Language/07_Classes/07_Classes_A07_t03: Fail, OK
Language/07_Classes/07_Classes_A07_t06: Fail, OK
+# co19 issue 298
+Language/03_Overview/1_Scoping_A03_t02: Fail, OK
+Language/03_Overview/2_Privacy_A01_t01: Fail, OK
+Language/03_Overview/2_Privacy_A01_t02: Fail, OK
+Language/03_Overview/2_Privacy_A01_t06: Fail, OK
+Language/03_Overview/2_Privacy_A01_t07: Fail, OK
+Language/03_Overview/2_Privacy_A01_t12: Fail, OK
+Language/03_Overview/2_Privacy_A01_t16: Fail, OK
+Language/07_Classes/07_Classes_A02_t01: Fail, OK
+Language/07_Classes/07_Classes_A03_t01: Fail, OK
+Language/07_Classes/07_Classes_A02_t34: Fail, OK
+Language/07_Classes/07_Classes_A03_t04: Fail, OK
+Language/07_Classes/07_Classes_A03_t10: Fail, OK
+Language/07_Classes/07_Classes_A07_t10: Fail, OK
+Language/07_Classes/1_Instance_Methods_A05_t02: Fail, OK
+Language/07_Classes/9_Superclasses/1_Inheritance_and_Overriding_A02_t04: Fail, OK
+Language/08_Interfaces/5_Superinterfaces/1_Inheritance_and_Overriding_A01_t01: Fail, OK
+Language/08_Interfaces/5_Superinterfaces/1_Inheritance_and_Overriding_A02_t05: Fail, OK
+Language/11_Expressions/15_Method_Invocation/2_Cascaded_Invocation_A01_t01: Fail, OK
+Language/11_Expressions/15_Method_Invocation/3_Static_Invocation_A03_t07: Fail, OK
+Language/11_Expressions/16_Getter_Lookup_A02_t04: Fail, OK
+Language/11_Expressions/18_Assignment_A04_t05: Fail, OK
+Language/11_Expressions/23_Relational_Expressions_A01_t01: Fail, OK
+Language/11_Expressions/24_Shift_A01_t01: Fail, OK
+Language/11_Expressions/30_Identifier_Reference_A12_t01: Fail, OK
+Language/13_Libraries_and_Scripts/13_Libraries_and_Scripts_A01_t01: Fail, OK
+Language/13_Libraries_and_Scripts/1_Imports_A02_t02: Fail, OK
+Language/13_Libraries_and_Scripts/1_Imports_A02_t01: Fail, OK
+Language/13_Libraries_and_Scripts/1_Imports_A02_t04: Fail, OK
+Language/13_Libraries_and_Scripts/1_Imports_A02_t06: Fail, OK
+Language/13_Libraries_and_Scripts/1_Imports_A02_t11: Fail, OK
+Language/13_Libraries_and_Scripts/1_Imports_A02_t14: Fail, OK
+Language/13_Libraries_and_Scripts/1_Imports_A02_t16: Fail, OK
+Language/13_Libraries_and_Scripts/1_Imports_A02_t17: Fail, OK
+Language/13_Libraries_and_Scripts/1_Imports_A02_t20: Fail, OK
+Language/13_Libraries_and_Scripts/3_Parts_A02_t04: Fail, OK
+
+
+# co19 issue 218
+Language/10_Expressions/28_Identifier_Reference_A08_t38: Fail, OK
+
+# co19 issue 270
+Language/13_Libraries_and_Scripts/3_Includes_A01_t14: Fail, OK
+Language/13_Libraries_and_Scripts/3_Includes_A02_t03: Fail, OK
+Language/13_Libraries_and_Scripts/3_Includes_A02_t04: Fail, OK
+Language/13_Libraries_and_Scripts/4_Scripts_A01_t16: Fail, OK
+
+
+
+Language/10_Expressions/30_Type_Cast_A01_t04: Fail, OK # the expected error is not specified
Language/13_Libraries_and_Scripts/13_Libraries_and_Scripts_A05_t03: Fail, OK # contains syntax error
Language/13_Libraries_and_Scripts/13_Libraries_and_Scripts_A05_t04: Fail, OK # contains syntax error
Language/06_Functions/2_Formal_Parameters/2_Optional_Formals_A03_t02: Fail, OK # deprecated parameter syntax
-Language/10_Expressions/15_Method_Invocation/4_Super_Invocation_A04_t03: Fail # Issue 5294
-Language/10_Expressions/15_Method_Invocation/4_Super_Invocation_A04_t04: Fail # Issue 5294
+Language/11_Expressions/15_Method_Invocation/4_Super_Invocation_A04_t04: Fail # Issue 5294
# The following tests use NoSuchMethodException instead of NoSuchMethodError.
Language/06_Functions/4_External_Functions_A01_t01: Fail, OK # co19 issue 195
-Language/10_Expressions/15_Method_Invocation/3_Static_Invocation_A04_t07: Fail, OK # co19 issue 195
-Language/10_Expressions/15_Method_Invocation/3_Static_Invocation_A04_t08: Fail, OK # co19 issue 195
-Language/10_Expressions/14_Function_Invocation/4_Function_Expression_Invocation_A05_t02: Fail, OK # co19 issue 195
+Language/11_Expressions/15_Method_Invocation/3_Static_Invocation_A04_t07: Fail, OK # co19 issue 195
+Language/11_Expressions/15_Method_Invocation/3_Static_Invocation_A04_t08: Fail, OK # co19 issue 195
+Language/11_Expressions/14_Function_Invocation/4_Function_Expression_Invocation_A05_t02: Fail, OK # co19 issue 195
Language/13_Libraries_and_Scripts/13_Libraries_and_Scripts_A05_t01: Fail, OK # co19 issue 195
# Rename "BadNumberFormatException" to "FormatException"
@@ -193,35 +234,29 @@
# http://code.google.com/p/co19/issues/detail?id=167 is fixed.
Language/03_Overview/1_Scoping_A02_t28: Fail # language change 1031
-Language/07_Classes/2_Getters_A01_t03: Fail, OK # out of date - getters are not allowed to have parameters
Language/07_Classes/6_Constructors/1_Generative_Constructors_A15_t07: Fail # Issue 3323
Language/07_Classes/6_Constructors/3_Constant_Constructors_A05_t01: Fail # Issue 2477
Language/07_Classes/6_Constructors/3_Constant_Constructors_A05_t02: Fail # Issue 2477
Language/07_Classes/6_Constructors/3_Constant_Constructors_A05_t03: Fail # Issue 2477
-Language/10_Expressions/01_Constants_A16_t01: Fail # Issue 1473
-Language/10_Expressions/01_Constants_A16_t02: Fail # Issue 1473
-Language/10_Expressions/01_Constants_A16_t03: Fail # Issue 1473
-Language/10_Expressions/01_Constants_A17_t03: Fail # Issue 1473
-Language/10_Expressions/05_Strings/1_String_Interpolation_A01_t05: Fail # language change 3368
-Language/10_Expressions/15_Method_Invocation/1_Ordinary_Invocation_A05_t02: Fail # Issue 3524
-Language/10_Expressions/15_Method_Invocation/1_Ordinary_Invocation_A05_t03: Fail # Issue 3524
-Language/10_Expressions/15_Method_Invocation/1_Ordinary_Invocation_A05_t05: Fail # Issue 3524
-Language/10_Expressions/15_Method_Invocation/1_Ordinary_Invocation_A05_t06: Fail # Issue 3524
-Language/10_Expressions/15_Method_Invocation/4_Super_Invocation_A04_t01: Fail # Issue 3524
-Language/10_Expressions/15_Method_Invocation/4_Super_Invocation_A04_t02: Fail # Issue 3524
-Language/10_Expressions/19_Conditional_A01_t12: Fail # language change 3368
-Language/10_Expressions/19_Conditional_A01_t13: Fail # language change 3368
-Language/10_Expressions/20_Logical_Boolean_Expressions_A01_t12: Fail # language change 3368
-Language/10_Expressions/20_Logical_Boolean_Expressions_A01_t13: Fail # language change 3368
-Language/10_Expressions/21_Bitwise_Expressions_A01_t14: Fail # language change 3368
-Language/10_Expressions/21_Bitwise_Expressions_A01_t15: Fail # language change 3368
-Language/10_Expressions/22_Equality_A01_t19: Fail # language change 3368
-Language/10_Expressions/22_Equality_A01_t20: Fail # language change 3368
-Language/10_Expressions/22_Equality_A02_t03: Fail, OK # co19 issue 169
-Language/10_Expressions/23_Relational_Expressions_A01_t20: Fail # language change 3368
-Language/10_Expressions/23_Relational_Expressions_A01_t21: Fail # language change 3368
-Language/10_Expressions/24_Shift_A01_t11: Fail # language change 3368
-Language/10_Expressions/24_Shift_A01_t12: Fail # language change 3368
+Language/11_Expressions/01_Constants_A16_t01: Fail # Issue 1473
+Language/11_Expressions/01_Constants_A16_t02: Fail # Issue 1473
+Language/11_Expressions/01_Constants_A16_t03: Fail # Issue 1473
+Language/11_Expressions/01_Constants_A17_t03: Fail # Issue 1473
+Language/11_Expressions/05_Strings/1_String_Interpolation_A01_t05: Fail # language change 3368
+Language/11_Expressions/15_Method_Invocation/1_Ordinary_Invocation_A05_t03: Fail # Issue 3524
+Language/11_Expressions/19_Conditional_A01_t12: Fail # language change 3368
+Language/11_Expressions/19_Conditional_A01_t13: Fail # language change 3368
+Language/11_Expressions/20_Logical_Boolean_Expressions_A01_t12: Fail # language change 3368
+Language/11_Expressions/20_Logical_Boolean_Expressions_A01_t13: Fail # language change 3368
+Language/11_Expressions/21_Bitwise_Expressions_A01_t14: Fail # language change 3368
+Language/11_Expressions/21_Bitwise_Expressions_A01_t15: Fail # language change 3368
+Language/11_Expressions/22_Equality_A01_t19: Fail # language change 3368
+Language/11_Expressions/22_Equality_A01_t20: Fail # language change 3368
+Language/11_Expressions/22_Equality_A02_t03: Fail, OK # co19 issue 169
+Language/11_Expressions/23_Relational_Expressions_A01_t20: Fail # language change 3368
+Language/11_Expressions/23_Relational_Expressions_A01_t21: Fail # language change 3368
+Language/11_Expressions/24_Shift_A01_t11: Fail # language change 3368
+Language/11_Expressions/24_Shift_A01_t12: Fail # language change 3368
# The following tests use hashCode() (function) instead of hashCode (getter).
# co19 issue 273
@@ -237,50 +272,49 @@
LibTest/core/Queue/iterator_next_A02_t01: Fail, OK # co19 issue 288
Language/06_Functions/3_Type_of_a_Function_A01_t01: Fail, OK
-Language/10_Expressions/15_Method_Invocation/1_Ordinary_Invocation_A05_t07: Fail, OK
-Language/10_Expressions/15_Method_Invocation/4_Super_Invocation_A03_t02: Fail, OK
-Language/10_Expressions/15_Method_Invocation/3_Static_Invocation_A06_t02: Fail, OK
-Language/10_Expressions/15_Method_Invocation/4_Super_Invocation_A07_t01: Fail, OK
-Language/10_Expressions/15_Method_Invocation/3_Static_Invocation_A05_t01: Fail, OK
-Language/10_Expressions/15_Method_Invocation/4_Super_Invocation_A03_t03: Fail, OK
-Language/10_Expressions/15_Method_Invocation/3_Static_Invocation_A04_t02: Fail, OK
-Language/10_Expressions/15_Method_Invocation/1_Ordinary_Invocation_A08_t01: Fail, OK
-Language/10_Expressions/15_Method_Invocation/4_Super_Invocation_A06_t01: Fail, OK
-Language/10_Expressions/15_Method_Invocation/4_Super_Invocation_A08_t02: Fail, OK
-Language/10_Expressions/15_Method_Invocation/4_Super_Invocation_A06_t02: Fail, OK
-Language/10_Expressions/15_Method_Invocation/2_Cascaded_Invocation_A02_t02: Fail, OK
-Language/10_Expressions/15_Method_Invocation/3_Static_Invocation_A04_t03: Fail, OK
-Language/10_Expressions/15_Method_Invocation/4_Super_Invocation_A02_t04: Fail, OK
-Language/10_Expressions/21_Bitwise_Expressions_A01_t15: Fail, OK
-Language/10_Expressions/19_Conditional_A01_t13: Fail, OK
-Language/10_Expressions/20_Logical_Boolean_Expressions_A01_t12: Fail, OK
-Language/10_Expressions/21_Bitwise_Expressions_A01_t14: Fail, OK
-Language/10_Expressions/23_Relational_Expressions_A01_t21: Fail, OK
-Language/10_Expressions/22_Equality_A01_t19: Fail, OK
-Language/10_Expressions/01_Constants_A17_t03: Fail, OK
-Language/10_Expressions/05_Strings/1_String_Interpolation_A04_t02: Fail, OK
-Language/10_Expressions/05_Strings/1_String_Interpolation_A03_t02: Fail, OK
-Language/10_Expressions/05_Strings/1_String_Interpolation_A01_t05: Fail, OK
-Language/10_Expressions/24_Shift_A01_t11: Fail, OK
-Language/10_Expressions/20_Logical_Boolean_Expressions_A01_t13: Fail, OK
-Language/10_Expressions/22_Equality_A01_t20: Fail, OK
-Language/10_Expressions/30_Identifier_Reference_A04_t07: Fail, OK
-Language/10_Expressions/30_Identifier_Reference_A04_t05: Fail, OK
-Language/10_Expressions/01_Constants_A16_t02: Fail, OK
-Language/10_Expressions/23_Relational_Expressions_A01_t20: Fail, OK
-Language/10_Expressions/30_Identifier_Reference_A05_t06: Fail, OK
-Language/10_Expressions/01_Constants_A15_t16: Fail, OK
-Language/10_Expressions/14_Function_Invocation/3_Unqualified_Invocation_A01_t04: Fail, OK
-Language/10_Expressions/14_Function_Invocation/3_Unqualified_Invocation_A01_t07: Fail, OK
-Language/10_Expressions/14_Function_Invocation/3_Unqualified_Invocation_A01_t03: Fail, OK
-Language/10_Expressions/14_Function_Invocation/4_Function_Expression_Invocation_A03_t01: Fail, OK
-Language/10_Expressions/14_Function_Invocation/4_Function_Expression_Invocation_A02_t01: Fail, OK
-Language/10_Expressions/14_Function_Invocation/3_Unqualified_Invocation_A01_t05: Fail, OK
-Language/10_Expressions/19_Conditional_A01_t12: Fail, OK
-Language/10_Expressions/01_Constants_A16_t03: Fail, OK
-Language/10_Expressions/01_Constants_A16_t01: Fail, OK
-Language/10_Expressions/24_Shift_A01_t12: Fail, OK
-Language/07_Classes/2_Getters_A01_t03: Fail, OK
+Language/11_Expressions/15_Method_Invocation/1_Ordinary_Invocation_A05_t07: Fail, OK
+Language/11_Expressions/15_Method_Invocation/4_Super_Invocation_A03_t02: Fail, OK
+Language/11_Expressions/15_Method_Invocation/3_Static_Invocation_A06_t02: Fail, OK
+Language/11_Expressions/15_Method_Invocation/4_Super_Invocation_A07_t01: Fail, OK
+Language/11_Expressions/15_Method_Invocation/3_Static_Invocation_A05_t01: Fail, OK
+Language/11_Expressions/15_Method_Invocation/4_Super_Invocation_A03_t03: Fail, OK
+Language/11_Expressions/15_Method_Invocation/3_Static_Invocation_A04_t02: Fail, OK
+Language/11_Expressions/15_Method_Invocation/1_Ordinary_Invocation_A08_t01: Fail, OK
+Language/11_Expressions/15_Method_Invocation/4_Super_Invocation_A06_t01: Fail, OK
+Language/11_Expressions/15_Method_Invocation/4_Super_Invocation_A08_t02: Fail, OK
+Language/11_Expressions/15_Method_Invocation/4_Super_Invocation_A06_t02: Fail, OK
+Language/11_Expressions/15_Method_Invocation/2_Cascaded_Invocation_A02_t02: Fail, OK
+Language/11_Expressions/15_Method_Invocation/3_Static_Invocation_A04_t03: Fail, OK
+Language/11_Expressions/15_Method_Invocation/4_Super_Invocation_A02_t04: Fail, OK
+Language/11_Expressions/21_Bitwise_Expressions_A01_t15: Fail, OK
+Language/11_Expressions/19_Conditional_A01_t13: Fail, OK
+Language/11_Expressions/20_Logical_Boolean_Expressions_A01_t12: Fail, OK
+Language/11_Expressions/21_Bitwise_Expressions_A01_t14: Fail, OK
+Language/11_Expressions/23_Relational_Expressions_A01_t21: Fail, OK
+Language/11_Expressions/22_Equality_A01_t19: Fail, OK
+Language/11_Expressions/01_Constants_A17_t03: Fail, OK
+Language/11_Expressions/05_Strings/1_String_Interpolation_A04_t02: Fail, OK
+Language/11_Expressions/05_Strings/1_String_Interpolation_A03_t02: Fail, OK
+Language/11_Expressions/05_Strings/1_String_Interpolation_A01_t05: Fail, OK
+Language/11_Expressions/24_Shift_A01_t11: Fail, OK
+Language/11_Expressions/20_Logical_Boolean_Expressions_A01_t13: Fail, OK
+Language/11_Expressions/22_Equality_A01_t20: Fail, OK
+Language/11_Expressions/30_Identifier_Reference_A04_t07: Fail, OK
+Language/11_Expressions/30_Identifier_Reference_A04_t05: Fail, OK
+Language/11_Expressions/01_Constants_A16_t02: Fail, OK
+Language/11_Expressions/23_Relational_Expressions_A01_t20: Fail, OK
+Language/11_Expressions/30_Identifier_Reference_A05_t06: Fail, OK
+Language/11_Expressions/01_Constants_A15_t16: Fail, OK
+Language/11_Expressions/14_Function_Invocation/3_Unqualified_Invocation_A01_t04: Fail, OK
+Language/11_Expressions/14_Function_Invocation/3_Unqualified_Invocation_A01_t07: Fail, OK
+Language/11_Expressions/14_Function_Invocation/3_Unqualified_Invocation_A01_t03: Fail, OK
+Language/11_Expressions/14_Function_Invocation/4_Function_Expression_Invocation_A03_t01: Fail, OK
+Language/11_Expressions/14_Function_Invocation/4_Function_Expression_Invocation_A02_t01: Fail, OK
+Language/11_Expressions/14_Function_Invocation/3_Unqualified_Invocation_A01_t05: Fail, OK
+Language/11_Expressions/19_Conditional_A01_t12: Fail, OK
+Language/11_Expressions/01_Constants_A16_t03: Fail, OK
+Language/11_Expressions/01_Constants_A16_t01: Fail, OK
+Language/11_Expressions/24_Shift_A01_t12: Fail, OK
Language/07_Classes/6_Constructors/3_Constant_Constructors_A05_t02: Fail, OK
Language/07_Classes/6_Constructors/3_Constant_Constructors_A05_t03: Fail, OK
Language/07_Classes/6_Constructors/3_Constant_Constructors_A05_t01: Fail, OK
diff --git a/tests/co19/co19-dart2dart.status b/tests/co19/co19-dart2dart.status
index be87353..05deb6f 100644
--- a/tests/co19/co19-dart2dart.status
+++ b/tests/co19/co19-dart2dart.status
@@ -3,15 +3,47 @@
# BSD-style license that can be found in the LICENSE file.
[ $compiler == dart2dart ]
+# Calling unresolved class constructor:
+Language/03_Overview/2_Privacy_A01_t19: Fail
+Language/03_Overview/2_Privacy_A01_t20: Fail
+Language/07_Classes/6_Constructors_A03_t03: Fail
+Language/11_Expressions/11_Instance_Creation/1_New_A06_t04: Fail
+Language/11_Expressions/11_Instance_Creation/1_New_A06_t05: Fail
+Language/11_Expressions/11_Instance_Creation/1_New_A06_t06: Fail
+
+# Renaming type from platform library:
+Language/09_Generics/09_Generics_A02_t01: Fail
+Language/14_Types/4_Interface_Types_A10_t03: Fail
+
+
Language/13_Libraries_and_Scripts/2_Exports_A04_t02: Crash # TODO(dart2dart-team): Please triage this crash.
Language/13_Libraries_and_Scripts/2_Exports_A04_t03: Crash # TODO(dart2dart-team): Please triage this crash.
+Language/12_Statements/10_Try_A06_t01: Fail, Pass # Fails in minified, TRIAGE
-Language/05_Variables/05_Variables_A03_t09: Fail # TODO(dart2dart-team): Please triage this failure.
-Language/05_Variables/05_Variables_A03_t11: Fail # TODO(dart2dart-team): Please triage this failure.
-Language/05_Variables/05_Variables_A03_t12: Fail # TODO(dart2dart-team): Please triage this failure.
-Language/05_Variables/05_Variables_A03_t13: Fail # TODO(dart2dart-team): Please triage this failure.
-Language/05_Variables/05_Variables_A03_t14: Fail # TODO(dart2dart-team): Please triage this failure.
-Language/05_Variables/05_Variables_A03_t15: Fail # TODO(dart2dart-team): Please triage this failure.
+Language/03_Overview/1_Scoping_A02_t05: Fail # TODO(dart2dart-team): Please triage this failure.
+Language/05_Variables/05_Variables_A05_t04: Fail # TODO(dart2dart-team): Please triage this failure.
+Language/05_Variables/05_Variables_A05_t05: Fail # TODO(dart2dart-team): Please triage this failure.
+Language/05_Variables/05_Variables_A05_t06: Fail # TODO(dart2dart-team): Please triage this failure.
+Language/05_Variables/05_Variables_A05_t07: Fail # TODO(dart2dart-team): Please triage this failure.
+Language/05_Variables/05_Variables_A05_t08: Fail # TODO(dart2dart-team): Please triage this failure.
+Language/05_Variables/05_Variables_A05_t09: Fail # TODO(dart2dart-team): Please triage this failure.
+Language/05_Variables/05_Variables_A05_t10: Fail # TODO(dart2dart-team): Please triage this failure.
+Language/05_Variables/05_Variables_A05_t11: Fail # TODO(dart2dart-team): Please triage this failure.
+Language/05_Variables/05_Variables_A05_t12: Fail # TODO(dart2dart-team): Please triage this failure.
+Language/05_Variables/05_Variables_A05_t13: Fail # TODO(dart2dart-team): Please triage this failure.
+Language/05_Variables/05_Variables_A05_t14: Fail # TODO(dart2dart-team): Please triage this failure.
+Language/05_Variables/05_Variables_A05_t15: Fail # TODO(dart2dart-team): Please triage this failure.
+Language/05_Variables/05_Variables_A07_t01: Fail # TODO(dart2dart-team): Please triage this failure.
+Language/05_Variables/05_Variables_A07_t02: Fail # TODO(dart2dart-team): Please triage this failure.
+Language/05_Variables/05_Variables_A07_t03: Fail # TODO(dart2dart-team): Please triage this failure.
+Language/05_Variables/05_Variables_A07_t04: Fail # TODO(dart2dart-team): Please triage this failure.
+Language/05_Variables/05_Variables_A07_t05: Fail # TODO(dart2dart-team): Please triage this failure.
+Language/05_Variables/05_Variables_A07_t06: Fail # TODO(dart2dart-team): Please triage this failure.
+Language/05_Variables/05_Variables_A07_t07: Fail # TODO(dart2dart-team): Please triage this failure.
+Language/05_Variables/05_Variables_A07_t08: Fail # TODO(dart2dart-team): Please triage this failure.
+Language/05_Variables/05_Variables_A07_t10: Fail # TODO(dart2dart-team): Please triage this failure.
+Language/05_Variables/05_Variables_A08_t01: Fail # TODO(dart2dart-team): Please triage this failure.
+Language/05_Variables/05_Variables_A08_t02: Fail # TODO(dart2dart-team): Please triage this failure.
Language/05_Variables/1_Evaluation_of_Implicit_Variable_Getters_A01_t02: Fail # TODO(dart2dart-team): Please triage this failure.
Language/05_Variables/1_Evaluation_of_Implicit_Variable_Getters_A01_t05: Fail # TODO(dart2dart-team): Please triage this failure.
Language/07_Classes/1_Instance_Methods_A06_t01: Fail # TODO(dart2dart-team): Please triage this failure.
@@ -19,52 +51,50 @@
Language/07_Classes/6_Constructors/2_Factories_A05_t02: Fail # TODO(dart2dart-team): Please triage this failure.
Language/07_Classes/6_Constructors/2_Factories_A05_t03: Fail # TODO(dart2dart-team): Please triage this failure.
Language/07_Classes/6_Constructors/2_Factories_A05_t04: Fail # TODO(dart2dart-team): Please triage this failure.
-Language/10_Expressions/01_Constants_A03_t01: Fail # TODO(dart2dart-team): Please triage this failure.
-Language/10_Expressions/01_Constants_A20_t01: Fail # TODO(dart2dart-team): Please triage this failure.
-Language/10_Expressions/01_Constants_A20_t02: Fail # TODO(dart2dart-team): Please triage this failure.
-Language/10_Expressions/09_Function_Expressions_A03_t02: Fail # TODO(dart2dart-team): Please triage this failure.
-Language/10_Expressions/09_Function_Expressions_A04_t02: Fail # TODO(dart2dart-team): Please triage this failure.
-Language/10_Expressions/30_Identifier_Reference_A04_t09: Fail # TODO(dart2dart-team): Please triage this failure.
-Language/10_Expressions/30_Identifier_Reference_A05_t01: Fail # TODO(dart2dart-team): Please triage this failure.
-Language/10_Expressions/30_Identifier_Reference_A05_t04: Fail # TODO(dart2dart-team): Please triage this failure.
-Language/10_Expressions/30_Identifier_Reference_A05_t12: Fail # TODO(dart2dart-team): Please triage this failure.
-Language/10_Expressions/30_Identifier_Reference_A06_t01: Fail # TODO(dart2dart-team): Please triage this failure.
-Language/10_Expressions/30_Identifier_Reference_A06_t02: Fail # TODO(dart2dart-team): Please triage this failure.
-Language/10_Expressions/30_Identifier_Reference_A08_t02: Fail # TODO(dart2dart-team): Please triage this failure.
-Language/10_Expressions/31_Type_Test_A01_t02: Fail # TODO(dart2dart-team): Please triage this failure.
-Language/10_Expressions/31_Type_Test_A01_t04: Fail # TODO(dart2dart-team): Please triage this failure.
-Language/10_Expressions/31_Type_Test_A04_t01: Fail # TODO(dart2dart-team): Please triage this failure.
-Language/10_Expressions/32_Type_Cast_A01_t04: Fail # TODO(dart2dart-team): Please triage this failure.
-Language/10_Expressions/32_Type_Cast_A03_t01: Fail # TODO(dart2dart-team): Please triage this failure.
-Language/10_Expressions/32_Type_Cast_A03_t02: Fail # TODO(dart2dart-team): Please triage this failure.
-Language/10_Expressions/32_Type_Cast_A05_t01: Fail # TODO(dart2dart-team): Please triage this failure.
-Language/10_Expressions/32_Type_Cast_A05_t02: Fail # TODO(dart2dart-team): Please triage this failure.
-Language/10_Expressions/32_Type_Cast_A05_t04: Fail # TODO(dart2dart-team): Please triage this failure.
-Language/11_Statements/03_Variable_Declaration_A04_t02: Fail # TODO(dart2dart-team): Please triage this failure.
-Language/11_Statements/03_Variable_Declaration_A04_t03: Fail # TODO(dart2dart-team): Please triage this failure.
-Language/11_Statements/03_Variable_Declaration_A04_t04: Fail # TODO(dart2dart-team): Please triage this failure.
-Language/11_Statements/03_Variable_Declaration_A04_t05: Fail # TODO(dart2dart-team): Please triage this failure.
-Language/11_Statements/03_Variable_Declaration_A04_t06: Fail # TODO(dart2dart-team): Please triage this failure.
-Language/11_Statements/04_Local_Function_Declaration_A01_t01: Fail # TODO(dart2dart-team): Please triage this failure.
-Language/11_Statements/04_Local_Function_Declaration_A02_t02: Fail # TODO(dart2dart-team): Please triage this failure.
-Language/11_Statements/06_For_A01_t11: Fail # TODO(dart2dart-team): Please triage this failure.
-Language/11_Statements/06_For_A01_t12: Fail # TODO(dart2dart-team): Please triage this failure.
-Language/11_Statements/09_Switch_A01_t02: Fail # TODO(dart2dart-team): Please triage this failure.
-Language/11_Statements/09_Switch_A02_t01: Fail # TODO(dart2dart-team): Please triage this failure.
-Language/11_Statements/09_Switch_A02_t02: Fail # TODO(dart2dart-team): Please triage this failure.
-Language/11_Statements/09_Switch_A02_t03: Fail # TODO(dart2dart-team): Please triage this failure.
-Language/11_Statements/09_Switch_A03_t01: Fail # TODO(dart2dart-team): Please triage this failure.
-Language/11_Statements/09_Switch_A03_t02: Fail # TODO(dart2dart-team): Please triage this failure.
-Language/11_Statements/09_Switch_A06_t02: Fail # TODO(dart2dart-team): Please triage this failure.
-Language/11_Statements/10_Try_A07_t03: Fail # TODO(dart2dart-team): Please triage this failure.
-Language/11_Statements/10_Try_A11_t01: Fail # TODO(dart2dart-team): Please triage this failure.
-Language/11_Statements/11_Return_A05_t01: Fail # TODO(dart2dart-team): Please triage this failure.
-Language/11_Statements/11_Return_A05_t02: Fail # TODO(dart2dart-team): Please triage this failure.
-Language/11_Statements/11_Return_A05_t03: Fail # TODO(dart2dart-team): Please triage this failure.
-Language/11_Statements/12_Labels_A01_t03: Fail # TODO(dart2dart-team): Please triage this failure.
-Language/11_Statements/12_Labels_A03_t04: Fail # TODO(dart2dart-team): Please triage this failure.
-Language/11_Statements/14_Continue_A02_t12: Fail # TODO(dart2dart-team): Please triage this failure.
-Language/11_Statements/14_Continue_A02_t13: Fail # TODO(dart2dart-team): Please triage this failure.
+Language/11_Expressions/01_Constants_A03_t01: Fail # TODO(dart2dart-team): Please triage this failure.
+Language/11_Expressions/01_Constants_A20_t01: Fail # TODO(dart2dart-team): Please triage this failure.
+Language/11_Expressions/01_Constants_A20_t02: Fail # TODO(dart2dart-team): Please triage this failure.
+Language/11_Expressions/30_Identifier_Reference_A04_t09: Fail # TODO(dart2dart-team): Please triage this failure.
+Language/11_Expressions/30_Identifier_Reference_A05_t01: Fail # TODO(dart2dart-team): Please triage this failure.
+Language/11_Expressions/30_Identifier_Reference_A05_t04: Fail # TODO(dart2dart-team): Please triage this failure.
+Language/11_Expressions/30_Identifier_Reference_A05_t12: Fail # TODO(dart2dart-team): Please triage this failure.
+Language/11_Expressions/30_Identifier_Reference_A06_t01: Fail # TODO(dart2dart-team): Please triage this failure.
+Language/11_Expressions/30_Identifier_Reference_A06_t02: Fail # TODO(dart2dart-team): Please triage this failure.
+Language/11_Expressions/30_Identifier_Reference_A08_t02: Fail # TODO(dart2dart-team): Please triage this failure.
+Language/11_Expressions/31_Type_Test_A01_t02: Fail # TODO(dart2dart-team): Please triage this failure.
+Language/11_Expressions/31_Type_Test_A01_t04: Fail # TODO(dart2dart-team): Please triage this failure.
+Language/11_Expressions/31_Type_Test_A04_t01: Fail # TODO(dart2dart-team): Please triage this failure.
+Language/11_Expressions/32_Type_Cast_A01_t04: Fail # TODO(dart2dart-team): Please triage this failure.
+Language/11_Expressions/32_Type_Cast_A03_t01: Fail # TODO(dart2dart-team): Please triage this failure.
+Language/11_Expressions/32_Type_Cast_A03_t02: Fail # TODO(dart2dart-team): Please triage this failure.
+Language/11_Expressions/32_Type_Cast_A05_t01: Fail # TODO(dart2dart-team): Please triage this failure.
+Language/11_Expressions/32_Type_Cast_A05_t02: Fail # TODO(dart2dart-team): Please triage this failure.
+Language/11_Expressions/32_Type_Cast_A05_t04: Fail # TODO(dart2dart-team): Please triage this failure.
+Language/12_Statements/03_Variable_Declaration_A04_t02: Fail # TODO(dart2dart-team): Please triage this failure.
+Language/12_Statements/03_Variable_Declaration_A04_t03: Fail # TODO(dart2dart-team): Please triage this failure.
+Language/12_Statements/03_Variable_Declaration_A04_t04: Fail # TODO(dart2dart-team): Please triage this failure.
+Language/12_Statements/03_Variable_Declaration_A04_t05: Fail # TODO(dart2dart-team): Please triage this failure.
+Language/12_Statements/03_Variable_Declaration_A04_t06: Fail # TODO(dart2dart-team): Please triage this failure.
+Language/12_Statements/04_Local_Function_Declaration_A01_t01: Fail # TODO(dart2dart-team): Please triage this failure.
+Language/12_Statements/04_Local_Function_Declaration_A02_t02: Fail # TODO(dart2dart-team): Please triage this failure.
+Language/12_Statements/06_For_A01_t11: Fail # TODO(dart2dart-team): Please triage this failure.
+Language/12_Statements/06_For_A01_t12: Fail # TODO(dart2dart-team): Please triage this failure.
+Language/12_Statements/09_Switch_A01_t02: Fail # TODO(dart2dart-team): Please triage this failure.
+Language/12_Statements/09_Switch_A02_t01: Fail # TODO(dart2dart-team): Please triage this failure.
+Language/12_Statements/09_Switch_A02_t02: Fail # TODO(dart2dart-team): Please triage this failure.
+Language/12_Statements/09_Switch_A02_t03: Fail # TODO(dart2dart-team): Please triage this failure.
+Language/12_Statements/09_Switch_A03_t01: Fail # TODO(dart2dart-team): Please triage this failure.
+Language/12_Statements/09_Switch_A03_t02: Fail # TODO(dart2dart-team): Please triage this failure.
+Language/12_Statements/09_Switch_A06_t02: Fail # TODO(dart2dart-team): Please triage this failure.
+Language/12_Statements/10_Try_A07_t03: Fail # TODO(dart2dart-team): Please triage this failure.
+Language/12_Statements/10_Try_A11_t01: Fail # TODO(dart2dart-team): Please triage this failure.
+Language/12_Statements/11_Return_A05_t01: Fail # TODO(dart2dart-team): Please triage this failure.
+Language/12_Statements/11_Return_A05_t02: Fail # TODO(dart2dart-team): Please triage this failure.
+Language/12_Statements/11_Return_A05_t03: Fail # TODO(dart2dart-team): Please triage this failure.
+Language/12_Statements/12_Labels_A01_t03: Fail # TODO(dart2dart-team): Please triage this failure.
+Language/12_Statements/12_Labels_A03_t04: Fail # TODO(dart2dart-team): Please triage this failure.
+Language/12_Statements/14_Continue_A02_t12: Fail # TODO(dart2dart-team): Please triage this failure.
+Language/12_Statements/14_Continue_A02_t13: Fail # TODO(dart2dart-team): Please triage this failure.
Language/13_Libraries_and_Scripts/1_Imports_A02_t01: Fail # TODO(dart2dart-team): Please triage this failure.
Language/13_Libraries_and_Scripts/1_Imports_A02_t02: Fail # TODO(dart2dart-team): Please triage this failure.
Language/13_Libraries_and_Scripts/1_Imports_A02_t16: Fail # TODO(dart2dart-team): Please triage this failure.
@@ -107,7 +137,9 @@
LibTest/isolate/isolate_api/port_A01_t01: Skip # Times out.
-LibTest/core/String/charCodes_A01_t01: Fail, OK # co19 issue 289
+LibTest/core/String/String_class_A02_t01: Fail, OK # co19 issue 284
+LibTest/core/String/charCodeAt_A01_t01: Fail, OK # co19 issue 284
+LibTest/core/String/charCodes_A01_t01: Fail, OK # co19 issue 284
LibTest/isolate/SendPort/send_A02_t02: Fail, OK # co19 issue 293
LibTest/isolate/SendPort/send_A02_t03: Fail, OK # co19 issue 293
@@ -131,62 +163,20 @@
LibTest/core/Stopwatch/frequency_A01_t01: Fail, OK # co19 issue 297
-LibTest/core/Match/end_A01_t01: Fail, OK # co19 issue 294
-LibTest/core/Match/group_A01_t01: Fail, OK # co19 issue 294
-LibTest/core/Match/groupCount_A01_t01: Fail, OK # co19 issue 294
LibTest/core/Match/operator_subscript_A01_t01: Fail, OK # co19 issue 294
-LibTest/core/Match/start_A01_t01: Fail, OK # co19 issue 294
-LibTest/core/RegExp/allMatches_A01_t01: Fail, OK # co19 issue 294
LibTest/core/RegExp/firstMatch_A01_t01: Fail, OK # co19 issue 294
-LibTest/core/RegExp/Pattern_semantics/firstMatch_Assertion_A03_t01: Fail, OK # co19 issue 294
-LibTest/core/RegExp/Pattern_semantics/firstMatch_Assertion_A04_t01: Fail, OK # co19 issue 294
-LibTest/core/RegExp/Pattern_semantics/firstMatch_Assertion_A05_t01: Fail, OK # co19 issue 294
-LibTest/core/RegExp/Pattern_semantics/firstMatch_Atom_A01_t01: Fail, OK # co19 issue 294
LibTest/core/RegExp/Pattern_semantics/firstMatch_Atom_A02_t01: Fail, OK # co19 issue 294
-LibTest/core/RegExp/Pattern_semantics/firstMatch_Atom_A03_t01: Fail, OK # co19 issue 294
-LibTest/core/RegExp/Pattern_semantics/firstMatch_Atom_A03_t02: Fail, OK # co19 issue 294
-LibTest/core/RegExp/Pattern_semantics/firstMatch_Atom_A03_t03: Fail, OK # co19 issue 294
-LibTest/core/RegExp/Pattern_semantics/firstMatch_Atom_A04_t01: Fail, OK # co19 issue 294
-LibTest/core/RegExp/Pattern_semantics/firstMatch_Atom_A05_t01: Fail, OK # co19 issue 294
-LibTest/core/RegExp/Pattern_semantics/firstMatch_Atom_A06_t01: Fail, OK # co19 issue 294
-LibTest/core/RegExp/Pattern_semantics/firstMatch_AtomEscape_A01_t01: Fail, OK # co19 issue 294
-LibTest/core/RegExp/Pattern_semantics/firstMatch_Disjunction_A01_t01: Fail, OK # co19 issue 294
-LibTest/core/RegExp/Pattern_semantics/firstMatch_Quantifier_A01_t01: Fail, OK # co19 issue 294
-LibTest/core/RegExp/Pattern_semantics/firstMatch_Quantifier_A02_t01: Fail, OK # co19 issue 294
-LibTest/core/RegExp/Pattern_semantics/firstMatch_Quantifier_A03_t01: Fail, OK # co19 issue 294
-LibTest/core/RegExp/Pattern_semantics/firstMatch_Quantifier_A04_t01: Fail, OK # co19 issue 294
-LibTest/core/RegExp/Pattern_semantics/firstMatch_Quantifier_A05_t01: Fail, OK # co19 issue 294
-LibTest/core/RegExp/Pattern_semantics/firstMatch_Quantifier_A06_t01: Fail, OK # co19 issue 294
-LibTest/core/RegExp/Pattern_semantics/firstMatch_Term_A01_t01: Fail, OK # co19 issue 294
-LibTest/core/RegExp/Pattern_semantics/firstMatch_Term_A02_t01: Fail, OK # co19 issue 294
LibTest/core/RegExp/Pattern_semantics/firstMatch_Term_A03_t01: Fail, OK # co19 issue 294
-LibTest/core/RegExp/Pattern_semantics/firstMatch_Term_A04_t01: Fail, OK # co19 issue 294
-LibTest/core/Queue/filter_A01_t04: Fail, OK # co19 issue 287
LibTest/core/Map/getValues_A01_t02: Fail, OK # co19 issue 287
-LibTest/core/Queue/filter_A01_t04: Fail, OK # co19 issue 291
-LibTest/core/Queue/first_A01_t01: Fail, OK # co19 issue 291
-LibTest/core/Queue/removeFirst_A01_t01: Fail, OK # co19 issue 291
LibTest/core/Queue/first_A02_t01: Fail, OK # co19 issue 291
-LibTest/core/Queue/addFirst_A01_t01: Fail, OK # co19 issue 291
-LibTest/core/Queue/removeLast_A01_t01: Fail, OK # co19 issue 291
-LibTest/core/Queue/add_A01_t01: Fail, OK # co19 issue 291
LibTest/core/Queue/last_A02_t01: Fail, OK # co19 issue 291
-LibTest/core/Queue/addLast_A01_t01: Fail, OK # co19 issue 291
-LibTest/core/Queue/last_A01_t01: Fail, OK # co19 issue 291
-LibTest/core/List/last_A02_t01: Fail, OK # co19 issue 291
-LibTest/core/List/last_A01_t01: Fail, OK # co19 issue 291
LibTest/isolate/isolate_api/port_A01_t01: Skip # Times out.
-LibTest/core/Map/putIfAbsent_A01_t08: Fail, OK # co19 issue 276
-LibTest/core/Map/putIfAbsent_A01_t06: Fail, OK # co19 issue 276
LibTest/isolate/ReceivePort/receive_A01_t02: Fail, OK # co19 issue 276
-LibTest/core/UnsupportedOperationException/toString_A01_t01: Fail, OK # co19 issue 285
-LibTest/core/UnsupportedOperationException/UnsupportedOperationException_A01_t01: Fail, OK # co19 issue 285
-
LibTest/core/List/iterator_next_A02_t01: Fail, OK # co19 issue 288
LibTest/core/Queue/iterator_next_A02_t01: Fail, OK # co19 issue 288
LibTest/core/Queue/first_A02_t01: Fail, OK # co19 issue 288
@@ -198,6 +188,26 @@
LibTest/core/EmptyQueueException/EmptyQueueException_A01_t01: Fail, OK # co19 issue 288
LibTest/core/EmptyQueueException/toString_A01_t01: Fail, OK # co19 issue 288
+LibTest/core/List/getRange_A04_t01: Fail, OK # co19 issue 290
+LibTest/core/List/insertRange_A06_t01: Fail, OK # co19 issue 290
+LibTest/core/List/last_A02_t01: Fail, OK # co19 issue 290
+LibTest/core/List/length_A05_t01: Fail, OK # co19 issue 290
+LibTest/core/List/List_A01_t01: Fail, OK # co19 issue 290
+LibTest/core/List/operator_subscript_A02_t01: Fail, OK # co19 issue 290
+LibTest/core/List/operator_subscripted_assignment_A02_t01: Fail, OK # co19 issue 290
+LibTest/core/List/removeLast_A01_t02: Fail, OK # co19 issue 290
+LibTest/core/List/removeRange_A05_t01: Fail, OK # co19 issue 290
+LibTest/core/List/setRange_A02_t01: Fail, OK # co19 issue 290
+LibTest/core/List/setRange_A02_t02: Fail, OK # co19 issue 290
+LibTest/core/List/setRange_A03_t01: Fail, OK # co19 issue 290
+LibTest/core/List/setRange_A03_t02: Fail, OK # co19 issue 290
+LibTest/core/Match/group_A02_t01: Fail, OK # co19 issue 290
+LibTest/core/Match/groups_A02_t01: Fail, OK # co19 issue 290
+LibTest/core/Match/operator_subscript_A02_t01: Fail, OK # co19 issue 290
+LibTest/core/String/charCodeAt_A02_t01: Fail, OK # co19 issue 290
+LibTest/core/String/operator_subscript_A02_t01: Fail, OK # co19 issue 290
+LibTest/core/String/substring_A02_t01: Fail, OK # co19 issue 290
+
Language/03_Overview/1_Scoping_A01_t39: Fail # http://dartbug.com/5519
Language/03_Overview/1_Scoping_A01_t40: Fail # http://dartbug.com/5519
Language/03_Overview/1_Scoping_A01_t41: Fail # http://dartbug.com/5519
@@ -213,29 +223,7 @@
Language/05_Variables/05_Variables_A01_t13: Fail # http://dartbug.com/5519
Language/05_Variables/05_Variables_A01_t14: Fail # http://dartbug.com/5519
Language/05_Variables/05_Variables_A01_t15: Fail # http://dartbug.com/5519
-Language/05_Variables/05_Variables_A03_t01: Fail # http://dartbug.com/5519
-Language/05_Variables/05_Variables_A03_t02: Fail # http://dartbug.com/5519
-Language/05_Variables/05_Variables_A03_t04: Fail # http://dartbug.com/5519
-Language/05_Variables/05_Variables_A03_t05: Fail # http://dartbug.com/5519
-Language/05_Variables/05_Variables_A03_t06: Fail # http://dartbug.com/5519
-Language/05_Variables/05_Variables_A03_t07: Fail # inherited from VM
-Language/05_Variables/05_Variables_A03_t08: Fail # http://dartbug.com/5519
-Language/05_Variables/05_Variables_A03_t09: Fail # inherited from dart2js
-Language/05_Variables/05_Variables_A03_t10: Fail # inherited from VM
-Language/05_Variables/05_Variables_A03_t11: Fail # inherited from VM
-Language/05_Variables/05_Variables_A03_t12: Fail # inherited from dart2js
-Language/05_Variables/05_Variables_A03_t13: Fail # inherited from VM
-Language/05_Variables/05_Variables_A03_t14: Fail # inherited from VM
-Language/05_Variables/05_Variables_A03_t15: Fail # inherited from VM
Language/05_Variables/05_Variables_A04_t01: Fail # http://dartbug.com/5519
-Language/05_Variables/05_Variables_A04_t02: Fail # http://dartbug.com/5519
-Language/05_Variables/05_Variables_A04_t03: Fail # http://dartbug.com/5519
-Language/05_Variables/05_Variables_A04_t04: Fail # http://dartbug.com/5519
-Language/05_Variables/05_Variables_A04_t05: Fail # http://dartbug.com/5519
-Language/05_Variables/05_Variables_A04_t06: Fail # http://dartbug.com/5519
-Language/05_Variables/05_Variables_A04_t07: Fail # http://dartbug.com/5519
-Language/05_Variables/05_Variables_A04_t08: Fail # http://dartbug.com/5519
-Language/05_Variables/05_Variables_A04_t10: Fail # http://dartbug.com/5519
Language/05_Variables/05_Variables_A05_t01: Fail # http://dartbug.com/5519
Language/05_Variables/05_Variables_A05_t02: Fail # http://dartbug.com/5519
Language/06_Functions/06_Functions_A01_t22: Fail # inherited from VM
@@ -354,193 +342,175 @@
Language/07_Classes/6_Constructors/3_Constant_Constructors_A05_t03: Fail # inherited from VM
Language/07_Classes/6_Constructors_A01_t01: Fail # inherited from VM
Language/07_Classes/6_Constructors_A02_t01: Fail # http://dartbug.com/5519
-Language/09_Generics/09_Generics_A05_t01: Fail # inherited from dart2js
-Language/09_Generics/09_Generics_A05_t02: Fail # inherited from VM
-Language/10_Expressions/01_Constants_A03_t02: Fail # http://dartbug.com/5519
-Language/10_Expressions/01_Constants_A03_t03: Fail # http://dartbug.com/5519
-Language/10_Expressions/01_Constants_A03_t04: Fail # http://dartbug.com/5519
-Language/10_Expressions/01_Constants_A03_t05: Fail # http://dartbug.com/5519
-Language/10_Expressions/01_Constants_A05_t01: Fail # inherited from VM
-Language/10_Expressions/01_Constants_A05_t02: Fail # http://dartbug.com/5519
-Language/10_Expressions/01_Constants_A05_t03: Fail # http://dartbug.com/5810
-Language/10_Expressions/01_Constants_A05_t04: Fail # http://dartbug.com/5519
-Language/10_Expressions/01_Constants_A06_t01: Fail # inherited from VM
-Language/10_Expressions/01_Constants_A08_t02: Fail # http://dartbug.com/5519
-Language/10_Expressions/01_Constants_A09_t02: Fail # http://dartbug.com/5519
-Language/10_Expressions/01_Constants_A10_t02: Fail # http://dartbug.com/5519
-Language/10_Expressions/01_Constants_A10_t03: Fail # http://dartbug.com/5519
-Language/10_Expressions/01_Constants_A11_t02: Fail # http://dartbug.com/5519
-Language/10_Expressions/01_Constants_A11_t03: Fail # http://dartbug.com/5519
-Language/10_Expressions/01_Constants_A11_t04: Fail # http://dartbug.com/5519
-Language/10_Expressions/01_Constants_A12_t02: Fail # http://dartbug.com/5519
-Language/10_Expressions/01_Constants_A12_t03: Fail # http://dartbug.com/5519
-Language/10_Expressions/01_Constants_A13_t02: Fail # http://dartbug.com/5519
-Language/10_Expressions/01_Constants_A13_t03: Fail # http://dartbug.com/5519
-Language/10_Expressions/01_Constants_A13_t04: Fail # http://dartbug.com/5519
-Language/10_Expressions/01_Constants_A13_t05: Fail # http://dartbug.com/5519
-Language/10_Expressions/01_Constants_A14_t01: Fail # inherited from dart2js
-Language/10_Expressions/01_Constants_A14_t01: Fail # inherited from VM
-Language/10_Expressions/01_Constants_A15_t06: Fail # http://dartbug.com/5519
-Language/10_Expressions/01_Constants_A15_t07: Fail # http://dartbug.com/5519
-Language/10_Expressions/01_Constants_A15_t08: Fail # http://dartbug.com/5519
-Language/10_Expressions/01_Constants_A15_t09: Fail # http://dartbug.com/5519
-Language/10_Expressions/01_Constants_A15_t10: Fail # http://dartbug.com/5519
-Language/10_Expressions/01_Constants_A15_t11: Fail # http://dartbug.com/5519
-Language/10_Expressions/01_Constants_A15_t12: Fail # http://dartbug.com/5519
-Language/10_Expressions/01_Constants_A15_t13: Fail # http://dartbug.com/5519
-Language/10_Expressions/01_Constants_A15_t14: Fail # http://dartbug.com/5519
-Language/10_Expressions/01_Constants_A15_t15: Fail # http://dartbug.com/5519
-Language/10_Expressions/01_Constants_A15_t16: Fail # http://dartbug.com/5519
-Language/10_Expressions/01_Constants_A15_t17: Fail # http://dartbug.com/5519
-Language/10_Expressions/01_Constants_A15_t18: Fail # http://dartbug.com/5519
-Language/10_Expressions/01_Constants_A15_t20: Fail # http://dartbug.com/5519
-Language/10_Expressions/01_Constants_A15_t21: Fail # http://dartbug.com/5519
-Language/10_Expressions/01_Constants_A15_t31: Fail # http://dartbug.com/5519
-Language/10_Expressions/01_Constants_A16_t01: Fail # inherited from VM
-Language/10_Expressions/01_Constants_A16_t02: Crash, Pass # inherited from VM
-Language/10_Expressions/01_Constants_A16_t02: Fail # inherited from VM
-Language/10_Expressions/01_Constants_A16_t03: Fail # inherited from VM
-Language/10_Expressions/01_Constants_A17_t01: Fail # http://dartbug.com/5519
-Language/10_Expressions/01_Constants_A17_t02: Fail # http://dartbug.com/5519
-Language/10_Expressions/01_Constants_A17_t03: Crash # inherited from VM
-Language/10_Expressions/01_Constants_A17_t03: Fail # http://dartbug.com/5519
-Language/10_Expressions/01_Constants_A19_t04: Fail # http://dartbug.com/5519
-Language/10_Expressions/05_Strings/1_String_Interpolation_A01_t04: Fail # Inherited from dart2js
-Language/10_Expressions/05_Strings/1_String_Interpolation_A01_t05: Fail # Inherited from dart2js
-Language/10_Expressions/05_Strings/1_String_Interpolation_A01_t06: Fail # Inherited from dart2js
-Language/10_Expressions/05_Strings/1_String_Interpolation_A01_t09: Fail, OK # co19 issue 210
-Language/10_Expressions/05_Strings/1_String_Interpolation_A03_t02: Fail # inherited from VM
-Language/10_Expressions/05_Strings/1_String_Interpolation_A04_t02: Fail # inherited from VM
-Language/10_Expressions/05_Strings_A02_t01: Skip # co19 issue 90.
-Language/10_Expressions/05_Strings_A02_t46: Fail # inherited from VM
-Language/10_Expressions/05_Strings_A02_t48: Fail # inherited from VM
-Language/10_Expressions/05_Strings_A20_t01: Fail # inherited from VM
-Language/10_Expressions/06_Lists_A03_t01: Fail # http://dartbug.com/5519
-Language/10_Expressions/06_Lists_A03_t02: Fail # http://dartbug.com/5519
-Language/10_Expressions/06_Lists_A04_t01: Fail # http://dartbug.com/5519
-Language/10_Expressions/07_Maps_A01_t01: Skip # co19 issue 91: map literals illegal at statement beginning.
-Language/10_Expressions/07_Maps_A02_t01: Fail # http://dartbug.com/5519
-Language/10_Expressions/07_Maps_A02_t02: Fail # http://dartbug.com/5519
-Language/10_Expressions/08_Throw_A01_t01: Fail # inherited from dart2js
-Language/10_Expressions/08_Throw_A05_t01: Fail # inherited from dart2js
-Language/10_Expressions/11_Instance_Creation/1_New_A02_t03: Fail # inherited from dart2js
-Language/10_Expressions/11_Instance_Creation/1_New_A02_t05: Fail # inherited from dart2js
-Language/10_Expressions/11_Instance_Creation/1_New_A02_t06: Fail # inherited from dart2js
-Language/10_Expressions/11_Instance_Creation/1_New_A02_t07: Fail # inherited from dart2js
-Language/10_Expressions/11_Instance_Creation/1_New_A09_t09: Fail # inherited from VM
-Language/10_Expressions/11_Instance_Creation/1_New_A12_t01: Fail # co19 issue 255: unmatched bracket (same behavior in dart2js)
-Language/10_Expressions/11_Instance_Creation/1_New_A12_t02: Fail # Inherited from VM
-Language/10_Expressions/11_Instance_Creation/1_New_A13_t04: Fail # Inherited from VM
-Language/10_Expressions/11_Instance_Creation/1_New_A14_t01: Fail # Inherited from dart2js
-Language/10_Expressions/11_Instance_Creation/2_Const_A01_t02: Fail # http://dartbug.com/5519
-Language/10_Expressions/11_Instance_Creation/2_Const_A06_t01: Fail # http://dartbug.com/5519
-Language/10_Expressions/11_Instance_Creation/2_Const_A06_t02: Fail # http://dartbug.com/5519
-Language/10_Expressions/11_Instance_Creation/2_Const_A10_t01: Fail # inherited from VM
-Language/10_Expressions/14_Function_Invocation/2_Binding_Actuals_to_Formals_A04_t01: Fail # http://dartbug.com/5519
-Language/10_Expressions/14_Function_Invocation/3_Unqualified_Invocation_A01_t03: Fail # inherited from VM
-Language/10_Expressions/14_Function_Invocation/3_Unqualified_Invocation_A01_t04: Fail # co19 issue 166
-Language/10_Expressions/14_Function_Invocation/3_Unqualified_Invocation_A01_t05: Fail # inherited from VM
-Language/10_Expressions/14_Function_Invocation/4_Function_Expression_Invocation_A02_t01: Fail # inherited from VM
-Language/10_Expressions/14_Function_Invocation/4_Function_Expression_Invocation_A03_t01: Fail # inherited from VM
-Language/10_Expressions/14_Function_Invocation/4_Function_Expression_Invocation_A05_t01: Fail # inherited from VM
-Language/10_Expressions/14_Function_Invocation/4_Function_Expression_Invocation_A05_t02: Fail # inherited from VM
-Language/10_Expressions/15_Method_Invocation/1_Ordinary_Invocation_A05_t02: Fail # inherited from VM
-Language/10_Expressions/15_Method_Invocation/1_Ordinary_Invocation_A05_t03: Fail # inherited from VM
-Language/10_Expressions/15_Method_Invocation/1_Ordinary_Invocation_A05_t05: Fail # inherited from VM
-Language/10_Expressions/15_Method_Invocation/1_Ordinary_Invocation_A05_t06: Fail # inherited from VM
-Language/10_Expressions/15_Method_Invocation/1_Ordinary_Invocation_A08_t01: Fail # inherited from VM
-Language/10_Expressions/15_Method_Invocation/3_Static_Invocation_A03_t03: Fail # inherited from VM
-Language/10_Expressions/15_Method_Invocation/3_Static_Invocation_A03_t04: Fail # http://dartbug.com/5519
-Language/10_Expressions/15_Method_Invocation/3_Static_Invocation_A03_t06: Fail # inherited from VM
-Language/10_Expressions/15_Method_Invocation/3_Static_Invocation_A04_t02: Fail # inherited from VM
-Language/10_Expressions/15_Method_Invocation/3_Static_Invocation_A04_t03: Fail # inherited from VM
-Language/10_Expressions/15_Method_Invocation/3_Static_Invocation_A04_t08: Fail # inherited from VM
-Language/10_Expressions/15_Method_Invocation/3_Static_Invocation_A05_t01: Fail # inherited from VM
-Language/10_Expressions/15_Method_Invocation/3_Static_Invocation_A06_t02: Fail # inherited from VM
-Language/10_Expressions/15_Method_Invocation/4_Super_Invocation_A02_t04: Fail # co19 issue 251 or issue 5732
-Language/10_Expressions/15_Method_Invocation/4_Super_Invocation_A03_t02: Fail # co19 issue 251 or issue 5732
-Language/10_Expressions/15_Method_Invocation/4_Super_Invocation_A03_t03: Fail # co19 issue 251 or issue 5732
-Language/10_Expressions/15_Method_Invocation/4_Super_Invocation_A04_t01: Fail # inherited from VM
-Language/10_Expressions/15_Method_Invocation/4_Super_Invocation_A04_t02: Fail # inherited from VM
-Language/10_Expressions/15_Method_Invocation/4_Super_Invocation_A04_t03: Fail # inherited from VM
-Language/10_Expressions/15_Method_Invocation/4_Super_Invocation_A04_t04: Fail # inherited from VM
-Language/10_Expressions/15_Method_Invocation/4_Super_Invocation_A07_t01: Fail # co19 issue 251 or issue 5732
-Language/10_Expressions/15_Method_Invocation/4_Super_Invocation_A08_t02: Fail # co19 issue 251 or issue 5732
-Language/10_Expressions/17_Getter_Invocation_A02_t01: Fail # inherited from VM
-Language/10_Expressions/17_Getter_Invocation_A02_t02: Fail # inherited from VM
-Language/10_Expressions/18_Assignment_A05_t02: Fail # inherited from VM
-Language/10_Expressions/18_Assignment_A05_t04: Fail # inherited from VM
-Language/10_Expressions/18_Assignment_A05_t05: Fail # inherited from VM
-Language/10_Expressions/18_Assignment_A08_t04: Fail # inherited from VM
-Language/10_Expressions/19_Conditional_A01_t10: Fail # Inherited from dart2js
-Language/10_Expressions/19_Conditional_A01_t11: Fail # Inherited from dart2js
-Language/10_Expressions/19_Conditional_A01_t12: Fail # Inherited from dart2js
-Language/10_Expressions/19_Conditional_A01_t13: Fail # Inherited from dart2js
-Language/10_Expressions/19_Conditional_A01_t14: Fail # Inherited from dart2js
-Language/10_Expressions/19_Conditional_A01_t15: Fail # Inherited from dart2js
-Language/10_Expressions/20_Logical_Boolean_Expressions_A01_t11: Fail # Inherited from dart2js
-Language/10_Expressions/20_Logical_Boolean_Expressions_A01_t12: Fail # http://dartbug.com/5519
-Language/10_Expressions/20_Logical_Boolean_Expressions_A01_t13: Fail # Inherited from dart2js
-Language/10_Expressions/20_Logical_Boolean_Expressions_A01_t14: Fail # Inherited from dart2js
-Language/10_Expressions/21_Bitwise_Expressions_A01_t13: Fail # Inherited from dart2js
-Language/10_Expressions/21_Bitwise_Expressions_A01_t14: Fail # http://dartbug.com/5519
-Language/10_Expressions/21_Bitwise_Expressions_A01_t15: Fail # Inherited from dart2js
-Language/10_Expressions/21_Bitwise_Expressions_A01_t16: Fail # Inherited from dart2js
-Language/10_Expressions/21_Bitwise_Expressions_A01_t17: Fail # Inherited from dart2js
-Language/10_Expressions/23_Relational_Expressions_A01_t10: Fail # http://dartbug.com/5519
-Language/10_Expressions/23_Relational_Expressions_A01_t11: Fail # http://dartbug.com/5519
-Language/10_Expressions/23_Relational_Expressions_A01_t12: Fail # http://dartbug.com/5519
-Language/10_Expressions/23_Relational_Expressions_A01_t13: Fail # http://dartbug.com/5519
-Language/10_Expressions/23_Relational_Expressions_A01_t19: Fail # Inherited from dart2js
-Language/10_Expressions/23_Relational_Expressions_A01_t20: Fail # http://dartbug.com/5519
-Language/10_Expressions/23_Relational_Expressions_A01_t21: Fail # Inherited from dart2js
-Language/10_Expressions/23_Relational_Expressions_A01_t22: Fail # Inherited from dart2js
-Language/10_Expressions/23_Relational_Expressions_A01_t23: Fail # Inherited from dart2js
-Language/10_Expressions/22_Equality_A01_t01: Fail # inherited from VM
-Language/10_Expressions/22_Equality_A01_t15: Fail # http://dartbug.com/5519
-Language/10_Expressions/22_Equality_A01_t16: Fail # http://dartbug.com/5519
-Language/10_Expressions/22_Equality_A01_t19: Fail # http://dartbug.com/5519
-Language/10_Expressions/22_Equality_A01_t23: Fail # Inherited from dart2js
-Language/10_Expressions/22_Equality_A01_t24: Fail # Inherited from dart2js
-Language/10_Expressions/22_Equality_A02_t03: Fail # inherited from VM
-Language/10_Expressions/22_Equality_A05_t01: Fail # inherited from VM
-Language/10_Expressions/24_Shift_A01_t10: Fail # Inherited from dart2js
-Language/10_Expressions/24_Shift_A01_t11: Fail # http://dartbug.com/5519
-Language/10_Expressions/24_Shift_A01_t12: Fail # Inherited from dart2js
-Language/10_Expressions/24_Shift_A01_t13: Fail # Inherited from dart2js
-Language/10_Expressions/24_Shift_A01_t14: Fail # Inherited from dart2js
-Language/10_Expressions/25_Additive_Expressions_A01_t08: Fail # Inherited from dart2js
-Language/10_Expressions/25_Additive_Expressions_A01_t11: Fail # Inherited from dart2js
-Language/10_Expressions/25_Additive_Expressions_A01_t12: Fail # Inherited from dart2js
-Language/10_Expressions/25_Additive_Expressions_A01_t13: Fail # Inherited from dart2js
-Language/10_Expressions/25_Additive_Expressions_A01_t14: Fail # Inherited from dart2js
-Language/10_Expressions/26_Multiplicative_Expressions_A01_t11: Fail # Inherited from dart2js
-Language/10_Expressions/26_Multiplicative_Expressions_A01_t14: Fail # Inherited from dart2js
-Language/10_Expressions/26_Multiplicative_Expressions_A01_t15: Fail # Inherited from dart2js
-Language/10_Expressions/26_Multiplicative_Expressions_A01_t16: Fail # Inherited from dart2js
-Language/10_Expressions/26_Multiplicative_Expressions_A01_t17: Fail # Inherited from dart2js
-Language/10_Expressions/27_Unary_Expressions_A01_t01: Fail # inherited from VM
-Language/10_Expressions/27_Unary_Expressions_A01_t02: Fail # Inherited from dart2js
-Language/10_Expressions/27_Unary_Expressions_A01_t04: Fail # Inherited from dart2js
-Language/10_Expressions/27_Unary_Expressions_A01_t05: Fail # Inherited from dart2js
-Language/10_Expressions/27_Unary_Expressions_A01_t10: Fail # inherited from VM
-Language/10_Expressions/27_Unary_Expressions_A01_t17: Fail # Inherited from dart2js
-Language/10_Expressions/27_Unary_Expressions_A01_t18: Fail # Inherited from dart2js
-Language/10_Expressions/27_Unary_Expressions_A01_t19: Fail # Inherited from dart2js
-Language/10_Expressions/27_Unary_Expressions_A01_t20: Fail # Inherited from dart2js
-Language/10_Expressions/27_Unary_Expressions_A01_t21: Fail # Inherited from dart2js
-Language/10_Expressions/27_Unary_Expressions_A01_t22: Fail # Inherited from dart2js
-Language/10_Expressions/27_Unary_Expressions_A08_t01: Fail # inherited from VM
-Language/10_Expressions/28_Postfix_Expressions_A01_t01: Fail # inherited from VM
-Language/10_Expressions/28_Postfix_Expressions_A01_t02: Fail # Inherited from dart2js
-Language/10_Expressions/28_Postfix_Expressions_A01_t03: Fail # Inherited from dart2js
-Language/10_Expressions/28_Postfix_Expressions_A01_t05: Fail # Inherited from dart2js
-Language/10_Expressions/29_Assignable_Expressions_A01_t06: Fail # Inherited from dart2js
-Language/10_Expressions/29_Assignable_Expressions_A01_t08: Fail # Inherited from dart2js
-Language/10_Expressions/29_Assignable_Expressions_A01_t09: Fail # Inherited from dart2js
-Language/10_Expressions/30_Identifier_Reference_A02_t01: Fail # Pseudo keyword "abstract".
-Language/10_Expressions/30_Identifier_Reference_A07_t01: Fail # http://dartbug.com/5519
-Language/11_Statements/03_Variable_Declaration_A04_t01: Fail # http://dartbug.com/5519
+Language/11_Expressions/01_Constants_A03_t02: Fail # http://dartbug.com/5519
+Language/11_Expressions/01_Constants_A03_t03: Fail # http://dartbug.com/5519
+Language/11_Expressions/01_Constants_A03_t04: Fail # http://dartbug.com/5519
+Language/11_Expressions/01_Constants_A03_t05: Fail # http://dartbug.com/5519
+Language/11_Expressions/01_Constants_A05_t01: Fail # inherited from VM
+Language/11_Expressions/01_Constants_A05_t02: Fail # http://dartbug.com/5519
+Language/11_Expressions/01_Constants_A05_t03: Fail # http://dartbug.com/5810
+Language/11_Expressions/01_Constants_A05_t04: Fail # http://dartbug.com/5519
+Language/11_Expressions/01_Constants_A06_t01: Fail # inherited from VM
+Language/11_Expressions/01_Constants_A08_t02: Fail # http://dartbug.com/5519
+Language/11_Expressions/01_Constants_A09_t02: Fail # http://dartbug.com/5519
+Language/11_Expressions/01_Constants_A10_t02: Fail # http://dartbug.com/5519
+Language/11_Expressions/01_Constants_A10_t03: Fail # http://dartbug.com/5519
+Language/11_Expressions/01_Constants_A11_t02: Fail # http://dartbug.com/5519
+Language/11_Expressions/01_Constants_A11_t03: Fail # http://dartbug.com/5519
+Language/11_Expressions/01_Constants_A11_t04: Fail # http://dartbug.com/5519
+Language/11_Expressions/01_Constants_A12_t02: Fail # http://dartbug.com/5519
+Language/11_Expressions/01_Constants_A12_t03: Fail # http://dartbug.com/5519
+Language/11_Expressions/01_Constants_A13_t02: Fail # http://dartbug.com/5519
+Language/11_Expressions/01_Constants_A13_t03: Fail # http://dartbug.com/5519
+Language/11_Expressions/01_Constants_A13_t04: Fail # http://dartbug.com/5519
+Language/11_Expressions/01_Constants_A13_t05: Fail # http://dartbug.com/5519
+Language/11_Expressions/01_Constants_A14_t01: Fail # inherited from dart2js
+Language/11_Expressions/01_Constants_A14_t01: Fail # inherited from VM
+Language/11_Expressions/01_Constants_A15_t06: Fail # http://dartbug.com/5519
+Language/11_Expressions/01_Constants_A15_t07: Fail # http://dartbug.com/5519
+Language/11_Expressions/01_Constants_A15_t08: Fail # http://dartbug.com/5519
+Language/11_Expressions/01_Constants_A15_t09: Fail # http://dartbug.com/5519
+Language/11_Expressions/01_Constants_A15_t10: Fail # http://dartbug.com/5519
+Language/11_Expressions/01_Constants_A15_t11: Fail # http://dartbug.com/5519
+Language/11_Expressions/01_Constants_A15_t12: Fail # http://dartbug.com/5519
+Language/11_Expressions/01_Constants_A15_t13: Fail # http://dartbug.com/5519
+Language/11_Expressions/01_Constants_A15_t14: Fail # http://dartbug.com/5519
+Language/11_Expressions/01_Constants_A15_t15: Fail # http://dartbug.com/5519
+Language/11_Expressions/01_Constants_A15_t16: Fail # http://dartbug.com/5519
+Language/11_Expressions/01_Constants_A15_t17: Fail # http://dartbug.com/5519
+Language/11_Expressions/01_Constants_A15_t18: Fail # http://dartbug.com/5519
+Language/11_Expressions/01_Constants_A15_t20: Fail # http://dartbug.com/5519
+Language/11_Expressions/01_Constants_A15_t21: Fail # http://dartbug.com/5519
+Language/11_Expressions/01_Constants_A15_t31: Fail # http://dartbug.com/5519
+Language/11_Expressions/01_Constants_A16_t01: Fail # inherited from VM
+Language/11_Expressions/01_Constants_A16_t02: Crash, Pass # inherited from VM
+Language/11_Expressions/01_Constants_A16_t02: Fail # inherited from VM
+Language/11_Expressions/01_Constants_A16_t03: Fail # inherited from VM
+Language/11_Expressions/01_Constants_A17_t01: Fail # http://dartbug.com/5519
+Language/11_Expressions/01_Constants_A17_t02: Fail # http://dartbug.com/5519
+Language/11_Expressions/01_Constants_A17_t03: Crash # inherited from VM
+Language/11_Expressions/01_Constants_A17_t03: Fail # http://dartbug.com/5519
+Language/11_Expressions/01_Constants_A19_t04: Fail # http://dartbug.com/5519
+Language/11_Expressions/05_Strings/1_String_Interpolation_A01_t04: Fail # Inherited from dart2js
+Language/11_Expressions/05_Strings/1_String_Interpolation_A01_t05: Fail # Inherited from dart2js
+Language/11_Expressions/05_Strings/1_String_Interpolation_A01_t06: Fail # Inherited from dart2js
+Language/11_Expressions/05_Strings/1_String_Interpolation_A01_t09: Fail, OK # co19 issue 210
+Language/11_Expressions/05_Strings/1_String_Interpolation_A03_t02: Fail # inherited from VM
+Language/11_Expressions/05_Strings/1_String_Interpolation_A04_t02: Fail # inherited from VM
+Language/11_Expressions/05_Strings_A02_t01: Skip # co19 issue 90.
+Language/11_Expressions/05_Strings_A02_t46: Fail # inherited from VM
+Language/11_Expressions/05_Strings_A02_t48: Fail # inherited from VM
+Language/11_Expressions/05_Strings_A20_t01: Fail # inherited from VM
+Language/11_Expressions/06_Lists_A03_t01: Fail # http://dartbug.com/5519
+Language/11_Expressions/06_Lists_A03_t02: Fail # http://dartbug.com/5519
+Language/11_Expressions/06_Lists_A04_t01: Fail # http://dartbug.com/5519
+Language/11_Expressions/07_Maps_A01_t01: Skip # co19 issue 91: map literals illegal at statement beginning.
+Language/11_Expressions/07_Maps_A02_t01: Fail # http://dartbug.com/5519
+Language/11_Expressions/07_Maps_A02_t02: Fail # http://dartbug.com/5519
+Language/11_Expressions/08_Throw_A01_t01: Fail # inherited from dart2js
+Language/11_Expressions/08_Throw_A05_t01: Fail # inherited from dart2js
+Language/11_Expressions/11_Instance_Creation/1_New_A02_t03: Fail # inherited from dart2js
+Language/11_Expressions/11_Instance_Creation/1_New_A02_t05: Fail # inherited from dart2js
+Language/11_Expressions/11_Instance_Creation/1_New_A02_t06: Fail # inherited from dart2js
+Language/11_Expressions/11_Instance_Creation/1_New_A02_t07: Fail # inherited from dart2js
+Language/11_Expressions/11_Instance_Creation/1_New_A09_t09: Fail # inherited from VM
+Language/11_Expressions/11_Instance_Creation/1_New_A12_t01: Fail # co19 issue 255: unmatched bracket (same behavior in dart2js)
+Language/11_Expressions/11_Instance_Creation/1_New_A12_t02: Fail # Inherited from VM
+Language/11_Expressions/11_Instance_Creation/1_New_A13_t04: Fail # Inherited from VM
+Language/11_Expressions/11_Instance_Creation/1_New_A14_t01: Fail # Inherited from dart2js
+Language/11_Expressions/11_Instance_Creation/2_Const_A01_t02: Fail # http://dartbug.com/5519
+Language/11_Expressions/11_Instance_Creation/2_Const_A06_t01: Fail # http://dartbug.com/5519
+Language/11_Expressions/11_Instance_Creation/2_Const_A06_t02: Fail # http://dartbug.com/5519
+Language/11_Expressions/11_Instance_Creation/2_Const_A10_t01: Fail # inherited from VM
+Language/11_Expressions/14_Function_Invocation/2_Binding_Actuals_to_Formals_A04_t01: Fail # http://dartbug.com/5519
+Language/11_Expressions/14_Function_Invocation/4_Function_Expression_Invocation_A03_t01: Fail # inherited from VM
+Language/11_Expressions/14_Function_Invocation/4_Function_Expression_Invocation_A05_t01: Fail # inherited from VM
+Language/11_Expressions/14_Function_Invocation/4_Function_Expression_Invocation_A05_t02: Fail # inherited from VM
+Language/11_Expressions/15_Method_Invocation/1_Ordinary_Invocation_A05_t02: Fail # inherited from VM
+Language/11_Expressions/15_Method_Invocation/1_Ordinary_Invocation_A05_t03: Fail # inherited from VM
+Language/11_Expressions/15_Method_Invocation/3_Static_Invocation_A03_t03: Fail # inherited from VM
+Language/11_Expressions/15_Method_Invocation/3_Static_Invocation_A03_t04: Fail # http://dartbug.com/5519
+Language/11_Expressions/15_Method_Invocation/3_Static_Invocation_A03_t06: Fail # inherited from VM
+Language/11_Expressions/15_Method_Invocation/3_Static_Invocation_A04_t02: Fail # inherited from VM
+Language/11_Expressions/15_Method_Invocation/3_Static_Invocation_A04_t03: Fail # inherited from VM
+Language/11_Expressions/15_Method_Invocation/3_Static_Invocation_A04_t08: Fail # inherited from VM
+Language/11_Expressions/15_Method_Invocation/3_Static_Invocation_A05_t01: Fail # inherited from VM
+Language/11_Expressions/15_Method_Invocation/3_Static_Invocation_A06_t02: Fail # inherited from VM
+Language/11_Expressions/15_Method_Invocation/4_Super_Invocation_A02_t04: Fail # co19 issue 251 or issue 5732
+Language/11_Expressions/15_Method_Invocation/4_Super_Invocation_A03_t02: Fail # co19 issue 251 or issue 5732
+Language/11_Expressions/15_Method_Invocation/4_Super_Invocation_A03_t03: Fail # co19 issue 251 or issue 5732
+Language/11_Expressions/15_Method_Invocation/4_Super_Invocation_A07_t01: Fail # co19 issue 251 or issue 5732
+Language/11_Expressions/15_Method_Invocation/4_Super_Invocation_A08_t02: Fail # co19 issue 251 or issue 5732
+Language/11_Expressions/17_Getter_Invocation_A02_t01: Fail # inherited from VM
+Language/11_Expressions/18_Assignment_A05_t02: Fail # inherited from VM
+Language/11_Expressions/18_Assignment_A05_t04: Fail # inherited from VM
+Language/11_Expressions/18_Assignment_A05_t05: Fail # inherited from VM
+Language/11_Expressions/19_Conditional_A01_t10: Fail # Inherited from dart2js
+Language/11_Expressions/19_Conditional_A01_t11: Fail # Inherited from dart2js
+Language/11_Expressions/19_Conditional_A01_t12: Fail # Inherited from dart2js
+Language/11_Expressions/19_Conditional_A01_t13: Fail # Inherited from dart2js
+Language/11_Expressions/19_Conditional_A01_t14: Fail # Inherited from dart2js
+Language/11_Expressions/19_Conditional_A01_t15: Fail # Inherited from dart2js
+Language/11_Expressions/20_Logical_Boolean_Expressions_A01_t11: Fail # Inherited from dart2js
+Language/11_Expressions/20_Logical_Boolean_Expressions_A01_t12: Fail # http://dartbug.com/5519
+Language/11_Expressions/20_Logical_Boolean_Expressions_A01_t13: Fail # Inherited from dart2js
+Language/11_Expressions/20_Logical_Boolean_Expressions_A01_t14: Fail # Inherited from dart2js
+Language/11_Expressions/21_Bitwise_Expressions_A01_t13: Fail # Inherited from dart2js
+Language/11_Expressions/21_Bitwise_Expressions_A01_t14: Fail # http://dartbug.com/5519
+Language/11_Expressions/21_Bitwise_Expressions_A01_t15: Fail # Inherited from dart2js
+Language/11_Expressions/21_Bitwise_Expressions_A01_t16: Fail # Inherited from dart2js
+Language/11_Expressions/21_Bitwise_Expressions_A01_t17: Fail # Inherited from dart2js
+Language/11_Expressions/23_Relational_Expressions_A01_t10: Fail # http://dartbug.com/5519
+Language/11_Expressions/23_Relational_Expressions_A01_t11: Fail # http://dartbug.com/5519
+Language/11_Expressions/23_Relational_Expressions_A01_t12: Fail # http://dartbug.com/5519
+Language/11_Expressions/23_Relational_Expressions_A01_t13: Fail # http://dartbug.com/5519
+Language/11_Expressions/23_Relational_Expressions_A01_t19: Fail # Inherited from dart2js
+Language/11_Expressions/23_Relational_Expressions_A01_t20: Fail # http://dartbug.com/5519
+Language/11_Expressions/23_Relational_Expressions_A01_t21: Fail # Inherited from dart2js
+Language/11_Expressions/23_Relational_Expressions_A01_t22: Fail # Inherited from dart2js
+Language/11_Expressions/23_Relational_Expressions_A01_t23: Fail # Inherited from dart2js
+Language/11_Expressions/22_Equality_A01_t01: Fail # inherited from VM
+Language/11_Expressions/22_Equality_A01_t15: Fail # http://dartbug.com/5519
+Language/11_Expressions/22_Equality_A01_t16: Fail # http://dartbug.com/5519
+Language/11_Expressions/22_Equality_A01_t19: Fail # http://dartbug.com/5519
+Language/11_Expressions/22_Equality_A01_t23: Fail # Inherited from dart2js
+Language/11_Expressions/22_Equality_A01_t24: Fail # Inherited from dart2js
+Language/11_Expressions/22_Equality_A02_t03: Fail # inherited from VM
+Language/11_Expressions/22_Equality_A05_t01: Fail # inherited from VM
+Language/11_Expressions/24_Shift_A01_t10: Fail # Inherited from dart2js
+Language/11_Expressions/24_Shift_A01_t11: Fail # http://dartbug.com/5519
+Language/11_Expressions/24_Shift_A01_t12: Fail # Inherited from dart2js
+Language/11_Expressions/24_Shift_A01_t13: Fail # Inherited from dart2js
+Language/11_Expressions/24_Shift_A01_t14: Fail # Inherited from dart2js
+Language/11_Expressions/25_Additive_Expressions_A01_t08: Fail # Inherited from dart2js
+Language/11_Expressions/25_Additive_Expressions_A01_t11: Fail # Inherited from dart2js
+Language/11_Expressions/25_Additive_Expressions_A01_t12: Fail # Inherited from dart2js
+Language/11_Expressions/25_Additive_Expressions_A01_t13: Fail # Inherited from dart2js
+Language/11_Expressions/25_Additive_Expressions_A01_t14: Fail # Inherited from dart2js
+Language/11_Expressions/26_Multiplicative_Expressions_A01_t11: Fail # Inherited from dart2js
+Language/11_Expressions/26_Multiplicative_Expressions_A01_t14: Fail # Inherited from dart2js
+Language/11_Expressions/26_Multiplicative_Expressions_A01_t15: Fail # Inherited from dart2js
+Language/11_Expressions/26_Multiplicative_Expressions_A01_t16: Fail # Inherited from dart2js
+Language/11_Expressions/26_Multiplicative_Expressions_A01_t17: Fail # Inherited from dart2js
+Language/11_Expressions/27_Unary_Expressions_A01_t01: Fail # inherited from VM
+Language/11_Expressions/27_Unary_Expressions_A01_t02: Fail # Inherited from dart2js
+Language/11_Expressions/27_Unary_Expressions_A01_t04: Fail # Inherited from dart2js
+Language/11_Expressions/27_Unary_Expressions_A01_t05: Fail # Inherited from dart2js
+Language/11_Expressions/27_Unary_Expressions_A01_t17: Fail # Inherited from dart2js
+Language/11_Expressions/27_Unary_Expressions_A01_t18: Fail # Inherited from dart2js
+Language/11_Expressions/27_Unary_Expressions_A01_t19: Fail # Inherited from dart2js
+Language/11_Expressions/27_Unary_Expressions_A01_t20: Fail # Inherited from dart2js
+Language/11_Expressions/27_Unary_Expressions_A01_t21: Fail # Inherited from dart2js
+Language/11_Expressions/27_Unary_Expressions_A01_t22: Fail # Inherited from dart2js
+Language/11_Expressions/28_Postfix_Expressions_A01_t02: Fail # Inherited from dart2js
+Language/11_Expressions/28_Postfix_Expressions_A01_t03: Fail # Inherited from dart2js
+Language/11_Expressions/28_Postfix_Expressions_A01_t05: Fail # Inherited from dart2js
+Language/11_Expressions/29_Assignable_Expressions_A01_t06: Fail # Inherited from dart2js
+Language/11_Expressions/29_Assignable_Expressions_A01_t08: Fail # Inherited from dart2js
+Language/11_Expressions/29_Assignable_Expressions_A01_t09: Fail # Inherited from dart2js
+Language/11_Expressions/30_Identifier_Reference_A02_t01: Fail # Pseudo keyword "abstract".
+Language/11_Expressions/30_Identifier_Reference_A07_t01: Fail # http://dartbug.com/5519
+Language/12_Statements/03_Variable_Declaration_A04_t01: Fail # http://dartbug.com/5519
Language/13_Libraries_and_Scripts/4_Scripts_A03_t01: Fail # http://dartbug.com/5519
Language/13_Libraries_and_Scripts/4_Scripts_A03_t03: Fail # http://dartbug.com/5519
Language/14_Types/2_Dynamic_Type_System_A02_t01: Fail # inherited from VM
@@ -559,9 +529,6 @@
LibTest/core/Date/toString_A02_t01: Fail, OK # inherited from VM
LibTest/core/Date/year_A01_t01: Fail, OK # inherited from VM
LibTest/core/double/toRadixString_A01_t01: Fail # inherited from VM
-LibTest/core/Expect/throws_A02_t01: Fail, OK # Issue co19 - 42
-LibTest/core/Future/handleException_A01_t07: Fail # inherited from VM
-LibTest/core/Future/then_A01_t05: Fail # inherited from VM
LibTest/core/int/operator_left_shift_A01_t02: Fail, OK # co19 issue 129
LibTest/core/int/toRadixString_A01_t01: Fail # inherited from VM
LibTest/core/Match/operator_subscript_A01_t01: Fail # inherited from VM
@@ -588,6 +555,8 @@
Language/07_Classes/6_Constructors/1_Generative_Constructors_A16_t07: Fail # http://dartbug.com/6242
+LibTest/core/NoSuchMethodError/NoSuchMethodError_A01_t01: Fail, OK # co19 issue 300
+LibTest/core/NoSuchMethodError/toString_A01_t01: Fail, OK # co19 issue 300
[ $compiler == dart2dart && $system == windows ]
LibTest/core/double/operator_remainder_A01_t04: Fail # Result is NaN
diff --git a/tests/co19/co19-dart2js.status b/tests/co19/co19-dart2js.status
index 98ac7b2..9e1dc2d 100644
--- a/tests/co19/co19-dart2js.status
+++ b/tests/co19/co19-dart2js.status
@@ -9,13 +9,31 @@
Language/13_Libraries_and_Scripts/2_Exports_A04_t02: Crash
Language/13_Libraries_and_Scripts/2_Exports_A04_t03: Crash
+Language/03_Overview/1_Scoping_A02_t05: Fail # TODO(ahe): Please triage this failure.
Language/03_Overview/1_Scoping_A02_t06: Fail # TODO(ahe): Please triage this failure.
-Language/05_Variables/05_Variables_A03_t09: Fail # TODO(ahe): Please triage this failure.
-Language/05_Variables/05_Variables_A03_t11: Fail # TODO(ahe): Please triage this failure.
-Language/05_Variables/05_Variables_A03_t12: Fail # TODO(ahe): Please triage this failure.
-Language/05_Variables/05_Variables_A03_t13: Fail # TODO(ahe): Please triage this failure.
-Language/05_Variables/05_Variables_A03_t14: Fail # TODO(ahe): Please triage this failure.
-Language/05_Variables/05_Variables_A03_t15: Fail # TODO(ahe): Please triage this failure.
+Language/05_Variables/05_Variables_A05_t02: Fail # TODO(ahe): Please triage this failure.
+Language/05_Variables/05_Variables_A05_t04: Fail # TODO(ahe): Please triage this failure.
+Language/05_Variables/05_Variables_A05_t05: Fail # TODO(ahe): Please triage this failure.
+Language/05_Variables/05_Variables_A05_t06: Fail # TODO(ahe): Please triage this failure.
+Language/05_Variables/05_Variables_A05_t07: Fail # TODO(ahe): Please triage this failure.
+Language/05_Variables/05_Variables_A05_t08: Fail # TODO(ahe): Please triage this failure.
+Language/05_Variables/05_Variables_A05_t09: Fail # TODO(ahe): Please triage this failure.
+Language/05_Variables/05_Variables_A05_t10: Fail # TODO(ahe): Please triage this failure.
+Language/05_Variables/05_Variables_A05_t11: Fail # TODO(ahe): Please triage this failure.
+Language/05_Variables/05_Variables_A05_t12: Fail # TODO(ahe): Please triage this failure.
+Language/05_Variables/05_Variables_A05_t13: Fail # TODO(ahe): Please triage this failure.
+Language/05_Variables/05_Variables_A05_t14: Fail # TODO(ahe): Please triage this failure.
+Language/05_Variables/05_Variables_A05_t15: Fail # TODO(ahe): Please triage this failure.
+Language/05_Variables/05_Variables_A07_t01: Fail # TODO(ahe): Please triage this failure.
+Language/05_Variables/05_Variables_A07_t02: Fail # TODO(ahe): Please triage this failure.
+Language/05_Variables/05_Variables_A07_t03: Fail # TODO(ahe): Please triage this failure.
+Language/05_Variables/05_Variables_A07_t04: Fail # TODO(ahe): Please triage this failure.
+Language/05_Variables/05_Variables_A07_t05: Fail # TODO(ahe): Please triage this failure.
+Language/05_Variables/05_Variables_A07_t06: Fail # TODO(ahe): Please triage this failure.
+Language/05_Variables/05_Variables_A07_t07: Fail # TODO(ahe): Please triage this failure.
+Language/05_Variables/05_Variables_A07_t08: Fail # TODO(ahe): Please triage this failure.
+Language/05_Variables/05_Variables_A07_t10: Fail # TODO(ahe): Please triage this failure.
+Language/05_Variables/05_Variables_A08_t01: Fail # TODO(ahe): Please triage this failure.
Language/05_Variables/1_Evaluation_of_Implicit_Variable_Getters_A01_t05: Fail # TODO(ahe): Please triage this failure.
Language/06_Functions/06_Functions_A01_t22: Fail # TODO(ahe): Please triage this failure.
Language/07_Classes/07_Classes_A03_t01: Fail # TODO(ahe): Please triage this failure.
@@ -29,133 +47,130 @@
Language/07_Classes/6_Constructors/3_Constant_Constructors_A05_t01: Fail # TODO(ahe): Please triage this failure.
Language/07_Classes/6_Constructors/3_Constant_Constructors_A05_t03: Fail # TODO(ahe): Please triage this failure.
Language/07_Classes/9_Superclasses/1_Inheritance_and_Overriding_A02_t03: Fail # TODO(ahe): Please triage this failure.
-Language/09_Generics/09_Generics_A05_t02: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/01_Constants_A05_t01: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/01_Constants_A13_t06: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/05_Strings/1_String_Interpolation_A01_t04: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/05_Strings/1_String_Interpolation_A01_t05: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/05_Strings/1_String_Interpolation_A01_t06: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/08_Throw_A01_t01: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/08_Throw_A05_t01: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/08_Throw_A05_t02: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/08_Throw_A05_t03: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/09_Function_Expressions_A03_t02: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/09_Function_Expressions_A04_t02: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/11_Instance_Creation/1_New_A02_t03: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/11_Instance_Creation/1_New_A02_t05: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/11_Instance_Creation/1_New_A02_t06: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/11_Instance_Creation/1_New_A02_t07: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/11_Instance_Creation/1_New_A12_t01: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/11_Instance_Creation/1_New_A12_t02: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/11_Instance_Creation/1_New_A13_t04: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/11_Instance_Creation/1_New_A14_t01: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/11_Instance_Creation/2_Const_A01_t02: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/17_Getter_Invocation_A02_t01: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/17_Getter_Invocation_A02_t02: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/18_Assignment_A05_t02: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/18_Assignment_A05_t04: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/18_Assignment_A05_t05: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/18_Assignment_A08_t04: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/19_Conditional_A01_t10: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/19_Conditional_A01_t11: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/19_Conditional_A01_t12: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/19_Conditional_A01_t13: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/19_Conditional_A01_t14: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/19_Conditional_A01_t15: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/20_Logical_Boolean_Expressions_A01_t10: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/20_Logical_Boolean_Expressions_A01_t11: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/20_Logical_Boolean_Expressions_A01_t12: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/20_Logical_Boolean_Expressions_A01_t13: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/20_Logical_Boolean_Expressions_A01_t14: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/21_Bitwise_Expressions_A01_t12: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/21_Bitwise_Expressions_A01_t13: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/21_Bitwise_Expressions_A01_t14: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/21_Bitwise_Expressions_A01_t15: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/21_Bitwise_Expressions_A01_t16: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/21_Bitwise_Expressions_A01_t17: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/22_Equality_A01_t23: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/22_Equality_A01_t24: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/22_Equality_A03_t02: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/23_Relational_Expressions_A01_t18: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/23_Relational_Expressions_A01_t19: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/23_Relational_Expressions_A01_t20: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/23_Relational_Expressions_A01_t21: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/23_Relational_Expressions_A01_t22: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/23_Relational_Expressions_A01_t23: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/24_Shift_A01_t09: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/24_Shift_A01_t10: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/24_Shift_A01_t11: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/24_Shift_A01_t12: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/24_Shift_A01_t13: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/24_Shift_A01_t14: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/25_Additive_Expressions_A01_t07: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/25_Additive_Expressions_A01_t08: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/25_Additive_Expressions_A01_t11: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/25_Additive_Expressions_A01_t12: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/25_Additive_Expressions_A01_t13: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/25_Additive_Expressions_A01_t14: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/26_Multiplicative_Expressions_A01_t10: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/26_Multiplicative_Expressions_A01_t11: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/26_Multiplicative_Expressions_A01_t14: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/26_Multiplicative_Expressions_A01_t15: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/26_Multiplicative_Expressions_A01_t16: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/26_Multiplicative_Expressions_A01_t17: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/27_Unary_Expressions_A01_t02: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/27_Unary_Expressions_A01_t04: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/27_Unary_Expressions_A01_t05: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/27_Unary_Expressions_A01_t11: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/27_Unary_Expressions_A01_t12: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/27_Unary_Expressions_A01_t13: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/27_Unary_Expressions_A01_t17: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/27_Unary_Expressions_A01_t18: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/27_Unary_Expressions_A01_t19: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/27_Unary_Expressions_A01_t20: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/27_Unary_Expressions_A01_t21: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/27_Unary_Expressions_A01_t22: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/28_Postfix_Expressions_A01_t02: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/28_Postfix_Expressions_A01_t03: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/28_Postfix_Expressions_A01_t05: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/29_Assignable_Expressions_A01_t06: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/29_Assignable_Expressions_A01_t08: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/29_Assignable_Expressions_A01_t09: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/30_Identifier_Reference_A04_t09: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/30_Identifier_Reference_A05_t01: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/30_Identifier_Reference_A05_t04: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/30_Identifier_Reference_A05_t12: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/30_Identifier_Reference_A06_t01: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/30_Identifier_Reference_A06_t02: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/31_Type_Test_A01_t02: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/31_Type_Test_A01_t04: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/31_Type_Test_A04_t01: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/32_Type_Cast_A02_t03: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/32_Type_Cast_A03_t01: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/32_Type_Cast_A03_t02: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/32_Type_Cast_A05_t01: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/32_Type_Cast_A05_t02: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/32_Type_Cast_A05_t04: Fail # TODO(ahe): Please triage this failure.
-Language/11_Statements/03_Variable_Declaration_A04_t02: Fail # TODO(ahe): Please triage this failure.
-Language/11_Statements/03_Variable_Declaration_A04_t03: Fail # TODO(ahe): Please triage this failure.
-Language/11_Statements/03_Variable_Declaration_A04_t04: Fail # TODO(ahe): Please triage this failure.
-Language/11_Statements/03_Variable_Declaration_A04_t05: Fail # TODO(ahe): Please triage this failure.
-Language/11_Statements/03_Variable_Declaration_A04_t06: Fail # TODO(ahe): Please triage this failure.
-Language/11_Statements/04_Local_Function_Declaration_A01_t01: Fail # TODO(ahe): Please triage this failure.
-Language/11_Statements/04_Local_Function_Declaration_A02_t02: Fail # TODO(ahe): Please triage this failure.
-Language/11_Statements/06_For_A01_t11: Fail # TODO(ahe): Please triage this failure.
-Language/11_Statements/06_For_A01_t12: Fail # TODO(ahe): Please triage this failure.
-Language/11_Statements/09_Switch_A02_t01: Fail # TODO(ahe): Please triage this failure.
-Language/11_Statements/09_Switch_A02_t02: Fail # TODO(ahe): Please triage this failure.
-Language/11_Statements/09_Switch_A02_t03: Fail # TODO(ahe): Please triage this failure.
-Language/11_Statements/09_Switch_A03_t01: Fail # TODO(ahe): Please triage this failure.
-Language/11_Statements/09_Switch_A03_t02: Fail # TODO(ahe): Please triage this failure.
-Language/11_Statements/09_Switch_A06_t02: Fail # TODO(ahe): Please triage this failure.
-Language/11_Statements/10_Try_A06_t01: Fail # TODO(ahe): Please triage this failure.
-Language/11_Statements/10_Try_A07_t03: Fail # TODO(ahe): Please triage this failure.
-Language/11_Statements/11_Return_A05_t01: Fail # TODO(ahe): Please triage this failure.
-Language/11_Statements/11_Return_A05_t02: Fail # TODO(ahe): Please triage this failure.
-Language/11_Statements/11_Return_A05_t03: Fail # TODO(ahe): Please triage this failure.
-Language/11_Statements/12_Labels_A03_t04: Fail # TODO(ahe): Please triage this failure.
-Language/11_Statements/14_Continue_A02_t12: Fail # TODO(ahe): Please triage this failure.
-Language/11_Statements/14_Continue_A02_t13: Fail # TODO(ahe): Please triage this failure.
+Language/09_Generics/09_Generics_A05_t01: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/01_Constants_A05_t01: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/01_Constants_A13_t06: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/05_Strings/1_String_Interpolation_A01_t04: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/05_Strings/1_String_Interpolation_A01_t05: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/05_Strings/1_String_Interpolation_A01_t06: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/08_Throw_A01_t01: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/08_Throw_A05_t01: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/08_Throw_A05_t02: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/08_Throw_A05_t03: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/11_Instance_Creation/1_New_A02_t03: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/11_Instance_Creation/1_New_A02_t05: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/11_Instance_Creation/1_New_A02_t06: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/11_Instance_Creation/1_New_A02_t07: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/11_Instance_Creation/1_New_A12_t01: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/11_Instance_Creation/1_New_A12_t02: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/11_Instance_Creation/1_New_A13_t04: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/11_Instance_Creation/1_New_A14_t01: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/11_Instance_Creation/2_Const_A01_t02: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/17_Getter_Invocation_A02_t01: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/18_Assignment_A05_t02: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/18_Assignment_A05_t04: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/18_Assignment_A05_t05: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/18_Assignment_A08_t04: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/19_Conditional_A01_t10: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/19_Conditional_A01_t11: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/19_Conditional_A01_t12: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/19_Conditional_A01_t13: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/19_Conditional_A01_t14: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/19_Conditional_A01_t15: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/20_Logical_Boolean_Expressions_A01_t10: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/20_Logical_Boolean_Expressions_A01_t11: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/20_Logical_Boolean_Expressions_A01_t12: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/20_Logical_Boolean_Expressions_A01_t13: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/20_Logical_Boolean_Expressions_A01_t14: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/21_Bitwise_Expressions_A01_t12: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/21_Bitwise_Expressions_A01_t13: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/21_Bitwise_Expressions_A01_t14: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/21_Bitwise_Expressions_A01_t15: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/21_Bitwise_Expressions_A01_t16: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/21_Bitwise_Expressions_A01_t17: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/22_Equality_A01_t23: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/22_Equality_A01_t24: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/22_Equality_A03_t02: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/23_Relational_Expressions_A01_t18: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/23_Relational_Expressions_A01_t19: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/23_Relational_Expressions_A01_t20: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/23_Relational_Expressions_A01_t21: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/23_Relational_Expressions_A01_t22: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/23_Relational_Expressions_A01_t23: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/24_Shift_A01_t09: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/24_Shift_A01_t10: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/24_Shift_A01_t11: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/24_Shift_A01_t12: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/24_Shift_A01_t13: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/24_Shift_A01_t14: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/25_Additive_Expressions_A01_t07: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/25_Additive_Expressions_A01_t08: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/25_Additive_Expressions_A01_t11: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/25_Additive_Expressions_A01_t12: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/25_Additive_Expressions_A01_t13: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/25_Additive_Expressions_A01_t14: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/26_Multiplicative_Expressions_A01_t10: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/26_Multiplicative_Expressions_A01_t11: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/26_Multiplicative_Expressions_A01_t14: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/26_Multiplicative_Expressions_A01_t15: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/26_Multiplicative_Expressions_A01_t16: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/26_Multiplicative_Expressions_A01_t17: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/27_Unary_Expressions_A01_t02: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/27_Unary_Expressions_A01_t04: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/27_Unary_Expressions_A01_t05: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/27_Unary_Expressions_A01_t11: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/27_Unary_Expressions_A01_t12: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/27_Unary_Expressions_A01_t13: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/27_Unary_Expressions_A01_t17: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/27_Unary_Expressions_A01_t18: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/27_Unary_Expressions_A01_t19: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/27_Unary_Expressions_A01_t20: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/27_Unary_Expressions_A01_t21: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/27_Unary_Expressions_A01_t22: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/28_Postfix_Expressions_A01_t02: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/28_Postfix_Expressions_A01_t03: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/28_Postfix_Expressions_A01_t05: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/29_Assignable_Expressions_A01_t06: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/29_Assignable_Expressions_A01_t08: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/29_Assignable_Expressions_A01_t09: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/30_Identifier_Reference_A04_t09: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/30_Identifier_Reference_A05_t01: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/30_Identifier_Reference_A05_t04: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/30_Identifier_Reference_A05_t12: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/30_Identifier_Reference_A06_t01: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/30_Identifier_Reference_A06_t02: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/31_Type_Test_A01_t02: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/31_Type_Test_A01_t04: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/31_Type_Test_A04_t01: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/32_Type_Cast_A02_t03: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/32_Type_Cast_A03_t01: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/32_Type_Cast_A03_t02: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/32_Type_Cast_A05_t01: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/32_Type_Cast_A05_t02: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/32_Type_Cast_A05_t04: Fail # TODO(ahe): Please triage this failure.
+Language/12_Statements/03_Variable_Declaration_A04_t02: Fail # TODO(ahe): Please triage this failure.
+Language/12_Statements/03_Variable_Declaration_A04_t03: Fail # TODO(ahe): Please triage this failure.
+Language/12_Statements/03_Variable_Declaration_A04_t04: Fail # TODO(ahe): Please triage this failure.
+Language/12_Statements/03_Variable_Declaration_A04_t05: Fail # TODO(ahe): Please triage this failure.
+Language/12_Statements/03_Variable_Declaration_A04_t06: Fail # TODO(ahe): Please triage this failure.
+Language/12_Statements/04_Local_Function_Declaration_A01_t01: Fail # TODO(ahe): Please triage this failure.
+Language/12_Statements/04_Local_Function_Declaration_A02_t02: Fail # TODO(ahe): Please triage this failure.
+Language/12_Statements/06_For_A01_t11: Fail # TODO(ahe): Please triage this failure.
+Language/12_Statements/06_For_A01_t12: Fail # TODO(ahe): Please triage this failure.
+Language/12_Statements/09_Switch_A02_t01: Fail # TODO(ahe): Please triage this failure.
+Language/12_Statements/09_Switch_A02_t02: Fail # TODO(ahe): Please triage this failure.
+Language/12_Statements/09_Switch_A02_t03: Fail # TODO(ahe): Please triage this failure.
+Language/12_Statements/09_Switch_A03_t01: Fail # TODO(ahe): Please triage this failure.
+Language/12_Statements/09_Switch_A03_t02: Fail # TODO(ahe): Please triage this failure.
+Language/12_Statements/09_Switch_A06_t02: Fail # TODO(ahe): Please triage this failure.
+Language/12_Statements/10_Try_A06_t01: Fail # TODO(ahe): Please triage this failure.
+Language/12_Statements/10_Try_A07_t03: Fail # TODO(ahe): Please triage this failure.
+Language/12_Statements/11_Return_A05_t01: Fail # TODO(ahe): Please triage this failure.
+Language/12_Statements/11_Return_A05_t02: Fail # TODO(ahe): Please triage this failure.
+Language/12_Statements/11_Return_A05_t03: Fail # TODO(ahe): Please triage this failure.
+Language/12_Statements/12_Labels_A03_t04: Fail # TODO(ahe): Please triage this failure.
+Language/12_Statements/14_Continue_A02_t12: Fail # TODO(ahe): Please triage this failure.
+Language/12_Statements/14_Continue_A02_t13: Fail # TODO(ahe): Please triage this failure.
Language/13_Libraries_and_Scripts/1_Imports_A02_t01: Fail # TODO(ahe): Please triage this failure.
Language/13_Libraries_and_Scripts/1_Imports_A02_t02: Fail # TODO(ahe): Please triage this failure.
Language/13_Libraries_and_Scripts/1_Imports_A02_t16: Fail # TODO(ahe): Please triage this failure.
@@ -216,6 +231,26 @@
LibTest/core/EmptyQueueException/EmptyQueueException_A01_t01: Fail, OK # co19 issue 288
LibTest/core/EmptyQueueException/toString_A01_t01: Fail, OK # co19 issue 288
+LibTest/core/List/getRange_A04_t01: Fail, OK # co19 issue 290
+LibTest/core/List/insertRange_A06_t01: Fail, OK # co19 issue 290
+LibTest/core/List/last_A02_t01: Fail, OK # co19 issue 290
+LibTest/core/List/length_A05_t01: Fail, OK # co19 issue 290
+LibTest/core/List/List_A01_t01: Fail, OK # co19 issue 290
+LibTest/core/List/operator_subscript_A02_t01: Fail, OK # co19 issue 290
+LibTest/core/List/operator_subscripted_assignment_A02_t01: Fail, OK # co19 issue 290
+LibTest/core/List/removeLast_A01_t02: Fail, OK # co19 issue 290
+LibTest/core/List/removeRange_A05_t01: Fail, OK # co19 issue 290
+LibTest/core/List/setRange_A02_t01: Fail, OK # co19 issue 290
+LibTest/core/List/setRange_A02_t02: Fail, OK # co19 issue 290
+LibTest/core/List/setRange_A03_t01: Fail, OK # co19 issue 290
+LibTest/core/List/setRange_A03_t02: Fail, OK # co19 issue 290
+LibTest/core/Match/group_A02_t01: Fail, OK # co19 issue 290
+LibTest/core/Match/groups_A02_t01: Fail, OK # co19 issue 290
+LibTest/core/Match/operator_subscript_A02_t01: Fail, OK # co19 issue 290
+LibTest/core/String/charCodeAt_A02_t01: Fail, OK # co19 issue 290
+LibTest/core/String/operator_subscript_A02_t01: Fail, OK # co19 issue 290
+LibTest/core/String/substring_A02_t01: Fail, OK # co19 issue 290
+
[ $compiler == dart2js && $unchecked ]
LibTest/core/Date/Date.fromMillisecondsSinceEpoch_A03_t01: Fail # TODO(ahe): Please triage this failure.
@@ -241,31 +276,32 @@
Language/07_Classes/6_Constructors/2_Factories_A06_t04: Fail # TODO(ahe): Please triage this failure.
Language/09_Generics/09_Generics_A03_t01: Fail # TODO(ahe): Please triage this failure.
Language/09_Generics/09_Generics_A04_t06: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/06_Lists_A09_t01: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/06_Lists_A09_t04: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/06_Lists_A09_t05: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/07_Maps_A10_t04: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/07_Maps_A10_t05: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/09_Function_Expressions_A03_t03: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/09_Function_Expressions_A04_t03: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/09_Function_Expressions_A05_t02: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/09_Function_Expressions_A05_t04: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/09_Function_Expressions_A06_t02: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/09_Function_Expressions_A06_t04: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/11_Instance_Creation/1_New_A07_t01: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/11_Instance_Creation/1_New_A11_t01: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/11_Instance_Creation/2_Const_A09_t02: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/11_Instance_Creation/2_Const_A09_t03: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/11_Instance_Creation_A05_t02: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/15_Method_Invocation/3_Static_Invocation_A03_t04: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/20_Logical_Boolean_Expressions_A03_t01: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/27_Unary_Expressions_A02_t03: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/32_Type_Cast_A05_t03: Fail # TODO(ahe): Please triage this failure.
-Language/10_Expressions/32_Type_Cast_A05_t05: Fail # TODO(ahe): Please triage this failure.
-Language/11_Statements/05_If_A02_t01: Fail # TODO(ahe): Please triage this failure.
-Language/11_Statements/06_For/1_For_Loop_A01_t08: Fail # TODO(ahe): Please triage this failure.
-Language/11_Statements/09_Switch_A05_t01: Fail # TODO(ahe): Please triage this failure.
-Language/11_Statements/11_Return_A04_t01: Fail # TODO(ahe): Please triage this failure.
+Language/09_Generics/09_Generics_A05_t02: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/06_Lists_A09_t01: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/06_Lists_A09_t04: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/06_Lists_A09_t05: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/07_Maps_A10_t04: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/07_Maps_A10_t05: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/09_Function_Expressions_A03_t03: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/09_Function_Expressions_A04_t03: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/09_Function_Expressions_A05_t02: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/09_Function_Expressions_A05_t04: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/09_Function_Expressions_A06_t02: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/09_Function_Expressions_A06_t04: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/11_Instance_Creation/1_New_A07_t01: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/11_Instance_Creation/1_New_A11_t01: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/11_Instance_Creation/2_Const_A09_t02: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/11_Instance_Creation/2_Const_A09_t03: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/11_Instance_Creation_A05_t02: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/15_Method_Invocation/3_Static_Invocation_A03_t04: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/20_Logical_Boolean_Expressions_A03_t01: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/27_Unary_Expressions_A02_t03: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/32_Type_Cast_A05_t03: Fail # TODO(ahe): Please triage this failure.
+Language/11_Expressions/32_Type_Cast_A05_t05: Fail # TODO(ahe): Please triage this failure.
+Language/12_Statements/05_If_A02_t01: Fail # TODO(ahe): Please triage this failure.
+Language/12_Statements/06_For/1_For_Loop_A01_t08: Fail # TODO(ahe): Please triage this failure.
+Language/12_Statements/09_Switch_A05_t01: Fail # TODO(ahe): Please triage this failure.
+Language/12_Statements/11_Return_A04_t01: Fail # TODO(ahe): Please triage this failure.
Language/14_Types/4_Interface_Types_A08_t03: Fail # TODO(ahe): Please triage this failure.
Language/14_Types/8_Parameterized_Types_A02_t01: Fail # TODO(ahe): Please triage this failure.
LibTest/core/AssertionError/column_A01_t02: Fail # TODO(ahe): Please triage this failure.
@@ -288,6 +324,13 @@
Language/03_Overview/1_Scoping_A02_t30: Fail # http://dartbug.com/5348
+Language/11_Expressions/15_Method_Invocation/4_Super_Invocation_A04_t01: Fail # Checked mode failure for noSuchMethod type.
+Language/11_Expressions/15_Method_Invocation/4_Super_Invocation_A04_t02: Fail # Checked mode failure for noSuchMethod type.
+Language/11_Expressions/15_Method_Invocation/4_Super_Invocation_A04_t03: Fail # Checked mode failure for noSuchMethod type.
+Language/11_Expressions/15_Method_Invocation/4_Super_Invocation_A04_t04: Fail # Checked mode failure for noSuchMethod type.
+Language/11_Expressions/15_Method_Invocation/4_Super_Invocation_A06_t01: Fail # Checked mode failure for noSuchMethod type.
+Language/11_Expressions/15_Method_Invocation/4_Super_Invocation_A06_t02: Fail # Checked mode failure for noSuchMethod type.
+
[ $compiler == dart2js ]
LibTest/core/int/operator_GT_A01_t01: Fail, OK # co19 issue 200
@@ -304,7 +347,6 @@
LibTest/core/List/setRange_A05_t01: Fail, OK
# These tests need to be updated for new optional parameter syntax and semantics, co19 issue 258:
-Language/06_Functions/2_Formal_Parameters/2_Optional_Formals_A01_t01: Fail, OK
Language/07_Classes/1_Instance_Methods_A02_t05: Fail, OK
Language/07_Classes/6_Constructors/1_Generative_Constructors_A13_t01: Fail, OK
Language/14_Types/5_Function_Types_A01_t21: Fail, OK
@@ -332,54 +374,16 @@
LibTest/core/Map/getValues_A01_t02: Fail, OK # co19 issue 293
LibTest/core/Map/getValues_A01_t01: Fail, OK # co19 issue 293
-LibTest/core/Match/end_A01_t01: Fail, OK # co19 issue 294
-LibTest/core/Match/group_A01_t01: Fail, OK # co19 issue 294
-LibTest/core/Match/groupCount_A01_t01: Fail, OK # co19 issue 294
-LibTest/core/Match/operator_subscript_A01_t01: Fail, OK # co19 issue 294
-LibTest/core/Match/start_A01_t01: Fail, OK # co19 issue 294
LibTest/core/RegExp/allMatches_A01_t01: Fail, OK # co19 issue 294
LibTest/core/RegExp/firstMatch_A01_t01: Fail, OK # co19 issue 294
-LibTest/core/RegExp/Pattern_semantics/firstMatch_Assertion_A03_t01: Fail, OK # co19 issue 294
-LibTest/core/RegExp/Pattern_semantics/firstMatch_Assertion_A04_t01: Fail, OK # co19 issue 294
-LibTest/core/RegExp/Pattern_semantics/firstMatch_Assertion_A05_t01: Fail, OK # co19 issue 294
-LibTest/core/RegExp/Pattern_semantics/firstMatch_Atom_A01_t01: Fail, OK # co19 issue 294
-LibTest/core/RegExp/Pattern_semantics/firstMatch_Atom_A02_t01: Fail, OK # co19 issue 294
-LibTest/core/RegExp/Pattern_semantics/firstMatch_Atom_A03_t01: Fail, OK # co19 issue 294
-LibTest/core/RegExp/Pattern_semantics/firstMatch_Atom_A03_t02: Fail, OK # co19 issue 294
-LibTest/core/RegExp/Pattern_semantics/firstMatch_Atom_A03_t03: Fail, OK # co19 issue 294
-LibTest/core/RegExp/Pattern_semantics/firstMatch_Atom_A04_t01: Fail, OK # co19 issue 294
-LibTest/core/RegExp/Pattern_semantics/firstMatch_Atom_A05_t01: Fail, OK # co19 issue 294
-LibTest/core/RegExp/Pattern_semantics/firstMatch_Atom_A06_t01: Fail, OK # co19 issue 294
-LibTest/core/RegExp/Pattern_semantics/firstMatch_AtomEscape_A01_t01: Fail, OK # co19 issue 294
-LibTest/core/RegExp/Pattern_semantics/firstMatch_Disjunction_A01_t01: Fail, OK # co19 issue 294
-LibTest/core/RegExp/Pattern_semantics/firstMatch_Quantifier_A01_t01: Fail, OK # co19 issue 294
-LibTest/core/RegExp/Pattern_semantics/firstMatch_Quantifier_A02_t01: Fail, OK # co19 issue 294
-LibTest/core/RegExp/Pattern_semantics/firstMatch_Quantifier_A03_t01: Fail, OK # co19 issue 294
-LibTest/core/RegExp/Pattern_semantics/firstMatch_Quantifier_A04_t01: Fail, OK # co19 issue 294
-LibTest/core/RegExp/Pattern_semantics/firstMatch_Quantifier_A05_t01: Fail, OK # co19 issue 294
-LibTest/core/RegExp/Pattern_semantics/firstMatch_Quantifier_A06_t01: Fail, OK # co19 issue 294
-LibTest/core/RegExp/Pattern_semantics/firstMatch_Term_A01_t01: Fail, OK # co19 issue 294
-LibTest/core/RegExp/Pattern_semantics/firstMatch_Term_A02_t01: Fail, OK # co19 issue 294
-LibTest/core/RegExp/Pattern_semantics/firstMatch_Term_A03_t01: Fail, OK # co19 issue 294
LibTest/core/RegExp/Pattern_semantics/firstMatch_Term_A04_t01: Fail, OK # co19 issue 294
-LibTest/core/Queue/filter_A01_t04: Fail, OK # co19 issue 291
-LibTest/core/Queue/first_A01_t01: Fail, OK # co19 issue 291
-LibTest/core/Queue/removeFirst_A01_t01: Fail, OK # co19 issue 291
-LibTest/core/Queue/addFirst_A01_t01: Fail, OK # co19 issue 291
-LibTest/core/Queue/removeLast_A01_t01: Fail, OK # co19 issue 291
-LibTest/core/Queue/add_A01_t01: Fail, OK # co19 issue 291
-LibTest/core/Queue/addLast_A01_t01: Fail, OK # co19 issue 291
-LibTest/core/Queue/last_A01_t01: Fail, OK # co19 issue 291
-LibTest/core/List/last_A02_t01: Fail, OK # co19 issue 291
-LibTest/core/List/last_A01_t01: Fail, OK # co19 issue 291
-
-LibTest/core/Queue/filter_A01_t04: Fail, OK # co19 issue 287
LibTest/core/Map/getValues_A01_t02: Fail, OK # co19 issue 287
LibTest/core/int/isOdd_A01_t01: Fail, OK # co19 issue 277
LibTest/core/int/isEven_A01_t01: Fail, OK # co19 issue 277
+Language/09_Generics/09_Generics_A05_t01: Fail # co19 issue 297
[ $compiler == dart2js && $system == windows && $jscl ]
LibTest/core/double/operator_remainder_A01_t04: Fail
@@ -388,44 +392,35 @@
Language/06_Functions/2_Formal_Parameters/2_Optional_Formals_A01_t10: Fail # TODO(ahe): Enforce optional parameter semantics.
Language/06_Functions/2_Formal_Parameters/2_Optional_Formals_A01_t11: Fail # TODO(ahe): Enforce optional parameter semantics.
Language/06_Functions/2_Formal_Parameters/2_Optional_Formals_A03_t03: Fail # TODO(ahe): Enforce optional parameter semantics.
+Language/06_Functions/2_Formal_Parameters/2_Optional_Formals_A01_t01: Fail # http://dartbug.com/5026
+Language/06_Functions/2_Formal_Parameters/2_Optional_Formals_A03_t04: Fail # TODO(ahe): Enforce optional parameter semantics.
+Language/06_Functions/2_Formal_Parameters_A03_t03: Fail # TODO(ahe): Enforce optional parameter semantics.
+Language/06_Functions/2_Formal_Parameters_A03_t04: Fail # TODO(ahe): Enforce optional parameter semantics.
+Language/06_Functions/2_Formal_Parameters_A03_t06: Fail # TODO(ahe): Enforce optional parameter semantics.
-Language/09_Generics/09_Generics_A05_t01: Fail # dart2js fails to reject type variable within static member
-
-Language/10_Expressions/14_Function_Invocation/2_Binding_Actuals_to_Formals_A06_t01: Fail # Compile-time error: Unimplemented non-matching static call
-Language/10_Expressions/14_Function_Invocation/2_Binding_Actuals_to_Formals_A06_t04: Fail # Compile-time error: Unimplemented non-matching static call
-Language/10_Expressions/14_Function_Invocation/2_Binding_Actuals_to_Formals_A06_t05: Fail # Compile-time error: Unimplemented non-matching static call
-Language/10_Expressions/14_Function_Invocation/2_Binding_Actuals_to_Formals_A06_t08: Fail # Compile-time error: Unimplemented non-matching static call
-Language/10_Expressions/14_Function_Invocation/2_Binding_Actuals_to_Formals_A07_t01: Fail # Compile-time error: Unimplemented non-matching static call
-Language/10_Expressions/14_Function_Invocation/2_Binding_Actuals_to_Formals_A07_t04: Fail # Compile-time error: Unimplemented non-matching static call
-Language/10_Expressions/01_Constants_A03_t01: Fail # Compile-time error: error: not a compile-time constant
-Language/10_Expressions/01_Constants_A11_t01: Fail # Compile-time error: error: not a compile-time constant
+Language/11_Expressions/01_Constants_A03_t01: Fail # Compile-time error: error: not a compile-time constant
+Language/11_Expressions/01_Constants_A11_t01: Fail # Compile-time error: error: not a compile-time constant
LibTest/isolate/SendPort/send_A02_t01: Fail # Compile-time error: error: not a compile-time constant
LibTest/isolate/SendPort/send_A02_t02: Fail # Compile-time error: error: not a compile-time constant
LibTest/isolate/SendPort/send_A02_t03: Fail # Compile-time error: error: not a compile-time constant
-Language/10_Expressions/01_Constants_A18_t03: Fail # Compile-time error: unexpected token 'equals'
-Language/10_Expressions/22_Equality_A02_t03: Fail # Compile-time error: unexpected token 'equals'
-Language/10_Expressions/05_Strings_A20_t01: Fail # Runtime error: Expect.identical(expected: <abyr, abyr
+Language/11_Expressions/01_Constants_A18_t03: Fail # Compile-time error: unexpected token 'equals'
+Language/11_Expressions/22_Equality_A02_t03: Fail # Compile-time error: unexpected token 'equals'
+Language/11_Expressions/05_Strings_A20_t01: Fail # Runtime error: Expect.identical(expected: <abyr, abyr
LibTest/isolate/isolate_api/spawnUri_A02_t01: Fail # Runtime error: Expect.throws() fails
-Language/10_Expressions/15_Method_Invocation/1_Ordinary_Invocation_A05_t03: Fail # Runtime error: NoSuchMethodException : method not found: '$call'
-Language/10_Expressions/15_Method_Invocation/1_Ordinary_Invocation_A05_t06: Fail # Runtime error: NoSuchMethodException : method not found: 'm'
-Language/10_Expressions/15_Method_Invocation/4_Super_Invocation_A04_t02: Fail # Runtime error: NoSuchMethodException : method not found: 'm'
-Language/10_Expressions/15_Method_Invocation/1_Ordinary_Invocation_A05_t05: Fail # Runtime error: NoSuchMethodException : method not found: 'nonExistingMethod'
-Language/10_Expressions/15_Method_Invocation/4_Super_Invocation_A04_t01: Fail # Runtime error: NoSuchMethodException : method not found: 'nonExistingMethod'
-Language/10_Expressions/05_Strings/1_String_Interpolation_A03_t02: Fail # Runtime error: TypeError: Cannot call method '$call$0' of undefined
-Language/10_Expressions/05_Strings/1_String_Interpolation_A04_t02: Fail # Runtime error: TypeError: Cannot call method '$call$0' of undefined
-Language/10_Expressions/15_Method_Invocation/1_Ordinary_Invocation_A08_t01: Fail # Runtime error: TypeError: Cannot call method '$call$0' of undefined
-Language/10_Expressions/15_Method_Invocation/3_Static_Invocation_A04_t02: Fail # Runtime error: TypeError: Cannot call method '$call$0' of undefined
-Language/10_Expressions/15_Method_Invocation/3_Static_Invocation_A04_t03: Fail # Runtime error: TypeError: Cannot call method '$call$0' of undefined
-Language/10_Expressions/15_Method_Invocation/3_Static_Invocation_A05_t01: Fail # Runtime error: TypeError: Cannot call method '$call$0' of undefined
-Language/10_Expressions/15_Method_Invocation/3_Static_Invocation_A06_t02: Fail # Runtime error: TypeError: Cannot call method '$call$0' of undefined
-Language/10_Expressions/15_Method_Invocation/4_Super_Invocation_A03_t02: Fail # Runtime error: TypeError: Cannot call method '$call$0' of undefined
-Language/10_Expressions/15_Method_Invocation/4_Super_Invocation_A03_t03: Fail # Runtime error: TypeError: Cannot call method '$call$0' of undefined
-Language/10_Expressions/15_Method_Invocation/4_Super_Invocation_A07_t01: Fail # Runtime error: TypeError: Cannot call method '$call$0' of undefined
-Language/10_Expressions/15_Method_Invocation/4_Super_Invocation_A08_t02: Fail # Runtime error: TypeError: Cannot call method '$call$0' of undefined
-Language/10_Expressions/15_Method_Invocation/4_Super_Invocation_A02_t04: Fail # Runtime error: TypeError: Cannot call method '$call$2' of undefined
-Language/10_Expressions/15_Method_Invocation/1_Ordinary_Invocation_A05_t02: Fail # Runtime error: TypeError: Object #<A> has no method '$call$0'
-Language/10_Expressions/14_Function_Invocation/4_Function_Expression_Invocation_A03_t01: Fail # Runtime error: TypeError: Object 1 has no method '$call$0'
+Language/11_Expressions/05_Strings/1_String_Interpolation_A03_t02: Fail # Runtime error: TypeError: Cannot call method '$call$0' of undefined
+Language/11_Expressions/05_Strings/1_String_Interpolation_A04_t02: Fail # Runtime error: TypeError: Cannot call method '$call$0' of undefined
+Language/11_Expressions/15_Method_Invocation/1_Ordinary_Invocation_A08_t01: Fail # Runtime error: TypeError: Cannot call method '$call$0' of undefined
+Language/11_Expressions/15_Method_Invocation/3_Static_Invocation_A04_t02: Fail # Runtime error: TypeError: Cannot call method '$call$0' of undefined
+Language/11_Expressions/15_Method_Invocation/3_Static_Invocation_A04_t03: Fail # Runtime error: TypeError: Cannot call method '$call$0' of undefined
+Language/11_Expressions/15_Method_Invocation/3_Static_Invocation_A05_t01: Fail # Runtime error: TypeError: Cannot call method '$call$0' of undefined
+Language/11_Expressions/15_Method_Invocation/3_Static_Invocation_A06_t02: Fail # Runtime error: TypeError: Cannot call method '$call$0' of undefined
+Language/11_Expressions/15_Method_Invocation/4_Super_Invocation_A03_t02: Fail # Runtime error: TypeError: Cannot call method '$call$0' of undefined
+Language/11_Expressions/15_Method_Invocation/4_Super_Invocation_A03_t03: Fail # Runtime error: TypeError: Cannot call method '$call$0' of undefined
+Language/11_Expressions/15_Method_Invocation/4_Super_Invocation_A07_t01: Fail # Runtime error: TypeError: Cannot call method '$call$0' of undefined
+Language/11_Expressions/15_Method_Invocation/4_Super_Invocation_A08_t02: Fail # Runtime error: TypeError: Cannot call method '$call$0' of undefined
+Language/11_Expressions/15_Method_Invocation/4_Super_Invocation_A02_t04: Fail # Runtime error: TypeError: Cannot call method '$call$2' of undefined
+Language/11_Expressions/14_Function_Invocation/4_Function_Expression_Invocation_A03_t01: Fail # Runtime error: TypeError: Object 1 has no method '$call$0'
LibTest/isolate/isolate_api/spawnUri_A01_t01: Fail # Runtime error: UnsupportedError: Currently spawnUri is not supported without web workers.
LibTest/isolate/isolate_api/spawnUri_A01_t02: Fail # Runtime error: UnsupportedError: Currently spawnUri is not supported without web workers.
LibTest/isolate/isolate_api/spawnUri_A01_t03: Fail # Runtime error: UnsupportedError: Currently spawnUri is not supported without web workers.
@@ -464,9 +459,9 @@
# can understand so he can file a bug later.
#
[ $compiler == dart2js ]
-Language/10_Expressions/22_Equality_A01_t01: Fail, OK # Function declaration takes precedence over function expression.
-Language/10_Expressions/28_Postfix_Expressions_A01_t01: Fail, OK # A map literal cannot start an expression statement.
-LibTest/core/String/String_class_A02_t01: Fail, OK # compiler cancelled: Unhandled non-BMP character: U+10000
+Language/11_Expressions/22_Equality_A01_t01: Fail, OK # Function declaration takes precedence over function expression.
+Language/11_Expressions/28_Postfix_Expressions_A01_t01: Fail, OK # A map literal cannot start an expression statement.
+LibTest/core/String/String_class_A02_t01: Pass, Fail, OK # issue 6418 compiler cancelled: Unhandled non-BMP character: U+10000
LibTest/core/String/charCodeAt_A01_t01: Fail, OK # compiler cancelled: Unhandled non-BMP character: U+10000
LibTest/core/String/charCodes_A01_t01: Fail, OK # compiler cancelled: Unhandled non-BMP character: U+10000
@@ -474,31 +469,29 @@
Language/06_Functions/1_Function_Declaration_A03_t03: Fail, OK # co19 issue 210
Language/06_Functions/2_Formal_Parameters/2_Optional_Formals_A01_t14: Fail, OK # co19 issue 210
Language/06_Functions/2_Formal_Parameters/2_Optional_Formals_A01_t15: Fail, OK # co19 issue 210
-Language/10_Expressions/05_Strings/1_String_Interpolation_A01_t09: Fail, OK # co19 issue 210
+Language/11_Expressions/05_Strings/1_String_Interpolation_A01_t09: Fail, OK # co19 issue 210
Language/03_Overview/1_Scoping_A01_t40: Fail, OK # co19 issue 188
Language/03_Overview/1_Scoping_A01_t41: Fail, OK # co19 issue 188
-Language/07_Classes/4_Abstract_Instance_Members_A02_t02: Fail, OK # co19 issue 194
-
Language/06_Functions/4_External_Functions_A01_t01: Fail, OK # http://dartbug.com/5021
-Language/07_Classes/4_Abstract_Instance_Members_A02_t01: Fail, OK # co19 issue 195
-
Language/03_Overview/2_Privacy_A01_t09: Fail, OK # co19 issue 198
Language/03_Overview/2_Privacy_A01_t10: Fail, OK # co19 issue 198
-Language/10_Expressions/11_Instance_Creation/1_New_A12_t01: Fail, OK # co19 issue 273
+Language/11_Expressions/11_Instance_Creation/1_New_A12_t01: Fail, OK # co19 issue 273
LibTest/core/String/hashCode_A01_t01: Fail, OK # co19 issue 273
LibTest/core/int/hashCode_A01_t01: Fail, OK # co19 issue 273
+LibTest/core/NoSuchMethodError/NoSuchMethodError_A01_t01: Fail, OK # co19 issue 300
+LibTest/core/NoSuchMethodError/toString_A01_t01: Fail, OK # co19 issue 300
[ $compiler == dart2js && $jscl ]
LibTest/core/RegExp/Pattern_semantics/firstMatch_CharacterClassEscape_A04_t01: Fail, Pass # issue 3333
LibTest/core/RegExp/Pattern_semantics/firstMatch_CharacterClassEscape_A03_t01: Fail, Pass # issue 3333
-Language/10_Expressions/03_Numbers_A01_t06: Fail, OK # Requires bigint.
-Language/10_Expressions/03_Numbers_A01_t09: Fail, OK # Requires bigint.
+Language/11_Expressions/03_Numbers_A01_t06: Fail, OK # Requires bigint.
+Language/11_Expressions/03_Numbers_A01_t09: Fail, OK # Requires bigint.
LibTest/core/Date/Date_A01_t03: Fail, OK # co19 issue 180
LibTest/core/Date/year_A01_t01: Fail, OK # Requires big int.
LibTest/core/Match/pattern_A01_t01: Fail, OK # Bad test, allMatches return an Iterable.
@@ -530,6 +523,12 @@
Language/07_Classes/1_Instance_Methods/2_Operators_A02_t01: Fail, OK # Expects negative result from bit-operation.
+[ $compiler == dart2js && $system == macos ]
+LibTest/math/acos_A01_t01: Fail, OK # co19 issue 44
+LibTest/math/asin_A01_t01: Fail, OK # co19 issue 44
+LibTest/math/atan_A01_t01: Fail, OK # co19 issue 44
+
+
#
# The following tests are failing. Please add the error message
# (either a compiler error or exception message). The error messages
@@ -544,25 +543,21 @@
Language/03_Overview/2_Privacy_A01_t11: Fail # internal error: super property read not implemented
Language/03_Overview/2_Privacy_A01_t14: Fail # duplicate definition of _(var _)=> _
-Language/10_Expressions/01_Constants_A12_t01: Fail # internal error: CompileTimeConstantEvaluator not implemented
-Language/10_Expressions/14_Function_Invocation/2_Binding_Actuals_to_Formals_A01_t01: Fail # Unimplemented non-matching static call
-Language/10_Expressions/14_Function_Invocation/2_Binding_Actuals_to_Formals_A01_t04: Fail # Unimplemented non-matching static call
-Language/10_Expressions/14_Function_Invocation/2_Binding_Actuals_to_Formals_A01_t05: Fail # Unimplemented non-matching static call
-Language/10_Expressions/22_Equality_A05_t01: Fail # != cannot be called on super
-Language/10_Expressions/27_Unary_Expressions_A01_t01: Fail # ! cannot be called on super
-Language/10_Expressions/27_Unary_Expressions_A01_t10: Fail # cannot deal with super in complex assignments
-Language/10_Expressions/30_Identifier_Reference_A02_t01: Fail # Pseudo keyword "abstract".
+Language/11_Expressions/01_Constants_A12_t01: Fail # internal error: CompileTimeConstantEvaluator not implemented
+Language/11_Expressions/22_Equality_A05_t01: Fail # != cannot be called on super
+Language/11_Expressions/27_Unary_Expressions_A01_t01: Fail # ! cannot be called on super
+Language/11_Expressions/27_Unary_Expressions_A01_t10: Fail # cannot deal with super in complex assignments
+Language/11_Expressions/30_Identifier_Reference_A02_t01: Fail # Pseudo keyword "abstract".
[ $compiler == dart2js && $jscl ]
LibTest/core/Date/Date.fromString_A03_t01: Fail # Issue co19 - 121
-LibTest/core/Expect/throws_A02_t01: Fail # reason (sdsds sd dsf) not mentioned in ExpectException message (Expect.isTrue(false) fails.)
LibTest/core/RegExp/Pattern_semantics/firstMatch_CharacterEscape_A06_t02: Fail # IllegalJSRegExpException: '\c(' 'SyntaxError: Invalid regular expression: /\c(/: Unterminated group'
LibTest/core/RegExp/Pattern_semantics/firstMatch_DecimalEscape_A01_t02: Fail # Expect.fail('Some exception expected')
LibTest/core/RegExp/Pattern_semantics/firstMatch_NonEmptyClassRanges_A01_t05: Fail # Expect.fail('Some exception expected')
LibTest/core/RegExp/Pattern_semantics/firstMatch_NonEmptyClassRanges_A01_t06: Fail # Expect.fail('Some exception expected')
-Language/10_Expressions/06_Lists_A07_t02: Fail # generic type information is lost during canonicalization.
-Language/10_Expressions/07_Maps_A06_t02: Fail # generic type information is lost during canonicalization.
+Language/11_Expressions/06_Lists_A07_t02: Fail # generic type information is lost during canonicalization.
+Language/11_Expressions/07_Maps_A06_t02: Fail # generic type information is lost during canonicalization.
#
# The following tests may be broken, but require further review.
@@ -586,23 +581,7 @@
Language/05_Variables/05_Variables_A01_t13: Fail # Checks that variable declaration cannot contain both 'const' and 'final'.
Language/05_Variables/05_Variables_A01_t14: Fail # Checks that variable declaration cannot contain 'const', 'final' and 'var' simultaneously.
Language/05_Variables/05_Variables_A01_t15: Fail # Checks that a variable declaration cannot contain the 'abstract' keyword.
-Language/05_Variables/05_Variables_A03_t01: Fail # Checks that a compile-time error occurs if local final variable is redefined.
-Language/05_Variables/05_Variables_A03_t02: Fail # Checks that a compile-time error occurs if local final variable is not assigned.
-Language/05_Variables/05_Variables_A03_t04: Fail # Checks that a compile-time error occurs if a global final variable is not assigned.
-Language/05_Variables/05_Variables_A03_t05: Fail # Checks that a compile-time error occurs if local typed final variable is redefined.
-Language/05_Variables/05_Variables_A03_t06: Fail # Checks that a compile-time error occurs if local typed final variable is not assigned.
-Language/05_Variables/05_Variables_A03_t07: Fail # Checks that a compile-time error occurs if a global typed final variable is redefined.
-Language/05_Variables/05_Variables_A03_t08: Fail # Checks that a compile-time error occurs if a global typed final variable is not assigned.
-Language/05_Variables/05_Variables_A03_t10: Fail # Checks that assigning a final variable to the same value it already holds still produces a compile-time error.
Language/05_Variables/05_Variables_A04_t01: Fail # Checks that a compile-time error occurs if a local constant variable is redefined.
-Language/05_Variables/05_Variables_A04_t02: Fail # Checks that a compile-time error occurs if a local typed constant variable is redefined.
-Language/05_Variables/05_Variables_A04_t03: Fail # Checks that a compile-time error occurs if a global constant variable is redefined.
-Language/05_Variables/05_Variables_A04_t04: Fail # Checks that a compile-time error occurs if a global typed constant variable is redefined.
-Language/05_Variables/05_Variables_A04_t05: Fail # Checks that a compile-time error occurs if a local constant variable is not initialized at declaration.
-Language/05_Variables/05_Variables_A04_t06: Fail # Checks that a compile-time error occurs if a local typed constant variable is not initialized at declaration.
-Language/05_Variables/05_Variables_A04_t07: Fail # Checks that a compile-time error occurs if a global constant variable is not initialized at declaration.
-Language/05_Variables/05_Variables_A04_t08: Fail # Checks that a compile-time error occurs if a global typed constant variable is not initialized at declaration.
-Language/05_Variables/05_Variables_A04_t10: Fail # Checks that assigning a constant variable to the same value it already holds still produces a compile-time error.
Language/05_Variables/05_Variables_A05_t01: Fail # Checks that a compile-time error occurs if a constant variable is not initialized.
Language/06_Functions/06_Functions_A01_t31: Fail # Checks that functions can't be declared as static inside of a function body.
Language/06_Functions/1_Function_Declaration_A01_t01: Fail # Checks that it is a compile-time error to preface library function with 'static'.
@@ -619,6 +598,7 @@
Language/06_Functions/2_Formal_Parameters/2_Optional_Formals_A03_t02: Fail # Checks that it is a compile-time error if the name of a positional optional parameter begins with an '_' character.
Language/06_Functions/2_Formal_Parameters_A03_t01: Fail # Checks that it is a compile-time error if a required parameter is declared as a constant variable.
Language/06_Functions/2_Formal_Parameters_A03_t02: Fail # Checks that it is a compile-time error if a required parameter is declared as a constant typed variable.
+Language/06_Functions/2_Formal_Parameters_A03_t05: Fail # Checks that it is a compile-time error if an optional named parameter is declared as a constant typed variable.
Language/06_Functions/2_Formal_Parameters_A03_t05: Fail # Checks that it is a compile-time error if an optional positional parameter is declared as a constant variable.
Language/07_Classes/07_Classes_A02_t02: Fail # Checks that it is a compile-time error if a constant constructor declaration includes a body.
Language/07_Classes/07_Classes_A02_t04: Fail # Checks that it is a compile-time error if a constant constructor declaration with initializers includes a body.
@@ -636,7 +616,7 @@
Language/07_Classes/1_Instance_Methods/2_Operators_A07_t01: Fail # Checks that a compile-time error is produced if a user-defined operator [] specifies an optional named parameter.
Language/07_Classes/1_Instance_Methods/2_Operators_A07_t02: Fail # Checks that a compile-time error is produced if a user-defined operator [] specifies an optional named parameter in addition to the required one.
Language/07_Classes/1_Instance_Methods/2_Operators_A07_t03: Fail # Checks that a compile-time error is produced if a user-defined operator []= specifies one optional named parameter.
-Language/07_Classes/1_Instance_Methods/2_Operators_A07_t04: Fail # Checks that a compile-time error is produced if a user-defined operator []= specifies one optional named parameter in addition to the two required ones.
+Language/07_Classes/1_Instance_Methods/2_Operators_A07_t04: Fail # Checks that a compile-time error is produced if a user-defined operator []= specifies one optional named parameter in addition to the two required ones
Language/07_Classes/1_Instance_Methods_A02_t01: Fail # Checks that a compile-time error is produced if m1 has fewer named parameters than m2 (2 vs 3) and neither have any required parameters.
Language/07_Classes/1_Instance_Methods_A02_t02: Fail # Checks that a compile-time error is produced if m1 has fewer named parameters than m2 (1 vs. 0) and neither have any required parameters.
Language/07_Classes/1_Instance_Methods_A02_t05: Fail # Checks that a compile-time error is produced if m1 has almost the same set of named parameters as m2 except for one of them having a different name.
@@ -666,20 +646,20 @@
Language/07_Classes/6_Constructors_A01_t01: Fail # Checks that a compile-error is produced when a constructor's id coincides with the name of a field in the same class.
Language/07_Classes/6_Constructors_A02_t01: Fail # Checks that a compile-error is produced when a named constructor definition does not begin with the name of its class.
Language/07_Classes/6_Constructors/1_Generative_Constructors_A16_t07: Fail # http://dartbug.com/6242
-Language/10_Expressions/01_Constants_A16_t01: Fail # Checks that an IntegerDivisionByZeroException raised during evaluation of a compile-time constant causes a compile-time error.
-Language/10_Expressions/01_Constants_A16_t02: Fail # Checks that an OutOfMemoryException raised during evaluation of a compile-time constant causes a compile-time error.
-Language/10_Expressions/05_Strings_A02_t46: Fail # Checks that multi-line strings that contain characters and sequences prohibited by this grammar, cause compile-time errors.
-Language/10_Expressions/05_Strings_A02_t48: Fail # Checks that multi-line strings that contain characters and sequences prohibited by this grammar, cause compile-time errors.
-Language/10_Expressions/06_Lists_A04_t01: Fail # Checks that it is a compile-time error if the type argument of a constant list literal includes a type variable.
-Language/10_Expressions/15_Method_Invocation/3_Static_Invocation_A03_t04: Fail # Checks that it is a static warning if interface C does not declare a static method or getter m.
-Language/10_Expressions/22_Equality_A01_t15: Fail # Checks that equality expressions cannot be operands of another equality expression.
-Language/10_Expressions/22_Equality_A01_t16: Fail # Checks that equality expressions cannot be operands of another equality expression.
-Language/10_Expressions/23_Relational_Expressions_A01_t10: Fail # Checks that a relational expression cannot be the operand of another relational expression.
-Language/10_Expressions/23_Relational_Expressions_A01_t11: Fail # Checks that a relational expression cannot be the operand of another relational expression.
-Language/10_Expressions/23_Relational_Expressions_A01_t12: Fail # Checks that a relational expression cannot be the operand of another relational expression.
-Language/10_Expressions/23_Relational_Expressions_A01_t13: Fail # Checks that a relational expression cannot be the operand of another relational expression.
-Language/10_Expressions/30_Identifier_Reference_A07_t01: Fail # Checks that it is a compile-time error when a built-in identifier "abstract" is used as a type annotation of a local variable.
-Language/11_Statements/03_Variable_Declaration_A04_t01: Fail # Checks that if the variable declaration is prefixed with the const modifier, then variable must be initialized to a constant expression.
+Language/11_Expressions/01_Constants_A16_t01: Fail # Checks that an IntegerDivisionByZeroException raised during evaluation of a compile-time constant causes a compile-time error.
+Language/11_Expressions/01_Constants_A16_t02: Fail # Checks that an OutOfMemoryException raised during evaluation of a compile-time constant causes a compile-time error.
+Language/11_Expressions/05_Strings_A02_t46: Fail # Checks that multi-line strings that contain characters and sequences prohibited by this grammar, cause compile-time errors.
+Language/11_Expressions/05_Strings_A02_t48: Fail # Checks that multi-line strings that contain characters and sequences prohibited by this grammar, cause compile-time errors.
+Language/11_Expressions/06_Lists_A04_t01: Fail # Checks that it is a compile-time error if the type argument of a constant list literal includes a type variable.
+Language/11_Expressions/15_Method_Invocation/3_Static_Invocation_A03_t04: Fail # Checks that it is a static warning if interface C does not declare a static method or getter m.
+Language/11_Expressions/22_Equality_A01_t15: Fail # Checks that equality expressions cannot be operands of another equality expression.
+Language/11_Expressions/22_Equality_A01_t16: Fail # Checks that equality expressions cannot be operands of another equality expression.
+Language/11_Expressions/23_Relational_Expressions_A01_t10: Fail # Checks that a relational expression cannot be the operand of another relational expression.
+Language/11_Expressions/23_Relational_Expressions_A01_t11: Fail # Checks that a relational expression cannot be the operand of another relational expression.
+Language/11_Expressions/23_Relational_Expressions_A01_t12: Fail # Checks that a relational expression cannot be the operand of another relational expression.
+Language/11_Expressions/23_Relational_Expressions_A01_t13: Fail # Checks that a relational expression cannot be the operand of another relational expression.
+Language/11_Expressions/30_Identifier_Reference_A07_t01: Fail # Checks that it is a compile-time error when a built-in identifier "abstract" is used as a type annotation of a local variable.
+Language/12_Statements/03_Variable_Declaration_A04_t01: Fail # Checks that if the variable declaration is prefixed with the const modifier, then variable must be initialized to a constant expression.
Language/14_Types/3_Type_Declarations/1_Typedef_A07_t01: Fail # Checks that self-referencing typedef is not allowed (return value type annotation has the same name as a type alias).
Language/14_Types/3_Type_Declarations/1_Typedef_A07_t02: Fail # Checks that self-referencing typedef is not allowed (positional formal parameter type annotation has the same name as a type alias).
Language/14_Types/3_Type_Declarations/1_Typedef_A07_t03: Fail # Checks that self-referencing typedef is not allowed (optional formal parameter type annotation has the same name as a type alias).
@@ -690,18 +670,14 @@
# Unexpected compile-time errors.
#
[ $compiler == dart2js ]
-Language/10_Expressions/15_Method_Invocation/3_Static_Invocation_A03_t03: Fail # http://dartbug.com/5027
-Language/10_Expressions/15_Method_Invocation/3_Static_Invocation_A03_t06: Fail # http://dartbug.com/5027
+Language/11_Expressions/14_Function_Invocation/2_Binding_Actuals_to_Formals_A04_t01: Fail # Checks that it is a compile-time error if there are two named arguments with the same name in a function invocation expression.
+Language/11_Expressions/15_Method_Invocation/3_Static_Invocation_A03_t03: Fail # http://dartbug.com/5027
+Language/11_Expressions/15_Method_Invocation/3_Static_Invocation_A03_t06: Fail # http://dartbug.com/5027
Language/14_Types/2_Dynamic_Type_System_A02_t01: Fail # http://dartbug.com/5029
-Language/10_Expressions/15_Method_Invocation/4_Super_Invocation_A04_t03: Fail # http://dartbug.com/3566
-Language/10_Expressions/15_Method_Invocation/4_Super_Invocation_A04_t04: Fail # http://dartbug.com/3566
-
Language/03_Overview/03_Overview_A01_t01: Fail # http://dartbug.com/3903
-Language/06_Functions/2_Formal_Parameters/2_Optional_Formals_A01_t01: Fail # http://dartbug.com/5026
-
Language/07_Classes/3_Setters_A04_t01: Fail # http://dartbug.com/5023
Language/07_Classes/3_Setters_A04_t02: Fail # http://dartbug.com/5023
Language/07_Classes/3_Setters_A04_t03: Fail # http://dartbug.com/5023
diff --git a/tests/co19/co19-runtime.status b/tests/co19/co19-runtime.status
index 51b34ca..0666c0c 100644
--- a/tests/co19/co19-runtime.status
+++ b/tests/co19/co19-runtime.status
@@ -26,12 +26,11 @@
Language/13_Libraries_and_Scripts/1_Imports_A02_t21: Crash # TODO(vm-team): Please triage this crash.
Language/13_Libraries_and_Scripts/1_Imports_A02_t22: Crash # TODO(vm-team): Please triage this crash.
-Language/03_Overview/1_Scoping_A02_t05: Fail # TODO(vm-team): Please triage this failure.
-Language/05_Variables/05_Variables_A03_t04: Fail # TODO(vm-team): Please triage this failure.
-Language/05_Variables/05_Variables_A03_t11: Fail # TODO(vm-team): Please triage this failure.
-Language/05_Variables/05_Variables_A03_t13: Fail # TODO(vm-team): Please triage this failure.
-Language/05_Variables/05_Variables_A03_t14: Fail # TODO(vm-team): Please triage this failure.
-Language/05_Variables/05_Variables_A03_t15: Fail # TODO(vm-team): Please triage this failure.
+Language/05_Variables/05_Variables_A05_t04: Fail # TODO(vm-team): Please triage this failure.
+Language/05_Variables/05_Variables_A05_t11: Fail # TODO(vm-team): Please triage this failure.
+Language/05_Variables/05_Variables_A05_t13: Fail # TODO(vm-team): Please triage this failure.
+Language/05_Variables/05_Variables_A05_t14: Fail # TODO(vm-team): Please triage this failure.
+Language/05_Variables/05_Variables_A05_t15: Fail # TODO(vm-team): Please triage this failure.
Language/05_Variables/1_Evaluation_of_Implicit_Variable_Getters_A01_t02: Fail # TODO(vm-team): Please triage this failure.
Language/05_Variables/1_Evaluation_of_Implicit_Variable_Getters_A01_t05: Fail # TODO(vm-team): Please triage this failure.
Language/07_Classes/2_Getters_A01_t03: Fail # TODO(vm-team): Please triage this failure.
@@ -59,121 +58,111 @@
Language/07_Classes/6_Constructors/3_Constant_Constructors_A05_t01: Fail # TODO(vm-team): Please triage this failure.
Language/07_Classes/6_Constructors/3_Constant_Constructors_A05_t02: Fail # TODO(vm-team): Please triage this failure.
Language/08_Interfaces/5_Superinterfaces_A01_t02: Fail # TODO(vm-team): Please triage this failure.
-Language/09_Generics/09_Generics_A05_t01: Fail # TODO(vm-team): Please triage this failure.
-Language/09_Generics/09_Generics_A05_t02: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/01_Constants_A03_t01: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/01_Constants_A05_t01: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/01_Constants_A06_t01: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/01_Constants_A14_t01: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/05_Strings/1_String_Interpolation_A01_t04: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/05_Strings/1_String_Interpolation_A01_t05: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/05_Strings/1_String_Interpolation_A01_t06: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/05_Strings_A02_t46: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/05_Strings_A02_t48: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/09_Function_Expressions_A03_t02: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/09_Function_Expressions_A04_t02: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/11_Instance_Creation/1_New_A02_t03: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/11_Instance_Creation/1_New_A02_t05: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/11_Instance_Creation/1_New_A09_t09: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/11_Instance_Creation/2_Const_A10_t01: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/14_Function_Invocation/3_Unqualified_Invocation_A01_t03: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/14_Function_Invocation/4_Function_Expression_Invocation_A03_t01: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/14_Function_Invocation/4_Function_Expression_Invocation_A05_t02: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/15_Method_Invocation/3_Static_Invocation_A04_t08: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/15_Method_Invocation/4_Super_Invocation_A04_t03: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/15_Method_Invocation/4_Super_Invocation_A04_t04: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/17_Getter_Invocation_A02_t01: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/17_Getter_Invocation_A02_t02: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/18_Assignment_A05_t02: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/18_Assignment_A05_t04: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/18_Assignment_A05_t05: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/18_Assignment_A08_t04: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/19_Conditional_A01_t10: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/19_Conditional_A01_t11: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/19_Conditional_A01_t12: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/19_Conditional_A01_t13: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/19_Conditional_A01_t14: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/19_Conditional_A01_t15: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/20_Logical_Boolean_Expressions_A01_t10: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/20_Logical_Boolean_Expressions_A01_t11: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/20_Logical_Boolean_Expressions_A01_t12: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/20_Logical_Boolean_Expressions_A01_t13: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/20_Logical_Boolean_Expressions_A01_t14: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/21_Bitwise_Expressions_A01_t12: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/21_Bitwise_Expressions_A01_t13: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/21_Bitwise_Expressions_A01_t14: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/21_Bitwise_Expressions_A01_t15: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/21_Bitwise_Expressions_A01_t16: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/21_Bitwise_Expressions_A01_t17: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/22_Equality_A01_t23: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/22_Equality_A01_t24: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/23_Relational_Expressions_A01_t18: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/23_Relational_Expressions_A01_t19: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/23_Relational_Expressions_A01_t20: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/23_Relational_Expressions_A01_t21: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/23_Relational_Expressions_A01_t22: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/23_Relational_Expressions_A01_t23: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/24_Shift_A01_t09: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/24_Shift_A01_t10: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/24_Shift_A01_t11: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/24_Shift_A01_t12: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/24_Shift_A01_t13: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/24_Shift_A01_t14: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/25_Additive_Expressions_A01_t07: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/25_Additive_Expressions_A01_t08: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/25_Additive_Expressions_A01_t11: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/25_Additive_Expressions_A01_t12: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/25_Additive_Expressions_A01_t13: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/25_Additive_Expressions_A01_t14: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/26_Multiplicative_Expressions_A01_t10: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/26_Multiplicative_Expressions_A01_t11: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/26_Multiplicative_Expressions_A01_t14: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/26_Multiplicative_Expressions_A01_t15: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/26_Multiplicative_Expressions_A01_t16: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/26_Multiplicative_Expressions_A01_t17: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/27_Unary_Expressions_A01_t02: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/27_Unary_Expressions_A01_t04: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/27_Unary_Expressions_A01_t05: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/27_Unary_Expressions_A01_t11: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/27_Unary_Expressions_A01_t12: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/27_Unary_Expressions_A01_t13: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/27_Unary_Expressions_A01_t17: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/27_Unary_Expressions_A01_t18: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/27_Unary_Expressions_A01_t19: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/27_Unary_Expressions_A01_t20: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/27_Unary_Expressions_A01_t21: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/27_Unary_Expressions_A01_t22: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/28_Postfix_Expressions_A01_t02: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/28_Postfix_Expressions_A01_t03: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/28_Postfix_Expressions_A01_t05: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/29_Assignable_Expressions_A01_t06: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/29_Assignable_Expressions_A01_t08: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/29_Assignable_Expressions_A01_t09: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/30_Identifier_Reference_A04_t09: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/30_Identifier_Reference_A05_t02: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/30_Identifier_Reference_A05_t08: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/30_Identifier_Reference_A06_t01: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/30_Identifier_Reference_A06_t02: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/30_Identifier_Reference_A07_t01: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/30_Identifier_Reference_A08_t02: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/31_Type_Test_A01_t02: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/31_Type_Test_A01_t04: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/31_Type_Test_A05_t01: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/31_Type_Test_A05_t02: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/31_Type_Test_A05_t03: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/32_Type_Cast_A04_t01: Fail # TODO(vm-team): Please triage this failure.
-Language/10_Expressions/32_Type_Cast_A04_t02: Fail # TODO(vm-team): Please triage this failure.
-Language/11_Statements/04_Local_Function_Declaration_A02_t02: Fail # TODO(vm-team): Please triage this failure.
-Language/11_Statements/06_For_A01_t11: Fail # TODO(vm-team): Please triage this failure.
-Language/11_Statements/09_Switch_A01_t02: Fail # TODO(vm-team): Please triage this failure.
-Language/11_Statements/09_Switch_A02_t01: Fail # TODO(vm-team): Please triage this failure.
-Language/11_Statements/09_Switch_A02_t02: Fail # TODO(vm-team): Please triage this failure.
-Language/11_Statements/09_Switch_A02_t03: Fail # TODO(vm-team): Please triage this failure.
-Language/11_Statements/09_Switch_A03_t01: Fail # TODO(vm-team): Please triage this failure.
-Language/11_Statements/09_Switch_A03_t02: Fail # TODO(vm-team): Please triage this failure.
-Language/11_Statements/09_Switch_A06_t02: Fail # TODO(vm-team): Please triage this failure.
-Language/11_Statements/10_Try_A11_t01: Fail # TODO(vm-team): Please triage this failure.
-Language/11_Statements/12_Labels_A01_t03: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/01_Constants_A03_t01: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/01_Constants_A05_t01: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/01_Constants_A06_t01: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/01_Constants_A14_t01: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/05_Strings/1_String_Interpolation_A01_t04: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/05_Strings/1_String_Interpolation_A01_t05: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/05_Strings/1_String_Interpolation_A01_t06: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/05_Strings_A02_t46: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/05_Strings_A02_t48: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/11_Instance_Creation/1_New_A02_t03: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/11_Instance_Creation/1_New_A02_t05: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/11_Instance_Creation/1_New_A09_t09: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/11_Instance_Creation/2_Const_A10_t01: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/14_Function_Invocation/4_Function_Expression_Invocation_A03_t01: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/14_Function_Invocation/4_Function_Expression_Invocation_A05_t02: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/15_Method_Invocation/3_Static_Invocation_A04_t08: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/17_Getter_Invocation_A02_t01: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/18_Assignment_A05_t02: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/18_Assignment_A05_t04: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/18_Assignment_A05_t05: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/19_Conditional_A01_t10: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/19_Conditional_A01_t11: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/19_Conditional_A01_t12: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/19_Conditional_A01_t13: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/19_Conditional_A01_t14: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/19_Conditional_A01_t15: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/20_Logical_Boolean_Expressions_A01_t10: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/20_Logical_Boolean_Expressions_A01_t11: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/20_Logical_Boolean_Expressions_A01_t12: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/20_Logical_Boolean_Expressions_A01_t13: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/20_Logical_Boolean_Expressions_A01_t14: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/21_Bitwise_Expressions_A01_t12: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/21_Bitwise_Expressions_A01_t13: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/21_Bitwise_Expressions_A01_t14: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/21_Bitwise_Expressions_A01_t15: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/21_Bitwise_Expressions_A01_t16: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/21_Bitwise_Expressions_A01_t17: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/22_Equality_A01_t23: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/22_Equality_A01_t24: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/23_Relational_Expressions_A01_t18: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/23_Relational_Expressions_A01_t19: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/23_Relational_Expressions_A01_t20: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/23_Relational_Expressions_A01_t21: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/23_Relational_Expressions_A01_t22: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/23_Relational_Expressions_A01_t23: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/24_Shift_A01_t09: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/24_Shift_A01_t10: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/24_Shift_A01_t11: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/24_Shift_A01_t12: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/24_Shift_A01_t13: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/24_Shift_A01_t14: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/25_Additive_Expressions_A01_t07: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/25_Additive_Expressions_A01_t08: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/25_Additive_Expressions_A01_t11: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/25_Additive_Expressions_A01_t12: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/25_Additive_Expressions_A01_t13: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/25_Additive_Expressions_A01_t14: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/26_Multiplicative_Expressions_A01_t10: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/26_Multiplicative_Expressions_A01_t11: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/26_Multiplicative_Expressions_A01_t14: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/26_Multiplicative_Expressions_A01_t15: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/26_Multiplicative_Expressions_A01_t16: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/26_Multiplicative_Expressions_A01_t17: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/27_Unary_Expressions_A01_t02: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/27_Unary_Expressions_A01_t04: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/27_Unary_Expressions_A01_t05: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/27_Unary_Expressions_A01_t11: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/27_Unary_Expressions_A01_t12: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/27_Unary_Expressions_A01_t13: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/27_Unary_Expressions_A01_t17: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/27_Unary_Expressions_A01_t18: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/27_Unary_Expressions_A01_t19: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/27_Unary_Expressions_A01_t20: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/27_Unary_Expressions_A01_t21: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/27_Unary_Expressions_A01_t22: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/28_Postfix_Expressions_A01_t02: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/28_Postfix_Expressions_A01_t03: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/28_Postfix_Expressions_A01_t05: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/29_Assignable_Expressions_A01_t06: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/29_Assignable_Expressions_A01_t08: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/29_Assignable_Expressions_A01_t09: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/30_Identifier_Reference_A05_t02: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/30_Identifier_Reference_A05_t08: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/30_Identifier_Reference_A06_t01: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/30_Identifier_Reference_A06_t02: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/30_Identifier_Reference_A07_t01: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/30_Identifier_Reference_A08_t02: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/31_Type_Test_A01_t02: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/31_Type_Test_A01_t04: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/31_Type_Test_A05_t01: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/31_Type_Test_A05_t02: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/31_Type_Test_A05_t03: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/32_Type_Cast_A04_t01: Fail # TODO(vm-team): Please triage this failure.
+Language/11_Expressions/32_Type_Cast_A04_t02: Fail # TODO(vm-team): Please triage this failure.
+Language/12_Statements/04_Local_Function_Declaration_A02_t02: Fail # TODO(vm-team): Please triage this failure.
+Language/12_Statements/06_For_A01_t11: Fail # TODO(vm-team): Please triage this failure.
+Language/12_Statements/09_Switch_A01_t02: Fail # TODO(vm-team): Please triage this failure.
+Language/12_Statements/09_Switch_A02_t01: Fail # TODO(vm-team): Please triage this failure.
+Language/12_Statements/09_Switch_A02_t02: Fail # TODO(vm-team): Please triage this failure.
+Language/12_Statements/09_Switch_A02_t03: Fail # TODO(vm-team): Please triage this failure.
+Language/12_Statements/09_Switch_A03_t01: Fail # TODO(vm-team): Please triage this failure.
+Language/12_Statements/09_Switch_A03_t02: Fail # TODO(vm-team): Please triage this failure.
+Language/12_Statements/09_Switch_A06_t02: Fail # TODO(vm-team): Please triage this failure.
+Language/12_Statements/10_Try_A11_t01: Fail # TODO(vm-team): Please triage this failure.
+Language/12_Statements/12_Labels_A01_t03: Fail # TODO(vm-team): Please triage this failure.
Language/13_Libraries_and_Scripts/13_Libraries_and_Scripts_A03_t01: Fail # TODO(vm-team): Please triage this failure.
Language/13_Libraries_and_Scripts/13_Libraries_and_Scripts_A05_t04: Fail # TODO(vm-team): Please triage this failure.
Language/13_Libraries_and_Scripts/1_Imports_A01_t53: Fail # TODO(vm-team): Please triage this failure.
@@ -211,15 +200,16 @@
LibTest/isolate/isolate_api/port_A01_t01: Skip # Times out.
+LibTest/core/String/String_class_A02_t01: Fail, OK # co19 issue 284
+LibTest/core/String/charCodeAt_A01_t01: Fail, OK # co19 issue 284
+LibTest/core/String/charCodes_A01_t01: Fail, OK # co19 issue 284
+
Language/06_Functions/1_Function_Declaration_A02_t03: Fail # issue 6058
Language/06_Functions/1_Function_Declaration_A03_t03: Fail # issue 6058
Language/06_Functions/2_Formal_Parameters/2_Optional_Formals_A03_t01: Fail # issue 6085
Language/06_Functions/2_Formal_Parameters/2_Optional_Formals_A03_t02: Fail # issue 6085
Language/06_Functions/2_Formal_Parameters/2_Optional_Formals_A03_t03: Fail # issue 6085
-LibTest/core/Map/putIfAbsent_A01_t08: Fail, OK # co19 issue 276
-LibTest/core/Map/putIfAbsent_A01_t06: Fail, OK # co19 issue 276
-
LibTest/core/EmptyQueueException/EmptyQueueException_A01_t01: Fail, OK # co19 issue 288
LibTest/core/EmptyQueueException/toString_A01_t01: Fail, OK # co19 issue 288
LibTest/core/List/iterator_next_A02_t01: Fail, OK # co19 issue 288
@@ -229,24 +219,25 @@
LibTest/core/Queue/removeFirst_A02_t01: Fail, OK # co19 issue 288
LibTest/core/Queue/removeLast_A02_t01: Fail, OK # co19 issue 288
+LibTest/core/NoSuchMethodError/NoSuchMethodError_A01_t01: Fail, OK # co19 issue 300
+LibTest/core/NoSuchMethodError/toString_A01_t01: Fail, OK # co19 issue 300
[ $compiler == none && $runtime == vm && $checked ]
-Language/07_Classes/6_Constructors/2_Factories_A03_t05: Fail # TODO(vm-team): Please triage this failure.
-Language/11_Statements/05_If_A02_t01: Fail # TODO(vm-team): Please triage this failure.
-Language/11_Statements/09_Switch_A05_t01: Fail # TODO(vm-team): Please triage this failure.
-Language/11_Statements/15_Assert_A04_t04: Fail # TODO(vm-team): Please triage this failure.
+Language/12_Statements/05_If_A02_t01: Fail # TODO(vm-team): Please triage this failure.
+Language/12_Statements/09_Switch_A05_t01: Fail # TODO(vm-team): Please triage this failure.
Language/14_Types/7_Type_Void_A04_t02: Fail # TODO(vm-team): Please triage this failure.
Language/14_Types/7_Type_Void_A04_t03: Fail # TODO(vm-team): Please triage this failure.
Language/14_Types/7_Type_Void_A04_t04: Fail # TODO(vm-team): Please triage this failure.
Language/14_Types/7_Type_Void_A04_t05: Fail # TODO(vm-team): Please triage this failure.
LibTest/core/Map/putIfAbsent_A01_t07: Fail # TODO(vm-team): Please triage this failure.
+LibTest/core/Map/putIfAbsent_A01_t08: Fail # TODO(vm-team): Please triage this failure.
Language/14_Types/7_Type_Void_A04_t02: Fail, OK # co19 issue 158
Language/14_Types/7_Type_Void_A04_t03: Fail, OK # co19 issue 158
Language/14_Types/7_Type_Void_A04_t04: Fail, OK # co19 issue 158
Language/14_Types/7_Type_Void_A04_t05: Fail, OK # co19 issue 158
-Language/10_Expressions/11_Instance_Creation_A05_t02: Fail # co19 issue 234
+Language/11_Expressions/11_Instance_Creation_A05_t02: Fail # co19 issue 234
[ $compiler == none && $runtime == vm && $unchecked ]
Language/14_Types/2_Dynamic_Type_System_A02_t01: Fail # TODO(vm-team): Please triage this failure.
@@ -255,13 +246,13 @@
[ $compiler == none && $runtime == vm ]
# Not properly reporting exception in initializer expressions
-Language/10_Expressions/01_Constants_A16_t01: Fail
-Language/10_Expressions/01_Constants_A16_t02: Fail
+Language/11_Expressions/01_Constants_A16_t01: Fail
+Language/11_Expressions/01_Constants_A16_t02: Fail
Language/07_Classes/6_Constructors/3_Constant_Constructors_A05_t03: Fail # issue 392, potentially constant expression analysis
-Language/10_Expressions/01_Constants_A17_t03: Crash # issue 1681 (recursion in compile-time constant expression)
-Language/10_Expressions/01_Constants_A16_t02: Crash, Pass # Should result in OOM
+Language/11_Expressions/01_Constants_A17_t03: Crash # issue 1681 (recursion in compile-time constant expression)
+Language/11_Expressions/01_Constants_A16_t02: Crash, Pass # Should result in OOM
# co19 issue 183 - must not instantiate an abstract class
# Some of these tests are expected to fail for another reason. These are marked as Skip.
@@ -269,28 +260,25 @@
Language/07_Classes/07_Classes_A02_t31: Skip # co19 issue 183
# co19 175 - related to issue 4522, all need fixing, some passes because of temporary warning.
-Language/10_Expressions/07_Maps_A03_t01: Pass, Fail # co19 175
-Language/10_Expressions/07_Maps_A04_t01: Pass, Fail # co19 175
-Language/10_Expressions/07_Maps_A04_t02: Pass, Fail # co19 175
-Language/10_Expressions/07_Maps_A06_t01: Pass, Fail # co19 175
-Language/10_Expressions/07_Maps_A06_t02: Pass, Fail # co19 175
-Language/10_Expressions/07_Maps_A07_t04: Pass, Fail # co19 175
-Language/10_Expressions/07_Maps_A07_t03: Pass, Fail # co19 175
-Language/10_Expressions/07_Maps_A08_t01: Pass, Fail # co19 175
-Language/10_Expressions/07_Maps_A10_t01: Pass, Fail # co19 175
-Language/10_Expressions/07_Maps_A10_t02: Pass, Fail # co19 175
-Language/10_Expressions/07_Maps_A10_t03: Pass, Fail # co19 175
-Language/10_Expressions/07_Maps_A10_t04: Pass, Fail # co19 175
-Language/10_Expressions/07_Maps_A10_t05: Pass, Fail # co19 175
+Language/11_Expressions/07_Maps_A03_t01: Pass, Fail # co19 175
+Language/11_Expressions/07_Maps_A04_t01: Pass, Fail # co19 175
+Language/11_Expressions/07_Maps_A04_t02: Pass, Fail # co19 175
+Language/11_Expressions/07_Maps_A06_t01: Pass, Fail # co19 175
+Language/11_Expressions/07_Maps_A06_t02: Pass, Fail # co19 175
+Language/11_Expressions/07_Maps_A07_t04: Pass, Fail # co19 175
+Language/11_Expressions/07_Maps_A07_t03: Pass, Fail # co19 175
+Language/11_Expressions/07_Maps_A08_t01: Pass, Fail # co19 175
+Language/11_Expressions/07_Maps_A10_t01: Pass, Fail # co19 175
+Language/11_Expressions/07_Maps_A10_t02: Pass, Fail # co19 175
+Language/11_Expressions/07_Maps_A10_t03: Pass, Fail # co19 175
+Language/11_Expressions/07_Maps_A10_t04: Pass, Fail # co19 175
+Language/11_Expressions/07_Maps_A10_t05: Pass, Fail # co19 175
-Language/10_Expressions/05_Strings_A02_t01: Skip # co19 issue 90.
-Language/10_Expressions/07_Maps_A01_t01: Skip # co19 issue 91: map literals illegal at statement beginning.
+Language/11_Expressions/05_Strings_A02_t01: Skip # co19 issue 90.
+Language/11_Expressions/07_Maps_A01_t01: Skip # co19 issue 91: map literals illegal at statement beginning.
-Language/10_Expressions/14_Function_Invocation/4_Function_Expression_Invocation_A05_t01: Fail # issue 1604.
-Language/10_Expressions/27_Unary_Expressions_A01_t01: Fail # issue 1288 (unary super operator call)
-Language/10_Expressions/27_Unary_Expressions_A01_t10: Fail # issue 2037 (super.x is assignable)
-Language/10_Expressions/27_Unary_Expressions_A08_t01: Fail # issue 1288 (unary super operator call)
-Language/10_Expressions/28_Postfix_Expressions_A01_t01: Fail # co19 issue 91: map literals illegal at statement beginning.
+Language/11_Expressions/14_Function_Invocation/4_Function_Expression_Invocation_A05_t01: Fail # issue 1604.
+Language/11_Expressions/27_Unary_Expressions_A01_t01: Fail # issue 1288 (unary super operator call)
LibTest/core/List/every_A03_t01: Skip # Promise removed (co19 issue #79)
LibTest/core/List/filter_A03_t01: Skip # Promise removed (co19 issue #79)
@@ -308,7 +296,6 @@
[ $compiler == none && $runtime == vm ]
LibTest/core/Date/Date.fromString_A03_t01: Fail # Issue co19 - 121
-LibTest/core/Expect/throws_A02_t01: Fail # Issue co19 - 42
LibTest/core/Match/operator_subscript_A01_t01: Fail
LibTest/core/RegExp/Pattern_semantics/firstMatch_NonEmptyClassRanges_A01_t05: Fail
LibTest/core/RegExp/Pattern_semantics/firstMatch_NonEmptyClassRanges_A01_t06: Fail
@@ -353,8 +340,6 @@
LibTest/core/Date/toString_A02_t01: Fail, OK
LibTest/core/Date/year_A01_t01: Fail, OK
-LibTest/core/String/charCodes_A01_t01: Fail, OK # co19 issue 289
-
LibTest/isolate/SendPort/send_A02_t02: Fail, OK # co19 issue 293
LibTest/isolate/SendPort/send_A02_t03: Fail, OK # co19 issue 293
LibTest/isolate/SendPort/send_A02_t04: Fail, OK # co19 issue 293
@@ -376,56 +361,38 @@
LibTest/core/Stopwatch/stop_A01_t01: Fail, OK # co19 issue 297
LibTest/core/Stopwatch/frequency_A01_t01: Fail, OK # co19 issue 297
-
-LibTest/core/Match/end_A01_t01: Fail, OK # co19 issue 294
-LibTest/core/Match/group_A01_t01: Fail, OK # co19 issue 294
-LibTest/core/Match/groupCount_A01_t01: Fail, OK # co19 issue 294
LibTest/core/Match/operator_subscript_A01_t01: Fail, OK # co19 issue 294
-LibTest/core/Match/start_A01_t01: Fail, OK # co19 issue 294
-LibTest/core/RegExp/allMatches_A01_t01: Fail, OK # co19 issue 294
LibTest/core/RegExp/firstMatch_A01_t01: Fail, OK # co19 issue 294
-LibTest/core/RegExp/Pattern_semantics/firstMatch_Assertion_A03_t01: Fail, OK # co19 issue 294
-LibTest/core/RegExp/Pattern_semantics/firstMatch_Assertion_A04_t01: Fail, OK # co19 issue 294
-LibTest/core/RegExp/Pattern_semantics/firstMatch_Assertion_A05_t01: Fail, OK # co19 issue 294
-LibTest/core/RegExp/Pattern_semantics/firstMatch_Atom_A01_t01: Fail, OK # co19 issue 294
LibTest/core/RegExp/Pattern_semantics/firstMatch_Atom_A02_t01: Fail, OK # co19 issue 294
-LibTest/core/RegExp/Pattern_semantics/firstMatch_Atom_A03_t01: Fail, OK # co19 issue 294
-LibTest/core/RegExp/Pattern_semantics/firstMatch_Atom_A03_t02: Fail, OK # co19 issue 294
-LibTest/core/RegExp/Pattern_semantics/firstMatch_Atom_A03_t03: Fail, OK # co19 issue 294
-LibTest/core/RegExp/Pattern_semantics/firstMatch_Atom_A04_t01: Fail, OK # co19 issue 294
-LibTest/core/RegExp/Pattern_semantics/firstMatch_Atom_A05_t01: Fail, OK # co19 issue 294
-LibTest/core/RegExp/Pattern_semantics/firstMatch_Atom_A06_t01: Fail, OK # co19 issue 294
-LibTest/core/RegExp/Pattern_semantics/firstMatch_AtomEscape_A01_t01: Fail, OK # co19 issue 294
-LibTest/core/RegExp/Pattern_semantics/firstMatch_Disjunction_A01_t01: Fail, OK # co19 issue 294
-LibTest/core/RegExp/Pattern_semantics/firstMatch_Quantifier_A01_t01: Fail, OK # co19 issue 294
-LibTest/core/RegExp/Pattern_semantics/firstMatch_Quantifier_A02_t01: Fail, OK # co19 issue 294
-LibTest/core/RegExp/Pattern_semantics/firstMatch_Quantifier_A03_t01: Fail, OK # co19 issue 294
-LibTest/core/RegExp/Pattern_semantics/firstMatch_Quantifier_A04_t01: Fail, OK # co19 issue 294
-LibTest/core/RegExp/Pattern_semantics/firstMatch_Quantifier_A05_t01: Fail, OK # co19 issue 294
-LibTest/core/RegExp/Pattern_semantics/firstMatch_Quantifier_A06_t01: Fail, OK # co19 issue 294
-LibTest/core/RegExp/Pattern_semantics/firstMatch_Term_A01_t01: Fail, OK # co19 issue 294
-LibTest/core/RegExp/Pattern_semantics/firstMatch_Term_A02_t01: Fail, OK # co19 issue 294
LibTest/core/RegExp/Pattern_semantics/firstMatch_Term_A03_t01: Fail, OK # co19 issue 294
-LibTest/core/RegExp/Pattern_semantics/firstMatch_Term_A04_t01: Fail, OK # co19 issue 294
-LibTest/core/Queue/filter_A01_t04: Fail, OK # co19 issue 291
-LibTest/core/Queue/first_A01_t01: Fail, OK # co19 issue 291
-LibTest/core/Queue/removeFirst_A01_t01: Fail, OK # co19 issue 291
LibTest/core/Queue/first_A02_t01: Fail, OK # co19 issue 291
-LibTest/core/Queue/addFirst_A01_t01: Fail, OK # co19 issue 291
-LibTest/core/Queue/removeLast_A01_t01: Fail, OK # co19 issue 291
-LibTest/core/Queue/add_A01_t01: Fail, OK # co19 issue 291
LibTest/core/Queue/last_A02_t01: Fail, OK # co19 issue 291
-LibTest/core/Queue/addLast_A01_t01: Fail, OK # co19 issue 291
-LibTest/core/Queue/last_A01_t01: Fail, OK # co19 issue 291
-LibTest/core/List/last_A02_t01: Fail, OK # co19 issue 291
-LibTest/core/List/last_A01_t01: Fail, OK # co19 issue 291
-Language/10_Expressions/07_Maps_A07_t03: Fail, OK # co19 issue 287
-Language/10_Expressions/07_Maps_A04_t02: Fail, OK # co19 issue 287
-LibTest/core/Queue/filter_A01_t04: Fail, OK # co19 issue 287
+Language/11_Expressions/07_Maps_A07_t03: Fail, OK # co19 issue 287
+Language/11_Expressions/07_Maps_A04_t02: Fail, OK # co19 issue 287
+
LibTest/core/Map/getValues_A01_t02: Fail, OK # co19 issue 287
+LibTest/core/List/List_A01_t01: Fail, OK # co19 issue 290
+LibTest/core/List/getRange_A04_t01: Fail, OK # co19 issue 290
+LibTest/core/List/insertRange_A06_t01: Fail, OK # co19 issue 290
+LibTest/core/List/last_A02_t01: Fail, OK # co19 issue 290
+LibTest/core/List/length_A05_t01: Fail, OK # co19 issue 290
+LibTest/core/List/operator_subscript_A02_t01: Fail, OK # co19 issue 290
+LibTest/core/List/operator_subscripted_assignment_A02_t01: Fail, OK # co19 issue 290
+LibTest/core/List/removeLast_A01_t02: Fail, OK # co19 issue 290
+LibTest/core/List/removeRange_A05_t01: Fail, OK # co19 issue 290
+LibTest/core/List/setRange_A02_t01: Fail, OK # co19 issue 290
+LibTest/core/List/setRange_A02_t02: Fail, OK # co19 issue 290
+LibTest/core/List/setRange_A03_t01: Fail, OK # co19 issue 290
+LibTest/core/List/setRange_A03_t02: Fail, OK # co19 issue 290
+LibTest/core/Match/group_A02_t01: Fail, OK # co19 issue 290
+LibTest/core/Match/groups_A02_t01: Fail, OK # co19 issue 290
+LibTest/core/Match/operator_subscript_A02_t01: Fail, OK # co19 issue 290
+LibTest/core/String/charCodeAt_A02_t01: Fail, OK # co19 issue 290
+LibTest/core/String/operator_subscript_A02_t01: Fail, OK # co19 issue 290
+LibTest/core/String/substring_A02_t01: Fail, OK # co19 issue 290
[ $compiler == none && $runtime == vm ]
LibTest/core/String/contains_A01_t03: Skip # Times out.
@@ -440,43 +407,33 @@
[ $compiler == none && $runtime == vm ]
Language/07_Classes/07_Classes_A02_t29: Fail
Language/07_Classes/07_Classes_A02_t31: Fail
-Language/10_Expressions/05_Strings/1_String_Interpolation_A03_t02: Fail
-Language/10_Expressions/05_Strings/1_String_Interpolation_A04_t02: Fail
-Language/10_Expressions/05_Strings_A20_t01: Fail
-Language/10_Expressions/14_Function_Invocation/3_Unqualified_Invocation_A01_t04: Fail # co19 issue 166
-Language/10_Expressions/14_Function_Invocation/3_Unqualified_Invocation_A01_t05: Fail
-Language/10_Expressions/14_Function_Invocation/4_Function_Expression_Invocation_A02_t01: Fail
-Language/10_Expressions/15_Method_Invocation/1_Ordinary_Invocation_A08_t01: Fail
-Language/10_Expressions/15_Method_Invocation/3_Static_Invocation_A04_t02: Fail # Issue 1604, exception should be NoSuchMethodException instead of ObjectNotClosureException
-Language/10_Expressions/15_Method_Invocation/3_Static_Invocation_A04_t03: Fail # Issue 1604, exception should be NoSuchMethodException instead of ObjectNotClosureException
-Language/10_Expressions/15_Method_Invocation/3_Static_Invocation_A05_t01: Fail # Issue 1604, exception should be NoSuchMethodException instead of ObjectNotClosureException
-Language/10_Expressions/15_Method_Invocation/3_Static_Invocation_A06_t02: Fail # Issue 1604, exception should be NoSuchMethodException instead of ObjectNotClosureException
-LibTest/core/Future/handleException_A01_t07: Fail
-LibTest/core/Future/then_A01_t05: Fail
+Language/11_Expressions/05_Strings/1_String_Interpolation_A03_t02: Fail
+Language/11_Expressions/05_Strings/1_String_Interpolation_A04_t02: Fail
+Language/11_Expressions/05_Strings_A20_t01: Fail
+Language/11_Expressions/15_Method_Invocation/3_Static_Invocation_A04_t02: Fail # Issue 1604, exception should be NoSuchMethodException instead of ObjectNotClosureException
+Language/11_Expressions/15_Method_Invocation/3_Static_Invocation_A04_t03: Fail # Issue 1604, exception should be NoSuchMethodException instead of ObjectNotClosureException
+Language/11_Expressions/15_Method_Invocation/3_Static_Invocation_A05_t01: Fail # Issue 1604, exception should be NoSuchMethodException instead of ObjectNotClosureException
+Language/11_Expressions/15_Method_Invocation/3_Static_Invocation_A06_t02: Fail # Issue 1604, exception should be NoSuchMethodException instead of ObjectNotClosureException
LibTest/isolate/ReceivePort/receive_A01_t02: Fail
LibTest/isolate/isolate_api/spawnUri_A01_t03: Crash
LibTest/isolate/isolate_api/spawnUri_A01_t04: Crash
# class '?' overrides function '?' of super class '?' with incompatible parameters
-Language/10_Expressions/15_Method_Invocation/1_Ordinary_Invocation_A05_t02: Fail
-Language/10_Expressions/15_Method_Invocation/1_Ordinary_Invocation_A05_t03: Fail
-Language/10_Expressions/15_Method_Invocation/1_Ordinary_Invocation_A05_t05: Fail
-Language/10_Expressions/15_Method_Invocation/1_Ordinary_Invocation_A05_t06: Fail
-Language/10_Expressions/15_Method_Invocation/4_Super_Invocation_A04_t01: Fail # Issue 3622
-Language/10_Expressions/15_Method_Invocation/4_Super_Invocation_A04_t02: Fail # Issue 3622
+Language/11_Expressions/15_Method_Invocation/1_Ordinary_Invocation_A05_t02: Fail
+Language/11_Expressions/15_Method_Invocation/1_Ordinary_Invocation_A05_t03: Fail
# function 'func' not found in super class, getter 'func' should be invoked first.
-Language/10_Expressions/15_Method_Invocation/4_Super_Invocation_A02_t04: Fail # co19 issue 251 or issue 5732
-Language/10_Expressions/15_Method_Invocation/4_Super_Invocation_A03_t02: Fail # co19 issue 251 or issue 5732
-Language/10_Expressions/15_Method_Invocation/4_Super_Invocation_A03_t03: Fail # co19 issue 251 or issue 5732
-Language/10_Expressions/15_Method_Invocation/4_Super_Invocation_A07_t01: Fail # co19 issue 251 or issue 5732
-Language/10_Expressions/15_Method_Invocation/4_Super_Invocation_A08_t02: Fail # co19 issue 251 or issue 5732
+Language/11_Expressions/15_Method_Invocation/4_Super_Invocation_A02_t04: Fail # co19 issue 251 or issue 5732
+Language/11_Expressions/15_Method_Invocation/4_Super_Invocation_A03_t02: Fail # co19 issue 251 or issue 5732
+Language/11_Expressions/15_Method_Invocation/4_Super_Invocation_A03_t03: Fail # co19 issue 251 or issue 5732
+Language/11_Expressions/15_Method_Invocation/4_Super_Invocation_A07_t01: Fail # co19 issue 251 or issue 5732
+Language/11_Expressions/15_Method_Invocation/4_Super_Invocation_A08_t02: Fail # co19 issue 251 or issue 5732
# initializer must be a compile time constant
-Language/10_Expressions/30_Identifier_Reference_A05_t09: Fail
+Language/11_Expressions/30_Identifier_Reference_A05_t09: Fail
# invalid operator overloading
diff --git a/tests/compiler/dart2js/backend_htype_list_test.dart b/tests/compiler/dart2js/backend_htype_list_test.dart
index 5d56b84..30369be 100644
--- a/tests/compiler/dart2js/backend_htype_list_test.dart
+++ b/tests/compiler/dart2js/backend_htype_list_test.dart
@@ -2,12 +2,12 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-import "dart:uri";
+import 'dart:uri';
-import "../../../lib/compiler/implementation/elements/elements.dart";
-import "../../../lib/compiler/implementation/js_backend/js_backend.dart";
-import "../../../lib/compiler/implementation/ssa/ssa.dart";
-import "../../../lib/compiler/implementation/dart2jslib.dart";
+import '../../../lib/compiler/implementation/elements/elements.dart';
+import '../../../lib/compiler/implementation/js_backend/js_backend.dart';
+import '../../../lib/compiler/implementation/ssa/ssa.dart';
+import '../../../lib/compiler/implementation/dart2jslib.dart' show Selector;
import 'compiler_helper.dart';
import 'parser_helper.dart';
diff --git a/tests/compiler/dart2js/begin_end_token_test.dart b/tests/compiler/dart2js/begin_end_token_test.dart
index 2123982..954213e 100644
--- a/tests/compiler/dart2js/begin_end_token_test.dart
+++ b/tests/compiler/dart2js/begin_end_token_test.dart
@@ -2,10 +2,8 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-#import('parser_helper.dart');
-#import("../../../lib/compiler/implementation/scanner/scannerlib.dart");
-#import("../../../lib/compiler/implementation/tree/tree.dart");
-
+import 'parser_helper.dart';
+import '../../../lib/compiler/implementation/tree/tree.dart';
void testNode(Node node, String expected, String text, [bool hard = true]) {
var debug = 'text=$text,expected=$expected,node:${node}';
diff --git a/tests/compiler/dart2js/call_site_type_inferer_test.dart b/tests/compiler/dart2js/call_site_type_inferer_test.dart
index 8176f75..a32d9e6 100644
--- a/tests/compiler/dart2js/call_site_type_inferer_test.dart
+++ b/tests/compiler/dart2js/call_site_type_inferer_test.dart
@@ -2,14 +2,13 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-#import("dart:uri");
+import 'dart:uri';
-#import("../../../lib/compiler/implementation/js_backend/js_backend.dart");
-#import("../../../lib/compiler/implementation/ssa/ssa.dart");
-#import("../../../lib/compiler/implementation/scanner/scannerlib.dart");
+import '../../../lib/compiler/implementation/js_backend/js_backend.dart';
+import '../../../lib/compiler/implementation/ssa/ssa.dart';
-#import('compiler_helper.dart');
-#import('parser_helper.dart');
+import 'compiler_helper.dart';
+import 'parser_helper.dart';
void compileAndFind(String code,
String className,
diff --git a/tests/compiler/dart2js/dart2js.status b/tests/compiler/dart2js/dart2js.status
index b94725f..5a11b46 100644
--- a/tests/compiler/dart2js/dart2js.status
+++ b/tests/compiler/dart2js/dart2js.status
@@ -10,5 +10,6 @@
# Minification of locals temporarily disabled due to issue 5808
minify_many_locals_test: Fail
+
[ $jscl || $runtime == drt || $runtime == dartium || $runtime == ff || $runtime == firefox || $runtime == chrome || $runtime == safari || $runtime == ie9 || $runtime == opera ]
*: Skip # dart2js uses #import('dart:io'); and it is not self-hosted (yet).
diff --git a/tests/compiler/dart2js/dart_backend_test.dart b/tests/compiler/dart2js/dart_backend_test.dart
index 7e9c960..6b59656 100644
--- a/tests/compiler/dart2js/dart_backend_test.dart
+++ b/tests/compiler/dart2js/dart_backend_test.dart
@@ -53,6 +53,7 @@
const helperLib = r'''
#library('js_helper');
+class JSInvocationMirror {}
''';
testDart2Dart(String src, {void continuation(String s), bool minify: false,
@@ -172,19 +173,6 @@
testDart2Dart('String get foo{return "a";}main(){foo;}');
}
-testFactoryConstructor() {
- testDart2Dart('main(){new A.fromFoo();}class A{A.fromFoo();}');
- // Now more complicated, with normal constructor and factory parameters.
- testDart2Dart('main(){new A.fromFoo(5);}'
- 'class A{A(this.f);A.fromFoo(foo):this("f");final String f;}');
- // Now even more complicated, with interface and default factory.
- testDart2Dart('main(){new A.fromFoo(5);new I.fromFoo();}'
- 'class IFactory{factory I.fromFoo()=>new A(5);}'
- 'interface I default IFactory{I.fromFoo();}'
- 'class A implements I{A(this.f);A.fromFoo(foo):this("f");'
- 'final String f;}');
-}
-
testAbstractClass() {
testDart2Dart('main(){A.foo;}abstract class A{final static num foo;}');
}
@@ -252,12 +240,12 @@
'static const field=5;}'
'p_globalfoo(){}'
'var p_globalVar;var p_globalVarInitialized=6,p_globalVarInitialized2=7;'
- 'class p_A{p_A(){}p_A.fromFoo(){}static p_staticfoo(){}foo(){}'
+ 'class p_A{p_A(){}p_A.p_fromFoo(){}static p_staticfoo(){}foo(){}'
'static const p_field=5;}'
'main(){p_globalVar;p_globalVarInitialized;'
'p_globalVarInitialized2;p_globalfoo();'
'p_A.p_field;p_A.p_staticfoo();'
- 'new p_A();new p_A.fromFoo();new p_A().foo();'
+ 'new p_A();new p_A.p_fromFoo();new p_A().foo();'
'globalVar;globalVarInitialized;globalVarInitialized2;globalfoo();'
'A.field;A.staticfoo();'
'new A();new A.fromFoo();new A().foo();}';
@@ -483,42 +471,6 @@
Expect.isTrue(collector.elementNodes[classElement].contains(defaultTypeNode));
}
-testFactoryRename() {
- var librarySrc = '''
-#library('mylib');
-
-interface I default B { I(); }
-class A implements I { A() {} }
-class B { factory I() {} }
-
-''';
- var mainSrc = '''
-#import('mylib.dart', prefix: 'mylib');
-
-interface I default B { I(); }
-class A implements I { A() {} }
-class B { factory I() {} }
-
-main() {
- new I();
- new A();
-
- new mylib.I();
- new mylib.A();
-}
-''';
- var expectedResult =
- 'interface I default B{I();}'
- 'class A implements I{A(){}}'
- 'class B{factory I(){}}'
- 'interface p_I default p_B{p_I();}'
- 'class p_A implements p_I{p_A(){}}'
- 'class p_B{factory p_I(){}}'
- 'main(){new p_I();new p_A();new I();new A();}';
- testDart2DartWithLibrary(mainSrc, librarySrc,
- continuation: (String result) { Expect.equals(expectedResult, result); });
-}
-
testTypeVariablesAreRenamed() {
// Somewhat a hack: we require all the references of the identifier
// to be renamed in the same way for the whole library. Hence
@@ -610,32 +562,6 @@
continuation: (String result) { Expect.equals(expectedResult, result); });
}
-testInterfaceDefaultAnotherLib() {
- var librarySrc = '''
-#library('mylib');
-class C<T> {
- factory I() {}
-}
-''';
- var mainSrc = '''
-#import('mylib.dart', prefix: 'mylib');
-
-interface I<T> default mylib.C<T> {
- I();
-}
-
-main() {
- new I();
-}
-''';
- var expectedResult =
- 'class C<T>{factory I(){}}'
- 'interface I<T> default C<T>{I();}'
- 'main(){new I();}';
- testDart2DartWithLibrary(mainSrc, librarySrc,
- continuation: (String result) { Expect.equals(expectedResult, result); });
-}
-
testStaticAccessIoLib() {
var src = '''
#import('dart:io');
@@ -710,39 +636,6 @@
(String result) { Expect.equals(expectedResult, result); }, minify: true);
}
-testTypeVariablesInDifferentLibraries() {
-// This is a simplified version of what we have in
-// lib/compiler/implementation/util.
- var librarySrc = '''
-#library('mylib');
-#import('script.dart');
-interface Iterable<K> {}
-
-interface Link<T> extends Iterable<T> default LinkFactory<T> {
- Link();
-}
-''';
- var mainSrc = '''
-#library('script.dart');
-#import('mylib.dart');
-
-class LinkFactory<T> {
- factory Link() {}
-}
-
-main() {
- new Link<int>();
-}
-''';
- var expectedResult =
- 'interface Iterable<K>{}'
- 'interface Link<T> extends Iterable<T> default LinkFactory<T>{Link();}'
- 'class LinkFactory<T>{factory Link(){}}'
- 'main(){new Link<int>();}';
- testDart2DartWithLibrary(mainSrc, librarySrc,
- continuation: (String result) { Expect.equals(expectedResult, result); });
-}
-
testDeclarationTypePlaceholders() {
var src = '''
String globalfield;
@@ -807,7 +700,6 @@
testExtendsImplements();
testVariableDefinitions();
testGetSet();
- testFactoryConstructor();
testAbstractClass();
testConflictSendsRename();
testNoConflictSendsRename();
@@ -818,17 +710,14 @@
testLibraryGetSet();
testFieldTypeOutput();
testDefaultClassNamePlaceholder();
- testFactoryRename();
testTypeVariablesAreRenamed();
testClassTypeArgumentBound();
testDoubleMains();
- testInterfaceDefaultAnotherLib();
testStaticAccessIoLib();
testLocalFunctionPlaceholder();
testMinification();
testClosureLocalsMinified();
testParametersMinified();
- testTypeVariablesInDifferentLibraries();
testDeclarationTypePlaceholders();
testPlatformLibraryMemberNamesAreFixed();
testConflictsWithCoreLib();
diff --git a/tests/compiler/dart2js/mirrors_test.dart b/tests/compiler/dart2js/mirrors_test.dart
index 409557b..cec75b4 100644
--- a/tests/compiler/dart2js/mirrors_test.dart
+++ b/tests/compiler/dart2js/mirrors_test.dart
@@ -17,15 +17,15 @@
bool containsType(TypeMirror expected, Iterable<TypeMirror> iterable) {
for (var element in iterable) {
- if (element.declaration == expected.declaration) {
+ if (element.originalDeclaration == expected.originalDeclaration) {
return true;
}
}
return false;
}
-Mirror findMirror(List<Mirror> list, String name) {
- for (Mirror mirror in list) {
+DeclarationMirror findMirror(List<DeclarationMirror> list, String name) {
+ for (DeclarationMirror mirror in list) {
if (mirror.simpleName == name) {
return mirror;
}
@@ -55,18 +55,26 @@
Expect.stringEquals("mirrors_helper", helperLibrary.qualifiedName,
"Unexpected library qualified name");
- var types = helperLibrary.types;
- Expect.isNotNull(types, "No types map returned");
- Expect.isFalse(types.isEmpty, "Empty types map returned");
+ var classes = helperLibrary.classes;
+ Expect.isNotNull(classes, "No classes map returned");
+ Expect.isFalse(classes.isEmpty, "Empty classes map returned");
- testFoo(mirrors, helperLibrary, types);
- testBar(mirrors, helperLibrary, types);
- testBaz(mirrors, helperLibrary, types);
+ testFoo(mirrors, helperLibrary, classes);
+ testBar(mirrors, helperLibrary, classes);
+ testBaz(mirrors, helperLibrary, classes);
// TODO(johnniwinther): Add test of class [Boz] and typedef [Func].
// TODO(johnniwinther): Add tests of type argument substitution, which
// is not currently implemented in dart2js.
// TODO(johnniwinther): Add tests of Location and Source.
- testPrivate(mirrors, helperLibrary, types);
+ testPrivate(mirrors, helperLibrary, classes);
+ // TODO(johnniwinther): Add thorough tests of [LibraryMirror.functions],
+ // [LibraryMirror.getters], [LibraryMirror.setters], [LibraryMirror.members],
+ // and [LibraryMirror.variable].
+ Expect.isNotNull(helperLibrary.functions);
+ Expect.isNotNull(helperLibrary.members);
+ Expect.isNotNull(helperLibrary.getters);
+ Expect.isNotNull(helperLibrary.setters);
+ Expect.isNotNull(helperLibrary.variables);
}
// Testing class Foo:
@@ -75,10 +83,10 @@
//
// }
void testFoo(MirrorSystem system, LibraryMirror helperLibrary,
- Map<String,TypeMirror> types) {
- var fooClass = types["Foo"];
+ Map<String,TypeMirror> classes) {
+ var fooClass = classes["Foo"];
Expect.isNotNull(fooClass, "Type 'Foo' not found");
- Expect.isTrue(fooClass is InterfaceMirror,
+ Expect.isTrue(fooClass is ClassMirror,
"Unexpected mirror type returned");
Expect.stringEquals("Foo", fooClass.simpleName,
"Unexpected type simple name");
@@ -95,9 +103,8 @@
Expect.isFalse(fooClass.isTypedef, "Class is a typedef");
Expect.isFalse(fooClass.isFunction, "Class is a function");
- Expect.isTrue(fooClass.isDeclaration, "Class is not declaration");
- Expect.equals(fooClass, fooClass.declaration,
- "Class is not its declaration");
+ Expect.isTrue(fooClass.isOriginalDeclaration);
+ Expect.equals(fooClass, fooClass.originalDeclaration);
Expect.isTrue(fooClass.isClass, "Class is not class");
Expect.isFalse(fooClass.isInterface, "Class is interface");
@@ -106,20 +113,19 @@
var objectType = fooClass.superclass;
Expect.isNotNull(objectType, "Superclass is null");
Expect.isTrue(objectType.isObject, "Object is not Object");
- Expect.isFalse(objectType.isDeclaration, "Object type is declaration");
+ Expect.isFalse(objectType.isOriginalDeclaration);
Expect.isTrue(containsType(fooClass,
computeSubdeclarations(objectType)),
"Class is not subclass of superclass");
- var fooInterfaces = fooClass.interfaces;
+ var fooInterfaces = fooClass.superinterfaces;
Expect.isNotNull(fooInterfaces, "Interfaces map is null");
Expect.isTrue(fooInterfaces.isEmpty, "Interfaces map is not empty");
var fooSubdeclarations = computeSubdeclarations(fooClass);
Expect.equals(1, count(fooSubdeclarations), "Unexpected subtype count");
for (var fooSubdeclaration in fooSubdeclarations) {
- Expect.equals(fooClass, fooSubdeclaration.superclass.declaration,
- "Class is not superclass of subclass");
+ Expect.equals(fooClass, fooSubdeclaration.superclass.originalDeclaration);
}
Expect.throws(() => fooClass.typeArguments,
@@ -130,9 +136,9 @@
Expect.isTrue(fooClassTypeVariables.isEmpty,
"Type variable list is not empty");
- Expect.isNull(fooClass.defaultType, "Class has default type");
+ Expect.isNull(fooClass.defaultFactory);
- var fooClassMembers = fooClass.declaredMembers;
+ var fooClassMembers = fooClass.members;
Expect.isNotNull(fooClassMembers, "Declared members map is null");
Expect.isTrue(fooClassMembers.isEmpty, "Declared members map is unempty");
@@ -140,6 +146,15 @@
Expect.isNotNull(fooClassConstructors, "Constructors map is null");
Expect.isTrue(fooClassConstructors.isEmpty,
"Constructors map is unempty");
+
+ // TODO(johnniwinther): Add thorough tests of [ClassMirror.functions],
+ // [ClassMirror.getters], [ClassMirror.setters], [ClassMirror.members],
+ // and [ClassMirror.variable].
+ Expect.isNotNull(fooClass.functions);
+ Expect.isNotNull(fooClass.members);
+ Expect.isNotNull(fooClass.getters);
+ Expect.isNotNull(fooClass.setters);
+ Expect.isNotNull(fooClass.variables);
}
// Testing interface Bar:
@@ -148,10 +163,10 @@
//
// }
void testBar(MirrorSystem system, LibraryMirror helperLibrary,
- Map<String,TypeMirror> types) {
- var barInterface = types["Bar"];
+ Map<String,TypeMirror> classes) {
+ var barInterface = classes["Bar"];
Expect.isNotNull(barInterface, "Type 'Bar' not found");
- Expect.isTrue(barInterface is InterfaceMirror,
+ Expect.isTrue(barInterface is ClassMirror,
"Unexpected mirror type returned");
Expect.stringEquals("Bar", barInterface.simpleName,
"Unexpected type simple name");
@@ -168,9 +183,8 @@
Expect.isFalse(barInterface.isTypedef, "Interface is a typedef");
Expect.isFalse(barInterface.isFunction, "Interface is a function");
- Expect.isTrue(barInterface.isDeclaration, "Interface is not declaration");
- Expect.equals(barInterface, barInterface.declaration,
- "Interface is not its declaration");
+ Expect.isTrue(barInterface.isOriginalDeclaration);
+ Expect.equals(barInterface, barInterface.originalDeclaration);
Expect.isFalse(barInterface.isClass, "Interface is class");
Expect.isTrue(barInterface.isInterface, "Interface is not interface");
@@ -179,12 +193,12 @@
var objectType = barInterface.superclass;
Expect.isNotNull(objectType, "Superclass is null");
Expect.isTrue(objectType.isObject, "Object is not Object");
- Expect.isFalse(objectType.isDeclaration, "Object type is declaration");
+ Expect.isFalse(objectType.isOriginalDeclaration);
Expect.isTrue(containsType(barInterface,
computeSubdeclarations(objectType)),
"Class is not subclass of superclass");
- var barInterfaces = barInterface.interfaces;
+ var barInterfaces = barInterface.superinterfaces;
Expect.isNotNull(barInterfaces, "Interfaces map is null");
Expect.isTrue(barInterfaces.isEmpty, "Interfaces map is not empty");
@@ -192,7 +206,7 @@
Expect.equals(1, count(barSubdeclarations), "Unexpected subtype count");
for (var barSubdeclaration in barSubdeclarations) {
Expect.isTrue(containsType(barInterface,
- barSubdeclaration.interfaces),
+ barSubdeclaration.superinterfaces),
"Interface is not superinterface of subclass");
}
@@ -210,9 +224,9 @@
Expect.isNotNull(barE, "Type variable is null");
Expect.isTrue(barE.isTypeVariable, "Type variable is not type variable");
- Expect.isNull(barInterface.defaultType, "Interface has default type");
+ Expect.isNull(barInterface.defaultFactory);
- var barInterfaceMembers = barInterface.declaredMembers;
+ var barInterfaceMembers = barInterface.members;
Expect.isNotNull(barInterfaceMembers, "Declared members map is null");
Expect.isTrue(barInterfaceMembers.isEmpty,
"Declared members map is unempty");
@@ -238,10 +252,10 @@
// int operator -() => 0;
// }
void testBaz(MirrorSystem system, LibraryMirror helperLibrary,
- Map<String,TypeMirror> types) {
- var bazClass = types["Baz"];
+ Map<String,TypeMirror> classes) {
+ var bazClass = classes["Baz"];
Expect.isNotNull(bazClass, "Type 'Baz' not found");
- Expect.isTrue(bazClass is InterfaceMirror,
+ Expect.isTrue(bazClass is ClassMirror,
"Unexpected mirror type returned");
Expect.stringEquals("Baz", bazClass.simpleName,
"Unexpected type simple name");
@@ -258,9 +272,8 @@
Expect.isFalse(bazClass.isTypedef, "Class is a typedef");
Expect.isFalse(bazClass.isFunction, "Class is a function");
- Expect.isTrue(bazClass.isDeclaration, "Class is not declaration");
- Expect.equals(bazClass, bazClass.declaration,
- "Class is not its declaration");
+ Expect.isTrue(bazClass.isOriginalDeclaration);
+ Expect.equals(bazClass, bazClass.originalDeclaration);
Expect.isTrue(bazClass.isClass, "Class is not class");
Expect.isFalse(bazClass.isInterface, "Class is interface");
@@ -269,12 +282,12 @@
var objectType = bazClass.superclass;
Expect.isNotNull(objectType, "Superclass is null");
Expect.isTrue(objectType.isObject, "Object is not Object");
- Expect.isFalse(objectType.isDeclaration, "Object type is declaration");
+ Expect.isFalse(objectType.isOriginalDeclaration);
Expect.isTrue(containsType(bazClass,
computeSubdeclarations(objectType)),
"Class is not subclass of superclass");
- var bazInterfaces = bazClass.interfaces;
+ var bazInterfaces = bazClass.superinterfaces;
Expect.isNotNull(bazInterfaces, "Interfaces map is null");
Expect.isTrue(!bazInterfaces.isEmpty, "Interfaces map is empty");
for (var bazInterface in bazInterfaces) {
@@ -288,7 +301,7 @@
var barInterface = findMirror(bazInterfaces, "Bar");
Expect.isNotNull(barInterface, "Interface bar is missing");
- Expect.isFalse(barInterface.isDeclaration, "Interface type is declaration");
+ Expect.isFalse(barInterface.isOriginalDeclaration);
var barInterfaceTypeArguments = barInterface.typeArguments;
Expect.isNotNull(barInterfaceTypeArguments, "Type arguments are missing");
Expect.equals(1, barInterfaceTypeArguments.length,
@@ -309,9 +322,9 @@
"Unexpected qualifiedName");
Expect.equals(bazClass, bazE.declarer,
"Unexpected type variable declarer");
- var bazEbound = bazE.bound;
- Expect.isNotNull(bazEbound, "Missing type variable bound");
- Expect.isFalse(bazEbound.isDeclaration, "Bound is declaration");
+ var bazEbound = bazE.upperBound;
+ Expect.isNotNull(bazEbound);
+ Expect.isFalse(bazEbound.isOriginalDeclaration);
Expect.isTrue(bazEbound.isObject, "Bound is not object");
var bazF = bazClassTypeVariables[1];
@@ -320,15 +333,15 @@
Expect.stringEquals('mirrors_helper.Baz.F', bazF.qualifiedName,
"Unexpected qualifiedName");
Expect.equals(bazClass, bazF.declarer);
- var bazFbound = bazF.bound;
- Expect.isNotNull(bazFbound, "Missing type variable bound");
- Expect.isFalse(bazFbound.isDeclaration, "Bound is declaration");
+ var bazFbound = bazF.upperBound;
+ Expect.isNotNull(bazFbound);
+ Expect.isFalse(bazFbound.isOriginalDeclaration);
Expect.stringEquals("mirrors_helper.Foo", bazFbound.qualifiedName,
"Bound is not Foo");
- Expect.isNull(bazClass.defaultType, "Class has default type");
+ Expect.isNull(bazClass.defaultFactory);
- var bazClassMembers = bazClass.declaredMembers;
+ var bazClassMembers = bazClass.members;
Expect.isNotNull(bazClassMembers, "Declared members map is null");
Expect.equals(8, bazClassMembers.length,
"Unexpected number of declared members");
@@ -342,24 +355,24 @@
"Unexpected method simpleName");
Expect.stringEquals('mirrors_helper.Baz.method1', method1.qualifiedName,
"Unexpected method qualifiedName");
- Expect.equals(method1.surroundingDeclaration, bazClass,
- "Unexpected surrounding declaration");
- Expect.isFalse(method1.isTopLevel, "Method is top level");
- Expect.isFalse(method1.isConstructor, "Method is constructor");
- Expect.isFalse(method1.isField, "Method is field");
- Expect.isTrue(method1.isMethod, "Method is not method");
- Expect.isFalse(method1.isPrivate, "Method is private");
- Expect.isTrue(method1.isStatic, "Method is not static");
- Expect.isTrue(method1 is MethodMirror, "Method is not MethodMirror");
- Expect.isFalse(method1.isConst, "Method is const");
- Expect.isFalse(method1.isFactory, "Method is factory");
- Expect.isNull(method1.constructorName,
- "Method constructorName is non-null");
- Expect.isFalse(method1.isGetter, "Method is getter");
- Expect.isFalse(method1.isSetter, "Method is setter");
- Expect.isFalse(method1.isOperator, "Method is operator");
- Expect.isNull(method1.operatorName,
- "Method operatorName is non-null");
+ Expect.equals(method1.owner, bazClass);
+ Expect.isFalse(method1.isTopLevel);
+ Expect.isFalse(method1.isConstructor);
+ Expect.isFalse(method1.isField);
+ Expect.isTrue(method1.isMethod);
+ Expect.isFalse(method1.isPrivate);
+ Expect.isTrue(method1.isStatic);
+ Expect.isTrue(method1 is MethodMirror);
+ Expect.isTrue(method1.isRegularMethod);
+ Expect.isFalse(method1.isConstConstructor);
+ Expect.isFalse(method1.isGenerativeConstructor);
+ Expect.isFalse(method1.isRedirectingConstructor);
+ Expect.isFalse(method1.isFactoryConstructor);
+ Expect.isNull(method1.constructorName);
+ Expect.isFalse(method1.isGetter);
+ Expect.isFalse(method1.isSetter);
+ Expect.isFalse(method1.isOperator);
+ Expect.isNull(method1.operatorName);
var dynamicType = method1.returnType;
Expect.isNotNull(dynamicType, "Return type was null");
@@ -396,24 +409,24 @@
"Unexpected method simpleName");
Expect.stringEquals('mirrors_helper.Baz.method2', method2.qualifiedName,
"Unexpected method qualifiedName");
- Expect.equals(method2.surroundingDeclaration, bazClass,
- "Unexpected surrounding declaration");
- Expect.isFalse(method2.isTopLevel, "Method is top level");
- Expect.isFalse(method2.isConstructor, "Method is constructor");
- Expect.isFalse(method2.isField, "Method is field");
- Expect.isTrue(method2.isMethod, "Method is not method");
- Expect.isFalse(method2.isPrivate, "Method is private");
- Expect.isFalse(method2.isStatic, "Method is static");
- Expect.isTrue(method2 is MethodMirror, "Method is not MethodMirror");
- Expect.isFalse(method2.isConst, "Method is const");
- Expect.isFalse(method2.isFactory, "Method is factory");
- Expect.isNull(method2.constructorName,
- "Method constructorName is non-null");
- Expect.isFalse(method2.isGetter, "Method is getter");
- Expect.isFalse(method2.isSetter, "Method is setter");
- Expect.isFalse(method2.isOperator, "Method is operator");
- Expect.isNull(method2.operatorName,
- "Method operatorName is non-null");
+ Expect.equals(method2.owner, bazClass);
+ Expect.isFalse(method2.isTopLevel);
+ Expect.isFalse(method2.isConstructor);
+ Expect.isFalse(method2.isField);
+ Expect.isTrue(method2.isMethod);
+ Expect.isFalse(method2.isPrivate);
+ Expect.isFalse(method2.isStatic);
+ Expect.isTrue(method2 is MethodMirror);
+ Expect.isTrue(method2.isRegularMethod);
+ Expect.isFalse(method2.isConstConstructor);
+ Expect.isFalse(method2.isGenerativeConstructor);
+ Expect.isFalse(method2.isRedirectingConstructor);
+ Expect.isFalse(method2.isFactoryConstructor);
+ Expect.isNull(method2.constructorName);
+ Expect.isFalse(method2.isGetter);
+ Expect.isFalse(method2.isSetter);
+ Expect.isFalse(method2.isOperator);
+ Expect.isNull(method2.operatorName);
var voidType = method2.returnType;
Expect.isNotNull(voidType, "Return type was null");
@@ -463,31 +476,30 @@
"Unexpected method simpleName");
Expect.stringEquals('mirrors_helper.Baz.method3', method3.qualifiedName,
"Unexpected method qualifiedName");
- Expect.equals(method3.surroundingDeclaration, bazClass,
- "Unexpected surrounding declaration");
- Expect.isFalse(method3.isTopLevel, "Method is top level");
- Expect.isFalse(method3.isConstructor, "Method is constructor");
- Expect.isFalse(method3.isField, "Method is field");
- Expect.isTrue(method3.isMethod, "Method is not method");
- Expect.isFalse(method3.isPrivate, "Method is private");
- Expect.isFalse(method3.isStatic, "Method is static");
- Expect.isTrue(method3 is MethodMirror, "Method is not MethodMirror");
- Expect.isFalse(method3.isConst, "Method is const");
- Expect.isFalse(method3.isFactory, "Method is factory");
- Expect.isNull(method3.constructorName,
- "Method constructorName is non-null");
- Expect.isFalse(method3.isGetter, "Method is getter");
- Expect.isFalse(method3.isSetter, "Method is setter");
- Expect.isFalse(method3.isOperator, "Method is operator");
- Expect.isNull(method3.operatorName,
- "Method operatorName is non-null");
+ Expect.equals(method3.owner, bazClass);
+ Expect.isFalse(method3.isTopLevel);
+ Expect.isFalse(method3.isConstructor);
+ Expect.isFalse(method3.isField);
+ Expect.isTrue(method3.isMethod);
+ Expect.isFalse(method3.isPrivate);
+ Expect.isFalse(method3.isStatic);
+ Expect.isTrue(method3 is MethodMirror);
+ Expect.isTrue(method3.isRegularMethod);
+ Expect.isFalse(method3.isConstConstructor);
+ Expect.isFalse(method3.isGenerativeConstructor);
+ Expect.isFalse(method3.isRedirectingConstructor);
+ Expect.isFalse(method3.isFactoryConstructor);
+ Expect.isNull(method3.constructorName);
+ Expect.isFalse(method3.isGetter);
+ Expect.isFalse(method3.isSetter);
+ Expect.isFalse(method3.isOperator);
+ Expect.isNull(method3.operatorName);
var method3ReturnType = method3.returnType;
Expect.isNotNull(method3ReturnType, "Return type is null");
- Expect.isTrue(method3ReturnType is InterfaceMirror,
+ Expect.isTrue(method3ReturnType is ClassMirror,
"Return type is not interface");
- Expect.equals(bazClass, method3ReturnType.declaration,
- "Return type is not Baz");
+ Expect.equals(bazClass, method3ReturnType.originalDeclaration);
// TODO(johnniwinther): Test type arguments of [method3ReturnType].
var method3Parameters = method3.parameters;
@@ -542,24 +554,20 @@
Expect.equals(helperLibrary, funcTypedef.library,
"Unexpected typedef library");
Expect.isNull(funcTypedef.superclass, "Non-null superclass on typedef");
- Expect.isNotNull(funcTypedef.interfaces,
- "Null interfaces map on typedef");
- Expect.isTrue(funcTypedef.interfaces.isEmpty,
- "Non-empty interfaces map on typedef");
- Expect.isNotNull(funcTypedef.declaredMembers,
- "Declared members map is null on type def");
- Expect.isTrue(funcTypedef.declaredMembers.isEmpty,
- "Non-empty declared members map on typedef");
+ Expect.isNotNull(funcTypedef.superinterfaces);
+ Expect.isTrue(funcTypedef.superinterfaces.isEmpty);
+ Expect.isNotNull(funcTypedef.members);
+ Expect.isTrue(funcTypedef.members.isEmpty);
- // TODO(johnniwinther): Returned typedef should not be the declaration:
- Expect.isTrue(funcTypedef.isDeclaration, "Typedef is not declaration");
+ // TODO(johnniwinther): Returned typedef should not be the original
+ // declaration:
+ Expect.isTrue(funcTypedef.isOriginalDeclaration);
Expect.isFalse(funcTypedef.isClass, "Typedef is class");
Expect.isFalse(funcTypedef.isInterface, "Typedef is interface");
Expect.isFalse(funcTypedef.isPrivate, "Typedef is private");
- Expect.isNull(funcTypedef.defaultType,
- "Typedef default type is non-null");
+ Expect.isNull(funcTypedef.defaultFactory);
// TODO(johnniwinther): Should not throw an exception since the type should
- // not be the declaration.
+ // not be the original declaration.
Expect.throws(() => funcTypedef.typeArguments,
(exception) => true,
"Typedef has type arguments");
@@ -567,7 +575,7 @@
Expect.isNotNull(funcTypedefTypeVariables);
Expect.equals(2, funcTypedefTypeVariables.length);
- var funcTypedefDefinition = funcTypedef.definition;
+ var funcTypedefDefinition = funcTypedef.value;
Expect.isNotNull(funcTypedefDefinition);
Expect.isTrue(funcTypedefDefinition is FunctionTypeMirror);
@@ -594,24 +602,24 @@
Expect.stringEquals('mirrors_helper.Baz.==',
operator_eq.qualifiedName,
"Unexpected method qualifiedName");
- Expect.equals(operator_eq.surroundingDeclaration, bazClass,
- "Unexpected surrounding declaration");
- Expect.isFalse(operator_eq.isTopLevel, "Method is top level");
- Expect.isFalse(operator_eq.isConstructor, "Method is constructor");
- Expect.isFalse(operator_eq.isField, "Method is field");
- Expect.isTrue(operator_eq.isMethod, "Method is not method");
- Expect.isFalse(operator_eq.isPrivate, "Method is private");
- Expect.isFalse(operator_eq.isStatic, "Method is static");
- Expect.isTrue(operator_eq is MethodMirror, "Method is not MethodMirror");
- Expect.isFalse(operator_eq.isConst, "Method is const");
- Expect.isFalse(operator_eq.isFactory, "Method is factory");
- Expect.isNull(operator_eq.constructorName,
- "Method constructorName is non-null");
- Expect.isFalse(operator_eq.isGetter, "Method is getter");
- Expect.isFalse(operator_eq.isSetter, "Method is setter");
- Expect.isTrue(operator_eq.isOperator, "Method is not operator");
- Expect.stringEquals('==', operator_eq.operatorName,
- "Unexpected operatorName");
+ Expect.equals(operator_eq.owner, bazClass);
+ Expect.isFalse(operator_eq.isTopLevel);
+ Expect.isFalse(operator_eq.isConstructor);
+ Expect.isFalse(operator_eq.isField);
+ Expect.isTrue(operator_eq.isMethod);
+ Expect.isFalse(operator_eq.isPrivate);
+ Expect.isFalse(operator_eq.isStatic);
+ Expect.isTrue(operator_eq is MethodMirror);
+ Expect.isTrue(operator_eq.isRegularMethod);
+ Expect.isFalse(operator_eq.isConstConstructor);
+ Expect.isFalse(operator_eq.isGenerativeConstructor);
+ Expect.isFalse(operator_eq.isRedirectingConstructor);
+ Expect.isFalse(operator_eq.isFactoryConstructor);
+ Expect.isNull(operator_eq.constructorName);
+ Expect.isFalse(operator_eq.isGetter);
+ Expect.isFalse(operator_eq.isSetter);
+ Expect.isTrue(operator_eq.isOperator);
+ Expect.stringEquals('==', operator_eq.operatorName);
////////////////////////////////////////////////////////////////////////////
// int operator -() => 0;
@@ -624,25 +632,24 @@
Expect.stringEquals('mirrors_helper.Baz.${Mirror.UNARY_MINUS}',
operator_negate.qualifiedName,
"Unexpected method qualifiedName");
- Expect.equals(operator_negate.surroundingDeclaration, bazClass,
- "Unexpected surrounding declaration");
- Expect.isFalse(operator_negate.isTopLevel, "Method is top level");
- Expect.isFalse(operator_negate.isConstructor, "Method is constructor");
- Expect.isFalse(operator_negate.isField, "Method is field");
- Expect.isTrue(operator_negate.isMethod, "Method is not method");
- Expect.isFalse(operator_negate.isPrivate, "Method is private");
- Expect.isFalse(operator_negate.isStatic, "Method is static");
- Expect.isTrue(operator_negate is MethodMirror,
- "Method is not MethodMirror");
- Expect.isFalse(operator_negate.isConst, "Method is const");
- Expect.isFalse(operator_negate.isFactory, "Method is factory");
- Expect.isNull(operator_negate.constructorName,
- "Method constructorName is non-null");
- Expect.isFalse(operator_negate.isGetter, "Method is getter");
- Expect.isFalse(operator_negate.isSetter, "Method is setter");
- Expect.isTrue(operator_negate.isOperator, "Method is not operator");
- Expect.stringEquals('-', operator_negate.operatorName,
- "Unexpected operatorName");
+ Expect.equals(operator_negate.owner, bazClass);
+ Expect.isFalse(operator_negate.isTopLevel);
+ Expect.isFalse(operator_negate.isConstructor);
+ Expect.isFalse(operator_negate.isField);
+ Expect.isTrue(operator_negate.isMethod);
+ Expect.isFalse(operator_negate.isPrivate);
+ Expect.isFalse(operator_negate.isStatic);
+ Expect.isTrue(operator_negate is MethodMirror);
+ Expect.isTrue(operator_negate.isRegularMethod);
+ Expect.isFalse(operator_negate.isConstConstructor);
+ Expect.isFalse(operator_negate.isGenerativeConstructor);
+ Expect.isFalse(operator_negate.isRedirectingConstructor);
+ Expect.isFalse(operator_negate.isFactoryConstructor);
+ Expect.isNull(operator_negate.constructorName);
+ Expect.isFalse(operator_negate.isGetter);
+ Expect.isFalse(operator_negate.isSetter);
+ Expect.isTrue(operator_negate.isOperator);
+ Expect.stringEquals('-', operator_negate.operatorName);
var bazClassConstructors = bazClass.constructors;
@@ -650,33 +657,54 @@
Expect.equals(3, bazClassConstructors.length,
"Unexpected number of constructors");
+ ////////////////////////////////////////////////////////////////////////////
+ // Baz();
+ ////////////////////////////////////////////////////////////////////////////
var bazClassNonameConstructor = bazClassConstructors['Baz'];
Expect.isNotNull(bazClassNonameConstructor);
Expect.isTrue(bazClassNonameConstructor is MethodMirror);
Expect.isTrue(bazClassNonameConstructor.isConstructor);
- Expect.isFalse(bazClassNonameConstructor.isFactory);
+ Expect.isFalse(bazClassNonameConstructor.isRegularMethod);
+ Expect.isFalse(bazClassNonameConstructor.isConstConstructor);
+ Expect.isTrue(bazClassNonameConstructor.isGenerativeConstructor);
+ Expect.isFalse(bazClassNonameConstructor.isRedirectingConstructor);
+ Expect.isFalse(bazClassNonameConstructor.isFactoryConstructor);
Expect.stringEquals('Baz', bazClassNonameConstructor.simpleName);
Expect.stringEquals('Baz', bazClassNonameConstructor.displayName);
Expect.stringEquals('mirrors_helper.Baz.Baz',
bazClassNonameConstructor.qualifiedName);
Expect.stringEquals('', bazClassNonameConstructor.constructorName);
+ ////////////////////////////////////////////////////////////////////////////
+ // const Baz.named();
+ ////////////////////////////////////////////////////////////////////////////
var bazClassNamedConstructor = bazClassConstructors['Baz.named'];
Expect.isNotNull(bazClassNamedConstructor);
Expect.isTrue(bazClassNamedConstructor is MethodMirror);
Expect.isTrue(bazClassNamedConstructor.isConstructor);
- Expect.isFalse(bazClassNamedConstructor.isFactory);
+ Expect.isFalse(bazClassNamedConstructor.isRegularMethod);
+ Expect.isTrue(bazClassNamedConstructor.isConstConstructor);
+ Expect.isFalse(bazClassNamedConstructor.isGenerativeConstructor);
+ Expect.isFalse(bazClassNamedConstructor.isRedirectingConstructor);
+ Expect.isFalse(bazClassNamedConstructor.isFactoryConstructor);
Expect.stringEquals('Baz.named', bazClassNamedConstructor.simpleName);
Expect.stringEquals('Baz.named', bazClassNamedConstructor.displayName);
Expect.stringEquals('mirrors_helper.Baz.Baz.named',
bazClassNamedConstructor.qualifiedName);
Expect.stringEquals('named', bazClassNamedConstructor.constructorName);
+ ////////////////////////////////////////////////////////////////////////////
+ // factory Baz.factory() => new Baz<E,F>();
+ ////////////////////////////////////////////////////////////////////////////
var bazClassFactoryConstructor = bazClassConstructors['Baz.factory'];
Expect.isNotNull(bazClassFactoryConstructor);
Expect.isTrue(bazClassFactoryConstructor is MethodMirror);
Expect.isTrue(bazClassFactoryConstructor.isConstructor);
- Expect.isTrue(bazClassFactoryConstructor.isFactory);
+ Expect.isFalse(bazClassFactoryConstructor.isRegularMethod);
+ Expect.isFalse(bazClassFactoryConstructor.isConstConstructor);
+ Expect.isFalse(bazClassFactoryConstructor.isGenerativeConstructor);
+ Expect.isFalse(bazClassFactoryConstructor.isRedirectingConstructor);
+ Expect.isTrue(bazClassFactoryConstructor.isFactoryConstructor);
Expect.stringEquals('Baz.factory', bazClassFactoryConstructor.simpleName);
Expect.stringEquals('Baz.factory', bazClassFactoryConstructor.displayName);
Expect.stringEquals('mirrors_helper.Baz.Baz.factory',
@@ -696,46 +724,57 @@
// factory _PrivateClass._privateFactoryConstructor() => new _PrivateClass();
// }
void testPrivate(MirrorSystem system, LibraryMirror helperLibrary,
- Map<String,TypeMirror> types) {
- var privateClass = types['_PrivateClass'];
+ Map<String,TypeMirror> classes) {
+ var privateClass = classes['_PrivateClass'];
Expect.isNotNull(privateClass);
- Expect.isTrue(privateClass is InterfaceMirror);
+ Expect.isTrue(privateClass is ClassMirror);
Expect.isTrue(privateClass.isClass);
Expect.isTrue(privateClass.isPrivate);
- var privateField = privateClass.declaredMembers['_privateField'];
+ var privateField = privateClass.members['_privateField'];
Expect.isNotNull(privateField);
- Expect.isTrue(privateField is FieldMirror);
+ Expect.isTrue(privateField is VariableMirror);
Expect.isTrue(privateField.isPrivate);
- var privateGetter = privateClass.declaredMembers['_privateGetter'];
+ var privateGetter = privateClass.members['_privateGetter'];
Expect.isNotNull(privateGetter);
Expect.isTrue(privateGetter is MethodMirror);
Expect.isTrue(privateGetter.isGetter);
Expect.isTrue(privateGetter.isPrivate);
+ Expect.isFalse(privateGetter.isRegularMethod);
- var privateSetter = privateClass.declaredMembers['_privateSetter='];
+ var privateSetter = privateClass.members['_privateSetter='];
Expect.isNotNull(privateSetter);
Expect.isTrue(privateSetter is MethodMirror);
Expect.isTrue(privateSetter.isSetter);
Expect.isTrue(privateSetter.isPrivate);
+ Expect.isFalse(privateSetter.isRegularMethod);
- var privateMethod = privateClass.declaredMembers['_privateMethod'];
+ var privateMethod = privateClass.members['_privateMethod'];
Expect.isNotNull(privateMethod);
Expect.isTrue(privateMethod is MethodMirror);
Expect.isTrue(privateMethod.isPrivate);
+ Expect.isTrue(privateMethod.isRegularMethod);
var privateConstructor =
- privateClass.declaredMembers['_PrivateClass._privateConstructor'];
+ privateClass.members['_PrivateClass._privateConstructor'];
Expect.isNotNull(privateConstructor);
Expect.isTrue(privateConstructor is MethodMirror);
Expect.isTrue(privateConstructor.isConstructor);
Expect.isTrue(privateConstructor.isPrivate);
+ Expect.isFalse(privateConstructor.isConstConstructor);
+ Expect.isFalse(privateConstructor.isRedirectingConstructor);
+ Expect.isTrue(privateConstructor.isGenerativeConstructor);
+ Expect.isFalse(privateConstructor.isFactoryConstructor);
var privateFactoryConstructor =
- privateClass.declaredMembers['_PrivateClass._privateFactoryConstructor'];
+ privateClass.members['_PrivateClass._privateFactoryConstructor'];
Expect.isNotNull(privateFactoryConstructor);
Expect.isTrue(privateFactoryConstructor is MethodMirror);
- Expect.isTrue(privateFactoryConstructor.isFactory);
+ Expect.isTrue(privateFactoryConstructor.isConstructor);
Expect.isTrue(privateFactoryConstructor.isPrivate);
+ Expect.isFalse(privateFactoryConstructor.isConstConstructor);
+ Expect.isFalse(privateFactoryConstructor.isRedirectingConstructor);
+ Expect.isFalse(privateFactoryConstructor.isGenerativeConstructor);
+ Expect.isTrue(privateFactoryConstructor.isFactoryConstructor);
}
diff --git a/tests/compiler/dart2js/mock_compiler.dart b/tests/compiler/dart2js/mock_compiler.dart
index 0a26a09..50bb431 100644
--- a/tests/compiler/dart2js/mock_compiler.dart
+++ b/tests/compiler/dart2js/mock_compiler.dart
@@ -42,6 +42,7 @@
stringTypeCheck(x) {}
boolConversionCheck(x) {}
abstract class JavaScriptIndexingBehavior {}
+ class JSInvocationMirror {}
S() {}
assertHelper(a){}''';
@@ -92,6 +93,7 @@
// We need to set the assert method to avoid calls with a 'null'
// target being interpreted as a call to assert.
jsHelperLibrary = createLibrary("helper", helperSource);
+ importHelperLibrary(coreLibrary);
assertMethod = jsHelperLibrary.find(buildSourceString('assert'));
interceptorsLibrary = createLibrary("interceptors", interceptorsSource);
diff --git a/tests/compiler/dart2js/parser_helper.dart b/tests/compiler/dart2js/parser_helper.dart
index dca44ba..fecc694 100644
--- a/tests/compiler/dart2js/parser_helper.dart
+++ b/tests/compiler/dart2js/parser_helper.dart
@@ -8,11 +8,16 @@
import "../../../lib/compiler/implementation/elements/elements.dart";
import "../../../lib/compiler/implementation/tree/tree.dart";
-import '../../../lib/compiler/implementation/scanner/scannerlib.dart';
+import "../../../lib/compiler/implementation/scanner/scannerlib.dart";
import "../../../lib/compiler/implementation/dart2jslib.dart" hide SourceString;
import "../../../lib/compiler/implementation/source_file.dart";
import "../../../lib/compiler/implementation/util/util.dart";
+export "../../../lib/compiler/implementation/dart2jslib.dart"
+ show DiagnosticListener;
+// TODO(ahe): We should have token library to export instead.
+export "../../../lib/compiler/implementation/scanner/scannerlib.dart";
+
class LoggerCanceler implements DiagnosticListener {
void cancel(String reason, {node, token, instruction, element}) {
throw new CompilerCancelledException(reason);
@@ -25,16 +30,18 @@
Token scan(String text) => new StringScanner(text).tokenize();
-Node parseBodyCode(String text, Function parseMethod) {
+Node parseBodyCode(String text, Function parseMethod,
+ {DiagnosticListener diagnosticHandler}) {
Token tokens = scan(text);
- LoggerCanceler lc = new LoggerCanceler();
+ if (diagnosticHandler == null) diagnosticHandler = new LoggerCanceler();
Script script =
new Script(
new Uri.fromComponents(scheme: "source"),
new MockFile(text));
LibraryElement library = new LibraryElement(script);
library.canUseNative = true;
- NodeListener listener = new NodeListener(lc, library.entryCompilationUnit);
+ NodeListener listener =
+ new NodeListener(diagnosticHandler, library.entryCompilationUnit);
Parser parser = new Parser(listener);
Token endToken = parseMethod(parser, tokens);
assert(endToken.kind == EOF_TOKEN);
@@ -54,8 +61,10 @@
return element.parseNode(compiler);
}
-Node parseMember(String text) =>
- parseBodyCode(text, (parser, tokens) => parser.parseMember(tokens));
+Node parseMember(String text, {DiagnosticListener diagnosticHandler}) {
+ return parseBodyCode(text, (parser, tokens) => parser.parseMember(tokens),
+ diagnosticHandler: diagnosticHandler);
+}
class MockFile extends SourceFile {
MockFile(text)
diff --git a/tests/compiler/dart2js/parser_test.dart b/tests/compiler/dart2js/parser_test.dart
index 3847f48..c3a6e00 100644
--- a/tests/compiler/dart2js/parser_test.dart
+++ b/tests/compiler/dart2js/parser_test.dart
@@ -265,6 +265,34 @@
Expect.isNull(function.getOrSet);
}
+class Collector implements DiagnosticListener {
+ int token = -1;
+
+ void cancel(String reason, {node, token, instruction, element}) {
+ this.token = token.kind;
+ throw this;
+ }
+
+ void log(message) {
+ print(message);
+ }
+}
+
+void testMissingCloseParen() {
+ final String source =
+'''foo(x { // <= missing closing ")"
+ return x;
+}''';
+ parse() {
+ parseMember(source, diagnosticHandler: new Collector());
+ }
+ check(Collector c) {
+ Expect.equals(OPEN_CURLY_BRACKET_TOKEN, c.token);
+ return true;
+ }
+ Expect.throws(parse, check);
+}
+
void main() {
testGenericTypes();
// TODO(ahe): Enable this test when we handle library prefixes.
@@ -279,4 +307,5 @@
testIndex();
testPostfix();
testOperatorParse();
+ testMissingCloseParen();
}
diff --git a/tests/compiler/dart2js/partial_parser_test.dart b/tests/compiler/dart2js/partial_parser_test.dart
index 60454d7..0539dfd 100644
--- a/tests/compiler/dart2js/partial_parser_test.dart
+++ b/tests/compiler/dart2js/partial_parser_test.dart
@@ -2,8 +2,7 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-#import('parser_helper.dart');
-#import('../../../lib/compiler/implementation/scanner/scannerlib.dart');
+import 'parser_helper.dart';
void main() {
testSkipExpression();
diff --git a/tests/compiler/dart2js/patch_test.dart b/tests/compiler/dart2js/patch_test.dart
index a727f78..9770b3f 100644
--- a/tests/compiler/dart2js/patch_test.dart
+++ b/tests/compiler/dart2js/patch_test.dart
@@ -34,11 +34,7 @@
void expectHasNoBody(compiler, Element element) {
var node = element.parseNode(compiler);
Expect.isNotNull(node, "Element isn't parseable, when a body was expected");
- Expect.isNotNull(node.body);
- // If the element has no body it is a Block with identical begin and end
- // tokens (the semicolon).
- Expect.isTrue(node.body is Block);
- Expect.identical(node.body.getBeginToken(), node.body.getEndToken());
+ Expect.isFalse(node.hasBody());
}
Element ensure(compiler,
diff --git a/tests/compiler/dart2js/resolver_test.dart b/tests/compiler/dart2js/resolver_test.dart
index 4f964aa..3cb50bf 100644
--- a/tests/compiler/dart2js/resolver_test.dart
+++ b/tests/compiler/dart2js/resolver_test.dart
@@ -5,7 +5,7 @@
import 'dart:uri';
import "../../../lib/compiler/implementation/dart2jslib.dart"
- hide TreeElementMapping, TreeElements;
+ hide TreeElementMapping, TreeElements, SourceString;
import "../../../lib/compiler/implementation/resolution/resolution.dart";
import "../../../lib/compiler/implementation/elements/elements.dart";
import "../../../lib/compiler/implementation/tree/tree.dart";
diff --git a/tests/compiler/dart2js/type_checker_test.dart b/tests/compiler/dart2js/type_checker_test.dart
index 62d231e..cb06d74 100644
--- a/tests/compiler/dart2js/type_checker_test.dart
+++ b/tests/compiler/dart2js/type_checker_test.dart
@@ -2,13 +2,12 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-import "../../../lib/compiler/implementation/dart2jslib.dart" hide SourceString;
-import "../../../lib/compiler/implementation/elements/elements.dart";
-import "../../../lib/compiler/implementation/tree/tree.dart";
-import '../../../lib/compiler/implementation/scanner/scannerlib.dart';
-import "../../../lib/compiler/implementation/util/util.dart";
-import "mock_compiler.dart";
-import "parser_helper.dart";
+import '../../../lib/compiler/implementation/dart2jslib.dart' hide SourceString;
+import '../../../lib/compiler/implementation/elements/elements.dart';
+import '../../../lib/compiler/implementation/tree/tree.dart';
+import '../../../lib/compiler/implementation/util/util.dart';
+import 'mock_compiler.dart';
+import 'parser_helper.dart';
DartType intType;
DartType boolType;
diff --git a/tests/compiler/dart2js/type_combination_test.dart b/tests/compiler/dart2js/type_combination_test.dart
index 7dbc058..fa2c48a 100644
--- a/tests/compiler/dart2js/type_combination_test.dart
+++ b/tests/compiler/dart2js/type_combination_test.dart
@@ -2,12 +2,8 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-#source("../../../lib/compiler/implementation/ssa/types.dart");
-
-class DartType {
- const DartType(this.str);
- final String str;
-}
+#import("mock_compiler.dart");
+#import("../../../lib/compiler/implementation/ssa/ssa.dart");
const CONFLICTING = HType.CONFLICTING;
const UNKNOWN = HType.UNKNOWN;
@@ -21,1048 +17,2021 @@
const MUTABLE_ARRAY = HType.MUTABLE_ARRAY;
const FIXED_ARRAY = HType.FIXED_ARRAY;
const EXTENDABLE_ARRAY = HType.EXTENDABLE_ARRAY;
-const NON_PRIMITIVE1 = const HBoundedType.nonNull(const DartType("type1"));
-const NON_PRIMITIVE2 = const HBoundedType.nonNull(const DartType("type2"));
-const POTENTIAL_ARRAY =
- const HBoundedPotentialPrimitiveArray(const DartType('type 3'), true);
-const POTENTIAL_STRING =
- const HBoundedPotentialPrimitiveString(const DartType('type 4'), true);
const BOOLEAN_OR_NULL = HType.BOOLEAN_OR_NULL;
const NUMBER_OR_NULL = HType.NUMBER_OR_NULL;
const INTEGER_OR_NULL = HType.INTEGER_OR_NULL;
const DOUBLE_OR_NULL = HType.DOUBLE_OR_NULL;
const STRING_OR_NULL = HType.STRING_OR_NULL;
const NULL = HType.NULL;
+HType nonPrimitive1;
+HType nonPrimitive2;
+HType potentialArray;
+HType potentialString;
-void testUnion() {
- Expect.equals(CONFLICTING, CONFLICTING.union(CONFLICTING));
- Expect.equals(UNKNOWN, CONFLICTING.union(UNKNOWN));
- Expect.equals(BOOLEAN, CONFLICTING.union(BOOLEAN));
- Expect.equals(NUMBER, CONFLICTING.union(NUMBER));
- Expect.equals(INTEGER, CONFLICTING.union(INTEGER));
- Expect.equals(DOUBLE, CONFLICTING.union(DOUBLE));
- Expect.equals(INDEXABLE_PRIMITIVE, CONFLICTING.union(INDEXABLE_PRIMITIVE));
- Expect.equals(STRING, CONFLICTING.union(STRING));
- Expect.equals(READABLE_ARRAY, CONFLICTING.union(READABLE_ARRAY));
- Expect.equals(MUTABLE_ARRAY, CONFLICTING.union(MUTABLE_ARRAY));
- Expect.equals(EXTENDABLE_ARRAY, CONFLICTING.union(EXTENDABLE_ARRAY));
- Expect.equals(NON_PRIMITIVE1, CONFLICTING.union(NON_PRIMITIVE1));
- Expect.equals(NON_PRIMITIVE2, CONFLICTING.union(NON_PRIMITIVE2));
- Expect.equals(POTENTIAL_ARRAY, CONFLICTING.union(POTENTIAL_ARRAY));
- Expect.equals(POTENTIAL_STRING, CONFLICTING.union(POTENTIAL_STRING));
- Expect.equals(BOOLEAN_OR_NULL, CONFLICTING.union(BOOLEAN_OR_NULL));
- Expect.equals(NUMBER_OR_NULL, CONFLICTING.union(NUMBER_OR_NULL));
- Expect.equals(INTEGER_OR_NULL, CONFLICTING.union(INTEGER_OR_NULL));
- Expect.equals(DOUBLE_OR_NULL, CONFLICTING.union(DOUBLE_OR_NULL));
- Expect.equals(STRING_OR_NULL, CONFLICTING.union(STRING_OR_NULL));
- Expect.equals(NULL, CONFLICTING.union(NULL));
- Expect.equals(FIXED_ARRAY, CONFLICTING.union(FIXED_ARRAY));
+void testUnion(MockCompiler compiler) {
+ Expect.equals(CONFLICTING,
+ CONFLICTING.union(CONFLICTING, compiler));
+ Expect.equals(UNKNOWN,
+ CONFLICTING.union(UNKNOWN, compiler));
+ Expect.equals(BOOLEAN,
+ CONFLICTING.union(BOOLEAN, compiler));
+ Expect.equals(NUMBER,
+ CONFLICTING.union(NUMBER, compiler));
+ Expect.equals(INTEGER,
+ CONFLICTING.union(INTEGER, compiler));
+ Expect.equals(DOUBLE,
+ CONFLICTING.union(DOUBLE, compiler));
+ Expect.equals(INDEXABLE_PRIMITIVE,
+ CONFLICTING.union(INDEXABLE_PRIMITIVE, compiler));
+ Expect.equals(STRING,
+ CONFLICTING.union(STRING, compiler));
+ Expect.equals(READABLE_ARRAY,
+ CONFLICTING.union(READABLE_ARRAY, compiler));
+ Expect.equals(MUTABLE_ARRAY,
+ CONFLICTING.union(MUTABLE_ARRAY, compiler));
+ Expect.equals(EXTENDABLE_ARRAY,
+ CONFLICTING.union(EXTENDABLE_ARRAY, compiler));
+ Expect.equals(nonPrimitive1,
+ CONFLICTING.union(nonPrimitive1, compiler));
+ Expect.equals(nonPrimitive2,
+ CONFLICTING.union(nonPrimitive2, compiler));
+ Expect.equals(potentialArray,
+ CONFLICTING.union(potentialArray, compiler));
+ Expect.equals(potentialString,
+ CONFLICTING.union(potentialString, compiler));
+ Expect.equals(BOOLEAN_OR_NULL,
+ CONFLICTING.union(BOOLEAN_OR_NULL, compiler));
+ Expect.equals(NUMBER_OR_NULL,
+ CONFLICTING.union(NUMBER_OR_NULL, compiler));
+ Expect.equals(INTEGER_OR_NULL,
+ CONFLICTING.union(INTEGER_OR_NULL, compiler));
+ Expect.equals(DOUBLE_OR_NULL,
+ CONFLICTING.union(DOUBLE_OR_NULL, compiler));
+ Expect.equals(STRING_OR_NULL,
+ CONFLICTING.union(STRING_OR_NULL, compiler));
+ Expect.equals(NULL,
+ CONFLICTING.union(NULL, compiler));
+ Expect.equals(FIXED_ARRAY,
+ CONFLICTING.union(FIXED_ARRAY, compiler));
- Expect.equals(UNKNOWN, UNKNOWN.union(CONFLICTING));
- Expect.equals(UNKNOWN, UNKNOWN.union(UNKNOWN));
- Expect.equals(UNKNOWN, UNKNOWN.union(BOOLEAN));
- Expect.equals(UNKNOWN, UNKNOWN.union(NUMBER));
- Expect.equals(UNKNOWN, UNKNOWN.union(INTEGER));
- Expect.equals(UNKNOWN, UNKNOWN.union(DOUBLE));
- Expect.equals(UNKNOWN, UNKNOWN.union(INDEXABLE_PRIMITIVE));
- Expect.equals(UNKNOWN, UNKNOWN.union(STRING));
- Expect.equals(UNKNOWN, UNKNOWN.union(READABLE_ARRAY));
- Expect.equals(UNKNOWN, UNKNOWN.union(MUTABLE_ARRAY));
- Expect.equals(UNKNOWN, UNKNOWN.union(EXTENDABLE_ARRAY));
- Expect.equals(UNKNOWN, UNKNOWN.union(NON_PRIMITIVE1));
- Expect.equals(UNKNOWN, UNKNOWN.union(NON_PRIMITIVE2));
- Expect.equals(UNKNOWN, UNKNOWN.union(POTENTIAL_ARRAY));
- Expect.equals(UNKNOWN, UNKNOWN.union(POTENTIAL_STRING));
- Expect.equals(UNKNOWN, UNKNOWN.union(BOOLEAN_OR_NULL));
- Expect.equals(UNKNOWN, UNKNOWN.union(NUMBER_OR_NULL));
- Expect.equals(UNKNOWN, UNKNOWN.union(INTEGER_OR_NULL));
- Expect.equals(UNKNOWN, UNKNOWN.union(DOUBLE_OR_NULL));
- Expect.equals(UNKNOWN, UNKNOWN.union(STRING_OR_NULL));
- Expect.equals(UNKNOWN, UNKNOWN.union(NULL));
- Expect.equals(UNKNOWN, UNKNOWN.union(FIXED_ARRAY));
+ Expect.equals(UNKNOWN,
+ UNKNOWN.union(CONFLICTING, compiler));
+ Expect.equals(UNKNOWN,
+ UNKNOWN.union(UNKNOWN, compiler));
+ Expect.equals(UNKNOWN,
+ UNKNOWN.union(BOOLEAN, compiler));
+ Expect.equals(UNKNOWN,
+ UNKNOWN.union(NUMBER, compiler));
+ Expect.equals(UNKNOWN,
+ UNKNOWN.union(INTEGER, compiler));
+ Expect.equals(UNKNOWN,
+ UNKNOWN.union(DOUBLE, compiler));
+ Expect.equals(UNKNOWN,
+ UNKNOWN.union(INDEXABLE_PRIMITIVE, compiler));
+ Expect.equals(UNKNOWN,
+ UNKNOWN.union(STRING, compiler));
+ Expect.equals(UNKNOWN,
+ UNKNOWN.union(READABLE_ARRAY, compiler));
+ Expect.equals(UNKNOWN,
+ UNKNOWN.union(MUTABLE_ARRAY, compiler));
+ Expect.equals(UNKNOWN,
+ UNKNOWN.union(EXTENDABLE_ARRAY, compiler));
+ Expect.equals(UNKNOWN,
+ UNKNOWN.union(nonPrimitive1, compiler));
+ Expect.equals(UNKNOWN,
+ UNKNOWN.union(nonPrimitive2, compiler));
+ Expect.equals(UNKNOWN,
+ UNKNOWN.union(potentialArray, compiler));
+ Expect.equals(UNKNOWN,
+ UNKNOWN.union(potentialString, compiler));
+ Expect.equals(UNKNOWN,
+ UNKNOWN.union(BOOLEAN_OR_NULL, compiler));
+ Expect.equals(UNKNOWN,
+ UNKNOWN.union(NUMBER_OR_NULL, compiler));
+ Expect.equals(UNKNOWN,
+ UNKNOWN.union(INTEGER_OR_NULL, compiler));
+ Expect.equals(UNKNOWN,
+ UNKNOWN.union(DOUBLE_OR_NULL, compiler));
+ Expect.equals(UNKNOWN,
+ UNKNOWN.union(STRING_OR_NULL, compiler));
+ Expect.equals(UNKNOWN,
+ UNKNOWN.union(NULL, compiler));
+ Expect.equals(UNKNOWN,
+ UNKNOWN.union(FIXED_ARRAY, compiler));
- Expect.equals(BOOLEAN, BOOLEAN.union(CONFLICTING));
- Expect.equals(UNKNOWN, BOOLEAN.union(UNKNOWN));
- Expect.equals(BOOLEAN, BOOLEAN.union(BOOLEAN));
- Expect.equals(UNKNOWN, BOOLEAN.union(NUMBER));
- Expect.equals(UNKNOWN, BOOLEAN.union(INTEGER));
- Expect.equals(UNKNOWN, BOOLEAN.union(DOUBLE));
- Expect.equals(UNKNOWN, BOOLEAN.union(INDEXABLE_PRIMITIVE));
- Expect.equals(UNKNOWN, BOOLEAN.union(STRING));
- Expect.equals(UNKNOWN, BOOLEAN.union(READABLE_ARRAY));
- Expect.equals(UNKNOWN, BOOLEAN.union(MUTABLE_ARRAY));
- Expect.equals(UNKNOWN, BOOLEAN.union(EXTENDABLE_ARRAY));
- Expect.equals(UNKNOWN, BOOLEAN.union(NON_PRIMITIVE1));
- Expect.equals(UNKNOWN, BOOLEAN.union(NON_PRIMITIVE2));
- Expect.equals(UNKNOWN, BOOLEAN.union(POTENTIAL_ARRAY));
- Expect.equals(UNKNOWN, BOOLEAN.union(POTENTIAL_STRING));
- Expect.equals(BOOLEAN_OR_NULL, BOOLEAN.union(BOOLEAN_OR_NULL));
- Expect.equals(UNKNOWN, BOOLEAN.union(NUMBER_OR_NULL));
- Expect.equals(UNKNOWN, BOOLEAN.union(INTEGER_OR_NULL));
- Expect.equals(UNKNOWN, BOOLEAN.union(DOUBLE_OR_NULL));
- Expect.equals(UNKNOWN, BOOLEAN.union(STRING_OR_NULL));
- Expect.equals(BOOLEAN_OR_NULL, BOOLEAN.union(NULL));
- Expect.equals(UNKNOWN, BOOLEAN.union(FIXED_ARRAY));
+ Expect.equals(BOOLEAN,
+ BOOLEAN.union(CONFLICTING, compiler));
+ Expect.equals(UNKNOWN,
+ BOOLEAN.union(UNKNOWN, compiler));
+ Expect.equals(BOOLEAN,
+ BOOLEAN.union(BOOLEAN, compiler));
+ Expect.equals(UNKNOWN,
+ BOOLEAN.union(NUMBER, compiler));
+ Expect.equals(UNKNOWN,
+ BOOLEAN.union(INTEGER, compiler));
+ Expect.equals(UNKNOWN,
+ BOOLEAN.union(DOUBLE, compiler));
+ Expect.equals(UNKNOWN,
+ BOOLEAN.union(INDEXABLE_PRIMITIVE, compiler));
+ Expect.equals(UNKNOWN,
+ BOOLEAN.union(STRING, compiler));
+ Expect.equals(UNKNOWN,
+ BOOLEAN.union(READABLE_ARRAY, compiler));
+ Expect.equals(UNKNOWN,
+ BOOLEAN.union(MUTABLE_ARRAY, compiler));
+ Expect.equals(UNKNOWN,
+ BOOLEAN.union(EXTENDABLE_ARRAY, compiler));
+ Expect.equals(UNKNOWN,
+ BOOLEAN.union(nonPrimitive1, compiler));
+ Expect.equals(UNKNOWN,
+ BOOLEAN.union(nonPrimitive2, compiler));
+ Expect.equals(UNKNOWN,
+ BOOLEAN.union(potentialArray, compiler));
+ Expect.equals(UNKNOWN,
+ BOOLEAN.union(potentialString, compiler));
+ Expect.equals(BOOLEAN_OR_NULL,
+ BOOLEAN.union(BOOLEAN_OR_NULL, compiler));
+ Expect.equals(UNKNOWN,
+ BOOLEAN.union(NUMBER_OR_NULL, compiler));
+ Expect.equals(UNKNOWN,
+ BOOLEAN.union(INTEGER_OR_NULL, compiler));
+ Expect.equals(UNKNOWN,
+ BOOLEAN.union(DOUBLE_OR_NULL, compiler));
+ Expect.equals(UNKNOWN,
+ BOOLEAN.union(STRING_OR_NULL, compiler));
+ Expect.equals(BOOLEAN_OR_NULL,
+ BOOLEAN.union(NULL, compiler));
+ Expect.equals(UNKNOWN,
+ BOOLEAN.union(FIXED_ARRAY, compiler));
- Expect.equals(NUMBER, NUMBER.union(CONFLICTING));
- Expect.equals(UNKNOWN, NUMBER.union(UNKNOWN));
- Expect.equals(UNKNOWN, NUMBER.union(BOOLEAN));
- Expect.equals(NUMBER, NUMBER.union(NUMBER));
- Expect.equals(NUMBER, NUMBER.union(INTEGER));
- Expect.equals(NUMBER, NUMBER.union(DOUBLE));
- Expect.equals(UNKNOWN, NUMBER.union(INDEXABLE_PRIMITIVE));
- Expect.equals(UNKNOWN, NUMBER.union(STRING));
- Expect.equals(UNKNOWN, NUMBER.union(READABLE_ARRAY));
- Expect.equals(UNKNOWN, NUMBER.union(MUTABLE_ARRAY));
- Expect.equals(UNKNOWN, NUMBER.union(EXTENDABLE_ARRAY));
- Expect.equals(UNKNOWN, NUMBER.union(NON_PRIMITIVE1));
- Expect.equals(UNKNOWN, NUMBER.union(NON_PRIMITIVE2));
- Expect.equals(UNKNOWN, NUMBER.union(POTENTIAL_ARRAY));
- Expect.equals(UNKNOWN, NUMBER.union(POTENTIAL_STRING));
- Expect.equals(UNKNOWN, NUMBER.union(BOOLEAN_OR_NULL));
- Expect.equals(NUMBER_OR_NULL, NUMBER.union(NUMBER_OR_NULL));
- Expect.equals(NUMBER_OR_NULL, NUMBER.union(INTEGER_OR_NULL));
- Expect.equals(NUMBER_OR_NULL, NUMBER.union(DOUBLE_OR_NULL));
- Expect.equals(UNKNOWN, NUMBER.union(STRING_OR_NULL));
- Expect.equals(NUMBER_OR_NULL, NUMBER.union(NULL));
- Expect.equals(UNKNOWN, NUMBER.union(FIXED_ARRAY));
+ Expect.equals(NUMBER,
+ NUMBER.union(CONFLICTING, compiler));
+ Expect.equals(UNKNOWN,
+ NUMBER.union(UNKNOWN, compiler));
+ Expect.equals(UNKNOWN,
+ NUMBER.union(BOOLEAN, compiler));
+ Expect.equals(NUMBER,
+ NUMBER.union(NUMBER, compiler));
+ Expect.equals(NUMBER,
+ NUMBER.union(INTEGER, compiler));
+ Expect.equals(NUMBER,
+ NUMBER.union(DOUBLE, compiler));
+ Expect.equals(UNKNOWN,
+ NUMBER.union(INDEXABLE_PRIMITIVE, compiler));
+ Expect.equals(UNKNOWN,
+ NUMBER.union(STRING, compiler));
+ Expect.equals(UNKNOWN,
+ NUMBER.union(READABLE_ARRAY, compiler));
+ Expect.equals(UNKNOWN,
+ NUMBER.union(MUTABLE_ARRAY, compiler));
+ Expect.equals(UNKNOWN,
+ NUMBER.union(EXTENDABLE_ARRAY, compiler));
+ Expect.equals(UNKNOWN,
+ NUMBER.union(nonPrimitive1, compiler));
+ Expect.equals(UNKNOWN,
+ NUMBER.union(nonPrimitive2, compiler));
+ Expect.equals(UNKNOWN,
+ NUMBER.union(potentialArray, compiler));
+ Expect.equals(UNKNOWN,
+ NUMBER.union(potentialString, compiler));
+ Expect.equals(UNKNOWN,
+ NUMBER.union(BOOLEAN_OR_NULL, compiler));
+ Expect.equals(NUMBER_OR_NULL,
+ NUMBER.union(NUMBER_OR_NULL, compiler));
+ Expect.equals(NUMBER_OR_NULL,
+ NUMBER.union(INTEGER_OR_NULL, compiler));
+ Expect.equals(NUMBER_OR_NULL,
+ NUMBER.union(DOUBLE_OR_NULL, compiler));
+ Expect.equals(UNKNOWN,
+ NUMBER.union(STRING_OR_NULL, compiler));
+ Expect.equals(NUMBER_OR_NULL,
+ NUMBER.union(NULL, compiler));
+ Expect.equals(UNKNOWN,
+ NUMBER.union(FIXED_ARRAY, compiler));
- Expect.equals(INTEGER, INTEGER.union(CONFLICTING));
- Expect.equals(UNKNOWN, INTEGER.union(UNKNOWN));
- Expect.equals(UNKNOWN, INTEGER.union(BOOLEAN));
- Expect.equals(NUMBER, INTEGER.union(NUMBER));
- Expect.equals(INTEGER, INTEGER.union(INTEGER));
- Expect.equals(NUMBER, INTEGER.union(DOUBLE));
- Expect.equals(UNKNOWN, INTEGER.union(INDEXABLE_PRIMITIVE));
- Expect.equals(UNKNOWN, INTEGER.union(STRING));
- Expect.equals(UNKNOWN, INTEGER.union(READABLE_ARRAY));
- Expect.equals(UNKNOWN, INTEGER.union(MUTABLE_ARRAY));
- Expect.equals(UNKNOWN, INTEGER.union(EXTENDABLE_ARRAY));
- Expect.equals(UNKNOWN, INTEGER.union(NON_PRIMITIVE1));
- Expect.equals(UNKNOWN, INTEGER.union(NON_PRIMITIVE2));
- Expect.equals(UNKNOWN, INTEGER.union(POTENTIAL_ARRAY));
- Expect.equals(UNKNOWN, INTEGER.union(POTENTIAL_STRING));
- Expect.equals(UNKNOWN, INTEGER.union(BOOLEAN_OR_NULL));
- Expect.equals(NUMBER_OR_NULL, INTEGER.union(NUMBER_OR_NULL));
- Expect.equals(INTEGER_OR_NULL, INTEGER.union(INTEGER_OR_NULL));
- Expect.equals(NUMBER_OR_NULL, INTEGER.union(DOUBLE_OR_NULL));
- Expect.equals(UNKNOWN, INTEGER.union(STRING_OR_NULL));
- Expect.equals(INTEGER_OR_NULL, INTEGER.union(NULL));
- Expect.equals(UNKNOWN, INTEGER.union(FIXED_ARRAY));
+ Expect.equals(INTEGER,
+ INTEGER.union(CONFLICTING, compiler));
+ Expect.equals(UNKNOWN,
+ INTEGER.union(UNKNOWN, compiler));
+ Expect.equals(UNKNOWN,
+ INTEGER.union(BOOLEAN, compiler));
+ Expect.equals(NUMBER,
+ INTEGER.union(NUMBER, compiler));
+ Expect.equals(INTEGER,
+ INTEGER.union(INTEGER, compiler));
+ Expect.equals(NUMBER,
+ INTEGER.union(DOUBLE, compiler));
+ Expect.equals(UNKNOWN,
+ INTEGER.union(INDEXABLE_PRIMITIVE, compiler));
+ Expect.equals(UNKNOWN,
+ INTEGER.union(STRING, compiler));
+ Expect.equals(UNKNOWN,
+ INTEGER.union(READABLE_ARRAY, compiler));
+ Expect.equals(UNKNOWN,
+ INTEGER.union(MUTABLE_ARRAY, compiler));
+ Expect.equals(UNKNOWN,
+ INTEGER.union(EXTENDABLE_ARRAY, compiler));
+ Expect.equals(UNKNOWN,
+ INTEGER.union(nonPrimitive1, compiler));
+ Expect.equals(UNKNOWN,
+ INTEGER.union(nonPrimitive2, compiler));
+ Expect.equals(UNKNOWN,
+ INTEGER.union(potentialArray, compiler));
+ Expect.equals(UNKNOWN,
+ INTEGER.union(potentialString, compiler));
+ Expect.equals(UNKNOWN,
+ INTEGER.union(BOOLEAN_OR_NULL, compiler));
+ Expect.equals(NUMBER_OR_NULL,
+ INTEGER.union(NUMBER_OR_NULL, compiler));
+ Expect.equals(INTEGER_OR_NULL,
+ INTEGER.union(INTEGER_OR_NULL, compiler));
+ Expect.equals(NUMBER_OR_NULL,
+ INTEGER.union(DOUBLE_OR_NULL, compiler));
+ Expect.equals(UNKNOWN,
+ INTEGER.union(STRING_OR_NULL, compiler));
+ Expect.equals(INTEGER_OR_NULL,
+ INTEGER.union(NULL, compiler));
+ Expect.equals(UNKNOWN,
+ INTEGER.union(FIXED_ARRAY, compiler));
- Expect.equals(DOUBLE, DOUBLE.union(CONFLICTING));
- Expect.equals(UNKNOWN, DOUBLE.union(UNKNOWN));
- Expect.equals(UNKNOWN, DOUBLE.union(BOOLEAN));
- Expect.equals(NUMBER, DOUBLE.union(NUMBER));
- Expect.equals(NUMBER, DOUBLE.union(INTEGER));
- Expect.equals(DOUBLE, DOUBLE.union(DOUBLE));
- Expect.equals(UNKNOWN, DOUBLE.union(INDEXABLE_PRIMITIVE));
- Expect.equals(UNKNOWN, DOUBLE.union(STRING));
- Expect.equals(UNKNOWN, DOUBLE.union(READABLE_ARRAY));
- Expect.equals(UNKNOWN, DOUBLE.union(MUTABLE_ARRAY));
- Expect.equals(UNKNOWN, DOUBLE.union(EXTENDABLE_ARRAY));
- Expect.equals(UNKNOWN, DOUBLE.union(NON_PRIMITIVE1));
- Expect.equals(UNKNOWN, DOUBLE.union(NON_PRIMITIVE2));
- Expect.equals(UNKNOWN, DOUBLE.union(POTENTIAL_ARRAY));
- Expect.equals(UNKNOWN, DOUBLE.union(POTENTIAL_STRING));
- Expect.equals(UNKNOWN, DOUBLE.union(BOOLEAN_OR_NULL));
- Expect.equals(NUMBER_OR_NULL, DOUBLE.union(NUMBER_OR_NULL));
- Expect.equals(NUMBER_OR_NULL, DOUBLE.union(INTEGER_OR_NULL));
- Expect.equals(DOUBLE_OR_NULL, DOUBLE.union(DOUBLE_OR_NULL));
- Expect.equals(UNKNOWN, DOUBLE.union(STRING_OR_NULL));
- Expect.equals(DOUBLE_OR_NULL, DOUBLE.union(NULL));
- Expect.equals(UNKNOWN, DOUBLE.union(FIXED_ARRAY));
+ Expect.equals(DOUBLE,
+ DOUBLE.union(CONFLICTING, compiler));
+ Expect.equals(UNKNOWN,
+ DOUBLE.union(UNKNOWN, compiler));
+ Expect.equals(UNKNOWN,
+ DOUBLE.union(BOOLEAN, compiler));
+ Expect.equals(NUMBER,
+ DOUBLE.union(NUMBER, compiler));
+ Expect.equals(NUMBER,
+ DOUBLE.union(INTEGER, compiler));
+ Expect.equals(DOUBLE,
+ DOUBLE.union(DOUBLE, compiler));
+ Expect.equals(UNKNOWN,
+ DOUBLE.union(INDEXABLE_PRIMITIVE, compiler));
+ Expect.equals(UNKNOWN,
+ DOUBLE.union(STRING, compiler));
+ Expect.equals(UNKNOWN,
+ DOUBLE.union(READABLE_ARRAY, compiler));
+ Expect.equals(UNKNOWN,
+ DOUBLE.union(MUTABLE_ARRAY, compiler));
+ Expect.equals(UNKNOWN,
+ DOUBLE.union(EXTENDABLE_ARRAY, compiler));
+ Expect.equals(UNKNOWN,
+ DOUBLE.union(nonPrimitive1, compiler));
+ Expect.equals(UNKNOWN,
+ DOUBLE.union(nonPrimitive2, compiler));
+ Expect.equals(UNKNOWN,
+ DOUBLE.union(potentialArray, compiler));
+ Expect.equals(UNKNOWN,
+ DOUBLE.union(potentialString, compiler));
+ Expect.equals(UNKNOWN,
+ DOUBLE.union(BOOLEAN_OR_NULL, compiler));
+ Expect.equals(NUMBER_OR_NULL,
+ DOUBLE.union(NUMBER_OR_NULL, compiler));
+ Expect.equals(NUMBER_OR_NULL,
+ DOUBLE.union(INTEGER_OR_NULL, compiler));
+ Expect.equals(DOUBLE_OR_NULL,
+ DOUBLE.union(DOUBLE_OR_NULL, compiler));
+ Expect.equals(UNKNOWN,
+ DOUBLE.union(STRING_OR_NULL, compiler));
+ Expect.equals(DOUBLE_OR_NULL,
+ DOUBLE.union(NULL, compiler));
+ Expect.equals(UNKNOWN,
+ DOUBLE.union(FIXED_ARRAY, compiler));
- Expect.equals(INDEXABLE_PRIMITIVE, INDEXABLE_PRIMITIVE.union(CONFLICTING));
- Expect.equals(UNKNOWN, INDEXABLE_PRIMITIVE.union(UNKNOWN));
- Expect.equals(UNKNOWN, INDEXABLE_PRIMITIVE.union(BOOLEAN));
- Expect.equals(UNKNOWN, INDEXABLE_PRIMITIVE.union(NUMBER));
- Expect.equals(UNKNOWN, INDEXABLE_PRIMITIVE.union(INTEGER));
- Expect.equals(UNKNOWN, INDEXABLE_PRIMITIVE.union(DOUBLE));
+ Expect.equals(INDEXABLE_PRIMITIVE,
+ INDEXABLE_PRIMITIVE.union(CONFLICTING, compiler));
+ Expect.equals(UNKNOWN,
+ INDEXABLE_PRIMITIVE.union(UNKNOWN, compiler));
+ Expect.equals(UNKNOWN,
+ INDEXABLE_PRIMITIVE.union(BOOLEAN, compiler));
+ Expect.equals(UNKNOWN,
+ INDEXABLE_PRIMITIVE.union(NUMBER, compiler));
+ Expect.equals(UNKNOWN,
+ INDEXABLE_PRIMITIVE.union(INTEGER, compiler));
+ Expect.equals(UNKNOWN,
+ INDEXABLE_PRIMITIVE.union(DOUBLE, compiler));
Expect.equals(INDEXABLE_PRIMITIVE,
- INDEXABLE_PRIMITIVE.union(INDEXABLE_PRIMITIVE));
- Expect.equals(INDEXABLE_PRIMITIVE, INDEXABLE_PRIMITIVE.union(STRING));
- Expect.equals(INDEXABLE_PRIMITIVE, INDEXABLE_PRIMITIVE.union(READABLE_ARRAY));
- Expect.equals(INDEXABLE_PRIMITIVE, INDEXABLE_PRIMITIVE.union(MUTABLE_ARRAY));
+ INDEXABLE_PRIMITIVE.union(INDEXABLE_PRIMITIVE,
+ compiler));
+ Expect.equals(INDEXABLE_PRIMITIVE,
+ INDEXABLE_PRIMITIVE.union(STRING, compiler));
+ Expect.equals(INDEXABLE_PRIMITIVE,
+ INDEXABLE_PRIMITIVE.union(READABLE_ARRAY, compiler));
+ Expect.equals(INDEXABLE_PRIMITIVE,
+ INDEXABLE_PRIMITIVE.union(MUTABLE_ARRAY, compiler));
Expect.equals(INDEXABLE_PRIMITIVE,
- INDEXABLE_PRIMITIVE.union(EXTENDABLE_ARRAY));
- Expect.equals(UNKNOWN, INDEXABLE_PRIMITIVE.union(NON_PRIMITIVE1));
- Expect.equals(UNKNOWN, INDEXABLE_PRIMITIVE.union(NON_PRIMITIVE2));
- Expect.equals(UNKNOWN, INDEXABLE_PRIMITIVE.union(POTENTIAL_ARRAY));
- Expect.equals(UNKNOWN, INDEXABLE_PRIMITIVE.union(POTENTIAL_STRING));
- Expect.equals(UNKNOWN, INDEXABLE_PRIMITIVE.union(BOOLEAN_OR_NULL));
- Expect.equals(UNKNOWN, INDEXABLE_PRIMITIVE.union(NUMBER_OR_NULL));
- Expect.equals(UNKNOWN, INDEXABLE_PRIMITIVE.union(INTEGER_OR_NULL));
- Expect.equals(UNKNOWN, INDEXABLE_PRIMITIVE.union(DOUBLE_OR_NULL));
- Expect.equals(UNKNOWN, INDEXABLE_PRIMITIVE.union(STRING_OR_NULL));
- Expect.equals(UNKNOWN, INDEXABLE_PRIMITIVE.union(NULL));
- Expect.equals(INDEXABLE_PRIMITIVE, INDEXABLE_PRIMITIVE.union(FIXED_ARRAY));
+ INDEXABLE_PRIMITIVE.union(EXTENDABLE_ARRAY,
+ compiler));
+ Expect.equals(UNKNOWN,
+ INDEXABLE_PRIMITIVE.union(nonPrimitive1, compiler));
+ Expect.equals(UNKNOWN,
+ INDEXABLE_PRIMITIVE.union(nonPrimitive2, compiler));
+ Expect.equals(UNKNOWN,
+ INDEXABLE_PRIMITIVE.union(potentialArray, compiler));
+ Expect.equals(UNKNOWN,
+ INDEXABLE_PRIMITIVE.union(potentialString, compiler));
+ Expect.equals(UNKNOWN,
+ INDEXABLE_PRIMITIVE.union(BOOLEAN_OR_NULL, compiler));
+ Expect.equals(UNKNOWN,
+ INDEXABLE_PRIMITIVE.union(NUMBER_OR_NULL, compiler));
+ Expect.equals(UNKNOWN,
+ INDEXABLE_PRIMITIVE.union(INTEGER_OR_NULL, compiler));
+ Expect.equals(UNKNOWN,
+ INDEXABLE_PRIMITIVE.union(DOUBLE_OR_NULL, compiler));
+ Expect.equals(UNKNOWN,
+ INDEXABLE_PRIMITIVE.union(STRING_OR_NULL, compiler));
+ Expect.equals(UNKNOWN,
+ INDEXABLE_PRIMITIVE.union(NULL, compiler));
+ Expect.equals(INDEXABLE_PRIMITIVE,
+ INDEXABLE_PRIMITIVE.union(FIXED_ARRAY, compiler));
- Expect.equals(STRING, STRING.union(CONFLICTING));
- Expect.equals(UNKNOWN, STRING.union(UNKNOWN));
- Expect.equals(UNKNOWN, STRING.union(BOOLEAN));
- Expect.equals(UNKNOWN, STRING.union(NUMBER));
- Expect.equals(UNKNOWN, STRING.union(INTEGER));
- Expect.equals(UNKNOWN, STRING.union(DOUBLE));
- Expect.equals(INDEXABLE_PRIMITIVE, STRING.union(INDEXABLE_PRIMITIVE));
- Expect.equals(STRING, STRING.union(STRING));
- Expect.equals(INDEXABLE_PRIMITIVE, STRING.union(READABLE_ARRAY));
- Expect.equals(INDEXABLE_PRIMITIVE, STRING.union(MUTABLE_ARRAY));
- Expect.equals(INDEXABLE_PRIMITIVE, STRING.union(EXTENDABLE_ARRAY));
- Expect.equals(UNKNOWN, STRING.union(NON_PRIMITIVE1));
- Expect.equals(UNKNOWN, STRING.union(NON_PRIMITIVE2));
- Expect.equals(UNKNOWN, STRING.union(POTENTIAL_ARRAY));
- Expect.equals(POTENTIAL_STRING, STRING.union(POTENTIAL_STRING));
- Expect.equals(UNKNOWN, STRING.union(BOOLEAN_OR_NULL));
- Expect.equals(UNKNOWN, STRING.union(NUMBER_OR_NULL));
- Expect.equals(UNKNOWN, STRING.union(INTEGER_OR_NULL));
- Expect.equals(UNKNOWN, STRING.union(DOUBLE_OR_NULL));
- Expect.equals(STRING_OR_NULL, STRING.union(STRING_OR_NULL));
- Expect.equals(STRING_OR_NULL, STRING.union(NULL));
- Expect.equals(INDEXABLE_PRIMITIVE, STRING.union(FIXED_ARRAY));
+ Expect.equals(STRING,
+ STRING.union(CONFLICTING, compiler));
+ Expect.equals(UNKNOWN,
+ STRING.union(UNKNOWN, compiler));
+ Expect.equals(UNKNOWN,
+ STRING.union(BOOLEAN, compiler));
+ Expect.equals(UNKNOWN,
+ STRING.union(NUMBER, compiler));
+ Expect.equals(UNKNOWN,
+ STRING.union(INTEGER, compiler));
+ Expect.equals(UNKNOWN,
+ STRING.union(DOUBLE, compiler));
+ Expect.equals(INDEXABLE_PRIMITIVE,
+ STRING.union(INDEXABLE_PRIMITIVE, compiler));
+ Expect.equals(STRING,
+ STRING.union(STRING, compiler));
+ Expect.equals(INDEXABLE_PRIMITIVE,
+ STRING.union(READABLE_ARRAY, compiler));
+ Expect.equals(INDEXABLE_PRIMITIVE,
+ STRING.union(MUTABLE_ARRAY, compiler));
+ Expect.equals(INDEXABLE_PRIMITIVE,
+ STRING.union(EXTENDABLE_ARRAY, compiler));
+ Expect.equals(UNKNOWN,
+ STRING.union(nonPrimitive1, compiler));
+ Expect.equals(UNKNOWN,
+ STRING.union(nonPrimitive2, compiler));
+ Expect.equals(UNKNOWN,
+ STRING.union(potentialArray, compiler));
+ Expect.equals(potentialString,
+ STRING.union(potentialString, compiler));
+ Expect.equals(UNKNOWN,
+ STRING.union(BOOLEAN_OR_NULL, compiler));
+ Expect.equals(UNKNOWN,
+ STRING.union(NUMBER_OR_NULL, compiler));
+ Expect.equals(UNKNOWN,
+ STRING.union(INTEGER_OR_NULL, compiler));
+ Expect.equals(UNKNOWN,
+ STRING.union(DOUBLE_OR_NULL, compiler));
+ Expect.equals(STRING_OR_NULL,
+ STRING.union(STRING_OR_NULL, compiler));
+ Expect.equals(STRING_OR_NULL,
+ STRING.union(NULL, compiler));
+ Expect.equals(INDEXABLE_PRIMITIVE,
+ STRING.union(FIXED_ARRAY, compiler));
- Expect.equals(READABLE_ARRAY, READABLE_ARRAY.union(CONFLICTING));
- Expect.equals(UNKNOWN, READABLE_ARRAY.union(UNKNOWN));
- Expect.equals(UNKNOWN, READABLE_ARRAY.union(BOOLEAN));
- Expect.equals(UNKNOWN, READABLE_ARRAY.union(NUMBER));
- Expect.equals(UNKNOWN, READABLE_ARRAY.union(INTEGER));
- Expect.equals(UNKNOWN, READABLE_ARRAY.union(DOUBLE));
- Expect.equals(INDEXABLE_PRIMITIVE, READABLE_ARRAY.union(INDEXABLE_PRIMITIVE));
- Expect.equals(INDEXABLE_PRIMITIVE, READABLE_ARRAY.union(STRING));
- Expect.equals(READABLE_ARRAY, READABLE_ARRAY.union(READABLE_ARRAY));
- Expect.equals(READABLE_ARRAY, READABLE_ARRAY.union(MUTABLE_ARRAY));
- Expect.equals(READABLE_ARRAY, READABLE_ARRAY.union(EXTENDABLE_ARRAY));
- Expect.equals(UNKNOWN, READABLE_ARRAY.union(NON_PRIMITIVE1));
- Expect.equals(UNKNOWN, READABLE_ARRAY.union(NON_PRIMITIVE2));
- Expect.equals(POTENTIAL_ARRAY, READABLE_ARRAY.union(POTENTIAL_ARRAY));
- Expect.equals(UNKNOWN, READABLE_ARRAY.union(POTENTIAL_STRING));
- Expect.equals(UNKNOWN, READABLE_ARRAY.union(BOOLEAN_OR_NULL));
- Expect.equals(UNKNOWN, READABLE_ARRAY.union(NUMBER_OR_NULL));
- Expect.equals(UNKNOWN, READABLE_ARRAY.union(INTEGER_OR_NULL));
- Expect.equals(UNKNOWN, READABLE_ARRAY.union(DOUBLE_OR_NULL));
- Expect.equals(UNKNOWN, READABLE_ARRAY.union(STRING_OR_NULL));
- Expect.equals(UNKNOWN, READABLE_ARRAY.union(NULL));
- Expect.equals(READABLE_ARRAY, READABLE_ARRAY.union(FIXED_ARRAY));
+ Expect.equals(READABLE_ARRAY,
+ READABLE_ARRAY.union(CONFLICTING, compiler));
+ Expect.equals(UNKNOWN,
+ READABLE_ARRAY.union(UNKNOWN, compiler));
+ Expect.equals(UNKNOWN,
+ READABLE_ARRAY.union(BOOLEAN, compiler));
+ Expect.equals(UNKNOWN,
+ READABLE_ARRAY.union(NUMBER, compiler));
+ Expect.equals(UNKNOWN,
+ READABLE_ARRAY.union(INTEGER, compiler));
+ Expect.equals(UNKNOWN,
+ READABLE_ARRAY.union(DOUBLE, compiler));
+ Expect.equals(INDEXABLE_PRIMITIVE,
+ READABLE_ARRAY.union(INDEXABLE_PRIMITIVE, compiler));
+ Expect.equals(INDEXABLE_PRIMITIVE,
+ READABLE_ARRAY.union(STRING, compiler));
+ Expect.equals(READABLE_ARRAY,
+ READABLE_ARRAY.union(READABLE_ARRAY, compiler));
+ Expect.equals(READABLE_ARRAY,
+ READABLE_ARRAY.union(MUTABLE_ARRAY, compiler));
+ Expect.equals(READABLE_ARRAY,
+ READABLE_ARRAY.union(EXTENDABLE_ARRAY, compiler));
+ Expect.equals(UNKNOWN,
+ READABLE_ARRAY.union(nonPrimitive1, compiler));
+ Expect.equals(UNKNOWN,
+ READABLE_ARRAY.union(nonPrimitive2, compiler));
+ Expect.equals(potentialArray,
+ READABLE_ARRAY.union(potentialArray, compiler));
+ Expect.equals(UNKNOWN,
+ READABLE_ARRAY.union(potentialString, compiler));
+ Expect.equals(UNKNOWN,
+ READABLE_ARRAY.union(BOOLEAN_OR_NULL, compiler));
+ Expect.equals(UNKNOWN,
+ READABLE_ARRAY.union(NUMBER_OR_NULL, compiler));
+ Expect.equals(UNKNOWN,
+ READABLE_ARRAY.union(INTEGER_OR_NULL, compiler));
+ Expect.equals(UNKNOWN,
+ READABLE_ARRAY.union(DOUBLE_OR_NULL, compiler));
+ Expect.equals(UNKNOWN,
+ READABLE_ARRAY.union(STRING_OR_NULL, compiler));
+ Expect.equals(UNKNOWN,
+ READABLE_ARRAY.union(NULL, compiler));
+ Expect.equals(READABLE_ARRAY,
+ READABLE_ARRAY.union(FIXED_ARRAY, compiler));
- Expect.equals(MUTABLE_ARRAY, MUTABLE_ARRAY.union(CONFLICTING));
- Expect.equals(UNKNOWN, MUTABLE_ARRAY.union(UNKNOWN));
- Expect.equals(UNKNOWN, MUTABLE_ARRAY.union(BOOLEAN));
- Expect.equals(UNKNOWN, MUTABLE_ARRAY.union(NUMBER));
- Expect.equals(UNKNOWN, MUTABLE_ARRAY.union(INTEGER));
- Expect.equals(UNKNOWN, MUTABLE_ARRAY.union(DOUBLE));
- Expect.equals(INDEXABLE_PRIMITIVE, MUTABLE_ARRAY.union(INDEXABLE_PRIMITIVE));
- Expect.equals(INDEXABLE_PRIMITIVE, MUTABLE_ARRAY.union(STRING));
- Expect.equals(READABLE_ARRAY, MUTABLE_ARRAY.union(READABLE_ARRAY));
- Expect.equals(MUTABLE_ARRAY, MUTABLE_ARRAY.union(MUTABLE_ARRAY));
- Expect.equals(MUTABLE_ARRAY, MUTABLE_ARRAY.union(EXTENDABLE_ARRAY));
- Expect.equals(UNKNOWN, MUTABLE_ARRAY.union(NON_PRIMITIVE1));
- Expect.equals(UNKNOWN, MUTABLE_ARRAY.union(NON_PRIMITIVE2));
- Expect.equals(POTENTIAL_ARRAY,MUTABLE_ARRAY.union(POTENTIAL_ARRAY));
- Expect.equals(UNKNOWN, MUTABLE_ARRAY.union(POTENTIAL_STRING));
- Expect.equals(UNKNOWN, MUTABLE_ARRAY.union(BOOLEAN_OR_NULL));
- Expect.equals(UNKNOWN, MUTABLE_ARRAY.union(NUMBER_OR_NULL));
- Expect.equals(UNKNOWN, MUTABLE_ARRAY.union(INTEGER_OR_NULL));
- Expect.equals(UNKNOWN, MUTABLE_ARRAY.union(DOUBLE_OR_NULL));
- Expect.equals(UNKNOWN, MUTABLE_ARRAY.union(STRING_OR_NULL));
- Expect.equals(UNKNOWN, MUTABLE_ARRAY.union(NULL));
- Expect.equals(MUTABLE_ARRAY, MUTABLE_ARRAY.union(FIXED_ARRAY));
+ Expect.equals(MUTABLE_ARRAY,
+ MUTABLE_ARRAY.union(CONFLICTING, compiler));
+ Expect.equals(UNKNOWN,
+ MUTABLE_ARRAY.union(UNKNOWN, compiler));
+ Expect.equals(UNKNOWN,
+ MUTABLE_ARRAY.union(BOOLEAN, compiler));
+ Expect.equals(UNKNOWN,
+ MUTABLE_ARRAY.union(NUMBER, compiler));
+ Expect.equals(UNKNOWN,
+ MUTABLE_ARRAY.union(INTEGER, compiler));
+ Expect.equals(UNKNOWN,
+ MUTABLE_ARRAY.union(DOUBLE, compiler));
+ Expect.equals(INDEXABLE_PRIMITIVE,
+ MUTABLE_ARRAY.union(INDEXABLE_PRIMITIVE, compiler));
+ Expect.equals(INDEXABLE_PRIMITIVE,
+ MUTABLE_ARRAY.union(STRING, compiler));
+ Expect.equals(READABLE_ARRAY,
+ MUTABLE_ARRAY.union(READABLE_ARRAY, compiler));
+ Expect.equals(MUTABLE_ARRAY,
+ MUTABLE_ARRAY.union(MUTABLE_ARRAY, compiler));
+ Expect.equals(MUTABLE_ARRAY,
+ MUTABLE_ARRAY.union(EXTENDABLE_ARRAY, compiler));
+ Expect.equals(UNKNOWN,
+ MUTABLE_ARRAY.union(nonPrimitive1, compiler));
+ Expect.equals(UNKNOWN,
+ MUTABLE_ARRAY.union(nonPrimitive2, compiler));
+ Expect.equals(potentialArray,MUTABLE_ARRAY.union(potentialArray,
+ compiler));
+ Expect.equals(UNKNOWN,
+ MUTABLE_ARRAY.union(potentialString, compiler));
+ Expect.equals(UNKNOWN,
+ MUTABLE_ARRAY.union(BOOLEAN_OR_NULL, compiler));
+ Expect.equals(UNKNOWN,
+ MUTABLE_ARRAY.union(NUMBER_OR_NULL, compiler));
+ Expect.equals(UNKNOWN,
+ MUTABLE_ARRAY.union(INTEGER_OR_NULL, compiler));
+ Expect.equals(UNKNOWN,
+ MUTABLE_ARRAY.union(DOUBLE_OR_NULL, compiler));
+ Expect.equals(UNKNOWN,
+ MUTABLE_ARRAY.union(STRING_OR_NULL, compiler));
+ Expect.equals(UNKNOWN,
+ MUTABLE_ARRAY.union(NULL, compiler));
+ Expect.equals(MUTABLE_ARRAY,
+ MUTABLE_ARRAY.union(FIXED_ARRAY, compiler));
- Expect.equals(EXTENDABLE_ARRAY, EXTENDABLE_ARRAY.union(CONFLICTING));
- Expect.equals(UNKNOWN, EXTENDABLE_ARRAY.union(UNKNOWN));
- Expect.equals(UNKNOWN, EXTENDABLE_ARRAY.union(BOOLEAN));
- Expect.equals(UNKNOWN, EXTENDABLE_ARRAY.union(NUMBER));
- Expect.equals(UNKNOWN, EXTENDABLE_ARRAY.union(INTEGER));
- Expect.equals(UNKNOWN, EXTENDABLE_ARRAY.union(DOUBLE));
- Expect.equals(INDEXABLE_PRIMITIVE, EXTENDABLE_ARRAY.union(INDEXABLE_PRIMITIVE));
- Expect.equals(INDEXABLE_PRIMITIVE, EXTENDABLE_ARRAY.union(STRING));
- Expect.equals(READABLE_ARRAY, EXTENDABLE_ARRAY.union(READABLE_ARRAY));
- Expect.equals(MUTABLE_ARRAY, EXTENDABLE_ARRAY.union(MUTABLE_ARRAY));
- Expect.equals(EXTENDABLE_ARRAY, EXTENDABLE_ARRAY.union(EXTENDABLE_ARRAY));
- Expect.equals(UNKNOWN, EXTENDABLE_ARRAY.union(NON_PRIMITIVE1));
- Expect.equals(UNKNOWN, EXTENDABLE_ARRAY.union(NON_PRIMITIVE2));
- Expect.equals(POTENTIAL_ARRAY, EXTENDABLE_ARRAY.union(POTENTIAL_ARRAY));
- Expect.equals(UNKNOWN, EXTENDABLE_ARRAY.union(POTENTIAL_STRING));
- Expect.equals(UNKNOWN, EXTENDABLE_ARRAY.union(BOOLEAN_OR_NULL));
- Expect.equals(UNKNOWN, EXTENDABLE_ARRAY.union(NUMBER_OR_NULL));
- Expect.equals(UNKNOWN, EXTENDABLE_ARRAY.union(INTEGER_OR_NULL));
- Expect.equals(UNKNOWN, EXTENDABLE_ARRAY.union(DOUBLE_OR_NULL));
- Expect.equals(UNKNOWN, EXTENDABLE_ARRAY.union(STRING_OR_NULL));
- Expect.equals(UNKNOWN, EXTENDABLE_ARRAY.union(NULL));
- Expect.equals(MUTABLE_ARRAY, EXTENDABLE_ARRAY.union(FIXED_ARRAY));
+ Expect.equals(EXTENDABLE_ARRAY,
+ EXTENDABLE_ARRAY.union(CONFLICTING, compiler));
+ Expect.equals(UNKNOWN,
+ EXTENDABLE_ARRAY.union(UNKNOWN, compiler));
+ Expect.equals(UNKNOWN,
+ EXTENDABLE_ARRAY.union(BOOLEAN, compiler));
+ Expect.equals(UNKNOWN,
+ EXTENDABLE_ARRAY.union(NUMBER, compiler));
+ Expect.equals(UNKNOWN,
+ EXTENDABLE_ARRAY.union(INTEGER, compiler));
+ Expect.equals(UNKNOWN,
+ EXTENDABLE_ARRAY.union(DOUBLE, compiler));
+ Expect.equals(INDEXABLE_PRIMITIVE,
+ EXTENDABLE_ARRAY.union(INDEXABLE_PRIMITIVE, compiler));
+ Expect.equals(INDEXABLE_PRIMITIVE,
+ EXTENDABLE_ARRAY.union(STRING, compiler));
+ Expect.equals(READABLE_ARRAY,
+ EXTENDABLE_ARRAY.union(READABLE_ARRAY, compiler));
+ Expect.equals(MUTABLE_ARRAY,
+ EXTENDABLE_ARRAY.union(MUTABLE_ARRAY, compiler));
+ Expect.equals(EXTENDABLE_ARRAY,
+ EXTENDABLE_ARRAY.union(EXTENDABLE_ARRAY, compiler));
+ Expect.equals(UNKNOWN,
+ EXTENDABLE_ARRAY.union(nonPrimitive1, compiler));
+ Expect.equals(UNKNOWN,
+ EXTENDABLE_ARRAY.union(nonPrimitive2, compiler));
+ Expect.equals(potentialArray,
+ EXTENDABLE_ARRAY.union(potentialArray, compiler));
+ Expect.equals(UNKNOWN,
+ EXTENDABLE_ARRAY.union(potentialString, compiler));
+ Expect.equals(UNKNOWN,
+ EXTENDABLE_ARRAY.union(BOOLEAN_OR_NULL, compiler));
+ Expect.equals(UNKNOWN,
+ EXTENDABLE_ARRAY.union(NUMBER_OR_NULL, compiler));
+ Expect.equals(UNKNOWN,
+ EXTENDABLE_ARRAY.union(INTEGER_OR_NULL, compiler));
+ Expect.equals(UNKNOWN,
+ EXTENDABLE_ARRAY.union(DOUBLE_OR_NULL, compiler));
+ Expect.equals(UNKNOWN,
+ EXTENDABLE_ARRAY.union(STRING_OR_NULL, compiler));
+ Expect.equals(UNKNOWN,
+ EXTENDABLE_ARRAY.union(NULL, compiler));
+ Expect.equals(MUTABLE_ARRAY,
+ EXTENDABLE_ARRAY.union(FIXED_ARRAY, compiler));
- Expect.equals(NON_PRIMITIVE1, NON_PRIMITIVE1.union(CONFLICTING));
- Expect.equals(UNKNOWN, NON_PRIMITIVE1.union(UNKNOWN));
- Expect.equals(UNKNOWN, NON_PRIMITIVE1.union(BOOLEAN));
- Expect.equals(UNKNOWN, NON_PRIMITIVE1.union(NUMBER));
- Expect.equals(UNKNOWN, NON_PRIMITIVE1.union(INTEGER));
- Expect.equals(UNKNOWN, NON_PRIMITIVE1.union(DOUBLE));
- Expect.equals(UNKNOWN, NON_PRIMITIVE1.union(INDEXABLE_PRIMITIVE));
- Expect.equals(UNKNOWN, NON_PRIMITIVE1.union(STRING));
- Expect.equals(UNKNOWN, NON_PRIMITIVE1.union(READABLE_ARRAY));
- Expect.equals(UNKNOWN, NON_PRIMITIVE1.union(MUTABLE_ARRAY));
- Expect.equals(UNKNOWN, NON_PRIMITIVE1.union(EXTENDABLE_ARRAY));
- Expect.equals(NON_PRIMITIVE1, NON_PRIMITIVE1.union(NON_PRIMITIVE1));
- Expect.equals(UNKNOWN, NON_PRIMITIVE1.union(NON_PRIMITIVE2));
- Expect.equals(UNKNOWN, NON_PRIMITIVE1.union(POTENTIAL_ARRAY));
- Expect.equals(UNKNOWN, NON_PRIMITIVE1.union(POTENTIAL_STRING));
- Expect.equals(UNKNOWN, NON_PRIMITIVE1.union(BOOLEAN_OR_NULL));
- Expect.equals(UNKNOWN, NON_PRIMITIVE1.union(NUMBER_OR_NULL));
- Expect.equals(UNKNOWN, NON_PRIMITIVE1.union(INTEGER_OR_NULL));
- Expect.equals(UNKNOWN, NON_PRIMITIVE1.union(DOUBLE_OR_NULL));
- Expect.equals(UNKNOWN, NON_PRIMITIVE1.union(STRING_OR_NULL));
- Expect.isTrue(NON_PRIMITIVE1.union(NULL) is HBoundedType);
- Expect.equals(UNKNOWN, NON_PRIMITIVE1.union(FIXED_ARRAY));
+ Expect.equals(nonPrimitive1,
+ nonPrimitive1.union(CONFLICTING, compiler));
+ Expect.equals(UNKNOWN,
+ nonPrimitive1.union(UNKNOWN, compiler));
+ Expect.equals(UNKNOWN,
+ nonPrimitive1.union(BOOLEAN, compiler));
+ Expect.equals(UNKNOWN,
+ nonPrimitive1.union(NUMBER, compiler));
+ Expect.equals(UNKNOWN,
+ nonPrimitive1.union(INTEGER, compiler));
+ Expect.equals(UNKNOWN,
+ nonPrimitive1.union(DOUBLE, compiler));
+ Expect.equals(UNKNOWN,
+ nonPrimitive1.union(INDEXABLE_PRIMITIVE, compiler));
+ Expect.equals(UNKNOWN,
+ nonPrimitive1.union(STRING, compiler));
+ Expect.equals(UNKNOWN,
+ nonPrimitive1.union(READABLE_ARRAY, compiler));
+ Expect.equals(UNKNOWN,
+ nonPrimitive1.union(MUTABLE_ARRAY, compiler));
+ Expect.equals(UNKNOWN,
+ nonPrimitive1.union(EXTENDABLE_ARRAY, compiler));
+ Expect.equals(nonPrimitive1,
+ nonPrimitive1.union(nonPrimitive1, compiler));
+ Expect.equals(UNKNOWN,
+ nonPrimitive1.union(nonPrimitive2, compiler));
+ Expect.equals(UNKNOWN,
+ nonPrimitive1.union(potentialArray, compiler));
+ Expect.equals(UNKNOWN,
+ nonPrimitive1.union(potentialString, compiler));
+ Expect.equals(UNKNOWN,
+ nonPrimitive1.union(BOOLEAN_OR_NULL, compiler));
+ Expect.equals(UNKNOWN,
+ nonPrimitive1.union(NUMBER_OR_NULL, compiler));
+ Expect.equals(UNKNOWN,
+ nonPrimitive1.union(INTEGER_OR_NULL, compiler));
+ Expect.equals(UNKNOWN,
+ nonPrimitive1.union(DOUBLE_OR_NULL, compiler));
+ Expect.equals(UNKNOWN,
+ nonPrimitive1.union(STRING_OR_NULL, compiler));
+ Expect.isTrue(nonPrimitive1.union(NULL, compiler) is HBoundedType);
+ Expect.equals(UNKNOWN,
+ nonPrimitive1.union(FIXED_ARRAY, compiler));
- Expect.equals(NON_PRIMITIVE2, NON_PRIMITIVE2.union(CONFLICTING));
- Expect.equals(UNKNOWN, NON_PRIMITIVE2.union(UNKNOWN));
- Expect.equals(UNKNOWN, NON_PRIMITIVE2.union(BOOLEAN));
- Expect.equals(UNKNOWN, NON_PRIMITIVE2.union(NUMBER));
- Expect.equals(UNKNOWN, NON_PRIMITIVE2.union(INTEGER));
- Expect.equals(UNKNOWN, NON_PRIMITIVE2.union(DOUBLE));
- Expect.equals(UNKNOWN, NON_PRIMITIVE2.union(INDEXABLE_PRIMITIVE));
- Expect.equals(UNKNOWN, NON_PRIMITIVE2.union(STRING));
- Expect.equals(UNKNOWN, NON_PRIMITIVE2.union(READABLE_ARRAY));
- Expect.equals(UNKNOWN, NON_PRIMITIVE2.union(MUTABLE_ARRAY));
- Expect.equals(UNKNOWN, NON_PRIMITIVE2.union(EXTENDABLE_ARRAY));
- Expect.equals(UNKNOWN, NON_PRIMITIVE2.union(NON_PRIMITIVE1));
- Expect.equals(NON_PRIMITIVE2, NON_PRIMITIVE2.union(NON_PRIMITIVE2));
- Expect.equals(UNKNOWN, NON_PRIMITIVE2.union(POTENTIAL_ARRAY));
- Expect.equals(UNKNOWN, NON_PRIMITIVE2.union(POTENTIAL_STRING));
- Expect.equals(UNKNOWN, NON_PRIMITIVE2.union(BOOLEAN_OR_NULL));
- Expect.equals(UNKNOWN, NON_PRIMITIVE2.union(NUMBER_OR_NULL));
- Expect.equals(UNKNOWN, NON_PRIMITIVE2.union(INTEGER_OR_NULL));
- Expect.equals(UNKNOWN, NON_PRIMITIVE2.union(DOUBLE_OR_NULL));
- Expect.equals(UNKNOWN, NON_PRIMITIVE2.union(STRING_OR_NULL));
- Expect.isTrue(NON_PRIMITIVE2.union(NULL) is HBoundedType);
- Expect.equals(UNKNOWN, NON_PRIMITIVE2.union(FIXED_ARRAY));
+ Expect.equals(nonPrimitive2,
+ nonPrimitive2.union(CONFLICTING, compiler));
+ Expect.equals(UNKNOWN,
+ nonPrimitive2.union(UNKNOWN, compiler));
+ Expect.equals(UNKNOWN,
+ nonPrimitive2.union(BOOLEAN, compiler));
+ Expect.equals(UNKNOWN,
+ nonPrimitive2.union(NUMBER, compiler));
+ Expect.equals(UNKNOWN,
+ nonPrimitive2.union(INTEGER, compiler));
+ Expect.equals(UNKNOWN,
+ nonPrimitive2.union(DOUBLE, compiler));
+ Expect.equals(UNKNOWN,
+ nonPrimitive2.union(INDEXABLE_PRIMITIVE, compiler));
+ Expect.equals(UNKNOWN,
+ nonPrimitive2.union(STRING, compiler));
+ Expect.equals(UNKNOWN,
+ nonPrimitive2.union(READABLE_ARRAY, compiler));
+ Expect.equals(UNKNOWN,
+ nonPrimitive2.union(MUTABLE_ARRAY, compiler));
+ Expect.equals(UNKNOWN,
+ nonPrimitive2.union(EXTENDABLE_ARRAY, compiler));
+ Expect.equals(UNKNOWN,
+ nonPrimitive2.union(nonPrimitive1, compiler));
+ Expect.equals(nonPrimitive2,
+ nonPrimitive2.union(nonPrimitive2, compiler));
+ Expect.equals(UNKNOWN,
+ nonPrimitive2.union(potentialArray, compiler));
+ Expect.equals(UNKNOWN,
+ nonPrimitive2.union(potentialString, compiler));
+ Expect.equals(UNKNOWN,
+ nonPrimitive2.union(BOOLEAN_OR_NULL, compiler));
+ Expect.equals(UNKNOWN,
+ nonPrimitive2.union(NUMBER_OR_NULL, compiler));
+ Expect.equals(UNKNOWN,
+ nonPrimitive2.union(INTEGER_OR_NULL, compiler));
+ Expect.equals(UNKNOWN,
+ nonPrimitive2.union(DOUBLE_OR_NULL, compiler));
+ Expect.equals(UNKNOWN,
+ nonPrimitive2.union(STRING_OR_NULL, compiler));
+ Expect.isTrue(nonPrimitive2.union(NULL, compiler) is HBoundedType);
+ Expect.equals(UNKNOWN,
+ nonPrimitive2.union(FIXED_ARRAY, compiler));
- Expect.equals(POTENTIAL_ARRAY, POTENTIAL_ARRAY.union(CONFLICTING));
- Expect.equals(UNKNOWN, POTENTIAL_ARRAY.union(UNKNOWN));
- Expect.equals(UNKNOWN, POTENTIAL_ARRAY.union(BOOLEAN));
- Expect.equals(UNKNOWN, POTENTIAL_ARRAY.union(NUMBER));
- Expect.equals(UNKNOWN, POTENTIAL_ARRAY.union(INTEGER));
- Expect.equals(UNKNOWN, POTENTIAL_ARRAY.union(DOUBLE));
- Expect.equals(UNKNOWN, POTENTIAL_ARRAY.union(INDEXABLE_PRIMITIVE));
- Expect.equals(UNKNOWN, POTENTIAL_ARRAY.union(STRING));
- Expect.equals(POTENTIAL_ARRAY, POTENTIAL_ARRAY.union(READABLE_ARRAY));
- Expect.equals(POTENTIAL_ARRAY, POTENTIAL_ARRAY.union(MUTABLE_ARRAY));
- Expect.equals(POTENTIAL_ARRAY, POTENTIAL_ARRAY.union(EXTENDABLE_ARRAY));
- Expect.equals(UNKNOWN, POTENTIAL_ARRAY.union(NON_PRIMITIVE1));
- Expect.equals(UNKNOWN, POTENTIAL_ARRAY.union(NON_PRIMITIVE2));
- Expect.equals(POTENTIAL_ARRAY, POTENTIAL_ARRAY.union(POTENTIAL_ARRAY));
- Expect.equals(UNKNOWN, POTENTIAL_ARRAY.union(POTENTIAL_STRING));
- Expect.equals(UNKNOWN, POTENTIAL_ARRAY.union(BOOLEAN_OR_NULL));
- Expect.equals(UNKNOWN, POTENTIAL_ARRAY.union(NUMBER_OR_NULL));
- Expect.equals(UNKNOWN, POTENTIAL_ARRAY.union(INTEGER_OR_NULL));
- Expect.equals(UNKNOWN, POTENTIAL_ARRAY.union(DOUBLE_OR_NULL));
- Expect.equals(UNKNOWN, POTENTIAL_ARRAY.union(STRING_OR_NULL));
- Expect.equals(POTENTIAL_ARRAY, POTENTIAL_ARRAY.union(NULL));
- Expect.equals(POTENTIAL_ARRAY, POTENTIAL_ARRAY.union(FIXED_ARRAY));
+ Expect.equals(potentialArray,
+ potentialArray.union(CONFLICTING, compiler));
+ Expect.equals(UNKNOWN,
+ potentialArray.union(UNKNOWN, compiler));
+ Expect.equals(UNKNOWN,
+ potentialArray.union(BOOLEAN, compiler));
+ Expect.equals(UNKNOWN,
+ potentialArray.union(NUMBER, compiler));
+ Expect.equals(UNKNOWN,
+ potentialArray.union(INTEGER, compiler));
+ Expect.equals(UNKNOWN,
+ potentialArray.union(DOUBLE, compiler));
+ Expect.equals(UNKNOWN,
+ potentialArray.union(INDEXABLE_PRIMITIVE, compiler));
+ Expect.equals(UNKNOWN,
+ potentialArray.union(STRING, compiler));
+ Expect.equals(potentialArray,
+ potentialArray.union(READABLE_ARRAY, compiler));
+ Expect.equals(potentialArray,
+ potentialArray.union(MUTABLE_ARRAY, compiler));
+ Expect.equals(potentialArray,
+ potentialArray.union(EXTENDABLE_ARRAY, compiler));
+ Expect.equals(UNKNOWN,
+ potentialArray.union(nonPrimitive1, compiler));
+ Expect.equals(UNKNOWN,
+ potentialArray.union(nonPrimitive2, compiler));
+ Expect.equals(potentialArray,
+ potentialArray.union(potentialArray, compiler));
+ Expect.equals(UNKNOWN,
+ potentialArray.union(potentialString, compiler));
+ Expect.equals(UNKNOWN,
+ potentialArray.union(BOOLEAN_OR_NULL, compiler));
+ Expect.equals(UNKNOWN,
+ potentialArray.union(NUMBER_OR_NULL, compiler));
+ Expect.equals(UNKNOWN,
+ potentialArray.union(INTEGER_OR_NULL, compiler));
+ Expect.equals(UNKNOWN,
+ potentialArray.union(DOUBLE_OR_NULL, compiler));
+ Expect.equals(UNKNOWN,
+ potentialArray.union(STRING_OR_NULL, compiler));
+ Expect.equals(potentialArray,
+ potentialArray.union(NULL, compiler));
+ Expect.equals(potentialArray,
+ potentialArray.union(FIXED_ARRAY, compiler));
- Expect.equals(POTENTIAL_STRING, POTENTIAL_STRING.union(CONFLICTING));
- Expect.equals(UNKNOWN, POTENTIAL_STRING.union(UNKNOWN));
- Expect.equals(UNKNOWN, POTENTIAL_STRING.union(BOOLEAN));
- Expect.equals(UNKNOWN, POTENTIAL_STRING.union(NUMBER));
- Expect.equals(UNKNOWN, POTENTIAL_STRING.union(INTEGER));
- Expect.equals(UNKNOWN, POTENTIAL_STRING.union(DOUBLE));
- Expect.equals(UNKNOWN, POTENTIAL_STRING.union(INDEXABLE_PRIMITIVE));
- Expect.equals(POTENTIAL_STRING, POTENTIAL_STRING.union(STRING));
- Expect.equals(UNKNOWN, POTENTIAL_STRING.union(READABLE_ARRAY));
- Expect.equals(UNKNOWN, POTENTIAL_STRING.union(MUTABLE_ARRAY));
- Expect.equals(UNKNOWN, POTENTIAL_STRING.union(EXTENDABLE_ARRAY));
- Expect.equals(UNKNOWN, POTENTIAL_STRING.union(NON_PRIMITIVE1));
- Expect.equals(UNKNOWN, POTENTIAL_STRING.union(NON_PRIMITIVE2));
- Expect.equals(UNKNOWN, POTENTIAL_STRING.union(POTENTIAL_ARRAY));
- Expect.equals(POTENTIAL_STRING, POTENTIAL_STRING.union(POTENTIAL_STRING));
- Expect.equals(UNKNOWN, POTENTIAL_STRING.union(BOOLEAN_OR_NULL));
- Expect.equals(UNKNOWN, POTENTIAL_STRING.union(NUMBER_OR_NULL));
- Expect.equals(UNKNOWN, POTENTIAL_STRING.union(INTEGER_OR_NULL));
- Expect.equals(UNKNOWN, POTENTIAL_STRING.union(DOUBLE_OR_NULL));
- Expect.equals(POTENTIAL_STRING, POTENTIAL_STRING.union(STRING_OR_NULL));
- Expect.equals(POTENTIAL_STRING, POTENTIAL_STRING.union(NULL));
- Expect.equals(UNKNOWN, POTENTIAL_STRING.union(FIXED_ARRAY));
+ Expect.equals(potentialString,
+ potentialString.union(CONFLICTING, compiler));
+ Expect.equals(UNKNOWN,
+ potentialString.union(UNKNOWN, compiler));
+ Expect.equals(UNKNOWN,
+ potentialString.union(BOOLEAN, compiler));
+ Expect.equals(UNKNOWN,
+ potentialString.union(NUMBER, compiler));
+ Expect.equals(UNKNOWN,
+ potentialString.union(INTEGER, compiler));
+ Expect.equals(UNKNOWN,
+ potentialString.union(DOUBLE, compiler));
+ Expect.equals(UNKNOWN,
+ potentialString.union(INDEXABLE_PRIMITIVE, compiler));
+ Expect.equals(potentialString,
+ potentialString.union(STRING, compiler));
+ Expect.equals(UNKNOWN,
+ potentialString.union(READABLE_ARRAY, compiler));
+ Expect.equals(UNKNOWN,
+ potentialString.union(MUTABLE_ARRAY, compiler));
+ Expect.equals(UNKNOWN,
+ potentialString.union(EXTENDABLE_ARRAY, compiler));
+ Expect.equals(UNKNOWN,
+ potentialString.union(nonPrimitive1, compiler));
+ Expect.equals(UNKNOWN,
+ potentialString.union(nonPrimitive2, compiler));
+ Expect.equals(UNKNOWN,
+ potentialString.union(potentialArray, compiler));
+ Expect.equals(potentialString,
+ potentialString.union(potentialString, compiler));
+ Expect.equals(UNKNOWN,
+ potentialString.union(BOOLEAN_OR_NULL, compiler));
+ Expect.equals(UNKNOWN,
+ potentialString.union(NUMBER_OR_NULL, compiler));
+ Expect.equals(UNKNOWN,
+ potentialString.union(INTEGER_OR_NULL, compiler));
+ Expect.equals(UNKNOWN,
+ potentialString.union(DOUBLE_OR_NULL, compiler));
+ Expect.equals(potentialString,
+ potentialString.union(STRING_OR_NULL, compiler));
+ Expect.equals(potentialString,
+ potentialString.union(NULL, compiler));
+ Expect.equals(UNKNOWN,
+ potentialString.union(FIXED_ARRAY, compiler));
- Expect.equals(BOOLEAN_OR_NULL, BOOLEAN_OR_NULL.union(CONFLICTING));
- Expect.equals(UNKNOWN, BOOLEAN_OR_NULL.union(UNKNOWN));
- Expect.equals(BOOLEAN_OR_NULL, BOOLEAN_OR_NULL.union(BOOLEAN));
- Expect.equals(UNKNOWN, BOOLEAN_OR_NULL.union(NUMBER));
- Expect.equals(UNKNOWN, BOOLEAN_OR_NULL.union(INTEGER));
- Expect.equals(UNKNOWN, BOOLEAN_OR_NULL.union(DOUBLE));
- Expect.equals(UNKNOWN, BOOLEAN_OR_NULL.union(INDEXABLE_PRIMITIVE));
- Expect.equals(UNKNOWN, BOOLEAN_OR_NULL.union(STRING));
- Expect.equals(UNKNOWN, BOOLEAN_OR_NULL.union(READABLE_ARRAY));
- Expect.equals(UNKNOWN, BOOLEAN_OR_NULL.union(MUTABLE_ARRAY));
- Expect.equals(UNKNOWN, BOOLEAN_OR_NULL.union(EXTENDABLE_ARRAY));
- Expect.equals(UNKNOWN, BOOLEAN_OR_NULL.union(NON_PRIMITIVE1));
- Expect.equals(UNKNOWN, BOOLEAN_OR_NULL.union(NON_PRIMITIVE2));
- Expect.equals(UNKNOWN, BOOLEAN_OR_NULL.union(POTENTIAL_ARRAY));
- Expect.equals(UNKNOWN, BOOLEAN_OR_NULL.union(POTENTIAL_STRING));
- Expect.equals(BOOLEAN_OR_NULL, BOOLEAN_OR_NULL.union(BOOLEAN_OR_NULL));
- Expect.equals(UNKNOWN, BOOLEAN_OR_NULL.union(NUMBER_OR_NULL));
- Expect.equals(UNKNOWN, BOOLEAN_OR_NULL.union(INTEGER_OR_NULL));
- Expect.equals(UNKNOWN, BOOLEAN_OR_NULL.union(DOUBLE_OR_NULL));
- Expect.equals(UNKNOWN, BOOLEAN_OR_NULL.union(STRING_OR_NULL));
- Expect.equals(BOOLEAN_OR_NULL, BOOLEAN_OR_NULL.union(NULL));
- Expect.equals(UNKNOWN, BOOLEAN_OR_NULL.union(FIXED_ARRAY));
+ Expect.equals(BOOLEAN_OR_NULL,
+ BOOLEAN_OR_NULL.union(CONFLICTING, compiler));
+ Expect.equals(UNKNOWN,
+ BOOLEAN_OR_NULL.union(UNKNOWN, compiler));
+ Expect.equals(BOOLEAN_OR_NULL,
+ BOOLEAN_OR_NULL.union(BOOLEAN, compiler));
+ Expect.equals(UNKNOWN,
+ BOOLEAN_OR_NULL.union(NUMBER, compiler));
+ Expect.equals(UNKNOWN,
+ BOOLEAN_OR_NULL.union(INTEGER, compiler));
+ Expect.equals(UNKNOWN,
+ BOOLEAN_OR_NULL.union(DOUBLE, compiler));
+ Expect.equals(UNKNOWN,
+ BOOLEAN_OR_NULL.union(INDEXABLE_PRIMITIVE, compiler));
+ Expect.equals(UNKNOWN,
+ BOOLEAN_OR_NULL.union(STRING, compiler));
+ Expect.equals(UNKNOWN,
+ BOOLEAN_OR_NULL.union(READABLE_ARRAY, compiler));
+ Expect.equals(UNKNOWN,
+ BOOLEAN_OR_NULL.union(MUTABLE_ARRAY, compiler));
+ Expect.equals(UNKNOWN,
+ BOOLEAN_OR_NULL.union(EXTENDABLE_ARRAY, compiler));
+ Expect.equals(UNKNOWN,
+ BOOLEAN_OR_NULL.union(nonPrimitive1, compiler));
+ Expect.equals(UNKNOWN,
+ BOOLEAN_OR_NULL.union(nonPrimitive2, compiler));
+ Expect.equals(UNKNOWN,
+ BOOLEAN_OR_NULL.union(potentialArray, compiler));
+ Expect.equals(UNKNOWN,
+ BOOLEAN_OR_NULL.union(potentialString, compiler));
+ Expect.equals(BOOLEAN_OR_NULL,
+ BOOLEAN_OR_NULL.union(BOOLEAN_OR_NULL, compiler));
+ Expect.equals(UNKNOWN,
+ BOOLEAN_OR_NULL.union(NUMBER_OR_NULL, compiler));
+ Expect.equals(UNKNOWN,
+ BOOLEAN_OR_NULL.union(INTEGER_OR_NULL, compiler));
+ Expect.equals(UNKNOWN,
+ BOOLEAN_OR_NULL.union(DOUBLE_OR_NULL, compiler));
+ Expect.equals(UNKNOWN,
+ BOOLEAN_OR_NULL.union(STRING_OR_NULL, compiler));
+ Expect.equals(BOOLEAN_OR_NULL,
+ BOOLEAN_OR_NULL.union(NULL, compiler));
+ Expect.equals(UNKNOWN,
+ BOOLEAN_OR_NULL.union(FIXED_ARRAY, compiler));
- Expect.equals(NUMBER_OR_NULL, NUMBER_OR_NULL.union(CONFLICTING));
- Expect.equals(UNKNOWN, NUMBER_OR_NULL.union(UNKNOWN));
- Expect.equals(UNKNOWN, NUMBER_OR_NULL.union(BOOLEAN));
- Expect.equals(NUMBER_OR_NULL, NUMBER_OR_NULL.union(NUMBER));
- Expect.equals(NUMBER_OR_NULL, NUMBER_OR_NULL.union(INTEGER));
- Expect.equals(NUMBER_OR_NULL, NUMBER_OR_NULL.union(DOUBLE));
- Expect.equals(UNKNOWN, NUMBER_OR_NULL.union(INDEXABLE_PRIMITIVE));
- Expect.equals(UNKNOWN, NUMBER_OR_NULL.union(STRING));
- Expect.equals(UNKNOWN, NUMBER_OR_NULL.union(READABLE_ARRAY));
- Expect.equals(UNKNOWN, NUMBER_OR_NULL.union(MUTABLE_ARRAY));
- Expect.equals(UNKNOWN, NUMBER_OR_NULL.union(EXTENDABLE_ARRAY));
- Expect.equals(UNKNOWN, NUMBER_OR_NULL.union(NON_PRIMITIVE1));
- Expect.equals(UNKNOWN, NUMBER_OR_NULL.union(NON_PRIMITIVE2));
- Expect.equals(UNKNOWN, NUMBER_OR_NULL.union(POTENTIAL_ARRAY));
- Expect.equals(UNKNOWN, NUMBER_OR_NULL.union(POTENTIAL_STRING));
- Expect.equals(UNKNOWN, NUMBER_OR_NULL.union(BOOLEAN_OR_NULL));
- Expect.equals(NUMBER_OR_NULL, NUMBER_OR_NULL.union(NUMBER_OR_NULL));
- Expect.equals(NUMBER_OR_NULL, NUMBER_OR_NULL.union(INTEGER_OR_NULL));
- Expect.equals(NUMBER_OR_NULL, NUMBER_OR_NULL.union(DOUBLE_OR_NULL));
- Expect.equals(UNKNOWN, NUMBER_OR_NULL.union(STRING_OR_NULL));
- Expect.equals(NUMBER_OR_NULL, NUMBER_OR_NULL.union(NULL));
- Expect.equals(UNKNOWN, NUMBER_OR_NULL.union(FIXED_ARRAY));
+ Expect.equals(NUMBER_OR_NULL,
+ NUMBER_OR_NULL.union(CONFLICTING, compiler));
+ Expect.equals(UNKNOWN,
+ NUMBER_OR_NULL.union(UNKNOWN, compiler));
+ Expect.equals(UNKNOWN,
+ NUMBER_OR_NULL.union(BOOLEAN, compiler));
+ Expect.equals(NUMBER_OR_NULL,
+ NUMBER_OR_NULL.union(NUMBER, compiler));
+ Expect.equals(NUMBER_OR_NULL,
+ NUMBER_OR_NULL.union(INTEGER, compiler));
+ Expect.equals(NUMBER_OR_NULL,
+ NUMBER_OR_NULL.union(DOUBLE, compiler));
+ Expect.equals(UNKNOWN,
+ NUMBER_OR_NULL.union(INDEXABLE_PRIMITIVE, compiler));
+ Expect.equals(UNKNOWN,
+ NUMBER_OR_NULL.union(STRING, compiler));
+ Expect.equals(UNKNOWN,
+ NUMBER_OR_NULL.union(READABLE_ARRAY, compiler));
+ Expect.equals(UNKNOWN,
+ NUMBER_OR_NULL.union(MUTABLE_ARRAY, compiler));
+ Expect.equals(UNKNOWN,
+ NUMBER_OR_NULL.union(EXTENDABLE_ARRAY, compiler));
+ Expect.equals(UNKNOWN,
+ NUMBER_OR_NULL.union(nonPrimitive1, compiler));
+ Expect.equals(UNKNOWN,
+ NUMBER_OR_NULL.union(nonPrimitive2, compiler));
+ Expect.equals(UNKNOWN,
+ NUMBER_OR_NULL.union(potentialArray, compiler));
+ Expect.equals(UNKNOWN,
+ NUMBER_OR_NULL.union(potentialString, compiler));
+ Expect.equals(UNKNOWN,
+ NUMBER_OR_NULL.union(BOOLEAN_OR_NULL, compiler));
+ Expect.equals(NUMBER_OR_NULL,
+ NUMBER_OR_NULL.union(NUMBER_OR_NULL, compiler));
+ Expect.equals(NUMBER_OR_NULL,
+ NUMBER_OR_NULL.union(INTEGER_OR_NULL, compiler));
+ Expect.equals(NUMBER_OR_NULL,
+ NUMBER_OR_NULL.union(DOUBLE_OR_NULL, compiler));
+ Expect.equals(UNKNOWN,
+ NUMBER_OR_NULL.union(STRING_OR_NULL, compiler));
+ Expect.equals(NUMBER_OR_NULL,
+ NUMBER_OR_NULL.union(NULL, compiler));
+ Expect.equals(UNKNOWN,
+ NUMBER_OR_NULL.union(FIXED_ARRAY, compiler));
- Expect.equals(INTEGER_OR_NULL, INTEGER_OR_NULL.union(CONFLICTING));
- Expect.equals(UNKNOWN, INTEGER_OR_NULL.union(UNKNOWN));
- Expect.equals(UNKNOWN, INTEGER_OR_NULL.union(BOOLEAN));
- Expect.equals(NUMBER_OR_NULL, INTEGER_OR_NULL.union(NUMBER));
- Expect.equals(INTEGER_OR_NULL, INTEGER_OR_NULL.union(INTEGER));
- Expect.equals(NUMBER_OR_NULL, INTEGER_OR_NULL.union(DOUBLE));
- Expect.equals(UNKNOWN, INTEGER_OR_NULL.union(INDEXABLE_PRIMITIVE));
- Expect.equals(UNKNOWN, INTEGER_OR_NULL.union(STRING));
- Expect.equals(UNKNOWN, INTEGER_OR_NULL.union(READABLE_ARRAY));
- Expect.equals(UNKNOWN, INTEGER_OR_NULL.union(MUTABLE_ARRAY));
- Expect.equals(UNKNOWN, INTEGER_OR_NULL.union(EXTENDABLE_ARRAY));
- Expect.equals(UNKNOWN, INTEGER_OR_NULL.union(NON_PRIMITIVE1));
- Expect.equals(UNKNOWN, INTEGER_OR_NULL.union(NON_PRIMITIVE2));
- Expect.equals(UNKNOWN, INTEGER_OR_NULL.union(POTENTIAL_ARRAY));
- Expect.equals(UNKNOWN, INTEGER_OR_NULL.union(POTENTIAL_STRING));
- Expect.equals(UNKNOWN, INTEGER_OR_NULL.union(BOOLEAN_OR_NULL));
- Expect.equals(NUMBER_OR_NULL, INTEGER_OR_NULL.union(NUMBER_OR_NULL));
- Expect.equals(INTEGER_OR_NULL, INTEGER_OR_NULL.union(INTEGER_OR_NULL));
- Expect.equals(NUMBER_OR_NULL, INTEGER_OR_NULL.union(DOUBLE_OR_NULL));
- Expect.equals(UNKNOWN, INTEGER_OR_NULL.union(STRING_OR_NULL));
- Expect.equals(INTEGER_OR_NULL, INTEGER_OR_NULL.union(NULL));
- Expect.equals(UNKNOWN, INTEGER_OR_NULL.union(FIXED_ARRAY));
+ Expect.equals(INTEGER_OR_NULL,
+ INTEGER_OR_NULL.union(CONFLICTING, compiler));
+ Expect.equals(UNKNOWN,
+ INTEGER_OR_NULL.union(UNKNOWN, compiler));
+ Expect.equals(UNKNOWN,
+ INTEGER_OR_NULL.union(BOOLEAN, compiler));
+ Expect.equals(NUMBER_OR_NULL,
+ INTEGER_OR_NULL.union(NUMBER, compiler));
+ Expect.equals(INTEGER_OR_NULL,
+ INTEGER_OR_NULL.union(INTEGER, compiler));
+ Expect.equals(NUMBER_OR_NULL,
+ INTEGER_OR_NULL.union(DOUBLE, compiler));
+ Expect.equals(UNKNOWN,
+ INTEGER_OR_NULL.union(INDEXABLE_PRIMITIVE, compiler));
+ Expect.equals(UNKNOWN,
+ INTEGER_OR_NULL.union(STRING, compiler));
+ Expect.equals(UNKNOWN,
+ INTEGER_OR_NULL.union(READABLE_ARRAY, compiler));
+ Expect.equals(UNKNOWN,
+ INTEGER_OR_NULL.union(MUTABLE_ARRAY, compiler));
+ Expect.equals(UNKNOWN,
+ INTEGER_OR_NULL.union(EXTENDABLE_ARRAY, compiler));
+ Expect.equals(UNKNOWN,
+ INTEGER_OR_NULL.union(nonPrimitive1, compiler));
+ Expect.equals(UNKNOWN,
+ INTEGER_OR_NULL.union(nonPrimitive2, compiler));
+ Expect.equals(UNKNOWN,
+ INTEGER_OR_NULL.union(potentialArray, compiler));
+ Expect.equals(UNKNOWN,
+ INTEGER_OR_NULL.union(potentialString, compiler));
+ Expect.equals(UNKNOWN,
+ INTEGER_OR_NULL.union(BOOLEAN_OR_NULL, compiler));
+ Expect.equals(NUMBER_OR_NULL,
+ INTEGER_OR_NULL.union(NUMBER_OR_NULL, compiler));
+ Expect.equals(INTEGER_OR_NULL,
+ INTEGER_OR_NULL.union(INTEGER_OR_NULL, compiler));
+ Expect.equals(NUMBER_OR_NULL,
+ INTEGER_OR_NULL.union(DOUBLE_OR_NULL, compiler));
+ Expect.equals(UNKNOWN,
+ INTEGER_OR_NULL.union(STRING_OR_NULL, compiler));
+ Expect.equals(INTEGER_OR_NULL,
+ INTEGER_OR_NULL.union(NULL, compiler));
+ Expect.equals(UNKNOWN,
+ INTEGER_OR_NULL.union(FIXED_ARRAY, compiler));
- Expect.equals(DOUBLE_OR_NULL, DOUBLE_OR_NULL.union(CONFLICTING));
- Expect.equals(UNKNOWN, DOUBLE_OR_NULL.union(UNKNOWN));
- Expect.equals(UNKNOWN, DOUBLE_OR_NULL.union(BOOLEAN));
- Expect.equals(NUMBER_OR_NULL, DOUBLE_OR_NULL.union(NUMBER));
- Expect.equals(NUMBER_OR_NULL, DOUBLE_OR_NULL.union(INTEGER));
- Expect.equals(DOUBLE_OR_NULL, DOUBLE_OR_NULL.union(DOUBLE));
- Expect.equals(UNKNOWN, DOUBLE_OR_NULL.union(INDEXABLE_PRIMITIVE));
- Expect.equals(UNKNOWN, DOUBLE_OR_NULL.union(STRING));
- Expect.equals(UNKNOWN, DOUBLE_OR_NULL.union(READABLE_ARRAY));
- Expect.equals(UNKNOWN, DOUBLE_OR_NULL.union(MUTABLE_ARRAY));
- Expect.equals(UNKNOWN, DOUBLE_OR_NULL.union(EXTENDABLE_ARRAY));
- Expect.equals(UNKNOWN, DOUBLE_OR_NULL.union(NON_PRIMITIVE1));
- Expect.equals(UNKNOWN, DOUBLE_OR_NULL.union(NON_PRIMITIVE2));
- Expect.equals(UNKNOWN, DOUBLE_OR_NULL.union(POTENTIAL_ARRAY));
- Expect.equals(UNKNOWN, DOUBLE_OR_NULL.union(POTENTIAL_STRING));
- Expect.equals(UNKNOWN, DOUBLE_OR_NULL.union(BOOLEAN_OR_NULL));
- Expect.equals(NUMBER_OR_NULL, DOUBLE_OR_NULL.union(NUMBER_OR_NULL));
- Expect.equals(NUMBER_OR_NULL, DOUBLE_OR_NULL.union(INTEGER_OR_NULL));
- Expect.equals(DOUBLE_OR_NULL, DOUBLE_OR_NULL.union(DOUBLE_OR_NULL));
- Expect.equals(UNKNOWN, DOUBLE_OR_NULL.union(STRING_OR_NULL));
- Expect.equals(DOUBLE_OR_NULL, DOUBLE_OR_NULL.union(NULL));
- Expect.equals(UNKNOWN, DOUBLE_OR_NULL.union(FIXED_ARRAY));
+ Expect.equals(DOUBLE_OR_NULL,
+ DOUBLE_OR_NULL.union(CONFLICTING, compiler));
+ Expect.equals(UNKNOWN,
+ DOUBLE_OR_NULL.union(UNKNOWN, compiler));
+ Expect.equals(UNKNOWN,
+ DOUBLE_OR_NULL.union(BOOLEAN, compiler));
+ Expect.equals(NUMBER_OR_NULL,
+ DOUBLE_OR_NULL.union(NUMBER, compiler));
+ Expect.equals(NUMBER_OR_NULL,
+ DOUBLE_OR_NULL.union(INTEGER, compiler));
+ Expect.equals(DOUBLE_OR_NULL,
+ DOUBLE_OR_NULL.union(DOUBLE, compiler));
+ Expect.equals(UNKNOWN,
+ DOUBLE_OR_NULL.union(INDEXABLE_PRIMITIVE, compiler));
+ Expect.equals(UNKNOWN,
+ DOUBLE_OR_NULL.union(STRING, compiler));
+ Expect.equals(UNKNOWN,
+ DOUBLE_OR_NULL.union(READABLE_ARRAY, compiler));
+ Expect.equals(UNKNOWN,
+ DOUBLE_OR_NULL.union(MUTABLE_ARRAY, compiler));
+ Expect.equals(UNKNOWN,
+ DOUBLE_OR_NULL.union(EXTENDABLE_ARRAY, compiler));
+ Expect.equals(UNKNOWN,
+ DOUBLE_OR_NULL.union(nonPrimitive1, compiler));
+ Expect.equals(UNKNOWN,
+ DOUBLE_OR_NULL.union(nonPrimitive2, compiler));
+ Expect.equals(UNKNOWN,
+ DOUBLE_OR_NULL.union(potentialArray, compiler));
+ Expect.equals(UNKNOWN,
+ DOUBLE_OR_NULL.union(potentialString, compiler));
+ Expect.equals(UNKNOWN,
+ DOUBLE_OR_NULL.union(BOOLEAN_OR_NULL, compiler));
+ Expect.equals(NUMBER_OR_NULL,
+ DOUBLE_OR_NULL.union(NUMBER_OR_NULL, compiler));
+ Expect.equals(NUMBER_OR_NULL,
+ DOUBLE_OR_NULL.union(INTEGER_OR_NULL, compiler));
+ Expect.equals(DOUBLE_OR_NULL,
+ DOUBLE_OR_NULL.union(DOUBLE_OR_NULL, compiler));
+ Expect.equals(UNKNOWN,
+ DOUBLE_OR_NULL.union(STRING_OR_NULL, compiler));
+ Expect.equals(DOUBLE_OR_NULL,
+ DOUBLE_OR_NULL.union(NULL, compiler));
+ Expect.equals(UNKNOWN,
+ DOUBLE_OR_NULL.union(FIXED_ARRAY, compiler));
- Expect.equals(STRING_OR_NULL, STRING_OR_NULL.union(CONFLICTING));
- Expect.equals(UNKNOWN, STRING_OR_NULL.union(UNKNOWN));
- Expect.equals(UNKNOWN, STRING_OR_NULL.union(BOOLEAN));
- Expect.equals(UNKNOWN, STRING_OR_NULL.union(NUMBER));
- Expect.equals(UNKNOWN, STRING_OR_NULL.union(INTEGER));
- Expect.equals(UNKNOWN, STRING_OR_NULL.union(DOUBLE));
- Expect.equals(UNKNOWN, STRING_OR_NULL.union(INDEXABLE_PRIMITIVE));
- Expect.equals(STRING_OR_NULL, STRING_OR_NULL.union(STRING));
- Expect.equals(UNKNOWN, STRING_OR_NULL.union(READABLE_ARRAY));
- Expect.equals(UNKNOWN, STRING_OR_NULL.union(MUTABLE_ARRAY));
- Expect.equals(UNKNOWN, STRING_OR_NULL.union(EXTENDABLE_ARRAY));
- Expect.equals(UNKNOWN, STRING_OR_NULL.union(NON_PRIMITIVE1));
- Expect.equals(UNKNOWN, STRING_OR_NULL.union(NON_PRIMITIVE2));
- Expect.equals(UNKNOWN, STRING_OR_NULL.union(POTENTIAL_ARRAY));
- Expect.equals(POTENTIAL_STRING, STRING_OR_NULL.union(POTENTIAL_STRING));
- Expect.equals(UNKNOWN, STRING_OR_NULL.union(BOOLEAN_OR_NULL));
- Expect.equals(UNKNOWN, STRING_OR_NULL.union(NUMBER_OR_NULL));
- Expect.equals(UNKNOWN, STRING_OR_NULL.union(INTEGER_OR_NULL));
- Expect.equals(UNKNOWN, STRING_OR_NULL.union(DOUBLE_OR_NULL));
- Expect.equals(STRING_OR_NULL, STRING_OR_NULL.union(STRING_OR_NULL));
- Expect.equals(STRING_OR_NULL, STRING_OR_NULL.union(NULL));
- Expect.equals(UNKNOWN, STRING_OR_NULL.union(FIXED_ARRAY));
+ Expect.equals(STRING_OR_NULL,
+ STRING_OR_NULL.union(CONFLICTING, compiler));
+ Expect.equals(UNKNOWN,
+ STRING_OR_NULL.union(UNKNOWN, compiler));
+ Expect.equals(UNKNOWN,
+ STRING_OR_NULL.union(BOOLEAN, compiler));
+ Expect.equals(UNKNOWN,
+ STRING_OR_NULL.union(NUMBER, compiler));
+ Expect.equals(UNKNOWN,
+ STRING_OR_NULL.union(INTEGER, compiler));
+ Expect.equals(UNKNOWN,
+ STRING_OR_NULL.union(DOUBLE, compiler));
+ Expect.equals(UNKNOWN,
+ STRING_OR_NULL.union(INDEXABLE_PRIMITIVE, compiler));
+ Expect.equals(STRING_OR_NULL,
+ STRING_OR_NULL.union(STRING, compiler));
+ Expect.equals(UNKNOWN,
+ STRING_OR_NULL.union(READABLE_ARRAY, compiler));
+ Expect.equals(UNKNOWN,
+ STRING_OR_NULL.union(MUTABLE_ARRAY, compiler));
+ Expect.equals(UNKNOWN,
+ STRING_OR_NULL.union(EXTENDABLE_ARRAY, compiler));
+ Expect.equals(UNKNOWN,
+ STRING_OR_NULL.union(nonPrimitive1, compiler));
+ Expect.equals(UNKNOWN,
+ STRING_OR_NULL.union(nonPrimitive2, compiler));
+ Expect.equals(UNKNOWN,
+ STRING_OR_NULL.union(potentialArray, compiler));
+ Expect.equals(potentialString,
+ STRING_OR_NULL.union(potentialString, compiler));
+ Expect.equals(UNKNOWN,
+ STRING_OR_NULL.union(BOOLEAN_OR_NULL, compiler));
+ Expect.equals(UNKNOWN,
+ STRING_OR_NULL.union(NUMBER_OR_NULL, compiler));
+ Expect.equals(UNKNOWN,
+ STRING_OR_NULL.union(INTEGER_OR_NULL, compiler));
+ Expect.equals(UNKNOWN,
+ STRING_OR_NULL.union(DOUBLE_OR_NULL, compiler));
+ Expect.equals(STRING_OR_NULL,
+ STRING_OR_NULL.union(STRING_OR_NULL, compiler));
+ Expect.equals(STRING_OR_NULL,
+ STRING_OR_NULL.union(NULL, compiler));
+ Expect.equals(UNKNOWN,
+ STRING_OR_NULL.union(FIXED_ARRAY, compiler));
- Expect.equals(NULL, NULL.union(CONFLICTING));
- Expect.equals(UNKNOWN, NULL.union(UNKNOWN));
- Expect.equals(BOOLEAN_OR_NULL, NULL.union(BOOLEAN));
- Expect.equals(NUMBER_OR_NULL, NULL.union(NUMBER));
- Expect.equals(INTEGER_OR_NULL, NULL.union(INTEGER));
- Expect.equals(DOUBLE_OR_NULL, NULL.union(DOUBLE));
- Expect.equals(UNKNOWN, NULL.union(INDEXABLE_PRIMITIVE));
- Expect.equals(STRING_OR_NULL, NULL.union(STRING));
- Expect.equals(UNKNOWN, NULL.union(READABLE_ARRAY));
- Expect.equals(UNKNOWN, NULL.union(MUTABLE_ARRAY));
- Expect.equals(UNKNOWN, NULL.union(EXTENDABLE_ARRAY));
- Expect.equals(UNKNOWN, NULL.union(NON_PRIMITIVE1));
- Expect.equals(UNKNOWN, NULL.union(NON_PRIMITIVE2));
- Expect.equals(POTENTIAL_ARRAY, NULL.union(POTENTIAL_ARRAY));
- Expect.equals(POTENTIAL_STRING, NULL.union(POTENTIAL_STRING));
- Expect.equals(BOOLEAN_OR_NULL, NULL.union(BOOLEAN_OR_NULL));
- Expect.equals(NUMBER_OR_NULL, NULL.union(NUMBER_OR_NULL));
- Expect.equals(INTEGER_OR_NULL, NULL.union(INTEGER_OR_NULL));
- Expect.equals(DOUBLE_OR_NULL, NULL.union(DOUBLE_OR_NULL));
- Expect.equals(STRING_OR_NULL, NULL.union(STRING_OR_NULL));
- Expect.equals(NULL, NULL.union(NULL));
- Expect.equals(UNKNOWN, NULL.union(FIXED_ARRAY));
+ Expect.equals(NULL,
+ NULL.union(CONFLICTING, compiler));
+ Expect.equals(UNKNOWN,
+ NULL.union(UNKNOWN, compiler));
+ Expect.equals(BOOLEAN_OR_NULL,
+ NULL.union(BOOLEAN, compiler));
+ Expect.equals(NUMBER_OR_NULL,
+ NULL.union(NUMBER, compiler));
+ Expect.equals(INTEGER_OR_NULL,
+ NULL.union(INTEGER, compiler));
+ Expect.equals(DOUBLE_OR_NULL,
+ NULL.union(DOUBLE, compiler));
+ Expect.equals(UNKNOWN,
+ NULL.union(INDEXABLE_PRIMITIVE, compiler));
+ Expect.equals(STRING_OR_NULL,
+ NULL.union(STRING, compiler));
+ Expect.equals(UNKNOWN,
+ NULL.union(READABLE_ARRAY, compiler));
+ Expect.equals(UNKNOWN,
+ NULL.union(MUTABLE_ARRAY, compiler));
+ Expect.equals(UNKNOWN,
+ NULL.union(EXTENDABLE_ARRAY, compiler));
+ Expect.equals(UNKNOWN,
+ NULL.union(nonPrimitive1, compiler));
+ Expect.equals(UNKNOWN,
+ NULL.union(nonPrimitive2, compiler));
+ Expect.equals(potentialArray,
+ NULL.union(potentialArray, compiler));
+ Expect.equals(potentialString,
+ NULL.union(potentialString, compiler));
+ Expect.equals(BOOLEAN_OR_NULL,
+ NULL.union(BOOLEAN_OR_NULL, compiler));
+ Expect.equals(NUMBER_OR_NULL,
+ NULL.union(NUMBER_OR_NULL, compiler));
+ Expect.equals(INTEGER_OR_NULL,
+ NULL.union(INTEGER_OR_NULL, compiler));
+ Expect.equals(DOUBLE_OR_NULL,
+ NULL.union(DOUBLE_OR_NULL, compiler));
+ Expect.equals(STRING_OR_NULL,
+ NULL.union(STRING_OR_NULL, compiler));
+ Expect.equals(NULL,
+ NULL.union(NULL, compiler));
+ Expect.equals(UNKNOWN,
+ NULL.union(FIXED_ARRAY, compiler));
- Expect.equals(FIXED_ARRAY, FIXED_ARRAY.union(CONFLICTING));
- Expect.equals(UNKNOWN, FIXED_ARRAY.union(UNKNOWN));
- Expect.equals(UNKNOWN, FIXED_ARRAY.union(BOOLEAN));
- Expect.equals(UNKNOWN, FIXED_ARRAY.union(NUMBER));
- Expect.equals(UNKNOWN, FIXED_ARRAY.union(INTEGER));
- Expect.equals(UNKNOWN, FIXED_ARRAY.union(DOUBLE));
- Expect.equals(INDEXABLE_PRIMITIVE, FIXED_ARRAY.union(INDEXABLE_PRIMITIVE));
- Expect.equals(INDEXABLE_PRIMITIVE, FIXED_ARRAY.union(STRING));
- Expect.equals(READABLE_ARRAY, FIXED_ARRAY.union(READABLE_ARRAY));
- Expect.equals(MUTABLE_ARRAY, FIXED_ARRAY.union(MUTABLE_ARRAY));
- Expect.equals(MUTABLE_ARRAY, FIXED_ARRAY.union(EXTENDABLE_ARRAY));
- Expect.equals(UNKNOWN, FIXED_ARRAY.union(NON_PRIMITIVE1));
- Expect.equals(UNKNOWN, FIXED_ARRAY.union(NON_PRIMITIVE2));
- Expect.equals(POTENTIAL_ARRAY, FIXED_ARRAY.union(POTENTIAL_ARRAY));
- Expect.equals(UNKNOWN, FIXED_ARRAY.union(POTENTIAL_STRING));
- Expect.equals(UNKNOWN, FIXED_ARRAY.union(BOOLEAN_OR_NULL));
- Expect.equals(UNKNOWN, FIXED_ARRAY.union(NUMBER_OR_NULL));
- Expect.equals(UNKNOWN, FIXED_ARRAY.union(INTEGER_OR_NULL));
- Expect.equals(UNKNOWN, FIXED_ARRAY.union(DOUBLE_OR_NULL));
- Expect.equals(UNKNOWN, FIXED_ARRAY.union(STRING_OR_NULL));
- Expect.equals(UNKNOWN, FIXED_ARRAY.union(NULL));
- Expect.equals(FIXED_ARRAY, FIXED_ARRAY.union(FIXED_ARRAY));
+ Expect.equals(FIXED_ARRAY,
+ FIXED_ARRAY.union(CONFLICTING, compiler));
+ Expect.equals(UNKNOWN,
+ FIXED_ARRAY.union(UNKNOWN, compiler));
+ Expect.equals(UNKNOWN,
+ FIXED_ARRAY.union(BOOLEAN, compiler));
+ Expect.equals(UNKNOWN,
+ FIXED_ARRAY.union(NUMBER, compiler));
+ Expect.equals(UNKNOWN,
+ FIXED_ARRAY.union(INTEGER, compiler));
+ Expect.equals(UNKNOWN,
+ FIXED_ARRAY.union(DOUBLE, compiler));
+ Expect.equals(INDEXABLE_PRIMITIVE,
+ FIXED_ARRAY.union(INDEXABLE_PRIMITIVE, compiler));
+ Expect.equals(INDEXABLE_PRIMITIVE,
+ FIXED_ARRAY.union(STRING, compiler));
+ Expect.equals(READABLE_ARRAY,
+ FIXED_ARRAY.union(READABLE_ARRAY, compiler));
+ Expect.equals(MUTABLE_ARRAY,
+ FIXED_ARRAY.union(MUTABLE_ARRAY, compiler));
+ Expect.equals(MUTABLE_ARRAY,
+ FIXED_ARRAY.union(EXTENDABLE_ARRAY, compiler));
+ Expect.equals(UNKNOWN,
+ FIXED_ARRAY.union(nonPrimitive1, compiler));
+ Expect.equals(UNKNOWN,
+ FIXED_ARRAY.union(nonPrimitive2, compiler));
+ Expect.equals(potentialArray,
+ FIXED_ARRAY.union(potentialArray, compiler));
+ Expect.equals(UNKNOWN,
+ FIXED_ARRAY.union(potentialString, compiler));
+ Expect.equals(UNKNOWN,
+ FIXED_ARRAY.union(BOOLEAN_OR_NULL, compiler));
+ Expect.equals(UNKNOWN,
+ FIXED_ARRAY.union(NUMBER_OR_NULL, compiler));
+ Expect.equals(UNKNOWN,
+ FIXED_ARRAY.union(INTEGER_OR_NULL, compiler));
+ Expect.equals(UNKNOWN,
+ FIXED_ARRAY.union(DOUBLE_OR_NULL, compiler));
+ Expect.equals(UNKNOWN,
+ FIXED_ARRAY.union(STRING_OR_NULL, compiler));
+ Expect.equals(UNKNOWN,
+ FIXED_ARRAY.union(NULL, compiler));
+ Expect.equals(FIXED_ARRAY,
+ FIXED_ARRAY.union(FIXED_ARRAY, compiler));
}
-void testIntersection() {
- Expect.equals(CONFLICTING, CONFLICTING.intersection(CONFLICTING));
- Expect.equals(CONFLICTING, CONFLICTING.intersection(UNKNOWN));
- Expect.equals(CONFLICTING, CONFLICTING.intersection(BOOLEAN));
- Expect.equals(CONFLICTING, CONFLICTING.intersection(NUMBER));
- Expect.equals(CONFLICTING, CONFLICTING.intersection(INTEGER));
- Expect.equals(CONFLICTING, CONFLICTING.intersection(DOUBLE));
- Expect.equals(CONFLICTING, CONFLICTING.intersection(INDEXABLE_PRIMITIVE));
- Expect.equals(CONFLICTING, CONFLICTING.intersection(STRING));
- Expect.equals(CONFLICTING, CONFLICTING.intersection(READABLE_ARRAY));
- Expect.equals(CONFLICTING, CONFLICTING.intersection(MUTABLE_ARRAY));
- Expect.equals(CONFLICTING, CONFLICTING.intersection(EXTENDABLE_ARRAY));
- Expect.equals(CONFLICTING, CONFLICTING.intersection(NON_PRIMITIVE1));
- Expect.equals(CONFLICTING, CONFLICTING.intersection(NON_PRIMITIVE2));
- Expect.equals(CONFLICTING, CONFLICTING.intersection(POTENTIAL_ARRAY));
- Expect.equals(CONFLICTING, CONFLICTING.intersection(POTENTIAL_STRING));
- Expect.equals(CONFLICTING, CONFLICTING.intersection(BOOLEAN_OR_NULL));
- Expect.equals(CONFLICTING, CONFLICTING.intersection(NUMBER_OR_NULL));
- Expect.equals(CONFLICTING, CONFLICTING.intersection(INTEGER_OR_NULL));
- Expect.equals(CONFLICTING, CONFLICTING.intersection(DOUBLE_OR_NULL));
- Expect.equals(CONFLICTING, CONFLICTING.intersection(STRING_OR_NULL));
- Expect.equals(CONFLICTING, CONFLICTING.intersection(NULL));
- Expect.equals(CONFLICTING, CONFLICTING.intersection(FIXED_ARRAY));
+void testIntersection(MockCompiler compiler) {
+ Expect.equals(CONFLICTING,
+ CONFLICTING.intersection(CONFLICTING, compiler));
+ Expect.equals(CONFLICTING,
+ CONFLICTING.intersection(UNKNOWN, compiler));
+ Expect.equals(CONFLICTING,
+ CONFLICTING.intersection(BOOLEAN, compiler));
+ Expect.equals(CONFLICTING,
+ CONFLICTING.intersection(NUMBER, compiler));
+ Expect.equals(CONFLICTING,
+ CONFLICTING.intersection(INTEGER, compiler));
+ Expect.equals(CONFLICTING,
+ CONFLICTING.intersection(DOUBLE, compiler));
+ Expect.equals(CONFLICTING,
+ CONFLICTING.intersection(INDEXABLE_PRIMITIVE, compiler));
+ Expect.equals(CONFLICTING,
+ CONFLICTING.intersection(STRING, compiler));
+ Expect.equals(CONFLICTING,
+ CONFLICTING.intersection(READABLE_ARRAY, compiler));
+ Expect.equals(CONFLICTING,
+ CONFLICTING.intersection(MUTABLE_ARRAY, compiler));
+ Expect.equals(CONFLICTING,
+ CONFLICTING.intersection(EXTENDABLE_ARRAY, compiler));
+ Expect.equals(CONFLICTING,
+ CONFLICTING.intersection(nonPrimitive1, compiler));
+ Expect.equals(CONFLICTING,
+ CONFLICTING.intersection(nonPrimitive2, compiler));
+ Expect.equals(CONFLICTING,
+ CONFLICTING.intersection(potentialArray, compiler));
+ Expect.equals(CONFLICTING,
+ CONFLICTING.intersection(potentialString, compiler));
+ Expect.equals(CONFLICTING,
+ CONFLICTING.intersection(BOOLEAN_OR_NULL, compiler));
+ Expect.equals(CONFLICTING,
+ CONFLICTING.intersection(NUMBER_OR_NULL, compiler));
+ Expect.equals(CONFLICTING,
+ CONFLICTING.intersection(INTEGER_OR_NULL, compiler));
+ Expect.equals(CONFLICTING,
+ CONFLICTING.intersection(DOUBLE_OR_NULL, compiler));
+ Expect.equals(CONFLICTING,
+ CONFLICTING.intersection(STRING_OR_NULL, compiler));
+ Expect.equals(CONFLICTING,
+ CONFLICTING.intersection(NULL, compiler));
+ Expect.equals(CONFLICTING,
+ CONFLICTING.intersection(FIXED_ARRAY, compiler));
- Expect.equals(CONFLICTING, UNKNOWN.intersection(CONFLICTING));
- Expect.equals(UNKNOWN, UNKNOWN.intersection(UNKNOWN));
- Expect.equals(BOOLEAN, UNKNOWN.intersection(BOOLEAN));
- Expect.equals(NUMBER, UNKNOWN.intersection(NUMBER));
- Expect.equals(INTEGER, UNKNOWN.intersection(INTEGER));
- Expect.equals(DOUBLE, UNKNOWN.intersection(DOUBLE));
- Expect.equals(INDEXABLE_PRIMITIVE, UNKNOWN.intersection(INDEXABLE_PRIMITIVE));
- Expect.equals(STRING, UNKNOWN.intersection(STRING));
- Expect.equals(READABLE_ARRAY, UNKNOWN.intersection(READABLE_ARRAY));
- Expect.equals(MUTABLE_ARRAY, UNKNOWN.intersection(MUTABLE_ARRAY));
- Expect.equals(EXTENDABLE_ARRAY, UNKNOWN.intersection(EXTENDABLE_ARRAY));
- Expect.equals(NON_PRIMITIVE1, UNKNOWN.intersection(NON_PRIMITIVE1));
- Expect.equals(NON_PRIMITIVE2, UNKNOWN.intersection(NON_PRIMITIVE2));
- Expect.equals(POTENTIAL_ARRAY, UNKNOWN.intersection(POTENTIAL_ARRAY));
- Expect.equals(POTENTIAL_STRING, UNKNOWN.intersection(POTENTIAL_STRING));
- Expect.equals(BOOLEAN_OR_NULL, UNKNOWN.intersection(BOOLEAN_OR_NULL));
- Expect.equals(NUMBER_OR_NULL, UNKNOWN.intersection(NUMBER_OR_NULL));
- Expect.equals(INTEGER_OR_NULL, UNKNOWN.intersection(INTEGER_OR_NULL));
- Expect.equals(DOUBLE_OR_NULL, UNKNOWN.intersection(DOUBLE_OR_NULL));
- Expect.equals(STRING_OR_NULL, UNKNOWN.intersection(STRING_OR_NULL));
- Expect.equals(NULL, UNKNOWN.intersection(NULL));
- Expect.equals(FIXED_ARRAY, UNKNOWN.intersection(FIXED_ARRAY));
+ Expect.equals(CONFLICTING,
+ UNKNOWN.intersection(CONFLICTING, compiler));
+ Expect.equals(UNKNOWN,
+ UNKNOWN.intersection(UNKNOWN, compiler));
+ Expect.equals(BOOLEAN,
+ UNKNOWN.intersection(BOOLEAN, compiler));
+ Expect.equals(NUMBER,
+ UNKNOWN.intersection(NUMBER, compiler));
+ Expect.equals(INTEGER,
+ UNKNOWN.intersection(INTEGER, compiler));
+ Expect.equals(DOUBLE,
+ UNKNOWN.intersection(DOUBLE, compiler));
+ Expect.equals(INDEXABLE_PRIMITIVE,
+ UNKNOWN.intersection(INDEXABLE_PRIMITIVE, compiler));
+ Expect.equals(STRING,
+ UNKNOWN.intersection(STRING, compiler));
+ Expect.equals(READABLE_ARRAY,
+ UNKNOWN.intersection(READABLE_ARRAY, compiler));
+ Expect.equals(MUTABLE_ARRAY,
+ UNKNOWN.intersection(MUTABLE_ARRAY, compiler));
+ Expect.equals(EXTENDABLE_ARRAY,
+ UNKNOWN.intersection(EXTENDABLE_ARRAY, compiler));
+ Expect.equals(nonPrimitive1,
+ UNKNOWN.intersection(nonPrimitive1, compiler));
+ Expect.equals(nonPrimitive2,
+ UNKNOWN.intersection(nonPrimitive2, compiler));
+ Expect.equals(potentialArray,
+ UNKNOWN.intersection(potentialArray, compiler));
+ Expect.equals(potentialString,
+ UNKNOWN.intersection(potentialString, compiler));
+ Expect.equals(BOOLEAN_OR_NULL,
+ UNKNOWN.intersection(BOOLEAN_OR_NULL, compiler));
+ Expect.equals(NUMBER_OR_NULL,
+ UNKNOWN.intersection(NUMBER_OR_NULL, compiler));
+ Expect.equals(INTEGER_OR_NULL,
+ UNKNOWN.intersection(INTEGER_OR_NULL, compiler));
+ Expect.equals(DOUBLE_OR_NULL,
+ UNKNOWN.intersection(DOUBLE_OR_NULL, compiler));
+ Expect.equals(STRING_OR_NULL,
+ UNKNOWN.intersection(STRING_OR_NULL, compiler));
+ Expect.equals(NULL,
+ UNKNOWN.intersection(NULL, compiler));
+ Expect.equals(FIXED_ARRAY,
+ UNKNOWN.intersection(FIXED_ARRAY, compiler));
- Expect.equals(CONFLICTING, BOOLEAN.intersection(CONFLICTING));
- Expect.equals(BOOLEAN, BOOLEAN.intersection(UNKNOWN));
- Expect.equals(BOOLEAN, BOOLEAN.intersection(BOOLEAN));
- Expect.equals(CONFLICTING, BOOLEAN.intersection(NUMBER));
- Expect.equals(CONFLICTING, BOOLEAN.intersection(INTEGER));
- Expect.equals(CONFLICTING, BOOLEAN.intersection(DOUBLE));
- Expect.equals(CONFLICTING, BOOLEAN.intersection(INDEXABLE_PRIMITIVE));
- Expect.equals(CONFLICTING, BOOLEAN.intersection(STRING));
- Expect.equals(CONFLICTING, BOOLEAN.intersection(READABLE_ARRAY));
- Expect.equals(CONFLICTING, BOOLEAN.intersection(MUTABLE_ARRAY));
- Expect.equals(CONFLICTING, BOOLEAN.intersection(EXTENDABLE_ARRAY));
- Expect.equals(CONFLICTING, BOOLEAN.intersection(NON_PRIMITIVE1));
- Expect.equals(CONFLICTING, BOOLEAN.intersection(NON_PRIMITIVE2));
- Expect.equals(CONFLICTING, BOOLEAN.intersection(POTENTIAL_ARRAY));
- Expect.equals(CONFLICTING, BOOLEAN.intersection(POTENTIAL_STRING));
- Expect.equals(BOOLEAN, BOOLEAN.intersection(BOOLEAN_OR_NULL));
- Expect.equals(CONFLICTING, BOOLEAN.intersection(NUMBER_OR_NULL));
- Expect.equals(CONFLICTING, BOOLEAN.intersection(INTEGER_OR_NULL));
- Expect.equals(CONFLICTING, BOOLEAN.intersection(DOUBLE_OR_NULL));
- Expect.equals(CONFLICTING, BOOLEAN.intersection(STRING_OR_NULL));
- Expect.equals(CONFLICTING, BOOLEAN.intersection(NULL));
- Expect.equals(CONFLICTING, BOOLEAN.intersection(FIXED_ARRAY));
+ Expect.equals(CONFLICTING,
+ BOOLEAN.intersection(CONFLICTING, compiler));
+ Expect.equals(BOOLEAN,
+ BOOLEAN.intersection(UNKNOWN, compiler));
+ Expect.equals(BOOLEAN,
+ BOOLEAN.intersection(BOOLEAN, compiler));
+ Expect.equals(CONFLICTING,
+ BOOLEAN.intersection(NUMBER, compiler));
+ Expect.equals(CONFLICTING,
+ BOOLEAN.intersection(INTEGER, compiler));
+ Expect.equals(CONFLICTING,
+ BOOLEAN.intersection(DOUBLE, compiler));
+ Expect.equals(CONFLICTING,
+ BOOLEAN.intersection(INDEXABLE_PRIMITIVE, compiler));
+ Expect.equals(CONFLICTING,
+ BOOLEAN.intersection(STRING, compiler));
+ Expect.equals(CONFLICTING,
+ BOOLEAN.intersection(READABLE_ARRAY, compiler));
+ Expect.equals(CONFLICTING,
+ BOOLEAN.intersection(MUTABLE_ARRAY, compiler));
+ Expect.equals(CONFLICTING,
+ BOOLEAN.intersection(EXTENDABLE_ARRAY, compiler));
+ Expect.equals(CONFLICTING,
+ BOOLEAN.intersection(nonPrimitive1, compiler));
+ Expect.equals(CONFLICTING,
+ BOOLEAN.intersection(nonPrimitive2, compiler));
+ Expect.equals(CONFLICTING,
+ BOOLEAN.intersection(potentialArray, compiler));
+ Expect.equals(CONFLICTING,
+ BOOLEAN.intersection(potentialString, compiler));
+ Expect.equals(BOOLEAN,
+ BOOLEAN.intersection(BOOLEAN_OR_NULL, compiler));
+ Expect.equals(CONFLICTING,
+ BOOLEAN.intersection(NUMBER_OR_NULL, compiler));
+ Expect.equals(CONFLICTING,
+ BOOLEAN.intersection(INTEGER_OR_NULL, compiler));
+ Expect.equals(CONFLICTING,
+ BOOLEAN.intersection(DOUBLE_OR_NULL, compiler));
+ Expect.equals(CONFLICTING,
+ BOOLEAN.intersection(STRING_OR_NULL, compiler));
+ Expect.equals(CONFLICTING,
+ BOOLEAN.intersection(NULL, compiler));
+ Expect.equals(CONFLICTING,
+ BOOLEAN.intersection(FIXED_ARRAY, compiler));
- Expect.equals(CONFLICTING, NUMBER.intersection(CONFLICTING));
- Expect.equals(NUMBER, NUMBER.intersection(UNKNOWN));
- Expect.equals(CONFLICTING, NUMBER.intersection(BOOLEAN));
- Expect.equals(NUMBER, NUMBER.intersection(NUMBER));
- Expect.equals(INTEGER, NUMBER.intersection(INTEGER));
- Expect.equals(DOUBLE, NUMBER.intersection(DOUBLE));
- Expect.equals(CONFLICTING, NUMBER.intersection(INDEXABLE_PRIMITIVE));
- Expect.equals(CONFLICTING, NUMBER.intersection(STRING));
- Expect.equals(CONFLICTING, NUMBER.intersection(READABLE_ARRAY));
- Expect.equals(CONFLICTING, NUMBER.intersection(MUTABLE_ARRAY));
- Expect.equals(CONFLICTING, NUMBER.intersection(EXTENDABLE_ARRAY));
- Expect.equals(CONFLICTING, NUMBER.intersection(NON_PRIMITIVE1));
- Expect.equals(CONFLICTING, NUMBER.intersection(NON_PRIMITIVE2));
- Expect.equals(CONFLICTING, NUMBER.intersection(POTENTIAL_ARRAY));
- Expect.equals(CONFLICTING, NUMBER.intersection(POTENTIAL_STRING));
- Expect.equals(CONFLICTING, NUMBER.intersection(BOOLEAN_OR_NULL));
- Expect.equals(NUMBER, NUMBER.intersection(NUMBER_OR_NULL));
- Expect.equals(INTEGER, NUMBER.intersection(INTEGER_OR_NULL));
- Expect.equals(DOUBLE, NUMBER.intersection(DOUBLE_OR_NULL));
- Expect.equals(CONFLICTING, NUMBER.intersection(STRING_OR_NULL));
- Expect.equals(CONFLICTING, NUMBER.intersection(NULL));
- Expect.equals(CONFLICTING, NUMBER.intersection(FIXED_ARRAY));
+ Expect.equals(CONFLICTING,
+ NUMBER.intersection(CONFLICTING, compiler));
+ Expect.equals(NUMBER,
+ NUMBER.intersection(UNKNOWN, compiler));
+ Expect.equals(CONFLICTING,
+ NUMBER.intersection(BOOLEAN, compiler));
+ Expect.equals(NUMBER,
+ NUMBER.intersection(NUMBER, compiler));
+ Expect.equals(INTEGER,
+ NUMBER.intersection(INTEGER, compiler));
+ Expect.equals(DOUBLE,
+ NUMBER.intersection(DOUBLE, compiler));
+ Expect.equals(CONFLICTING,
+ NUMBER.intersection(INDEXABLE_PRIMITIVE, compiler));
+ Expect.equals(CONFLICTING,
+ NUMBER.intersection(STRING, compiler));
+ Expect.equals(CONFLICTING,
+ NUMBER.intersection(READABLE_ARRAY, compiler));
+ Expect.equals(CONFLICTING,
+ NUMBER.intersection(MUTABLE_ARRAY, compiler));
+ Expect.equals(CONFLICTING,
+ NUMBER.intersection(EXTENDABLE_ARRAY, compiler));
+ Expect.equals(CONFLICTING,
+ NUMBER.intersection(nonPrimitive1, compiler));
+ Expect.equals(CONFLICTING,
+ NUMBER.intersection(nonPrimitive2, compiler));
+ Expect.equals(CONFLICTING,
+ NUMBER.intersection(potentialArray, compiler));
+ Expect.equals(CONFLICTING,
+ NUMBER.intersection(potentialString, compiler));
+ Expect.equals(CONFLICTING,
+ NUMBER.intersection(BOOLEAN_OR_NULL, compiler));
+ Expect.equals(NUMBER,
+ NUMBER.intersection(NUMBER_OR_NULL, compiler));
+ Expect.equals(INTEGER,
+ NUMBER.intersection(INTEGER_OR_NULL, compiler));
+ Expect.equals(DOUBLE,
+ NUMBER.intersection(DOUBLE_OR_NULL, compiler));
+ Expect.equals(CONFLICTING,
+ NUMBER.intersection(STRING_OR_NULL, compiler));
+ Expect.equals(CONFLICTING,
+ NUMBER.intersection(NULL, compiler));
+ Expect.equals(CONFLICTING,
+ NUMBER.intersection(FIXED_ARRAY, compiler));
- Expect.equals(CONFLICTING, INTEGER.intersection(CONFLICTING));
- Expect.equals(INTEGER, INTEGER.intersection(UNKNOWN));
- Expect.equals(CONFLICTING, INTEGER.intersection(BOOLEAN));
- Expect.equals(INTEGER, INTEGER.intersection(NUMBER));
- Expect.equals(INTEGER, INTEGER.intersection(INTEGER));
- Expect.equals(CONFLICTING, INTEGER.intersection(DOUBLE));
- Expect.equals(CONFLICTING, INTEGER.intersection(INDEXABLE_PRIMITIVE));
- Expect.equals(CONFLICTING, INTEGER.intersection(STRING));
- Expect.equals(CONFLICTING, INTEGER.intersection(READABLE_ARRAY));
- Expect.equals(CONFLICTING, INTEGER.intersection(MUTABLE_ARRAY));
- Expect.equals(CONFLICTING, INTEGER.intersection(EXTENDABLE_ARRAY));
- Expect.equals(CONFLICTING, INTEGER.intersection(NON_PRIMITIVE1));
- Expect.equals(CONFLICTING, INTEGER.intersection(NON_PRIMITIVE2));
- Expect.equals(CONFLICTING, INTEGER.intersection(POTENTIAL_ARRAY));
- Expect.equals(CONFLICTING, INTEGER.intersection(POTENTIAL_STRING));
- Expect.equals(CONFLICTING, INTEGER.intersection(BOOLEAN_OR_NULL));
- Expect.equals(INTEGER, INTEGER.intersection(NUMBER_OR_NULL));
- Expect.equals(INTEGER, INTEGER.intersection(INTEGER_OR_NULL));
- Expect.equals(CONFLICTING, INTEGER.intersection(DOUBLE_OR_NULL));
- Expect.equals(CONFLICTING, INTEGER.intersection(STRING_OR_NULL));
- Expect.equals(CONFLICTING, INTEGER.intersection(NULL));
- Expect.equals(CONFLICTING, INTEGER.intersection(FIXED_ARRAY));
+ Expect.equals(CONFLICTING,
+ INTEGER.intersection(CONFLICTING, compiler));
+ Expect.equals(INTEGER,
+ INTEGER.intersection(UNKNOWN, compiler));
+ Expect.equals(CONFLICTING,
+ INTEGER.intersection(BOOLEAN, compiler));
+ Expect.equals(INTEGER,
+ INTEGER.intersection(NUMBER, compiler));
+ Expect.equals(INTEGER,
+ INTEGER.intersection(INTEGER, compiler));
+ Expect.equals(CONFLICTING,
+ INTEGER.intersection(DOUBLE, compiler));
+ Expect.equals(CONFLICTING,
+ INTEGER.intersection(INDEXABLE_PRIMITIVE, compiler));
+ Expect.equals(CONFLICTING,
+ INTEGER.intersection(STRING, compiler));
+ Expect.equals(CONFLICTING,
+ INTEGER.intersection(READABLE_ARRAY, compiler));
+ Expect.equals(CONFLICTING,
+ INTEGER.intersection(MUTABLE_ARRAY, compiler));
+ Expect.equals(CONFLICTING,
+ INTEGER.intersection(EXTENDABLE_ARRAY, compiler));
+ Expect.equals(CONFLICTING,
+ INTEGER.intersection(nonPrimitive1, compiler));
+ Expect.equals(CONFLICTING,
+ INTEGER.intersection(nonPrimitive2, compiler));
+ Expect.equals(CONFLICTING,
+ INTEGER.intersection(potentialArray, compiler));
+ Expect.equals(CONFLICTING,
+ INTEGER.intersection(potentialString, compiler));
+ Expect.equals(CONFLICTING,
+ INTEGER.intersection(BOOLEAN_OR_NULL, compiler));
+ Expect.equals(INTEGER,
+ INTEGER.intersection(NUMBER_OR_NULL, compiler));
+ Expect.equals(INTEGER,
+ INTEGER.intersection(INTEGER_OR_NULL, compiler));
+ Expect.equals(CONFLICTING,
+ INTEGER.intersection(DOUBLE_OR_NULL, compiler));
+ Expect.equals(CONFLICTING,
+ INTEGER.intersection(STRING_OR_NULL, compiler));
+ Expect.equals(CONFLICTING,
+ INTEGER.intersection(NULL, compiler));
+ Expect.equals(CONFLICTING,
+ INTEGER.intersection(FIXED_ARRAY, compiler));
- Expect.equals(CONFLICTING, DOUBLE.intersection(CONFLICTING));
- Expect.equals(DOUBLE, DOUBLE.intersection(UNKNOWN));
- Expect.equals(CONFLICTING, DOUBLE.intersection(BOOLEAN));
- Expect.equals(DOUBLE, DOUBLE.intersection(NUMBER));
- Expect.equals(CONFLICTING, DOUBLE.intersection(INTEGER));
- Expect.equals(DOUBLE, DOUBLE.intersection(DOUBLE));
- Expect.equals(CONFLICTING, DOUBLE.intersection(INDEXABLE_PRIMITIVE));
- Expect.equals(CONFLICTING, DOUBLE.intersection(STRING));
- Expect.equals(CONFLICTING, DOUBLE.intersection(READABLE_ARRAY));
- Expect.equals(CONFLICTING, DOUBLE.intersection(MUTABLE_ARRAY));
- Expect.equals(CONFLICTING, DOUBLE.intersection(EXTENDABLE_ARRAY));
- Expect.equals(CONFLICTING, DOUBLE.intersection(NON_PRIMITIVE1));
- Expect.equals(CONFLICTING, DOUBLE.intersection(NON_PRIMITIVE2));
- Expect.equals(CONFLICTING, DOUBLE.intersection(POTENTIAL_ARRAY));
- Expect.equals(CONFLICTING, DOUBLE.intersection(POTENTIAL_STRING));
- Expect.equals(CONFLICTING, DOUBLE.intersection(BOOLEAN_OR_NULL));
- Expect.equals(DOUBLE, DOUBLE.intersection(NUMBER_OR_NULL));
- Expect.equals(CONFLICTING, DOUBLE.intersection(INTEGER_OR_NULL));
- Expect.equals(DOUBLE, DOUBLE.intersection(DOUBLE_OR_NULL));
- Expect.equals(CONFLICTING, DOUBLE.intersection(STRING_OR_NULL));
- Expect.equals(CONFLICTING, DOUBLE.intersection(NULL));
- Expect.equals(CONFLICTING, DOUBLE.intersection(FIXED_ARRAY));
+ Expect.equals(CONFLICTING,
+ DOUBLE.intersection(CONFLICTING, compiler));
+ Expect.equals(DOUBLE,
+ DOUBLE.intersection(UNKNOWN, compiler));
+ Expect.equals(CONFLICTING,
+ DOUBLE.intersection(BOOLEAN, compiler));
+ Expect.equals(DOUBLE,
+ DOUBLE.intersection(NUMBER, compiler));
+ Expect.equals(CONFLICTING,
+ DOUBLE.intersection(INTEGER, compiler));
+ Expect.equals(DOUBLE,
+ DOUBLE.intersection(DOUBLE, compiler));
+ Expect.equals(CONFLICTING,
+ DOUBLE.intersection(INDEXABLE_PRIMITIVE, compiler));
+ Expect.equals(CONFLICTING,
+ DOUBLE.intersection(STRING, compiler));
+ Expect.equals(CONFLICTING,
+ DOUBLE.intersection(READABLE_ARRAY, compiler));
+ Expect.equals(CONFLICTING,
+ DOUBLE.intersection(MUTABLE_ARRAY, compiler));
+ Expect.equals(CONFLICTING,
+ DOUBLE.intersection(EXTENDABLE_ARRAY, compiler));
+ Expect.equals(CONFLICTING,
+ DOUBLE.intersection(nonPrimitive1, compiler));
+ Expect.equals(CONFLICTING,
+ DOUBLE.intersection(nonPrimitive2, compiler));
+ Expect.equals(CONFLICTING,
+ DOUBLE.intersection(potentialArray, compiler));
+ Expect.equals(CONFLICTING,
+ DOUBLE.intersection(potentialString, compiler));
+ Expect.equals(CONFLICTING,
+ DOUBLE.intersection(BOOLEAN_OR_NULL, compiler));
+ Expect.equals(DOUBLE,
+ DOUBLE.intersection(NUMBER_OR_NULL, compiler));
+ Expect.equals(CONFLICTING,
+ DOUBLE.intersection(INTEGER_OR_NULL, compiler));
+ Expect.equals(DOUBLE,
+ DOUBLE.intersection(DOUBLE_OR_NULL, compiler));
+ Expect.equals(CONFLICTING,
+ DOUBLE.intersection(STRING_OR_NULL, compiler));
+ Expect.equals(CONFLICTING,
+ DOUBLE.intersection(NULL, compiler));
+ Expect.equals(CONFLICTING,
+ DOUBLE.intersection(FIXED_ARRAY, compiler));
- Expect.equals(CONFLICTING, INDEXABLE_PRIMITIVE.intersection(CONFLICTING));
- Expect.equals(INDEXABLE_PRIMITIVE, INDEXABLE_PRIMITIVE.intersection(UNKNOWN));
- Expect.equals(CONFLICTING, INDEXABLE_PRIMITIVE.intersection(BOOLEAN));
- Expect.equals(CONFLICTING, INDEXABLE_PRIMITIVE.intersection(NUMBER));
- Expect.equals(CONFLICTING, INDEXABLE_PRIMITIVE.intersection(INTEGER));
- Expect.equals(CONFLICTING, INDEXABLE_PRIMITIVE.intersection(DOUBLE));
+ Expect.equals(CONFLICTING,
+ INDEXABLE_PRIMITIVE.intersection(CONFLICTING, compiler));
+ Expect.equals(INDEXABLE_PRIMITIVE,
+ INDEXABLE_PRIMITIVE.intersection(UNKNOWN, compiler));
+ Expect.equals(CONFLICTING,
+ INDEXABLE_PRIMITIVE.intersection(BOOLEAN, compiler));
+ Expect.equals(CONFLICTING,
+ INDEXABLE_PRIMITIVE.intersection(NUMBER, compiler));
+ Expect.equals(CONFLICTING,
+ INDEXABLE_PRIMITIVE.intersection(INTEGER, compiler));
+ Expect.equals(CONFLICTING,
+ INDEXABLE_PRIMITIVE.intersection(DOUBLE, compiler));
Expect.equals(INDEXABLE_PRIMITIVE,
- INDEXABLE_PRIMITIVE.intersection(INDEXABLE_PRIMITIVE));
- Expect.equals(STRING, INDEXABLE_PRIMITIVE.intersection(STRING));
+ INDEXABLE_PRIMITIVE.intersection(INDEXABLE_PRIMITIVE,
+ compiler));
+ Expect.equals(STRING,
+ INDEXABLE_PRIMITIVE.intersection(STRING, compiler));
Expect.equals(READABLE_ARRAY,
- INDEXABLE_PRIMITIVE.intersection(READABLE_ARRAY));
+ INDEXABLE_PRIMITIVE.intersection(READABLE_ARRAY,
+ compiler));
Expect.equals(MUTABLE_ARRAY,
- INDEXABLE_PRIMITIVE.intersection(MUTABLE_ARRAY));
+ INDEXABLE_PRIMITIVE.intersection(MUTABLE_ARRAY,
+ compiler));
Expect.equals(EXTENDABLE_ARRAY,
- INDEXABLE_PRIMITIVE.intersection(EXTENDABLE_ARRAY));
- Expect.equals(CONFLICTING, INDEXABLE_PRIMITIVE.intersection(NON_PRIMITIVE1));
- Expect.equals(CONFLICTING, INDEXABLE_PRIMITIVE.intersection(NON_PRIMITIVE2));
+ INDEXABLE_PRIMITIVE.intersection(EXTENDABLE_ARRAY,
+ compiler));
+ Expect.equals(CONFLICTING,
+ INDEXABLE_PRIMITIVE.intersection(nonPrimitive1, compiler));
+ Expect.equals(CONFLICTING,
+ INDEXABLE_PRIMITIVE.intersection(nonPrimitive2, compiler));
Expect.equals(READABLE_ARRAY,
- INDEXABLE_PRIMITIVE.intersection(POTENTIAL_ARRAY));
+ INDEXABLE_PRIMITIVE.intersection(potentialArray,
+ compiler));
Expect.equals(STRING,
- INDEXABLE_PRIMITIVE.intersection(POTENTIAL_STRING));
- Expect.equals(CONFLICTING, INDEXABLE_PRIMITIVE.intersection(BOOLEAN_OR_NULL));
- Expect.equals(CONFLICTING, INDEXABLE_PRIMITIVE.intersection(NUMBER_OR_NULL));
- Expect.equals(CONFLICTING, INDEXABLE_PRIMITIVE.intersection(INTEGER_OR_NULL));
- Expect.equals(CONFLICTING, INDEXABLE_PRIMITIVE.intersection(DOUBLE_OR_NULL));
- Expect.equals(CONFLICTING, INDEXABLE_PRIMITIVE.intersection(STRING_OR_NULL));
- Expect.equals(CONFLICTING, INDEXABLE_PRIMITIVE.intersection(NULL));
- Expect.equals(FIXED_ARRAY, INDEXABLE_PRIMITIVE.intersection(FIXED_ARRAY));
+ INDEXABLE_PRIMITIVE.intersection(potentialString,
+ compiler));
+ Expect.equals(CONFLICTING,
+ INDEXABLE_PRIMITIVE.intersection(BOOLEAN_OR_NULL, compiler));
+ Expect.equals(CONFLICTING,
+ INDEXABLE_PRIMITIVE.intersection(NUMBER_OR_NULL, compiler));
+ Expect.equals(CONFLICTING,
+ INDEXABLE_PRIMITIVE.intersection(INTEGER_OR_NULL, compiler));
+ Expect.equals(CONFLICTING,
+ INDEXABLE_PRIMITIVE.intersection(DOUBLE_OR_NULL, compiler));
+ Expect.equals(CONFLICTING,
+ INDEXABLE_PRIMITIVE.intersection(STRING_OR_NULL, compiler));
+ Expect.equals(CONFLICTING,
+ INDEXABLE_PRIMITIVE.intersection(NULL, compiler));
+ Expect.equals(FIXED_ARRAY,
+ INDEXABLE_PRIMITIVE.intersection(FIXED_ARRAY, compiler));
- Expect.equals(CONFLICTING, STRING.intersection(CONFLICTING));
- Expect.equals(STRING, STRING.intersection(UNKNOWN));
- Expect.equals(CONFLICTING, STRING.intersection(BOOLEAN));
- Expect.equals(CONFLICTING, STRING.intersection(NUMBER));
- Expect.equals(CONFLICTING, STRING.intersection(INTEGER));
- Expect.equals(CONFLICTING, STRING.intersection(DOUBLE));
- Expect.equals(STRING, STRING.intersection(INDEXABLE_PRIMITIVE));
- Expect.equals(STRING, STRING.intersection(STRING));
- Expect.equals(CONFLICTING, STRING.intersection(READABLE_ARRAY));
- Expect.equals(CONFLICTING, STRING.intersection(MUTABLE_ARRAY));
- Expect.equals(CONFLICTING, STRING.intersection(EXTENDABLE_ARRAY));
- Expect.equals(CONFLICTING, STRING.intersection(NON_PRIMITIVE1));
- Expect.equals(CONFLICTING, STRING.intersection(NON_PRIMITIVE2));
- Expect.equals(CONFLICTING, STRING.intersection(POTENTIAL_ARRAY));
- Expect.equals(STRING, STRING.intersection(POTENTIAL_STRING));
- Expect.equals(CONFLICTING, STRING.intersection(BOOLEAN_OR_NULL));
- Expect.equals(CONFLICTING, STRING.intersection(NUMBER_OR_NULL));
- Expect.equals(CONFLICTING, STRING.intersection(INTEGER_OR_NULL));
- Expect.equals(CONFLICTING, STRING.intersection(DOUBLE_OR_NULL));
- Expect.equals(STRING, STRING.intersection(STRING_OR_NULL));
- Expect.equals(CONFLICTING, STRING.intersection(NULL));
- Expect.equals(CONFLICTING, STRING.intersection(FIXED_ARRAY));
+ Expect.equals(CONFLICTING,
+ STRING.intersection(CONFLICTING, compiler));
+ Expect.equals(STRING,
+ STRING.intersection(UNKNOWN, compiler));
+ Expect.equals(CONFLICTING,
+ STRING.intersection(BOOLEAN, compiler));
+ Expect.equals(CONFLICTING,
+ STRING.intersection(NUMBER, compiler));
+ Expect.equals(CONFLICTING,
+ STRING.intersection(INTEGER, compiler));
+ Expect.equals(CONFLICTING,
+ STRING.intersection(DOUBLE, compiler));
+ Expect.equals(STRING,
+ STRING.intersection(INDEXABLE_PRIMITIVE, compiler));
+ Expect.equals(STRING,
+ STRING.intersection(STRING, compiler));
+ Expect.equals(CONFLICTING,
+ STRING.intersection(READABLE_ARRAY, compiler));
+ Expect.equals(CONFLICTING,
+ STRING.intersection(MUTABLE_ARRAY, compiler));
+ Expect.equals(CONFLICTING,
+ STRING.intersection(EXTENDABLE_ARRAY, compiler));
+ Expect.equals(CONFLICTING,
+ STRING.intersection(nonPrimitive1, compiler));
+ Expect.equals(CONFLICTING,
+ STRING.intersection(nonPrimitive2, compiler));
+ Expect.equals(CONFLICTING,
+ STRING.intersection(potentialArray, compiler));
+ Expect.equals(STRING,
+ STRING.intersection(potentialString, compiler));
+ Expect.equals(CONFLICTING,
+ STRING.intersection(BOOLEAN_OR_NULL, compiler));
+ Expect.equals(CONFLICTING,
+ STRING.intersection(NUMBER_OR_NULL, compiler));
+ Expect.equals(CONFLICTING,
+ STRING.intersection(INTEGER_OR_NULL, compiler));
+ Expect.equals(CONFLICTING,
+ STRING.intersection(DOUBLE_OR_NULL, compiler));
+ Expect.equals(STRING,
+ STRING.intersection(STRING_OR_NULL, compiler));
+ Expect.equals(CONFLICTING,
+ STRING.intersection(NULL, compiler));
+ Expect.equals(CONFLICTING,
+ STRING.intersection(FIXED_ARRAY, compiler));
- Expect.equals(CONFLICTING, READABLE_ARRAY.intersection(CONFLICTING));
- Expect.equals(READABLE_ARRAY, READABLE_ARRAY.intersection(UNKNOWN));
- Expect.equals(CONFLICTING, READABLE_ARRAY.intersection(BOOLEAN));
- Expect.equals(CONFLICTING, READABLE_ARRAY.intersection(NUMBER));
- Expect.equals(CONFLICTING, READABLE_ARRAY.intersection(INTEGER));
- Expect.equals(CONFLICTING, READABLE_ARRAY.intersection(DOUBLE));
- Expect.equals(READABLE_ARRAY, READABLE_ARRAY.intersection(INDEXABLE_PRIMITIVE));
- Expect.equals(CONFLICTING, READABLE_ARRAY.intersection(STRING));
- Expect.equals(READABLE_ARRAY, READABLE_ARRAY.intersection(READABLE_ARRAY));
- Expect.equals(MUTABLE_ARRAY, READABLE_ARRAY.intersection(MUTABLE_ARRAY));
- Expect.equals(EXTENDABLE_ARRAY, READABLE_ARRAY.intersection(EXTENDABLE_ARRAY));
- Expect.equals(CONFLICTING, READABLE_ARRAY.intersection(NON_PRIMITIVE1));
- Expect.equals(CONFLICTING, READABLE_ARRAY.intersection(NON_PRIMITIVE2));
- Expect.equals(READABLE_ARRAY, READABLE_ARRAY.intersection(POTENTIAL_ARRAY));
- Expect.equals(CONFLICTING, READABLE_ARRAY.intersection(POTENTIAL_STRING));
- Expect.equals(CONFLICTING, READABLE_ARRAY.intersection(BOOLEAN_OR_NULL));
- Expect.equals(CONFLICTING, READABLE_ARRAY.intersection(NUMBER_OR_NULL));
- Expect.equals(CONFLICTING, READABLE_ARRAY.intersection(INTEGER_OR_NULL));
- Expect.equals(CONFLICTING, READABLE_ARRAY.intersection(DOUBLE_OR_NULL));
- Expect.equals(CONFLICTING, READABLE_ARRAY.intersection(STRING_OR_NULL));
- Expect.equals(CONFLICTING, READABLE_ARRAY.intersection(NULL));
- Expect.equals(FIXED_ARRAY, READABLE_ARRAY.intersection(FIXED_ARRAY));
+ Expect.equals(CONFLICTING,
+ READABLE_ARRAY.intersection(CONFLICTING, compiler));
+ Expect.equals(READABLE_ARRAY,
+ READABLE_ARRAY.intersection(UNKNOWN, compiler));
+ Expect.equals(CONFLICTING,
+ READABLE_ARRAY.intersection(BOOLEAN, compiler));
+ Expect.equals(CONFLICTING,
+ READABLE_ARRAY.intersection(NUMBER, compiler));
+ Expect.equals(CONFLICTING,
+ READABLE_ARRAY.intersection(INTEGER, compiler));
+ Expect.equals(CONFLICTING,
+ READABLE_ARRAY.intersection(DOUBLE, compiler));
+ Expect.equals(READABLE_ARRAY,
+ READABLE_ARRAY.intersection(INDEXABLE_PRIMITIVE, compiler));
+ Expect.equals(CONFLICTING,
+ READABLE_ARRAY.intersection(STRING, compiler));
+ Expect.equals(READABLE_ARRAY,
+ READABLE_ARRAY.intersection(READABLE_ARRAY, compiler));
+ Expect.equals(MUTABLE_ARRAY,
+ READABLE_ARRAY.intersection(MUTABLE_ARRAY, compiler));
+ Expect.equals(EXTENDABLE_ARRAY,
+ READABLE_ARRAY.intersection(EXTENDABLE_ARRAY, compiler));
+ Expect.equals(CONFLICTING,
+ READABLE_ARRAY.intersection(nonPrimitive1, compiler));
+ Expect.equals(CONFLICTING,
+ READABLE_ARRAY.intersection(nonPrimitive2, compiler));
+ Expect.equals(READABLE_ARRAY,
+ READABLE_ARRAY.intersection(potentialArray, compiler));
+ Expect.equals(CONFLICTING,
+ READABLE_ARRAY.intersection(potentialString, compiler));
+ Expect.equals(CONFLICTING,
+ READABLE_ARRAY.intersection(BOOLEAN_OR_NULL, compiler));
+ Expect.equals(CONFLICTING,
+ READABLE_ARRAY.intersection(NUMBER_OR_NULL, compiler));
+ Expect.equals(CONFLICTING,
+ READABLE_ARRAY.intersection(INTEGER_OR_NULL, compiler));
+ Expect.equals(CONFLICTING,
+ READABLE_ARRAY.intersection(DOUBLE_OR_NULL, compiler));
+ Expect.equals(CONFLICTING,
+ READABLE_ARRAY.intersection(STRING_OR_NULL, compiler));
+ Expect.equals(CONFLICTING,
+ READABLE_ARRAY.intersection(NULL, compiler));
+ Expect.equals(FIXED_ARRAY,
+ READABLE_ARRAY.intersection(FIXED_ARRAY, compiler));
- Expect.equals(CONFLICTING, MUTABLE_ARRAY.intersection(CONFLICTING));
- Expect.equals(MUTABLE_ARRAY, MUTABLE_ARRAY.intersection(UNKNOWN));
- Expect.equals(CONFLICTING, MUTABLE_ARRAY.intersection(BOOLEAN));
- Expect.equals(CONFLICTING, MUTABLE_ARRAY.intersection(NUMBER));
- Expect.equals(CONFLICTING, MUTABLE_ARRAY.intersection(INTEGER));
- Expect.equals(CONFLICTING, MUTABLE_ARRAY.intersection(DOUBLE));
- Expect.equals(MUTABLE_ARRAY, MUTABLE_ARRAY.intersection(INDEXABLE_PRIMITIVE));
- Expect.equals(CONFLICTING, MUTABLE_ARRAY.intersection(STRING));
- Expect.equals(MUTABLE_ARRAY, MUTABLE_ARRAY.intersection(READABLE_ARRAY));
- Expect.equals(MUTABLE_ARRAY, MUTABLE_ARRAY.intersection(MUTABLE_ARRAY));
- Expect.equals(EXTENDABLE_ARRAY, MUTABLE_ARRAY.intersection(EXTENDABLE_ARRAY));
- Expect.equals(CONFLICTING, MUTABLE_ARRAY.intersection(NON_PRIMITIVE1));
- Expect.equals(CONFLICTING, MUTABLE_ARRAY.intersection(NON_PRIMITIVE2));
- Expect.equals(MUTABLE_ARRAY, MUTABLE_ARRAY.intersection(POTENTIAL_ARRAY));
- Expect.equals(CONFLICTING, MUTABLE_ARRAY.intersection(POTENTIAL_STRING));
- Expect.equals(CONFLICTING, MUTABLE_ARRAY.intersection(BOOLEAN_OR_NULL));
- Expect.equals(CONFLICTING, MUTABLE_ARRAY.intersection(NUMBER_OR_NULL));
- Expect.equals(CONFLICTING, MUTABLE_ARRAY.intersection(INTEGER_OR_NULL));
- Expect.equals(CONFLICTING, MUTABLE_ARRAY.intersection(DOUBLE_OR_NULL));
- Expect.equals(CONFLICTING, MUTABLE_ARRAY.intersection(STRING_OR_NULL));
- Expect.equals(CONFLICTING, MUTABLE_ARRAY.intersection(NULL));
- Expect.equals(FIXED_ARRAY, MUTABLE_ARRAY.intersection(FIXED_ARRAY));
+ Expect.equals(CONFLICTING,
+ MUTABLE_ARRAY.intersection(CONFLICTING, compiler));
+ Expect.equals(MUTABLE_ARRAY,
+ MUTABLE_ARRAY.intersection(UNKNOWN, compiler));
+ Expect.equals(CONFLICTING,
+ MUTABLE_ARRAY.intersection(BOOLEAN, compiler));
+ Expect.equals(CONFLICTING,
+ MUTABLE_ARRAY.intersection(NUMBER, compiler));
+ Expect.equals(CONFLICTING,
+ MUTABLE_ARRAY.intersection(INTEGER, compiler));
+ Expect.equals(CONFLICTING,
+ MUTABLE_ARRAY.intersection(DOUBLE, compiler));
+ Expect.equals(MUTABLE_ARRAY,
+ MUTABLE_ARRAY.intersection(INDEXABLE_PRIMITIVE, compiler));
+ Expect.equals(CONFLICTING,
+ MUTABLE_ARRAY.intersection(STRING, compiler));
+ Expect.equals(MUTABLE_ARRAY,
+ MUTABLE_ARRAY.intersection(READABLE_ARRAY, compiler));
+ Expect.equals(MUTABLE_ARRAY,
+ MUTABLE_ARRAY.intersection(MUTABLE_ARRAY, compiler));
+ Expect.equals(EXTENDABLE_ARRAY,
+ MUTABLE_ARRAY.intersection(EXTENDABLE_ARRAY, compiler));
+ Expect.equals(CONFLICTING,
+ MUTABLE_ARRAY.intersection(nonPrimitive1, compiler));
+ Expect.equals(CONFLICTING,
+ MUTABLE_ARRAY.intersection(nonPrimitive2, compiler));
+ Expect.equals(MUTABLE_ARRAY,
+ MUTABLE_ARRAY.intersection(potentialArray, compiler));
+ Expect.equals(CONFLICTING,
+ MUTABLE_ARRAY.intersection(potentialString, compiler));
+ Expect.equals(CONFLICTING,
+ MUTABLE_ARRAY.intersection(BOOLEAN_OR_NULL, compiler));
+ Expect.equals(CONFLICTING,
+ MUTABLE_ARRAY.intersection(NUMBER_OR_NULL, compiler));
+ Expect.equals(CONFLICTING,
+ MUTABLE_ARRAY.intersection(INTEGER_OR_NULL, compiler));
+ Expect.equals(CONFLICTING,
+ MUTABLE_ARRAY.intersection(DOUBLE_OR_NULL, compiler));
+ Expect.equals(CONFLICTING,
+ MUTABLE_ARRAY.intersection(STRING_OR_NULL, compiler));
+ Expect.equals(CONFLICTING,
+ MUTABLE_ARRAY.intersection(NULL, compiler));
+ Expect.equals(FIXED_ARRAY,
+ MUTABLE_ARRAY.intersection(FIXED_ARRAY, compiler));
- Expect.equals(CONFLICTING, EXTENDABLE_ARRAY.intersection(CONFLICTING));
- Expect.equals(EXTENDABLE_ARRAY, EXTENDABLE_ARRAY.intersection(UNKNOWN));
- Expect.equals(CONFLICTING, EXTENDABLE_ARRAY.intersection(BOOLEAN));
- Expect.equals(CONFLICTING, EXTENDABLE_ARRAY.intersection(NUMBER));
- Expect.equals(CONFLICTING, EXTENDABLE_ARRAY.intersection(INTEGER));
- Expect.equals(CONFLICTING, EXTENDABLE_ARRAY.intersection(DOUBLE));
+ Expect.equals(CONFLICTING,
+ EXTENDABLE_ARRAY.intersection(CONFLICTING, compiler));
+ Expect.equals(EXTENDABLE_ARRAY,
+ EXTENDABLE_ARRAY.intersection(UNKNOWN, compiler));
+ Expect.equals(CONFLICTING,
+ EXTENDABLE_ARRAY.intersection(BOOLEAN, compiler));
+ Expect.equals(CONFLICTING,
+ EXTENDABLE_ARRAY.intersection(NUMBER, compiler));
+ Expect.equals(CONFLICTING,
+ EXTENDABLE_ARRAY.intersection(INTEGER, compiler));
+ Expect.equals(CONFLICTING,
+ EXTENDABLE_ARRAY.intersection(DOUBLE, compiler));
Expect.equals(EXTENDABLE_ARRAY,
- EXTENDABLE_ARRAY.intersection(INDEXABLE_PRIMITIVE));
- Expect.equals(CONFLICTING, EXTENDABLE_ARRAY.intersection(STRING));
+ EXTENDABLE_ARRAY.intersection(INDEXABLE_PRIMITIVE,
+ compiler));
+ Expect.equals(CONFLICTING,
+ EXTENDABLE_ARRAY.intersection(STRING, compiler));
Expect.equals(EXTENDABLE_ARRAY,
- EXTENDABLE_ARRAY.intersection(READABLE_ARRAY));
- Expect.equals(EXTENDABLE_ARRAY, EXTENDABLE_ARRAY.intersection(MUTABLE_ARRAY));
+ EXTENDABLE_ARRAY.intersection(READABLE_ARRAY,
+ compiler));
+ Expect.equals(EXTENDABLE_ARRAY,
+ EXTENDABLE_ARRAY.intersection(MUTABLE_ARRAY, compiler));
Expect.equals(EXTENDABLE_ARRAY,
- EXTENDABLE_ARRAY.intersection(EXTENDABLE_ARRAY));
- Expect.equals(CONFLICTING, EXTENDABLE_ARRAY.intersection(NON_PRIMITIVE1));
- Expect.equals(CONFLICTING, EXTENDABLE_ARRAY.intersection(NON_PRIMITIVE2));
+ EXTENDABLE_ARRAY.intersection(EXTENDABLE_ARRAY,
+ compiler));
+ Expect.equals(CONFLICTING,
+ EXTENDABLE_ARRAY.intersection(nonPrimitive1, compiler));
+ Expect.equals(CONFLICTING,
+ EXTENDABLE_ARRAY.intersection(nonPrimitive2, compiler));
Expect.equals(EXTENDABLE_ARRAY,
- EXTENDABLE_ARRAY.intersection(POTENTIAL_ARRAY));
- Expect.equals(CONFLICTING, EXTENDABLE_ARRAY.intersection(POTENTIAL_STRING));
- Expect.equals(CONFLICTING, EXTENDABLE_ARRAY.intersection(BOOLEAN_OR_NULL));
- Expect.equals(CONFLICTING, EXTENDABLE_ARRAY.intersection(NUMBER_OR_NULL));
- Expect.equals(CONFLICTING, EXTENDABLE_ARRAY.intersection(INTEGER_OR_NULL));
- Expect.equals(CONFLICTING, EXTENDABLE_ARRAY.intersection(DOUBLE_OR_NULL));
- Expect.equals(CONFLICTING, EXTENDABLE_ARRAY.intersection(STRING_OR_NULL));
- Expect.equals(CONFLICTING, EXTENDABLE_ARRAY.intersection(NULL));
- Expect.equals(CONFLICTING, EXTENDABLE_ARRAY.intersection(FIXED_ARRAY));
+ EXTENDABLE_ARRAY.intersection(potentialArray,
+ compiler));
+ Expect.equals(CONFLICTING,
+ EXTENDABLE_ARRAY.intersection(potentialString, compiler));
+ Expect.equals(CONFLICTING,
+ EXTENDABLE_ARRAY.intersection(BOOLEAN_OR_NULL, compiler));
+ Expect.equals(CONFLICTING,
+ EXTENDABLE_ARRAY.intersection(NUMBER_OR_NULL, compiler));
+ Expect.equals(CONFLICTING,
+ EXTENDABLE_ARRAY.intersection(INTEGER_OR_NULL, compiler));
+ Expect.equals(CONFLICTING,
+ EXTENDABLE_ARRAY.intersection(DOUBLE_OR_NULL, compiler));
+ Expect.equals(CONFLICTING,
+ EXTENDABLE_ARRAY.intersection(STRING_OR_NULL, compiler));
+ Expect.equals(CONFLICTING,
+ EXTENDABLE_ARRAY.intersection(NULL, compiler));
+ Expect.equals(CONFLICTING,
+ EXTENDABLE_ARRAY.intersection(FIXED_ARRAY, compiler));
- Expect.equals(CONFLICTING, NON_PRIMITIVE1.intersection(CONFLICTING));
- Expect.equals(NON_PRIMITIVE1, NON_PRIMITIVE1.intersection(UNKNOWN));
- Expect.equals(CONFLICTING, NON_PRIMITIVE1.intersection(BOOLEAN));
- Expect.equals(CONFLICTING, NON_PRIMITIVE1.intersection(NUMBER));
- Expect.equals(CONFLICTING, NON_PRIMITIVE1.intersection(INTEGER));
- Expect.equals(CONFLICTING, NON_PRIMITIVE1.intersection(DOUBLE));
- Expect.equals(CONFLICTING, NON_PRIMITIVE1.intersection(INDEXABLE_PRIMITIVE));
- Expect.equals(CONFLICTING, NON_PRIMITIVE1.intersection(STRING));
- Expect.equals(CONFLICTING, NON_PRIMITIVE1.intersection(READABLE_ARRAY));
- Expect.equals(CONFLICTING, NON_PRIMITIVE1.intersection(MUTABLE_ARRAY));
- Expect.equals(CONFLICTING, NON_PRIMITIVE1.intersection(EXTENDABLE_ARRAY));
- Expect.equals(NON_PRIMITIVE1, NON_PRIMITIVE1.intersection(NON_PRIMITIVE1));
- Expect.equals(CONFLICTING, NON_PRIMITIVE1.intersection(NON_PRIMITIVE2));
- Expect.equals(CONFLICTING, NON_PRIMITIVE1.intersection(POTENTIAL_ARRAY));
- Expect.equals(CONFLICTING, NON_PRIMITIVE1.intersection(POTENTIAL_STRING));
- Expect.equals(CONFLICTING, NON_PRIMITIVE1.intersection(BOOLEAN_OR_NULL));
- Expect.equals(CONFLICTING, NON_PRIMITIVE1.intersection(NUMBER_OR_NULL));
- Expect.equals(CONFLICTING, NON_PRIMITIVE1.intersection(INTEGER_OR_NULL));
- Expect.equals(CONFLICTING, NON_PRIMITIVE1.intersection(DOUBLE_OR_NULL));
- Expect.equals(CONFLICTING, NON_PRIMITIVE1.intersection(STRING_OR_NULL));
- Expect.equals(CONFLICTING, NON_PRIMITIVE1.intersection(NULL));
- Expect.equals(CONFLICTING, NON_PRIMITIVE1.intersection(FIXED_ARRAY));
+ Expect.equals(CONFLICTING,
+ nonPrimitive1.intersection(CONFLICTING, compiler));
+ Expect.equals(nonPrimitive1,
+ nonPrimitive1.intersection(UNKNOWN, compiler));
+ Expect.equals(CONFLICTING,
+ nonPrimitive1.intersection(BOOLEAN, compiler));
+ Expect.equals(CONFLICTING,
+ nonPrimitive1.intersection(NUMBER, compiler));
+ Expect.equals(CONFLICTING,
+ nonPrimitive1.intersection(INTEGER, compiler));
+ Expect.equals(CONFLICTING,
+ nonPrimitive1.intersection(DOUBLE, compiler));
+ Expect.equals(CONFLICTING,
+ nonPrimitive1.intersection(INDEXABLE_PRIMITIVE, compiler));
+ Expect.equals(CONFLICTING,
+ nonPrimitive1.intersection(STRING, compiler));
+ Expect.equals(CONFLICTING,
+ nonPrimitive1.intersection(READABLE_ARRAY, compiler));
+ Expect.equals(CONFLICTING,
+ nonPrimitive1.intersection(MUTABLE_ARRAY, compiler));
+ Expect.equals(CONFLICTING,
+ nonPrimitive1.intersection(EXTENDABLE_ARRAY, compiler));
+ Expect.equals(nonPrimitive1,
+ nonPrimitive1.intersection(nonPrimitive1, compiler));
+ Expect.equals(CONFLICTING,
+ nonPrimitive1.intersection(nonPrimitive2, compiler));
+ Expect.equals(CONFLICTING,
+ nonPrimitive1.intersection(potentialArray, compiler));
+ Expect.equals(CONFLICTING,
+ nonPrimitive1.intersection(potentialString, compiler));
+ Expect.equals(CONFLICTING,
+ nonPrimitive1.intersection(BOOLEAN_OR_NULL, compiler));
+ Expect.equals(CONFLICTING,
+ nonPrimitive1.intersection(NUMBER_OR_NULL, compiler));
+ Expect.equals(CONFLICTING,
+ nonPrimitive1.intersection(INTEGER_OR_NULL, compiler));
+ Expect.equals(CONFLICTING,
+ nonPrimitive1.intersection(DOUBLE_OR_NULL, compiler));
+ Expect.equals(CONFLICTING,
+ nonPrimitive1.intersection(STRING_OR_NULL, compiler));
+ Expect.equals(CONFLICTING,
+ nonPrimitive1.intersection(NULL, compiler));
+ Expect.equals(CONFLICTING,
+ nonPrimitive1.intersection(FIXED_ARRAY, compiler));
- Expect.equals(CONFLICTING, NON_PRIMITIVE2.intersection(CONFLICTING));
- Expect.equals(NON_PRIMITIVE2, NON_PRIMITIVE2.intersection(UNKNOWN));
- Expect.equals(CONFLICTING, NON_PRIMITIVE2.intersection(BOOLEAN));
- Expect.equals(CONFLICTING, NON_PRIMITIVE2.intersection(NUMBER));
- Expect.equals(CONFLICTING, NON_PRIMITIVE2.intersection(INTEGER));
- Expect.equals(CONFLICTING, NON_PRIMITIVE2.intersection(DOUBLE));
- Expect.equals(CONFLICTING, NON_PRIMITIVE2.intersection(INDEXABLE_PRIMITIVE));
- Expect.equals(CONFLICTING, NON_PRIMITIVE2.intersection(STRING));
- Expect.equals(CONFLICTING, NON_PRIMITIVE2.intersection(READABLE_ARRAY));
- Expect.equals(CONFLICTING, NON_PRIMITIVE2.intersection(MUTABLE_ARRAY));
- Expect.equals(CONFLICTING, NON_PRIMITIVE2.intersection(EXTENDABLE_ARRAY));
- Expect.equals(CONFLICTING, NON_PRIMITIVE2.intersection(NON_PRIMITIVE1));
- Expect.equals(NON_PRIMITIVE2, NON_PRIMITIVE2.intersection(NON_PRIMITIVE2));
- Expect.equals(CONFLICTING, NON_PRIMITIVE2.intersection(POTENTIAL_ARRAY));
- Expect.equals(CONFLICTING, NON_PRIMITIVE2.intersection(POTENTIAL_STRING));
- Expect.equals(CONFLICTING, NON_PRIMITIVE2.intersection(BOOLEAN_OR_NULL));
- Expect.equals(CONFLICTING, NON_PRIMITIVE2.intersection(NUMBER_OR_NULL));
- Expect.equals(CONFLICTING, NON_PRIMITIVE2.intersection(INTEGER_OR_NULL));
- Expect.equals(CONFLICTING, NON_PRIMITIVE2.intersection(DOUBLE_OR_NULL));
- Expect.equals(CONFLICTING, NON_PRIMITIVE2.intersection(STRING_OR_NULL));
- Expect.equals(CONFLICTING, NON_PRIMITIVE2.intersection(NULL));
- Expect.equals(CONFLICTING, NON_PRIMITIVE2.intersection(FIXED_ARRAY));
+ Expect.equals(CONFLICTING,
+ nonPrimitive2.intersection(CONFLICTING, compiler));
+ Expect.equals(nonPrimitive2,
+ nonPrimitive2.intersection(UNKNOWN, compiler));
+ Expect.equals(CONFLICTING,
+ nonPrimitive2.intersection(BOOLEAN, compiler));
+ Expect.equals(CONFLICTING,
+ nonPrimitive2.intersection(NUMBER, compiler));
+ Expect.equals(CONFLICTING,
+ nonPrimitive2.intersection(INTEGER, compiler));
+ Expect.equals(CONFLICTING,
+ nonPrimitive2.intersection(DOUBLE, compiler));
+ Expect.equals(CONFLICTING,
+ nonPrimitive2.intersection(INDEXABLE_PRIMITIVE, compiler));
+ Expect.equals(CONFLICTING,
+ nonPrimitive2.intersection(STRING, compiler));
+ Expect.equals(CONFLICTING,
+ nonPrimitive2.intersection(READABLE_ARRAY, compiler));
+ Expect.equals(CONFLICTING,
+ nonPrimitive2.intersection(MUTABLE_ARRAY, compiler));
+ Expect.equals(CONFLICTING,
+ nonPrimitive2.intersection(EXTENDABLE_ARRAY, compiler));
+ Expect.equals(CONFLICTING,
+ nonPrimitive2.intersection(nonPrimitive1, compiler));
+ Expect.equals(nonPrimitive2,
+ nonPrimitive2.intersection(nonPrimitive2, compiler));
+ Expect.equals(CONFLICTING,
+ nonPrimitive2.intersection(potentialArray, compiler));
+ Expect.equals(CONFLICTING,
+ nonPrimitive2.intersection(potentialString, compiler));
+ Expect.equals(CONFLICTING,
+ nonPrimitive2.intersection(BOOLEAN_OR_NULL, compiler));
+ Expect.equals(CONFLICTING,
+ nonPrimitive2.intersection(NUMBER_OR_NULL, compiler));
+ Expect.equals(CONFLICTING,
+ nonPrimitive2.intersection(INTEGER_OR_NULL, compiler));
+ Expect.equals(CONFLICTING,
+ nonPrimitive2.intersection(DOUBLE_OR_NULL, compiler));
+ Expect.equals(CONFLICTING,
+ nonPrimitive2.intersection(STRING_OR_NULL, compiler));
+ Expect.equals(CONFLICTING,
+ nonPrimitive2.intersection(NULL, compiler));
+ Expect.equals(CONFLICTING,
+ nonPrimitive2.intersection(FIXED_ARRAY, compiler));
- Expect.equals(CONFLICTING, POTENTIAL_ARRAY.intersection(CONFLICTING));
- Expect.equals(POTENTIAL_ARRAY, POTENTIAL_ARRAY.intersection(UNKNOWN));
- Expect.equals(CONFLICTING, POTENTIAL_ARRAY.intersection(BOOLEAN));
- Expect.equals(CONFLICTING, POTENTIAL_ARRAY.intersection(NUMBER));
- Expect.equals(CONFLICTING, POTENTIAL_ARRAY.intersection(INTEGER));
- Expect.equals(CONFLICTING, POTENTIAL_ARRAY.intersection(DOUBLE));
- Expect.equals(READABLE_ARRAY, POTENTIAL_ARRAY.intersection(INDEXABLE_PRIMITIVE));
- Expect.equals(CONFLICTING, POTENTIAL_ARRAY.intersection(STRING));
- Expect.equals(READABLE_ARRAY, POTENTIAL_ARRAY.intersection(READABLE_ARRAY));
- Expect.equals(MUTABLE_ARRAY, POTENTIAL_ARRAY.intersection(MUTABLE_ARRAY));
- Expect.equals(EXTENDABLE_ARRAY, POTENTIAL_ARRAY.intersection(EXTENDABLE_ARRAY));
- Expect.equals(CONFLICTING, POTENTIAL_ARRAY.intersection(NON_PRIMITIVE1));
- Expect.equals(CONFLICTING, POTENTIAL_ARRAY.intersection(NON_PRIMITIVE2));
- Expect.equals(POTENTIAL_ARRAY, POTENTIAL_ARRAY.intersection(POTENTIAL_ARRAY));
- Expect.equals(NULL, POTENTIAL_ARRAY.intersection(POTENTIAL_STRING));
- Expect.equals(NULL, POTENTIAL_ARRAY.intersection(BOOLEAN_OR_NULL));
- Expect.equals(NULL, POTENTIAL_ARRAY.intersection(NUMBER_OR_NULL));
- Expect.equals(NULL, POTENTIAL_ARRAY.intersection(INTEGER_OR_NULL));
- Expect.equals(NULL, POTENTIAL_ARRAY.intersection(DOUBLE_OR_NULL));
- Expect.equals(NULL, POTENTIAL_ARRAY.intersection(STRING_OR_NULL));
- Expect.equals(NULL, POTENTIAL_ARRAY.intersection(NULL));
- Expect.equals(FIXED_ARRAY, POTENTIAL_ARRAY.intersection(FIXED_ARRAY));
+ Expect.equals(CONFLICTING,
+ potentialArray.intersection(CONFLICTING, compiler));
+ Expect.equals(potentialArray,
+ potentialArray.intersection(UNKNOWN, compiler));
+ Expect.equals(CONFLICTING,
+ potentialArray.intersection(BOOLEAN, compiler));
+ Expect.equals(CONFLICTING,
+ potentialArray.intersection(NUMBER, compiler));
+ Expect.equals(CONFLICTING,
+ potentialArray.intersection(INTEGER, compiler));
+ Expect.equals(CONFLICTING,
+ potentialArray.intersection(DOUBLE, compiler));
+ Expect.equals(READABLE_ARRAY,
+ potentialArray.intersection(INDEXABLE_PRIMITIVE, compiler));
+ Expect.equals(CONFLICTING,
+ potentialArray.intersection(STRING, compiler));
+ Expect.equals(READABLE_ARRAY,
+ potentialArray.intersection(READABLE_ARRAY, compiler));
+ Expect.equals(MUTABLE_ARRAY,
+ potentialArray.intersection(MUTABLE_ARRAY, compiler));
+ Expect.equals(EXTENDABLE_ARRAY,
+ potentialArray.intersection(EXTENDABLE_ARRAY, compiler));
+ Expect.equals(CONFLICTING,
+ potentialArray.intersection(nonPrimitive1, compiler));
+ Expect.equals(CONFLICTING,
+ potentialArray.intersection(nonPrimitive2, compiler));
+ Expect.equals(potentialArray,
+ potentialArray.intersection(potentialArray, compiler));
+ Expect.equals(NULL,
+ potentialArray.intersection(potentialString, compiler));
+ Expect.equals(NULL,
+ potentialArray.intersection(BOOLEAN_OR_NULL, compiler));
+ Expect.equals(NULL,
+ potentialArray.intersection(NUMBER_OR_NULL, compiler));
+ Expect.equals(NULL,
+ potentialArray.intersection(INTEGER_OR_NULL, compiler));
+ Expect.equals(NULL,
+ potentialArray.intersection(DOUBLE_OR_NULL, compiler));
+ Expect.equals(NULL,
+ potentialArray.intersection(STRING_OR_NULL, compiler));
+ Expect.equals(NULL,
+ potentialArray.intersection(NULL, compiler));
+ Expect.equals(FIXED_ARRAY,
+ potentialArray.intersection(FIXED_ARRAY, compiler));
- Expect.equals(CONFLICTING, POTENTIAL_STRING.intersection(CONFLICTING));
- Expect.equals(POTENTIAL_STRING, POTENTIAL_STRING.intersection(UNKNOWN));
- Expect.equals(CONFLICTING, POTENTIAL_STRING.intersection(BOOLEAN));
- Expect.equals(CONFLICTING, POTENTIAL_STRING.intersection(NUMBER));
- Expect.equals(CONFLICTING, POTENTIAL_STRING.intersection(INTEGER));
- Expect.equals(CONFLICTING, POTENTIAL_STRING.intersection(DOUBLE));
- Expect.equals(STRING, POTENTIAL_STRING.intersection(INDEXABLE_PRIMITIVE));
- Expect.equals(STRING, POTENTIAL_STRING.intersection(STRING));
- Expect.equals(CONFLICTING, POTENTIAL_STRING.intersection(READABLE_ARRAY));
- Expect.equals(CONFLICTING, POTENTIAL_STRING.intersection(MUTABLE_ARRAY));
- Expect.equals(CONFLICTING, POTENTIAL_STRING.intersection(EXTENDABLE_ARRAY));
- Expect.equals(CONFLICTING, POTENTIAL_STRING.intersection(NON_PRIMITIVE1));
- Expect.equals(CONFLICTING, POTENTIAL_STRING.intersection(NON_PRIMITIVE2));
- Expect.equals(NULL, POTENTIAL_STRING.intersection(POTENTIAL_ARRAY));
- Expect.equals(POTENTIAL_STRING, POTENTIAL_STRING.intersection(POTENTIAL_STRING));
- Expect.equals(NULL, POTENTIAL_STRING.intersection(BOOLEAN_OR_NULL));
- Expect.equals(NULL, POTENTIAL_STRING.intersection(NUMBER_OR_NULL));
- Expect.equals(NULL, POTENTIAL_STRING.intersection(INTEGER_OR_NULL));
- Expect.equals(NULL, POTENTIAL_STRING.intersection(DOUBLE_OR_NULL));
- Expect.equals(STRING_OR_NULL, POTENTIAL_STRING.intersection(STRING_OR_NULL));
- Expect.equals(NULL, POTENTIAL_STRING.intersection(NULL));
- Expect.equals(CONFLICTING, POTENTIAL_STRING.intersection(FIXED_ARRAY));
+ Expect.equals(CONFLICTING,
+ potentialString.intersection(CONFLICTING, compiler));
+ Expect.equals(potentialString,
+ potentialString.intersection(UNKNOWN, compiler));
+ Expect.equals(CONFLICTING,
+ potentialString.intersection(BOOLEAN, compiler));
+ Expect.equals(CONFLICTING,
+ potentialString.intersection(NUMBER, compiler));
+ Expect.equals(CONFLICTING,
+ potentialString.intersection(INTEGER, compiler));
+ Expect.equals(CONFLICTING,
+ potentialString.intersection(DOUBLE, compiler));
+ Expect.equals(STRING,
+ potentialString.intersection(INDEXABLE_PRIMITIVE, compiler));
+ Expect.equals(STRING,
+ potentialString.intersection(STRING, compiler));
+ Expect.equals(CONFLICTING,
+ potentialString.intersection(READABLE_ARRAY, compiler));
+ Expect.equals(CONFLICTING,
+ potentialString.intersection(MUTABLE_ARRAY, compiler));
+ Expect.equals(CONFLICTING,
+ potentialString.intersection(EXTENDABLE_ARRAY, compiler));
+ Expect.equals(CONFLICTING,
+ potentialString.intersection(nonPrimitive1, compiler));
+ Expect.equals(CONFLICTING,
+ potentialString.intersection(nonPrimitive2, compiler));
+ Expect.equals(NULL,
+ potentialString.intersection(potentialArray, compiler));
+ Expect.equals(potentialString,
+ potentialString.intersection(potentialString, compiler));
+ Expect.equals(NULL,
+ potentialString.intersection(BOOLEAN_OR_NULL, compiler));
+ Expect.equals(NULL,
+ potentialString.intersection(NUMBER_OR_NULL, compiler));
+ Expect.equals(NULL,
+ potentialString.intersection(INTEGER_OR_NULL, compiler));
+ Expect.equals(NULL,
+ potentialString.intersection(DOUBLE_OR_NULL, compiler));
+ Expect.equals(STRING_OR_NULL,
+ potentialString.intersection(STRING_OR_NULL, compiler));
+ Expect.equals(NULL,
+ potentialString.intersection(NULL, compiler));
+ Expect.equals(CONFLICTING,
+ potentialString.intersection(FIXED_ARRAY, compiler));
- Expect.equals(CONFLICTING, BOOLEAN_OR_NULL.intersection(CONFLICTING));
- Expect.equals(BOOLEAN_OR_NULL, BOOLEAN_OR_NULL.intersection(UNKNOWN));
- Expect.equals(BOOLEAN, BOOLEAN_OR_NULL.intersection(BOOLEAN));
- Expect.equals(CONFLICTING, BOOLEAN_OR_NULL.intersection(NUMBER));
- Expect.equals(CONFLICTING, BOOLEAN_OR_NULL.intersection(INTEGER));
- Expect.equals(CONFLICTING, BOOLEAN_OR_NULL.intersection(DOUBLE));
- Expect.equals(CONFLICTING, BOOLEAN_OR_NULL.intersection(INDEXABLE_PRIMITIVE));
- Expect.equals(CONFLICTING, BOOLEAN_OR_NULL.intersection(STRING));
- Expect.equals(CONFLICTING, BOOLEAN_OR_NULL.intersection(READABLE_ARRAY));
- Expect.equals(CONFLICTING, BOOLEAN_OR_NULL.intersection(MUTABLE_ARRAY));
- Expect.equals(CONFLICTING, BOOLEAN_OR_NULL.intersection(EXTENDABLE_ARRAY));
- Expect.equals(CONFLICTING, BOOLEAN_OR_NULL.intersection(NON_PRIMITIVE1));
- Expect.equals(CONFLICTING, BOOLEAN_OR_NULL.intersection(NON_PRIMITIVE2));
- Expect.equals(NULL, BOOLEAN_OR_NULL.intersection(POTENTIAL_ARRAY));
- Expect.equals(NULL, BOOLEAN_OR_NULL.intersection(POTENTIAL_STRING));
- Expect.equals(BOOLEAN_OR_NULL, BOOLEAN_OR_NULL.intersection(BOOLEAN_OR_NULL));
- Expect.equals(NULL, BOOLEAN_OR_NULL.intersection(NUMBER_OR_NULL));
- Expect.equals(NULL, BOOLEAN_OR_NULL.intersection(INTEGER_OR_NULL));
- Expect.equals(NULL, BOOLEAN_OR_NULL.intersection(DOUBLE_OR_NULL));
- Expect.equals(NULL, BOOLEAN_OR_NULL.intersection(STRING_OR_NULL));
- Expect.equals(NULL, BOOLEAN_OR_NULL.intersection(NULL));
- Expect.equals(CONFLICTING, BOOLEAN_OR_NULL.intersection(FIXED_ARRAY));
+ Expect.equals(CONFLICTING,
+ BOOLEAN_OR_NULL.intersection(CONFLICTING, compiler));
+ Expect.equals(BOOLEAN_OR_NULL,
+ BOOLEAN_OR_NULL.intersection(UNKNOWN, compiler));
+ Expect.equals(BOOLEAN,
+ BOOLEAN_OR_NULL.intersection(BOOLEAN, compiler));
+ Expect.equals(CONFLICTING,
+ BOOLEAN_OR_NULL.intersection(NUMBER, compiler));
+ Expect.equals(CONFLICTING,
+ BOOLEAN_OR_NULL.intersection(INTEGER, compiler));
+ Expect.equals(CONFLICTING,
+ BOOLEAN_OR_NULL.intersection(DOUBLE, compiler));
+ Expect.equals(CONFLICTING,
+ BOOLEAN_OR_NULL.intersection(INDEXABLE_PRIMITIVE, compiler));
+ Expect.equals(CONFLICTING,
+ BOOLEAN_OR_NULL.intersection(STRING, compiler));
+ Expect.equals(CONFLICTING,
+ BOOLEAN_OR_NULL.intersection(READABLE_ARRAY, compiler));
+ Expect.equals(CONFLICTING,
+ BOOLEAN_OR_NULL.intersection(MUTABLE_ARRAY, compiler));
+ Expect.equals(CONFLICTING,
+ BOOLEAN_OR_NULL.intersection(EXTENDABLE_ARRAY, compiler));
+ Expect.equals(CONFLICTING,
+ BOOLEAN_OR_NULL.intersection(nonPrimitive1, compiler));
+ Expect.equals(CONFLICTING,
+ BOOLEAN_OR_NULL.intersection(nonPrimitive2, compiler));
+ Expect.equals(NULL,
+ BOOLEAN_OR_NULL.intersection(potentialArray, compiler));
+ Expect.equals(NULL,
+ BOOLEAN_OR_NULL.intersection(potentialString, compiler));
+ Expect.equals(BOOLEAN_OR_NULL,
+ BOOLEAN_OR_NULL.intersection(BOOLEAN_OR_NULL, compiler));
+ Expect.equals(NULL,
+ BOOLEAN_OR_NULL.intersection(NUMBER_OR_NULL, compiler));
+ Expect.equals(NULL,
+ BOOLEAN_OR_NULL.intersection(INTEGER_OR_NULL, compiler));
+ Expect.equals(NULL,
+ BOOLEAN_OR_NULL.intersection(DOUBLE_OR_NULL, compiler));
+ Expect.equals(NULL,
+ BOOLEAN_OR_NULL.intersection(STRING_OR_NULL, compiler));
+ Expect.equals(NULL,
+ BOOLEAN_OR_NULL.intersection(NULL, compiler));
+ Expect.equals(CONFLICTING,
+ BOOLEAN_OR_NULL.intersection(FIXED_ARRAY, compiler));
- Expect.equals(CONFLICTING, NUMBER_OR_NULL.intersection(CONFLICTING));
- Expect.equals(NUMBER_OR_NULL, NUMBER_OR_NULL.intersection(UNKNOWN));
- Expect.equals(CONFLICTING, NUMBER_OR_NULL.intersection(BOOLEAN));
- Expect.equals(NUMBER, NUMBER_OR_NULL.intersection(NUMBER));
- Expect.equals(INTEGER, NUMBER_OR_NULL.intersection(INTEGER));
- Expect.equals(DOUBLE, NUMBER_OR_NULL.intersection(DOUBLE));
- Expect.equals(CONFLICTING, NUMBER_OR_NULL.intersection(INDEXABLE_PRIMITIVE));
- Expect.equals(CONFLICTING, NUMBER_OR_NULL.intersection(STRING));
- Expect.equals(CONFLICTING, NUMBER_OR_NULL.intersection(READABLE_ARRAY));
- Expect.equals(CONFLICTING, NUMBER_OR_NULL.intersection(MUTABLE_ARRAY));
- Expect.equals(CONFLICTING, NUMBER_OR_NULL.intersection(EXTENDABLE_ARRAY));
- Expect.equals(CONFLICTING, NUMBER_OR_NULL.intersection(NON_PRIMITIVE1));
- Expect.equals(CONFLICTING, NUMBER_OR_NULL.intersection(NON_PRIMITIVE2));
- Expect.equals(NULL, NUMBER_OR_NULL.intersection(POTENTIAL_ARRAY));
- Expect.equals(NULL, NUMBER_OR_NULL.intersection(POTENTIAL_STRING));
- Expect.equals(NULL, NUMBER_OR_NULL.intersection(BOOLEAN_OR_NULL));
- Expect.equals(NUMBER_OR_NULL, NUMBER_OR_NULL.intersection(NUMBER_OR_NULL));
- Expect.equals(INTEGER_OR_NULL, NUMBER_OR_NULL.intersection(INTEGER_OR_NULL));
- Expect.equals(DOUBLE_OR_NULL, NUMBER_OR_NULL.intersection(DOUBLE_OR_NULL));
- Expect.equals(NULL, NUMBER_OR_NULL.intersection(STRING_OR_NULL));
- Expect.equals(NULL, NUMBER_OR_NULL.intersection(NULL));
- Expect.equals(CONFLICTING, NUMBER_OR_NULL.intersection(FIXED_ARRAY));
+ Expect.equals(CONFLICTING,
+ NUMBER_OR_NULL.intersection(CONFLICTING, compiler));
+ Expect.equals(NUMBER_OR_NULL,
+ NUMBER_OR_NULL.intersection(UNKNOWN, compiler));
+ Expect.equals(CONFLICTING,
+ NUMBER_OR_NULL.intersection(BOOLEAN, compiler));
+ Expect.equals(NUMBER,
+ NUMBER_OR_NULL.intersection(NUMBER, compiler));
+ Expect.equals(INTEGER,
+ NUMBER_OR_NULL.intersection(INTEGER, compiler));
+ Expect.equals(DOUBLE,
+ NUMBER_OR_NULL.intersection(DOUBLE, compiler));
+ Expect.equals(CONFLICTING,
+ NUMBER_OR_NULL.intersection(INDEXABLE_PRIMITIVE, compiler));
+ Expect.equals(CONFLICTING,
+ NUMBER_OR_NULL.intersection(STRING, compiler));
+ Expect.equals(CONFLICTING,
+ NUMBER_OR_NULL.intersection(READABLE_ARRAY, compiler));
+ Expect.equals(CONFLICTING,
+ NUMBER_OR_NULL.intersection(MUTABLE_ARRAY, compiler));
+ Expect.equals(CONFLICTING,
+ NUMBER_OR_NULL.intersection(EXTENDABLE_ARRAY, compiler));
+ Expect.equals(CONFLICTING,
+ NUMBER_OR_NULL.intersection(nonPrimitive1, compiler));
+ Expect.equals(CONFLICTING,
+ NUMBER_OR_NULL.intersection(nonPrimitive2, compiler));
+ Expect.equals(NULL,
+ NUMBER_OR_NULL.intersection(potentialArray, compiler));
+ Expect.equals(NULL,
+ NUMBER_OR_NULL.intersection(potentialString, compiler));
+ Expect.equals(NULL,
+ NUMBER_OR_NULL.intersection(BOOLEAN_OR_NULL, compiler));
+ Expect.equals(NUMBER_OR_NULL,
+ NUMBER_OR_NULL.intersection(NUMBER_OR_NULL, compiler));
+ Expect.equals(INTEGER_OR_NULL,
+ NUMBER_OR_NULL.intersection(INTEGER_OR_NULL, compiler));
+ Expect.equals(DOUBLE_OR_NULL,
+ NUMBER_OR_NULL.intersection(DOUBLE_OR_NULL, compiler));
+ Expect.equals(NULL,
+ NUMBER_OR_NULL.intersection(STRING_OR_NULL, compiler));
+ Expect.equals(NULL,
+ NUMBER_OR_NULL.intersection(NULL, compiler));
+ Expect.equals(CONFLICTING,
+ NUMBER_OR_NULL.intersection(FIXED_ARRAY, compiler));
- Expect.equals(CONFLICTING, INTEGER_OR_NULL.intersection(CONFLICTING));
- Expect.equals(INTEGER_OR_NULL, INTEGER_OR_NULL.intersection(UNKNOWN));
- Expect.equals(CONFLICTING, INTEGER_OR_NULL.intersection(BOOLEAN));
- Expect.equals(INTEGER, INTEGER_OR_NULL.intersection(NUMBER));
- Expect.equals(INTEGER, INTEGER_OR_NULL.intersection(INTEGER));
- Expect.equals(CONFLICTING, INTEGER_OR_NULL.intersection(DOUBLE));
- Expect.equals(CONFLICTING, INTEGER_OR_NULL.intersection(INDEXABLE_PRIMITIVE));
- Expect.equals(CONFLICTING, INTEGER_OR_NULL.intersection(STRING));
- Expect.equals(CONFLICTING, INTEGER_OR_NULL.intersection(READABLE_ARRAY));
- Expect.equals(CONFLICTING, INTEGER_OR_NULL.intersection(MUTABLE_ARRAY));
- Expect.equals(CONFLICTING, INTEGER_OR_NULL.intersection(EXTENDABLE_ARRAY));
- Expect.equals(CONFLICTING, INTEGER_OR_NULL.intersection(NON_PRIMITIVE1));
- Expect.equals(CONFLICTING, INTEGER_OR_NULL.intersection(NON_PRIMITIVE2));
- Expect.equals(NULL, INTEGER_OR_NULL.intersection(POTENTIAL_ARRAY));
- Expect.equals(NULL, INTEGER_OR_NULL.intersection(POTENTIAL_STRING));
- Expect.equals(NULL, INTEGER_OR_NULL.intersection(BOOLEAN_OR_NULL));
- Expect.equals(INTEGER_OR_NULL, INTEGER_OR_NULL.intersection(NUMBER_OR_NULL));
- Expect.equals(INTEGER_OR_NULL, INTEGER_OR_NULL.intersection(INTEGER_OR_NULL));
- Expect.equals(NULL, INTEGER_OR_NULL.intersection(DOUBLE_OR_NULL));
- Expect.equals(NULL, INTEGER_OR_NULL.intersection(STRING_OR_NULL));
- Expect.equals(NULL, INTEGER_OR_NULL.intersection(NULL));
- Expect.equals(CONFLICTING, INTEGER_OR_NULL.intersection(FIXED_ARRAY));
+ Expect.equals(CONFLICTING,
+ INTEGER_OR_NULL.intersection(CONFLICTING, compiler));
+ Expect.equals(INTEGER_OR_NULL,
+ INTEGER_OR_NULL.intersection(UNKNOWN, compiler));
+ Expect.equals(CONFLICTING,
+ INTEGER_OR_NULL.intersection(BOOLEAN, compiler));
+ Expect.equals(INTEGER,
+ INTEGER_OR_NULL.intersection(NUMBER, compiler));
+ Expect.equals(INTEGER,
+ INTEGER_OR_NULL.intersection(INTEGER, compiler));
+ Expect.equals(CONFLICTING,
+ INTEGER_OR_NULL.intersection(DOUBLE, compiler));
+ Expect.equals(CONFLICTING,
+ INTEGER_OR_NULL.intersection(INDEXABLE_PRIMITIVE, compiler));
+ Expect.equals(CONFLICTING,
+ INTEGER_OR_NULL.intersection(STRING, compiler));
+ Expect.equals(CONFLICTING,
+ INTEGER_OR_NULL.intersection(READABLE_ARRAY, compiler));
+ Expect.equals(CONFLICTING,
+ INTEGER_OR_NULL.intersection(MUTABLE_ARRAY, compiler));
+ Expect.equals(CONFLICTING,
+ INTEGER_OR_NULL.intersection(EXTENDABLE_ARRAY, compiler));
+ Expect.equals(CONFLICTING,
+ INTEGER_OR_NULL.intersection(nonPrimitive1, compiler));
+ Expect.equals(CONFLICTING,
+ INTEGER_OR_NULL.intersection(nonPrimitive2, compiler));
+ Expect.equals(NULL,
+ INTEGER_OR_NULL.intersection(potentialArray, compiler));
+ Expect.equals(NULL,
+ INTEGER_OR_NULL.intersection(potentialString, compiler));
+ Expect.equals(NULL,
+ INTEGER_OR_NULL.intersection(BOOLEAN_OR_NULL, compiler));
+ Expect.equals(INTEGER_OR_NULL,
+ INTEGER_OR_NULL.intersection(NUMBER_OR_NULL, compiler));
+ Expect.equals(INTEGER_OR_NULL,
+ INTEGER_OR_NULL.intersection(INTEGER_OR_NULL, compiler));
+ Expect.equals(NULL,
+ INTEGER_OR_NULL.intersection(DOUBLE_OR_NULL, compiler));
+ Expect.equals(NULL,
+ INTEGER_OR_NULL.intersection(STRING_OR_NULL, compiler));
+ Expect.equals(NULL,
+ INTEGER_OR_NULL.intersection(NULL, compiler));
+ Expect.equals(CONFLICTING,
+ INTEGER_OR_NULL.intersection(FIXED_ARRAY, compiler));
- Expect.equals(CONFLICTING, DOUBLE_OR_NULL.intersection(CONFLICTING));
- Expect.equals(DOUBLE_OR_NULL, DOUBLE_OR_NULL.intersection(UNKNOWN));
- Expect.equals(CONFLICTING, DOUBLE_OR_NULL.intersection(BOOLEAN));
- Expect.equals(DOUBLE, DOUBLE_OR_NULL.intersection(NUMBER));
- Expect.equals(CONFLICTING, DOUBLE_OR_NULL.intersection(INTEGER));
- Expect.equals(DOUBLE, DOUBLE_OR_NULL.intersection(DOUBLE));
- Expect.equals(CONFLICTING, DOUBLE_OR_NULL.intersection(INDEXABLE_PRIMITIVE));
- Expect.equals(CONFLICTING, DOUBLE_OR_NULL.intersection(STRING));
- Expect.equals(CONFLICTING, DOUBLE_OR_NULL.intersection(READABLE_ARRAY));
- Expect.equals(CONFLICTING, DOUBLE_OR_NULL.intersection(MUTABLE_ARRAY));
- Expect.equals(CONFLICTING, DOUBLE_OR_NULL.intersection(EXTENDABLE_ARRAY));
- Expect.equals(CONFLICTING, DOUBLE_OR_NULL.intersection(NON_PRIMITIVE1));
- Expect.equals(CONFLICTING, DOUBLE_OR_NULL.intersection(NON_PRIMITIVE2));
- Expect.equals(NULL, DOUBLE_OR_NULL.intersection(POTENTIAL_ARRAY));
- Expect.equals(NULL, DOUBLE_OR_NULL.intersection(POTENTIAL_STRING));
- Expect.equals(NULL, DOUBLE_OR_NULL.intersection(BOOLEAN_OR_NULL));
- Expect.equals(DOUBLE_OR_NULL, DOUBLE_OR_NULL.intersection(NUMBER_OR_NULL));
- Expect.equals(NULL, DOUBLE_OR_NULL.intersection(INTEGER_OR_NULL));
- Expect.equals(DOUBLE_OR_NULL, DOUBLE_OR_NULL.intersection(DOUBLE_OR_NULL));
- Expect.equals(NULL, DOUBLE_OR_NULL.intersection(STRING_OR_NULL));
- Expect.equals(NULL, DOUBLE_OR_NULL.intersection(NULL));
- Expect.equals(CONFLICTING, DOUBLE_OR_NULL.intersection(FIXED_ARRAY));
+ Expect.equals(CONFLICTING,
+ DOUBLE_OR_NULL.intersection(CONFLICTING, compiler));
+ Expect.equals(DOUBLE_OR_NULL,
+ DOUBLE_OR_NULL.intersection(UNKNOWN, compiler));
+ Expect.equals(CONFLICTING,
+ DOUBLE_OR_NULL.intersection(BOOLEAN, compiler));
+ Expect.equals(DOUBLE,
+ DOUBLE_OR_NULL.intersection(NUMBER, compiler));
+ Expect.equals(CONFLICTING,
+ DOUBLE_OR_NULL.intersection(INTEGER, compiler));
+ Expect.equals(DOUBLE,
+ DOUBLE_OR_NULL.intersection(DOUBLE, compiler));
+ Expect.equals(CONFLICTING,
+ DOUBLE_OR_NULL.intersection(INDEXABLE_PRIMITIVE, compiler));
+ Expect.equals(CONFLICTING,
+ DOUBLE_OR_NULL.intersection(STRING, compiler));
+ Expect.equals(CONFLICTING,
+ DOUBLE_OR_NULL.intersection(READABLE_ARRAY, compiler));
+ Expect.equals(CONFLICTING,
+ DOUBLE_OR_NULL.intersection(MUTABLE_ARRAY, compiler));
+ Expect.equals(CONFLICTING,
+ DOUBLE_OR_NULL.intersection(EXTENDABLE_ARRAY, compiler));
+ Expect.equals(CONFLICTING,
+ DOUBLE_OR_NULL.intersection(nonPrimitive1, compiler));
+ Expect.equals(CONFLICTING,
+ DOUBLE_OR_NULL.intersection(nonPrimitive2, compiler));
+ Expect.equals(NULL,
+ DOUBLE_OR_NULL.intersection(potentialArray, compiler));
+ Expect.equals(NULL,
+ DOUBLE_OR_NULL.intersection(potentialString, compiler));
+ Expect.equals(NULL,
+ DOUBLE_OR_NULL.intersection(BOOLEAN_OR_NULL, compiler));
+ Expect.equals(DOUBLE_OR_NULL,
+ DOUBLE_OR_NULL.intersection(NUMBER_OR_NULL, compiler));
+ Expect.equals(NULL,
+ DOUBLE_OR_NULL.intersection(INTEGER_OR_NULL, compiler));
+ Expect.equals(DOUBLE_OR_NULL,
+ DOUBLE_OR_NULL.intersection(DOUBLE_OR_NULL, compiler));
+ Expect.equals(NULL,
+ DOUBLE_OR_NULL.intersection(STRING_OR_NULL, compiler));
+ Expect.equals(NULL,
+ DOUBLE_OR_NULL.intersection(NULL, compiler));
+ Expect.equals(CONFLICTING,
+ DOUBLE_OR_NULL.intersection(FIXED_ARRAY, compiler));
- Expect.equals(CONFLICTING, STRING_OR_NULL.intersection(CONFLICTING));
- Expect.equals(STRING_OR_NULL, STRING_OR_NULL.intersection(UNKNOWN));
- Expect.equals(CONFLICTING, STRING_OR_NULL.intersection(BOOLEAN));
- Expect.equals(CONFLICTING, STRING_OR_NULL.intersection(NUMBER));
- Expect.equals(CONFLICTING, STRING_OR_NULL.intersection(INTEGER));
- Expect.equals(CONFLICTING, STRING_OR_NULL.intersection(DOUBLE));
- Expect.equals(STRING, STRING_OR_NULL.intersection(INDEXABLE_PRIMITIVE));
- Expect.equals(STRING, STRING_OR_NULL.intersection(STRING));
- Expect.equals(CONFLICTING, STRING_OR_NULL.intersection(READABLE_ARRAY));
- Expect.equals(CONFLICTING, STRING_OR_NULL.intersection(MUTABLE_ARRAY));
- Expect.equals(CONFLICTING, STRING_OR_NULL.intersection(EXTENDABLE_ARRAY));
- Expect.equals(CONFLICTING, STRING_OR_NULL.intersection(NON_PRIMITIVE1));
- Expect.equals(CONFLICTING, STRING_OR_NULL.intersection(NON_PRIMITIVE2));
- Expect.equals(NULL, STRING_OR_NULL.intersection(POTENTIAL_ARRAY));
- Expect.equals(STRING_OR_NULL, STRING_OR_NULL.intersection(POTENTIAL_STRING));
- Expect.equals(NULL, STRING_OR_NULL.intersection(BOOLEAN_OR_NULL));
- Expect.equals(NULL, STRING_OR_NULL.intersection(NUMBER_OR_NULL));
- Expect.equals(NULL, STRING_OR_NULL.intersection(INTEGER_OR_NULL));
- Expect.equals(NULL, STRING_OR_NULL.intersection(DOUBLE_OR_NULL));
- Expect.equals(STRING_OR_NULL, STRING_OR_NULL.intersection(STRING_OR_NULL));
- Expect.equals(NULL, STRING_OR_NULL.intersection(NULL));
- Expect.equals(CONFLICTING, STRING_OR_NULL.intersection(FIXED_ARRAY));
+ Expect.equals(CONFLICTING,
+ STRING_OR_NULL.intersection(CONFLICTING, compiler));
+ Expect.equals(STRING_OR_NULL,
+ STRING_OR_NULL.intersection(UNKNOWN, compiler));
+ Expect.equals(CONFLICTING,
+ STRING_OR_NULL.intersection(BOOLEAN, compiler));
+ Expect.equals(CONFLICTING,
+ STRING_OR_NULL.intersection(NUMBER, compiler));
+ Expect.equals(CONFLICTING,
+ STRING_OR_NULL.intersection(INTEGER, compiler));
+ Expect.equals(CONFLICTING,
+ STRING_OR_NULL.intersection(DOUBLE, compiler));
+ Expect.equals(STRING,
+ STRING_OR_NULL.intersection(INDEXABLE_PRIMITIVE, compiler));
+ Expect.equals(STRING,
+ STRING_OR_NULL.intersection(STRING, compiler));
+ Expect.equals(CONFLICTING,
+ STRING_OR_NULL.intersection(READABLE_ARRAY, compiler));
+ Expect.equals(CONFLICTING,
+ STRING_OR_NULL.intersection(MUTABLE_ARRAY, compiler));
+ Expect.equals(CONFLICTING,
+ STRING_OR_NULL.intersection(EXTENDABLE_ARRAY, compiler));
+ Expect.equals(CONFLICTING,
+ STRING_OR_NULL.intersection(nonPrimitive1, compiler));
+ Expect.equals(CONFLICTING,
+ STRING_OR_NULL.intersection(nonPrimitive2, compiler));
+ Expect.equals(NULL,
+ STRING_OR_NULL.intersection(potentialArray, compiler));
+ Expect.equals(STRING_OR_NULL,
+ STRING_OR_NULL.intersection(potentialString, compiler));
+ Expect.equals(NULL,
+ STRING_OR_NULL.intersection(BOOLEAN_OR_NULL, compiler));
+ Expect.equals(NULL,
+ STRING_OR_NULL.intersection(NUMBER_OR_NULL, compiler));
+ Expect.equals(NULL,
+ STRING_OR_NULL.intersection(INTEGER_OR_NULL, compiler));
+ Expect.equals(NULL,
+ STRING_OR_NULL.intersection(DOUBLE_OR_NULL, compiler));
+ Expect.equals(STRING_OR_NULL,
+ STRING_OR_NULL.intersection(STRING_OR_NULL, compiler));
+ Expect.equals(NULL,
+ STRING_OR_NULL.intersection(NULL, compiler));
+ Expect.equals(CONFLICTING,
+ STRING_OR_NULL.intersection(FIXED_ARRAY, compiler));
- Expect.equals(CONFLICTING, NULL.intersection(CONFLICTING));
- Expect.equals(NULL, NULL.intersection(UNKNOWN));
- Expect.equals(CONFLICTING, NULL.intersection(BOOLEAN));
- Expect.equals(CONFLICTING, NULL.intersection(NUMBER));
- Expect.equals(CONFLICTING, NULL.intersection(INTEGER));
- Expect.equals(CONFLICTING, NULL.intersection(DOUBLE));
- Expect.equals(CONFLICTING, NULL.intersection(INDEXABLE_PRIMITIVE));
- Expect.equals(CONFLICTING, NULL.intersection(STRING));
- Expect.equals(CONFLICTING, NULL.intersection(READABLE_ARRAY));
- Expect.equals(CONFLICTING, NULL.intersection(MUTABLE_ARRAY));
- Expect.equals(CONFLICTING, NULL.intersection(EXTENDABLE_ARRAY));
- Expect.equals(CONFLICTING, NULL.intersection(NON_PRIMITIVE1));
- Expect.equals(CONFLICTING, NULL.intersection(NON_PRIMITIVE2));
- Expect.equals(NULL, NULL.intersection(POTENTIAL_ARRAY));
- Expect.equals(NULL, NULL.intersection(POTENTIAL_STRING));
- Expect.equals(NULL, NULL.intersection(BOOLEAN_OR_NULL));
- Expect.equals(NULL, NULL.intersection(NUMBER_OR_NULL));
- Expect.equals(NULL, NULL.intersection(INTEGER_OR_NULL));
- Expect.equals(NULL, NULL.intersection(DOUBLE_OR_NULL));
- Expect.equals(NULL, NULL.intersection(STRING_OR_NULL));
- Expect.equals(NULL, NULL.intersection(NULL));
- Expect.equals(CONFLICTING, NULL.intersection(FIXED_ARRAY));
+ Expect.equals(CONFLICTING,
+ NULL.intersection(CONFLICTING, compiler));
+ Expect.equals(NULL,
+ NULL.intersection(UNKNOWN, compiler));
+ Expect.equals(CONFLICTING,
+ NULL.intersection(BOOLEAN, compiler));
+ Expect.equals(CONFLICTING,
+ NULL.intersection(NUMBER, compiler));
+ Expect.equals(CONFLICTING,
+ NULL.intersection(INTEGER, compiler));
+ Expect.equals(CONFLICTING,
+ NULL.intersection(DOUBLE, compiler));
+ Expect.equals(CONFLICTING,
+ NULL.intersection(INDEXABLE_PRIMITIVE, compiler));
+ Expect.equals(CONFLICTING,
+ NULL.intersection(STRING, compiler));
+ Expect.equals(CONFLICTING,
+ NULL.intersection(READABLE_ARRAY, compiler));
+ Expect.equals(CONFLICTING,
+ NULL.intersection(MUTABLE_ARRAY, compiler));
+ Expect.equals(CONFLICTING,
+ NULL.intersection(EXTENDABLE_ARRAY, compiler));
+ Expect.equals(CONFLICTING,
+ NULL.intersection(nonPrimitive1, compiler));
+ Expect.equals(CONFLICTING,
+ NULL.intersection(nonPrimitive2, compiler));
+ Expect.equals(NULL,
+ NULL.intersection(potentialArray, compiler));
+ Expect.equals(NULL,
+ NULL.intersection(potentialString, compiler));
+ Expect.equals(NULL,
+ NULL.intersection(BOOLEAN_OR_NULL, compiler));
+ Expect.equals(NULL,
+ NULL.intersection(NUMBER_OR_NULL, compiler));
+ Expect.equals(NULL,
+ NULL.intersection(INTEGER_OR_NULL, compiler));
+ Expect.equals(NULL,
+ NULL.intersection(DOUBLE_OR_NULL, compiler));
+ Expect.equals(NULL,
+ NULL.intersection(STRING_OR_NULL, compiler));
+ Expect.equals(NULL,
+ NULL.intersection(NULL, compiler));
+ Expect.equals(CONFLICTING,
+ NULL.intersection(FIXED_ARRAY, compiler));
- Expect.equals(CONFLICTING, FIXED_ARRAY.intersection(CONFLICTING));
- Expect.equals(FIXED_ARRAY, FIXED_ARRAY.intersection(UNKNOWN));
- Expect.equals(CONFLICTING, FIXED_ARRAY.intersection(BOOLEAN));
- Expect.equals(CONFLICTING, FIXED_ARRAY.intersection(NUMBER));
- Expect.equals(CONFLICTING, FIXED_ARRAY.intersection(INTEGER));
- Expect.equals(CONFLICTING, FIXED_ARRAY.intersection(DOUBLE));
- Expect.equals(FIXED_ARRAY, FIXED_ARRAY.intersection(INDEXABLE_PRIMITIVE));
- Expect.equals(CONFLICTING, FIXED_ARRAY.intersection(STRING));
- Expect.equals(FIXED_ARRAY, FIXED_ARRAY.intersection(READABLE_ARRAY));
- Expect.equals(FIXED_ARRAY, FIXED_ARRAY.intersection(MUTABLE_ARRAY));
- Expect.equals(CONFLICTING, FIXED_ARRAY.intersection(EXTENDABLE_ARRAY));
- Expect.equals(CONFLICTING, FIXED_ARRAY.intersection(NON_PRIMITIVE1));
- Expect.equals(CONFLICTING, FIXED_ARRAY.intersection(NON_PRIMITIVE2));
- Expect.equals(FIXED_ARRAY, FIXED_ARRAY.intersection(POTENTIAL_ARRAY));
- Expect.equals(CONFLICTING, FIXED_ARRAY.intersection(POTENTIAL_STRING));
- Expect.equals(CONFLICTING, FIXED_ARRAY.intersection(BOOLEAN_OR_NULL));
- Expect.equals(CONFLICTING, FIXED_ARRAY.intersection(NUMBER_OR_NULL));
- Expect.equals(CONFLICTING, FIXED_ARRAY.intersection(INTEGER_OR_NULL));
- Expect.equals(CONFLICTING, FIXED_ARRAY.intersection(DOUBLE_OR_NULL));
- Expect.equals(CONFLICTING, FIXED_ARRAY.intersection(STRING_OR_NULL));
- Expect.equals(CONFLICTING, FIXED_ARRAY.intersection(NULL));
- Expect.equals(FIXED_ARRAY, FIXED_ARRAY.intersection(FIXED_ARRAY));
+ Expect.equals(CONFLICTING,
+ FIXED_ARRAY.intersection(CONFLICTING, compiler));
+ Expect.equals(FIXED_ARRAY,
+ FIXED_ARRAY.intersection(UNKNOWN, compiler));
+ Expect.equals(CONFLICTING,
+ FIXED_ARRAY.intersection(BOOLEAN, compiler));
+ Expect.equals(CONFLICTING,
+ FIXED_ARRAY.intersection(NUMBER, compiler));
+ Expect.equals(CONFLICTING,
+ FIXED_ARRAY.intersection(INTEGER, compiler));
+ Expect.equals(CONFLICTING,
+ FIXED_ARRAY.intersection(DOUBLE, compiler));
+ Expect.equals(FIXED_ARRAY,
+ FIXED_ARRAY.intersection(INDEXABLE_PRIMITIVE, compiler));
+ Expect.equals(CONFLICTING,
+ FIXED_ARRAY.intersection(STRING, compiler));
+ Expect.equals(FIXED_ARRAY,
+ FIXED_ARRAY.intersection(READABLE_ARRAY, compiler));
+ Expect.equals(FIXED_ARRAY,
+ FIXED_ARRAY.intersection(MUTABLE_ARRAY, compiler));
+ Expect.equals(CONFLICTING,
+ FIXED_ARRAY.intersection(EXTENDABLE_ARRAY, compiler));
+ Expect.equals(CONFLICTING,
+ FIXED_ARRAY.intersection(nonPrimitive1, compiler));
+ Expect.equals(CONFLICTING,
+ FIXED_ARRAY.intersection(nonPrimitive2, compiler));
+ Expect.equals(FIXED_ARRAY,
+ FIXED_ARRAY.intersection(potentialArray, compiler));
+ Expect.equals(CONFLICTING,
+ FIXED_ARRAY.intersection(potentialString, compiler));
+ Expect.equals(CONFLICTING,
+ FIXED_ARRAY.intersection(BOOLEAN_OR_NULL, compiler));
+ Expect.equals(CONFLICTING,
+ FIXED_ARRAY.intersection(NUMBER_OR_NULL, compiler));
+ Expect.equals(CONFLICTING,
+ FIXED_ARRAY.intersection(INTEGER_OR_NULL, compiler));
+ Expect.equals(CONFLICTING,
+ FIXED_ARRAY.intersection(DOUBLE_OR_NULL, compiler));
+ Expect.equals(CONFLICTING,
+ FIXED_ARRAY.intersection(STRING_OR_NULL, compiler));
+ Expect.equals(CONFLICTING,
+ FIXED_ARRAY.intersection(NULL, compiler));
+ Expect.equals(FIXED_ARRAY,
+ FIXED_ARRAY.intersection(FIXED_ARRAY, compiler));
}
void main() {
- testUnion();
- testIntersection();
+ MockCompiler compiler = new MockCompiler();
+ nonPrimitive1 = new HBoundedType.nonNull(
+ compiler.mapClass.computeType(compiler));
+ nonPrimitive2 = new HBoundedType.nonNull(
+ compiler.functionClass.computeType(compiler));
+ potentialArray = new HBoundedPotentialPrimitiveArray(
+ compiler.listClass.computeType(compiler), true);
+ potentialString = new HBoundedPotentialPrimitiveString(
+ compiler.stringClass.computeType(compiler), true);
+ testUnion(compiler);
+ testIntersection(compiler);
}
diff --git a/tests/compiler/dart2js/value_range2_test.dart b/tests/compiler/dart2js/value_range2_test.dart
index 768a3f1..c0c3bca 100644
--- a/tests/compiler/dart2js/value_range2_test.dart
+++ b/tests/compiler/dart2js/value_range2_test.dart
@@ -4,22 +4,33 @@
import "../../../lib/compiler/implementation/ssa/ssa.dart";
import "../../../lib/compiler/implementation/dart2jslib.dart";
+import "../../../lib/compiler/implementation/js_backend/js_backend.dart";
-Value instructionValue = new InstructionValue(new HReturn(null));
-Value lengthValue = new LengthValue(new HReturn(null));
+ValueRangeInfo info = new ValueRangeInfo(const JavaScriptConstantSystem());
-Range createSingleRange(Value value) => new Range(value, value);
-Range createSingleIntRange(int value) => createSingleRange(new IntValue(value));
+Value instructionValue = info.newInstructionValue(new HReturn(null));
+Value lengthValue = info.newLengthValue(new HReturn(null));
+
+Range createSingleRange(Value value) => info.newRange(value, value);
+
+Range createSingleIntRange(int value) {
+ return createSingleRange(info.newIntValue(value));
+}
+
Range createSingleInstructionRange() => createSingleRange(instructionValue);
+
Range createSingleLengthRange() => createSingleRange(lengthValue);
+
Range createIntRange(int lower, int upper) {
- return new Range(new IntValue(lower), new IntValue(upper));
+ return info.newRange(info.newIntValue(lower), info.newIntValue(upper));
}
+
Range createLengthRange(int lower) {
- return new Range(new IntValue(lower), lengthValue);
+ return info.newRange(info.newIntValue(lower), lengthValue);
}
+
Range createInstructionRange(int lower) {
- return new Range(new IntValue(lower), instructionValue);
+ return info.newRange(info.newIntValue(lower), instructionValue);
}
Range instruction = createSingleInstructionRange();
@@ -35,9 +46,9 @@
Range _0_instruction = createInstructionRange(0);
checkAndRange(Range one, Range two, lower, upper) {
- if (lower is num) lower = new IntValue(lower);
- if (upper is num) upper = new IntValue(upper);
- Range range = new Range(lower, upper);
+ if (lower is num) lower = info.newIntValue(lower);
+ if (upper is num) upper = info.newIntValue(upper);
+ Range range = info.newRange(lower, upper);
Expect.equals(range, one & two);
}
@@ -47,33 +58,33 @@
// Create a bound just like our current implementation in dart2js does.
if (two is IntValue) {
if (two.isNegative) {
- return new AddValue(one, -two);
+ return info.newAddValue(one, -two);
} else if (two.isZero) {
return one;
}
}
if (one is IntValue) {
if (one.isNegative) {
- return new SubtractValue(-two, -one);
+ return info.newSubtractValue(-two, -one);
} else if (one.isZero) {
return -two;
}
}
- return new SubtractValue(one, two);
+ return info.newSubtractValue(one, two);
}
if (lower == null) {
lower = buildBound(one.lower, two.upper);
} else if (lower is num) {
- lower = new IntValue(lower);
+ lower = info.newIntValue(lower);
}
if (upper == null) {
upper = buildBound(one.upper, two.lower);
} else if (upper is num) {
- upper = new IntValue(upper);
+ upper = info.newIntValue(upper);
}
- Expect.equals(new Range(lower, upper), one - two);
+ Expect.equals(info.newRange(lower, upper), one - two);
}
checkNegateRange(Range range, [arg1, arg2]) {
@@ -82,20 +93,20 @@
} else {
Value low, up;
if (arg1 is num) {
- low = new IntValue(arg1);
+ low = info.newIntValue(arg1);
} else if (arg1 == null) {
- low = new NegateValue(range.upper);
+ low = info.newNegateValue(range.upper);
} else {
low = arg1;
}
if (arg2 is num) {
- up = new IntValue(arg2);
+ up = info.newIntValue(arg2);
} else if (arg2 == null) {
- up = new NegateValue(range.lower);
+ up = info.newNegateValue(range.lower);
} else {
up = arg2;
}
- Expect.equals(new Range(low, up), -range);
+ Expect.equals(info.newRange(low, up), -range);
}
}
@@ -113,6 +124,8 @@
checkNegateRange(_0_instruction, -instructionValue, 0);
}
+bits32(value) => value & 0xFFFFFFFF;
+
testAnd() {
checkAndRange(
instruction, instruction, const MinIntValue(), const MaxIntValue());
@@ -162,7 +175,7 @@
checkAndRange(nFF, FF, 1, 1);
checkAndRange(nFF, FA, 0, 0);
- checkAndRange(nFF, nFF, -0xFF, -0xFF);
+ checkAndRange(nFF, nFF, bits32(-0xFF), bits32(-0xFF));
checkAndRange(nFF, length, 0, length.upper);
checkAndRange(nFF, _FA_FF, 0, 0xFF);
checkAndRange(nFF, _0_FF, 0, 0xFF);
diff --git a/tests/compiler/dart2js_extra/constant_javascript_semantics2_test.dart b/tests/compiler/dart2js_extra/constant_javascript_semantics2_test.dart
index af4872f..5790fe3 100644
--- a/tests/compiler/dart2js_extra/constant_javascript_semantics2_test.dart
+++ b/tests/compiler/dart2js_extra/constant_javascript_semantics2_test.dart
@@ -21,5 +21,5 @@
main() {
Expect.throws(() => foo(),
- (e) => e is IndexOutOfRangeException);
+ (e) => e is RangeError);
}
diff --git a/tests/compiler/dart2js_extra/constant_javascript_semantics3_test.dart b/tests/compiler/dart2js_extra/constant_javascript_semantics3_test.dart
index b21674d..0fba325 100644
--- a/tests/compiler/dart2js_extra/constant_javascript_semantics3_test.dart
+++ b/tests/compiler/dart2js_extra/constant_javascript_semantics3_test.dart
@@ -33,5 +33,5 @@
main() {
Expect.throws(() => foo(),
- (e) => e is IndexOutOfRangeException);
+ (e) => e is RangeError);
}
diff --git a/tests/compiler/dart2js_extra/dart2js_extra.status b/tests/compiler/dart2js_extra/dart2js_extra.status
index 31ef7cf..47ea3f2 100644
--- a/tests/compiler/dart2js_extra/dart2js_extra.status
+++ b/tests/compiler/dart2js_extra/dart2js_extra.status
@@ -6,8 +6,7 @@
class_test: Fail
statements_test: Fail
typed_locals_test: Fail
-inline_position_crash_test: Fail # http://www.dartbug.com/3905
-constant_javascript_semantics3_test: Fail # http://www.dartbug.com/5581
+no_such_method_test: Fail # Wrong InvocationMirror.memberName.
[ $compiler == dart2js && $runtime == ff && $system == windows ]
regress/4740_test: Fail
diff --git a/tests/compiler/dart2js_extra/no_such_method_test.dart b/tests/compiler/dart2js_extra/no_such_method_test.dart
index 4a432c5..f1047df 100644
--- a/tests/compiler/dart2js_extra/no_such_method_test.dart
+++ b/tests/compiler/dart2js_extra/no_such_method_test.dart
@@ -11,8 +11,9 @@
}
class A {
- noSuchMethod(String name, List args) {
- topLevelInfo = new NoSuchMethodInfo(this, name, args);
+ noSuchMethod(InvocationMirror invocation) {
+ topLevelInfo = new NoSuchMethodInfo(this, invocation.memberName,
+ invocation.positionalArguments);
return topLevelInfo;
}
@@ -38,13 +39,13 @@
Expect.isTrue(info.receiver === a);
info = a.bar;
- Expect.equals('get:bar', info.name);
+ Expect.equals('bar', info.name);
Expect.isTrue(info.args.length == 0);
Expect.isTrue(info.receiver === a);
a.bar = 2;
info = topLevelInfo;
- Expect.equals('set:bar', info.name);
+ Expect.equals('bar', info.name);
Expect.isTrue(info.args.length == 1);
Expect.isTrue(info.args[0] === 2);
Expect.isTrue(info.receiver === a);
diff --git a/tests/compiler/dart2js_extra/optional_parameter_test.dart b/tests/compiler/dart2js_extra/optional_parameter_test.dart
index 82f2f84..4fd5ac8 100644
--- a/tests/compiler/dart2js_extra/optional_parameter_test.dart
+++ b/tests/compiler/dart2js_extra/optional_parameter_test.dart
@@ -11,7 +11,7 @@
return b;
}
- noSuchMethod(name, args) {
+ noSuchMethod(mirror) {
return 0;
}
}
diff --git a/tests/compiler/dart2js_native/native_no_such_method_exception3_frog_test.dart b/tests/compiler/dart2js_native/native_no_such_method_exception3_frog_test.dart
index 549b111..22f4369 100644
--- a/tests/compiler/dart2js_native/native_no_such_method_exception3_frog_test.dart
+++ b/tests/compiler/dart2js_native/native_no_such_method_exception3_frog_test.dart
@@ -12,7 +12,7 @@
class C {
static create() => new C();
- noSuchMethod(x, y) => "$x:$y";
+ noSuchMethod(x) => "${x.memberName}:${x.positionalArguments}";
}
makeA() native;
diff --git a/tests/compiler/dart2js_native/native_no_such_method_exception4_frog_test.dart b/tests/compiler/dart2js_native/native_no_such_method_exception4_frog_test.dart
index fa1f878..3827cac 100644
--- a/tests/compiler/dart2js_native/native_no_such_method_exception4_frog_test.dart
+++ b/tests/compiler/dart2js_native/native_no_such_method_exception4_frog_test.dart
@@ -4,7 +4,7 @@
class A native "*A" {
bar() => 42;
- noSuchMethod(x,y) => "native($x:$y)";
+ noSuchMethod(x) => "native(${x.memberName}:${x.positionalArguments})";
}
class B native "*B" {
diff --git a/tests/compiler/dart2js_native/native_no_such_method_exception5_frog_test.dart b/tests/compiler/dart2js_native/native_no_such_method_exception5_frog_test.dart
index 58074df..c0f03ac 100644
--- a/tests/compiler/dart2js_native/native_no_such_method_exception5_frog_test.dart
+++ b/tests/compiler/dart2js_native/native_no_such_method_exception5_frog_test.dart
@@ -4,7 +4,7 @@
class A native "*A" {
bar() => 42;
- noSuchMethod(x,y) => "native($x:$y)";
+ noSuchMethod(x) => "native(${x.memberName}:${x.positionalArguments})";
}
class B native "*B" {
@@ -13,7 +13,7 @@
class C {
static create() => new C();
- noSuchMethod(x, y) => "$x:$y";
+ noSuchMethod(x) => "${x.memberName}:${x.positionalArguments}";
}
makeA() native;
diff --git a/tests/corelib/core_runtime_types_test.dart b/tests/corelib/core_runtime_types_test.dart
index d1733bd..e3d94ce 100644
--- a/tests/corelib/core_runtime_types_test.dart
+++ b/tests/corelib/core_runtime_types_test.dart
@@ -45,16 +45,10 @@
}
static assertTypeError(void f()) {
- try {
- f();
- } catch (exception) {
- Expect.equals(true, (exception is TypeError) ||
- (exception is NoSuchMethodError) ||
- (exception is NullPointerException) ||
- (exception is ArgumentError));
- return;
- }
- Expect.equals(true, false);
+ Expect.throws(f, (exception) => (exception is TypeError) ||
+ (exception is NoSuchMethodError) ||
+ (exception is NullPointerException) ||
+ (exception is ArgumentError));
}
static testBooleanOperators() {
diff --git a/tests/corelib/corelib.status b/tests/corelib/corelib.status
index b604ddd..83da1cb 100644
--- a/tests/corelib/corelib.status
+++ b/tests/corelib/corelib.status
@@ -67,3 +67,8 @@
null_nosuchmethod_test: Fail # inherited from VM
null_test: Fail # inherited from VM
unicode_test: Fail # inherited from VM
+
+[ $compiler == dartc ]
+# test issue 6324
+list_sort_test: Fail, OK
+sort_test: Fail, OK
diff --git a/tests/corelib/list_get_range_test.dart b/tests/corelib/list_get_range_test.dart
index 431af2c..88baeb6 100644
--- a/tests/corelib/list_get_range_test.dart
+++ b/tests/corelib/list_get_range_test.dart
@@ -37,7 +37,7 @@
}
void expectIOORE(Function f) {
- Expect.throws(f, (e) => e is IndexOutOfRangeException);
+ Expect.throws(f, (e) => e is RangeError);
}
void expectIAE(Function f) {
diff --git a/tests/corelib/list_insert_range_test.dart b/tests/corelib/list_insert_range_test.dart
index eebe9b0..26e48cf 100644
--- a/tests/corelib/list_insert_range_test.dart
+++ b/tests/corelib/list_insert_range_test.dart
@@ -37,7 +37,7 @@
}
void expectIOORE(Function f) {
- Expect.throws(f, (e) => e is IndexOutOfRangeException);
+ Expect.throws(f, (e) => e is RangeError);
}
void expectIAE(Function f) {
diff --git a/tests/corelib/list_remove_range_test.dart b/tests/corelib/list_remove_range_test.dart
index b806c92..4e41ef6 100644
--- a/tests/corelib/list_remove_range_test.dart
+++ b/tests/corelib/list_remove_range_test.dart
@@ -40,7 +40,7 @@
}
void expectIOORE(Function f) {
- Expect.throws(f, (e) => e is IndexOutOfRangeException);
+ Expect.throws(f, (e) => e is RangeError);
}
void testNegativeIndices() {
diff --git a/tests/corelib/list_removeat_test.dart b/tests/corelib/list_removeat_test.dart
index 465f2f5..d6a9b28 100644
--- a/tests/corelib/list_removeat_test.dart
+++ b/tests/corelib/list_removeat_test.dart
@@ -11,10 +11,10 @@
// Index must be integer and in range.
Expect.throws(() { l1.removeAt(-1); },
- (e) => e is IndexOutOfRangeException,
+ (e) => e is RangeError,
"negative");
Expect.throws(() { l1.removeAt(5); },
- (e) => e is IndexOutOfRangeException,
+ (e) => e is RangeError,
"too large");
Expect.throws(() { l1.removeAt(null); },
(e) => e is ArgumentError,
@@ -57,6 +57,6 @@
// Empty list is not special.
var l4 = [];
Expect.throws(() { l4.removeAt(0); },
- (e) => e is IndexOutOfRangeException,
+ (e) => e is RangeError,
"empty");
}
diff --git a/tests/corelib/list_set_range_test.dart b/tests/corelib/list_set_range_test.dart
index c37e950..f96ede5 100644
--- a/tests/corelib/list_set_range_test.dart
+++ b/tests/corelib/list_set_range_test.dart
@@ -57,7 +57,7 @@
}
void expectIOORE(Function f) {
- Expect.throws(f, (e) => e is IndexOutOfRangeException);
+ Expect.throws(f, (e) => e is RangeError);
}
void testNegativeIndices() {
diff --git a/tests/corelib/map_test.dart b/tests/corelib/map_test.dart
index 4b44793..0f78437 100644
--- a/tests/corelib/map_test.dart
+++ b/tests/corelib/map_test.dart
@@ -3,7 +3,7 @@
// BSD-style license that can be found in the LICENSE file.
#library("MapTest.dart");
-#import("dart:coreimpl");
+#import("dart:collection");
class MapTest {
diff --git a/tests/corelib/maps_test.dart b/tests/corelib/maps_test.dart
index 95b2e1d..16ef12c 100644
--- a/tests/corelib/maps_test.dart
+++ b/tests/corelib/maps_test.dart
@@ -3,7 +3,7 @@
// BSD-style license that can be found in the LICENSE file.
#library("MapsTest.dart");
-#import("dart:coreimpl");
+#import("dart:collection");
main() {
final key1 = "key1";
diff --git a/tests/corelib/index_out_of_range_exception_test.dart b/tests/corelib/range_error_test.dart
similarity index 89%
rename from tests/corelib/index_out_of_range_exception_test.dart
rename to tests/corelib/range_error_test.dart
index b052a4b..e83bd30 100644
--- a/tests/corelib/index_out_of_range_exception_test.dart
+++ b/tests/corelib/range_error_test.dart
@@ -4,7 +4,7 @@
// Dart test for testing out of range exceptions on arrays.
-class IndexOutOfRangeExceptionTest {
+class RangeErrorTest {
static testRead() {
testListRead([], 0);
testListRead([], -1);
@@ -52,7 +52,7 @@
var exception = null;
try {
var e = list[index];
- } on IndexOutOfRangeException catch (e) {
+ } on RangeError catch (e) {
exception = e;
}
Expect.equals(true, exception != null);
@@ -62,7 +62,7 @@
var exception = null;
try {
list[index] = null;
- } on IndexOutOfRangeException catch (e) {
+ } on RangeError catch (e) {
exception = e;
}
Expect.equals(true, exception != null);
@@ -70,5 +70,5 @@
}
main() {
- IndexOutOfRangeExceptionTest.testMain();
+ RangeErrorTest.testMain();
}
diff --git a/tests/corelib/splay_tree_test.dart b/tests/corelib/splay_tree_test.dart
index dd3601c..bb0ae70 100644
--- a/tests/corelib/splay_tree_test.dart
+++ b/tests/corelib/splay_tree_test.dart
@@ -4,7 +4,7 @@
// Dart test for Splaytrees.
#library("SplayTreeTest.dart");
-#import("dart:coreimpl");
+#import("dart:collection");
class SplayTreeMapTest {
diff --git a/tests/corelib/string_base_vm_test.dart b/tests/corelib/string_base_vm_test.dart
index 87d3a53..be44250 100644
--- a/tests/corelib/string_base_vm_test.dart
+++ b/tests/corelib/string_base_vm_test.dart
@@ -55,14 +55,14 @@
bool exception_caught = false;
try {
s.substring(5, 12);
- } on IndexOutOfRangeException catch (ex) {
+ } on RangeError catch (ex) {
exception_caught = true;
}
Expect.equals(true, exception_caught);
exception_caught = false;
try {
s.substring(5, 4);
- } on IndexOutOfRangeException catch (ex) {
+ } on RangeError catch (ex) {
exception_caught = true;
}
Expect.equals(true, exception_caught);
diff --git a/tests/corelib/string_substring_test.dart b/tests/corelib/string_substring_test.dart
index fa6085f..0cdac66 100644
--- a/tests/corelib/string_substring_test.dart
+++ b/tests/corelib/string_substring_test.dart
@@ -6,32 +6,32 @@
// Test that not providing an optional argument goes to the end.
Expect.equals("".substring(0), "");
Expect.throws(() => "".substring(1),
- (e) => e is IndexOutOfRangeException);
+ (e) => e is RangeError);
Expect.throws(() => "".substring(-1),
- (e) => e is IndexOutOfRangeException);
+ (e) => e is RangeError);
Expect.equals("abc".substring(0), "abc");
Expect.equals("abc".substring(1), "bc");
Expect.equals("abc".substring(2), "c");
Expect.equals("abc".substring(3), "");
Expect.throws(() => "abc".substring(4),
- (e) => e is IndexOutOfRangeException);
+ (e) => e is RangeError);
Expect.throws(() => "abc".substring(-1),
- (e) => e is IndexOutOfRangeException);
+ (e) => e is RangeError);
// Test that providing null goes to the end.
Expect.equals("".substring(0, null), "");
Expect.throws(() => "".substring(1, null),
- (e) => e is IndexOutOfRangeException);
+ (e) => e is RangeError);
Expect.throws(() => "".substring(-1, null),
- (e) => e is IndexOutOfRangeException);
+ (e) => e is RangeError);
Expect.equals("abc".substring(0, null), "abc");
Expect.equals("abc".substring(1, null), "bc");
Expect.equals("abc".substring(2, null), "c");
Expect.equals("abc".substring(3, null), "");
Expect.throws(() => "abc".substring(4, null),
- (e) => e is IndexOutOfRangeException);
+ (e) => e is RangeError);
Expect.throws(() => "abc".substring(-1, null),
- (e) => e is IndexOutOfRangeException);
+ (e) => e is RangeError);
}
diff --git a/tests/corelib/string_test.dart b/tests/corelib/string_test.dart
index 0dd8e54..a5ba35b 100644
--- a/tests/corelib/string_test.dart
+++ b/tests/corelib/string_test.dart
@@ -28,7 +28,7 @@
bool exception_caught = false;
try {
var c = a[20]; // Throw exception.
- } on IndexOutOfRangeException catch (e) {
+ } on RangeError catch (e) {
exception_caught = true;
}
Expect.equals(true, exception_caught);
diff --git a/tests/html/audiobuffersourcenode_test.dart b/tests/html/audiobuffersourcenode_test.dart
index 0251672..360f9bc 100644
--- a/tests/html/audiobuffersourcenode_test.dart
+++ b/tests/html/audiobuffersourcenode_test.dart
@@ -12,6 +12,6 @@
AudioBufferSourceNode node = ctx.createBufferSource();
node.start(ctx.currentTime, 0, 2);
node.stop(ctx.currentTime + 2);
- expect(node is AudioBufferSourceNode);
+ expect(node is AudioBufferSourceNode, isTrue);
});
}
diff --git a/tests/html/audiocontext_test.dart b/tests/html/audiocontext_test.dart
index 9706aa4..f84ddbf 100644
--- a/tests/html/audiocontext_test.dart
+++ b/tests/html/audiocontext_test.dart
@@ -7,10 +7,13 @@
useHtmlConfiguration();
+ var isAudioContext =
+ predicate((x) => x is AudioContext, 'is an AudioContext');
+
test('constructorTest', () {
var ctx = new AudioContext();
expect(ctx, isNotNull);
- expect(ctx is AudioContext);
+ expect(ctx, isAudioContext);
});
test('createBuffer', () {
var ctx = new AudioContext();
@@ -23,4 +26,18 @@
expect(e.code, equals(DOMException.SYNTAX_ERR));
}
});
+
+ test('audioRenames', () {
+ AudioContext context = new AudioContext();
+ GainNode gainNode = context.createGainNode();
+ gainNode.connect(context.destination, 0, 0);
+ expect(gainNode is GainNode, isTrue);
+
+ expect(context.createAnalyser() is AnalyserNode, isTrue);
+ expect(context.createChannelMerger() is ChannelMergerNode, isTrue);
+ expect(context.createChannelSplitter() is ChannelSplitterNode, isTrue);
+ expect(context.createOscillator() is OscillatorNode, isTrue);
+ expect(context.createPanner() is PannerNode, isTrue);
+ expect(context.createJavaScriptNode(4096) is ScriptProcessorNode, isTrue);
+ });
}
diff --git a/tests/html/audioelement_test.dart b/tests/html/audioelement_test.dart
index da7fd3f..988d140 100644
--- a/tests/html/audioelement_test.dart
+++ b/tests/html/audioelement_test.dart
@@ -9,13 +9,13 @@
test('constructorTest1', () {
var audio = new AudioElement();
expect(audio, isNotNull);
- expect(audio is AudioElement);
+ expect(audio is AudioElement, isTrue);
});
test('constructorTest2', () {
var audio = new AudioElement('hahaURL');
expect(audio, isNotNull);
- expect(audio is AudioElement);
+ expect(audio is AudioElement, isTrue);
expect(audio.src, contains('hahaURL'));
});
}
diff --git a/tests/html/blob_constructor_test.dart b/tests/html/blob_constructor_test.dart
index 788d4d5..71071bc 100644
--- a/tests/html/blob_constructor_test.dart
+++ b/tests/html/blob_constructor_test.dart
@@ -12,7 +12,7 @@
test('basic', () {
var b = new Blob([]);
- expect(b.size, 0);
+ expect(b.size, isZero);
});
test('type1', () {
@@ -31,7 +31,8 @@
test('endings2', () {
// OPTIONALS var b = new Blob(['A\nB\n'], endings: 'native');
var b = new Blob(['A\nB\n'], null, 'native');
- expect(b.size, (x) => x == 4 || x == 6);
+ expect(b.size, (x) => x == 4 || x == 6,
+ reason: "b.size should be 4 or 6");
});
test('twoStrings', () {
@@ -43,7 +44,7 @@
test('fromBlob1', () {
var b1 = new Blob([]);
var b2 = new Blob([b1]);
- expect(b2.size, 0);
+ expect(b2.size, isZero);
});
test('fromBlob2', () {
diff --git a/tests/html/canvas_pixel_array_type_alias_test.dart b/tests/html/canvas_pixel_array_type_alias_test.dart
index 5560d9f..7a9ba78 100644
--- a/tests/html/canvas_pixel_array_type_alias_test.dart
+++ b/tests/html/canvas_pixel_array_type_alias_test.dart
@@ -31,7 +31,8 @@
Uint8ClampedArray data = image.data;
// It is legal for the dart2js compiler to believe the type of the native
// ImageData.data and elides the check, so check the type explicitly:
- expect(confuseType(data) is Uint8ClampedArray, isTrue, 'canvas array type');
+ expect(confuseType(data) is Uint8ClampedArray, isTrue,
+ reason: 'canvas array type');
expect(data, hasLength(40000));
checkPixel(data, 0, [0, 0, 0, 0]);
@@ -46,6 +47,6 @@
{
offset *= 4;
for (var i = 0; i < 4; ++i) {
- Expect.equals(rgba[i], data[offset + i]);
+ expect(rgba[i], equals(data[offset + i]));
}
}
diff --git a/tests/html/client_rect_test.dart b/tests/html/client_rect_test.dart
index 580f41d..4ad9ddf 100644
--- a/tests/html/client_rect_test.dart
+++ b/tests/html/client_rect_test.dart
@@ -5,6 +5,9 @@
main() {
+ var isClientRectList =
+ predicate((x) => x is List<ClientRect>, 'is a List<ClientRect>');
+
insertTestDiv() {
var element = new Element.tag('div');
element.innerHTML = r'''
@@ -21,7 +24,7 @@
test("ClientRectList test", () {
insertTestDiv();
var range = document.createRange();
- List<ClientRect> rects = range.getClientRects();
- Expect.isTrue(rects is List<ClientRect>);
+ var rects = range.getClientRects();
+ expect(rects, isClientRectList);
});
}
diff --git a/tests/html/contentelement_test.dart b/tests/html/contentelement_test.dart
index 88e5c57..1df3b10 100644
--- a/tests/html/contentelement_test.dart
+++ b/tests/html/contentelement_test.dart
@@ -10,8 +10,11 @@
main() {
useHtmlConfiguration();
+ var isContentElement =
+ predicate((x) => x is ContentElement, 'is a ContentElement');
+
test('constructor', () {
var e = new ContentElement();
- expect(e is ContentElement);
+ expect(e, isContentElement);
});
}
diff --git a/tests/html/cross_frame_test.dart b/tests/html/cross_frame_test.dart
index 1fb54ad..aa8043e 100644
--- a/tests/html/cross_frame_test.dart
+++ b/tests/html/cross_frame_test.dart
@@ -6,19 +6,31 @@
main() {
useHtmlConfiguration();
+ var isWindow = predicate((x) => x is Window, 'is a Window');
+ var isLocalWindow = predicate((x) => x is LocalWindow, 'is a LocalWindow');
+ var isLocation = predicate((x) => x is Location, 'is a Location');
+ var isLocalLocation =
+ predicate((x) => x is LocalLocation, 'is a LocalLocation');
+ var isHistory = predicate((x) => x is History, 'is a History');
+ var isLocalHistory = predicate((x) => x is LocalHistory, 'is a LocalHistory');
+
final iframe = new Element.tag('iframe');
document.body.nodes.add(iframe);
test('window', () {
- expect(window is LocalWindow);
- expect(window.document == document);
+ expect(window, isLocalWindow);
+ expect(window.document, document);
});
test('iframe', () {
final frameWindow = iframe.contentWindow;
- expect(frameWindow is Window);
- expect(frameWindow is! LocalWindow);
- expect(frameWindow.parent is LocalWindow);
+ expect(frameWindow, isWindow);
+ //TODO(gram) The next test should be written as:
+ // expect(frameWindow, isNot(isLocalWindow));
+ // but that will cause problems now until is/is! work
+ // properly in dart2js instead of always returning true.
+ expect(frameWindow is! LocalWindow, isTrue);
+ expect(frameWindow.parent, isLocalWindow);
// Ensure that the frame's document is inaccessible via window.
expect(() => frameWindow.document, throws);
@@ -30,23 +42,27 @@
});
test('location', () {
- expect(window.location is LocalLocation);
+ expect(window.location, isLocalLocation);
final frameLocation = iframe.contentWindow.location;
- expect(frameLocation is Location);
- expect(frameLocation is! LocalLocation);
+ expect(frameLocation, isLocation);
+ // TODO(gram) Similar to the above, the next test should be:
+ // expect(frameLocation, isNot(isLocalLocation));
+ expect(frameLocation is! LocalLocation, isTrue);
expect(() => frameLocation.href, throws);
expect(() => frameLocation.hash, throws);
final frameParentLocation = iframe.contentWindow.parent.location;
- expect(frameParentLocation is LocalLocation);
+ expect(frameParentLocation, isLocalLocation);
});
test('history', () {
- expect(window.history is LocalHistory);
+ expect(window.history, isLocalHistory);
final frameHistory = iframe.contentWindow.history;
- expect(frameHistory is History);
- expect(frameHistory is! LocalHistory);
+ expect(frameHistory, isHistory);
+ // See earlier comments.
+ //expect(frameHistory, isNot(isLocalHistory));
+ expect(frameHistory is! LocalHistory, isTrue);
// Valid methods.
frameHistory.forward();
@@ -54,6 +70,6 @@
expect(() => frameHistory.length, throws);
final frameParentHistory = iframe.contentWindow.parent.history;
- expect(frameParentHistory is LocalHistory);
+ expect(frameParentHistory, isLocalHistory);
});
}
diff --git a/tests/html/css_rule_list_test.dart b/tests/html/css_rule_list_test.dart
index bf534ad..9d144b4 100644
--- a/tests/html/css_rule_list_test.dart
+++ b/tests/html/css_rule_list_test.dart
@@ -5,11 +5,14 @@
main() {
+ var isCSSRuleList =
+ predicate((x) => x is List<CSSRule>, 'is a List<CSSRule>');
+
useHtmlConfiguration();
test("ClientRectList test", () {
var sheet = document.styleSheets[0];
List<CSSRule> rulesList = sheet.cssRules;
- Expect.isTrue(rulesList is List<CSSRule>);
+ expect(rulesList, isCSSRuleList);
});
}
diff --git a/tests/html/css_test.dart b/tests/html/css_test.dart
index ca6cc53..f4fa0b8 100644
--- a/tests/html/css_test.dart
+++ b/tests/html/css_test.dart
@@ -38,6 +38,6 @@
}
void checkPoint(expectedX, expectedY, Point point) {
- expect(point.x.round(), equals(expectedX), 'Wrong point.x');
- expect(point.y.round(), equals(expectedY), 'Wrong point.y');
+ expect(point.x.round(), equals(expectedX), reason: 'Wrong point.x');
+ expect(point.y.round(), equals(expectedY), reason: 'Wrong point.y');
}
diff --git a/tests/html/cssstyledeclaration_test.dart b/tests/html/cssstyledeclaration_test.dart
index 9807299..068952a7 100644
--- a/tests/html/cssstyledeclaration_test.dart
+++ b/tests/html/cssstyledeclaration_test.dart
@@ -24,9 +24,9 @@
expect(style.item(0), isEmpty);
expect(style, hasLength(0));
// These assertions throw a NotImplementedException in dartium:
- // Expect.isNull(style.parentRule);
- // Expect.isNull(style.getPropertyCSSValue('color'));
- // Expect.isNull(style.getPropertyShorthand('color'));
+ // expect(style.parentRule, isNull);
+ // expect(style.getPropertyCSSValue('color'), isNull);
+ // expect(style.getPropertyShorthand('color'), isNull);
});
test('length is wrapped', () {
diff --git a/tests/html/dart_object_local_storage_test.dart b/tests/html/dart_object_local_storage_test.dart
index 6d4291d..3e8a36d 100644
--- a/tests/html/dart_object_local_storage_test.dart
+++ b/tests/html/dart_object_local_storage_test.dart
@@ -19,16 +19,16 @@
body.nodes.add(element);
test('body', () {
- Expect.equals(body, document.body);
+ expect(body, equals(document.body));
});
test('localStorage', () {
- Expect.equals(localStorage, window.localStorage);
+ expect(localStorage, equals(window.localStorage));
});
test('sessionStorage', () {
- Expect.equals(sessionStorage, window.sessionStorage);
+ expect(sessionStorage, equals(window.sessionStorage));
});
test('unknown', () {
var test = document.query('#test');
- Expect.equals(element, test);
+ expect(element, equals(test));
});
}
diff --git a/tests/html/datalistelement_test.dart b/tests/html/datalistelement_test.dart
index e130152..790f11d 100644
--- a/tests/html/datalistelement_test.dart
+++ b/tests/html/datalistelement_test.dart
@@ -10,6 +10,9 @@
main() {
useHtmlConfiguration();
+ var isDataListElement =
+ predicate((x) => x is DataListElement, 'is a DataListElement');
+
var div;
setUp(() {
@@ -34,7 +37,7 @@
test('is', () {
var list = document.query('#browsers');
- expect(list is DataListElement);
+ expect(list, isDataListElement);
});
test('list', () {
@@ -51,6 +54,6 @@
test('create', () {
var list = new DataListElement();
- expect(list is DataListElement);
+ expect(list, isDataListElement);
});
}
diff --git a/tests/html/document_test.dart b/tests/html/document_test.dart
index bba6e20..e535aba 100644
--- a/tests/html/document_test.dart
+++ b/tests/html/document_test.dart
@@ -6,11 +6,18 @@
main() {
useHtmlConfiguration();
+ var isElement = predicate((x) => x is Element, 'is an Element');
+ var isDivElement = predicate((x) => x is DivElement, 'is a DivElement');
+ var isAnchorElement =
+ predicate((x) => x is AnchorElement, 'is an AnchorElement');
+ var isUnknownElement =
+ predicate((x) => x is UnknownElement, 'is UnknownElement');
+
test('CreateElement', () {
// FIXME: nifty way crashes, do it boring way.
- Expect.isTrue(new Element.tag('span') is Element);
- Expect.isTrue(new Element.tag('div') is DivElement);
- Expect.isTrue(new Element.tag('a') is AnchorElement);
- Expect.isTrue(new Element.tag('bad_name') is UnknownElement);
+ expect(new Element.tag('span'), isElement);
+ expect(new Element.tag('div'), isDivElement);
+ expect(new Element.tag('a'), isAnchorElement);
+ expect(new Element.tag('bad_name'), isUnknownElement);
});
}
diff --git a/tests/html/documentfragment_test.dart b/tests/html/documentfragment_test.dart
index b312cf6..fe6ecb6 100644
--- a/tests/html/documentfragment_test.dart
+++ b/tests/html/documentfragment_test.dart
@@ -11,6 +11,9 @@
main() {
useHtmlConfiguration();
+ var isAnchorElement =
+ predicate((x) => x is AnchorElement, 'is an AnchorElement');
+
Collection<String> _nodeStrings(Collection<Node> input) {
var out = new List<String>();
for (Node n in input) {
@@ -32,19 +35,19 @@
return;
}
}
- Expect.fail('Expected immutability error');
+ expect(true, isFalse, reason: 'Expected immutability error');
};
void expectEmptyStyleDeclaration(CSSStyleDeclaration style) {
- Expect.equals("", style.cssText);
- Expect.equals("", style.getPropertyPriority('color'));
- Expect.equals("", style.item(0));
- Expect.equals(0, style.length);
+ expect(style.cssText, equals(''));
+ expect(style.getPropertyPriority('color'), equals(''));
+ expect(style.item(0), equals(''));
+ expect(style.length, isZero);
// TODO(jacobr): these checks throw NotImplementedExceptions in dartium.
- // Expect.isNull(style.parentRule);
- // Expect.isNull(style.getPropertyCSSValue('color'));
- // Expect.isNull(style.getPropertyShorthand('color'));
- // Expect.isFalse(style.isPropertyImplicit('color'));
+ // expect(style.parentRule, isNull);
+ // expect(style.getPropertyCSSValue('color'), isNull);
+ // expect(style.getPropertyShorthand('color'), isNull);
+ // expect(style.isPropertyImplicit('color'), isFalse);
// Ideally these would throw errors, but it's not possible to create a class
// that'll intercept these calls without implementing the entire
@@ -57,23 +60,23 @@
group('constructors', () {
test('0-argument makes an empty fragment', () {
final fragment = new DocumentFragment();
- Expect.listEquals([], fragment.elements);
+ expect(fragment.elements, equals([]));
});
test('.html parses input as HTML', () {
final fragment = new DocumentFragment.html('<a>foo</a>');
- Expect.isTrue(fragment.elements[0] is AnchorElement);
+ expect(fragment.elements[0], isAnchorElement);
});
// test('.svg parses input as SVG', () {
// final fragment = new DocumentFragment.svg('<a>foo</a>');
- // Expect.isTrue(fragment.elements[0] is SVGAElement);
+ // expect(fragment.elements[0] is SVGAElement, isTrue);
// });
// TODO(nweiz): enable this once XML is ported.
// test('.xml parses input as XML', () {
// final fragment = new DocumentFragment.xml('<a>foo</a>');
- // Expect.isTrue(fragment.elements[0] is XMLElement);
+ // expect(fragment.elements[0] is XMLElement, isTrue);
// });
});
@@ -116,63 +119,66 @@
test('is initially empty', () {
elements = new DocumentFragment().elements;
- Expect.listEquals([], elements);
- Expect.isTrue(elements.isEmpty);
+ expect(elements, equals([]));
+ expect(elements.isEmpty, isTrue);
});
test('filters out non-element nodes', () {
init();
- Expect.listEquals(["1", "A", "B", "2", "I", "3", "U"],
- _nodeStrings(fragment.nodes));
- Expect.listEquals(["A", "B", "I", "U"], _nodeStrings(elements));
+ expect(_nodeStrings(fragment.nodes),
+ orderedEquals(["1", "A", "B", "2", "I", "3", "U"]));
+ expect(_nodeStrings(elements),
+ orderedEquals(["A", "B", "I", "U"]));
});
test('only indexes elements, not other nodes', () {
init();
elements[1] = new Element.tag("BR");
- Expect.listEquals(["1", "A", "BR", "2", "I", "3", "U"],
- _nodeStrings(fragment.nodes));
- Expect.listEquals(["A", "BR", "I", "U"], _nodeStrings(elements));
+ expect(_nodeStrings(fragment.nodes),
+ orderedEquals(["1", "A", "BR", "2", "I", "3", "U"]));
+ expect(_nodeStrings(elements),
+ orderedEquals(["A", "BR", "I", "U"]));
});
test('adds to both elements and nodes', () {
init();
elements.add(new Element.tag("UL"));
- Expect.listEquals(["1", "A", "B", "2", "I", "3", "U", "UL"],
- _nodeStrings(fragment.nodes));
- Expect.listEquals(["A", "B", "I", "U", "UL"], _nodeStrings(elements));
+ expect(_nodeStrings(fragment.nodes),
+ orderedEquals(["1", "A", "B", "2", "I", "3", "U", "UL"]));
+ expect(_nodeStrings(elements),
+ orderedEquals(["A", "B", "I", "U", "UL"]));
});
test('removes only elements, from both elements and nodes', () {
init();
- Expect.equals("U", elements.removeLast().tagName);
- Expect.listEquals(["1", "A", "B", "2", "I", "3"],
- _nodeStrings(fragment.nodes));
- Expect.listEquals(["A", "B", "I"], _nodeStrings(elements));
+ expect(elements.removeLast().tagName, equals('U'));
+ expect(_nodeStrings(fragment.nodes),
+ orderedEquals(["1", "A", "B", "2", "I", "3"]));
+ expect(_nodeStrings(elements),
+ orderedEquals(["A", "B", "I"]));
- Expect.equals("I", elements.removeLast().tagName);
- Expect.listEquals(["1", "A", "B", "2", "3"],
- _nodeStrings(fragment.nodes));
- Expect.listEquals(["A", "B"], _nodeStrings(elements));
+ expect(elements.removeLast().tagName, "I");
+ expect(_nodeStrings(fragment.nodes),
+ equals(["1", "A", "B", "2", "3"]));
+ expect(_nodeStrings(elements), equals(["A", "B"]));
});
test('accessors are wrapped', () {
init();
- Expect.equals("A", elements[0].tagName);
- Expect.listEquals(
- ["I"], _nodeStrings(elements.filter((e) => e.tagName == "I")));
- Expect.isTrue(elements.every((e) => e is Element));
- Expect.isTrue(elements.some((e) => e.tagName == "U"));
- Expect.isFalse(elements.isEmpty);
- Expect.equals(4, elements.length);
- Expect.equals("I", elements[2].tagName);
- Expect.equals("U", elements.last.tagName);
+ expect(elements[0].tagName, "A");
+ expect(_nodeStrings(elements.filter((e) => e.tagName == "I")), ["I"]);
+ expect(elements.every((e) => e is Element), isTrue);
+ expect(elements.some((e) => e.tagName == "U"), isTrue);
+ expect(elements.isEmpty, isFalse);
+ expect(elements.length, 4);
+ expect(elements[2].tagName, "I");
+ expect(elements.last.tagName, "U");
});
test('setting elements overwrites nodes as well', () {
init();
fragment.elements = [new Element.tag("DIV"), new Element.tag("HEAD")];
- Expect.listEquals(["DIV", "HEAD"], _nodeStrings(fragment.nodes));
+ expect(_nodeStrings(fragment.nodes), equals(["DIV", "HEAD"]));
});
});
@@ -180,14 +186,14 @@
var fragment = new DocumentFragment();
fragment.nodes.add(new Text("foo"));
fragment.innerHTML = "<a>bar</a>baz";
- Expect.listEquals(["A", "baz"], _nodeStrings(fragment.nodes));
+ expect(_nodeStrings(fragment.nodes), equals(["A", "baz"]));
});
test('getting innerHTML works', () {
var fragment = new DocumentFragment();
fragment.nodes.addAll([new Text("foo"), new Element.html("<A>bar</A>")]);
- Expect.equals("foo<a>bar</a>", fragment.innerHTML);
- Expect.equals("foo<a>bar</a>", fragment.outerHTML);
+ expect(fragment.innerHTML, "foo<a>bar</a>");
+ expect(fragment.outerHTML, "foo<a>bar</a>");
});
group('insertAdjacentElement', () {
@@ -195,30 +201,30 @@
test('beforeBegin does nothing', () {
var fragment = getFragment();
- Expect.isNull(
- fragment.insertAdjacentElement("beforeBegin", new Element.tag("b")));
- Expect.equals("<a>foo</a>", fragment.innerHTML);
+ expect(fragment.insertAdjacentElement("beforeBegin",
+ new Element.tag("b")), isNull);
+ expect(fragment.innerHTML, "<a>foo</a>");
});
test('afterEnd does nothing', () {
var fragment = getFragment();
- Expect.isNull(
- fragment.insertAdjacentElement("afterEnd", new Element.tag("b")));
- Expect.equals("<a>foo</a>", fragment.innerHTML);
+ expect(fragment.insertAdjacentElement("afterEnd",
+ new Element.tag("b")), isNull);
+ expect(fragment.innerHTML, "<a>foo</a>");
});
test('afterBegin inserts the element', () {
var fragment = getFragment();
var el = new Element.tag("b");
- Expect.equals(el, fragment.insertAdjacentElement("afterBegin", el));
- Expect.equals("<b></b><a>foo</a>", fragment.innerHTML);
+ expect(fragment.insertAdjacentElement("afterBegin", el), equals(el));
+ expect(fragment.innerHTML, "<b></b><a>foo</a>");
});
test('beforeEnd inserts the element', () {
var fragment = getFragment();
var el = new Element.tag("b");
- Expect.equals(el, fragment.insertAdjacentElement("beforeEnd", el));
- Expect.equals("<a>foo</a><b></b>", fragment.innerHTML);
+ expect(fragment.insertAdjacentElement("beforeEnd", el), equals(el));
+ expect(fragment.innerHTML, "<a>foo</a><b></b>");
});
});
@@ -228,25 +234,25 @@
test('beforeBegin does nothing', () {
var fragment = getFragment();
fragment.insertAdjacentText("beforeBegin", "foo");
- Expect.equals("<a>foo</a>", fragment.innerHTML);
+ expect(fragment.innerHTML, "<a>foo</a>");
});
test('afterEnd does nothing', () {
var fragment = getFragment();
fragment.insertAdjacentText("afterEnd", "foo");
- Expect.equals("<a>foo</a>", fragment.innerHTML);
+ expect(fragment.innerHTML, "<a>foo</a>");
});
test('afterBegin inserts the text', () {
var fragment = getFragment();
fragment.insertAdjacentText("afterBegin", "foo");
- Expect.equals("foo<a>foo</a>", fragment.innerHTML);
+ expect(fragment.innerHTML, "foo<a>foo</a>");
});
test('beforeEnd inserts the text', () {
var fragment = getFragment();
fragment.insertAdjacentText("beforeEnd", "foo");
- Expect.equals("<a>foo</a>foo", fragment.innerHTML);
+ expect(fragment.innerHTML, "<a>foo</a>foo");
});
});
@@ -256,25 +262,25 @@
test('beforeBegin does nothing', () {
var fragment = getFragment();
fragment.insertAdjacentHTML("beforeBegin", "foo<br>");
- Expect.equals("<a>foo</a>", fragment.innerHTML);
+ expect(fragment.innerHTML, "<a>foo</a>");
});
test('afterEnd does nothing', () {
var fragment = getFragment();
fragment.insertAdjacentHTML("afterEnd", "<br>foo");
- Expect.equals("<a>foo</a>", fragment.innerHTML);
+ expect(fragment.innerHTML, "<a>foo</a>");
});
test('afterBegin inserts the HTML', () {
var fragment = getFragment();
fragment.insertAdjacentHTML("afterBegin", "foo<br>");
- Expect.equals("foo<br><a>foo</a>", fragment.innerHTML);
+ expect(fragment.innerHTML, "foo<br><a>foo</a>");
});
test('beforeEnd inserts the HTML', () {
var fragment = getFragment();
fragment.insertAdjacentHTML("beforeEnd", "<br>foo");
- Expect.equals("<a>foo</a><br>foo", fragment.innerHTML);
+ expect(fragment.innerHTML, "<a>foo</a><br>foo");
});
});
@@ -298,29 +304,29 @@
expectEmptyRect(rect.offset);
expectEmptyRect(rect.scroll);
expectEmptyRect(rect.bounding);
- Expect.isTrue(rect.clientRects.isEmpty);
+ expect(rect.clientRects.isEmpty, isTrue);
}));
- Expect.equals("false", fragment.contentEditable);
- Expect.equals(-1, fragment.tabIndex);
- Expect.equals("", fragment.id);
- Expect.equals("", fragment.title);
- Expect.equals("", fragment.tagName);
- Expect.equals("", fragment.webkitdropzone);
- Expect.equals("", fragment.webkitRegionOverflow);
- Expect.isFalse(fragment.isContentEditable);
- Expect.isFalse(fragment.draggable);
- Expect.isFalse(fragment.hidden);
- Expect.isFalse(fragment.spellcheck);
- Expect.isFalse(fragment.translate);
- Expect.isNull(fragment.nextElementSibling);
- Expect.isNull(fragment.previousElementSibling);
- Expect.isNull(fragment.offsetParent);
- Expect.isNull(fragment.parent);
- Expect.isTrue(fragment.attributes.isEmpty);
- Expect.isTrue(fragment.classes.isEmpty);
- Expect.isTrue(fragment.dataAttributes.isEmpty);
- Expect.isFalse(fragment.matchesSelector("foo"));
- Expect.isFalse(fragment.matchesSelector("*"));
+ expect(fragment.contentEditable, "false");
+ expect(fragment.tabIndex, -1);
+ expect(fragment.id, "");
+ expect(fragment.title, "");
+ expect(fragment.tagName, "");
+ expect(fragment.webkitdropzone, "");
+ expect(fragment.webkitRegionOverflow, "");
+ expect(fragment.isContentEditable, isFalse);
+ expect(fragment.draggable, isFalse);
+ expect(fragment.hidden, isFalse);
+ expect(fragment.spellcheck, isFalse);
+ expect(fragment.translate, isFalse);
+ expect(fragment.nextElementSibling, isNull);
+ expect(fragment.previousElementSibling, isNull);
+ expect(fragment.offsetParent, isNull);
+ expect(fragment.parent, isNull);
+ expect(fragment.attributes.isEmpty, isTrue);
+ expect(fragment.classes.isEmpty, isTrue);
+ expect(fragment.dataAttributes.isEmpty, isTrue);
+ expect(fragment.matchesSelector("foo"), isFalse);
+ expect(fragment.matchesSelector("*"), isFalse);
});
test('style', () {
@@ -348,7 +354,7 @@
test('query searches the fragment', () {
var fragment = new DocumentFragment.html(
"<div class='foo'><a>foo</a><b>bar</b></div>");
- Expect.equals("A", fragment.query(".foo a").tagName);
- Expect.listEquals(["A", "B"], _nodeStrings(fragment.queryAll(".foo *")));
+ expect(fragment.query(".foo a").tagName, "A");
+ expect(_nodeStrings(fragment.queryAll(".foo *")), equals(["A", "B"]));
});
}
diff --git a/tests/html/dom_constructors_test.dart b/tests/html/dom_constructors_test.dart
index 684caf5..6354aac 100644
--- a/tests/html/dom_constructors_test.dart
+++ b/tests/html/dom_constructors_test.dart
@@ -7,6 +7,6 @@
useHtmlConfiguration();
test('FileReader', () {
FileReader fileReader = new FileReader();
- Expect.equals(FileReader.EMPTY, fileReader.readyState);
+ expect(fileReader.readyState, equals(FileReader.EMPTY));
});
}
diff --git a/tests/html/domparser_test.dart b/tests/html/domparser_test.dart
index 990f4cd0f..59d20fb 100644
--- a/tests/html/domparser_test.dart
+++ b/tests/html/domparser_test.dart
@@ -7,9 +7,11 @@
useHtmlConfiguration();
+ var isDOMParser = predicate((x) => x is DOMParser, 'is a DOMParser');
+
test('constructorTest', () {
var ctx = new DOMParser();
- Expect.isTrue(ctx != null);
- Expect.isTrue(ctx is DOMParser);
+ expect(ctx, isNotNull);
+ expect(ctx, isDOMParser);
});
}
diff --git a/tests/html/element_add_test.dart b/tests/html/element_add_test.dart
index 3a128f6..767dbe1 100644
--- a/tests/html/element_add_test.dart
+++ b/tests/html/element_add_test.dart
@@ -11,8 +11,12 @@
main() {
useHtmlConfiguration();
+ var isSpanElement = predicate((x) => x is SpanElement, 'is a SpanElemt');
+ var isDivElement = predicate((x) => x is DivElement, 'is a DivElement');
+ var isText = predicate((x) => x is Text, 'is a Text');
+
void expectNoSuchMethod(void fn()) =>
- Expect.throws(fn, (e) => e is NoSuchMethodError);
+ expect(fn, throwsNoSuchMethodError);
group('addHTML', () {
test('htmlelement', () {
@@ -20,20 +24,20 @@
el.addHTML('<span></span>');
expect(el.elements.length, equals(1));
var span = el.elements[0];
- expect(span is SpanElement);
+ expect(span, isSpanElement);
el.addHTML('<div></div>');
expect(el.elements.length, equals(2));
// Validate that the first item is still first.
- expect(el.elements[0] == span);
- expect(el.elements[1] is DivElement);
+ expect(el.elements[0], equals(span));
+ expect(el.elements[1], isDivElement);
});
test('documentFragment', () {
var fragment = new DocumentFragment();
fragment.addHTML('<span>something</span>');
expect(fragment.elements.length, equals(1));
- expect(fragment.elements[0] is SpanElement);
+ expect(fragment.elements[0], isSpanElement);
});
});
@@ -67,7 +71,7 @@
child.insertAdjacentElement('beforebegin', newChild);
expect(parent.elements.length, 2);
- expect(parent.elements[0] is SpanElement);
+ expect(parent.elements[0], isSpanElement);
});
test('afterend', () {
@@ -79,7 +83,7 @@
child.insertAdjacentElement('afterend', newChild);
expect(parent.elements.length, 2);
- expect(parent.elements[1] is SpanElement);
+ expect(parent.elements[1], isSpanElement);
});
test('afterbegin', () {
@@ -91,7 +95,7 @@
parent.insertAdjacentElement('afterbegin', newChild);
expect(parent.elements.length, 2);
- expect(parent.elements[0] is SpanElement);
+ expect(parent.elements[0], isSpanElement);
});
test('beforeend', () {
@@ -103,7 +107,7 @@
parent.insertAdjacentElement('beforeend', newChild);
expect(parent.elements.length, 2);
- expect(parent.elements[1] is SpanElement);
+ expect(parent.elements[1], isSpanElement);
});
});
@@ -116,7 +120,7 @@
child.insertAdjacentHTML('beforebegin', '<span></span>');
expect(parent.elements.length, 2);
- expect(parent.elements[0] is SpanElement);
+ expect(parent.elements[0], isSpanElement);
});
test('afterend', () {
@@ -127,7 +131,7 @@
child.insertAdjacentHTML('afterend', '<span></span>');
expect(parent.elements.length, 2);
- expect(parent.elements[1] is SpanElement);
+ expect(parent.elements[1], isSpanElement);
});
test('afterbegin', () {
@@ -138,7 +142,7 @@
parent.insertAdjacentHTML('afterbegin', '<span></span>');
expect(parent.elements.length, 2);
- expect(parent.elements[0] is SpanElement);
+ expect(parent.elements[0], isSpanElement);
});
test('beforeend', () {
@@ -149,7 +153,7 @@
parent.insertAdjacentHTML('beforeend', '<span></span>');
expect(parent.elements.length, 2);
- expect(parent.elements[1] is SpanElement);
+ expect(parent.elements[1], isSpanElement);
});
});
@@ -162,7 +166,7 @@
child.insertAdjacentText('beforebegin', 'test');
expect(parent.nodes.length, 2);
- expect(parent.nodes[0] is Text);
+ expect(parent.nodes[0], isText);
});
test('afterend', () {
@@ -173,7 +177,7 @@
child.insertAdjacentText('afterend', 'test');
expect(parent.nodes.length, 2);
- expect(parent.nodes[1] is Text);
+ expect(parent.nodes[1], isText);
});
test('afterbegin', () {
@@ -184,7 +188,7 @@
parent.insertAdjacentText('afterbegin', 'test');
expect(parent.nodes.length, 2);
- expect(parent.nodes[0] is Text);
+ expect(parent.nodes[0], isText);
});
test('beforeend', () {
@@ -195,7 +199,7 @@
parent.insertAdjacentText('beforeend', 'test');
expect(parent.nodes.length, 2);
- expect(parent.nodes[1] is Text);
+ expect(parent.nodes[1], isText);
});
});
}
diff --git a/tests/html/element_classes_test.dart b/tests/html/element_classes_test.dart
index 5dd611c..039e844 100644
--- a/tests/html/element_classes_test.dart
+++ b/tests/html/element_classes_test.dart
@@ -28,26 +28,26 @@
test('affects the "class" attribute', () {
final el = makeElementWithClasses();
el.classes.add('qux');
- Expect.setEquals(['foo', 'bar', 'baz', 'qux'], extractClasses(el));
+ expect(extractClasses(el), unorderedEquals(['foo', 'bar', 'baz', 'qux']));
});
test('is affected by the "class" attribute', () {
final el = makeElementWithClasses();
el.attributes['class'] = 'foo qux';
- Expect.setEquals(['foo', 'qux'], el.classes);
+ expect(el.classes, unorderedEquals(['foo', 'qux']));
});
test('classes=', () {
final el = makeElementWithClasses();
el.classes = ['foo', 'qux'];
- Expect.setEquals(['foo', 'qux'], el.classes);
- Expect.setEquals(['foo', 'qux'], extractClasses(el));
+ expect(el.classes, unorderedEquals(['foo', 'qux']));
+ expect(extractClasses(el), unorderedEquals(['foo', 'qux']));
});
test('toString', () {
- Expect.setEquals(['foo', 'bar', 'baz'],
- makeClassSet().toString().split(' '));
- Expect.equals('', makeElement().classes.toString());
+ expect(makeClassSet().toString().split(' '),
+ unorderedEquals(['foo', 'bar', 'baz']));
+ expect(makeElement().classes.toString(), '');
});
test('forEach', () {
@@ -55,7 +55,7 @@
// TODO: Change to this when Issue 3484 is fixed.
// makeClassSet().forEach(classes.add);
makeClassSet().forEach((c) => classes.add(c));
- Expect.setEquals(['foo', 'bar', 'baz'], classes);
+ expect(classes, unorderedEquals(['foo', 'bar', 'baz']));
});
test('iterator', () {
@@ -63,108 +63,106 @@
for (var el in makeClassSet()) {
classes.add(el);
}
- Expect.setEquals(['foo', 'bar', 'baz'], classes);
+ expect(classes, unorderedEquals(['foo', 'bar', 'baz']));
});
test('map', () {
- Expect.setEquals(['FOO', 'BAR', 'BAZ'],
- makeClassSet().map((c) => c.toUpperCase()));
+ expect(makeClassSet().map((c) => c.toUpperCase()),
+ unorderedEquals(['FOO', 'BAR', 'BAZ']));
});
test('filter', () {
- Expect.setEquals(['bar', 'baz'],
- makeClassSet().filter((c) => c.contains('a')));
+ expect(makeClassSet().filter((c) => c.contains('a')),
+ unorderedEquals(['bar', 'baz']));
});
test('every', () {
- Expect.isTrue(makeClassSet().every((c) => c is String));
- Expect.isFalse(
- makeClassSet().every((c) => c.contains('a')));
+ expect(makeClassSet().every((c) => c is String), isTrue);
+ expect(makeClassSet().every((c) => c.contains('a')), isFalse);
});
test('some', () {
- Expect.isTrue(
- makeClassSet().some((c) => c.contains('a')));
- Expect.isFalse(makeClassSet().some((c) => c is num));
+ expect(makeClassSet().some((c) => c.contains('a')), isTrue);
+ expect(makeClassSet().some((c) => c is num), isFalse);
});
test('isEmpty', () {
- Expect.isFalse(makeClassSet().isEmpty);
- Expect.isTrue(makeElement().classes.isEmpty);
+ expect(makeClassSet().isEmpty, isFalse);
+ expect(makeElement().classes.isEmpty, isTrue);
});
test('length', () {
- Expect.equals(3, makeClassSet().length);
- Expect.equals(0, makeElement().classes.length);
+ expect(makeClassSet().length, 3);
+ expect(makeElement().classes.length, 0);
});
test('contains', () {
- Expect.isTrue(makeClassSet().contains('foo'));
- Expect.isFalse(makeClassSet().contains('qux'));
+ expect(makeClassSet().contains('foo'), isTrue);
+ expect(makeClassSet().contains('qux'), isFalse);
});
test('add', () {
final classes = makeClassSet();
classes.add('qux');
- Expect.setEquals(['foo', 'bar', 'baz', 'qux'], classes);
+ expect(classes, unorderedEquals(['foo', 'bar', 'baz', 'qux']));
classes.add('qux');
final list = new List.from(classes);
list.sort((a, b) => a.compareTo(b));
- Expect.listEquals(['bar', 'baz', 'foo', 'qux'], list,
- "The class set shouldn't have duplicate elements.");
+ expect(list, unorderedEquals(['bar', 'baz', 'foo', 'qux']),
+ reason: "The class set shouldn't have duplicate elements.");
});
test('remove', () {
final classes = makeClassSet();
classes.remove('bar');
- Expect.setEquals(['foo', 'baz'], classes);
+ expect(classes, unorderedEquals(['foo', 'baz']));
classes.remove('qux');
- Expect.setEquals(['foo', 'baz'], classes);
+ expect(classes, unorderedEquals(['foo', 'baz']));
});
test('toggle', () {
final classes = makeClassSet();
classes.toggle('bar');
- Expect.setEquals(['foo', 'baz'], classes);
+ expect(classes, unorderedEquals(['foo', 'baz']));
classes.toggle('qux');
- Expect.setEquals(['foo', 'baz', 'qux'], classes);
+ expect(classes, unorderedEquals(['foo', 'baz', 'qux']));
});
test('addAll', () {
final classes = makeClassSet();
classes.addAll(['bar', 'qux', 'bip']);
- Expect.setEquals(['foo', 'bar', 'baz', 'qux', 'bip'], classes);
+ expect(classes, unorderedEquals(['foo', 'bar', 'baz', 'qux', 'bip']));
});
test('removeAll', () {
final classes = makeClassSet();
classes.removeAll(['bar', 'baz', 'qux']);
- Expect.setEquals(['foo'], classes);
+ expect(classes, unorderedEquals(['foo']));
});
test('isSubsetOf', () {
final classes = makeClassSet();
- Expect.isTrue(classes.isSubsetOf(['foo', 'bar', 'baz']));
- Expect.isTrue(classes.isSubsetOf(['foo', 'bar', 'baz', 'qux']));
- Expect.isFalse(classes.isSubsetOf(['foo', 'bar', 'qux']));
+ expect(classes.isSubsetOf(['foo', 'bar', 'baz']), isTrue);
+ expect(classes.isSubsetOf(['foo', 'bar', 'baz', 'qux']), isTrue);
+ expect(classes.isSubsetOf(['foo', 'bar', 'qux']), isFalse);
});
test('containsAll', () {
final classes = makeClassSet();
- Expect.isTrue(classes.containsAll(['foo', 'baz']));
- Expect.isFalse(classes.containsAll(['foo', 'qux']));
+ expect(classes.containsAll(['foo', 'baz']), isTrue);
+ expect(classes.containsAll(['foo', 'qux']), isFalse);
});
test('intersection', () {
final classes = makeClassSet();
- Expect.setEquals(['foo', 'baz'],
- classes.intersection(['foo', 'qux', 'baz']));
+ expect(classes.intersection(['foo', 'qux', 'baz']),
+ unorderedEquals(['foo', 'baz']));
});
test('clear', () {
final classes = makeClassSet();
classes.clear();
- Expect.setEquals([], classes);
+ expect(classes, equals([]));
});
}
diff --git a/tests/html/element_constructor_1_test.dart b/tests/html/element_constructor_1_test.dart
index cf4e43f..57f9439 100644
--- a/tests/html/element_constructor_1_test.dart
+++ b/tests/html/element_constructor_1_test.dart
@@ -14,53 +14,66 @@
main() {
useHtmlConfiguration();
+ var isAnchorElement =
+ predicate((x) => x is AnchorElement, 'is an AnchorElement');
+ var isAreaElement =
+ predicate((x) => x is AreaElement, 'is an AreaElement');
+ var isDivElement = predicate((x) => x is DivElement, 'is a DivElement');
+ var isCanvasElement =
+ predicate((x) => x is CanvasElement, 'is a CanvasElement');
+ var isParagraphElement =
+ predicate((x) => x is ParagraphElement, 'is a ParagraphElement');
+ var isSpanElement = predicate((x) => x is SpanElement, 'is a SpanElement');
+ var isSelectElement =
+ predicate((x) => x is SelectElement, 'is a SelectElement');
+
test('anchor1', () {
var e = new AnchorElement();
- Expect.isTrue(e is AnchorElement);
+ expect(e, isAnchorElement);
});
test('anchor2', () {
var e = new AnchorElement(href: '#blah');
- Expect.isTrue(e is AnchorElement);
- Expect.isTrue(e.href.endsWith('#blah'));
+ expect(e, isAnchorElement);
+ expect(e.href, endsWith('#blah'));
});
test('area', () {
var e = new AreaElement();
- Expect.isTrue(e is AreaElement);
+ expect(e, isAreaElement);
});
// AudioElement tested in audioelement_test.dart
test('div', () {
var e = new DivElement();
- Expect.isTrue(e is DivElement);
+ expect(e, isDivElement);
});
test('canvas1', () {
var e = new CanvasElement();
- Expect.isTrue(e is CanvasElement);
+ expect(e, isCanvasElement);
});
test('canvas2', () {
var e = new CanvasElement(height: 100, width: 200);
- Expect.isTrue(e is CanvasElement);
- Expect.equals(200, e.width);
- Expect.equals(100, e.height);
+ expect(e, isCanvasElement);
+ expect(e.width, 200);
+ expect(e.height, 100);
});
test('p', () {
var e = new ParagraphElement();
- Expect.isTrue(e is ParagraphElement);
+ expect(e, isParagraphElement);
});
test('span', () {
var e = new SpanElement();
- Expect.isTrue(e is SpanElement);
+ expect(e, isSpanElement);
});
test('select', () {
var e = new SelectElement();
- Expect.isTrue(e is SelectElement);
+ expect(e, isSelectElement);
});
}
diff --git a/tests/html/element_test.dart b/tests/html/element_test.dart
index 511eef7..66968b2 100644
--- a/tests/html/element_test.dart
+++ b/tests/html/element_test.dart
@@ -8,12 +8,12 @@
#import('dart:html');
expectLargeRect(ClientRect rect) {
- Expect.equals(rect.top, 0);
- Expect.equals(rect.left, 0);
- Expect.isTrue(rect.width > 100);
- Expect.isTrue(rect.height > 100);
- Expect.equals(rect.bottom, rect.top + rect.height);
- Expect.equals(rect.right, rect.left + rect.width);
+ expect(rect.top, 0);
+ expect(rect.left, 0);
+ expect(rect.width, greaterThan(100));
+ expect(rect.height, greaterThan(100));
+ expect(rect.bottom, rect.top + rect.height);
+ expect(rect.right, rect.left + rect.width);
}
void testEventHelper(EventListenerList listenerList, String type,
@@ -38,23 +38,37 @@
listenerList.dispatch(event);
}
- Expect.isTrue(firedWhenAddedToListenerList);
+ expect(firedWhenAddedToListenerList, isTrue);
if (registerOnEventListener != null) {
- Expect.isTrue(firedOnEvent);
+ expect(firedOnEvent, isTrue);
}
}
void testConstructorHelper(String tag, String htmlSnippet,
String expectedText, Function isExpectedClass) {
- Expect.isTrue(isExpectedClass(new Element.tag(tag)));
+ expect(isExpectedClass(new Element.tag(tag)), isTrue);
final elementFromSnippet = new Element.html(htmlSnippet);
- Expect.isTrue(isExpectedClass(elementFromSnippet));
- Expect.equals(expectedText, elementFromSnippet.text);
+ expect(isExpectedClass(elementFromSnippet), isTrue);
+ expect(elementFromSnippet.text, expectedText);
}
main() {
useHtmlConfiguration();
+ var isHRElement = predicate((x) => x is HRElement, 'is a HRElement');
+ var isBRElement = predicate((x) => x is BRElement, 'is a BRElement');
+ var isInputElement =
+ predicate((x) => x is InputElement, 'is an InputElement');
+ var isImageElement =
+ predicate((x) => x is ImageElement, 'is an ImageElement');
+ var isSpanElement = predicate((x) => x is SpanElement, 'is a SpanElement');
+ var isAnchorElement =
+ predicate((x) => x is AnchorElement, 'is an AnchorElement');
+ var isElementList =
+ predicate((x) => x is List<Element>, 'is a List<Element>');
+ var isHeadingElement =
+ predicate((x) => x is HeadingElement, 'is a HeadingElement');
+
Element makeElement() => new Element.tag('div');
Element makeElementWithChildren() =>
@@ -63,7 +77,7 @@
test('computedStyle', () {
final element = document.body;
element.computedStyle.then(expectAsync1((style) {
- Expect.equals(style.getPropertyValue('left'), 'auto');
+ expect(style.getPropertyValue('left'), 'auto');
}));
});
@@ -113,12 +127,11 @@
group('constructors', () {
test('error', () {
- Expect.throws(() => new Element.html('<br/><br/>'),
- (e) => e is ArgumentError);
+ expect(() => new Element.html('<br/><br/>'), throwsArgumentError);
});
test('.html has no parent', () =>
- Expect.isNull(new Element.html('<br/>').parent));
+ expect(new Element.html('<br/>').parent, isNull));
test('a', () => testConstructorHelper('a', '<a>foo</a>', 'foo',
(element) => element is AnchorElement));
@@ -434,136 +447,136 @@
data-foo2="bar2" dir="rtl">
</div>''');
final attributes = element.attributes;
- Expect.equals(attributes['class'], 'foo');
- Expect.equals(attributes['style'], 'overflow: hidden');
- Expect.equals(attributes['data-foo'], 'bar');
- Expect.equals(attributes['data-foo2'], 'bar2');
- Expect.equals(attributes.length, 5);
- Expect.equals(element.dataAttributes.length, 2);
+ expect(attributes['class'], 'foo');
+ expect(attributes['style'], 'overflow: hidden');
+ expect(attributes['data-foo'], 'bar');
+ expect(attributes['data-foo2'], 'bar2');
+ expect(attributes.length, 5);
+ expect(element.dataAttributes.length, 2);
element.dataAttributes['foo'] = 'baz';
- Expect.equals(element.dataAttributes['foo'], 'baz');
- Expect.equals(attributes['data-foo'], 'baz');
+ expect(element.dataAttributes['foo'], 'baz');
+ expect(attributes['data-foo'], 'baz');
attributes['data-foo2'] = 'baz2';
- Expect.equals(attributes['data-foo2'], 'baz2');
- Expect.equals(element.dataAttributes['foo2'], 'baz2');
- Expect.equals(attributes['dir'], 'rtl');
+ expect(attributes['data-foo2'], 'baz2');
+ expect(element.dataAttributes['foo2'], 'baz2');
+ expect(attributes['dir'], 'rtl');
final dataAttributes = element.dataAttributes;
dataAttributes.remove('foo2');
- Expect.equals(attributes.length, 4);
- Expect.equals(dataAttributes.length, 1);
+ expect(attributes.length, 4);
+ expect(dataAttributes.length, 1);
attributes.remove('style');
- Expect.equals(attributes.length, 3);
+ expect(attributes.length, 3);
dataAttributes['foo3'] = 'baz3';
- Expect.equals(dataAttributes.length, 2);
- Expect.equals(attributes.length, 4);
+ expect(dataAttributes.length, 2);
+ expect(attributes.length, 4);
attributes['style'] = 'width: 300px;';
- Expect.equals(attributes.length, 5);
+ expect(attributes.length, 5);
});
test('coercion', () {
final element = new Element.tag('div');
element.attributes['foo'] = 42;
element.attributes['bar'] = 3.1;
- Expect.equals(element.attributes['foo'], '42');
- Expect.equals(element.attributes['bar'], '3.1');
+ expect(element.attributes['foo'], '42');
+ expect(element.attributes['bar'], '3.1');
});
});
group('elements', () {
test('is a subset of nodes', () {
var el = new Element.html("<div>Foo<br/><img/></div>");
- Expect.equals(3, el.nodes.length);
- Expect.equals(2, el.elements.length);
- Expect.equals(el.nodes[1], el.elements[0]);
- Expect.equals(el.nodes[2], el.elements[1]);
+ expect(el.nodes.length, 3);
+ expect(el.elements.length, 2);
+ expect(el.nodes[1], el.elements[0]);
+ expect(el.nodes[2], el.elements[1]);
});
test('changes when an element is added to nodes', () {
var el = new Element.html("<div>Foo<br/><img/></div>");
el.nodes.add(new Element.tag('hr'));
- Expect.equals(3, el.elements.length);
- Expect.isTrue(el.elements[2] is HRElement);
- Expect.equals(el.nodes[3], el.elements[2]);
+ expect(el.elements.length, 3);
+ expect(el.elements[2], isHRElement);
+ expect(el.nodes[3], el.elements[2]);
});
test('changes nodes when an element is added', () {
var el = new Element.html("<div>Foo<br/><img/></div>");
el.elements.add(new Element.tag('hr'));
- Expect.equals(4, el.nodes.length);
- Expect.isTrue(el.nodes[3] is HRElement);
- Expect.equals(el.elements[2], el.nodes[3]);
+ expect(el.nodes.length, 4);
+ expect(el.nodes[3], isHRElement);
+ expect(el.elements[2], el.nodes[3]);
});
test('last', () {
var el = makeElementWithChildren();
- Expect.isTrue(el.elements.last is InputElement);
+ expect(el.elements.last, isInputElement);
});
test('forEach', () {
var els = [];
var el = makeElementWithChildren();
el.elements.forEach((n) => els.add(n));
- Expect.isTrue(els[0] is BRElement);
- Expect.isTrue(els[1] is ImageElement);
- Expect.isTrue(els[2] is InputElement);
+ expect(els[0], isBRElement);
+ expect(els[1], isImageElement);
+ expect(els[2], isInputElement);
});
test('filter', () {
var filtered = makeElementWithChildren().elements.
filter((n) => n is ImageElement);
- Expect.equals(1, filtered.length);
- Expect.isTrue(filtered[0] is ImageElement);
- Expect.isTrue(filtered is List<Element>);
+ expect(1, filtered.length);
+ expect(filtered[0], isImageElement);
+ expect(filtered, isElementList);
});
test('every', () {
var el = makeElementWithChildren();
- Expect.isTrue(el.elements.every((n) => n is Element));
- Expect.isFalse(el.elements.every((n) => n is InputElement));
+ expect(el.elements.every((n) => n is Element), isTrue);
+ expect(el.elements.every((n) => n is InputElement), isFalse);
});
test('some', () {
var el = makeElementWithChildren();
- Expect.isTrue(el.elements.some((n) => n is InputElement));
- Expect.isFalse(el.elements.some((n) => n is SVGElement));
+ expect(el.elements.some((n) => n is InputElement), isTrue);
+ expect(el.elements.some((n) => n is SVGElement), isFalse);
});
test('isEmpty', () {
- Expect.isTrue(makeElement().elements.isEmpty);
- Expect.isFalse(makeElementWithChildren().elements.isEmpty);
+ expect(makeElement().elements.isEmpty, isTrue);
+ expect(makeElementWithChildren().elements.isEmpty, isFalse);
});
test('length', () {
- Expect.equals(0, makeElement().elements.length);
- Expect.equals(3, makeElementWithChildren().elements.length);
+ expect(makeElement().elements.length, 0);
+ expect(makeElementWithChildren().elements.length, 3);
});
test('[]', () {
var el = makeElementWithChildren();
- Expect.isTrue(el.elements[0] is BRElement);
- Expect.isTrue(el.elements[1] is ImageElement);
- Expect.isTrue(el.elements[2] is InputElement);
+ expect(el.elements[0], isBRElement);
+ expect(el.elements[1], isImageElement);
+ expect(el.elements[2], isInputElement);
});
test('[]=', () {
var el = makeElementWithChildren();
el.elements[1] = new Element.tag('hr');
- Expect.isTrue(el.elements[0] is BRElement);
- Expect.isTrue(el.elements[1] is HRElement);
- Expect.isTrue(el.elements[2] is InputElement);
+ expect(el.elements[0], isBRElement);
+ expect(el.elements[1], isHRElement);
+ expect(el.elements[2], isInputElement);
});
test('add', () {
var el = makeElement();
el.elements.add(new Element.tag('hr'));
- Expect.isTrue(el.elements.last is HRElement);
+ expect(el.elements.last, isHRElement);
});
test('addLast', () {
var el = makeElement();
el.elements.addLast(new Element.tag('hr'));
- Expect.isTrue(el.elements.last is HRElement);
+ expect(el.elements.last, isHRElement);
});
test('iterator', () {
@@ -572,9 +585,9 @@
for (var subel in el.elements) {
els.add(subel);
}
- Expect.isTrue(els[0] is BRElement);
- Expect.isTrue(els[1] is ImageElement);
- Expect.isTrue(els[2] is InputElement);
+ expect(els[0], isBRElement);
+ expect(els[1], isImageElement);
+ expect(els[2], isInputElement);
});
test('addAll', () {
@@ -584,31 +597,31 @@
new Element.tag('a'),
new Element.tag('h1')
]);
- Expect.isTrue(el.elements[0] is BRElement);
- Expect.isTrue(el.elements[1] is ImageElement);
- Expect.isTrue(el.elements[2] is InputElement);
- Expect.isTrue(el.elements[3] is SpanElement);
- Expect.isTrue(el.elements[4] is AnchorElement);
- Expect.isTrue(el.elements[5] is HeadingElement);
+ expect(el.elements[0], isBRElement);
+ expect(el.elements[1], isImageElement);
+ expect(el.elements[2], isInputElement);
+ expect(el.elements[3], isSpanElement);
+ expect(el.elements[4], isAnchorElement);
+ expect(el.elements[5], isHeadingElement);
});
test('clear', () {
var el = makeElementWithChildren();
el.elements.clear();
- Expect.listEquals([], el.elements);
+ expect(el.elements, equals([]));
});
test('removeLast', () {
var el = makeElementWithChildren();
- Expect.isTrue(el.elements.removeLast() is InputElement);
- Expect.equals(2, el.elements.length);
- Expect.isTrue(el.elements.removeLast() is ImageElement);
- Expect.equals(1, el.elements.length);
+ expect(el.elements.removeLast(), isInputElement);
+ expect(el.elements.length, 2);
+ expect(el.elements.removeLast(), isImageElement);
+ expect(el.elements.length, 1);
});
test('getRange', () {
var el = makeElementWithChildren();
- Expect.isTrue(el.elements.getRange(1, 1) is List<Element>);
+ expect(el.elements.getRange(1, 1), isElementList);
});
});
@@ -631,61 +644,61 @@
void testUnsupported(String name, void f()) {
test(name, () {
- Expect.throws(f, (e) => e is UnsupportedError);
+ expect(f, throwsUnsupportedError);
});
}
test('last', () {
- Expect.isTrue(getQueryAll().last is HRElement);
+ expect(getQueryAll().last, isHRElement);
});
test('forEach', () {
var els = [];
getQueryAll().forEach((el) => els.add(el));
- Expect.isTrue(els[0] is AnchorElement);
- Expect.isTrue(els[1] is SpanElement);
- Expect.isTrue(els[2] is HRElement);
+ expect(els[0], isAnchorElement);
+ expect(els[1], isSpanElement);
+ expect(els[2], isHRElement);
});
test('map', () {
var texts = getQueryAll().map((el) => el.text);
- Expect.listEquals(['Dart!', 'Hello', ''], texts);
+ expect(texts, equals(['Dart!', 'Hello', '']));
});
test('filter', () {
var filtered = getQueryAll().filter((n) => n is SpanElement);
- Expect.equals(1, filtered.length);
- Expect.isTrue(filtered[0] is SpanElement);
- Expect.isTrue(filtered is List<Element>);
+ expect(filtered.length, 1);
+ expect(filtered[0], isSpanElement);
+ expect(filtered, isElementList);
});
test('every', () {
var el = getQueryAll();
- Expect.isTrue(el.every((n) => n is Element));
- Expect.isFalse(el.every((n) => n is SpanElement));
+ expect(el.every((n) => n is Element), isTrue);
+ expect(el.every((n) => n is SpanElement), isFalse);
});
test('some', () {
var el = getQueryAll();
- Expect.isTrue(el.some((n) => n is SpanElement));
- Expect.isFalse(el.some((n) => n is SVGElement));
+ expect(el.some((n) => n is SpanElement), isTrue);
+ expect(el.some((n) => n is SVGElement), isFalse);
});
test('isEmpty', () {
- Expect.isTrue(getEmptyQueryAll().isEmpty);
- Expect.isFalse(getQueryAll().isEmpty);
+ expect(getEmptyQueryAll().isEmpty, isTrue);
+ expect(getQueryAll().isEmpty, isFalse);
});
test('length', () {
- Expect.equals(0, getEmptyQueryAll().length);
- Expect.equals(3, getQueryAll().length);
+ expect(getEmptyQueryAll().length, 0);
+ expect(getQueryAll().length, 3);
});
test('[]', () {
var els = getQueryAll();
- Expect.isTrue(els[0] is AnchorElement);
- Expect.isTrue(els[1] is SpanElement);
- Expect.isTrue(els[2] is HRElement);
+ expect(els[0], isAnchorElement);
+ expect(els[1], isSpanElement);
+ expect(els[2], isHRElement);
});
test('iterator', () {
@@ -693,13 +706,13 @@
for (var subel in getQueryAll()) {
els.add(subel);
}
- Expect.isTrue(els[0] is AnchorElement);
- Expect.isTrue(els[1] is SpanElement);
- Expect.isTrue(els[2] is HRElement);
+ expect(els[0], isAnchorElement);
+ expect(els[1], isSpanElement);
+ expect(els[2], isHRElement);
});
test('getRange', () {
- Expect.isTrue(getQueryAll().getRange(1, 1) is List<Element>);
+ expect(getQueryAll().getRange(1, 1) is List<Element>, isTrue);
});
testUnsupported('[]=', () => getQueryAll()[1] = new Element.tag('br'));
@@ -733,16 +746,16 @@
test('filter', () {
var filtered = makeElList().filter((n) => n is ImageElement);
- Expect.equals(1, filtered.length);
- Expect.isTrue(filtered[0] is ImageElement);
- Expect.isTrue(filtered is List<Element>);
+ expect(filtered.length, 1);
+ expect(filtered[0], isImageElement);
+ expect(filtered, isElementList);
});
test('getRange', () {
var range = makeElList().getRange(1, 2);
- Expect.isTrue(range is List<Element>);
- Expect.isTrue(range[0] is ImageElement);
- Expect.isTrue(range[1] is InputElement);
+ expect(range, isElementList);
+ expect(range[0], isImageElement);
+ expect(range[1], isInputElement);
});
});
}
diff --git a/tests/html/element_webkit_test.dart b/tests/html/element_webkit_test.dart
index dc1e637..64f5c7e 100644
--- a/tests/html/element_webkit_test.dart
+++ b/tests/html/element_webkit_test.dart
@@ -37,9 +37,9 @@
final event = new Event(type);
listenerList.dispatch(event);
- Expect.isTrue(firedWhenAddedToListenerList);
+ expect(firedWhenAddedToListenerList, isTrue);
if (registerOnEventListener != null) {
- Expect.isTrue(firedOnEvent);
+ expect(firedOnEvent, isTrue);
}
}
diff --git a/tests/html/event_customevent_test.dart b/tests/html/event_customevent_test.dart
index 348ed16..f7e789a 100644
--- a/tests/html/event_customevent_test.dart
+++ b/tests/html/event_customevent_test.dart
@@ -19,7 +19,7 @@
validate(ev);
});
el.on[type].dispatch(eventFn());
- expect(fired, isTrue, 'Expected event to be dispatched.');
+ expect(fired, isTrue, reason: 'Expected event to be dispatched.');
});
}
diff --git a/tests/html/event_test.dart b/tests/html/event_test.dart
index 370ced2..7484432 100644
--- a/tests/html/event_test.dart
+++ b/tests/html/event_test.dart
@@ -19,7 +19,7 @@
validate(ev);
});
el.on[type].dispatch(eventFn());
- Expect.isTrue(fired, 'Expected event to be dispatched.');
+ expect(fired, isTrue, reason: 'Expected event to be dispatched.');
});
}
@@ -29,33 +29,33 @@
// Issue 1005.
// eventTest('AnimationEvent', () => new AnimationEvent('foo', 'color', 0.5),
// (ev) {
- // Expect.equals('color', ev.animationName);
- // Expect.equals(0.5, ev.elapsedTime);
+ // expect(ev.animationName, 'color');
+ // expect(ev.elapsedTime, 0.5);
// });
// Issue 1005.
// eventTest('BeforeLoadEvent',
// () => new BeforeLoadEvent('foo', 'http://example.url'),
- // (ev) { Expect.equals('http://example.url', ev.url); });
+ // (ev) { expect(ev.url, 'http://example.url'); });
// Issue 1005.
// eventTest('CloseEvent',
// () => new CloseEvent('foo', 5, 'reason', wasClean: true),
// (ev) {
- // Expect.equals(5, ev.code);
- // Expect.equals('reason', ev.reason);
- // Expect.isTrue(ev.wasClean);
+ // expect(ev.code, 5);
+ // expect(ev.reason, 'reason');
+ // expect(ev.wasClean, isTrue);
// });
eventTest('CompositionEvent',
() => new CompositionEvent('compositionstart', window, 'data'),
- (ev) { Expect.equals('data', ev.data); },
+ (ev) { expect(ev.data, 'data'); },
type: 'compositionstart');
// initCustomEvent is not yet implemented
// eventTest('CustomEvent',
// () => new CustomEvent('foo', false, false, 'detail'),
- // (ev) { Expect.equals('detail', ev.detail); });
+ // (ev) { expect(ev.detail, 'detail'); });
// DeviceMotionEvent has no properties to itself, so just test that it doesn't
// error out on creation and can be dispatched.
@@ -65,46 +65,46 @@
// eventTest('DeviceOrientationEvent',
// () => new DeviceOrientationEvent('foo', 0.1, 0.2, 0.3),
// (ev) {
- // Expect.equals(0.1, ev.alpha);
- // Expect.equals(0.2, ev.beta);
- // Expect.equals(0.3, ev.gamma);
+ // expect(ev.alpha, 0.1);
+ // expect(ev.beta, 0.2);
+ // expect(ev.gamma, 0.3);
// });
// Issue 1005.
// eventTest('ErrorEvent',
// () => new ErrorEvent('foo', 'message', 'filename', 10),
// (ev) {
- // Expect.equals('message', ev.message);
- // Expect.equals('filename', ev.filename);
- // Expect.equals(10, ev.lineno);
+ // expect('message', ev.message);
+ // expect('filename', ev.filename);
+ // expect(ev.lineno, 10);
// });
eventTest('Event',
() => new Event('foo', canBubble: false, cancelable: false),
(ev) {
- Expect.equals('foo', ev.type);
- Expect.isFalse(ev.bubbles);
- Expect.isFalse(ev.cancelable);
+ expect(ev.type, equals('foo'));
+ expect(ev.bubbles, isFalse);
+ expect(ev.cancelable, isFalse);
});
eventTest('HashChangeEvent',
() => new HashChangeEvent('foo', 'http://old.url', 'http://new.url'),
(ev) {
- Expect.equals('http://old.url', ev.oldURL);
- Expect.equals('http://new.url', ev.newURL);
+ expect(ev.oldURL, equals('http//old.url'));
+ expect(ev.newURL, equals('http://new.url'));
});
eventTest('KeyboardEvent',
() => new KeyboardEvent('foo', window, 'key', 10, ctrlKey: true,
altKey: true, shiftKey: true, metaKey: true, altGraphKey: true),
(ev) {
- Expect.equals('key', ev.keyIdentifier);
- Expect.equals(10, ev.keyLocation);
- Expect.isTrue(ev.ctrlKey);
- Expect.isTrue(ev.altKey);
- Expect.isTrue(ev.shiftKey);
- Expect.isTrue(ev.metaKey);
- Expect.isTrue(ev.altGraphKey);
+ expect.equals(ev.keyIdentifier, equals('key'));
+ expect.equals(ev.keyLocation, equals(10));
+ expect(ev.ctrlKey, isTrue);
+ expect(ev.altKey, isTrue);
+ expect(ev.shiftKey, isTrue);
+ expect(ev.metaKey, isTrue);
+ expect(ev.altGraphKey, isTrue);
});
eventTest('MouseEvent',
@@ -114,30 +114,30 @@
cancelable: true, ctrlKey: true, altKey: true, shiftKey: true,
metaKey: true, relatedTarget: new Element.tag('div')),
(ev) {
- Expect.equals(1, ev.detail);
- Expect.equals(2, ev.screenX);
- Expect.equals(3, ev.screenY);
- Expect.equals(4, ev.clientX);
- Expect.equals(5, ev.clientY);
- Expect.equals(4, ev.offsetX); // Same as clientX.
- Expect.equals(5, ev.offsetY); // Same as clientY.
- Expect.equals(6, ev.button);
- Expect.isTrue(ev.ctrlKey);
- Expect.isTrue(ev.altKey);
- Expect.isTrue(ev.shiftKey);
- Expect.isTrue(ev.metaKey);
- Expect.equals('DIV', ev.relatedTarget.tagName);
+ expect(ev.detail, 1);
+ expect(ev.screenX, 2);
+ expect(ev.screenYi, 3);
+ expect(ev.clientX, 4);
+ expect(ev.clientY, 5);
+ expect(ev.offsetX, 4); // Same as clientX.
+ expect(ev.offsetY, 5); // Same as clientY.
+ expect(ev.button, 6);
+ expect(ev.ctrlKey, isTrue);
+ expect(ev.altKey, isTrue);
+ expect(ev.shiftKey, isTrue);
+ expect(ev.metaKey, isTrue);
+ expect(ev.relatedTarget.tagName, 'DIV');
});
eventTest('MutationEvent',
() => new MutationEvent('foo', new Element.tag('div'), 'red', 'blue',
'color', MutationEvent.MODIFICATION),
(ev) {
- Expect.equals('DIV', ev.relatedNode.tagName);
- Expect.equals('red', ev.prevValue);
- Expect.equals('blue', ev.newValue);
- Expect.equals('color', ev.attrName);
- Expect.equals(MutationEvent.MODIFICATION, ev.attrChange);
+ expect(ev.relatedNode.tagName, 'DIV');
+ expect.equals(ev.prevValue, 'red');
+ expect.equals(ev.newValue, 'blue');
+ expect.equals(ev.attrName, 'color');
+ expect.equals(ev.attrChange, equals(MutationEvent.MODIFICATION));
});
test('DOMMutationEvent', () {
@@ -150,19 +150,19 @@
// eventTest('OverflowEvent',
// () => new OverflowEvent(OverflowEvent.BOTH, true, true),
// (ev) {
- // Expect.equals(OverflowEvent.BOTH, ev.orient);
- // Expect.isTrue(ev.horizontalOverflow);
- // Expect.isTrue(ev.verticalOverflow);
+ // expect(ev.orient, OverflowEvent.BOTH);
+ // expect(ev.horizontalOverflow, isTrue);
+ // expect(ev.verticalOverflow, isTrue);
// }, type: 'overflowchanged');
// Issue 1005.
// eventTest('PageTransitionEvent',
// () => new PageTransitionEvent('foo', persisted: true),
- // (ev) { Expect.isTrue(ev.persisted); });
+ // (ev) { expect(ev.persisted, isTrue); });
// initPopStateEvent is not yet implemented
// eventTest('PopStateEvent', () => new PopStateEvent('foo', 'state'),
- // (ev) { Expect.equals('state', ev.state); }
+ // (ev) { expect(ev.state, 'state'); }
// Issue 1005.
// eventTest('ProgressEvent',
@@ -171,9 +171,9 @@
// () => new ProgressEvent('foo', 5, canBubble: true, cancelable: true,
// lengthComputable: true, total: 10),
// (ev) {
- // Expect.equals(5, ev.loaded);
- // Expect.isTrue(ev.lengthComputable);
- // Expect.equals(10, ev.total);
+ // expect(ev.loaded, 5);
+ // expect(ev.lengthComputable, isTrue);
+ // expect(ev.total, 10);
// });
eventTest('StorageEvent',
@@ -181,28 +181,28 @@
window.localStorage, canBubble: true, cancelable: true,
oldValue: 'old', newValue: 'new'),
(ev) {
- Expect.equals('key', ev.key);
- Expect.equals('http://example.url', ev.url);
+ expect(ev.key, 'key');
+ expect(ev.url, 'http://example.url');
// Equality isn't preserved for storageArea
- Expect.isNotNull(ev.storageArea);
- Expect.equals('old', ev.oldValue);
- Expect.equals('new', ev.newValue);
+ expect.isNotNull(ev.storageArea);
+ expect(ev.oldValue, 'old');
+ expect(ev.newValue, 'new');
});
eventTest('TextEvent', () => new TextEvent('foo', window, 'data'),
- (ev) { Expect.equals('data', ev.data); });
+ (ev) { expect(ev.data, 'data'); });
// Issue 1005.
// eventTest('TransitionEvent', () => new TransitionEvent('foo', 'color', 0.5),
// (ev) {
- // Expect.equals('color', ev.propertyName);
- // Expect.equals(0.5, ev.elapsedTime);
+ // expect(ev.propertyName, 'color');
+ // expect(ev.elapsedTime, 0.5);
// });
eventTest('UIEvent', () => new UIEvent('foo', window, 12),
(ev) {
- Expect.equals(window, ev.view);
- Expect.equals(12, ev.detail);
+ expect(window, ev.view, window);
+ expect(12, ev.detail, 12);
});
eventTest('WheelEvent',
@@ -210,16 +210,16 @@
altKey: true, shiftKey: true, metaKey: true),
(ev) {
// wheelDelta* properties are multiplied by 120 for some reason
- Expect.equals(120, ev.wheelDeltaX);
- Expect.equals(240, ev.wheelDeltaY);
- Expect.equals(3, ev.screenX);
- Expect.equals(4, ev.screenY);
- Expect.equals(5, ev.clientX);
- Expect.equals(6, ev.clientY);
- Expect.isTrue(ev.ctrlKey);
- Expect.isTrue(ev.altKey);
- Expect.isTrue(ev.shiftKey);
- Expect.isTrue(ev.metaKey);
+ expect(ev.wheelDeltaX, 120);
+ expect(ev.wheelDeltaY, 240);
+ expect(ev.screenX, 3);
+ expect(ev.screenY, 4);
+ expect(ev.clientX, 5);
+ expect(ev.clientY, 6);
+ expect(ev.ctrlKey, isTrue);
+ expect(ev.altKey, isTrue);
+ expect(ev.shiftKey, isTrue);
+ expect(ev.metaKey, isTrue);
}, type: 'mousewheel');
// HttpRequestProgressEvent has no properties to itself, so just test that
diff --git a/tests/html/events_test.dart b/tests/html/events_test.dart
index 0657de0..62fbb7e 100644
--- a/tests/html/events_test.dart
+++ b/tests/html/events_test.dart
@@ -9,7 +9,7 @@
Event event = new Event('test');
int timeStamp = event.timeStamp;
- Expect.isTrue(timeStamp > 0);
+ expect(timeStamp, greaterThan(0));
});
// The next test is not asynchronous because [on['test'].dispatch(event)] fires the event
// and event listener synchronously.
@@ -20,9 +20,9 @@
int invocationCounter = 0;
void handler(Event e) {
- Expect.equals('test', e.type);
+ expect(e.type, equals('test'));
Element target = e.target;
- Expect.identical(element, target);
+ expect(element, equals(target));
invocationCounter++;
}
@@ -30,27 +30,27 @@
invocationCounter = 0;
element.on['test'].dispatch(event);
- Expect.equals(0, invocationCounter);
+ expect(invocationCounter, isZero);
element.on['test'].add(handler, false);
invocationCounter = 0;
element.on['test'].dispatch(event);
- Expect.equals(1, invocationCounter);
+ expect(invocationCounter, 1);
element.on['test'].remove(handler, false);
invocationCounter = 0;
element.on['test'].dispatch(event);
- Expect.equals(0, invocationCounter);
+ expect(invocationCounter, isZero);
element.on['test'].add(handler, false);
invocationCounter = 0;
element.on['test'].dispatch(event);
- Expect.equals(1, invocationCounter);
+ expect(invocationCounter, 1);
element.on['test'].add(handler, false);
invocationCounter = 0;
element.on['test'].dispatch(event);
- Expect.equals(1, invocationCounter);
+ expect(invocationCounter, 1);
});
test('InitMouseEvent', () {
DivElement div = new Element.tag('div');
diff --git a/tests/html/exceptions_test.dart b/tests/html/exceptions_test.dart
index 984a3d0..2895d02 100644
--- a/tests/html/exceptions_test.dart
+++ b/tests/html/exceptions_test.dart
@@ -9,9 +9,9 @@
try {
window.webkitNotifications.createNotification('', '', '');
} on DOMException catch (e) {
- Expect.equals(DOMException.SECURITY_ERR, e.code);
- Expect.equals('SECURITY_ERR', e.name);
- Expect.equals('SECURITY_ERR: DOM Exception 18', e.message);
+ expect(e.code, DOMException.SECURITY_ERR);
+ expect(e.name, 'SECURITY_ERR');
+ expect(e.message, 'SECURITY_ERR: DOM Exception 18');
}
});
test('EventException', () {
@@ -20,9 +20,9 @@
try {
document.$dom_dispatchEvent(event);
} on EventException catch (e) {
- Expect.equals(EventException.UNSPECIFIED_EVENT_TYPE_ERR, e.code);
- Expect.equals('UNSPECIFIED_EVENT_TYPE_ERR', e.name);
- Expect.equals('UNSPECIFIED_EVENT_TYPE_ERR: DOM Events Exception 0', e.message);
+ expect(e.code, EventException.UNSPECIFIED_EVENT_TYPE_ERR);
+ expect(e.name, 'UNSPECIFIED_EVENT_TYPE_ERR');
+ expect(e.message, 'UNSPECIFIED_EVENT_TYPE_ERR: DOM Events Exception 0');
}
});
}
diff --git a/tests/html/fileapi_test.dart b/tests/html/fileapi_test.dart
index 82aad86..bb15d15 100644
--- a/tests/html/fileapi_test.dart
+++ b/tests/html/fileapi_test.dart
@@ -5,7 +5,7 @@
void fail(message) {
guardAsync(() {
- Expect.fail(message);
+ expect(false, isTrue, reason: message);
});
}
@@ -69,7 +69,7 @@
options: {'create': true},
successCallback: expectAsync1((FileEntry e) {
expect(e.name, equals('file4'));
- expect(e.isFile, equals(true));
+ expect(e.isFile, isTrue);
}),
errorCallback: (e) {
fail('Got file error: ${e.code}');
diff --git a/tests/html/form_data_test.dart b/tests/html/form_data_test.dart
index eedafb1..808c52f 100644
--- a/tests/html/form_data_test.dart
+++ b/tests/html/form_data_test.dart
@@ -13,16 +13,18 @@
// both a server and fire up a browser.
useHtmlConfiguration();
+ var isFormData = predicate((x) => x is FormData, 'is a FormData');
+
test('constructorTest1', () {
var form = new FormData();
expect(form, isNotNull);
- expect(form is FormData);
+ expect(form, isFormData);
});
test('constructorTest2', () {
var form = new FormData(new FormElement());
expect(form, isNotNull);
- expect(form is FormData);
+ expect(form, isFormData);
});
test('appendTest', () {
diff --git a/tests/html/form_element_test.dart b/tests/html/form_element_test.dart
index 03b36f7..a4b81f5 100644
--- a/tests/html/form_element_test.dart
+++ b/tests/html/form_element_test.dart
@@ -11,10 +11,12 @@
void main() {
useHtmlConfiguration();
+ var isFormElement = predicate((x) => x is FormElement, 'is a FormElement');
+
test('constructorTest1', () {
var form = new FormElement();
expect(form, isNotNull);
- expect(form is FormElement);
+ expect(form, isFormElement);
});
test('checkValidityTest', () {
diff --git a/tests/html/hidden_dom_1_test.dart b/tests/html/hidden_dom_1_test.dart
index f2a4597..7d7e05a 100644
--- a/tests/html/hidden_dom_1_test.dart
+++ b/tests/html/hidden_dom_1_test.dart
@@ -15,7 +15,7 @@
Hello World!
</div>'''));
Element e = document.query('#div1');
- Expect.isTrue(e != null);
+ expect(e, isNotNull);
checkNoSuchMethod(() { confuse(e).onfocus = null; });
});
@@ -39,7 +39,7 @@
ex = e;
}
if (ex === null)
- Expect.fail('Action should have thrown exception');
+ expect(false, isTrue, reason: 'Action should have thrown exception');
- Expect.isTrue(ex is NoSuchMethodError, 'ex is NoSuchMethodError');
+ expect(ex, isNoSuchMethodError);
}
diff --git a/tests/html/hidden_dom_2_test.dart b/tests/html/hidden_dom_2_test.dart
index 262fbf8..1e73b37 100644
--- a/tests/html/hidden_dom_2_test.dart
+++ b/tests/html/hidden_dom_2_test.dart
@@ -16,7 +16,7 @@
</div>'''));
Element e = document.query('#div1');
Element e2 = new Element.html(r"<div id='xx'>XX</div>");
- Expect.isTrue(e != null);
+ expect(e, isNotNull);
checkNoSuchMethod(() { confuse(e).appendChild(e2); });
@@ -42,7 +42,7 @@
ex = e;
}
if (!threw)
- Expect.fail('Action should have thrown exception');
+ expect(false, isTrue, reason: 'Action should have thrown exception');
- Expect.isTrue(ex is NoSuchMethodError, 'ex is NoSuchMethodError');
+ expect(ex, isNoSuchMethodError);
}
diff --git a/tests/html/html.status b/tests/html/html.status
index 5f77f84..b31ad44 100644
--- a/tests/html/html.status
+++ b/tests/html/html.status
@@ -53,6 +53,7 @@
[ $runtime == dartium || $runtime == chrome || $runtime == ie9 || $runtime == ie10 || $runtime == safari || $runtime == ff || $runtime == opera ]
history_test: Fail
+audiocontext_test: Fail # After WebKit roll due to renamed method?
[$runtime == ie10 ]
# TODO(efortuna, blois): Triage.
@@ -179,7 +180,7 @@
instance_of_test: Fail
mutationobserver_test: Fail
native_gc_test: Fail
-node_test: Fail
+node_test: Skip # Issue 6457
serialized_script_value_test: Fail
svgelement2_test: Fail
svgelement_test: Fail
@@ -273,6 +274,7 @@
[ $compiler == dart2js && $runtime == drt ]
# Unknown error - should investigate.
+audiocontext_test: Fail
htmloptionscollection_test: Fail # Issue 3813.
unknownelement_test: Fail # Issue 4189
@@ -300,6 +302,3 @@
[ $compiler == dart2js && $runtime == chrome && $system == windows]
css_test: Pass, Fail # Issue #2823
-
-[ $compiler == dart2js && $checked && $browser]
-fileapi_test: Fail # TypeError: Object #<DirectoryEntry> has no method 'get$name'
diff --git a/tests/html/htmlaudioelement_test.dart b/tests/html/htmlaudioelement_test.dart
index c526b0f..6d1b1c9 100644
--- a/tests/html/htmlaudioelement_test.dart
+++ b/tests/html/htmlaudioelement_test.dart
@@ -7,16 +7,19 @@
useHtmlConfiguration();
+ var isAudioElement =
+ predicate((x) => x is AudioElement, 'is an AudioElement');
+
test('constructorTest1', () {
var audio = new AudioElement(); // would be new Audio() in JS
- Expect.isTrue(audio != null);
- Expect.isTrue(audio is AudioElement);
+ expect(audio, isNotNull);
+ expect(audio, isAudioElement);
});
test('constructorTest2', () {
var audio = new AudioElement('hahaURL');
- Expect.isTrue(audio != null);
- Expect.isTrue(audio is AudioElement);
- Expect.isTrue(audio.src.indexOf('hahaURL') >= 0);
+ expect(audio, isNotNull);
+ expect(audio, isAudioElement);
+ expect(audio.src.indexOf('hahaURL'), greaterThanOrEqualTo(0));
});
}
diff --git a/tests/html/htmlcollection_test.dart b/tests/html/htmlcollection_test.dart
index e7cc4d1..7f6ce9c 100644
--- a/tests/html/htmlcollection_test.dart
+++ b/tests/html/htmlcollection_test.dart
@@ -33,13 +33,14 @@
}
useHtmlConfiguration();
+
test('IsList', () {
Element root = insertTestDiv();
List<Element> eachChecked =
document.query('#allChecked').elements;
- Expect.isTrue(eachChecked is List);
+ expect(eachChecked, isList);
root.remove();
});
@@ -55,16 +56,16 @@
List<Element> noneChecked =
document.query('#noneChecked').elements;
- Expect.equals(4, eachChecked.length);
- Expect.equals(4, someChecked.length);
- Expect.equals(4, noneChecked.length);
+ expect(eachChecked.length, 4);
+ expect(someChecked.length, 4);
+ expect(noneChecked.length, 4);
- Expect.isTrue(eachChecked.every((x) => x.checked));
- Expect.isFalse(eachChecked.every((x) => !x.checked));
- Expect.isFalse(someChecked.every((x) => x.checked));
- Expect.isFalse(someChecked.every((x) => !x.checked));
- Expect.isFalse(noneChecked.every((x) => x.checked));
- Expect.isTrue(noneChecked.every((x) => !x.checked));
+ expect(eachChecked.every((x) => x.checked), isTrue);
+ expect(eachChecked.every((x) => !x.checked), isFalse);
+ expect(someChecked.every((x) => x.checked), isFalse);
+ expect(someChecked.every((x) => !x.checked), isFalse);
+ expect(noneChecked.every((x) => x.checked), isFalse);
+ expect(noneChecked.every((x) => !x.checked), isTrue);
root.remove();
});
@@ -80,16 +81,16 @@
List<Element> noneChecked =
document.query('#noneChecked').elements;
- Expect.equals(4, eachChecked.length);
- Expect.equals(4, someChecked.length);
- Expect.equals(4, noneChecked.length);
+ expect(eachChecked.length, 4);
+ expect(someChecked.length, 4);
+ expect(noneChecked.length, 4);
- Expect.isTrue(eachChecked.some((x) => x.checked));
- Expect.isFalse(eachChecked.some((x) => !x.checked));
- Expect.isTrue(someChecked.some((x) => x.checked));
- Expect.isTrue(someChecked.some((x) => !x.checked));
- Expect.isFalse(noneChecked.some((x) => x.checked));
- Expect.isTrue(noneChecked.some((x) => !x.checked));
+ expect(eachChecked.some((x) => x.checked), isTrue);
+ expect(eachChecked.some((x) => !x.checked), isFalse);
+ expect(someChecked.some((x) => x.checked), isTrue);
+ expect(someChecked.some((x) => !x.checked), isTrue);
+ expect(noneChecked.some((x) => x.checked), isFalse);
+ expect(noneChecked.some((x) => !x.checked), isTrue);
root.remove();
});
@@ -105,16 +106,16 @@
List<Element> noneChecked =
document.query('#noneChecked').elements;
- Expect.equals(4, eachChecked.length);
- Expect.equals(4, someChecked.length);
- Expect.equals(4, noneChecked.length);
+ expect(eachChecked.length, 4);
+ expect(someChecked.length, 4);
+ expect(noneChecked.length, 4);
- Expect.equals(4, eachChecked.filter((x) => x.checked).length);
- Expect.equals(0, eachChecked.filter((x) => !x.checked).length);
- Expect.equals(2, someChecked.filter((x) => x.checked).length);
- Expect.equals(2, someChecked.filter((x) => !x.checked).length);
- Expect.equals(0, noneChecked.filter((x) => x.checked).length);
- Expect.equals(4, noneChecked.filter((x) => !x.checked).length);
+ expect(eachChecked.filter((x) => x.checked).length, 4);
+ expect(eachChecked.filter((x) => !x.checked).length, 0);
+ expect(someChecked.filter((x) => x.checked).length, 2);
+ expect(someChecked.filter((x) => !x.checked).length, 2);
+ expect(noneChecked.filter((x) => x.checked).length, 0);
+ expect(noneChecked.filter((x) => !x.checked).length, 4);
root.remove();
});
@@ -127,11 +128,11 @@
List<Element> emptyDiv =
document.query('#emptyDiv').elements;
- Expect.equals(4, someChecked.length);
- Expect.equals(0, emptyDiv.length);
+ expect(someChecked.length, 4);
+ expect(emptyDiv.length, 0);
- Expect.isFalse(someChecked.isEmpty);
- Expect.isTrue(emptyDiv.isEmpty);
+ expect(someChecked.isEmpty, isFalse);
+ expect(emptyDiv.isEmpty, isTrue);
root.remove();
});
@@ -156,16 +157,16 @@
List<Element> noneChecked =
document.query('#noneChecked').elements;
- Expect.equals(4, eachChecked.length);
- Expect.equals(4, someChecked.length);
- Expect.equals(4, noneChecked.length);
+ expect(eachChecked.length, 4);
+ expect(someChecked.length, 4);
+ expect(noneChecked.length, 4);
- Expect.equals(4, countWithForEach(eachChecked, (x) => x.checked));
- Expect.equals(0, countWithForEach(eachChecked, (x) => !x.checked));
- Expect.equals(2, countWithForEach(someChecked, (x) => x.checked));
- Expect.equals(2, countWithForEach(someChecked, (x) => !x.checked));
- Expect.equals(0, countWithForEach(noneChecked, (x) => x.checked));
- Expect.equals(4, countWithForEach(noneChecked, (x) => !x.checked));
+ expect(countWithForEach(eachChecked, (x) => x.checked), 4);
+ expect(countWithForEach(eachChecked, (x) => !x.checked), 0);
+ expect(countWithForEach(someChecked, (x) => x.checked), 2);
+ expect(countWithForEach(someChecked, (x) => !x.checked), 2);
+ expect(countWithForEach(noneChecked, (x) => x.checked), 0);
+ expect(countWithForEach(noneChecked, (x) => !x.checked), 4);
root.remove();
});
@@ -190,16 +191,16 @@
List<Element> noneChecked =
document.query('#noneChecked').elements;
- Expect.equals(4, eachChecked.length);
- Expect.equals(4, someChecked.length);
- Expect.equals(4, noneChecked.length);
+ expect(eachChecked.length, 4);
+ expect(someChecked.length, 4);
+ expect(noneChecked.length, 4);
- Expect.equals(4, countWithForLoop(eachChecked, (x) => x.checked));
- Expect.equals(0, countWithForLoop(eachChecked, (x) => !x.checked));
- Expect.equals(2, countWithForLoop(someChecked, (x) => x.checked));
- Expect.equals(2, countWithForLoop(someChecked, (x) => !x.checked));
- Expect.equals(0, countWithForLoop(noneChecked, (x) => x.checked));
- Expect.equals(4, countWithForLoop(noneChecked, (x) => !x.checked));
+ expect(countWithForLoop(eachChecked, (x) => x.checked), 4);
+ expect(countWithForLoop(eachChecked, (x) => !x.checked), 0);
+ expect(countWithForLoop(someChecked, (x) => x.checked), 2);
+ expect(countWithForLoop(someChecked, (x) => !x.checked), 2);
+ expect(countWithForLoop(noneChecked, (x) => x.checked), 0);
+ expect(countWithForLoop(noneChecked, (x) => !x.checked), 4);
root.remove();
});
@@ -209,9 +210,9 @@
List<Element> someChecked =
document.query('#someChecked').elements;
- Expect.equals(4, someChecked.length);
+ expect(someChecked.length, 4);
- Expect.equals(someChecked[3], someChecked.last);
+ expect(someChecked.last, equals(someChecked[3]));
root.remove();
});
@@ -224,24 +225,23 @@
List<Element> noneChecked =
document.query('#noneChecked').elements;
- Expect.equals(4, someChecked.length);
- Expect.equals(4, noneChecked.length);
+ expect(someChecked.length, 4);
+ expect(noneChecked.length, 4);
- Expect.equals(0, someChecked.indexOf(someChecked[0], 0));
- Expect.equals(1, someChecked.indexOf(someChecked[1], 0));
- Expect.equals(2, someChecked.indexOf(someChecked[2], 0));
- Expect.equals(3, someChecked.indexOf(someChecked[3], 0));
+ expect(someChecked.indexOf(someChecked[0], 0), 0);
+ expect(someChecked.indexOf(someChecked[1], 0), 1);
+ expect(someChecked.indexOf(someChecked[2], 0), 2);
+ expect(someChecked.indexOf(someChecked[3], 0), 3);
- Expect.equals(-1, someChecked.indexOf(someChecked[0], 1));
- Expect.equals(-1, someChecked.indexOf(someChecked[1], 2));
- Expect.equals(-1, someChecked.indexOf(someChecked[2], 3));
- Expect.equals(-1, someChecked.indexOf(someChecked[3], 4));
+ expect(someChecked.indexOf(someChecked[0], 1), -1);
+ expect(someChecked.indexOf(someChecked[1], 2), -1);
+ expect(someChecked.indexOf(someChecked[2], 3), -1);
+ expect(someChecked.indexOf(someChecked[3], 4), -1);
-
- Expect.equals(-1, someChecked.indexOf(noneChecked[0], 0));
- Expect.equals(-1, noneChecked.indexOf(someChecked[0], 0));
- Expect.equals(-1, someChecked.indexOf(noneChecked[1], 0));
- Expect.equals(-1, noneChecked.indexOf(someChecked[1], 0));
+ expect(someChecked.indexOf(noneChecked[0], 0), -1);
+ expect(noneChecked.indexOf(someChecked[0], 0), -1);
+ expect(someChecked.indexOf(noneChecked[1], 0), -1);
+ expect(noneChecked.indexOf(someChecked[1], 0), -1);
root.remove();
});
@@ -254,23 +254,23 @@
List<Element> noneChecked =
document.query('#noneChecked').elements;
- Expect.equals(4, someChecked.length);
- Expect.equals(4, noneChecked.length);
+ expect(someChecked.length, 4);
+ expect(noneChecked.length, 4);
- Expect.equals(0, someChecked.lastIndexOf(someChecked[0], 3));
- Expect.equals(1, someChecked.lastIndexOf(someChecked[1], 3));
- Expect.equals(2, someChecked.lastIndexOf(someChecked[2], 3));
- Expect.equals(3, someChecked.lastIndexOf(someChecked[3], 3));
+ expect(someChecked.lastIndexOf(someChecked[0], 3), 0);
+ expect(someChecked.lastIndexOf(someChecked[1], 3), 1);
+ expect(someChecked.lastIndexOf(someChecked[2], 3), 2);
+ expect(someChecked.lastIndexOf(someChecked[3], 3), 3);
- Expect.equals(-1, someChecked.lastIndexOf(someChecked[0], -1));
- Expect.equals(-1, someChecked.lastIndexOf(someChecked[1], 0));
- Expect.equals(-1, someChecked.lastIndexOf(someChecked[2], 1));
- Expect.equals(-1, someChecked.lastIndexOf(someChecked[3], 2));
+ expect(someChecked.lastIndexOf(someChecked[0], -1), -1);
+ expect(someChecked.lastIndexOf(someChecked[1], 0), -1);
+ expect(someChecked.lastIndexOf(someChecked[2], 1), -1);
+ expect(someChecked.lastIndexOf(someChecked[3], 2), -1);
- Expect.equals(-1, someChecked.lastIndexOf(noneChecked[0], 3));
- Expect.equals(-1, noneChecked.lastIndexOf(someChecked[0], 3));
- Expect.equals(-1, someChecked.lastIndexOf(noneChecked[1], 3));
- Expect.equals(-1, noneChecked.lastIndexOf(someChecked[1], 3));
+ expect(someChecked.lastIndexOf(noneChecked[0], 3), -1);
+ expect(noneChecked.lastIndexOf(someChecked[0], 3), -1);
+ expect(someChecked.lastIndexOf(noneChecked[1], 3), -1);
+ expect(noneChecked.lastIndexOf(someChecked[1], 3), -1);
root.remove();
});
diff --git a/tests/html/htmlelement_test.dart b/tests/html/htmlelement_test.dart
index ba83071..ea99338 100644
--- a/tests/html/htmlelement_test.dart
+++ b/tests/html/htmlelement_test.dart
@@ -12,7 +12,7 @@
document.body.nodes.add(element);
element = document.query('#test');
- Expect.stringEquals('Hello World', element.innerHTML);
+ expect(element.innerHTML, 'Hello World');
element.remove();
});
test('HTMLTable', () {
@@ -24,26 +24,26 @@
row.nodes.add(new Element.tag('td'));
row.nodes.add(new Element.tag('td'));
- Expect.equals(2, row.cells.length);
+ expect(row.cells.length, 2);
TableRowElement headerRow = table.rows[0];
- Expect.equals(2, headerRow.cells.length);
+ expect(headerRow.cells.length, 2);
});
test('dataAttributes', () {
Element div = new Element.tag('div');
- Expect.isTrue(div.dataAttributes.isEmpty);
- Expect.equals(null, div.dataAttributes['foo']);
- Expect.isTrue(div.dataAttributes.isEmpty);
+ expect(div.dataAttributes.isEmpty, isTrue);
+ expect(div.dataAttributes['foo'], isNull);
+ expect(div.dataAttributes.isEmpty, isTrue);
div.dataAttributes['foo'] = 'foo-value';
- Expect.equals('foo-value', div.dataAttributes['foo']);
- Expect.isFalse(div.dataAttributes.isEmpty);
+ expect(div.dataAttributes['foo'], 'foo-value');
+ expect(div.dataAttributes.isEmpty, isFalse);
- Expect.isTrue(div.dataAttributes.containsValue('foo-value'));
- Expect.isFalse(div.dataAttributes.containsValue('bar-value'));
- Expect.isTrue(div.dataAttributes.containsKey('foo'));
- Expect.isFalse(div.dataAttributes.containsKey('bar'));
+ expect(div.dataAttributes.containsValue('foo-value'), isTrue);
+ expect(div.dataAttributes.containsValue('bar-value'), isFalse);
+ expect(div.dataAttributes.containsKey('foo'), isTrue);
+ expect(div.dataAttributes.containsKey('bar'), isFalse);
bool hasBeenInvoked;
String f() {
@@ -52,12 +52,12 @@
}
hasBeenInvoked = false;
- Expect.equals('bar-value', div.dataAttributes.putIfAbsent('bar', f));
- Expect.isTrue(hasBeenInvoked);
+ expect(div.dataAttributes.putIfAbsent('bar', f), 'bar-value');
+ expect(hasBeenInvoked, isTrue);
hasBeenInvoked = false;
- Expect.equals('bar-value', div.dataAttributes.putIfAbsent('bar', f));
- Expect.isFalse(hasBeenInvoked);
+ expect(div.dataAttributes.putIfAbsent('bar', f), 'bar-value');
+ expect(hasBeenInvoked, isFalse);
final keys = <String> [];
final values = <String> [];
@@ -65,27 +65,27 @@
keys.add(key);
values.add(value);
});
- Expect.setEquals(const <String> ['foo', 'bar'], keys);
- Expect.setEquals(const <String> ['foo-value', 'bar-value'], values);
+ expect(keys, unorderedEquals(['foo', 'bar']));
+ expect(values, unorderedEquals(['foo-value', 'bar-value']));
- Expect.setEquals(const <String> ['foo', 'bar'],
- new List<String>.from(div.dataAttributes.keys));
- Expect.setEquals(const <String> ['foo-value', 'bar-value'],
- new List<String>.from(div.dataAttributes.values));
+ expect(new List<String>.from(div.dataAttributes.keys),
+ unorderedEquals(['foo', 'bar']));
+ expect(new List<String>.from(div.dataAttributes.values),
+ unorderedEquals(['foo-value', 'bar-value']));
- Expect.equals(2, div.dataAttributes.length);
- Expect.isFalse(div.dataAttributes.isEmpty);
+ expect(div.dataAttributes.length, 2);
+ expect(div.dataAttributes.isEmpty, isFalse);
- Expect.isNull(div.dataAttributes.remove('qux'));
- Expect.equals(2, div.dataAttributes.length);
- Expect.isFalse(div.dataAttributes.isEmpty);
+ expect(div.dataAttributes.remove('qux'), isNull);
+ expect(div.dataAttributes.length, 2);
+ expect(div.dataAttributes.isEmpty, isFalse);
- Expect.equals('foo-value', div.dataAttributes.remove('foo'));
- Expect.equals(1, div.dataAttributes.length);
- Expect.isFalse(div.dataAttributes.isEmpty);
+ expect(div.dataAttributes.remove('foo'), 'foo-value');
+ expect(div.dataAttributes.length, 1);
+ expect(div.dataAttributes.isEmpty, isFalse);
div.dataAttributes.clear();
- Expect.equals(0, div.dataAttributes.length);
- Expect.isTrue(div.dataAttributes.isEmpty);
+ expect(div.dataAttributes.length, 0);
+ expect(div.dataAttributes.isEmpty, isTrue);
});
}
diff --git a/tests/html/indexeddb_1_test.dart b/tests/html/indexeddb_1_test.dart
index 3a8eb4c..2f2c6c7 100644
--- a/tests/html/indexeddb_1_test.dart
+++ b/tests/html/indexeddb_1_test.dart
@@ -7,7 +7,7 @@
const String STORE_NAME = 'TEST';
const int VERSION = 1;
-testReadWrite(key, value, check,
+testReadWrite(key, value, matcher,
[dbName = DB_NAME,
storeName = STORE_NAME,
version = VERSION]) => () {
@@ -30,7 +30,7 @@
request.on.success.add(expectAsync1((e) {
var object = e.target.result;
db.close();
- check(value, object);
+ expect(object, matcher);
}));
request.on.error.add(fail);
}
@@ -83,7 +83,7 @@
deleteRequest.on.error.add(fail);
};
-testReadWriteTyped(key, value, check,
+testReadWriteTyped(key, value, matcher,
[dbName = DB_NAME,
storeName = STORE_NAME,
version = VERSION]) => () {
@@ -106,7 +106,7 @@
request.on.success.add(expectAsync1((e) {
var object = e.target.result;
db.close();
- check(value, object);
+ expect(object, matcher);
}));
request.on.error.add(fail);
}
@@ -160,18 +160,17 @@
};
tests_dynamic() {
- test('test1', testReadWrite(123, 'Hoot!', Expect.equals));
- test('test2', testReadWrite(123, 12345, Expect.equals));
- test('test3', testReadWrite(123, [1,2,3], Expect.listEquals));
- test('test4', testReadWrite(123, const [2, 3, 4], Expect.listEquals));
+ test('test1', testReadWrite(123, 'Hoot!', equals('Hoot!')));
+ test('test2', testReadWrite(123, 12345, equals(12345)));
+ test('test3', testReadWrite(123, [1, 2, 3], equals([1, 2, 3])));
+ test('test4', testReadWrite(123, [2, 3, 4], equals([2, 3, 4])));
}
tests_typed() {
- test('test1', testReadWriteTyped(123, 'Hoot!', Expect.equals));
- test('test2', testReadWriteTyped(123, 12345, Expect.equals));
- test('test3', testReadWriteTyped(123, [1,2,3], Expect.listEquals));
- test('test4',
- testReadWriteTyped(123, const [2, 3, 4], Expect.listEquals));
+ test('test1', testReadWriteTyped(123, 'Hoot!', equals('Hoot!')));
+ test('test2', testReadWriteTyped(123, 12345, equals(12345)));
+ test('test3', testReadWriteTyped(123, [1, 2, 3], equals([1, 2, 3])));
+ test('test4', testReadWriteTyped(123, [2, 3, 4], equals([2, 3, 4])));
}
main() {
diff --git a/tests/html/indexeddb_2_test.dart b/tests/html/indexeddb_2_test.dart
index 7a64313..f37be90 100644
--- a/tests/html/indexeddb_2_test.dart
+++ b/tests/html/indexeddb_2_test.dart
@@ -2,7 +2,7 @@
#import('../../pkg/unittest/unittest.dart');
#import('../../pkg/unittest/html_config.dart');
#import('dart:html');
-#import('dart:coreimpl');
+#import('dart:collection');
#import('utils.dart');
// Write and re-read Maps: simple Maps; Maps with DAGs; Maps with cycles.
diff --git a/tests/html/indexeddb_3_test.dart b/tests/html/indexeddb_3_test.dart
index 8914add..03cb79a 100644
--- a/tests/html/indexeddb_3_test.dart
+++ b/tests/html/indexeddb_3_test.dart
@@ -12,7 +12,7 @@
class Test {
fail(message) => (e) {
guardAsync(() {
- Expect.fail('IndexedDB failure: $message');
+ expect(false, isTrue, reason: 'IndexedDB failure: $message');
});
};
@@ -100,13 +100,13 @@
itemCount += 1;
sumKeys += cursor.key;
window.console.log('${cursor.key} ${cursor.value}');
- Expect.equals('Item ${cursor.key}', cursor.value);
+ expect(cursor.value, 'Item ${cursor.key}');
cursor.continueFunction();
} else {
// Done
- Expect.equals(99, lastKey);
- Expect.equals(100, itemCount);
- Expect.equals((100 * 99) ~/ 2, sumKeys);
+ expect(lastKey, 99);
+ expect(itemCount, 100);
+ expect(sumKeys, (100 * 99) ~/ 2);
}
}, count:101));
cursorRequest.on.error.add(fail('openCursor'));
@@ -126,13 +126,13 @@
lastKey = cursor.key;
itemCount += 1;
sumKeys += cursor.key;
- Expect.equals('Item ${cursor.key}', cursor.value);
+ expect(cursor.value, 'Item ${cursor.key}');
cursor.continueFunction();
} else {
// Done
- Expect.equals(0, lastKey); // i.e. first key (scanned in reverse).
- Expect.equals(100, itemCount);
- Expect.equals((100 * 99) ~/ 2, sumKeys);
+ expect(lastKey, 0); // i.e. first key (scanned in reverse).
+ expect(itemCount, 100);
+ expect(sumKeys, (100 * 99) ~/ 2);
}
}, count:101));
cursorRequest.on.error.add(fail('openCursor'));
diff --git a/tests/html/indexeddb_4_test.dart b/tests/html/indexeddb_4_test.dart
index 1e7e29c..cbe4f77 100644
--- a/tests/html/indexeddb_4_test.dart
+++ b/tests/html/indexeddb_4_test.dart
@@ -12,7 +12,7 @@
class Test {
fail(message) => (e) {
guardAsync(() {
- Expect.fail('IndexedDB failure: $message');
+ expect(false, isTrue, reason: 'IndexedDB failure: $message');
});
};
@@ -99,16 +99,16 @@
if (firstKey == null) firstKey = cursor.key;
lastKey = cursor.key;
itemCount += 1;
- Expect.equals('Item ${cursor.key}', cursor.value);
+ expect(cursor.value, 'Item ${cursor.key}');
cursor.continueFunction();
} else {
// Done
- Expect.equals(expectedFirst, firstKey);
- Expect.equals(expectedLast, lastKey);
+ expect(firstKey, expectedFirst);
+ expect(lastKey, expectedLast);
if (expectedFirst == null) {
- Expect.equals(0, itemCount);
+ expect(itemCount, isZero);
} else {
- Expect.equals(expectedLast - expectedFirst + 1, itemCount);
+ expect(itemCount, expectedLast - expectedFirst + 1);
}
}
},
diff --git a/tests/html/inner_frame_test.dart b/tests/html/inner_frame_test.dart
index c14fa79..0579412 100644
--- a/tests/html/inner_frame_test.dart
+++ b/tests/html/inner_frame_test.dart
@@ -19,7 +19,7 @@
var div = parentDocument.$dom_createElement("div");
div.id = "illegalFrameElement";
parentDocument.body.nodes.add(div);
- Expect.fail('Should not reach here.');
+ expect(false, isTrue, reason: 'Should not reach here.');
} on NoSuchMethodError catch (e) {
// Expected.
window.top.postMessage('pass_frameElement', '*');
@@ -36,7 +36,7 @@
var div = parentDocument.$dom_createElement("div");
div.id = "illegalTop";
parentDocument.body.nodes.add(div);
- Expect.fail('Should not reach here.');
+ expect(false, isTrue, reason: 'Should not reach here.');
} on NoSuchMethodError catch (e) {
// Expected.
window.top.postMessage('pass_top', '*');
@@ -53,7 +53,7 @@
var div = parentDocument.$dom_createElement("div");
div.id = "illegalParent";
parentDocument.body.nodes.add(div);
- Expect.fail('Should not reach here.');
+ expect(false, isTrue, reason: 'Should not reach here.');
} on NoSuchMethodError catch (e) {
// Expected.
window.top.postMessage('pass_parent', '*');
@@ -85,7 +85,7 @@
if (e.data == 'pass_$testName') {
expectedVerify();
}
- expect(e.data != 'fail_$testName');
+ expect(e.data, isNot(equals('fail_$testName')));
});
});
child.postMessage(testName, '*');
diff --git a/tests/html/instance_of_test.dart b/tests/html/instance_of_test.dart
index 2d382c5..ee21a9d 100644
--- a/tests/html/instance_of_test.dart
+++ b/tests/html/instance_of_test.dart
@@ -11,46 +11,60 @@
canvas.attributes['height'] = 100;
document.body.nodes.add(canvas);
+ var isCanvasRenderingContext = predicate((x) => x is CanvasRenderingContext,
+ 'is a CanvasRenderingContext');
+ var isCanvasRenderingContext2D =
+ predicate((x) => x is CanvasRenderingContext2D,
+ 'is a CanvasRenderingContext2D');
+ var isElement = predicate((x) => x is Element, 'is an Element');
+ var isCanvasElement =
+ predicate((x) => x is CanvasElement, 'is a CanvasElement');
+ var isImageData = predicate((x) => x is ImageData, 'is an ImageData');
+ //var isCanvasPixelArray =
+ // predicate((x) => x is CanvasPixelArray, 'is a CanvasPixelArray');
+ var isUint8ClampedArray =
+ predicate((x) => x is Uint8ClampedArray, 'is a Uint8ClampedArray');
+
useHtmlConfiguration();
test('Instanceof', () {
- Expect.isFalse(canvas is CanvasRenderingContext);
- Expect.isFalse(canvas is CanvasRenderingContext2D);
- Expect.isTrue(canvas is Element);
- Expect.isTrue(canvas is CanvasElement);
- Expect.isFalse(canvas is ImageData);
- // Expect.isFalse(canvas is CanvasPixelArray);
+ expect(canvas, isNot(isCanvasRenderingContext));
+ expect(canvas, isNot(isCanvasRenderingContext2D));
+ expect(canvas, isElement);
+ expect(canvas, isCanvasElement);
+ expect(canvas, isNot(isImageData));
+ // expect(canvas, isNot(isCanvasPixelArray));
CanvasRenderingContext2D context = canvas.getContext('2d');
- Expect.isTrue(context is CanvasRenderingContext);
- Expect.isTrue(context is CanvasRenderingContext2D);
- Expect.isFalse(context is Element);
- Expect.isFalse(context is CanvasElement);
- Expect.isFalse(context is ImageData);
- // Expect.isFalse(context is CanvasPixelArray);
+ expect(context, isCanvasRenderingContext);
+ expect(context, isCanvasRenderingContext2D);
+ expect(context, isNot(isElement));
+ expect(context, isNot(isCanvasElement));
+ expect(context, isNot(isImageData));
+ // expect(context, isNot(isCanvasPixelArray));
// FIXME(b/5286633): Interface injection type check workaround.
var image = context.createImageData(canvas.width as Dynamic,
canvas.height as Dynamic);
- Expect.isFalse(image is CanvasRenderingContext);
- Expect.isFalse(image is CanvasRenderingContext2D);
- Expect.isFalse(image is Element);
- Expect.isFalse(image is CanvasElement);
- Expect.isTrue(image is ImageData);
- // Expect.isFalse(image is CanvasPixelArray);
+ expect(image, isNot(isCanvasRenderingContext));
+ expect(image, isNot(isCanvasRenderingContext2D));
+ expect(image, isNot(isElement));
+ expect(image, isNot(isCanvasElement));
+ expect(image, isImageData);
+ // expect(image, isNot(isCanvasPixelArray));
// Include CanvasPixelArray since constructor and prototype are not
// available until one is created.
var bytes = image.data;
- Expect.isFalse(bytes is CanvasRenderingContext);
- Expect.isFalse(bytes is CanvasRenderingContext2D);
- Expect.isFalse(bytes is Element);
- Expect.isFalse(bytes is CanvasElement);
- Expect.isFalse(bytes is ImageData);
- Expect.isTrue(bytes is Uint8ClampedArray);
+ expect(bytes, isNot(isCanvasRenderingContext));
+ expect(bytes, isNot(isCanvasRenderingContext2D));
+ expect(bytes, isNot(isElement));
+ expect(bytes, isNot(isCanvasElement));
+ expect(bytes, isNot(isImageData));
+ expect(bytes, isUint8ClampedArray);
// FIXME: Ensure this is an SpanElement when we next update
// WebKit IDL.
var span = new Element.tag('span');
- Expect.isTrue(span is Element);
+ expect(span, isElement);
});
}
diff --git a/tests/html/isolates_test.dart b/tests/html/isolates_test.dart
index 7140d3e..8b31ca3 100644
--- a/tests/html/isolates_test.dart
+++ b/tests/html/isolates_test.dart
@@ -39,10 +39,10 @@
final msg2 = 'bar';
port.call(msg1).then((response) {
guardAsync(() {
- Expect.equals(responseFor(msg1), response);
+ expect(response, equals(responseFor(msg1)));
port.call(msg2).then((response) {
guardAsync(() {
- Expect.equals(responseFor(msg2), response);
+ expect(response, equals(responseFor(msg2)));
callback();
});
});
diff --git a/tests/html/js_interop_2_test.dart b/tests/html/js_interop_2_test.dart
index 6f43564..bf7cfde 100644
--- a/tests/html/js_interop_2_test.dart
+++ b/tests/html/js_interop_2_test.dart
@@ -34,9 +34,9 @@
SendPortSync port = window.lookupPort('test');
var result = port.callSync('sent');
- Expect.equals('received', result);
+ expect(result, 'received');
result = port.callSync('ignore');
- Expect.isNull(result);
+ expect(result, isNull);
});
}
diff --git a/tests/html/js_interop_3_test.dart b/tests/html/js_interop_3_test.dart
index c8ab351..92f7294 100644
--- a/tests/html/js_interop_3_test.dart
+++ b/tests/html/js_interop_3_test.dart
@@ -28,10 +28,10 @@
test('js-to-dart', () {
var fun1 = (message) {
- Expect.equals('Hello', message['a']);
- Expect.equals('World', message['b']);
- Expect.equals(42, message['c']);
- Expect.equals(3, message.keys.length);
+ expect(message['a'], 'Hello');
+ expect(message['b'], 'World');
+ expect(message['c'], 42);
+ expect(message.keys.length, 3);
return 42;
};
@@ -42,7 +42,7 @@
// TODO(vsm): Investigate why this needs to be called asynchronously.
var done = expectAsync0(() {});
var fun2 = (message) {
- Expect.equals(42, message);
+ expect(message, 42);
window.setTimeout(done, 0);
};
diff --git a/tests/html/js_interop_4_test.dart b/tests/html/js_interop_4_test.dart
index b05ffb7..3e0fe4e 100644
--- a/tests/html/js_interop_4_test.dart
+++ b/tests/html/js_interop_4_test.dart
@@ -24,7 +24,7 @@
// Test that our interop scheme also works from Dart to Dart.
test('dart-to-dart-same-isolate', () {
var fun = expectAsync1((message) {
- Expect.listEquals(testData, message);
+ expect(message, orderedEquals(testData));
return message.length;
});
@@ -34,13 +34,13 @@
var port2 = window.lookupPort('fun');
var result = port2.callSync(testData);
- Expect.equals(3, result);
+ expect(result, 3);
});
// Test across isolate boundary.
test('dart-to-dart-cross-isolate', () {
var fun1 = (message) {
- Expect.listEquals(testData, message);
+ expect(message, orderedEquals(testData));
return message.length;
};
@@ -51,7 +51,7 @@
// TODO(vsm): Investigate why this needs to be called asynchronously.
var done = expectAsync0(() {});
var fun2 = (message) {
- Expect.equals(3, message);
+ expect(message, 3);
window.setTimeout(done, 0);
};
diff --git a/tests/html/key_name_location_test.dart b/tests/html/key_name_location_test.dart
index 445f43d..856b615 100644
--- a/tests/html/key_name_location_test.dart
+++ b/tests/html/key_name_location_test.dart
@@ -10,22 +10,22 @@
useHtmlConfiguration();
test('keyNames', () {
- Expect.equals("DownLeft", KeyName.DOWN_LEFT);
- Expect.equals("Fn", KeyName.FN);
- Expect.equals("F1", KeyName.F1);
- Expect.equals("Meta", KeyName.META);
- Expect.equals("MediaNextTrack", KeyName.MEDIA_NEXT_TRACK);
- Expect.equals("NumLock", KeyName.NUM_LOCK);
- Expect.equals("PageDown", KeyName.PAGE_DOWN);
- Expect.equals("DeadIota", KeyName.DEAD_IOTA);
+ expect(KeyName.DOWN_LEFT, "DownLeft");
+ expect(KeyName.FN, "Fn");
+ expect(KeyName.F1, "F1");
+ expect(KeyName.META, "Meta");
+ expect(KeyName.MEDIA_NEXT_TRACK, "MediaNextTrack");
+ expect(KeyName.NUM_LOCK, "NumLock");
+ expect(KeyName.PAGE_DOWN, "PageDown");
+ expect(KeyName.DEAD_IOTA, "DeadIota");
});
test('keyLocations', () {
- Expect.equals(0, KeyLocation.STANDARD);
- Expect.equals(1, KeyLocation.LEFT);
- Expect.equals(2, KeyLocation.RIGHT);
- Expect.equals(3, KeyLocation.NUMPAD);
- Expect.equals(4, KeyLocation.MOBILE);
- Expect.equals(5, KeyLocation.JOYSTICK);
+ expect(KeyLocation.STANDARD, 0);
+ expect(KeyLocation.LEFT, 1);
+ expect(KeyLocation.RIGHT, 2);
+ expect(KeyLocation.NUMPAD, 3);
+ expect(KeyLocation.MOBILE, 4);
+ expect(KeyLocation.JOYSTICK, 5);
});
}
diff --git a/tests/html/localstorage_test.dart b/tests/html/localstorage_test.dart
index 38e4204..3e4aeda 100644
--- a/tests/html/localstorage_test.dart
+++ b/tests/html/localstorage_test.dart
@@ -25,56 +25,55 @@
}
testWithLocalStorage('containsValue', () {
- Expect.isFalse(window.localStorage.containsValue('does not exist'));
- Expect.isFalse(window.localStorage.containsValue('key1'));
- Expect.isTrue(window.localStorage.containsValue('val1'));
- Expect.isTrue(window.localStorage.containsValue('val3'));
+ expect(window.localStorage.containsValue('does not exist'), isFalse);
+ expect(window.localStorage.containsValue('key1'), isFalse);
+ expect(window.localStorage.containsValue('val1'), isTrue);
+ expect(window.localStorage.containsValue('val3'), isTrue);
});
testWithLocalStorage('containsKey', () {
- Expect.isFalse(window.localStorage.containsKey('does not exist'));
- Expect.isFalse(window.localStorage.containsKey('val1'));
- Expect.isTrue(window.localStorage.containsKey('key1'));
- Expect.isTrue(window.localStorage.containsKey('key3'));
+ expect(window.localStorage.containsKey('does not exist'), isFalse);
+ expect(window.localStorage.containsKey('val1'), isFalse);
+ expect(window.localStorage.containsKey('key1'), isTrue);
+ expect(window.localStorage.containsKey('key3'), isTrue);
});
testWithLocalStorage('[]', () {
- Expect.isNull(window.localStorage['does not exist']);
- Expect.equals('val1', window.localStorage['key1']);
- Expect.equals('val3', window.localStorage['key3']);
+ expect(window.localStorage['does not exist'], isNull);
+ expect(window.localStorage['key1'], 'val1');
+ expect(window.localStorage['key3'], 'val3');
});
testWithLocalStorage('[]=', () {
- Expect.isNull(window.localStorage['key4']);
+ expect(window.localStorage['key4'], isNull);
window.localStorage['key4'] = 'val4';
- Expect.equals('val4', window.localStorage['key4']);
+ expect(window.localStorage['key4'], 'val4');
- Expect.equals('val3', window.localStorage['key3']);
+ expect(window.localStorage['key3'], 'val3');
window.localStorage['key3'] = 'val3-new';
- Expect.equals('val3-new', window.localStorage['key3']);
+ expect(window.localStorage['key3'], 'val3-new');
});
testWithLocalStorage('putIfAbsent', () {
- Expect.isNull(window.localStorage['key4']);
- Expect.equals('val4',
- window.localStorage.putIfAbsent('key4', () => 'val4'));
- Expect.equals('val4', window.localStorage['key4']);
+ expect(window.localStorage['key4'], isNull);
+ expect(window.localStorage.putIfAbsent('key4', () => 'val4'), 'val4');
+ expect(window.localStorage['key4'], 'val4');
- Expect.equals('val3', window.localStorage['key3']);
- Expect.equals('val3', window.localStorage.putIfAbsent(
- 'key3', () => Expect.fail('should not be called')));
- Expect.equals('val3', window.localStorage['key3']);
+ expect(window.localStorage['key3'], 'val3');
+ expect(window.localStorage.putIfAbsent('key3',
+ () => expect(false, isTrue, reason: 'should not be called')), 'val3');
+ expect(window.localStorage['key3'], 'val3');
});
testWithLocalStorage('remove', () {
- Expect.isNull(window.localStorage.remove('does not exist'));
- Expect.equals('val3', window.localStorage.remove('key3'));
- Expect.mapEquals({'key1': 'val1', 'key2': 'val2'}, window.localStorage);
+ expect(window.localStorage.remove('does not exist'), isNull);
+ expect(window.localStorage.remove('key3'), 'val3');
+ expect(window.localStorage, equals({'key1': 'val1', 'key2': 'val2'}));
});
testWithLocalStorage('clear', () {
window.localStorage.clear();
- Expect.mapEquals({}, window.localStorage);
+ expect(window.localStorage, equals({}));
});
testWithLocalStorage('forEach', () {
@@ -82,28 +81,28 @@
window.localStorage.forEach((k, v) {
results[k] = v;
});
- Expect.mapEquals({'key1': 'val1', 'key2': 'val2', 'key3': 'val3'},
- results);
+ expect(results, equals({'key1': 'val1', 'key2': 'val2', 'key3': 'val3'}));
});
testWithLocalStorage('getKeys', () {
- Expect.setEquals(['key1', 'key2', 'key3'], window.localStorage.keys);
+ expect(window.localStorage.keys,
+ unorderedEquals(['key1', 'key2', 'key3']));
});
testWithLocalStorage('getVals', () {
- Expect.setEquals(['val1', 'val2', 'val3'],
- window.localStorage.values);
+ expect(window.localStorage.values,
+ unorderedEquals(['val1', 'val2', 'val3']));
});
testWithLocalStorage('length', () {
- Expect.equals(3, window.localStorage.length);
+ expect(window.localStorage.length, 3);
window.localStorage.clear();
- Expect.equals(0, window.localStorage.length);
+ expect(window.localStorage.length, 0);
});
testWithLocalStorage('isEmpty', () {
- Expect.isFalse(window.localStorage.isEmpty);
+ expect(window.localStorage.isEmpty, isFalse);
window.localStorage.clear();
- Expect.isTrue(window.localStorage.isEmpty);
+ expect(window.localStorage.isEmpty, isTrue);
});
}
diff --git a/tests/html/location_test.dart b/tests/html/location_test.dart
index fc2b8f9..a46f528 100644
--- a/tests/html/location_test.dart
+++ b/tests/html/location_test.dart
@@ -6,13 +6,15 @@
main() {
useHtmlConfiguration();
+ var isLocation = predicate((x) => x is Location, 'is a Location');
+
test('location hash', () {
final location = window.location;
- Expect.isTrue(location is Location);
+ expect(location, isLocation);
// The only navigation we dare try is hash.
location.hash = 'hello';
var h = location.hash;
- Expect.equals('#hello', h);
+ expect(h, '#hello');
});
}
diff --git a/tests/html/measurement_test.dart b/tests/html/measurement_test.dart
index 175e92f..74c4182 100644
--- a/tests/html/measurement_test.dart
+++ b/tests/html/measurement_test.dart
@@ -18,10 +18,10 @@
final computedStyle = element.computedStyle;
computedStyle.then(expectAsync1((style) {
expect(style.getPropertyValue('left'), equals('auto'));
- expect(fnComplete);
+ expect(fnComplete, isTrue);
expect(timeout0, isFalse);
}));
- Expect.isFalse(computedStyle.isComplete);
+ expect(computedStyle.isComplete, isFalse);
fnComplete = true;
});
@@ -29,8 +29,8 @@
var rect;
var computedStyle;
window.requestLayoutFrame(expectAsync0(() {
- expect(rect.isComplete);
- expect(computedStyle.isComplete);
+ expect(rect.isComplete, isTrue);
+ expect(computedStyle.isComplete, isTrue);
}));
final element = document.body;
diff --git a/tests/html/mutationobserver_test.dart b/tests/html/mutationobserver_test.dart
index 3585b85..07bf311 100644
--- a/tests/html/mutationobserver_test.dart
+++ b/tests/html/mutationobserver_test.dart
@@ -38,7 +38,8 @@
test('empty options is syntax error', () {
var mutationObserver = new MutationObserver(
- (mutations, observer) { expect(false, 'Should not be reached'); });
+ (mutations, observer) { expect(false, isTrue,
+ reason: 'Should not be reached'); });
expect(() { mutationObserver.observe(document, {}); },
throws);
});
diff --git a/tests/html/native_gc_test.dart b/tests/html/native_gc_test.dart
index b2bc481..0044ac4 100644
--- a/tests/html/native_gc_test.dart
+++ b/tests/html/native_gc_test.dart
@@ -23,7 +23,7 @@
div.on['test'].add((_) {
// Only the final iteration's listener should be invoked.
// Note: the reference to l keeps the entire list alive.
- Expect.equals(M - 1, l[N - 1]);
+ expect(l[N - 1], M - 1);
}, false);
}
diff --git a/tests/html/node_test.dart b/tests/html/node_test.dart
index 80ab9a9..df490ab 100644
--- a/tests/html/node_test.dart
+++ b/tests/html/node_test.dart
@@ -14,114 +14,124 @@
main() {
useHtmlConfiguration();
+ var isText = predicate((x) => x is Text, 'is a Text');
+ var isComment = predicate((x) => x is Comment, 'is a Comment');
+ var isBRElement = predicate((x) => x is BRElement, 'is a BRElement');
+ var isHRElement = predicate((x) => x is HRElement, 'is a HRElement');
+ var isNodeList = predicate((x) => x is List<Node>, 'is a List<Node>');
+ var isImageElement =
+ predicate((x) => x is ImageElement, 'is an ImageElement');
+ var isInputElement =
+ predicate((x) => x is InputElement, 'is an InputElement');
+
test('replaceWith', () {
final node = makeNodeWithChildren();
final subnode = node.nodes[1];
final out = subnode.replaceWith(new Text('Bar'));
- Expect.equals(subnode, out, '#replaceWith should be chainable');
- Expect.equals(3, node.nodes.length);
- Expect.isTrue(node.nodes[0] is Text);
- Expect.equals('Foo', node.nodes[0].text);
- Expect.isTrue(node.nodes[1] is Text);
- Expect.equals('Bar', node.nodes[1].text);
- Expect.isTrue(node.nodes[2] is Comment);
+ expect(out, equals(subnode), reason: '#replaceWith should be chainable');
+ expect(node.nodes.length, 3);
+ expect(node.nodes[0], isText);
+ expect(node.nodes[0].text, 'Foo');
+ expect(node.nodes[1], isText);
+ expect(node.nodes[1].text, 'Bar');
+ expect(node.nodes[2], isComment);
});
test('remove', () {
final node = makeNodeWithChildren();
final subnode = node.nodes[1];
final out = subnode.remove();
- Expect.isNull(out);
- Expect.equals(2, node.nodes.length);
- Expect.isTrue(node.nodes[0] is Text);
- Expect.isTrue(node.nodes[1] is Comment);
+ expect(out, isNull);
+ expect(node.nodes.length, 2);
+ expect(node.nodes[0], isText);
+ expect(node.nodes[1], isComment);
});
test('contains', () {
final Node node = new Element.html("<div>Foo<span>Bar</span></div>");
- Expect.isTrue(node.contains(node.nodes.first));
- Expect.isTrue(node.contains(node.nodes[1].nodes.first));
- Expect.isFalse(node.contains(new Text('Foo')));
+ expect(node.contains(node.nodes.first), isTrue);
+ expect(node.contains(node.nodes[1].nodes.first), isTrue);
+ expect(node.contains(new Text('Foo')), isFalse);
});
group('nodes', () {
test('is a NodeList', () {
- Expect.isTrue(makeNodeWithChildren().nodes is List<Node>);
+ expect(makeNodeWithChildren().nodes, isNodeList);
});
test('first', () {
var node = makeNodeWithChildren();
- Expect.isTrue(node.nodes.first is Text);
+ expect(node.nodes.first, isText);
});
test('last', () {
var node = makeNodeWithChildren();
- Expect.isTrue(node.nodes.last is Comment);
+ expect(node.nodes.last, isComment);
});
test('forEach', () {
var nodes = [];
var node = makeNodeWithChildren();
node.nodes.forEach((n) => nodes.add(n));
- Expect.isTrue(nodes[0] is Text);
- Expect.isTrue(nodes[1] is BRElement);
- Expect.isTrue(nodes[2] is Comment);
+ expect(nodes[0], isText);
+ expect(nodes[1], isBRElement);
+ expect(nodes[2], isComment);
});
test('filter', () {
var filtered = makeNodeWithChildren().nodes.filter((n) => n is BRElement);
- Expect.equals(1, filtered.length);
- Expect.isTrue(filtered[0] is BRElement);
- Expect.isTrue(filtered is List<Node>);
+ expect(filtered.length, 1);
+ expect(filtered[0], isBRElement);
+ expect(filtered, isNodeList);
});
test('every', () {
var node = makeNodeWithChildren();
- Expect.isTrue(node.nodes.every((n) => n is Node));
- Expect.isFalse(node.nodes.every((n) => n is Comment));
+ expect(node.nodes.every((n) => n is Node), isTrue);
+ expect(node.nodes.every((n) => n is Comment), isFalse);
});
test('some', () {
var node = makeNodeWithChildren();
- Expect.isTrue(node.nodes.some((n) => n is Comment));
- Expect.isFalse(node.nodes.some((n) => n is SVGElement));
+ expect(node.nodes.some((n) => n is Comment), isTrue);
+ expect(node.nodes.some((n) => n is SVGElement), isFalse);
});
test('isEmpty', () {
- Expect.isTrue(makeNode().nodes.isEmpty);
- Expect.isFalse(makeNodeWithChildren().nodes.isEmpty);
+ expect(makeNode().nodes.isEmpty, isTrue);
+ expect(makeNodeWithChildren().nodes.isEmpty, isFalse);
});
test('length', () {
- Expect.equals(0, makeNode().nodes.length);
- Expect.equals(3, makeNodeWithChildren().nodes.length);
+ expect(makeNode().nodes.length, 0);
+ expect(makeNodeWithChildren().nodes.length, 3);
});
test('[]', () {
var node = makeNodeWithChildren();
- Expect.isTrue(node.nodes[0] is Text);
- Expect.isTrue(node.nodes[1] is BRElement);
- Expect.isTrue(node.nodes[2] is Comment);
+ expect(node.nodes[0], isText);
+ expect(node.nodes[1], isBRElement);
+ expect(node.nodes[2], isComment);
});
test('[]=', () {
var node = makeNodeWithChildren();
node.nodes[1] = new Element.tag('hr');
- Expect.isTrue(node.nodes[0] is Text);
- Expect.isTrue(node.nodes[1] is HRElement);
- Expect.isTrue(node.nodes[2] is Comment);
+ expect(node.nodes[0], isText);
+ expect(node.nodes[1], isHRElement);
+ expect(node.nodes[2], isComment);
});
test('add', () {
var node = makeNode();
node.nodes.add(new Element.tag('hr'));
- Expect.isTrue(node.nodes.last is HRElement);
+ expect(node.nodes.last, isHRElement);
});
test('addLast', () {
var node = makeNode();
node.nodes.addLast(new Element.tag('hr'));
- Expect.isTrue(node.nodes.last is HRElement);
+ expect(node.nodes.last, isHRElement);
});
test('iterator', () {
@@ -130,9 +140,9 @@
for (var subnode in node.nodes) {
nodes.add(subnode);
}
- Expect.isTrue(nodes[0] is Text);
- Expect.isTrue(nodes[1] is BRElement);
- Expect.isTrue(nodes[2] is Comment);
+ expect(nodes[0], isText);
+ expect(nodes[1], isBRElement);
+ expect(nodes[2], isComment);
});
test('addAll', () {
@@ -142,31 +152,31 @@
new Element.tag('img'),
new Element.tag('input')
]);
- Expect.isTrue(node.nodes[0] is Text);
- Expect.isTrue(node.nodes[1] is BRElement);
- Expect.isTrue(node.nodes[2] is Comment);
- Expect.isTrue(node.nodes[3] is HRElement);
- Expect.isTrue(node.nodes[4] is ImageElement);
- Expect.isTrue(node.nodes[5] is InputElement);
+ expect(node.nodes[0], isText);
+ expect(node.nodes[1], isBRElement);
+ expect(node.nodes[2], isComment);
+ expect(node.nodes[3], isHRElement);
+ expect(node.nodes[4], isImageElement);
+ expect(node.nodes[5], isInputElement);
});
test('clear', () {
var node = makeNodeWithChildren();
node.nodes.clear();
- Expect.listEquals([], node.nodes);
+ expect(node.nodes, []);
});
test('removeLast', () {
var node = makeNodeWithChildren();
- Expect.isTrue(node.nodes.removeLast() is Comment);
- Expect.equals(2, node.nodes.length);
- Expect.isTrue(node.nodes.removeLast() is BRElement);
- Expect.equals(1, node.nodes.length);
+ expect(node.nodes.removeLast(), isComment);
+ expect(node.nodes.length, 2);
+ expect(node.nodes.removeLast(), isBRElement);
+ expect(node.nodes.length, 1);
});
test('getRange', () {
var node = makeNodeWithChildren();
- Expect.isTrue(node.nodes.getRange(1, 2) is List<Node>);
+ expect(node.nodes.getRange(1, 2), isNodeList);
});
});
@@ -176,21 +186,21 @@
test('first', () {
var nodes = makeNodeList();
- Expect.isTrue(nodes.first is Text);
+ expect(nodes.first, isText);
});
test('filter', () {
var filtered = makeNodeList().filter((n) => n is BRElement);
- Expect.equals(1, filtered.length);
- Expect.isTrue(filtered[0] is BRElement);
- Expect.isTrue(filtered is List<Node>);
+ expect(filtered.length, 1);
+ expect(filtered[0], isBRElement);
+ expect(filtered, isNodeList);
});
test('getRange', () {
var range = makeNodeList().getRange(1, 2);
- Expect.isTrue(range is List<Node>);
- Expect.isTrue(range[0] is BRElement);
- Expect.isTrue(range[1] is Comment);
+ expect(range, isNodeList);
+ expect(range[0], isBRElement);
+ expect(range[1], isComment);
});
});
}
diff --git a/tests/html/postmessage_structured_test.dart b/tests/html/postmessage_structured_test.dart
index 6fd7beb..a37280f 100644
--- a/tests/html/postmessage_structured_test.dart
+++ b/tests/html/postmessage_structured_test.dart
@@ -6,7 +6,7 @@
#import('../../pkg/unittest/unittest.dart');
#import('../../pkg/unittest/html_config.dart');
#import('dart:html');
-#import('dart:coreimpl'); // SplayTreeMap
+#import('dart:collection'); // SplayTreeMap
#import('utils.dart');
injectSource(code) {
@@ -34,7 +34,7 @@
guardAsync(() {
var data = e.data;
if (data is String) return; // Messages from unit test protocol.
- expect(data is Map);
+ expect(data, isMap);
expect(data['eggs'], equals(3));
onSuccess(e);
});
@@ -66,7 +66,7 @@
guardAsync(() {
var data = e.data;
if (data is String) return; // Messages from unit test protocol.
- expect(data is Map);
+ expect(data, isMap);
if (data['recipient'] != 'DART') return; // Hearing the sent message.
expect(data['peas'], equals(50));
onSuccess(e);
@@ -98,7 +98,7 @@
guardAsync(() {
var data = e.data;
if (data is String) return; // Messages from unit test protocol.
- expect(data is Map);
+ expect(data, isMap);
if (data['recipient'] != 'DART') return; // Not for me.
var returnedValue = data['data'];
diff --git a/tests/html/query_test.dart b/tests/html/query_test.dart
index 6abae94..5713652 100644
--- a/tests/html/query_test.dart
+++ b/tests/html/query_test.dart
@@ -17,37 +17,41 @@
new Element.html("<div><br/><img/><input/><img/></div>");
document.body.nodes.addAll([div, canvas, element]);
+ var isCanvasElement =
+ predicate((x) => x is CanvasElement, 'is a CanvasElement');
+ var isImageElement =
+ predicate((x) => x is ImageElement, 'is an ImageElement');
test('query', () {
Element e = query('#testcanvas');
- Expect.isNotNull(e);
- Expect.stringEquals('testcanvas', e.id);
- Expect.isTrue(e is CanvasElement);
- Expect.equals(canvas, e);
+ expect(e, isNotNull);
+ expect(e.id, 'testcanvas');
+ expect(e, isCanvasElement);
+ expect(e, canvas);
});
test('query (None)', () {
Element e = query('#nothere');
- Expect.isNull(e);
+ expect(e, isNull);
});
test('queryAll (One)', () {
List l = queryAll('canvas');
- Expect.equals(1, l.length);
- Expect.equals(canvas, l[0]);
+ expect(l.length, 1);
+ expect(l[0], canvas);
});
test('queryAll (Multiple)', () {
List l = queryAll('img');
- Expect.equals(2, l.length);
- Expect.isTrue(l[0] is ImageElement);
- Expect.isTrue(l[1] is ImageElement);
- Expect.notEquals(l[0], l[1]);
+ expect(l.length, 2);
+ expect(l[0], isImageElement);
+ expect(l[1], isImageElement);
+ expect(l[0], isNot(equals(l[1])));
});
test('queryAll (None)', () {
List l = queryAll('video');
- Expect.isTrue(l.isEmpty);
+ expect(l.isEmpty, isTrue);
});
}
diff --git a/tests/html/queryall_test.dart b/tests/html/queryall_test.dart
index 181f5c3..ce580e1 100644
--- a/tests/html/queryall_test.dart
+++ b/tests/html/queryall_test.dart
@@ -10,6 +10,11 @@
main() {
useHtmlConfiguration();
+ var isElement = predicate((x) => x is Element, 'is an Element');
+ var isCanvasElement =
+ predicate((x) => x is CanvasElement, 'is a CanvasElement');
+ var isDivElement = predicate((x) => x is DivElement, 'is a isDivElement');
+
var div = new DivElement();
div.id = 'test';
document.body.nodes.add(div);
@@ -26,7 +31,7 @@
test('queryAll', () {
List<Node> all = queryAll('*');
for (var e in all) {
- expect(e is Element, isTrue);
+ expect(e, isElement);
}
});
@@ -42,7 +47,7 @@
test('queryAll-canvas', () {
List<CanvasElement> all = queryAll('canvas');
for (var e in all) {
- expect(e is CanvasElement, isTrue);
+ expect(e, isCanvasElement);
}
expect(all.length, equals(2));
});
@@ -66,11 +71,11 @@
test('node.queryAll', () {
List<Element> list = div.queryAll('*');
expect(list.length, equals(5));
- expect(list[0] is DivElement, isTrue);
- expect(list[1] is CanvasElement, isTrue);
- expect(list[2] is DivElement, isTrue);
- expect(list[3] is DivElement, isTrue);
- expect(list[4] is CanvasElement, isTrue);
+ expect(list[0], isDivElement);
+ expect(list[1], isCanvasElement);
+ expect(list[2], isDivElement);
+ expect(list[3], isDivElement);
+ expect(list[4], isCanvasElement);
});
test('immutable', () {
diff --git a/tests/html/request_animation_frame_test.dart b/tests/html/request_animation_frame_test.dart
index 56d0d2f..c61c9ce 100644
--- a/tests/html/request_animation_frame_test.dart
+++ b/tests/html/request_animation_frame_test.dart
@@ -21,7 +21,8 @@
window.requestAnimationFrame(
expectAsync1((timestamp2) {
// Not monotonic on Safari and IE.
- // Expect.isTrue(timestamp2 > timestamp1, 'timestamps ordered');
+ // expect(timestamp2, greaterThan(timestamp1),
+ // reason: 'timestamps ordered');
}));
}));
});
diff --git a/tests/html/selectelement_test.dart b/tests/html/selectelement_test.dart
index 4adb45f..0d354df 100644
--- a/tests/html/selectelement_test.dart
+++ b/tests/html/selectelement_test.dart
@@ -23,7 +23,7 @@
];
element.elements.addAll(options);
expect(element.selectedOptions.length, 1);
- expect(element.selectedOptions[0] == options[4]);
+ expect(element.selectedOptions[0], equals(options[4]));
});
test('multiple selectedOptions', () {
@@ -39,8 +39,8 @@
];
element.elements.addAll(options);
expect(element.selectedOptions.length, 2);
- expect(element.selectedOptions[0] == options[2]);
- expect(element.selectedOptions[1] == options[4]);
+ expect(element.selectedOptions[0], equals(options[2]));
+ expect(element.selectedOptions[1], equals(options[4]));
});
test('options', () {
@@ -53,6 +53,6 @@
];
element.elements.addAll(options);
// Use last to make sure that the list was correctly wrapped.
- expect(element.options.last, options[3]);
+ expect(element.options.last, equals(options[3]));
});
}
diff --git a/tests/html/shadowroot_test.dart b/tests/html/shadowroot_test.dart
index a216392..4a55b27 100644
--- a/tests/html/shadowroot_test.dart
+++ b/tests/html/shadowroot_test.dart
@@ -10,13 +10,16 @@
main() {
useHtmlConfiguration();
+ var isShadowRoot =
+ predicate((x) => x is ShadowRoot, 'is a ShadowRoot');
+
test('ShadowRoot supported', () {
var isSupported = ShadowRoot.supported;
// If it's supported, then it should work. Otherwise should fail.
if (isSupported) {
var shadowRoot = new ShadowRoot(new DivElement());
- expect(shadowRoot is ShadowRoot);
+ expect(shadowRoot, isShadowRoot);
} else {
expect(() => new ShadowRoot(new DivElement()), throws);
}
diff --git a/tests/html/storage_test.dart b/tests/html/storage_test.dart
index 985d377..25f127e 100644
--- a/tests/html/storage_test.dart
+++ b/tests/html/storage_test.dart
@@ -7,13 +7,13 @@
useHtmlConfiguration();
test('GetItem', () {
final value = window.localStorage['does not exist'];
- Expect.isNull(value);
+ expect(value, isNull);
});
test('SetItem', () {
final key = 'foo';
final value = 'bar';
window.localStorage[key] = value;
final stored = window.localStorage[key];
- Expect.equals(value, stored);
+ expect(stored, value);
});
}
diff --git a/tests/html/svg_1_test.dart b/tests/html/svg_1_test.dart
index fc8c724..f536f2c 100644
--- a/tests/html/svg_1_test.dart
+++ b/tests/html/svg_1_test.dart
@@ -8,6 +8,8 @@
main() {
useHtmlConfiguration();
+ var isSVGElement = predicate((x) => x is SVGElement, 'is a SVGElement');
+
test('simpleRect', () {
var div = new Element.tag('div');
document.body.nodes.add(div);
@@ -19,14 +21,14 @@
''';
var e = document.query('#svg1');
- Expect.isTrue(e != null);
+ expect(e, isNotNull);
SVGRectElement r = document.query('#rect1');
- Expect.equals(10, r.x.baseVal.value);
- Expect.equals(20, r.y.baseVal.value);
- Expect.equals(40, r.height.baseVal.value);
- Expect.equals(130, r.width.baseVal.value);
- Expect.equals(5, r.rx.baseVal.value);
+ expect(r.x.baseVal.value, 10);
+ expect(r.y.baseVal.value, 20);
+ expect(r.height.baseVal.value, 40);
+ expect(r.width.baseVal.value, 130);
+ expect(r.rx.baseVal.value, 5);
});
test('trailing newline', () {
@@ -37,7 +39,7 @@
</svg>
""");
- expect(logo is SVGElement, true);
+ expect(logo, isSVGElement);
});
}
diff --git a/tests/html/svg_2_test.dart b/tests/html/svg_2_test.dart
index d792481..1c355c0 100644
--- a/tests/html/svg_2_test.dart
+++ b/tests/html/svg_2_test.dart
@@ -21,27 +21,44 @@
useHtmlConfiguration();
+ var isElement = predicate((x) => x is Element, 'is an Element');
+ var isSVGElement = predicate((x) => x is SVGElement, 'is a SVGElement');
+ var isSVGSVGElement =
+ predicate((x) => x is SVGSVGElement, 'is a SVGSVGElement');
+ var isNode = predicate((x) => x is Node, 'is a Node');
+ var isSVGTests = predicate((x) => x is SVGTests, 'is a SVGTests');
+ var isSVGLangSpace = predicate((x) => x is SVGLangSpace, 'is a SVGLangSpace');
+ var isSVGExternalResourcesRequired =
+ predicate((x) => x is SVGExternalResourcesRequired,
+ 'is a SVGExternalResourcesRequired');
+ var isSVGStylable = predicate((x) => x is SVGStylable, 'is a SVGStylable');
+ var isSVGTransformable =
+ predicate((x) => x is SVGTransformable, 'is a SVGTransformable');
+ var isSVGLocatable = predicate((x) => x is SVGLocatable, 'is a SVGLocatable');
+ var isSVGNumber = predicate((x) => x is SVGNumber, 'is a SVGNumber');
+ var isSVGRect = predicate((x) => x is SVGRect, 'is a SVGRect');
+
test('rect_isChecks', () {
var div = insertTestDiv();
var r = document.query('#rect1');
// Direct inheritance chain
- Expect.isTrue(r is SVGElement);
- Expect.isTrue(r is Element);
- Expect.isTrue(r is Node);
+ expect(r, isSVGElement);
+ expect(r, isElement);
+ expect(r, isNode);
// Other implemented interfaces.
- Expect.isTrue(r is SVGTests);
- Expect.isTrue(r is SVGLangSpace);
- Expect.isTrue(r is SVGExternalResourcesRequired);
- Expect.isTrue(r is SVGStylable);
- Expect.isTrue(r is SVGTransformable);
- Expect.isTrue(r is SVGLocatable);
+ expect(r, isSVGTests);
+ expect(r, isSVGLangSpace);
+ expect(r, isSVGExternalResourcesRequired);
+ expect(r, isSVGStylable);
+ expect(r, isSVGTransformable);
+ expect(r, isSVGLocatable);
// Interfaces not implemented.
- Expect.isFalse(r is SVGNumber);
- Expect.isFalse(r is SVGRect);
- Expect.isFalse(r is SVGSVGElement);
+ expect(r, isNot(isSVGNumber));
+ expect(r, isNot(isSVGRect));
+ expect(r, isNot(isSVGSVGElement));
div.remove();
});
diff --git a/tests/html/svg_3_test.dart b/tests/html/svg_3_test.dart
index 46d0cc2..573c198 100644
--- a/tests/html/svg_3_test.dart
+++ b/tests/html/svg_3_test.dart
@@ -9,6 +9,21 @@
main() {
+ var isString = predicate((x) => x is String, 'is a String');
+ var isStringList = predicate((x) => x is List<String>, 'is a List<String>');
+ var isSVGMatrix = predicate((x) => x is SVGMatrix, 'is a SVGMatrix');
+ var isSVGAnimatedBoolean =
+ predicate((x) => x is SVGAnimatedBoolean, 'is an SVGAnimatedBoolean');
+ var isSVGAnimatedString =
+ predicate((x) => x is SVGAnimatedString, 'is an SVGAnimatedString');
+ var isSVGRect = predicate((x) => x is SVGRect, 'is a SVGRect');
+ var isSVGAnimatedTransformList =
+ predicate((x) => x is SVGAnimatedTransformList,
+ 'is an SVGAnimatedTransformList');
+ var isCSSStyleDeclaration =
+ predicate((x) => x is CSSStyleDeclaration, 'is a CSSStyleDeclaration');
+ var isCSSValue = predicate((x) => x is CSSValue, 'is a CSSValue');
+
insertTestDiv() {
var element = new Element.tag('div');
element.innerHTML = r'''
@@ -28,14 +43,14 @@
checkSVGTests(e) {
// Just check that the operations seem to exist.
var rx = e.requiredExtensions;
- Expect.isTrue(rx is List<String>);
+ expect(rx, isStringList);
var rf = e.requiredFeatures;
- Expect.isTrue(rf is List<String>);
+ expect(rf, isStringList);
var sl = e.systemLanguage;
- Expect.isTrue(sl is List<String>);
+ expect(sl, isStringList);
bool hasDoDo = e.hasExtension("DoDo");
- Expect.isFalse(hasDoDo);
+ expect(hasDoDo, isFalse);
}
/**
@@ -49,8 +64,8 @@
String space = e.xmlspace;
e.xmlspace = space;
- Expect.isTrue(lang is String);
- Expect.isTrue(space is String);
+ expect(lang, isString);
+ expect(space, isString);
}
/**
@@ -59,9 +74,9 @@
*/
checkSVGExternalResourcesRequired(e) {
var b = e.externalResourcesRequired;
- Expect.isTrue(b is SVGAnimatedBoolean);
- Expect.isFalse(b.baseVal);
- Expect.isFalse(b.animVal);
+ expect(b, isSVGAnimatedBoolean);
+ expect(b.baseVal, isFalse);
+ expect(b.animVal, isFalse);
}
/**
@@ -69,13 +84,13 @@
*/
checkSVGStylable(e) {
var className = e.$dom_svgClassName;
- Expect.isTrue(className is SVGAnimatedString);
+ expect(className, isSVGAnimatedString);
var s = e.style;
- Expect.isTrue(s is CSSStyleDeclaration);
+ expect(s, isCSSStyleDeclaration);
var attributeA = e.getPresentationAttribute('A');
- Expect.isTrue(attributeA === null || attributeA is CSSValue);
+ expect(attributeA, anyOf(isNull, isCSSValue));
}
/**
@@ -84,19 +99,19 @@
checkSVGLocatable(e) {
var v1 = e.farthestViewportElement;
var v2 = e.nearestViewportElement;
- Expect.isTrue(v1 === v2);
+ expect(v1, same(v2));
var bbox = e.getBBox();
- Expect.isTrue(bbox is SVGRect);
+ expect(bbox, isSVGRect);
var ctm = e.getCTM();
- Expect.isTrue(ctm is SVGMatrix);
+ expect(ctm, isSVGMatrix);
var sctm = e.getScreenCTM();
- Expect.isTrue(sctm is SVGMatrix);
+ expect(sctm, isSVGMatrix);
var xf2e = e.getTransformToElement(e);
- Expect.isTrue(xf2e is SVGMatrix);
+ expect(xf2e, isSVGMatrix);
}
/**
@@ -105,7 +120,7 @@
*/
checkSVGTransformable(e) {
var trans = e.transform;
- Expect.isTrue(trans is SVGAnimatedTransformList);
+ expect(trans, isSVGAnimatedTransformList);
}
testRect(name, checker) {
diff --git a/tests/html/svgelement2_test.dart b/tests/html/svgelement2_test.dart
index 218e7a6..024cf6b 100644
--- a/tests/html/svgelement2_test.dart
+++ b/tests/html/svgelement2_test.dart
@@ -17,6 +17,6 @@
// The svgelement_test requires the field "_this" to map to "_this". In this
// test-case we use another library's '_this' first (see issue 3039 and
// _ChildNodeListLazy.first).
- Expect.equals(499, new A(499)._this);
+ expect(new A(499)._this, 499);
originalTest.main();
}
diff --git a/tests/html/svgelement_test.dart b/tests/html/svgelement_test.dart
index 9892601..69ab4fe 100644
--- a/tests/html/svgelement_test.dart
+++ b/tests/html/svgelement_test.dart
@@ -10,6 +10,9 @@
main() {
useHtmlConfiguration();
+ var isSVGSVGElement =
+ predicate((x) => x is SVGSVGElement, 'is a SVGSVGElement');
+
Collection<String> _nodeStrings(Collection<Node> input) {
final out = new List<String>();
for (Node n in input) {
@@ -25,9 +28,9 @@
testConstructor(String tagName, Function isExpectedClass) {
test(tagName, () {
- Expect.isTrue(isExpectedClass(new SVGElement.tag(tagName)));
- Expect.isTrue(isExpectedClass(
- new SVGElement.svg('<$tagName></$tagName>')));
+ expect(isExpectedClass(new SVGElement.tag(tagName)), isTrue);
+ expect(isExpectedClass(
+ new SVGElement.svg('<$tagName></$tagName>')), isTrue);
});
}
@@ -40,23 +43,22 @@
<path></path>
</svg>""";
final el = new SVGElement.svg(svg);
- Expect.isTrue(el is SVGSVGElement);
- Expect.equals("<circle></circle><path></path>", el.innerHTML);
- Expect.equals(svg, el.outerHTML);
+ expect(el, isSVGSVGElement);
+ expect(el.innerHTML, "<circle></circle><path></path>");
+ expect(el.outerHTML, svg);
});
test('has no parent', () =>
- Expect.isNull(new SVGElement.svg('<circle/>').parent));
+ expect(new SVGElement.svg('<circle/>').parent, isNull)
+ );
test('empty', () {
- Expect.throws(() => new SVGElement.svg(""),
- (e) => e is ArgumentError);
+ expect(() => new SVGElement.svg(""), throwsArgumentError);
});
test('too many elements', () {
- Expect.throws(
- () => new SVGElement.svg("<circle></circle><path></path>"),
- (e) => e is ArgumentError);
+ expect(() => new SVGElement.svg("<circle></circle><path></path>"),
+ throwsArgumentError);
});
});
@@ -149,8 +151,8 @@
final el = new SVGSVGElement();
el.elements.add(new SVGElement.tag("circle"));
el.elements.add(new SVGElement.tag("path"));
- Expect.equals('<svg version="1.1"><circle></circle><path></path></svg>',
- el.outerHTML);
+ expect(el.outerHTML,
+ '<svg version="1.1"><circle></circle><path></path></svg>');
});
group('innerHTML', () {
@@ -158,7 +160,7 @@
final el = new SVGSVGElement();
el.elements.add(new SVGElement.tag("circle"));
el.elements.add(new SVGElement.tag("path"));
- Expect.equals('<circle></circle><path></path>', el.innerHTML);
+ expect(el.innerHTML, '<circle></circle><path></path>');
});
test('set', () {
@@ -166,7 +168,7 @@
el.elements.add(new SVGElement.tag("circle"));
el.elements.add(new SVGElement.tag("path"));
el.innerHTML = '<rect></rect><a></a>';
- Expect.listEquals(["rect", "a"], _nodeStrings(el.elements));
+ expect(_nodeStrings(el.elements), ["rect", "a"]);
});
});
@@ -178,13 +180,13 @@
<path></path>
text
</svg>""");
- Expect.listEquals(["circle", "path"], _nodeStrings(el.elements));
+ expect(_nodeStrings(el.elements), ["circle", "path"]);
});
test('set', () {
final el = new SVGSVGElement();
el.elements = [new SVGElement.tag("circle"), new SVGElement.tag("path")];
- Expect.equals('<circle></circle><path></path>', el.innerHTML);
+ expect(el.innerHTML, '<circle></circle><path></path>');
});
});
}
diff --git a/tests/html/transferables_test.dart b/tests/html/transferables_test.dart
index 220852c..8779362 100644
--- a/tests/html/transferables_test.dart
+++ b/tests/html/transferables_test.dart
@@ -10,9 +10,12 @@
main() {
useHtmlConfiguration();
+ var isArrayBuffer =
+ predicate((x) => x is ArrayBuffer, 'is an ArrayBuffer');
+
test('TransferableTest', () {
window.on.message.add(expectAsync1((messageEvent) {
- expect(messageEvent.data, new isInstanceOf<ArrayBuffer>());
+ expect(messageEvent.data, isArrayBuffer);
}));
final buffer = (new Float32Array(3)).buffer;
window.postMessage(buffer, '*', [buffer]);
diff --git a/tests/html/typed_arrays_1_test.dart b/tests/html/typed_arrays_1_test.dart
index daca422..860ed71 100644
--- a/tests/html/typed_arrays_1_test.dart
+++ b/tests/html/typed_arrays_1_test.dart
@@ -10,36 +10,39 @@
main() {
useHtmlConfiguration();
+ var isnumList = predicate((x) => x is List<num>, 'is a List<num>');
+ var isStringList = predicate((x) => x is List<String>, 'is a List<String>');
+
test('createByLengthTest', () {
var a = new Float32Array(10);
- Expect.equals(10, a.length);
- Expect.equals(0, a[4]);
+ expect(a.length, 10);
+ expect(a[4], 0);
});
test('aliasTest', () {
var a1 = new Uint8Array.fromList([0,0,1,0x45]);
var a2 = new Float32Array.fromBuffer(a1.buffer);
- Expect.equals(1, a2.length);
+ expect(a2.length, 1);
// 0x45010000 = 2048+16
- Expect.equals(2048 + 16, a2[0]);
+ expect(a2[0], 2048 + 16);
a1[2] = 0;
// 0x45000000 = 2048
- Expect.equals(2048, a2[0]);
+ expect(a2[0], 2048);
a1[3]--;
a1[2] += 128;
// 0x44800000 = 1024
- Expect.equals(1024, a2[0]);
+ expect(a2[0], 1024);
});
test('typeTests', () {
var a = new Float32Array(10);
- Expect.isTrue(a is List);
- Expect.isTrue(a is List<num>);
- Expect.isTrue(a is! List<String>);
+ expect(a, isList);
+ expect(a, isnumList);
+ expect(a, isNot(isStringList));
});
}
diff --git a/tests/html/typed_arrays_2_test.dart b/tests/html/typed_arrays_2_test.dart
index 6705833f..a2e747e 100644
--- a/tests/html/typed_arrays_2_test.dart
+++ b/tests/html/typed_arrays_2_test.dart
@@ -17,32 +17,32 @@
}
var a2 = new Uint32Array.fromBuffer(a1.buffer);
- Expect.equals(1024 ~/ 4, a2.length);
- Expect.equals(0x03020100, a2[0]);
- Expect.equals(0x07060504, a2[1]);
- Expect.equals(0x0B0A0908, a2[2]);
- Expect.equals(0xCBCAC9C8, a2[50]);
- Expect.equals(0xCFCECDCC, a2[51]);
- Expect.equals(0x03020100, a2[64]);
+ expect(1024 ~/ 4, a2.length);
+ expect(a2[0], 0x03020100);
+ expect(a2[1], 0x07060504);
+ expect(a2[2], 0x0B0A0908);
+ expect(a2[50], 0xCBCAC9C8);
+ expect(a2[51], 0xCFCECDCC);
+ expect(a2[64], 0x03020100);
a2 = new Uint32Array.fromBuffer(a1.buffer, 200);
- Expect.equals((1024 - 200) ~/ 4, a2.length);
- Expect.equals(0xCBCAC9C8, a2[0]);
- Expect.equals(0xCFCECDCC, a2[1]);
- Expect.equals(0x03020100, a2[14]);
+ expect(a2.length, (1024 - 200) ~/ 4);
+ expect(a2[0], 0xCBCAC9C8);
+ expect(a2[1], 0xCFCECDCC);
+ expect(a2[14], 0x03020100);
a2 = new Uint32Array.fromBuffer(a1.buffer, 456, 20);
- Expect.equals(20, a2.length);
- Expect.equals(0xCBCAC9C8, a2[0]);
- Expect.equals(0xCFCECDCC, a2[1]);
- Expect.equals(0x03020100, a2[14]);
+ expect(a2.length, 20);
+ expect(a2[0], 0xCBCAC9C8);
+ expect(a2[1], 0xCFCECDCC);
+ expect(a2[14], 0x03020100);
// OPTIONALS a2 = new Uint32Array.fromBuffer(a1.buffer, length: 30, byteOffset: 456);
a2 = new Uint32Array.fromBuffer(a1.buffer, 456, 30);
- Expect.equals(30, a2.length);
- Expect.equals(0xCBCAC9C8, a2[0]);
- Expect.equals(0xCFCECDCC, a2[1]);
- Expect.equals(0x03020100, a2[14]);
+ expect(a2.length, 30);
+ expect(a2[0], 0xCBCAC9C8);
+ expect(a2[1], 0xCFCECDCC);
+ expect(a2[14], 0x03020100);
});
test('fromBufferTest_typed', () {
@@ -52,29 +52,29 @@
}
Uint32Array a2 = new Uint32Array.fromBuffer(a1.buffer);
- Expect.equals(1024 ~/ 4, a2.length);
- Expect.equals(0x03020100, a2[0]);
- Expect.equals(0xCBCAC9C8, a2[50]);
- Expect.equals(0xCFCECDCC, a2[51]);
- Expect.equals(0x03020100, a2[64]);
+ expect(a2.length, 1024 ~/ 4);
+ expect(a2[0], 0x03020100);
+ expect(a2[50], 0xCBCAC9C8);
+ expect(a2[51], 0xCFCECDCC);
+ expect(a2[64], 0x03020100);
a2 = new Uint32Array.fromBuffer(a1.buffer, 200);
- Expect.equals((1024 - 200) ~/ 4, a2.length);
- Expect.equals(0xCBCAC9C8, a2[0]);
- Expect.equals(0xCFCECDCC, a2[1]);
- Expect.equals(0x03020100, a2[14]);
+ expect(a2.length, (1024 - 200) ~/ 4);
+ expect(a2[0], 0xCBCAC9C8);
+ expect(a2[1], 0xCFCECDCC);
+ expect(a2[14], 0x03020100);
a2 = new Uint32Array.fromBuffer(a1.buffer, 456, 20);
- Expect.equals(20, a2.length);
- Expect.equals(0xCBCAC9C8, a2[0]);
- Expect.equals(0xCFCECDCC, a2[1]);
- Expect.equals(0x03020100, a2[14]);
+ expect(20, a2.length);
+ expect(a2[0], 0xCBCAC9C8);
+ expect(a2[1], 0xCFCECDCC);
+ expect(a2[14], 0x03020100);
// OPTIONALS a2 = new Uint32Array.fromBuffer(a1.buffer, length: 30, byteOffset: 456);
a2 = new Uint32Array.fromBuffer(a1.buffer, 456, 30);
- Expect.equals(30, a2.length);
- Expect.equals(0xCBCAC9C8, a2[0]);
- Expect.equals(0xCFCECDCC, a2[1]);
- Expect.equals(0x03020100, a2[14]);
+ expect(a2.length, 30);
+ expect(a2[0], 0xCBCAC9C8);
+ expect(a2[1], 0xCFCECDCC);
+ expect(a2[14], 0x03020100);
});
}
diff --git a/tests/html/typed_arrays_3_test.dart b/tests/html/typed_arrays_3_test.dart
index 7d0c1a5..a1f9416 100644
--- a/tests/html/typed_arrays_3_test.dart
+++ b/tests/html/typed_arrays_3_test.dart
@@ -16,12 +16,12 @@
a1.setElements([0x50,0x60,0x70], 4);
var a2 = new Uint32Array.fromBuffer(a1.buffer);
- Expect.equals(0x00000000, a2[0]);
- Expect.equals(0x00706050, a2[1]);
+ expect(a2[0], 0x00000000);
+ expect(a2[1], 0x00706050);
a2.setElements([0x01020304], 2);
- Expect.equals(0x04, a1[8]);
- Expect.equals(0x01, a1[11]);
+ expect(a1[8], 0x04);
+ expect(a1[11], 0x01);
});
test('setElementsTest_typed', () {
@@ -30,11 +30,11 @@
a1.setElements([0x50,0x60,0x70], 4);
Uint32Array a2 = new Uint32Array.fromBuffer(a1.buffer);
- Expect.equals(0x00000000, a2[0]);
- Expect.equals(0x00706050, a2[1]);
+ expect(a2[0], 0x00000000);
+ expect(a2[1], 0x00706050);
a2.setElements([0x01020304], 2);
- Expect.equals(0x04, a1[8]);
- Expect.equals(0x01, a1[11]);
+ expect(a1[8], 0x04);
+ expect(a1[11], 0x01);
});
}
diff --git a/tests/html/typed_arrays_4_test.dart b/tests/html/typed_arrays_4_test.dart
index 43f3331..59e532c 100644
--- a/tests/html/typed_arrays_4_test.dart
+++ b/tests/html/typed_arrays_4_test.dart
@@ -16,13 +16,13 @@
a1[i] = i;
}
- Expect.equals(50, a1.indexOf(50));
- Expect.equals(50, a1.indexOf(50, 50));
- Expect.equals(256 + 50, a1.indexOf(50, 51));
+ expect(a1.indexOf(50), 50);
+ expect(a1.indexOf(50, 50), 50);
+ expect(a1.indexOf(50, 51), 256 + 50);
- Expect.equals(768 + 50, a1.lastIndexOf(50));
- Expect.equals(768 + 50, a1.lastIndexOf(50, 768 + 50));
- Expect.equals(512 + 50, a1.lastIndexOf(50, 768 + 50 - 1));
+ expect(a1.lastIndexOf(50), 768 + 50);
+ expect(a1.lastIndexOf(50, 768 + 50), 768 + 50);
+ expect(a1.lastIndexOf(50, 768 + 50 - 1), 512 + 50);
});
test('indexOf_typed', () {
@@ -31,12 +31,12 @@
a1[i] = i;
}
- Expect.equals(50, a1.indexOf(50));
- Expect.equals(50, a1.indexOf(50, 50));
- Expect.equals(256 + 50, a1.indexOf(50, 51));
+ expect(a1.indexOf(50), 50);
+ expect(a1.indexOf(50, 50), 50);
+ expect(a1.indexOf(50, 51), 256 + 50);
- Expect.equals(768 + 50, a1.lastIndexOf(50));
- Expect.equals(768 + 50, a1.lastIndexOf(50, 768 + 50));
- Expect.equals(512 + 50, a1.lastIndexOf(50, 768 + 50 - 1));
+ expect(a1.lastIndexOf(50), 768 + 50);
+ expect(a1.lastIndexOf(50, 768 + 50), 768 + 50);
+ expect(a1.lastIndexOf(50, 768 + 50 - 1), 512 + 50);
});
}
diff --git a/tests/html/typing_test.dart b/tests/html/typing_test.dart
index 518a7d3..ec544d8 100644
--- a/tests/html/typing_test.dart
+++ b/tests/html/typing_test.dart
@@ -6,6 +6,9 @@
main() {
useHtmlConfiguration();
+ var isStyleSheetList =
+ predicate((x) => x is List<StyleSheet>, 'is a List<StyleSheet>');
+
test('NodeList', () {
List<Node> asList = window.document.queryAll('body');
// Check it's Iterable
@@ -13,15 +16,15 @@
for (Node node in window.document.queryAll('body')) {
counter++;
}
- Expect.equals(1, counter);
+ expect(counter, 1);
counter = 0;
window.document.queryAll('body').forEach((e) { counter++; });
- Expect.equals(1, counter);
+ expect(counter, 1);
});
test('StyleSheetList', () {
List<StyleSheet> asList = window.document.styleSheets;
- expect(asList is List<StyleSheet>);
+ expect(asList, isStyleSheetList);
// Check it's Iterable.
int counter = 0;
for (StyleSheet styleSheet in window.document.styleSheets) {
@@ -29,6 +32,6 @@
}
// There is one style sheet from the unittest framework.
- Expect.equals(1, counter);
+ expect(counter, 1);
});
}
diff --git a/tests/html/unknownelement_test.dart b/tests/html/unknownelement_test.dart
index 86a67b1..00d7ca6 100644
--- a/tests/html/unknownelement_test.dart
+++ b/tests/html/unknownelement_test.dart
@@ -10,6 +10,9 @@
main() {
useHtmlConfiguration();
+ var isUnknownElement =
+ predicate((x) => x is UnknownElement, 'is an UnknownELement');
+
var foo = new Element.tag('foo');
foo.id = 'foo';
var bar = new Element.tag('bar');
@@ -17,8 +20,8 @@
document.body.nodes.addAll([foo, bar]);
test('type-check', () {
- expect(foo is UnknownElement, isTrue);
- expect(bar is UnknownElement, isTrue);
+ expect(foo, isUnknownElement);
+ expect(bar, isUnknownElement);
expect(query('#foo'), equals(foo));
expect(query('#bar'), equals(bar));
});
@@ -57,7 +60,7 @@
}
break;
}
- throw new NoSuchMethodError(element, name, args);
+ throw new NoSuchMethodError(element, name, args, {});
}
dynamicUnknownElementDispatcher = dispatch;
diff --git a/tests/html/url_test.dart b/tests/html/url_test.dart
index 6cfc815..8fec60a 100644
--- a/tests/html/url_test.dart
+++ b/tests/html/url_test.dart
@@ -38,7 +38,7 @@
var blob = createImageBlob();
var url = window.createObjectUrl(blob);
expect(url.length, greaterThan(0));
- expect(url.startsWith('blob:'));
+ expect(url, startsWith('blob:'));
var img = new ImageElement();
img.on.load.add(expectAsync1((_) {
@@ -46,7 +46,7 @@
}));
img.on.error.add((_) {
guardAsync(() {
- expect(true, isFalse, 'URL failed to load.');
+ expect(true, isFalse, reason: 'URL failed to load.');
});
});
img.src = url;
@@ -55,7 +55,7 @@
test('revokeObjectUrl', () {
var blob = createImageBlob();
var url = window.createObjectUrl(blob);
- expect(url.startsWith('blob:'));
+ expect(url, startsWith('blob:'));
window.revokeObjectUrl(url);
var img = new ImageElement();
@@ -64,7 +64,7 @@
}));
img.on.load.add((_) {
guardAsync(() {
- expect(true, isFalse, 'URL should not have loaded.');
+ expect(true, isFalse, reason: 'URL should not have loaded.');
});
});
img.src = url;
diff --git a/tests/html/util.dart b/tests/html/util.dart
index 511a576..9451581 100644
--- a/tests/html/util.dart
+++ b/tests/html/util.dart
@@ -2,14 +2,13 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-void expectUnsupported(void fn()) =>
- Expect.throws(fn, (e) => e is UnsupportedError);
+void expectUnsupported(f) => expect(f, throwsUnsupportedError);
void expectEmptyRect(ClientRect rect) {
- Expect.equals(0, rect.bottom);
- Expect.equals(0, rect.top);
- Expect.equals(0, rect.left);
- Expect.equals(0, rect.right);
- Expect.equals(0, rect.height);
- Expect.equals(0, rect.width);
+ expect(rect.bottom, isZero);
+ expect(rect.top, isZero);
+ expect(rect.left, isZero);
+ expect(rect.right, isZero);
+ expect(rect.height, isZero);
+ expect(rect.width, isZero);
}
diff --git a/tests/html/utils.dart b/tests/html/utils.dart
index 2c07fcf..9752239 100644
--- a/tests/html/utils.dart
+++ b/tests/html/utils.dart
@@ -1,4 +1,5 @@
#library('TestUtils');
+#import('../../pkg/unittest/unittest.dart');
/**
* Verifies that [actual] has the same graph structure as [expected].
@@ -14,22 +15,22 @@
walk(path, expected, actual) {
if (expected is String || expected is num || expected == null) {
- Expect.equals(expected, actual, message(path, 'not equal'));
+ expect(actual, equals(expected), reason: message(path, 'not equal'));
return;
}
// Cycle or DAG?
for (int i = 0; i < eItems.length; i++) {
if (expected === eItems[i]) {
- Expect.identical(aItems[i], actual,
- message(path, 'missing back or side edge'));
+ expect(actual, same(aItems[i]),
+ reason: message(path, 'missing back or side edge'));
return;
}
}
for (int i = 0; i < aItems.length; i++) {
if (actual === aItems[i]) {
- Expect.identical(eItems[i], expected,
- message(path, 'extra back or side edge'));
+ expect(expected, same(eItems[i]),
+ reason: message(path, 'extra back or side edge'));
return;
}
}
@@ -37,9 +38,9 @@
aItems.add(actual);
if (expected is List) {
- Expect.isTrue(actual is List, message(path, '$actual is List'));
- Expect.equals(expected.length, actual.length,
- message(path, 'different list lengths'));
+ expect(actual, isList, reason: message(path, '$actual is List'));
+ expect(actual.length, expected.length,
+ reason: message(path, 'different list lengths'));
for (var i = 0; i < expected.length; i++) {
walk('$path[$i]', expected[i], actual[i]);
}
@@ -47,22 +48,22 @@
}
if (expected is Map) {
- Expect.isTrue(actual is Map, message(path, '$actual is Map'));
+ expect(actual, isMap, reason: message(path, '$actual is Map'));
for (var key in expected.keys) {
if (!actual.containsKey(key)) {
- Expect.fail(message(path, 'missing key "$key"'));
+ expect(false, isTrue, reason: message(path, 'missing key "$key"'));
}
walk('$path["$key"]', expected[key], actual[key]);
}
for (var key in actual.keys) {
if (!expected.containsKey(key)) {
- Expect.fail(message(path, 'extra key "$key"'));
+ expect(false, isTrue, reason: message(path, 'extra key "$key"'));
}
}
return;
}
- Expect.fail('Unhandled type: $expected');
+ expect(false, isTrue, reason: 'Unhandled type: $expected');
}
walk('', expected, actual);
diff --git a/tests/html/webgl_1_test.dart b/tests/html/webgl_1_test.dart
index 5be80d7..8ad757c 100644
--- a/tests/html/webgl_1_test.dart
+++ b/tests/html/webgl_1_test.dart
@@ -16,6 +16,6 @@
gl.compileShader(shader);
var success =
gl.getShaderParameter(shader, WebGLRenderingContext.COMPILE_STATUS);
- Expect.isTrue(success);
+ expect(success, isTrue);
});
}
diff --git a/tests/html/websocket_test.dart b/tests/html/websocket_test.dart
index 25c271c..d14765f 100644
--- a/tests/html/websocket_test.dart
+++ b/tests/html/websocket_test.dart
@@ -7,9 +7,11 @@
useHtmlConfiguration();
+ var isWebSocket = predicate((x) => x is WebSocket, 'is a WebSocket');
+
test('constructorTest', () {
var socket = new WebSocket('ws://localhost');
- Expect.isTrue(socket != null);
- Expect.isTrue(socket is WebSocket);
+ expect(socket, isNotNull);
+ expect(socket, isWebSocket);
});
}
diff --git a/tests/html/websql_test.dart b/tests/html/websql_test.dart
index 8cf2fd2..047e9b3 100644
--- a/tests/html/websql_test.dart
+++ b/tests/html/websql_test.dart
@@ -5,7 +5,7 @@
void fail(message) {
guardAsync(() {
- Expect.fail(message);
+ expect(false, isTrue, reason: message);
});
}
@@ -94,7 +94,7 @@
final db = window.openDatabase('test_db', '1.0', 'test_db', 1024 * 1024);
- Expect.isNotNull(db, 'Unable to open database');
+ expect(db, isNotNull, reason: 'Unable to open database');
createTransaction(db)
// Attempt to clear out any tables which may be lurking from previous
@@ -104,10 +104,10 @@
.chain(insert(tableName, columnName, 'Some text data'))
.chain(queryTable(tableName, (resultSet) {
guardAsync(() {
- Expect.equals(1, resultSet.rows.length);
+ expect(resultSet.rows.length, 1);
var row = resultSet.rows.item(0);
- Expect.isTrue(row.containsKey(columnName));
- Expect.equals('Some text data', row[columnName]);
+ expect(row.containsKey(columnName), isTrue);
+ expect(row[columnName], 'Some text data');
});
}))
.chain(dropTable(tableName))
diff --git a/tests/html/window_eq_test.dart b/tests/html/window_eq_test.dart
index a91d1e3..015c985 100644
--- a/tests/html/window_eq_test.dart
+++ b/tests/html/window_eq_test.dart
@@ -8,7 +8,7 @@
var obfuscated = null;
test('notNull', () {
- Expect.isNotNull(window);
- Expect.isTrue(window != obfuscated);
+ expect(window, isNotNull);
+ expect(window, isNot(equals(obfuscated)));
});
}
diff --git a/tests/html/window_mangling_test.dart b/tests/html/window_mangling_test.dart
index 911a1ef..83d5481 100644
--- a/tests/html/window_mangling_test.dart
+++ b/tests/html/window_mangling_test.dart
@@ -20,16 +20,16 @@
test('windowMethod', () {
final message = navigator;
final x = win.navigator;
- Expect.notEquals(message, x);
+ expect(x, isNot(equals(message)));
});
test('windowEquals', () {
- Expect.isFalse($eq(win, win));
- Expect.isTrue(win == win);
+ expect($eq(win, win), isFalse);
+ expect(win == win, isTrue);
});
test('windowEquals', () {
- Expect.isFalse($eq$(win, win));
- Expect.isTrue(win == win);
+ expect($eq$(win, win), isFalse);
+ expect(win == win, isTrue);
});
}
diff --git a/tests/html/window_nosuchmethod_test.dart b/tests/html/window_nosuchmethod_test.dart
index b46f4f8..cad0678 100644
--- a/tests/html/window_nosuchmethod_test.dart
+++ b/tests/html/window_nosuchmethod_test.dart
@@ -25,18 +25,18 @@
final message = foo("Hello World");
try {
String x = win.foo(message);
- Expect.fail('Should not reach here: $x');
+ expect(false, isTrue, reason: 'Should not reach here: $x');
} on NoSuchMethodError catch (e) {
// Expected exception.
} on Exception catch (e) {
- Expect.fail('Wrong exception: $e');
+ expect(false, isTrue, reason: 'Wrong exception: $e');
}
});
test('foo', () {
var win = things[inscrutable(0)];
String x = win.foo('bar');
- Expect.equals('not bar', x);
+ expect(x, 'not bar');
});
// Use dom.window direclty in case the compiler does type inference.
@@ -44,11 +44,11 @@
final message = foo("Hello World");
try {
String x = dom.window.foo(message);
- Expect.fail('Should not reach here: $x');
+ expect(false, isTrue, reason: 'Should not reach here: $x');
} on NoSuchMethodError catch (e) {
// Expected exception.
} on Exception catch (e) {
- Expect.fail('Wrong exception: $e');
+ expect(false, isTrue, reason: 'Wrong exception: $e');
}
});
}
diff --git a/tests/html/xhr_cross_origin_test.dart b/tests/html/xhr_cross_origin_test.dart
index 472950c..a210f66 100644
--- a/tests/html/xhr_cross_origin_test.dart
+++ b/tests/html/xhr_cross_origin_test.dart
@@ -18,7 +18,7 @@
var validate = expectAsync1((data) {
expect(data, contains('feed'));
expect(data['feed'], contains('entry'));
- expect(data is Map, isTrue);
+ expect(data, isMap);
});
xhr.on.readyStateChange.add((e) {
guardAsync(() {
@@ -36,7 +36,7 @@
var data = JSON.parse(xhr.response);
expect(data, contains('feed'));
expect(data['feed'], contains('entry'));
- expect(data is Map, isTrue);
+ expect(data, isMap);
}));
});
}
diff --git a/tests/html/xmldocument_test.dart b/tests/html/xmldocument_test.dart
index dccf15b..980801d 100644
--- a/tests/html/xmldocument_test.dart
+++ b/tests/html/xmldocument_test.dart
@@ -10,27 +10,30 @@
main() {
useHtmlConfiguration();
+ var isXMLDocument = predicate((x) => x is XMLDocument, 'is an XMLDocument');
+ var isXMLElement = predicate((x) => x is XMLElement, 'is an XMLElement');
+
XMLDocument makeDocument() => new XMLDocument.xml("<xml><foo/><bar/></xml>");
group('constructor', () {
test('with a well-formed document', () {
final doc = makeDocument();
- Expect.isTrue(doc is XMLDocument);
- Expect.equals('foo', doc.elements[0].tagName);
- Expect.equals('bar', doc.elements[1].tagName);
+ expect(doc, isXMLDocument);
+ expect(doc.elements[0].tagName, 'foo');
+ expect(doc.elements[1].tagName, 'bar');
});
// TODO(nweiz): re-enable this when Document#query matches the root-level
// element. Otherwise it fails on Firefox.
//
// test('with a parse error', () {
- // Expect.throws(() => new XMLDocument.xml("<xml></xml>foo"),
- // (e) => e is ArgumentError);
+ // expect(() => new XMLDocument.xml("<xml></xml>foo"),
+ // throwsArgumentError);
// });
test('with a PARSERERROR tag', () {
final doc = new XMLDocument.xml("<xml><parsererror /></xml>");
- Expect.equals('parsererror', doc.elements[0].tagName);
+ expect(doc.elements[0].tagName, 'parsererror');
});
});
@@ -38,13 +41,13 @@
group('elements', () {
test('filters out non-element nodes', () {
final doc = new XMLDocument.xml("<xml>1<a/><b/>2<c/>3<d/></xml>");
- Expect.listEquals(["a", "b", "c", "d"], doc.elements.map((e) => e.tagName));
+ expect(doc.elements.map((e) => e.tagName), ["a", "b", "c", "d"]);
});
test('overwrites nodes when set', () {
final doc = new XMLDocument.xml("<xml>1<a/><b/>2<c/>3<d/></xml>");
doc.elements = [new XMLElement.tag('x'), new XMLElement.tag('y')];
- Expect.equals("<xml><x></x><y></y></xml>", doc.outerHTML);
+ expect(doc.outerHTML, "<xml><x></x><y></y></xml>");
});
});
@@ -62,32 +65,32 @@
test('affects the "class" attribute', () {
final doc = makeDocumentWithClasses();
doc.classes.add('qux');
- Expect.setEquals(['foo', 'bar', 'baz', 'qux'], extractClasses(doc));
+ expect(extractClasses(doc), ["foo", "bar", "baz", "qux"]);
});
test('is affected by the "class" attribute', () {
final doc = makeDocumentWithClasses();
doc.attributes['class'] = 'foo qux';
- Expect.setEquals(['foo', 'qux'], doc.classes);
+ expect(doc.classes, ["foo", "qux"]);
});
test('classes=', () {
final doc = makeDocumentWithClasses();
doc.classes = ['foo', 'qux'];
- Expect.setEquals(['foo', 'qux'], doc.classes);
- Expect.setEquals(['foo', 'qux'], extractClasses(doc));
+ expect(doc.classes, ["foo", "qux"]);
+ expect(extractClasses(doc), ["foo", "qux"]);
});
test('toString', () {
- Expect.setEquals(['foo', 'bar', 'baz'],
- makeClassSet().toString().split(' '));
- Expect.equals('', makeDocument().classes.toString());
+ expect(makeClassSet().toString().split(' '),
+ unorderedEquals(['foo', 'bar', 'baz']));
+ expect(makeDocument().classes.toString(), '');
});
test('forEach', () {
final classes = <String>[];
makeClassSet().forEach(classes.add);
- Expect.setEquals(['foo', 'bar', 'baz'], classes);
+ expect(classes, unorderedEquals(['foo', 'bar', 'baz']));
});
test('iterator', () {
@@ -95,101 +98,99 @@
for (var doc in makeClassSet()) {
classes.add(doc);
}
- Expect.setEquals(['foo', 'bar', 'baz'], classes);
+ expect(classes, unorderedEquals(['foo', 'bar', 'baz']));
});
test('map', () {
- Expect.setEquals(['FOO', 'BAR', 'BAZ'],
- makeClassSet().map((c) => c.toUpperCase()));
+ expect(makeClassSet().map((c) => c.toUpperCase()),
+ unorderedEquals(['FOO', 'BAR', 'BAZ']));
});
test('filter', () {
- Expect.setEquals(['bar', 'baz'],
- makeClassSet().filter((c) => c.contains('a')));
+ expect(makeClassSet().filter((c) => c.contains('a')),
+ unorderedEquals(['bar', 'baz']));
});
test('every', () {
- Expect.isTrue(makeClassSet().every((c) => c is String));
- Expect.isFalse(
- makeClassSet().every((c) => c.contains('a')));
+ expect(makeClassSet().every((c) => c is String), isTrue);
+ expect(makeClassSet().every((c) => c.contains('a')), isFalse);
});
test('some', () {
- Expect.isTrue(
- makeClassSet().some((c) => c.contains('a')));
- Expect.isFalse(makeClassSet().some((c) => c is num));
+ expect(makeClassSet().some((c) => c.contains('a')), isTrue);
+ expect(makeClassSet().some((c) => c is num), isFalse);
});
test('isEmpty', () {
- Expect.isFalse(makeClassSet().isEmpty);
- Expect.isTrue(makeDocument().classes.isEmpty);
+ expect(makeClassSet().isEmpty, isFalse);
+ expect(makeDocument().classes.isEmpty, isTrue);
});
test('length', () {
- Expect.equals(3, makeClassSet().length);
- Expect.equals(0, makeDocument().classes.length);
+ expect(makeClassSet().length, 3);
+ expect(makeDocument().classes.length, 0);
});
test('contains', () {
- Expect.isTrue(makeClassSet().contains('foo'));
- Expect.isFalse(makeClassSet().contains('qux'));
+ expect(makeClassSet().contains('foo'), isTrue);
+ expect(makeClassSet().contains('qux'), isFalse);
});
test('add', () {
final classes = makeClassSet();
classes.add('qux');
- Expect.setEquals(['foo', 'bar', 'baz', 'qux'], classes);
+ expect(classes, unorderedEquals(['foo', 'bar', 'baz', 'qux']);
classes.add('qux');
final list = new List.from(classes);
list.sort((a, b) => a.compareTo(b));
- Expect.listEquals(['bar', 'baz', 'foo', 'qux'], list,
- "The class set shouldn't have duplicate elements.");
+ expect(list, ['bar', 'baz', 'foo', 'qux'],
+ reason: "The class set shouldn't have duplicate elements.");
});
test('remove', () {
final classes = makeClassSet();
classes.remove('bar');
- Expect.setEquals(['foo', 'baz'], classes);
+ expect(classes, unorderedEquals(['foo', 'baz']));
classes.remove('qux');
- Expect.setEquals(['foo', 'baz'], classes);
+ expect(classes, unorderedEquals(['foo', 'baz']));
});
test('addAll', () {
final classes = makeClassSet();
classes.addAll(['bar', 'qux', 'bip']);
- Expect.setEquals(['foo', 'bar', 'baz', 'qux', 'bip'], classes);
+ expect(classes, unorderedEquals(['foo', 'bar', 'baz', 'qux', 'bip']));
});
test('removeAll', () {
final classes = makeClassSet();
classes.removeAll(['bar', 'baz', 'qux']);
- Expect.setEquals(['foo'], classes);
+ expect(classes, ['foo']);
});
test('isSubsetOf', () {
final classes = makeClassSet();
- Expect.isTrue(classes.isSubsetOf(['foo', 'bar', 'baz']));
- Expect.isTrue(classes.isSubsetOf(['foo', 'bar', 'baz', 'qux']));
- Expect.isFalse(classes.isSubsetOf(['foo', 'bar', 'qux']));
+ expect(classes.isSubsetOf(['foo', 'bar', 'baz']), isTrue);
+ expect(classes.isSubsetOf(['foo', 'bar', 'baz', 'qux']), isTrue);
+ expect(classes.isSubsetOf(['foo', 'bar', 'qux']), isFalse);
});
test('containsAll', () {
final classes = makeClassSet();
- Expect.isTrue(classes.containsAll(['foo', 'baz']));
- Expect.isFalse(classes.containsAll(['foo', 'qux']));
+ expect(classes.containsAll(['foo', 'baz']), isTrue);
+ expect(classes.containsAll(['foo', 'qux']), isFalse);
});
test('intersection', () {
final classes = makeClassSet();
- Expect.setEquals(['foo', 'baz'],
- classes.intersection(['foo', 'qux', 'baz']));
+ expect(classes.intersection(['foo', 'qux', 'baz']),
+ unorderedEquals(['foo', 'baz']))
});
test('clear', () {
final classes = makeClassSet();
classes.clear();
- Expect.setEquals([], classes);
+ expect(classes, []);
});
});
@@ -201,14 +202,14 @@
test('affects the "class" attribute', () {
final doc = makeDocumentWithClasses();
doc.classes.add('qux');
- Expect.setEquals(['foo', 'bar', 'baz', 'qux'],
- doc.attributes['class'].split(' '));
+ expect(doc.attributes['class'].split(' '),
+ unorderedEquals(['foo', 'bar', 'baz', 'qux']));
});
test('is affected by the "class" attribute', () {
final doc = makeDocumentWithClasses();
doc.attributes['class'] = 'foo qux';
- Expect.setEquals(['foo', 'qux'], doc.classes);
+ expect(doc.classes, unorderedEquals(['foo', 'qux']));
});
});
@@ -220,131 +221,131 @@
doc.scrollByLines(2);
doc.scrollByPages(2);
doc.scrollIntoView();
- Expect.isFalse(doc.execCommand("foo", false, "bar"));
+ expect(doc.execCommand("foo", false, "bar"), isFalse);
});
group('properties that map to attributes', () {
group('contentEditable', () {
test('get', () {
final doc = makeDocument();
- Expect.equals('inherit', doc.contentEditable);
+ expect(doc.contentEditable, 'inherit');
doc.attributes['contentEditable'] = 'foo';
- Expect.equals('foo', doc.contentEditable);
+ expect(doc.contentEditable, 'foo');
});
test('set', () {
final doc = makeDocument();
doc.contentEditable = 'foo';
- Expect.equals('foo', doc.attributes['contentEditable']);
+ expect(doc.attributes['contentEditable'], 'foo');
});
test('isContentEditable', () {
final doc = makeDocument();
- Expect.isFalse(doc.isContentEditable);
+ expect(doc.isContentEditable, isFalse);
doc.contentEditable = 'true';
- Expect.isFalse(doc.isContentEditable);
+ expect(doc.isContentEditable, isFalse);
});
});
group('draggable', () {
test('get', () {
final doc = makeDocument();
- Expect.isFalse(doc.draggable);
+ expect(doc.draggable, isFalse);
doc.attributes['draggable'] = 'true';
- Expect.isTrue(doc.draggable);
+ expect(doc.draggable, isTrue);
doc.attributes['draggable'] = 'foo';
- Expect.isFalse(doc.draggable);
+ expect(doc.draggable, isFalse);
});
test('set', () {
final doc = makeDocument();
doc.draggable = true;
- Expect.equals('true', doc.attributes['draggable']);
+ expect(doc.attributes['draggable'], 'true');
doc.draggable = false;
- Expect.equals('false', doc.attributes['draggable']);
+ expect(doc.attributes['draggable'], 'false');
});
});
group('spellcheck', () {
test('get', () {
final doc = makeDocument();
- Expect.isFalse(doc.spellcheck);
+ expect(doc.spellcheck, isFalse);
doc.attributes['spellcheck'] = 'true';
- Expect.isTrue(doc.spellcheck);
+ expect(doc.spellcheck, isTrue);
doc.attributes['spellcheck'] = 'foo';
- Expect.isFalse(doc.spellcheck);
+ expect(doc.spellcheck, isFalse);
});
test('set', () {
final doc = makeDocument();
doc.spellcheck = true;
- Expect.equals('true', doc.attributes['spellcheck']);
+ expect(doc.attributes['spellcheck'], 'true');
doc.spellcheck = false;
- Expect.equals('false', doc.attributes['spellcheck']);
+ expect(doc.attributes['spellcheck'], 'false');
});
});
group('hidden', () {
test('get', () {
final doc = makeDocument();
- Expect.isFalse(doc.hidden);
+ expect(doc.hidden, isFalse);
doc.attributes['hidden'] = '';
- Expect.isTrue(doc.hidden);
+ expect(doc.hidden, isTrue);
});
test('set', () {
final doc = makeDocument();
doc.hidden = true;
- Expect.equals('', doc.attributes['hidden']);
+ expect(doc.attributes['hidden'], '');
doc.hidden = false;
- Expect.isFalse(doc.attributes.containsKey('hidden'));
+ expect(doc.attributes.containsKey('hidden'), isFalse);
});
});
group('tabIndex', () {
test('get', () {
final doc = makeDocument();
- Expect.equals(0, doc.tabIndex);
+ expect(doc.tabIndex, 0);
doc.attributes['tabIndex'] = '2';
- Expect.equals(2, doc.tabIndex);
+ expect(doc.tabIndex, 2);
doc.attributes['tabIndex'] = 'foo';
- Expect.equals(0, doc.tabIndex);
+ expect(doc.tabIndex, 0);
});
test('set', () {
final doc = makeDocument();
doc.tabIndex = 15;
- Expect.equals('15', doc.attributes['tabIndex']);
+ expect(doc.attributes['tabIndex'], '15');
});
});
group('id', () {
test('get', () {
final doc = makeDocument();
- Expect.equals('', doc.id);
+ expect(doc.id, '');
doc.attributes['id'] = 'foo';
- Expect.equals('foo', doc.id);
+ expect(doc.id, 'foo');
});
test('set', () {
final doc = makeDocument();
doc.id = 'foo';
- Expect.equals('foo', doc.attributes['id']);
+ expect(doc.attributes['id'], 'foo');
});
});
group('title', () {
test('get', () {
final doc = makeDocument();
- Expect.equals('', doc.title);
+ expect(doc.title, '');
doc.attributes['title'] = 'foo';
- Expect.equals('foo', doc.title);
+ expect(doc.title, 'foo');
});
test('set', () {
final doc = makeDocument();
doc.title = 'foo';
- Expect.equals('foo', doc.attributes['title']);
+ expect(doc.attributes['title'], 'foo');
});
});
@@ -354,45 +355,45 @@
// group('webkitdropzone', () {
// test('get', () {
// final doc = makeDocument();
- // Expect.equals('', doc.webkitdropzone);
+ // expect(doc.webkitdropzone, '');
// doc.attributes['webkitdropzone'] = 'foo';
- // Expect.equals('foo', doc.webkitdropzone);
+ // expect(doc.webkitdropzone, 'foo');
// });
//
// test('set', () {
// final doc = makeDocument();
// doc.webkitdropzone = 'foo';
- // Expect.equals('foo', doc.attributes['webkitdropzone']);
+ // expect(doc.attributes['webkitdropzone'], 'foo');
// });
// });
group('lang', () {
test('get', () {
final doc = makeDocument();
- Expect.equals('', doc.lang);
+ expect(doc.lang, '');
doc.attributes['lang'] = 'foo';
- Expect.equals('foo', doc.lang);
+ expect(doc.lang, 'foo');
});
test('set', () {
final doc = makeDocument();
doc.lang = 'foo';
- Expect.equals('foo', doc.attributes['lang']);
+ expect(doc.attributes['lang'], 'foo');
});
});
group('dir', () {
test('get', () {
final doc = makeDocument();
- Expect.equals('', doc.dir);
+ expect(doc.dir, '');
doc.attributes['dir'] = 'foo';
- Expect.equals('foo', doc.dir);
+ expect(doc.dir, 'foo');
});
test('set', () {
final doc = makeDocument();
doc.dir = 'foo';
- Expect.equals('foo', doc.attributes['dir']);
+ expect(doc.attributes['dir'], 'foo');
});
});
});
@@ -400,43 +401,43 @@
test('set innerHTML', () {
final doc = makeDocument();
doc.innerHTML = "<foo>Bar<baz/></foo>";
- Expect.equals(1, doc.nodes.length);
+ expect(doc.nodes.length, 1);
final node = doc.nodes[0];
- Expect.isTrue(node is XMLElement);
- Expect.equals('foo', node.tagName);
- Expect.equals('Bar', node.nodes[0].text);
- Expect.equals('baz', node.nodes[1].tagName);
+ expect(node, isXMLElement);
+ expect(node.tagName, 'foo');
+ expect(node.nodes[0].text, 'Bar');
+ expect(node.nodes[1].tagName, 'baz');
});
test('get innerHTML/outerHTML', () {
final doc = makeDocument();
- Expect.equals("<foo></foo><bar></bar>", doc.innerHTML);
+ expect(doc.innerHTML, "<foo></foo><bar></bar>");
doc.nodes.clear();
doc.nodes.addAll([new Text("foo"), new XMLElement.xml("<a>bar</a>")]);
- Expect.equals("foo<a>bar</a>", doc.innerHTML);
- Expect.equals("<xml>foo<a>bar</a></xml>", doc.outerHTML);
+ expect(doc.innertHTML, "foo<a>bar</a>");
+ expect(doc.outerHTML, "<xml>foo<a>bar</a></xml>");
});
test('query', () {
final doc = makeDocument();
- Expect.equals("foo", doc.query('foo').tagName);
- Expect.isNull(doc.query('baz'));
+ expect(doc.query('foo').tagName, 'foo');
+ expect(doc.query('baz'), isNull);
});
test('queryAll', () {
final doc = new XMLDocument.xml(
"<xml><foo id='f1' /><bar><foo id='f2' /></bar></xml>");
- Expect.listEquals(["f1", "f2"], doc.queryAll('foo').map((e) => e.id));
- Expect.listEquals([], doc.queryAll('baz'));
+ expect(doc.queryAll('foo').map((e) => e.id), ['f1', 'f2']);
+ expect(doc.queryAll('baz'), []);
});
// TODO(nweiz): re-enable this when matchesSelector works cross-browser.
//
// test('matchesSelector', () {
// final doc = makeDocument();
- // Expect.isTrue(doc.matchesSelector('*'));
- // Expect.isTrue(doc.matchesSelector('xml'));
- // Expect.isFalse(doc.matchesSelector('html'));
+ // expect(doc.matchesSelector('*'), isTrue);
+ // expect(doc.matchesSelector('xml'), isTrue);
+ // expect(doc.matchesSelector('html'), isFalse);
// });
group('insertAdjacentElement', () {
@@ -444,30 +445,30 @@
test('beforeBegin does nothing', () {
final doc = getDoc();
- Expect.isNull(
- doc.insertAdjacentElement("beforeBegin", new XMLElement.tag("b")));
- Expect.equals("<a>foo</a>", doc.innerHTML);
+ expect(doc.insertAdjacentElement("beforeBegin", new XMLElement.tag("b")),
+ isNull);
+ expect(doc.innerHTML, "<a>foo</a>");
});
test('afterEnd does nothing', () {
final doc = getDoc();
- Expect.isNull(
- doc.insertAdjacentElement("afterEnd", new XMLElement.tag("b")));
- Expect.equals("<a>foo</a>", doc.innerHTML);
+ expect(doc.insertAdjacentElement("afterEnd", new XMLElement.tag("b")),
+ isNull);
+ expect(doc.innerHTML, "<a>foo</a>");
});
test('afterBegin inserts the element', () {
final doc = getDoc();
final el = new XMLElement.tag("b");
- Expect.equals(el, doc.insertAdjacentElement("afterBegin", el));
- Expect.equals("<b></b><a>foo</a>", doc.innerHTML);
+ expect(doc.insertAdjacentElement("afterBegin", el), el);
+ expect(doc.innerHTML, "<b></b><a>foo</a>");
});
test('beforeEnd inserts the element', () {
final doc = getDoc();
final el = new XMLElement.tag("b");
- Expect.equals(el, doc.insertAdjacentElement("beforeEnd", el));
- Expect.equals("<a>foo</a><b></b>", doc.innerHTML);
+ expect(doc.insertAdjacentElement("beforeEnd", el), el);
+ expect(doc.innerHTML, "<a>foo</a><b></b>");
});
});
@@ -477,25 +478,25 @@
test('beforeBegin does nothing', () {
final doc = getDoc();
doc.insertAdjacentText("beforeBegin", "foo");
- Expect.equals("<a>foo</a>", doc.innerHTML);
+ expect(doc.innerHTML, "<a>foo</a>");
});
test('afterEnd does nothing', () {
final doc = getDoc();
doc.insertAdjacentText("afterEnd", "foo");
- Expect.equals("<a>foo</a>", doc.innerHTML);
+ expect(doc.innerHTML, "<a>foo</a>");
});
test('afterBegin inserts the text', () {
final doc = getDoc();
doc.insertAdjacentText("afterBegin", "foo");
- Expect.equals("foo<a>foo</a>", doc.innerHTML);
+ expect(doc.innerHTML, "foo<a>foo</a>");
});
test('beforeEnd inserts the text', () {
final doc = getDoc();
doc.insertAdjacentText("beforeEnd", "foo");
- Expect.equals("<a>foo</a>foo", doc.innerHTML);
+ expect(doc.innerHTML, "<a>foo</a>foo");
});
});
@@ -505,25 +506,25 @@
test('beforeBegin does nothing', () {
final doc = getDoc();
doc.insertAdjacentHTML("beforeBegin", "foo<b/>");
- Expect.equals("<a>foo</a>", doc.innerHTML);
+ expect(doc.innerHTML, "<a>foo</a>");
});
test('afterEnd does nothing', () {
final doc = getDoc();
doc.insertAdjacentHTML("afterEnd", "<b/>foo");
- Expect.equals("<a>foo</a>", doc.innerHTML);
+ expect(doc.innerHTML, "<a>foo</a>");
});
test('afterBegin inserts the HTML', () {
final doc = getDoc();
doc.insertAdjacentHTML("afterBegin", "foo<b/>");
- Expect.equals("foo<b></b><a>foo</a>", doc.innerHTML);
+ expect(doc.innerHTML, "foo<b></b><a>foo</a>");
});
test('beforeEnd inserts the HTML', () {
final doc = getDoc();
doc.insertAdjacentHTML("beforeEnd", "<b/>foo");
- Expect.equals("<a>foo</a><b></b>foo", doc.innerHTML);
+ expect(doc.innerHTML, "<a>foo</a><b></b>foo");
});
});
@@ -534,37 +535,36 @@
expectEmptyRect(rect.offset);
expectEmptyRect(rect.scroll);
expectEmptyRect(rect.bounding);
- Expect.isTrue(rect.clientRects.isEmpty);
+ expect(rect.clientRects.isEmpty, isTrue);
}));
});
test('nextElementSibling', () =>
- Expect.isNull(makeDocument().nextElementSibling));
+ expect(makeDocument().nextElementSibling), isNull);
test('previousElementSibling', () =>
- Expect.isNull(makeDocument().previousElementSibling));
- test('parent', () => Expect.isNull(makeDocument().parent));
- test('offsetParent', () => Expect.isNull(makeDocument().offsetParent));
- test('activeElement', () => Expect.isNull(makeDocument().activeElement));
- test('body', () => Expect.isNull(makeDocument().body));
- test('window', () => Expect.isNull(makeDocument().window));
- test('domain', () => Expect.equals('', makeDocument().domain));
- test('head', () => Expect.isNull(makeDocument().head));
- test('referrer', () => Expect.equals('', makeDocument().referrer));
- test('styleSheets', () =>
- Expect.listEquals([], makeDocument().styleSheets));
- test('title', () => Expect.equals('', makeDocument().title));
+ expect(makeDocument().previousElementSibling), isNull);
+ test('parent', () => expect(makeDocument().parent), isNull);
+ test('offsetParent', () => expect(makeDocument().offsetParent), isNull);
+ test('activeElement', () => expect(makeDocument().activeElement), isNull);
+ test('body', () => expect(makeDocument().body), isNull);
+ test('window', () => expect(makeDocument().window), isNull);
+ test('domain', () => expect(makeDocument().domain), '');
+ test('head', () => expect(makeDocument().head), isNull);
+ test('referrer', () => expect(makeDocument().referrer), '');
+ test('styleSheets', () => expect(makeDocument().styleSheets), []);
+ test('title', () => expect(makeDocument().title), '');
// TODO(nweiz): IE sets the charset to "windows-1252". How do we want to
// handle that?
//
- // test('charset', () => Expect.isNull(makeDocument().charset));
+ // test('charset', () => expect(makeDocument().charset), isNull);
// TODO(nweiz): re-enable these when the WebKit-specificness won't break
// non-WebKit browsers.
//
- // test('webkitHidden', () => Expect.isFalse(makeDocument().webkitHidden));
+ // test('webkitHidden', () => expect(makeDocument().webkitHidden), isFalse);
// test('webkitVisibilityState', () =>
- // Expect.equals('visible', makeDocument().webkitVisibilityState));
+ // expect(makeDocument().webkitVisibilityState), 'visible');
test('caretRangeFromPoint', () {
final doc = makeDocument();
@@ -573,7 +573,7 @@
doc.caretRangeFromPoint(0, 0),
doc.caretRangeFromPoint(5, 5)
]).then(expectAsync1((ranges) {
- Expect.listEquals([null, null, null], ranges);
+ expect(ranges, [null, null, null]);
}));
});
@@ -584,31 +584,31 @@
doc.elementFromPoint(0, 0),
doc.elementFromPoint(5, 5)
]).then(expectAsync1((ranges) {
- Expect.listEquals([null, null, null], ranges);
+ expect(ranges, [null, null, null]);
}));
});
test('queryCommandEnabled', () {
- Expect.isFalse(makeDocument().queryCommandEnabled('foo'));
- Expect.isFalse(makeDocument().queryCommandEnabled('bold'));
+ expect(makeDocument().queryCommandEnabled('foo'), isFalse);
+ expect(makeDocument().queryCommandEnabled('bold'), isFalse);
});
test('queryCommandIndeterm', () {
- Expect.isFalse(makeDocument().queryCommandIndeterm('foo'));
- Expect.isFalse(makeDocument().queryCommandIndeterm('bold'));
+ expect(makeDocument().queryCommandIndeterm('foo'), isFalse);
+ expect(makeDocument().queryCommandIndeterm('bold'), isFalse);
});
test('queryCommandState', () {
- Expect.isFalse(makeDocument().queryCommandState('foo'));
- Expect.isFalse(makeDocument().queryCommandState('bold'));
+ expect(makeDocument().queryCommandState('foo'), isFalse);
+ expect(makeDocument().queryCommandState('bold'), isFalse);
});
test('queryCommandSupported', () {
- Expect.isFalse(makeDocument().queryCommandSupported('foo'));
- Expect.isFalse(makeDocument().queryCommandSupported('bold'));
+ expect(makeDocument().queryCommandSupported('foo'), isFalse);
+ expect(makeDocument().queryCommandSupported('bold'), isFalse);
});
- test('manifest', () => Expect.equals('', makeDocument().manifest));
+ test('manifest', () => expect(makeDocument().manifest), '');
});
test('unsupported operations', () {
diff --git a/tests/html/xmlelement_test.dart b/tests/html/xmlelement_test.dart
index 1518673..b134a69 100644
--- a/tests/html/xmlelement_test.dart
+++ b/tests/html/xmlelement_test.dart
@@ -10,6 +10,8 @@
main() {
useHtmlConfiguration();
+ var isXMLElement = predicate((x) => x is XMLElement, 'is an XMLElement');
+
XMLElement makeElement() => new XMLElement.xml("<xml><foo/><bar/></xml>");
makeElementWithParent() {
@@ -22,34 +24,32 @@
group('.xml', () {
test('with a well-formed document', () {
final el = makeElement();
- Expect.isTrue(el is XMLElement);
- Expect.equals('foo', el.elements[0].tagName);
- Expect.equals('bar', el.elements[1].tagName);
+ expect(el, isXMLElement);
+ expect(el.elements[0].tagName, 'foo');
+ expect(el.elements[1].tagName, 'bar');
});
test('with too many nodes', () {
- Expect.throws(() => new XMLElement.xml("<xml></xml>foo"),
- (e) => e is ArgumentError);
+ expect(() => new XMLElement.xml("<xml></xml>foo"), throwsArgumentError);
});
test('with a parse error', () {
- Expect.throws(() => new XMLElement.xml("<xml></xml>>"),
- (e) => e is ArgumentError);
+ expect(() => new XMLElement.xml("<xml></xml>>"), throwsArgumentError);
});
test('with a PARSERERROR tag', () {
final el = new XMLElement.xml("<xml><parsererror /></xml>");
- Expect.equals('parsererror', el.elements[0].tagName);
+ expect('parsererror', el.elements[0].tagName, 'parsererror');
});
test('has no parent', () =>
- Expect.isNull(new XMLElement.xml('<foo/>').parent));
+ expect(new XMLElement.xml('<foo/>').parent), isNull);
});
test('.tag', () {
final el = new XMLElement.tag('foo');
- Expect.isTrue(el is XMLElement);
- Expect.equals('foo', el.tagName);
+ expect(el, isXMLElement);
+ expect(el.tagName, 'foo');
});
});
@@ -57,13 +57,13 @@
group('elements', () {
test('filters out non-element nodes', () {
final el = new XMLElement.xml("<xml>1<a/><b/>2<c/>3<d/></xml>");
- Expect.listEquals(["a", "b", "c", "d"], el.elements.map((e) => e.tagName));
+ expect(el.elements.map((e) => e.tagName), ["a", "b", "c", "d"]);
});
test('overwrites nodes when set', () {
final el = new XMLElement.xml("<xml>1<a/><b/>2<c/>3<d/></xml>");
el.elements = [new XMLElement.tag('x'), new XMLElement.tag('y')];
- Expect.equals("<xml><x></x><y></y></xml>", el.outerHTML);
+ expect(el.outerHTML, "<xml><x></x><y></y></xml>");
});
});
@@ -76,33 +76,34 @@
test('affects the "class" attribute', () {
final el = makeElementWithClasses();
el.classes.add('qux');
- Expect.setEquals(['foo', 'bar', 'baz', 'qux'],
- el.attributes['class'].split(' '));
+ expect(el.attributes['class'].split(' '),
+ unorderedEquals(['foo', 'bar', 'baz', 'qux']));
});
test('is affected by the "class" attribute', () {
final el = makeElementWithClasses();
el.attributes['class'] = 'foo qux';
- Expect.setEquals(['foo', 'qux'], el.classes);
+ expect(el.classes, unorderedEquals(['foo', 'qux']));
});
test('classes=', () {
final el = makeElementWithClasses();
el.classes = ['foo', 'qux'];
- Expect.setEquals(['foo', 'qux'], el.classes);
- Expect.setEquals(['foo', 'qux'], el.attributes['class'].split(' '));
+ expect(el.classes, unorderedEquals(['foo', 'qux']));
+ expect(el.attributes['class'].split(' '),
+ unorderedEquals(['foo', 'qux']));
});
test('toString', () {
- Expect.setEquals(['foo', 'bar', 'baz'],
- makeClassSet().toString().split(' '));
- Expect.equals('', makeElement().classes.toString());
+ expect(makeClassSet().toString().split(' '),
+ unorderedEquals(['foo', 'bar', 'baz']));
+ expect(makeElement().classes.toString(), '');
});
test('forEach', () {
final classes = <String>[];
makeClassSet().forEach(classes.add);
- Expect.setEquals(['foo', 'bar', 'baz'], classes);
+ expect(classes, unorderedEquals(['foo', 'bar', 'baz']));
});
test('iterator', () {
@@ -110,101 +111,99 @@
for (var el in makeClassSet()) {
classes.add(el);
}
- Expect.setEquals(['foo', 'bar', 'baz'], classes);
+ expect(classes, unorderedEquals(['foo', 'bar', 'baz']));
});
test('map', () {
- Expect.setEquals(['FOO', 'BAR', 'BAZ'],
- makeClassSet().map((c) => c.toUpperCase()));
+ expect(makeClassSet().map((c) => c.toUpperCase()),
+ unorderedEquals(['FOO', 'BAR', 'BAZ']));
});
test('filter', () {
- Expect.setEquals(['bar', 'baz'],
- makeClassSet().filter((c) => c.contains('a')));
+ expect(makeClassSet().filter((c) => c.contains('a')),
+ unorderedEquals(['bar', 'baz']));
});
test('every', () {
- Expect.isTrue(makeClassSet().every((c) => c is String));
- Expect.isFalse(
- makeClassSet().every((c) => c.contains('a')));
+ expect(makeClassSet().every((c) => c is String), isTrue);
+ expect(makeClassSet().every((c) => c.contains('a')), isFalse);
});
test('some', () {
- Expect.isTrue(
- makeClassSet().some((c) => c.contains('a')));
- Expect.isFalse(makeClassSet().some((c) => c is num));
+ expect(makeClassSet().some((c) => c.contains('a')), isTrue);
+ expect(makeClassSet().some((c) => c is num), isFalse);
});
test('isEmpty', () {
- Expect.isFalse(makeClassSet().isEmpty);
- Expect.isTrue(makeElement().classes.isEmpty);
+ expect(makeClassSet().isEmpty, isFalse);
+ expect(makeElement().classes.isEmpty, isTrue);
});
test('length', () {
- Expect.equals(3, makeClassSet().length);
- Expect.equals(0, makeElement().classes.length);
+ expect(makeClassSet().length, 3);
+ expect(makeElement().classes.length, 0);
});
test('contains', () {
- Expect.isTrue(makeClassSet().contains('foo'));
- Expect.isFalse(makeClassSet().contains('qux'));
+ expect(makeClassSet().contains('foo'), isTrue);
+ expect(makeClassSet().contains('qux'), isFalse);
});
test('add', () {
final classes = makeClassSet();
classes.add('qux');
- Expect.setEquals(['foo', 'bar', 'baz', 'qux'], classes);
+ expect(classes, unorderedEquals(['foo', 'bar', 'baz', 'qux']));
classes.add('qux');
final list = new List.from(classes);
list.sort((a, b) => a.compareTo(b));
- Expect.listEquals(['bar', 'baz', 'foo', 'qux'], list,
- "The class set shouldn't have duplicate elements.");
+ expect(list, ['bar', 'baz', 'foo', 'qux'],
+ reason: "The class set shouldn't have duplicate elements.");
});
test('remove', () {
final classes = makeClassSet();
classes.remove('bar');
- Expect.setEquals(['foo', 'baz'], classes);
+ expect(classes, unorderedEquals(['foo', 'baz']));
classes.remove('qux');
- Expect.setEquals(['foo', 'baz'], classes);
+ expect(classes, unorderedEquals(['foo', 'baz']));
});
test('addAll', () {
final classes = makeClassSet();
classes.addAll(['bar', 'qux', 'bip']);
- Expect.setEquals(['foo', 'bar', 'baz', 'qux', 'bip'], classes);
+ expect(classes, unorderedEquals(['foo', 'bar', 'baz', 'qux', 'bip']));
});
test('removeAll', () {
final classes = makeClassSet();
classes.removeAll(['bar', 'baz', 'qux']);
- Expect.setEquals(['foo'], classes);
+ expect(classes, ['foo']);
});
test('isSubsetOf', () {
final classes = makeClassSet();
- Expect.isTrue(classes.isSubsetOf(['foo', 'bar', 'baz']));
- Expect.isTrue(classes.isSubsetOf(['foo', 'bar', 'baz', 'qux']));
- Expect.isFalse(classes.isSubsetOf(['foo', 'bar', 'qux']));
+ expect(classes.isSubsetOf(['foo', 'bar', 'baz']), isTrue);
+ expect(classes.isSubsetOf(['foo', 'bar', 'baz', 'qux']), isTrue);
+ expect(classes.isSubsetOf(['foo', 'bar', 'qux']), isFalse);
});
test('containsAll', () {
final classes = makeClassSet();
- Expect.isTrue(classes.containsAll(['foo', 'baz']));
- Expect.isFalse(classes.containsAll(['foo', 'qux']));
+ expect(classes.containsAll(['foo', 'baz']), isTrue);
+ expect(classes.containsAll(['foo', 'qux']), isFalse);
});
test('intersection', () {
final classes = makeClassSet();
- Expect.setEquals(['foo', 'baz'],
- classes.intersection(['foo', 'qux', 'baz']));
+ expect(classes.intersection(['foo', 'qux', 'baz']),
+ unorderedEquals(['foo', 'baz']));
});
test('clear', () {
final classes = makeClassSet();
classes.clear();
- Expect.setEquals([], classes);
+ expect(classes, []);
});
});
@@ -222,169 +221,169 @@
group('contentEditable', () {
test('get', () {
final el = makeElement();
- Expect.equals('inherit', el.contentEditable);
+ expect(el.contentEditable, 'inherit');
el.attributes['contentEditable'] = 'foo';
- Expect.equals('foo', el.contentEditable);
+ expect(el.contentEditable, 'foo');
});
test('set', () {
final el = makeElement();
el.contentEditable = 'foo';
- Expect.equals('foo', el.attributes['contentEditable']);
+ expect(el.attributes['contentEditable'], 'foo');
});
test('isContentEditable', () {
final el = makeElement();
- Expect.isFalse(el.isContentEditable);
+ expect(el.isContentEditable, isFalse);
el.contentEditable = 'true';
- Expect.isFalse(el.isContentEditable);
+ expect(el.isContentEditable, isFalse);
});
});
group('draggable', () {
test('get', () {
final el = makeElement();
- Expect.isFalse(el.draggable);
+ expect(el.draggable, isFalse);
el.attributes['draggable'] = 'true';
- Expect.isTrue(el.draggable);
+ expect(el.draggable, isTrue);
el.attributes['draggable'] = 'foo';
- Expect.isFalse(el.draggable);
+ expect(el.draggable, isFalse);
});
test('set', () {
final el = makeElement();
el.draggable = true;
- Expect.equals('true', el.attributes['draggable']);
+ expect(el.attributes['draggable'], 'true');
el.draggable = false;
- Expect.equals('false', el.attributes['draggable']);
+ expect(el.attributes['draggable'], 'false');
});
});
group('spellcheck', () {
test('get', () {
final el = makeElement();
- Expect.isFalse(el.spellcheck);
+ expect(el.spellcheck, isFalse);
el.attributes['spellcheck'] = 'true';
- Expect.isTrue(el.spellcheck);
+ expect(el.spellcheck, isTrue);
el.attributes['spellcheck'] = 'foo';
- Expect.isFalse(el.spellcheck);
+ expect(el.spellcheck, isFalse);
});
test('set', () {
final el = makeElement();
el.spellcheck = true;
- Expect.equals('true', el.attributes['spellcheck']);
+ expect(el.attributes['spellcheck'], 'true');
el.spellcheck = false;
- Expect.equals('false', el.attributes['spellcheck']);
+ expect(el.attributes['spellcheck'], 'false');
});
});
group('hidden', () {
test('get', () {
final el = makeElement();
- Expect.isFalse(el.hidden);
+ expect(el.hidden, isFalse);
el.attributes['hidden'] = '';
- Expect.isTrue(el.hidden);
+ expect(el.hidden, isTrue);
});
test('set', () {
final el = makeElement();
el.hidden = true;
- Expect.equals('', el.attributes['hidden']);
+ expect(el.attributes['hidden'], '');
el.hidden = false;
- Expect.isFalse(el.attributes.containsKey('hidden'));
+ expect(el.attributes.containsKey('hidden'), isFalse);
});
});
group('tabIndex', () {
test('get', () {
final el = makeElement();
- Expect.equals(0, el.tabIndex);
+ expect(el.tabIndex, 0);
el.attributes['tabIndex'] = '2';
- Expect.equals(2, el.tabIndex);
+ expect(el.tabIndex, 2);
el.attributes['tabIndex'] = 'foo';
- Expect.equals(0, el.tabIndex);
+ expect(el.tabIndex, 0);
});
test('set', () {
final el = makeElement();
el.tabIndex = 15;
- Expect.equals('15', el.attributes['tabIndex']);
+ expect(el.attributes['tabIndex'], '15');
});
});
group('id', () {
test('get', () {
final el = makeElement();
- Expect.equals('', el.id);
+ expect(el.id, '');
el.attributes['id'] = 'foo';
- Expect.equals('foo', el.id);
+ expect(el.id, 'foo');
});
test('set', () {
final el = makeElement();
el.id = 'foo';
- Expect.equals('foo', el.attributes['id']);
+ expect(el.attributes['id'], 'foo');
});
});
group('title', () {
test('get', () {
final el = makeElement();
- Expect.equals('', el.title);
+ expect(el.title, '');
el.attributes['title'] = 'foo';
- Expect.equals('foo', el.title);
+ expect(el.title, 'foo');
});
test('set', () {
final el = makeElement();
el.title = 'foo';
- Expect.equals('foo', el.attributes['title']);
+ expect(el.attributes['title'], 'foo');
});
});
group('webkitdropzone', () {
test('get', () {
final el = makeElement();
- Expect.equals('', el.webkitdropzone);
+ expect(el.webkitdropzone, '');
el.attributes['webkitdropzone'] = 'foo';
- Expect.equals('foo', el.webkitdropzone);
+ expect(el.webkitdropzone, 'foo');
});
test('set', () {
final el = makeElement();
el.webkitdropzone = 'foo';
- Expect.equals('foo', el.attributes['webkitdropzone']);
+ expect(el.attributes['webkitdropzone'], 'foo');
});
});
group('lang', () {
test('get', () {
final el = makeElement();
- Expect.equals('', el.lang);
+ expect(el.lang, '');
el.attributes['lang'] = 'foo';
- Expect.equals('foo', el.lang);
+ expect(el.lang, 'foo');
});
test('set', () {
final el = makeElement();
el.lang = 'foo';
- Expect.equals('foo', el.attributes['lang']);
+ expect(el.attributes['lang'], 'foo');
});
});
group('dir', () {
test('get', () {
final el = makeElement();
- Expect.equals('', el.dir);
+ expect(el.dir, '');
el.attributes['dir'] = 'foo';
- Expect.equals('foo', el.dir);
+ expect(el.dir, 'foo');
});
test('set', () {
final el = makeElement();
el.dir = 'foo';
- Expect.equals('foo', el.attributes['dir']);
+ expect(el.attributes['dir'], 'foo');
});
});
});
@@ -392,90 +391,92 @@
test('set innerHTML', () {
final el = makeElement();
el.innerHTML = "<foo>Bar<baz/></foo>";
- Expect.equals(1, el.nodes.length);
+ expect(el.nodes.length, 1);
final node = el.nodes[0];
- Expect.isTrue(node is XMLElement);
- Expect.equals('foo', node.tagName);
- Expect.equals('Bar', node.nodes[0].text);
- Expect.equals('baz', node.nodes[1].tagName);
+ expect(node, isXMLElement);
+ expect(node.tagName, 'foo');
+ expect(node.nodes[0].text, 'Bar');
+ expect(node.nodes[1].tagName, 'baz');
});
test('get innerHTML/outerHTML', () {
final el = makeElement();
- Expect.equals("<foo></foo><bar></bar>", el.innerHTML);
+ expect(el.innerHTML, "<foo></foo><bar></bar>");
el.nodes.clear();
el.nodes.addAll([new Text("foo"), new XMLElement.xml("<a>bar</a>")]);
- Expect.equals("foo<a>bar</a>", el.innerHTML);
- Expect.equals("<xml>foo<a>bar</a></xml>", el.outerHTML);
+ expect(el.innerHTML, "foo<a>bar</a>");
+ expect(el.outerHTML, "<xml>foo<a>bar</a></xml>");
});
test('query', () {
final el = makeElement();
- Expect.equals("foo", el.query('foo').tagName);
- Expect.isNull(el.query('baz'));
+ expect(el.query('foo').tagName, 'foo');
+ expect(el.query('baz'), isNull);
});
test('queryAll', () {
final el = new XMLElement.xml(
"<xml><foo id='f1' /><bar><foo id='f2' /></bar></xml>");
- Expect.listEquals(["f1", "f2"], el.queryAll('foo').map((e) => e.id));
- Expect.listEquals([], el.queryAll('baz'));
+ expect(el.queryAll('foo').map((e) => e.id), ['f1', 'f2']);
+ expect(el.queryAll('baz'), []);
});
// TODO(nweiz): re-enable this when matchesSelector works cross-browser.
//
// test('matchesSelector', () {
// final el = makeElement();
- // Expect.isTrue(el.matchesSelector('*'));
- // Expect.isTrue(el.matchesSelector('xml'));
- // Expect.isFalse(el.matchesSelector('html'));
+ // expect(el.matchesSelector('*'), isTrue);
+ // expect(el.matchesSelector('xml'), isTrue);
+ // expect(el.matchesSelector('html'), isFalse);
// });
group('insertAdjacentElement', () {
test('beforeBegin with no parent does nothing', () {
final el = makeElement();
- Expect.isNull(
- el.insertAdjacentElement("beforeBegin", new XMLElement.tag("b")));
- Expect.equals("<foo></foo><bar></bar>", el.innerHTML);
+ expect(el.insertAdjacentElement("beforeBegin", new XMLElement.tag("b")),
+ isNull);
+ expect(el.innerHTML, "<foo></foo><bar></bar>");
});
test('afterEnd with no parent does nothing', () {
final el = makeElement();
- Expect.isNull(
- el.insertAdjacentElement("afterEnd", new XMLElement.tag("b")));
- Expect.equals("<foo></foo><bar></bar>", el.innerHTML);
+ expect(
+ el.insertAdjacentElement("afterEnd", new XMLElement.tag("b")), isNull);
+ expect(el.innerHTML, "<foo></foo><bar></bar>");
});
test('beforeBegin with parent inserts the element', () {
final el = makeElementWithParent();
final newEl = new XMLElement.tag("b");
- Expect.equals(newEl, el.insertAdjacentElement("beforeBegin", newEl));
- Expect.equals("<foo></foo><bar></bar>", el.innerHTML);
- Expect.equals("<before></before><b></b><xml><foo></foo><bar></bar>" +
- "</xml><after></after>", el.parent.innerHTML);
+ expect(el.insertAdjacentElement("beforeBegin", newEl), newEl);
+ expect(el.innerHTML, "<foo></foo><bar></bar>");
+ expect(el.parent.innerHTML,
+ "<before></before><b></b><xml><foo></foo><bar></bar>"
+ "</xml><after></after>");
});
test('afterEnd with parent inserts the element', () {
final el = makeElementWithParent();
final newEl = new XMLElement.tag("b");
- Expect.equals(newEl, el.insertAdjacentElement("afterEnd", newEl));
- Expect.equals("<foo></foo><bar></bar>", el.innerHTML);
- Expect.equals("<before></before><xml><foo></foo><bar></bar></xml><b>" +
- "</b><after></after>", el.parent.innerHTML);
+ expect(el.insertAdjacentElement("afterEnd", newEl), newEl);
+ expect(el.innerHTML, "<foo></foo><bar></bar>");
+ expect(el.parent.innerHTML,
+ "<before></before><xml><foo></foo><bar></bar></xml><b>"
+ "</b><after></after>");
});
test('afterBegin inserts the element', () {
final el = makeElement();
final newEl = new XMLElement.tag("b");
- Expect.equals(newEl, el.insertAdjacentElement("afterBegin", newEl));
- Expect.equals("<b></b><foo></foo><bar></bar>", el.innerHTML);
+ expect(el.insertAdjacentElement("afterBegin", newEl), newEl);
+ expect(el.innerHTML, "<b></b><foo></foo><bar></bar>");
});
test('beforeEnd inserts the element', () {
final el = makeElement();
final newEl = new XMLElement.tag("b");
- Expect.equals(newEl, el.insertAdjacentElement("beforeEnd", newEl));
- Expect.equals("<foo></foo><bar></bar><b></b>", el.innerHTML);
+ expect(el.insertAdjacentElement("beforeEnd", newEl), newEl);
+ expect(el.innerHTML, "<foo></foo><bar></bar><b></b>");
});
});
@@ -483,41 +484,43 @@
test('beforeBegin with no parent does nothing', () {
final el = makeElement();
el.insertAdjacentText("beforeBegin", "foo");
- Expect.equals("<foo></foo><bar></bar>", el.innerHTML);
+ expect(el.innerHTML, "<foo></foo><bar></bar>");
});
test('afterEnd with no parent does nothing', () {
final el = makeElement();
el.insertAdjacentText("afterEnd", "foo");
- Expect.equals("<foo></foo><bar></bar>", el.innerHTML);
+ expect(el.innerHTML, "<foo></foo><bar></bar>");
});
test('beforeBegin with parent inserts the text', () {
final el = makeElementWithParent();
el.insertAdjacentText("beforeBegin", "foo");
- Expect.equals("<foo></foo><bar></bar>", el.innerHTML);
- Expect.equals("<before></before>foo<xml><foo></foo><bar></bar></xml>" +
- "<after></after>", el.parent.innerHTML);
+ expect(el.innerHTML, "<foo></foo><bar></bar>");
+ expect(el.parent.innerHTML,
+ "<before></before>foo<xml><foo></foo><bar></bar></xml>"
+ "<after></after>");
});
test('afterEnd with parent inserts the text', () {
final el = makeElementWithParent();
el.insertAdjacentText("afterEnd", "foo");
- Expect.equals("<foo></foo><bar></bar>", el.innerHTML);
- Expect.equals("<before></before><xml><foo></foo><bar></bar></xml>foo" +
- "<after></after>", el.parent.innerHTML);
+ expect(el.innerHTML, "<foo></foo><bar></bar>");
+ expect(el.parent.innerHTML,
+ "<before></before><xml><foo></foo><bar></bar></xml>foo"
+ "<after></after>");
});
test('afterBegin inserts the text', () {
final el = makeElement();
el.insertAdjacentText("afterBegin", "foo");
- Expect.equals("foo<foo></foo><bar></bar>", el.innerHTML);
+ expect(el.innerHTML, "foo<foo></foo><bar></bar>");
});
test('beforeEnd inserts the text', () {
final el = makeElement();
el.insertAdjacentText("beforeEnd", "foo");
- Expect.equals("<foo></foo><bar></bar>foo", el.innerHTML);
+ expect(el.innerHTML, "<foo></foo><bar></bar>foo");
});
});
@@ -525,41 +528,43 @@
test('beforeBegin with no parent does nothing', () {
final el = makeElement();
el.insertAdjacentHTML("beforeBegin", "foo<b/>");
- Expect.equals("<foo></foo><bar></bar>", el.innerHTML);
+ expect(el.innerHTML, "<foo></foo><bar></bar>");
});
test('afterEnd with no parent does nothing', () {
final el = makeElement();
el.insertAdjacentHTML("afterEnd", "<b/>foo");
- Expect.equals("<foo></foo><bar></bar>", el.innerHTML);
+ expect(el.innerHTML, "<foo></foo><bar></bar>");
});
test('beforeBegin with parent inserts the HTML', () {
final el = makeElementWithParent();
el.insertAdjacentHTML("beforeBegin", "foo<b/>");
- Expect.equals("<foo></foo><bar></bar>", el.innerHTML);
- Expect.equals("<before></before>foo<b></b><xml><foo></foo><bar></bar>" +
- "</xml><after></after>", el.parent.innerHTML);
+ expect(el.innerHTML, "<foo></foo><bar></bar>");
+ expect(el.parent.innerHTML,
+ "<before></before>foo<b></b><xml><foo></foo><bar></bar>"
+ "</xml><after></after>");
});
test('afterEnd with parent inserts the HTML', () {
final el = makeElementWithParent();
el.insertAdjacentHTML("afterEnd", "foo<b/>");
- Expect.equals("<foo></foo><bar></bar>", el.innerHTML);
- Expect.equals("<before></before><xml><foo></foo><bar></bar></xml>foo" +
- "<b></b><after></after>", el.parent.innerHTML);
+ expect(el.innerHTML, "<foo></foo><bar></bar>");
+ expect(el.parent.innerHTML,
+ "<before></before><xml><foo></foo><bar></bar></xml>foo"
+ "<b></b><after></after>");
});
test('afterBegin inserts the HTML', () {
final el = makeElement();
el.insertAdjacentHTML("afterBegin", "foo<b/>");
- Expect.equals("foo<b></b><foo></foo><bar></bar>", el.innerHTML);
+ expect(el.innerHTML, "foo<b></b><foo></foo><bar></bar>");
});
test('beforeEnd inserts the HTML', () {
final el = makeElement();
el.insertAdjacentHTML("beforeEnd", "<b/>foo");
- Expect.equals("<foo></foo><bar></bar><b></b>foo", el.innerHTML);
+ expect(el.innerHTML, "<foo></foo><bar></bar><b></b>foo");
});
});
@@ -570,7 +575,7 @@
expectEmptyRect(rect.offset);
expectEmptyRect(rect.scroll);
expectEmptyRect(rect.bounding);
- Expect.isTrue(rect.clientRects.isEmpty);
+ expect(rect.clientRects.isEmpty, isTrue);
}));
});
}
diff --git a/tests/html/xsltprocessor_test.dart b/tests/html/xsltprocessor_test.dart
index 7e70cf0..5216726 100644
--- a/tests/html/xsltprocessor_test.dart
+++ b/tests/html/xsltprocessor_test.dart
@@ -7,9 +7,12 @@
useHtmlConfiguration();
+ var isXSLTProcessor =
+ predicate((x) => x is XSLTProcessor, 'is an XSLTProcessor');
+
test('constructorTest', () {
var processor = new XSLTProcessor();
- Expect.isTrue(processor != null);
- Expect.isTrue(processor is XSLTProcessor);
+ expect(processor, isNotNull);
+ expect(processor, isXSLTProcessor);
});
}
diff --git a/tests/isolate/isolate.status b/tests/isolate/isolate.status
index 0fdc16c..6e106f5 100644
--- a/tests/isolate/isolate.status
+++ b/tests/isolate/isolate.status
@@ -30,6 +30,10 @@
spawn_uri_vm_negative_test: Fail, OK # Fails at runtime.
unresolved_ports_negative_test: Fail, OK # Fails at runtime.
+# packages issue 6340
+compute_this_script_browser_test: Fail, OK
+
+
[ $compiler == dart2js ]
serialization_test: Fail # Tries to access class TestingOnly declared in isolate_patch.dart
diff --git a/tests/isolate/multiple_timer_test.dart b/tests/isolate/multiple_timer_test.dart
index d43e135..9071e88 100644
--- a/tests/isolate/multiple_timer_test.dart
+++ b/tests/isolate/multiple_timer_test.dart
@@ -23,29 +23,29 @@
void timeoutHandler1(Timer timer) {
int endTime = (new Date.now()).millisecondsSinceEpoch;
- expect((endTime - _startTime1) >= TIMEOUT1);
- expect(_order[_message] == 0);
+ expect(endTime - _startTime1, greaterThanOrEqualTo(TIMEOUT1));
+ expect(_order[_message], 0);
_message++;
}
void timeoutHandler2(Timer timer) {
int endTime = (new Date.now()).millisecondsSinceEpoch;
- expect((endTime - _startTime2) >= TIMEOUT2);
- expect(_order[_message] == 1);
+ expect(endTime - _startTime2, greaterThanOrEqualTo(TIMEOUT2));
+ expect(_order[_message], 1);
_message++;
}
void timeoutHandler3(Timer timer) {
int endTime = (new Date.now()).millisecondsSinceEpoch;
- expect((endTime - _startTime3) >= TIMEOUT3);
- expect(_order[_message] == 2);
+ expect(endTime - _startTime3, greaterThanOrEqualTo(TIMEOUT3));
+ expect(_order[_message], 2);
_message++;
}
void timeoutHandler4(Timer timer) {
int endTime = (new Date.now()).millisecondsSinceEpoch;
- expect((endTime - _startTime4) >= TIMEOUT4);
- expect(_order[_message] == 3);
+ expect(endTime - _startTime4, greaterThanOrEqualTo(TIMEOUT4));
+ expect(_order[_message], 3);
_message++;
}
diff --git a/tests/isolate/timer_cancel_test.dart b/tests/isolate/timer_cancel_test.dart
index 7e35062..ffb866d 100644
--- a/tests/isolate/timer_cancel_test.dart
+++ b/tests/isolate/timer_cancel_test.dart
@@ -23,7 +23,7 @@
void repeatHandler(Timer timer) {
repeatTimer++;
timer.cancel();
- expect(repeatTimer == 1);
+ expect(repeatTimer, 1);
}
cancelTimer = new Timer(1000, expectAsync1(unreachable, count: 0));
diff --git a/tests/isolate/timer_isolate_test.dart b/tests/isolate/timer_isolate_test.dart
index 63345ea..f98ffd2 100644
--- a/tests/isolate/timer_isolate_test.dart
+++ b/tests/isolate/timer_isolate_test.dart
@@ -25,7 +25,7 @@
port.receive(expectAsync2((msg, _) {
expect("timer_fired", msg);
int endTime = (new Date.now()).millisecondsSinceEpoch;
- expect((endTime - startTime) >= TIMEOUT);
+ expect(endTime - startTime, greaterThanOrEqualTo(TIMEOUT));
port.close();
}));
diff --git a/tests/isolate/timer_test.dart b/tests/isolate/timer_test.dart
index fd679d3..4a151e0 100644
--- a/tests/isolate/timer_test.dart
+++ b/tests/isolate/timer_test.dart
@@ -17,7 +17,7 @@
void timeoutHandler(Timer timer) {
int endTime = (new Date.now()).millisecondsSinceEpoch;
- expect((endTime - startTime) >= timeout);
+ expect(endTime - startTime, greaterThanOrEqualTo(timeout));
if (iteration < ITERATIONS) {
iteration++;
timeout = timeout - DECREASE;
diff --git a/tests/language/argument_definition3_test.dart b/tests/language/argument_definition3_test.dart
new file mode 100644
index 0000000..be74835
--- /dev/null
+++ b/tests/language/argument_definition3_test.dart
@@ -0,0 +1,76 @@
+// 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.
+
+main() {
+ new Param.test1(false);
+ new Param.test1(true, 42);
+
+ new Param.test2(false);
+ new Param.test2(true, 42);
+
+ new Param.test3(false);
+ new Param.test3(true, 42);
+
+ new Param.test4();
+ new Param.test5();
+
+ new Param.test6(false);
+ new Param.test6(true, 42);
+
+ new Param.test7();
+ new Param.test8();
+}
+
+class Super {
+ var superField;
+ var otherSuperField;
+
+ Super();
+ Super.withParameters(passed, op, value) {
+ Expect.equals(passed, op);
+ Expect.equals(passed ? 42 : 0, value);
+ }
+
+ Super.withOptional(passed, [int a]) : superField = ?a {
+ Expect.equals(passed, ?a);
+ Expect.equals(passed, superField);
+ }
+
+ Super.withUpdate(passed, [int a = 0])
+ : superField = ?a, otherSuperField = a++ {
+ Expect.equals(passed, ?a);
+ Expect.equals(passed, superField);
+ Expect.equals(passed ? 43 : 1, a);
+ }
+}
+
+class Param extends Super {
+ var field;
+ var otherField;
+
+ Param.test1(a_check, [int a]) {
+ Expect.equals(a_check, ?a);
+ }
+
+ Param.test2(passed, [int a]) : field = ?a {
+ Expect.equals(passed, ?a);
+ Expect.equals(passed, field);
+ }
+
+ Param.test3(passed, [int a = 0]) : super.withParameters(passed, ?a, a) {
+ Expect.equals(passed, ?a);
+ }
+
+ Param.test4() : super.withOptional(true, 42);
+ Param.test5() : super.withOptional(false);
+
+ Param.test6(passed, [int a = 0]) : field = ?a, otherField = a++ {
+ Expect.equals(passed, ?a);
+ Expect.equals(passed, field);
+ Expect.equals(passed ? 43 : 1, a);
+ }
+
+ Param.test7() : super.withUpdate(true, 42);
+ Param.test8() : super.withUpdate(false);
+}
diff --git a/tests/language/bad_named_parameters_test.dart b/tests/language/bad_named_parameters_test.dart
index 937cf05..99a82b8 100644
--- a/tests/language/bad_named_parameters_test.dart
+++ b/tests/language/bad_named_parameters_test.dart
@@ -6,11 +6,11 @@
class BadNamedParametersTest {
- int f42(int a, [int b = 20, int c = 30]) {
+ int f42(int a, {int b: 20, int c: 30}) {
return 100*(100*a + b) + c;
}
- int f52(int a, [int b = 20, int c, int d = 40]) {
+ int f52(int a, {int b: 20, int c, int d: 40}) {
return 100*(100*(100*a + b) + (c == null ? 0 : c)) + d;
}
diff --git a/tests/language/call_nonexistent_static_test.dart b/tests/language/call_nonexistent_static_test.dart
index dca8536..f114be9 100644
--- a/tests/language/call_nonexistent_static_test.dart
+++ b/tests/language/call_nonexistent_static_test.dart
@@ -22,7 +22,7 @@
}
alwaysThrows() {
- throw new NoSuchMethodError(null, 'foo', []);
+ throw new NoSuchMethodError(null, 'foo', [], {});
}
test01() {
diff --git a/tests/language/char_escape_test.dart b/tests/language/char_escape_test.dart
index 18a0f47..a890e4d 100644
--- a/tests/language/char_escape_test.dart
+++ b/tests/language/char_escape_test.dart
@@ -366,24 +366,24 @@
var v10000 = "\u{10000}";
var v010000 = "\u{010000}";
- Expect.equals(1, v10000.length);
- Expect.equals(1, v010000.length);
+ Expect.equals(2, v10000.length);
+ Expect.equals(2, v010000.length);
Expect.equals("\u{10000}", new String.fromCharCodes([0x10000]));
Expect.equals("\u{010000}", new String.fromCharCodes([0x10000]));
var v1FFFF = "\u{1FFFF}";
var v01FFFF = "\u{01FFFF}";
- Expect.equals(1, v1FFFF.length);
- Expect.equals(1, v01FFFF.length);
+ Expect.equals(2, v1FFFF.length);
+ Expect.equals(2, v01FFFF.length);
Expect.equals("\u{1FFFF}", new String.fromCharCodes([0x1FFFF]));
Expect.equals("\u{01FFFF}", new String.fromCharCodes([0x1FFFF]));
var v105555 = "\u{105555}";
- Expect.equals(1, v105555.length);
+ Expect.equals(2, v105555.length);
Expect.equals("\u{105555}", new String.fromCharCodes([0x105555]));
var v10FFFF = "\u{10FFFF}";
- Expect.equals(1, v10FFFF.length);
+ Expect.equals(2, v10FFFF.length);
Expect.equals("\u{10FFFF}", new String.fromCharCodes([0x10FFFF]));
var bs = "\b";
diff --git a/tests/language/closure8_test.dart b/tests/language/closure8_test.dart
new file mode 100644
index 0000000..623679a
--- /dev/null
+++ b/tests/language/closure8_test.dart
@@ -0,0 +1,23 @@
+// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+// Regression test for issue 6353.
+
+class A<E> {
+}
+
+class C<E> extends A<E> {
+ forEach(callback(E element)) {
+ }
+}
+
+class D<E> {
+ lala(E element) {
+ }
+}
+
+main() {
+ var c = new C<int>();
+ c.forEach(new D<int>().lala);
+}
+
diff --git a/tests/language/closure_in_initializer2_test.dart b/tests/language/closure_in_initializer2_test.dart
new file mode 100644
index 0000000..3c1e1bd
--- /dev/null
+++ b/tests/language/closure_in_initializer2_test.dart
@@ -0,0 +1,21 @@
+// 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.
+
+class S {
+ S() {
+ Expect.equals(2, this.f());
+ }
+}
+
+class A extends S {
+ var f;
+ A(a) : f = (() => ++a) {
+ Expect.equals(a, 2);
+ }
+}
+
+main() {
+ var a = new A(1);
+ Expect.equals(a.f(), 3);
+}
diff --git a/tests/language/closure_in_initializer_test.dart b/tests/language/closure_in_initializer_test.dart
new file mode 100644
index 0000000..607553c
--- /dev/null
+++ b/tests/language/closure_in_initializer_test.dart
@@ -0,0 +1,42 @@
+// 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.
+
+class A {
+ var f;
+ var g;
+ A(a) : f = (() => 42 + a), g = (() => ++a) {
+ a = 4;
+ }
+}
+
+class B extends A {
+ B() : super(42);
+}
+
+class C extends A {
+ var h;
+ C(a) : super(42), h = (() => ++a);
+}
+
+main() {
+ var a = new A(1);
+ Expect.equals(46, a.f());
+ Expect.equals(5, a.g());
+ Expect.equals(47, a.f());
+
+ a = new B();
+ Expect.equals(46, a.f());
+ Expect.equals(5, a.g());
+ Expect.equals(47, a.f());
+
+ a = new C(0);
+ Expect.equals(46, a.f());
+ Expect.equals(5, a.g());
+ Expect.equals(47, a.f());
+ Expect.equals(1, a.h());
+ Expect.equals(2, a.h());
+ Expect.equals(47, a.f());
+ Expect.equals(6, a.g());
+ Expect.equals(48, a.f());
+}
diff --git a/tests/language/constructor6_test.dart b/tests/language/constructor6_test.dart
index 39116c9..ff105e8 100644
--- a/tests/language/constructor6_test.dart
+++ b/tests/language/constructor6_test.dart
@@ -9,7 +9,7 @@
String trace = "";
int E(int i) {
- trace += "$i-";
+ trace = "$trace$i-";
return i;
}
diff --git a/tests/language/constructor_redirect2_test.dart b/tests/language/constructor_redirect2_test.dart
new file mode 100644
index 0000000..e0ceb8d
--- /dev/null
+++ b/tests/language/constructor_redirect2_test.dart
@@ -0,0 +1,29 @@
+// 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.
+// Redirection constructors must not have a function body.
+
+class A {
+ var x;
+ A(this.x) {}
+
+ // Redirecting constructor must not have a function body.
+ A.illegalBody(x) : this(3) {} /// 01: compile-time error
+
+ // Redirecting constructor must not initialize any fields.
+ A.illegalInit() : this(3), x = 5; /// 02: compile-time error
+
+ // Redirecting constructor must not have initializing formal parameters.
+ A.illegalFormal(this.x) : this(3); /// 03: compile-time error
+
+ // Redirection constructors must not call super constructor.
+ A.illegalSuper() : this(3), super(3); /// 04: compile-time error
+}
+
+main() {
+ new A(3);
+ new A.illegalBody(10); /// 01: continued
+ new A.illegalInit(10); /// 02: continued
+ new A.illegalFormal(10); /// 03: continued
+ new A.illegalSuper(10); /// 04: continued
+}
diff --git a/tests/language/constructor_redirect3_negative_test.dart b/tests/language/constructor_redirect3_negative_test.dart
deleted file mode 100644
index 37d3109..0000000
--- a/tests/language/constructor_redirect3_negative_test.dart
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-// Redirection constructors must not initialize any fields.
-
-class A {
- var x;
- A(this.x) {}
- A.named() : this(3), x = 5 {}
-}
-
-class ConstructorRedirect3NegativeTest {
- static testMain() {
- new A.named();
- }
-}
-
-main() {
- ConstructorRedirect3NegativeTest.testMain();
-}
diff --git a/tests/language/constructor_redirect4_negative_test.dart b/tests/language/constructor_redirect4_negative_test.dart
deleted file mode 100644
index f38229f..0000000
--- a/tests/language/constructor_redirect4_negative_test.dart
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-// Redirection constructors must not initialize any fields.
-
-class A {
- var x;
- A(this.x) {}
- A.named(this.x) : this(3) {}
-}
-
-class ConstructorRedirect4NegativeTest {
- static testMain() {
- new A.named(10);
- }
-}
-
-main() {
- ConstructorRedirect4NegativeTest.testMain();
-}
diff --git a/tests/language/constructor_redirect5_negative_test.dart b/tests/language/constructor_redirect5_negative_test.dart
deleted file mode 100644
index 498be3b..0000000
--- a/tests/language/constructor_redirect5_negative_test.dart
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-// Redirection constructors must not call any super constructors.
-
-class A {
- var x;
- A(this.x) {}
- A.named(x) : this(3), super() {}
-}
-
-class ConstructorRedirect5NegativeTest {
- static testMain() {
- new A.named(10);
- }
-}
-
-main() {
- ConstructorRedirect5NegativeTest.testMain();
-}
diff --git a/tests/language/final_variable_assignment_test.dart b/tests/language/final_variable_assignment_test.dart
new file mode 100644
index 0000000..f173747
--- /dev/null
+++ b/tests/language/final_variable_assignment_test.dart
@@ -0,0 +1,13 @@
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// Test to make sure we catch assignments to final local variables.
+
+main() {
+ final x = 30;
+ x = 0; /// 01: compile-time error
+ x += 1; /// 02: compile-time error
+ ++x; /// 03: compile-time error
+ x++; /// 04: compile-time error
+}
diff --git a/tests/language/function_syntax_test.dart b/tests/language/function_syntax_test.dart
index dc8a58e..131802f 100644
--- a/tests/language/function_syntax_test.dart
+++ b/tests/language/function_syntax_test.dart
@@ -470,7 +470,6 @@
expectEvaluatesTo(0, ()=> 4 % 2);
// Negate.
- expectEvaluatesTo(-3, ()=> ~2);
expectEvaluatesTo(false, ()=> !true);
// Postfix / prefix.
diff --git a/tests/language/import_core_impl_no_prefix_test.dart b/tests/language/import_collection_no_prefix_test.dart
similarity index 71%
rename from tests/language/import_core_impl_no_prefix_test.dart
rename to tests/language/import_collection_no_prefix_test.dart
index 434d606..6353284 100644
--- a/tests/language/import_core_impl_no_prefix_test.dart
+++ b/tests/language/import_collection_no_prefix_test.dart
@@ -4,10 +4,10 @@
// Dart test program importing the core library explicitly.
-#library("ImportCoreImplNoPrefixTest.dart");
-#import("dart:coreimpl");
+#library("ImportCollectionNoPrefixTest.dart");
+#import("dart:collection");
main() {
var e = new SplayTreeMap();
- print('"dart:coreimpl" imported, $e allocated');
+ print('"dart:collection" imported, $e allocated');
}
diff --git a/tests/language/invocation_mirror_test.dart b/tests/language/invocation_mirror_test.dart
index 6bbb094..38e1277 100644
--- a/tests/language/invocation_mirror_test.dart
+++ b/tests/language/invocation_mirror_test.dart
@@ -6,7 +6,10 @@
/** Class with noSuchMethod that returns the mirror */
class N {
- noSuchMethod(InvocationMirror m) => m;
+ // Storage for the last argument to noSuchMethod.
+ // Needed for setters, which don't evaluate to the return value.
+ var last;
+ noSuchMethod(InvocationMirror m) => last = m;
get wut => this;
@@ -31,38 +34,40 @@
*/
testInvocationMirror(InvocationMirror im, String name,
[List positional, Map named]) {
- Expect.isTrue(im is InvocationMirror);
- Expect.equals(name, im.methodName);
+ Expect.isTrue(im is InvocationMirror, "is InvocationMirror");
+ Expect.equals(name, im.memberName, "name");
if (named == null) {
- Expect.isTrue(im.isAccessor);
- Expect.isFalse(im.isMethod);
+ Expect.isTrue(im.isAccessor, "$name:isAccessor");
+ Expect.isFalse(im.isMethod, "$name:isMethod");
if (positional == null) {
- Expect.isTrue(im.isGetter);
- Expect.isFalse(im.isSetter);
- Expect.equals(null, im.positionalArguments);
- Expect.equals(null, im.positionalArguments);
+ Expect.isTrue(im.isGetter, "$name:isGetter");
+ Expect.isFalse(im.isSetter, "$name:isSetter");
+ Expect.equals(null, im.positionalArguments, "$name:positional");
+ Expect.equals(null, im.namedArguments, "$name:named");
return;
}
- Expect.isTrue(im.isSetter);
- Expect.isFalse(im.isGetter);
- Expect.equals(1, im.positionalArguments.length);
- Expect.equals(positional[0], im.positionalArguments[0]);
- Expect.equals(null, im.namedArguments);
+ Expect.isTrue(im.isSetter, "$name:isSetter");
+ Expect.isFalse(im.isGetter, "$name:isGetter");
+ Expect.equals(1, im.positionalArguments.length, "$name:#positional");
+ Expect.equals(positional[0], im.positionalArguments[0],
+ "$name:positional[0]");
+ Expect.equals(null, im.namedArguments, "$name:named");
return;
}
- Expect.isTrue(im.isMethod);
- Expect.isFalse(im.isAccessor);
- Expect.isFalse(im.isSetter);
- Expect.isFalse(im.isGetter);
+ Expect.isTrue(im.isMethod, "$name:isMethod");
+ Expect.isFalse(im.isAccessor, "$name:isAccessor");
+ Expect.isFalse(im.isSetter, "$name:isSetter");
+ Expect.isFalse(im.isGetter, "$name:isGetter");
Expect.equals(positional.length, im.positionalArguments.length);
for (int i = 0; i < positional.length; i++) {
- Expect.equals(positional[i], im.positionalArguments[i]);
+ Expect.equals(positional[i], im.positionalArguments[i],
+ "$name:positional[$i]");
}
- Expect.equals(named.length, im.namedArguments.length);
+ Expect.equals(named.length, im.namedArguments.length, "$name:#named");
named.forEach((k, v) {
- Expect.isTrue(im.namedArguments.containsKey(k));
- Expect.equals(v, im.namedArguments[k]);
+ Expect.isTrue(im.namedArguments.containsKey(k), "$name:?named[$k]");
+ Expect.equals(v, im.namedArguments[k], "$name:named[$k]");
});
}
@@ -74,7 +79,7 @@
// Missing property/method access.
testInvocationMirror(n.bar, 'bar');
- testInvocationMirror(n.bar = 42, 'bar=', [42]);
+ testInvocationMirror((n..bar = 42).last, 'bar=', [42]);
testInvocationMirror(n.bar(), 'bar', [], {});
testInvocationMirror(n.bar(42), 'bar', [42], {});
testInvocationMirror(n.bar(x: 42), 'bar', [], {"x": 42});
@@ -87,15 +92,15 @@
// Missing operator access.
testInvocationMirror(n + 4, '+', [4], {});
testInvocationMirror(n - 4, '-', [4], {});
- testInvocationMirror(-n, '+', [], {});
+ testInvocationMirror(-n, '-', [], {});
testInvocationMirror(n[42], '[]', [42], {});
- testInvocationMirror(n[37] = 42, '[]=', [37, 42], {});
+ testInvocationMirror((n..[37] = 42).last, '[]=', [37, 42], {});
// Calling as function when it's not.
testInvocationMirror(n(), 'call', [], {});
testInvocationMirror(n(42), 'call', [42], {});
testInvocationMirror(n(x: 42), 'call', [], {"x": 42});
- testInvocationMirror(n(37, x: 42), 'call', [37], {"x": 42});is
+ testInvocationMirror(n(37, x: 42), 'call', [37], {"x": 42});
// Calling with arguments not matching existing call method.
testInvocationMirror(c(), 'call', [], {});
@@ -108,17 +113,17 @@
testInvocationMirror(n.flif(37, 42), "flif", [37, 42], {});
testInvocationMirror(n.flif(x: 42), "flif", [], {"x": 42});
testInvocationMirror(n.flif(37, x: 42), "flif", [37], {"x": 42});
- testInvocationMirror(n.flif = 42, "flif=", [42]);
+ testInvocationMirror((n..flif = 42).last, "flif=", [42]);
testInvocationMirror(n.flaf(37, 42), "flaf", [37, 42], {});
testInvocationMirror(n.flaf(x: 42), "flaf", [], {"x": 42});
testInvocationMirror(n.flaf(37, x: 42), "flaf", [37], {"x": 42});
- testInvocationMirror(n.flaf = 42, "flaf=", [42]);
+ testInvocationMirror((n..flaf = 42).last, "flaf=", [42]);
testInvocationMirror(n.flof(37, 42), "flof", [37, 42], {});
testInvocationMirror(n.flof(x: 42), "flof", [], {"x": 42});
testInvocationMirror(n.flof(37, y: 42), "flof", [37], {"y": 42});
- testInvocationMirror(n.flof = 42, "flof=", [42]);
+ testInvocationMirror((n..flof = 42).last, "flof=", [42]);
// Reading works.
Expect.isTrue(n.flif is Function);
@@ -126,26 +131,26 @@
Expect.isTrue(n.flof is Function);
// Writing to read-only fields.
- testInvocationMirror(n.wut = 42, "wut=", [42]);
- testInvocationMirror(n.plif = 42, "plif=", [42]);
- testInvocationMirror(n.plaf = 42, "plaf=", [42]);
+ testInvocationMirror((n..wut = 42).last, "wut=", [42]);
+ testInvocationMirror((n..plif = 42).last, "plif=", [42]);
+ testInvocationMirror((n..plaf = 42).last, "plaf=", [42]);
// Trick call to n.call - wut is a getter returning n again.
- testInvocationMirror(n.wut(42), "call", [42]);
+ testInvocationMirror(n.wut(42), "call", [42], {});
// Closurizing a method means that calling it badly will not hit the
// original receivers noSuchMethod, only the one inherited from Object
// by the closure object.
Expect.throws(() { var x = n.flif; x(37, 42); },
- (e) => e is noSuchMethodError);
+ (e) => e is NoSuchMethodError);
Expect.throws(() { var x = c.call; x(37, 42); },
- (e) => e is noSuchMethodError);
+ (e) => e is NoSuchMethodError);
}
// Test the NoSuchMethodError thrown by different incorrect calls.
testNoSuchMethodErrors() {
test(Function block) {
- Expect.throws(block, (e) => e is noSuchMethodError);
+ Expect.throws(block, (e) => e is NoSuchMethodError);
}
var o = new Object();
diff --git a/tests/language/language.status b/tests/language/language.status
index 0549cc3..fd80dde 100644
--- a/tests/language/language.status
+++ b/tests/language/language.status
@@ -28,8 +28,10 @@
pseudo_kw_illegal_test/14: Fail # Issue 356
# These bugs refer currently ongoing language discussions.
-constructor5_test: Fail # (Discussion ongoing)
-constructor6_test: Fail # (Discussion ongoing)
+constructor5_test: Fail # (Discussion ongoing)
+
+constructor6_test: Fail # Issue 6422
+closure_in_initializer_test: Fail # Issue 6422
# Regular bugs which should be fixed.
const_init6_negative_test: Fail # Issue 811
@@ -57,12 +59,12 @@
export_cyclic_test: Crash # issue 6060
-call_through_getter_test: Fail # issue 6124
call_through_null_getter_test: Fail # issue 6124
-local_function_test: Fail # issue 6124
-naming_test: Fail # issue 6124
invocation_mirror_test: Fail # issue 3326, 3622.
+no_such_method_test: Fail # issue 3326, 3622.
+
+invocation_mirror_indirect_test: Fail # Issue 3326
[ $compiler == none && ($system == macos || $system == linux) && $arch == ia32 && $checked ]
gc_test: Skip # Issue 1487, flaky.
@@ -139,8 +141,6 @@
constructor3_negative_test: Fail # Runtime only test, rewrite as multitest
constructor_call_wrong_argument_count_negative_test: Fail # Runtime only test, rewrite as multitest
disable_privacy_test: Fail # Issue 1882: Needs --disable_privacy support.
-duplicate_implements_test/03: Fail, OK # we are going to remove interfaces
-duplicate_implements_test/04: Fail, OK # we are going to remove interfaces
factory5_test/00: Fail # issue 3079
field_method4_negative_test: Fail # Runtime only test, rewrite as multitest
field7_negative_test: Fail, OK # language changed, test issue 5249
@@ -148,11 +148,9 @@
getter_no_setter_test/01: Fail # Fails to detect compile-time error.
getter_no_setter2_test/01: Fail # Fails to detect compile-time error.
instance_call_wrong_argument_count_negative_test: Fail # Runtime only test, rewrite as multitest
-interface_factory1_negative_test: Fail # language change 1031
# Test expects signature of noSuchMethod to be correct according
# to specification. Should start working when the library signature
# changes.
-invocation_mirror_test: Fail, OK
is_not_class2_negative_test: Fail # Runtime only test, rewrite as multitest
library2_negative_test: Fail # still a valid test? Issue 3649
library4_negative_test: Fail # still a valid test? Issue 3530
@@ -160,11 +158,13 @@
list_literal4_test: Fail # Issue 1343
map_literal4_test: Fail # Issue 1343
named_parameters_with_object_property_names_test: Fail # Issue 2137
-no_such_method_negative_test: Fail # Runtime only test, rewrite as multiteste
+many_overridden_no_such_method_test: Fail
+no_such_method_negative_test: Fail # Runtime only test, rewrite as multitest
override_field_test/03: Fail # still a valid test? Issue 3894
override_field_test/04: Fail # still a valid test? Issue 3656
override_field_method3_negative_test: Fail, OK # test issue 5249
override_field_method6_negative_test: Fail, OK # test issue 5249
+overridden_no_such_method_test: Fail
parameter_initializer6_negative_test: Fail # language change 4288
prefix1_negative_test : Fail # language change 1031
prefix4_negative_test : Fail # language change 1031
@@ -172,7 +172,6 @@
prefix8_negative_test : Fail # language change 1031
prefix9_negative_test : Fail # language change 1031
prefix10_negative_test : Fail # language change 1031
-prefix11_negative_test : Fail # language change 1031
private_member3_negative_test: Fail # Runtime only test? rewrite as multitest
pseudo_kw_illegal_test/09: Fail, OK # 'interface' is not a built-in identifier
pseudo_kw_illegal_test/14: Fail, OK # 'source' is not a built-in identifier
@@ -185,7 +184,6 @@
syntax_test/none: Fail # Bug 2107 Static type warnings in none case (INSTANTIATION_OF_CLASS_WITH_UNIMPLEMENTED_MEMBERS)
throw7_negative_test: Fail # Issue 3654
type_variable_bounds_test/00: Fail # issue 3079
-type_variable_bounds_test/07: Fail # language change 1031
# test issue 5291
type_parameter_test/none: Fail, OK
@@ -204,6 +202,109 @@
abstract_syntax_test/none: Fail, OK
interface_test/none: Fail, OK
+# test issue 6338
+application_negative_test: Pass
+application_test: Fail, OK
+generic_instanceof_test: Fail, OK
+hello_script_test: Fail, OK
+lazy_static6_test: Fail, OK
+library1_test: Fail, OK
+library_prefixes_test: Fail, OK
+many_generic_instanceof_test: Fail, OK
+multi_pass2_test: Fail, OK
+multi_pass_test: Fail, OK
+private2_test: Fail, OK
+private3_test: Fail, OK
+private_test: Fail, OK
+top_level_entry_test: Fail, OK
+top_level_multiple_files_test: Fail, OK
+top_level_non_prefixed_library_test: Fail, OK
+
+
+
+# test issue 6324
+class_test: Fail, OK
+compile_time_constant_h_test: Fail, OK
+const_constructor_syntax_test/none: Fail, OK
+ct_const_test: Fail, OK
+cyclic_type_variable_test/none: Fail, OK
+cyclic_type_variable_test/01: Fail, OK
+cyclic_type_variable_test/02: Fail, OK
+cyclic_type_variable_test/03: Fail, OK
+cyclic_type_variable_test/04: Fail, OK
+default_class_implicit_constructor_test: Fail, OK
+default_factory2_test/none: Fail, OK
+default_factory2_test/01: Fail, OK
+default_factory3_test: Fail, OK
+default_factory_library_test: Fail, OK
+default_implementation2_test: Fail, OK
+default_factory_test: Fail, OK
+default_implementation_test: Fail, OK
+duplicate_implements_test/none: Fail, OK
+duplicate_implements_test/03: Pass
+duplicate_implements_test/04: Pass
+dynamic_test: Fail, OK
+factory2_test: Fail, OK
+factory3_test: Fail, OK
+factory5_test/none: Fail, OK
+factory4_test: Fail, OK
+factory_implementation_test: Fail, OK
+generic_deep_test: Fail, OK
+generic_instanceof3_test: Fail, OK
+generic_syntax_test: Fail, OK
+implicit_this_test/01: Fail, OK
+implicit_this_test/04: Fail, OK
+implied_interface_test: Fail, OK
+instanceof2_test: Fail, OK
+instanceof_test: Fail, OK
+interface_constants_test: Fail, OK
+interface_factory1_negative_test: Fail, OK
+interface_factory_test: Fail, OK
+interface_factory_multi_test: Fail, OK
+interface_inherit_field_test: Fail, OK
+interface_test/00: Fail, OK
+is_operator_test: Fail, OK
+library_same_name_used_test: Fail, OK
+list_literal_syntax_test/none: Fail, OK
+method_override2_test/none: Fail, OK
+named_parameters_test/none: Fail, OK
+non_parameterized_factory2_test: Fail, OK
+non_parameterized_factory_test: Fail, OK
+prefix11_negative_test: Pass
+prefix14_test: Fail, OK
+prefix15_test: Fail, OK
+prefix16_test: Fail, OK
+prefix17_test: Fail, OK
+prefix22_test: Fail, OK
+prefix23_test: Fail, OK
+throw1_test: Fail, OK
+throw2_test: Fail, OK
+try_catch2_test: Fail, OK
+try_catch3_test: Fail, OK
+type_checks_in_factory_method_test: Fail, OK
+type_variable_bounds2_test/none: Fail, OK
+type_variable_bounds2_test/01: Fail, OK
+type_variable_bounds2_test/02: Fail, OK
+type_variable_bounds2_test/03: Fail, OK
+type_variable_bounds2_test/04: Fail, OK
+type_variable_bounds2_test/00: Fail, OK
+type_variable_bounds2_test/06: Fail, OK
+type_variable_bounds_test/none: Fail, OK
+type_variable_bounds_test/04: Fail, OK
+type_variable_bounds_test/05: Fail, OK
+type_variable_bounds_test/02: Fail, OK
+type_variable_bounds_test/03: Fail, OK
+type_variable_bounds_test/06: Fail, OK
+type_variable_bounds_test/01: Fail, OK
+type_variable_bounds_test/07: Fail, OK
+type_variable_bounds_test/10: Fail, OK
+type_variable_bounds_test/09: Fail, OK
+type_variable_scope_test/none: Fail, OK
+interface_factory1_negative_test: Pass
+type_variable_bounds_test/07: Pass
+
+
+
#
# Add new dartc annotations above in alphabetical order
#
@@ -214,6 +315,10 @@
[ $compiler == none && $runtime == drt ]
+final_variable_assignment_test/01: Fail
+final_variable_assignment_test/02: Fail
+final_variable_assignment_test/03: Fail
+final_variable_assignment_test/04: Fail
gc_test: Skip # Issue 1487
prefix_new_test: Fail
import_combinators_test: Fail
@@ -249,6 +354,38 @@
*: Skip
[ $compiler == dart2dart ]
+many_overridden_no_such_method_test: Fail, Pass # TRIAGE: fails in minified mode
+overridden_no_such_method_test: Fail, Pass # TRIAGE: fails in minified mode
+# Calling unresolved class constructor:
+# call_constructor_on_unresolvable_class_test/07: Fail
+call_nonexistent_constructor_test: Fail
+
+# Renaming type from platform library:
+dynamic_test: Fail
+
+# Missing compile-time error when modifying final local variables
+final_variable_assignment_test/01: Fail
+final_variable_assignment_test/02: Fail
+final_variable_assignment_test/03: Fail
+final_variable_assignment_test/04: Fail
+
+# Factory for another interface (will be obsolete soon).
+# factory2_negative_test: Fail
+# factory3_negative_test: Fail
+# factory_negative_test: Fail
+default_factory_test: Fail
+factory2_test: Fail
+factory3_test: Fail
+factory4_test: Fail
+factory5_test: Fail
+factory_implementation_test: Fail
+interface_factory_multi_test: Fail
+interface_factory_test: Fail
+non_parameterized_factory2_test: Fail
+non_parameterized_factory_test: Fail
+type_variable_scope_test: Fail
+constructor_redirect2_test/03: Fail
+
class_literal_test/05: Fail # http://dartbug.com/5519
class_literal_test/10: Fail # http://dartbug.com/5519
class_literal_test/11: Fail # http://dartbug.com/5519
@@ -298,7 +435,6 @@
named_parameters_aggregated_test/01: Fail # http://dartbug.com/5519
named_parameters_aggregated_test/03: Fail # http://dartbug.com/5519
named_parameters_aggregated_test/04: Fail # http://dartbug.com/5519
-new_expression_type_args_test/02: Fail # inherited from dart2js
not_enough_positional_arguments_test/01: Fail # http://dartbug.com/5519
override_field_test/04: Fail # http://dartbug.com/5519
static_field3_test/01: Fail # http://dartbug.com/5519
@@ -314,6 +450,7 @@
bad_constructor_test/06: Fail
argument_definition_test/*: Skip # Not implemented.
argument_definition2_test: Skip # Not implemented. Fails in minified tests.
+argument_definition3_test: Skip # Not implemented. Fails in minified tests.
const_var_test: Fail # Map literals take 2 type arguments.
map_literal3_test: Fail # Map literals take 2 type arguments.
class_cycle_negative_test: Fail, OK # Bad test: assumes eager loading.
@@ -384,6 +521,7 @@
# DartVM problem.
constructor5_test: Fail
constructor6_test: Fail
+closure_in_initializer_test: Fail
field_override_test/01: Fail
field_override_test/02: Fail
field_override_test/none: Fail
@@ -396,12 +534,12 @@
generic_test: Fail, Ok
# Minified mode failures.
# TODO(antonm): proper support in test framework.
-overridden_no_such_method_test: Pass, Fail, OK # Hard codes the name of invoked method ("foo").
-many_overridden_no_such_method_test: Pass, Fail, OK # Hard codes the name of invoked method ("foo").
no_such_method_test: Pass, Fail, OK # Hard codes the name of invoked method ("foo").
named_parameters_aggregated_test/05: Fail # Compile-time error reported instead of static type warning.
+new_expression_type_args_test/02: Fail # Test does not conform with spec.
+
get_set_syntax_test/00: Fail # Fixed by https://chromiumcodereview.appspot.com/10915111
get_set_syntax_test/01: Fail # Fixed by https://chromiumcodereview.appspot.com/10915111
get_set_syntax_test/02: Fail # Fixed by https://chromiumcodereview.appspot.com/10915111
@@ -435,10 +573,8 @@
type_error_test: Fail, OK # VM bug: http://dartbug.com/5280
-call_through_getter_test: Fail # issue 6130
call_through_null_getter_test: Fail # issue 6130
-local_function_test: Fail # issue 6130
-naming_test: Fail # issue 6130
# This is a VM error when the compiled code is run.
invocation_mirror_test: Fail # issue 3326, 3622.
+invocation_mirror_indirect_test: Fail # issue 3326, 3622.
diff --git a/tests/language/language_dart2js.status b/tests/language/language_dart2js.status
index f3ff4de..8bcd4fd 100644
--- a/tests/language/language_dart2js.status
+++ b/tests/language/language_dart2js.status
@@ -38,9 +38,11 @@
type_parameter_test/03: Fail # Issue 4932
type_parameter_test/04: Fail # Issue 4932
+super_call4_test: Fail # Badly generated noSuchMethod call.
+
[ $compiler == dart2js && $unchecked ]
assertion_test: Fail
-new_expression_type_args_test/02: Fail # dart2js fails to reject type variable within static member
+new_expression_type_args_test/02: Fail # Test does not conform with spec.
# Only checked mode reports an error on type assignment
# problems in compile time constants.
@@ -59,6 +61,10 @@
compile_time_constant_checked3_test/06: Fail, OK
[ $compiler == dart2js ]
+final_variable_assignment_test/01: Fail
+final_variable_assignment_test/02: Fail
+final_variable_assignment_test/03: Fail
+final_variable_assignment_test/04: Fail
bad_constructor_test/04: Fail # http://dartbug.com/5519
bad_constructor_test/05: Fail # http://dartbug.com/5519
bad_constructor_test/06: Fail # http://dartbug.com/5519
@@ -70,14 +76,6 @@
illegal_invocation_test/03: Fail # http://dartbug.com/5519
isnot_malformed_type_test/01: Fail # http://dartbug.com/5519
not_enough_positional_arguments_test/01: Fail # http://dartbug.com/5519
-not_enough_positional_arguments_test/02: Fail # http://dartbug.com/5519
-optional_named_parameters_test/01: Fail # http://dartbug.com/5519
-optional_named_parameters_test/03: Fail # http://dartbug.com/5519
-optional_named_parameters_test/05: Fail # http://dartbug.com/5519
-optional_named_parameters_test/07: Fail # http://dartbug.com/5519
-optional_named_parameters_test/09: Fail # http://dartbug.com/5519
-
-execute_finally8_test: Fail # http://dartbug.com/5643
throw_expr_test: Fail
metadata_test: Fail # Metadata on type parameters not supported.
@@ -94,12 +92,8 @@
function_type_alias2_test: Fail
named_parameters_type_test: Fail
positional_parameters_type_test: Fail
-named_parameters_test/01: Fail
-named_parameters_test/03: Fail
-named_parameters_test/05: Fail
-named_parameters_test/07: Fail
-named_parameters_test/09: Fail
named_parameters_with_object_property_names_test: Fail
+named_parameters_aggregated_test/04: Fail # dart2js issue 5213
# Fail "const EmptyLink<Element>" must be a compile-time constant if unchecked on linux.
# Crash infinite loop on Mac and dart2js checked mode on linux.
@@ -111,7 +105,6 @@
map_literal3_test: Fail # Map literals take 2 type arguments.
ct_const_test: Fail # We don't take the generic type into account yet.
char_escape_test: Fail # Unhandled non-BMP character: U+10000
-constructor6_test: Fail # Closures inside initializers not implemented.
default_factory_library_test: Fail # lib is not a type
dynamic_test: Fail # cannot resolve type F1
factory_redirection_test/none: Fail # Not implemented.
@@ -122,10 +115,8 @@
factory_redirection_test/05: Fail # Not implemented.
factory_redirection_test/06: Fail # Not implemented.
factory_redirection_test/07: Pass # For the wrong reason. Not implemented.
+constructor_redirect2_test/03: Fail # redirecting ctor with initializing formal
factory3_test: Fail # internal error: visitIs for type variables not implemented
-function_literals2_test: Fail # Closures inside initializers not implemented.
-function_syntax_test/none: Fail # Closures inside initializers not implemented.
-function_test: Fail # internal error: Closures inside initializers not implemented
function_type_alias2_test: Fail # cannot resolve type f1
function_type_alias3_test: Fail # cannot resolve type F
function_type_alias4_test: Fail # cannot resolve type F
@@ -155,7 +146,6 @@
get_set_syntax_test/15: Fail # Fixed by https://chromiumcodereview.appspot.com/10915111
get_set_syntax_test/16: Fail # Fixed by https://chromiumcodereview.appspot.com/10915111
implicit_scope_test: Fail # duplicate definition of a="bar"
-library_prefixes_test: Fail # other is not a type
many_generic_instanceof_test: Fail # cannot resolve type T
method_binding_test: Fail # internal error: super property read not implemented.
method_override_test: Fail # cannot resolve type GetKeysFunctionType
@@ -166,9 +156,6 @@
abstract_getter_test/01: Fail # instantiation of abstract class
abstract_factory_constructor_test/01: Fail # instantiation of abstract class
parameter_initializer6_negative_test: Fail # Issue 3502
-named_parameters2_test: Fail # Unimplemented non-matching static call
-named_parameters3_test: Fail # Unimplemented non-matching static call
-named_parameters4_test: Fail # Unimplemented non-matching static call
named_parameters_aggregated_test/01: Fail # Presence of default values for optional params is not properly validated in type definitions.
named_parameters_aggregated_test/03: Fail # Presence of default values for optional params is not properly validated in closure types.
named_parameters_aggregated_test/05: Fail # Absence of positional parameters before named parameters does not trigger static type warning.
diff --git a/tests/language/licm_test.dart b/tests/language/licm_test.dart
new file mode 100644
index 0000000..67fea65
--- /dev/null
+++ b/tests/language/licm_test.dart
@@ -0,0 +1,25 @@
+// 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.
+
+var sum = 0;
+var foo = 0;
+var bar = 1;
+
+test() {
+ while (true) {
+ if (0 === foo) {
+ sum += 2;
+ if (1 === bar) {
+ sum += 3;
+ break;
+ }
+ break;
+ }
+ }
+}
+
+main() {
+ test();
+ Expect.equals(5, sum);
+}
diff --git a/tests/language/list_test.dart b/tests/language/list_test.dart
index 192b219..899c178 100644
--- a/tests/language/list_test.dart
+++ b/tests/language/list_test.dart
@@ -48,7 +48,7 @@
a.forEach(f(element) { Expect.equals(null, element); });
a[1] = 1;
Expect.equals(1, a[1]);
- Expect.throws(() => a[len], (e) => e is IndexOutOfRangeException);
+ Expect.throws(() => a[len], (e) => e is RangeError);
Expect.throws(() {
List a = new List(4);
@@ -58,7 +58,7 @@
Expect.throws(() {
List a = new List(4);
a.setRange(10, 1, a, 1);
- }, (e) => e is IndexOutOfRangeException);
+ }, (e) => e is RangeError);
a = new List(4);
List b = new List(4);
@@ -101,7 +101,7 @@
List list = new List();
// We cannot write just 'list.removeLast' due to issue 3769.
Expect.throws(() => list.removeLast(),
- (e) => e is IndexOutOfRangeException);
+ (e) => e is RangeError);
Expect.equals(0, list.length);
}
}
diff --git a/tests/language/mint_compares.dart b/tests/language/mint_compares.dart
index c09bec1..fea302e 100644
--- a/tests/language/mint_compares.dart
+++ b/tests/language/mint_compares.dart
@@ -4,7 +4,6 @@
// Test compares on 64-bit integers.
-
compareTest() {
Expect.isFalse(4294967296 < 6);
Expect.isFalse(4294967296 < 4294967296);
@@ -52,9 +51,46 @@
Expect.isFalse(-4294967296 < -184467440737095516150);
}
+compareTest2(lt, lte, gt, gte) {
+ Expect.isFalse(lt(4294967296, 6));
+ Expect.isFalse(lte(4294967296, 6));
+ Expect.isTrue(gt(4294967296, 6));
+ Expect.isTrue(gte(4294967296, 6));
+
+ Expect.isTrue(lte(-1, -1));
+ Expect.isTrue(gte(-1, -1));
+ Expect.isTrue(lte(-2, -1));
+ Expect.isFalse(gte(-2, -1));
+ Expect.isTrue(lte(-4294967296, -1));
+ Expect.isFalse(gte(-4294967296, -1));
+
+ Expect.isTrue(lt(-2, -1));
+ Expect.isFalse(gt(-2, -1));
+ Expect.isTrue(lt(-4294967296, -1));
+ Expect.isFalse(gt(-4294967296, -1));
+
+ Expect.isFalse(lt(-1, -4294967296));
+ Expect.isTrue(gt(-1, -4294967296));
+ Expect.isFalse(lt(2, -2));
+ Expect.isTrue(gt(2, -2));
+ Expect.isFalse(lt(4294967296, -1));
+ Expect.isTrue(gt(4294967296, -1));
+}
+
+bool lt1(a, b) => a < b;
+bool lte1(a, b) => a <= b;
+bool gt1(a, b) => a > b;
+bool gte1(a, b) => a >= b;
+
+bool lt2(a, b) => a < b ? true : false;
+bool lte2(a, b) => a <= b ? true : false;
+bool gt2(a, b) => a > b ? true : false;
+bool gte2(a, b) => a >= b ? true : false;
main() {
- for (var i = 0; i < 100; i++) {
+ for (var i = 0; i < 1000; i++) {
compareTest();
+ compareTest2(lt1, lte1, gt1, gte1);
+ compareTest2(lt2, lte2, gt2, gte2);
}
}
diff --git a/tests/language/no_such_method_test.dart b/tests/language/no_such_method_test.dart
index 138df66..0bd9da3 100644
--- a/tests/language/no_such_method_test.dart
+++ b/tests/language/no_such_method_test.dart
@@ -5,22 +5,20 @@
class NoSuchMethodTest {
- foo([a = 10, b = 20]) {
+ foo({a : 10, b : 20}) {
return (10 * a) + b;
}
- noSuchMethod(String name, List args) {
- Expect.equals("moo", name);
- Expect.equals(1, args.length);
- return foo(args[0]);
+ noSuchMethod(InvocationMirror im) {
+ Expect.equals("moo", im.memberName);
+ Expect.equals(0, im.positionalArguments.length);
+ Expect.equals(1, im.namedArguments.length);
+ return foo(b:im.namedArguments["b"]);
}
static testMain() {
var obj = new NoSuchMethodTest();
- Expect.equals(1010, obj.moo(b:99)); // obj.NoSuchMethod called here.
- // After we remove the rest argument and change the signature of
- // noSuchMethod to be compatible with named arguments, we can expect the
- // correct value of 199 instead of 1010.
+ Expect.equals(199, obj.moo(b:99)); // obj.NoSuchMethod called here.
}
}
diff --git a/tests/language/overridden_no_such_method.dart b/tests/language/overridden_no_such_method.dart
index d2d26fb..b06fc5c 100644
--- a/tests/language/overridden_no_such_method.dart
+++ b/tests/language/overridden_no_such_method.dart
@@ -7,9 +7,10 @@
OverriddenNoSuchMethod() {}
- noSuchMethod(var function_name, List args) {
- Expect.equals("foo", function_name);
+ noSuchMethod(InvocationMirror mirror) {
+ Expect.equals("foo", mirror.memberName);
// 'foo' was called with two parameters (not counting receiver).
+ List args = mirror.positionalArguments;
Expect.equals(2, args.length);
Expect.equals(101, args[0]);
Expect.equals(202, args[1]);
diff --git a/tests/language/super_assign_test.dart b/tests/language/super_assign_test.dart
new file mode 100644
index 0000000..84f8146
--- /dev/null
+++ b/tests/language/super_assign_test.dart
@@ -0,0 +1,18 @@
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+class A {
+ int x;
+}
+
+class C extends A {
+ void setX(int value) { super.x = value; }
+}
+
+main() {
+ A a = new C();
+ a.x = 37;
+ a.setX(42);
+ Expect.equals(42, a.x);
+}
diff --git a/tests/language/super_call4_test.dart b/tests/language/super_call4_test.dart
index f353f48..f5ce7c28 100644
--- a/tests/language/super_call4_test.dart
+++ b/tests/language/super_call4_test.dart
@@ -6,15 +6,13 @@
// current class.
class C {
- // bool noSuchMethod(InvocationMirror im) { // Issue 3622
- bool noSuchMethod(String function_name, List args) {
+ bool noSuchMethod(InvocationMirror im) {
return true;
}
}
class D extends C {
- // bool noSuchMethod(InvocationMirror im) { // Issue 3622
- bool noSuchMethod(String function_name, List args) {
+ bool noSuchMethod(InvocationMirror im) {
return false;
}
test() {
diff --git a/tests/language/super_operator_test.dart b/tests/language/super_operator_test.dart
index a0be547..eea7545 100644
--- a/tests/language/super_operator_test.dart
+++ b/tests/language/super_operator_test.dart
@@ -47,6 +47,18 @@
}
+
+class Autobianchi {
+ g() => super[0];
+}
+
+
+testRegression6403() {
+ // Do not crash, throw exception instead
+ new Autobianchi().g();
+}
+
+
main () {
var a = new A();
a = a + "William"; // operator + of class A.
@@ -62,4 +74,5 @@
Expect.equals(43, a.things[4]);
Expect.equals(86, a[4]);
+ Expect.throws(testRegression6403);
}
diff --git a/tests/language/typed_equality_test.dart b/tests/language/typed_equality_test.dart
new file mode 100644
index 0000000..c849df0
--- /dev/null
+++ b/tests/language/typed_equality_test.dart
@@ -0,0 +1,21 @@
+// 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.
+
+// Regression test for http://dartbug.com/6036. dart2js used to fail
+// this method because it was computing that intersecting type D with
+// type C is conflicting.
+
+foo(a, b) {
+ if (a === b) return;
+ throw 'broken';
+}
+
+class D {}
+
+class C implements D {}
+
+main() {
+ var c = new C();
+ foo(c, c as D);
+}
diff --git a/tests/language/typed_selector_test.dart b/tests/language/typed_selector_test.dart
new file mode 100644
index 0000000..5431d36
--- /dev/null
+++ b/tests/language/typed_selector_test.dart
@@ -0,0 +1,29 @@
+// 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.
+
+// Regression test for http://dartbug.com/6259. This test used to fail
+// on dart2js because class A does not know [A.document] is a target for
+// the call [:obj.document:] in the [main] method. Therefore, dart2js
+// would not compile [A.document].
+
+class A {
+ get document => 42;
+}
+
+abstract class B {
+ abstract get document;
+}
+
+class C extends A implements B {
+}
+
+int inscrutable(int x) => x == 0 ? 0 : x | inscrutable(x & (x - 1));
+
+void main() {
+ var tab = [new Object(), new C()];
+ var obj = tab[inscrutable(1)];
+ int res = 0;
+ if (obj is B) res = obj.document;
+ Expect.equals(42, res);
+}
diff --git a/tests/language/value_range2_test.dart b/tests/language/value_range2_test.dart
index 49a9b71..6e45cc1 100644
--- a/tests/language/value_range2_test.dart
+++ b/tests/language/value_range2_test.dart
@@ -17,6 +17,6 @@
main() {
Expect.throws(() => foo(),
- (e) => e is IndexOutOfRangeException);
+ (e) => e is RangeError);
}
diff --git a/tests/language/value_range_test.dart b/tests/language/value_range_test.dart
index f5a0491..5f4abb7 100644
--- a/tests/language/value_range_test.dart
+++ b/tests/language/value_range_test.dart
@@ -15,6 +15,6 @@
main() {
Expect.throws(() => foo(),
- (e) => e is IndexOutOfRangeException);
+ (e) => e is RangeError);
}
diff --git a/tests/lib/lib.status b/tests/lib/lib.status
index 4e9589d..63ffc68 100644
--- a/tests/lib/lib.status
+++ b/tests/lib/lib.status
@@ -13,3 +13,10 @@
[ $compiler == dart2dart ]
# Skip until we stabilize language tests.
*: Skip
+
+[ $compiler == dartc ]
+# lib issue 6322
+crypto/hmac_sha1_test: Fail, OK
+crypto/hmac_sha256_test: Fail, OK
+crypto/sha1_test: Fail, OK
+crypto/sha256_test: Fail, OK
diff --git a/tests/standalone/byte_array_test.dart b/tests/standalone/byte_array_test.dart
index e23715f..c2a1165 100644
--- a/tests/standalone/byte_array_test.dart
+++ b/tests/standalone/byte_array_test.dart
@@ -20,7 +20,7 @@
for (int i = 0; i < 10; i++) {
Expect.equals(0, byteArray[i]);
}
-
+
}
void testUnsignedByteArrayRange() {
@@ -31,7 +31,7 @@
Expect.equals(255, byteArray[1]);
byteArray[1] = 0;
Expect.equals(0, byteArray[1]);
-
+
Expect.throws(() {
byteArray[1] = 1.2;
});
@@ -131,7 +131,7 @@
Expect.equals(10, array.subByteArray(0, null).lengthInBytes());
Expect.equals(10, array.subByteArray().lengthInBytes());
testThrowsIndex(function) {
- Expect.throws(function, (e) => e is IndexOutOfRangeException);
+ Expect.throws(function, (e) => e is RangeError);
}
testThrowsIndex(() => array.subByteArray(0, -1));
testThrowsIndex(() => array.subByteArray(1, -1));
diff --git a/tests/standalone/crypto/base64_test.dart b/tests/standalone/crypto/base64_test.dart
index 1d47aac..96de0c2 100644
--- a/tests/standalone/crypto/base64_test.dart
+++ b/tests/standalone/crypto/base64_test.dart
@@ -2,7 +2,7 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-#source("../../../runtime/bin/base64.dart");
+#source("../../../lib/io/base64.dart");
void main() {
String line;
diff --git a/tests/standalone/io/dart_std_io_pipe_test.dart b/tests/standalone/io/dart_std_io_pipe_test.dart
index 1642fa6..5264a72 100644
--- a/tests/standalone/io/dart_std_io_pipe_test.dart
+++ b/tests/standalone/io/dart_std_io_pipe_test.dart
@@ -44,7 +44,6 @@
future.then((process) {
process.onExit = (exitCode) {
Expect.equals(0, exitCode);
- process.close();
// Check the expected file contents.
if (type == "0") {
@@ -68,6 +67,9 @@
// Cleanup test directory.
dir.deleteRecursivelySync();
};
+ // Drain out and err streams so they close.
+ process.stdout.onData = process.stdout.read;
+ process.stderr.onData = process.stderr.read;
});
future.handleException((ProcessException error) {
dir.deleteRecursivelySync();
diff --git a/tests/standalone/io/echo_server_stream_test.dart b/tests/standalone/io/echo_server_stream_test.dart
index c30fc95..3368b5c 100644
--- a/tests/standalone/io/echo_server_stream_test.dart
+++ b/tests/standalone/io/echo_server_stream_test.dart
@@ -39,7 +39,7 @@
void connectHandler() {
- SocketOutputStream stream = _socket.outputStream;
+ OutputStream stream = _socket.outputStream;
void dataSent() {
InputStream inputStream = _socket.inputStream;
@@ -149,9 +149,8 @@
int offset = 0;
void dataReceived() {
- SocketOutputStream outputStream;
int bytesRead;
- outputStream = connection.outputStream;
+ OutputStream outputStream = connection.outputStream;
bytesRead = inputStream.readInto(buffer, offset, MSGSIZE - offset);
if (bytesRead > 0) {
offset += bytesRead;
diff --git a/tests/standalone/io/file_test.dart b/tests/standalone/io/file_test.dart
index 4fd426a..02ee65f 100644
--- a/tests/standalone/io/file_test.dart
+++ b/tests/standalone/io/file_test.dart
@@ -872,7 +872,7 @@
try {
List<int> buffer = new List<int>(10);
openedFile.readListSync(buffer, 0, 12);
- } on IndexOutOfRangeException catch (ex) {
+ } on RangeError catch (ex) {
exceptionCaught = true;
} on Exception catch (ex) {
wrongExceptionCaught = true;
@@ -883,7 +883,7 @@
try {
List<int> buffer = new List<int>(10);
openedFile.readListSync(buffer, 6, 6);
- } on IndexOutOfRangeException catch (ex) {
+ } on RangeError catch (ex) {
exceptionCaught = true;
} on Exception catch (ex) {
wrongExceptionCaught = true;
@@ -894,7 +894,7 @@
try {
List<int> buffer = new List<int>(10);
openedFile.readListSync(buffer, -1, 1);
- } on IndexOutOfRangeException catch (ex) {
+ } on RangeError catch (ex) {
exceptionCaught = true;
} on Exception catch (ex) {
wrongExceptionCaught = true;
@@ -905,7 +905,7 @@
try {
List<int> buffer = new List<int>(10);
openedFile.readListSync(buffer, 0, -1);
- } on IndexOutOfRangeException catch (ex) {
+ } on RangeError catch (ex) {
exceptionCaught = true;
} on Exception catch (ex) {
wrongExceptionCaught = true;
@@ -916,7 +916,7 @@
try {
List<int> buffer = new List<int>(10);
openedFile.writeListSync(buffer, 0, 12);
- } on IndexOutOfRangeException catch (ex) {
+ } on RangeError catch (ex) {
exceptionCaught = true;
} on Exception catch (ex) {
wrongExceptionCaught = true;
@@ -927,7 +927,7 @@
try {
List<int> buffer = new List<int>(10);
openedFile.writeListSync(buffer, 6, 6);
- } on IndexOutOfRangeException catch (ex) {
+ } on RangeError catch (ex) {
exceptionCaught = true;
} on Exception catch (ex) {
wrongExceptionCaught = true;
@@ -938,7 +938,7 @@
try {
List<int> buffer = new List<int>(10);
openedFile.writeListSync(buffer, -1, 1);
- } on IndexOutOfRangeException catch (ex) {
+ } on RangeError catch (ex) {
exceptionCaught = true;
} on Exception catch (ex) {
wrongExceptionCaught = true;
@@ -949,7 +949,7 @@
try {
List<int> buffer = new List<int>(10);
openedFile.writeListSync(buffer, 0, -1);
- } on IndexOutOfRangeException catch (ex) {
+ } on RangeError catch (ex) {
exceptionCaught = true;
} on Exception catch (ex) {
wrongExceptionCaught = true;
@@ -1218,6 +1218,59 @@
Expect.isFalse(file.existsSync());
}
+ static void testWriteStringUtf8() {
+ var file = new File('${tempDirectory.path}/out_write_string');
+ var string = new String.fromCharCodes([0x192]);
+ file.open(FileMode.WRITE).then((openedFile) {
+ openedFile.writeString(string).then((_) {
+ openedFile.length().then((l) {
+ Expect.equals(2, l);
+ openedFile.close().then((_) {
+ file.open(FileMode.APPEND).then((openedFile) {
+ openedFile.setPosition(2).then((_) {
+ openedFile.writeString(string).then((_) {
+ openedFile.length().then((l) {
+ Expect.equals(4, l);
+ openedFile.close().then((_) {
+ file.readAsText().then((readBack) {
+ Expect.stringEquals(readBack, '$string$string');
+ file.delete().then((_) {
+ file.exists().then((e) {
+ Expect.isFalse(e);
+ asyncTestDone("testWriteStringUtf8");
+ });
+ });
+ });
+ });
+ });
+ });
+ });
+ });
+ });
+ });
+ });
+ });
+ asyncTestStarted();
+ }
+
+ static void testWriteStringUtf8Sync() {
+ var file = new File('${tempDirectory.path}/out_write_string_sync');
+ var string = new String.fromCharCodes([0x192]);
+ var openedFile = file.openSync(FileMode.WRITE);
+ openedFile.writeStringSync(string);
+ Expect.equals(2, openedFile.lengthSync());
+ openedFile.closeSync();
+ openedFile = file.openSync(FileMode.APPEND);
+ openedFile.setPositionSync(2);
+ openedFile.writeStringSync(string);
+ Expect.equals(4, openedFile.lengthSync());
+ openedFile.closeSync();
+ var readBack = file.readAsTextSync();
+ Expect.stringEquals(readBack, '$string$string');
+ file.deleteSync();
+ Expect.isFalse(file.existsSync());
+ }
+
// Helper method to be able to run the test from the runtime
// directory, or the top directory.
static String getFilename(String path) =>
@@ -1273,6 +1326,8 @@
testWriteVariousLists();
testDirectory();
testDirectorySync();
+ testWriteStringUtf8();
+ testWriteStringUtf8Sync();
});
}
}
diff --git a/tests/standalone/io/http_advanced_test.dart b/tests/standalone/io/http_advanced_test.dart
index 77e36fa..a37d025 100644
--- a/tests/standalone/io/http_advanced_test.dart
+++ b/tests/standalone/io/http_advanced_test.dart
@@ -178,6 +178,11 @@
response.outputStream.close();
}
+ void _flushHandler(HttpRequest request, HttpResponse response) {
+ response.outputStream.flush();
+ response.outputStream.close();
+ }
+
void init() {
// Setup request handlers.
_requestHandlers = new Map();
@@ -209,6 +214,10 @@
(HttpRequest request, HttpResponse response) {
_cookie2Handler(request, response);
};
+ _requestHandlers["/flush"] =
+ (HttpRequest request, HttpResponse response) {
+ _flushHandler(request, response);
+ };
}
void dispatch(message, replyTo) {
@@ -405,9 +414,29 @@
testServerMain.start();
}
+void testFlush() {
+ TestServerMain testServerMain = new TestServerMain();
+ testServerMain.setServerStartedHandler((int port) {
+ HttpClient httpClient = new HttpClient();
+
+ HttpClientConnection conn = httpClient.get("127.0.0.1", port, "/flush");
+ conn.onRequest = (HttpClientRequest request) {
+ request.outputStream.flush();
+ request.outputStream.close();
+ };
+ conn.onResponse = (HttpClientResponse response) {
+ Expect.equals(HttpStatus.OK, response.statusCode);
+ httpClient.shutdown();
+ testServerMain.shutdown();
+ };
+ });
+ testServerMain.start();
+}
+
void main() {
testHost();
testExpires();
testContentType();
testCookies();
+ testFlush();
}
diff --git a/tests/standalone/io/http_auth_test.dart b/tests/standalone/io/http_auth_test.dart
new file mode 100644
index 0000000..7347b5d
--- /dev/null
+++ b/tests/standalone/io/http_auth_test.dart
@@ -0,0 +1,264 @@
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+#import("dart:isolate");
+#import("dart:crypto");
+#import("dart:io");
+#import("dart:uri");
+#import("dart:utf");
+
+class Server {
+ HttpServer server;
+ bool passwordChanged = false;
+
+ Server() : server = new HttpServer();
+
+ void start() {
+ server.listen("127.0.0.1", 0);
+ server.defaultRequestHandler =
+ (HttpRequest request, HttpResponse response) {
+ String username;
+ String password;
+ if (request.path == "/") {
+ username = "username";
+ password = "password";
+ } else {
+ username = request.path.substring(1, 6);
+ password = request.path.substring(1, 6);
+ }
+ if (passwordChanged) password = "${password}1";
+ if (request.headers[HttpHeaders.AUTHORIZATION] != null) {
+ Expect.equals(1, request.headers[HttpHeaders.AUTHORIZATION].length);
+ String authorization =
+ request.headers[HttpHeaders.AUTHORIZATION][0];
+ List<String> tokens = authorization.split(" ");
+ Expect.equals("Basic", tokens[0]);
+ String auth =
+ CryptoUtils.bytesToBase64(encodeUtf8("$username:$password"));
+ if (passwordChanged && auth != tokens[1]) {
+ response.statusCode = HttpStatus.UNAUTHORIZED;
+ response.headers.set(HttpHeaders.WWW_AUTHENTICATE,
+ "Basic, realm=realm");
+ } else {
+ Expect.equals(auth, tokens[1]);
+ }
+ } else {
+ response.statusCode = HttpStatus.UNAUTHORIZED;
+ response.headers.set(HttpHeaders.WWW_AUTHENTICATE,
+ "Basic, realm=realm");
+ }
+ response.outputStream.close();
+ };
+ server.addRequestHandler(
+ (HttpRequest request) => request.path == "/passwdchg",
+ (HttpRequest request, HttpResponse response) {
+ passwordChanged = true;
+ response.outputStream.close();
+ });
+ }
+
+ void shutdown() {
+ server.close();
+ }
+
+ int get port => server.port;
+}
+
+Server setupServer() {
+ Server server = new Server();
+ server.start();
+ return server;
+}
+
+void testUrlUserInfo() {
+ Server server = setupServer();
+ HttpClient client = new HttpClient();
+
+ HttpClientConnection conn =
+ client.getUrl(
+ new Uri.fromString(
+ "http://username:password@127.0.0.1:${server.port}/"));
+ conn.onResponse = (HttpClientResponse response) {
+ server.shutdown();
+ client.shutdown();
+ };
+}
+
+void testBasicNoCredentials() {
+ Server server = setupServer();
+ HttpClient client = new HttpClient();
+
+ Future makeRequest(Uri url) {
+ Completer completer = new Completer();
+ HttpClientConnection conn = client.getUrl(url);
+ conn.onResponse = (HttpClientResponse response) {
+ Expect.equals(HttpStatus.UNAUTHORIZED, response.statusCode);
+ completer.complete(null);
+ };
+ return completer.future;
+ }
+
+ var futures = [];
+ for (int i = 0; i < 5; i++) {
+ futures.add(
+ makeRequest(
+ new Uri.fromString("http://127.0.0.1:${server.port}/test$i")));
+ futures.add(
+ makeRequest(
+ new Uri.fromString("http://127.0.0.1:${server.port}/test$i/xxx")));
+ }
+ Futures.wait(futures).then((_) {
+ server.shutdown();
+ client.shutdown();
+ });
+}
+
+void testBasicCredentials() {
+ Server server = setupServer();
+ HttpClient client = new HttpClient();
+
+ Future makeRequest(Uri url) {
+ Completer completer = new Completer();
+ HttpClientConnection conn = client.getUrl(url);
+ conn.onResponse = (HttpClientResponse response) {
+ Expect.equals(HttpStatus.OK, response.statusCode);
+ completer.complete(null);
+ };
+ return completer.future;
+ }
+
+ for (int i = 0; i < 5; i++) {
+ client.addCredentials(
+ new Uri.fromString("http://127.0.0.1:${server.port}/test$i"),
+ "realm",
+ new HttpClientBasicCredentials("test$i", "test$i"));
+ }
+
+ var futures = [];
+ for (int i = 0; i < 5; i++) {
+ futures.add(
+ makeRequest(
+ new Uri.fromString("http://127.0.0.1:${server.port}/test$i")));
+ futures.add(
+ makeRequest(
+ new Uri.fromString("http://127.0.0.1:${server.port}/test$i/xxx")));
+ }
+ Futures.wait(futures).then((_) {
+ server.shutdown();
+ client.shutdown();
+ });
+}
+
+void testBasicAuthenticateCallback() {
+ Server server = setupServer();
+ HttpClient client = new HttpClient();
+ bool passwordChanged = false;
+
+ client.authenticate = (Uri url, String scheme, String realm) {
+ Expect.equals("Basic", scheme);
+ Expect.equals("realm", realm);
+ String username = url.path.substring(1, 6);
+ String password = url.path.substring(1, 6);
+ if (passwordChanged) password = "${password}1";
+ Completer completer = new Completer();
+ new Timer(10, (_) {
+ client.addCredentials(
+ url, realm, new HttpClientBasicCredentials(username, password));
+ completer.complete(true);
+ });
+ return completer.future;
+ };
+
+ Future makeRequest(Uri url) {
+ Completer completer = new Completer();
+ HttpClientConnection conn = client.getUrl(url);
+ conn.onResponse = (HttpClientResponse response) {
+ Expect.equals(HttpStatus.OK, response.statusCode);
+ completer.complete(null);
+ };
+ return completer.future;
+ }
+
+ List<Future> makeRequests() {
+ var futures = [];
+ for (int i = 0; i < 5; i++) {
+ futures.add(
+ makeRequest(
+ new Uri.fromString("http://127.0.0.1:${server.port}/test$i")));
+ futures.add(
+ makeRequest(
+ new Uri.fromString(
+ "http://127.0.0.1:${server.port}/test$i/xxx")));
+ }
+ return futures;
+ }
+
+ Futures.wait(makeRequests()).then((_) {
+ makeRequest(
+ new Uri.fromString(
+ "http://127.0.0.1:${server.port}/passwdchg")).then((_) {
+ passwordChanged = true;
+ Futures.wait(makeRequests()).then((_) {
+ server.shutdown();
+ client.shutdown();
+ });
+ });
+ });
+}
+
+void testLocalServerBasic() {
+ HttpClient client = new HttpClient();
+
+ client.authenticate = (Uri url, String scheme, String realm) {
+ client.addCredentials(
+ new Uri.fromString("http://127.0.0.1/basic"),
+ "test",
+ new HttpClientBasicCredentials("test", "test"));
+ return new Future.immediate(true);
+ };
+
+ HttpClientConnection conn =
+ client.getUrl(new Uri.fromString("http://127.0.0.1/basic/test"));
+ conn.onResponse = (HttpClientResponse response) {
+ Expect.equals(HttpStatus.OK, response.statusCode);
+ response.inputStream.onData = () => response.inputStream.read();
+ response.inputStream.onClosed = () {
+ client.shutdown();
+ };
+ };
+}
+
+void testLocalServerDigest() {
+ HttpClient client = new HttpClient();
+
+ client.authenticate = (Uri url, String scheme, String realm) {
+ print("url: $url, scheme: $scheme, realm: $realm");
+ client.addCredentials(
+ new Uri.fromString("http://127.0.0.1/digest"),
+ "test",
+ new HttpClientDigestCredentials("test", "test"));
+ return new Future.immediate(true);
+ };
+
+ HttpClientConnection conn =
+ client.getUrl(new Uri.fromString("http://127.0.0.1/digest/test"));
+ conn.onResponse = (HttpClientResponse response) {
+ Expect.equals(HttpStatus.OK, response.statusCode);
+ response.inputStream.onData = () => response.inputStream.read();
+ response.inputStream.onClosed = () {
+ client.shutdown();
+ };
+ };
+}
+
+main() {
+ testUrlUserInfo();
+ testBasicNoCredentials();
+ testBasicCredentials();
+ testBasicAuthenticateCallback();
+ // These teste are not normally run. They can be used for locally
+ // testing with another web server (e.g. Apache).
+ //testLocalServerBasic();
+ //testLocalServerDigest();
+}
diff --git a/tests/standalone/io/http_client_test.dart b/tests/standalone/io/http_client_test.dart
index 55ec617..6c3c549 100644
--- a/tests/standalone/io/http_client_test.dart
+++ b/tests/standalone/io/http_client_test.dart
@@ -63,8 +63,6 @@
HttpClient client = new HttpClient();
Expect.throws(
() => client.getUrl(new Uri.fromString('ftp://www.google.com')));
- Expect.throws(
- () => client.getUrl(new Uri.fromString('http://usr:pwd@www.google.com')));
}
void testBadHostName() {
diff --git a/tests/standalone/io/http_content_length_test.dart b/tests/standalone/io/http_content_length_test.dart
index 2f03c8b..917b014 100644
--- a/tests/standalone/io/http_content_length_test.dart
+++ b/tests/standalone/io/http_content_length_test.dart
@@ -6,11 +6,13 @@
#import("dart:isolate");
#import("dart:io");
-void testNoBody(int totalConnections) {
+void testNoBody(int totalConnections, bool explicitContentLength) {
HttpServer server = new HttpServer();
server.onError = (e) => Expect.fail("Unexpected error $e");
server.listen("127.0.0.1", 0, backlog: totalConnections);
server.defaultRequestHandler = (HttpRequest request, HttpResponse response) {
+ Expect.isNull(request.headers.value('content-length'));
+ Expect.equals(0, request.contentLength);
response.contentLength = 0;
OutputStream stream = response.outputStream;
Expect.throws(() => stream.writeString("x"), (e) => e is HttpException);
@@ -25,11 +27,16 @@
conn.onError = (e) => Expect.fail("Unexpected error $e");
conn.onRequest = (HttpClientRequest request) {
OutputStream stream = request.outputStream;
- Expect.throws(() => stream.writeString("x"), (e) => e is HttpException);
+ if (explicitContentLength) {
+ request.contentLength = 0;
+ Expect.throws(() => stream.writeString("x"), (e) => e is HttpException);
+ }
stream.close();
Expect.throws(() => stream.writeString("x"), (e) => e is HttpException);
};
conn.onResponse = (HttpClientResponse response) {
+ Expect.equals("0", response.headers.value('content-length'));
+ Expect.equals(0, response.contentLength);
count++;
if (count == totalConnections) {
client.shutdown();
@@ -44,6 +51,8 @@
server.onError = (e) => Expect.fail("Unexpected error $e");
server.listen("127.0.0.1", 0, backlog: totalConnections);
server.defaultRequestHandler = (HttpRequest request, HttpResponse response) {
+ Expect.equals("2", request.headers.value('content-length'));
+ Expect.equals(2, request.contentLength);
response.contentLength = 2;
OutputStream stream = response.outputStream;
stream.writeString("x");
@@ -70,6 +79,8 @@
Expect.throws(() => stream.writeString("x"), (e) => e is HttpException);
};
conn.onResponse = (HttpClientResponse response) {
+ Expect.equals("2", response.headers.value('content-length'));
+ Expect.equals(2, response.contentLength);
count++;
if (count == totalConnections) {
client.shutdown();
@@ -84,10 +95,12 @@
server.onError = (e) => Expect.fail("Unexpected error $e");
server.listen("127.0.0.1", 0, backlog: 5);
server.defaultRequestHandler = (HttpRequest request, HttpResponse response) {
+ Expect.isNull(request.headers.value('content-length'));
+ Expect.equals(0, request.contentLength);
+ response.contentLength = 0;
OutputStream stream = response.outputStream;
Expect.equals("1.0", request.protocolVersion);
Expect.throws(() => stream.writeString("x"), (e) => e is HttpException);
- response.contentLength = 0;
stream.close();
};
@@ -104,7 +117,8 @@
}
void main() {
- testNoBody(5);
+ testNoBody(5, false);
+ testNoBody(5, true);
testBody(5);
testHttp10();
}
diff --git a/tests/standalone/io/http_date_test.dart b/tests/standalone/io/http_date_test.dart
index 1c7df41..81ed109 100644
--- a/tests/standalone/io/http_date_test.dart
+++ b/tests/standalone/io/http_date_test.dart
@@ -4,15 +4,15 @@
#import("dart:math");
-#source("../../../runtime/bin/input_stream.dart");
-#source("../../../runtime/bin/output_stream.dart");
-#source("../../../runtime/bin/chunked_stream.dart");
-#source("../../../runtime/bin/string_stream.dart");
-#source("../../../runtime/bin/stream_util.dart");
-#source("../../../runtime/bin/http.dart");
-#source("../../../runtime/bin/http_impl.dart");
-#source("../../../runtime/bin/http_parser.dart");
-#source("../../../runtime/bin/http_utils.dart");
+#source("../../../lib/io/input_stream.dart");
+#source("../../../lib/io/output_stream.dart");
+#source("../../../lib/io/chunked_stream.dart");
+#source("../../../lib/io/string_stream.dart");
+#source("../../../lib/io/stream_util.dart");
+#source("../../../lib/io/http.dart");
+#source("../../../lib/io/http_impl.dart");
+#source("../../../lib/io/http_parser.dart");
+#source("../../../lib/io/http_utils.dart");
void testParseHttpDate() {
Date date;
diff --git a/tests/standalone/io/http_headers_test.dart b/tests/standalone/io/http_headers_test.dart
index fe1c11f..feb579a 100644
--- a/tests/standalone/io/http_headers_test.dart
+++ b/tests/standalone/io/http_headers_test.dart
@@ -4,15 +4,15 @@
#import('dart:math');
-#source("../../../runtime/bin/input_stream.dart");
-#source("../../../runtime/bin/output_stream.dart");
-#source("../../../runtime/bin/chunked_stream.dart");
-#source("../../../runtime/bin/string_stream.dart");
-#source("../../../runtime/bin/stream_util.dart");
-#source("../../../runtime/bin/http.dart");
-#source("../../../runtime/bin/http_impl.dart");
-#source("../../../runtime/bin/http_parser.dart");
-#source("../../../runtime/bin/http_utils.dart");
+#source("../../../lib/io/input_stream.dart");
+#source("../../../lib/io/output_stream.dart");
+#source("../../../lib/io/chunked_stream.dart");
+#source("../../../lib/io/string_stream.dart");
+#source("../../../lib/io/stream_util.dart");
+#source("../../../lib/io/http.dart");
+#source("../../../lib/io/http_impl.dart");
+#source("../../../lib/io/http_parser.dart");
+#source("../../../lib/io/http_utils.dart");
void testMultiValue() {
_HttpHeaders headers = new _HttpHeaders();
diff --git a/tests/standalone/io/http_parser_test.dart b/tests/standalone/io/http_parser_test.dart
index 456ffc2..1c6538d 100644
--- a/tests/standalone/io/http_parser_test.dart
+++ b/tests/standalone/io/http_parser_test.dart
@@ -5,7 +5,7 @@
#import('dart:math');
#import('dart:scalarlist');
-#source("../../../runtime/bin/http_parser.dart");
+#source("../../../lib/io/http_parser.dart");
class HttpParserTest {
static void runAllTests() {
@@ -18,7 +18,7 @@
static void _testParseRequest(String request,
String expectedMethod,
String expectedUri,
- {int expectedContentLength: -1,
+ {int expectedContentLength: 0,
int expectedBytesReceived: 0,
Map expectedHeaders: null,
bool chunked: false,
diff --git a/tests/standalone/io/mime_multipart_parser_test.dart b/tests/standalone/io/mime_multipart_parser_test.dart
index d349a4f..b46e5d1 100644
--- a/tests/standalone/io/mime_multipart_parser_test.dart
+++ b/tests/standalone/io/mime_multipart_parser_test.dart
@@ -4,8 +4,8 @@
#import('dart:math');
-#source("../../../runtime/bin/http_parser.dart");
-#source("../../../runtime/bin/mime_multipart_parser.dart");
+#source("../../../lib/io/http_parser.dart");
+#source("../../../lib/io/mime_multipart_parser.dart");
void testParse(String message,
String boundary,
diff --git a/tests/standalone/io/process_broken_pipe_test.dart b/tests/standalone/io/process_broken_pipe_test.dart
index e56ab14..611f850 100644
--- a/tests/standalone/io/process_broken_pipe_test.dart
+++ b/tests/standalone/io/process_broken_pipe_test.dart
@@ -15,11 +15,14 @@
// Ignore error on stdin.
process.stdin.onError = (e) => null;
+ // Drain stdout and stderr.
+ process.stdout.onData = () => process.stdout.read();
+ process.stderr.onData = () => process.stderr.read();
+
// Write to the stdin after the process is terminated to test
// writing to a broken pipe.
process.onExit = (code) {
Expect.isFalse(process.stdin.write([0]));
- process.close();
};
});
}
diff --git a/tests/standalone/io/process_check_arguments_test.dart b/tests/standalone/io/process_check_arguments_test.dart
index cc0f5e7..1e97c8d 100644
--- a/tests/standalone/io/process_check_arguments_test.dart
+++ b/tests/standalone/io/process_check_arguments_test.dart
@@ -10,8 +10,10 @@
future.then((process) {
process.onExit = (exitCode) {
Expect.equals(0, exitCode);
- process.close();
};
+ // Drain stdout and stderr.
+ process.stdout.onData = process.stdout.read;
+ process.stderr.onData = process.stderr.read;
});
}
diff --git a/tests/standalone/io/process_exit_negative_test.dart b/tests/standalone/io/process_exit_negative_test.dart
index 0e5e445..caf5cfb 100644
--- a/tests/standalone/io/process_exit_negative_test.dart
+++ b/tests/standalone/io/process_exit_negative_test.dart
@@ -13,6 +13,8 @@
const ["0", "0", "0", "0"]);
p.onExit = (int s) {
print(a.toString()); // Should cause a compilation error here.
- p.close();
};
+ // Drain stdout and stderr.
+ p.stdout.onData = p.stdout.read;
+ p.stderr.onData = p.stderr.read;
}
diff --git a/tests/standalone/io/process_exit_test.dart b/tests/standalone/io/process_exit_test.dart
index 84e5865..a745bfe 100644
--- a/tests/standalone/io/process_exit_test.dart
+++ b/tests/standalone/io/process_exit_test.dart
@@ -14,8 +14,9 @@
future.then((process) {
process.onExit = (int exitCode) {
Expect.equals(exitCode, 99);
- process.close();
};
+ process.stdout.onData = process.stdout.read;
+ process.stderr.onData = process.stderr.read;
});
}
diff --git a/tests/standalone/io/process_path_environment_test.dart b/tests/standalone/io/process_path_environment_test.dart
new file mode 100644
index 0000000..0a29708
--- /dev/null
+++ b/tests/standalone/io/process_path_environment_test.dart
@@ -0,0 +1,27 @@
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+//
+// Test that the executable is looked up on the user's PATH when spawning a
+// process and environment variables are passed in.
+
+#import('dart:io');
+
+main() {
+ // Pick an app that we expect to be on the PATH that returns 0 when run with
+ // no arguments.
+ var executable = 'true';
+ var args = [];
+ if (Platform.operatingSystem == 'windows') {
+ executable = 'cmd.exe';
+ args = ['/C', 'echo', '"ok"'];
+ }
+
+ var options = new ProcessOptions();
+ options.environment = new Map.from(Platform.environment);
+ options.environment['whatever'] = 'something';
+
+ Process.run(executable, args, options).then((result) {
+ Expect.equals(0, result.exitCode);
+ });
+}
diff --git a/tests/standalone/io/process_path_test.dart b/tests/standalone/io/process_path_test.dart
new file mode 100644
index 0000000..03debe3
--- /dev/null
+++ b/tests/standalone/io/process_path_test.dart
@@ -0,0 +1,24 @@
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+//
+// Test that the executable is looked up on the user's PATH when spawning a
+// process.
+
+#import('dart:io');
+
+main() {
+ // Pick an app that we expect to be on the PATH that returns 0 when run with
+ // no arguments.
+ var executable = 'true';
+ var args = [];
+ if (Platform.operatingSystem == 'windows') {
+ executable = 'cmd.exe';
+ args = ['/C', 'echo', '"ok"'];
+ }
+
+ var options = new ProcessOptions();
+ Process.run(executable, args).then((result) {
+ Expect.equals(0, result.exitCode);
+ });
+}
diff --git a/tests/standalone/io/process_segfault_test.dart b/tests/standalone/io/process_segfault_test.dart
index 541a4f6..e535a69 100644
--- a/tests/standalone/io/process_segfault_test.dart
+++ b/tests/standalone/io/process_segfault_test.dart
@@ -14,8 +14,9 @@
future.then((process) {
process.onExit = (int exitCode) {
Expect.isTrue(exitCode != 0);
- process.close();
};
+ process.stdout.onData = process.stdout.read;
+ process.stderr.onData = process.stderr.read;
});
}
diff --git a/tests/standalone/io/process_stderr_test.dart b/tests/standalone/io/process_stderr_test.dart
index 8cd987f..ccf3187 100644
--- a/tests/standalone/io/process_stderr_test.dart
+++ b/tests/standalone/io/process_stderr_test.dart
@@ -23,14 +23,13 @@
List<int> data = "ABCDEFGHI\n".charCodes;
final int dataSize = data.length;
- InputStream input = process.stderr;
- OutputStream output = process.stdin;
+ InputStream err = process.stderr;
int received = 0;
List<int> buffer = [];
void readData() {
- buffer.addAll(input.read());
+ buffer.addAll(err.read());
for (int i = received;
i < min(data.length, buffer.length) - 1;
i++) {
@@ -43,17 +42,14 @@
Expect.equals(13, buffer[dataSize - 1]);
Expect.equals(10, buffer[dataSize]);
buffer.removeLast();
- process.close();
- } else if (received === dataSize) {
- process.close();
}
}
}
- output.write(data);
- output.close();
- input.onData = readData;
-
+ process.stdout.onData = process.stdout.read;
+ process.stdin.write(data);
+ process.stdin.close();
+ err.onData = readData;
});
}
diff --git a/tests/standalone/io/process_stdout_test.dart b/tests/standalone/io/process_stdout_test.dart
index ecebe73..048deb3 100644
--- a/tests/standalone/io/process_stdout_test.dart
+++ b/tests/standalone/io/process_stdout_test.dart
@@ -23,14 +23,13 @@
List<int> data = "ABCDEFGHI\n".charCodes;
final int dataSize = data.length;
- InputStream input = process.stdout;
- OutputStream output = process.stdin;
+ InputStream out = process.stdout;
int received = 0;
List<int> buffer = [];
void readData() {
- buffer.addAll(input.read());
+ buffer.addAll(out.read());
for (int i = received;
i < min(data.length, buffer.length) - 1;
i++) {
@@ -43,16 +42,14 @@
Expect.equals(13, buffer[dataSize - 1]);
Expect.equals(10, buffer[dataSize]);
buffer.removeLast();
- process.close();
- } else if (received === dataSize) {
- process.close();
}
}
}
- output.write(data);
- output.close();
- input.onData = readData;
+ process.stdin.write(data);
+ process.stdin.close();
+ out.onData = readData;
+ process.stderr.onData = process.stderr.read;
});
}
diff --git a/tests/standalone/io/process_working_directory_test.dart b/tests/standalone/io/process_working_directory_test.dart
index 1255518..6040b53 100644
--- a/tests/standalone/io/process_working_directory_test.dart
+++ b/tests/standalone/io/process_working_directory_test.dart
@@ -27,9 +27,10 @@
processFuture.then((process) {
process.onExit = (int exitCode) {
Expect.equals(exitCode, 99);
- process.close();
directory.deleteSync();
};
+ process.stdout.onData = process.stdout.read;
+ process.stderr.onData = process.stderr.read;
});
processFuture.handleException((error) {
directory.deleteSync();
@@ -48,7 +49,6 @@
options);
future.then((process) {
Expect.fail("bad process completed");
- process.close();
directory.deleteSync();
});
diff --git a/tests/standalone/io/socket_exception_test.dart b/tests/standalone/io/socket_exception_test.dart
index 67f4ef4..46d6c13 100644
--- a/tests/standalone/io/socket_exception_test.dart
+++ b/tests/standalone/io/socket_exception_test.dart
@@ -128,7 +128,7 @@
try {
List<int> buffer = new List<int>(10);
client.readList(buffer, -1, 1);
- } on IndexOutOfRangeException catch (ex) {
+ } on RangeError catch (ex) {
exceptionCaught = true;
} on Exception catch (ex) {
wrongExceptionCaught = true;
@@ -140,7 +140,7 @@
try {
List<int> buffer = new List<int>(10);
client.readList(buffer, 0, -1);
- } on IndexOutOfRangeException catch (ex) {
+ } on RangeError catch (ex) {
exceptionCaught = true;
} on Exception catch (ex) {
wrongExceptionCaught = true;
@@ -152,7 +152,7 @@
try {
List<int> buffer = new List<int>(10);
client.writeList(buffer, -1, 1);
- } on IndexOutOfRangeException catch (ex) {
+ } on RangeError catch (ex) {
exceptionCaught = true;
} on Exception catch (ex) {
wrongExceptionCaught = true;
@@ -164,7 +164,7 @@
try {
List<int> buffer = new List<int>(10);
client.writeList(buffer, 0, -1);
- } on IndexOutOfRangeException catch (ex) {
+ } on RangeError catch (ex) {
exceptionCaught = true;
} on Exception catch (ex) {
wrongExceptionCaught = true;
diff --git a/tests/standalone/io/stream_pipe_test.dart b/tests/standalone/io/stream_pipe_test.dart
index 42f86de..4683794 100644
--- a/tests/standalone/io/stream_pipe_test.dart
+++ b/tests/standalone/io/stream_pipe_test.dart
@@ -78,11 +78,11 @@
String srcFileName =
getDataFilename("tests/standalone/io/readline_test1.dat");
- SocketOutputStream socketOutput = _socket.outputStream;
+ OutputStream socketOutput = _socket.outputStream;
InputStream fileInput = new File(srcFileName).openInputStream();
fileInput.onClosed = () {
- SocketInputStream socketInput = _socket.inputStream;
+ InputStream socketInput = _socket.inputStream;
var tempDir = new Directory('').createTempSync();
var dstFileName = tempDir.path.concat("/readline_test1.dat");
var dstFile = new File(dstFileName);
diff --git a/tests/standalone/io/string_stream_test.dart b/tests/standalone/io/string_stream_test.dart
index ade6c8d..e9bb7af 100644
--- a/tests/standalone/io/string_stream_test.dart
+++ b/tests/standalone/io/string_stream_test.dart
@@ -3,6 +3,7 @@
// BSD-style license that can be found in the LICENSE file.
#import("dart:io");
+#import("dart:isolate");
void testUtf8() {
List<int> data = [0x01,
@@ -278,7 +279,7 @@
List<int> read([int len]) => null;
int readInto(List<int> buffer, [int offset, int len]) => 0;
int available() => 0;
- void pipe(OutputStream output, [bool close]){ }
+ void pipe(OutputStream output, {bool close: true}){ }
void close() { }
bool get closed => true;
void set onData(void callback()) { }
@@ -298,6 +299,23 @@
Expect.equals(1, errors);
}
+testEncodingErrorWithHandler() {
+ var port = new ReceivePort();
+ var errors = 0;
+ var expected = [206, 187, 120, 46, 32, 120, 10];
+ ListInputStream input = new ListInputStream();
+ input.write(expected);
+ var stringStream = new StringInputStream(input, Encoding.ASCII);
+ stringStream.onData = () {
+ Expect.fail("We should not get any data");
+ };
+ stringStream.onError = (e) {
+ port.close();
+ Expect.isTrue(e is Exception);
+ };
+}
+
+
main() {
testUtf8();
testLatin1();
@@ -307,4 +325,5 @@
testReadChunks();
testReadMixed();
testErrorHandler();
+ testEncodingErrorWithHandler();
}
diff --git a/tests/standalone/io/url_encoding_test.dart b/tests/standalone/io/url_encoding_test.dart
index 4cf2eaa..7148c77 100644
--- a/tests/standalone/io/url_encoding_test.dart
+++ b/tests/standalone/io/url_encoding_test.dart
@@ -3,15 +3,15 @@
// BSD-style license that can be found in the LICENSE file.
#import("dart:utf");
-#source("../../../runtime/bin/input_stream.dart");
-#source("../../../runtime/bin/output_stream.dart");
-#source("../../../runtime/bin/chunked_stream.dart");
-#source("../../../runtime/bin/string_stream.dart");
-#source("../../../runtime/bin/stream_util.dart");
-#source("../../../runtime/bin/http.dart");
-#source("../../../runtime/bin/http_impl.dart");
-#source("../../../runtime/bin/http_parser.dart");
-#source("../../../runtime/bin/http_utils.dart");
+#source("../../../lib/io/input_stream.dart");
+#source("../../../lib/io/output_stream.dart");
+#source("../../../lib/io/chunked_stream.dart");
+#source("../../../lib/io/string_stream.dart");
+#source("../../../lib/io/stream_util.dart");
+#source("../../../lib/io/http.dart");
+#source("../../../lib/io/http_impl.dart");
+#source("../../../lib/io/http_parser.dart");
+#source("../../../lib/io/http_utils.dart");
void testParseEncodedString() {
String encodedString = 'foo+bar%20foobar%25%26';
diff --git a/tests/standalone/io/web_socket_protocol_processor_test.dart b/tests/standalone/io/web_socket_protocol_processor_test.dart
index 609f7a8..568a705 100644
--- a/tests/standalone/io/web_socket_protocol_processor_test.dart
+++ b/tests/standalone/io/web_socket_protocol_processor_test.dart
@@ -4,8 +4,8 @@
#import("dart:math");
-#source("../../../runtime/bin/websocket.dart");
-#source("../../../runtime/bin/websocket_impl.dart");
+#source("../../../lib/io/websocket.dart");
+#source("../../../lib/io/websocket_impl.dart");
class WebSocketFrame {
WebSocketFrame(int opcode, List<int> data);
diff --git a/tests/standalone/standalone.status b/tests/standalone/standalone.status
index cb5fd3e..265fae8 100644
--- a/tests/standalone/standalone.status
+++ b/tests/standalone/standalone.status
@@ -6,21 +6,6 @@
package/invalid_uri_test: Fail, OK # Fails intentionally
-[ $runtime == vm ]
-# The following tests require files in the tools-directory to be modified.
-# However the tools directory uses its own version of dart-binary. We reenable
-# these tests when we update the dart-binary.
-status_expression_test: Fail, OK
-io/status_file_parser_test: Fail, OK
-io/test_runner_exit_code_test: Fail, OK
-io/test_runner_test: Fail, OK
-
-[ $compiler == dart2js || ($compiler == none && $runtime == drt) ]
-# The following tests require files in the tools-directory to be modified.
-# However the tools directory uses its own version of dart-binary. We reenable
-# these tests when we update the dart-binary.
-status_expression_test: Fail, OK
-
[ $runtime == vm && $checked ]
# These tests have type errors on purpose.
io/process_invalid_arguments_test: Fail, OK
@@ -64,6 +49,7 @@
*: Skip
[ $compiler == dart2js ]
+typed_array_test: Skip # This is a VM test
float_array_test: Skip # This is a VM test
int_array_test: Skip # This is a VM test
medium_integer_test: Fail, OK # cannot resolve type Mint
diff --git a/tests/standalone/typed_array_test.dart b/tests/standalone/typed_array_test.dart
new file mode 100644
index 0000000..993b232
--- /dev/null
+++ b/tests/standalone/typed_array_test.dart
@@ -0,0 +1,342 @@
+// 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.
+//
+// Dart test program for testing native float arrays.
+
+// Library tag to be able to run in html test framework.
+#library('TypedArray');
+#import('dart:isolate');
+#import('dart:scalarlist');
+
+void main() {
+ int8_receiver();
+ uint8_receiver();
+ int16_receiver();
+ uint16_receiver();
+ int32_receiver();
+ uint32_receiver();
+ int64_receiver();
+ uint64_receiver();
+ float32_receiver();
+ float64_receiver();
+}
+
+// Int8 array.
+Int8List initInt8() {
+ var int8 = new Int8List(2);
+ int8[0] = 10;
+ int8[1] = 100;
+ return int8;
+}
+Int8List int8 = initInt8();
+
+void int8_receiver() {
+ var sp = spawnFunction(int8_sender);
+ sp.call(int8.length).then((a) {
+ Expect.equals(int8.length, a.length);
+ for (int i = 0; i < a.length; i++) {
+ Expect.equals(int8[i], a[i]);
+ }
+ print("int8_receiver");
+ });
+}
+
+int8_sender() {
+ port.receive((len, r) {
+ Expect.equals(int8.length, len);
+ var a = new Int8List(len);
+ for (int i = 0; i < len; i++) {
+ a[i] = int8[i];
+ }
+ r.send(a);
+ });
+}
+
+
+// Uint8 array.
+Uint8List initUint8() {
+ var uint8 = new Uint8List(2);
+ uint8[0] = 0xff;
+ uint8[1] = 0x7f;
+ return uint8;
+}
+Uint8List uint8 = initUint8();
+
+void uint8_receiver() {
+ var sp = spawnFunction(uint8_sender);
+ sp.call(uint8.length).then((a) {
+ Expect.equals(uint8.length, a.length);
+ for (int i = 0; i < a.length; i++) {
+ Expect.equals(uint8[i], a[i]);
+ }
+ print("uint8_receiver");
+ });
+}
+
+uint8_sender() {
+ port.receive((len, r) {
+ Expect.equals(uint8.length, len);
+ var a = new Uint8List(len);
+ for (int i = 0; i < len; i++) {
+ a[i] = uint8[i];
+ }
+ r.send(a);
+ });
+}
+
+
+// Int16 array.
+Int16List initInt16() {
+ var int16 = new Int16List(2);
+ int16[0] = 1000;
+ int16[1] = 10000;
+ return int16;
+}
+Int16List int16 = initInt16();
+
+void int16_receiver() {
+ var sp = spawnFunction(int16_sender);
+ sp.call(int16.length).then((a) {
+ Expect.equals(int16.length, a.length);
+ for (int i = 0; i < a.length; i++) {
+ Expect.equals(int16[i], a[i]);
+ }
+ print("int16_receiver");
+ });
+}
+
+int16_sender() {
+ port.receive((len, r) {
+ Expect.equals(int16.length, len);
+ var a = new Int16List(len);
+ for (int i = 0; i < len; i++) {
+ a[i] = int16[i];
+ }
+ r.send(a);
+ });
+}
+
+
+// Uint16 array.
+Uint16List initUint16() {
+ var uint16 = new Uint16List(2);
+ uint16[0] = 0xffff;
+ uint16[1] = 0x7fff;
+ return uint16;
+}
+Uint16List uint16 = initUint16();
+
+void uint16_receiver() {
+ var sp = spawnFunction(uint16_sender);
+ sp.call(uint16.length).then((a) {
+ Expect.equals(uint16.length, a.length);
+ for (int i = 0; i < a.length; i++) {
+ Expect.equals(uint16[i], a[i]);
+ }
+ print("uint16_receiver");
+ });
+}
+
+uint16_sender() {
+ port.receive((len, r) {
+ Expect.equals(uint16.length, len);
+ var a = new Uint16List(len);
+ for (int i = 0; i < len; i++) {
+ a[i] = uint16[i];
+ }
+ r.send(a);
+ });
+}
+
+
+// Int32 array.
+Int32List initInt32() {
+ var int32 = new Int32List(2);
+ int32[0] = 100000;
+ int32[1] = 1000000;
+ return int32;
+}
+Int32List int32 = initInt32();
+
+void int32_receiver() {
+ var sp = spawnFunction(int32_sender);
+ sp.call(int32.length).then((a) {
+ Expect.equals(int32.length, a.length);
+ for (int i = 0; i < a.length; i++) {
+ Expect.equals(int32[i], a[i]);
+ }
+ print("int32_receiver");
+ });
+}
+
+int32_sender() {
+ port.receive((len, r) {
+ Expect.equals(int32.length, len);
+ var a = new Int32List(len);
+ for (int i = 0; i < len; i++) {
+ a[i] = int32[i];
+ }
+ r.send(a);
+ });
+}
+
+
+// Uint32 array.
+Uint32List initUint32() {
+ var uint32 = new Uint32List(2);
+ uint32[0] = 0xffffffff;
+ uint32[1] = 0x7fffffff;
+ return uint32;
+}
+Uint32List uint32 = initUint32();
+
+void uint32_receiver() {
+ var sp = spawnFunction(uint32_sender);
+ sp.call(uint32.length).then((a) {
+ Expect.equals(uint32.length, a.length);
+ for (int i = 0; i < a.length; i++) {
+ Expect.equals(uint32[i], a[i]);
+ }
+ print("uint32_receiver");
+ });
+}
+
+uint32_sender() {
+ port.receive((len, r) {
+ Expect.equals(uint32.length, len);
+ var a = new Uint32List(len);
+ for (int i = 0; i < len; i++) {
+ a[i] = uint32[i];
+ }
+ r.send(a);
+ });
+}
+
+
+// Int64 array.
+Int64List initInt64() {
+ var int64 = new Int64List(2);
+ int64[0] = 10000000;
+ int64[1] = 100000000;
+ return int64;
+}
+Int64List int64 = initInt64();
+
+void int64_receiver() {
+ var sp = spawnFunction(int64_sender);
+ sp.call(int64.length).then((a) {
+ Expect.equals(int64.length, a.length);
+ for (int i = 0; i < a.length; i++) {
+ Expect.equals(int64[i], a[i]);
+ }
+ print("int64_receiver");
+ });
+}
+
+int64_sender() {
+ port.receive((len, r) {
+ Expect.equals(int64.length, len);
+ var a = new Int64List(len);
+ for (int i = 0; i < len; i++) {
+ a[i] = int64[i];
+ }
+ r.send(a);
+ });
+}
+
+
+// Uint64 array.
+Uint64List initUint64() {
+ var uint64 = new Uint64List(2);
+ uint64[0] = 0xffffffffffffffff;
+ uint64[1] = 0x7fffffffffffffff;
+ return uint64;
+}
+Uint64List uint64 = initUint64();
+
+void uint64_receiver() {
+ var sp = spawnFunction(uint64_sender);
+ sp.call(uint64.length).then((a) {
+ Expect.equals(uint64.length, a.length);
+ for (int i = 0; i < a.length; i++) {
+ Expect.equals(uint64[i], a[i]);
+ }
+ print("uint64_receiver");
+ });
+}
+
+uint64_sender() {
+ port.receive((len, r) {
+ Expect.equals(uint64.length, len);
+ var a = new Uint64List(len);
+ for (int i = 0; i < len; i++) {
+ a[i] = uint64[i];
+ }
+ r.send(a);
+ });
+}
+
+
+// Float32 Array.
+Float32List initFloat32() {
+ var float32 = new Float32List(2);
+ float32[0] = 1.0;
+ float32[1] = 2.0;
+ return float32;
+}
+Float32List float32 = new Float32List(2);
+
+void float32_receiver() {
+ var sp = spawnFunction(float32_sender);
+ sp.call(float32.length).then((a) {
+ Expect.equals(float32.length, a.length);
+ for (int i = 0; i < a.length; i++) {
+ Expect.equals(float32[i], a[i]);
+ }
+ print("float32_receiver");
+ });
+}
+
+float32_sender() {
+ port.receive((len, r) {
+ Expect.equals(float32.length, len);
+ var a = new Float32List(len);
+ for (int i = 0; i < len; i++) {
+ a[i] = float32[i];
+ }
+ r.send(a);
+ });
+}
+
+
+// Float64 Array.
+Float64List initFloat64() {
+ var float64 = new Float64List(2);
+ float64[0] = 101.234;
+ float64[1] = 201.765;
+ return float64;
+}
+Float64List float64 = initFloat64();
+
+void float64_receiver() {
+ var sp = spawnFunction(float64_sender);
+ sp.call(float64.length).then((a) {
+ Expect.equals(float64.length, a.length);
+ for (int i = 0; i < a.length; i++) {
+ Expect.equals(float64[i], a[i]);
+ }
+ print("float64_receiver");
+ });
+}
+
+float64_sender() {
+ port.receive((len, r) {
+ Expect.equals(float64.length, len);
+ var a = new Float64List(len);
+ for (int i = 0; i < len; i++) {
+ a[i] = float64[i];
+ }
+ r.send(a);
+ });
+}
diff --git a/tests/utils/dummy_compiler_test.dart b/tests/utils/dummy_compiler_test.dart
index dab13b5..7389be8 100644
--- a/tests/utils/dummy_compiler_test.dart
+++ b/tests/utils/dummy_compiler_test.dart
@@ -33,6 +33,8 @@
eqNullB(a) {}""";
} else if (uri.path.endsWith('_patch.dart')) {
source = '';
+ } else if (uri.path.endsWith('js_helper.dart')) {
+ source = 'library jshelper; class JSInvocationMirror {}';
} else {
source = "#library('lib');";
}
diff --git a/tests/utils/recursive_import_test.dart b/tests/utils/recursive_import_test.dart
index 2702f67..fdf5fb4 100644
--- a/tests/utils/recursive_import_test.dart
+++ b/tests/utils/recursive_import_test.dart
@@ -25,6 +25,7 @@
setRuntimeTypeInfo(o, i) {}
eqNull(a) {}
eqNullB(a) {}
+class JSInvocationMirror {} // Should be in helper.
""";
const String RECURSIVE_MAIN = """
diff --git a/tests/utils/utils.status b/tests/utils/utils.status
index 0ccca1e..d06160b 100644
--- a/tests/utils/utils.status
+++ b/tests/utils/utils.status
@@ -8,6 +8,7 @@
[ $compiler == dart2js ]
dummy_compiler_test: Slow, Pass
recursive_import_test: Slow, Pass
+utf8_test: Fail # issue 6418
[ $compiler == none && $runtime == drt ]
dummy_compiler_test: Fail # http://dartbug.com/2264
@@ -16,6 +17,9 @@
[ $compiler == dart2js && $browser ]
*: Skip
+[ $runtime == dartium || $runtime == drt ]
+utf8_test: Fail # TRIAGE
+
[ $runtime == vm ]
*_layout_test: Skip
diff --git a/tools/VERSION b/tools/VERSION
index b629afa..34007a7 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -1,4 +1,4 @@
MAJOR 0
MINOR 2
-BUILD 1
-PATCH 2
+BUILD 2
+PATCH 0
diff --git a/tools/bots/android.py b/tools/bots/android.py
index 5ccc4e9..b320ce0 100644
--- a/tools/bots/android.py
+++ b/tools/bots/android.py
@@ -1,8 +1,8 @@
#!/usr/bin/python
-# Copyright (c) 2012 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
+# 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.
"""
Android buildbot steps.
diff --git a/tools/bots/bot.py b/tools/bots/bot.py
index 5bde985..a57877e 100644
--- a/tools/bots/bot.py
+++ b/tools/bots/bot.py
@@ -1,8 +1,8 @@
#!/usr/bin/python
-# Copyright (c) 2012 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
+# 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.
"""
Shared code for use in the buildbot scripts.
diff --git a/tools/bots/compiler.py b/tools/bots/compiler.py
index 35f0d795..c752f8d 100644
--- a/tools/bots/compiler.py
+++ b/tools/bots/compiler.py
@@ -1,8 +1,8 @@
#!/usr/bin/python
-# Copyright (c) 2011 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
+# 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.
"""
Dart2js buildbot steps
@@ -294,5 +294,19 @@
CleanUpTemporaryFiles(build_info.system, build_info.runtime)
+def BuildCompiler(build_info):
+ """
+ Builds the SDK.
+
+ - build_info: the buildInfo object, containing information about what sort of
+ build and test to be run.
+ """
+ with bot.BuildStep('Build SDK and d8'):
+ args = [sys.executable, './tools/build.py', '--mode=' + build_info.mode,
+ 'dart2js_bot']
+ print 'Build SDK and d8: %s' % (' '.join(args))
+ bot.RunProcess(args)
+
+
if __name__ == '__main__':
- bot.RunBot(GetBuildInfo, RunCompilerTests)
+ bot.RunBot(GetBuildInfo, RunCompilerTests, build_step=BuildCompiler)
diff --git a/tools/bots/pub.py b/tools/bots/pub.py
index 41d6745..9d40778 100755
--- a/tools/bots/pub.py
+++ b/tools/bots/pub.py
@@ -1,8 +1,8 @@
#!/usr/bin/python
-# Copyright (c) 2012 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
+# 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.
"""
Pub buildbot steps.
diff --git a/tools/create_sdk.py b/tools/create_sdk.py
index 841c99b..857ba0e 100755
--- a/tools/create_sdk.py
+++ b/tools/create_sdk.py
@@ -23,6 +23,7 @@
# ......dart_debugger_api.h
# ....lib/
# ......_internal/
+# ......collection/
# ......core/
# ......coreimpl/
# ......crypto/
@@ -148,9 +149,6 @@
def Main(argv):
# Pull in all of the gpyi files which will be munged into the sdk.
- io_runtime_sources = \
- (eval(open("runtime/bin/io_sources.gypi").read()))['sources']
-
HOME = dirname(dirname(realpath(__file__)))
SDK = argv[1]
@@ -221,37 +219,13 @@
os.makedirs(LIB)
#
- # Create and populate lib/io.
- #
- io_dest_dir = join(LIB, 'io')
- os.makedirs(io_dest_dir)
- os.makedirs(join(io_dest_dir, 'runtime'))
- for filename in io_runtime_sources:
- assert filename.endswith('.dart')
- if filename == 'io.dart':
- copyfile(join(HOME, 'runtime', 'bin', filename),
- join(io_dest_dir, 'io_runtime.dart'))
- else:
- copyfile(join(HOME, 'runtime', 'bin', filename),
- join(io_dest_dir, 'runtime', filename))
-
- # Construct lib/io/io_runtime.dart from whole cloth.
- dest_file = open(join(io_dest_dir, 'io_runtime.dart'), 'a')
- for filename in io_runtime_sources:
- assert filename.endswith('.dart')
- if filename == 'io.dart':
- continue
- dest_file.write('#source("runtime/' + filename + '");\n')
- dest_file.close()
-
- #
# Create and populate lib/{core, crypto, isolate, json, uri, utf, ...}.
#
os.makedirs(join(LIB, 'html'))
- for library in ['_internal', 'core', 'coreimpl', 'crypto', 'isolate',
- join('html', 'dart2js'), join('html', 'dartium'), 'json',
- 'math', 'mirrors', 'scalarlist', 'uri', 'utf']:
+ for library in ['_internal', 'collection', 'core', 'coreimpl', 'crypto', 'io',
+ 'isolate', join('html', 'dart2js'), join('html', 'dartium'),
+ 'json', 'math', 'mirrors', 'scalarlist', 'uri', 'utf']:
copytree(join(HOME, 'lib', library), join(LIB, library),
ignore=ignore_patterns('*.svn', 'doc', '*.py', '*.gypi', '*.sh'))
@@ -278,10 +252,6 @@
[join(LIB, '_internal', 'libraries.dart')],
[('"compiler/', '"../pkg/compiler/')])
- ReplaceInFiles(
- [join(PKG, 'compiler', 'implementation', 'lib', 'io.dart')],
- [('../../runtime/bin', '../../lib/io/runtime')])
-
# Fixup dartdoc
# TODO(dgrove): Remove this once issue 4788 is addressed.
ReplaceInFiles([
diff --git a/tools/ddbg.dart b/tools/ddbg.dart
index eaf0258..e51516f 100644
--- a/tools/ddbg.dart
+++ b/tools/ddbg.dart
@@ -62,7 +62,7 @@
}
-Future sendCmd(Map<String, Dynamic> cmd) {
+Future sendCmd(Map<String, dynamic> cmd) {
var completer = new Completer();
int id = cmd["id"];
outstandingCommands[id] = completer;
@@ -529,12 +529,12 @@
void main() {
outstandingCommands = new Map<int, Completer>();
vmSock = new Socket("127.0.0.1", 5858);
- vmStream = new SocketOutputStream(vmSock);
+ vmStream = vmSock.outputStream;
var stdinStream = new StringInputStream(stdin);
stdinStream.onLine = () {
processCommand(stdinStream.readLine());
};
- var vmInStream = new SocketInputStream(vmSock);
+ var vmInStream = vmSock.inputStream;
vmInStream.onData = () {
String s = decodeUtf8(vmInStream.read());
processVmData(s);
diff --git a/tools/gyp/configurations_msvs.gypi b/tools/gyp/configurations_msvs.gypi
index 023cec1..4a21b2f 100644
--- a/tools/gyp/configurations_msvs.gypi
+++ b/tools/gyp/configurations_msvs.gypi
@@ -17,6 +17,7 @@
'ExceptionHandling': '0',
'RuntimeTypeInfo': 'false',
'OmitFramePointers': 'false',
+ 'RuntimeLibrary': '1', # /MTd - Multi-threaded, static (debug)
},
'VCLinkerTool': {
'LinkIncremental': '2',
@@ -37,6 +38,7 @@
'RuntimeTypeInfo': 'false',
'OmitFramePointers': 'false',
'StringPooling': 'true',
+ 'RuntimeLibrary': '0', # /MT - Multi-threaded, static
},
'VCLinkerTool': {
'LinkIncremental': '1',
diff --git a/tools/revert.py b/tools/revert.py
old mode 100644
new mode 100755
diff --git a/tools/test-runtime.dart b/tools/test-runtime.dart
index ec1a450..b9663ff 100755
--- a/tools/test-runtime.dart
+++ b/tools/test-runtime.dart
@@ -68,7 +68,7 @@
var configurationIterator = configurations.iterator();
void enqueueConfiguration(ProcessQueue queue) {
- if (!configurationIterator.hasNext()) return;
+ if (!configurationIterator.hasNext) return;
var conf = configurationIterator.next();
if (selectors.containsKey('co19')) {
@@ -92,7 +92,13 @@
// Start global http server that serves the entire dart repo.
// The http server is available on localhost:9876 for any
// test that needs to load resources from the repo over http.
- startHttpServer('127.0.0.1', 9876);
+ if (!listTests) {
+ // Only start the server if we are running browser tests.
+ var runningBrowserTests = configurations.some((config) {
+ return TestUtils.isBrowserRuntime(config['runtime']);
+ });
+ if (runningBrowserTests) startHttpServer('127.0.0.1', 9876);
+ }
// Start process queue.
new ProcessQueue(
diff --git a/tools/test.dart b/tools/test.dart
index 439aaad..2e4990d 100755
--- a/tools/test.dart
+++ b/tools/test.dart
@@ -99,10 +99,10 @@
var configurationIterator = configurations.iterator();
void enqueueConfiguration(ProcessQueue queue) {
- if (!configurationIterator.hasNext()) return;
+ if (!configurationIterator.hasNext) return;
var conf = configurationIterator.next();
- for (String key in selectors.getKeys()) {
+ for (String key in selectors.keys) {
if (key == 'co19') {
queue.addTestSuite(new Co19TestSuite(conf));
} else if (conf['runtime'] == 'vm' && key == 'vm') {
@@ -127,7 +127,13 @@
// Start global http server that serves the entire dart repo.
// The http server is available on localhost:9876 for any
// test that needs to load resources from the repo over http.
- if (!listTests) startHttpServer('127.0.0.1', 9876);
+ if (!listTests) {
+ // Only start the server if we are running browser tests.
+ var runningBrowserTests = configurations.some((config) {
+ return TestUtils.isBrowserRuntime(config['runtime']);
+ });
+ if (runningBrowserTests) startHttpServer('127.0.0.1', 9876);
+ }
// Start process queue.
new ProcessQueue(maxProcesses,
@@ -135,9 +141,7 @@
startTime,
printTiming,
enqueueConfiguration,
- () {
- if (!listTests) terminateHttpServer();
- },
+ () => terminateHttpServer(),
verbose,
listTests);
}
diff --git a/tools/testing/dart/browser_test.dart b/tools/testing/dart/browser_test.dart
index 21a4e82..fc0d05b 100644
--- a/tools/testing/dart/browser_test.dart
+++ b/tools/testing/dart/browser_test.dart
@@ -3,10 +3,10 @@
// BSD-style license that can be found in the LICENSE file.
String getHtmlContents(String title,
- String controllerScript,
- String dartJsScript,
+ Path controllerScript,
+ Path dartJsScript,
String scriptType,
- String sourceScript) =>
+ Path sourceScript) =>
"""
<!DOCTYPE html>
<html>
diff --git a/tools/testing/dart/co19_test.dart b/tools/testing/dart/co19_test.dart
index dba9eb6..0adda23 100644
--- a/tools/testing/dart/co19_test.dart
+++ b/tools/testing/dart/co19_test.dart
@@ -50,7 +50,7 @@
arguments.add('co19');
configurations.addAll(optionsParser.parse(arguments));
}
- if (configurations == null || configurations.isEmpty()) return;
+ if (configurations == null || configurations.isEmpty) return;
var firstConfiguration = configurations[0];
Map<String, RegExp> selectors = firstConfiguration['selectors'];
@@ -60,9 +60,9 @@
var configurationIterator = configurations.iterator();
void enqueueConfiguration(ProcessQueue queue) {
- if (!configurationIterator.hasNext()) return;
+ if (!configurationIterator.hasNext) return;
var configuration = configurationIterator.next();
- for (String selector in selectors.getKeys()) {
+ for (String selector in selectors.keys) {
if (selector == 'co19') {
queue.addTestSuite(new Co19TestSuite(configuration));
} else {
diff --git a/tools/testing/dart/http_server.dart b/tools/testing/dart/http_server.dart
index b939e2c..ad542d7 100644
--- a/tools/testing/dart/http_server.dart
+++ b/tools/testing/dart/http_server.dart
@@ -46,5 +46,5 @@
}
terminateHttpServer() {
- _httpServer.close();
+ if (_httpServer != null) _httpServer.close();
}
diff --git a/tools/testing/dart/multitest.dart b/tools/testing/dart/multitest.dart
index 93a9f0a..34551db 100644
--- a/tools/testing/dart/multitest.dart
+++ b/tools/testing/dart/multitest.dart
@@ -72,7 +72,7 @@
? '\n'
: '\r\n';
List<String> lines = contents.split(line_separator);
- if (lines.last() == '') lines.removeLast();
+ if (lines.last == '') lines.removeLast();
contents = null;
Set<String> validMultitestOutcomes = new Set<String>.from(
['compile-time error', 'runtime error',
@@ -108,13 +108,13 @@
}
} else {
testTemplate.add(line);
- for (var test in testsAsLines.getValues()) test.add(line);
+ for (var test in testsAsLines.values) test.add(line);
}
}
// Check that every key (other than the none case) has at least one outcome
- for (var outcomeKey in outcomes.getKeys()) {
- if (outcomeKey != 'none' && outcomes[outcomeKey].isEmpty()) {
+ for (var outcomeKey in outcomes.keys) {
+ if (outcomeKey != 'none' && outcomes[outcomeKey].isEmpty) {
Expect.fail("Test ${outcomeKey} has no valid annotated outcomes.\n"
"Expected one of: ${validMultitestOutcomes.toString()}");
}
@@ -125,7 +125,7 @@
outcomes['none'] = new Set<String>();
// Copy all the tests into the output map tests, as multiline strings.
- for (String key in testsAsLines.getKeys()) {
+ for (String key in testsAsLines.keys) {
tests[key] =
Strings.join(testsAsLines[key], line_separator).concat(line_separator);
}
@@ -161,7 +161,7 @@
// except dart:, dart-ext: or /, at the beginning of a line.
RegExp relativeImportRegExp = const RegExp(
'^#(import|source)[(]["\'](?!(dart:|dart-ext:|/))([^"\']*)["\']');
- while (!toSearch.isEmpty()) {
+ while (!toSearch.isEmpty) {
var thisPass = toSearch;
toSearch = new HashSet<Path>();
for (Path filename in thisPass) {
@@ -219,14 +219,14 @@
// Wait until all imports are copied before scheduling test cases.
Futures.wait(futureCopies).then((ignored) {
String baseFilename = filePath.filenameWithoutExtension;
- for (String key in tests.getKeys()) {
+ for (String key in tests.keys) {
final Path multitestFilename =
targetDir.append('${baseFilename}_$key.dart');
final File file = new File.fromPath(multitestFilename);
file.createSync();
RandomAccessFile openedFile = file.openSync(FileMode.WRITE);
- var bytes = tests[key].charCodes();
+ var bytes = tests[key].charCodes;
openedFile.writeListSync(bytes, 0, bytes.length);
openedFile.closeSync();
Set<String> outcome = outcomes[key];
@@ -256,12 +256,12 @@
generatedTestDir.createSync();
}
var split = suiteDir.segments();
- if (split.last() == 'src') {
+ if (split.last == 'src') {
// TODO(sigmund): remove this once all tests are migrated to use
// TestSuite.forDirectory.
split.removeLast();
}
- String path = '${generatedTestDir.path}/${split.last()}';
+ String path = '${generatedTestDir.path}/${split.last}';
Directory dir = new Directory(path);
if (!dir.existsSync()) {
dir.createSync();
diff --git a/tools/testing/dart/status_expression.dart b/tools/testing/dart/status_expression.dart
index fcc11cb..e49dc6c 100644
--- a/tools/testing/dart/status_expression.dart
+++ b/tools/testing/dart/status_expression.dart
@@ -182,7 +182,7 @@
bool hasMore() => current != null;
void advance() {
- current = tokenIterator.hasNext() ? tokenIterator.next() : null;
+ current = tokenIterator.hasNext ? tokenIterator.next() : null;
}
}
diff --git a/tools/testing/dart/status_file_parser.dart b/tools/testing/dart/status_file_parser.dart
index ef0f819..c3b70d8 100644
--- a/tools/testing/dart/status_file_parser.dart
+++ b/tools/testing/dart/status_file_parser.dart
@@ -77,7 +77,7 @@
Match match = StripComment.firstMatch(line);
line = (match == null) ? "" : match[0];
line = line.trim();
- if (line.isEmpty()) continue;
+ if (line.isEmpty) continue;
match = HeaderPattern.firstMatch(line);
if (match != null) {
@@ -177,7 +177,7 @@
// If no expectations were found the expectation is that the test
// passes.
- if (result.isEmpty()) {
+ if (result.isEmpty) {
result.add(PASS);
}
return result;
diff --git a/tools/testing/dart/test_options.dart b/tools/testing/dart/test_options.dart
index eae9f12..97301ea 100644
--- a/tools/testing/dart/test_options.dart
+++ b/tools/testing/dart/test_options.dart
@@ -353,7 +353,7 @@
}
// Parse the value for the option.
if (spec.type == 'bool') {
- if (!value.isEmpty()) {
+ if (!value.isEmpty) {
print('No value expected for bool option $name');
exit(1);
}
@@ -367,7 +367,7 @@
}
} else {
assert(spec.type == 'string');
- if (!spec.values.isEmpty()) {
+ if (!spec.values.isEmpty) {
for (var v in value.split(',')) {
if (spec.values.lastIndexOf(v) == -1) {
print('Unknown value ($v) for option $name');
@@ -388,7 +388,7 @@
List<Map> expandedConfigs = _expandConfigurations(configuration);
List<Map> result = expandedConfigs.filter(_isValidConfig);
- return result.isEmpty() ? null : result;
+ return result.isEmpty ? null : result;
}
/**
@@ -624,11 +624,11 @@
var buffer = new StringBuffer();;
buffer.add(name);
if (option.type == 'bool') {
- assert(option.values.isEmpty());
+ assert(option.values.isEmpty);
} else {
buffer.add(name.startsWith('--') ? '=' : ' ');
if (option.type == 'int') {
- assert(option.values.isEmpty());
+ assert(option.values.isEmpty);
buffer.add('n (default: ${option.defaultValue})');
} else {
buffer.add('[');
diff --git a/tools/testing/dart/test_progress.dart b/tools/testing/dart/test_progress.dart
index bcd027b..44c94c8 100644
--- a/tools/testing/dart/test_progress.dart
+++ b/tools/testing/dart/test_progress.dart
@@ -143,21 +143,21 @@
}
}
}
- if (!test.output.diagnostics.isEmpty()) {
+ if (!test.output.diagnostics.isEmpty) {
String prefix = 'diagnostics:';
for (var s in test.output.diagnostics) {
output.add('$prefix ${s}');
prefix = ' ';
}
}
- if (!test.output.stdout.isEmpty()) {
+ if (!test.output.stdout.isEmpty) {
output.add('');
output.add('stdout:');
for (var s in test.output.stdout) {
output.add(s);
}
}
- if (!test.output.stderr.isEmpty()) {
+ if (!test.output.stderr.isEmpty) {
output.add('');
output.add('stderr:');
for (var s in test.output.stderr) {
@@ -166,7 +166,7 @@
}
for (Command c in test.commands) {
output.add('');
- String message = (c == test.commands.last()
+ String message = (c == test.commands.last
? "Command line" : "Compilation command");
output.add('$message: ${c.commandLine}');
}
@@ -228,7 +228,7 @@
: super(startTime, printTiming);
void allDone() {
- stdout.write('\n'.charCodes());
+ stdout.write('\n'.charCodes);
_printFailureSummary();
_printTimingInformation();
if (_failedTests > 0) {
@@ -245,7 +245,7 @@
if (!_allTestsKnown && SummaryReport.total > 0) {
// Clear progress indicator before printing summary report.
stdout.write(
- '\r \r'.charCodes());
+ '\r \r'.charCodes);
SummaryReport.printReport();
}
_allTestsKnown = true;
@@ -271,7 +271,7 @@
var progressLine =
'\r[${_timeString(d)} | $progressPadded% | '
'+$passedPadded | -$failedPadded]';
- stdout.write(progressLine.charCodes());
+ stdout.write(progressLine.charCodes);
}
}
@@ -287,10 +287,10 @@
addColorWrapped(List<int> codes, String string, int color) {
codes.add(27);
- codes.addAll('[${color}m'.charCodes());
- codes.addAll(string.charCodes());
+ codes.addAll('[${color}m'.charCodes);
+ codes.addAll(string.charCodes);
codes.add(27);
- codes.addAll('[0m'.charCodes());
+ codes.addAll('[0m'.charCodes);
}
void _printProgress() {
@@ -300,12 +300,12 @@
var failedPadded = _pad(_failedTests.toString(), 5);
Duration d = (new Date.now()).difference(_startTime);
var progressLine = [];
- progressLine.addAll('\r[${_timeString(d)} | $progressPadded% | '.charCodes());
+ progressLine.addAll('\r[${_timeString(d)} | $progressPadded% | '.charCodes);
addColorWrapped(progressLine, '+$passedPadded ', GREEN);
- progressLine.addAll('| '.charCodes());
+ progressLine.addAll('| '.charCodes);
var failedColor = (_failedTests != 0) ? RED : NONE;
addColorWrapped(progressLine, '-$failedPadded', failedColor);
- progressLine.addAll(']'.charCodes());
+ progressLine.addAll(']'.charCodes);
stdout.write(progressLine);
}
@@ -385,7 +385,7 @@
}
void _printFailureSummary() {
- if (!_failureSummary.isEmpty()) {
+ if (!_failureSummary.isEmpty) {
print('@@@STEP_FAILURE@@@');
print('@@@BUILD_STEP $stepName failures@@@');
}
diff --git a/tools/testing/dart/test_runner.dart b/tools/testing/dart/test_runner.dart
index 930a561..c270a10 100644
--- a/tools/testing/dart/test_runner.dart
+++ b/tools/testing/dart/test_runner.dart
@@ -104,7 +104,7 @@
// The new command will be:
// PREFIX EXECUTABLE SUFFIX ARGUMENTS
var specialCommand = configuration['special-command'];
- if (!specialCommand.isEmpty()) {
+ if (!specialCommand.isEmpty) {
Expect.isTrue(specialCommand.contains('@'),
"special-command must contain a '@' char");
var specialCommandSplit = specialCommand.split('@');
@@ -121,7 +121,7 @@
newExecutablePath = prefixSplit[0];
for (int i = 1; i < prefixSplit.length; i++) {
var current = prefixSplit[i];
- if (!current.isEmpty()) newArguments.add(current);
+ if (!current.isEmpty) newArguments.add(current);
}
newArguments.add(c.executable);
}
@@ -129,7 +129,7 @@
// Add any suffixes to the arguments of the original executable.
var suffixSplit = suffix.split(' ');
suffixSplit.forEach((e) {
- if (!e.isEmpty()) newArguments.add(e);
+ if (!e.isEmpty) newArguments.add(e);
});
newArguments.addAll(c.arguments);
@@ -162,7 +162,7 @@
}
List<String> get batchRunnerArguments => ['-batch'];
- List<String> get batchTestArguments => commands.last().arguments;
+ List<String> get batchTestArguments => commands.last.arguments;
bool get usesWebDriver => TestUtils.usesWebDriver(configuration['runtime']);
@@ -189,7 +189,7 @@
numRetries = 2; // Allow two retries to compensate for flaky browser tests.
}
- List<String> get _lastArguments => commands.last().arguments;
+ List<String> get _lastArguments => commands.last.arguments;
List<String> get batchRunnerArguments => [_lastArguments[0], '--batch'];
@@ -436,7 +436,7 @@
} else if (outcome.contains('static type warning')
&& staticWarnings.length > 0) {
return true;
- } else if (outcome.isEmpty()
+ } else if (outcome.isEmpty
&& (errors.length > 0 || staticWarnings.length > 0)) {
return true;
}
@@ -609,7 +609,6 @@
* the actual test and its output is analyzed in [testComplete].
*/
void stepExitHandler(int exitCode) {
- process.close();
process = null;
int totalSteps = testCase.commands.length;
String suffix =' (step $currentStep of $totalSteps)';
@@ -740,7 +739,7 @@
bool _isWebDriver;
BatchRunnerProcess(TestCase testCase) {
- _executable = testCase.commands.last().executable;
+ _executable = testCase.commands.last.executable;
_batchArguments = testCase.batchRunnerArguments;
_isWebDriver = testCase.usesWebDriver;
}
@@ -752,17 +751,16 @@
_currentTest = testCase;
if (_process === null) {
// Start process if not yet started.
- _executable = testCase.commands.last().executable;
+ _executable = testCase.commands.last.executable;
_startProcess(() {
doStartTest(testCase);
});
- } else if (testCase.commands.last().executable != _executable) {
+ } else if (testCase.commands.last.executable != _executable) {
// Restart this runner with the right executable for this test
// if needed.
- _executable = testCase.commands.last().executable;
+ _executable = testCase.commands.last.executable;
_batchArguments = testCase.batchRunnerArguments;
_process.onExit = (exitCode) {
- _process.close();
_startProcess(() {
doStartTest(testCase);
});
@@ -778,7 +776,6 @@
Completer completer = new Completer();
Timer killTimer;
_process.onExit = (exitCode) {
- _process.close();
if (killTimer != null) killTimer.cancel();
completer.complete(true);
};
@@ -786,7 +783,7 @@
// Use a graceful shutdown so our Selenium script can close
// the open browser processes. On Windows, signals do not exist
// and a kill is a hard kill.
- _process.stdin.write('--terminate\n'.charCodes());
+ _process.stdin.write('--terminate\n'.charCodes);
// In case the run_selenium process didn't close, kill it after 30s
int shutdownMillisecs = 30000;
@@ -817,7 +814,7 @@
print(' Error: $err');
throw err;
};
- _process.stdin.write(line.charCodes());
+ _process.stdin.write(line.charCodes);
}
String _createArgumentsLine(List<String> arguments) {
@@ -926,10 +923,8 @@
}
_stderrDrained = true;
_stdoutDrained = true;
- _process.close();
_startProcess(_reportResult);
} else { // No active test case running.
- _process.close();
_process = null;
}
}
@@ -1071,7 +1066,7 @@
// If there is still no work, we are done.
if (_activeTestListers == 0) {
_progress.allTestsKnown();
- if (_tests.isEmpty() && _numProcesses == 0) {
+ if (_tests.isEmpty && _numProcesses == 0) {
_terminateBatchRunners().then((_) => _cleanupAndMarkDone());
}
}
@@ -1111,6 +1106,8 @@
Future processFuture = Process.start(cmd, arg);
processFuture.then((Process p) {
+ // Drain stderr to not leak resources.
+ p.stderr.onData = p.stderr.read;
final StringInputStream stdoutStringStream =
new StringInputStream(p.stdout);
stdoutStringStream.onLine = () {
@@ -1214,7 +1211,7 @@
Future _terminateBatchRunners() {
var futures = new List();
- for (var runners in _batchProcesses.getValues()) {
+ for (var runners in _batchProcesses.values) {
for (var runner in runners) {
futures.add(runner.terminate());
}
@@ -1242,13 +1239,13 @@
void _tryRunTest() {
_checkDone();
- if (_numProcesses < _maxProcesses && !_tests.isEmpty()) {
+ if (_numProcesses < _maxProcesses && !_tests.isEmpty) {
TestCase test = _tests.removeFirst();
if (_listTests) {
var fields = [test.displayName,
Strings.join(new List.from(test.expectedOutcomes), ','),
test.isNegative.toString()];
- fields.addAll(test.commands.last().arguments);
+ fields.addAll(test.commands.last.arguments);
print(Strings.join(fields, '\t'));
return;
}
diff --git a/tools/testing/dart/test_suite.dart b/tools/testing/dart/test_suite.dart
index dc01e69..dd639df 100644
--- a/tools/testing/dart/test_suite.dart
+++ b/tools/testing/dart/test_suite.dart
@@ -67,6 +67,8 @@
port.receive((String runnerPath, SendPort replyTo) {
Future processFuture = Process.start(runnerPath, ["--list"]);
processFuture.then((p) {
+ // Drain stderr to not leak resources.
+ p.stderr.onData = p.stderr.read;
StringInputStream stdoutStream = new StringInputStream(p.stdout);
var streamDone = false;
var processExited = false;
@@ -127,7 +129,7 @@
String this.suiteName,
String runnerName,
List<String> this.statusFilePaths,
- [this.testPrefix = ''])
+ {this.testPrefix: ''})
: dartDir = TestUtils.dartDir().toNativePath() {
runnerPath = '${TestUtils.buildDir(configuration)}/$runnerName';
}
@@ -399,7 +401,7 @@
int shards = configuration['shards'];
if (shards > 1) {
int shard = configuration['shard'];
- if (testName.hashCode() % shards != shard - 1) {
+ if (testName.hashCode % shards != shard - 1) {
return;
}
}
@@ -452,7 +454,7 @@
info.optionsFromFile);
List<List<String>> vmOptionsList = getVmOptions(info.optionsFromFile);
- Expect.isFalse(vmOptionsList.isEmpty(), "empty vmOptionsList");
+ Expect.isFalse(vmOptionsList.isEmpty, "empty vmOptionsList");
for (var vmOptions in vmOptionsList) {
doTest(new TestCase('$suiteName/$testName',
@@ -489,7 +491,7 @@
var additionalFlags =
configuration['additional-compiler-flags'].split(' ');
for (final flag in additionalFlags) {
- if (flag.isEmpty()) continue;
+ if (flag.isEmpty) continue;
compilerArguments.add(flag);
}
compilerArguments.add('--output-type=dart');
@@ -785,7 +787,7 @@
Path relative = testPath.relativeTo(TestUtils.dartDir());
relative = relative.directoryPath.append(relative.filenameWithoutExtension);
String testUniqueName = relative.toString().replaceAll('/', '_');
- if (!optionsName.isEmpty()) {
+ if (!optionsName.isEmpty) {
testUniqueName = '$testUniqueName-$optionsName';
}
@@ -1006,7 +1008,7 @@
for (var match in matches) {
result.add(match[1].split(' ').filter((e) => e != ''));
}
- if (result.isEmpty()) result.add([]);
+ if (result.isEmpty) result.add([]);
matches = dartOptionsRegExp.allMatches(contents);
for (var match in matches) {
diff --git a/utils/apidoc/apidoc.dart b/utils/apidoc/apidoc.dart
index 8e016f3..931a5fe 100644
--- a/utils/apidoc/apidoc.dart
+++ b/utils/apidoc/apidoc.dart
@@ -380,7 +380,7 @@
/** Override definition from parent class to strip out annotation tags. */
doc.DocComment createDocComment(String text,
- [InterfaceMirror inheritedFrom]) {
+ [ClassMirror inheritedFrom]) {
String strippedText =
text.replaceAll(const RegExp("@([a-zA-Z]+) ([^;]+)(?:;|\$)"),
'').trim();
@@ -551,7 +551,7 @@
* different library than [member].
*/
String _linkMember(MemberMirror member) {
- final typeName = member.surroundingDeclaration.simpleName;
+ final typeName = member.owner.simpleName;
var memberName = '$typeName.${member.simpleName}';
if (member is MethodMirror && (member.isConstructor || member.isFactory)) {
final separator = member.constructorName == '' ? '' : '.';
@@ -570,7 +570,7 @@
String get text => mdnComment;
- InterfaceMirror get inheritedFrom => null;
+ ClassMirror get inheritedFrom => null;
String get html {
// Wrap the mdn comment so we can highlight it and so we handle MDN scraped
diff --git a/utils/apidoc/html_diff.dart b/utils/apidoc/html_diff.dart
index c9428bb..2de79b7 100644
--- a/utils/apidoc/html_diff.dart
+++ b/utils/apidoc/html_diff.dart
@@ -101,14 +101,14 @@
warn('Could not find $HTML_LIBRARY_NAME');
return;
}
- for (InterfaceMirror htmlType in htmlLib.types.values) {
+ for (ClassMirror htmlType in htmlLib.classes.values) {
final domTypes = htmlToDomTypes(htmlType);
if (domTypes.isEmpty) continue;
htmlTypesToDom.putIfAbsent(htmlType.qualifiedName,
() => new Set()).addAll(domTypes);
- htmlType.declaredMembers.forEach(
+ htmlType.members.forEach(
(_, m) => _addMemberDiff(m, domTypes));
}
}
@@ -123,7 +123,7 @@
var domMembers = htmlToDomMembers(htmlMember, domTypes);
if (htmlMember == null && !domMembers.isEmpty) {
warn('$HTML_LIBRARY_NAME member '
- '${htmlMember.surroundingDeclaration.simpleName}.'
+ '${htmlMember.owner.simpleName}.'
'${htmlMember.simpleName} has no corresponding '
'$HTML_LIBRARY_NAME member.');
}
@@ -139,7 +139,7 @@
* [htmlType] from `dart:html`. This can be the empty list if no
* correspondence is found.
*/
- List<String> htmlToDomTypes(InterfaceMirror htmlType) {
+ List<String> htmlToDomTypes(ClassMirror htmlType) {
if (htmlType.simpleName == null) return [];
final tags = _getTags(comments.find(htmlType.location));
if (tags.containsKey('domName')) {
diff --git a/utils/compiler/build_helper.dart b/utils/compiler/build_helper.dart
index 0b4d29e..971bb58 100644
--- a/utils/compiler/build_helper.dart
+++ b/utils/compiler/build_helper.dart
@@ -142,7 +142,9 @@
if %SCRIPTPATH:~-1%==\ set SCRIPTPATH=%SCRIPTPATH:~0,-1%
set arguments=%*
+set SNAPSHOTNAME=%SCRIPTPATH%dart2js.snapshot
+if exist %SNAPSHOTNAME% set SNAPSHOT=--use_script_snapshot=%SNAPSHOTNAME%
-"%SCRIPTPATH%\dart.exe"$options "%SCRIPTPATH%$pathWin" %arguments%
+"%SCRIPTPATH%\dart.exe"$options %SNAPSHOT% "%SCRIPTPATH%$pathWin" %arguments%
'''.replaceAll('\n', '\r\n')];
}
diff --git a/utils/compiler/compiler.gyp b/utils/compiler/compiler.gyp
index fc83a3c..abb576d 100644
--- a/utils/compiler/compiler.gyp
+++ b/utils/compiler/compiler.gyp
@@ -12,7 +12,6 @@
'type': 'none',
'dependencies': [
'../../runtime/dart-runtime.gyp:dart',
- '../../third_party/v8/src/d8.gyp:d8',
],
'actions': [
{
diff --git a/utils/pub/io.dart b/utils/pub/io.dart
index c2f1456..8b632e3 100644
--- a/utils/pub/io.dart
+++ b/utils/pub/io.dart
@@ -471,15 +471,17 @@
return completer.future;
}
-/**
- * Spawns and runs the process located at [executable], passing in [args].
- * Returns a [Future] that will complete the results of the process after it
- * has ended.
- *
- * If [pipeStdout] and/or [pipeStderr] are set, all output from the subprocess's
- * output streams are sent to the parent process's output streams. Output from
- * piped streams won't be available in the result object.
- */
+/// Spawns and runs the process located at [executable], passing in [args].
+/// Returns a [Future] that will complete the results of the process after it
+/// has ended.
+///
+/// The spawned process will inherit its parent's environment variables. If
+/// [environment] is provided, that will be used to augment (not replace) the
+/// the inherited variables.
+///
+/// If [pipeStdout] and/or [pipeStderr] are set, all output from the
+/// subprocess's output streams are sent to the parent process's output streams.
+/// Output from piped streams won't be available in the result object.
Future<PubProcessResult> runProcess(String executable, List<String> args,
{workingDir, Map<String, String> environment, bool pipeStdout: false,
bool pipeStderr: false}) {
@@ -499,7 +501,11 @@
if (workingDir != null) {
options.workingDirectory = _getDirectory(workingDir).path;
}
- options.environment = environment;
+
+ if (environment != null) {
+ options.environment = new Map.from(Platform.environment);
+ environment.forEach((key, value) => options.environment[key] = value);
+ }
var future = Process.run(executable, args, options);
return future.transform((result) {
@@ -556,8 +562,11 @@
}
/// Run a git process with [args] from [workingDir].
-Future<PubProcessResult> runGit(List<String> args, {String workingDir}) =>
- _gitCommand.chain((git) => runProcess(git, args, workingDir: workingDir));
+Future<PubProcessResult> runGit(List<String> args,
+ {String workingDir, Map<String, String> environment}) {
+ return _gitCommand.chain((git) => runProcess(git, args,
+ workingDir: workingDir, environment: environment));
+}
/// Returns the name of the git command-line app, or null if Git could not be
/// found on the user's PATH.
diff --git a/utils/testrunner/layout_test_controller.dart b/utils/testrunner/layout_test_controller.dart
index d8864a3..8dedf11 100644
--- a/utils/testrunner/layout_test_controller.dart
+++ b/utils/testrunner/layout_test_controller.dart
@@ -129,6 +129,8 @@
var stdout = new List();
start = new Date.now();
Process.start(drt, [url]).then((process) {
+ // Drain stderr to not leak resources.
+ process.stderr.onData = process.stderr.read;
StringInputStream stdoutStringStream =
new StringInputStream(process.stdout);
stdoutStringStream.onLine = () {
@@ -213,6 +215,8 @@
var stdout = new List();
start = new Date.now();
Process.start(drt, ["$url'-p"]).then((process) {
+ // Drain stderr to not leak resources.
+ process.stderr.onData = process.stderr.read;
ListInputStream stdoutStream = process.stdout;
stdoutStream.onData = () {
if (!stdoutStream.closed) {
diff --git a/utils/tests/pub/pubspec_test.dart b/utils/tests/pub/pubspec_test.dart
index ed5522e..d952611 100644
--- a/utils/tests/pub/pubspec_test.dart
+++ b/utils/tests/pub/pubspec_test.dart
@@ -36,9 +36,9 @@
var foo = pubspec.dependencies[0];
expect(foo.name, equals('foo'));
- expect(foo.constraint.allows(new Version(1, 2, 3)));
- expect(foo.constraint.allows(new Version(1, 2, 5)));
- expect(!foo.constraint.allows(new Version(3, 4, 5)));
+ expect(foo.constraint.allows(new Version(1, 2, 3)), isTrue);
+ expect(foo.constraint.allows(new Version(1, 2, 5)), isTrue);
+ expect(foo.constraint.allows(new Version(3, 4, 5)), isFalse);
});
test("throws if the description isn't valid", () {
diff --git a/utils/tests/pub/test_pub.dart b/utils/tests/pub/test_pub.dart
index 8c8dd80..67ac4a7 100644
--- a/utils/tests/pub/test_pub.dart
+++ b/utils/tests/pub/test_pub.dart
@@ -536,9 +536,10 @@
['--enable-type-checks', '--enable-asserts', pubPath, '--trace'];
dartArgs.addAll(args);
- var environment = new Map.from(Platform.environment);
- environment['PUB_CACHE'] = pathInSandbox(cachePath);
- environment['DART_SDK'] = pathInSandbox(sdkPath);
+ var environment = {
+ 'PUB_CACHE': pathInSandbox(cachePath),
+ 'DART_SDK': pathInSandbox(sdkPath)
+ };
return runProcess(dartBin, dartArgs, workingDir: pathInSandbox(appPath),
environment: environment);
@@ -1050,16 +1051,22 @@
return super.create(parentDir).chain((rootDir) {
workingDir = rootDir;
- return writeTextFile(join(parentDir, '.gitconfig'), '''
-[user]
- name = Test Pub
- email = pub@dartlang.org
-''');
- }).chain(runGitStep);
+ return runGitStep(null);
+ });
}
Future<String> _runGit(List<String> args, Directory workingDir) {
- return runGit(args, workingDir: workingDir.path).transform((result) {
+ // Explicitly specify the committer information. Git needs this to commit
+ // and we don't want to rely on the buildbots having this already set up.
+ var environment = {
+ 'GIT_AUTHOR_NAME': 'Pub Test',
+ 'GIT_AUTHOR_EMAIL': 'pub@dartlang.org',
+ 'GIT_COMMITTER_NAME': 'Pub Test',
+ 'GIT_COMMITTER_EMAIL': 'pub@dartlang.org'
+ };
+
+ return runGit(args, workingDir: workingDir.path,
+ environment: environment).transform((result) {
if (!result.success) {
throw "Error running: git ${Strings.join(args, ' ')}\n"
"${Strings.join(result.stderr, '\n')}";
diff --git a/utils/tests/pub/version_solver_test.dart b/utils/tests/pub/version_solver_test.dart
index e077b6b..4777aa41 100644
--- a/utils/tests/pub/version_solver_test.dart
+++ b/utils/tests/pub/version_solver_test.dart
@@ -339,6 +339,20 @@
testResolve(description, packages, {lockfile, result, error}) {
test(description, () {
+ var isNoVersionException = predicate((x)=> x is NoVersionException,
+ "is a NoVersionException");
+ var isDisjointConstraintException =
+ predicate((x)=> x is DisjointConstraintException,
+ " is a DisjointConstraintException");
+ var isSourceMismatchException =
+ predicate((x)=> x is SourceMismatchException,
+ "is a SourceMismatchException");
+ var isDescriptionMismatchException =
+ predicate((x)=> x is DescriptionMismatchException,
+ "is a DescriptionMismatchException");
+ var isCouldNotSolveException = predicate((x)=> x is CouldNotSolveException,
+ "is a CouldNotSolveException");
+
var sources = new SourceRegistry();
source1 = new MockSource('mock1');
source2 = new MockSource('mock2');
@@ -405,17 +419,17 @@
if (actualId != expectedId) return false;
}
return result.isEmpty;
- }, description: 'packages to match $result')));
+ }, 'packages to match $result')));
} else if (error == noVersion) {
- expect(future, throwsA(new isInstanceOf<NoVersionException>()));
+ expect(future, throwsA(isNoVersionException));
} else if (error == disjointConstraint) {
- expect(future, throwsA(new isInstanceOf<DisjointConstraintException>()));
+ expect(future, throwsA(isDisjointConstraintException));
} else if (error == sourceMismatch) {
- expect(future, throwsA(new isInstanceOf<SourceMismatchException>()));
+ expect(future, throwsA(isSourceMismatchException));
} else if (error == descriptionMismatch) {
- expect(future, throwsA(new isInstanceOf<DescriptionMismatchException>()));
+ expect(future, throwsA(isDescriptionMismatchException));
} else if (error == couldNotSolve) {
- expect(future, throwsA(new isInstanceOf<CouldNotSolveException>()));
+ expect(future, throwsA(isCouldNotSolveException));
} else {
expect(future, throwsA(error));
}
diff --git a/utils/tests/pub/version_test.dart b/utils/tests/pub/version_test.dart
index 22c0ffb..314ab5b 100644
--- a/utils/tests/pub/version_test.dart
+++ b/utils/tests/pub/version_test.dart
@@ -81,9 +81,9 @@
});
test('allows()', () {
- expect(v123.allows(v123));
- expect(!v123.allows(v114));
- expect(!v123.allows(v124));
+ expect(v123.allows(v123), isTrue);
+ expect(v123.allows(v114), isFalse);
+ expect(v123.allows(v124), isFalse);
});
test('intersect()', () {
@@ -91,18 +91,19 @@
expect(v123.intersect(v123), equals(v123));
// Intersecting a different version allows no versions.
- expect(v123.intersect(v114).isEmpty);
+ expect(v123.intersect(v114).isEmpty, isTrue);
// Intersecting a range returns the version if the range allows it.
expect(v123.intersect(new VersionRange(min: v114, max: v124)),
equals(v123));
// Intersecting a range allows no versions if the range doesn't allow it.
- expect(v114.intersect(new VersionRange(min: v123, max: v124)).isEmpty);
+ expect(v114.intersect(new VersionRange(min: v123, max: v124)).isEmpty,
+ isTrue);
});
test('isEmpty', () {
- expect(!v123.isEmpty);
+ expect(v123.isEmpty, isFalse);
});
test('parse()', () {
@@ -169,7 +170,7 @@
test('takes includeMin', () {
var range = new VersionRange(min: v123, includeMin: true);
- expect(range.includeMin);
+ expect(range.includeMin, isTrue);
});
test('includeMin defaults to false if omitted', () {
@@ -179,7 +180,7 @@
test('takes includeMax', () {
var range = new VersionRange(max: v123, includeMax: true);
- expect(range.includeMax);
+ expect(range.includeMax, isTrue);
});
test('includeMax defaults to false if omitted', () {
@@ -196,57 +197,57 @@
test('version must be greater than min', () {
var range = new VersionRange(min: v123, max: v234);
- expect(!range.allows(new Version.parse('1.2.2')));
- expect(!range.allows(new Version.parse('1.2.3')));
- expect(range.allows(new Version.parse('1.3.3')));
- expect(range.allows(new Version.parse('2.3.3')));
+ expect(range.allows(new Version.parse('1.2.2')), isFalse);
+ expect(range.allows(new Version.parse('1.2.3')), isFalse);
+ expect(range.allows(new Version.parse('1.3.3')), isTrue);
+ expect(range.allows(new Version.parse('2.3.3')), isTrue);
});
test('version must be min or greater if includeMin', () {
var range = new VersionRange(min: v123, max: v234, includeMin: true);
- expect(!range.allows(new Version.parse('1.2.2')));
- expect(range.allows(new Version.parse('1.2.3')));
- expect(range.allows(new Version.parse('1.3.3')));
- expect(range.allows(new Version.parse('2.3.3')));
+ expect(range.allows(new Version.parse('1.2.2')), isFalse);
+ expect(range.allows(new Version.parse('1.2.3')), isTrue);
+ expect(range.allows(new Version.parse('1.3.3')), isTrue);
+ expect(range.allows(new Version.parse('2.3.3')), isTrue);
});
test('version must be less than max', () {
var range = new VersionRange(min: v123, max: v234);
- expect(range.allows(new Version.parse('2.3.3')));
- expect(!range.allows(new Version.parse('2.3.4')));
- expect(!range.allows(new Version.parse('2.4.3')));
+ expect(range.allows(new Version.parse('2.3.3')), isTrue);
+ expect(range.allows(new Version.parse('2.3.4')), isFalse);
+ expect(range.allows(new Version.parse('2.4.3')), isFalse);
});
test('version must be max or less if includeMax', () {
var range = new VersionRange(min: v123, max: v234, includeMax: true);
- expect(range.allows(new Version.parse('2.3.3')));
- expect(range.allows(new Version.parse('2.3.4')));
- expect(!range.allows(new Version.parse('2.4.3')));
+ expect(range.allows(new Version.parse('2.3.3')), isTrue);
+ expect(range.allows(new Version.parse('2.3.4')), isTrue);
+ expect(range.allows(new Version.parse('2.4.3')), isFalse);
});
test('has no min if one was not set', () {
var range = new VersionRange(max: v123);
- expect(range.allows(new Version.parse('0.0.0')));
- expect(!range.allows(new Version.parse('1.2.3')));
+ expect(range.allows(new Version.parse('0.0.0')), isTrue);
+ expect(range.allows(new Version.parse('1.2.3')), isFalse);
});
test('has no max if one was not set', () {
var range = new VersionRange(min: v123);
- expect(!range.allows(new Version.parse('1.2.3')));
- expect(range.allows(new Version.parse('1.3.3')));
- expect(range.allows(new Version.parse('999.3.3')));
+ expect(range.allows(new Version.parse('1.2.3')), isFalse);
+ expect(range.allows(new Version.parse('1.3.3')), isTrue);
+ expect(range.allows(new Version.parse('999.3.3')), isTrue);
});
test('allows any version if there is no min or max', () {
var range = new VersionRange();
- expect(range.allows(new Version.parse('0.0.0')));
- expect(range.allows(new Version.parse('999.99.9')));
+ expect(range.allows(new Version.parse('0.0.0')), isTrue);
+ expect(range.allows(new Version.parse('999.99.9')), isTrue);
});
});
@@ -264,13 +265,13 @@
test('a non-overlapping range allows no versions', () {
var a = new VersionRange(min: v114, max: v124);
var b = new VersionRange(min: v200, max: v250);
- expect(a.intersect(b).isEmpty);
+ expect(a.intersect(b).isEmpty, isTrue);
});
test('adjacent ranges allow no versions if exclusive', () {
var a = new VersionRange(min: v114, max: v124, includeMax: false);
var b = new VersionRange(min: v124, max: v200, includeMin: true);
- expect(a.intersect(b).isEmpty);
+ expect(a.intersect(b).isEmpty, isTrue);
});
test('adjacent ranges allow version if inclusive', () {
@@ -289,7 +290,8 @@
test('returns the version if the range allows it', () {
expect(new VersionRange(min: v114, max: v124).intersect(v123),
equals(v123));
- expect(new VersionRange(min: v123, max: v124).intersect(v114).isEmpty);
+ expect(new VersionRange(min: v123, max: v124).intersect(v114).isEmpty,
+ isTrue);
});
});
@@ -301,19 +303,19 @@
group('VersionConstraint', () {
test('empty', () {
- expect(new VersionConstraint.empty().isEmpty);
+ expect(new VersionConstraint.empty().isEmpty, isTrue);
});
group('parse()', () {
test('parses an exact version', () {
var constraint = new VersionConstraint.parse('1.2.3-alpha');
- expect(constraint is Version);
+ expect(constraint is Version, isTrue);
expect(constraint, equals(new Version(1, 2, 3, pre: 'alpha')));
});
test('parses "any"', () {
var constraint = new VersionConstraint.parse('any');
- expect(constraint is VersionConstraint);
+ expect(constraint is VersionConstraint, isTrue);
expect(constraint, allows([
new Version.parse('0.0.0'),
new Version.parse('1.2.3'),