Version 1.23.0-dev.3.0
Merge commit ff89087641dc0d5a3d1e1621f869b67b132654a7 into dev
diff --git a/BUILD.gn b/BUILD.gn
index c592d73..38fd398 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -53,7 +53,7 @@
deps = [
":runtime",
- # TODO(rmacnak): Link this into 'dart'
+ # TODO(rmacnak): Link this into 'dart'.
"utils/kernel-service:kernel-service",
]
}
@@ -237,8 +237,20 @@
"runtime/bin:run_vm_tests",
]
+ # Compute path to magenta bootdata.bin
+ if (current_cpu == "arm64") {
+ magenta_bootdata =
+ "//out/build-magenta/build-magenta-qemu-arm64/bootdata.bin"
+ } else if (current_cpu == "x64") {
+ magenta_bootdata =
+ "//out/build-magenta/build-magenta-pc-x86-64/bootdata.bin"
+ } else {
+ assert(false, "unable to determine path to magenta's bootdata.bin")
+ }
+
input = "$target_gen_dir/dart_test_tree.manifest"
inputs = [
+ magenta_bootdata,
input,
]
@@ -256,6 +268,8 @@
"--build-id-map",
rebase_path("$target_gen_dir/build_id_map"),
"--compress",
+ "--pre-binaries",
+ rebase_path(magenta_bootdata),
]
}
}
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c434aa0..dee30bf 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -17,6 +17,25 @@
characters to the console on Windows. Calls to `Stdout.add*()` behave as
before.
+### Tool changes
+
+* Analysis
+
+ * The `dartanalyzer` now follows the same rules as the analysis server to find an analysis options file,
+ stopping when an analysis options file is found:
+ * Search up the directory hierarchy looking for an analysis options file.
+ * If analyzing a project referencing the [Flutter](https://flutter.io/) package, then use the
+ [default Flutter analysis options](https://github.com/flutter/flutter/blob/master/packages/flutter/lib/analysis_options_user.yaml)
+ found in `package:flutter`.
+ * If in a Bazel workspace, then use the analysis options in `package:dart.analysis_options/default.yaml` if it exists.
+ * Use the default analysis options rules.
+ * In addition, specific to `dartanalyzer`:
+ * an analysis options file can be specified on the command line via `--options`
+ and that file will be used instead of searching for an analysis options file.
+ * any analysis option specified on the command line (e.g. `--strong` or `--no-strong`)
+ takes precedence over any corresponding value specified in the analysis options file.
+
+
## 1.22.0 - 2017-02-14
### Language
diff --git a/docs/language/dart.sty b/docs/language/dart.sty
index 125c771..b331d80 100644
--- a/docs/language/dart.sty
+++ b/docs/language/dart.sty
@@ -11,6 +11,7 @@
\def\ABSTRACT{\builtinId{abstract}}
\def\AS{\builtinId{as}}
+\def\COVARIANT{\builtinId{covariant}}
\def\DEFERRED{\builtinId{deferred}}
\def\DYNAMIC{\builtinId{dynamic}}
\def\EXPORT{\builtinId{export}}
diff --git a/docs/language/dartLangSpec.tex b/docs/language/dartLangSpec.tex
index d60e3de..62dba69 100644
--- a/docs/language/dartLangSpec.tex
+++ b/docs/language/dartLangSpec.tex
@@ -394,22 +394,22 @@
\begin{grammar}
{\bf variableDeclaration:}
declaredIdentifier (`,' identifier)*
- .
+ .
{\bf declaredIdentifier:}
metadata finalConstVarOrType identifier
.
{\bf finalConstVarOrType:}\FINAL{} type?;
- \CONST{} type?;
- varOrType
+ \CONST{} type?;
+ varOrType
.
- {\bf varOrType:}\VAR{};
- type
+{\bf varOrType:}\VAR{};
+ type
.
- {\bf initializedVariableDeclaration:}
+{\bf initializedVariableDeclaration:}
declaredIdentifier (`=' expression)? (`,' initializedIdentifier)* % could do top level here
.
@@ -420,11 +420,7 @@
{\bf initializedIdentifierList:}
initializedIdentifier (`,' initializedIdentifier)*
.
-
-
-
-
- \end{grammar}
+\end{grammar}
\LMHash{}
A variable that has not been initialized has the initial value \NULL{} (\ref{null}).
@@ -764,13 +760,17 @@
\end{itemize}
\begin{grammar}
-{\bf normalFormalParameter:}functionSignature;
+{\bf normalFormalParameter:}functionFormalParameter;
fieldFormalParameter;
simpleFormalParameter
- .
+ .
-{\bf simpleFormalParameter:}declaredIdentifier;
- metadata identifier
+{\bf functionFormalParameter:}
+ metadata \COVARIANT{}? returnType? identifier formalParameterList
+ .
+
+{\bf simpleFormalParameter:}
+ metadata \COVARIANT{}? finalConstVarOrType? identifier;
.
{\bf fieldFormalParameter:}
@@ -778,6 +778,18 @@
.
\end{grammar}
+\LMHash{}
+It is possible to include the modifier \COVARIANT{} in some forms of parameter declarations.
+This modifier has no effect.
+
+\rationale{
+The modifier \COVARIANT{} is used in strong mode.
+The modifier is allowed here even though it has no effect, such that source code can be used in both contexts.
+}
+
+\LMHash{}
+It is a compile-time error if the modifier \COVARIANT{} occurs on a parameter of a function which is not an instance method, instance setter, or instance operator.
+
%\subsubsection{Rest Formals}
%\LMLabel{restFormals}
@@ -908,14 +920,14 @@
constructorSignature (redirection $|$ initializers)?;
\EXTERNAL{} constantConstructorSignature;
\EXTERNAL{} constructorSignature;
- ((\EXTERNAL{} \STATIC{} ?))? getterSignature;
+ ((\EXTERNAL{} \STATIC{}?))? getterSignature;
((\EXTERNAL{} \STATIC{}?))? setterSignature;
\EXTERNAL{}? operatorSignature;
- ((\EXTERNAL{} \STATIC{}?))? functionSignature;
+ ((\EXTERNAL{} \STATIC{}?))? functionSignature;
\STATIC{} (\FINAL{} $|$ \CONST{}) type? staticFinalDeclarationList;
% \CONST{} type? staticFinalDeclarationList;
\FINAL{} type? initializedIdentifierList;
- \STATIC{}? (\VAR{} $|$ type) initializedIdentifierList
+ (\STATIC{} $|$ \COVARIANT{})? (\VAR{} $|$ type) initializedIdentifierList
.
{\bf staticFinalDeclarationList:}
@@ -929,6 +941,15 @@
\end{grammar}
\LMHash{}
+It is possible to include the modifier \COVARIANT{} in some forms of declarations.
+This modifier has no effect.
+
+\rationale{
+The modifier \COVARIANT{} is used in strong mode.
+The modifier is allowed here even though it has no effect, such that source code can be used in both contexts.
+}
+
+\LMHash{}
A class has constructors, instance members and static members. The instance members of a class are its instance methods, getters, setters and instance variables. The static members of a class are its static methods, getters, setters and static variables. The members of a class are its static and instance members.
\LMHash{}
@@ -5347,11 +5368,10 @@
\begin{grammar}
{\bf identifier:}
- IDENTIFIER
- .
+ IDENTIFIER
+ .
-
- {\bf IDENTIFIER\_NO\_DOLLAR:}
+{\bf IDENTIFIER\_NO\_DOLLAR:}
IDENTIFIER\_START\_NO\_DOLLAR IDENTIFIER\_PART\_NO\_DOLLAR*
.
@@ -5359,22 +5379,23 @@
IDENTIFIER\_START IDENTIFIER\_PART*
.
-{\bf BUILT\_IN\_IDENTIFIER:} \ABSTRACT{};
- \AS{};
- \DEFERRED{};
- \DYNAMIC{};
- \EXPORT{};
- \EXTERNAL{};
- \FACTORY{};
- \GET{};
- \IMPLEMENTS{};
- \IMPORT{};
- \LIBRARY{};
- \OPERATOR{};
- \PART{};
+{\bf BUILT\_IN\_IDENTIFIER:}\ABSTRACT{};
+ \AS{};
+ \COVARIANT{};
+ \DEFERRED{};
+ \DYNAMIC{};
+ \EXPORT{};
+ \EXTERNAL{};
+ \FACTORY{};
+ \GET{};
+ \IMPLEMENTS{};
+ \IMPORT{};
+ \LIBRARY{};
+ \OPERATOR{};
+ \PART{};
\SET{};
\STATIC{};
- \TYPEDEF{}
+ \TYPEDEF{}
.
{\bf IDENTIFIER\_START:}IDENTIFIER\_START\_NO\_DOLLAR;
@@ -5389,16 +5410,13 @@
DIGIT
.
-
{\bf IDENTIFIER\_PART:}IDENTIFIER\_START;
DIGIT
.
-
-
{\bf qualified:}
identifier (`{\escapegrammar .}' identifier)?
- .
+ .
\end{grammar}
\LMHash{}
diff --git a/pkg/analysis_server/doc/api.html b/pkg/analysis_server/doc/api.html
index 31588d1..6c6e96d 100644
--- a/pkg/analysis_server/doc/api.html
+++ b/pkg/analysis_server/doc/api.html
@@ -2804,6 +2804,17 @@
A default String for use in generating argument list
source contents on the client side.
</p>
+ </dd><dt class="field"><b>defaultArgumentListTextRanges (<span style="color:#999999">optional</span> List<int>)</b></dt><dd>
+
+ <p>
+ Pairs of offsets and lengths describing 'defaultArgumentListString'
+ text ranges suitable for use by clients to set up linked edits of
+ default argument source contents. For example, given an argument
+ list string 'x, y', the corresponding text range [0, 1, 3, 1],
+ indicates two text ranges of length 1, starting at offsets 0 and 3.
+ Clients can use these ranges to treat the 'x' and 'y' values
+ specially for linked edits.
+ </p>
</dd><dt class="field"><b>element (<span style="color:#999999">optional</span> <a href="#type_Element">Element</a>)</b></dt><dd>
<p>
diff --git a/pkg/analysis_server/lib/plugin/protocol/generated_protocol.dart b/pkg/analysis_server/lib/plugin/protocol/generated_protocol.dart
index 5fafc98..c946e9a 100644
--- a/pkg/analysis_server/lib/plugin/protocol/generated_protocol.dart
+++ b/pkg/analysis_server/lib/plugin/protocol/generated_protocol.dart
@@ -8971,6 +8971,7 @@
* "docComplete": optional String
* "declaringType": optional String
* "defaultArgumentListString": optional String
+ * "defaultArgumentListTextRanges": optional List<int>
* "element": optional Element
* "returnType": optional String
* "parameterNames": optional List<String>
@@ -9007,6 +9008,8 @@
String _defaultArgumentListString;
+ List<int> _defaultArgumentListTextRanges;
+
Element _element;
String _returnType;
@@ -9187,6 +9190,28 @@
}
/**
+ * Pairs of offsets and lengths describing 'defaultArgumentListString' text
+ * ranges suitable for use by clients to set up linked edits of default
+ * argument source contents. For example, given an argument list string 'x,
+ * y', the corresponding text range [0, 1, 3, 1], indicates two text ranges
+ * of length 1, starting at offsets 0 and 3. Clients can use these ranges to
+ * treat the 'x' and 'y' values specially for linked edits.
+ */
+ List<int> get defaultArgumentListTextRanges => _defaultArgumentListTextRanges;
+
+ /**
+ * Pairs of offsets and lengths describing 'defaultArgumentListString' text
+ * ranges suitable for use by clients to set up linked edits of default
+ * argument source contents. For example, given an argument list string 'x,
+ * y', the corresponding text range [0, 1, 3, 1], indicates two text ranges
+ * of length 1, starting at offsets 0 and 3. Clients can use these ranges to
+ * treat the 'x' and 'y' values specially for linked edits.
+ */
+ void set defaultArgumentListTextRanges(List<int> value) {
+ this._defaultArgumentListTextRanges = value;
+ }
+
+ /**
* Information about the element reference being suggested.
*/
Element get element => _element;
@@ -9316,7 +9341,7 @@
this._importUri = value;
}
- CompletionSuggestion(CompletionSuggestionKind kind, int relevance, String completion, int selectionOffset, int selectionLength, bool isDeprecated, bool isPotential, {String docSummary, String docComplete, String declaringType, String defaultArgumentListString, Element element, String returnType, List<String> parameterNames, List<String> parameterTypes, int requiredParameterCount, bool hasNamedParameters, String parameterName, String parameterType, String importUri}) {
+ CompletionSuggestion(CompletionSuggestionKind kind, int relevance, String completion, int selectionOffset, int selectionLength, bool isDeprecated, bool isPotential, {String docSummary, String docComplete, String declaringType, String defaultArgumentListString, List<int> defaultArgumentListTextRanges, Element element, String returnType, List<String> parameterNames, List<String> parameterTypes, int requiredParameterCount, bool hasNamedParameters, String parameterName, String parameterType, String importUri}) {
this.kind = kind;
this.relevance = relevance;
this.completion = completion;
@@ -9328,6 +9353,7 @@
this.docComplete = docComplete;
this.declaringType = declaringType;
this.defaultArgumentListString = defaultArgumentListString;
+ this.defaultArgumentListTextRanges = defaultArgumentListTextRanges;
this.element = element;
this.returnType = returnType;
this.parameterNames = parameterNames;
@@ -9402,6 +9428,10 @@
if (json.containsKey("defaultArgumentListString")) {
defaultArgumentListString = jsonDecoder.decodeString(jsonPath + ".defaultArgumentListString", json["defaultArgumentListString"]);
}
+ List<int> defaultArgumentListTextRanges;
+ if (json.containsKey("defaultArgumentListTextRanges")) {
+ defaultArgumentListTextRanges = jsonDecoder.decodeList(jsonPath + ".defaultArgumentListTextRanges", json["defaultArgumentListTextRanges"], jsonDecoder.decodeInt);
+ }
Element element;
if (json.containsKey("element")) {
element = new Element.fromJson(jsonDecoder, jsonPath + ".element", json["element"]);
@@ -9438,7 +9468,7 @@
if (json.containsKey("importUri")) {
importUri = jsonDecoder.decodeString(jsonPath + ".importUri", json["importUri"]);
}
- return new CompletionSuggestion(kind, relevance, completion, selectionOffset, selectionLength, isDeprecated, isPotential, docSummary: docSummary, docComplete: docComplete, declaringType: declaringType, defaultArgumentListString: defaultArgumentListString, element: element, returnType: returnType, parameterNames: parameterNames, parameterTypes: parameterTypes, requiredParameterCount: requiredParameterCount, hasNamedParameters: hasNamedParameters, parameterName: parameterName, parameterType: parameterType, importUri: importUri);
+ return new CompletionSuggestion(kind, relevance, completion, selectionOffset, selectionLength, isDeprecated, isPotential, docSummary: docSummary, docComplete: docComplete, declaringType: declaringType, defaultArgumentListString: defaultArgumentListString, defaultArgumentListTextRanges: defaultArgumentListTextRanges, element: element, returnType: returnType, parameterNames: parameterNames, parameterTypes: parameterTypes, requiredParameterCount: requiredParameterCount, hasNamedParameters: hasNamedParameters, parameterName: parameterName, parameterType: parameterType, importUri: importUri);
} else {
throw jsonDecoder.mismatch(jsonPath, "CompletionSuggestion", json);
}
@@ -9465,6 +9495,9 @@
if (defaultArgumentListString != null) {
result["defaultArgumentListString"] = defaultArgumentListString;
}
+ if (defaultArgumentListTextRanges != null) {
+ result["defaultArgumentListTextRanges"] = defaultArgumentListTextRanges;
+ }
if (element != null) {
result["element"] = element.toJson();
}
@@ -9512,6 +9545,7 @@
docComplete == other.docComplete &&
declaringType == other.declaringType &&
defaultArgumentListString == other.defaultArgumentListString &&
+ listEqual(defaultArgumentListTextRanges, other.defaultArgumentListTextRanges, (int a, int b) => a == b) &&
element == other.element &&
returnType == other.returnType &&
listEqual(parameterNames, other.parameterNames, (String a, String b) => a == b) &&
@@ -9539,6 +9573,7 @@
hash = JenkinsSmiHash.combine(hash, docComplete.hashCode);
hash = JenkinsSmiHash.combine(hash, declaringType.hashCode);
hash = JenkinsSmiHash.combine(hash, defaultArgumentListString.hashCode);
+ hash = JenkinsSmiHash.combine(hash, defaultArgumentListTextRanges.hashCode);
hash = JenkinsSmiHash.combine(hash, element.hashCode);
hash = JenkinsSmiHash.combine(hash, returnType.hashCode);
hash = JenkinsSmiHash.combine(hash, parameterNames.hashCode);
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/local_reference_contributor.dart b/pkg/analysis_server/lib/src/services/completion/dart/local_reference_contributor.dart
index ae66900..1dba712 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/local_reference_contributor.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/local_reference_contributor.dart
@@ -470,11 +470,18 @@
// TODO(brianwilkerson) Support function types.
return 'dynamic';
}).toList();
- suggestion.requiredParameterCount = paramList
- .where((FormalParameter param) => param is! DefaultFormalParameter)
- .length;
- suggestion.hasNamedParameters = paramList
- .any((FormalParameter param) => param.kind == ParameterKind.NAMED);
+
+ Iterable<ParameterElement> requiredParameters = paramList
+ .where((FormalParameter param) => param.kind == ParameterKind.REQUIRED)
+ .map((p) => p.element);
+ suggestion.requiredParameterCount = requiredParameters.length;
+
+ Iterable<ParameterElement> namedParameters = paramList
+ .where((FormalParameter param) => param.kind == ParameterKind.NAMED)
+ .map((p) => p.element);
+ suggestion.hasNamedParameters = namedParameters.isNotEmpty;
+
+ addDefaultArgDetails(suggestion, requiredParameters, namedParameters);
}
bool _isVoid(TypeAnnotation returnType) {
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/suggestion_builder.dart b/pkg/analysis_server/lib/src/services/completion/dart/suggestion_builder.dart
index a57319a..a00a87d 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/suggestion_builder.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/suggestion_builder.dart
@@ -8,6 +8,7 @@
import 'package:analysis_server/src/protocol_server.dart'
hide Element, ElementKind;
import 'package:analysis_server/src/provisional/completion/dart/completion_dart.dart';
+import 'package:analysis_server/src/services/completion/dart/utilities.dart';
import 'package:analysis_server/src/utilities/documentation.dart';
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/dart/element/type.dart';
@@ -70,13 +71,17 @@
// Gracefully degrade if type not resolved yet
return paramType != null ? paramType.displayName : 'var';
}).toList();
- suggestion.requiredParameterCount = element.parameters
- .where((ParameterElement parameter) =>
- parameter.parameterKind == ParameterKind.REQUIRED)
- .length;
- suggestion.hasNamedParameters = element.parameters.any(
- (ParameterElement parameter) =>
- parameter.parameterKind == ParameterKind.NAMED);
+
+ Iterable<ParameterElement> requiredParameters = element.parameters.where(
+ (ParameterElement param) =>
+ param.parameterKind == ParameterKind.REQUIRED);
+ suggestion.requiredParameterCount = requiredParameters.length;
+
+ Iterable<ParameterElement> namedParameters = element.parameters.where(
+ (ParameterElement param) => param.parameterKind == ParameterKind.NAMED);
+ suggestion.hasNamedParameters = namedParameters.isNotEmpty;
+
+ addDefaultArgDetails(suggestion, requiredParameters, namedParameters);
}
if (importForSource != null) {
String srcPath = path.dirname(importForSource.fullName);
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/utilities.dart b/pkg/analysis_server/lib/src/services/completion/dart/utilities.dart
index a3ec936..8000253 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/utilities.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/utilities.dart
@@ -13,6 +13,7 @@
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/ast/standard_ast_factory.dart';
import 'package:analyzer/dart/ast/token.dart';
+import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/src/dart/ast/token.dart';
import 'package:analyzer/src/generated/source.dart';
@@ -29,6 +30,47 @@
null);
/**
+ * Add default argument list text and ranges based on the given [requiredParams]
+ * and [namedParams].
+ */
+void addDefaultArgDetails(
+ CompletionSuggestion suggestion,
+ Iterable<ParameterElement> requiredParams,
+ Iterable<ParameterElement> namedParams) {
+ StringBuffer sb = new StringBuffer();
+ List<int> ranges = <int>[];
+
+ int offset;
+
+ for (ParameterElement param in requiredParams) {
+ if (sb.isNotEmpty) {
+ sb.write(', ');
+ }
+ offset = sb.length;
+ String name = param.name;
+ sb.write(name);
+ ranges.addAll([offset, name.length]);
+ }
+
+ for (ParameterElement param in namedParams) {
+ if (param.isRequired) {
+ if (sb.isNotEmpty) {
+ sb.write(', ');
+ }
+ String name = param.name;
+ sb.write('$name: ');
+ offset = sb.length;
+ String defaultValue = _getDefaultValue(param);
+ sb.write(defaultValue);
+ ranges.addAll([offset, defaultValue.length]);
+ }
+ }
+
+ suggestion.defaultArgumentListString = sb.isNotEmpty ? sb.toString() : null;
+ suggestion.defaultArgumentListTextRanges = ranges.isNotEmpty ? ranges : null;
+}
+
+/**
* Create a new protocol Element for inclusion in a completion suggestion.
*/
protocol.Element createLocalElement(
@@ -155,3 +197,5 @@
}
return DYNAMIC;
}
+
+String _getDefaultValue(ParameterElement param) => 'null';
diff --git a/pkg/analysis_server/test/abstract_context.dart b/pkg/analysis_server/test/abstract_context.dart
index e3c4b93..e139528 100644
--- a/pkg/analysis_server/test/abstract_context.dart
+++ b/pkg/analysis_server/test/abstract_context.dart
@@ -76,6 +76,20 @@
*/
bool get enableNewAnalysisDriver => false;
+ Source addMetaPackageSource() => addPackageSource(
+ 'meta',
+ 'meta.dart',
+ r'''
+library meta;
+
+const Required required = const Required();
+
+class Required {
+ final String reason;
+ const Required([this.reason]);
+}
+''');
+
Source addPackageSource(String packageName, String filePath, String content) {
packageMap[packageName] = [(newFolder('/pubcache/$packageName'))];
File file = newFile('/pubcache/$packageName/$filePath', content);
diff --git a/pkg/analysis_server/test/integration/protocol_matchers.dart b/pkg/analysis_server/test/integration/protocol_matchers.dart
index 2246d1e..1ad51bf 100644
--- a/pkg/analysis_server/test/integration/protocol_matchers.dart
+++ b/pkg/analysis_server/test/integration/protocol_matchers.dart
@@ -1264,6 +1264,7 @@
* "docComplete": optional String
* "declaringType": optional String
* "defaultArgumentListString": optional String
+ * "defaultArgumentListTextRanges": optional List<int>
* "element": optional Element
* "returnType": optional String
* "parameterNames": optional List<String>
@@ -1289,6 +1290,7 @@
"docComplete": isString,
"declaringType": isString,
"defaultArgumentListString": isString,
+ "defaultArgumentListTextRanges": isListOf(isInt),
"element": isElement,
"returnType": isString,
"parameterNames": isListOf(isString),
diff --git a/pkg/analysis_server/test/services/completion/dart/completion_contributor_util.dart b/pkg/analysis_server/test/services/completion/dart/completion_contributor_util.dart
index 2a0bd25..f9c6a45 100644
--- a/pkg/analysis_server/test/services/completion/dart/completion_contributor_util.dart
+++ b/pkg/analysis_server/test/services/completion/dart/completion_contributor_util.dart
@@ -114,7 +114,9 @@
String elemFile,
int elemOffset,
String paramName,
- String paramType}) {
+ String paramType,
+ String defaultArgListString,
+ List<int> defaultArgumentListTextRanges}) {
CompletionSuggestion cs =
getSuggest(completion: completion, csKind: csKind, elemKind: elemKind);
if (cs == null) {
@@ -151,6 +153,12 @@
if (paramType != null) {
expect(cs.parameterType, paramType);
}
+ if (defaultArgListString != null) {
+ expect(cs.defaultArgumentListString, defaultArgListString);
+ }
+ if (defaultArgumentListTextRanges != null) {
+ expect(cs.defaultArgumentListTextRanges, defaultArgumentListTextRanges);
+ }
return cs;
}
@@ -197,9 +205,13 @@
CompletionSuggestion assertSuggestConstructor(String name,
{int relevance: DART_RELEVANCE_DEFAULT,
String importUri,
- int elemOffset}) {
+ int elemOffset,
+ String defaultArgListString}) {
CompletionSuggestion cs = assertSuggest(name,
- relevance: relevance, importUri: importUri, elemOffset: elemOffset);
+ relevance: relevance,
+ importUri: importUri,
+ elemOffset: elemOffset,
+ defaultArgListString: defaultArgListString);
protocol.Element element = cs.element;
expect(element, isNotNull);
expect(element.kind, equals(protocol.ElementKind.CONSTRUCTOR));
@@ -255,12 +267,16 @@
{CompletionSuggestionKind kind: CompletionSuggestionKind.INVOCATION,
bool isDeprecated: false,
int relevance: DART_RELEVANCE_DEFAULT,
- String importUri}) {
+ String importUri,
+ String defaultArgListString,
+ List<int> defaultArgumentListTextRanges}) {
CompletionSuggestion cs = assertSuggest(name,
csKind: kind,
relevance: relevance,
importUri: importUri,
- isDeprecated: isDeprecated);
+ isDeprecated: isDeprecated,
+ defaultArgListString: defaultArgListString,
+ defaultArgumentListTextRanges: defaultArgumentListTextRanges);
if (returnType != null) {
expect(cs.returnType, returnType);
} else if (isNullExpectedReturnTypeConsideredDynamic) {
@@ -347,12 +363,16 @@
{int relevance: DART_RELEVANCE_DEFAULT,
String importUri,
CompletionSuggestionKind kind: CompletionSuggestionKind.INVOCATION,
- bool isDeprecated: false}) {
+ bool isDeprecated: false,
+ String defaultArgListString,
+ List<int> defaultArgumentListTextRanges}) {
CompletionSuggestion cs = assertSuggest(name,
csKind: kind,
relevance: relevance,
importUri: importUri,
- isDeprecated: isDeprecated);
+ isDeprecated: isDeprecated,
+ defaultArgListString: defaultArgListString,
+ defaultArgumentListTextRanges: defaultArgumentListTextRanges);
expect(cs.declaringType, equals(declaringType));
expect(cs.returnType, returnType != null ? returnType : 'dynamic');
protocol.Element element = cs.element;
diff --git a/pkg/analysis_server/test/services/completion/dart/imported_reference_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/imported_reference_contributor_test.dart
index 7c91fe8..94a5c56 100644
--- a/pkg/analysis_server/test/services/completion/dart/imported_reference_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/imported_reference_contributor_test.dart
@@ -4521,4 +4521,27 @@
test_enum_deprecated() {
// TODO(scheglov) remove it?
}
+
+ /// Sanity check. Permutations tested in local_ref_contributor.
+ test_ArgDefaults_function_with_required_named() async {
+ addMetaPackageSource();
+
+ resolveSource(
+ '/testB.dart',
+ '''
+lib B;
+import 'package:meta/meta.dart';
+
+bool foo(int bar, {bool boo, @required int baz}) => false;
+''');
+
+ addTestSource('''
+import "/testB.dart";
+
+void main() {f^}''');
+ await computeSuggestions();
+
+ assertSuggestFunction('foo', 'bool',
+ defaultArgListString: 'bar, baz: null');
+ }
}
diff --git a/pkg/analysis_server/test/services/completion/dart/inherited_reference_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/inherited_reference_contributor_test.dart
index 8e564c7..834cda6 100644
--- a/pkg/analysis_server/test/services/completion/dart/inherited_reference_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/inherited_reference_contributor_test.dart
@@ -623,4 +623,28 @@
class InheritedContributorTest_Driver extends InheritedContributorTest {
@override
bool get enableNewAnalysisDriver => true;
+
+ /// Sanity check. Permutations tested in local_ref_contributor.
+ test_ArgDefaults_inherited_method_with_required_named() async {
+ addMetaPackageSource();
+ resolveSource(
+ '/testB.dart',
+ '''
+import 'package:meta/meta.dart';
+
+lib libB;
+class A {
+ bool foo(int bar, {bool boo, @required int baz}) => false;
+}''');
+ addTestSource('''
+import "/testB.dart";
+class B extends A {
+ b() => f^
+}
+''');
+ await computeSuggestions();
+
+ assertSuggestMethod('foo', 'A', 'bool',
+ defaultArgListString: 'bar, baz: null');
+ }
}
diff --git a/pkg/analysis_server/test/services/completion/dart/local_constructor_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/local_constructor_contributor_test.dart
index 7ee4457..ddaa6a5 100644
--- a/pkg/analysis_server/test/services/completion/dart/local_constructor_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/local_constructor_contributor_test.dart
@@ -4153,4 +4153,22 @@
extends LocalConstructorContributorTest {
@override
bool get enableNewAnalysisDriver => true;
+
+ /// Sanity check. Permutations tested in local_ref_contributor.
+ test_ArgDefaults_cons_with_required_named() async {
+ addMetaPackageSource();
+ addTestSource('''
+import 'package:meta/meta.dart';
+
+class A {
+ A(int bar, {bool boo, @required int baz});
+ baz() {
+ new A^
+ }
+}''');
+ await computeSuggestions();
+
+ assertSuggestConstructor('A',
+ defaultArgListString: 'bar, baz: null');
+ }
}
diff --git a/pkg/analysis_server/test/services/completion/dart/local_reference_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/local_reference_contributor_test.dart
index 45624f2..31e96f7 100644
--- a/pkg/analysis_server/test/services/completion/dart/local_reference_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/local_reference_contributor_test.dart
@@ -4597,4 +4597,77 @@
extends LocalReferenceContributorTest {
@override
bool get enableNewAnalysisDriver => true;
+
+ test_ArgDefaults_function() async {
+ addTestSource('''
+bool hasLength(int a, bool b) => false;
+void main() {h^}''');
+ await computeSuggestions();
+
+ assertSuggestFunction('hasLength', 'bool',
+ relevance: DART_RELEVANCE_LOCAL_FUNCTION,
+ defaultArgListString: 'a, b',
+ defaultArgumentListTextRanges: [0, 1, 3, 1]);
+ }
+
+ test_ArgDefaults_function_none() async {
+ addTestSource('''
+bool hasLength() => false;
+void main() {h^}''');
+ await computeSuggestions();
+
+ assertSuggestFunction('hasLength', 'bool',
+ relevance: DART_RELEVANCE_LOCAL_FUNCTION,
+ defaultArgListString: null,
+ defaultArgumentListTextRanges: null);
+ }
+
+ test_ArgDefaults_function_with_optional_positional() async {
+ addMetaPackageSource();
+ addTestSource('''
+import 'package:meta/meta.dart';
+
+bool foo(int bar, [bool boo, int baz]) => false;
+void main() {h^}''');
+ await computeSuggestions();
+
+ assertSuggestFunction('foo', 'bool',
+ relevance: DART_RELEVANCE_LOCAL_FUNCTION,
+ defaultArgListString: 'bar',
+ defaultArgumentListTextRanges: [0, 3]);
+ }
+
+ test_ArgDefaults_function_with_required_named() async {
+ addMetaPackageSource();
+ addTestSource('''
+import 'package:meta/meta.dart';
+
+bool foo(int bar, {bool boo, @required int baz}) => false;
+void main() {h^}''');
+ await computeSuggestions();
+
+ assertSuggestFunction('foo', 'bool',
+ relevance: DART_RELEVANCE_LOCAL_FUNCTION,
+ defaultArgListString: 'bar, baz: null',
+ defaultArgumentListTextRanges: [0, 3, 10, 4]);
+ }
+
+ test_ArgDefaults_method_with_required_named() async {
+ addMetaPackageSource();
+ addTestSource('''
+import 'package:meta/meta.dart';
+
+class A {
+ bool foo(int bar, {bool boo, @required int baz}) => false;
+ baz() {
+ f^
+ }
+}''');
+ await computeSuggestions();
+
+ assertSuggestMethod('foo', 'A', 'bool',
+ relevance: DART_RELEVANCE_LOCAL_METHOD,
+ defaultArgListString: 'bar, baz: null',
+ defaultArgumentListTextRanges: [0, 3, 10, 4]);
+ }
}
diff --git a/pkg/analysis_server/test/services/completion/dart/type_member_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/type_member_contributor_test.dart
index 9801e82..2dbbc05 100644
--- a/pkg/analysis_server/test/services/completion/dart/type_member_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/type_member_contributor_test.dart
@@ -4163,4 +4163,59 @@
class TypeMemberContributorTest_Driver extends TypeMemberContributorTest {
@override
bool get enableNewAnalysisDriver => true;
+
+ test_ArgDefaults_method() async {
+ addTestSource('''
+class A {
+ bool a(int b, bool c) => false;
+}
+
+void main() {new A().a^}''');
+ await computeSuggestions();
+
+ assertSuggestMethod('a', 'A', 'bool', defaultArgListString: 'b, c');
+ }
+
+ test_ArgDefaults_method_none() async {
+ addTestSource('''
+class A {
+ bool a() => false;
+}
+
+void main() {new A().a^}''');
+ await computeSuggestions();
+
+ assertSuggestMethod('a', 'A', 'bool', defaultArgListString: null);
+ }
+
+ test_ArgDefaults_method_with_optional_positional() async {
+ addMetaPackageSource();
+ addTestSource('''
+import 'package:meta/meta.dart';
+
+class A {
+ bool foo(int bar, [bool boo, int baz]) => false;
+}
+
+void main() {new A().f^}''');
+ await computeSuggestions();
+
+ assertSuggestMethod('foo', 'A', 'bool', defaultArgListString: 'bar');
+ }
+
+ test_ArgDefaults_method_with_required_named() async {
+ addMetaPackageSource();
+ addTestSource('''
+import 'package:meta/meta.dart';
+
+class A {
+ bool foo(int bar, {bool boo, @required int baz}) => false;
+}
+
+void main() {new A().f^}''');
+ await computeSuggestions();
+
+ assertSuggestMethod('foo', 'A', 'bool',
+ defaultArgListString: 'bar, baz: null');
+ }
}
diff --git a/pkg/analysis_server/tool/spec/generated/java/types/CompletionSuggestion.java b/pkg/analysis_server/tool/spec/generated/java/types/CompletionSuggestion.java
index 71a4bb9..f20a098 100644
--- a/pkg/analysis_server/tool/spec/generated/java/types/CompletionSuggestion.java
+++ b/pkg/analysis_server/tool/spec/generated/java/types/CompletionSuggestion.java
@@ -107,6 +107,15 @@
private final String defaultArgumentListString;
/**
+ * Pairs of offsets and lengths describing 'defaultArgumentListString' text ranges suitable for use
+ * by clients to set up linked edits of default argument source contents. For example, given an
+ * argument list string 'x, y', the corresponding text range [0, 1, 3, 1], indicates two text
+ * ranges of length 1, starting at offsets 0 and 3. Clients can use these ranges to treat the 'x'
+ * and 'y' values specially for linked edits.
+ */
+ private final int[] defaultArgumentListTextRanges;
+
+ /**
* Information about the element reference being suggested.
*/
private final Element element;
@@ -162,7 +171,7 @@
/**
* Constructor for {@link CompletionSuggestion}.
*/
- public CompletionSuggestion(String kind, int relevance, String completion, int selectionOffset, int selectionLength, boolean isDeprecated, boolean isPotential, String docSummary, String docComplete, String declaringType, String defaultArgumentListString, Element element, String returnType, List<String> parameterNames, List<String> parameterTypes, Integer requiredParameterCount, Boolean hasNamedParameters, String parameterName, String parameterType, String importUri) {
+ public CompletionSuggestion(String kind, int relevance, String completion, int selectionOffset, int selectionLength, boolean isDeprecated, boolean isPotential, String docSummary, String docComplete, String declaringType, String defaultArgumentListString, int[] defaultArgumentListTextRanges, Element element, String returnType, List<String> parameterNames, List<String> parameterTypes, Integer requiredParameterCount, Boolean hasNamedParameters, String parameterName, String parameterType, String importUri) {
this.kind = kind;
this.relevance = relevance;
this.completion = completion;
@@ -174,6 +183,7 @@
this.docComplete = docComplete;
this.declaringType = declaringType;
this.defaultArgumentListString = defaultArgumentListString;
+ this.defaultArgumentListTextRanges = defaultArgumentListTextRanges;
this.element = element;
this.returnType = returnType;
this.parameterNames = parameterNames;
@@ -201,6 +211,7 @@
ObjectUtilities.equals(other.docComplete, docComplete) &&
ObjectUtilities.equals(other.declaringType, declaringType) &&
ObjectUtilities.equals(other.defaultArgumentListString, defaultArgumentListString) &&
+ Arrays.equals(other.defaultArgumentListTextRanges, defaultArgumentListTextRanges) &&
ObjectUtilities.equals(other.element, element) &&
ObjectUtilities.equals(other.returnType, returnType) &&
ObjectUtilities.equals(other.parameterNames, parameterNames) &&
@@ -226,6 +237,7 @@
String docComplete = jsonObject.get("docComplete") == null ? null : jsonObject.get("docComplete").getAsString();
String declaringType = jsonObject.get("declaringType") == null ? null : jsonObject.get("declaringType").getAsString();
String defaultArgumentListString = jsonObject.get("defaultArgumentListString") == null ? null : jsonObject.get("defaultArgumentListString").getAsString();
+ int[] defaultArgumentListTextRanges = jsonObject.get("defaultArgumentListTextRanges") == null ? null : JsonUtilities.decodeIntArray(jsonObject.get("defaultArgumentListTextRanges").getAsJsonArray());
Element element = jsonObject.get("element") == null ? null : Element.fromJson(jsonObject.get("element").getAsJsonObject());
String returnType = jsonObject.get("returnType") == null ? null : jsonObject.get("returnType").getAsString();
List<String> parameterNames = jsonObject.get("parameterNames") == null ? null : JsonUtilities.decodeStringList(jsonObject.get("parameterNames").getAsJsonArray());
@@ -235,7 +247,7 @@
String parameterName = jsonObject.get("parameterName") == null ? null : jsonObject.get("parameterName").getAsString();
String parameterType = jsonObject.get("parameterType") == null ? null : jsonObject.get("parameterType").getAsString();
String importUri = jsonObject.get("importUri") == null ? null : jsonObject.get("importUri").getAsString();
- return new CompletionSuggestion(kind, relevance, completion, selectionOffset, selectionLength, isDeprecated, isPotential, docSummary, docComplete, declaringType, defaultArgumentListString, element, returnType, parameterNames, parameterTypes, requiredParameterCount, hasNamedParameters, parameterName, parameterType, importUri);
+ return new CompletionSuggestion(kind, relevance, completion, selectionOffset, selectionLength, isDeprecated, isPotential, docSummary, docComplete, declaringType, defaultArgumentListString, defaultArgumentListTextRanges, element, returnType, parameterNames, parameterTypes, requiredParameterCount, hasNamedParameters, parameterName, parameterType, importUri);
}
public static List<CompletionSuggestion> fromJsonArray(JsonArray jsonArray) {
@@ -275,6 +287,17 @@
}
/**
+ * Pairs of offsets and lengths describing 'defaultArgumentListString' text ranges suitable for use
+ * by clients to set up linked edits of default argument source contents. For example, given an
+ * argument list string 'x, y', the corresponding text range [0, 1, 3, 1], indicates two text
+ * ranges of length 1, starting at offsets 0 and 3. Clients can use these ranges to treat the 'x'
+ * and 'y' values specially for linked edits.
+ */
+ public int[] getDefaultArgumentListTextRanges() {
+ return defaultArgumentListTextRanges;
+ }
+
+ /**
* The Dartdoc associated with the element being suggested, This field is omitted if there is no
* Dartdoc associated with the element.
*/
@@ -419,6 +442,7 @@
builder.append(docComplete);
builder.append(declaringType);
builder.append(defaultArgumentListString);
+ builder.append(defaultArgumentListTextRanges);
builder.append(element);
builder.append(returnType);
builder.append(parameterNames);
@@ -452,6 +476,13 @@
if (defaultArgumentListString != null) {
jsonObject.addProperty("defaultArgumentListString", defaultArgumentListString);
}
+ if (defaultArgumentListTextRanges != null) {
+ JsonArray jsonArrayDefaultArgumentListTextRanges = new JsonArray();
+ for (int elt : defaultArgumentListTextRanges) {
+ jsonArrayDefaultArgumentListTextRanges.add(new JsonPrimitive(elt));
+ }
+ jsonObject.add("defaultArgumentListTextRanges", jsonArrayDefaultArgumentListTextRanges);
+ }
if (element != null) {
jsonObject.add("element", element.toJson());
}
@@ -516,6 +547,8 @@
builder.append(declaringType + ", ");
builder.append("defaultArgumentListString=");
builder.append(defaultArgumentListString + ", ");
+ builder.append("defaultArgumentListTextRanges=");
+ builder.append(StringUtils.join(defaultArgumentListTextRanges, ", ") + ", ");
builder.append("element=");
builder.append(element + ", ");
builder.append("returnType=");
diff --git a/pkg/analysis_server/tool/spec/spec_input.html b/pkg/analysis_server/tool/spec/spec_input.html
index 24bbf48..e2a4c15 100644
--- a/pkg/analysis_server/tool/spec/spec_input.html
+++ b/pkg/analysis_server/tool/spec/spec_input.html
@@ -2439,6 +2439,18 @@
source contents on the client side.
</p>
</field>
+ <field name="defaultArgumentListTextRanges" optional="true">
+ <list><ref>int</ref></list>
+ <p>
+ Pairs of offsets and lengths describing 'defaultArgumentListString'
+ text ranges suitable for use by clients to set up linked edits of
+ default argument source contents. For example, given an argument
+ list string 'x, y', the corresponding text range [0, 1, 3, 1],
+ indicates two text ranges of length 1, starting at offsets 0 and 3.
+ Clients can use these ranges to treat the 'x' and 'y' values
+ specially for linked edits.
+ </p>
+ </field>
<field name="element" optional="true">
<ref>Element</ref>
<p>
diff --git a/pkg/analyzer/lib/dart/ast/ast.dart b/pkg/analyzer/lib/dart/ast/ast.dart
index 624f840..0c65f34 100644
--- a/pkg/analyzer/lib/dart/ast/ast.dart
+++ b/pkg/analyzer/lib/dart/ast/ast.dart
@@ -2765,6 +2765,11 @@
Token get covariantKeyword;
/**
+ * Set the token for the 'covariant' keyword to the given [token].
+ */
+ void set covariantKeyword(Token token);
+
+ /**
* Return the fields being declared.
*/
VariableDeclarationList get fields;
diff --git a/pkg/analyzer/lib/dart/ast/ast_factory.dart b/pkg/analyzer/lib/dart/ast/ast_factory.dart
index 3e5c448..40a5830 100644
--- a/pkg/analyzer/lib/dart/ast/ast_factory.dart
+++ b/pkg/analyzer/lib/dart/ast/ast_factory.dart
@@ -83,6 +83,7 @@
*/
BinaryExpression binaryExpression(
Expression leftOperand, Token operator, Expression rightOperand);
+
/**
* Returns a newly created block of code.
*/
@@ -407,11 +408,28 @@
* [comment] and [metadata] can be `null` if the declaration does not have the
* corresponding attribute. The [staticKeyword] can be `null` if the field is
* not a static field.
+ *
+ * Use [fieldDeclaration2] instead.
*/
+ @deprecated
FieldDeclaration fieldDeclaration(Comment comment, List<Annotation> metadata,
Token staticKeyword, VariableDeclarationList fieldList, Token semicolon);
/**
+ * Returns a newly created field declaration. Either or both of the
+ * [comment] and [metadata] can be `null` if the declaration does not have the
+ * corresponding attribute. The [staticKeyword] can be `null` if the field is
+ * not a static field.
+ */
+ FieldDeclaration fieldDeclaration2(
+ {Comment comment,
+ List<Annotation> metadata,
+ Token covariantKeyword,
+ Token staticKeyword,
+ @required VariableDeclarationList fieldList,
+ @required Token semicolon});
+
+ /**
* Returns a newly created formal parameter. Either or both of the
* [comment] and [metadata] can be `null` if the parameter does not have the
* corresponding attribute. The [keyword] can be `null` if there is a type.
@@ -419,7 +437,10 @@
* [period] can be `null` if the keyword 'this' was not provided. The
* [parameters] can be `null` if this is not a function-typed field formal
* parameter.
+ *
+ * Use [fieldFormalParameter2] instead.
*/
+ @deprecated
FieldFormalParameter fieldFormalParameter(
Comment comment,
List<Annotation> metadata,
@@ -569,7 +590,10 @@
* [comment] and [metadata] can be `null` if the parameter does not have the
* corresponding attribute. The [returnType] can be `null` if no return type
* was specified.
+ *
+ * Use [functionTypedFormalParameter2] instead.
*/
+ @deprecated
FunctionTypedFormalParameter functionTypedFormalParameter(
Comment comment,
List<Annotation> metadata,
@@ -907,7 +931,10 @@
* [comment] and [metadata] can be `null` if the parameter does not have the
* corresponding attribute. The [keyword] can be `null` if a type was
* specified. The [type] must be `null` if the keyword is 'var'.
+ *
+ * Use [simpleFormalParameter2] instead.
*/
+ @deprecated
SimpleFormalParameter simpleFormalParameter(
Comment comment,
List<Annotation> metadata,
diff --git a/pkg/analyzer/lib/src/command_line/arguments.dart b/pkg/analyzer/lib/src/command_line/arguments.dart
index e0ab676..5579005 100644
--- a/pkg/analyzer/lib/src/command_line/arguments.dart
+++ b/pkg/analyzer/lib/src/command_line/arguments.dart
@@ -32,25 +32,38 @@
/**
* Update [options] with the value of each analysis option command line flag.
*/
-void applyAnalysisOptionFlags(AnalysisOptionsImpl options, ArgResults args) {
+void applyAnalysisOptionFlags(AnalysisOptionsImpl options, ArgResults args,
+ {void verbosePrint(String text)}) {
+ void verbose(String text) {
+ if (verbosePrint != null) {
+ verbosePrint('Analysis options: $text');
+ }
+ }
+
if (args.wasParsed(enableStrictCallChecksFlag)) {
options.enableStrictCallChecks = args[enableStrictCallChecksFlag];
+ verbose('$enableStrictCallChecksFlag = ${options.enableStrictCallChecks}');
}
if (args.wasParsed(enableSuperMixinFlag)) {
options.enableSuperMixins = args[enableSuperMixinFlag];
+ verbose('$enableSuperMixinFlag = ${options.enableSuperMixins}');
}
if (args.wasParsed(noImplicitCastsFlag)) {
options.implicitCasts = !args[noImplicitCastsFlag];
+ verbose('$noImplicitCastsFlag = ${options.implicitCasts}');
}
if (args.wasParsed(noImplicitDynamicFlag)) {
options.implicitDynamic = !args[noImplicitDynamicFlag];
+ verbose('$noImplicitDynamicFlag = ${options.implicitDynamic}');
}
if (args.wasParsed(strongModeFlag)) {
options.strongMode = args[strongModeFlag];
+ verbose('$strongModeFlag = ${options.strongMode}');
}
try {
if (args.wasParsed(lintsFlag)) {
options.lint = args[lintsFlag];
+ verbose('$lintsFlag = ${options.lint}');
}
} on ArgumentError {
// lints were not defined - ignore and fall through
diff --git a/pkg/analyzer/lib/src/context/builder.dart b/pkg/analyzer/lib/src/context/builder.dart
index ea35756..0bd531e 100644
--- a/pkg/analyzer/lib/src/context/builder.dart
+++ b/pkg/analyzer/lib/src/context/builder.dart
@@ -366,9 +366,17 @@
/**
* Return the analysis options that should be used to analyze code in the
- * directory with the given [path].
+ * directory with the given [path]. Use [verbosePrint] to echo verbose
+ * information about the analysis options selection process.
*/
- AnalysisOptions getAnalysisOptions(String path) {
+ AnalysisOptions getAnalysisOptions(String path,
+ {void verbosePrint(String text)}) {
+ void verbose(String text) {
+ if (verbosePrint != null) {
+ verbosePrint(text);
+ }
+ }
+
// TODO(danrubel) restructure so that we don't create a workspace
// both here and in createSourceFactory
Workspace workspace = createWorkspace(path);
@@ -383,8 +391,10 @@
if (optionsFile != null) {
try {
optionMap = optionsProvider.getOptionsFromFile(optionsFile);
- } catch (_) {
+ verbose('Loaded analysis options from ${optionsFile.path}');
+ } catch (e) {
// Ignore exceptions thrown while trying to load the options file.
+ verbose('Exception: $e\n when loading ${optionsFile.path}');
}
} else {
// Search for the default analysis options
@@ -401,8 +411,10 @@
if (source.exists()) {
try {
optionMap = optionsProvider.getOptionsFromSource(source);
- } catch (_) {
+ verbose('Loaded analysis options from ${source.fullName}');
+ } catch (e) {
// Ignore exceptions thrown while trying to load the options file.
+ verbose('Exception: $e\n when loading ${source.fullName}');
}
}
}
@@ -410,12 +422,16 @@
if (optionMap != null) {
applyToAnalysisOptions(options, optionMap);
if (builderOptions.argResults != null) {
- applyAnalysisOptionFlags(options, builderOptions.argResults);
+ applyAnalysisOptionFlags(options, builderOptions.argResults,
+ verbosePrint: verbosePrint);
// If lints turned on but none specified, then enable default lints
if (options.lint && options.lintRules.isEmpty) {
options.lintRules = Registry.ruleRegistry.defaultRules;
+ verbose('Using default lint rules');
}
}
+ } else {
+ verbose('Using default analysis options');
}
return options;
}
diff --git a/pkg/analyzer/lib/src/dart/ast/ast.dart b/pkg/analyzer/lib/src/dart/ast/ast.dart
index c4a3177..0a364cf 100644
--- a/pkg/analyzer/lib/src/dart/ast/ast.dart
+++ b/pkg/analyzer/lib/src/dart/ast/ast.dart
@@ -4325,6 +4325,7 @@
/**
* The 'covariant' keyword, or `null` if the keyword was not used.
*/
+ @override
Token covariantKeyword;
/**
@@ -4351,8 +4352,13 @@
* corresponding attribute. The [staticKeyword] can be `null` if the field is
* not a static field.
*/
- FieldDeclarationImpl(CommentImpl comment, List<Annotation> metadata,
- this.staticKeyword, VariableDeclarationListImpl fieldList, this.semicolon)
+ FieldDeclarationImpl(
+ CommentImpl comment,
+ List<Annotation> metadata,
+ this.covariantKeyword,
+ this.staticKeyword,
+ VariableDeclarationListImpl fieldList,
+ this.semicolon)
: super(comment, metadata) {
_fieldList = _becomeParentOf(fieldList);
}
diff --git a/pkg/analyzer/lib/src/dart/ast/ast_factory.dart b/pkg/analyzer/lib/src/dart/ast/ast_factory.dart
index f7e92be..a3a09ee9 100644
--- a/pkg/analyzer/lib/src/dart/ast/ast_factory.dart
+++ b/pkg/analyzer/lib/src/dart/ast/ast_factory.dart
@@ -361,7 +361,18 @@
VariableDeclarationList fieldList,
Token semicolon) =>
new FieldDeclarationImpl(
- comment, metadata, staticKeyword, fieldList, semicolon);
+ comment, metadata, null, staticKeyword, fieldList, semicolon);
+
+ @override
+ FieldDeclaration fieldDeclaration2(
+ {Comment comment,
+ List<Annotation> metadata,
+ Token covariantKeyword,
+ Token staticKeyword,
+ @required VariableDeclarationList fieldList,
+ @required Token semicolon}) =>
+ new FieldDeclarationImpl(comment, metadata, covariantKeyword,
+ staticKeyword, fieldList, semicolon);
@override
FieldFormalParameter fieldFormalParameter(
diff --git a/pkg/analyzer/lib/src/dart/ast/utilities.dart b/pkg/analyzer/lib/src/dart/ast/utilities.dart
index 9e370a1..920e585 100644
--- a/pkg/analyzer/lib/src/dart/ast/utilities.dart
+++ b/pkg/analyzer/lib/src/dart/ast/utilities.dart
@@ -432,12 +432,13 @@
@override
FieldDeclaration visitFieldDeclaration(FieldDeclaration node) =>
- astFactory.fieldDeclaration(
- cloneNode(node.documentationComment),
- cloneNodeList(node.metadata),
- cloneToken(node.staticKeyword),
- cloneNode(node.fields),
- cloneToken(node.semicolon));
+ astFactory.fieldDeclaration2(
+ comment: cloneNode(node.documentationComment),
+ metadata: cloneNodeList(node.metadata),
+ covariantKeyword: cloneToken(node.covariantKeyword),
+ staticKeyword: cloneToken(node.staticKeyword),
+ fieldList: cloneNode(node.fields),
+ semicolon: cloneToken(node.semicolon));
@override
FieldFormalParameter visitFieldFormalParameter(FieldFormalParameter node) =>
@@ -3171,12 +3172,13 @@
@override
FieldDeclaration visitFieldDeclaration(FieldDeclaration node) =>
- astFactory.fieldDeclaration(
- _cloneNode(node.documentationComment),
- _cloneNodeList(node.metadata),
- _mapToken(node.staticKeyword),
- _cloneNode(node.fields),
- _mapToken(node.semicolon));
+ astFactory.fieldDeclaration2(
+ comment: _cloneNode(node.documentationComment),
+ metadata: _cloneNodeList(node.metadata),
+ covariantKeyword: _mapToken(node.covariantKeyword),
+ staticKeyword: _mapToken(node.staticKeyword),
+ fieldList: _cloneNode(node.fields),
+ semicolon: _mapToken(node.semicolon));
@override
FieldFormalParameter visitFieldFormalParameter(FieldFormalParameter node) =>
diff --git a/pkg/analyzer/lib/src/generated/parser.dart b/pkg/analyzer/lib/src/generated/parser.dart
index c785abe..1ccc89f 100644
--- a/pkg/analyzer/lib/src/generated/parser.dart
+++ b/pkg/analyzer/lib/src/generated/parser.dart
@@ -1338,15 +1338,13 @@
VariableDeclaration variable = astFactory.variableDeclaration(
createSyntheticIdentifier(), null, null);
List<VariableDeclaration> variables = <VariableDeclaration>[variable];
- FieldDeclarationImpl field = astFactory.fieldDeclaration(
- commentAndMetadata.comment,
- commentAndMetadata.metadata,
- null,
- astFactory.variableDeclarationList(
+ return astFactory.fieldDeclaration2(
+ comment: commentAndMetadata.comment,
+ metadata: commentAndMetadata.metadata,
+ covariantKeyword: modifiers.covariantKeyword,
+ fieldList: astFactory.variableDeclarationList(
null, null, keyword, null, variables),
- _expect(TokenType.SEMICOLON));
- field.covariantKeyword = modifiers.covariantKeyword;
- return field;
+ semicolon: _expect(TokenType.SEMICOLON));
}
_reportErrorForToken(
ParserErrorCode.EXPECTED_CLASS_MEMBER, _currentToken);
@@ -3584,14 +3582,13 @@
TypeAnnotation type) {
VariableDeclarationList fieldList =
parseVariableDeclarationListAfterType(null, keyword, type);
- FieldDeclarationImpl field = astFactory.fieldDeclaration(
- commentAndMetadata.comment,
- commentAndMetadata.metadata,
- staticKeyword,
- fieldList,
- _expect(TokenType.SEMICOLON));
- field.covariantKeyword = covariantKeyword;
- return field;
+ return astFactory.fieldDeclaration2(
+ comment: commentAndMetadata.comment,
+ metadata: commentAndMetadata.metadata,
+ covariantKeyword: covariantKeyword,
+ staticKeyword: staticKeyword,
+ fieldList: fieldList,
+ semicolon: _expect(TokenType.SEMICOLON));
}
/**
@@ -6360,11 +6357,6 @@
Expression selectorExpression = parseAssignableSelector(
expression, isOptional || (expression is PrefixedIdentifier));
if (identical(selectorExpression, expression)) {
- if (!isOptional && (expression is PrefixedIdentifier)) {
- PrefixedIdentifier identifier = expression as PrefixedIdentifier;
- expression = astFactory.propertyAccess(
- identifier.prefix, identifier.period, identifier.identifier);
- }
return expression;
}
expression = selectorExpression;
diff --git a/pkg/analyzer/lib/src/generated/testing/ast_test_factory.dart b/pkg/analyzer/lib/src/generated/testing/ast_test_factory.dart
index 2139d38..115bad5 100644
--- a/pkg/analyzer/lib/src/generated/testing/ast_test_factory.dart
+++ b/pkg/analyzer/lib/src/generated/testing/ast_test_factory.dart
@@ -471,12 +471,11 @@
static FieldDeclaration fieldDeclaration(bool isStatic, Keyword keyword,
TypeAnnotation type, List<VariableDeclaration> variables) =>
- astFactory.fieldDeclaration(
- null,
- null,
- isStatic ? TokenFactory.tokenFromKeyword(Keyword.STATIC) : null,
- variableDeclarationList(keyword, type, variables),
- TokenFactory.tokenFromType(TokenType.SEMICOLON));
+ astFactory.fieldDeclaration2(
+ staticKeyword:
+ isStatic ? TokenFactory.tokenFromKeyword(Keyword.STATIC) : null,
+ fieldList: variableDeclarationList(keyword, type, variables),
+ semicolon: TokenFactory.tokenFromType(TokenType.SEMICOLON));
static FieldDeclaration fieldDeclaration2(bool isStatic, Keyword keyword,
List<VariableDeclaration> variables) =>
@@ -485,16 +484,14 @@
static FieldFormalParameter fieldFormalParameter(
Keyword keyword, TypeAnnotation type, String identifier,
[FormalParameterList parameterList]) =>
- astFactory.fieldFormalParameter(
- null,
- null,
- keyword == null ? null : TokenFactory.tokenFromKeyword(keyword),
- type,
- TokenFactory.tokenFromKeyword(Keyword.THIS),
- TokenFactory.tokenFromType(TokenType.PERIOD),
- identifier3(identifier),
- null,
- parameterList);
+ astFactory.fieldFormalParameter2(
+ keyword:
+ keyword == null ? null : TokenFactory.tokenFromKeyword(keyword),
+ type: type,
+ thisKeyword: TokenFactory.tokenFromKeyword(Keyword.THIS),
+ period: TokenFactory.tokenFromType(TokenType.PERIOD),
+ identifier: identifier3(identifier),
+ parameters: parameterList);
static FieldFormalParameter fieldFormalParameter2(String identifier) =>
fieldFormalParameter(null, null, identifier);
@@ -610,8 +607,10 @@
static FunctionTypedFormalParameter functionTypedFormalParameter(
TypeAnnotation returnType, String identifier,
[List<FormalParameter> parameters]) =>
- astFactory.functionTypedFormalParameter(null, null, returnType,
- identifier3(identifier), null, formalParameterList(parameters));
+ astFactory.functionTypedFormalParameter2(
+ returnType: returnType,
+ identifier: identifier3(identifier),
+ parameters: formalParameterList(parameters));
static HideCombinator hideCombinator(List<SimpleIdentifier> identifiers) =>
astFactory.hideCombinator(
@@ -1066,12 +1065,11 @@
static SimpleFormalParameter simpleFormalParameter2(
Keyword keyword, TypeAnnotation type, String parameterName) =>
- astFactory.simpleFormalParameter(
- null,
- null,
- keyword == null ? null : TokenFactory.tokenFromKeyword(keyword),
- type,
- identifier3(parameterName));
+ astFactory.simpleFormalParameter2(
+ keyword:
+ keyword == null ? null : TokenFactory.tokenFromKeyword(keyword),
+ type: type,
+ identifier: identifier3(parameterName));
static SimpleFormalParameter simpleFormalParameter3(String parameterName) =>
simpleFormalParameter2(null, null, parameterName);
diff --git a/pkg/analyzer/test/generated/parser_fasta_test.dart b/pkg/analyzer/test/generated/parser_fasta_test.dart
index 0c99a09..eb8b5f9 100644
--- a/pkg/analyzer/test/generated/parser_fasta_test.dart
+++ b/pkg/analyzer/test/generated/parser_fasta_test.dart
@@ -3,6 +3,7 @@
// BSD-style license that can be found in the LICENSE file.
import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/token.dart' as analyzer;
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/error/error.dart';
import 'package:analyzer/src/generated/parser.dart' as analyzer;
@@ -25,6 +26,7 @@
defineReflectiveSuite(() {
defineReflectiveTests(ClassMemberParserTest_Fasta);
defineReflectiveTests(ComplexParserTest_Fasta);
+ defineReflectiveTests(ExpressionParserTest_Fasta);
defineReflectiveTests(FormalParameterParserTest_Fasta);
defineReflectiveTests(TopLevelParserTest_Fasta);
});
@@ -57,20 +59,6 @@
@override
@failingTest
- void test_parseAwaitExpression_asStatement_inAsync() {
- // TODO(paulberry): Add support for async
- super.test_parseAwaitExpression_asStatement_inAsync();
- }
-
- @override
- @failingTest
- void test_parseAwaitExpression_asStatement_inSync() {
- // TODO(paulberry): Add support for method declarations
- super.test_parseAwaitExpression_asStatement_inSync();
- }
-
- @override
- @failingTest
void test_parseClassMember_constructor_withInitializers() {
// TODO(paulberry): 'this' can't be used here.
super.test_parseClassMember_constructor_withInitializers();
@@ -78,55 +66,6 @@
@override
@failingTest
- void test_parseClassMember_field_covariant() {
- // TODO(paulberry): Unhandled event: Fields
- super.test_parseClassMember_field_covariant();
- }
-
- @override
- @failingTest
- void test_parseClassMember_field_instance_prefixedType() {
- // TODO(paulberry): Unhandled event: Fields
- super.test_parseClassMember_field_instance_prefixedType();
- }
-
- @override
- @failingTest
- void test_parseClassMember_field_namedGet() {
- // TODO(paulberry): Unhandled event: Fields
- super.test_parseClassMember_field_namedGet();
- }
-
- @override
- @failingTest
- void test_parseClassMember_field_namedOperator() {
- // TODO(paulberry): Unhandled event: Fields
- super.test_parseClassMember_field_namedOperator();
- }
-
- @override
- @failingTest
- void test_parseClassMember_field_namedOperator_withAssignment() {
- // TODO(paulberry): Unhandled event: Fields
- super.test_parseClassMember_field_namedOperator_withAssignment();
- }
-
- @override
- @failingTest
- void test_parseClassMember_field_namedSet() {
- // TODO(paulberry): Unhandled event: Fields
- super.test_parseClassMember_field_namedSet();
- }
-
- @override
- @failingTest
- void test_parseClassMember_field_static() {
- // TODO(paulberry): Unhandled event: Fields
- super.test_parseClassMember_field_static();
- }
-
- @override
- @failingTest
void test_parseClassMember_getter_functionType() {
// TODO(paulberry): InputError: ErrorKind.ExpectedFunctionBody {actual: get}
super.test_parseClassMember_getter_functionType();
@@ -134,27 +73,6 @@
@override
@failingTest
- void test_parseClassMember_getter_void() {
- // TODO(paulberry): Add support for method declarations
- super.test_parseClassMember_getter_void();
- }
-
- @override
- @failingTest
- void test_parseClassMember_method_external() {
- // TODO(paulberry): Add support for method declarations
- super.test_parseClassMember_method_external();
- }
-
- @override
- @failingTest
- void test_parseClassMember_method_external_withTypeAndArgs() {
- // TODO(paulberry): Add support for method declarations
- super.test_parseClassMember_method_external_withTypeAndArgs();
- }
-
- @override
- @failingTest
void test_parseClassMember_method_generic_comment_noReturnType() {
// TODO(paulberry): Fasta doesn't support generic comment syntax
super.test_parseClassMember_method_generic_comment_noReturnType();
@@ -183,69 +101,6 @@
@override
@failingTest
- void test_parseClassMember_method_generic_noReturnType() {
- // TODO(paulberry): Add support for method declarations
- super.test_parseClassMember_method_generic_noReturnType();
- }
-
- @override
- @failingTest
- void test_parseClassMember_method_generic_returnType() {
- // TODO(paulberry): Add support for method declarations
- super.test_parseClassMember_method_generic_returnType();
- }
-
- @override
- @failingTest
- void test_parseClassMember_method_generic_void() {
- // TODO(paulberry): Add support for method declarations
- super.test_parseClassMember_method_generic_void();
- }
-
- @override
- @failingTest
- void test_parseClassMember_method_get_noType() {
- // TODO(paulberry): Add support for method declarations
- super.test_parseClassMember_method_get_noType();
- }
-
- @override
- @failingTest
- void test_parseClassMember_method_get_type() {
- // TODO(paulberry): Add support for method declarations
- super.test_parseClassMember_method_get_type();
- }
-
- @override
- @failingTest
- void test_parseClassMember_method_get_void() {
- // TODO(paulberry): Add support for method declarations
- super.test_parseClassMember_method_get_void();
- }
-
- @override
- @failingTest
- void test_parseClassMember_method_operator_noType() {
- // TODO(paulberry): Add support for method declarations
- super.test_parseClassMember_method_operator_noType();
- }
-
- @override
- @failingTest
- void test_parseClassMember_method_operator_type() {
- // TODO(paulberry): Add support for method declarations
- super.test_parseClassMember_method_operator_type();
- }
-
- @override
- @failingTest
- void test_parseClassMember_method_operator_void() {
- // TODO(paulberry): Add support for method declarations
- super.test_parseClassMember_method_operator_void();
- }
-
- @override
- @failingTest
void test_parseClassMember_method_returnType_functionType() {
// TODO(paulberry): InputError: ErrorKind.ExpectedFunctionBody {actual: m}
super.test_parseClassMember_method_returnType_functionType();
@@ -253,41 +108,6 @@
@override
@failingTest
- void test_parseClassMember_method_returnType_parameterized() {
- // TODO(paulberry): Add support for method declarations
- super.test_parseClassMember_method_returnType_parameterized();
- }
-
- @override
- @failingTest
- void test_parseClassMember_method_set_noType() {
- // TODO(paulberry): Add support for method declarations
- super.test_parseClassMember_method_set_noType();
- }
-
- @override
- @failingTest
- void test_parseClassMember_method_set_type() {
- // TODO(paulberry): Add support for method declarations
- super.test_parseClassMember_method_set_type();
- }
-
- @override
- @failingTest
- void test_parseClassMember_method_set_void() {
- // TODO(paulberry): Add support for method declarations
- super.test_parseClassMember_method_set_void();
- }
-
- @override
- @failingTest
- void test_parseClassMember_method_trailing_commas() {
- // TODO(paulberry): Add support for method declarations
- super.test_parseClassMember_method_trailing_commas();
- }
-
- @override
- @failingTest
void test_parseClassMember_operator_functionType() {
// TODO(paulberry): InputError: ErrorKind.ExpectedFunctionBody {actual: operator}
super.test_parseClassMember_operator_functionType();
@@ -295,20 +115,6 @@
@override
@failingTest
- void test_parseClassMember_operator_index() {
- // TODO(paulberry): Unhandled event: OperatorName
- super.test_parseClassMember_operator_index();
- }
-
- @override
- @failingTest
- void test_parseClassMember_operator_indexAssign() {
- // TODO(paulberry): Unhandled event: OperatorName
- super.test_parseClassMember_operator_indexAssign();
- }
-
- @override
- @failingTest
void test_parseClassMember_redirectingFactory_const() {
// TODO(paulberry): Unhandled event: ConstructorReference
super.test_parseClassMember_redirectingFactory_const();
@@ -352,7 +158,7 @@
@override
@failingTest
void test_parseGetter_nonStatic() {
- // TODO(paulberry): Add support for method declarations
+ // TODO(paulberry): handle doc comments
super.test_parseGetter_nonStatic();
}
@@ -366,28 +172,28 @@
@override
@failingTest
void test_parseInitializedIdentifierList_type() {
- // TODO(paulberry): Unhandled event: Fields
+ // TODO(paulberry): handle doc comments
super.test_parseInitializedIdentifierList_type();
}
@override
@failingTest
void test_parseInitializedIdentifierList_var() {
- // TODO(paulberry): Unhandled event: Fields
+ // TODO(paulberry): handle doc comments
super.test_parseInitializedIdentifierList_var();
}
@override
@failingTest
void test_parseOperator() {
- // TODO(paulberry): Unhandled event: OperatorName
+ // TODO(paulberry): handle doc comments
super.test_parseOperator();
}
@override
@failingTest
void test_parseSetter_nonStatic() {
- // TODO(paulberry): Add support for method declarations
+ // TODO(paulberry): handle doc comments
super.test_parseSetter_nonStatic();
}
@@ -407,30 +213,6 @@
with ComplexParserTestMixin {
@override
@failingTest
- void test_additiveExpression_precedence_multiplicative_left_withSuper() {
- // TODO(paulberry,ahe): AstBuilder doesn't implement
- // handleSuperExpression().
- super.test_additiveExpression_precedence_multiplicative_left_withSuper();
- }
-
- @override
- @failingTest
- void test_additiveExpression_super() {
- // TODO(paulberry,ahe): AstBuilder doesn't implement
- // handleSuperExpression().
- super.test_additiveExpression_super();
- }
-
- @override
- @failingTest
- void test_assignableExpression_arguments_normal_chain() {
- // TODO(paulberry,ahe): AstBuilder.doInvocation doesn't handle receiver
- // other than SimpleIdentifier.
- super.test_assignableExpression_arguments_normal_chain();
- }
-
- @override
- @failingTest
void test_assignableExpression_arguments_normal_chain_typeArgumentComments() {
// TODO(paulberry,ahe): Fasta doesn't support generic method comment syntax.
super
@@ -447,46 +229,6 @@
@override
@failingTest
- void test_assignmentExpression_prefixedIdentifier() {
- // TODO(paulberry,ahe): Analyzer expects "x.y" to be parsed as a
- // PrefixedIdentifier, even if x is not a prefix.
- super.test_assignmentExpression_prefixedIdentifier();
- }
-
- @override
- @failingTest
- void test_assignmentExpression_propertyAccess() {
- // TODO(paulberry,ahe): AstBuilder doesn't implement
- // handleSuperExpression().
- super.test_assignmentExpression_propertyAccess();
- }
-
- @override
- @failingTest
- void test_bitwiseAndExpression_super() {
- // TODO(paulberry,ahe): AstBuilder doesn't implement
- // handleSuperExpression().
- super.test_bitwiseAndExpression_super();
- }
-
- @override
- @failingTest
- void test_bitwiseOrExpression_super() {
- // TODO(paulberry,ahe): AstBuilder doesn't implement
- // handleSuperExpression().
- super.test_bitwiseOrExpression_super();
- }
-
- @override
- @failingTest
- void test_bitwiseXorExpression_super() {
- // TODO(paulberry,ahe): AstBuilder doesn't implement
- // handleSuperExpression().
- super.test_bitwiseXorExpression_super();
- }
-
- @override
- @failingTest
void test_cascade_withAssignment() {
// TODO(paulberry,ahe): AstBuilder doesn't implement
// endConstructorReference().
@@ -509,13 +251,6 @@
@override
@failingTest
- void test_constructor_initializer_withParenthesizedExpression() {
- // TODO(paulberry): Implement parseCompilationUnitWithOptions
- super.test_constructor_initializer_withParenthesizedExpression();
- }
-
- @override
- @failingTest
void test_equalityExpression_normal() {
// TODO(paulberry,ahe): bad error recovery
super.test_equalityExpression_normal();
@@ -552,22 +287,6 @@
@override
@failingTest
- void test_multiplicativeExpression_super() {
- // TODO(paulberry,ahe): AstBuilder doesn't implement
- // handleSuperExpression().
- super.test_multiplicativeExpression_super();
- }
-
- @override
- @failingTest
- void test_shiftExpression_super() {
- // TODO(paulberry,ahe): AstBuilder doesn't implement
- // handleSuperExpression().
- super.test_shiftExpression_super();
- }
-
- @override
- @failingTest
void test_topLevelFunction_nestedGenericFunction() {
// TODO(paulberry): Implement parseCompilationUnitWithOptions
super.test_topLevelFunction_nestedGenericFunction();
@@ -604,6 +323,376 @@
}
/**
+ * Tests of the fasta parser based on [ExpressionParserTestMixin].
+ */
+@reflectiveTest
+class ExpressionParserTest_Fasta extends FastaParserTestCase
+ with ExpressionParserTestMixin {
+ @override
+ @failingTest
+ void
+ test_parseAssignableExpression_expression_args_dot_typeParameterComments() {
+ super
+ .test_parseAssignableExpression_expression_args_dot_typeParameterComments();
+ }
+
+ @override
+ @failingTest
+ void test_parseAssignableExpression_expression_args_dot_typeParameters() {
+ super.test_parseAssignableExpression_expression_args_dot_typeParameters();
+ }
+
+ @override
+ @failingTest
+ void
+ test_parseAssignableExpression_identifier_args_dot_typeParameterComments() {
+ super
+ .test_parseAssignableExpression_identifier_args_dot_typeParameterComments();
+ }
+
+ @override
+ @failingTest
+ void test_parseAwaitExpression() {
+ super.test_parseAwaitExpression();
+ }
+
+ @override
+ @failingTest
+ void test_parseCascadeSection_ia_typeArgumentComments() {
+ super.test_parseCascadeSection_ia_typeArgumentComments();
+ }
+
+ @override
+ @failingTest
+ void test_parseCascadeSection_ia_typeArguments() {
+ super.test_parseCascadeSection_ia_typeArguments();
+ }
+
+ @override
+ @failingTest
+ void test_parseCascadeSection_ii_typeArgumentComments() {
+ super.test_parseCascadeSection_ii_typeArgumentComments();
+ }
+
+ @override
+ @failingTest
+ void test_parseCascadeSection_p_assign_withCascade() {
+ super.test_parseCascadeSection_p_assign_withCascade();
+ }
+
+ @override
+ @failingTest
+ void test_parseCascadeSection_p_assign_withCascade_typeArgumentComments() {
+ super.test_parseCascadeSection_p_assign_withCascade_typeArgumentComments();
+ }
+
+ @override
+ @failingTest
+ void test_parseCascadeSection_p_assign_withCascade_typeArguments() {
+ super.test_parseCascadeSection_p_assign_withCascade_typeArguments();
+ }
+
+ @override
+ @failingTest
+ void test_parseCascadeSection_pa_typeArgumentComments() {
+ super.test_parseCascadeSection_pa_typeArgumentComments();
+ }
+
+ @override
+ @failingTest
+ void test_parseCascadeSection_paa_typeArgumentComments() {
+ super.test_parseCascadeSection_paa_typeArgumentComments();
+ }
+
+ @override
+ @failingTest
+ void test_parseCascadeSection_paa_typeArguments() {
+ super.test_parseCascadeSection_paa_typeArguments();
+ }
+
+ @override
+ @failingTest
+ void test_parseCascadeSection_paapaa_typeArgumentComments() {
+ super.test_parseCascadeSection_paapaa_typeArgumentComments();
+ }
+
+ @override
+ @failingTest
+ void test_parseCascadeSection_paapaa_typeArguments() {
+ super.test_parseCascadeSection_paapaa_typeArguments();
+ }
+
+ @override
+ @failingTest
+ void test_parseCascadeSection_pap_typeArgumentComments() {
+ super.test_parseCascadeSection_pap_typeArgumentComments();
+ }
+
+ @override
+ @failingTest
+ void test_parseConstExpression_instanceCreation() {
+ super.test_parseConstExpression_instanceCreation();
+ }
+
+ @override
+ @failingTest
+ void test_parseConstExpression_listLiteral_typed_genericComment() {
+ super.test_parseConstExpression_listLiteral_typed_genericComment();
+ }
+
+ @override
+ @failingTest
+ void test_parseConstExpression_mapLiteral_typed_genericComment() {
+ super.test_parseConstExpression_mapLiteral_typed_genericComment();
+ }
+
+ @override
+ @failingTest
+ void test_parseExpression_assign_compound() {
+ super.test_parseExpression_assign_compound();
+ }
+
+ @override
+ @failingTest
+ void test_parseExpression_superMethodInvocation_typeArgumentComments() {
+ super.test_parseExpression_superMethodInvocation_typeArgumentComments();
+ }
+
+ @override
+ @failingTest
+ void
+ test_parseExpressionWithoutCascade_superMethodInvocation_typeArgumentComments() {
+ super
+ .test_parseExpressionWithoutCascade_superMethodInvocation_typeArgumentComments();
+ }
+
+ @override
+ @failingTest
+ void test_parseFunctionExpression_typeParameterComments() {
+ super.test_parseFunctionExpression_typeParameterComments();
+ }
+
+ @override
+ @failingTest
+ void
+ test_parseInstanceCreationExpression_qualifiedType_named_typeParameterComment() {
+ super
+ .test_parseInstanceCreationExpression_qualifiedType_named_typeParameterComment();
+ }
+
+ @override
+ @failingTest
+ void
+ test_parseInstanceCreationExpression_qualifiedType_typeParameterComment() {
+ super
+ .test_parseInstanceCreationExpression_qualifiedType_typeParameterComment();
+ }
+
+ @override
+ @failingTest
+ void test_parseInstanceCreationExpression_type_named_typeParameterComment() {
+ super
+ .test_parseInstanceCreationExpression_type_named_typeParameterComment();
+ }
+
+ @override
+ @failingTest
+ void test_parseInstanceCreationExpression_type_typeParameterComment() {
+ super.test_parseInstanceCreationExpression_type_typeParameterComment();
+ }
+
+ @override
+ @failingTest
+ void test_parseInstanceCreationExpression_type_typeParameters_nullable() {
+ super.test_parseInstanceCreationExpression_type_typeParameters_nullable();
+ }
+
+ @override
+ @failingTest
+ void test_parseListLiteral_empty_oneToken() {
+ super.test_parseListLiteral_empty_oneToken();
+ }
+
+ @override
+ @failingTest
+ void test_parseListLiteral_empty_oneToken_withComment() {
+ super.test_parseListLiteral_empty_oneToken_withComment();
+ }
+
+ @override
+ @failingTest
+ void test_parseListLiteral_empty_twoTokens() {
+ super.test_parseListLiteral_empty_twoTokens();
+ }
+
+ @override
+ @failingTest
+ void test_parseListOrMapLiteral_list_noType() {
+ super.test_parseListOrMapLiteral_list_noType();
+ }
+
+ @override
+ @failingTest
+ void test_parseListOrMapLiteral_list_type() {
+ super.test_parseListOrMapLiteral_list_type();
+ }
+
+ @override
+ @failingTest
+ void test_parseListOrMapLiteral_map_noType() {
+ super.test_parseListOrMapLiteral_map_noType();
+ }
+
+ @override
+ @failingTest
+ void test_parseListOrMapLiteral_map_type() {
+ super.test_parseListOrMapLiteral_map_type();
+ }
+
+ @override
+ @failingTest
+ void test_parseMapLiteral_empty() {
+ super.test_parseMapLiteral_empty();
+ }
+
+ @override
+ @failingTest
+ void test_parseMapLiteral_multiple() {
+ super.test_parseMapLiteral_multiple();
+ }
+
+ @override
+ @failingTest
+ void test_parseMapLiteral_single() {
+ super.test_parseMapLiteral_single();
+ }
+
+ @override
+ @failingTest
+ void test_parseMapLiteralEntry_complex() {
+ super.test_parseMapLiteralEntry_complex();
+ }
+
+ @override
+ @failingTest
+ void test_parseMapLiteralEntry_int() {
+ super.test_parseMapLiteralEntry_int();
+ }
+
+ @override
+ @failingTest
+ void test_parseMapLiteralEntry_string() {
+ super.test_parseMapLiteralEntry_string();
+ }
+
+ @override
+ @failingTest
+ void
+ test_parsePostfixExpression_none_methodInvocation_question_dot_typeArgumentComments() {
+ super
+ .test_parsePostfixExpression_none_methodInvocation_question_dot_typeArgumentComments();
+ }
+
+ @override
+ @failingTest
+ void
+ test_parsePostfixExpression_none_methodInvocation_typeArgumentComments() {
+ super
+ .test_parsePostfixExpression_none_methodInvocation_typeArgumentComments();
+ }
+
+ @override
+ @failingTest
+ void test_parsePrimaryExpression_const() {
+ super.test_parsePrimaryExpression_const();
+ }
+
+ @override
+ @failingTest
+ void test_parsePrimaryExpression_listLiteral_typed_genericComment() {
+ super.test_parsePrimaryExpression_listLiteral_typed_genericComment();
+ }
+
+ @override
+ @failingTest
+ void test_parsePrimaryExpression_mapLiteral() {
+ super.test_parsePrimaryExpression_mapLiteral();
+ }
+
+ @override
+ @failingTest
+ void test_parsePrimaryExpression_mapLiteral_typed_genericComment() {
+ super.test_parsePrimaryExpression_mapLiteral_typed_genericComment();
+ }
+
+ @override
+ @failingTest
+ void test_parseRelationalExpression_as_functionType_noReturnType() {
+ super.test_parseRelationalExpression_as_functionType_noReturnType();
+ }
+
+ @override
+ @failingTest
+ void test_parseRelationalExpression_as_functionType_returnType() {
+ super.test_parseRelationalExpression_as_functionType_returnType();
+ }
+
+ @override
+ @failingTest
+ void test_parseRelationalExpression_as_nullable() {
+ super.test_parseRelationalExpression_as_nullable();
+ }
+
+ @override
+ @failingTest
+ void test_parseRelationalExpression_is_nullable() {
+ super.test_parseRelationalExpression_is_nullable();
+ }
+
+ @override
+ @failingTest
+ void test_parseRethrowExpression() {
+ super.test_parseRethrowExpression();
+ }
+
+ @override
+ @failingTest
+ void test_parseSuperConstructorInvocation_named() {
+ super.test_parseSuperConstructorInvocation_named();
+ }
+
+ @override
+ @failingTest
+ void test_parseSuperConstructorInvocation_unnamed() {
+ super.test_parseSuperConstructorInvocation_unnamed();
+ }
+
+ @override
+ @failingTest
+ void test_parseSymbolLiteral_operator() {
+ super.test_parseSymbolLiteral_operator();
+ }
+
+ @override
+ @failingTest
+ void test_parseSymbolLiteral_void() {
+ super.test_parseSymbolLiteral_void();
+ }
+
+ @override
+ @failingTest
+ void test_parseUnaryExpression_decrement_super() {
+ super.test_parseUnaryExpression_decrement_super();
+ }
+
+ @override
+ @failingTest
+ void test_parseUnaryExpression_decrement_super_withComment() {
+ super.test_parseUnaryExpression_decrement_super_withComment();
+ }
+}
+
+/**
* Implementation of [AbstractParserTestCase] specialized for testing the
* Fasta parser.
*/
@@ -677,6 +766,54 @@
}
@override
+ Expression parseAdditiveExpression(String code) {
+ return _parseExpression(code);
+ }
+
+ @override
+ Expression parseAssignableExpression(String code, bool primaryAllowed) {
+ return _parseExpression(code);
+ }
+
+ @override
+ Expression parseAssignableSelector(String code, bool optional,
+ {bool allowConditional: true}) {
+ if (optional) {
+ if (code.isEmpty) {
+ return _parseExpression('foo');
+ }
+ return _parseExpression('(foo)$code');
+ }
+ return _parseExpression('foo$code');
+ }
+
+ @override
+ AwaitExpression parseAwaitExpression(String code) {
+ return _parseExpression(code);
+ }
+
+ @override
+ Expression parseBitwiseAndExpression(String code) {
+ return _parseExpression(code);
+ }
+
+ @override
+ Expression parseBitwiseOrExpression(String code) {
+ return _parseExpression(code);
+ }
+
+ @override
+ Expression parseBitwiseXorExpression(String code) {
+ return _parseExpression(code);
+ }
+
+ @override
+ Expression parseCascadeSection(String code) {
+ var cascadeExpression = _parseExpression('null$code') as CascadeExpression;
+ return cascadeExpression.cascadeSections.single;
+ }
+
+ @override
CompilationUnit parseCompilationUnit(String source,
[List<ErrorCode> errorCodes = const <ErrorCode>[]]) {
return _runParser(source, (parser) => parser.parseUnit, errorCodes)
@@ -691,12 +828,27 @@
}
@override
+ ConditionalExpression parseConditionalExpression(String code) {
+ return _parseExpression(code);
+ }
+
+ @override
+ Expression parseConstExpression(String code) {
+ return _parseExpression(code);
+ }
+
+ @override
CompilationUnit parseDirectives(String source,
[List<ErrorCode> errorCodes = const <ErrorCode>[]]) {
return _runParser(source, (parser) => parser.parseUnit, errorCodes);
}
@override
+ BinaryExpression parseEqualityExpression(String code) {
+ return _parseExpression(code);
+ }
+
+ @override
Expression parseExpression(String source,
[List<ErrorCode> errorCodes = const <ErrorCode>[]]) {
return _runParser(source, (parser) => parser.parseExpression, errorCodes)
@@ -704,6 +856,16 @@
}
@override
+ List<Expression> parseExpressionList(String code) {
+ return (_parseExpression('[$code]') as ListLiteral).elements.toList();
+ }
+
+ @override
+ Expression parseExpressionWithoutCascade(String code) {
+ return _parseExpression(code);
+ }
+
+ @override
FormalParameter parseFormalParameter(String code, ParameterKind kind,
{List<ErrorCode> errorCodes: const <ErrorCode>[]}) {
String parametersCode;
@@ -743,6 +905,75 @@
}
@override
+ FunctionExpression parseFunctionExpression(String code) {
+ return _parseExpression(code);
+ }
+
+ @override
+ InstanceCreationExpression parseInstanceCreationExpression(
+ String code, analyzer.Token newToken) {
+ return _parseExpression('$newToken $code');
+ }
+
+ @override
+ ListLiteral parseListLiteral(
+ analyzer.Token token, String typeArgumentsCode, String code) {
+ String sc = '';
+ if (token != null) {
+ sc += token.lexeme + ' ';
+ }
+ if (typeArgumentsCode != null) {
+ sc += typeArgumentsCode;
+ }
+ sc += code;
+ return _parseExpression(sc);
+ }
+
+ @override
+ TypedLiteral parseListOrMapLiteral(analyzer.Token modifier, String code) {
+ return _parseExpression('$modifier $code');
+ }
+
+ @override
+ Expression parseLogicalAndExpression(String code) {
+ return _parseExpression(code);
+ }
+
+ @override
+ Expression parseLogicalOrExpression(String code) {
+ return _parseExpression(code);
+ }
+
+ @override
+ MapLiteral parseMapLiteral(
+ analyzer.Token token, String typeArgumentsCode, String code) {
+ String sc = '';
+ if (token != null) {
+ sc += token.lexeme + ' ';
+ }
+ if (typeArgumentsCode != null) {
+ sc += typeArgumentsCode;
+ }
+ sc += code;
+ return _parseExpression(sc);
+ }
+
+ @override
+ MapLiteralEntry parseMapLiteralEntry(String code) {
+ return (_parseExpression('{$code}') as MapLiteral).entries.single;
+ }
+
+ @override
+ Expression parseMultiplicativeExpression(String code) {
+ return _parseExpression(code);
+ }
+
+ @override
+ InstanceCreationExpression parseNewExpression(String code) {
+ return _parseExpression(code);
+ }
+
+ @override
NormalFormalParameter parseNormalFormalParameter(String code,
{bool inFunctionType: false,
List<ErrorCode> errorCodes: const <ErrorCode>[]}) {
@@ -752,6 +983,41 @@
}
@override
+ Expression parsePostfixExpression(String code) {
+ return _parseExpression(code);
+ }
+
+ @override
+ Identifier parsePrefixedIdentifier(String code) {
+ return _parseExpression(code);
+ }
+
+ @override
+ Expression parsePrimaryExpression(String code) {
+ return _parseExpression(code);
+ }
+
+ @override
+ Expression parseRelationalExpression(String code) {
+ return _parseExpression(code);
+ }
+
+ @override
+ RethrowExpression parseRethrowExpression(String code) {
+ return _parseExpression(code);
+ }
+
+ @override
+ BinaryExpression parseShiftExpression(String code) {
+ return _parseExpression(code);
+ }
+
+ @override
+ SimpleIdentifier parseSimpleIdentifier(String code) {
+ return _parseExpression(code);
+ }
+
+ @override
Statement parseStatement(String source,
[List<ErrorCode> errorCodes = const <ErrorCode>[],
bool enableLazyAssignmentOperators]) {
@@ -759,6 +1025,42 @@
as Statement;
}
+ @override
+ Expression parseStringLiteral(String code) {
+ return _parseExpression(code);
+ }
+
+ @override
+ SuperConstructorInvocation parseSuperConstructorInvocation(String code) {
+ // TODO(scheglov): implement parseSuperConstructorInvocation
+ throw new UnimplementedError();
+ }
+
+ @override
+ SymbolLiteral parseSymbolLiteral(String code) {
+ return _parseExpression(code);
+ }
+
+ @override
+ Expression parseThrowExpression(String code) {
+ return _parseExpression(code);
+ }
+
+ @override
+ Expression parseThrowExpressionWithoutCascade(String code) {
+ return _parseExpression(code);
+ }
+
+ @override
+ PrefixExpression parseUnaryExpression(String code) {
+ return _parseExpression(code);
+ }
+
+ Expression _parseExpression(String code) {
+ var statement = parseStatement('$code;') as ExpressionStatement;
+ return statement.expression;
+ }
+
Object _runParser(
String source, ParseFunction getParseFunction(fasta.Parser parser),
[List<ErrorCode> errorCodes = const <ErrorCode>[]]) {
@@ -1030,13 +1332,6 @@
@override
@failingTest
- void test_parseClassDeclaration_nonEmpty() {
- // TODO(paulberry): Unhandled event: NoFieldInitializer
- super.test_parseClassDeclaration_nonEmpty();
- }
-
- @override
- @failingTest
void test_parseClassDeclaration_typeAlias_withB() {
// TODO(paulberry,ahe): capture `with` token.
super.test_parseClassDeclaration_typeAlias_withB();
@@ -1044,13 +1339,6 @@
@override
@failingTest
- void test_parseCompilationUnit_abstractAsPrefix_parameterized() {
- // TODO(paulberry): Unhandled event: ConstructorReference
- super.test_parseCompilationUnit_abstractAsPrefix_parameterized();
- }
-
- @override
- @failingTest
void test_parseCompilationUnit_builtIn_asFunctionName() {
// TODO(paulberry,ahe): Fasta's parser is confused when one of the built-in
// identifiers `export`, `import`, `library`, `part`, or `typedef` appears
@@ -1081,13 +1369,6 @@
@override
@failingTest
- void test_parseCompilationUnit_operatorAsPrefix_parameterized() {
- // TODO(paulberry): Unhandled event: ConstructorReference
- super.test_parseCompilationUnit_operatorAsPrefix_parameterized();
- }
-
- @override
- @failingTest
void test_parseCompilationUnit_script() {
// TODO(paulberry): No objects placed on stack
super.test_parseCompilationUnit_script();
@@ -1102,13 +1383,6 @@
@override
@failingTest
- void test_parseCompilationUnitMember_abstractAsPrefix() {
- // TODO(paulberry): Unhandled event: ConstructorReference
- super.test_parseCompilationUnitMember_abstractAsPrefix();
- }
-
- @override
- @failingTest
void
test_parseCompilationUnitMember_function_generic_noReturnType_annotated() {
// TODO(paulberry,ahe): Fasta doesn't appear to support annotated type
diff --git a/pkg/analyzer/test/generated/parser_test.dart b/pkg/analyzer/test/generated/parser_test.dart
index ea1386c..dc25481 100644
--- a/pkg/analyzer/test/generated/parser_test.dart
+++ b/pkg/analyzer/test/generated/parser_test.dart
@@ -15,7 +15,6 @@
import 'package:analyzer/src/dart/scanner/scanner.dart';
import 'package:analyzer/src/generated/parser.dart';
import 'package:analyzer/src/generated/source.dart';
-import 'package:analyzer/src/generated/testing/ast_test_factory.dart';
import 'package:analyzer/src/generated/testing/token_factory.dart';
import 'package:analyzer/src/generated/utilities_dart.dart';
import 'package:test/test.dart';
@@ -79,6 +78,24 @@
*/
void createParser(String content);
+ Expression parseAdditiveExpression(String code);
+
+ Expression parseAssignableExpression(String code, bool primaryAllowed);
+
+ Expression parseAssignableSelector(
+ String code, bool optional,
+ {bool allowConditional: true});
+
+ AwaitExpression parseAwaitExpression(String code);
+
+ Expression parseBitwiseAndExpression(String code);
+
+ Expression parseBitwiseOrExpression(String code);
+
+ Expression parseBitwiseXorExpression(String code);
+
+ Expression parseCascadeSection(String code);
+
CompilationUnit parseCompilationUnit(String source,
[List<ErrorCode> errorCodes = const <ErrorCode>[]]);
@@ -86,6 +103,10 @@
CompilationUnit parseCompilationUnitWithOptions(String source,
[List<ErrorCode> errorCodes = const <ErrorCode>[]]);
+ ConditionalExpression parseConditionalExpression(String code);
+
+ Expression parseConstExpression(String code);
+
/**
* Parse the given source as a compilation unit.
*
@@ -98,9 +119,15 @@
CompilationUnit parseDirectives(String source,
[List<ErrorCode> errorCodes = const <ErrorCode>[]]);
+ BinaryExpression parseEqualityExpression(String code);
+
Expression parseExpression(String source,
[List<ErrorCode> errorCodes = const <ErrorCode>[]]);
+ List<Expression> parseExpressionList(String code);
+
+ Expression parseExpressionWithoutCascade(String code);
+
FormalParameter parseFormalParameter(String code, ParameterKind kind,
{List<ErrorCode> errorCodes: const <ErrorCode>[]});
@@ -120,12 +147,61 @@
*/
Directive parseFullDirective();
+ FunctionExpression parseFunctionExpression(String code);
+
+ InstanceCreationExpression parseInstanceCreationExpression(
+ String code, Token newToken);
+
+ ListLiteral parseListLiteral(
+ Token token, String typeArgumentsCode, String code);
+
+ TypedLiteral parseListOrMapLiteral(Token modifier, String code);
+
+ Expression parseLogicalAndExpression(String code);
+
+ Expression parseLogicalOrExpression(String code);
+
+ MapLiteral parseMapLiteral(
+ Token token, String typeArgumentsCode, String code);
+
+ MapLiteralEntry parseMapLiteralEntry(String code);
+
+ Expression parseMultiplicativeExpression(String code);
+
+ InstanceCreationExpression parseNewExpression(String code);
+
NormalFormalParameter parseNormalFormalParameter(String code,
{bool inFunctionType: false});
+ Expression parsePostfixExpression(String code);
+
+ Identifier parsePrefixedIdentifier(String code);
+
+ Expression parsePrimaryExpression(String code);
+
+ Expression parseRelationalExpression(String code);
+
+ RethrowExpression parseRethrowExpression(String code);
+
+ BinaryExpression parseShiftExpression(String code);
+
+ SimpleIdentifier parseSimpleIdentifier(String code);
+
Statement parseStatement(String source,
[List<ErrorCode> errorCodes = const <ErrorCode>[],
bool enableLazyAssignmentOperators]);
+
+ Expression parseStringLiteral(String code);
+
+ SuperConstructorInvocation parseSuperConstructorInvocation(String code);
+
+ SymbolLiteral parseSymbolLiteral(String code);
+
+ Expression parseThrowExpression(String code);
+
+ Expression parseThrowExpressionWithoutCascade(String code);
+
+ PrefixExpression parseUnaryExpression(String code);
}
/**
@@ -2194,8 +2270,7 @@
// literals that are being created are not always zero length (because they
// could have type parameters), which violates the contract of
// isSynthetic().
- createParser('1');
- TypedLiteral literal = parser.parseListOrMapLiteral(null);
+ TypedLiteral literal = parseListOrMapLiteral(null, '1');
expectNotNullIfNoErrors(literal);
listener
.assertErrorsWithCodes([ParserErrorCode.EXPECTED_LIST_OR_MAP_LITERAL]);
@@ -2693,16 +2768,14 @@
}
void test_invalidOperatorAfterSuper_assignableExpression() {
- createParser('super?.v');
- Expression expression = parser.parseAssignableExpression(false);
+ Expression expression = parseAssignableExpression('super?.v', false);
expectNotNullIfNoErrors(expression);
listener
.assertErrorsWithCodes([ParserErrorCode.INVALID_OPERATOR_FOR_SUPER]);
}
void test_invalidOperatorAfterSuper_primaryExpression() {
- createParser('super?.v');
- Expression expression = parser.parsePrimaryExpression();
+ Expression expression = parsePrimaryExpression('super?.v');
expectNotNullIfNoErrors(expression);
listener
.assertErrorsWithCodes([ParserErrorCode.INVALID_OPERATOR_FOR_SUPER]);
@@ -2731,43 +2804,37 @@
}
void test_invalidUnicodeEscape_incomplete_noDigits() {
- createParser("'\\u{'");
- Expression expression = parser.parseStringLiteral();
+ Expression expression = parseStringLiteral("'\\u{'");
expectNotNullIfNoErrors(expression);
listener.assertErrorsWithCodes([ParserErrorCode.INVALID_UNICODE_ESCAPE]);
}
void test_invalidUnicodeEscape_incomplete_someDigits() {
- createParser("'\\u{0A'");
- Expression expression = parser.parseStringLiteral();
+ Expression expression = parseStringLiteral("'\\u{0A'");
expectNotNullIfNoErrors(expression);
listener.assertErrorsWithCodes([ParserErrorCode.INVALID_UNICODE_ESCAPE]);
}
void test_invalidUnicodeEscape_invalidDigit() {
- createParser("'\\u0 a'");
- Expression expression = parser.parseStringLiteral();
+ Expression expression = parseStringLiteral("'\\u0 a'");
expectNotNullIfNoErrors(expression);
listener.assertErrorsWithCodes([ParserErrorCode.INVALID_UNICODE_ESCAPE]);
}
void test_invalidUnicodeEscape_tooFewDigits_fixed() {
- createParser("'\\u04'");
- Expression expression = parser.parseStringLiteral();
+ Expression expression = parseStringLiteral("'\\u04'");
expectNotNullIfNoErrors(expression);
listener.assertErrorsWithCodes([ParserErrorCode.INVALID_UNICODE_ESCAPE]);
}
void test_invalidUnicodeEscape_tooFewDigits_variable() {
- createParser("'\\u{}'");
- Expression expression = parser.parseStringLiteral();
+ Expression expression = parseStringLiteral("'\\u{}'");
expectNotNullIfNoErrors(expression);
listener.assertErrorsWithCodes([ParserErrorCode.INVALID_UNICODE_ESCAPE]);
}
void test_invalidUnicodeEscape_tooManyDigits_variable() {
- createParser("'\\u{12345678}'");
- Expression expression = parser.parseStringLiteral();
+ Expression expression = parseStringLiteral("'\\u{12345678}'");
expectNotNullIfNoErrors(expression);
listener.assertErrorsWithCodes([
ParserErrorCode.INVALID_UNICODE_ESCAPE,
@@ -3072,15 +3139,13 @@
}
void test_missingIdentifier_inSymbol_afterPeriod() {
- createParser('#a.');
- SymbolLiteral literal = parser.parseSymbolLiteral();
+ SymbolLiteral literal = parseSymbolLiteral('#a.');
expectNotNullIfNoErrors(literal);
listener.assertErrorsWithCodes([ParserErrorCode.MISSING_IDENTIFIER]);
}
void test_missingIdentifier_inSymbol_first() {
- createParser('#');
- SymbolLiteral literal = parser.parseSymbolLiteral();
+ SymbolLiteral literal = parseSymbolLiteral('#');
expectNotNullIfNoErrors(literal);
listener.assertErrorsWithCodes([ParserErrorCode.MISSING_IDENTIFIER]);
}
@@ -3316,8 +3381,7 @@
@failingTest
void test_namedFunctionExpression() {
- createParser('f() {}');
- Expression expression = parser.parsePrimaryExpression();
+ Expression expression = parsePrimaryExpression('f() {}');
expectNotNullIfNoErrors(expression);
listener.assertErrorsWithCodes([ParserErrorCode.NAMED_FUNCTION_EXPRESSION]);
expect(expression, new isInstanceOf<FunctionExpression>());
@@ -3802,8 +3866,7 @@
Expression expression = parser.parseUnaryExpression();
expectNotNullIfNoErrors(expression);
listener.assertErrorsWithCodes([ParserErrorCode.MISSING_IDENTIFIER]);
- expect(expression, new isInstanceOf<SimpleIdentifier>());
- SimpleIdentifier identifier = expression;
+ var identifier = expression as SimpleIdentifier;
expect(identifier.isSynthetic, isTrue);
}
@@ -3956,12 +4019,10 @@
abstract class ExpressionParserTestMixin implements AbstractParserTestCase {
void test_parseAdditiveExpression_normal() {
- createParser('x + y');
- Expression expression = parser.parseAdditiveExpression();
+ Expression expression = parseAdditiveExpression('x + y');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<BinaryExpression>());
- BinaryExpression binaryExpression = expression;
+ var binaryExpression = expression as BinaryExpression;
expect(binaryExpression.leftOperand, isNotNull);
expect(binaryExpression.operator, isNotNull);
expect(binaryExpression.operator.type, TokenType.PLUS);
@@ -3969,12 +4030,10 @@
}
void test_parseAdditiveExpression_super() {
- createParser('super + y');
- Expression expression = parser.parseAdditiveExpression();
+ Expression expression = parseAdditiveExpression('super + y');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<BinaryExpression>());
- BinaryExpression binaryExpression = expression;
+ var binaryExpression = expression as BinaryExpression;
expect(binaryExpression.leftOperand, new isInstanceOf<SuperExpression>());
expect(binaryExpression.operator, isNotNull);
expect(binaryExpression.operator.type, TokenType.PLUS);
@@ -3982,12 +4041,10 @@
}
void test_parseAssignableExpression_expression_args_dot() {
- createParser('(x)(y).z');
- Expression expression = parser.parseAssignableExpression(false);
+ Expression expression = parseAssignableExpression('(x)(y).z', false);
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<PropertyAccess>());
- PropertyAccess propertyAccess = expression;
+ var propertyAccess = expression as PropertyAccess;
FunctionExpressionInvocation invocation =
propertyAccess.target as FunctionExpressionInvocation;
expect(invocation.function, isNotNull);
@@ -4002,12 +4059,10 @@
void
test_parseAssignableExpression_expression_args_dot_typeParameterComments() {
enableGenericMethodComments = true;
- createParser('(x)/*<F>*/(y).z');
- Expression expression = parser.parseAssignableExpression(false);
+ Expression expression = parseAssignableExpression('(x)/*<F>*/(y).z', false);
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<PropertyAccess>());
- PropertyAccess propertyAccess = expression;
+ var propertyAccess = expression as PropertyAccess;
FunctionExpressionInvocation invocation =
propertyAccess.target as FunctionExpressionInvocation;
expect(invocation.function, isNotNull);
@@ -4020,12 +4075,10 @@
}
void test_parseAssignableExpression_expression_args_dot_typeParameters() {
- createParser('(x)<F>(y).z');
- Expression expression = parser.parseAssignableExpression(false);
+ Expression expression = parseAssignableExpression('(x)<F>(y).z', false);
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<PropertyAccess>());
- PropertyAccess propertyAccess = expression;
+ var propertyAccess = expression as PropertyAccess;
FunctionExpressionInvocation invocation =
propertyAccess.target as FunctionExpressionInvocation;
expect(invocation.function, isNotNull);
@@ -4038,24 +4091,20 @@
}
void test_parseAssignableExpression_expression_dot() {
- createParser('(x).y');
- Expression expression = parser.parseAssignableExpression(false);
+ Expression expression = parseAssignableExpression('(x).y', false);
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<PropertyAccess>());
- PropertyAccess propertyAccess = expression;
+ var propertyAccess = expression as PropertyAccess;
expect(propertyAccess.target, isNotNull);
expect(propertyAccess.operator.type, TokenType.PERIOD);
expect(propertyAccess.propertyName, isNotNull);
}
void test_parseAssignableExpression_expression_index() {
- createParser('(x)[y]');
- Expression expression = parser.parseAssignableExpression(false);
+ Expression expression = parseAssignableExpression('(x)[y]', false);
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<IndexExpression>());
- IndexExpression indexExpression = expression;
+ var indexExpression = expression as IndexExpression;
expect(indexExpression.target, isNotNull);
expect(indexExpression.leftBracket, isNotNull);
expect(indexExpression.index, isNotNull);
@@ -4063,34 +4112,28 @@
}
void test_parseAssignableExpression_expression_question_dot() {
- createParser('(x)?.y');
- Expression expression = parser.parseAssignableExpression(false);
+ Expression expression = parseAssignableExpression('(x)?.y', false);
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<PropertyAccess>());
- PropertyAccess propertyAccess = expression;
+ var propertyAccess = expression as PropertyAccess;
expect(propertyAccess.target, isNotNull);
expect(propertyAccess.operator.type, TokenType.QUESTION_PERIOD);
expect(propertyAccess.propertyName, isNotNull);
}
void test_parseAssignableExpression_identifier() {
- createParser('x');
- Expression expression = parser.parseAssignableExpression(false);
+ Expression expression = parseAssignableExpression('x', false);
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<SimpleIdentifier>());
- SimpleIdentifier identifier = expression;
+ var identifier = expression as SimpleIdentifier;
expect(identifier, isNotNull);
}
void test_parseAssignableExpression_identifier_args_dot() {
- createParser('x(y).z');
- Expression expression = parser.parseAssignableExpression(false);
+ Expression expression = parseAssignableExpression('x(y).z', false);
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<PropertyAccess>());
- PropertyAccess propertyAccess = expression;
+ var propertyAccess = expression as PropertyAccess;
MethodInvocation invocation = propertyAccess.target as MethodInvocation;
expect(invocation.methodName.name, "x");
expect(invocation.typeArguments, isNull);
@@ -4104,12 +4147,10 @@
void
test_parseAssignableExpression_identifier_args_dot_typeParameterComments() {
enableGenericMethodComments = true;
- createParser('x/*<E>*/(y).z');
- Expression expression = parser.parseAssignableExpression(false);
+ Expression expression = parseAssignableExpression('x/*<E>*/(y).z', false);
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<PropertyAccess>());
- PropertyAccess propertyAccess = expression;
+ var propertyAccess = expression as PropertyAccess;
MethodInvocation invocation = propertyAccess.target as MethodInvocation;
expect(invocation.methodName.name, "x");
expect(invocation.typeArguments, isNotNull);
@@ -4121,12 +4162,10 @@
}
void test_parseAssignableExpression_identifier_args_dot_typeParameters() {
- createParser('x<E>(y).z');
- Expression expression = parser.parseAssignableExpression(false);
+ Expression expression = parseAssignableExpression('x<E>(y).z', false);
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<PropertyAccess>());
- PropertyAccess propertyAccess = expression;
+ var propertyAccess = expression as PropertyAccess;
MethodInvocation invocation = propertyAccess.target as MethodInvocation;
expect(invocation.methodName.name, "x");
expect(invocation.typeArguments, isNotNull);
@@ -4138,25 +4177,21 @@
}
void test_parseAssignableExpression_identifier_dot() {
- createParser('x.y');
- Expression expression = parser.parseAssignableExpression(false);
+ Expression expression = parseAssignableExpression('x.y', false);
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<PropertyAccess>());
- PropertyAccess propertyAccess = expression;
- expect(propertyAccess.target, isNotNull);
- expect(propertyAccess.operator, isNotNull);
- expect(propertyAccess.operator.type, TokenType.PERIOD);
- expect(propertyAccess.propertyName, isNotNull);
+ var identifier = expression as PrefixedIdentifier;
+ expect(identifier.prefix.name, 'x');
+ expect(identifier.period, isNotNull);
+ expect(identifier.period.type, TokenType.PERIOD);
+ expect(identifier.identifier.name, 'y');
}
void test_parseAssignableExpression_identifier_index() {
- createParser('x[y]');
- Expression expression = parser.parseAssignableExpression(false);
+ Expression expression = parseAssignableExpression('x[y]', false);
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<IndexExpression>());
- IndexExpression indexExpression = expression;
+ var indexExpression = expression as IndexExpression;
expect(indexExpression.target, isNotNull);
expect(indexExpression.leftBracket, isNotNull);
expect(indexExpression.index, isNotNull);
@@ -4164,24 +4199,20 @@
}
void test_parseAssignableExpression_identifier_question_dot() {
- createParser('x?.y');
- Expression expression = parser.parseAssignableExpression(false);
+ Expression expression = parseAssignableExpression('x?.y', false);
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<PropertyAccess>());
- PropertyAccess propertyAccess = expression;
+ var propertyAccess = expression as PropertyAccess;
expect(propertyAccess.target, isNotNull);
expect(propertyAccess.operator.type, TokenType.QUESTION_PERIOD);
expect(propertyAccess.propertyName, isNotNull);
}
void test_parseAssignableExpression_super_dot() {
- createParser('super.y');
- Expression expression = parser.parseAssignableExpression(false);
+ Expression expression = parseAssignableExpression('super.y', false);
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<PropertyAccess>());
- PropertyAccess propertyAccess = expression;
+ var propertyAccess = expression as PropertyAccess;
EngineTestCase.assertInstanceOf((obj) => obj is SuperExpression,
SuperExpression, propertyAccess.target);
expect(propertyAccess.operator, isNotNull);
@@ -4189,12 +4220,10 @@
}
void test_parseAssignableExpression_super_index() {
- createParser('super[y]');
- Expression expression = parser.parseAssignableExpression(false);
+ Expression expression = parseAssignableExpression('super[y]', false);
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<IndexExpression>());
- IndexExpression indexExpression = expression;
+ var indexExpression = expression as IndexExpression;
expect(indexExpression.target, new isInstanceOf<SuperExpression>());
expect(indexExpression.leftBracket, isNotNull);
expect(indexExpression.index, isNotNull);
@@ -4202,53 +4231,43 @@
}
void test_parseAssignableSelector_dot() {
- createParser('.x');
- Expression expression = parser.parseAssignableSelector(null, true);
+ Expression expression = parseAssignableSelector('.x', true);
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<PropertyAccess>());
- PropertyAccess propertyAccess = expression;
+ var propertyAccess = expression as PropertyAccess;
expect(propertyAccess.operator.type, TokenType.PERIOD);
expect(propertyAccess.propertyName, isNotNull);
}
void test_parseAssignableSelector_index() {
- createParser('[x]');
- Expression expression = parser.parseAssignableSelector(null, true);
+ Expression expression = parseAssignableSelector('[x]', true);
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<IndexExpression>());
- IndexExpression indexExpression = expression;
+ var indexExpression = expression as IndexExpression;
expect(indexExpression.leftBracket, isNotNull);
expect(indexExpression.index, isNotNull);
expect(indexExpression.rightBracket, isNotNull);
}
void test_parseAssignableSelector_none() {
- createParser(';');
- Expression expression =
- parser.parseAssignableSelector(astFactory.simpleIdentifier(null), true);
+ Expression expression = parseAssignableSelector('', true);
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<SimpleIdentifier>());
- SimpleIdentifier identifier = expression;
+ var identifier = expression as SimpleIdentifier;
expect(identifier, isNotNull);
}
void test_parseAssignableSelector_question_dot() {
- createParser('?.x');
- Expression expression = parser.parseAssignableSelector(null, true);
+ Expression expression = parseAssignableSelector('?.x', true);
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<PropertyAccess>());
- PropertyAccess propertyAccess = expression;
+ var propertyAccess = expression as PropertyAccess;
expect(propertyAccess.operator.type, TokenType.QUESTION_PERIOD);
expect(propertyAccess.propertyName, isNotNull);
}
void test_parseAwaitExpression() {
- createParser('await x;');
- AwaitExpression expression = parser.parseAwaitExpression();
+ AwaitExpression expression = parseAwaitExpression('await x;');
expect(expression, isNotNull);
assertNoErrors();
expect(expression.awaitKeyword, isNotNull);
@@ -4256,12 +4275,10 @@
}
void test_parseBitwiseAndExpression_normal() {
- createParser('x & y');
- Expression expression = parser.parseBitwiseAndExpression();
+ Expression expression = parseBitwiseAndExpression('x & y');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<BinaryExpression>());
- BinaryExpression binaryExpression = expression;
+ var binaryExpression = expression as BinaryExpression;
expect(binaryExpression.leftOperand, isNotNull);
expect(binaryExpression.operator, isNotNull);
expect(binaryExpression.operator.type, TokenType.AMPERSAND);
@@ -4269,12 +4286,10 @@
}
void test_parseBitwiseAndExpression_super() {
- createParser('super & y');
- Expression expression = parser.parseBitwiseAndExpression();
+ Expression expression = parseBitwiseAndExpression('super & y');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<BinaryExpression>());
- BinaryExpression binaryExpression = expression;
+ var binaryExpression = expression as BinaryExpression;
expect(binaryExpression.leftOperand, new isInstanceOf<SuperExpression>());
expect(binaryExpression.operator, isNotNull);
expect(binaryExpression.operator.type, TokenType.AMPERSAND);
@@ -4282,12 +4297,10 @@
}
void test_parseBitwiseOrExpression_normal() {
- createParser('x | y');
- Expression expression = parser.parseBitwiseOrExpression();
+ Expression expression = parseBitwiseOrExpression('x | y');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<BinaryExpression>());
- BinaryExpression binaryExpression = expression;
+ var binaryExpression = expression as BinaryExpression;
expect(binaryExpression.leftOperand, isNotNull);
expect(binaryExpression.operator, isNotNull);
expect(binaryExpression.operator.type, TokenType.BAR);
@@ -4295,12 +4308,10 @@
}
void test_parseBitwiseOrExpression_super() {
- createParser('super | y');
- Expression expression = parser.parseBitwiseOrExpression();
+ Expression expression = parseBitwiseOrExpression('super | y');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<BinaryExpression>());
- BinaryExpression binaryExpression = expression;
+ var binaryExpression = expression as BinaryExpression;
expect(binaryExpression.leftOperand, new isInstanceOf<SuperExpression>());
expect(binaryExpression.operator, isNotNull);
expect(binaryExpression.operator.type, TokenType.BAR);
@@ -4308,12 +4319,10 @@
}
void test_parseBitwiseXorExpression_normal() {
- createParser('x ^ y');
- Expression expression = parser.parseBitwiseXorExpression();
+ Expression expression = parseBitwiseXorExpression('x ^ y');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<BinaryExpression>());
- BinaryExpression binaryExpression = expression;
+ var binaryExpression = expression as BinaryExpression;
expect(binaryExpression.leftOperand, isNotNull);
expect(binaryExpression.operator, isNotNull);
expect(binaryExpression.operator.type, TokenType.CARET);
@@ -4321,12 +4330,10 @@
}
void test_parseBitwiseXorExpression_super() {
- createParser('super ^ y');
- Expression expression = parser.parseBitwiseXorExpression();
+ Expression expression = parseBitwiseXorExpression('super ^ y');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<BinaryExpression>());
- BinaryExpression binaryExpression = expression;
+ var binaryExpression = expression as BinaryExpression;
expect(binaryExpression.leftOperand, new isInstanceOf<SuperExpression>());
expect(binaryExpression.operator, isNotNull);
expect(binaryExpression.operator.type, TokenType.CARET);
@@ -4334,12 +4341,10 @@
}
void test_parseCascadeSection_i() {
- createParser('..[i]');
- Expression expression = parser.parseCascadeSection();
+ Expression expression = parseCascadeSection('..[i]');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<IndexExpression>());
- IndexExpression section = expression;
+ var section = expression as IndexExpression;
expect(section.target, isNull);
expect(section.leftBracket, isNotNull);
expect(section.index, isNotNull);
@@ -4347,12 +4352,10 @@
}
void test_parseCascadeSection_ia() {
- createParser('..[i](b)');
- Expression expression = parser.parseCascadeSection();
+ Expression expression = parseCascadeSection('..[i](b)');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<FunctionExpressionInvocation>());
- FunctionExpressionInvocation section = expression;
+ var section = expression as FunctionExpressionInvocation;
expect(section.function, new isInstanceOf<IndexExpression>());
expect(section.typeArguments, isNull);
expect(section.argumentList, isNotNull);
@@ -4360,36 +4363,30 @@
void test_parseCascadeSection_ia_typeArgumentComments() {
enableGenericMethodComments = true;
- createParser('..[i]/*<E>*/(b)');
- Expression expression = parser.parseCascadeSection();
+ Expression expression = parseCascadeSection('..[i]/*<E>*/(b)');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<FunctionExpressionInvocation>());
- FunctionExpressionInvocation section = expression;
+ var section = expression as FunctionExpressionInvocation;
expect(section.function, new isInstanceOf<IndexExpression>());
expect(section.typeArguments, isNotNull);
expect(section.argumentList, isNotNull);
}
void test_parseCascadeSection_ia_typeArguments() {
- createParser('..[i]<E>(b)');
- Expression expression = parser.parseCascadeSection();
+ Expression expression = parseCascadeSection('..[i]<E>(b)');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<FunctionExpressionInvocation>());
- FunctionExpressionInvocation section = expression;
+ var section = expression as FunctionExpressionInvocation;
expect(section.function, new isInstanceOf<IndexExpression>());
expect(section.typeArguments, isNotNull);
expect(section.argumentList, isNotNull);
}
void test_parseCascadeSection_ii() {
- createParser('..a(b).c(d)');
- Expression expression = parser.parseCascadeSection();
+ Expression expression = parseCascadeSection('..a(b).c(d)');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<MethodInvocation>());
- MethodInvocation section = expression;
+ var section = expression as MethodInvocation;
expect(section.target, new isInstanceOf<MethodInvocation>());
expect(section.operator, isNotNull);
expect(section.methodName, isNotNull);
@@ -4400,12 +4397,10 @@
void test_parseCascadeSection_ii_typeArgumentComments() {
enableGenericMethodComments = true;
- createParser('..a/*<E>*/(b).c/*<F>*/(d)');
- Expression expression = parser.parseCascadeSection();
+ Expression expression = parseCascadeSection('..a/*<E>*/(b).c/*<F>*/(d)');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<MethodInvocation>());
- MethodInvocation section = expression;
+ var section = expression as MethodInvocation;
expect(section.target, new isInstanceOf<MethodInvocation>());
expect(section.operator, isNotNull);
expect(section.methodName, isNotNull);
@@ -4415,12 +4410,10 @@
}
void test_parseCascadeSection_ii_typeArguments() {
- createParser('..a<E>(b).c<F>(d)');
- Expression expression = parser.parseCascadeSection();
+ Expression expression = parseCascadeSection('..a<E>(b).c<F>(d)');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<MethodInvocation>());
- MethodInvocation section = expression;
+ var section = expression as MethodInvocation;
expect(section.target, new isInstanceOf<MethodInvocation>());
expect(section.operator, isNotNull);
expect(section.methodName, isNotNull);
@@ -4430,24 +4423,20 @@
}
void test_parseCascadeSection_p() {
- createParser('..a');
- Expression expression = parser.parseCascadeSection();
+ Expression expression = parseCascadeSection('..a');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<PropertyAccess>());
- PropertyAccess section = expression;
+ var section = expression as PropertyAccess;
expect(section.target, isNull);
expect(section.operator, isNotNull);
expect(section.propertyName, isNotNull);
}
void test_parseCascadeSection_p_assign() {
- createParser('..a = 3');
- Expression expression = parser.parseCascadeSection();
+ Expression expression = parseCascadeSection('..a = 3');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<AssignmentExpression>());
- AssignmentExpression section = expression;
+ var section = expression as AssignmentExpression;
expect(section.leftHandSide, isNotNull);
expect(section.operator, isNotNull);
Expression rhs = section.rightHandSide;
@@ -4455,12 +4444,10 @@
}
void test_parseCascadeSection_p_assign_withCascade() {
- createParser('..a = 3..m()');
- Expression expression = parser.parseCascadeSection();
+ Expression expression = parseCascadeSection('..a = 3..m()');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<AssignmentExpression>());
- AssignmentExpression section = expression;
+ var section = expression as AssignmentExpression;
expect(section.leftHandSide, isNotNull);
expect(section.operator, isNotNull);
Expression rhs = section.rightHandSide;
@@ -4470,12 +4457,10 @@
void test_parseCascadeSection_p_assign_withCascade_typeArgumentComments() {
enableGenericMethodComments = true;
- createParser('..a = 3..m/*<E>*/()');
- Expression expression = parser.parseCascadeSection();
+ Expression expression = parseCascadeSection('..a = 3..m/*<E>*/()');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<AssignmentExpression>());
- AssignmentExpression section = expression;
+ var section = expression as AssignmentExpression;
expect(section.leftHandSide, isNotNull);
expect(section.operator, isNotNull);
Expression rhs = section.rightHandSide;
@@ -4484,12 +4469,10 @@
}
void test_parseCascadeSection_p_assign_withCascade_typeArguments() {
- createParser('..a = 3..m<E>()');
- Expression expression = parser.parseCascadeSection();
+ Expression expression = parseCascadeSection('..a = 3..m<E>()');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<AssignmentExpression>());
- AssignmentExpression section = expression;
+ var section = expression as AssignmentExpression;
expect(section.leftHandSide, isNotNull);
expect(section.operator, isNotNull);
Expression rhs = section.rightHandSide;
@@ -4498,24 +4481,20 @@
}
void test_parseCascadeSection_p_builtIn() {
- createParser('..as');
- Expression expression = parser.parseCascadeSection();
+ Expression expression = parseCascadeSection('..as');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<PropertyAccess>());
- PropertyAccess section = expression;
+ var section = expression as PropertyAccess;
expect(section.target, isNull);
expect(section.operator, isNotNull);
expect(section.propertyName, isNotNull);
}
void test_parseCascadeSection_pa() {
- createParser('..a(b)');
- Expression expression = parser.parseCascadeSection();
+ Expression expression = parseCascadeSection('..a(b)');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<MethodInvocation>());
- MethodInvocation section = expression;
+ var section = expression as MethodInvocation;
expect(section.target, isNull);
expect(section.operator, isNotNull);
expect(section.methodName, isNotNull);
@@ -4526,12 +4505,10 @@
void test_parseCascadeSection_pa_typeArgumentComments() {
enableGenericMethodComments = true;
- createParser('..a/*<E>*/(b)');
- Expression expression = parser.parseCascadeSection();
+ Expression expression = parseCascadeSection('..a/*<E>*/(b)');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<MethodInvocation>());
- MethodInvocation section = expression;
+ var section = expression as MethodInvocation;
expect(section.target, isNull);
expect(section.operator, isNotNull);
expect(section.methodName, isNotNull);
@@ -4541,12 +4518,10 @@
}
void test_parseCascadeSection_pa_typeArguments() {
- createParser('..a<E>(b)');
- Expression expression = parser.parseCascadeSection();
+ Expression expression = parseCascadeSection('..a<E>(b)');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<MethodInvocation>());
- MethodInvocation section = expression;
+ var section = expression as MethodInvocation;
expect(section.target, isNull);
expect(section.operator, isNotNull);
expect(section.methodName, isNotNull);
@@ -4556,12 +4531,10 @@
}
void test_parseCascadeSection_paa() {
- createParser('..a(b)(c)');
- Expression expression = parser.parseCascadeSection();
+ Expression expression = parseCascadeSection('..a(b)(c)');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<FunctionExpressionInvocation>());
- FunctionExpressionInvocation section = expression;
+ var section = expression as FunctionExpressionInvocation;
expect(section.function, new isInstanceOf<MethodInvocation>());
expect(section.typeArguments, isNull);
expect(section.argumentList, isNotNull);
@@ -4570,12 +4543,10 @@
void test_parseCascadeSection_paa_typeArgumentComments() {
enableGenericMethodComments = true;
- createParser('..a/*<E>*/(b)/*<F>*/(c)');
- Expression expression = parser.parseCascadeSection();
+ Expression expression = parseCascadeSection('..a/*<E>*/(b)/*<F>*/(c)');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<FunctionExpressionInvocation>());
- FunctionExpressionInvocation section = expression;
+ var section = expression as FunctionExpressionInvocation;
expect(section.function, new isInstanceOf<MethodInvocation>());
expect(section.typeArguments, isNotNull);
expect(section.argumentList, isNotNull);
@@ -4583,12 +4554,10 @@
}
void test_parseCascadeSection_paa_typeArguments() {
- createParser('..a<E>(b)<F>(c)');
- Expression expression = parser.parseCascadeSection();
+ Expression expression = parseCascadeSection('..a<E>(b)<F>(c)');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<FunctionExpressionInvocation>());
- FunctionExpressionInvocation section = expression;
+ var section = expression as FunctionExpressionInvocation;
expect(section.function, new isInstanceOf<MethodInvocation>());
expect(section.typeArguments, isNotNull);
expect(section.argumentList, isNotNull);
@@ -4596,12 +4565,10 @@
}
void test_parseCascadeSection_paapaa() {
- createParser('..a(b)(c).d(e)(f)');
- Expression expression = parser.parseCascadeSection();
+ Expression expression = parseCascadeSection('..a(b)(c).d(e)(f)');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<FunctionExpressionInvocation>());
- FunctionExpressionInvocation section = expression;
+ var section = expression as FunctionExpressionInvocation;
expect(section.function, new isInstanceOf<MethodInvocation>());
expect(section.typeArguments, isNull);
expect(section.argumentList, isNotNull);
@@ -4610,12 +4577,11 @@
void test_parseCascadeSection_paapaa_typeArgumentComments() {
enableGenericMethodComments = true;
- createParser('..a/*<E>*/(b)/*<F>*/(c).d/*<G>*/(e)/*<H>*/(f)');
- Expression expression = parser.parseCascadeSection();
+ Expression expression =
+ parseCascadeSection('..a/*<E>*/(b)/*<F>*/(c).d/*<G>*/(e)/*<H>*/(f)');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<FunctionExpressionInvocation>());
- FunctionExpressionInvocation section = expression;
+ var section = expression as FunctionExpressionInvocation;
expect(section.function, new isInstanceOf<MethodInvocation>());
expect(section.typeArguments, isNotNull);
expect(section.argumentList, isNotNull);
@@ -4623,12 +4589,11 @@
}
void test_parseCascadeSection_paapaa_typeArguments() {
- createParser('..a<E>(b)<F>(c).d<G>(e)<H>(f)');
- Expression expression = parser.parseCascadeSection();
+ Expression expression =
+ parseCascadeSection('..a<E>(b)<F>(c).d<G>(e)<H>(f)');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<FunctionExpressionInvocation>());
- FunctionExpressionInvocation section = expression;
+ var section = expression as FunctionExpressionInvocation;
expect(section.function, new isInstanceOf<MethodInvocation>());
expect(section.typeArguments, isNotNull);
expect(section.argumentList, isNotNull);
@@ -4636,12 +4601,10 @@
}
void test_parseCascadeSection_pap() {
- createParser('..a(b).c');
- Expression expression = parser.parseCascadeSection();
+ Expression expression = parseCascadeSection('..a(b).c');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<PropertyAccess>());
- PropertyAccess section = expression;
+ var section = expression as PropertyAccess;
expect(section.target, isNotNull);
expect(section.operator, isNotNull);
expect(section.propertyName, isNotNull);
@@ -4649,32 +4612,27 @@
void test_parseCascadeSection_pap_typeArgumentComments() {
enableGenericMethodComments = true;
- createParser('..a/*<E>*/(b).c');
- Expression expression = parser.parseCascadeSection();
+ Expression expression = parseCascadeSection('..a/*<E>*/(b).c');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<PropertyAccess>());
- PropertyAccess section = expression;
+ var section = expression as PropertyAccess;
expect(section.target, isNotNull);
expect(section.operator, isNotNull);
expect(section.propertyName, isNotNull);
}
void test_parseCascadeSection_pap_typeArguments() {
- createParser('..a<E>(b).c');
- Expression expression = parser.parseCascadeSection();
+ Expression expression = parseCascadeSection('..a<E>(b).c');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<PropertyAccess>());
- PropertyAccess section = expression;
+ var section = expression as PropertyAccess;
expect(section.target, isNotNull);
expect(section.operator, isNotNull);
expect(section.propertyName, isNotNull);
}
void test_parseConditionalExpression() {
- createParser('x ? y : z');
- ConditionalExpression expression = parser.parseConditionalExpression();
+ ConditionalExpression expression = parseConditionalExpression('x ? y : z');
expect(expression, isNotNull);
assertNoErrors();
expect(expression.condition, isNotNull);
@@ -4685,8 +4643,7 @@
}
void test_parseConstExpression_instanceCreation() {
- createParser('const A()');
- Expression expression = parser.parseConstExpression();
+ Expression expression = parseConstExpression('const A()');
expect(expression, isNotNull);
assertNoErrors();
expect(expression, new isInstanceOf<InstanceCreationExpression>());
@@ -4701,12 +4658,10 @@
}
void test_parseConstExpression_listLiteral_typed() {
- createParser('const <A> []');
- Expression expression = parser.parseConstExpression();
+ Expression expression = parseConstExpression('const <A> []');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<ListLiteral>());
- ListLiteral literal = expression;
+ var literal = expression as ListLiteral;
expect(literal.constKeyword, isNotNull);
expect(literal.typeArguments, isNotNull);
expect(literal.leftBracket, isNotNull);
@@ -4716,12 +4671,10 @@
void test_parseConstExpression_listLiteral_typed_genericComment() {
enableGenericMethodComments = true;
- createParser('const /*<A>*/ []');
- Expression expression = parser.parseConstExpression();
+ Expression expression = parseConstExpression('const /*<A>*/ []');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<ListLiteral>());
- ListLiteral literal = expression;
+ var literal = expression as ListLiteral;
expect(literal.constKeyword, isNotNull);
expect(literal.typeArguments, isNotNull);
expect(literal.leftBracket, isNotNull);
@@ -4730,12 +4683,10 @@
}
void test_parseConstExpression_listLiteral_untyped() {
- createParser('const []');
- Expression expression = parser.parseConstExpression();
+ Expression expression = parseConstExpression('const []');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<ListLiteral>());
- ListLiteral literal = expression;
+ var literal = expression as ListLiteral;
expect(literal.constKeyword, isNotNull);
expect(literal.typeArguments, isNull);
expect(literal.leftBracket, isNotNull);
@@ -4744,12 +4695,10 @@
}
void test_parseConstExpression_mapLiteral_typed() {
- createParser('const <A, B> {}');
- Expression expression = parser.parseConstExpression();
+ Expression expression = parseConstExpression('const <A, B> {}');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<MapLiteral>());
- MapLiteral literal = expression;
+ var literal = expression as MapLiteral;
expect(literal.leftBracket, isNotNull);
expect(literal.entries, hasLength(0));
expect(literal.rightBracket, isNotNull);
@@ -4758,12 +4707,10 @@
void test_parseConstExpression_mapLiteral_typed_genericComment() {
enableGenericMethodComments = true;
- createParser('const /*<A, B>*/ {}');
- Expression expression = parser.parseConstExpression();
+ Expression expression = parseConstExpression('const /*<A, B>*/ {}');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<MapLiteral>());
- MapLiteral literal = expression;
+ var literal = expression as MapLiteral;
expect(literal.leftBracket, isNotNull);
expect(literal.entries, hasLength(0));
expect(literal.rightBracket, isNotNull);
@@ -4771,12 +4718,10 @@
}
void test_parseConstExpression_mapLiteral_untyped() {
- createParser('const {}');
- Expression expression = parser.parseConstExpression();
+ Expression expression = parseConstExpression('const {}');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<MapLiteral>());
- MapLiteral literal = expression;
+ var literal = expression as MapLiteral;
expect(literal.leftBracket, isNotNull);
expect(literal.entries, hasLength(0));
expect(literal.rightBracket, isNotNull);
@@ -4784,8 +4729,7 @@
}
void test_parseEqualityExpression_normal() {
- createParser('x == y');
- BinaryExpression expression = parser.parseEqualityExpression();
+ BinaryExpression expression = parseEqualityExpression('x == y');
expect(expression, isNotNull);
assertNoErrors();
expect(expression.leftOperand, isNotNull);
@@ -4795,8 +4739,7 @@
}
void test_parseEqualityExpression_super() {
- createParser('super == y');
- BinaryExpression expression = parser.parseEqualityExpression();
+ BinaryExpression expression = parseEqualityExpression('super == y');
expect(expression, isNotNull);
assertNoErrors();
expect(expression.leftOperand, new isInstanceOf<SuperExpression>());
@@ -4808,8 +4751,7 @@
void test_parseExpression_assign() {
// TODO(brianwilkerson) Implement more tests for this method.
Expression expression = parseExpression('x = y');
- expect(expression, new isInstanceOf<AssignmentExpression>());
- AssignmentExpression assignmentExpression = expression;
+ var assignmentExpression = expression as AssignmentExpression;
expect(assignmentExpression.leftHandSide, isNotNull);
expect(assignmentExpression.operator, isNotNull);
expect(assignmentExpression.operator.type, TokenType.EQ);
@@ -4819,8 +4761,7 @@
void test_parseExpression_assign_compound() {
enableLazyAssignmentOperators = true;
Expression expression = parseExpression('x ||= y');
- expect(expression, new isInstanceOf<AssignmentExpression>());
- AssignmentExpression assignmentExpression = expression;
+ var assignmentExpression = expression as AssignmentExpression;
expect(assignmentExpression.leftHandSide, isNotNull);
expect(assignmentExpression.operator, isNotNull);
expect(assignmentExpression.operator.type, TokenType.BAR_BAR_EQ);
@@ -4829,8 +4770,7 @@
void test_parseExpression_comparison() {
Expression expression = parseExpression('--a.b == c');
- expect(expression, new isInstanceOf<BinaryExpression>());
- BinaryExpression binaryExpression = expression;
+ var binaryExpression = expression as BinaryExpression;
expect(binaryExpression.leftOperand, isNotNull);
expect(binaryExpression.operator, isNotNull);
expect(binaryExpression.operator.type, TokenType.EQ_EQ);
@@ -4839,8 +4779,7 @@
void test_parseExpression_function_async() {
Expression expression = parseExpression('() async {}');
- expect(expression, new isInstanceOf<FunctionExpression>());
- FunctionExpression functionExpression = expression;
+ var functionExpression = expression as FunctionExpression;
expect(functionExpression.body, isNotNull);
expect(functionExpression.body.isAsynchronous, isTrue);
expect(functionExpression.body.isGenerator, isFalse);
@@ -4849,8 +4788,7 @@
void test_parseExpression_function_asyncStar() {
Expression expression = parseExpression('() async* {}');
- expect(expression, new isInstanceOf<FunctionExpression>());
- FunctionExpression functionExpression = expression;
+ var functionExpression = expression as FunctionExpression;
expect(functionExpression.body, isNotNull);
expect(functionExpression.body.isAsynchronous, isTrue);
expect(functionExpression.body.isGenerator, isTrue);
@@ -4859,8 +4797,7 @@
void test_parseExpression_function_sync() {
Expression expression = parseExpression('() {}');
- expect(expression, new isInstanceOf<FunctionExpression>());
- FunctionExpression functionExpression = expression;
+ var functionExpression = expression as FunctionExpression;
expect(functionExpression.body, isNotNull);
expect(functionExpression.body.isAsynchronous, isFalse);
expect(functionExpression.body.isGenerator, isFalse);
@@ -4869,8 +4806,7 @@
void test_parseExpression_function_syncStar() {
Expression expression = parseExpression('() sync* {}');
- expect(expression, new isInstanceOf<FunctionExpression>());
- FunctionExpression functionExpression = expression;
+ var functionExpression = expression as FunctionExpression;
expect(functionExpression.body, isNotNull);
expect(functionExpression.body.isAsynchronous, isFalse);
expect(functionExpression.body.isGenerator, isTrue);
@@ -4879,8 +4815,7 @@
void test_parseExpression_invokeFunctionExpression() {
Expression expression = parseExpression('(a) {return a + a;} (3)');
- expect(expression, new isInstanceOf<FunctionExpressionInvocation>());
- FunctionExpressionInvocation invocation = expression;
+ var invocation = expression as FunctionExpressionInvocation;
expect(invocation.function, new isInstanceOf<FunctionExpression>());
FunctionExpression functionExpression =
invocation.function as FunctionExpression;
@@ -4894,8 +4829,7 @@
void test_parseExpression_nonAwait() {
Expression expression = parseExpression('await()');
- expect(expression, new isInstanceOf<MethodInvocation>());
- MethodInvocation invocation = expression;
+ var invocation = expression as MethodInvocation;
expect(invocation.methodName.name, 'await');
expect(invocation.typeArguments, isNull);
expect(invocation.argumentList, isNotNull);
@@ -4903,8 +4837,7 @@
void test_parseExpression_superMethodInvocation() {
Expression expression = parseExpression('super.m()');
- expect(expression, new isInstanceOf<MethodInvocation>());
- MethodInvocation invocation = expression;
+ var invocation = expression as MethodInvocation;
expect(invocation.target, isNotNull);
expect(invocation.methodName, isNotNull);
expect(invocation.typeArguments, isNull);
@@ -4914,8 +4847,7 @@
void test_parseExpression_superMethodInvocation_typeArgumentComments() {
enableGenericMethodComments = true;
Expression expression = parseExpression('super.m/*<E>*/()');
- expect(expression, new isInstanceOf<MethodInvocation>());
- MethodInvocation invocation = expression;
+ var invocation = expression as MethodInvocation;
expect(invocation.target, isNotNull);
expect(invocation.methodName, isNotNull);
expect(invocation.typeArguments, isNotNull);
@@ -4924,8 +4856,7 @@
void test_parseExpression_superMethodInvocation_typeArguments() {
Expression expression = parseExpression('super.m<E>()');
- expect(expression, new isInstanceOf<MethodInvocation>());
- MethodInvocation invocation = expression;
+ var invocation = expression as MethodInvocation;
expect(invocation.target, isNotNull);
expect(invocation.methodName, isNotNull);
expect(invocation.typeArguments, isNotNull);
@@ -4933,16 +4864,14 @@
}
void test_parseExpressionList_multiple() {
- createParser('1, 2, 3');
- List<Expression> result = parser.parseExpressionList();
+ List<Expression> result = parseExpressionList('1, 2, 3');
expect(result, isNotNull);
assertNoErrors();
expect(result, hasLength(3));
}
void test_parseExpressionList_single() {
- createParser('1');
- List<Expression> result = parser.parseExpressionList();
+ List<Expression> result = parseExpressionList('1');
expect(result, isNotNull);
assertNoErrors();
expect(result, hasLength(1));
@@ -4950,12 +4879,10 @@
void test_parseExpressionWithoutCascade_assign() {
// TODO(brianwilkerson) Implement more tests for this method.
- createParser('x = y');
- Expression expression = parser.parseExpressionWithoutCascade();
+ Expression expression = parseExpressionWithoutCascade('x = y');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<AssignmentExpression>());
- AssignmentExpression assignmentExpression = expression;
+ var assignmentExpression = expression as AssignmentExpression;
expect(assignmentExpression.leftHandSide, isNotNull);
expect(assignmentExpression.operator, isNotNull);
expect(assignmentExpression.operator.type, TokenType.EQ);
@@ -4963,12 +4890,10 @@
}
void test_parseExpressionWithoutCascade_comparison() {
- createParser('--a.b == c');
- Expression expression = parser.parseExpressionWithoutCascade();
+ Expression expression = parseExpressionWithoutCascade('--a.b == c');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<BinaryExpression>());
- BinaryExpression binaryExpression = expression;
+ var binaryExpression = expression as BinaryExpression;
expect(binaryExpression.leftOperand, isNotNull);
expect(binaryExpression.operator, isNotNull);
expect(binaryExpression.operator.type, TokenType.EQ_EQ);
@@ -4976,12 +4901,10 @@
}
void test_parseExpressionWithoutCascade_superMethodInvocation() {
- createParser('super.m()');
- Expression expression = parser.parseExpressionWithoutCascade();
+ Expression expression = parseExpressionWithoutCascade('super.m()');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<MethodInvocation>());
- MethodInvocation invocation = expression;
+ var invocation = expression as MethodInvocation;
expect(invocation.target, isNotNull);
expect(invocation.methodName, isNotNull);
expect(invocation.typeArguments, isNull);
@@ -4991,12 +4914,10 @@
void
test_parseExpressionWithoutCascade_superMethodInvocation_typeArgumentComments() {
enableGenericMethodComments = true;
- createParser('super.m/*<E>*/()');
- Expression expression = parser.parseExpressionWithoutCascade();
+ Expression expression = parseExpressionWithoutCascade('super.m/*<E>*/()');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<MethodInvocation>());
- MethodInvocation invocation = expression;
+ var invocation = expression as MethodInvocation;
expect(invocation.target, isNotNull);
expect(invocation.methodName, isNotNull);
expect(invocation.typeArguments, isNotNull);
@@ -5005,12 +4926,10 @@
void
test_parseExpressionWithoutCascade_superMethodInvocation_typeArguments() {
- createParser('super.m<E>()');
- Expression expression = parser.parseExpressionWithoutCascade();
+ Expression expression = parseExpressionWithoutCascade('super.m<E>()');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<MethodInvocation>());
- MethodInvocation invocation = expression;
+ var invocation = expression as MethodInvocation;
expect(invocation.target, isNotNull);
expect(invocation.methodName, isNotNull);
expect(invocation.typeArguments, isNotNull);
@@ -5018,8 +4937,7 @@
}
void test_parseFunctionExpression_body_inExpression() {
- createParser('(int i) => i++');
- FunctionExpression expression = parser.parseFunctionExpression();
+ FunctionExpression expression = parseFunctionExpression('(int i) => i++');
expect(expression, isNotNull);
assertNoErrors();
expect(expression.body, isNotNull);
@@ -5030,8 +4948,8 @@
void test_parseFunctionExpression_typeParameterComments() {
enableGenericMethodComments = true;
- createParser('/*<E>*/(/*=E*/ i) => i++');
- FunctionExpression expression = parser.parseFunctionExpression();
+ FunctionExpression expression =
+ parseFunctionExpression('/*<E>*/(/*=E*/ i) => i++');
expect(expression, isNotNull);
assertNoErrors();
expect(expression.body, isNotNull);
@@ -5043,8 +4961,7 @@
}
void test_parseFunctionExpression_typeParameters() {
- createParser('<E>(E i) => i++');
- FunctionExpression expression = parser.parseFunctionExpression();
+ FunctionExpression expression = parseFunctionExpression('<E>(E i) => i++');
expect(expression, isNotNull);
assertNoErrors();
expect(expression.body, isNotNull);
@@ -5055,16 +4972,15 @@
void test_parseInstanceCreationExpression_qualifiedType() {
Token token = TokenFactory.tokenFromKeyword(Keyword.NEW);
- createParser('A.B()');
InstanceCreationExpression expression =
- parser.parseInstanceCreationExpression(token);
+ parseInstanceCreationExpression('A.B()', token);
expect(expression, isNotNull);
assertNoErrors();
- expect(expression.keyword, token);
+ expect(expression.keyword.keyword, Keyword.NEW);
ConstructorName name = expression.constructorName;
expect(name, isNotNull);
TypeName type = name.type;
- expect(type, isNotNull);
+ expect(type.name.name, 'A.B');
expect(type.typeArguments, isNull);
expect(name.period, isNull);
expect(name.name, isNull);
@@ -5073,12 +4989,11 @@
void test_parseInstanceCreationExpression_qualifiedType_named() {
Token token = TokenFactory.tokenFromKeyword(Keyword.NEW);
- createParser('A.B.c()');
InstanceCreationExpression expression =
- parser.parseInstanceCreationExpression(token);
+ parseInstanceCreationExpression('A.B.c()', token);
expect(expression, isNotNull);
assertNoErrors();
- expect(expression.keyword, token);
+ expect(expression.keyword.keyword, Keyword.NEW);
ConstructorName name = expression.constructorName;
expect(name, isNotNull);
TypeName type = name.type;
@@ -5093,12 +5008,11 @@
test_parseInstanceCreationExpression_qualifiedType_named_typeParameterComment() {
enableGenericMethodComments = true;
Token token = TokenFactory.tokenFromKeyword(Keyword.NEW);
- createParser('A.B/*<E>*/.c()');
InstanceCreationExpression expression =
- parser.parseInstanceCreationExpression(token);
+ parseInstanceCreationExpression('A.B/*<E>*/.c()', token);
expect(expression, isNotNull);
assertNoErrors();
- expect(expression.keyword, token);
+ expect(expression.keyword.keyword, Keyword.NEW);
ConstructorName name = expression.constructorName;
expect(name, isNotNull);
TypeName type = name.type;
@@ -5112,12 +5026,11 @@
void
test_parseInstanceCreationExpression_qualifiedType_named_typeParameters() {
Token token = TokenFactory.tokenFromKeyword(Keyword.NEW);
- createParser('A.B<E>.c()');
InstanceCreationExpression expression =
- parser.parseInstanceCreationExpression(token);
+ parseInstanceCreationExpression('A.B<E>.c()', token);
expect(expression, isNotNull);
assertNoErrors();
- expect(expression.keyword, token);
+ expect(expression.keyword.keyword, Keyword.NEW);
ConstructorName name = expression.constructorName;
expect(name, isNotNull);
TypeName type = name.type;
@@ -5132,12 +5045,11 @@
test_parseInstanceCreationExpression_qualifiedType_typeParameterComment() {
enableGenericMethodComments = true;
Token token = TokenFactory.tokenFromKeyword(Keyword.NEW);
- createParser('A.B/*<E>*/()');
InstanceCreationExpression expression =
- parser.parseInstanceCreationExpression(token);
+ parseInstanceCreationExpression('A.B/*<E>*/()', token);
expect(expression, isNotNull);
assertNoErrors();
- expect(expression.keyword, token);
+ expect(expression.keyword.keyword, Keyword.NEW);
ConstructorName name = expression.constructorName;
expect(name, isNotNull);
TypeName type = name.type;
@@ -5150,12 +5062,11 @@
void test_parseInstanceCreationExpression_qualifiedType_typeParameters() {
Token token = TokenFactory.tokenFromKeyword(Keyword.NEW);
- createParser('A.B<E>()');
InstanceCreationExpression expression =
- parser.parseInstanceCreationExpression(token);
+ parseInstanceCreationExpression('A.B<E>()', token);
expect(expression, isNotNull);
assertNoErrors();
- expect(expression.keyword, token);
+ expect(expression.keyword.keyword, Keyword.NEW);
ConstructorName name = expression.constructorName;
expect(name, isNotNull);
TypeName type = name.type;
@@ -5168,12 +5079,11 @@
void test_parseInstanceCreationExpression_type() {
Token token = TokenFactory.tokenFromKeyword(Keyword.NEW);
- createParser('A()');
InstanceCreationExpression expression =
- parser.parseInstanceCreationExpression(token);
+ parseInstanceCreationExpression('A()', token);
expect(expression, isNotNull);
assertNoErrors();
- expect(expression.keyword, token);
+ expect(expression.keyword.keyword, Keyword.NEW);
ConstructorName name = expression.constructorName;
expect(name, isNotNull);
TypeName type = name.type;
@@ -5185,14 +5095,12 @@
}
void test_parseInstanceCreationExpression_type_named() {
- enableGenericMethodComments = true;
Token token = TokenFactory.tokenFromKeyword(Keyword.NEW);
- createParser('A.c()');
InstanceCreationExpression expression =
- parser.parseInstanceCreationExpression(token);
+ parseInstanceCreationExpression('A.c()', token);
expect(expression, isNotNull);
assertNoErrors();
- expect(expression.keyword, token);
+ expect(expression.keyword.keyword, Keyword.NEW);
ConstructorName name = expression.constructorName;
expect(name, isNotNull);
TypeName type = name.type;
@@ -5206,12 +5114,11 @@
void test_parseInstanceCreationExpression_type_named_typeParameterComment() {
enableGenericMethodComments = true;
Token token = TokenFactory.tokenFromKeyword(Keyword.NEW);
- createParser('A/*<B>*/.c()');
InstanceCreationExpression expression =
- parser.parseInstanceCreationExpression(token);
+ parseInstanceCreationExpression('A/*<B>*/.c()', token);
expect(expression, isNotNull);
assertNoErrors();
- expect(expression.keyword, token);
+ expect(expression.keyword.keyword, Keyword.NEW);
ConstructorName name = expression.constructorName;
expect(name, isNotNull);
TypeName type = name.type;
@@ -5224,12 +5131,11 @@
void test_parseInstanceCreationExpression_type_named_typeParameters() {
Token token = TokenFactory.tokenFromKeyword(Keyword.NEW);
- createParser('A<B>.c()');
InstanceCreationExpression expression =
- parser.parseInstanceCreationExpression(token);
+ parseInstanceCreationExpression('A<B>.c()', token);
expect(expression, isNotNull);
assertNoErrors();
- expect(expression.keyword, token);
+ expect(expression.keyword.keyword, Keyword.NEW);
ConstructorName name = expression.constructorName;
expect(name, isNotNull);
TypeName type = name.type;
@@ -5243,12 +5149,11 @@
void test_parseInstanceCreationExpression_type_typeParameterComment() {
enableGenericMethodComments = true;
Token token = TokenFactory.tokenFromKeyword(Keyword.NEW);
- createParser('A/*<B>*/()');
InstanceCreationExpression expression =
- parser.parseInstanceCreationExpression(token);
+ parseInstanceCreationExpression('A/*<B>*/()', token);
expect(expression, isNotNull);
assertNoErrors();
- expect(expression.keyword, token);
+ expect(expression.keyword.keyword, Keyword.NEW);
ConstructorName name = expression.constructorName;
expect(name, isNotNull);
TypeName type = name.type;
@@ -5261,12 +5166,11 @@
void test_parseInstanceCreationExpression_type_typeParameters() {
Token token = TokenFactory.tokenFromKeyword(Keyword.NEW);
- createParser('A<B>()');
InstanceCreationExpression expression =
- parser.parseInstanceCreationExpression(token);
+ parseInstanceCreationExpression('A<B>()', token);
expect(expression, isNotNull);
assertNoErrors();
- expect(expression.keyword, token);
+ expect(expression.keyword.keyword, Keyword.NEW);
ConstructorName name = expression.constructorName;
expect(name, isNotNull);
TypeName type = name.type;
@@ -5280,12 +5184,11 @@
void test_parseInstanceCreationExpression_type_typeParameters_nullable() {
enableNnbd = true;
Token token = TokenFactory.tokenFromKeyword(Keyword.NEW);
- createParser('A<B?>()');
InstanceCreationExpression expression =
- parser.parseInstanceCreationExpression(token);
+ parseInstanceCreationExpression('A<B?>()', token);
expect(expression, isNotNull);
assertNoErrors();
- expect(expression.keyword, token);
+ expect(expression.keyword.keyword, Keyword.NEW);
ConstructorName name = expression.constructorName;
expect(name, isNotNull);
TypeName type = name.type;
@@ -5300,27 +5203,22 @@
void test_parseListLiteral_empty_oneToken() {
Token token = TokenFactory.tokenFromKeyword(Keyword.CONST);
- TypeArgumentList typeArguments = null;
- createParser('[]');
- ListLiteral literal = parser.parseListLiteral(token, typeArguments);
+ ListLiteral literal = parseListLiteral(token, null, '[]');
expect(literal, isNotNull);
assertNoErrors();
expect(literal.constKeyword, token);
- expect(literal.typeArguments, typeArguments);
+ expect(literal.typeArguments, isNull);
expect(literal.leftBracket, isNotNull);
expect(literal.elements, hasLength(0));
expect(literal.rightBracket, isNotNull);
}
void test_parseListLiteral_empty_oneToken_withComment() {
- Token token = null;
- TypeArgumentList typeArguments = null;
- createParser('/* 0 */ []');
- ListLiteral literal = parser.parseListLiteral(token, typeArguments);
+ ListLiteral literal = parseListLiteral(null, null, '/* 0 */ []');
expect(literal, isNotNull);
assertNoErrors();
- expect(literal.constKeyword, token);
- expect(literal.typeArguments, typeArguments);
+ expect(literal.constKeyword, isNull);
+ expect(literal.typeArguments, isNull);
Token leftBracket = literal.leftBracket;
expect(leftBracket, isNotNull);
expect(leftBracket.precedingComments, isNotNull);
@@ -5330,21 +5228,18 @@
void test_parseListLiteral_empty_twoTokens() {
Token token = TokenFactory.tokenFromKeyword(Keyword.CONST);
- TypeArgumentList typeArguments = null;
- createParser('[ ]');
- ListLiteral literal = parser.parseListLiteral(token, typeArguments);
+ ListLiteral literal = parseListLiteral(token, null, '[ ]');
expect(literal, isNotNull);
assertNoErrors();
expect(literal.constKeyword, token);
- expect(literal.typeArguments, typeArguments);
+ expect(literal.typeArguments, isNull);
expect(literal.leftBracket, isNotNull);
expect(literal.elements, hasLength(0));
expect(literal.rightBracket, isNotNull);
}
void test_parseListLiteral_multiple() {
- createParser('[1, 2, 3]');
- ListLiteral literal = parser.parseListLiteral(null, null);
+ ListLiteral literal = parseListLiteral(null, null, '[1, 2, 3]');
expect(literal, isNotNull);
assertNoErrors();
expect(literal.constKeyword, isNull);
@@ -5355,8 +5250,7 @@
}
void test_parseListLiteral_single() {
- createParser('[1]');
- ListLiteral literal = parser.parseListLiteral(null, null);
+ ListLiteral literal = parseListLiteral(null, null, '[1]');
expect(literal, isNotNull);
assertNoErrors();
expect(literal.constKeyword, isNull);
@@ -5366,13 +5260,22 @@
expect(literal.rightBracket, isNotNull);
}
- void test_parseListOrMapLiteral_list_noType() {
- createParser('[1]');
- TypedLiteral literal = parser.parseListOrMapLiteral(null);
+ void test_parseListLiteral_single_withTypeArgument() {
+ ListLiteral literal = parseListLiteral(null, '<int>', '[1]');
expect(literal, isNotNull);
assertNoErrors();
- expect(literal, new isInstanceOf<ListLiteral>());
- ListLiteral listLiteral = literal;
+ expect(literal.constKeyword, isNull);
+ expect(literal.typeArguments, isNotNull);
+ expect(literal.leftBracket, isNotNull);
+ expect(literal.elements, hasLength(1));
+ expect(literal.rightBracket, isNotNull);
+ }
+
+ void test_parseListOrMapLiteral_list_noType() {
+ TypedLiteral literal = parseListOrMapLiteral(null, '[1]');
+ expect(literal, isNotNull);
+ assertNoErrors();
+ var listLiteral = literal as ListLiteral;
expect(listLiteral.constKeyword, isNull);
expect(listLiteral.typeArguments, isNull);
expect(listLiteral.leftBracket, isNotNull);
@@ -5381,12 +5284,10 @@
}
void test_parseListOrMapLiteral_list_type() {
- createParser('<int> [1]');
- TypedLiteral literal = parser.parseListOrMapLiteral(null);
+ TypedLiteral literal = parseListOrMapLiteral(null, '<int> [1]');
expect(literal, isNotNull);
assertNoErrors();
- expect(literal, new isInstanceOf<ListLiteral>());
- ListLiteral listLiteral = literal;
+ var listLiteral = literal as ListLiteral;
expect(listLiteral.constKeyword, isNull);
expect(listLiteral.typeArguments, isNotNull);
expect(listLiteral.leftBracket, isNotNull);
@@ -5395,12 +5296,10 @@
}
void test_parseListOrMapLiteral_map_noType() {
- createParser("{'1' : 1}");
- TypedLiteral literal = parser.parseListOrMapLiteral(null);
+ TypedLiteral literal = parseListOrMapLiteral(null, "{'1' : 1}");
expect(literal, isNotNull);
assertNoErrors();
- expect(literal, new isInstanceOf<MapLiteral>());
- MapLiteral mapLiteral = literal;
+ var mapLiteral = literal as MapLiteral;
expect(mapLiteral.constKeyword, isNull);
expect(mapLiteral.typeArguments, isNull);
expect(mapLiteral.leftBracket, isNotNull);
@@ -5409,12 +5308,11 @@
}
void test_parseListOrMapLiteral_map_type() {
- createParser("<String, int> {'1' : 1}");
- TypedLiteral literal = parser.parseListOrMapLiteral(null);
+ TypedLiteral literal =
+ parseListOrMapLiteral(null, "<String, int> {'1' : 1}");
expect(literal, isNotNull);
assertNoErrors();
- expect(literal, new isInstanceOf<MapLiteral>());
- MapLiteral mapLiteral = literal;
+ var mapLiteral = literal as MapLiteral;
expect(mapLiteral.constKeyword, isNull);
expect(mapLiteral.typeArguments, isNotNull);
expect(mapLiteral.leftBracket, isNotNull);
@@ -5423,12 +5321,10 @@
}
void test_parseLogicalAndExpression() {
- createParser('x && y');
- Expression expression = parser.parseLogicalAndExpression();
+ Expression expression = parseLogicalAndExpression('x && y');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<BinaryExpression>());
- BinaryExpression binaryExpression = expression;
+ var binaryExpression = expression as BinaryExpression;
expect(binaryExpression.leftOperand, isNotNull);
expect(binaryExpression.operator, isNotNull);
expect(binaryExpression.operator.type, TokenType.AMPERSAND_AMPERSAND);
@@ -5436,12 +5332,10 @@
}
void test_parseLogicalOrExpression() {
- createParser('x || y');
- Expression expression = parser.parseLogicalOrExpression();
+ Expression expression = parseLogicalOrExpression('x || y');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<BinaryExpression>());
- BinaryExpression binaryExpression = expression;
+ var binaryExpression = expression as BinaryExpression;
expect(binaryExpression.leftOperand, isNotNull);
expect(binaryExpression.operator, isNotNull);
expect(binaryExpression.operator.type, TokenType.BAR_BAR);
@@ -5450,22 +5344,18 @@
void test_parseMapLiteral_empty() {
Token token = TokenFactory.tokenFromKeyword(Keyword.CONST);
- TypeArgumentList typeArguments = AstTestFactory.typeArgumentList(
- [AstTestFactory.typeName4("String"), AstTestFactory.typeName4("int")]);
- createParser('{}');
- MapLiteral literal = parser.parseMapLiteral(token, typeArguments);
+ MapLiteral literal = parseMapLiteral(token, '<String, int>', '{}');
expect(literal, isNotNull);
assertNoErrors();
expect(literal.constKeyword, token);
- expect(literal.typeArguments, typeArguments);
+ expect(literal.typeArguments, isNotNull);
expect(literal.leftBracket, isNotNull);
expect(literal.entries, hasLength(0));
expect(literal.rightBracket, isNotNull);
}
void test_parseMapLiteral_multiple() {
- createParser("{'a' : b, 'x' : y}");
- MapLiteral literal = parser.parseMapLiteral(null, null);
+ MapLiteral literal = parseMapLiteral(null, null, "{'a' : b, 'x' : y}");
expect(literal, isNotNull);
assertNoErrors();
expect(literal.leftBracket, isNotNull);
@@ -5474,8 +5364,7 @@
}
void test_parseMapLiteral_single() {
- createParser("{'x' : y}");
- MapLiteral literal = parser.parseMapLiteral(null, null);
+ MapLiteral literal = parseMapLiteral(null, null, "{'x' : y}");
expect(literal, isNotNull);
assertNoErrors();
expect(literal.leftBracket, isNotNull);
@@ -5484,8 +5373,7 @@
}
void test_parseMapLiteralEntry_complex() {
- createParser('2 + 2 : y');
- MapLiteralEntry entry = parser.parseMapLiteralEntry();
+ MapLiteralEntry entry = parseMapLiteralEntry('2 + 2 : y');
expect(entry, isNotNull);
assertNoErrors();
expect(entry.key, isNotNull);
@@ -5494,8 +5382,7 @@
}
void test_parseMapLiteralEntry_int() {
- createParser('0 : y');
- MapLiteralEntry entry = parser.parseMapLiteralEntry();
+ MapLiteralEntry entry = parseMapLiteralEntry('0 : y');
expect(entry, isNotNull);
assertNoErrors();
expect(entry.key, isNotNull);
@@ -5504,8 +5391,7 @@
}
void test_parseMapLiteralEntry_string() {
- createParser("'x' : y");
- MapLiteralEntry entry = parser.parseMapLiteralEntry();
+ MapLiteralEntry entry = parseMapLiteralEntry("'x' : y");
expect(entry, isNotNull);
assertNoErrors();
expect(entry.key, isNotNull);
@@ -5514,12 +5400,10 @@
}
void test_parseMultiplicativeExpression_normal() {
- createParser('x * y');
- Expression expression = parser.parseMultiplicativeExpression();
+ Expression expression = parseMultiplicativeExpression('x * y');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<BinaryExpression>());
- BinaryExpression binaryExpression = expression;
+ var binaryExpression = expression as BinaryExpression;
expect(binaryExpression.leftOperand, isNotNull);
expect(binaryExpression.operator, isNotNull);
expect(binaryExpression.operator.type, TokenType.STAR);
@@ -5527,12 +5411,10 @@
}
void test_parseMultiplicativeExpression_super() {
- createParser('super * y');
- Expression expression = parser.parseMultiplicativeExpression();
+ Expression expression = parseMultiplicativeExpression('super * y');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<BinaryExpression>());
- BinaryExpression binaryExpression = expression;
+ var binaryExpression = expression as BinaryExpression;
expect(binaryExpression.leftOperand, new isInstanceOf<SuperExpression>());
expect(binaryExpression.operator, isNotNull);
expect(binaryExpression.operator.type, TokenType.STAR);
@@ -5540,8 +5422,7 @@
}
void test_parseNewExpression() {
- createParser('new A()');
- InstanceCreationExpression expression = parser.parseNewExpression();
+ InstanceCreationExpression expression = parseNewExpression('new A()');
expect(expression, isNotNull);
assertNoErrors();
expect(expression.keyword, isNotNull);
@@ -5554,47 +5435,39 @@
}
void test_parsePostfixExpression_decrement() {
- createParser('i--');
- Expression expression = parser.parsePostfixExpression();
+ Expression expression = parsePostfixExpression('i--');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<PostfixExpression>());
- PostfixExpression postfixExpression = expression;
+ var postfixExpression = expression as PostfixExpression;
expect(postfixExpression.operand, isNotNull);
expect(postfixExpression.operator, isNotNull);
expect(postfixExpression.operator.type, TokenType.MINUS_MINUS);
}
void test_parsePostfixExpression_increment() {
- createParser('i++');
- Expression expression = parser.parsePostfixExpression();
+ Expression expression = parsePostfixExpression('i++');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<PostfixExpression>());
- PostfixExpression postfixExpression = expression;
+ var postfixExpression = expression as PostfixExpression;
expect(postfixExpression.operand, isNotNull);
expect(postfixExpression.operator, isNotNull);
expect(postfixExpression.operator.type, TokenType.PLUS_PLUS);
}
void test_parsePostfixExpression_none_indexExpression() {
- createParser('a[0]');
- Expression expression = parser.parsePostfixExpression();
+ Expression expression = parsePostfixExpression('a[0]');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<IndexExpression>());
- IndexExpression indexExpression = expression;
+ var indexExpression = expression as IndexExpression;
expect(indexExpression.target, isNotNull);
expect(indexExpression.index, isNotNull);
}
void test_parsePostfixExpression_none_methodInvocation() {
- createParser('a.m()');
- Expression expression = parser.parsePostfixExpression();
+ Expression expression = parsePostfixExpression('a.m()');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<MethodInvocation>());
- MethodInvocation methodInvocation = expression;
+ var methodInvocation = expression as MethodInvocation;
expect(methodInvocation.target, isNotNull);
expect(methodInvocation.operator.type, TokenType.PERIOD);
expect(methodInvocation.methodName, isNotNull);
@@ -5603,12 +5476,10 @@
}
void test_parsePostfixExpression_none_methodInvocation_question_dot() {
- createParser('a?.m()');
- Expression expression = parser.parsePostfixExpression();
+ Expression expression = parsePostfixExpression('a?.m()');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<MethodInvocation>());
- MethodInvocation methodInvocation = expression;
+ var methodInvocation = expression as MethodInvocation;
expect(methodInvocation.target, isNotNull);
expect(methodInvocation.operator.type, TokenType.QUESTION_PERIOD);
expect(methodInvocation.methodName, isNotNull);
@@ -5619,12 +5490,10 @@
void
test_parsePostfixExpression_none_methodInvocation_question_dot_typeArgumentComments() {
enableGenericMethodComments = true;
- createParser('a?.m/*<E>*/()');
- Expression expression = parser.parsePostfixExpression();
+ Expression expression = parsePostfixExpression('a?.m/*<E>*/()');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<MethodInvocation>());
- MethodInvocation methodInvocation = expression;
+ var methodInvocation = expression as MethodInvocation;
expect(methodInvocation.target, isNotNull);
expect(methodInvocation.operator.type, TokenType.QUESTION_PERIOD);
expect(methodInvocation.methodName, isNotNull);
@@ -5634,12 +5503,10 @@
void
test_parsePostfixExpression_none_methodInvocation_question_dot_typeArguments() {
- createParser('a?.m<E>()');
- Expression expression = parser.parsePostfixExpression();
+ Expression expression = parsePostfixExpression('a?.m<E>()');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<MethodInvocation>());
- MethodInvocation methodInvocation = expression;
+ var methodInvocation = expression as MethodInvocation;
expect(methodInvocation.target, isNotNull);
expect(methodInvocation.operator.type, TokenType.QUESTION_PERIOD);
expect(methodInvocation.methodName, isNotNull);
@@ -5650,12 +5517,10 @@
void
test_parsePostfixExpression_none_methodInvocation_typeArgumentComments() {
enableGenericMethodComments = true;
- createParser('a.m/*<E>*/()');
- Expression expression = parser.parsePostfixExpression();
+ Expression expression = parsePostfixExpression('a.m/*<E>*/()');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<MethodInvocation>());
- MethodInvocation methodInvocation = expression;
+ var methodInvocation = expression as MethodInvocation;
expect(methodInvocation.target, isNotNull);
expect(methodInvocation.operator.type, TokenType.PERIOD);
expect(methodInvocation.methodName, isNotNull);
@@ -5664,12 +5529,10 @@
}
void test_parsePostfixExpression_none_methodInvocation_typeArguments() {
- createParser('a.m<E>()');
- Expression expression = parser.parsePostfixExpression();
+ Expression expression = parsePostfixExpression('a.m<E>()');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<MethodInvocation>());
- MethodInvocation methodInvocation = expression;
+ var methodInvocation = expression as MethodInvocation;
expect(methodInvocation.target, isNotNull);
expect(methodInvocation.operator.type, TokenType.PERIOD);
expect(methodInvocation.methodName, isNotNull);
@@ -5678,44 +5541,37 @@
}
void test_parsePostfixExpression_none_propertyAccess() {
- createParser('a.b');
- Expression expression = parser.parsePostfixExpression();
+ Expression expression = parsePostfixExpression('a.b');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<PrefixedIdentifier>());
- PrefixedIdentifier identifier = expression;
+ var identifier = expression as PrefixedIdentifier;
expect(identifier.prefix, isNotNull);
expect(identifier.identifier, isNotNull);
}
void test_parsePrefixedIdentifier_noPrefix() {
String lexeme = "bar";
- createParser(lexeme);
- Identifier identifier = parser.parsePrefixedIdentifier();
+ Identifier identifier = parsePrefixedIdentifier(lexeme);
expect(identifier, isNotNull);
assertNoErrors();
- expect(identifier, new isInstanceOf<SimpleIdentifier>());
- SimpleIdentifier simpleIdentifier = identifier;
+ var simpleIdentifier = identifier as SimpleIdentifier;
expect(simpleIdentifier.token, isNotNull);
expect(simpleIdentifier.name, lexeme);
}
void test_parsePrefixedIdentifier_prefix() {
String lexeme = "foo.bar";
- createParser(lexeme);
- Identifier identifier = parser.parsePrefixedIdentifier();
+ Identifier identifier = parsePrefixedIdentifier(lexeme);
expect(identifier, isNotNull);
assertNoErrors();
- expect(identifier, new isInstanceOf<PrefixedIdentifier>());
- PrefixedIdentifier prefixedIdentifier = identifier;
+ var prefixedIdentifier = identifier as PrefixedIdentifier;
expect(prefixedIdentifier.prefix.name, "foo");
expect(prefixedIdentifier.period, isNotNull);
expect(prefixedIdentifier.identifier.name, "bar");
}
void test_parsePrimaryExpression_const() {
- createParser('const A()');
- Expression expression = parser.parsePrimaryExpression();
+ Expression expression = parsePrimaryExpression('const A()');
expect(expression, isNotNull);
assertNoErrors();
expect(expression, isNotNull);
@@ -5723,183 +5579,151 @@
void test_parsePrimaryExpression_double() {
String doubleLiteral = "3.2e4";
- createParser(doubleLiteral);
- Expression expression = parser.parsePrimaryExpression();
+ Expression expression = parsePrimaryExpression(doubleLiteral);
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<DoubleLiteral>());
- DoubleLiteral literal = expression;
+ var literal = expression as DoubleLiteral;
expect(literal.literal, isNotNull);
expect(literal.value, double.parse(doubleLiteral));
}
void test_parsePrimaryExpression_false() {
- createParser('false');
- Expression expression = parser.parsePrimaryExpression();
+ Expression expression = parsePrimaryExpression('false');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<BooleanLiteral>());
- BooleanLiteral literal = expression;
+ var literal = expression as BooleanLiteral;
expect(literal.literal, isNotNull);
expect(literal.value, isFalse);
}
void test_parsePrimaryExpression_function_arguments() {
- createParser('(int i) => i + 1');
- Expression expression = parser.parsePrimaryExpression();
+ Expression expression = parsePrimaryExpression('(int i) => i + 1');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<FunctionExpression>());
- FunctionExpression functionExpression = expression;
+ var functionExpression = expression as FunctionExpression;
expect(functionExpression.parameters, isNotNull);
expect(functionExpression.body, isNotNull);
}
void test_parsePrimaryExpression_function_noArguments() {
- createParser('() => 42');
- Expression expression = parser.parsePrimaryExpression();
+ Expression expression = parsePrimaryExpression('() => 42');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<FunctionExpression>());
- FunctionExpression functionExpression = expression;
+ var functionExpression = expression as FunctionExpression;
expect(functionExpression.parameters, isNotNull);
expect(functionExpression.body, isNotNull);
}
void test_parsePrimaryExpression_genericFunctionExpression() {
- createParser('<X, Y>(Map<X, Y> m, X x) => m[x]');
- Expression expression = parser.parsePrimaryExpression();
+ Expression expression =
+ parsePrimaryExpression('<X, Y>(Map<X, Y> m, X x) => m[x]');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<FunctionExpression>());
- FunctionExpression function = expression;
- expect(function.typeParameters, isNotNull);
+ var functionExpression = expression as FunctionExpression;
+ expect(functionExpression.typeParameters, isNotNull);
}
void test_parsePrimaryExpression_hex() {
String hexLiteral = "3F";
- createParser('0x$hexLiteral');
- Expression expression = parser.parsePrimaryExpression();
+ Expression expression = parsePrimaryExpression('0x$hexLiteral');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<IntegerLiteral>());
- IntegerLiteral literal = expression;
+ var literal = expression as IntegerLiteral;
expect(literal.literal, isNotNull);
expect(literal.value, int.parse(hexLiteral, radix: 16));
}
void test_parsePrimaryExpression_identifier() {
- createParser('a');
- Expression expression = parser.parsePrimaryExpression();
+ Expression expression = parsePrimaryExpression('a');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<SimpleIdentifier>());
- SimpleIdentifier identifier = expression;
+ var identifier = expression as SimpleIdentifier;
expect(identifier, isNotNull);
}
void test_parsePrimaryExpression_int() {
String intLiteral = "472";
- createParser(intLiteral);
- Expression expression = parser.parsePrimaryExpression();
+ Expression expression = parsePrimaryExpression(intLiteral);
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<IntegerLiteral>());
- IntegerLiteral literal = expression;
+ var literal = expression as IntegerLiteral;
expect(literal.literal, isNotNull);
expect(literal.value, int.parse(intLiteral));
}
void test_parsePrimaryExpression_listLiteral() {
- createParser('[ ]');
- Expression expression = parser.parsePrimaryExpression();
+ Expression expression = parsePrimaryExpression('[ ]');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<ListLiteral>());
- ListLiteral literal = expression;
+ var literal = expression as ListLiteral;
expect(literal, isNotNull);
}
void test_parsePrimaryExpression_listLiteral_index() {
- createParser('[]');
- Expression expression = parser.parsePrimaryExpression();
+ Expression expression = parsePrimaryExpression('[]');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<ListLiteral>());
- ListLiteral literal = expression;
+ var literal = expression as ListLiteral;
expect(literal, isNotNull);
}
void test_parsePrimaryExpression_listLiteral_typed() {
- createParser('<A>[ ]');
- Expression expression = parser.parsePrimaryExpression();
+ Expression expression = parsePrimaryExpression('<A>[ ]');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<ListLiteral>());
- ListLiteral literal = expression;
+ var literal = expression as ListLiteral;
expect(literal.typeArguments, isNotNull);
expect(literal.typeArguments.arguments, hasLength(1));
}
void test_parsePrimaryExpression_listLiteral_typed_genericComment() {
enableGenericMethodComments = true;
- createParser('/*<A>*/[ ]');
- Expression expression = parser.parsePrimaryExpression();
+ Expression expression = parsePrimaryExpression('/*<A>*/[ ]');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<ListLiteral>());
- ListLiteral literal = expression;
+ var literal = expression as ListLiteral;
expect(literal.typeArguments, isNotNull);
expect(literal.typeArguments.arguments, hasLength(1));
}
void test_parsePrimaryExpression_mapLiteral() {
- createParser('{}');
- Expression expression = parser.parsePrimaryExpression();
+ Expression expression = parsePrimaryExpression('{}');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<MapLiteral>());
- MapLiteral literal = expression;
+ var literal = expression as MapLiteral;
expect(literal.typeArguments, isNull);
expect(literal, isNotNull);
}
void test_parsePrimaryExpression_mapLiteral_typed() {
- createParser('<A, B>{}');
- Expression expression = parser.parsePrimaryExpression();
+ Expression expression = parsePrimaryExpression('<A, B>{}');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<MapLiteral>());
- MapLiteral literal = expression;
+ var literal = expression as MapLiteral;
expect(literal.typeArguments, isNotNull);
expect(literal.typeArguments.arguments, hasLength(2));
}
void test_parsePrimaryExpression_mapLiteral_typed_genericComment() {
enableGenericMethodComments = true;
- createParser('/*<A, B>*/{}');
- Expression expression = parser.parsePrimaryExpression();
+ Expression expression = parsePrimaryExpression('/*<A, B>*/{}');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<MapLiteral>());
- MapLiteral literal = expression;
+ var literal = expression as MapLiteral;
expect(literal.typeArguments, isNotNull);
expect(literal.typeArguments.arguments, hasLength(2));
}
void test_parsePrimaryExpression_new() {
- createParser('new A()');
- Expression expression = parser.parsePrimaryExpression();
+ Expression expression = parsePrimaryExpression('new A()');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<InstanceCreationExpression>());
- InstanceCreationExpression creation = expression;
+ var creation = expression as InstanceCreationExpression;
expect(creation, isNotNull);
}
void test_parsePrimaryExpression_null() {
- createParser('null');
- Expression expression = parser.parsePrimaryExpression();
+ Expression expression = parsePrimaryExpression('null');
expect(expression, isNotNull);
assertNoErrors();
expect(expression, new isInstanceOf<NullLiteral>());
@@ -5908,58 +5732,48 @@
}
void test_parsePrimaryExpression_parenthesized() {
- createParser('(x)');
- Expression expression = parser.parsePrimaryExpression();
+ Expression expression = parsePrimaryExpression('(x)');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<ParenthesizedExpression>());
- ParenthesizedExpression parens = expression;
+ var parens = expression as ParenthesizedExpression;
expect(parens, isNotNull);
}
void test_parsePrimaryExpression_string() {
- createParser('"string"');
- Expression expression = parser.parsePrimaryExpression();
+ Expression expression = parsePrimaryExpression('"string"');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<SimpleStringLiteral>());
- SimpleStringLiteral literal = expression;
+ var literal = expression as SimpleStringLiteral;
expect(literal.isMultiline, isFalse);
expect(literal.isRaw, isFalse);
expect(literal.value, "string");
}
void test_parsePrimaryExpression_string_multiline() {
- createParser("'''string'''");
- Expression expression = parser.parsePrimaryExpression();
+ Expression expression = parsePrimaryExpression("'''string'''");
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<SimpleStringLiteral>());
- SimpleStringLiteral literal = expression;
+ var literal = expression as SimpleStringLiteral;
expect(literal.isMultiline, isTrue);
expect(literal.isRaw, isFalse);
expect(literal.value, "string");
}
void test_parsePrimaryExpression_string_raw() {
- createParser("r'string'");
- Expression expression = parser.parsePrimaryExpression();
+ Expression expression = parsePrimaryExpression("r'string'");
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<SimpleStringLiteral>());
- SimpleStringLiteral literal = expression;
+ var literal = expression as SimpleStringLiteral;
expect(literal.isMultiline, isFalse);
expect(literal.isRaw, isTrue);
expect(literal.value, "string");
}
void test_parsePrimaryExpression_super() {
- createParser('super.x');
- Expression expression = parser.parsePrimaryExpression();
+ Expression expression = parsePrimaryExpression('super.x');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<PropertyAccess>());
- PropertyAccess propertyAccess = expression;
+ var propertyAccess = expression as PropertyAccess;
expect(propertyAccess.target is SuperExpression, isTrue);
expect(propertyAccess.operator, isNotNull);
expect(propertyAccess.operator.type, TokenType.PERIOD);
@@ -5967,57 +5781,48 @@
}
void test_parsePrimaryExpression_this() {
- createParser('this');
- Expression expression = parser.parsePrimaryExpression();
+ Expression expression = parsePrimaryExpression('this');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<ThisExpression>());
- ThisExpression thisExpression = expression;
+ var thisExpression = expression as ThisExpression;
expect(thisExpression.thisKeyword, isNotNull);
}
void test_parsePrimaryExpression_true() {
- createParser('true');
- Expression expression = parser.parsePrimaryExpression();
+ Expression expression = parsePrimaryExpression('true');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<BooleanLiteral>());
- BooleanLiteral literal = expression;
+ var literal = expression as BooleanLiteral;
expect(literal.literal, isNotNull);
expect(literal.value, isTrue);
}
void test_parseRelationalExpression_as_functionType_noReturnType() {
- createParser('x as Function(int)');
- Expression expression = parser.parseRelationalExpression();
+ Expression expression = parseRelationalExpression('x as Function(int)');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<AsExpression>());
- AsExpression asExpression = expression;
+ var asExpression = expression as AsExpression;
expect(asExpression.expression, isNotNull);
expect(asExpression.asOperator, isNotNull);
expect(asExpression.type, new isInstanceOf<GenericFunctionType>());
}
void test_parseRelationalExpression_as_functionType_returnType() {
- createParser('x as String Function(int)');
- Expression expression = parser.parseRelationalExpression();
+ Expression expression =
+ parseRelationalExpression('x as String Function(int)');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<AsExpression>());
- AsExpression asExpression = expression;
+ var asExpression = expression as AsExpression;
expect(asExpression.expression, isNotNull);
expect(asExpression.asOperator, isNotNull);
expect(asExpression.type, new isInstanceOf<GenericFunctionType>());
}
void test_parseRelationalExpression_as_generic() {
- createParser('x as C<D>');
- Expression expression = parser.parseRelationalExpression();
+ Expression expression = parseRelationalExpression('x as C<D>');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<AsExpression>());
- AsExpression asExpression = expression;
+ var asExpression = expression as AsExpression;
expect(asExpression.expression, isNotNull);
expect(asExpression.asOperator, isNotNull);
expect(asExpression.type, new isInstanceOf<TypeName>());
@@ -6025,48 +5830,40 @@
void test_parseRelationalExpression_as_nullable() {
enableNnbd = true;
- createParser('x as Y?)');
- Expression expression = parser.parseRelationalExpression();
+ Expression expression = parseRelationalExpression('x as Y?)');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<AsExpression>());
- AsExpression asExpression = expression;
+ var asExpression = expression as AsExpression;
expect(asExpression.expression, isNotNull);
expect(asExpression.asOperator, isNotNull);
expect(asExpression.type, new isInstanceOf<TypeName>());
}
void test_parseRelationalExpression_as_simple() {
- createParser('x as Y');
- Expression expression = parser.parseRelationalExpression();
+ Expression expression = parseRelationalExpression('x as Y');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<AsExpression>());
- AsExpression asExpression = expression;
+ var asExpression = expression as AsExpression;
expect(asExpression.expression, isNotNull);
expect(asExpression.asOperator, isNotNull);
expect(asExpression.type, new isInstanceOf<TypeName>());
}
void test_parseRelationalExpression_as_simple_function() {
- createParser('x as Function');
- Expression expression = parser.parseRelationalExpression();
+ Expression expression = parseRelationalExpression('x as Function');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<AsExpression>());
- AsExpression asExpression = expression;
+ var asExpression = expression as AsExpression;
expect(asExpression.expression, isNotNull);
expect(asExpression.asOperator, isNotNull);
expect(asExpression.type, new isInstanceOf<TypeName>());
}
void test_parseRelationalExpression_is() {
- createParser('x is y');
- Expression expression = parser.parseRelationalExpression();
+ Expression expression = parseRelationalExpression('x is y');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<IsExpression>());
- IsExpression isExpression = expression;
+ var isExpression = expression as IsExpression;
expect(isExpression.expression, isNotNull);
expect(isExpression.isOperator, isNotNull);
expect(isExpression.notOperator, isNull);
@@ -6075,12 +5872,10 @@
void test_parseRelationalExpression_is_nullable() {
enableNnbd = true;
- createParser('x is y?)');
- Expression expression = parser.parseRelationalExpression();
+ Expression expression = parseRelationalExpression('x is y?)');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<IsExpression>());
- IsExpression isExpression = expression;
+ var isExpression = expression as IsExpression;
expect(isExpression.expression, isNotNull);
expect(isExpression.isOperator, isNotNull);
expect(isExpression.notOperator, isNull);
@@ -6088,12 +5883,10 @@
}
void test_parseRelationalExpression_isNot() {
- createParser('x is! y');
- Expression expression = parser.parseRelationalExpression();
+ Expression expression = parseRelationalExpression('x is! y');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<IsExpression>());
- IsExpression isExpression = expression;
+ var isExpression = expression as IsExpression;
expect(isExpression.expression, isNotNull);
expect(isExpression.isOperator, isNotNull);
expect(isExpression.notOperator, isNotNull);
@@ -6101,12 +5894,10 @@
}
void test_parseRelationalExpression_normal() {
- createParser('x < y');
- Expression expression = parser.parseRelationalExpression();
+ Expression expression = parseRelationalExpression('x < y');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<BinaryExpression>());
- BinaryExpression binaryExpression = expression;
+ var binaryExpression = expression as BinaryExpression;
expect(binaryExpression.leftOperand, isNotNull);
expect(binaryExpression.operator, isNotNull);
expect(binaryExpression.operator.type, TokenType.LT);
@@ -6114,12 +5905,10 @@
}
void test_parseRelationalExpression_super() {
- createParser('super < y');
- Expression expression = parser.parseRelationalExpression();
+ Expression expression = parseRelationalExpression('super < y');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<BinaryExpression>());
- BinaryExpression binaryExpression = expression;
+ var binaryExpression = expression as BinaryExpression;
expect(binaryExpression.leftOperand, isNotNull);
expect(binaryExpression.operator, isNotNull);
expect(binaryExpression.operator.type, TokenType.LT);
@@ -6127,16 +5916,14 @@
}
void test_parseRethrowExpression() {
- createParser('rethrow;');
- RethrowExpression expression = parser.parseRethrowExpression();
+ RethrowExpression expression = parseRethrowExpression('rethrow');
expect(expression, isNotNull);
assertNoErrors();
expect(expression.rethrowKeyword, isNotNull);
}
void test_parseShiftExpression_normal() {
- createParser('x << y');
- BinaryExpression expression = parser.parseShiftExpression();
+ BinaryExpression expression = parseShiftExpression('x << y');
expect(expression, isNotNull);
assertNoErrors();
expect(expression.leftOperand, isNotNull);
@@ -6146,8 +5933,7 @@
}
void test_parseShiftExpression_super() {
- createParser('super << y');
- BinaryExpression expression = parser.parseShiftExpression();
+ BinaryExpression expression = parseShiftExpression('super << y');
expect(expression, isNotNull);
assertNoErrors();
expect(expression.leftOperand, isNotNull);
@@ -6162,8 +5948,7 @@
void test_parseSimpleIdentifier_builtInIdentifier() {
String lexeme = "as";
- createParser(lexeme);
- SimpleIdentifier identifier = parser.parseSimpleIdentifier();
+ SimpleIdentifier identifier = parseSimpleIdentifier(lexeme);
expect(identifier, isNotNull);
assertNoErrors();
expect(identifier.token, isNotNull);
@@ -6172,8 +5957,7 @@
void test_parseSimpleIdentifier_normalIdentifier() {
String lexeme = "foo";
- createParser(lexeme);
- SimpleIdentifier identifier = parser.parseSimpleIdentifier();
+ SimpleIdentifier identifier = parseSimpleIdentifier(lexeme);
expect(identifier, isNotNull);
assertNoErrors();
expect(identifier.token, isNotNull);
@@ -6181,12 +5965,10 @@
}
void test_parseStringLiteral_adjacent() {
- createParser("'a' 'b'");
- Expression expression = parser.parseStringLiteral();
+ Expression expression = parseStringLiteral("'a' 'b'");
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<AdjacentStrings>());
- AdjacentStrings literal = expression;
+ var literal = expression as AdjacentStrings;
NodeList<StringLiteral> strings = literal.strings;
expect(strings, hasLength(2));
StringLiteral firstString = strings[0];
@@ -6196,12 +5978,10 @@
}
void test_parseStringLiteral_endsWithInterpolation() {
- createParser(r"'x$y'");
- Expression expression = parser.parseStringLiteral();
+ Expression expression = parseStringLiteral(r"'x$y'");
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<StringInterpolation>());
- StringInterpolation interpolation = expression;
+ var interpolation = expression as StringInterpolation;
expect(interpolation.elements, hasLength(3));
expect(interpolation.elements[0], new isInstanceOf<InterpolationString>());
InterpolationString element0 = interpolation.elements[0];
@@ -6216,8 +5996,7 @@
}
void test_parseStringLiteral_interpolated() {
- createParser("'a \${b} c \$this d'");
- Expression expression = parser.parseStringLiteral();
+ Expression expression = parseStringLiteral("'a \${b} c \$this d'");
expect(expression, isNotNull);
assertNoErrors();
expect(expression, new isInstanceOf<StringInterpolation>());
@@ -6232,23 +6011,19 @@
}
void test_parseStringLiteral_multiline_encodedSpace() {
- createParser("'''\\x20\na'''");
- Expression expression = parser.parseStringLiteral();
+ Expression expression = parseStringLiteral("'''\\x20\na'''");
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<SimpleStringLiteral>());
- SimpleStringLiteral literal = expression;
+ var literal = expression as SimpleStringLiteral;
expect(literal.literal, isNotNull);
expect(literal.value, " \na");
}
void test_parseStringLiteral_multiline_endsWithInterpolation() {
- createParser(r"'''x$y'''");
- Expression expression = parser.parseStringLiteral();
+ Expression expression = parseStringLiteral(r"'''x$y'''");
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<StringInterpolation>());
- StringInterpolation interpolation = expression;
+ var interpolation = expression as StringInterpolation;
expect(interpolation.elements, hasLength(3));
expect(interpolation.elements[0], new isInstanceOf<InterpolationString>());
InterpolationString element0 = interpolation.elements[0];
@@ -6263,100 +6038,82 @@
}
void test_parseStringLiteral_multiline_escapedBackslash() {
- createParser("'''\\\\\na'''");
- Expression expression = parser.parseStringLiteral();
+ Expression expression = parseStringLiteral("'''\\\\\na'''");
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<SimpleStringLiteral>());
- SimpleStringLiteral literal = expression;
+ var literal = expression as SimpleStringLiteral;
expect(literal.literal, isNotNull);
expect(literal.value, "\\\na");
}
void test_parseStringLiteral_multiline_escapedBackslash_raw() {
- createParser("r'''\\\\\na'''");
- Expression expression = parser.parseStringLiteral();
+ Expression expression = parseStringLiteral("r'''\\\\\na'''");
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<SimpleStringLiteral>());
- SimpleStringLiteral literal = expression;
+ var literal = expression as SimpleStringLiteral;
expect(literal.literal, isNotNull);
expect(literal.value, "\\\\\na");
}
void test_parseStringLiteral_multiline_escapedEolMarker() {
- createParser("'''\\\na'''");
- Expression expression = parser.parseStringLiteral();
+ Expression expression = parseStringLiteral("'''\\\na'''");
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<SimpleStringLiteral>());
- SimpleStringLiteral literal = expression;
+ var literal = expression as SimpleStringLiteral;
expect(literal.literal, isNotNull);
expect(literal.value, "a");
}
void test_parseStringLiteral_multiline_escapedEolMarker_raw() {
- createParser("r'''\\\na'''");
- Expression expression = parser.parseStringLiteral();
+ Expression expression = parseStringLiteral("r'''\\\na'''");
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<SimpleStringLiteral>());
- SimpleStringLiteral literal = expression;
+ var literal = expression as SimpleStringLiteral;
expect(literal.literal, isNotNull);
expect(literal.value, "a");
}
void test_parseStringLiteral_multiline_escapedSpaceAndEolMarker() {
- createParser("'''\\ \\\na'''");
- Expression expression = parser.parseStringLiteral();
+ Expression expression = parseStringLiteral("'''\\ \\\na'''");
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<SimpleStringLiteral>());
- SimpleStringLiteral literal = expression;
+ var literal = expression as SimpleStringLiteral;
expect(literal.literal, isNotNull);
expect(literal.value, "a");
}
void test_parseStringLiteral_multiline_escapedSpaceAndEolMarker_raw() {
- createParser("r'''\\ \\\na'''");
- Expression expression = parser.parseStringLiteral();
+ Expression expression = parseStringLiteral("r'''\\ \\\na'''");
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<SimpleStringLiteral>());
- SimpleStringLiteral literal = expression;
+ var literal = expression as SimpleStringLiteral;
expect(literal.literal, isNotNull);
expect(literal.value, "a");
}
void test_parseStringLiteral_multiline_escapedTab() {
- createParser("'''\\t\na'''");
- Expression expression = parser.parseStringLiteral();
+ Expression expression = parseStringLiteral("'''\\t\na'''");
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<SimpleStringLiteral>());
- SimpleStringLiteral literal = expression;
+ var literal = expression as SimpleStringLiteral;
expect(literal.literal, isNotNull);
expect(literal.value, "\t\na");
}
void test_parseStringLiteral_multiline_escapedTab_raw() {
- createParser("r'''\\t\na'''");
- Expression expression = parser.parseStringLiteral();
+ Expression expression = parseStringLiteral("r'''\\t\na'''");
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<SimpleStringLiteral>());
- SimpleStringLiteral literal = expression;
+ var literal = expression as SimpleStringLiteral;
expect(literal.literal, isNotNull);
expect(literal.value, "\\t\na");
}
void test_parseStringLiteral_multiline_quoteAfterInterpolation() {
- createParser(r"""'''$x'y'''""");
- Expression expression = parser.parseStringLiteral();
+ Expression expression = parseStringLiteral(r"""'''$x'y'''""");
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<StringInterpolation>());
- StringInterpolation interpolation = expression;
+ var interpolation = expression as StringInterpolation;
expect(interpolation.elements, hasLength(3));
expect(interpolation.elements[0], new isInstanceOf<InterpolationString>());
InterpolationString element0 = interpolation.elements[0];
@@ -6371,12 +6128,10 @@
}
void test_parseStringLiteral_multiline_startsWithInterpolation() {
- createParser(r"'''${x}y'''");
- Expression expression = parser.parseStringLiteral();
+ Expression expression = parseStringLiteral(r"'''${x}y'''");
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<StringInterpolation>());
- StringInterpolation interpolation = expression;
+ var interpolation = expression as StringInterpolation;
expect(interpolation.elements, hasLength(3));
expect(interpolation.elements[0], new isInstanceOf<InterpolationString>());
InterpolationString element0 = interpolation.elements[0];
@@ -6391,45 +6146,37 @@
}
void test_parseStringLiteral_multiline_twoSpaces() {
- createParser("''' \na'''");
- Expression expression = parser.parseStringLiteral();
+ Expression expression = parseStringLiteral("''' \na'''");
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<SimpleStringLiteral>());
- SimpleStringLiteral literal = expression;
+ var literal = expression as SimpleStringLiteral;
expect(literal.literal, isNotNull);
expect(literal.value, "a");
}
void test_parseStringLiteral_multiline_twoSpaces_raw() {
- createParser("r''' \na'''");
- Expression expression = parser.parseStringLiteral();
+ Expression expression = parseStringLiteral("r''' \na'''");
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<SimpleStringLiteral>());
- SimpleStringLiteral literal = expression;
+ var literal = expression as SimpleStringLiteral;
expect(literal.literal, isNotNull);
expect(literal.value, "a");
}
void test_parseStringLiteral_multiline_untrimmed() {
- createParser("''' a\nb'''");
- Expression expression = parser.parseStringLiteral();
+ Expression expression = parseStringLiteral("''' a\nb'''");
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<SimpleStringLiteral>());
- SimpleStringLiteral literal = expression;
+ var literal = expression as SimpleStringLiteral;
expect(literal.literal, isNotNull);
expect(literal.value, " a\nb");
}
void test_parseStringLiteral_quoteAfterInterpolation() {
- createParser(r"""'$x"'""");
- Expression expression = parser.parseStringLiteral();
+ Expression expression = parseStringLiteral(r"""'$x"'""");
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<StringInterpolation>());
- StringInterpolation interpolation = expression;
+ var interpolation = expression as StringInterpolation;
expect(interpolation.elements, hasLength(3));
expect(interpolation.elements[0], new isInstanceOf<InterpolationString>());
InterpolationString element0 = interpolation.elements[0];
@@ -6444,23 +6191,19 @@
}
void test_parseStringLiteral_single() {
- createParser("'a'");
- Expression expression = parser.parseStringLiteral();
+ Expression expression = parseStringLiteral("'a'");
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<SimpleStringLiteral>());
- SimpleStringLiteral literal = expression;
+ var literal = expression as SimpleStringLiteral;
expect(literal.literal, isNotNull);
expect(literal.value, "a");
}
void test_parseStringLiteral_startsWithInterpolation() {
- createParser(r"'${x}y'");
- Expression expression = parser.parseStringLiteral();
+ Expression expression = parseStringLiteral(r"'${x}y'");
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<StringInterpolation>());
- StringInterpolation interpolation = expression;
+ var interpolation = expression as StringInterpolation;
expect(interpolation.elements, hasLength(3));
expect(interpolation.elements[0], new isInstanceOf<InterpolationString>());
InterpolationString element0 = interpolation.elements[0];
@@ -6475,9 +6218,8 @@
}
void test_parseSuperConstructorInvocation_named() {
- createParser('super.a()');
SuperConstructorInvocation invocation =
- parser.parseSuperConstructorInvocation();
+ parseSuperConstructorInvocation('super.a()');
expect(invocation, isNotNull);
assertNoErrors();
expect(invocation.argumentList, isNotNull);
@@ -6487,9 +6229,8 @@
}
void test_parseSuperConstructorInvocation_unnamed() {
- createParser('super()');
SuperConstructorInvocation invocation =
- parser.parseSuperConstructorInvocation();
+ parseSuperConstructorInvocation('super()');
expect(invocation, isNotNull);
assertNoErrors();
expect(invocation.argumentList, isNotNull);
@@ -6499,8 +6240,7 @@
}
void test_parseSymbolLiteral_builtInIdentifier() {
- createParser('#dynamic.static.abstract');
- SymbolLiteral literal = parser.parseSymbolLiteral();
+ SymbolLiteral literal = parseSymbolLiteral('#dynamic.static.abstract');
expect(literal, isNotNull);
assertNoErrors();
expect(literal.poundSign, isNotNull);
@@ -6512,8 +6252,7 @@
}
void test_parseSymbolLiteral_multiple() {
- createParser('#a.b.c');
- SymbolLiteral literal = parser.parseSymbolLiteral();
+ SymbolLiteral literal = parseSymbolLiteral('#a.b.c');
expect(literal, isNotNull);
assertNoErrors();
expect(literal.poundSign, isNotNull);
@@ -6525,8 +6264,7 @@
}
void test_parseSymbolLiteral_operator() {
- createParser('#==');
- SymbolLiteral literal = parser.parseSymbolLiteral();
+ SymbolLiteral literal = parseSymbolLiteral('#==');
expect(literal, isNotNull);
assertNoErrors();
expect(literal.poundSign, isNotNull);
@@ -6536,8 +6274,7 @@
}
void test_parseSymbolLiteral_single() {
- createParser('#a');
- SymbolLiteral literal = parser.parseSymbolLiteral();
+ SymbolLiteral literal = parseSymbolLiteral('#a');
expect(literal, isNotNull);
assertNoErrors();
expect(literal.poundSign, isNotNull);
@@ -6547,8 +6284,7 @@
}
void test_parseSymbolLiteral_void() {
- createParser('#void');
- SymbolLiteral literal = parser.parseSymbolLiteral();
+ SymbolLiteral literal = parseSymbolLiteral('#void');
expect(literal, isNotNull);
assertNoErrors();
expect(literal.poundSign, isNotNull);
@@ -6558,30 +6294,25 @@
}
void test_parseThrowExpression() {
- createParser('throw x;');
- Expression expression = parser.parseThrowExpression();
+ Expression expression = parseThrowExpression('throw x');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<ThrowExpression>());
- ThrowExpression throwExpression = expression;
+ var throwExpression = expression as ThrowExpression;
expect(throwExpression.throwKeyword, isNotNull);
expect(throwExpression.expression, isNotNull);
}
void test_parseThrowExpressionWithoutCascade() {
- createParser('throw x;');
- Expression expression = parser.parseThrowExpressionWithoutCascade();
+ Expression expression = parseThrowExpressionWithoutCascade('throw x');
expect(expression, isNotNull);
assertNoErrors();
- expect(expression, new isInstanceOf<ThrowExpression>());
- ThrowExpression throwExpression = expression;
+ var throwExpression = expression as ThrowExpression;
expect(throwExpression.throwKeyword, isNotNull);
expect(throwExpression.expression, isNotNull);
}
void test_parseUnaryExpression_decrement_normal() {
- createParser('--x');
- PrefixExpression expression = parser.parseUnaryExpression();
+ PrefixExpression expression = parseUnaryExpression('--x');
expect(expression, isNotNull);
assertNoErrors();
expect(expression.operator, isNotNull);
@@ -6590,8 +6321,7 @@
}
void test_parseUnaryExpression_decrement_super() {
- createParser('--super');
- PrefixExpression expression = parser.parseUnaryExpression();
+ PrefixExpression expression = parseUnaryExpression('--super');
expect(expression, isNotNull);
assertNoErrors();
expect(expression.operator, isNotNull);
@@ -6606,8 +6336,7 @@
}
void test_parseUnaryExpression_decrement_super_propertyAccess() {
- createParser('--super.x');
- PrefixExpression expression = parser.parseUnaryExpression();
+ PrefixExpression expression = parseUnaryExpression('--super.x');
expect(expression, isNotNull);
assertNoErrors();
expect(expression.operator, isNotNull);
@@ -6619,8 +6348,7 @@
}
void test_parseUnaryExpression_decrement_super_withComment() {
- createParser('/* 0 */ --super');
- PrefixExpression expression = parser.parseUnaryExpression();
+ PrefixExpression expression = parseUnaryExpression('/* 0 */ --super');
expect(expression, isNotNull);
assertNoErrors();
expect(expression.operator, isNotNull);
@@ -6636,8 +6364,7 @@
}
void test_parseUnaryExpression_increment_normal() {
- createParser('++x');
- PrefixExpression expression = parser.parseUnaryExpression();
+ PrefixExpression expression = parseUnaryExpression('++x');
expect(expression, isNotNull);
assertNoErrors();
expect(expression.operator, isNotNull);
@@ -6646,8 +6373,7 @@
}
void test_parseUnaryExpression_increment_super_index() {
- createParser('++super[0]');
- PrefixExpression expression = parser.parseUnaryExpression();
+ PrefixExpression expression = parseUnaryExpression('++super[0]');
expect(expression, isNotNull);
assertNoErrors();
expect(expression.operator, isNotNull);
@@ -6659,8 +6385,7 @@
}
void test_parseUnaryExpression_increment_super_propertyAccess() {
- createParser('++super.x');
- PrefixExpression expression = parser.parseUnaryExpression();
+ PrefixExpression expression = parseUnaryExpression('++super.x');
expect(expression, isNotNull);
assertNoErrors();
expect(expression.operator, isNotNull);
@@ -6672,8 +6397,7 @@
}
void test_parseUnaryExpression_minus_normal() {
- createParser('-x');
- PrefixExpression expression = parser.parseUnaryExpression();
+ PrefixExpression expression = parseUnaryExpression('-x');
expect(expression, isNotNull);
assertNoErrors();
expect(expression.operator, isNotNull);
@@ -6682,8 +6406,7 @@
}
void test_parseUnaryExpression_minus_super() {
- createParser('-super');
- PrefixExpression expression = parser.parseUnaryExpression();
+ PrefixExpression expression = parseUnaryExpression('-super');
expect(expression, isNotNull);
assertNoErrors();
expect(expression.operator, isNotNull);
@@ -6692,8 +6415,7 @@
}
void test_parseUnaryExpression_not_normal() {
- createParser('!x');
- PrefixExpression expression = parser.parseUnaryExpression();
+ PrefixExpression expression = parseUnaryExpression('!x');
expect(expression, isNotNull);
assertNoErrors();
expect(expression.operator, isNotNull);
@@ -6702,8 +6424,7 @@
}
void test_parseUnaryExpression_not_super() {
- createParser('!super');
- PrefixExpression expression = parser.parseUnaryExpression();
+ PrefixExpression expression = parseUnaryExpression('!super');
expect(expression, isNotNull);
assertNoErrors();
expect(expression.operator, isNotNull);
@@ -6712,8 +6433,7 @@
}
void test_parseUnaryExpression_tilda_normal() {
- createParser('~x');
- PrefixExpression expression = parser.parseUnaryExpression();
+ PrefixExpression expression = parseUnaryExpression('~x');
expect(expression, isNotNull);
assertNoErrors();
expect(expression.operator, isNotNull);
@@ -6722,8 +6442,7 @@
}
void test_parseUnaryExpression_tilda_super() {
- createParser('~super');
- PrefixExpression expression = parser.parseUnaryExpression();
+ PrefixExpression expression = parseUnaryExpression('~super');
expect(expression, isNotNull);
assertNoErrors();
expect(expression.operator, isNotNull);
@@ -7985,6 +7704,59 @@
}
}
+ @override
+ Expression parseAdditiveExpression(String code) {
+ createParser(code);
+ return parser.parseAdditiveExpression();
+ }
+
+ @override
+ Expression parseAssignableExpression(String code, bool primaryAllowed) {
+ createParser(code);
+ return parser.parseAssignableExpression(primaryAllowed);
+ }
+
+ @override
+ Expression parseAssignableSelector(
+ String code, bool optional,
+ {bool allowConditional: true}) {
+ Expression prefix =
+ astFactory.simpleIdentifier(new StringToken(TokenType.STRING, 'foo', 0));
+ createParser(code);
+ return parser.parseAssignableSelector(prefix, optional,
+ allowConditional: allowConditional);
+ }
+
+ @override
+ AwaitExpression parseAwaitExpression(String code) {
+ createParser(code);
+ return parser.parseAwaitExpression();
+ }
+
+ @override
+ Expression parseBitwiseAndExpression(String code) {
+ createParser(code);
+ return parser.parseBitwiseAndExpression();
+ }
+
+ @override
+ Expression parseBitwiseOrExpression(String code) {
+ createParser(code);
+ return parser.parseBitwiseOrExpression();
+ }
+
+ @override
+ Expression parseBitwiseXorExpression(String code) {
+ createParser(code);
+ return parser.parseBitwiseXorExpression();
+ }
+
+ @override
+ Expression parseCascadeSection(String code) {
+ createParser(code);
+ return parser.parseCascadeSection();
+ }
+
/**
* Parse the given source as a compilation unit.
*
@@ -8037,6 +7809,18 @@
}
@override
+ ConditionalExpression parseConditionalExpression(String code) {
+ createParser(code);
+ return parser.parseConditionalExpression();
+ }
+
+ @override
+ Expression parseConstExpression(String code) {
+ createParser(code);
+ return parser.parseConstExpression();
+ }
+
+ @override
CompilationUnit parseDirectives(String source,
[List<ErrorCode> errorCodes = const <ErrorCode>[]]) {
createParser(source);
@@ -8047,6 +7831,12 @@
return unit;
}
+ @override
+ BinaryExpression parseEqualityExpression(String code) {
+ createParser(code);
+ return parser.parseEqualityExpression();
+ }
+
/**
* Parse the given source as an expression.
*
@@ -8066,6 +7856,18 @@
}
@override
+ List<Expression> parseExpressionList(String code) {
+ createParser(code);
+ return parser.parseExpressionList();
+ }
+
+ @override
+ Expression parseExpressionWithoutCascade(String code) {
+ createParser(code);
+ return parser.parseExpressionWithoutCascade();
+ }
+
+ @override
FormalParameter parseFormalParameter(String code, ParameterKind kind,
{List<ErrorCode> errorCodes: const <ErrorCode>[]}) {
createParser(code);
@@ -8105,6 +7907,79 @@
parser.parseCommentAndMetadata());
@override
+ FunctionExpression parseFunctionExpression(String code) {
+ createParser(code);
+ return parser.parseFunctionExpression();
+ }
+
+ @override
+ InstanceCreationExpression parseInstanceCreationExpression(
+ String code, Token newToken) {
+ createParser(code);
+ return parser.parseInstanceCreationExpression(newToken);
+ }
+
+ @override
+ ListLiteral parseListLiteral(
+ Token token, String typeArgumentsCode, String code) {
+ TypeArgumentList typeArguments;
+ if (typeArgumentsCode != null) {
+ createParser(typeArgumentsCode);
+ typeArguments = parser.parseTypeArgumentList();
+ }
+ createParser(code);
+ return parser.parseListLiteral(token, typeArguments);
+ }
+
+ @override
+ TypedLiteral parseListOrMapLiteral(Token modifier, String code) {
+ createParser(code);
+ return parser.parseListOrMapLiteral(modifier);
+ }
+
+ @override
+ Expression parseLogicalAndExpression(String code) {
+ createParser(code);
+ return parser.parseLogicalAndExpression();
+ }
+
+ @override
+ Expression parseLogicalOrExpression(String code) {
+ createParser(code);
+ return parser.parseLogicalOrExpression();
+ }
+
+ @override
+ MapLiteral parseMapLiteral(
+ Token token, String typeArgumentsCode, String code) {
+ TypeArgumentList typeArguments;
+ if (typeArgumentsCode != null) {
+ createParser(typeArgumentsCode);
+ typeArguments = parser.parseTypeArgumentList();
+ }
+ createParser(code);
+ return parser.parseMapLiteral(token, typeArguments);
+ }
+
+ @override
+ MapLiteralEntry parseMapLiteralEntry(String code) {
+ createParser(code);
+ return parser.parseMapLiteralEntry();
+ }
+
+ @override
+ Expression parseMultiplicativeExpression(String code) {
+ createParser(code);
+ return parser.parseMultiplicativeExpression();
+ }
+
+ @override
+ InstanceCreationExpression parseNewExpression(String code) {
+ createParser(code);
+ return parser.parseNewExpression();
+ }
+
+ @override
NormalFormalParameter parseNormalFormalParameter(String code,
{bool inFunctionType: false,
List<ErrorCode> errorCodes: const <ErrorCode>[]}) {
@@ -8115,6 +7990,48 @@
return parameter;
}
+ @override
+ Expression parsePostfixExpression(String code) {
+ createParser(code);
+ return parser.parsePostfixExpression();
+ }
+
+ @override
+ Identifier parsePrefixedIdentifier(String code) {
+ createParser(code);
+ return parser.parsePrefixedIdentifier();
+ }
+
+ @override
+ Expression parsePrimaryExpression(String code) {
+ createParser(code);
+ return parser.parsePrimaryExpression();
+ }
+
+ @override
+ Expression parseRelationalExpression(String code) {
+ createParser(code);
+ return parser.parseRelationalExpression();
+ }
+
+ @override
+ RethrowExpression parseRethrowExpression(String code) {
+ createParser(code);
+ return parser.parseRethrowExpression();
+ }
+
+ @override
+ BinaryExpression parseShiftExpression(String code) {
+ createParser(code);
+ return parser.parseShiftExpression();
+ }
+
+ @override
+ SimpleIdentifier parseSimpleIdentifier(String code) {
+ createParser(code);
+ return parser.parseSimpleIdentifier();
+ }
+
/**
* Parse the given [source] as a statement. The [errorCodes] are the error
* codes of the errors that are expected to be found. If
@@ -8163,6 +8080,42 @@
}
@override
+ Expression parseStringLiteral(String code) {
+ createParser(code);
+ return parser.parseStringLiteral();
+ }
+
+ @override
+ SuperConstructorInvocation parseSuperConstructorInvocation(String code) {
+ createParser(code);
+ return parser.parseSuperConstructorInvocation();
+ }
+
+ @override
+ SymbolLiteral parseSymbolLiteral(String code) {
+ createParser(code);
+ return parser.parseSymbolLiteral();
+ }
+
+ @override
+ Expression parseThrowExpression(String code) {
+ createParser(code);
+ return parser.parseThrowExpression();
+ }
+
+ @override
+ Expression parseThrowExpressionWithoutCascade(String code) {
+ createParser(code);
+ return parser.parseThrowExpressionWithoutCascade();
+ }
+
+ @override
+ PrefixExpression parseUnaryExpression(String code) {
+ createParser(code);
+ return parser.parseUnaryExpression();
+ }
+
+ @override
void setUp() {
super.setUp();
parseFunctionBodies = true;
@@ -9269,8 +9222,7 @@
}
void test_primaryExpression_argumentDefinitionTest() {
- createParser('?a');
- Expression expression = parser.parsePrimaryExpression();
+ Expression expression = parsePrimaryExpression('?a');
expectNotNullIfNoErrors(expression);
listener.assertErrorsWithCodes([ParserErrorCode.UNEXPECTED_TOKEN]);
expect(expression, new isInstanceOf<SimpleIdentifier>());
@@ -9787,8 +9739,7 @@
Expression expression = parser.parseArgument();
expectNotNullIfNoErrors(expression);
listener.assertNoErrors();
- expect(expression, new isInstanceOf<SimpleIdentifier>());
- SimpleIdentifier identifier = expression;
+ var identifier = expression as SimpleIdentifier;
expect(identifier.name, lexeme);
}
diff --git a/pkg/analyzer_cli/lib/src/driver.dart b/pkg/analyzer_cli/lib/src/driver.dart
index f6d67ec..464bcda 100644
--- a/pkg/analyzer_cli/lib/src/driver.dart
+++ b/pkg/analyzer_cli/lib/src/driver.dart
@@ -748,10 +748,16 @@
contextRoot = path.absolute(contextRoot);
}
}
+
+ void verbosePrint(String text) {
+ outSink.writeln(text);
+ }
+
AnalysisOptionsImpl contextOptions = new ContextBuilder(
resourceProvider, null, null,
options: options.contextBuilderOptions)
- .getAnalysisOptions(contextRoot);
+ .getAnalysisOptions(contextRoot,
+ verbosePrint: options.verbose ? verbosePrint : null);
contextOptions.trackCacheDependencies = false;
contextOptions.disableCacheFlushing = options.disableCacheFlushing;
diff --git a/pkg/compiler/lib/src/js_backend/backend_helpers.dart b/pkg/compiler/lib/src/js_backend/backend_helpers.dart
index 088c4de..66251fc 100644
--- a/pkg/compiler/lib/src/js_backend/backend_helpers.dart
+++ b/pkg/compiler/lib/src/js_backend/backend_helpers.dart
@@ -612,6 +612,9 @@
FunctionEntity get subtypeCast => _findHelperFunction('subtypeCast');
+ FunctionEntity get functionTypeTest =>
+ _findHelperFunction('functionTypeTest');
+
FunctionEntity get checkSubtypeOfRuntimeType =>
_findHelperFunction('checkSubtypeOfRuntimeType');
@@ -710,45 +713,6 @@
ClassEntity get VoidRuntimeType => _findHelperClass('VoidRuntimeType');
- ClassEntity get RuntimeType => _findHelperClass('RuntimeType');
-
- ClassEntity get RuntimeFunctionType =>
- _findHelperClass('RuntimeFunctionType');
-
- ClassEntity get RuntimeTypePlain => _findHelperClass('RuntimeTypePlain');
-
- ClassEntity get RuntimeTypeGeneric => _findHelperClass('RuntimeTypeGeneric');
-
- ClassEntity get DynamicRuntimeType => _findHelperClass('DynamicRuntimeType');
-
- FunctionEntity get getDynamicRuntimeType {
- // TODO(johnniwinther): Support this in mocks.
- return _env.lookupLibraryMember(jsHelperLibrary, 'getDynamicRuntimeType');
- }
-
- FunctionEntity get getVoidRuntimeType {
- // TODO(johnniwinther): Support this in mocks.
- return _env.lookupLibraryMember(jsHelperLibrary, 'getVoidRuntimeType');
- }
-
- FunctionEntity get buildInterfaceType {
- // TODO(johnniwinther): Support this in mocks.
- return _env.lookupLibraryMember(jsHelperLibrary, 'buildInterfaceType');
- }
-
- FunctionEntity get buildFunctionType {
- // TODO(johnniwinther): Support this in mocks.
- return _env.lookupLibraryMember(jsHelperLibrary, 'buildFunctionType');
- }
-
- FunctionEntity get buildNamedFunctionType {
- // TODO(johnniwinther): Support this in mocks.
- return _env.lookupLibraryMember(jsHelperLibrary, 'buildNamedFunctionType');
- }
-
- FunctionEntity get functionTypeTestMetaHelper =>
- _findHelperFunction('functionTypeTestMetaHelper');
-
FunctionEntity get defineProperty => _findHelperFunction('defineProperty');
FunctionEntity get startRootIsolate =>
diff --git a/pkg/compiler/lib/src/js_backend/backend_impact.dart b/pkg/compiler/lib/src/js_backend/backend_impact.dart
index 0ba422f..892c946 100644
--- a/pkg/compiler/lib/src/js_backend/backend_impact.dart
+++ b/pkg/compiler/lib/src/js_backend/backend_impact.dart
@@ -503,7 +503,7 @@
BackendImpact get functionTypeCheck {
return _functionTypeCheck ??=
- new BackendImpact(staticUses: [helpers.functionTypeTestMetaHelper]);
+ new BackendImpact(staticUses: [/*helpers.functionTypeTestMetaHelper*/]);
}
BackendImpact _nativeTypeCheck;
diff --git a/pkg/compiler/lib/src/js_backend/checked_mode_helpers.dart b/pkg/compiler/lib/src/js_backend/checked_mode_helpers.dart
index ab44766..be9011f 100644
--- a/pkg/compiler/lib/src/js_backend/checked_mode_helpers.dart
+++ b/pkg/compiler/lib/src/js_backend/checked_mode_helpers.dart
@@ -89,6 +89,19 @@
}
}
+class FunctionTypeRepresentationCheckedModeHelper extends CheckedModeHelper {
+ const FunctionTypeRepresentationCheckedModeHelper(String name) : super(name);
+
+ CallStructure get callStructure => CallStructure.TWO_ARGS;
+
+ void generateAdditionalArguments(SsaCodeGenerator codegen,
+ HTypeConversion node, List<jsAst.Expression> arguments) {
+ assert(node.typeExpression.isFunctionType);
+ codegen.use(node.typeRepresentation);
+ arguments.add(codegen.pop());
+ }
+}
+
class SubtypeCheckedModeHelper extends CheckedModeHelper {
const SubtypeCheckedModeHelper(String name) : super(name);
@@ -96,6 +109,8 @@
void generateAdditionalArguments(SsaCodeGenerator codegen,
HTypeConversion node, List<jsAst.Expression> arguments) {
+ // TODO(sra): Move these calls into the SSA graph so that the arguments can
+ // be optimized, e,g, GVNed.
InterfaceType type = node.typeExpression;
ClassEntity element = type.element;
jsAst.Name isField = codegen.backend.namer.operatorIs(element);
@@ -149,6 +164,8 @@
const TypeVariableCheckedModeHelper('assertSubtypeOfRuntimeType'),
const PropertyCheckedModeHelper('propertyTypeCast'),
const PropertyCheckedModeHelper('propertyTypeCheck'),
+ const FunctionTypeRepresentationCheckedModeHelper('functionTypeCast'),
+ const FunctionTypeRepresentationCheckedModeHelper('functionTypeCheck'),
];
// Checked mode helpers indexed by name.
@@ -212,7 +229,9 @@
: 'assertSubtypeOfRuntimeType';
}
- if (type.isFunctionType) return null;
+ if (type.isFunctionType) {
+ return typeCast ? 'functionTypeCast' : 'functionTypeCheck';
+ }
assert(invariant(NO_LOCATION_SPANNABLE, type.isInterfaceType,
message: "Unexpected type: $type"));
diff --git a/pkg/compiler/lib/src/js_backend/namer.dart b/pkg/compiler/lib/src/js_backend/namer.dart
index c41e2b9..a1e17a7a 100644
--- a/pkg/compiler/lib/src/js_backend/namer.dart
+++ b/pkg/compiler/lib/src/js_backend/namer.dart
@@ -906,14 +906,6 @@
}
/**
- * Returns name of the JavaScript property used to store the
- * `readTypeVariable` function for the given type variable.
- */
- jsAst.Name nameForReadTypeVariable(TypeVariableElement element) {
- return _disambiguateInternalMember(element, () => element.name);
- }
-
- /**
* Returns a JavaScript property name used to store [element] on one
* of the global objects.
*
diff --git a/pkg/compiler/lib/src/js_emitter/code_emitter_task.dart b/pkg/compiler/lib/src/js_emitter/code_emitter_task.dart
index 430f1de..cb69608 100644
--- a/pkg/compiler/lib/src/js_emitter/code_emitter_task.dart
+++ b/pkg/compiler/lib/src/js_emitter/code_emitter_task.dart
@@ -40,10 +40,6 @@
Emitter _emitter;
final Compiler compiler;
- /// Records if a type variable is read dynamically for type tests.
- final Set<TypeVariableEntity> readTypeVariables =
- new Set<TypeVariableEntity>();
-
JavaScriptBackend get backend => compiler.backend;
@deprecated
@@ -151,10 +147,6 @@
return emitter.templateForBuiltin(builtin);
}
- void registerReadTypeVariable(TypeVariableEntity element) {
- readTypeVariables.add(element);
- }
-
Set<ClassEntity> _finalizeRti() {
// Compute the required type checks to know which classes need a
// 'is$' method.
diff --git a/pkg/compiler/lib/src/js_emitter/full_emitter/class_emitter.dart b/pkg/compiler/lib/src/js_emitter/full_emitter/class_emitter.dart
index 2be2636..5e341d4 100644
--- a/pkg/compiler/lib/src/js_emitter/full_emitter/class_emitter.dart
+++ b/pkg/compiler/lib/src/js_emitter/full_emitter/class_emitter.dart
@@ -63,7 +63,6 @@
emitClassGettersSettersForCSP(cls, builder);
emitInstanceMembers(cls, builder);
emitStubs(cls.callStubs, builder);
- emitStubs(cls.typeVariableReaderStubs, builder);
emitRuntimeTypeInformation(cls, builder);
emitNativeInfo(cls, builder);
diff --git a/pkg/compiler/lib/src/js_emitter/lazy_emitter/model_emitter.dart b/pkg/compiler/lib/src/js_emitter/lazy_emitter/model_emitter.dart
index 6744c1e..ca11591f 100644
--- a/pkg/compiler/lib/src/js_emitter/lazy_emitter/model_emitter.dart
+++ b/pkg/compiler/lib/src/js_emitter/lazy_emitter/model_emitter.dart
@@ -715,14 +715,12 @@
Iterable<Method> methods = cls.methods;
Iterable<Method> isChecks = cls.isChecks;
Iterable<Method> callStubs = cls.callStubs;
- Iterable<Method> typeVariableReaderStubs = cls.typeVariableReaderStubs;
Iterable<Method> noSuchMethodStubs = cls.noSuchMethodStubs;
Iterable<Method> gettersSetters = _generateGettersSetters(cls);
Iterable<Method> allMethods = [
methods,
isChecks,
callStubs,
- typeVariableReaderStubs,
noSuchMethodStubs,
gettersSetters
].expand((x) => x);
diff --git a/pkg/compiler/lib/src/js_emitter/model.dart b/pkg/compiler/lib/src/js_emitter/model.dart
index b4473a6..593798a 100644
--- a/pkg/compiler/lib/src/js_emitter/model.dart
+++ b/pkg/compiler/lib/src/js_emitter/model.dart
@@ -223,9 +223,6 @@
/// Stub methods for this class that are call stubs for getters.
final List<StubMethod> callStubs;
- /// Stub methods for this class handling reads to type variables.
- final List<StubMethod> typeVariableReaderStubs;
-
/// noSuchMethod stubs in the special case that the class is Object.
final List<StubMethod> noSuchMethodStubs;
final List<Field> staticFieldsForReflection;
@@ -258,7 +255,6 @@
this.fields,
this.staticFieldsForReflection,
this.callStubs,
- this.typeVariableReaderStubs,
this.noSuchMethodStubs,
this.checkedSetters,
this.isChecks,
@@ -295,7 +291,6 @@
List<Field> instanceFields,
List<Field> staticFieldsForReflection,
List<StubMethod> callStubs,
- List<StubMethod> typeVariableReaderStubs,
List<StubMethod> checkedSetters,
List<StubMethod> isChecks,
js.Expression functionTypeIndex,
@@ -310,7 +305,6 @@
instanceFields,
staticFieldsForReflection,
callStubs,
- typeVariableReaderStubs,
const <StubMethod>[],
checkedSetters,
isChecks,
diff --git a/pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart b/pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart
index 08e2ee3..0d7f2b5 100644
--- a/pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart
+++ b/pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart
@@ -531,9 +531,6 @@
}
}
- List<StubMethod> typeVariableReaderStubs =
- runtimeTypeGenerator.generateTypeVariableReaderStubs(element);
-
List<StubMethod> noSuchMethodStubs = <StubMethod>[];
if (backend.enabledNoSuchMethod && element.isObject) {
@@ -620,7 +617,6 @@
instanceFields,
staticFieldsForReflection,
callStubs,
- typeVariableReaderStubs,
checkedSetters,
isChecks,
typeTests.functionTypeIndex,
@@ -636,7 +632,6 @@
instanceFields,
staticFieldsForReflection,
callStubs,
- typeVariableReaderStubs,
noSuchMethodStubs,
checkedSetters,
isChecks,
diff --git a/pkg/compiler/lib/src/js_emitter/runtime_type_generator.dart b/pkg/compiler/lib/src/js_emitter/runtime_type_generator.dart
index 0791151..09fe5ba 100644
--- a/pkg/compiler/lib/src/js_emitter/runtime_type_generator.dart
+++ b/pkg/compiler/lib/src/js_emitter/runtime_type_generator.dart
@@ -329,48 +329,4 @@
superclass, generateIsTest, generateSubstitution, alreadyGenerated);
}
}
-
- List<StubMethod> generateTypeVariableReaderStubs(ClassElement classElement) {
- List<StubMethod> stubs = <StubMethod>[];
- ClassElement superclass = classElement;
- while (superclass != null) {
- for (ResolutionTypeVariableType parameter in superclass.typeVariables) {
- if (backend.emitter.readTypeVariables.contains(parameter.element)) {
- stubs.add(
- _generateTypeVariableReader(classElement, parameter.element));
- }
- }
- superclass = superclass.superclass;
- }
-
- return stubs;
- }
-
- StubMethod _generateTypeVariableReader(
- ClassElement cls, TypeVariableElement element) {
- jsAst.Name name = namer.nameForReadTypeVariable(element);
- int index = element.index;
- jsAst.Expression computeTypeVariable;
-
- Substitution substitution =
- backend.rti.getSubstitution(cls, element.typeDeclaration);
- jsAst.Name rtiFieldName = backend.namer.rtiFieldJsName;
- if (substitution != null) {
- computeTypeVariable = js(r'#.apply(null, this.#)', [
- backend.rtiEncoder.getSubstitutionCodeForVariable(substitution, index),
- rtiFieldName
- ]);
- } else {
- // TODO(ahe): These can be generated dynamically.
- computeTypeVariable = js(r'this.# && this.#[#]',
- [rtiFieldName, rtiFieldName, js.number(index)]);
- }
- jsAst.Expression convertRtiToRuntimeType = backend.emitter
- .staticFunctionAccess(backend.helpers.convertRtiToRuntimeType);
-
- return new StubMethod(
- name,
- js('function () { return #(#) }',
- [convertRtiToRuntimeType, computeTypeVariable]));
- }
}
diff --git a/pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_emitter.dart b/pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_emitter.dart
index 3335c4a..a0eb6fe 100644
--- a/pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_emitter.dart
+++ b/pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_emitter.dart
@@ -702,7 +702,6 @@
Iterable<Method> checkedSetters = cls.checkedSetters;
Iterable<Method> isChecks = cls.isChecks;
Iterable<Method> callStubs = cls.callStubs;
- Iterable<Method> typeVariableReaderStubs = cls.typeVariableReaderStubs;
Iterable<Method> noSuchMethodStubs = cls.noSuchMethodStubs;
Iterable<Method> gettersSetters = generateGettersSetters(cls);
Iterable<Method> allMethods = [
@@ -710,7 +709,6 @@
checkedSetters,
isChecks,
callStubs,
- typeVariableReaderStubs,
noSuchMethodStubs,
gettersSetters
].expand((x) => x);
diff --git a/pkg/compiler/lib/src/parser/element_listener.dart b/pkg/compiler/lib/src/parser/element_listener.dart
index de5445f..1c50d01 100644
--- a/pkg/compiler/lib/src/parser/element_listener.dart
+++ b/pkg/compiler/lib/src/parser/element_listener.dart
@@ -410,6 +410,10 @@
}
@override
+ void handleNoConstructorReferenceContinuationAfterTypeArguments(Token token) {
+ }
+
+ @override
void handleNoType(Token token) {
pushNode(null);
}
diff --git a/pkg/compiler/lib/src/parser/member_listener.dart b/pkg/compiler/lib/src/parser/member_listener.dart
index 4697d5b..b1684cb 100644
--- a/pkg/compiler/lib/src/parser/member_listener.dart
+++ b/pkg/compiler/lib/src/parser/member_listener.dart
@@ -115,9 +115,10 @@
}
@override
- void endFields(int count, Token beginToken, Token endToken) {
+ void endFields(
+ int count, Token covariantKeyword, Token beginToken, Token endToken) {
bool hasParseError = memberErrors.head;
- super.endFields(count, beginToken, endToken);
+ super.endFields(count, covariantKeyword, beginToken, endToken);
VariableDefinitions variableDefinitions = popNode();
Modifiers modifiers = variableDefinitions.modifiers;
pushNode(null);
diff --git a/pkg/compiler/lib/src/parser/node_listener.dart b/pkg/compiler/lib/src/parser/node_listener.dart
index 4317efc..09483b2 100644
--- a/pkg/compiler/lib/src/parser/node_listener.dart
+++ b/pkg/compiler/lib/src/parser/node_listener.dart
@@ -164,15 +164,8 @@
typeParameters = functionType.typeParameters;
formals = functionType.formals;
}
- pushNode(new Typedef(
- isGeneralizedTypeAlias,
- templateParameters,
- returnType,
- name,
- typeParameters,
- formals,
- typedefKeyword,
- endToken));
+ pushNode(new Typedef(isGeneralizedTypeAlias, templateParameters, returnType,
+ name, typeParameters, formals, typedefKeyword, endToken));
}
void handleNoName(Token token) {
@@ -234,8 +227,8 @@
}
@override
- void endFormalParameter(Token covariantKeyword, Token thisKeyword,
- FormalParameterType kind) {
+ void endFormalParameter(
+ Token covariantKeyword, Token thisKeyword, FormalParameterType kind) {
Expression name = popNode();
if (thisKeyword != null) {
Identifier thisIdentifier = new Identifier(thisKeyword);
@@ -309,6 +302,10 @@
pushNode(new RedirectingFactoryBody(beginToken, endToken, popNode()));
}
+ void endExpressionFunctionBody(Token arrowToken, Token endToken) {
+ endReturnStatement(true, arrowToken, endToken);
+ }
+
@override
void endReturnStatement(
bool hasExpression, Token beginToken, Token endToken) {
@@ -664,7 +661,8 @@
}
@override
- void endFields(int count, Token beginToken, Token endToken) {
+ void endFields(
+ int count, Token covariantKeyword, Token beginToken, Token endToken) {
NodeList variables = makeNodeList(count, null, endToken, ",");
TypeAnnotation type = popNode();
Modifiers modifiers = popNode();
@@ -757,8 +755,8 @@
}
@override
- void endFunctionTypedFormalParameter(Token covariantKeyword,
- Token thisKeyword, FormalParameterType kind) {
+ void endFunctionTypedFormalParameter(
+ Token covariantKeyword, Token thisKeyword, FormalParameterType kind) {
NodeList formals = popNode();
NodeList typeVariables = popNode();
Identifier name = popNode();
@@ -777,8 +775,7 @@
}
@override
- void handleFormalParameterWithoutValue(Token token) {
- }
+ void handleFormalParameterWithoutValue(Token token) {}
@override
void endTryStatement(int catchCount, Token tryKeyword, Token finallyKeyword) {
@@ -865,6 +862,7 @@
AsyncModifier asyncModifier = popNode();
NodeList formals = popNode();
Node name = popNode();
+ popNode(); // Discard modifiers. They're recomputed below.
// TODO(ahe): Move this parsing to the parser.
int modifierCount = 0;
diff --git a/pkg/compiler/lib/src/ssa/builder.dart b/pkg/compiler/lib/src/ssa/builder.dart
index 1b44c1d..e6ae55e 100644
--- a/pkg/compiler/lib/src/ssa/builder.dart
+++ b/pkg/compiler/lib/src/ssa/builder.dart
@@ -301,13 +301,6 @@
add(attachPosition(instruction, node));
}
- HTypeConversion buildFunctionTypeConversion(
- HInstruction original, ResolutionDartType type, int kind) {
- HInstruction reifiedType = buildFunctionType(type);
- return new HTypeConversion.viaMethodOnType(
- type, kind, original.instructionType, reifiedType, original);
- }
-
/**
* Returns a complete argument list for a call of [function].
*/
@@ -2414,14 +2407,16 @@
HInstruction call = pop();
return new HIs.compound(type, expression, call, commonMasks.boolType);
} else if (type.isFunctionType) {
- List arguments = [buildFunctionType(type), expression];
- pushInvokeDynamic(
- node,
- new Selector.call(new PrivateName('_isTest', helpers.jsHelperLibrary),
- CallStructure.ONE_ARG),
- null,
- arguments);
- return new HIs.compound(type, expression, pop(), commonMasks.boolType);
+ HInstruction representation =
+ typeBuilder.analyzeTypeArgument(type, sourceElement);
+ List<HInstruction> inputs = <HInstruction>[
+ expression,
+ representation,
+ ];
+ pushInvokeStatic(node, helpers.functionTypeTest, inputs,
+ typeMask: commonMasks.boolType);
+ HInstruction call = pop();
+ return new HIs.compound(type, expression, call, commonMasks.boolType);
} else if (type.isTypeVariable) {
HInstruction runtimeType =
typeBuilder.addTypeVariableReference(type, sourceElement);
diff --git a/pkg/compiler/lib/src/ssa/builder_kernel.dart b/pkg/compiler/lib/src/ssa/builder_kernel.dart
index 66888f4..1d89901 100644
--- a/pkg/compiler/lib/src/ssa/builder_kernel.dart
+++ b/pkg/compiler/lib/src/ssa/builder_kernel.dart
@@ -476,13 +476,6 @@
_buildInitializers(constructor, constructorChain, fieldValues);
}
- HTypeConversion buildFunctionTypeConversion(
- HInstruction original, ResolutionDartType type, int kind) {
- HInstruction reifiedType = buildFunctionType(type);
- return new HTypeConversion.viaMethodOnType(
- type, kind, original.instructionType, reifiedType, original);
- }
-
/// Builds generative constructor body.
void buildConstructorBody(ir.Constructor constructor) {
openFunction();
@@ -2856,14 +2849,18 @@
ResolutionDartType typeValue =
localsHandler.substInContext(astAdapter.getDartType(type));
+
if (type is ir.FunctionType) {
- List arguments = [buildFunctionType(typeValue), expression];
- _pushDynamicInvocation(node, null, arguments,
- selector: new Selector.call(
- new PrivateName('_isTest', backend.helpers.jsHelperLibrary),
- CallStructure.ONE_ARG));
- push(
- new HIs.compound(typeValue, expression, pop(), commonMasks.boolType));
+ HInstruction representation =
+ typeBuilder.analyzeTypeArgument(typeValue, sourceElement);
+ List<HInstruction> inputs = <HInstruction>[
+ expression,
+ representation,
+ ];
+ _pushStaticInvocation(
+ astAdapter.functionTypeTest, inputs, commonMasks.boolType);
+ HInstruction call = pop();
+ push(new HIs.compound(typeValue, expression, call, commonMasks.boolType));
return;
}
diff --git a/pkg/compiler/lib/src/ssa/codegen.dart b/pkg/compiler/lib/src/ssa/codegen.dart
index 5cd48da..c53de93 100644
--- a/pkg/compiler/lib/src/ssa/codegen.dart
+++ b/pkg/compiler/lib/src/ssa/codegen.dart
@@ -2893,26 +2893,7 @@
.getCheckedModeHelper(type, typeCast: node.isCastTypeCheck);
}
- if (helper == null) {
- assert(type.isFunctionType);
- assert(node.usesMethodOnType);
-
- String name = node.isCastTypeCheck ? '_asCheck' : '_assertCheck';
- HInstruction reifiedType = node.inputs[0];
- HInstruction checkedInput = node.inputs[1];
- use(reifiedType);
- js.Expression receiver = pop();
- use(checkedInput);
- Selector selector = new Selector.call(
- new Name(name, helpers.jsHelperLibrary), CallStructure.ONE_ARG);
- registry.registerDynamicUse(
- new DynamicUse(selector, reifiedType.instructionType));
- js.Name methodLiteral = backend.namer.invocationName(selector);
- push(js.js('#.#(#)', [receiver, methodLiteral, pop()]));
- } else {
- assert(!node.usesMethodOnType);
- push(helper.generateCall(this, node));
- }
+ push(helper.generateCall(this, node));
}
void visitTypeKnown(HTypeKnown node) {
@@ -2920,52 +2901,6 @@
assert(false);
}
- void visitFunctionType(HFunctionType node) {
- FunctionType type = node.dartType;
- int inputCount = 0;
- use(node.inputs[inputCount++]);
- js.Expression returnType = pop();
-
- List<js.Expression> parameterTypes = <js.Expression>[];
- for (var _ in type.parameterTypes) {
- use(node.inputs[inputCount++]);
- parameterTypes.add(pop());
- }
-
- List<js.Expression> optionalParameterTypes = <js.Expression>[];
- for (var _ in type.optionalParameterTypes) {
- use(node.inputs[inputCount++]);
- optionalParameterTypes.add(pop());
- }
-
- List<js.Property> namedParameters = <js.Property>[];
- for (var _ in type.namedParameters) {
- use(node.inputs[inputCount++]);
- js.Expression name = pop();
- use(node.inputs[inputCount++]);
- namedParameters.add(new js.Property(name, pop()));
- }
-
- if (namedParameters.isEmpty) {
- var arguments = [returnType];
- if (!parameterTypes.isEmpty || !optionalParameterTypes.isEmpty) {
- arguments.add(new js.ArrayInitializer(parameterTypes));
- }
- if (!optionalParameterTypes.isEmpty) {
- arguments.add(new js.ArrayInitializer(optionalParameterTypes));
- }
- push(js.js('#(#)', [accessHelper(helpers.buildFunctionType), arguments]));
- } else {
- var arguments = [
- returnType,
- new js.ArrayInitializer(parameterTypes),
- new js.ObjectInitializer(namedParameters)
- ];
- push(js.js(
- '#(#)', [accessHelper(helpers.buildNamedFunctionType), arguments]));
- }
- }
-
void visitTypeInfoReadRaw(HTypeInfoReadRaw node) {
use(node.inputs[0]);
js.Expression receiver = pop();
@@ -3048,76 +2983,6 @@
});
}
- void visitReadTypeVariable(HReadTypeVariable node) {
- TypeVariableEntity element = node.dartType.element;
- FunctionEntity helperElement = helpers.convertRtiToRuntimeType;
- registry.registerStaticUse(
- new StaticUse.staticInvoke(helperElement, CallStructure.ONE_ARG));
-
- use(node.inputs[0]);
- if (node.hasReceiver) {
- if (backend.interceptorData.isInterceptorClass(element.typeDeclaration)) {
- int index = element.index;
- js.Expression receiver = pop();
- js.Expression helper =
- backend.emitter.staticFunctionAccess(helperElement);
- js.Expression rtiFieldName = backend.namer.rtiFieldJsName;
- push(js.js(r'#(#.# && #.#[#])', [
- helper,
- receiver,
- rtiFieldName,
- receiver,
- rtiFieldName,
- js.js.number(index)
- ]));
- } else {
- backend.emitter.registerReadTypeVariable(element);
- push(js.js(
- '#.#()', [pop(), backend.namer.nameForReadTypeVariable(element)]));
- }
- } else {
- push(js.js('#(#)',
- [backend.emitter.staticFunctionAccess(helperElement), pop()]));
- }
- }
-
- void visitInterfaceType(HInterfaceType node) {
- List<js.Expression> typeArguments = <js.Expression>[];
- for (HInstruction type in node.inputs) {
- use(type);
- typeArguments.add(pop());
- }
- InterfaceType type = node.dartType;
- ClassEntity cls = type.element;
- var arguments = [backend.emitter.typeAccess(cls)];
- if (!typeArguments.isEmpty) {
- arguments.add(new js.ArrayInitializer(typeArguments));
- }
- push(js.js('#(#)', [
- accessHelper(helpers.buildInterfaceType, arguments.length),
- arguments
- ]));
- }
-
- void visitVoidType(HVoidType node) {
- push(js.js('#()', accessHelper(helpers.getVoidRuntimeType)));
- }
-
- void visitDynamicType(HDynamicType node) {
- push(js.js('#()', accessHelper(helpers.getDynamicRuntimeType)));
- }
-
- js.PropertyAccess accessHelper(FunctionEntity helper,
- [int argumentCount = 0]) {
- if (helper == null) {
- // For mocked-up tests.
- return js.js('(void 0).dummy');
- }
- registry.registerStaticUse(new StaticUse.staticInvoke(
- helper, new CallStructure.unnamed(argumentCount)));
- return backend.emitter.staticFunctionAccess(helper);
- }
-
@override
void visitRef(HRef node) {
visit(node.value);
diff --git a/pkg/compiler/lib/src/ssa/graph_builder.dart b/pkg/compiler/lib/src/ssa/graph_builder.dart
index 0af3064..ac49027 100644
--- a/pkg/compiler/lib/src/ssa/graph_builder.dart
+++ b/pkg/compiler/lib/src/ssa/graph_builder.dart
@@ -189,14 +189,6 @@
return new HSubExpressionBlockInformation(expression);
}
- HInstruction buildFunctionType(ResolutionFunctionType type) {
- type.accept(new ReifiedTypeRepresentationBuilder(closedWorld), this);
- return pop();
- }
-
- HInstruction buildFunctionTypeConversion(
- HInstruction original, ResolutionDartType type, int kind);
-
/// Returns the current source element.
///
/// The returned element is a declaration element.
@@ -242,105 +234,3 @@
Element get targetElement;
TypeBuilder get typeBuilder;
}
-
-class ReifiedTypeRepresentationBuilder
- implements DartTypeVisitor<dynamic, GraphBuilder> {
- final ClosedWorld closedWorld;
-
- ReifiedTypeRepresentationBuilder(this.closedWorld);
-
- void visit(ResolutionDartType type, GraphBuilder builder) =>
- type.accept(this, builder);
-
- void visitVoidType(ResolutionVoidType type, GraphBuilder builder) {
- ClassElement cls = builder.backend.helpers.VoidRuntimeType;
- builder.push(new HVoidType(type, new TypeMask.exact(cls, closedWorld)));
- }
-
- void visitTypeVariableType(
- ResolutionTypeVariableType type, GraphBuilder builder) {
- ClassElement cls = builder.backend.helpers.RuntimeType;
- TypeMask instructionType = new TypeMask.subclass(cls, closedWorld);
-
- // TODO(floitsch): this hack maps type variables of generic function
- // typedefs to dynamic. For example: `typedef F = Function<T>(T)`.
- if (type is MethodTypeVariableType) {
- visitDynamicType(const ResolutionDynamicType(), builder);
- return;
- }
-
- if (!builder.sourceElement.enclosingElement.isClosure &&
- builder.sourceElement.isInstanceMember) {
- HInstruction receiver = builder.localsHandler.readThis();
- builder.push(new HReadTypeVariable(type, receiver, instructionType));
- } else {
- builder.push(new HReadTypeVariable.noReceiver(
- type,
- builder.typeBuilder
- .addTypeVariableReference(type, builder.sourceElement),
- instructionType));
- }
- }
-
- void visitFunctionType(ResolutionFunctionType type, GraphBuilder builder) {
- type.returnType.accept(this, builder);
- HInstruction returnType = builder.pop();
- List<HInstruction> inputs = <HInstruction>[returnType];
-
- for (ResolutionDartType parameter in type.parameterTypes) {
- parameter.accept(this, builder);
- inputs.add(builder.pop());
- }
-
- for (ResolutionDartType parameter in type.optionalParameterTypes) {
- parameter.accept(this, builder);
- inputs.add(builder.pop());
- }
-
- List<ResolutionDartType> namedParameterTypes = type.namedParameterTypes;
- List<String> names = type.namedParameters;
- for (int index = 0; index < names.length; index++) {
- ast.DartString dartString = new ast.DartString.literal(names[index]);
- inputs.add(
- builder.graph.addConstantString(dartString, builder.closedWorld));
- namedParameterTypes[index].accept(this, builder);
- inputs.add(builder.pop());
- }
-
- ClassElement cls = builder.backend.helpers.RuntimeFunctionType;
- builder.push(
- new HFunctionType(inputs, type, new TypeMask.exact(cls, closedWorld)));
- }
-
- void visitMalformedType(MalformedType type, GraphBuilder builder) {
- visitDynamicType(const ResolutionDynamicType(), builder);
- }
-
- void visitInterfaceType(ResolutionInterfaceType type, GraphBuilder builder) {
- List<HInstruction> inputs = <HInstruction>[];
- for (ResolutionDartType typeArgument in type.typeArguments) {
- typeArgument.accept(this, builder);
- inputs.add(builder.pop());
- }
- ClassElement cls;
- if (type.typeArguments.isEmpty) {
- cls = builder.backend.helpers.RuntimeTypePlain;
- } else {
- cls = builder.backend.helpers.RuntimeTypeGeneric;
- }
- builder.push(
- new HInterfaceType(inputs, type, new TypeMask.exact(cls, closedWorld)));
- }
-
- void visitTypedefType(ResolutionTypedefType type, GraphBuilder builder) {
- ResolutionDartType unaliased = type.unaliased;
- if (unaliased is ResolutionTypedefType) throw 'unable to unalias $type';
- unaliased.accept(this, builder);
- }
-
- void visitDynamicType(ResolutionDynamicType type, GraphBuilder builder) {
- JavaScriptBackend backend = builder.compiler.backend;
- ClassElement cls = backend.helpers.DynamicRuntimeType;
- builder.push(new HDynamicType(type, new TypeMask.exact(cls, closedWorld)));
- }
-}
diff --git a/pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart b/pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart
index 56c69ee..9bc078b 100644
--- a/pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart
+++ b/pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart
@@ -423,6 +423,9 @@
ir.Procedure get checkSubtypeOfRuntimeType =>
kernel.functions[_backend.helpers.checkSubtypeOfRuntimeType];
+ ir.Procedure get functionTypeTest =>
+ kernel.functions[_backend.helpers.functionTypeTest];
+
ir.Procedure get throwTypeError =>
kernel.functions[_backend.helpers.throwTypeError];
diff --git a/pkg/compiler/lib/src/ssa/nodes.dart b/pkg/compiler/lib/src/ssa/nodes.dart
index df84deb..86be86b 100644
--- a/pkg/compiler/lib/src/ssa/nodes.dart
+++ b/pkg/compiler/lib/src/ssa/nodes.dart
@@ -97,11 +97,6 @@
R visitTypeConversion(HTypeConversion node);
R visitTypeKnown(HTypeKnown node);
R visitYield(HYield node);
- R visitReadTypeVariable(HReadTypeVariable node);
- R visitFunctionType(HFunctionType node);
- R visitVoidType(HVoidType node);
- R visitInterfaceType(HInterfaceType node);
- R visitDynamicType(HDynamicType node);
R visitTypeInfoReadRaw(HTypeInfoReadRaw node);
R visitTypeInfoReadVariable(HTypeInfoReadVariable node);
@@ -416,11 +411,6 @@
visitIsViaInterceptor(HIsViaInterceptor node) => visitInstruction(node);
visitTypeConversion(HTypeConversion node) => visitCheck(node);
visitTypeKnown(HTypeKnown node) => visitCheck(node);
- visitReadTypeVariable(HReadTypeVariable node) => visitInstruction(node);
- visitFunctionType(HFunctionType node) => visitInstruction(node);
- visitVoidType(HVoidType node) => visitInstruction(node);
- visitInterfaceType(HInterfaceType node) => visitInstruction(node);
- visitDynamicType(HDynamicType node) => visitInstruction(node);
visitAwait(HAwait node) => visitInstruction(node);
visitYield(HYield node) => visitInstruction(node);
@@ -880,11 +870,7 @@
static const int IS_TYPECODE = 28;
static const int INVOKE_DYNAMIC_TYPECODE = 29;
static const int SHIFT_RIGHT_TYPECODE = 30;
- static const int READ_TYPE_VARIABLE_TYPECODE = 31;
- static const int FUNCTION_TYPE_TYPECODE = 32;
- static const int VOID_TYPE_TYPECODE = 33;
- static const int INTERFACE_TYPE_TYPECODE = 34;
- static const int DYNAMIC_TYPE_TYPECODE = 35;
+
static const int TRUNCATING_DIVIDE_TYPECODE = 36;
static const int IS_VIA_INTERCEPTOR_TYPECODE = 37;
@@ -2877,11 +2863,7 @@
HInstruction get typeRepresentation => inputs[1];
- bool get usesMethodOnType =>
- typeExpression != null && typeExpression.isFunctionType;
-
- HInstruction get checkedInput =>
- usesMethodOnType ? inputs[1] : super.checkedInput;
+ HInstruction get checkedInput => super.checkedInput;
HInstruction convertType(ClosedWorld closedWorld, DartType type, int kind) {
if (typeExpression == type) {
@@ -3405,105 +3387,3 @@
}
}
}
-
-class HReadTypeVariable extends HInstruction {
- /// The type variable being read.
- final TypeVariableType dartType;
-
- final bool hasReceiver;
-
- HReadTypeVariable(
- this.dartType, HInstruction receiver, TypeMask instructionType)
- : hasReceiver = true,
- super(<HInstruction>[receiver], instructionType) {
- setUseGvn();
- }
-
- HReadTypeVariable.noReceiver(
- this.dartType, HInstruction typeArgument, TypeMask instructionType)
- : hasReceiver = false,
- super(<HInstruction>[typeArgument], instructionType) {
- setUseGvn();
- }
-
- accept(HVisitor visitor) => visitor.visitReadTypeVariable(this);
-
- bool canThrow() => false;
-
- int typeCode() => HInstruction.READ_TYPE_VARIABLE_TYPECODE;
- bool typeEquals(HInstruction other) => other is HReadTypeVariable;
-
- bool dataEquals(HReadTypeVariable other) {
- return dartType == other.dartType && hasReceiver == other.hasReceiver;
- }
-}
-
-abstract class HRuntimeType extends HInstruction {
- final DartType dartType;
-
- HRuntimeType(
- List<HInstruction> inputs, this.dartType, TypeMask instructionType)
- : super(inputs, instructionType) {
- setUseGvn();
- }
-
- bool canThrow() => false;
-
- int typeCode() {
- throw 'abstract method';
- }
-
- bool typeEquals(HInstruction other) {
- throw 'abstract method';
- }
-
- bool dataEquals(HRuntimeType other) {
- return dartType == other.dartType;
- }
-}
-
-class HFunctionType extends HRuntimeType {
- HFunctionType(List<HInstruction> inputs, FunctionType dartType,
- TypeMask instructionType)
- : super(inputs, dartType, instructionType);
-
- accept(HVisitor visitor) => visitor.visitFunctionType(this);
-
- int typeCode() => HInstruction.FUNCTION_TYPE_TYPECODE;
-
- bool typeEquals(HInstruction other) => other is HFunctionType;
-}
-
-class HVoidType extends HRuntimeType {
- HVoidType(VoidType dartType, TypeMask instructionType)
- : super(const <HInstruction>[], dartType, instructionType);
-
- accept(HVisitor visitor) => visitor.visitVoidType(this);
-
- int typeCode() => HInstruction.VOID_TYPE_TYPECODE;
-
- bool typeEquals(HInstruction other) => other is HVoidType;
-}
-
-class HInterfaceType extends HRuntimeType {
- HInterfaceType(List<HInstruction> inputs, InterfaceType dartType,
- TypeMask instructionType)
- : super(inputs, dartType, instructionType);
-
- accept(HVisitor visitor) => visitor.visitInterfaceType(this);
-
- int typeCode() => HInstruction.INTERFACE_TYPE_TYPECODE;
-
- bool typeEquals(HInstruction other) => other is HInterfaceType;
-}
-
-class HDynamicType extends HRuntimeType {
- HDynamicType(DynamicType dartType, TypeMask instructionType)
- : super(const <HInstruction>[], dartType, instructionType);
-
- accept(HVisitor visitor) => visitor.visitDynamicType(this);
-
- int typeCode() => HInstruction.DYNAMIC_TYPE_TYPECODE;
-
- bool typeEquals(HInstruction other) => other is HDynamicType;
-}
diff --git a/pkg/compiler/lib/src/ssa/ssa_tracer.dart b/pkg/compiler/lib/src/ssa/ssa_tracer.dart
index 8e7dcbb..d4ac68c 100644
--- a/pkg/compiler/lib/src/ssa/ssa_tracer.dart
+++ b/pkg/compiler/lib/src/ssa/ssa_tracer.dart
@@ -493,11 +493,7 @@
String visitTypeConversion(HTypeConversion node) {
String checkedInput = temporaryId(node.checkedInput);
String rest;
- if (node.usesMethodOnType) {
- assert(node.inputs.length == 2);
- assert(identical(node.checkedInput, node.inputs.last));
- rest = " ${temporaryId(node.inputs.first)}";
- } else if (node.inputs.length == 2) {
+ if (node.inputs.length == 2) {
rest = " ${temporaryId(node.inputs.last)}";
} else {
assert(node.inputs.length == 1);
@@ -536,28 +532,6 @@
" ($inputs)";
}
- String visitReadTypeVariable(HReadTypeVariable node) {
- var inputs = node.inputs.map(temporaryId).join(', ');
- return "ReadTypeVariable: ${node.dartType} ${node.hasReceiver} $inputs";
- }
-
- String visitFunctionType(HFunctionType node) {
- var inputs = node.inputs.map(temporaryId).join(', ');
- return "FunctionType: ${node.dartType} $inputs";
- }
-
- String visitVoidType(HVoidType node) {
- return "VoidType";
- }
-
- String visitInterfaceType(HInterfaceType node) {
- return "InterfaceType: ${node.dartType}";
- }
-
- String visitDynamicType(HDynamicType node) {
- return "DynamicType";
- }
-
String visitAwait(HAwait node) {
return "Await: ${temporaryId(node.inputs[0])}";
}
diff --git a/pkg/compiler/lib/src/ssa/type_builder.dart b/pkg/compiler/lib/src/ssa/type_builder.dart
index 44eb5bc..5724e10 100644
--- a/pkg/compiler/lib/src/ssa/type_builder.dart
+++ b/pkg/compiler/lib/src/ssa/type_builder.dart
@@ -250,7 +250,12 @@
return new HTypeConversion.withTypeRepresentation(
type, kind, subtype, original, typeVariable);
} else if (type.isFunctionType) {
- return builder.buildFunctionTypeConversion(original, type, kind);
+ HInstruction reifiedType =
+ analyzeTypeArgument(type, builder.sourceElement);
+ // TypeMasks don't encode function types.
+ TypeMask refinedMask = original.instructionType;
+ return new HTypeConversion.withTypeRepresentation(
+ type, kind, refinedMask, original, reifiedType);
} else {
return original.convertType(builder.closedWorld, type, kind);
}
diff --git a/pkg/dev_compiler/lib/js/amd/dart_sdk.js b/pkg/dev_compiler/lib/js/amd/dart_sdk.js
index c9b5bda..89fc660 100644
--- a/pkg/dev_compiler/lib/js/amd/dart_sdk.js
+++ b/pkg/dev_compiler/lib/js/amd/dart_sdk.js
@@ -19,7 +19,7 @@
const core = Object.create(null);
const developer = Object.create(null);
const io = Object.create(null);
- const isolate = Object.create(null);
+ const isolate$ = Object.create(null);
const js = Object.create(null);
const js_util = Object.create(null);
const math = Object.create(null);
@@ -39,16 +39,14 @@
let MapOfString$_MethodStats = () => (MapOfString$_MethodStats = dart.constFn(core.Map$(core.String, dart._MethodStats)))();
let ListOfString = () => (ListOfString = dart.constFn(core.List$(core.String)))();
let SetOfNameValuePair = () => (SetOfNameValuePair = dart.constFn(core.Set$(_debugger.NameValuePair)))();
+ let ListOfNameValuePair = () => (ListOfNameValuePair = dart.constFn(core.List$(_debugger.NameValuePair)))();
+ let IterableOfNameValuePair = () => (IterableOfNameValuePair = dart.constFn(core.Iterable$(_debugger.NameValuePair)))();
let JSArrayOfNameValuePair = () => (JSArrayOfNameValuePair = dart.constFn(_interceptors.JSArray$(_debugger.NameValuePair)))();
let MapOfdynamic$Object = () => (MapOfdynamic$Object = dart.constFn(core.Map$(dart.dynamic, core.Object)))();
let JSArrayOfFormatter = () => (JSArrayOfFormatter = dart.constFn(_interceptors.JSArray$(_debugger.Formatter)))();
let ListOfFormatter = () => (ListOfFormatter = dart.constFn(core.List$(_debugger.Formatter)))();
let LinkedHashSetOfNameValuePair = () => (LinkedHashSetOfNameValuePair = dart.constFn(collection.LinkedHashSet$(_debugger.NameValuePair)))();
- let SetOfString = () => (SetOfString = dart.constFn(core.Set$(core.String)))();
let HashMapOfString$String = () => (HashMapOfString$String = dart.constFn(collection.HashMap$(core.String, core.String)))();
- let LinkedHashMapOfString$Object = () => (LinkedHashMapOfString$Object = dart.constFn(collection.LinkedHashMap$(core.String, core.Object)))();
- let ListOfNameValuePair = () => (ListOfNameValuePair = dart.constFn(core.List$(_debugger.NameValuePair)))();
- let JSArrayOfString = () => (JSArrayOfString = dart.constFn(_interceptors.JSArray$(core.String)))();
let JSArrayOfJsonMLFormatter = () => (JSArrayOfJsonMLFormatter = dart.constFn(_interceptors.JSArray$(_debugger.JsonMLFormatter)))();
let JSIndexable = () => (JSIndexable = dart.constFn(_interceptors.JSIndexable$()))();
let JSArray = () => (JSArray = dart.constFn(_interceptors.JSArray$()))();
@@ -57,6 +55,7 @@
let JSExtendableArray = () => (JSExtendableArray = dart.constFn(_interceptors.JSExtendableArray$()))();
let JSUnmodifiableArray = () => (JSUnmodifiableArray = dart.constFn(_interceptors.JSUnmodifiableArray$()))();
let ArrayIterator = () => (ArrayIterator = dart.constFn(_interceptors.ArrayIterator$()))();
+ let JSArrayOfString = () => (JSArrayOfString = dart.constFn(_interceptors.JSArray$(core.String)))();
let JSIndexableOfString = () => (JSIndexableOfString = dart.constFn(_interceptors.JSIndexable$(core.String)))();
let MatchToString = () => (MatchToString = dart.constFn(dart.functionType(core.String, [core.Match])))();
let StringToString = () => (StringToString = dart.constFn(dart.functionType(core.String, [core.String])))();
@@ -70,6 +69,7 @@
let UnmodifiableListBase = () => (UnmodifiableListBase = dart.constFn(_internal.UnmodifiableListBase$()))();
let StringToint = () => (StringToint = dart.constFn(dart.functionType(core.int, [core.String])))();
let Iterable = () => (Iterable = dart.constFn(core.Iterable$()))();
+ let EfficientLengthIterable = () => (EfficientLengthIterable = dart.constFn(_internal.EfficientLengthIterable$()))();
let ListIterable = () => (ListIterable = dart.constFn(_internal.ListIterable$()))();
let SubListIterable = () => (SubListIterable = dart.constFn(_internal.SubListIterable$()))();
let ListIterator = () => (ListIterator = dart.constFn(_internal.ListIterator$()))();
@@ -106,8 +106,8 @@
let MapOfint$RawReceivePortImpl = () => (MapOfint$RawReceivePortImpl = dart.constFn(core.Map$(core.int, _isolate_helper.RawReceivePortImpl)))();
let SetOfint = () => (SetOfint = dart.constFn(core.Set$(core.int)))();
let JSArrayOf_IsolateEvent = () => (JSArrayOf_IsolateEvent = dart.constFn(_interceptors.JSArray$(_isolate_helper._IsolateEvent)))();
- let SetOfCapability = () => (SetOfCapability = dart.constFn(core.Set$(isolate.Capability)))();
- let SetOfSendPort = () => (SetOfSendPort = dart.constFn(core.Set$(isolate.SendPort)))();
+ let SetOfCapability = () => (SetOfCapability = dart.constFn(core.Set$(isolate$.Capability)))();
+ let SetOfSendPort = () => (SetOfSendPort = dart.constFn(core.Set$(isolate$.SendPort)))();
let ListOf_IsolateEvent = () => (ListOf_IsolateEvent = dart.constFn(core.List$(_isolate_helper._IsolateEvent)))();
let QueueOf_IsolateEvent = () => (QueueOf_IsolateEvent = dart.constFn(collection.Queue$(_isolate_helper._IsolateEvent)))();
let CompleterOfList = () => (CompleterOfList = dart.constFn(async.Completer$(core.List)))();
@@ -138,6 +138,7 @@
let _Lazy = () => (_Lazy = dart.constFn(_js_mirrors._Lazy$()))();
let ListOfSymbol = () => (ListOfSymbol = dart.constFn(core.List$(core.Symbol)))();
let ListOfInstanceMirror = () => (ListOfInstanceMirror = dart.constFn(core.List$(mirrors.InstanceMirror)))();
+ let FutureOfLibraryMirror = () => (FutureOfLibraryMirror = dart.constFn(async.Future$(mirrors.LibraryMirror)))();
let ListOfCombinatorMirror = () => (ListOfCombinatorMirror = dart.constFn(core.List$(mirrors.CombinatorMirror)))();
let MapOfSymbol$DeclarationMirror = () => (MapOfSymbol$DeclarationMirror = dart.constFn(core.Map$(core.Symbol, mirrors.DeclarationMirror)))();
let ListOfTypeMirror = () => (ListOfTypeMirror = dart.constFn(core.List$(mirrors.TypeMirror)))();
@@ -149,7 +150,6 @@
let ListOfParameterMirror = () => (ListOfParameterMirror = dart.constFn(core.List$(mirrors.ParameterMirror)))();
let IterableOfdouble = () => (IterableOfdouble = dart.constFn(core.Iterable$(core.double)))();
let IterableOfint = () => (IterableOfint = dart.constFn(core.Iterable$(core.int)))();
- let ZoneBinaryCallbackOfdynamic$dynamic$StackTrace = () => (ZoneBinaryCallbackOfdynamic$dynamic$StackTrace = dart.constFn(async.ZoneBinaryCallback$(dart.dynamic, dart.dynamic, core.StackTrace)))();
let _StreamImpl = () => (_StreamImpl = dart.constFn(async._StreamImpl$()))();
let _ControllerStream = () => (_ControllerStream = dart.constFn(async._ControllerStream$()))();
let _BroadcastStream = () => (_BroadcastStream = dart.constFn(async._BroadcastStream$()))();
@@ -171,7 +171,6 @@
let _Completer = () => (_Completer = dart.constFn(async._Completer$()))();
let _AsyncCompleter = () => (_AsyncCompleter = dart.constFn(async._AsyncCompleter$()))();
let _SyncCompleter = () => (_SyncCompleter = dart.constFn(async._SyncCompleter$()))();
- let ZoneBinaryCallbackOfObject$Object$StackTrace = () => (ZoneBinaryCallbackOfObject$Object$StackTrace = dart.constFn(async.ZoneBinaryCallback$(core.Object, core.Object, core.StackTrace)))();
let _FutureListener = () => (_FutureListener = dart.constFn(async._FutureListener$()))();
let _Future = () => (_Future = dart.constFn(async._Future$()))();
let StreamSubscription = () => (StreamSubscription = dart.constFn(async.StreamSubscription$()))();
@@ -207,8 +206,9 @@
let _DoneStreamSubscription = () => (_DoneStreamSubscription = dart.constFn(async._DoneStreamSubscription$()))();
let _AsBroadcastStream = () => (_AsBroadcastStream = dart.constFn(async._AsBroadcastStream$()))();
let _BroadcastSubscriptionWrapper = () => (_BroadcastSubscriptionWrapper = dart.constFn(async._BroadcastSubscriptionWrapper$()))();
- let _StreamIteratorImpl = () => (_StreamIteratorImpl = dart.constFn(async._StreamIteratorImpl$()))();
+ let _StreamIterator = () => (_StreamIterator = dart.constFn(async._StreamIterator$()))();
let _EmptyStream = () => (_EmptyStream = dart.constFn(async._EmptyStream$()))();
+ let dynamicAndStackTraceTodynamic = () => (dynamicAndStackTraceTodynamic = dart.constFn(dart.functionType(dart.dynamic, [dart.dynamic, core.StackTrace])))();
let _ForwardingStream = () => (_ForwardingStream = dart.constFn(async._ForwardingStream$()))();
let _ForwardingStreamSubscription = () => (_ForwardingStreamSubscription = dart.constFn(async._ForwardingStreamSubscription$()))();
let _Predicate = () => (_Predicate = dart.constFn(async._Predicate$()))();
@@ -311,7 +311,6 @@
let Queue = () => (Queue = dart.constFn(collection.Queue$()))();
let _DoubleLink = () => (_DoubleLink = dart.constFn(collection._DoubleLink$()))();
let DoubleLinkedQueueEntry = () => (DoubleLinkedQueueEntry = dart.constFn(collection.DoubleLinkedQueueEntry$()))();
- let _UserDoubleLinkedQueueEntry = () => (_UserDoubleLinkedQueueEntry = dart.constFn(collection._UserDoubleLinkedQueueEntry$()))();
let _DoubleLinkedQueueEntry = () => (_DoubleLinkedQueueEntry = dart.constFn(collection._DoubleLinkedQueueEntry$()))();
let _DoubleLinkedQueueElement = () => (_DoubleLinkedQueueElement = dart.constFn(collection._DoubleLinkedQueueElement$()))();
let _DoubleLinkedQueueSentinel = () => (_DoubleLinkedQueueSentinel = dart.constFn(collection._DoubleLinkedQueueSentinel$()))();
@@ -340,8 +339,10 @@
let List = () => (List = dart.constFn(core.List$()))();
let StreamOfListOfint = () => (StreamOfListOfint = dart.constFn(async.Stream$(ListOfint())))();
let Converter = () => (Converter = dart.constFn(convert.Converter$()))();
+ let ChunkedConverterOfString$ListOfint$String$ListOfint = () => (ChunkedConverterOfString$ListOfint$String$ListOfint = dart.constFn(convert.ChunkedConverter$(core.String, ListOfint(), core.String, ListOfint())))();
let SinkOfListOfint = () => (SinkOfListOfint = dart.constFn(core.Sink$(ListOfint())))();
let StreamOfString = () => (StreamOfString = dart.constFn(async.Stream$(core.String)))();
+ let ChunkedConverterOfListOfint$String$ListOfint$String = () => (ChunkedConverterOfListOfint$String$ListOfint$String = dart.constFn(convert.ChunkedConverter$(ListOfint(), core.String, ListOfint(), core.String)))();
let SinkOfString = () => (SinkOfString = dart.constFn(core.Sink$(core.String)))();
let ChunkedConversionSink = () => (ChunkedConversionSink = dart.constFn(convert.ChunkedConversionSink$()))();
let _ChunkedConversionCallbackOfListOfint = () => (_ChunkedConversionCallbackOfListOfint = dart.constFn(convert._ChunkedConversionCallback$(ListOfint())))();
@@ -352,8 +353,12 @@
let _FusedCodec = () => (_FusedCodec = dart.constFn(convert._FusedCodec$()))();
let _InvertedCodec = () => (_InvertedCodec = dart.constFn(convert._InvertedCodec$()))();
let _FusedConverter = () => (_FusedConverter = dart.constFn(convert._FusedConverter$()))();
+ let ChunkedConverterOfString$String$String$String = () => (ChunkedConverterOfString$String$String$String = dart.constFn(convert.ChunkedConverter$(core.String, core.String, core.String, core.String)))();
+ let ChunkedConverterOfObject$String$Object$String = () => (ChunkedConverterOfObject$String$Object$String = dart.constFn(convert.ChunkedConverter$(core.Object, core.String, core.Object, core.String)))();
let StreamOfObject = () => (StreamOfObject = dart.constFn(async.Stream$(core.Object)))();
let JSArrayOfListOfint = () => (JSArrayOfListOfint = dart.constFn(_interceptors.JSArray$(ListOfint())))();
+ let ChunkedConverterOfObject$ListOfint$Object$ListOfint = () => (ChunkedConverterOfObject$ListOfint$Object$ListOfint = dart.constFn(convert.ChunkedConverter$(core.Object, ListOfint(), core.Object, ListOfint())))();
+ let ChunkedConverterOfString$Object$String$Object = () => (ChunkedConverterOfString$Object$String$Object = dart.constFn(convert.ChunkedConverter$(core.String, core.Object, core.String, core.Object)))();
let Uint8ListAndintAndintTovoid = () => (Uint8ListAndintAndintTovoid = dart.constFn(dart.functionType(dart.void, [typed_data.Uint8List, core.int, core.int])))();
let EventSinkOfString = () => (EventSinkOfString = dart.constFn(async.EventSink$(core.String)))();
let StreamTransformerOfString$String = () => (StreamTransformerOfString$String = dart.constFn(async.StreamTransformer$(core.String, core.String)))();
@@ -364,59 +369,62 @@
let Expando = () => (Expando = dart.constFn(core.Expando$()))();
let _Generator = () => (_Generator = dart.constFn(core._Generator$()))();
let _GeneratorIterable = () => (_GeneratorIterable = dart.constFn(core._GeneratorIterable$()))();
- let _GeneratorIterator = () => (_GeneratorIterator = dart.constFn(core._GeneratorIterator$()))();
let BidirectionalIterator = () => (BidirectionalIterator = dart.constFn(core.BidirectionalIterator$()))();
let Map$ = () => (Map$ = dart.constFn(core.Map$()))();
let Set = () => (Set = dart.constFn(core.Set$()))();
let Sink = () => (Sink = dart.constFn(core.Sink$()))();
let BidirectionalIteratorOfint = () => (BidirectionalIteratorOfint = dart.constFn(core.BidirectionalIterator$(core.int)))();
+ let MapOfString$String = () => (MapOfString$String = dart.constFn(core.Map$(core.String, core.String)))();
let UnmodifiableMapViewOfString$String = () => (UnmodifiableMapViewOfString$String = dart.constFn(collection.UnmodifiableMapView$(core.String, core.String)))();
let MapOfString$ListOfString = () => (MapOfString$ListOfString = dart.constFn(core.Map$(core.String, ListOfString())))();
- let MapOfString$String = () => (MapOfString$String = dart.constFn(core.Map$(core.String, core.String)))();
let IterableOfString = () => (IterableOfString = dart.constFn(core.Iterable$(core.String)))();
let MapOfString$dynamic = () => (MapOfString$dynamic = dart.constFn(core.Map$(core.String, dart.dynamic)))();
+ let ListOfUint8List = () => (ListOfUint8List = dart.constFn(core.List$(typed_data.Uint8List)))();
let MapOfString$ServiceExtensionHandler = () => (MapOfString$ServiceExtensionHandler = dart.constFn(core.Map$(core.String, developer.ServiceExtensionHandler)))();
let MapOfString$Metric = () => (MapOfString$Metric = dart.constFn(core.Map$(core.String, developer.Metric)))();
let ListOf_SyncBlock = () => (ListOf_SyncBlock = dart.constFn(core.List$(developer._SyncBlock)))();
let JSArrayOf_AsyncBlock = () => (JSArrayOf_AsyncBlock = dart.constFn(_interceptors.JSArray$(developer._AsyncBlock)))();
let ListOf_AsyncBlock = () => (ListOf_AsyncBlock = dart.constFn(core.List$(developer._AsyncBlock)))();
let CompleterOfUri = () => (CompleterOfUri = dart.constFn(async.Completer$(core.Uri)))();
- let ListOfListOfint = () => (ListOfListOfint = dart.constFn(core.List$(ListOfint())))();
- let FutureOfint = () => (FutureOfint = dart.constFn(async.Future$(core.int)))();
+ let JSArrayOfUint8List = () => (JSArrayOfUint8List = dart.constFn(_interceptors.JSArray$(typed_data.Uint8List)))();
+ let ChunkedConverterOfListOfint$ListOfint$ListOfint$ListOfint = () => (ChunkedConverterOfListOfint$ListOfint$ListOfint$ListOfint = dart.constFn(convert.ChunkedConverter$(ListOfint(), ListOfint(), ListOfint(), ListOfint())))();
let FutureOfDirectory = () => (FutureOfDirectory = dart.constFn(async.Future$(io.Directory)))();
let FutureOrOfDirectory = () => (FutureOrOfDirectory = dart.constFn(async.FutureOr$(io.Directory)))();
- let StreamOfFileSystemEntity = () => (StreamOfFileSystemEntity = dart.constFn(async.Stream$(io.FileSystemEntity)))();
let JSArrayOfFileSystemEntity = () => (JSArrayOfFileSystemEntity = dart.constFn(_interceptors.JSArray$(io.FileSystemEntity)))();
let FutureOrOfString = () => (FutureOrOfString = dart.constFn(async.FutureOr$(core.String)))();
let FutureOrOfbool = () => (FutureOrOfbool = dart.constFn(async.FutureOr$(core.bool)))();
let FutureOrOfint = () => (FutureOrOfint = dart.constFn(async.FutureOr$(core.int)))();
let ListOfFileSystemEntity = () => (ListOfFileSystemEntity = dart.constFn(core.List$(io.FileSystemEntity)))();
+ let StreamControllerOfFileSystemEntity = () => (StreamControllerOfFileSystemEntity = dart.constFn(async.StreamController$(io.FileSystemEntity)))();
let StreamControllerOfListOfint = () => (StreamControllerOfListOfint = dart.constFn(async.StreamController$(ListOfint())))();
let FutureOfRandomAccessFile = () => (FutureOfRandomAccessFile = dart.constFn(async.Future$(io.RandomAccessFile)))();
let CompleterOfFile = () => (CompleterOfFile = dart.constFn(async.Completer$(io.File)))();
+ let CompleterOfListOfint = () => (CompleterOfListOfint = dart.constFn(async.Completer$(ListOfint())))();
let FutureOfListOfint = () => (FutureOfListOfint = dart.constFn(async.Future$(ListOfint())))();
let FutureOrOfFile = () => (FutureOrOfFile = dart.constFn(async.FutureOr$(io.File)))();
let FutureOfFile = () => (FutureOfFile = dart.constFn(async.Future$(io.File)))();
- let FutureOrOfListOfint = () => (FutureOrOfListOfint = dart.constFn(async.FutureOr$(ListOfint())))();
+ let FutureOfint = () => (FutureOfint = dart.constFn(async.Future$(core.int)))();
let StreamOfHttpRequest = () => (StreamOfHttpRequest = dart.constFn(async.Stream$(io.HttpRequest)))();
let ListOfRedirectInfo = () => (ListOfRedirectInfo = dart.constFn(core.List$(io.RedirectInfo)))();
let HashMapOfString$ListOfString = () => (HashMapOfString$ListOfString = dart.constFn(collection.HashMap$(core.String, ListOfString())))();
let ListOfCookie = () => (ListOfCookie = dart.constFn(core.List$(io.Cookie)))();
let StringAndListOfStringTovoid = () => (StringAndListOfStringTovoid = dart.constFn(dart.functionType(dart.void, [core.String, ListOfString()])))();
let FutureOfHttpClientResponse = () => (FutureOfHttpClientResponse = dart.constFn(async.Future$(io.HttpClientResponse)))();
- let StreamSubscriptionOfListOfint = () => (StreamSubscriptionOfListOfint = dart.constFn(async.StreamSubscription$(ListOfint())))();
let FutureOrOfHttpClientResponse = () => (FutureOrOfHttpClientResponse = dart.constFn(async.FutureOr$(io.HttpClientResponse)))();
let _StreamSinkImpl = () => (_StreamSinkImpl = dart.constFn(io._StreamSinkImpl$()))();
let _HttpOutboundMessage = () => (_HttpOutboundMessage = dart.constFn(io._HttpOutboundMessage$()))();
let CompleterOfHttpClientResponse = () => (CompleterOfHttpClientResponse = dart.constFn(async.Completer$(io.HttpClientResponse)))();
let JSArrayOfRedirectInfo = () => (JSArrayOfRedirectInfo = dart.constFn(_interceptors.JSArray$(io.RedirectInfo)))();
let JSArrayOfFuture = () => (JSArrayOfFuture = dart.constFn(_interceptors.JSArray$(async.Future)))();
+ let CompleterOfSocket = () => (CompleterOfSocket = dart.constFn(async.Completer$(io.Socket)))();
let StreamConsumerOfListOfint = () => (StreamConsumerOfListOfint = dart.constFn(async.StreamConsumer$(ListOfint())))();
let CompleterOf_HttpIncoming = () => (CompleterOf_HttpIncoming = dart.constFn(async.Completer$(io._HttpIncoming)))();
- let X509CertificateTobool = () => (X509CertificateTobool = dart.constFn(dart.functionType(core.bool, [io.X509Certificate])))();
let FutureOfSecureSocket = () => (FutureOfSecureSocket = dart.constFn(async.Future$(io.SecureSocket)))();
+ let X509CertificateTobool = () => (X509CertificateTobool = dart.constFn(dart.functionType(core.bool, [io.X509Certificate])))();
+ let FutureOfSocket = () => (FutureOfSocket = dart.constFn(async.Future$(io.Socket)))();
let HashSetOf_HttpClientConnection = () => (HashSetOf_HttpClientConnection = dart.constFn(collection.HashSet$(io._HttpClientConnection)))();
let FutureOf_ConnectionInfo = () => (FutureOf_ConnectionInfo = dart.constFn(async.Future$(io._ConnectionInfo)))();
+ let CompleterOf_ConnectionInfo = () => (CompleterOf_ConnectionInfo = dart.constFn(async.Completer$(io._ConnectionInfo)))();
let FutureOrOf_ConnectionInfo = () => (FutureOrOf_ConnectionInfo = dart.constFn(async.FutureOr$(io._ConnectionInfo)))();
let SetOf_HttpClientConnection = () => (SetOf_HttpClientConnection = dart.constFn(core.Set$(io._HttpClientConnection)))();
let HashMapOfString$_ConnectionTarget = () => (HashMapOfString$_ConnectionTarget = dart.constFn(collection.HashMap$(core.String, io._ConnectionTarget)))();
@@ -438,8 +446,7 @@
let HttpRequestTovoid = () => (HttpRequestTovoid = dart.constFn(dart.functionType(dart.void, [io.HttpRequest])))();
let MapOfint$_HttpServer = () => (MapOfint$_HttpServer = dart.constFn(core.Map$(core.int, io._HttpServer)))();
let ListOf_Proxy = () => (ListOf_Proxy = dart.constFn(core.List$(io._Proxy)))();
- let FutureOfSocket = () => (FutureOfSocket = dart.constFn(async.Future$(io.Socket)))();
- let StreamOfint = () => (StreamOfint = dart.constFn(async.Stream$(core.int)))();
+ let StreamSubscriptionOfListOfint = () => (StreamSubscriptionOfListOfint = dart.constFn(async.StreamSubscription$(ListOfint())))();
let StreamControllerOf_HttpIncoming = () => (StreamControllerOf_HttpIncoming = dart.constFn(async.StreamController$(io._HttpIncoming)))();
let _HttpIncomingTovoid = () => (_HttpIncomingTovoid = dart.constFn(dart.functionType(dart.void, [io._HttpIncoming])))();
let MapOfString$_HttpSession = () => (MapOfString$_HttpSession = dart.constFn(core.Map$(core.String, io._HttpSession)))();
@@ -450,14 +457,16 @@
let MapOfint$_SocketResourceInfo = () => (MapOfint$_SocketResourceInfo = dart.constFn(core.Map$(core.int, io._SocketResourceInfo)))();
let StreamSinkOfListOfint = () => (StreamSinkOfListOfint = dart.constFn(async.StreamSink$(ListOfint())))();
let FutureOfLink = () => (FutureOfLink = dart.constFn(async.Future$(io.Link)))();
+ let _CaseInsensitiveStringMapOfString = () => (_CaseInsensitiveStringMapOfString = dart.constFn(io._CaseInsensitiveStringMap$(core.String)))();
let _CaseInsensitiveStringMap = () => (_CaseInsensitiveStringMap = dart.constFn(io._CaseInsensitiveStringMap$()))();
+ let StreamSubscriptionOfRawSocketEvent = () => (StreamSubscriptionOfRawSocketEvent = dart.constFn(async.StreamSubscription$(io.RawSocketEvent)))();
let FutureOfRawSecureSocket = () => (FutureOfRawSecureSocket = dart.constFn(async.Future$(io.RawSecureSocket)))();
let SecureSocketTovoid = () => (SecureSocketTovoid = dart.constFn(dart.functionType(dart.void, [io.SecureSocket])))();
let StreamControllerOfRawSecureSocket = () => (StreamControllerOfRawSecureSocket = dart.constFn(async.StreamController$(io.RawSecureSocket)))();
let RawSecureSocketTovoid = () => (RawSecureSocketTovoid = dart.constFn(dart.functionType(dart.void, [io.RawSecureSocket])))();
let StreamSubscriptionOfRawSocket = () => (StreamSubscriptionOfRawSocket = dart.constFn(async.StreamSubscription$(io.RawSocket)))();
- let StreamSubscriptionOfRawSocketEvent = () => (StreamSubscriptionOfRawSocketEvent = dart.constFn(async.StreamSubscription$(io.RawSocketEvent)))();
let CompleterOf_RawSecureSocket = () => (CompleterOf_RawSecureSocket = dart.constFn(async.Completer$(io._RawSecureSocket)))();
+ let CompleterOfRawSecureSocket = () => (CompleterOfRawSecureSocket = dart.constFn(async.Completer$(io.RawSecureSocket)))();
let StreamControllerOfRawSocketEvent = () => (StreamControllerOfRawSocketEvent = dart.constFn(async.StreamController$(io.RawSocketEvent)))();
let RawSocketEventTovoid = () => (RawSocketEventTovoid = dart.constFn(dart.functionType(dart.void, [io.RawSocketEvent])))();
let StreamOfRawSocketEvent = () => (StreamOfRawSocketEvent = dart.constFn(async.Stream$(io.RawSocketEvent)))();
@@ -466,15 +475,14 @@
let StreamOfSocket = () => (StreamOfSocket = dart.constFn(async.Stream$(io.Socket)))();
let StreamTransformerOfHttpRequest$WebSocket = () => (StreamTransformerOfHttpRequest$WebSocket = dart.constFn(async.StreamTransformer$(io.HttpRequest, io.WebSocket)))();
let ListOfStringTodynamic = () => (ListOfStringTodynamic = dart.constFn(dart.functionType(dart.dynamic, [ListOfString()])))();
+ let EventSinkOfListOfint = () => (EventSinkOfListOfint = dart.constFn(async.EventSink$(ListOfint())))();
let StreamTransformerOfListOfint$dynamic = () => (StreamTransformerOfListOfint$dynamic = dart.constFn(async.StreamTransformer$(ListOfint(), dart.dynamic)))();
- let EventSinkOfUint8List = () => (EventSinkOfUint8List = dart.constFn(async.EventSink$(typed_data.Uint8List)))();
let StreamControllerOfWebSocket = () => (StreamControllerOfWebSocket = dart.constFn(async.StreamController$(io.WebSocket)))();
let FutureOfWebSocket = () => (FutureOfWebSocket = dart.constFn(async.Future$(io.WebSocket)))();
- let EventSinkOfListOfint = () => (EventSinkOfListOfint = dart.constFn(async.EventSink$(ListOfint())))();
- let JSArrayOfUint8List = () => (JSArrayOfUint8List = dart.constFn(_interceptors.JSArray$(typed_data.Uint8List)))();
+ let FutureOfString = () => (FutureOfString = dart.constFn(async.Future$(core.String)))();
let StreamTransformerOfdynamic$ListOfint = () => (StreamTransformerOfdynamic$ListOfint = dart.constFn(async.StreamTransformer$(dart.dynamic, ListOfint())))();
let MapOfint$_WebSocketImpl = () => (MapOfint$_WebSocketImpl = dart.constFn(core.Map$(core.int, io._WebSocketImpl)))();
- let FutureOfIsolate = () => (FutureOfIsolate = dart.constFn(async.Future$(isolate.Isolate)))();
+ let FutureOfIsolate = () => (FutureOfIsolate = dart.constFn(async.Future$(isolate$.Isolate)))();
let JsArray = () => (JsArray = dart.constFn(js.JsArray$()))();
let ExpandoOfFunction = () => (ExpandoOfFunction = dart.constFn(core.Expando$(core.Function)))();
let PointOfnum = () => (PointOfnum = dart.constFn(math.Point$(core.num)))();
@@ -595,6 +603,7 @@
let ElementListOfElement = () => (ElementListOfElement = dart.constFn(html$.ElementList$(html$.Element)))();
let ListOfRectangleOfnum = () => (ListOfRectangleOfnum = dart.constFn(core.List$(RectangleOfnum())))();
let ListOfGamepad = () => (ListOfGamepad = dart.constFn(core.List$(html$.Gamepad)))();
+ let SetOfString = () => (SetOfString = dart.constFn(core.Set$(core.String)))();
let ListOfCssClassSetImpl = () => (ListOfCssClassSetImpl = dart.constFn(core.List$(html_common.CssClassSetImpl)))();
let LinkedHashSetOfString = () => (LinkedHashSetOfString = dart.constFn(collection.LinkedHashSet$(core.String)))();
let StringTobool = () => (StringTobool = dart.constFn(dart.functionType(core.bool, [core.String])))();
@@ -640,18 +649,20 @@
let dynamicToListOfString = () => (dynamicToListOfString = dart.constFn(dart.definiteFunctionType(ListOfString(), [dart.dynamic])))();
let dynamicToList = () => (dynamicToList = dart.constFn(dart.definiteFunctionType(core.List, [dart.dynamic])))();
let dynamicAndSetOfNameValuePairTovoid = () => (dynamicAndSetOfNameValuePairTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [dart.dynamic, SetOfNameValuePair()])))();
- let TypeToString = () => (TypeToString = dart.constFn(dart.definiteFunctionType(core.String, [core.Type])))();
- let dynamicToObject = () => (dynamicToObject = dart.constFn(dart.definiteFunctionType(core.Object, [dart.dynamic])))();
+ let dynamicAndSetOfNameValuePairAnddynamic__Tovoid = () => (dynamicAndSetOfNameValuePairAnddynamic__Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [dart.dynamic, SetOfNameValuePair(), dart.dynamic, core.bool], {tagTypes: dart.dynamic})))();
+ let NameValuePairAndNameValuePairToint = () => (NameValuePairAndNameValuePairToint = dart.constFn(dart.definiteFunctionType(core.int, [_debugger.NameValuePair, _debugger.NameValuePair])))();
+ let IterableOfNameValuePairToListOfNameValuePair = () => (IterableOfNameValuePairToListOfNameValuePair = dart.constFn(dart.definiteFunctionType(ListOfNameValuePair(), [IterableOfNameValuePair()])))();
let dynamicAnddynamicToString = () => (dynamicAnddynamicToString = dart.constFn(dart.definiteFunctionType(core.String, [dart.dynamic, dart.dynamic])))();
let dynamicAndStringTobool = () => (dynamicAndStringTobool = dart.constFn(dart.definiteFunctionType(core.bool, [dart.dynamic, core.String])))();
let intAnddynamicToNull = () => (intAnddynamicToNull = dart.constFn(dart.definiteFunctionType(core.Null, [core.int, dart.dynamic])))();
let ObjectAndObjectToObject = () => (ObjectAndObjectToObject = dart.constFn(dart.definiteFunctionType(core.Object, [core.Object, core.Object])))();
let StringTobool$ = () => (StringTobool$ = dart.constFn(dart.definiteFunctionType(core.bool, [core.String])))();
+ let dynamicToObject = () => (dynamicToObject = dart.constFn(dart.definiteFunctionType(core.Object, [dart.dynamic])))();
let dynamicTobool$ = () => (dynamicTobool$ = dart.constFn(dart.definiteFunctionType(core.bool, [dart.dynamic])))();
let dynamicAnddynamicToNull = () => (dynamicAnddynamicToNull = dart.constFn(dart.definiteFunctionType(core.Null, [dart.dynamic, dart.dynamic])))();
- let StringAndObjectToNull = () => (StringAndObjectToNull = dart.constFn(dart.definiteFunctionType(core.Null, [core.String, core.Object])))();
let StringToNameValuePair = () => (StringToNameValuePair = dart.constFn(dart.definiteFunctionType(_debugger.NameValuePair, [core.String])))();
let VoidTodynamic$ = () => (VoidTodynamic$ = dart.constFn(dart.definiteFunctionType(dart.dynamic, [])))();
+ let StringTodynamic = () => (StringTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.String])))();
let StringAndString__Todynamic = () => (StringAndString__Todynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.String, core.String], [dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic])))();
let VoidToIsolateContext = () => (VoidToIsolateContext = dart.constFn(dart.definiteFunctionType(_foreign_helper.IsolateContext, [])))();
let dynamicAndFunctionTodynamic = () => (dynamicAndFunctionTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [dart.dynamic, core.Function])))();
@@ -665,6 +676,8 @@
let TypeAndStringTodynamic = () => (TypeAndStringTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.Type, core.String])))();
let dynamicAnddynamicTodynamic$ = () => (dynamicAnddynamicTodynamic$ = dart.constFn(dart.definiteFunctionType(dart.dynamic, [dart.dynamic, dart.dynamic])))();
let dynamicAnddynamicToint = () => (dynamicAnddynamicToint = dart.constFn(dart.definiteFunctionType(core.int, [dart.dynamic, dart.dynamic])))();
+ let intToint = () => (intToint = dart.constFn(dart.definiteFunctionType(core.int, [core.int])))();
+ let StringAndintToint = () => (StringAndintToint = dart.constFn(dart.definiteFunctionType(core.int, [core.String, core.int])))();
let ListOfEToListOfE = () => (ListOfEToListOfE = dart.constFn(dart.definiteFunctionType(E => [core.List$(E), [core.List$(E)]])))();
let StringTovoid$ = () => (StringTovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [core.String])))();
let _IsolateContextAndFunctionTodynamic = () => (_IsolateContextAndFunctionTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [_isolate_helper._IsolateContext, core.Function])))();
@@ -677,10 +690,11 @@
let StringToNull = () => (StringToNull = dart.constFn(dart.definiteFunctionType(core.Null, [core.String])))();
let dynamicToNull$ = () => (dynamicToNull$ = dart.constFn(dart.definiteFunctionType(core.Null, [dart.dynamic])))();
let TimerToNull = () => (TimerToNull = dart.constFn(dart.definiteFunctionType(core.Null, [async.Timer])))();
+ let VoidTo_Future = () => (VoidTo_Future = dart.constFn(dart.definiteFunctionType(async._Future, [])))();
+ let VoidToFuture = () => (VoidToFuture = dart.constFn(dart.definiteFunctionType(async.Future, [])))();
let dynamicToFuture = () => (dynamicToFuture = dart.constFn(dart.definiteFunctionType(async.Future, [dart.dynamic])))();
let boolToNull = () => (boolToNull = dart.constFn(dart.definiteFunctionType(core.Null, [core.bool])))();
let dynamicAndStackTraceTovoid = () => (dynamicAndStackTraceTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [dart.dynamic, core.StackTrace])))();
- let VoidToFuture = () => (VoidToFuture = dart.constFn(dart.definiteFunctionType(async.Future, [])))();
let VoidToint = () => (VoidToint = dart.constFn(dart.definiteFunctionType(core.int, [])))();
let dynamicAnddynamicToError = () => (dynamicAnddynamicToError = dart.constFn(dart.definiteFunctionType(core.Error, [dart.dynamic, dart.dynamic])))();
let dynamicAnddynamicAnddynamicToError = () => (dynamicAnddynamicAnddynamicToError = dart.constFn(dart.definiteFunctionType(core.Error, [dart.dynamic, dart.dynamic, dart.dynamic])))();
@@ -741,7 +755,7 @@
let _NotificationHandlerToFuture = () => (_NotificationHandlerToFuture = dart.constFn(dart.definiteFunctionType(async.Future, [async._NotificationHandler])))();
let dynamicAndStackTraceToNull = () => (dynamicAndStackTraceToNull = dart.constFn(dart.definiteFunctionType(core.Null, [dart.dynamic, core.StackTrace])))();
let dynamic__Tovoid = () => (dynamic__Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [dart.dynamic], [core.StackTrace])))();
- let FnAndFnAndFnTodynamic = () => (FnAndFnAndFnTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [VoidTodynamic(), dynamicTodynamic(), ZoneBinaryCallbackOfdynamic$dynamic$StackTrace()])))();
+ let FnAndFnAndFnTodynamic = () => (FnAndFnAndFnTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [VoidTodynamic(), dynamicTodynamic(), dynamicAndStackTraceTodynamic()])))();
let StreamSubscriptionAnd_FutureAnddynamic__Tovoid = () => (StreamSubscriptionAnd_FutureAnddynamic__Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [async.StreamSubscription, async._Future, dart.dynamic, core.StackTrace])))();
let StreamSubscriptionAnd_FutureTo_ErrorCallback = () => (StreamSubscriptionAnd_FutureTo_ErrorCallback = dart.constFn(dart.definiteFunctionType(async._ErrorCallback, [async.StreamSubscription, async._Future])))();
let StreamSubscriptionAnd_FutureAnddynamicTovoid = () => (StreamSubscriptionAnd_FutureAnddynamicTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [async.StreamSubscription, async._Future, dart.dynamic])))();
@@ -779,12 +793,18 @@
let ObjectAndObjectTobool = () => (ObjectAndObjectTobool = dart.constFn(dart.definiteFunctionType(core.bool, [core.Object, core.Object])))();
let ObjectToint = () => (ObjectToint = dart.constFn(dart.definiteFunctionType(core.int, [core.Object])))();
let ObjectTovoid = () => (ObjectTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.Object])))();
+ let MapOfString$StringAndStringToMapOfString$String = () => (MapOfString$StringAndStringToMapOfString$String = dart.constFn(dart.definiteFunctionType(MapOfString$String(), [MapOfString$String(), core.String])))();
+ let StringAndintTovoid = () => (StringAndintTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String, core.int])))();
+ let String__Tovoid = () => (String__Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String], [dart.dynamic])))();
let StringAndStringTovoid$ = () => (StringAndStringTovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [core.String, core.String])))();
let StringAnddynamicToNull = () => (StringAnddynamicToNull = dart.constFn(dart.definiteFunctionType(core.Null, [core.String, dart.dynamic])))();
- let MapOfString$StringAndStringToMapOfString$String = () => (MapOfString$StringAndStringToMapOfString$String = dart.constFn(dart.definiteFunctionType(MapOfString$String(), [MapOfString$String(), core.String])))();
let intAndintAndintTovoid = () => (intAndintAndintTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.int, core.int, core.int])))();
- let String__Tovoid = () => (String__Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String], [dart.dynamic])))();
let StringAndStringToNull = () => (StringAndStringToNull = dart.constFn(dart.definiteFunctionType(core.Null, [core.String, core.String])))();
+ let intToUint8List = () => (intToUint8List = dart.constFn(dart.definiteFunctionType(typed_data.Uint8List, [core.int])))();
+ let dynamicAnddynamicToUint8List = () => (dynamicAnddynamicToUint8List = dart.constFn(dart.definiteFunctionType(typed_data.Uint8List, [dart.dynamic, dart.dynamic])))();
+ let Uint8ListAndStringAndintTovoid = () => (Uint8ListAndStringAndintTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [typed_data.Uint8List, core.String, core.int])))();
+ let VoidToListOfUint8List = () => (VoidToListOfUint8List = dart.constFn(dart.definiteFunctionType(ListOfUint8List(), [])))();
+ let StringAndintAndint__Toint = () => (StringAndintAndint__Toint = dart.constFn(dart.definiteFunctionType(core.int, [core.String, core.int, core.int, core.int, ListOfint()])))();
let __Tobool = () => (__Tobool = dart.constFn(dart.definiteFunctionType(core.bool, [], {when: core.bool, message: core.String})))();
let String__Tovoid$ = () => (String__Tovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [core.String], {time: core.DateTime, sequenceNumber: core.int, level: core.int, name: core.String, zone: async.Zone, error: core.Object, stackTrace: core.StackTrace})))();
let StringAndServiceExtensionHandlerTovoid = () => (StringAndServiceExtensionHandlerTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String, developer.ServiceExtensionHandler])))();
@@ -797,10 +817,11 @@
let intAndintAndString__Tovoid$ = () => (intAndintAndString__Tovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [core.int, core.int, core.String, core.String, core.String])))();
let intAndStringAndString__Tovoid = () => (intAndStringAndString__Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.int, core.String, core.String, core.String])))();
let UriTovoid = () => (UriTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.Uri])))();
- let SendPortTovoid = () => (SendPortTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [isolate.SendPort])))();
- let SendPortAndboolTovoid = () => (SendPortAndboolTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [isolate.SendPort, core.bool])))();
+ let SendPortTovoid = () => (SendPortTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [isolate$.SendPort])))();
+ let SendPortAndboolTovoid = () => (SendPortAndboolTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [isolate$.SendPort, core.bool])))();
+ let SendPortToString = () => (SendPortToString = dart.constFn(dart.definiteFunctionType(core.String, [isolate$.SendPort])))();
let dynamicAndStringAndStringTodynamic = () => (dynamicAndStringAndStringTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [dart.dynamic, core.String, core.String])))();
- let ListAndintAndintTo_BufferAndStart = () => (ListAndintAndintTo_BufferAndStart = dart.constFn(dart.definiteFunctionType(io._BufferAndStart, [core.List, core.int, core.int])))();
+ let ListOfintAndintAndintTo_BufferAndStart = () => (ListOfintAndintAndintTo_BufferAndStart = dart.constFn(dart.definiteFunctionType(io._BufferAndStart, [ListOfint(), core.int, core.int])))();
let intTovoid = () => (intTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.int])))();
let DirectoryToFutureOfDirectory = () => (DirectoryToFutureOfDirectory = dart.constFn(dart.definiteFunctionType(FutureOfDirectory(), [io.Directory])))();
let boolToFutureOrOfDirectory = () => (boolToFutureOrOfDirectory = dart.constFn(dart.definiteFunctionType(FutureOrOfDirectory(), [core.bool])))();
@@ -819,17 +840,15 @@
let dynamicToFile = () => (dynamicToFile = dart.constFn(dart.definiteFunctionType(io.File, [dart.dynamic])))();
let dynamicTo_RandomAccessFile = () => (dynamicTo_RandomAccessFile = dart.constFn(dart.definiteFunctionType(io._RandomAccessFile, [dart.dynamic])))();
let dynamicToDateTime = () => (dynamicToDateTime = dart.constFn(dart.definiteFunctionType(core.DateTime, [dart.dynamic])))();
- let dynamicToFutureOfListOfint = () => (dynamicToFutureOfListOfint = dart.constFn(dart.definiteFunctionType(FutureOfListOfint(), [dart.dynamic])))();
- let intToFutureOfListOfint = () => (intToFutureOfListOfint = dart.constFn(dart.definiteFunctionType(FutureOfListOfint(), [core.int])))();
let RandomAccessFileToFutureOfListOfint = () => (RandomAccessFileToFutureOfListOfint = dart.constFn(dart.definiteFunctionType(FutureOfListOfint(), [io.RandomAccessFile])))();
+ let intToFutureOfListOfint = () => (intToFutureOfListOfint = dart.constFn(dart.definiteFunctionType(FutureOfListOfint(), [core.int])))();
let ListOfintToString = () => (ListOfintToString = dart.constFn(dart.definiteFunctionType(core.String, [ListOfint()])))();
let RandomAccessFileTo_File = () => (RandomAccessFileTo_File = dart.constFn(dart.definiteFunctionType(io._File, [io.RandomAccessFile])))();
let RandomAccessFileToObject = () => (RandomAccessFileToObject = dart.constFn(dart.definiteFunctionType(core.Object, [io.RandomAccessFile])))();
let RandomAccessFileToFutureOrOfFile = () => (RandomAccessFileToFutureOrOfFile = dart.constFn(dart.definiteFunctionType(FutureOrOfFile(), [io.RandomAccessFile])))();
- let dynamicToFutureOrOfListOfint = () => (dynamicToFutureOrOfListOfint = dart.constFn(dart.definiteFunctionType(FutureOrOfListOfint(), [dart.dynamic])))();
+ let dynamicToListOfint = () => (dynamicToListOfint = dart.constFn(dart.definiteFunctionType(ListOfint(), [dart.dynamic])))();
let dynamicToFileStat = () => (dynamicToFileStat = dart.constFn(dart.definiteFunctionType(io.FileStat, [dart.dynamic])))();
let StringAndListOfStringToListOfString = () => (StringAndListOfStringToListOfString = dart.constFn(dart.definiteFunctionType(ListOfString(), [core.String, ListOfString()])))();
- let ListOfintTovoid = () => (ListOfintTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [ListOfint()])))();
let StringAndListOfStringToNull = () => (StringAndListOfStringToNull = dart.constFn(dart.definiteFunctionType(core.Null, [core.String, ListOfString()])))();
let CookieToString = () => (CookieToString = dart.constFn(dart.definiteFunctionType(core.String, [io.Cookie])))();
let CookieTobool = () => (CookieTobool = dart.constFn(dart.definiteFunctionType(core.bool, [io.Cookie])))();
@@ -845,11 +864,14 @@
let ListToFutureOrOfHttpClientResponse = () => (ListToFutureOrOfHttpClientResponse = dart.constFn(dart.definiteFunctionType(FutureOrOfHttpClientResponse(), [core.List])))();
let HttpClientResponseTovoid = () => (HttpClientResponseTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [io.HttpClientResponse])))();
let dynamicToIterable = () => (dynamicToIterable = dart.constFn(dart.definiteFunctionType(core.Iterable, [dart.dynamic])))();
+ let ListOfintTovoid = () => (ListOfintTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [ListOfint()])))();
let dynamicTo_HttpOutboundMessage = () => (dynamicTo_HttpOutboundMessage = dart.constFn(dart.definiteFunctionType(io._HttpOutboundMessage, [dart.dynamic])))();
let dynamicAnddynamicTo_HttpOutboundMessage = () => (dynamicAnddynamicTo_HttpOutboundMessage = dart.constFn(dart.definiteFunctionType(io._HttpOutboundMessage, [dart.dynamic, dart.dynamic])))();
let dynamic__ToNull$ = () => (dynamic__ToNull$ = dart.constFn(dart.definiteFunctionType(core.Null, [dart.dynamic], [core.StackTrace])))();
let _HttpIncomingToNull = () => (_HttpIncomingToNull = dart.constFn(dart.definiteFunctionType(core.Null, [io._HttpIncoming])))();
- let dynamicTo_DetachedSocket = () => (dynamicTo_DetachedSocket = dart.constFn(dart.definiteFunctionType(io._DetachedSocket, [dart.dynamic])))();
+ let SocketToSocket = () => (SocketToSocket = dart.constFn(dart.definiteFunctionType(io.Socket, [io.Socket])))();
+ let SocketTo_DetachedSocket = () => (SocketTo_DetachedSocket = dart.constFn(dart.definiteFunctionType(io._DetachedSocket, [io.Socket])))();
+ let SocketTovoid = () => (SocketTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [io.Socket])))();
let SecureSocketTo_HttpClientConnection = () => (SecureSocketTo_HttpClientConnection = dart.constFn(dart.definiteFunctionType(io._HttpClientConnection, [io.SecureSocket])))();
let HttpClientResponseToFutureOfSecureSocket = () => (HttpClientResponseToFutureOfSecureSocket = dart.constFn(dart.definiteFunctionType(FutureOfSecureSocket(), [io.HttpClientResponse])))();
let X509CertificateTobool$ = () => (X509CertificateTobool$ = dart.constFn(dart.definiteFunctionType(core.bool, [io.X509Certificate])))();
@@ -863,14 +885,15 @@
let dynamicToFutureOf_ConnectionInfo = () => (dynamicToFutureOf_ConnectionInfo = dart.constFn(dart.definiteFunctionType(FutureOf_ConnectionInfo(), [dart.dynamic])))();
let VoidToFutureOf_ConnectionInfo = () => (VoidToFutureOf_ConnectionInfo = dart.constFn(dart.definiteFunctionType(FutureOf_ConnectionInfo(), [])))();
let _SiteCredentialsAnd_CredentialsTo_SiteCredentials = () => (_SiteCredentialsAnd_CredentialsTo_SiteCredentials = dart.constFn(dart.definiteFunctionType(io._SiteCredentials, [io._SiteCredentials, io._Credentials])))();
+ let SocketToNull = () => (SocketToNull = dart.constFn(dart.definiteFunctionType(core.Null, [io.Socket])))();
+ let dynamicTo_DetachedSocket = () => (dynamicTo_DetachedSocket = dart.constFn(dart.definiteFunctionType(io._DetachedSocket, [dart.dynamic])))();
let ServerSocketTo_HttpServer = () => (ServerSocketTo_HttpServer = dart.constFn(dart.definiteFunctionType(io._HttpServer, [io.ServerSocket])))();
let SecureServerSocketTo_HttpServer = () => (SecureServerSocketTo_HttpServer = dart.constFn(dart.definiteFunctionType(io._HttpServer, [io.SecureServerSocket])))();
- let SocketToNull = () => (SocketToNull = dart.constFn(dart.definiteFunctionType(core.Null, [io.Socket])))();
let _HttpConnectionToNull = () => (_HttpConnectionToNull = dart.constFn(dart.definiteFunctionType(core.Null, [io._HttpConnection])))();
let _HttpConnectionToMap = () => (_HttpConnectionToMap = dart.constFn(dart.definiteFunctionType(core.Map, [io._HttpConnection])))();
- let _FileResourceInfoToMapOfString$String = () => (_FileResourceInfoToMapOfString$String = dart.constFn(dart.definiteFunctionType(MapOfString$String(), [io._FileResourceInfo])))();
- let _ProcessResourceInfoToMapOfString$String = () => (_ProcessResourceInfoToMapOfString$String = dart.constFn(dart.definiteFunctionType(MapOfString$String(), [io._ProcessResourceInfo])))();
- let _SocketResourceInfoToMapOfString$String = () => (_SocketResourceInfoToMapOfString$String = dart.constFn(dart.definiteFunctionType(MapOfString$String(), [io._SocketResourceInfo])))();
+ let _FileResourceInfoToMapOfString$dynamic = () => (_FileResourceInfoToMapOfString$dynamic = dart.constFn(dart.definiteFunctionType(MapOfString$dynamic(), [io._FileResourceInfo])))();
+ let _ProcessResourceInfoToMapOfString$dynamic = () => (_ProcessResourceInfoToMapOfString$dynamic = dart.constFn(dart.definiteFunctionType(MapOfString$dynamic(), [io._ProcessResourceInfo])))();
+ let _SocketResourceInfoToMapOfString$dynamic = () => (_SocketResourceInfoToMapOfString$dynamic = dart.constFn(dart.definiteFunctionType(MapOfString$dynamic(), [io._SocketResourceInfo])))();
let dynamicTo_Link = () => (dynamicTo_Link = dart.constFn(dart.definiteFunctionType(io._Link, [dart.dynamic])))();
let FileSystemEntityToFutureOfLink = () => (FileSystemEntityToFutureOfLink = dart.constFn(dart.definiteFunctionType(FutureOfLink(), [io.FileSystemEntity])))();
let FileSystemEntityTo_Link = () => (FileSystemEntityTo_Link = dart.constFn(dart.definiteFunctionType(io._Link, [io.FileSystemEntity])))();
@@ -883,7 +906,6 @@
let RawSecureSocketToNull = () => (RawSecureSocketToNull = dart.constFn(dart.definiteFunctionType(core.Null, [io.RawSecureSocket])))();
let RawSocketToFutureOfRawSecureSocket = () => (RawSocketToFutureOfRawSecureSocket = dart.constFn(dart.definiteFunctionType(FutureOfRawSecureSocket(), [io.RawSocket])))();
let _FilterStatusToNull = () => (_FilterStatusToNull = dart.constFn(dart.definiteFunctionType(core.Null, [io._FilterStatus])))();
- let intToint = () => (intToint = dart.constFn(dart.definiteFunctionType(core.int, [core.int])))();
let dynamicTo_FilterStatus = () => (dynamicTo_FilterStatus = dart.constFn(dart.definiteFunctionType(io._FilterStatus, [dart.dynamic])))();
let ListOfintAndStringTovoid = () => (ListOfintAndStringTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [ListOfint(), core.String])))();
let dynamicToStdioType = () => (dynamicToStdioType = dart.constFn(dart.definiteFunctionType(io.StdioType, [dart.dynamic])))();
@@ -891,14 +913,13 @@
let WebSocketTovoid = () => (WebSocketTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [io.WebSocket])))();
let HttpRequestToNull = () => (HttpRequestToNull = dart.constFn(dart.definiteFunctionType(core.Null, [io.HttpRequest])))();
let SocketTo_WebSocketImpl = () => (SocketTo_WebSocketImpl = dart.constFn(dart.definiteFunctionType(io._WebSocketImpl, [io.Socket])))();
- let StringToFuture = () => (StringToFuture = dart.constFn(dart.definiteFunctionType(async.Future, [core.String])))();
+ let StringToFutureOfWebSocket = () => (StringToFutureOfWebSocket = dart.constFn(dart.definiteFunctionType(FutureOfWebSocket(), [core.String])))();
let EventSinkOfListOfintTo_WebSocketOutgoingTransformer = () => (EventSinkOfListOfintTo_WebSocketOutgoingTransformer = dart.constFn(dart.definiteFunctionType(io._WebSocketOutgoingTransformer, [EventSinkOfListOfint()])))();
- let dynamicTo_WebSocketImpl = () => (dynamicTo_WebSocketImpl = dart.constFn(dart.definiteFunctionType(io._WebSocketImpl, [dart.dynamic])))();
let HttpClientResponseToFutureOfWebSocket = () => (HttpClientResponseToFutureOfWebSocket = dart.constFn(dart.definiteFunctionType(FutureOfWebSocket(), [io.HttpClientResponse])))();
let StringAnddynamicTovoid = () => (StringAnddynamicTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String, dart.dynamic])))();
let HttpClientRequestToFutureOfHttpClientResponse = () => (HttpClientRequestToFutureOfHttpClientResponse = dart.constFn(dart.definiteFunctionType(FutureOfHttpClientResponse(), [io.HttpClientRequest])))();
let dynamicToMap = () => (dynamicToMap = dart.constFn(dart.definiteFunctionType(core.Map, [dart.dynamic])))();
- let ListToIsolate = () => (ListToIsolate = dart.constFn(dart.definiteFunctionType(isolate.Isolate, [core.List])))();
+ let ListToIsolate = () => (ListToIsolate = dart.constFn(dart.definiteFunctionType(isolate$.Isolate, [core.List])))();
let dynamicTo_DartObject = () => (dynamicTo_DartObject = dart.constFn(dart.definiteFunctionType(js._DartObject, [dart.dynamic])))();
let dynamicAnddynamicAndFnToObject = () => (dynamicAnddynamicAndFnToObject = dart.constFn(dart.definiteFunctionType(core.Object, [dart.dynamic, dart.dynamic, dynamicTodynamic()])))();
let FToF = () => (FToF = dart.constFn(dart.definiteFunctionType(F => [F, [F]])))();
@@ -1463,8 +1484,8 @@
dart.getIsNamedConstructor = function(value) {
return value[dart.isNamedConstructor];
};
- dart.getDartLibraryName = function(value) {
- return value[dart_library.dartLibraryName];
+ dart.getModuleName = function(value) {
+ return value[dart._moduleName];
};
dart.tag = function(value, t) {
value[dart._runtimeType] = t;
@@ -1475,6 +1496,18 @@
dart.tagLazy = function(value, compute) {
dart.defineLazyProperty(value, dart._runtimeType, {get: compute});
};
+ dart.getModuleNames = function() {
+ return Array.from(dart._loadedModules.keys());
+ };
+ dart.getModuleLibraries = function(name) {
+ let module = dart._loadedModules.get(name);
+ if (module == null) return null;
+ module[dart._moduleName] = name;
+ return module;
+ };
+ dart.trackLibraries = function(moduleName, libraries) {
+ dart._loadedModules.set(moduleName, libraries);
+ };
dart._warn = function(arg) {
console.warn(arg);
};
@@ -1617,6 +1650,9 @@
dart.definiteFunctionType = function(returnType, args, extra) {
return dart._functionType(true, returnType, args, extra);
};
+ dart.isType = function(obj) {
+ return dart._getRuntimeType(obj) === core.Type;
+ };
dart.typeName = function(type) {
if (type === void 0) return "undefined type";
if (type === null) return "null type";
@@ -2041,7 +2077,7 @@
return name;
};
dart._dartSymbol = function(name) {
- return core.Symbol._check(typeof name === "symbol" ? dart.const(new _internal.Symbol.es6(dart._toSymbolName(name), name)) : dart.const(core.Symbol.new(dart._toDisplayName(name))));
+ return core.Symbol._check(typeof name === "symbol" ? dart.const(new _internal.PrivateSymbol(dart._toSymbolName(name), name)) : dart.const(core.Symbol.new(dart._toDisplayName(name))));
};
dart.extractNamedArgs = function(args) {
if (args.length > 0) {
@@ -2435,6 +2471,7 @@
return obj[dartx.toString]();
}
if (typeof obj == "function") {
+ if (dart.test(dart.isType(obj))) return dart.typeName(obj);
return "Closure: " + dart.getReifiedType(obj) + " from: " + obj;
}
return obj.toString();
@@ -2639,12 +2676,19 @@
dart.dartx = dartx;
dart._runtimeType = Symbol("_runtimeType");
dart.isNamedConstructor = Symbol("isNamedConstructor");
+ dart._moduleName = Symbol("_moduleName");
dart.defineLazy(dart, {
get _lazyJSTypes() {
return new Map();
},
set _lazyJSTypes(_) {}
});
+ dart.defineLazy(dart, {
+ get _loadedModules() {
+ return new Map();
+ },
+ set _loadedModules(_) {}
+ });
dart.metadata = Symbol("metadata");
dart._typeObject = Symbol("typeObject");
core.Object = class Object {
@@ -3198,9 +3242,51 @@
names: ['getProperty', 'setProperty']
});
_debugger.addMetadataChildren = function(object, ret) {
- ret.add(new _debugger.NameValuePair({name: _debugger.getTypeName(core.Type._check(_debugger._getType(object))), value: object, config: _debugger.JsonMLConfig.asClass}));
+ ret.add(new _debugger.NameValuePair({name: "[[class]]", value: dart.getReifiedType(object), config: _debugger.JsonMLConfig.asClass}));
};
dart.lazyFn(_debugger.addMetadataChildren, () => dynamicAndSetOfNameValuePairTovoid());
+ _debugger.addPropertiesFromSignature = function(sig, properties, object, walkPrototypeChain, opts) {
+ let tagTypes = opts && 'tagTypes' in opts ? opts.tagTypes : false;
+ let skippedNames = core.Set.new();
+ skippedNames.add('hashCode');
+ while (sig != null) {
+ for (let symbol of _debugger.getOwnPropertySymbols(sig)) {
+ let dartName = _debugger.symbolName(symbol);
+ let dartXPrefix = 'dartx.';
+ if (dart.test(dartName[dartx.startsWith](dartXPrefix))) {
+ dartName = dartName[dartx.substring](dartXPrefix[dartx.length]);
+ }
+ if (dart.test(skippedNames.contains(dartName))) continue;
+ let value = _debugger.safeGetProperty(object, symbol);
+ if (dart.test(tagTypes) && _debugger._typeof(value) == 'function') {
+ dart.tag(value, sig[symbol]);
+ }
+ properties.add(new _debugger.NameValuePair({name: dartName, value: value}));
+ }
+ for (let name of _debugger.getOwnPropertyNames(sig)) {
+ let value = _debugger.safeGetProperty(object, name);
+ if (dart.test(skippedNames.contains(name))) continue;
+ if (dart.test(tagTypes) && _debugger._typeof(value) == 'function') {
+ dart.tag(value, sig[name]);
+ }
+ properties.add(new _debugger.NameValuePair({name: name, value: value}));
+ }
+ if (!dart.test(walkPrototypeChain)) break;
+ sig = _debugger.safeGetProperty(sig, '__proto__');
+ }
+ };
+ dart.lazyFn(_debugger.addPropertiesFromSignature, () => dynamicAndSetOfNameValuePairAnddynamic__Tovoid());
+ _debugger.sortProperties = function(properties) {
+ let sortedProperties = properties[dartx.toList]();
+ sortedProperties[dartx.sort](dart.fn((a, b) => {
+ let aPrivate = a.name[dartx.startsWith]('_');
+ let bPrivate = b.name[dartx.startsWith]('_');
+ if (aPrivate != bPrivate) return dart.test(aPrivate) ? 1 : -1;
+ return a.name[dartx.compareTo](b.name);
+ }, NameValuePairAndNameValuePairToint()));
+ return sortedProperties;
+ };
+ dart.lazyFn(_debugger.sortProperties, () => IterableOfNameValuePairToListOfNameValuePair());
_debugger.getObjectTypeName = function(object) {
let reifiedType = dart.getReifiedType(object);
if (reifiedType == null) {
@@ -3209,7 +3295,7 @@
}
return '<Error getting type name>';
}
- return _debugger.getTypeName(core.Type._check(reifiedType));
+ return _debugger.getTypeName(reifiedType);
};
dart.lazyFn(_debugger.getObjectTypeName, () => dynamicToString());
_debugger.getTypeName = function(type) {
@@ -3217,11 +3303,7 @@
if (name == 'JSArray<dynamic>' || name == 'JSObject<Array>') return 'List<dynamic>';
return name;
};
- dart.lazyFn(_debugger.getTypeName, () => TypeToString());
- _debugger._getType = function(object) {
- return core.Type.is(object) ? object : dart.getReifiedType(object);
- };
- dart.fn(_debugger._getType, dynamicToObject());
+ dart.lazyFn(_debugger.getTypeName, () => dynamicToString());
const _simpleFormatter = Symbol('_simpleFormatter');
_debugger.safePreview = function(object, config) {
try {
@@ -3261,7 +3343,9 @@
this.hideName = hideName;
}
['=='](other) {
- return _debugger.NameValuePair.is(other) && other.name == this.name;
+ if (!_debugger.NameValuePair.is(other)) return false;
+ if (dart.test(this.hideName) || dart.test(dart.dload(other, 'hideName'))) return core.identical(this, other);
+ return dart.equals(dart.dload(other, 'name'), this.name);
}
get hashCode() {
return dart.hashCode(this.name);
@@ -3454,7 +3538,7 @@
});
_debugger.isNativeJavaScriptObject = function(object) {
let type = _debugger._typeof(object);
- return type != 'object' && type != 'function' || dart.JSObject.is(object) || html$.Node.is(object);
+ return type != 'object' && type != 'function' || dart.test(dart.isJsInterop(object)) || html$.Node.is(object);
};
dart.lazyFn(_debugger.isNativeJavaScriptObject, () => dynamicTobool$());
_debugger.JsonMLFormatter = class JsonMLFormatter extends core.Object {
@@ -3490,24 +3574,37 @@
body.addStyle('color: rgb(196, 26, 22);');
}
let children = this[_simpleFormatter].children(object, config);
+ if (children == null) return body.toJsonML();
for (let child of children) {
let li = body.createChild('li');
- let nameSpan = new _debugger.JsonMLElement('span');
- nameSpan.createTextChild(dart.test(child.displayName[dartx.isNotEmpty]) ? dart.str`${child.displayName}: ` : '');
- nameSpan.setStyle('color: rgb(136, 19, 145);');
+ li.setStyle("padding-left: 13px;");
+ let nameSpan = null;
+ let valueStyle = '';
+ if (!dart.test(child.hideName)) {
+ nameSpan = new _debugger.JsonMLElement('span');
+ nameSpan.createTextChild(dart.test(child.displayName[dartx.isNotEmpty]) ? dart.str`${child.displayName}: ` : '');
+ nameSpan.setStyle('color: rgb(136, 19, 145); margin-right: -13px');
+ valueStyle = 'margin-left: 13px';
+ }
if (_debugger._typeof(child.value) == 'object' || _debugger._typeof(child.value) == 'function') {
- nameSpan.addStyle("padding-left: 13px;");
- li.appendChild(nameSpan);
- let objectTag = li.createObjectTag(child.value);
- objectTag.addAttribute('config', child.config);
- if (!dart.test(this[_simpleFormatter].hasChildren(child.value, child.config))) {
- li.setStyle("padding-left: 13px;");
+ let valueSpan = new _debugger.JsonMLElement('span');
+ valueSpan.setStyle(valueStyle);
+ valueSpan.createObjectTag(child.value).addAttribute('config', child.config);
+ if (nameSpan != null) {
+ li.appendChild(nameSpan);
}
+ li.appendChild(valueSpan);
} else {
- li.setStyle("padding-left: 13px;");
- let _ = li.createChild('span');
- _.appendChild(nameSpan);
- _.createTextChild(_debugger.safePreview(child.value, child.config));
+ let line = li.createChild('span');
+ if (nameSpan != null) {
+ line.appendChild(nameSpan);
+ }
+ line.appendChild((() => {
+ let _ = new _debugger.JsonMLElement('span');
+ _.createTextChild(_debugger.safePreview(child.value, child.config));
+ _.setStyle(valueStyle);
+ return _;
+ })());
}
}
return body.toJsonML();
@@ -3530,7 +3627,7 @@
_debugger.DartFormatter = class DartFormatter extends core.Object {
new() {
this[_formatters] = null;
- this[_formatters] = JSArrayOfFormatter().of([new _debugger.ClassFormatter(), new _debugger.NamedConstructorFormatter(), new _debugger.MapFormatter(), new _debugger.IterableFormatter(), new _debugger.IterableSpanFormatter(), new _debugger.MapEntryFormatter(), new _debugger.StackTraceFormatter(), new _debugger.FunctionFormatter(), new _debugger.HeritageClauseFormatter(), new _debugger.LibraryModuleFormatter(), new _debugger.LibraryFormatter(), new _debugger.ObjectFormatter()]);
+ this[_formatters] = JSArrayOfFormatter().of([new _debugger.ClassFormatter(), new _debugger.TypeFormatter(), new _debugger.NamedConstructorFormatter(), new _debugger.MapFormatter(), new _debugger.IterableFormatter(), new _debugger.IterableSpanFormatter(), new _debugger.MapEntryFormatter(), new _debugger.StackTraceFormatter(), new _debugger.FunctionFormatter(), new _debugger.HeritageClauseFormatter(), new _debugger.LibraryModuleFormatter(), new _debugger.LibraryFormatter(), new _debugger.ObjectFormatter()]);
}
preview(object, config) {
try {
@@ -3594,42 +3691,14 @@
return true;
}
children(object) {
- let properties = LinkedHashSetOfNameValuePair().new();
- _debugger.addMetadataChildren(object, properties);
- let current = object;
- let protoChain = JSArrayOfObject().of([]);
- while (current != null && !dart.test(_debugger.isNativeJavaScriptObject(current)) && current !== Object.prototype) {
- protoChain[dartx.add](current);
- current = _debugger.safeGetProperty(current, '__proto__');
- }
- for (current of protoChain) {
- for (let symbol of _debugger.getOwnPropertySymbols(current)) {
- let dartName = _debugger.symbolName(symbol);
- if (dart.test(_debugger.hasMethod(object, dartName))) {
- continue;
- }
- let dartXPrefix = 'dartx.';
- if (dart.test(dartName[dartx.startsWith](dartXPrefix))) {
- dartName = dartName[dartx.substring](dartXPrefix[dartx.length]);
- } else if (!dart.test(dartName[dartx.startsWith]('_'))) {
- continue;
- }
- let value = _debugger.safeGetProperty(object, symbol);
- properties.add(new _debugger.NameValuePair({name: dartName, value: value}));
- }
- }
- for (current of protoChain) {
- let className = dart.dload(dart.getReifiedType(current), 'name');
- for (let name of _debugger.getOwnPropertyNames(current)) {
- if (dart.test(_debugger.ObjectFormatter._customNames.contains(name)) || dart.equals(name, className)) continue;
- if (dart.test(_debugger.hasMethod(object, name))) {
- continue;
- }
- let value = _debugger.safeGetProperty(object, name);
- properties.add(new _debugger.NameValuePair({name: name, value: value}));
- }
- }
- return properties.toList();
+ let type = dart.getType(object);
+ let ret = LinkedHashSetOfNameValuePair().new();
+ let properties = SetOfNameValuePair().new();
+ _debugger.addPropertiesFromSignature(dart.getFieldSig(type), properties, object, true);
+ _debugger.addPropertiesFromSignature(dart.getGetterSig(type), properties, object, true);
+ ret.addAll(_debugger.sortProperties(properties));
+ _debugger.addMetadataChildren(object, ret);
+ return ret.toList();
}
};
dart.setSignature(_debugger.ObjectFormatter, {
@@ -3640,28 +3709,16 @@
children: dart.definiteFunctionType(core.List$(_debugger.NameValuePair), [dart.dynamic])
})
});
- dart.defineLazy(_debugger.ObjectFormatter, {
- get _customNames() {
- return (() => {
- let _ = SetOfString().new();
- _.add('constructor');
- _.add('prototype');
- _.add('__proto__');
- return _;
- })();
- },
- set _customNames(_) {}
- });
_debugger.LibraryModuleFormatter = class LibraryModuleFormatter extends core.Object {
accept(object, config) {
- return dart.getDartLibraryName(object) != null;
+ return dart.getModuleName(object) != null;
}
hasChildren(object) {
return true;
}
preview(object) {
- let libraryNames = dart.dsend(dart.getDartLibraryName(object), 'split', '/');
- if (dart.test(dart.dsend(dart.dload(libraryNames, 'length'), '>', 1))) {
+ let libraryNames = dart.dsend(dart.getModuleName(object), 'split', '/');
+ if (dart.test(dart.dsend(dart.dload(libraryNames, 'length'), '>', 1)) && dart.equals(dart.dload(libraryNames, 'last'), dart.dindex(libraryNames, dart.dsend(dart.dload(libraryNames, 'length'), '-', 2)))) {
dart.dsetindex(libraryNames, dart.dsend(dart.dload(libraryNames, 'length'), '-', 1), '');
}
return dart.str`Library Module: ${dart.dsend(libraryNames, 'join', '/')}`;
@@ -3670,7 +3727,6 @@
let children = LinkedHashSetOfNameValuePair().new();
for (let name of _debugger.getOwnPropertyNames(object)) {
let value = _debugger.safeGetProperty(object, name);
- name = dart.str`${name[dartx.replaceAll]("__", "/")}.dart`;
children.add(new _debugger.NameValuePair({name: name, value: new _debugger.Library(name, value), hideName: true}));
}
return children.toList();
@@ -3700,36 +3756,16 @@
}
children(object) {
let children = LinkedHashSetOfNameValuePair().new();
- let nonGenericProperties = LinkedHashMapOfString$Object().new();
let objectProperties = _debugger.safeProperties(dart.dload(object, 'object'));
dart.dsend(objectProperties, 'forEach', dart.fn((name, value) => {
- let genericTypeConstructor = dart.getGenericTypeCtor(value);
- if (genericTypeConstructor != null) {
- this.recordGenericParameters(core.String._check(name), genericTypeConstructor);
- } else {
- nonGenericProperties._set(core.String._check(name), value);
- }
+ if (dart.getGenericTypeCtor(value) != null) return;
+ children.add(_debugger.NameValuePair._check(dart.test(dart.isType(value)) ? this.classChild(core.String._check(name), value) : new _debugger.NameValuePair({name: core.String._check(name), value: value})));
}, dynamicAnddynamicToNull()));
- nonGenericProperties.forEach(dart.fn((name, value) => {
- if (core.Type.is(value)) {
- children.add(_debugger.NameValuePair._check(this.classChild(name, value)));
- } else {
- children.add(new _debugger.NameValuePair({name: name, value: value}));
- }
- }, StringAndObjectToNull()));
return children.toList();
}
- recordGenericParameters(name, genericTypeConstructor) {
- this.genericParameters._set(name, genericTypeConstructor.toString()[dartx.split](' =>')[dartx.first][dartx.replaceAll](core.RegExp.new('[(|)]'), ''));
- }
classChild(name, child) {
- let typeName = _debugger.getTypeName(core.Type._check(child));
- let parameterName = dart.str`${name}\$`;
- if (dart.test(this.genericParameters.keys[dartx.contains](parameterName))) {
- typeName = dart.str`${typeName}<${this.genericParameters._get(parameterName)}>`;
- _debugger.JSNative.setProperty(child, 'genericTypeName', typeName);
- }
- return new _debugger.NameValuePair({name: typeName, value: child});
+ let typeName = _debugger.getTypeName(child);
+ return new _debugger.NameValuePair({name: typeName, value: child, config: _debugger.JsonMLConfig.asClass});
}
};
_debugger.LibraryFormatter[dart.implements] = () => [_debugger.Formatter];
@@ -3740,7 +3776,6 @@
hasChildren: dart.definiteFunctionType(core.bool, [dart.dynamic]),
preview: dart.definiteFunctionType(core.String, [dart.dynamic]),
children: dart.definiteFunctionType(core.List$(_debugger.NameValuePair), [dart.dynamic]),
- recordGenericParameters: dart.definiteFunctionType(dart.dynamic, [core.String, core.Object]),
classChild: dart.definiteFunctionType(dart.dynamic, [core.String, core.Object])
})
});
@@ -3957,60 +3992,49 @@
});
_debugger.ClassFormatter = class ClassFormatter extends core.Object {
accept(object, config) {
- return core.Type.is(object) || dart.equals(config, _debugger.JsonMLConfig.asClass);
+ return dart.equals(config, _debugger.JsonMLConfig.asClass);
}
- preview(object) {
- let typeName = _debugger.safeGetProperty(object, 'genericTypeName');
- if (typeName != null) return core.String._check(typeName);
- let type = _debugger._getType(object);
+ preview(type) {
let implements$ = dart.getImplements(type);
- typeName = _debugger.getTypeName(core.Type._check(type));
+ let typeName = _debugger.getTypeName(type);
if (implements$ != null) {
let typeNames = dart.dsend(dart.dcall(implements$), 'map', _debugger.getTypeName);
return dart.str`${typeName} implements ${dart.dsend(typeNames, 'join', ", ")}`;
} else {
- return core.String._check(typeName);
+ return typeName;
}
}
hasChildren(object) {
return true;
}
- children(object) {
- let type = _debugger._getType(object);
- let children = JSArrayOfNameValuePair().of([]);
- let typeName = _debugger.getTypeName(core.Type._check(_debugger._getType(object)));
+ children(type) {
+ let ret = LinkedHashSetOfNameValuePair().new();
+ let staticProperties = SetOfNameValuePair().new();
+ let staticMethods = SetOfNameValuePair().new();
+ _debugger.addPropertiesFromSignature(dart.getStaticFieldSig(type), staticProperties, type, false);
+ _debugger.addPropertiesFromSignature(dart.getStaticGetterSig(type), staticProperties, type, false);
+ _debugger.addPropertiesFromSignature(dart.getStaticSig(type), staticMethods, type, false);
+ if (dart.test(staticProperties.isNotEmpty) || dart.test(staticMethods.isNotEmpty)) {
+ ret.add(new _debugger.NameValuePair({value: '[[Static members]]', hideName: true}));
+ ret.addAll(_debugger.sortProperties(staticProperties));
+ ret.addAll(_debugger.sortProperties(staticMethods));
+ }
+ let instanceMethods = SetOfNameValuePair().new();
+ _debugger.addPropertiesFromSignature(dart.getMethodSig(type), instanceMethods, type.prototype, false, {tagTypes: true});
+ if (dart.test(instanceMethods.isNotEmpty)) {
+ ret.add(new _debugger.NameValuePair({value: '[[Instance Methods]]', hideName: true}));
+ ret.addAll(_debugger.sortProperties(instanceMethods));
+ }
+ let typeName = _debugger.getTypeName(type);
let mixins = dart.getMixins(type);
if (mixins != null && dart.test(dart.dload(mixins, 'isNotEmpty'))) {
- children[dartx.add](new _debugger.NameValuePair({name: '[[Mixins]]', value: new _debugger.HeritageClause('mixins', core.List._check(mixins))}));
+ ret.add(new _debugger.NameValuePair({name: '[[Mixins]]', value: new _debugger.HeritageClause('mixins', core.List._check(mixins))}));
}
- let hiddenProperties = JSArrayOfString().of(['length', 'name', 'prototype', 'genericTypeName']);
- for (let name of _debugger.getOwnPropertyNames(object)) {
- if (dart.test(hiddenProperties[dartx.contains](name))) continue;
- let value = _debugger.safeGetProperty(object, name);
- if (value != null && dart.getIsNamedConstructor(value) != null) {
- value = new _debugger.NamedConstructor(value);
- name = dart.str`${typeName}.${name}`;
- }
- children[dartx.add](new _debugger.NameValuePair({name: name, value: value}));
+ let baseProto = type.__proto__;
+ if (baseProto != null && !dart.test(dart.isJsInterop(baseProto))) {
+ ret.add(new _debugger.NameValuePair({name: "[[base class]]", value: baseProto, config: _debugger.JsonMLConfig.asClass}));
}
- let hiddenPrototypeProperties = JSArrayOfString().of(['constructor', 'new', '$identityHash']);
- let prototype = object.prototype;
- if (prototype != null) {
- for (let name of _debugger.getOwnPropertyNames(prototype)) {
- if (dart.test(hiddenPrototypeProperties[dartx.contains](name))) continue;
- let func = _debugger.safeGetProperty(prototype, name);
- let constructor = _debugger.safeGetProperty(prototype, 'constructor');
- let sigObj = dart.getMethodSig(constructor);
- if (sigObj != null) {
- let value = _debugger.safeGetProperty(sigObj, name);
- if (_debugger.getTypeName(core.Type._check(dart.getReifiedType(value))) != 'Null') {
- dart.tag(func, value);
- children[dartx.add](new _debugger.NameValuePair({name: name, value: func}));
- }
- }
- }
- }
- return children;
+ return ret.toList();
}
};
_debugger.ClassFormatter[dart.implements] = () => [_debugger.Formatter];
@@ -4022,11 +4046,42 @@
children: dart.definiteFunctionType(core.List$(_debugger.NameValuePair), [dart.dynamic])
})
});
+ _debugger.TypeFormatter = class TypeFormatter extends core.Object {
+ accept(object, config) {
+ return core.Type.is(object);
+ }
+ preview(object) {
+ return dart.toString(object);
+ }
+ hasChildren(object) {
+ return false;
+ }
+ children(object) {
+ return JSArrayOfNameValuePair().of([]);
+ }
+ };
+ _debugger.TypeFormatter[dart.implements] = () => [_debugger.Formatter];
+ dart.setSignature(_debugger.TypeFormatter, {
+ methods: () => ({
+ accept: dart.definiteFunctionType(core.bool, [dart.dynamic, dart.dynamic]),
+ preview: dart.definiteFunctionType(core.String, [dart.dynamic]),
+ hasChildren: dart.definiteFunctionType(core.bool, [dart.dynamic]),
+ children: dart.definiteFunctionType(core.List$(_debugger.NameValuePair), [dart.dynamic])
+ })
+ });
_debugger.registerDevtoolsFormatter = function() {
let formatters = JSArrayOfJsonMLFormatter().of([_debugger._devtoolsFormatter]);
dart.global.devtoolsFormatters = formatters;
};
dart.fn(_debugger.registerDevtoolsFormatter, VoidTodynamic$());
+ _debugger.getModuleNames = function() {
+ return dart.getModuleNames();
+ };
+ dart.fn(_debugger.getModuleNames, VoidTodynamic$());
+ _debugger.getModuleLibraries = function(name) {
+ return dart.getModuleLibraries(name);
+ };
+ dart.lazyFn(_debugger.getModuleLibraries, () => StringTodynamic());
_foreign_helper.JS = function(typeDescription, codeTemplate, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11) {
if (arg0 === void 0) arg0 = null;
if (arg1 === void 0) arg1 = null;
@@ -4360,7 +4415,7 @@
IterableOfE()._check(iterable);
this[dartx.checkGrowable]('insertAll');
core.RangeError.checkValueInInterval(index, 0, this[dartx.length], "index");
- if (!_internal.EfficientLength.is(iterable)) {
+ if (!_internal.EfficientLengthIterable.is(iterable)) {
iterable = iterable[dartx.toList]();
}
let insertionLength = iterable[dartx.length];
@@ -4633,7 +4688,7 @@
IterableOfE()._check(replacement);
this[dartx.checkGrowable]('replace range');
core.RangeError.checkValidRange(start, end, this[dartx.length]);
- if (!_internal.EfficientLength.is(replacement)) {
+ if (!_internal.EfficientLengthIterable.is(replacement)) {
replacement = replacement[dartx.toList]();
}
let removeLength = dart.notNull(end) - dart.notNull(start);
@@ -6348,21 +6403,20 @@
this[_filter](test, true);
}
[_filter](test, retainMatching) {
- let source = this;
let retained = JSArrayOfE().of([]);
- let length = source[dartx.length];
+ let length = this[dartx.length];
for (let i = 0; i < dart.notNull(length); i++) {
- let element = source[dartx._get](i);
+ let element = this[dartx._get](i);
if (dart.dcall(test, element) == retainMatching) {
retained[dartx.add](element);
}
- if (length != source[dartx.length]) {
- dart.throw(new core.ConcurrentModificationError(source));
+ if (length != this[dartx.length]) {
+ dart.throw(new core.ConcurrentModificationError(this));
}
}
- if (retained[dartx.length] != source[dartx.length]) {
- source[dartx.setRange](0, retained[dartx.length], retained);
- source[dartx.length] = retained[dartx.length];
+ if (retained[dartx.length] != this[dartx.length]) {
+ this[dartx.setRange](0, retained[dartx.length], retained);
+ this[dartx.length] = retained[dartx.length];
}
}
clear() {
@@ -6378,11 +6432,10 @@
}
sort(compare) {
if (compare === void 0) compare = null;
- if (compare == null) {
- _internal.Sort.sort(E)(this, dart.fn((a, b) => core.Comparable.compare(core.Comparable._check(a), core.Comparable._check(b)), dynamicAnddynamicToint()));
- } else {
- _internal.Sort.sort(E)(this, compare);
- }
+ _internal.Sort.sort(E)(this, (compare != null ? compare : collection.ListMixin._compareAny));
+ }
+ static _compareAny(a, b) {
+ return core.Comparable.compare(core.Comparable._check(a), core.Comparable._check(b));
}
shuffle(random) {
if (random === void 0) random = null;
@@ -6462,7 +6515,7 @@
replaceRange(start, end, newContents) {
IterableOfE()._check(newContents);
core.RangeError.checkValidRange(start, end, this[dartx.length]);
- if (!_internal.EfficientLength.is(newContents)) {
+ if (!_internal.EfficientLengthIterable.is(newContents)) {
newContents = newContents[dartx.toList]();
}
let removeLength = dart.notNull(end) - dart.notNull(start);
@@ -6540,7 +6593,7 @@
insertAll(index, iterable) {
IterableOfE()._check(iterable);
core.RangeError.checkValueInInterval(index, 0, this[dartx.length], "index");
- if (!_internal.EfficientLength.is(iterable) || core.identical(iterable, this)) {
+ if (!_internal.EfficientLengthIterable.is(iterable) || core.identical(iterable, this)) {
iterable = iterable[dartx.toList]();
}
let insertionLength = iterable[dartx.length];
@@ -6629,7 +6682,9 @@
removeAt: dart.definiteFunctionType(E, [core.int]),
insertAll: dart.definiteFunctionType(dart.void, [core.int, IterableOfE()]),
setAll: dart.definiteFunctionType(dart.void, [core.int, IterableOfE()])
- })
+ }),
+ statics: () => ({_compareAny: dart.definiteFunctionType(core.int, [dart.dynamic, dart.dynamic])}),
+ names: ['_compareAny']
});
dart.defineExtensionMembers(ListMixin, [
'elementAt',
@@ -6888,7 +6943,66 @@
names: ['stringOf']
});
dart.defineExtensionMembers(_internal.CodeUnits, ['_get', 'length']);
- _internal.EfficientLength = class EfficientLength extends core.Object {};
+ _internal.ExternalName = class ExternalName extends core.Object {
+ new(name) {
+ this.name = name;
+ }
+ };
+ dart.setSignature(_internal.ExternalName, {
+ fields: () => ({name: core.String})
+ });
+ _internal.hexDigitValue = function(char) {
+ dart.assert(dart.notNull(char) >= 0 && dart.notNull(char) <= 65535);
+ let digit0 = 48;
+ let a = 97;
+ let f = 102;
+ let digit = (dart.notNull(char) ^ digit0) >>> 0;
+ if (digit <= 9) return digit;
+ let letter = (dart.notNull(char) | 32) >>> 0;
+ if (a <= letter && letter <= f) return letter - (a - 10);
+ return -1;
+ };
+ dart.fn(_internal.hexDigitValue, intToint());
+ _internal.parseHexByte = function(source, index) {
+ dart.assert(dart.notNull(index) + 2 <= dart.notNull(source[dartx.length]));
+ let digit1 = _internal.hexDigitValue(source[dartx.codeUnitAt](index));
+ let digit2 = _internal.hexDigitValue(source[dartx.codeUnitAt](dart.notNull(index) + 1));
+ return dart.notNull(digit1) * 16 + dart.notNull(digit2) - (dart.notNull(digit2) & 256);
+ };
+ dart.lazyFn(_internal.parseHexByte, () => StringAndintToint());
+ const _name$ = Symbol('_name');
+ const _nativeSymbol = Symbol('_nativeSymbol');
+ _internal.PrivateSymbol = class PrivateSymbol extends core.Object {
+ new(name, nativeSymbol) {
+ this[_name$] = name;
+ this[_nativeSymbol] = nativeSymbol;
+ }
+ static getName(symbol) {
+ return _internal.PrivateSymbol.as(symbol)[_name$];
+ }
+ static getNativeSymbol(symbol) {
+ if (_internal.PrivateSymbol.is(symbol)) return symbol[_nativeSymbol];
+ return null;
+ }
+ ['=='](other) {
+ return _internal.PrivateSymbol.is(other) && core.identical(this[_nativeSymbol], other[_nativeSymbol]);
+ }
+ toString() {
+ return dart.str`Symbol("${this[_name$]}")`;
+ }
+ };
+ _internal.PrivateSymbol[dart.implements] = () => [core.Symbol];
+ dart.setSignature(_internal.PrivateSymbol, {
+ fields: () => ({
+ [_name$]: core.String,
+ [_nativeSymbol]: core.Object
+ }),
+ statics: () => ({
+ getName: dart.definiteFunctionType(core.String, [core.Symbol]),
+ getNativeSymbol: dart.definiteFunctionType(core.Object, [core.Symbol])
+ }),
+ names: ['getName', 'getNativeSymbol']
+ });
core.Iterable$ = dart.generic(E => {
let EmptyIterableOfE = () => (EmptyIterableOfE = dart.constFn(_internal.EmptyIterable$(E)))();
let _GeneratorIterableOfE = () => (_GeneratorIterableOfE = dart.constFn(core._GeneratorIterable$(E)))();
@@ -7027,7 +7141,7 @@
return SetOfE().from(this);
}
get length() {
- dart.assert(!_internal.EfficientLength.is(this));
+ dart.assert(!_internal.EfficientLengthIterable.is(this));
let count = 0;
let it = this[dartx.iterator];
while (dart.test(it.moveNext())) {
@@ -7196,6 +7310,15 @@
return Iterable;
});
core.Iterable = Iterable();
+ _internal.EfficientLengthIterable$ = dart.generic(T => {
+ class EfficientLengthIterable extends core.Iterable$(T) {
+ new() {
+ super.new();
+ }
+ }
+ return EfficientLengthIterable;
+ });
+ _internal.EfficientLengthIterable = EfficientLengthIterable();
_internal.ListIterable$ = dart.generic(E => {
let ListIteratorOfE = () => (ListIteratorOfE = dart.constFn(_internal.ListIterator$(E)))();
let VoidToE = () => (VoidToE = dart.constFn(dart.functionType(E, [])))();
@@ -7205,7 +7328,7 @@
let SetOfE = () => (SetOfE = dart.constFn(core.Set$(E)))();
let ETovoid = () => (ETovoid = dart.constFn(dart.functionType(dart.void, [E])))();
let ETobool = () => (ETobool = dart.constFn(dart.functionType(core.bool, [E])))();
- class ListIterable extends core.Iterable$(E) {
+ class ListIterable extends _internal.EfficientLengthIterable$(E) {
new() {
super.new();
}
@@ -7412,7 +7535,6 @@
return result;
}
}
- ListIterable[dart.implements] = () => [_internal.EfficientLength];
dart.setSignature(ListIterable, {
getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])}),
methods: () => ({reduce: dart.definiteFunctionType(E, [dynamicAndEToE()])})
@@ -7611,7 +7733,7 @@
let _TransformationOfS$T = () => (_TransformationOfS$T = dart.constFn(_internal._Transformation$(S, T)))();
class MappedIterable extends core.Iterable$(T) {
static new(iterable, func) {
- if (_internal.EfficientLength.is(iterable)) {
+ if (_internal.EfficientLengthIterable.is(iterable)) {
return new (EfficientLengthMappedIterableOfS$T())(iterable, func);
}
return new (MappedIterableOfS$T())._(iterable, func);
@@ -7664,12 +7786,13 @@
});
_internal.MappedIterable = MappedIterable();
_internal.EfficientLengthMappedIterable$ = dart.generic((S, T) => {
+ let EfficientLengthIterableOfT = () => (EfficientLengthIterableOfT = dart.constFn(_internal.EfficientLengthIterable$(T)))();
class EfficientLengthMappedIterable extends _internal.MappedIterable$(S, T) {
new(iterable, func) {
super._(iterable, func);
}
}
- EfficientLengthMappedIterable[dart.implements] = () => [_internal.EfficientLength];
+ EfficientLengthMappedIterable[dart.implements] = () => [EfficientLengthIterableOfT()];
return EfficientLengthMappedIterable;
});
_internal.EfficientLengthMappedIterable = EfficientLengthMappedIterable();
@@ -7730,7 +7853,6 @@
return this[_f](this[_source][dartx.elementAt](index));
}
}
- MappedListIterable[dart.implements] = () => [_internal.EfficientLength];
dart.setSignature(MappedListIterable, {
fields: () => ({
[_source]: IterableOfS(),
@@ -7759,6 +7881,11 @@
get iterator() {
return new (WhereIteratorOfE())(this[_iterable$][dartx.iterator], this[_f]);
}
+ map(T) {
+ return f => {
+ return new (_internal.MappedIterable$(E, T))._(this, f);
+ };
+ }
}
dart.setSignature(WhereIterable, {
fields: () => ({
@@ -7767,13 +7894,12 @@
}),
getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])})
});
- dart.defineExtensionMembers(WhereIterable, ['iterator']);
+ dart.defineExtensionMembers(WhereIterable, ['map', 'iterator']);
return WhereIterable;
});
_internal.WhereIterable = WhereIterable();
_internal.WhereIterator$ = dart.generic(E => {
let IteratorOfE = () => (IteratorOfE = dart.constFn(core.Iterator$(E)))();
- let _ElementPredicateOfE = () => (_ElementPredicateOfE = dart.constFn(_internal._ElementPredicate$(E)))();
class WhereIterator extends core.Iterator$(E) {
new(iterator, f) {
this[_iterator] = iterator;
@@ -7781,7 +7907,7 @@
}
moveNext() {
while (dart.test(this[_iterator].moveNext())) {
- if (dart.test(this[_f](this[_iterator].current))) {
+ if (dart.test(dart.dcall(this[_f], this[_iterator].current))) {
return true;
}
}
@@ -7794,7 +7920,7 @@
dart.setSignature(WhereIterator, {
fields: () => ({
[_iterator]: IteratorOfE(),
- [_f]: _ElementPredicateOfE()
+ [_f]: _internal._ElementPredicate
}),
getters: () => ({current: dart.definiteFunctionType(E, [])}),
methods: () => ({moveNext: dart.definiteFunctionType(core.bool, [])})
@@ -7889,7 +8015,7 @@
if (!(typeof takeCount == 'number') || dart.notNull(takeCount) < 0) {
dart.throw(new core.ArgumentError(takeCount));
}
- if (_internal.EfficientLength.is(iterable)) {
+ if (_internal.EfficientLengthIterable.is(iterable)) {
return new (EfficientLengthTakeIterableOfE())(iterable, takeCount);
}
return new (TakeIterableOfE())._(iterable, takeCount);
@@ -7916,6 +8042,7 @@
});
_internal.TakeIterable = TakeIterable();
_internal.EfficientLengthTakeIterable$ = dart.generic(E => {
+ let EfficientLengthIterableOfE = () => (EfficientLengthIterableOfE = dart.constFn(_internal.EfficientLengthIterable$(E)))();
class EfficientLengthTakeIterable extends _internal.TakeIterable$(E) {
new(iterable, takeCount) {
super._(iterable, takeCount);
@@ -7926,7 +8053,7 @@
return iterableLength;
}
}
- EfficientLengthTakeIterable[dart.implements] = () => [_internal.EfficientLength];
+ EfficientLengthTakeIterable[dart.implements] = () => [EfficientLengthIterableOfE()];
dart.setSignature(EfficientLengthTakeIterable, {});
dart.defineExtensionMembers(EfficientLengthTakeIterable, ['length']);
return EfficientLengthTakeIterable;
@@ -8033,7 +8160,7 @@
let IterableOfE = () => (IterableOfE = dart.constFn(core.Iterable$(E)))();
class SkipIterable extends core.Iterable$(E) {
static new(iterable, count) {
- if (_internal.EfficientLength.is(iterable)) {
+ if (_internal.EfficientLengthIterable.is(iterable)) {
return new (EfficientLengthSkipIterableOfE())(iterable, count);
}
return new (SkipIterableOfE())._(iterable, count);
@@ -8071,6 +8198,7 @@
});
_internal.SkipIterable = SkipIterable();
_internal.EfficientLengthSkipIterable$ = dart.generic(E => {
+ let EfficientLengthIterableOfE = () => (EfficientLengthIterableOfE = dart.constFn(_internal.EfficientLengthIterable$(E)))();
class EfficientLengthSkipIterable extends _internal.SkipIterable$(E) {
new(iterable, skipCount) {
super._(iterable, skipCount);
@@ -8081,7 +8209,7 @@
return 0;
}
}
- EfficientLengthSkipIterable[dart.implements] = () => [_internal.EfficientLength];
+ EfficientLengthSkipIterable[dart.implements] = () => [EfficientLengthIterableOfE()];
dart.setSignature(EfficientLengthSkipIterable, {});
dart.defineExtensionMembers(EfficientLengthSkipIterable, ['length']);
return EfficientLengthSkipIterable;
@@ -8185,7 +8313,7 @@
let SetOfE = () => (SetOfE = dart.constFn(core.Set$(E)))();
let ETovoid = () => (ETovoid = dart.constFn(dart.functionType(dart.void, [E])))();
let ETobool = () => (ETobool = dart.constFn(dart.functionType(core.bool, [E])))();
- class EmptyIterable extends core.Iterable$(E) {
+ class EmptyIterable extends _internal.EfficientLengthIterable$(E) {
new() {
super.new();
}
@@ -8281,7 +8409,6 @@
return SetOfE().new();
}
}
- EmptyIterable[dart.implements] = () => [_internal.EfficientLength];
dart.setSignature(EmptyIterable, {
getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])}),
methods: () => ({singleWhere: dart.definiteFunctionType(E, [ETobool()], {orElse: VoidToE()})})
@@ -8670,79 +8797,6 @@
};
};
dart.lazyFn(_internal.makeFixedListUnmodifiable, () => ListOfEToListOfE());
- _internal.Lists = class Lists extends core.Object {
- static copy(src, srcStart, dst, dstStart, count) {
- if (dart.notNull(srcStart) < dart.notNull(dstStart)) {
- for (let i = dart.notNull(srcStart) + dart.notNull(count) - 1, j = dart.notNull(dstStart) + dart.notNull(count) - 1; i >= dart.notNull(srcStart); i--, j--) {
- dst[dartx._set](j, src[dartx._get](i));
- }
- } else {
- for (let i = srcStart, j = dstStart; dart.notNull(i) < dart.notNull(srcStart) + dart.notNull(count); i = dart.notNull(i) + 1, j = dart.notNull(j) + 1) {
- dst[dartx._set](j, src[dartx._get](i));
- }
- }
- }
- static areEqual(a, b) {
- if (core.identical(a, b)) return true;
- if (!core.List.is(b)) return false;
- let length = a[dartx.length];
- if (!dart.equals(length, dart.dload(b, 'length'))) return false;
- for (let i = 0; i < dart.notNull(length); i++) {
- if (!core.identical(a[dartx._get](i), dart.dindex(b, i))) return false;
- }
- return true;
- }
- static indexOf(a, element, startIndex, endIndex) {
- if (dart.notNull(startIndex) >= dart.notNull(a[dartx.length])) {
- return -1;
- }
- if (dart.notNull(startIndex) < 0) {
- startIndex = 0;
- }
- for (let i = startIndex; dart.notNull(i) < dart.notNull(endIndex); i = dart.notNull(i) + 1) {
- if (dart.equals(a[dartx._get](i), element)) {
- return i;
- }
- }
- return -1;
- }
- static lastIndexOf(a, element, startIndex) {
- if (dart.notNull(startIndex) < 0) {
- return -1;
- }
- if (dart.notNull(startIndex) >= dart.notNull(a[dartx.length])) {
- startIndex = dart.notNull(a[dartx.length]) - 1;
- }
- for (let i = startIndex; dart.notNull(i) >= 0; i = dart.notNull(i) - 1) {
- if (dart.equals(a[dartx._get](i), element)) {
- return i;
- }
- }
- return -1;
- }
- static indicesCheck(a, start, end) {
- core.RangeError.checkValidRange(start, end, a[dartx.length]);
- }
- static rangeCheck(a, start, length) {
- core.RangeError.checkNotNegative(length);
- core.RangeError.checkNotNegative(start);
- if (dart.notNull(start) + dart.notNull(length) > dart.notNull(a[dartx.length])) {
- let message = dart.str`${start} + ${length} must be in the range [0..${a[dartx.length]}]`;
- dart.throw(new core.RangeError.range(length, 0, dart.notNull(a[dartx.length]) - dart.notNull(start), "length", message));
- }
- }
- };
- dart.setSignature(_internal.Lists, {
- statics: () => ({
- copy: dart.definiteFunctionType(dart.void, [core.List, core.int, core.List, core.int, core.int]),
- areEqual: dart.definiteFunctionType(core.bool, [core.List, dart.dynamic]),
- indexOf: dart.definiteFunctionType(core.int, [core.List, core.Object, core.int, core.int]),
- lastIndexOf: dart.definiteFunctionType(core.int, [core.List, core.Object, core.int]),
- indicesCheck: dart.definiteFunctionType(dart.void, [core.List, core.int, core.int]),
- rangeCheck: dart.definiteFunctionType(dart.void, [core.List, core.int, core.int])
- }),
- names: ['copy', 'areEqual', 'indexOf', 'lastIndexOf', 'indicesCheck', 'rangeCheck']
- });
_internal.printToZone = null;
_internal.printToConsole = function(line) {
_js_primitives.printString(dart.str`${line}`);
@@ -8988,27 +9042,18 @@
names: ['sort', 'sortRange', '_doSort', '_insertionSort', '_dualPivotQuicksort']
});
_internal.Sort._INSERTION_SORT_THRESHOLD = 32;
- const _name$ = Symbol('_name');
- const _nativeSymbol = Symbol('_nativeSymbol');
_internal.Symbol = class Symbol extends core.Object {
new(name) {
this[_name$] = name;
- this[_nativeSymbol] = null;
- }
- es6(name, nativeSymbol) {
- this[_name$] = name;
- this[_nativeSymbol] = nativeSymbol;
}
unvalidated(name) {
this[_name$] = name;
- this[_nativeSymbol] = null;
}
validated(name) {
this[_name$] = _internal.Symbol.validatePublicSymbol(name);
- this[_nativeSymbol] = null;
}
['=='](other) {
- return _internal.Symbol.is(other) && this[_name$] == other[_name$] && dart.equals(this[_nativeSymbol], other[_nativeSymbol]);
+ return _internal.Symbol.is(other) && this[_name$] == other[_name$];
}
get hashCode() {
let hash = this._hashCode;
@@ -9024,9 +9069,6 @@
static getName(symbol) {
return symbol[_name$];
}
- static getNativeSymbol(symbol) {
- return symbol[_nativeSymbol];
- }
static validatePublicSymbol(name) {
if (dart.test(name[dartx.isEmpty]) || dart.test(_internal.Symbol.publicSymbolPattern.hasMatch(name))) return name;
if (dart.test(name[dartx.startsWith]('_'))) {
@@ -9038,23 +9080,17 @@
return dart.test(name[dartx.isEmpty]) || dart.test(_internal.Symbol.symbolPattern.hasMatch(name));
}
};
- dart.defineNamedConstructor(_internal.Symbol, 'es6');
dart.defineNamedConstructor(_internal.Symbol, 'unvalidated');
dart.defineNamedConstructor(_internal.Symbol, 'validated');
_internal.Symbol[dart.implements] = () => [core.Symbol];
dart.setSignature(_internal.Symbol, {
- fields: () => ({
- [_name$]: core.String,
- [_nativeSymbol]: dart.dynamic
- }),
- methods: () => ({'==': dart.definiteFunctionType(core.bool, [core.Object])}),
+ fields: () => ({[_name$]: core.String}),
statics: () => ({
getName: dart.definiteFunctionType(core.String, [_internal.Symbol]),
- getNativeSymbol: dart.definiteFunctionType(dart.dynamic, [_internal.Symbol]),
validatePublicSymbol: dart.definiteFunctionType(core.String, [core.String]),
isValidSymbol: dart.definiteFunctionType(core.bool, [core.String])
}),
- names: ['getName', 'getNativeSymbol', 'validatePublicSymbol', 'isValidSymbol']
+ names: ['getName', 'validatePublicSymbol', 'isValidSymbol']
});
_internal.Symbol.reservedWordRE = '(?:assert|break|c(?:a(?:se|tch)|lass|on(?:st|tinue))|d(?:efault|o)|' + 'e(?:lse|num|xtends)|f(?:alse|inal(?:ly)?|or)|i[fns]|n(?:ew|ull)|' + 'ret(?:hrow|urn)|s(?:uper|witch)|t(?:h(?:is|row)|r(?:ue|y))|' + 'v(?:ar|oid)|w(?:hile|ith))';
_internal.Symbol.operatorRE = '(?:[\\-+*/%&|^]|\\[\\]=?|==|~/?|<[<=]?|>[>=]?|unary-)';
@@ -9237,8 +9273,8 @@
this.weakPorts = SetOfint().new();
this.isolateStatics = _foreign_helper.JS_CREATE_ISOLATE();
this.controlPort = new _isolate_helper.RawReceivePortImpl._controlPort();
- this.pauseCapability = isolate.Capability.new();
- this.terminateCapability = isolate.Capability.new();
+ this.pauseCapability = isolate$.Capability.new();
+ this.terminateCapability = isolate$.Capability.new();
this.delayedEvents = JSArrayOf_IsolateEvent().of([]);
this.pauseTokens = SetOfCapability().new();
this.errorPorts = SetOfSendPort().new();
@@ -9285,7 +9321,7 @@
this.errorsAreFatal = errorsAreFatal;
}
handlePing(responsePort, pingType) {
- if (pingType == isolate.Isolate.IMMEDIATE || pingType == isolate.Isolate.BEFORE_NEXT_EVENT && !dart.test(this[_isExecutingEvent])) {
+ if (pingType == isolate$.Isolate.IMMEDIATE || pingType == isolate$.Isolate.BEFORE_NEXT_EVENT && !dart.test(this[_isExecutingEvent])) {
responsePort.send(null);
return;
}
@@ -9293,11 +9329,7 @@
responsePort.send(null);
}
dart.fn(respond, VoidTovoid$());
- if (pingType == isolate.Isolate.AS_EVENT) {
- _isolate_helper._globalState.topEventLoop.enqueue(this, respond, "ping");
- return;
- }
- dart.assert(pingType == isolate.Isolate.BEFORE_NEXT_EVENT);
+ dart.assert(pingType == isolate$.Isolate.BEFORE_NEXT_EVENT);
if (this[_scheduledControlEvents] == null) {
this[_scheduledControlEvents] = collection.Queue.new();
}
@@ -9305,15 +9337,11 @@
}
handleKill(authentification, priority) {
if (!dart.equals(this.terminateCapability, authentification)) return;
- if (priority == isolate.Isolate.IMMEDIATE || priority == isolate.Isolate.BEFORE_NEXT_EVENT && !dart.test(this[_isExecutingEvent])) {
+ if (priority == isolate$.Isolate.IMMEDIATE || priority == isolate$.Isolate.BEFORE_NEXT_EVENT && !dart.test(this[_isExecutingEvent])) {
this.kill();
return;
}
- if (priority == isolate.Isolate.AS_EVENT) {
- _isolate_helper._globalState.topEventLoop.enqueue(this, dart.bind(this, 'kill'), "kill");
- return;
- }
- dart.assert(priority == isolate.Isolate.BEFORE_NEXT_EVENT);
+ dart.assert(priority == isolate$.Isolate.BEFORE_NEXT_EVENT);
if (this[_scheduledControlEvents] == null) {
this[_scheduledControlEvents] = collection.Queue.new();
}
@@ -9381,47 +9409,47 @@
switch (dart.dindex(message, 0)) {
case "pause":
{
- this.addPause(isolate.Capability._check(dart.dindex(message, 1)), isolate.Capability._check(dart.dindex(message, 2)));
+ this.addPause(isolate$.Capability._check(dart.dindex(message, 1)), isolate$.Capability._check(dart.dindex(message, 2)));
break;
}
case "resume":
{
- this.removePause(isolate.Capability._check(dart.dindex(message, 1)));
+ this.removePause(isolate$.Capability._check(dart.dindex(message, 1)));
break;
}
case 'add-ondone':
{
- this.addDoneListener(isolate.SendPort._check(dart.dindex(message, 1)));
+ this.addDoneListener(isolate$.SendPort._check(dart.dindex(message, 1)));
break;
}
case 'remove-ondone':
{
- this.removeDoneListener(isolate.SendPort._check(dart.dindex(message, 1)));
+ this.removeDoneListener(isolate$.SendPort._check(dart.dindex(message, 1)));
break;
}
case 'set-errors-fatal':
{
- this.setErrorsFatal(isolate.Capability._check(dart.dindex(message, 1)), core.bool._check(dart.dindex(message, 2)));
+ this.setErrorsFatal(isolate$.Capability._check(dart.dindex(message, 1)), core.bool._check(dart.dindex(message, 2)));
break;
}
case "ping":
{
- this.handlePing(isolate.SendPort._check(dart.dindex(message, 1)), core.int._check(dart.dindex(message, 2)));
+ this.handlePing(isolate$.SendPort._check(dart.dindex(message, 1)), core.int._check(dart.dindex(message, 2)));
break;
}
case "kill":
{
- this.handleKill(isolate.Capability._check(dart.dindex(message, 1)), core.int._check(dart.dindex(message, 2)));
+ this.handleKill(isolate$.Capability._check(dart.dindex(message, 1)), core.int._check(dart.dindex(message, 2)));
break;
}
case "getErrors":
{
- this.addErrorListener(isolate.SendPort._check(dart.dindex(message, 1)));
+ this.addErrorListener(isolate$.SendPort._check(dart.dindex(message, 1)));
break;
}
case "stopErrors":
{
- this.removeErrorListener(isolate.SendPort._check(dart.dindex(message, 1)));
+ this.removeErrorListener(isolate$.SendPort._check(dart.dindex(message, 1)));
break;
}
default:
@@ -9464,7 +9492,7 @@
this.errorPorts.clear();
if (this.doneHandlers != null) {
for (let port of core.Iterable._check(this.doneHandlers)) {
- isolate.SendPort._check(port);
+ isolate$.SendPort._check(port);
port.send(null);
}
this.doneHandlers = null;
@@ -9484,8 +9512,8 @@
weakPorts: SetOfint(),
isolateStatics: dart.dynamic,
controlPort: _isolate_helper.RawReceivePortImpl,
- pauseCapability: isolate.Capability,
- terminateCapability: isolate.Capability,
+ pauseCapability: isolate$.Capability,
+ terminateCapability: isolate$.Capability,
initialized: core.bool,
isPaused: core.bool,
delayedEvents: ListOf_IsolateEvent(),
@@ -9497,15 +9525,15 @@
errorPorts: SetOfSendPort()
}),
methods: () => ({
- addPause: dart.definiteFunctionType(dart.void, [isolate.Capability, isolate.Capability]),
- removePause: dart.definiteFunctionType(dart.void, [isolate.Capability]),
- addDoneListener: dart.definiteFunctionType(dart.void, [isolate.SendPort]),
- removeDoneListener: dart.definiteFunctionType(dart.void, [isolate.SendPort]),
- setErrorsFatal: dart.definiteFunctionType(dart.void, [isolate.Capability, core.bool]),
- handlePing: dart.definiteFunctionType(dart.void, [isolate.SendPort, core.int]),
- handleKill: dart.definiteFunctionType(dart.void, [isolate.Capability, core.int]),
- addErrorListener: dart.definiteFunctionType(dart.void, [isolate.SendPort]),
- removeErrorListener: dart.definiteFunctionType(dart.void, [isolate.SendPort]),
+ addPause: dart.definiteFunctionType(dart.void, [isolate$.Capability, isolate$.Capability]),
+ removePause: dart.definiteFunctionType(dart.void, [isolate$.Capability]),
+ addDoneListener: dart.definiteFunctionType(dart.void, [isolate$.SendPort]),
+ removeDoneListener: dart.definiteFunctionType(dart.void, [isolate$.SendPort]),
+ setErrorsFatal: dart.definiteFunctionType(dart.void, [isolate$.Capability, core.bool]),
+ handlePing: dart.definiteFunctionType(dart.void, [isolate$.SendPort, core.int]),
+ handleKill: dart.definiteFunctionType(dart.void, [isolate$.Capability, core.int]),
+ addErrorListener: dart.definiteFunctionType(dart.void, [isolate$.SendPort]),
+ removeErrorListener: dart.definiteFunctionType(dart.void, [isolate$.SendPort]),
handleUncaughtError: dart.definiteFunctionType(dart.void, [dart.dynamic, core.StackTrace]),
eval: dart.definiteFunctionType(dart.dynamic, [core.Function]),
[_setGlobals]: dart.definiteFunctionType(dart.void, []),
@@ -9706,7 +9734,7 @@
let replyTo = _isolate_helper._deserializeMessage(dart.dindex(msg, 'replyTo'));
let context = new _isolate_helper._IsolateContext();
_isolate_helper._globalState.topEventLoop.enqueue(context, dart.fn(() => {
- _isolate_helper.IsolateNatives._startIsolate(entryPoint, ListOfString()._check(args), message, core.bool._check(isSpawnUri), core.bool._check(startPaused), isolate.SendPort._check(replyTo));
+ _isolate_helper.IsolateNatives._startIsolate(entryPoint, ListOfString()._check(args), message, core.bool._check(isSpawnUri), core.bool._check(startPaused), isolate$.SendPort._check(replyTo));
}, VoidToNull()), 'worker-start');
_isolate_helper._globalState.currentContext = context;
_isolate_helper._globalState.topEventLoop.run();
@@ -9719,7 +9747,7 @@
}
case 'message':
{
- let port = isolate.SendPort._check(dart.dindex(msg, 'port'));
+ let port = isolate$.SendPort._check(dart.dindex(msg, 'port'));
if (port != null) {
dart.dsend(dart.dindex(msg, 'port'), 'send', dart.dindex(msg, 'msg'));
}
@@ -9807,7 +9835,7 @@
if (uri != null && dart.test(uri[dartx.endsWith](".dart"))) {
uri = dart.notNull(uri) + ".js";
}
- let port = isolate.ReceivePort.new();
+ let port = isolate$.ReceivePort.new();
let completer = CompleterOfList().new();
port.first.then(dart.dynamic)(dart.fn(msg => {
if (dart.equals(dart.dindex(msg, 0), _isolate_helper._SPAWNED_SIGNAL)) {
@@ -9846,7 +9874,7 @@
}
static get currentIsolate() {
let context = _isolate_helper._IsolateContext._check(_foreign_helper.JS_CURRENT_ISOLATE_CONTEXT());
- return new isolate.Isolate(context.controlPort.sendPort, {pauseCapability: context.pauseCapability, terminateCapability: context.terminateCapability});
+ return new isolate$.Isolate(context.controlPort.sendPort, {pauseCapability: context.pauseCapability, terminateCapability: context.terminateCapability});
}
static _startIsolate(topLevel, args, message, isSpawnUri, startPaused, replyTo) {
let context = _isolate_helper._IsolateContext._check(_foreign_helper.JS_CURRENT_ISOLATE_CONTEXT());
@@ -9924,10 +9952,10 @@
spawnFunction: dart.definiteFunctionType(async.Future$(core.List), [dynamicTovoid(), dart.dynamic, core.bool]),
spawnUri: dart.definiteFunctionType(async.Future$(core.List), [core.Uri, ListOfString(), dart.dynamic, core.bool]),
spawn: dart.definiteFunctionType(async.Future$(core.List), [core.String, core.String, ListOfString(), dart.dynamic, core.bool, core.bool, core.bool]),
- _startWorker: dart.definiteFunctionType(dart.void, [core.String, core.String, ListOfString(), dart.dynamic, core.bool, core.bool, isolate.SendPort, StringTovoid()]),
- _startNonWorker: dart.definiteFunctionType(dart.void, [core.String, core.String, ListOfString(), dart.dynamic, core.bool, core.bool, isolate.SendPort]),
- _startIsolate: dart.definiteFunctionType(dart.void, [core.Function, ListOfString(), dart.dynamic, core.bool, core.bool, isolate.SendPort]),
- _spawnWorker: dart.definiteFunctionType(dart.void, [dart.dynamic, core.String, ListOfString(), dart.dynamic, core.bool, core.bool, isolate.SendPort, StringTovoid()]),
+ _startWorker: dart.definiteFunctionType(dart.void, [core.String, core.String, ListOfString(), dart.dynamic, core.bool, core.bool, isolate$.SendPort, StringTovoid()]),
+ _startNonWorker: dart.definiteFunctionType(dart.void, [core.String, core.String, ListOfString(), dart.dynamic, core.bool, core.bool, isolate$.SendPort]),
+ _startIsolate: dart.definiteFunctionType(dart.void, [core.Function, ListOfString(), dart.dynamic, core.bool, core.bool, isolate$.SendPort]),
+ _spawnWorker: dart.definiteFunctionType(dart.void, [dart.dynamic, core.String, ListOfString(), dart.dynamic, core.bool, core.bool, isolate$.SendPort, StringTovoid()]),
workerOnError: dart.definiteFunctionType(core.bool, [dart.dynamic, core.String, StringTovoid()])
}),
names: ['computeThisScript', 'computeThisScriptJsshell', 'computeThisScriptD8', 'computeThisScriptFromTrace', '_getEventData', '_processWorkerMessage', 'handleSpawnWorkerRequest', '_log', '_consoleLog', '_getJSFunctionFromName', '_getJSFunctionName', '_allocate', 'spawnFunction', 'spawnUri', 'spawn', '_startWorker', '_startNonWorker', '_startIsolate', '_spawnWorker', 'workerOnError']
@@ -9954,10 +9982,10 @@
}
}
};
- _isolate_helper._BaseSendPort[dart.implements] = () => [isolate.SendPort];
+ _isolate_helper._BaseSendPort[dart.implements] = () => [isolate$.SendPort];
dart.setSignature(_isolate_helper._BaseSendPort, {
fields: () => ({[_isolateId]: core.int}),
- methods: () => ({[_checkReplyTo]: dart.definiteFunctionType(dart.void, [isolate.SendPort])})
+ methods: () => ({[_checkReplyTo]: dart.definiteFunctionType(dart.void, [isolate$.SendPort])})
});
const _receivePort = Symbol('_receivePort');
const _isClosed = Symbol('_isClosed');
@@ -9989,7 +10017,7 @@
return this[_receivePort][_id];
}
};
- _isolate_helper._NativeJsSendPort[dart.implements] = () => [isolate.SendPort];
+ _isolate_helper._NativeJsSendPort[dart.implements] = () => [isolate$.SendPort];
dart.setSignature(_isolate_helper._NativeJsSendPort, {
fields: () => ({[_receivePort]: _isolate_helper.RawReceivePortImpl}),
methods: () => ({send: dart.definiteFunctionType(dart.void, [dart.dynamic])})
@@ -10020,7 +10048,7 @@
return (dart.notNull(this[_workerId]) << 16 ^ dart.notNull(this[_isolateId]) << 8 ^ dart.notNull(this[_receivePortId])) >>> 0;
}
};
- _isolate_helper._WorkerSendPort[dart.implements] = () => [isolate.SendPort];
+ _isolate_helper._WorkerSendPort[dart.implements] = () => [isolate$.SendPort];
dart.setSignature(_isolate_helper._WorkerSendPort, {
fields: () => ({
[_workerId]: core.int,
@@ -10078,14 +10106,14 @@
};
dart.defineNamedConstructor(_isolate_helper.RawReceivePortImpl, 'weak');
dart.defineNamedConstructor(_isolate_helper.RawReceivePortImpl, '_controlPort');
- _isolate_helper.RawReceivePortImpl[dart.implements] = () => [isolate.RawReceivePort];
+ _isolate_helper.RawReceivePortImpl[dart.implements] = () => [isolate$.RawReceivePort];
dart.setSignature(_isolate_helper.RawReceivePortImpl, {
fields: () => ({
[_id]: core.int,
[_handler]: core.Function,
[_isClosed]: core.bool
}),
- getters: () => ({sendPort: dart.definiteFunctionType(isolate.SendPort, [])}),
+ getters: () => ({sendPort: dart.definiteFunctionType(isolate$.SendPort, [])}),
setters: () => ({handler: dart.definiteFunctionType(dart.void, [core.Function])}),
methods: () => ({
[_close]: dart.definiteFunctionType(dart.void, []),
@@ -10231,7 +10259,8 @@
}, VoidToNull()), onCancel: dart.fn(() => {
if (timer != null) timer.cancel();
timer = null;
- }, VoidToNull())});
+ return async.Future._nullFuture;
+ }, VoidTo_Future())});
return controller.stream;
}
static eventTransformed(source, mapSink) {
@@ -10290,9 +10319,7 @@
subscription.pause();
}, VoidToNull()), onResume: dart.fn(() => {
subscription.resume();
- }, VoidToNull()), onCancel: dart.fn(() => {
- subscription.cancel();
- }, VoidToNull()), sync: true});
+ }, VoidToNull()), onCancel: dart.fn(() => subscription.cancel(), VoidToFuture()), sync: true});
}
return controller.stream;
};
@@ -10330,9 +10357,7 @@
subscription.pause();
}, VoidToNull()), onResume: dart.fn(() => {
subscription.resume();
- }, VoidToNull()), onCancel: dart.fn(() => {
- subscription.cancel();
- }, VoidToNull()), sync: true});
+ }, VoidToNull()), onCancel: dart.fn(() => subscription.cancel(), VoidToFuture()), sync: true});
}
return controller.stream;
};
@@ -10863,13 +10888,13 @@
dart.addSimpleTypeTests(_isolate_helper.ReceivePortImpl);
dart.defineNamedConstructor(_isolate_helper.ReceivePortImpl, 'weak');
dart.defineNamedConstructor(_isolate_helper.ReceivePortImpl, 'fromRawReceivePort');
- _isolate_helper.ReceivePortImpl[dart.implements] = () => [isolate.ReceivePort];
+ _isolate_helper.ReceivePortImpl[dart.implements] = () => [isolate$.ReceivePort];
dart.setSignature(_isolate_helper.ReceivePortImpl, {
fields: () => ({
- [_rawPort]: isolate.RawReceivePort,
+ [_rawPort]: isolate$.RawReceivePort,
[_controller]: async.StreamController
}),
- getters: () => ({sendPort: dart.definiteFunctionType(isolate.SendPort, [])}),
+ getters: () => ({sendPort: dart.definiteFunctionType(isolate$.SendPort, [])}),
methods: () => ({
listen: dart.definiteFunctionType(async.StreamSubscription, [dynamicTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool}),
close: dart.definiteFunctionType(dart.void, [])
@@ -10982,7 +11007,7 @@
}
};
dart.defineNamedConstructor(_isolate_helper.CapabilityImpl, '_internal');
- _isolate_helper.CapabilityImpl[dart.implements] = () => [isolate.Capability];
+ _isolate_helper.CapabilityImpl[dart.implements] = () => [isolate$.Capability];
dart.setSignature(_isolate_helper.CapabilityImpl, {
fields: () => ({[_id]: core.int}),
methods: () => ({'==': dart.definiteFunctionType(core.bool, [core.Object])})
@@ -11020,7 +11045,7 @@
if (_js_helper.InternalMap.is(x)) return this.serializeMap(x);
if (_interceptors.JSObject.is(x)) return this.serializeJSObject(x);
if (_interceptors.Interceptor.is(x)) this.unsupported(x);
- if (isolate.RawReceivePort.is(x)) {
+ if (isolate$.RawReceivePort.is(x)) {
this.unsupported(x, "RawReceivePorts can't be transmitted:");
}
if (_isolate_helper._NativeJsSendPort.is(x)) return this.serializeJsSendPort(x);
@@ -11298,7 +11323,7 @@
}
deserializeRawSendPort(x) {
dart.assert(dart.equals(dart.dindex(x, 0), 'raw sendport'));
- let result = isolate.SendPort._check(dart.dindex(x, 1));
+ let result = isolate$.SendPort._check(dart.dindex(x, 1));
this.deserializedObjects[dartx.add](result);
return result;
}
@@ -11350,8 +11375,8 @@
deserializeMutable: dart.definiteFunctionType(core.List, [dart.dynamic]),
deserializeConst: dart.definiteFunctionType(core.List, [dart.dynamic]),
deserializeMap: dart.definiteFunctionType(core.Map, [_js_helper.InternalMap]),
- deserializeSendPort: dart.definiteFunctionType(isolate.SendPort, [dart.dynamic]),
- deserializeRawSendPort: dart.definiteFunctionType(isolate.SendPort, [dart.dynamic]),
+ deserializeSendPort: dart.definiteFunctionType(isolate$.SendPort, [dart.dynamic]),
+ deserializeRawSendPort: dart.definiteFunctionType(isolate$.SendPort, [dart.dynamic]),
deserializeJSObject: dart.definiteFunctionType(dart.dynamic, [dart.dynamic]),
deserializeClosure: dart.definiteFunctionType(core.Function, [dart.dynamic]),
deserializeDartObject: dart.definiteFunctionType(dart.dynamic, [dart.dynamic])
@@ -11388,6 +11413,11 @@
_js_embedded_names.TYPEDEF_PREDICATE_PROPERTY_NAME = "$$isTypedef";
_js_embedded_names.NATIVE_SUPERCLASS_TAG_NAME = "$nativeSuperclassTag";
_js_embedded_names.MAP_TYPE_TO_INTERCEPTOR = "mapTypeToInterceptor";
+ dart.defineLazy(_js_helper, {
+ get _identityHashCode() {
+ return Symbol("_identityHashCode");
+ }
+ });
_js_helper._Patch = class _Patch extends core.Object {
new() {
}
@@ -11407,10 +11437,10 @@
_js_helper.Primitives.mirrorInvokeCacheName = dart.notNull(_js_helper.Primitives.mirrorInvokeCacheName) + dart.str`_${id}`;
}
static objectHashCode(object) {
- let hash = object.$identityHash;
+ let hash = object[_js_helper._identityHashCode];
if (hash == null) {
hash = Math.random() * 0x3fffffff | 0;
- object.$identityHash = hash;
+ object[_js_helper._identityHashCode] = hash;
}
return hash;
}
@@ -12049,6 +12079,9 @@
new() {
super.new();
}
+ toString() {
+ return super.toString();
+ }
};
_js_helper.FallThroughErrorImplementation = class FallThroughErrorImplementation extends core.FallThroughError {
new() {
@@ -12071,13 +12104,18 @@
fields: () => ({message: dart.dynamic})
});
core.AssertionError = class AssertionError extends core.Error {
- new() {
+ new(message) {
+ if (message === void 0) message = null;
+ this.message = message;
super.new();
}
toString() {
return "Assertion failed";
}
};
+ dart.setSignature(core.AssertionError, {
+ fields: () => ({message: core.Object})
+ });
_js_helper.AssertionErrorWithMessage = class AssertionErrorWithMessage extends core.AssertionError {
new(message) {
this[_message] = message;
@@ -12682,7 +12720,7 @@
let LinkedHashMapKeyIteratorOfE = () => (LinkedHashMapKeyIteratorOfE = dart.constFn(_js_helper.LinkedHashMapKeyIterator$(E)))();
let ETovoid = () => (ETovoid = dart.constFn(dart.functionType(dart.void, [E])))();
let JsLinkedHashMapOfE$dynamic = () => (JsLinkedHashMapOfE$dynamic = dart.constFn(_js_helper.JsLinkedHashMap$(E, dart.dynamic)))();
- class LinkedHashMapKeyIterable extends core.Iterable$(E) {
+ class LinkedHashMapKeyIterable extends _internal.EfficientLengthIterable$(E) {
new(map) {
this[_map] = map;
super.new();
@@ -12711,7 +12749,6 @@
}
}
}
- LinkedHashMapKeyIterable[dart.implements] = () => [_internal.EfficientLength];
dart.setSignature(LinkedHashMapKeyIterable, {
fields: () => ({[_map]: JsLinkedHashMapOfE$dynamic()}),
getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])})
@@ -13382,7 +13419,11 @@
};
dart.lazyFn(_js_helper.isJsArray, () => dynamicTobool$());
_js_mirrors.getName = function(symbol) {
- return _internal.Symbol.getName(_internal.Symbol.as(symbol));
+ if (_internal.PrivateSymbol.is(symbol)) {
+ return _internal.PrivateSymbol.getName(symbol);
+ } else {
+ return _internal.Symbol.getName(_internal.Symbol.as(symbol));
+ }
};
dart.lazyFn(_js_mirrors.getName, () => SymbolToString());
_js_mirrors.getSymbol = function(name, library) {
@@ -13461,7 +13502,7 @@
});
_js_mirrors._Lazy = _Lazy();
_js_mirrors._getESSymbol = function(symbol) {
- return _internal.Symbol.getNativeSymbol(_internal.Symbol.as(symbol));
+ return _internal.PrivateSymbol.getNativeSymbol(symbol);
};
dart.lazyFn(_js_mirrors._getESSymbol, () => SymbolTodynamic());
_js_mirrors._getMember = function(symbol) {
@@ -13505,7 +13546,7 @@
dart.lazyFn(_js_mirrors._getNameForESSymbol, () => dynamicToString());
_js_mirrors._getSymbolForESSymbol = function(member) {
let name = _js_mirrors._getNameForESSymbol(member);
- return new _internal.Symbol.es6(name, member);
+ return new _internal.PrivateSymbol(name, member);
};
dart.lazyFn(_js_mirrors._getSymbolForESSymbol, () => dynamicToSymbol());
_js_mirrors._getSymbolForMember = function(member) {
@@ -13513,7 +13554,7 @@
return core.Symbol.new(member);
} else {
let name = _js_mirrors._getNameForESSymbol(member);
- return new _internal.Symbol.es6(name, member);
+ return new _internal.PrivateSymbol(name, member);
}
};
dart.lazyFn(_js_mirrors._getSymbolForMember, () => dynamicToSymbol());
@@ -13657,12 +13698,18 @@
};
_js_mirrors.JsIsolateMirror[dart.implements] = () => [mirrors.IsolateMirror];
_js_mirrors.JsLibraryDependencyMirror = class JsLibraryDependencyMirror extends _js_mirrors.JsMirror {
+ loadLibrary(...args) {
+ return FutureOfLibraryMirror()._check(this.noSuchMethod(new dart.InvocationImpl('loadLibrary', args, {isMethod: true})));
+ }
get isImport() {
return core.bool._check(this.noSuchMethod(new dart.InvocationImpl('isImport', [], {isGetter: true})));
}
get isExport() {
return core.bool._check(this.noSuchMethod(new dart.InvocationImpl('isExport', [], {isGetter: true})));
}
+ get isDeferred() {
+ return core.bool._check(this.noSuchMethod(new dart.InvocationImpl('isDeferred', [], {isGetter: true})));
+ }
get sourceLibrary() {
return mirrors.LibraryMirror._check(this.noSuchMethod(new dart.InvocationImpl('sourceLibrary', [], {isGetter: true})));
}
@@ -13693,6 +13740,9 @@
setField(...args) {
return mirrors.InstanceMirror._check(this.noSuchMethod(new dart.InvocationImpl('setField', args, {isMethod: true})));
}
+ delegate(...args) {
+ return this.noSuchMethod(new dart.InvocationImpl('delegate', args, {isMethod: true}));
+ }
};
_js_mirrors.JsObjectMirror[dart.implements] = () => [mirrors.ObjectMirror];
const _getAccessor = Symbol('_getAccessor');
@@ -13840,7 +13890,7 @@
let setters = _js_mirrors._getSetters(unwrapped);
setters[dartx.forEach](dart.fn((symbol, ft) => {
let name = dart.notNull(_js_mirrors.getName(symbol)) + '=';
- symbol = new _internal.Symbol.es6(name, _js_mirrors._getESSymbol(symbol));
+ symbol = new _internal.PrivateSymbol(name, _js_mirrors._getESSymbol(symbol));
this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._instanceMethod(this, symbol, ft));
}, SymbolAnddynamicToNull()));
let staticFields = _js_mirrors._getStaticFields(unwrapped);
@@ -13989,12 +14039,18 @@
get typeVariables() {
return ListOfTypeVariableMirror()._check(this.noSuchMethod(new dart.InvocationImpl('typeVariables', [], {isGetter: true})));
}
+ delegate(...args) {
+ return this.noSuchMethod(new dart.InvocationImpl('delegate', args, {isMethod: true}));
+ }
isSubclassOf(...args) {
return core.bool._check(this.noSuchMethod(new dart.InvocationImpl('isSubclassOf', args, {isMethod: true})));
}
get isAbstract() {
return core.bool._check(this.noSuchMethod(new dart.InvocationImpl('isAbstract', [], {isGetter: true})));
}
+ get isEnum() {
+ return core.bool._check(this.noSuchMethod(new dart.InvocationImpl('isEnum', [], {isGetter: true})));
+ }
get instanceMembers() {
return MapOfSymbol$MethodMirror()._check(this.noSuchMethod(new dart.InvocationImpl('instanceMembers', [], {isGetter: true})));
}
@@ -16800,9 +16856,9 @@
async._registerErrorHandler = function(R) {
return (errorHandler, zone) => {
if (async.ZoneBinaryCallback.is(errorHandler)) {
- return zone.registerBinaryCallback(dart.dynamic, dart.dynamic, core.StackTrace)(ZoneBinaryCallbackOfdynamic$dynamic$StackTrace().as(errorHandler));
+ return zone.registerBinaryCallback(R, dart.dynamic, core.StackTrace)(async.ZoneBinaryCallback$(R, dart.dynamic, core.StackTrace).as(errorHandler));
} else {
- return zone.registerUnaryCallback(dart.dynamic, dart.dynamic)(async.ZoneUnaryCallback.as(errorHandler));
+ return zone.registerUnaryCallback(R, dart.dynamic)(async.ZoneUnaryCallback$(R, dart.dynamic).as(errorHandler));
}
};
};
@@ -16956,7 +17012,6 @@
const _waitsForCancel = Symbol('_waitsForCancel');
const _canFire = Symbol('_canFire');
const _cancelOnError = Symbol('_cancelOnError');
- const _incrementPauseCount = Symbol('_incrementPauseCount');
const _sendData = Symbol('_sendData');
const _addPending = Symbol('_addPending');
const _sendError = Symbol('_sendError');
@@ -17001,7 +17056,7 @@
}
onError(handleError) {
if (handleError == null) handleError = async._nullErrorHandler;
- this[_onError] = async._registerErrorHandler(T)(handleError, this[_zone]);
+ this[_onError] = async._registerErrorHandler(dart.dynamic)(handleError, this[_zone]);
}
onDone(handleDone) {
if (handleDone == null) handleDone = async._nullDoneHandler;
@@ -17034,9 +17089,11 @@
}
cancel() {
this[_state] = (dart.notNull(this[_state]) & ~async._BufferingStreamSubscription._STATE_WAIT_FOR_CANCEL) >>> 0;
- if (dart.test(this[_isCanceled])) return this[_cancelFuture];
- this[_cancel]();
- return this[_cancelFuture];
+ if (!dart.test(this[_isCanceled])) {
+ this[_cancel]();
+ }
+ let l = this[_cancelFuture];
+ return l != null ? l : async.Future._nullFuture;
}
asFuture(E) {
return futureValue => {
@@ -17046,8 +17103,14 @@
result[_complete](futureValue);
}, VoidToNull());
this[_onError] = dart.fn((error, stackTrace) => {
- this.cancel();
- result[_completeError](error, core.StackTrace._check(stackTrace));
+ let cancelFuture = this.cancel();
+ if (!core.identical(cancelFuture, async.Future._nullFuture)) {
+ cancelFuture.whenComplete(dart.fn(() => {
+ result[_completeError](error, core.StackTrace._check(stackTrace));
+ }, VoidToNull()));
+ } else {
+ result[_completeError](error, core.StackTrace._check(stackTrace));
+ }
}, dynamicAnddynamicToNull());
return result;
};
@@ -17093,9 +17156,6 @@
if (!dart.test(this[_inCallback])) this[_pending] = null;
this[_cancelFuture] = this[_onCancel]();
}
- [_incrementPauseCount]() {
- this[_state] = (dart.notNull(this[_state]) + async._BufferingStreamSubscription._STATE_PAUSE_COUNT | async._BufferingStreamSubscription._STATE_INPUT_PAUSED) >>> 0;
- }
[_decrementPauseCount]() {
dart.assert(this[_isPaused]);
this[_state] = dart.notNull(this[_state]) - async._BufferingStreamSubscription._STATE_PAUSE_COUNT;
@@ -17182,7 +17242,7 @@
if (dart.test(this[_cancelOnError])) {
this[_state] = (dart.notNull(this[_state]) | async._BufferingStreamSubscription._STATE_WAIT_FOR_CANCEL) >>> 0;
this[_cancel]();
- if (async.Future.is(this[_cancelFuture])) {
+ if (async.Future.is(this[_cancelFuture]) && !core.identical(this[_cancelFuture], async.Future._nullFuture)) {
this[_cancelFuture].whenComplete(sendError);
} else {
sendError();
@@ -17205,7 +17265,7 @@
dart.fn(sendDone, VoidTovoid$());
this[_cancel]();
this[_state] = (dart.notNull(this[_state]) | async._BufferingStreamSubscription._STATE_WAIT_FOR_CANCEL) >>> 0;
- if (async.Future.is(this[_cancelFuture])) {
+ if (async.Future.is(this[_cancelFuture]) && !core.identical(this[_cancelFuture], async.Future._nullFuture)) {
this[_cancelFuture].whenComplete(sendDone);
} else {
sendDone();
@@ -17215,7 +17275,7 @@
dart.assert(!dart.test(this[_inCallback]));
let wasInputPaused = this[_isInputPaused];
this[_state] = (dart.notNull(this[_state]) | async._BufferingStreamSubscription._STATE_IN_CALLBACK) >>> 0;
- callback();
+ dart.dcall(callback);
this[_state] = (dart.notNull(this[_state]) & ~async._BufferingStreamSubscription._STATE_IN_CALLBACK) >>> 0;
this[_checkState](wasInputPaused);
}
@@ -17283,7 +17343,6 @@
cancel: dart.definiteFunctionType(async.Future, []),
asFuture: dart.definiteFunctionType(E => [async.Future$(E), [], [E]]),
[_cancel]: dart.definiteFunctionType(dart.void, []),
- [_incrementPauseCount]: dart.definiteFunctionType(dart.void, []),
[_decrementPauseCount]: dart.definiteFunctionType(dart.void, []),
[_add$]: dart.definiteFunctionType(dart.void, [T]),
[_addError]: dart.definiteFunctionType(dart.void, [core.Object, core.StackTrace]),
@@ -17295,7 +17354,7 @@
[_sendData]: dart.definiteFunctionType(dart.void, [T]),
[_sendError]: dart.definiteFunctionType(dart.void, [core.Object, core.StackTrace]),
[_sendDone]: dart.definiteFunctionType(dart.void, []),
- [_guardCallback]: dart.definiteFunctionType(dart.void, [VoidTovoid()]),
+ [_guardCallback]: dart.definiteFunctionType(dart.void, [dart.dynamic]),
[_checkState]: dart.definiteFunctionType(dart.void, [core.bool])
})
});
@@ -17310,7 +17369,6 @@
async._BufferingStreamSubscription._STATE_IN_CALLBACK = 32;
async._BufferingStreamSubscription._STATE_HAS_PENDING = 64;
async._BufferingStreamSubscription._STATE_PAUSE_COUNT = 128;
- async._BufferingStreamSubscription._STATE_PAUSE_COUNT_SHIFT = 7;
async._ControllerSubscription$ = dart.generic(T => {
let _StreamControllerLifecycleOfT = () => (_StreamControllerLifecycleOfT = dart.constFn(async._StreamControllerLifecycle$(T)))();
class _ControllerSubscription extends async._BufferingStreamSubscription$(T) {
@@ -18066,7 +18124,7 @@
result[_completeError](error, stackTrace);
}
}
- dart.fn(handleError, dynamicAnddynamicTovoid$());
+ dart.fn(handleError, dynamicAnddynamicToNull());
try {
for (let future of futures) {
let pos = remaining;
@@ -18212,7 +18270,7 @@
};
dart.fn(async._nonNullError, ObjectToObject());
async._FutureOnValue$ = dart.generic((S, T) => {
- const _FutureOnValue = dart.typedef('_FutureOnValue', () => dart.functionType(dart.dynamic, [S]));
+ const _FutureOnValue = dart.typedef('_FutureOnValue', () => dart.functionType(async.FutureOr$(T), [S]));
return _FutureOnValue;
});
async._FutureOnValue = _FutureOnValue();
@@ -18303,6 +18361,9 @@
const _whenCompleteAction = Symbol('_whenCompleteAction');
async._FutureListener$ = dart.generic((S, T) => {
let _FutureOnValueOfS$T = () => (_FutureOnValueOfS$T = dart.constFn(async._FutureOnValue$(S, T)))();
+ let FutureOrOfT = () => (FutureOrOfT = dart.constFn(async.FutureOr$(T)))();
+ let ZoneBinaryCallbackOfFutureOrOfT$Object$StackTrace = () => (ZoneBinaryCallbackOfFutureOrOfT$Object$StackTrace = dart.constFn(async.ZoneBinaryCallback$(FutureOrOfT(), core.Object, core.StackTrace)))();
+ let dynamicToFutureOrOfT = () => (dynamicToFutureOrOfT = dart.constFn(dart.functionType(FutureOrOfT(), [dart.dynamic])))();
let _FutureOfT = () => (_FutureOfT = dart.constFn(async._Future$(T)))();
class _FutureListener extends core.Object {
then(result, onValue, errorCallback) {
@@ -18362,7 +18423,7 @@
}
handleValue(sourceResult) {
S._check(sourceResult);
- return this[_zone].runUnary(dart.dynamic, S)(this[_onValue], sourceResult);
+ return this[_zone].runUnary(FutureOrOfT(), S)(this[_onValue], sourceResult);
}
matchesErrorTest(asyncError) {
if (!dart.test(this.hasErrorTest)) return true;
@@ -18372,10 +18433,10 @@
handleError(asyncError) {
dart.assert(dart.test(this.handlesError) && dart.test(this.hasErrorCallback));
if (async.ZoneBinaryCallback.is(this.errorCallback)) {
- let typedErrorCallback = ZoneBinaryCallbackOfObject$Object$StackTrace().as(this.errorCallback);
- return this[_zone].runBinary(core.Object, core.Object, core.StackTrace)(typedErrorCallback, asyncError.error, asyncError.stackTrace);
+ let typedErrorCallback = ZoneBinaryCallbackOfFutureOrOfT$Object$StackTrace().as(this.errorCallback);
+ return this[_zone].runBinary(FutureOrOfT(), core.Object, core.StackTrace)(typedErrorCallback, asyncError.error, asyncError.stackTrace);
} else {
- return this[_zone].runUnary(dart.dynamic, dart.dynamic)(dynamicTodynamic()._check(this.errorCallback), asyncError.error);
+ return this[_zone].runUnary(FutureOrOfT(), dart.dynamic)(dynamicToFutureOrOfT()._check(this.errorCallback), asyncError.error);
}
}
handleWhenComplete() {
@@ -18408,9 +18469,9 @@
hasErrorCallback: dart.definiteFunctionType(core.bool, [])
}),
methods: () => ({
- handleValue: dart.definiteFunctionType(dart.dynamic, [S]),
+ handleValue: dart.definiteFunctionType(async.FutureOr$(T), [S]),
matchesErrorTest: dart.definiteFunctionType(core.bool, [async.AsyncError]),
- handleError: dart.definiteFunctionType(dart.dynamic, [async.AsyncError]),
+ handleError: dart.definiteFunctionType(async.FutureOr$(T), [async.AsyncError]),
handleWhenComplete: dart.definiteFunctionType(dart.dynamic, [])
})
});
@@ -18511,7 +18572,7 @@
if (!core.identical(currentZone, async._ROOT_ZONE)) {
f = currentZone.registerUnaryCallback(async.FutureOr$(E), T)(f);
if (onError != null) {
- onError = async._registerErrorHandler(T)(onError, currentZone);
+ onError = async._registerErrorHandler(E)(onError, currentZone);
}
}
return this[_thenNoZoneRegistration](E)(f, onError);
@@ -18520,7 +18581,7 @@
[_thenNoZoneRegistration](E) {
return (f, onError) => {
let result = new (async._Future$(E))();
- this[_addListener](new (async._FutureListener$(T, E)).then(result, f, onError));
+ this[_addListener](new (async._FutureListener$(T, E)).then(result, async._FutureOnValue$(T, E)._check(f), onError));
return result;
};
}
@@ -19212,10 +19273,10 @@
});
async.StreamTransformer = StreamTransformer();
async.StreamIterator$ = dart.generic(T => {
- let _StreamIteratorImplOfT = () => (_StreamIteratorImplOfT = dart.constFn(async._StreamIteratorImpl$(T)))();
+ let _StreamIteratorOfT = () => (_StreamIteratorOfT = dart.constFn(async._StreamIterator$(T)))();
class StreamIterator extends core.Object {
static new(stream) {
- return new (_StreamIteratorImplOfT())(stream);
+ return new (_StreamIteratorOfT())(stream);
}
}
dart.addTypeTests(StreamIterator);
@@ -20083,36 +20144,6 @@
return _StreamImplEvents;
});
async._StreamImplEvents = _StreamImplEvents();
- const _unlink = Symbol('_unlink');
- const _insertBefore = Symbol('_insertBefore');
- async._BroadcastLinkedList = class _BroadcastLinkedList extends core.Object {
- new() {
- this[_next$] = null;
- this[_previous$] = null;
- }
- [_unlink]() {
- this[_previous$][_next$] = this[_next$];
- this[_next$][_previous$] = this[_previous$];
- this[_next$] = this[_previous$] = this;
- }
- [_insertBefore](newNext) {
- let newPrevious = newNext[_previous$];
- newPrevious[_next$] = this;
- newNext[_previous$] = this[_previous$];
- this[_previous$][_next$] = newNext;
- this[_previous$] = newPrevious;
- }
- };
- dart.setSignature(async._BroadcastLinkedList, {
- fields: () => ({
- [_next$]: async._BroadcastLinkedList,
- [_previous$]: async._BroadcastLinkedList
- }),
- methods: () => ({
- [_unlink]: dart.definiteFunctionType(dart.void, []),
- [_insertBefore]: dart.definiteFunctionType(dart.void, [async._BroadcastLinkedList])
- })
- });
async._BroadcastCallback$ = dart.generic(T => {
const _BroadcastCallback = dart.typedef('_BroadcastCallback', () => dart.functionType(dart.void, [async.StreamSubscription$(T)]));
return _BroadcastCallback;
@@ -20164,7 +20195,7 @@
}
}
cancel() {
- return null;
+ return async.Future._nullFuture;
}
asFuture(E) {
return futureValue => {
@@ -20340,7 +20371,7 @@
}
cancel() {
this[_stream][_cancelSubscription]();
- return null;
+ return async.Future._nullFuture;
}
get isPaused() {
return this[_stream][_isSubscriptionPaused];
@@ -20370,146 +20401,109 @@
return _BroadcastSubscriptionWrapper;
});
async._BroadcastSubscriptionWrapper = _BroadcastSubscriptionWrapper();
- const _current$1 = Symbol('_current');
- const _futureOrPrefetch = Symbol('_futureOrPrefetch');
- const _clear = Symbol('_clear');
- async._StreamIteratorImpl$ = dart.generic(T => {
+ const _stateData = Symbol('_stateData');
+ const _initializeOrDone = Symbol('_initializeOrDone');
+ async._StreamIterator$ = dart.generic(T => {
+ let StreamOfT = () => (StreamOfT = dart.constFn(async.Stream$(T)))();
+ let StreamSubscriptionOfT = () => (StreamSubscriptionOfT = dart.constFn(async.StreamSubscription$(T)))();
let StreamIteratorOfT = () => (StreamIteratorOfT = dart.constFn(async.StreamIterator$(T)))();
- class _StreamIteratorImpl extends core.Object {
+ class _StreamIterator extends core.Object {
new(stream) {
+ this[_stateData] = stream;
this[_subscription] = null;
- this[_current$1] = null;
- this[_futureOrPrefetch] = null;
- this[_state] = async._StreamIteratorImpl._STATE_FOUND;
- this[_subscription] = stream.listen(dart.bind(this, _onData), {onError: dart.bind(this, _onError), onDone: dart.bind(this, _onDone), cancelOnError: true});
+ this[_isPaused] = false;
}
get current() {
- return this[_current$1];
+ if (this[_subscription] != null && dart.test(this[_isPaused])) {
+ return T.as(this[_stateData]);
+ }
+ return null;
}
moveNext() {
- if (this[_state] == async._StreamIteratorImpl._STATE_DONE) {
- return new (_FutureOfbool()).immediate(false);
- }
- if (this[_state] == async._StreamIteratorImpl._STATE_MOVING) {
+ if (this[_subscription] != null) {
+ if (dart.test(this[_isPaused])) {
+ let future = new (_FutureOfbool())();
+ this[_stateData] = future;
+ this[_isPaused] = false;
+ this[_subscription].resume();
+ return future;
+ }
dart.throw(new core.StateError("Already waiting for next."));
}
- if (this[_state] == async._StreamIteratorImpl._STATE_FOUND) {
- this[_state] = async._StreamIteratorImpl._STATE_MOVING;
- this[_current$1] = null;
- let result = new (_FutureOfbool())();
- this[_futureOrPrefetch] = result;
- return result;
- } else {
- dart.assert(dart.notNull(this[_state]) >= async._StreamIteratorImpl._STATE_EXTRA_DATA);
- switch (this[_state]) {
- case async._StreamIteratorImpl._STATE_EXTRA_DATA:
- {
- this[_state] = async._StreamIteratorImpl._STATE_FOUND;
- this[_current$1] = T.as(this[_futureOrPrefetch]);
- this[_futureOrPrefetch] = null;
- this[_subscription].resume();
- return new (_FutureOfbool()).immediate(true);
- }
- case async._StreamIteratorImpl._STATE_EXTRA_ERROR:
- {
- let prefetch = async.AsyncError._check(this[_futureOrPrefetch]);
- this[_clear]();
- return new (_FutureOfbool()).immediateError(prefetch.error, prefetch.stackTrace);
- }
- case async._StreamIteratorImpl._STATE_EXTRA_DONE:
- {
- this[_clear]();
- return new (_FutureOfbool()).immediate(false);
- }
- }
- }
+ return this[_initializeOrDone]();
}
- [_clear]() {
- this[_subscription] = null;
- this[_futureOrPrefetch] = null;
- this[_current$1] = null;
- this[_state] = async._StreamIteratorImpl._STATE_DONE;
+ [_initializeOrDone]() {
+ dart.assert(this[_subscription] == null);
+ let stateData = this[_stateData];
+ if (stateData != null) {
+ let stream = StreamOfT().as(stateData);
+ this[_subscription] = stream.listen(dart.bind(this, _onData), {onError: dart.bind(this, _onError), onDone: dart.bind(this, _onDone), cancelOnError: true});
+ let future = new (_FutureOfbool())();
+ this[_stateData] = future;
+ return future;
+ }
+ return new (_FutureOfbool()).immediate(false);
}
cancel() {
- let subscription = this[_subscription];
- if (subscription == null) return null;
- if (this[_state] == async._StreamIteratorImpl._STATE_MOVING) {
- let hasNext = _FutureOfbool().as(this[_futureOrPrefetch]);
- this[_clear]();
- hasNext[_complete](false);
- } else {
- this[_clear]();
+ let subscription = StreamSubscriptionOfT()._check(this[_subscription]);
+ let stateData = this[_stateData];
+ this[_stateData] = null;
+ if (subscription != null) {
+ this[_subscription] = null;
+ if (!dart.test(this[_isPaused])) {
+ let future = _FutureOfbool().as(stateData);
+ future[_asyncComplete](false);
+ }
+ return subscription.cancel();
}
- return subscription.cancel();
+ return async.Future._nullFuture;
}
[_onData](data) {
T._check(data);
- if (this[_state] == async._StreamIteratorImpl._STATE_MOVING) {
- this[_current$1] = data;
- let hasNext = _FutureOfbool().as(this[_futureOrPrefetch]);
- this[_futureOrPrefetch] = null;
- this[_state] = async._StreamIteratorImpl._STATE_FOUND;
- hasNext[_complete](true);
- return;
- }
- this[_subscription].pause();
- dart.assert(this[_futureOrPrefetch] == null);
- this[_futureOrPrefetch] = data;
- this[_state] = async._StreamIteratorImpl._STATE_EXTRA_DATA;
+ dart.assert(this[_subscription] != null && !dart.test(this[_isPaused]));
+ let moveNextFuture = _FutureOfbool().as(this[_stateData]);
+ this[_stateData] = data;
+ this[_isPaused] = true;
+ moveNextFuture[_complete](true);
+ if (this[_subscription] != null && dart.test(this[_isPaused])) this[_subscription].pause();
}
[_onError](error, stackTrace) {
if (stackTrace === void 0) stackTrace = null;
- if (this[_state] == async._StreamIteratorImpl._STATE_MOVING) {
- let hasNext = _FutureOfbool().as(this[_futureOrPrefetch]);
- this[_clear]();
- hasNext[_completeError](error, stackTrace);
- return;
- }
- this[_subscription].pause();
- dart.assert(this[_futureOrPrefetch] == null);
- this[_futureOrPrefetch] = new async.AsyncError(error, stackTrace);
- this[_state] = async._StreamIteratorImpl._STATE_EXTRA_ERROR;
+ dart.assert(this[_subscription] != null && !dart.test(this[_isPaused]));
+ let moveNextFuture = _FutureOfbool().as(this[_stateData]);
+ this[_subscription] = null;
+ this[_stateData] = null;
+ moveNextFuture[_completeError](error, stackTrace);
}
[_onDone]() {
- if (this[_state] == async._StreamIteratorImpl._STATE_MOVING) {
- let hasNext = _FutureOfbool().as(this[_futureOrPrefetch]);
- this[_clear]();
- hasNext[_complete](false);
- return;
- }
- this[_subscription].pause();
- this[_futureOrPrefetch] = null;
- this[_state] = async._StreamIteratorImpl._STATE_EXTRA_DONE;
+ dart.assert(this[_subscription] != null && !dart.test(this[_isPaused]));
+ let moveNextFuture = _FutureOfbool().as(this[_stateData]);
+ this[_subscription] = null;
+ this[_stateData] = null;
+ moveNextFuture[_complete](false);
}
}
- dart.addTypeTests(_StreamIteratorImpl);
- _StreamIteratorImpl[dart.implements] = () => [StreamIteratorOfT()];
- dart.setSignature(_StreamIteratorImpl, {
+ dart.addTypeTests(_StreamIterator);
+ _StreamIterator[dart.implements] = () => [StreamIteratorOfT()];
+ dart.setSignature(_StreamIterator, {
fields: () => ({
[_subscription]: async.StreamSubscription,
- [_current$1]: T,
- [_futureOrPrefetch]: dart.dynamic,
- [_state]: core.int
+ [_stateData]: core.Object,
+ [_isPaused]: core.bool
}),
getters: () => ({current: dart.definiteFunctionType(T, [])}),
methods: () => ({
moveNext: dart.definiteFunctionType(async.Future$(core.bool), []),
- [_clear]: dart.definiteFunctionType(dart.void, []),
+ [_initializeOrDone]: dart.definiteFunctionType(async.Future$(core.bool), []),
cancel: dart.definiteFunctionType(async.Future, []),
[_onData]: dart.definiteFunctionType(dart.void, [T]),
[_onError]: dart.definiteFunctionType(dart.void, [core.Object], [core.StackTrace]),
[_onDone]: dart.definiteFunctionType(dart.void, [])
})
});
- return _StreamIteratorImpl;
+ return _StreamIterator;
});
- async._StreamIteratorImpl = _StreamIteratorImpl();
- async._StreamIteratorImpl._STATE_FOUND = 0;
- async._StreamIteratorImpl._STATE_DONE = 1;
- async._StreamIteratorImpl._STATE_MOVING = 2;
- async._StreamIteratorImpl._STATE_EXTRA_DATA = 3;
- async._StreamIteratorImpl._STATE_EXTRA_ERROR = 4;
- async._StreamIteratorImpl._STATE_EXTRA_DONE = 5;
+ async._StreamIterator = _StreamIterator();
async._EmptyStream$ = dart.generic(T => {
let _DoneStreamSubscriptionOfT = () => (_DoneStreamSubscriptionOfT = dart.constFn(async._DoneStreamSubscription$(T)))();
let TTovoid = () => (TTovoid = dart.constFn(dart.functionType(dart.void, [T])))();
@@ -20552,7 +20546,7 @@
dart.lazyFn(async._runUserCode, () => FnAndFnAndFnTodynamic());
async._cancelAndError = function(subscription, future, error, stackTrace) {
let cancelFuture = subscription.cancel();
- if (async.Future.is(cancelFuture)) {
+ if (async.Future.is(cancelFuture) && !core.identical(cancelFuture, async.Future._nullFuture)) {
cancelFuture.whenComplete(dart.fn(() => future[_completeError](error, stackTrace), VoidTovoid$()));
} else {
future[_completeError](error, stackTrace);
@@ -20577,7 +20571,7 @@
dart.fn(async._cancelAndErrorClosure, StreamSubscriptionAnd_FutureTo_ErrorCallback());
async._cancelAndValue = function(subscription, future, value) {
let cancelFuture = subscription.cancel();
- if (async.Future.is(cancelFuture)) {
+ if (async.Future.is(cancelFuture) && !core.identical(cancelFuture, async.Future._nullFuture)) {
cancelFuture.whenComplete(dart.fn(() => future[_complete](value), VoidTovoid$()));
} else {
future[_complete](value);
@@ -20860,6 +20854,7 @@
async._HandleErrorStream = _HandleErrorStream();
const _count = Symbol('_count');
async._TakeStream$ = dart.generic(T => {
+ let _DoneStreamSubscriptionOfT = () => (_DoneStreamSubscriptionOfT = dart.constFn(async._DoneStreamSubscription$(T)))();
let _StateStreamSubscriptionOfT = () => (_StateStreamSubscriptionOfT = dart.constFn(async._StateStreamSubscription$(T)))();
let _EventSinkOfT = () => (_EventSinkOfT = dart.constFn(async._EventSink$(T)))();
let TTovoid = () => (TTovoid = dart.constFn(dart.functionType(dart.void, [T])))();
@@ -20870,6 +20865,10 @@
if (!(typeof count == 'number')) dart.throw(new core.ArgumentError(count));
}
[_createSubscription](onData, onError, onDone, cancelOnError) {
+ if (this[_count] == 0) {
+ this[_source$].listen(null).cancel();
+ return new (_DoneStreamSubscriptionOfT())(onDone);
+ }
return new (_StateStreamSubscriptionOfT())(this, onData, onError, onDone, cancelOnError, this[_count]);
}
[_handleData](inputEvent, sink) {
@@ -21172,7 +21171,7 @@
if (dart.test(this[_isSubscribed])) {
let subscription = this[_subscription];
this[_subscription] = null;
- subscription.cancel();
+ return subscription.cancel();
}
return null;
}
@@ -22476,8 +22475,8 @@
if (onError != null) {
errorHandler = dart.fn((self, parent, zone, error, stackTrace) => {
try {
- if (ZoneBinaryCallbackOfdynamic$dynamic$StackTrace().is(onError)) {
- return R.as(self.parent.runBinary(dart.dynamic, dart.dynamic, core.StackTrace)(onError, error, stackTrace));
+ if (async.ZoneBinaryCallback$(R, dart.dynamic, core.StackTrace).is(onError)) {
+ return self.parent.runBinary(R, dart.dynamic, core.StackTrace)(onError, error, stackTrace);
}
return self.parent.runUnary(dart.dynamic, dart.dynamic)(dynamicTodynamic()._check(onError), error);
} catch (e) {
@@ -22939,7 +22938,7 @@
let _HashMapKeyIteratorOfE = () => (_HashMapKeyIteratorOfE = dart.constFn(collection._HashMapKeyIterator$(E)))();
let ETovoid = () => (ETovoid = dart.constFn(dart.functionType(dart.void, [E])))();
let _HashMapOfE$dynamic = () => (_HashMapOfE$dynamic = dart.constFn(collection._HashMap$(E, dart.dynamic)))();
- class _HashMapKeyIterable extends core.Iterable$(E) {
+ class _HashMapKeyIterable extends _internal.EfficientLengthIterable$(E) {
new(map) {
this[_map$0] = map;
super.new();
@@ -22966,7 +22965,6 @@
}
}
}
- _HashMapKeyIterable[dart.implements] = () => [_internal.EfficientLength];
dart.setSignature(_HashMapKeyIterable, {
fields: () => ({[_map$0]: _HashMapOfE$dynamic()}),
getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])})
@@ -22982,7 +22980,7 @@
});
collection._HashMapKeyIterable = _HashMapKeyIterable();
const _offset = Symbol('_offset');
- const _current$2 = Symbol('_current');
+ const _current$1 = Symbol('_current');
collection._HashMapKeyIterator$ = dart.generic(E => {
let IteratorOfE = () => (IteratorOfE = dart.constFn(core.Iterator$(E)))();
let _HashMapOfE$dynamic = () => (_HashMapOfE$dynamic = dart.constFn(collection._HashMap$(E, dart.dynamic)))();
@@ -22992,10 +22990,10 @@
this[_map$0] = map;
this[_keys] = keys;
this[_offset] = 0;
- this[_current$2] = null;
+ this[_current$1] = null;
}
get current() {
- return this[_current$2];
+ return this[_current$1];
}
moveNext() {
let keys = this[_keys];
@@ -23003,10 +23001,10 @@
if (keys !== this[_map$0][_keys]) {
dart.throw(new core.ConcurrentModificationError(this[_map$0]));
} else if (dart.notNull(offset) >= keys.length) {
- this[_current$2] = null;
+ this[_current$1] = null;
return false;
} else {
- this[_current$2] = keys[offset];
+ this[_current$1] = keys[offset];
this[_offset] = dart.notNull(offset) + 1;
return true;
}
@@ -23019,7 +23017,7 @@
[_map$0]: _HashMapOfE$dynamic(),
[_keys]: ListOfE(),
[_offset]: core.int,
- [_current$2]: E
+ [_current$1]: E
}),
getters: () => ({current: dart.definiteFunctionType(E, [])}),
methods: () => ({moveNext: dart.definiteFunctionType(core.bool, [])})
@@ -23182,7 +23180,7 @@
collection._Es6MapIterable$ = dart.generic(E => {
let _Es6MapIteratorOfE = () => (_Es6MapIteratorOfE = dart.constFn(collection._Es6MapIterator$(E)))();
let ETovoid = () => (ETovoid = dart.constFn(dart.functionType(dart.void, [E])))();
- class _Es6MapIterable extends core.Iterable$(E) {
+ class _Es6MapIterable extends _internal.EfficientLengthIterable$(E) {
new(map, isKeys) {
this[_map$0] = map;
this[_isKeys] = isKeys;
@@ -23220,7 +23218,6 @@
}
}
}
- _Es6MapIterable[dart.implements] = () => [_internal.EfficientLength];
dart.setSignature(_Es6MapIterable, {
fields: () => ({
[_map$0]: dart.dynamic,
@@ -23250,7 +23247,7 @@
this[_isKeys] = isKeys;
this[_jsIterator$] = null;
this[_next$0] = null;
- this[_current$2] = null;
+ this[_current$1] = null;
this[_done] = null;
if (dart.test(this[_isKeys])) {
this[_jsIterator$] = dart.dload(this[_map$0], _map$0).keys();
@@ -23260,7 +23257,7 @@
this[_done] = false;
}
get current() {
- return this[_current$2];
+ return this[_current$1];
}
moveNext() {
if (!dart.equals(this[_modifications$], dart.dload(this[_map$0], _modifications$))) {
@@ -23270,11 +23267,11 @@
this[_next$0] = this[_jsIterator$].next();
let done = this[_next$0].done;
if (done) {
- this[_current$2] = null;
+ this[_current$1] = null;
this[_done] = true;
return false;
} else {
- this[_current$2] = this[_next$0].value;
+ this[_current$1] = this[_next$0].value;
return true;
}
}
@@ -23288,7 +23285,7 @@
[_isKeys]: core.bool,
[_jsIterator$]: dart.dynamic,
[_next$0]: dart.dynamic,
- [_current$2]: E,
+ [_current$1]: E,
[_done]: core.bool
}),
getters: () => ({current: dart.definiteFunctionType(E, [])}),
@@ -24079,10 +24076,10 @@
this[_set] = set;
this[_elements] = elements;
this[_offset] = 0;
- this[_current$2] = null;
+ this[_current$1] = null;
}
get current() {
- return this[_current$2];
+ return this[_current$1];
}
moveNext() {
let elements = this[_elements];
@@ -24090,10 +24087,10 @@
if (elements !== dart.dload(this[_set], _elements)) {
dart.throw(new core.ConcurrentModificationError(this[_set]));
} else if (dart.notNull(offset) >= elements.length) {
- this[_current$2] = null;
+ this[_current$1] = null;
return false;
} else {
- this[_current$2] = elements[offset];
+ this[_current$1] = elements[offset];
this[_offset] = dart.notNull(offset) + 1;
return true;
}
@@ -24106,7 +24103,7 @@
[_set]: dart.dynamic,
[_elements]: ListOfE(),
[_offset]: core.int,
- [_current$2]: E
+ [_current$1]: E
}),
getters: () => ({current: dart.definiteFunctionType(E, [])}),
methods: () => ({moveNext: dart.definiteFunctionType(core.bool, [])})
@@ -24560,20 +24557,20 @@
this[_set] = set;
this[_modifications$] = modifications;
this[_cell$] = null;
- this[_current$2] = null;
+ this[_current$1] = null;
this[_cell$] = this[_set][_first$];
}
get current() {
- return this[_current$2];
+ return this[_current$1];
}
moveNext() {
if (this[_modifications$] != this[_set][_modifications$]) {
dart.throw(new core.ConcurrentModificationError(this[_set]));
} else if (this[_cell$] == null) {
- this[_current$2] = null;
+ this[_current$1] = null;
return false;
} else {
- this[_current$2] = E._check(this[_cell$][_element]);
+ this[_current$1] = E._check(this[_cell$][_element]);
this[_cell$] = this[_cell$][_next$0];
return true;
}
@@ -24586,7 +24583,7 @@
[_set]: collection._LinkedHashSet,
[_modifications$]: core.int,
[_cell$]: collection._LinkedHashSetCell,
- [_current$2]: E
+ [_current$1]: E
}),
getters: () => ({current: dart.definiteFunctionType(E, [])}),
methods: () => ({moveNext: dart.definiteFunctionType(core.bool, [])})
@@ -24851,7 +24848,7 @@
return SetOfE().from(this);
}
get length() {
- dart.assert(!_internal.EfficientLength.is(this));
+ dart.assert(!_internal.EfficientLengthIterable.is(this));
let count = 0;
let it = this[dartx.iterator];
while (dart.test(it.moveNext())) {
@@ -25279,9 +25276,9 @@
});
collection.LinkedHashSet = LinkedHashSet();
const _modificationCount = Symbol('_modificationCount');
- const _insertBefore$ = Symbol('_insertBefore');
+ const _insertBefore = Symbol('_insertBefore');
const _list = Symbol('_list');
- const _unlink$ = Symbol('_unlink');
+ const _unlink = Symbol('_unlink');
collection.LinkedList$ = dart.generic(E => {
let IterableOfE = () => (IterableOfE = dart.constFn(core.Iterable$(E)))();
let _LinkedListIteratorOfE = () => (_LinkedListIteratorOfE = dart.constFn(collection._LinkedListIterator$(E)))();
@@ -25295,12 +25292,12 @@
}
addFirst(entry) {
E._check(entry);
- this[_insertBefore$](this[_first$], entry, {updateFirst: true});
+ this[_insertBefore](this[_first$], entry, {updateFirst: true});
this[_first$] = entry;
}
add(entry) {
E._check(entry);
- this[_insertBefore$](this[_first$], entry, {updateFirst: false});
+ this[_insertBefore](this[_first$], entry, {updateFirst: false});
}
addAll(entries) {
IterableOfE()._check(entries);
@@ -25309,7 +25306,7 @@
remove(entry) {
E._check(entry);
if (!dart.equals(entry[_list], this)) return false;
- this[_unlink$](entry);
+ this[_unlink](entry);
return true;
}
get iterator() {
@@ -25366,7 +25363,7 @@
get isEmpty() {
return this[_length$1] == 0;
}
- [_insertBefore$](entry, newEntry, opts) {
+ [_insertBefore](entry, newEntry, opts) {
E._check(entry);
E._check(newEntry);
let updateFirst = opts && 'updateFirst' in opts ? opts.updateFirst : null;
@@ -25393,7 +25390,7 @@
}
this[_length$1] = dart.notNull(this[_length$1]) + 1;
}
- [_unlink$](entry) {
+ [_unlink](entry) {
E._check(entry);
this[_modificationCount] = dart.notNull(this[_modificationCount]) + 1;
entry[_next$0][_previous$0] = entry[_previous$0];
@@ -25420,8 +25417,8 @@
addAll: dart.definiteFunctionType(dart.void, [IterableOfE()]),
remove: dart.definiteFunctionType(core.bool, [E]),
clear: dart.definiteFunctionType(dart.void, []),
- [_insertBefore$]: dart.definiteFunctionType(dart.void, [E, E], {updateFirst: core.bool}),
- [_unlink$]: dart.definiteFunctionType(dart.void, [E])
+ [_insertBefore]: dart.definiteFunctionType(dart.void, [E, E], {updateFirst: core.bool}),
+ [_unlink]: dart.definiteFunctionType(dart.void, [E])
})
});
dart.defineExtensionMembers(LinkedList, [
@@ -25447,21 +25444,21 @@
this[_modificationCount] = list[_modificationCount];
this[_next$0] = list[_first$];
this[_visitedFirst] = false;
- this[_current$2] = null;
+ this[_current$1] = null;
}
get current() {
- return this[_current$2];
+ return this[_current$1];
}
moveNext() {
if (this[_modificationCount] != this[_list][_modificationCount]) {
dart.throw(new core.ConcurrentModificationError(this));
}
if (dart.test(this[_list].isEmpty) || dart.test(this[_visitedFirst]) && core.identical(this[_next$0], this[_list].first)) {
- this[_current$2] = null;
+ this[_current$1] = null;
return false;
}
this[_visitedFirst] = true;
- this[_current$2] = E._check(this[_next$0]);
+ this[_current$1] = E._check(this[_next$0]);
this[_next$0] = this[_next$0][_next$0];
return true;
}
@@ -25472,7 +25469,7 @@
fields: () => ({
[_list]: LinkedListOfE(),
[_modificationCount]: core.int,
- [_current$2]: E,
+ [_current$1]: E,
[_next$0]: LinkedListEntryOfE(),
[_visitedFirst]: core.bool
}),
@@ -25494,23 +25491,23 @@
return this[_list];
}
unlink() {
- this[_list][_unlink$](E._check(this));
+ this[_list][_unlink](E._check(this));
}
get next() {
- if (core.identical(this, this[_next$0])) return null;
+ if (this[_list] == null || core.identical(this[_list].first, this[_next$0])) return null;
return this[_next$0];
}
get previous() {
- if (core.identical(this, this[_previous$0])) return null;
+ if (this[_list] == null || core.identical(this, this[_list].first)) return null;
return this[_previous$0];
}
insertAfter(entry) {
E._check(entry);
- this[_list][_insertBefore$](this[_next$0], entry, {updateFirst: false});
+ this[_list][_insertBefore](this[_next$0], entry, {updateFirst: false});
}
insertBefore(entry) {
E._check(entry);
- this[_list][_insertBefore$](E.as(this), entry, {updateFirst: true});
+ this[_list][_insertBefore](E.as(this), entry, {updateFirst: true});
}
}
dart.addTypeTests(LinkedListEntry);
@@ -25679,7 +25676,7 @@
collection._MapBaseValueIterable$ = dart.generic((K, V) => {
let _MapBaseValueIteratorOfK$V = () => (_MapBaseValueIteratorOfK$V = dart.constFn(collection._MapBaseValueIterator$(K, V)))();
let MapOfK$V = () => (MapOfK$V = dart.constFn(core.Map$(K, V)))();
- class _MapBaseValueIterable extends core.Iterable$(V) {
+ class _MapBaseValueIterable extends _internal.EfficientLengthIterable$(V) {
new(map) {
this[_map$0] = map;
super.new();
@@ -25706,7 +25703,6 @@
return new (_MapBaseValueIteratorOfK$V())(this[_map$0]);
}
}
- _MapBaseValueIterable[dart.implements] = () => [_internal.EfficientLength];
dart.setSignature(_MapBaseValueIterable, {
fields: () => ({[_map$0]: MapOfK$V()}),
getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(V), [])})
@@ -25731,18 +25727,18 @@
new(map) {
this[_map$0] = map;
this[_keys] = map[dartx.keys][dartx.iterator];
- this[_current$2] = null;
+ this[_current$1] = null;
}
moveNext() {
if (dart.test(this[_keys].moveNext())) {
- this[_current$2] = this[_map$0][dartx._get](this[_keys].current);
+ this[_current$1] = this[_map$0][dartx._get](this[_keys].current);
return true;
}
- this[_current$2] = null;
+ this[_current$1] = null;
return false;
}
get current() {
- return this[_current$2];
+ return this[_current$1];
}
}
dart.addTypeTests(_MapBaseValueIterator);
@@ -25751,7 +25747,7 @@
fields: () => ({
[_keys]: IteratorOfK(),
[_map$0]: MapOfK$V(),
- [_current$2]: V
+ [_current$1]: V
}),
getters: () => ({current: dart.definiteFunctionType(V, [])}),
methods: () => ({moveNext: dart.definiteFunctionType(core.bool, [])})
@@ -25987,7 +25983,7 @@
});
collection.Queue$ = dart.generic(E => {
let ListQueueOfE = () => (ListQueueOfE = dart.constFn(collection.ListQueue$(E)))();
- let IterableOfE = () => (IterableOfE = dart.constFn(core.Iterable$(E)))();
+ let EfficientLengthIterableOfE = () => (EfficientLengthIterableOfE = dart.constFn(_internal.EfficientLengthIterable$(E)))();
class Queue extends core.Object {
static new() {
return new (ListQueueOfE())();
@@ -25995,33 +25991,30 @@
static from(elements) {
return ListQueueOfE().from(elements);
}
- [Symbol.iterator]() {
- return new dart.JsIterator(this.iterator);
- }
}
dart.addTypeTests(Queue);
- Queue[dart.implements] = () => [IterableOfE(), _internal.EfficientLength];
+ Queue[dart.implements] = () => [EfficientLengthIterableOfE()];
return Queue;
});
collection.Queue = Queue();
const _previousLink = Symbol('_previousLink');
const _nextLink = Symbol('_nextLink');
const _link = Symbol('_link');
- collection._DoubleLink$ = dart.generic(E => {
+ collection._DoubleLink$ = dart.generic(Link => {
class _DoubleLink extends core.Object {
new() {
this[_previousLink] = null;
this[_nextLink] = null;
}
[_link](previous, next) {
- E._check(previous);
- E._check(next);
+ Link._check(previous);
+ Link._check(next);
this[_nextLink] = next;
this[_previousLink] = previous;
if (previous != null) previous[_nextLink] = this;
if (next != null) next[_previousLink] = this;
}
- [_unlink$]() {
+ [_unlink]() {
if (this[_previousLink] != null) this[_previousLink][_nextLink] = this[_nextLink];
if (this[_nextLink] != null) this[_nextLink][_previousLink] = this[_previousLink];
this[_nextLink] = null;
@@ -26031,46 +26024,34 @@
dart.addTypeTests(_DoubleLink);
dart.setSignature(_DoubleLink, {
fields: () => ({
- [_previousLink]: E,
- [_nextLink]: E
+ [_previousLink]: Link,
+ [_nextLink]: Link
}),
methods: () => ({
- [_link]: dart.definiteFunctionType(dart.void, [E, E]),
- [_unlink$]: dart.definiteFunctionType(dart.void, [])
+ [_link]: dart.definiteFunctionType(dart.void, [Link, Link]),
+ [_unlink]: dart.definiteFunctionType(dart.void, [])
})
});
return _DoubleLink;
});
collection._DoubleLink = _DoubleLink();
collection.DoubleLinkedQueueEntry$ = dart.generic(E => {
- let _UserDoubleLinkedQueueEntryOfE = () => (_UserDoubleLinkedQueueEntryOfE = dart.constFn(collection._UserDoubleLinkedQueueEntry$(E)))();
- class DoubleLinkedQueueEntry extends core.Object {
- static new(element) {
- return new (_UserDoubleLinkedQueueEntryOfE())(element);
- }
- }
- dart.addTypeTests(DoubleLinkedQueueEntry);
- return DoubleLinkedQueueEntry;
- });
- collection.DoubleLinkedQueueEntry = DoubleLinkedQueueEntry();
- collection._UserDoubleLinkedQueueEntry$ = dart.generic(E => {
- let _UserDoubleLinkedQueueEntryOfE = () => (_UserDoubleLinkedQueueEntryOfE = dart.constFn(collection._UserDoubleLinkedQueueEntry$(E)))();
let DoubleLinkedQueueEntryOfE = () => (DoubleLinkedQueueEntryOfE = dart.constFn(collection.DoubleLinkedQueueEntry$(E)))();
- class _UserDoubleLinkedQueueEntry extends collection._DoubleLink {
+ class DoubleLinkedQueueEntry extends collection._DoubleLink {
new(element) {
this.element = element;
super.new();
}
append(e) {
E._check(e);
- new (_UserDoubleLinkedQueueEntryOfE())(e)[_link](this, this[_nextLink]);
+ new (DoubleLinkedQueueEntryOfE())(e)[_link](this, this[_nextLink]);
}
prepend(e) {
E._check(e);
- new (_UserDoubleLinkedQueueEntryOfE())(e)[_link](this[_previousLink], this);
+ new (DoubleLinkedQueueEntryOfE())(e)[_link](this[_previousLink], this);
}
remove() {
- this[_unlink$]();
+ this[_unlink]();
return this.element;
}
previousEntry() {
@@ -26080,8 +26061,7 @@
return this[_nextLink];
}
}
- _UserDoubleLinkedQueueEntry[dart.implements] = () => [DoubleLinkedQueueEntryOfE()];
- dart.setSignature(_UserDoubleLinkedQueueEntry, {
+ dart.setSignature(DoubleLinkedQueueEntry, {
fields: () => ({element: E}),
methods: () => ({
append: dart.definiteFunctionType(dart.void, [E]),
@@ -26091,22 +26071,23 @@
nextEntry: dart.definiteFunctionType(collection.DoubleLinkedQueueEntry$(E), [])
})
});
- return _UserDoubleLinkedQueueEntry;
- }, _UserDoubleLinkedQueueEntry => {
- dart.setBaseClass(_UserDoubleLinkedQueueEntry, collection._DoubleLink$(_UserDoubleLinkedQueueEntry));
+ return DoubleLinkedQueueEntry;
+ }, DoubleLinkedQueueEntry => {
+ dart.setBaseClass(DoubleLinkedQueueEntry, collection._DoubleLink$(DoubleLinkedQueueEntry));
});
- collection._UserDoubleLinkedQueueEntry = _UserDoubleLinkedQueueEntry();
+ collection.DoubleLinkedQueueEntry = DoubleLinkedQueueEntry();
const _queue = Symbol('_queue');
const _append = Symbol('_append');
const _prepend = Symbol('_prepend');
const _asNonSentinelEntry = Symbol('_asNonSentinelEntry');
collection._DoubleLinkedQueueEntry$ = dart.generic(E => {
let _DoubleLinkedQueueElementOfE = () => (_DoubleLinkedQueueElementOfE = dart.constFn(collection._DoubleLinkedQueueElement$(E)))();
+ let _DoubleLinkedQueueEntryOfE = () => (_DoubleLinkedQueueEntryOfE = dart.constFn(collection._DoubleLinkedQueueEntry$(E)))();
let DoubleLinkedQueueOfE = () => (DoubleLinkedQueueOfE = dart.constFn(collection.DoubleLinkedQueue$(E)))();
- class _DoubleLinkedQueueEntry extends collection._DoubleLink {
- new(queue) {
+ class _DoubleLinkedQueueEntry extends collection.DoubleLinkedQueueEntry$(E) {
+ new(element, queue) {
this[_queue] = queue;
- super.new();
+ super.new(element);
}
[_append](e) {
E._check(e);
@@ -26116,34 +26097,34 @@
E._check(e);
new (_DoubleLinkedQueueElementOfE())(e, this[_queue])[_link](this[_previousLink], this);
}
+ get [_element]() {
+ return this.element;
+ }
nextEntry() {
- return this[_nextLink][_asNonSentinelEntry]();
+ let entry = _DoubleLinkedQueueEntryOfE()._check(this[_nextLink]);
+ return entry[_asNonSentinelEntry]();
}
previousEntry() {
- return this[_previousLink][_asNonSentinelEntry]();
+ let entry = _DoubleLinkedQueueEntryOfE()._check(this[_previousLink]);
+ return entry[_asNonSentinelEntry]();
}
}
dart.setSignature(_DoubleLinkedQueueEntry, {
fields: () => ({[_queue]: DoubleLinkedQueueOfE()}),
+ getters: () => ({[_element]: dart.definiteFunctionType(E, [])}),
methods: () => ({
[_append]: dart.definiteFunctionType(dart.void, [E]),
- [_prepend]: dart.definiteFunctionType(dart.void, [E]),
- nextEntry: dart.definiteFunctionType(collection.DoubleLinkedQueueEntry$(E), []),
- previousEntry: dart.definiteFunctionType(collection.DoubleLinkedQueueEntry$(E), [])
+ [_prepend]: dart.definiteFunctionType(dart.void, [E])
})
});
return _DoubleLinkedQueueEntry;
- }, _DoubleLinkedQueueEntry => {
- dart.setBaseClass(_DoubleLinkedQueueEntry, collection._DoubleLink$(_DoubleLinkedQueueEntry));
});
collection._DoubleLinkedQueueEntry = _DoubleLinkedQueueEntry();
const _elementCount = Symbol('_elementCount');
collection._DoubleLinkedQueueElement$ = dart.generic(E => {
- let DoubleLinkedQueueEntryOfE = () => (DoubleLinkedQueueEntryOfE = dart.constFn(collection.DoubleLinkedQueueEntry$(E)))();
class _DoubleLinkedQueueElement extends collection._DoubleLinkedQueueEntry$(E) {
new(element, queue) {
- this.element = element;
- super.new(queue);
+ super.new(element, queue);
}
append(e) {
E._check(e);
@@ -26163,7 +26144,7 @@
}
[_remove]() {
this[_queue] = null;
- this[_unlink$]();
+ this[_unlink]();
return this.element;
}
remove() {
@@ -26177,14 +26158,9 @@
return this;
}
}
- _DoubleLinkedQueueElement[dart.implements] = () => [DoubleLinkedQueueEntryOfE()];
dart.setSignature(_DoubleLinkedQueueElement, {
- fields: () => ({element: E}),
methods: () => ({
- append: dart.definiteFunctionType(dart.void, [E]),
- prepend: dart.definiteFunctionType(dart.void, [E]),
[_remove]: dart.definiteFunctionType(E, []),
- remove: dart.definiteFunctionType(E, []),
[_asNonSentinelEntry]: dart.definiteFunctionType(collection._DoubleLinkedQueueElement$(E), [])
})
});
@@ -26194,7 +26170,7 @@
collection._DoubleLinkedQueueSentinel$ = dart.generic(E => {
class _DoubleLinkedQueueSentinel extends collection._DoubleLinkedQueueEntry$(E) {
new(queue) {
- super.new(queue);
+ super.new(null, queue);
this[_previousLink] = this;
this[_nextLink] = this;
}
@@ -26204,12 +26180,11 @@
[_remove]() {
dart.throw(_internal.IterableElementError.noElement());
}
- get element() {
+ get [_element]() {
dart.throw(_internal.IterableElementError.noElement());
}
}
dart.setSignature(_DoubleLinkedQueueSentinel, {
- getters: () => ({element: dart.definiteFunctionType(E, [])}),
methods: () => ({
[_asNonSentinelEntry]: dart.definiteFunctionType(collection.DoubleLinkedQueueEntry$(E), []),
[_remove]: dart.definiteFunctionType(E, [])
@@ -26223,6 +26198,7 @@
let _DoubleLinkedQueueSentinelOfE = () => (_DoubleLinkedQueueSentinelOfE = dart.constFn(collection._DoubleLinkedQueueSentinel$(E)))();
let DoubleLinkedQueueOfE = () => (DoubleLinkedQueueOfE = dart.constFn(collection.DoubleLinkedQueue$(E)))();
let IterableOfE = () => (IterableOfE = dart.constFn(core.Iterable$(E)))();
+ let _DoubleLinkedQueueEntryOfE = () => (_DoubleLinkedQueueEntryOfE = dart.constFn(collection._DoubleLinkedQueueEntry$(E)))();
let _DoubleLinkedQueueElementOfE = () => (_DoubleLinkedQueueElementOfE = dart.constFn(collection._DoubleLinkedQueueElement$(E)))();
let _DoubleLinkedQueueIteratorOfE = () => (_DoubleLinkedQueueIteratorOfE = dart.constFn(collection._DoubleLinkedQueueIterator$(E)))();
let QueueOfE = () => (QueueOfE = dart.constFn(collection.Queue$(E)))();
@@ -26270,34 +26246,42 @@
}
}
removeLast() {
- let lastEntry = this[_sentinel][_previousLink];
+ let lastEntry = _DoubleLinkedQueueEntryOfE()._check(this[_sentinel][_previousLink]);
let result = lastEntry[_remove]();
this[_elementCount] = dart.notNull(this[_elementCount]) - 1;
return result;
}
removeFirst() {
- let firstEntry = this[_sentinel][_nextLink];
+ let firstEntry = _DoubleLinkedQueueEntryOfE()._check(this[_sentinel][_nextLink]);
let result = firstEntry[_remove]();
this[_elementCount] = dart.notNull(this[_elementCount]) - 1;
return result;
}
remove(o) {
- let entry = this[_sentinel][_nextLink];
+ let entry = _DoubleLinkedQueueEntryOfE()._check(this[_sentinel][_nextLink]);
while (!core.identical(entry, this[_sentinel])) {
- if (dart.equals(entry.element, o)) {
+ let equals = dart.equals(entry[_element], o);
+ if (!core.identical(this, entry[_queue])) {
+ dart.throw(new core.ConcurrentModificationError(this));
+ }
+ if (equals) {
entry[_remove]();
this[_elementCount] = dart.notNull(this[_elementCount]) - 1;
return true;
}
- entry = entry[_nextLink];
+ entry = _DoubleLinkedQueueEntryOfE()._check(entry[_nextLink]);
}
return false;
}
[_filter](test, removeMatching) {
- let entry = this[_sentinel][_nextLink];
+ let entry = _DoubleLinkedQueueEntryOfE()._check(this[_sentinel][_nextLink]);
while (!core.identical(entry, this[_sentinel])) {
- let next = entry[_nextLink];
- if (core.identical(removeMatching, test(entry.element))) {
+ let matches = test(entry[_element]);
+ if (!core.identical(this, entry[_queue])) {
+ dart.throw(new core.ConcurrentModificationError(this));
+ }
+ let next = _DoubleLinkedQueueEntryOfE()._check(entry[_nextLink]);
+ if (core.identical(removeMatching, matches)) {
entry[_remove]();
this[_elementCount] = dart.notNull(this[_elementCount]) - 1;
}
@@ -26311,26 +26295,26 @@
this[_filter](test, false);
}
get first() {
- let firstEntry = this[_sentinel][_nextLink];
- return firstEntry.element;
+ let firstEntry = _DoubleLinkedQueueEntryOfE()._check(this[_sentinel][_nextLink]);
+ return firstEntry[_element];
}
get last() {
- let lastEntry = this[_sentinel][_previousLink];
- return lastEntry.element;
+ let lastEntry = _DoubleLinkedQueueEntryOfE()._check(this[_sentinel][_previousLink]);
+ return lastEntry[_element];
}
get single() {
if (core.identical(this[_sentinel][_nextLink], this[_sentinel][_previousLink])) {
- let entry = this[_sentinel][_nextLink];
- return entry.element;
+ let entry = _DoubleLinkedQueueEntryOfE()._check(this[_sentinel][_nextLink]);
+ return entry[_element];
}
dart.throw(_internal.IterableElementError.tooMany());
}
- lastEntry() {
- return this[_sentinel].previousEntry();
- }
firstEntry() {
return this[_sentinel].nextEntry();
}
+ lastEntry() {
+ return this[_sentinel].previousEntry();
+ }
get isEmpty() {
return core.identical(this[_sentinel][_nextLink], this[_sentinel]);
}
@@ -26339,13 +26323,18 @@
this[_sentinel][_previousLink] = this[_sentinel];
this[_elementCount] = 0;
}
- forEachEntry(f) {
- let entry = this[_sentinel][_nextLink];
+ forEachEntry(action) {
+ let entry = _DoubleLinkedQueueEntryOfE()._check(this[_sentinel][_nextLink]);
while (!core.identical(entry, this[_sentinel])) {
- let nextEntry = entry[_nextLink];
let element = _DoubleLinkedQueueElementOfE()._check(entry);
- f(element);
- entry = nextEntry;
+ let next = _DoubleLinkedQueueEntryOfE()._check(element[_nextLink]);
+ action(element);
+ if (core.identical(this, entry[_queue])) {
+ next = _DoubleLinkedQueueEntryOfE()._check(entry[_nextLink]);
+ } else if (!core.identical(this, next[_queue])) {
+ dart.throw(new core.ConcurrentModificationError(this));
+ }
+ entry = next;
}
}
get iterator() {
@@ -26373,8 +26362,8 @@
[_filter]: dart.definiteFunctionType(dart.void, [ETobool(), core.bool]),
removeWhere: dart.definiteFunctionType(dart.void, [ETobool()]),
retainWhere: dart.definiteFunctionType(dart.void, [ETobool()]),
- lastEntry: dart.definiteFunctionType(collection.DoubleLinkedQueueEntry$(E), []),
firstEntry: dart.definiteFunctionType(collection.DoubleLinkedQueueEntry$(E), []),
+ lastEntry: dart.definiteFunctionType(collection.DoubleLinkedQueueEntry$(E), []),
clear: dart.definiteFunctionType(dart.void, []),
forEachEntry: dart.definiteFunctionType(dart.void, [DoubleLinkedQueueEntryOfETovoid()])
})
@@ -26393,33 +26382,33 @@
collection.DoubleLinkedQueue = DoubleLinkedQueue();
const _nextEntry = Symbol('_nextEntry');
collection._DoubleLinkedQueueIterator$ = dart.generic(E => {
+ let _DoubleLinkedQueueEntryOfE = () => (_DoubleLinkedQueueEntryOfE = dart.constFn(collection._DoubleLinkedQueueEntry$(E)))();
let _DoubleLinkedQueueElementOfE = () => (_DoubleLinkedQueueElementOfE = dart.constFn(collection._DoubleLinkedQueueElement$(E)))();
let IteratorOfE = () => (IteratorOfE = dart.constFn(core.Iterator$(E)))();
let _DoubleLinkedQueueSentinelOfE = () => (_DoubleLinkedQueueSentinelOfE = dart.constFn(collection._DoubleLinkedQueueSentinel$(E)))();
- let _DoubleLinkedQueueEntryOfE = () => (_DoubleLinkedQueueEntryOfE = dart.constFn(collection._DoubleLinkedQueueEntry$(E)))();
class _DoubleLinkedQueueIterator extends core.Object {
new(sentinel) {
this[_sentinel] = sentinel;
- this[_nextEntry] = sentinel[_nextLink];
- this[_current$2] = null;
+ this[_nextEntry] = _DoubleLinkedQueueEntryOfE()._check(sentinel[_nextLink]);
+ this[_current$1] = null;
}
moveNext() {
if (core.identical(this[_nextEntry], this[_sentinel])) {
- this[_current$2] = null;
+ this[_current$1] = null;
this[_nextEntry] = null;
this[_sentinel] = null;
return false;
}
let elementEntry = _DoubleLinkedQueueElementOfE()._check(this[_nextEntry]);
- if (elementEntry[_queue] == null) {
+ if (!core.identical(this[_sentinel][_queue], elementEntry[_queue])) {
dart.throw(new core.ConcurrentModificationError(this[_sentinel][_queue]));
}
- this[_current$2] = elementEntry.element;
- this[_nextEntry] = elementEntry[_nextLink];
+ this[_current$1] = elementEntry[_element];
+ this[_nextEntry] = _DoubleLinkedQueueEntryOfE()._check(elementEntry[_nextLink]);
return true;
}
get current() {
- return this[_current$2];
+ return this[_current$1];
}
}
dart.addTypeTests(_DoubleLinkedQueueIterator);
@@ -26428,7 +26417,7 @@
fields: () => ({
[_sentinel]: _DoubleLinkedQueueSentinelOfE(),
[_nextEntry]: _DoubleLinkedQueueEntryOfE(),
- [_current$2]: E
+ [_current$1]: E
}),
getters: () => ({current: dart.definiteFunctionType(E, [])}),
methods: () => ({moveNext: dart.definiteFunctionType(core.bool, [])})
@@ -26451,7 +26440,7 @@
let QueueOfE = () => (QueueOfE = dart.constFn(collection.Queue$(E)))();
let ETovoid = () => (ETovoid = dart.constFn(dart.functionType(dart.void, [E])))();
let ETobool = () => (ETobool = dart.constFn(dart.functionType(core.bool, [E])))();
- class ListQueue extends core.Iterable$(E) {
+ class ListQueue extends _internal.ListIterable$(E) {
new(initialCapacity) {
if (initialCapacity === void 0) initialCapacity = null;
this[_head] = 0;
@@ -26479,7 +26468,7 @@
return queue;
} else {
let capacity = collection.ListQueue._INITIAL_CAPACITY;
- if (_internal.EfficientLength.is(elements)) {
+ if (_internal.EfficientLengthIterable.is(elements)) {
capacity = elements[dartx.length];
}
let result = new (ListQueueOfE())(capacity);
@@ -26728,7 +26717,6 @@
[_tail]: core.int,
[_modificationCount]: core.int
}),
- getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])}),
methods: () => ({
add: dart.definiteFunctionType(dart.void, [E]),
addAll: dart.definiteFunctionType(dart.void, [IterableOfE()]),
@@ -26781,18 +26769,18 @@
this[_end] = queue[_tail];
this[_modificationCount] = queue[_modificationCount];
this[_position] = queue[_head];
- this[_current$2] = null;
+ this[_current$1] = null;
}
get current() {
- return this[_current$2];
+ return this[_current$1];
}
moveNext() {
this[_queue][_checkModification](this[_modificationCount]);
if (this[_position] == this[_end]) {
- this[_current$2] = null;
+ this[_current$1] = null;
return false;
}
- this[_current$2] = this[_queue][_table][dartx._get](this[_position]);
+ this[_current$1] = this[_queue][_table][dartx._get](this[_position]);
this[_position] = (dart.notNull(this[_position]) + 1 & dart.notNull(this[_queue][_table][dartx.length]) - 1) >>> 0;
return true;
}
@@ -26805,7 +26793,7 @@
[_end]: core.int,
[_modificationCount]: core.int,
[_position]: core.int,
- [_current$2]: E
+ [_current$1]: E
}),
getters: () => ({current: dart.definiteFunctionType(E, [])}),
methods: () => ({moveNext: dart.definiteFunctionType(core.bool, [])})
@@ -26861,7 +26849,7 @@
const _splayMin = Symbol('_splayMin');
const _splayMax = Symbol('_splayMax');
const _addNewRoot = Symbol('_addNewRoot');
- const _clear$ = Symbol('_clear');
+ const _clear = Symbol('_clear');
collection._SplayTree$ = dart.generic((K, Node) => {
class _SplayTree extends core.Object {
new() {
@@ -26986,7 +26974,7 @@
this[_root] = this[_splayMax](this[_root]);
return this[_root];
}
- [_clear$]() {
+ [_clear]() {
this[_root] = null;
this[_count$] = 0;
this[_modificationCount] = dart.notNull(this[_modificationCount]) + 1;
@@ -27009,7 +26997,7 @@
[_splayMax]: dart.definiteFunctionType(Node, [Node]),
[_remove]: dart.definiteFunctionType(Node, [K]),
[_addNewRoot]: dart.definiteFunctionType(dart.void, [Node, core.int]),
- [_clear$]: dart.definiteFunctionType(dart.void, [])
+ [_clear]: dart.definiteFunctionType(dart.void, [])
})
});
return _SplayTree;
@@ -27166,7 +27154,7 @@
return this[_count$];
}
clear() {
- this[_clear$]();
+ this[_clear]();
}
containsKey(key) {
return dart.test(dart.dcall(this[_validKey], key)) && this[_splay](K.as(key)) == 0;
@@ -27386,7 +27374,7 @@
let SplayTreeSetOfK = () => (SplayTreeSetOfK = dart.constFn(collection.SplayTreeSet$(K)))();
let _SplayTreeNodeOfK = () => (_SplayTreeNodeOfK = dart.constFn(collection._SplayTreeNode$(K)))();
let _SplayTreeOfK$_SplayTreeNodeOfK = () => (_SplayTreeOfK$_SplayTreeNodeOfK = dart.constFn(collection._SplayTree$(K, _SplayTreeNodeOfK())))();
- class _SplayTreeKeyIterable extends core.Iterable$(K) {
+ class _SplayTreeKeyIterable extends _internal.EfficientLengthIterable$(K) {
new(tree) {
this[_tree] = tree;
super.new();
@@ -27407,7 +27395,6 @@
return set;
}
}
- _SplayTreeKeyIterable[dart.implements] = () => [_internal.EfficientLength];
dart.setSignature(_SplayTreeKeyIterable, {
fields: () => ({[_tree]: _SplayTreeOfK$_SplayTreeNodeOfK()}),
getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(K), [])})
@@ -27419,7 +27406,7 @@
collection._SplayTreeValueIterable$ = dart.generic((K, V) => {
let _SplayTreeValueIteratorOfK$V = () => (_SplayTreeValueIteratorOfK$V = dart.constFn(collection._SplayTreeValueIterator$(K, V)))();
let SplayTreeMapOfK$V = () => (SplayTreeMapOfK$V = dart.constFn(collection.SplayTreeMap$(K, V)))();
- class _SplayTreeValueIterable extends core.Iterable$(V) {
+ class _SplayTreeValueIterable extends _internal.EfficientLengthIterable$(V) {
new(map) {
this[_map$0] = map;
super.new();
@@ -27434,7 +27421,6 @@
return new (_SplayTreeValueIteratorOfK$V())(this[_map$0]);
}
}
- _SplayTreeValueIterable[dart.implements] = () => [_internal.EfficientLength];
dart.setSignature(_SplayTreeValueIterable, {
fields: () => ({[_map$0]: SplayTreeMapOfK$V()}),
getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(V), [])})
@@ -27650,7 +27636,7 @@
return _;
}
clear() {
- this[_clear$]();
+ this[_clear]();
}
toSet() {
return this[_clone]();
@@ -28187,7 +28173,7 @@
core.List$ = dart.generic(E => {
let JSArrayOfE = () => (JSArrayOfE = dart.constFn(_interceptors.JSArray$(E)))();
let ListOfE = () => (ListOfE = dart.constFn(core.List$(E)))();
- let IterableOfE = () => (IterableOfE = dart.constFn(core.Iterable$(E)))();
+ let EfficientLengthIterableOfE = () => (EfficientLengthIterableOfE = dart.constFn(_internal.EfficientLengthIterable$(E)))();
class List extends core.Object {
static new(length) {
if (length === void 0) length = null;
@@ -28238,12 +28224,9 @@
let result = ListOfE().from(elements, {growable: false});
return _internal.makeFixedListUnmodifiable(E)(result);
}
- [Symbol.iterator]() {
- return new dart.JsIterator(this[dartx.iterator]);
- }
}
dart.addTypeTests(List);
- List[dart.implements] = () => [IterableOfE(), _internal.EfficientLength];
+ List[dart.implements] = () => [EfficientLengthIterableOfE()];
return List;
});
core.List = List();
@@ -28382,6 +28365,7 @@
}
};
dart.addSimpleTypeTests(convert._UnicodeSubsetEncoder);
+ convert._UnicodeSubsetEncoder[dart.implements] = () => [ChunkedConverterOfString$ListOfint$String$ListOfint()];
dart.setSignature(convert._UnicodeSubsetEncoder, {
fields: () => ({[_subsetMask]: core.int}),
methods: () => ({
@@ -28464,6 +28448,7 @@
}
};
dart.addSimpleTypeTests(convert._UnicodeSubsetDecoder);
+ convert._UnicodeSubsetDecoder[dart.implements] = () => [ChunkedConverterOfListOfint$String$ListOfint$String()];
dart.setSignature(convert._UnicodeSubsetDecoder, {
fields: () => ({
[_allowInvalid]: core.bool,
@@ -28628,6 +28613,7 @@
};
dart.addSimpleTypeTests(convert.Base64Encoder);
dart.defineNamedConstructor(convert.Base64Encoder, 'urlSafe');
+ convert.Base64Encoder[dart.implements] = () => [ChunkedConverterOfListOfint$String$ListOfint$String()];
dart.setSignature(convert.Base64Encoder, {
fields: () => ({[_urlSafe]: core.bool}),
methods: () => ({
@@ -28654,6 +28640,104 @@
get decoder() {
return const$33 || (const$33 = dart.const(new convert.Base64Decoder()));
}
+ normalize(source, start, end) {
+ if (start === void 0) start = 0;
+ if (end === void 0) end = null;
+ end = core.RangeError.checkValidRange(start, end, source[dartx.length]);
+ let percent = 37;
+ let equals = 61;
+ let buffer = null;
+ let sliceStart = start;
+ let alphabet = convert._Base64Encoder._base64Alphabet;
+ let inverseAlphabet = convert._Base64Decoder._inverseAlphabet;
+ let firstPadding = -1;
+ let firstPaddingSourceIndex = -1;
+ let paddingCount = 0;
+ for (let i = start; dart.notNull(i) < dart.notNull(end);) {
+ let sliceEnd = i;
+ let char = source[dartx.codeUnitAt]((() => {
+ let x = i;
+ i = dart.notNull(x) + 1;
+ return x;
+ })());
+ let originalChar = char;
+ if (char == percent) {
+ if (dart.notNull(i) + 2 <= dart.notNull(end)) {
+ char = _internal.parseHexByte(source, i);
+ i = dart.notNull(i) + 2;
+ if (char == percent) char = -1;
+ } else {
+ char = -1;
+ }
+ }
+ if (0 <= dart.notNull(char) && dart.notNull(char) <= 127) {
+ let value = inverseAlphabet[dartx._get](char);
+ if (dart.notNull(value) >= 0) {
+ char = alphabet[dartx.codeUnitAt](value);
+ if (char == originalChar) continue;
+ } else if (value == convert._Base64Decoder._padding) {
+ if (dart.notNull(firstPadding) < 0) {
+ firstPadding = (() => {
+ let l = dart.nullSafe(buffer, _ => _.length);
+ return l != null ? l : 0;
+ })() + (dart.notNull(sliceEnd) - dart.notNull(sliceStart));
+ firstPaddingSourceIndex = sliceEnd;
+ }
+ paddingCount = dart.notNull(paddingCount) + 1;
+ if (originalChar == equals) continue;
+ }
+ if (value != convert._Base64Decoder._invalid) {
+ let t = buffer;
+ t == null ? buffer = new core.StringBuffer() : t;
+ buffer.write(source[dartx.substring](sliceStart, sliceEnd));
+ buffer.writeCharCode(char);
+ sliceStart = i;
+ continue;
+ }
+ }
+ dart.throw(new core.FormatException("Invalid base64 data", source, sliceEnd));
+ }
+ if (buffer != null) {
+ buffer.write(source[dartx.substring](sliceStart, end));
+ if (dart.notNull(firstPadding) >= 0) {
+ convert.Base64Codec._checkPadding(source, firstPaddingSourceIndex, end, firstPadding, paddingCount, buffer.length);
+ } else {
+ let endLength = (dart.notNull(buffer.length) - 1)[dartx['%']](4) + 1;
+ if (endLength == 1) {
+ dart.throw(new core.FormatException("Invalid base64 encoding length ", source, end));
+ }
+ while (dart.notNull(endLength) < 4) {
+ buffer.write("=");
+ endLength = dart.notNull(endLength) + 1;
+ }
+ }
+ return source[dartx.replaceRange](start, end, dart.toString(buffer));
+ }
+ let length = dart.notNull(end) - dart.notNull(start);
+ if (dart.notNull(firstPadding) >= 0) {
+ convert.Base64Codec._checkPadding(source, firstPaddingSourceIndex, end, firstPadding, paddingCount, length);
+ } else {
+ let endLength = length[dartx['%']](4);
+ if (endLength == 1) {
+ dart.throw(new core.FormatException("Invalid base64 encoding length ", source, end));
+ }
+ if (dart.notNull(endLength) > 1) {
+ source = source[dartx.replaceRange](end, end, endLength == 2 ? "==" : "=");
+ }
+ }
+ return source;
+ }
+ static _checkPadding(source, sourceIndex, sourceEnd, firstPadding, paddingCount, length) {
+ if (length[dartx['%']](4) != 0) {
+ dart.throw(new core.FormatException("Invalid base64 padding, padded length must be multiple of four, " + dart.str`is ${length}`, source, sourceEnd));
+ }
+ if (dart.notNull(firstPadding) + dart.notNull(paddingCount) != length) {
+ dart.throw(new core.FormatException("Invalid base64 padding, '=' not at the end", source, sourceIndex));
+ }
+ if (dart.notNull(paddingCount) > 2) {
+ dart.throw(new core.FormatException("Invalid base64 padding, more than two '=' characters", source, sourceIndex));
+ }
+ }
};
dart.addSimpleTypeTests(convert.Base64Codec);
dart.defineNamedConstructor(convert.Base64Codec, 'urlSafe');
@@ -28662,7 +28746,10 @@
getters: () => ({
encoder: dart.definiteFunctionType(convert.Base64Encoder, []),
decoder: dart.definiteFunctionType(convert.Base64Decoder, [])
- })
+ }),
+ methods: () => ({normalize: dart.definiteFunctionType(core.String, [core.String], [core.int, core.int])}),
+ statics: () => ({_checkPadding: dart.definiteFunctionType(core.int, [core.String, core.int, core.int, core.int, core.int, core.int])}),
+ names: ['_checkPadding']
});
convert.BASE64 = dart.const(new convert.Base64Codec());
convert.BASE64URL = dart.const(new convert.Base64Codec.urlSafe());
@@ -28926,6 +29013,7 @@
}
};
dart.addSimpleTypeTests(convert.Base64Decoder);
+ convert.Base64Decoder[dart.implements] = () => [ChunkedConverterOfString$ListOfint$String$ListOfint()];
dart.setSignature(convert.Base64Decoder, {
methods: () => ({
convert: dart.definiteFunctionType(core.List$(core.int), [core.String], [core.int, core.int]),
@@ -29454,6 +29542,7 @@
});
convert._InvertedCodec = _InvertedCodec();
convert._FusedConverter$ = dart.generic((S, M, T) => {
+ let ChunkedConverterOfS$T$S$T = () => (ChunkedConverterOfS$T$S$T = dart.constFn(convert.ChunkedConverter$(S, T, S, T)))();
let ConverterOfS$M = () => (ConverterOfS$M = dart.constFn(convert.Converter$(S, M)))();
let ConverterOfM$T = () => (ConverterOfM$T = dart.constFn(convert.Converter$(M, T)))();
let SinkOfT = () => (SinkOfT = dart.constFn(core.Sink$(T)))();
@@ -29472,6 +29561,7 @@
return this[_first$0].startChunkedConversion(this[_second].startChunkedConversion(sink));
}
}
+ _FusedConverter[dart.implements] = () => [ChunkedConverterOfS$T$S$T()];
dart.setSignature(_FusedConverter, {
fields: () => ({
[_first$0]: ConverterOfS$M(),
@@ -29606,6 +29696,7 @@
}
};
dart.addSimpleTypeTests(convert.HtmlEscape);
+ convert.HtmlEscape[dart.implements] = () => [ChunkedConverterOfString$String$String$String()];
dart.setSignature(convert.HtmlEscape, {
fields: () => ({mode: convert.HtmlEscapeMode}),
methods: () => ({
@@ -29765,6 +29856,7 @@
};
dart.addSimpleTypeTests(convert.JsonEncoder);
dart.defineNamedConstructor(convert.JsonEncoder, 'withIndent');
+ convert.JsonEncoder[dart.implements] = () => [ChunkedConverterOfObject$String$Object$String()];
dart.setSignature(convert.JsonEncoder, {
fields: () => ({
indent: core.String,
@@ -29837,6 +29929,7 @@
}
};
dart.addSimpleTypeTests(convert.JsonUtf8Encoder);
+ convert.JsonUtf8Encoder[dart.implements] = () => [ChunkedConverterOfObject$ListOfint$Object$ListOfint()];
dart.setSignature(convert.JsonUtf8Encoder, {
fields: () => ({
[_indent]: ListOfint(),
@@ -29944,6 +30037,7 @@
}
};
dart.addSimpleTypeTests(convert.JsonDecoder);
+ convert.JsonDecoder[dart.implements] = () => [ChunkedConverterOfString$Object$String$Object()];
dart.setSignature(convert.JsonDecoder, {
fields: () => ({[_reviver]: convert._Reviver}),
methods: () => ({
@@ -31072,6 +31166,7 @@
}
};
dart.addSimpleTypeTests(convert.Utf8Encoder);
+ convert.Utf8Encoder[dart.implements] = () => [ChunkedConverterOfString$ListOfint$String$ListOfint()];
dart.setSignature(convert.Utf8Encoder, {
methods: () => ({
convert: dart.definiteFunctionType(core.List$(core.int), [core.String], [core.int, core.int]),
@@ -31284,7 +31379,7 @@
let buffer = new core.StringBuffer();
let decoder = new convert._Utf8Decoder(buffer, this[_allowMalformed]);
decoder.convert(codeUnits, start, end);
- decoder.close();
+ decoder.flush(codeUnits, end);
return buffer.toString();
}
startChunkedConversion(sink) {
@@ -31309,6 +31404,7 @@
}
};
dart.addSimpleTypeTests(convert.Utf8Decoder);
+ convert.Utf8Decoder[dart.implements] = () => [ChunkedConverterOfListOfint$String$ListOfint$String()];
dart.setSignature(convert.Utf8Decoder, {
fields: () => ({[_allowMalformed]: core.bool}),
methods: () => ({
@@ -31358,10 +31454,12 @@
close() {
this.flush();
}
- flush() {
+ flush(source, offset) {
+ if (source === void 0) source = null;
+ if (offset === void 0) offset = null;
if (dart.test(this.hasPartialInput)) {
if (!dart.test(this[_allowMalformed])) {
- dart.throw(new core.FormatException("Unfinished UTF-8 octet sequence"));
+ dart.throw(new core.FormatException("Unfinished UTF-8 octet sequence", source, offset));
}
this[_stringSink].writeCharCode(convert.UNICODE_REPLACEMENT_CHARACTER_RUNE);
this[_value] = 0;
@@ -31405,7 +31503,7 @@
if ((dart.notNull(unit) & 192) != 128) {
expectedUnits = 0;
if (!dart.test(this[_allowMalformed])) {
- dart.throw(new core.FormatException(dart.str`Bad UTF-8 encoding 0x${unit[dartx.toRadixString](16)}`));
+ dart.throw(new core.FormatException(dart.str`Bad UTF-8 encoding 0x${unit[dartx.toRadixString](16)}`, codeUnits, i));
}
this[_isFirstCharacter] = false;
this[_stringSink].writeCharCode(convert.UNICODE_REPLACEMENT_CHARACTER_RUNE);
@@ -31418,14 +31516,14 @@
} while (dart.notNull(expectedUnits) > 0);
if (dart.notNull(value) <= dart.notNull(convert._Utf8Decoder._LIMITS[dartx._get](dart.notNull(extraUnits) - 1))) {
if (!dart.test(this[_allowMalformed])) {
- dart.throw(new core.FormatException(dart.str`Overlong encoding of 0x${value[dartx.toRadixString](16)}`));
+ dart.throw(new core.FormatException(dart.str`Overlong encoding of 0x${value[dartx.toRadixString](16)}`, codeUnits, dart.notNull(i) - dart.notNull(extraUnits) - 1));
}
expectedUnits = extraUnits = 0;
value = convert.UNICODE_REPLACEMENT_CHARACTER_RUNE;
}
if (dart.notNull(value) > convert._FOUR_BYTE_LIMIT) {
if (!dart.test(this[_allowMalformed])) {
- dart.throw(new core.FormatException("Character outside valid Unicode range: " + dart.str`0x${value[dartx.toRadixString](16)}`));
+ dart.throw(new core.FormatException("Character outside valid Unicode range: " + dart.str`0x${value[dartx.toRadixString](16)}`, codeUnits, dart.notNull(i) - dart.notNull(extraUnits) - 1));
}
value = convert.UNICODE_REPLACEMENT_CHARACTER_RUNE;
}
@@ -31449,7 +31547,7 @@
})());
if (dart.notNull(unit) < 0) {
if (!dart.test(this[_allowMalformed])) {
- dart.throw(new core.FormatException(dart.str`Negative UTF-8 code unit: -0x${(-dart.notNull(unit))[dartx.toRadixString](16)}`));
+ dart.throw(new core.FormatException(dart.str`Negative UTF-8 code unit: -0x${(-dart.notNull(unit))[dartx.toRadixString](16)}`, codeUnits, dart.notNull(i) - 1));
}
this[_stringSink].writeCharCode(convert.UNICODE_REPLACEMENT_CHARACTER_RUNE);
} else {
@@ -31470,7 +31568,7 @@
continue loop;
}
if (!dart.test(this[_allowMalformed])) {
- dart.throw(new core.FormatException(dart.str`Bad UTF-8 encoding 0x${unit[dartx.toRadixString](16)}`));
+ dart.throw(new core.FormatException(dart.str`Bad UTF-8 encoding 0x${unit[dartx.toRadixString](16)}`, codeUnits, dart.notNull(i) - 1));
}
value = convert.UNICODE_REPLACEMENT_CHARACTER_RUNE;
expectedUnits = extraUnits = 0;
@@ -31499,7 +31597,7 @@
getters: () => ({hasPartialInput: dart.definiteFunctionType(core.bool, [])}),
methods: () => ({
close: dart.definiteFunctionType(dart.void, []),
- flush: dart.definiteFunctionType(dart.void, []),
+ flush: dart.definiteFunctionType(dart.void, [], [ListOfint(), core.int]),
convert: dart.definiteFunctionType(dart.void, [ListOfint(), core.int, core.int])
})
});
@@ -31536,6 +31634,7 @@
};
core.proxy = dart.const(new core._Proxy());
dart.defineExtensionNames([
+ 'hashCode',
'toString'
]);
core.bool = class bool extends core.Object {
@@ -31543,6 +31642,9 @@
let defaultValue = opts && 'defaultValue' in opts ? opts.defaultValue : false;
dart.throw(new core.UnsupportedError('bool.fromEnvironment can only be used as a const constructor'));
}
+ get [dartx.hashCode]() {
+ return super.hashCode;
+ }
[dartx.toString]() {
return this ? "true" : "false";
}
@@ -32679,108 +32781,42 @@
return _Generator;
});
core._Generator = _Generator();
- const _end$ = Symbol('_end');
- const _start$0 = Symbol('_start');
const _generator$ = Symbol('_generator');
core._GeneratorIterable$ = dart.generic(E => {
let _GeneratorOfE = () => (_GeneratorOfE = dart.constFn(core._Generator$(E)))();
- let _GeneratorIteratorOfE = () => (_GeneratorIteratorOfE = dart.constFn(core._GeneratorIterator$(E)))();
- let EmptyIterableOfE = () => (EmptyIterableOfE = dart.constFn(_internal.EmptyIterable$(E)))();
- let _GeneratorIterableOfE = () => (_GeneratorIterableOfE = dart.constFn(core._GeneratorIterable$(E)))();
- class _GeneratorIterable extends core.Iterable$(E) {
- new(end, generator) {
- this[_end$] = end;
- this[_start$0] = 0;
+ class _GeneratorIterable extends _internal.ListIterable$(E) {
+ get length() {
+ return this[length$];
+ }
+ set length(value) {
+ super.length = value;
+ }
+ new(length, generator) {
+ this[length$] = length;
this[_generator$] = generator != null ? generator : _GeneratorOfE().as(core._GeneratorIterable._id);
super.new();
}
- slice(start, end, generator) {
- this[_start$0] = start;
- this[_end$] = end;
- this[_generator$] = generator;
- super.new();
- }
- get iterator() {
- return new (_GeneratorIteratorOfE())(this[_start$0], this[_end$], this[_generator$]);
- }
- get length() {
- return dart.notNull(this[_end$]) - dart.notNull(this[_start$0]);
- }
- skip(count) {
- core.RangeError.checkNotNegative(count, "count");
- if (count == 0) return this;
- let newStart = dart.notNull(this[_start$0]) + dart.notNull(count);
- if (newStart >= dart.notNull(this[_end$])) return new (EmptyIterableOfE())();
- return new (_GeneratorIterableOfE()).slice(newStart, this[_end$], this[_generator$]);
- }
- take(count) {
- core.RangeError.checkNotNegative(count, "count");
- if (count == 0) return new (EmptyIterableOfE())();
- let newEnd = dart.notNull(this[_start$0]) + dart.notNull(count);
- if (newEnd >= dart.notNull(this[_end$])) return this;
- return new (_GeneratorIterableOfE()).slice(this[_start$0], newEnd, this[_generator$]);
+ elementAt(index) {
+ core.RangeError.checkValidIndex(index, this);
+ return this[_generator$](index);
}
static _id(n) {
return n;
}
}
- dart.defineNamedConstructor(_GeneratorIterable, 'slice');
- _GeneratorIterable[dart.implements] = () => [_internal.EfficientLength];
+ const length$ = Symbol("_GeneratorIterable.length");
dart.setSignature(_GeneratorIterable, {
fields: () => ({
- [_start$0]: core.int,
- [_end$]: core.int,
+ length: core.int,
[_generator$]: _GeneratorOfE()
}),
- getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])}),
statics: () => ({_id: dart.definiteFunctionType(core.int, [core.int])}),
names: ['_id']
});
- dart.defineExtensionMembers(_GeneratorIterable, ['skip', 'take', 'iterator', 'length']);
+ dart.defineExtensionMembers(_GeneratorIterable, ['elementAt', 'length']);
return _GeneratorIterable;
});
core._GeneratorIterable = _GeneratorIterable();
- const _index$1 = Symbol('_index');
- const _current$3 = Symbol('_current');
- core._GeneratorIterator$ = dart.generic(E => {
- let IteratorOfE = () => (IteratorOfE = dart.constFn(core.Iterator$(E)))();
- let _GeneratorOfE = () => (_GeneratorOfE = dart.constFn(core._Generator$(E)))();
- class _GeneratorIterator extends core.Object {
- new(index, end, generator) {
- this[_index$1] = index;
- this[_end$] = end;
- this[_generator$] = generator;
- this[_current$3] = null;
- }
- moveNext() {
- if (dart.notNull(this[_index$1]) < dart.notNull(this[_end$])) {
- this[_current$3] = this[_generator$](this[_index$1]);
- this[_index$1] = dart.notNull(this[_index$1]) + 1;
- return true;
- } else {
- this[_current$3] = null;
- return false;
- }
- }
- get current() {
- return this[_current$3];
- }
- }
- dart.addTypeTests(_GeneratorIterator);
- _GeneratorIterator[dart.implements] = () => [IteratorOfE()];
- dart.setSignature(_GeneratorIterator, {
- fields: () => ({
- [_end$]: core.int,
- [_generator$]: _GeneratorOfE(),
- [_index$1]: core.int,
- [_current$3]: E
- }),
- getters: () => ({current: dart.definiteFunctionType(E, [])}),
- methods: () => ({moveNext: dart.definiteFunctionType(core.bool, [])})
- });
- return _GeneratorIterator;
- });
- core._GeneratorIterator = _GeneratorIterator();
core.BidirectionalIterator$ = dart.generic(E => {
let IteratorOfE = () => (IteratorOfE = dart.constFn(core.Iterator$(E)))();
class BidirectionalIterator extends core.Object {}
@@ -32822,6 +32858,9 @@
static _uninstantiable() {
dart.throw(new core.UnsupportedError('class Null cannot be instantiated'));
}
+ get hashCode() {
+ return super.hashCode;
+ }
toString() {
return "null";
}
@@ -32857,7 +32896,7 @@
core.RegExp[dart.implements] = () => [core.Pattern];
core.Set$ = dart.generic(E => {
let LinkedHashSetOfE = () => (LinkedHashSetOfE = dart.constFn(collection.LinkedHashSet$(E)))();
- class Set extends core.Iterable$(E) {
+ class Set extends _internal.EfficientLengthIterable$(E) {
static new() {
return LinkedHashSetOfE().new();
}
@@ -32868,7 +32907,6 @@
return LinkedHashSetOfE().from(elements);
}
}
- Set[dart.implements] = () => [_internal.EfficientLength];
return Set;
});
core.Set = Set();
@@ -32901,41 +32939,38 @@
dart.setSignature(core._StringStackTrace, {
fields: () => ({[_stackTrace]: core.String})
});
+ const _start$0 = Symbol('_start');
const _stop = Symbol('_stop');
core.Stopwatch = class Stopwatch extends core.Object {
+ new() {
+ this[_start$0] = 0;
+ this[_stop] = 0;
+ if (core.Stopwatch._frequency == null) core.Stopwatch._initTicker();
+ }
get frequency() {
return core.Stopwatch._frequency;
}
- new() {
- this[_start$0] = null;
- this[_stop] = null;
- core.Stopwatch._initTicker();
- }
start() {
- if (dart.test(this.isRunning)) return;
- if (this[_start$0] == null) {
- this[_start$0] = core.Stopwatch._now();
- } else {
- this[_start$0] = dart.notNull(core.Stopwatch._now()) - (dart.notNull(this[_stop]) - dart.notNull(this[_start$0]));
+ if (this[_stop] != null) {
+ this[_start$0] = dart.notNull(this[_start$0]) + (dart.notNull(core.Stopwatch._now()) - dart.notNull(this[_stop]));
this[_stop] = null;
}
}
stop() {
- if (!dart.test(this.isRunning)) return;
- this[_stop] = core.Stopwatch._now();
+ let t = this[_stop];
+ t == null ? this[_stop] = core.Stopwatch._now() : t;
}
reset() {
- if (this[_start$0] == null) return;
- this[_start$0] = core.Stopwatch._now();
- if (this[_stop] != null) {
- this[_stop] = this[_start$0];
- }
+ this[_start$0] = (() => {
+ let l = this[_stop];
+ return l != null ? l : core.Stopwatch._now();
+ })();
}
get elapsedTicks() {
- if (this[_start$0] == null) {
- return 0;
- }
- return this[_stop] == null ? dart.notNull(core.Stopwatch._now()) - dart.notNull(this[_start$0]) : dart.notNull(this[_stop]) - dart.notNull(this[_start$0]);
+ return dart.notNull((() => {
+ let l = this[_stop];
+ return l != null ? l : core.Stopwatch._now();
+ })()) - dart.notNull(this[_start$0]);
}
get elapsed() {
return new core.Duration({microseconds: this.elapsedMicroseconds});
@@ -32947,7 +32982,7 @@
return (dart.notNull(this.elapsedTicks) * 1000 / dart.notNull(this.frequency))[dartx.truncate]();
}
get isRunning() {
- return this[_start$0] != null && this[_stop] == null;
+ return this[_stop] == null;
}
static _initTicker() {
_js_helper.Primitives.initTicker();
@@ -33223,37 +33258,471 @@
return new _internal.Symbol(name);
}
};
+ core._SPACE = 32;
+ core._PERCENT = 37;
+ core._AMPERSAND = 38;
+ core._PLUS = 43;
+ core._DOT = 46;
+ core._SLASH = 47;
+ core._COLON = 58;
+ core._EQUALS = 61;
+ core._UPPER_CASE_A = 65;
+ core._UPPER_CASE_Z = 90;
+ core._LEFT_BRACKET = 91;
+ core._BACKSLASH = 92;
+ core._RIGHT_BRACKET = 93;
+ core._LOWER_CASE_A = 97;
+ core._LOWER_CASE_F = 102;
+ core._LOWER_CASE_Z = 122;
+ core._hexDigits = "0123456789ABCDEF";
+ core.Uri = class Uri extends core.Object {
+ static get base() {
+ let uri = _js_helper.Primitives.currentUri();
+ if (uri != null) return core.Uri.parse(uri);
+ dart.throw(new core.UnsupportedError("'Uri.base' is not supported"));
+ }
+ static new(opts) {
+ return core._Uri.new(opts);
+ }
+ static http(authority, unencodedPath, queryParameters) {
+ return core._Uri.http(authority, unencodedPath, queryParameters);
+ }
+ static https(authority, unencodedPath, queryParameters) {
+ return core._Uri.https(authority, unencodedPath, queryParameters);
+ }
+ static file(path, opts) {
+ return core._Uri.file(path, opts);
+ }
+ static directory(path, opts) {
+ return core._Uri.directory(path, opts);
+ }
+ static dataFromString(content, opts) {
+ let mimeType = opts && 'mimeType' in opts ? opts.mimeType : null;
+ let encoding = opts && 'encoding' in opts ? opts.encoding : null;
+ let parameters = opts && 'parameters' in opts ? opts.parameters : null;
+ let base64 = opts && 'base64' in opts ? opts.base64 : false;
+ let data = core.UriData.fromString(content, {mimeType: mimeType, encoding: encoding, parameters: parameters, base64: base64});
+ return data.uri;
+ }
+ static dataFromBytes(bytes, opts) {
+ let mimeType = opts && 'mimeType' in opts ? opts.mimeType : "application/octet-stream";
+ let parameters = opts && 'parameters' in opts ? opts.parameters : null;
+ let percentEncoded = opts && 'percentEncoded' in opts ? opts.percentEncoded : false;
+ let data = core.UriData.fromBytes(bytes, {mimeType: mimeType, parameters: parameters, percentEncoded: percentEncoded});
+ return data.uri;
+ }
+ get hasScheme() {
+ return this.scheme[dartx.isNotEmpty];
+ }
+ static parse(uri, start, end) {
+ if (start === void 0) start = 0;
+ if (end === void 0) end = null;
+ let t = end;
+ t == null ? end = uri[dartx.length] : t;
+ if (dart.notNull(end) >= dart.notNull(start) + 5) {
+ let dataDelta = core._startsWithData(uri, start);
+ if (dataDelta == 0) {
+ if (dart.notNull(start) > 0 || dart.notNull(end) < dart.notNull(uri[dartx.length])) uri = uri[dartx.substring](start, end);
+ return core.UriData._parse(uri, 5, null).uri;
+ } else if (dataDelta == 32) {
+ return core.UriData._parse(uri[dartx.substring](dart.notNull(start) + 5, end), 0, null).uri;
+ }
+ }
+ let indices = ListOfint().new(8);
+ indices[dartx._set](0, 0);
+ indices[dartx._set](core._schemeEndIndex, dart.notNull(start) - 1);
+ indices[dartx._set](core._hostStartIndex, dart.notNull(start) - 1);
+ indices[dartx._set](core._notSimpleIndex, dart.notNull(start) - 1);
+ indices[dartx._set](core._portStartIndex, start);
+ indices[dartx._set](core._pathStartIndex, start);
+ indices[dartx._set](core._queryStartIndex, end);
+ indices[dartx._set](core._fragmentStartIndex, end);
+ let state = core._scan(uri, start, end, core._uriStart, indices);
+ if (dart.notNull(state) >= core._nonSimpleEndStates) {
+ indices[dartx._set](core._notSimpleIndex, end);
+ }
+ let schemeEnd = indices[dartx._get](core._schemeEndIndex);
+ if (dart.notNull(schemeEnd) >= dart.notNull(start)) {
+ state = core._scan(uri, start, schemeEnd, core._schemeStart, indices);
+ if (state == core._schemeStart) {
+ indices[dartx._set](core._notSimpleIndex, schemeEnd);
+ }
+ }
+ let hostStart = dart.notNull(indices[dartx._get](core._hostStartIndex)) + 1;
+ let portStart = indices[dartx._get](core._portStartIndex);
+ let pathStart = indices[dartx._get](core._pathStartIndex);
+ let queryStart = indices[dartx._get](core._queryStartIndex);
+ let fragmentStart = indices[dartx._get](core._fragmentStartIndex);
+ let scheme = null;
+ if (dart.notNull(fragmentStart) < dart.notNull(queryStart)) queryStart = fragmentStart;
+ if (dart.notNull(pathStart) < dart.notNull(hostStart) || dart.notNull(pathStart) <= dart.notNull(schemeEnd)) {
+ pathStart = queryStart;
+ }
+ if (dart.notNull(portStart) < dart.notNull(hostStart)) portStart = pathStart;
+ dart.assert(hostStart == start || dart.notNull(schemeEnd) <= dart.notNull(hostStart));
+ dart.assert(dart.notNull(hostStart) <= dart.notNull(portStart));
+ dart.assert(dart.notNull(schemeEnd) <= dart.notNull(pathStart));
+ dart.assert(dart.notNull(portStart) <= dart.notNull(pathStart));
+ dart.assert(dart.notNull(pathStart) <= dart.notNull(queryStart));
+ dart.assert(dart.notNull(queryStart) <= dart.notNull(fragmentStart));
+ let isSimple = dart.notNull(indices[dartx._get](core._notSimpleIndex)) < dart.notNull(start);
+ if (isSimple) {
+ if (dart.notNull(hostStart) > dart.notNull(schemeEnd) + 3) {
+ isSimple = false;
+ } else if (dart.notNull(portStart) > dart.notNull(start) && dart.notNull(portStart) + 1 == pathStart) {
+ isSimple = false;
+ } else if (dart.notNull(queryStart) < dart.notNull(end) && queryStart == dart.notNull(pathStart) + 2 && dart.test(uri[dartx.startsWith]("..", pathStart)) || dart.notNull(queryStart) > dart.notNull(pathStart) + 2 && dart.test(uri[dartx.startsWith]("/..", dart.notNull(queryStart) - 3))) {
+ isSimple = false;
+ } else {
+ if (schemeEnd == dart.notNull(start) + 4) {
+ if (dart.test(uri[dartx.startsWith]("file", start))) {
+ scheme = "file";
+ if (dart.notNull(hostStart) <= dart.notNull(start)) {
+ let schemeAuth = "file://";
+ let delta = 2;
+ if (!dart.test(uri[dartx.startsWith]("/", pathStart))) {
+ schemeAuth = "file:///";
+ delta = 3;
+ }
+ uri = schemeAuth + dart.notNull(uri[dartx.substring](pathStart, end));
+ schemeEnd = dart.notNull(schemeEnd) - dart.notNull(start);
+ hostStart = 7;
+ portStart = 7;
+ pathStart = 7;
+ queryStart = dart.notNull(queryStart) + (delta - dart.notNull(start));
+ fragmentStart = dart.notNull(fragmentStart) + (delta - dart.notNull(start));
+ start = 0;
+ end = uri[dartx.length];
+ } else if (pathStart == queryStart) {
+ if (start == 0 && end == uri[dartx.length]) {
+ uri = uri[dartx.replaceRange](pathStart, queryStart, "/");
+ queryStart = dart.notNull(queryStart) + 1;
+ fragmentStart = dart.notNull(fragmentStart) + 1;
+ end = dart.notNull(end) + 1;
+ } else {
+ uri = dart.str`${uri[dartx.substring](start, pathStart)}/` + dart.str`${uri[dartx.substring](queryStart, end)}`;
+ schemeEnd = dart.notNull(schemeEnd) - dart.notNull(start);
+ hostStart = dart.notNull(hostStart) - dart.notNull(start);
+ portStart = dart.notNull(portStart) - dart.notNull(start);
+ pathStart = dart.notNull(pathStart) - dart.notNull(start);
+ queryStart = dart.notNull(queryStart) + (1 - dart.notNull(start));
+ fragmentStart = dart.notNull(fragmentStart) + (1 - dart.notNull(start));
+ start = 0;
+ end = uri[dartx.length];
+ }
+ }
+ } else if (dart.test(uri[dartx.startsWith]("http", start))) {
+ scheme = "http";
+ if (dart.notNull(portStart) > dart.notNull(start) && dart.notNull(portStart) + 3 == pathStart && dart.test(uri[dartx.startsWith]("80", dart.notNull(portStart) + 1))) {
+ if (start == 0 && end == uri[dartx.length]) {
+ uri = uri[dartx.replaceRange](portStart, pathStart, "");
+ pathStart = dart.notNull(pathStart) - 3;
+ queryStart = dart.notNull(queryStart) - 3;
+ fragmentStart = dart.notNull(fragmentStart) - 3;
+ end = dart.notNull(end) - 3;
+ } else {
+ uri = dart.notNull(uri[dartx.substring](start, portStart)) + dart.notNull(uri[dartx.substring](pathStart, end));
+ schemeEnd = dart.notNull(schemeEnd) - dart.notNull(start);
+ hostStart = dart.notNull(hostStart) - dart.notNull(start);
+ portStart = dart.notNull(portStart) - dart.notNull(start);
+ pathStart = dart.notNull(pathStart) - (3 + dart.notNull(start));
+ queryStart = dart.notNull(queryStart) - (3 + dart.notNull(start));
+ fragmentStart = dart.notNull(fragmentStart) - (3 + dart.notNull(start));
+ start = 0;
+ end = uri[dartx.length];
+ }
+ }
+ }
+ } else if (schemeEnd == dart.notNull(start) + 5 && dart.test(uri[dartx.startsWith]("https", start))) {
+ scheme = "https";
+ if (dart.notNull(portStart) > dart.notNull(start) && dart.notNull(portStart) + 4 == pathStart && dart.test(uri[dartx.startsWith]("443", dart.notNull(portStart) + 1))) {
+ if (start == 0 && end == uri[dartx.length]) {
+ uri = uri[dartx.replaceRange](portStart, pathStart, "");
+ pathStart = dart.notNull(pathStart) - 4;
+ queryStart = dart.notNull(queryStart) - 4;
+ fragmentStart = dart.notNull(fragmentStart) - 4;
+ end = dart.notNull(end) - 3;
+ } else {
+ uri = dart.notNull(uri[dartx.substring](start, portStart)) + dart.notNull(uri[dartx.substring](pathStart, end));
+ schemeEnd = dart.notNull(schemeEnd) - dart.notNull(start);
+ hostStart = dart.notNull(hostStart) - dart.notNull(start);
+ portStart = dart.notNull(portStart) - dart.notNull(start);
+ pathStart = dart.notNull(pathStart) - (4 + dart.notNull(start));
+ queryStart = dart.notNull(queryStart) - (4 + dart.notNull(start));
+ fragmentStart = dart.notNull(fragmentStart) - (4 + dart.notNull(start));
+ start = 0;
+ end = uri[dartx.length];
+ }
+ }
+ }
+ }
+ }
+ if (isSimple) {
+ if (dart.notNull(start) > 0 || dart.notNull(end) < dart.notNull(uri[dartx.length])) {
+ uri = uri[dartx.substring](start, end);
+ schemeEnd = dart.notNull(schemeEnd) - dart.notNull(start);
+ hostStart = dart.notNull(hostStart) - dart.notNull(start);
+ portStart = dart.notNull(portStart) - dart.notNull(start);
+ pathStart = dart.notNull(pathStart) - dart.notNull(start);
+ queryStart = dart.notNull(queryStart) - dart.notNull(start);
+ fragmentStart = dart.notNull(fragmentStart) - dart.notNull(start);
+ }
+ return new core._SimpleUri(uri, schemeEnd, hostStart, portStart, pathStart, queryStart, fragmentStart, scheme);
+ }
+ return core._Uri.notSimple(uri, start, end, schemeEnd, hostStart, portStart, pathStart, queryStart, fragmentStart, scheme);
+ }
+ static encodeComponent(component) {
+ return core._Uri._uriEncode(core._Uri._unreserved2396Table, component, convert.UTF8, false);
+ }
+ static encodeQueryComponent(component, opts) {
+ let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
+ return core._Uri._uriEncode(core._Uri._unreservedTable, component, encoding, true);
+ }
+ static decodeComponent(encodedComponent) {
+ return core._Uri._uriDecode(encodedComponent, 0, encodedComponent[dartx.length], convert.UTF8, false);
+ }
+ static decodeQueryComponent(encodedComponent, opts) {
+ let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
+ return core._Uri._uriDecode(encodedComponent, 0, encodedComponent[dartx.length], encoding, true);
+ }
+ static encodeFull(uri) {
+ return core._Uri._uriEncode(core._Uri._encodeFullTable, uri, convert.UTF8, false);
+ }
+ static decodeFull(uri) {
+ return core._Uri._uriDecode(uri, 0, uri[dartx.length], convert.UTF8, false);
+ }
+ static splitQueryString(query, opts) {
+ let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
+ return query[dartx.split]("&")[dartx.fold](MapOfString$String())(dart.map({}, core.String, core.String), dart.fn((map, element) => {
+ let index = element[dartx.indexOf]("=");
+ if (index == -1) {
+ if (element != "") {
+ map[dartx._set](core.Uri.decodeQueryComponent(element, {encoding: encoding}), "");
+ }
+ } else if (index != 0) {
+ let key = element[dartx.substring](0, index);
+ let value = element[dartx.substring](dart.notNull(index) + 1);
+ map[dartx._set](core.Uri.decodeQueryComponent(key, {encoding: encoding}), core.Uri.decodeQueryComponent(value, {encoding: encoding}));
+ }
+ return map;
+ }, MapOfString$StringAndStringToMapOfString$String()));
+ }
+ static parseIPv4Address(host) {
+ return core.Uri._parseIPv4Address(host, 0, host[dartx.length]);
+ }
+ static _parseIPv4Address(host, start, end) {
+ function error(msg, position) {
+ dart.throw(new core.FormatException(dart.str`Illegal IPv4 address, ${msg}`, host, position));
+ }
+ dart.fn(error, StringAndintTovoid());
+ let result = typed_data.Uint8List.new(4);
+ let partIndex = 0;
+ let partStart = start;
+ for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(i) + 1) {
+ let char = host[dartx.codeUnitAt](i);
+ if (char != core._DOT) {
+ if ((dart.notNull(char) ^ 48) >>> 0 > 9) {
+ error("invalid character", i);
+ }
+ } else {
+ if (partIndex == 3) {
+ error('IPv4 address should contain exactly 4 parts', i);
+ }
+ let part = core.int.parse(host[dartx.substring](partStart, i));
+ if (dart.notNull(part) > 255) {
+ error("each part must be in the range 0..255", partStart);
+ }
+ result[dartx._set](partIndex++, part);
+ partStart = dart.notNull(i) + 1;
+ }
+ }
+ if (partIndex != 3) {
+ error('IPv4 address should contain exactly 4 parts', end);
+ }
+ let part = core.int.parse(host[dartx.substring](partStart, end));
+ if (dart.notNull(part) > 255) {
+ error("each part must be in the range 0..255", partStart);
+ }
+ result[dartx._set](partIndex, part);
+ return result;
+ }
+ static parseIPv6Address(host, start, end) {
+ if (start === void 0) start = 0;
+ if (end === void 0) end = null;
+ if (end == null) end = host[dartx.length];
+ function error(msg, position) {
+ if (position === void 0) position = null;
+ dart.throw(new core.FormatException(dart.str`Illegal IPv6 address, ${msg}`, host, core.int._check(position)));
+ }
+ dart.fn(error, String__Tovoid());
+ function parseHex(start, end) {
+ if (dart.notNull(end) - dart.notNull(start) > 4) {
+ error('an IPv6 part can only contain a maximum of 4 hex digits', start);
+ }
+ let value = core.int.parse(host[dartx.substring](start, end), {radix: 16});
+ if (dart.notNull(value) < 0 || dart.notNull(value) > 65535) {
+ error('each part must be in the range of `0x0..0xFFFF`', start);
+ }
+ return value;
+ }
+ dart.fn(parseHex, intAndintToint());
+ if (dart.notNull(host[dartx.length]) < 2) error('address is too short');
+ let parts = JSArrayOfint().of([]);
+ let wildcardSeen = false;
+ let seenDot = false;
+ let partStart = start;
+ for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(i) + 1) {
+ let char = host[dartx.codeUnitAt](i);
+ if (char == core._COLON) {
+ if (i == start) {
+ i = dart.notNull(i) + 1;
+ if (host[dartx.codeUnitAt](i) != core._COLON) {
+ error('invalid start colon.', i);
+ }
+ partStart = i;
+ }
+ if (i == partStart) {
+ if (wildcardSeen) {
+ error('only one wildcard `::` is allowed', i);
+ }
+ wildcardSeen = true;
+ parts[dartx.add](-1);
+ } else {
+ parts[dartx.add](parseHex(partStart, i));
+ }
+ partStart = dart.notNull(i) + 1;
+ } else if (char == core._DOT) {
+ seenDot = true;
+ }
+ }
+ if (parts[dartx.length] == 0) error('too few parts');
+ let atEnd = partStart == end;
+ let isLastWildcard = parts[dartx.last] == -1;
+ if (atEnd && !isLastWildcard) {
+ error('expected a part after last `:`', end);
+ }
+ if (!atEnd) {
+ if (!seenDot) {
+ parts[dartx.add](parseHex(partStart, end));
+ } else {
+ let last = core.Uri._parseIPv4Address(host, partStart, end);
+ parts[dartx.add]((dart.notNull(last[dartx._get](0)) << 8 | dart.notNull(last[dartx._get](1))) >>> 0);
+ parts[dartx.add]((dart.notNull(last[dartx._get](2)) << 8 | dart.notNull(last[dartx._get](3))) >>> 0);
+ }
+ }
+ if (wildcardSeen) {
+ if (dart.notNull(parts[dartx.length]) > 7) {
+ error('an address with a wildcard must have less than 7 parts');
+ }
+ } else if (parts[dartx.length] != 8) {
+ error('an address without a wildcard must contain exactly 8 parts');
+ }
+ let bytes = typed_data.Uint8List.new(16);
+ for (let i = 0, index = 0; i < dart.notNull(parts[dartx.length]); i++) {
+ let value = parts[dartx._get](i);
+ if (value == -1) {
+ let wildCardLength = 9 - dart.notNull(parts[dartx.length]);
+ for (let j = 0; j < wildCardLength; j++) {
+ bytes[dartx._set](index, 0);
+ bytes[dartx._set](index + 1, 0);
+ index = index + 2;
+ }
+ } else {
+ bytes[dartx._set](index, value[dartx['>>']](8));
+ bytes[dartx._set](index + 1, dart.notNull(value) & 255);
+ index = index + 2;
+ }
+ }
+ return bytes;
+ }
+ };
+ dart.setSignature(core.Uri, {
+ getters: () => ({hasScheme: dart.definiteFunctionType(core.bool, [])}),
+ statics: () => ({
+ parse: dart.definiteFunctionType(core.Uri, [core.String], [core.int, core.int]),
+ encodeComponent: dart.definiteFunctionType(core.String, [core.String]),
+ encodeQueryComponent: dart.definiteFunctionType(core.String, [core.String], {encoding: convert.Encoding}),
+ decodeComponent: dart.definiteFunctionType(core.String, [core.String]),
+ decodeQueryComponent: dart.definiteFunctionType(core.String, [core.String], {encoding: convert.Encoding}),
+ encodeFull: dart.definiteFunctionType(core.String, [core.String]),
+ decodeFull: dart.definiteFunctionType(core.String, [core.String]),
+ splitQueryString: dart.definiteFunctionType(core.Map$(core.String, core.String), [core.String], {encoding: convert.Encoding}),
+ parseIPv4Address: dart.definiteFunctionType(core.List$(core.int), [core.String]),
+ _parseIPv4Address: dart.definiteFunctionType(core.List$(core.int), [core.String, core.int, core.int]),
+ parseIPv6Address: dart.definiteFunctionType(core.List$(core.int), [core.String], [core.int, core.int])
+ }),
+ names: ['parse', 'encodeComponent', 'encodeQueryComponent', 'decodeComponent', 'decodeQueryComponent', 'encodeFull', 'decodeFull', 'splitQueryString', 'parseIPv4Address', '_parseIPv4Address', 'parseIPv6Address']
+ });
const _userInfo = Symbol('_userInfo');
const _host = Symbol('_host');
const _port = Symbol('_port');
- const _path = Symbol('_path');
const _query = Symbol('_query');
const _fragment = Symbol('_fragment');
const _pathSegments = Symbol('_pathSegments');
+ const _text = Symbol('_text');
+ const _hashCodeCache = Symbol('_hashCodeCache');
const _queryParameters = Symbol('_queryParameters');
const _queryParameterLists = Symbol('_queryParameterLists');
const _writeAuthority = Symbol('_writeAuthority');
let const$51;
const _mergePaths = Symbol('_mergePaths');
- const _toWindowsFilePath = Symbol('_toWindowsFilePath');
const _toFilePath = Symbol('_toFilePath');
const _isPathAbsolute = Symbol('_isPathAbsolute');
- core.Uri = class Uri extends core.Object {
+ const _initializeText = Symbol('_initializeText');
+ core._Uri = class _Uri extends core.Object {
_internal(scheme, userInfo, host, port, path, query, fragment) {
this.scheme = scheme;
this[_userInfo] = userInfo;
this[_host] = host;
this[_port] = port;
- this[_path] = path;
+ this.path = path;
this[_query] = query;
this[_fragment] = fragment;
this[_pathSegments] = null;
+ this[_text] = null;
+ this[_hashCodeCache] = null;
this[_queryParameters] = null;
this[_queryParameterLists] = null;
}
+ static notSimple(uri, start, end, schemeEnd, hostStart, portStart, pathStart, queryStart, fragmentStart, scheme) {
+ if (scheme == null) {
+ scheme = "";
+ if (dart.notNull(schemeEnd) > dart.notNull(start)) {
+ scheme = core._Uri._makeScheme(uri, start, schemeEnd);
+ } else if (schemeEnd == start) {
+ core._Uri._fail(uri, start, "Invalid empty scheme");
+ }
+ }
+ let userInfo = "";
+ let host = null;
+ let port = null;
+ if (dart.notNull(hostStart) > dart.notNull(start)) {
+ let userInfoStart = dart.notNull(schemeEnd) + 3;
+ if (userInfoStart < dart.notNull(hostStart)) {
+ userInfo = core._Uri._makeUserInfo(uri, userInfoStart, dart.notNull(hostStart) - 1);
+ }
+ host = core._Uri._makeHost(uri, hostStart, portStart, false);
+ if (dart.notNull(portStart) + 1 < dart.notNull(pathStart)) {
+ port = core.int.parse(uri[dartx.substring](dart.notNull(portStart) + 1, pathStart), {onError: dart.fn(_ => {
+ dart.throw(new core.FormatException("Invalid port", uri, dart.notNull(portStart) + 1));
+ }, StringToNull())});
+ port = core._Uri._makePort(port, scheme);
+ }
+ }
+ let path = core._Uri._makePath(uri, pathStart, queryStart, null, scheme, host != null);
+ let query = null;
+ if (dart.notNull(queryStart) < dart.notNull(fragmentStart)) {
+ query = core._Uri._makeQuery(uri, dart.notNull(queryStart) + 1, fragmentStart, null);
+ }
+ let fragment = null;
+ if (dart.notNull(fragmentStart) < dart.notNull(end)) {
+ fragment = core._Uri._makeFragment(uri, dart.notNull(fragmentStart) + 1, end);
+ }
+ return new core._Uri._internal(scheme, userInfo, host, port, path, query, fragment);
+ }
static new(opts) {
- let scheme = opts && 'scheme' in opts ? opts.scheme : "";
- let userInfo = opts && 'userInfo' in opts ? opts.userInfo : "";
+ let scheme = opts && 'scheme' in opts ? opts.scheme : null;
+ let userInfo = opts && 'userInfo' in opts ? opts.userInfo : null;
let host = opts && 'host' in opts ? opts.host : null;
let port = opts && 'port' in opts ? opts.port : null;
let path = opts && 'path' in opts ? opts.path : null;
@@ -33261,33 +33730,37 @@
let query = opts && 'query' in opts ? opts.query : null;
let queryParameters = opts && 'queryParameters' in opts ? opts.queryParameters : null;
let fragment = opts && 'fragment' in opts ? opts.fragment : null;
- scheme = core.Uri._makeScheme(scheme, 0, core.Uri._stringOrNullLength(scheme));
- userInfo = core.Uri._makeUserInfo(userInfo, 0, core.Uri._stringOrNullLength(userInfo));
- host = core.Uri._makeHost(host, 0, core.Uri._stringOrNullLength(host), false);
+ scheme = core._Uri._makeScheme(scheme, 0, core._stringOrNullLength(scheme));
+ userInfo = core._Uri._makeUserInfo(userInfo, 0, core._stringOrNullLength(userInfo));
+ host = core._Uri._makeHost(host, 0, core._stringOrNullLength(host), false);
if (query == "") query = null;
- query = core.Uri._makeQuery(query, 0, core.Uri._stringOrNullLength(query), queryParameters);
- fragment = core.Uri._makeFragment(fragment, 0, core.Uri._stringOrNullLength(fragment));
- port = core.Uri._makePort(port, scheme);
+ query = core._Uri._makeQuery(query, 0, core._stringOrNullLength(query), queryParameters);
+ fragment = core._Uri._makeFragment(fragment, 0, core._stringOrNullLength(fragment));
+ port = core._Uri._makePort(port, scheme);
let isFile = scheme == "file";
if (host == null && (dart.test(userInfo[dartx.isNotEmpty]) || port != null || isFile)) {
host = "";
}
let hasAuthority = host != null;
- path = core.Uri._makePath(path, 0, core.Uri._stringOrNullLength(path), pathSegments, scheme, hasAuthority);
+ path = core._Uri._makePath(path, 0, core._stringOrNullLength(path), pathSegments, scheme, hasAuthority);
if (dart.test(scheme[dartx.isEmpty]) && host == null && !dart.test(path[dartx.startsWith]('/'))) {
- path = core.Uri._normalizeRelativePath(path);
+ let allowScheme = dart.test(scheme[dartx.isNotEmpty]) || host != null;
+ path = core._Uri._normalizeRelativePath(path, allowScheme);
} else {
- path = core.Uri._removeDotSegments(path);
+ path = core._Uri._removeDotSegments(path);
}
- return new core.Uri._internal(scheme, userInfo, host, port, path, query, fragment);
+ if (host == null && dart.test(path[dartx.startsWith]("//"))) {
+ host = "";
+ }
+ return new core._Uri._internal(scheme, userInfo, host, port, path, query, fragment);
}
static http(authority, unencodedPath, queryParameters) {
if (queryParameters === void 0) queryParameters = null;
- return core.Uri._makeHttpUri("http", authority, unencodedPath, queryParameters);
+ return core._Uri._check(core._Uri._makeHttpUri("http", authority, unencodedPath, queryParameters));
}
static https(authority, unencodedPath, queryParameters) {
if (queryParameters === void 0) queryParameters = null;
- return core.Uri._makeHttpUri("https", authority, unencodedPath, queryParameters);
+ return core._Uri._check(core._Uri._makeHttpUri("https", authority, unencodedPath, queryParameters));
}
get authority() {
if (!dart.test(this.hasAuthority)) return "";
@@ -33306,7 +33779,7 @@
return this[_host];
}
get port() {
- if (this[_port] == null) return core.Uri._defaultPort(this.scheme);
+ if (this[_port] == null) return core._Uri._defaultPort(this.scheme);
return this[_port];
}
static _defaultPort(scheme) {
@@ -33314,181 +33787,34 @@
if (scheme == "https") return 443;
return 0;
}
- get path() {
- return this[_path];
- }
get query() {
- return this[_query] == null ? "" : this[_query];
+ return this[_query] != null ? this[_query] : "";
}
get fragment() {
- return this[_fragment] == null ? "" : this[_fragment];
+ return this[_fragment] != null ? this[_fragment] : "";
}
- static parse(uri, start, end) {
- if (start === void 0) start = 0;
- if (end === void 0) end = null;
- let EOI = -1;
- let scheme = "";
- let userinfo = "";
- let host = null;
- let port = null;
- let path = null;
- let query = null;
- let fragment = null;
- if (end == null) end = uri[dartx.length];
- let index = start;
- let pathStart = start;
- let char = EOI;
- function parseAuth() {
- if (index == end) {
- char = EOI;
- return;
- }
- let authStart = index;
- let lastColon = -1;
- let lastAt = -1;
- char = uri[dartx.codeUnitAt](index);
- while (dart.notNull(index) < dart.notNull(end)) {
- char = uri[dartx.codeUnitAt](index);
- if (char == core.Uri._SLASH || char == core.Uri._QUESTION || char == core.Uri._NUMBER_SIGN) {
- break;
- }
- if (char == core.Uri._AT_SIGN) {
- lastAt = index;
- lastColon = -1;
- } else if (char == core.Uri._COLON) {
- lastColon = index;
- } else if (char == core.Uri._LEFT_BRACKET) {
- lastColon = -1;
- let endBracket = uri[dartx.indexOf](']', dart.notNull(index) + 1);
- if (endBracket == -1) {
- index = end;
- char = EOI;
- break;
- } else {
- index = endBracket;
+ isScheme(scheme) {
+ let thisScheme = this.scheme;
+ if (scheme == null) return thisScheme[dartx.isEmpty];
+ if (scheme[dartx.length] != thisScheme[dartx.length]) return false;
+ return core._Uri._compareScheme(scheme, thisScheme);
+ }
+ static _compareScheme(scheme, uri) {
+ for (let i = 0; i < dart.notNull(scheme[dartx.length]); i++) {
+ let schemeChar = scheme[dartx.codeUnitAt](i);
+ let uriChar = uri[dartx.codeUnitAt](i);
+ let delta = (dart.notNull(schemeChar) ^ dart.notNull(uriChar)) >>> 0;
+ if (delta != 0) {
+ if (delta == 32) {
+ let lowerChar = (dart.notNull(uriChar) | delta) >>> 0;
+ if (97 <= lowerChar && lowerChar <= 122) {
+ continue;
}
}
- index = dart.notNull(index) + 1;
- char = EOI;
- }
- let hostStart = authStart;
- let hostEnd = index;
- if (dart.notNull(lastAt) >= 0) {
- userinfo = core.Uri._makeUserInfo(uri, authStart, lastAt);
- hostStart = dart.notNull(lastAt) + 1;
- }
- if (dart.notNull(lastColon) >= 0) {
- let portNumber = null;
- if (dart.notNull(lastColon) + 1 < dart.notNull(index)) {
- portNumber = 0;
- for (let i = dart.notNull(lastColon) + 1; i < dart.notNull(index); i++) {
- let digit = uri[dartx.codeUnitAt](i);
- if (core.Uri._ZERO > dart.notNull(digit) || core.Uri._NINE < dart.notNull(digit)) {
- core.Uri._fail(uri, i, "Invalid port number");
- }
- portNumber = dart.notNull(portNumber) * 10 + (dart.notNull(digit) - core.Uri._ZERO);
- }
- }
- port = core.Uri._makePort(portNumber, scheme);
- hostEnd = lastColon;
- }
- host = core.Uri._makeHost(uri, hostStart, hostEnd, true);
- if (dart.notNull(index) < dart.notNull(end)) {
- char = uri[dartx.codeUnitAt](index);
+ return false;
}
}
- dart.fn(parseAuth, VoidTovoid$());
- let NOT_IN_PATH = 0;
- let IN_PATH = 1;
- let ALLOW_AUTH = 2;
- let state = NOT_IN_PATH;
- let i = index;
- while (dart.notNull(i) < dart.notNull(end)) {
- char = uri[dartx.codeUnitAt](i);
- if (char == core.Uri._QUESTION || char == core.Uri._NUMBER_SIGN) {
- state = NOT_IN_PATH;
- break;
- }
- if (char == core.Uri._SLASH) {
- state = i == start ? ALLOW_AUTH : IN_PATH;
- break;
- }
- if (char == core.Uri._COLON) {
- if (i == start) core.Uri._fail(uri, start, "Invalid empty scheme");
- scheme = core.Uri._makeScheme(uri, start, i);
- i = dart.notNull(i) + 1;
- pathStart = i;
- if (i == end) {
- char = EOI;
- state = NOT_IN_PATH;
- } else {
- char = uri[dartx.codeUnitAt](i);
- if (char == core.Uri._QUESTION || char == core.Uri._NUMBER_SIGN) {
- state = NOT_IN_PATH;
- } else if (char == core.Uri._SLASH) {
- state = ALLOW_AUTH;
- } else {
- state = IN_PATH;
- }
- }
- break;
- }
- i = dart.notNull(i) + 1;
- char = EOI;
- }
- index = i;
- if (state == ALLOW_AUTH) {
- dart.assert(char == core.Uri._SLASH);
- index = dart.notNull(index) + 1;
- if (index == end) {
- char = EOI;
- state = NOT_IN_PATH;
- } else {
- char = uri[dartx.codeUnitAt](index);
- if (char == core.Uri._SLASH) {
- index = dart.notNull(index) + 1;
- parseAuth();
- pathStart = index;
- }
- if (char == core.Uri._QUESTION || char == core.Uri._NUMBER_SIGN || char == EOI) {
- state = NOT_IN_PATH;
- } else {
- state = IN_PATH;
- }
- }
- }
- dart.assert(state == IN_PATH || state == NOT_IN_PATH);
- if (state == IN_PATH) {
- while ((index = dart.notNull(index) + 1) < dart.notNull(end)) {
- char = uri[dartx.codeUnitAt](index);
- if (char == core.Uri._QUESTION || char == core.Uri._NUMBER_SIGN) {
- break;
- }
- char = EOI;
- }
- state = NOT_IN_PATH;
- }
- dart.assert(state == NOT_IN_PATH);
- let hasAuthority = host != null;
- path = core.Uri._makePath(uri, pathStart, index, null, scheme, hasAuthority);
- if (char == core.Uri._QUESTION) {
- let numberSignIndex = -1;
- for (let i = dart.notNull(index) + 1; i < dart.notNull(end); i++) {
- if (uri[dartx.codeUnitAt](i) == core.Uri._NUMBER_SIGN) {
- numberSignIndex = i;
- break;
- }
- }
- if (numberSignIndex < 0) {
- query = core.Uri._makeQuery(uri, dart.notNull(index) + 1, end, null);
- } else {
- query = core.Uri._makeQuery(uri, dart.notNull(index) + 1, numberSignIndex, null);
- fragment = core.Uri._makeFragment(uri, numberSignIndex + 1, end);
- }
- } else if (char == core.Uri._NUMBER_SIGN) {
- fragment = core.Uri._makeFragment(uri, dart.notNull(index) + 1, end);
- }
- return new core.Uri._internal(scheme, userinfo, host, port, path, query, fragment);
+ return true;
}
static _fail(uri, index, message) {
dart.throw(new core.FormatException(message, uri, index));
@@ -33501,7 +33827,8 @@
let hostStart = 0;
let hasUserInfo = false;
for (let i = 0; i < dart.notNull(authority[dartx.length]); i++) {
- if (authority[dartx.codeUnitAt](i) == core.Uri._AT_SIGN) {
+ let atSign = 64;
+ if (authority[dartx.codeUnitAt](i) == atSign) {
hasUserInfo = true;
userInfo = authority[dartx.substring](0, i);
hostStart = i + 1;
@@ -33509,22 +33836,22 @@
}
}
let hostEnd = hostStart;
- if (hostStart < dart.notNull(authority[dartx.length]) && authority[dartx.codeUnitAt](hostStart) == core.Uri._LEFT_BRACKET) {
+ if (hostStart < dart.notNull(authority[dartx.length]) && authority[dartx.codeUnitAt](hostStart) == core._LEFT_BRACKET) {
for (; hostEnd < dart.notNull(authority[dartx.length]); hostEnd++) {
- if (authority[dartx.codeUnitAt](hostEnd) == core.Uri._RIGHT_BRACKET) break;
+ if (authority[dartx.codeUnitAt](hostEnd) == core._RIGHT_BRACKET) break;
}
if (hostEnd == authority[dartx.length]) {
dart.throw(new core.FormatException("Invalid IPv6 host entry.", authority, hostStart));
}
core.Uri.parseIPv6Address(authority, hostStart + 1, hostEnd);
hostEnd++;
- if (hostEnd != authority[dartx.length] && authority[dartx.codeUnitAt](hostEnd) != core.Uri._COLON) {
+ if (hostEnd != authority[dartx.length] && authority[dartx.codeUnitAt](hostEnd) != core._COLON) {
dart.throw(new core.FormatException("Invalid end of authority", authority, hostEnd));
}
}
let hasPort = false;
for (; hostEnd < dart.notNull(authority[dartx.length]); hostEnd++) {
- if (authority[dartx.codeUnitAt](hostEnd) == core.Uri._COLON) {
+ if (authority[dartx.codeUnitAt](hostEnd) == core._COLON) {
let portString = authority[dartx.substring](hostEnd + 1);
if (dart.test(portString[dartx.isNotEmpty])) port = core.int.parse(portString);
break;
@@ -33536,33 +33863,13 @@
}
static file(path, opts) {
let windows = opts && 'windows' in opts ? opts.windows : null;
- windows = windows == null ? core.Uri._isWindows : windows;
- return core.Uri._check(dart.test(windows) ? core.Uri._makeWindowsFileUrl(path, false) : core.Uri._makeFileUri(path, false));
+ windows = windows == null ? core._Uri._isWindows : windows;
+ return core._Uri._check(dart.test(windows) ? core._Uri._makeWindowsFileUrl(path, false) : core._Uri._makeFileUri(path, false));
}
static directory(path, opts) {
let windows = opts && 'windows' in opts ? opts.windows : null;
- windows = windows == null ? core.Uri._isWindows : windows;
- return core.Uri._check(dart.test(windows) ? core.Uri._makeWindowsFileUrl(path, true) : core.Uri._makeFileUri(path, true));
- }
- static dataFromString(content, opts) {
- let mimeType = opts && 'mimeType' in opts ? opts.mimeType : null;
- let encoding = opts && 'encoding' in opts ? opts.encoding : null;
- let parameters = opts && 'parameters' in opts ? opts.parameters : null;
- let base64 = opts && 'base64' in opts ? opts.base64 : false;
- let data = core.UriData.fromString(content, {mimeType: mimeType, encoding: encoding, parameters: parameters, base64: base64});
- return data.uri;
- }
- static dataFromBytes(bytes, opts) {
- let mimeType = opts && 'mimeType' in opts ? opts.mimeType : "application/octet-stream";
- let parameters = opts && 'parameters' in opts ? opts.parameters : null;
- let percentEncoded = opts && 'percentEncoded' in opts ? opts.percentEncoded : false;
- let data = core.UriData.fromBytes(bytes, {mimeType: mimeType, parameters: parameters, percentEncoded: percentEncoded});
- return data.uri;
- }
- static get base() {
- let uri = _js_helper.Primitives.currentUri();
- if (uri != null) return core.Uri.parse(uri);
- dart.throw(new core.UnsupportedError("'Uri.base' is not supported"));
+ windows = windows == null ? core._Uri._isWindows : windows;
+ return core._Uri._check(dart.test(windows) ? core._Uri._makeWindowsFileUrl(path, true) : core._Uri._makeFileUri(path, true));
}
static get _isWindows() {
return false;
@@ -33591,7 +33898,7 @@
}
}
static _checkWindowsDriveLetter(charCode, argumentError) {
- if (core.Uri._UPPER_CASE_A <= dart.notNull(charCode) && dart.notNull(charCode) <= core.Uri._UPPER_CASE_Z || core.Uri._LOWER_CASE_A <= dart.notNull(charCode) && dart.notNull(charCode) <= core.Uri._LOWER_CASE_Z) {
+ if (core._UPPER_CASE_A <= dart.notNull(charCode) && dart.notNull(charCode) <= core._UPPER_CASE_Z || core._LOWER_CASE_A <= dart.notNull(charCode) && dart.notNull(charCode) <= core._LOWER_CASE_Z) {
return;
}
if (dart.test(argumentError)) {
@@ -33618,7 +33925,7 @@
path = path[dartx.replaceRange](0, 7, '\\');
} else {
path = path[dartx.substring](4);
- if (dart.notNull(path[dartx.length]) < 3 || path[dartx.codeUnitAt](1) != core.Uri._COLON || path[dartx.codeUnitAt](2) != core.Uri._BACKSLASH) {
+ if (dart.notNull(path[dartx.length]) < 3 || path[dartx.codeUnitAt](1) != core._COLON || path[dartx.codeUnitAt](2) != core._BACKSLASH) {
dart.throw(new core.ArgumentError("Windows paths with \\\\?\\ prefix must be absolute"));
}
}
@@ -33626,16 +33933,16 @@
path = path[dartx.replaceAll]("/", '\\');
}
let sep = '\\';
- if (dart.notNull(path[dartx.length]) > 1 && path[dartx.codeUnitAt](1) == core.Uri._COLON) {
- core.Uri._checkWindowsDriveLetter(path[dartx.codeUnitAt](0), true);
- if (path[dartx.length] == 2 || path[dartx.codeUnitAt](2) != core.Uri._BACKSLASH) {
+ if (dart.notNull(path[dartx.length]) > 1 && path[dartx.codeUnitAt](1) == core._COLON) {
+ core._Uri._checkWindowsDriveLetter(path[dartx.codeUnitAt](0), true);
+ if (path[dartx.length] == 2 || path[dartx.codeUnitAt](2) != core._BACKSLASH) {
dart.throw(new core.ArgumentError("Windows paths with drive letter must be absolute"));
}
let pathSegments = path[dartx.split](sep);
if (dart.test(slashTerminated) && dart.test(pathSegments[dartx.last][dartx.isNotEmpty])) {
pathSegments[dartx.add]("");
}
- core.Uri._checkWindowsPathReservedCharacters(pathSegments, true, 1);
+ core._Uri._checkWindowsPathReservedCharacters(pathSegments, true, 1);
return core.Uri.new({scheme: "file", pathSegments: pathSegments});
}
if (dart.test(path[dartx.startsWith](sep))) {
@@ -33644,7 +33951,7 @@
let hostPart = dart.notNull(pathStart) < 0 ? path[dartx.substring](2) : path[dartx.substring](2, pathStart);
let pathPart = dart.notNull(pathStart) < 0 ? "" : path[dartx.substring](dart.notNull(pathStart) + 1);
let pathSegments = pathPart[dartx.split](sep);
- core.Uri._checkWindowsPathReservedCharacters(pathSegments, true);
+ core._Uri._checkWindowsPathReservedCharacters(pathSegments, true);
if (dart.test(slashTerminated) && dart.test(pathSegments[dartx.last][dartx.isNotEmpty])) {
pathSegments[dartx.add]("");
}
@@ -33654,12 +33961,12 @@
if (dart.test(slashTerminated) && dart.test(pathSegments[dartx.last][dartx.isNotEmpty])) {
pathSegments[dartx.add]("");
}
- core.Uri._checkWindowsPathReservedCharacters(pathSegments, true);
+ core._Uri._checkWindowsPathReservedCharacters(pathSegments, true);
return core.Uri.new({scheme: "file", pathSegments: pathSegments});
}
} else {
let pathSegments = path[dartx.split](sep);
- core.Uri._checkWindowsPathReservedCharacters(pathSegments, true);
+ core._Uri._checkWindowsPathReservedCharacters(pathSegments, true);
if (dart.test(slashTerminated) && dart.test(pathSegments[dartx.isNotEmpty]) && dart.test(pathSegments[dartx.last][dartx.isNotEmpty])) {
pathSegments[dartx.add]("");
}
@@ -33678,27 +33985,27 @@
let fragment = opts && 'fragment' in opts ? opts.fragment : null;
let schemeChanged = false;
if (scheme != null) {
- scheme = core.Uri._makeScheme(scheme, 0, scheme[dartx.length]);
- schemeChanged = true;
+ scheme = core._Uri._makeScheme(scheme, 0, scheme[dartx.length]);
+ schemeChanged = scheme != this.scheme;
} else {
scheme = this.scheme;
}
let isFile = scheme == "file";
if (userInfo != null) {
- userInfo = core.Uri._makeUserInfo(userInfo, 0, userInfo[dartx.length]);
+ userInfo = core._Uri._makeUserInfo(userInfo, 0, userInfo[dartx.length]);
} else {
userInfo = this[_userInfo];
}
if (port != null) {
- port = core.Uri._makePort(port, scheme);
+ port = core._Uri._makePort(port, scheme);
} else {
port = this[_port];
if (schemeChanged) {
- port = core.Uri._makePort(port, scheme);
+ port = core._Uri._makePort(port, scheme);
}
}
if (host != null) {
- host = core.Uri._makeHost(host, 0, host[dartx.length], false);
+ host = core._Uri._makeHost(host, 0, host[dartx.length], false);
} else if (dart.test(this.hasAuthority)) {
host = this[_host];
} else if (dart.test(userInfo[dartx.isNotEmpty]) || port != null || isFile) {
@@ -33706,34 +34013,34 @@
}
let hasAuthority = host != null;
if (path != null || pathSegments != null) {
- path = core.Uri._makePath(path, 0, core.Uri._stringOrNullLength(path), pathSegments, scheme, hasAuthority);
+ path = core._Uri._makePath(path, 0, core._stringOrNullLength(path), pathSegments, scheme, hasAuthority);
} else {
- path = this[_path];
+ path = this.path;
if ((isFile || hasAuthority && !dart.test(path[dartx.isEmpty])) && !dart.test(path[dartx.startsWith]('/'))) {
path = "/" + dart.notNull(path);
}
}
if (query != null || queryParameters != null) {
- query = core.Uri._makeQuery(query, 0, core.Uri._stringOrNullLength(query), queryParameters);
+ query = core._Uri._makeQuery(query, 0, core._stringOrNullLength(query), queryParameters);
} else {
query = this[_query];
}
if (fragment != null) {
- fragment = core.Uri._makeFragment(fragment, 0, fragment[dartx.length]);
+ fragment = core._Uri._makeFragment(fragment, 0, fragment[dartx.length]);
} else {
fragment = this[_fragment];
}
- return new core.Uri._internal(scheme, userInfo, host, port, path, query, fragment);
+ return new core._Uri._internal(scheme, userInfo, host, port, path, query, fragment);
}
removeFragment() {
if (!dart.test(this.hasFragment)) return this;
- return new core.Uri._internal(this.scheme, this[_userInfo], this[_host], this[_port], this[_path], this[_query], null);
+ return new core._Uri._internal(this.scheme, this[_userInfo], this[_host], this[_port], this.path, this[_query], null);
}
get pathSegments() {
let result = this[_pathSegments];
if (result != null) return result;
let pathToSplit = this.path;
- if (dart.test(pathToSplit[dartx.isNotEmpty]) && pathToSplit[dartx.codeUnitAt](0) == core.Uri._SLASH) {
+ if (dart.test(pathToSplit[dartx.isNotEmpty]) && pathToSplit[dartx.codeUnitAt](0) == core._SLASH) {
pathToSplit = pathToSplit[dartx.substring](1);
}
result = pathToSplit == "" ? const$51 || (const$51 = dart.constList([], core.String)) : ListOfString().unmodifiable(pathToSplit[dartx.split]("/")[dartx.map](core.String)(core.Uri.decodeComponent));
@@ -33748,7 +34055,7 @@
}
get queryParametersAll() {
if (this[_queryParameterLists] == null) {
- let queryParameterLists = core.Uri._splitQueryStringAll(this.query);
+ let queryParameterLists = core._Uri._splitQueryStringAll(this.query);
for (let key of queryParameterLists[dartx.keys]) {
queryParameterLists[dartx._set](key, ListOfString().unmodifiable(core.Iterable._check(queryParameterLists[dartx._get](key))));
}
@@ -33757,36 +34064,36 @@
return this[_queryParameterLists];
}
normalizePath() {
- let path = core.Uri._normalizePath(this[_path], this.scheme, this.hasAuthority);
- if (core.identical(path, this[_path])) return this;
+ let path = core._Uri._normalizePath(this.path, this.scheme, this.hasAuthority);
+ if (core.identical(path, this.path)) return this;
return this.replace({path: path});
}
static _makePort(port, scheme) {
- if (port != null && port == core.Uri._defaultPort(scheme)) return null;
+ if (port != null && port == core._Uri._defaultPort(scheme)) return null;
return port;
}
static _makeHost(host, start, end, strictIPv6) {
if (host == null) return null;
if (start == end) return "";
- if (host[dartx.codeUnitAt](start) == core.Uri._LEFT_BRACKET) {
- if (host[dartx.codeUnitAt](dart.notNull(end) - 1) != core.Uri._RIGHT_BRACKET) {
- core.Uri._fail(host, start, 'Missing end `]` to match `[` in host');
+ if (host[dartx.codeUnitAt](start) == core._LEFT_BRACKET) {
+ if (host[dartx.codeUnitAt](dart.notNull(end) - 1) != core._RIGHT_BRACKET) {
+ core._Uri._fail(host, start, 'Missing end `]` to match `[` in host');
}
core.Uri.parseIPv6Address(host, dart.notNull(start) + 1, dart.notNull(end) - 1);
return host[dartx.substring](start, end)[dartx.toLowerCase]();
}
if (!dart.test(strictIPv6)) {
for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(i) + 1) {
- if (host[dartx.codeUnitAt](i) == core.Uri._COLON) {
+ if (host[dartx.codeUnitAt](i) == core._COLON) {
core.Uri.parseIPv6Address(host, start, end);
return dart.str`[${host}]`;
}
}
}
- return core.Uri._normalizeRegName(host, start, end);
+ return core._Uri._normalizeRegName(host, start, end);
}
static _isRegNameChar(char) {
- return dart.notNull(char) < 127 && (dart.notNull(core.Uri._regNameTable[dartx._get](char[dartx['>>']](4))) & 1 << (dart.notNull(char) & 15)) != 0;
+ return dart.notNull(char) < 127 && (dart.notNull(core._Uri._regNameTable[dartx._get](char[dartx['>>']](4))) & 1 << (dart.notNull(char) & 15)) != 0;
}
static _normalizeRegName(host, start, end) {
let buffer = null;
@@ -33795,8 +34102,8 @@
let isNormalized = true;
while (dart.notNull(index) < dart.notNull(end)) {
let char = host[dartx.codeUnitAt](index);
- if (char == core.Uri._PERCENT) {
- let replacement = core.Uri._normalizeEscape(host, index, true);
+ if (char == core._PERCENT) {
+ let replacement = core._Uri._normalizeEscape(host, index, true);
if (replacement == null && isNormalized) {
index = dart.notNull(index) + 3;
continue;
@@ -33816,8 +34123,8 @@
index = dart.notNull(index) + sourceLength;
sectionStart = index;
isNormalized = true;
- } else if (dart.test(core.Uri._isRegNameChar(char))) {
- if (isNormalized && core.Uri._UPPER_CASE_A <= dart.notNull(char) && core.Uri._UPPER_CASE_Z >= dart.notNull(char)) {
+ } else if (dart.test(core._Uri._isRegNameChar(char))) {
+ if (isNormalized && core._UPPER_CASE_A <= dart.notNull(char) && core._UPPER_CASE_Z >= dart.notNull(char)) {
if (buffer == null) buffer = new core.StringBuffer();
if (dart.notNull(sectionStart) < dart.notNull(index)) {
buffer.write(host[dartx.substring](sectionStart, index));
@@ -33826,8 +34133,8 @@
isNormalized = false;
}
index = dart.notNull(index) + 1;
- } else if (dart.test(core.Uri._isGeneralDelimiter(char))) {
- core.Uri._fail(host, index, "Invalid character");
+ } else if (dart.test(core._Uri._isGeneralDelimiter(char))) {
+ core._Uri._fail(host, index, "Invalid character");
} else {
let sourceLength = 1;
if ((dart.notNull(char) & 64512) == 55296 && dart.notNull(index) + 1 < dart.notNull(end)) {
@@ -33841,7 +34148,7 @@
let slice = host[dartx.substring](sectionStart, index);
if (!isNormalized) slice = slice[dartx.toLowerCase]();
buffer.write(slice);
- buffer.write(core.Uri._escapeChar(char));
+ buffer.write(core._Uri._escapeChar(char));
index = dart.notNull(index) + sourceLength;
sectionStart = index;
}
@@ -33857,26 +34164,33 @@
static _makeScheme(scheme, start, end) {
if (start == end) return "";
let firstCodeUnit = scheme[dartx.codeUnitAt](start);
- if (!dart.test(core.Uri._isAlphabeticCharacter(firstCodeUnit))) {
- core.Uri._fail(scheme, start, "Scheme not starting with alphabetic character");
+ if (!dart.test(core._Uri._isAlphabeticCharacter(firstCodeUnit))) {
+ core._Uri._fail(scheme, start, "Scheme not starting with alphabetic character");
}
let containsUpperCase = false;
for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(i) + 1) {
let codeUnit = scheme[dartx.codeUnitAt](i);
- if (!dart.test(core.Uri._isSchemeCharacter(codeUnit))) {
- core.Uri._fail(scheme, i, "Illegal scheme character");
+ if (!dart.test(core._Uri._isSchemeCharacter(codeUnit))) {
+ core._Uri._fail(scheme, i, "Illegal scheme character");
}
- if (core.Uri._UPPER_CASE_A <= dart.notNull(codeUnit) && dart.notNull(codeUnit) <= core.Uri._UPPER_CASE_Z) {
+ if (core._UPPER_CASE_A <= dart.notNull(codeUnit) && dart.notNull(codeUnit) <= core._UPPER_CASE_Z) {
containsUpperCase = true;
}
}
scheme = scheme[dartx.substring](start, end);
if (containsUpperCase) scheme = scheme[dartx.toLowerCase]();
+ return core._Uri._canonicalizeScheme(scheme);
+ }
+ static _canonicalizeScheme(scheme) {
+ if (scheme == "http") return "http";
+ if (scheme == "file") return "file";
+ if (scheme == "https") return "https";
+ if (scheme == "package") return "package";
return scheme;
}
static _makeUserInfo(userInfo, start, end) {
if (userInfo == null) return "";
- return core.Uri._normalize(userInfo, start, end, core.Uri._userinfoTable);
+ return core._Uri._normalizeOrSubstring(userInfo, start, end, core._Uri._userinfoTable);
}
static _makePath(path, start, end, pathSegments, scheme, hasAuthority) {
let isFile = scheme == "file";
@@ -33887,30 +34201,32 @@
}
let result = null;
if (path != null) {
- result = core.Uri._normalize(path, start, end, core.Uri._pathCharOrSlashTable);
+ result = core._Uri._normalizeOrSubstring(path, start, end, core._Uri._pathCharOrSlashTable);
} else {
- result = pathSegments[dartx.map](core.String)(dart.fn(s => core.Uri._uriEncode(core.Uri._pathCharTable, s, convert.UTF8, false), StringToString$()))[dartx.join]("/");
+ result = pathSegments[dartx.map](core.String)(dart.fn(s => core._Uri._uriEncode(core._Uri._pathCharTable, s, convert.UTF8, false), StringToString$()))[dartx.join]("/");
}
if (dart.test(dart.dload(result, 'isEmpty'))) {
if (isFile) return "/";
} else if (ensureLeadingSlash && !dart.test(dart.dsend(result, 'startsWith', '/'))) {
result = "/" + dart.notNull(core.String._check(result));
}
- result = core.Uri._normalizePath(core.String._check(result), scheme, hasAuthority);
+ result = core._Uri._normalizePath(core.String._check(result), scheme, hasAuthority);
return core.String._check(result);
}
static _normalizePath(path, scheme, hasAuthority) {
if (dart.test(scheme[dartx.isEmpty]) && !dart.test(hasAuthority) && !dart.test(path[dartx.startsWith]('/'))) {
- return core.Uri._normalizeRelativePath(path);
+ return core._Uri._normalizeRelativePath(path, dart.test(scheme[dartx.isNotEmpty]) || dart.test(hasAuthority));
}
- return core.Uri._removeDotSegments(path);
+ return core._Uri._removeDotSegments(path);
}
static _makeQuery(query, start, end, queryParameters) {
- if (query == null && queryParameters == null) return null;
- if (query != null && queryParameters != null) {
- dart.throw(new core.ArgumentError('Both query and queryParameters specified'));
+ if (query != null) {
+ if (queryParameters != null) {
+ dart.throw(new core.ArgumentError('Both query and queryParameters specified'));
+ }
+ return core._Uri._normalizeOrSubstring(query, start, end, core._Uri._queryCharTable);
}
- if (query != null) return core.Uri._normalize(query, start, end, core.Uri._queryCharTable);
+ if (queryParameters == null) return null;
let result = new core.StringBuffer();
let separator = "";
function writeParameter(key, value) {
@@ -33938,52 +34254,40 @@
}
static _makeFragment(fragment, start, end) {
if (fragment == null) return null;
- return core.Uri._normalize(fragment, start, end, core.Uri._queryCharTable);
- }
- static _stringOrNullLength(s) {
- return s == null ? 0 : s[dartx.length];
+ return core._Uri._normalizeOrSubstring(fragment, start, end, core._Uri._queryCharTable);
}
static _normalizeEscape(source, index, lowerCase) {
- dart.assert(source[dartx.codeUnitAt](index) == core.Uri._PERCENT);
+ dart.assert(source[dartx.codeUnitAt](index) == core._PERCENT);
if (dart.notNull(index) + 2 >= dart.notNull(source[dartx.length])) {
return "%";
}
let firstDigit = source[dartx.codeUnitAt](dart.notNull(index) + 1);
let secondDigit = source[dartx.codeUnitAt](dart.notNull(index) + 2);
- let firstDigitValue = core.Uri._parseHexDigit(firstDigit);
- let secondDigitValue = core.Uri._parseHexDigit(secondDigit);
+ let firstDigitValue = _internal.hexDigitValue(firstDigit);
+ let secondDigitValue = _internal.hexDigitValue(secondDigit);
if (dart.notNull(firstDigitValue) < 0 || dart.notNull(secondDigitValue) < 0) {
return "%";
}
let value = dart.notNull(firstDigitValue) * 16 + dart.notNull(secondDigitValue);
- if (dart.test(core.Uri._isUnreservedChar(value))) {
- if (dart.test(lowerCase) && core.Uri._UPPER_CASE_A <= value && core.Uri._UPPER_CASE_Z >= value) {
+ if (dart.test(core._Uri._isUnreservedChar(value))) {
+ if (dart.test(lowerCase) && core._UPPER_CASE_A <= value && core._UPPER_CASE_Z >= value) {
value = (value | 32) >>> 0;
}
return core.String.fromCharCode(value);
}
- if (dart.notNull(firstDigit) >= core.Uri._LOWER_CASE_A || dart.notNull(secondDigit) >= core.Uri._LOWER_CASE_A) {
+ if (dart.notNull(firstDigit) >= core._LOWER_CASE_A || dart.notNull(secondDigit) >= core._LOWER_CASE_A) {
return source[dartx.substring](index, dart.notNull(index) + 3)[dartx.toUpperCase]();
}
return null;
}
- static _parseHexDigit(char) {
- let digit = (dart.notNull(char) ^ core.Uri._ZERO) >>> 0;
- if (digit <= 9) return digit;
- let lowerCase = (dart.notNull(char) | 32) >>> 0;
- if (core.Uri._LOWER_CASE_A <= lowerCase && lowerCase <= core.Uri._LOWER_CASE_F) {
- return lowerCase - (core.Uri._LOWER_CASE_A - 10);
- }
- return -1;
- }
static _escapeChar(char) {
dart.assert(dart.notNull(char) <= 1114111);
let codeUnits = null;
if (dart.notNull(char) < 128) {
codeUnits = ListOfint().new(3);
- codeUnits[dartx._set](0, core.Uri._PERCENT);
- codeUnits[dartx._set](1, core.Uri._hexDigits[dartx.codeUnitAt](char[dartx['>>']](4)));
- codeUnits[dartx._set](2, core.Uri._hexDigits[dartx.codeUnitAt](dart.notNull(char) & 15));
+ codeUnits[dartx._set](0, core._PERCENT);
+ codeUnits[dartx._set](1, core._hexDigits[dartx.codeUnitAt](char[dartx['>>']](4)));
+ codeUnits[dartx._set](2, core._hexDigits[dartx.codeUnitAt](dart.notNull(char) & 15));
} else {
let flag = 192;
let encodedBytes = 2;
@@ -33999,16 +34303,21 @@
let index = 0;
while (--encodedBytes >= 0) {
let byte = (char[dartx['>>']](6 * encodedBytes) & 63 | flag) >>> 0;
- codeUnits[dartx._set](index, core.Uri._PERCENT);
- codeUnits[dartx._set](index + 1, core.Uri._hexDigits[dartx.codeUnitAt](byte[dartx['>>']](4)));
- codeUnits[dartx._set](index + 2, core.Uri._hexDigits[dartx.codeUnitAt](byte & 15));
+ codeUnits[dartx._set](index, core._PERCENT);
+ codeUnits[dartx._set](index + 1, core._hexDigits[dartx.codeUnitAt](byte[dartx['>>']](4)));
+ codeUnits[dartx._set](index + 2, core._hexDigits[dartx.codeUnitAt](byte & 15));
index = index + 3;
flag = 128;
}
}
return core.String.fromCharCodes(codeUnits);
}
- static _normalize(component, start, end, charTable) {
+ static _normalizeOrSubstring(component, start, end, charTable) {
+ let l = core._Uri._normalize(component, start, end, charTable);
+ return l != null ? l : component[dartx.substring](start, end);
+ }
+ static _normalize(component, start, end, charTable, opts) {
+ let escapeDelimiters = opts && 'escapeDelimiters' in opts ? opts.escapeDelimiters : false;
let buffer = null;
let sectionStart = start;
let index = start;
@@ -34019,8 +34328,8 @@
} else {
let replacement = null;
let sourceLength = null;
- if (char == core.Uri._PERCENT) {
- replacement = core.Uri._normalizeEscape(component, index, false);
+ if (char == core._PERCENT) {
+ replacement = core._Uri._normalizeEscape(component, index, false);
if (replacement == null) {
index = dart.notNull(index) + 3;
continue;
@@ -34031,8 +34340,8 @@
} else {
sourceLength = 3;
}
- } else if (dart.test(core.Uri._isGeneralDelimiter(char))) {
- core.Uri._fail(component, index, "Invalid character");
+ } else if (!dart.test(escapeDelimiters) && dart.test(core._Uri._isGeneralDelimiter(char))) {
+ core._Uri._fail(component, index, "Invalid character");
} else {
sourceLength = 1;
if ((dart.notNull(char) & 64512) == 55296) {
@@ -34044,7 +34353,7 @@
}
}
}
- replacement = core.Uri._escapeChar(char);
+ replacement = core._Uri._escapeChar(char);
}
if (buffer == null) buffer = new core.StringBuffer();
buffer.write(component[dartx.substring](sectionStart, index));
@@ -34054,7 +34363,7 @@
}
}
if (buffer == null) {
- return component[dartx.substring](start, end);
+ return null;
}
if (dart.notNull(sectionStart) < dart.notNull(end)) {
buffer.write(component[dartx.substring](sectionStart, end));
@@ -34062,10 +34371,10 @@
return dart.toString(buffer);
}
static _isSchemeCharacter(ch) {
- return dart.notNull(ch) < 128 && (dart.notNull(core.Uri._schemeTable[dartx._get](ch[dartx['>>']](4))) & 1 << (dart.notNull(ch) & 15)) != 0;
+ return dart.notNull(ch) < 128 && (dart.notNull(core._Uri._schemeTable[dartx._get](ch[dartx['>>']](4))) & 1 << (dart.notNull(ch) & 15)) != 0;
}
static _isGeneralDelimiter(ch) {
- return dart.notNull(ch) <= core.Uri._RIGHT_BRACKET && (dart.notNull(core.Uri._genDelimitersTable[dartx._get](ch[dartx['>>']](4))) & 1 << (dart.notNull(ch) & 15)) != 0;
+ return dart.notNull(ch) <= core._RIGHT_BRACKET && (dart.notNull(core._Uri._genDelimitersTable[dartx._get](ch[dartx['>>']](4))) & 1 << (dart.notNull(ch) & 15)) != 0;
}
get isAbsolute() {
return this.scheme != "" && this.fragment == "";
@@ -34084,7 +34393,7 @@
break;
}
let delta = dart.notNull(baseEnd) - dart.notNull(newEnd);
- if ((delta == 2 || delta == 3) && base[dartx.codeUnitAt](dart.notNull(newEnd) + 1) == core.Uri._DOT && (delta == 2 || base[dartx.codeUnitAt](dart.notNull(newEnd) + 2) == core.Uri._DOT)) {
+ if ((delta == 2 || delta == 3) && base[dartx.codeUnitAt](dart.notNull(newEnd) + 1) == core._DOT && (delta == 2 || base[dartx.codeUnitAt](dart.notNull(newEnd) + 2) == core._DOT)) {
break;
}
baseEnd = newEnd;
@@ -34098,7 +34407,7 @@
return index != -1;
}
static _removeDotSegments(path) {
- if (!dart.test(core.Uri._mayContainDotSegments(path))) return path;
+ if (!dart.test(core._Uri._mayContainDotSegments(path))) return path;
dart.assert(path[dartx.isNotEmpty]);
let output = JSArrayOfString().of([]);
let appendSlash = false;
@@ -34121,9 +34430,12 @@
if (appendSlash) output[dartx.add]("");
return output[dartx.join]("/");
}
- static _normalizeRelativePath(path) {
+ static _normalizeRelativePath(path, allowScheme) {
dart.assert(!dart.test(path[dartx.startsWith]('/')));
- if (!dart.test(core.Uri._mayContainDotSegments(path))) return path;
+ if (!dart.test(core._Uri._mayContainDotSegments(path))) {
+ if (!dart.test(allowScheme)) path = core._Uri._escapeScheme(path);
+ return path;
+ }
dart.assert(path[dartx.isNotEmpty]);
let output = JSArrayOfString().of([]);
let appendSlash = false;
@@ -34146,8 +34458,23 @@
return "./";
}
if (appendSlash || output[dartx.last] == '..') output[dartx.add]("");
+ if (!dart.test(allowScheme)) output[dartx._set](0, core._Uri._escapeScheme(output[dartx._get](0)));
return output[dartx.join]("/");
}
+ static _escapeScheme(path) {
+ if (dart.notNull(path[dartx.length]) >= 2 && dart.test(core._Uri._isAlphabeticCharacter(path[dartx.codeUnitAt](0)))) {
+ for (let i = 1; i < dart.notNull(path[dartx.length]); i++) {
+ let char = path[dartx.codeUnitAt](i);
+ if (char == core._COLON) {
+ return dart.str`${path[dartx.substring](0, i)}%3A${path[dartx.substring](i + 1)}`;
+ }
+ if (dart.notNull(char) > 127 || (dart.notNull(core._Uri._schemeTable[dartx._get](char[dartx['>>']](4))) & 1 << (dart.notNull(char) & 15)) == 0) {
+ break;
+ }
+ }
+ }
+ return path;
+ }
resolve(reference) {
return this.resolveUri(core.Uri.parse(reference));
}
@@ -34165,7 +34492,7 @@
targetHost = reference.host;
targetPort = dart.test(reference.hasPort) ? reference.port : null;
}
- targetPath = core.Uri._removeDotSegments(reference.path);
+ targetPath = core._Uri._removeDotSegments(reference.path);
if (dart.test(reference.hasQuery)) {
targetQuery = reference.query;
}
@@ -34174,15 +34501,15 @@
if (dart.test(reference.hasAuthority)) {
targetUserInfo = reference.userInfo;
targetHost = reference.host;
- targetPort = core.Uri._makePort(dart.test(reference.hasPort) ? reference.port : null, targetScheme);
- targetPath = core.Uri._removeDotSegments(reference.path);
+ targetPort = core._Uri._makePort(dart.test(reference.hasPort) ? reference.port : null, targetScheme);
+ targetPath = core._Uri._removeDotSegments(reference.path);
if (dart.test(reference.hasQuery)) targetQuery = reference.query;
} else {
targetUserInfo = this[_userInfo];
targetHost = this[_host];
targetPort = this[_port];
if (reference.path == "") {
- targetPath = this[_path];
+ targetPath = this.path;
if (dart.test(reference.hasQuery)) {
targetQuery = reference.query;
} else {
@@ -34190,20 +34517,24 @@
}
} else {
if (dart.test(reference.hasAbsolutePath)) {
- targetPath = core.Uri._removeDotSegments(reference.path);
+ targetPath = core._Uri._removeDotSegments(reference.path);
} else {
if (dart.test(this.hasEmptyPath)) {
- if (!dart.test(this.hasScheme) && !dart.test(this.hasAuthority)) {
- targetPath = reference.path;
+ if (!dart.test(this.hasAuthority)) {
+ if (!dart.test(this.hasScheme)) {
+ targetPath = reference.path;
+ } else {
+ targetPath = core._Uri._removeDotSegments(reference.path);
+ }
} else {
- targetPath = core.Uri._removeDotSegments("/" + dart.notNull(reference.path));
+ targetPath = core._Uri._removeDotSegments("/" + dart.notNull(reference.path));
}
} else {
- let mergedPath = this[_mergePaths](this[_path], reference.path);
+ let mergedPath = this[_mergePaths](this.path, reference.path);
if (dart.test(this.hasScheme) || dart.test(this.hasAuthority) || dart.test(this.hasAbsolutePath)) {
- targetPath = core.Uri._removeDotSegments(mergedPath);
+ targetPath = core._Uri._removeDotSegments(mergedPath);
} else {
- targetPath = core.Uri._normalizeRelativePath(mergedPath);
+ targetPath = core._Uri._normalizeRelativePath(mergedPath, dart.test(this.hasScheme) || dart.test(this.hasAuthority));
}
}
}
@@ -34212,7 +34543,7 @@
}
}
let fragment = dart.test(reference.hasFragment) ? reference.fragment : null;
- return new core.Uri._internal(targetScheme, targetUserInfo, targetHost, targetPort, targetPath, targetQuery, fragment);
+ return new core._Uri._internal(targetScheme, targetUserInfo, targetHost, targetPort, targetPath, targetQuery, fragment);
}
get hasScheme() {
return this.scheme[dartx.isNotEmpty];
@@ -34230,18 +34561,21 @@
return this[_fragment] != null;
}
get hasEmptyPath() {
- return this[_path][dartx.isEmpty];
+ return this.path[dartx.isEmpty];
}
get hasAbsolutePath() {
- return this[_path][dartx.startsWith]('/');
+ return this.path[dartx.startsWith]('/');
}
get origin() {
- if (this.scheme == "" || this[_host] == null || this[_host] == "") {
+ if (this.scheme == "") {
dart.throw(new core.StateError(dart.str`Cannot use origin without a scheme: ${this}`));
}
if (this.scheme != "http" && this.scheme != "https") {
dart.throw(new core.StateError(dart.str`Origin is only applicable schemes http and https: ${this}`));
}
+ if (this[_host] == null || this[_host] == "") {
+ dart.throw(new core.StateError(dart.str`A ${this.scheme}: URI should have a non-empty host name: ${this}`));
+ }
if (this[_port] == null) return dart.str`${this.scheme}://${this[_host]}`;
return dart.str`${this.scheme}://${this[_host]}:${this[_port]}`;
}
@@ -34256,43 +34590,46 @@
if (this.fragment != "") {
dart.throw(new core.UnsupportedError("Cannot extract a file path from a URI with a fragment component"));
}
- if (windows == null) windows = core.Uri._isWindows;
- return dart.test(windows) ? this[_toWindowsFilePath]() : this[_toFilePath]();
+ if (windows == null) windows = core._Uri._isWindows;
+ return dart.test(windows) ? core._Uri._toWindowsFilePath(this) : this[_toFilePath]();
}
[_toFilePath]() {
- if (this.host != "") {
+ if (dart.test(this.hasAuthority) && this.host != "") {
dart.throw(new core.UnsupportedError("Cannot extract a non-Windows file path from a file URI " + "with an authority"));
}
- core.Uri._checkNonWindowsPathReservedCharacters(this.pathSegments, false);
+ let pathSegments = this.pathSegments;
+ core._Uri._checkNonWindowsPathReservedCharacters(pathSegments, false);
let result = new core.StringBuffer();
- if (dart.test(this[_isPathAbsolute])) result.write("/");
- result.writeAll(this.pathSegments, "/");
+ if (dart.test(this.hasAbsolutePath)) result.write("/");
+ result.writeAll(pathSegments, "/");
return result.toString();
}
- [_toWindowsFilePath]() {
+ static _toWindowsFilePath(uri) {
let hasDriveLetter = false;
- let segments = this.pathSegments;
- if (dart.notNull(segments[dartx.length]) > 0 && segments[dartx._get](0)[dartx.length] == 2 && segments[dartx._get](0)[dartx.codeUnitAt](1) == core.Uri._COLON) {
- core.Uri._checkWindowsDriveLetter(segments[dartx._get](0)[dartx.codeUnitAt](0), false);
- core.Uri._checkWindowsPathReservedCharacters(segments, false, 1);
+ let segments = uri.pathSegments;
+ if (dart.notNull(segments[dartx.length]) > 0 && segments[dartx._get](0)[dartx.length] == 2 && segments[dartx._get](0)[dartx.codeUnitAt](1) == core._COLON) {
+ core._Uri._checkWindowsDriveLetter(segments[dartx._get](0)[dartx.codeUnitAt](0), false);
+ core._Uri._checkWindowsPathReservedCharacters(segments, false, 1);
hasDriveLetter = true;
} else {
- core.Uri._checkWindowsPathReservedCharacters(segments, false);
+ core._Uri._checkWindowsPathReservedCharacters(segments, false, 0);
}
let result = new core.StringBuffer();
- if (dart.test(this[_isPathAbsolute]) && !hasDriveLetter) result.write("\\");
- if (this.host != "") {
- result.write("\\");
- result.write(this.host);
- result.write("\\");
+ if (dart.test(uri.hasAbsolutePath) && !hasDriveLetter) result.write("\\");
+ if (dart.test(uri.hasAuthority)) {
+ let host = uri.host;
+ if (dart.test(host[dartx.isNotEmpty])) {
+ result.write("\\");
+ result.write(host);
+ result.write("\\");
+ }
}
result.writeAll(segments, "\\");
if (hasDriveLetter && segments[dartx.length] == 1) result.write("\\");
return result.toString();
}
get [_isPathAbsolute]() {
- if (this.path == null || dart.test(this.path[dartx.isEmpty])) return false;
- return this.path[dartx.startsWith]('/');
+ return this.path != null && dart.test(this.path[dartx.startsWith]('/'));
}
[_writeAuthority](ss) {
if (dart.test(this[_userInfo][dartx.isNotEmpty])) {
@@ -34309,9 +34646,17 @@
return this.scheme == "data" ? core.UriData.fromUri(this) : null;
}
toString() {
+ let t = this[_text];
+ return t == null ? this[_text] = this[_initializeText]() : t;
+ }
+ [_initializeText]() {
+ dart.assert(this[_text] == null);
let sb = new core.StringBuffer();
- core.Uri._addIfNonEmpty(sb, this.scheme, this.scheme, ':');
- if (dart.test(this.hasAuthority) || dart.test(this.path[dartx.startsWith]("//")) || this.scheme == "file") {
+ if (dart.test(this.scheme[dartx.isNotEmpty])) {
+ sb.write(this.scheme);
+ sb.write(":");
+ }
+ if (dart.test(this.hasAuthority) || this.scheme == "file") {
sb.write("//");
this[_writeAuthority](sb);
}
@@ -34327,58 +34672,16 @@
return sb.toString();
}
['=='](other) {
- if (!core.Uri.is(other)) return false;
- let uri = core.Uri._check(other);
- return this.scheme == uri.scheme && this.hasAuthority == uri.hasAuthority && this.userInfo == uri.userInfo && this.host == uri.host && this.port == uri.port && this.path == uri.path && this.hasQuery == uri.hasQuery && this.query == uri.query && this.hasFragment == uri.hasFragment && this.fragment == uri.fragment;
+ if (core.identical(this, other)) return true;
+ if (core.Uri.is(other)) {
+ let uri = other;
+ return this.scheme == uri.scheme && this.hasAuthority == uri.hasAuthority && this.userInfo == uri.userInfo && this.host == uri.host && this.port == uri.port && this.path == uri.path && this.hasQuery == uri.hasQuery && this.query == uri.query && this.hasFragment == uri.hasFragment && this.fragment == uri.fragment;
+ }
+ return false;
}
get hashCode() {
- function combine(part, current) {
- return core.int._check(dart.dsend(dart.dsend(dart.dsend(current, '*', 31), '+', dart.hashCode(part)), '&', 1073741823));
- }
- dart.fn(combine, dynamicAnddynamicToint());
- return combine(this.scheme, combine(this.userInfo, combine(this.host, combine(this.port, combine(this.path, combine(this.query, combine(this.fragment, 1)))))));
- }
- static _addIfNonEmpty(sb, test, first, second) {
- if ("" != test) {
- sb.write(first);
- sb.write(second);
- }
- }
- static encodeComponent(component) {
- return core.Uri._uriEncode(core.Uri._unreserved2396Table, component, convert.UTF8, false);
- }
- static encodeQueryComponent(component, opts) {
- let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
- return core.Uri._uriEncode(core.Uri._unreservedTable, component, encoding, true);
- }
- static decodeComponent(encodedComponent) {
- return core.Uri._uriDecode(encodedComponent, 0, encodedComponent[dartx.length], convert.UTF8, false);
- }
- static decodeQueryComponent(encodedComponent, opts) {
- let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
- return core.Uri._uriDecode(encodedComponent, 0, encodedComponent[dartx.length], encoding, true);
- }
- static encodeFull(uri) {
- return core.Uri._uriEncode(core.Uri._encodeFullTable, uri, convert.UTF8, false);
- }
- static decodeFull(uri) {
- return core.Uri._uriDecode(uri, 0, uri[dartx.length], convert.UTF8, false);
- }
- static splitQueryString(query, opts) {
- let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
- return query[dartx.split]("&")[dartx.fold](MapOfString$String())(dart.map({}, core.String, core.String), dart.fn((map, element) => {
- let index = element[dartx.indexOf]("=");
- if (index == -1) {
- if (element != "") {
- map[dartx._set](core.Uri.decodeQueryComponent(element, {encoding: encoding}), "");
- }
- } else if (index != 0) {
- let key = element[dartx.substring](0, index);
- let value = element[dartx.substring](dart.notNull(index) + 1);
- map[dartx._set](core.Uri.decodeQueryComponent(key, {encoding: encoding}), core.Uri.decodeQueryComponent(value, {encoding: encoding}));
- }
- return map;
- }, MapOfString$StringAndStringToMapOfString$String()));
+ let t = this[_hashCodeCache];
+ return t == null ? this[_hashCodeCache] = dart.hashCode(this.toString()) : t;
}
static _createList() {
return [];
@@ -34394,22 +34697,20 @@
let value = null;
if (start == end) return;
if (dart.notNull(equalsIndex) < 0) {
- key = core.Uri._uriDecode(query, start, end, encoding, true);
+ key = core._Uri._uriDecode(query, start, end, encoding, true);
value = "";
} else {
- key = core.Uri._uriDecode(query, start, equalsIndex, encoding, true);
- value = core.Uri._uriDecode(query, dart.notNull(equalsIndex) + 1, end, encoding, true);
+ key = core._Uri._uriDecode(query, start, equalsIndex, encoding, true);
+ value = core._Uri._uriDecode(query, dart.notNull(equalsIndex) + 1, end, encoding, true);
}
- dart.dsend(result[dartx.putIfAbsent](key, core.Uri._createList), 'add', value);
+ dart.dsend(result[dartx.putIfAbsent](key, core._Uri._createList), 'add', value);
}
dart.fn(parsePair, intAndintAndintTovoid());
- let _equals = 61;
- let _ampersand = 38;
while (i < dart.notNull(query[dartx.length])) {
let char = query[dartx.codeUnitAt](i);
- if (char == _equals) {
+ if (char == core._EQUALS) {
if (equalsIndex < 0) equalsIndex = i;
- } else if (char == _ampersand) {
+ } else if (char == core._AMPERSAND) {
parsePair(start, equalsIndex, i);
start = i + 1;
equalsIndex = -1;
@@ -34419,125 +34720,17 @@
parsePair(start, equalsIndex, i);
return result;
}
- static parseIPv4Address(host) {
- function error(msg) {
- dart.throw(new core.FormatException(dart.str`Illegal IPv4 address, ${msg}`));
- }
- dart.fn(error, StringTovoid$());
- let bytes = host[dartx.split]('.');
- if (bytes[dartx.length] != 4) {
- error('IPv4 address should contain exactly 4 parts');
- }
- return bytes[dartx.map](core.int)(dart.fn(byteString => {
- let byte = core.int.parse(byteString);
- if (dart.notNull(byte) < 0 || dart.notNull(byte) > 255) {
- error('each part must be in the range of `0..255`');
- }
- return byte;
- }, StringToint$()))[dartx.toList]();
- }
- static parseIPv6Address(host, start, end) {
- if (start === void 0) start = 0;
- if (end === void 0) end = null;
- if (end == null) end = host[dartx.length];
- function error(msg, position) {
- if (position === void 0) position = null;
- dart.throw(new core.FormatException(dart.str`Illegal IPv6 address, ${msg}`, host, core.int._check(position)));
- }
- dart.fn(error, String__Tovoid());
- function parseHex(start, end) {
- if (dart.notNull(end) - dart.notNull(start) > 4) {
- error('an IPv6 part can only contain a maximum of 4 hex digits', start);
- }
- let value = core.int.parse(host[dartx.substring](start, end), {radix: 16});
- if (dart.notNull(value) < 0 || dart.notNull(value) > (1 << 16) - 1) {
- error('each part must be in the range of `0x0..0xFFFF`', start);
- }
- return value;
- }
- dart.fn(parseHex, intAndintToint());
- if (dart.notNull(host[dartx.length]) < 2) error('address is too short');
- let parts = JSArrayOfint().of([]);
- let wildcardSeen = false;
- let partStart = start;
- for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(i) + 1) {
- if (host[dartx.codeUnitAt](i) == core.Uri._COLON) {
- if (i == start) {
- i = dart.notNull(i) + 1;
- if (host[dartx.codeUnitAt](i) != core.Uri._COLON) {
- error('invalid start colon.', i);
- }
- partStart = i;
- }
- if (i == partStart) {
- if (wildcardSeen) {
- error('only one wildcard `::` is allowed', i);
- }
- wildcardSeen = true;
- parts[dartx.add](-1);
- } else {
- parts[dartx.add](parseHex(partStart, i));
- }
- partStart = dart.notNull(i) + 1;
- }
- }
- if (parts[dartx.length] == 0) error('too few parts');
- let atEnd = partStart == end;
- let isLastWildcard = parts[dartx.last] == -1;
- if (atEnd && !isLastWildcard) {
- error('expected a part after last `:`', end);
- }
- if (!atEnd) {
- try {
- parts[dartx.add](parseHex(partStart, end));
- } catch (e) {
- try {
- let last = core.Uri.parseIPv4Address(host[dartx.substring](partStart, end));
- parts[dartx.add]((dart.notNull(last[dartx._get](0)) << 8 | dart.notNull(last[dartx._get](1))) >>> 0);
- parts[dartx.add]((dart.notNull(last[dartx._get](2)) << 8 | dart.notNull(last[dartx._get](3))) >>> 0);
- } catch (e) {
- error('invalid end of IPv6 address.', partStart);
- }
-
- }
-
- }
- if (wildcardSeen) {
- if (dart.notNull(parts[dartx.length]) > 7) {
- error('an address with a wildcard must have less than 7 parts');
- }
- } else if (parts[dartx.length] != 8) {
- error('an address without a wildcard must contain exactly 8 parts');
- }
- let bytes = typed_data.Uint8List.new(16);
- for (let i = 0, index = 0; i < dart.notNull(parts[dartx.length]); i++) {
- let value = parts[dartx._get](i);
- if (value == -1) {
- let wildCardLength = 9 - dart.notNull(parts[dartx.length]);
- for (let j = 0; j < wildCardLength; j++) {
- bytes[dartx._set](index, 0);
- bytes[dartx._set](index + 1, 0);
- index = index + 2;
- }
- } else {
- bytes[dartx._set](index, value[dartx['>>']](8));
- bytes[dartx._set](index + 1, dart.notNull(value) & 255);
- index = index + 2;
- }
- }
- return bytes;
- }
static _uriEncode(canonicalTable, text, encoding, spaceToPlus) {
- if (core.identical(encoding, convert.UTF8) && dart.test(core.Uri._needsNoEncoding.hasMatch(text))) {
+ if (core.identical(encoding, convert.UTF8) && dart.test(core._Uri._needsNoEncoding.hasMatch(text))) {
return text;
}
- let result = new core.StringBuffer();
+ let result = new core.StringBuffer('');
let bytes = encoding.encode(text);
for (let i = 0; i < dart.notNull(bytes[dartx.length]); i++) {
let byte = bytes[dartx._get](i);
if (dart.notNull(byte) < 128 && (dart.notNull(canonicalTable[dartx._get](byte[dartx['>>']](4))) & 1 << (dart.notNull(byte) & 15)) != 0) {
result.writeCharCode(byte);
- } else if (dart.test(spaceToPlus) && byte == core.Uri._SPACE) {
+ } else if (dart.test(spaceToPlus) && byte == core._SPACE) {
result.write('+');
} else {
let hexDigits = '0123456789ABCDEF';
@@ -34573,7 +34766,7 @@
let simple = true;
for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(i) + 1) {
let codeUnit = text[dartx.codeUnitAt](i);
- if (dart.notNull(codeUnit) > 127 || codeUnit == core.Uri._PERCENT || dart.test(plusToSpace) && codeUnit == core.Uri._PLUS) {
+ if (dart.notNull(codeUnit) > 127 || codeUnit == core._PERCENT || dart.test(plusToSpace) && codeUnit == core._PLUS) {
simple = false;
break;
}
@@ -34592,14 +34785,14 @@
if (dart.notNull(codeUnit) > 127) {
dart.throw(new core.ArgumentError("Illegal percent encoding in URI"));
}
- if (codeUnit == core.Uri._PERCENT) {
+ if (codeUnit == core._PERCENT) {
if (dart.notNull(i) + 3 > dart.notNull(text[dartx.length])) {
dart.throw(new core.ArgumentError('Truncated URI'));
}
- bytes[dartx.add](core.Uri._hexCharPairToByte(text, dart.notNull(i) + 1));
+ bytes[dartx.add](core._Uri._hexCharPairToByte(text, dart.notNull(i) + 1));
i = dart.notNull(i) + 2;
- } else if (dart.test(plusToSpace) && codeUnit == core.Uri._PLUS) {
- bytes[dartx.add](core.Uri._SPACE);
+ } else if (dart.test(plusToSpace) && codeUnit == core._PLUS) {
+ bytes[dartx.add](core._SPACE);
} else {
bytes[dartx.add](codeUnit);
}
@@ -34609,23 +34802,26 @@
}
static _isAlphabeticCharacter(codeUnit) {
let lowerCase = (dart.notNull(codeUnit) | 32) >>> 0;
- return core.Uri._LOWER_CASE_A <= lowerCase && lowerCase <= core.Uri._LOWER_CASE_Z;
+ return core._LOWER_CASE_A <= lowerCase && lowerCase <= core._LOWER_CASE_Z;
}
static _isUnreservedChar(char) {
- return dart.notNull(char) < 127 && (dart.notNull(core.Uri._unreservedTable[dartx._get](char[dartx['>>']](4))) & 1 << (dart.notNull(char) & 15)) != 0;
+ return dart.notNull(char) < 127 && (dart.notNull(core._Uri._unreservedTable[dartx._get](char[dartx['>>']](4))) & 1 << (dart.notNull(char) & 15)) != 0;
}
};
- dart.defineNamedConstructor(core.Uri, '_internal');
- dart.setSignature(core.Uri, {
+ dart.defineNamedConstructor(core._Uri, '_internal');
+ core._Uri[dart.implements] = () => [core.Uri];
+ dart.setSignature(core._Uri, {
fields: () => ({
scheme: core.String,
[_userInfo]: core.String,
[_host]: core.String,
[_port]: core.int,
- [_path]: core.String,
+ path: core.String,
[_query]: core.String,
[_fragment]: core.String,
[_pathSegments]: ListOfString(),
+ [_text]: core.String,
+ [_hashCodeCache]: core.int,
[_queryParameters]: MapOfString$String(),
[_queryParameterLists]: MapOfString$ListOfString()
}),
@@ -34634,7 +34830,6 @@
userInfo: dart.definiteFunctionType(core.String, []),
host: dart.definiteFunctionType(core.String, []),
port: dart.definiteFunctionType(core.int, []),
- path: dart.definiteFunctionType(core.String, []),
query: dart.definiteFunctionType(core.String, []),
fragment: dart.definiteFunctionType(core.String, []),
pathSegments: dart.definiteFunctionType(core.List$(core.String), []),
@@ -34653,6 +34848,7 @@
data: dart.definiteFunctionType(core.UriData, [])
}),
methods: () => ({
+ isScheme: dart.definiteFunctionType(core.bool, [core.String]),
replace: dart.definiteFunctionType(core.Uri, [], {scheme: core.String, userInfo: core.String, host: core.String, port: core.int, path: core.String, pathSegments: IterableOfString(), query: core.String, queryParameters: MapOfString$dynamic(), fragment: core.String}),
removeFragment: dart.definiteFunctionType(core.Uri, []),
normalizePath: dart.definiteFunctionType(core.Uri, []),
@@ -34661,12 +34857,12 @@
resolveUri: dart.definiteFunctionType(core.Uri, [core.Uri]),
toFilePath: dart.definiteFunctionType(core.String, [], {windows: core.bool}),
[_toFilePath]: dart.definiteFunctionType(core.String, []),
- [_toWindowsFilePath]: dart.definiteFunctionType(core.String, []),
- [_writeAuthority]: dart.definiteFunctionType(dart.void, [core.StringSink])
+ [_writeAuthority]: dart.definiteFunctionType(dart.void, [core.StringSink]),
+ [_initializeText]: dart.definiteFunctionType(core.String, [])
}),
statics: () => ({
_defaultPort: dart.definiteFunctionType(core.int, [core.String]),
- parse: dart.definiteFunctionType(core.Uri, [core.String], [core.int, core.int]),
+ _compareScheme: dart.definiteFunctionType(core.bool, [core.String, core.String]),
_fail: dart.definiteFunctionType(dart.void, [core.String, core.int, core.String]),
_makeHttpUri: dart.definiteFunctionType(core.Uri, [core.String, core.String, core.String, MapOfString$String()]),
_checkNonWindowsPathReservedCharacters: dart.definiteFunctionType(dart.dynamic, [ListOfString(), core.bool]),
@@ -34679,85 +34875,50 @@
_isRegNameChar: dart.definiteFunctionType(core.bool, [core.int]),
_normalizeRegName: dart.definiteFunctionType(core.String, [core.String, core.int, core.int]),
_makeScheme: dart.definiteFunctionType(core.String, [core.String, core.int, core.int]),
+ _canonicalizeScheme: dart.definiteFunctionType(core.String, [core.String]),
_makeUserInfo: dart.definiteFunctionType(core.String, [core.String, core.int, core.int]),
_makePath: dart.definiteFunctionType(core.String, [core.String, core.int, core.int, IterableOfString(), core.String, core.bool]),
_normalizePath: dart.definiteFunctionType(core.String, [core.String, core.String, core.bool]),
_makeQuery: dart.definiteFunctionType(core.String, [core.String, core.int, core.int, MapOfString$dynamic()]),
_makeFragment: dart.definiteFunctionType(core.String, [core.String, core.int, core.int]),
- _stringOrNullLength: dart.definiteFunctionType(core.int, [core.String]),
_normalizeEscape: dart.definiteFunctionType(core.String, [core.String, core.int, core.bool]),
- _parseHexDigit: dart.definiteFunctionType(core.int, [core.int]),
_escapeChar: dart.definiteFunctionType(core.String, [core.int]),
- _normalize: dart.definiteFunctionType(core.String, [core.String, core.int, core.int, ListOfint()]),
+ _normalizeOrSubstring: dart.definiteFunctionType(core.String, [core.String, core.int, core.int, ListOfint()]),
+ _normalize: dart.definiteFunctionType(core.String, [core.String, core.int, core.int, ListOfint()], {escapeDelimiters: core.bool}),
_isSchemeCharacter: dart.definiteFunctionType(core.bool, [core.int]),
_isGeneralDelimiter: dart.definiteFunctionType(core.bool, [core.int]),
_mayContainDotSegments: dart.definiteFunctionType(core.bool, [core.String]),
_removeDotSegments: dart.definiteFunctionType(core.String, [core.String]),
- _normalizeRelativePath: dart.definiteFunctionType(core.String, [core.String]),
- _addIfNonEmpty: dart.definiteFunctionType(dart.void, [core.StringBuffer, core.String, core.String, core.String]),
- encodeComponent: dart.definiteFunctionType(core.String, [core.String]),
- encodeQueryComponent: dart.definiteFunctionType(core.String, [core.String], {encoding: convert.Encoding}),
- decodeComponent: dart.definiteFunctionType(core.String, [core.String]),
- decodeQueryComponent: dart.definiteFunctionType(core.String, [core.String], {encoding: convert.Encoding}),
- encodeFull: dart.definiteFunctionType(core.String, [core.String]),
- decodeFull: dart.definiteFunctionType(core.String, [core.String]),
- splitQueryString: dart.definiteFunctionType(core.Map$(core.String, core.String), [core.String], {encoding: convert.Encoding}),
+ _normalizeRelativePath: dart.definiteFunctionType(core.String, [core.String, core.bool]),
+ _escapeScheme: dart.definiteFunctionType(core.String, [core.String]),
+ _toWindowsFilePath: dart.definiteFunctionType(core.String, [core.Uri]),
_createList: dart.definiteFunctionType(core.List, []),
_splitQueryStringAll: dart.definiteFunctionType(core.Map, [core.String], {encoding: convert.Encoding}),
- parseIPv4Address: dart.definiteFunctionType(core.List$(core.int), [core.String]),
- parseIPv6Address: dart.definiteFunctionType(core.List$(core.int), [core.String], [core.int, core.int]),
_uriEncode: dart.definiteFunctionType(core.String, [ListOfint(), core.String, convert.Encoding, core.bool]),
_hexCharPairToByte: dart.definiteFunctionType(core.int, [core.String, core.int]),
_uriDecode: dart.definiteFunctionType(core.String, [core.String, core.int, core.int, convert.Encoding, core.bool]),
_isAlphabeticCharacter: dart.definiteFunctionType(core.bool, [core.int]),
_isUnreservedChar: dart.definiteFunctionType(core.bool, [core.int])
}),
- names: ['_defaultPort', 'parse', '_fail', '_makeHttpUri', '_checkNonWindowsPathReservedCharacters', '_checkWindowsPathReservedCharacters', '_checkWindowsDriveLetter', '_makeFileUri', '_makeWindowsFileUrl', '_makePort', '_makeHost', '_isRegNameChar', '_normalizeRegName', '_makeScheme', '_makeUserInfo', '_makePath', '_normalizePath', '_makeQuery', '_makeFragment', '_stringOrNullLength', '_normalizeEscape', '_parseHexDigit', '_escapeChar', '_normalize', '_isSchemeCharacter', '_isGeneralDelimiter', '_mayContainDotSegments', '_removeDotSegments', '_normalizeRelativePath', '_addIfNonEmpty', 'encodeComponent', 'encodeQueryComponent', 'decodeComponent', 'decodeQueryComponent', 'encodeFull', 'decodeFull', 'splitQueryString', '_createList', '_splitQueryStringAll', 'parseIPv4Address', 'parseIPv6Address', '_uriEncode', '_hexCharPairToByte', '_uriDecode', '_isAlphabeticCharacter', '_isUnreservedChar']
+ names: ['_defaultPort', '_compareScheme', '_fail', '_makeHttpUri', '_checkNonWindowsPathReservedCharacters', '_checkWindowsPathReservedCharacters', '_checkWindowsDriveLetter', '_makeFileUri', '_makeWindowsFileUrl', '_makePort', '_makeHost', '_isRegNameChar', '_normalizeRegName', '_makeScheme', '_canonicalizeScheme', '_makeUserInfo', '_makePath', '_normalizePath', '_makeQuery', '_makeFragment', '_normalizeEscape', '_escapeChar', '_normalizeOrSubstring', '_normalize', '_isSchemeCharacter', '_isGeneralDelimiter', '_mayContainDotSegments', '_removeDotSegments', '_normalizeRelativePath', '_escapeScheme', '_toWindowsFilePath', '_createList', '_splitQueryStringAll', '_uriEncode', '_hexCharPairToByte', '_uriDecode', '_isAlphabeticCharacter', '_isUnreservedChar']
});
- core.Uri._SPACE = 32;
- core.Uri._DOUBLE_QUOTE = 34;
- core.Uri._NUMBER_SIGN = 35;
- core.Uri._PERCENT = 37;
- core.Uri._ASTERISK = 42;
- core.Uri._PLUS = 43;
- core.Uri._DOT = 46;
- core.Uri._SLASH = 47;
- core.Uri._ZERO = 48;
- core.Uri._NINE = 57;
- core.Uri._COLON = 58;
- core.Uri._LESS = 60;
- core.Uri._GREATER = 62;
- core.Uri._QUESTION = 63;
- core.Uri._AT_SIGN = 64;
- core.Uri._UPPER_CASE_A = 65;
- core.Uri._UPPER_CASE_F = 70;
- core.Uri._UPPER_CASE_Z = 90;
- core.Uri._LEFT_BRACKET = 91;
- core.Uri._BACKSLASH = 92;
- core.Uri._RIGHT_BRACKET = 93;
- core.Uri._LOWER_CASE_A = 97;
- core.Uri._LOWER_CASE_F = 102;
- core.Uri._LOWER_CASE_Z = 122;
- core.Uri._BAR = 124;
- core.Uri._hexDigits = "0123456789ABCDEF";
- core.Uri._unreservedTable = dart.constList([0, 0, 24576, 1023, 65534, 34815, 65534, 18431], core.int);
- core.Uri._unreserved2396Table = dart.constList([0, 0, 26498, 1023, 65534, 34815, 65534, 18431], core.int);
- core.Uri._encodeFullTable = dart.constList([0, 0, 65498, 45055, 65535, 34815, 65534, 18431], core.int);
- core.Uri._schemeTable = dart.constList([0, 0, 26624, 1023, 65534, 2047, 65534, 2047], core.int);
- core.Uri._schemeLowerTable = dart.constList([0, 0, 26624, 1023, 0, 0, 65534, 2047], core.int);
- core.Uri._subDelimitersTable = dart.constList([0, 0, 32722, 11263, 65534, 34815, 65534, 18431], core.int);
- core.Uri._genDelimitersTable = dart.constList([0, 0, 32776, 33792, 1, 10240, 0, 0], core.int);
- core.Uri._userinfoTable = dart.constList([0, 0, 32722, 12287, 65534, 34815, 65534, 18431], core.int);
- core.Uri._regNameTable = dart.constList([0, 0, 32754, 11263, 65534, 34815, 65534, 18431], core.int);
- core.Uri._pathCharTable = dart.constList([0, 0, 32722, 12287, 65535, 34815, 65534, 18431], core.int);
- core.Uri._pathCharOrSlashTable = dart.constList([0, 0, 65490, 12287, 65535, 34815, 65534, 18431], core.int);
- core.Uri._queryCharTable = dart.constList([0, 0, 65490, 45055, 65535, 34815, 65534, 18431], core.int);
- dart.defineLazy(core.Uri, {
+ core._Uri._unreservedTable = dart.constList([0, 0, 24576, 1023, 65534, 34815, 65534, 18431], core.int);
+ core._Uri._unreserved2396Table = dart.constList([0, 0, 26498, 1023, 65534, 34815, 65534, 18431], core.int);
+ core._Uri._encodeFullTable = dart.constList([0, 0, 65498, 45055, 65535, 34815, 65534, 18431], core.int);
+ core._Uri._schemeTable = dart.constList([0, 0, 26624, 1023, 65534, 2047, 65534, 2047], core.int);
+ core._Uri._schemeLowerTable = dart.constList([0, 0, 26624, 1023, 0, 0, 65534, 2047], core.int);
+ core._Uri._subDelimitersTable = dart.constList([0, 0, 32722, 11263, 65534, 34815, 65534, 18431], core.int);
+ core._Uri._genDelimitersTable = dart.constList([0, 0, 32776, 33792, 1, 10240, 0, 0], core.int);
+ core._Uri._userinfoTable = dart.constList([0, 0, 32722, 12287, 65534, 34815, 65534, 18431], core.int);
+ core._Uri._regNameTable = dart.constList([0, 0, 32754, 11263, 65534, 34815, 65534, 18431], core.int);
+ core._Uri._pathCharTable = dart.constList([0, 0, 32722, 12287, 65535, 34815, 65534, 18431], core.int);
+ core._Uri._pathCharOrSlashTable = dart.constList([0, 0, 65490, 12287, 65535, 34815, 65534, 18431], core.int);
+ core._Uri._queryCharTable = dart.constList([0, 0, 65490, 45055, 65535, 34815, 65534, 18431], core.int);
+ dart.defineLazy(core._Uri, {
get _needsNoEncoding() {
return core.RegExp.new('^[\\-\\.0-9A-Z_a-z~]*$');
}
});
- const _text = Symbol('_text');
const _separatorIndices = Symbol('_separatorIndices');
const _uriCache = Symbol('_uriCache');
core.UriData = class UriData extends core.Object {
@@ -34841,9 +35002,9 @@
if (dart.notNull(slashIndex) < 0) {
dart.throw(new core.ArgumentError.value(mimeType, "mimeType", "Invalid MIME type"));
}
- buffer.write(core.Uri._uriEncode(core.UriData._tokenCharTable, mimeType[dartx.substring](0, slashIndex), convert.UTF8, false));
+ buffer.write(core._Uri._uriEncode(core.UriData._tokenCharTable, mimeType[dartx.substring](0, slashIndex), convert.UTF8, false));
buffer.write("/");
- buffer.write(core.Uri._uriEncode(core.UriData._tokenCharTable, mimeType[dartx.substring](dart.notNull(slashIndex) + 1), convert.UTF8, false));
+ buffer.write(core._Uri._uriEncode(core.UriData._tokenCharTable, mimeType[dartx.substring](dart.notNull(slashIndex) + 1), convert.UTF8, false));
}
if (charsetName != null) {
if (indices != null) {
@@ -34851,7 +35012,7 @@
indices[dartx.add](dart.notNull(buffer.length) + 8);
}
buffer.write(";charset=");
- buffer.write(core.Uri._uriEncode(core.UriData._tokenCharTable, charsetName, convert.UTF8, false));
+ buffer.write(core._Uri._uriEncode(core.UriData._tokenCharTable, charsetName, convert.UTF8, false));
}
dart.nullSafe(parameters, _ => _[dartx.forEach](dart.fn((key, value) => {
if (dart.test(key[dartx.isEmpty])) {
@@ -34862,17 +35023,17 @@
}
if (indices != null) indices[dartx.add](buffer.length);
buffer.write(';');
- buffer.write(core.Uri._uriEncode(core.UriData._tokenCharTable, key, convert.UTF8, false));
+ buffer.write(core._Uri._uriEncode(core.UriData._tokenCharTable, key, convert.UTF8, false));
if (indices != null) indices[dartx.add](buffer.length);
buffer.write('=');
- buffer.write(core.Uri._uriEncode(core.UriData._tokenCharTable, value, convert.UTF8, false));
+ buffer.write(core._Uri._uriEncode(core.UriData._tokenCharTable, value, convert.UTF8, false));
}, StringAndStringToNull())));
}
static _validateMimeType(mimeType) {
let slashIndex = -1;
for (let i = 0; i < dart.notNull(mimeType[dartx.length]); i++) {
let char = mimeType[dartx.codeUnitAt](i);
- if (char != core.Uri._SLASH) continue;
+ if (char != core._SLASH) continue;
if (slashIndex < 0) {
slashIndex = i;
continue;
@@ -34882,10 +35043,16 @@
return slashIndex;
}
static parse(uri) {
- if (!dart.test(uri[dartx.startsWith]("data:"))) {
- dart.throw(new core.FormatException("Does not start with 'data:'", uri, 0));
+ if (dart.notNull(uri[dartx.length]) >= 5) {
+ let dataDelta = core._startsWithData(uri, 0);
+ if (dataDelta == 0) {
+ return core.UriData._parse(uri, 5, null);
+ }
+ if (dataDelta == 32) {
+ return core.UriData._parse(uri[dartx.substring](5), 0, null);
+ }
}
- return core.UriData._parse(uri, 5, null);
+ dart.throw(new core.FormatException("Does not start with 'data:'", uri, 0));
}
get uri() {
if (this[_uriCache] != null) return this[_uriCache];
@@ -34893,20 +35060,20 @@
let query = null;
let colonIndex = this[_separatorIndices][dartx._get](0);
let queryIndex = this[_text][dartx.indexOf]('?', dart.notNull(colonIndex) + 1);
- let end = null;
+ let end = this[_text][dartx.length];
if (dart.notNull(queryIndex) >= 0) {
- query = this[_text][dartx.substring](dart.notNull(queryIndex) + 1);
+ query = core._Uri._normalizeOrSubstring(this[_text], dart.notNull(queryIndex) + 1, end, core._Uri._queryCharTable);
end = queryIndex;
}
- path = this[_text][dartx.substring](dart.notNull(colonIndex) + 1, end);
- this[_uriCache] = new core.Uri._internal("data", "", null, null, path, query, null);
+ path = core._Uri._normalizeOrSubstring(this[_text], dart.notNull(colonIndex) + 1, end, core._Uri._pathCharOrSlashTable);
+ this[_uriCache] = new core._DataUri(this, path, query);
return this[_uriCache];
}
get mimeType() {
let start = dart.notNull(this[_separatorIndices][dartx._get](0)) + 1;
let end = this[_separatorIndices][dartx._get](1);
if (start == end) return "text/plain";
- return core.Uri._uriDecode(this[_text], start, end, convert.UTF8, false);
+ return core._Uri._uriDecode(this[_text], start, end, convert.UTF8, false);
}
get charset() {
let parameterStart = 1;
@@ -34918,7 +35085,7 @@
let keyStart = dart.notNull(this[_separatorIndices][dartx._get](i)) + 1;
let keyEnd = this[_separatorIndices][dartx._get](i + 1);
if (keyEnd == keyStart + 7 && dart.test(this[_text][dartx.startsWith]("charset", keyStart))) {
- return core.Uri._uriDecode(this[_text], dart.notNull(keyEnd) + 1, this[_separatorIndices][dartx._get](i + 2), convert.UTF8, false);
+ return core._Uri._uriDecode(this[_text], dart.notNull(keyEnd) + 1, this[_separatorIndices][dartx._get](i + 2), convert.UTF8, false);
}
}
return "US-ASCII";
@@ -34956,10 +35123,8 @@
result[dartx._set](index++, codeUnit);
} else {
if (i + 2 < dart.notNull(text[dartx.length])) {
- let digit1 = core.Uri._parseHexDigit(text[dartx.codeUnitAt](i + 1));
- let digit2 = core.Uri._parseHexDigit(text[dartx.codeUnitAt](i + 2));
- if (dart.notNull(digit1) >= 0 && dart.notNull(digit2) >= 0) {
- let byte = dart.notNull(digit1) * 16 + dart.notNull(digit2);
+ let byte = _internal.parseHexByte(text, i + 1);
+ if (dart.notNull(byte) >= 0) {
result[dartx._set](index++, byte);
i = i + 2;
continue;
@@ -34986,7 +35151,7 @@
let converter = convert.BASE64.decoder.fuse(core.String)(encoding.decoder);
return converter.convert(text[dartx.substring](start));
}
- return core.Uri._uriDecode(text, start, text[dartx.length], encoding, false);
+ return core._Uri._uriDecode(text, start, text[dartx.length], encoding, false);
}
get parameters() {
let result = dart.map({}, core.String, core.String);
@@ -34994,8 +35159,8 @@
let start = dart.notNull(this[_separatorIndices][dartx._get](i - 2)) + 1;
let equals = this[_separatorIndices][dartx._get](i - 1);
let end = this[_separatorIndices][dartx._get](i);
- let key = core.Uri._uriDecode(this[_text], start, equals, convert.UTF8, false);
- let value = core.Uri._uriDecode(this[_text], dart.notNull(equals) + 1, end, convert.UTF8, false);
+ let key = core._Uri._uriDecode(this[_text], start, equals, convert.UTF8, false);
+ let value = core._Uri._uriDecode(this[_text], dart.notNull(equals) + 1, end, convert.UTF8, false);
result[dartx._set](key, value);
}
return result;
@@ -35048,6 +35213,15 @@
}
}
indices[dartx.add](i);
+ let isBase64 = indices[dartx.length][dartx.isOdd];
+ if (dart.test(isBase64)) {
+ text = convert.BASE64.normalize(text, dart.notNull(i) + 1, text[dartx.length]);
+ } else {
+ let data = core._Uri._normalize(text, dart.notNull(i) + 1, text[dartx.length], core.UriData._uricTable, {escapeDelimiters: true});
+ if (data != null) {
+ text = text[dartx.replaceRange](dart.notNull(i) + 1, text[dartx.length], data);
+ }
+ }
return new core.UriData._(text, indices, sourceUri);
}
static _uriEncodeBytes(canonicalTable, bytes, buffer) {
@@ -35058,9 +35232,9 @@
if (dart.notNull(byte) < 128 && (dart.notNull(canonicalTable[dartx._get](byte[dartx['>>']](4))) & 1 << (dart.notNull(byte) & 15)) != 0) {
buffer.writeCharCode(byte);
} else {
- buffer.writeCharCode(core.Uri._PERCENT);
- buffer.writeCharCode(core.Uri._hexDigits[dartx.codeUnitAt](byte[dartx['>>']](4)));
- buffer.writeCharCode(core.Uri._hexDigits[dartx.codeUnitAt](dart.notNull(byte) & 15));
+ buffer.writeCharCode(core._PERCENT);
+ buffer.writeCharCode(core._hexDigits[dartx.codeUnitAt](byte[dartx['>>']](4)));
+ buffer.writeCharCode(core._hexDigits[dartx.codeUnitAt](dart.notNull(byte) & 15));
}
}
if ((dart.notNull(byteOr) & ~255) != 0) {
@@ -35106,7 +35280,667 @@
});
core.UriData._noScheme = -1;
core.UriData._tokenCharTable = dart.constList([0, 0, 27858, 1023, 65534, 51199, 65535, 32767], core.int);
- core.UriData._uricTable = core.Uri._queryCharTable;
+ core.UriData._uricTable = core._Uri._queryCharTable;
+ core.UriData._base64Table = dart.constList([0, 0, 34816, 1023, 65534, 2047, 65534, 2047], core.int);
+ core._schemeEndIndex = 1;
+ core._hostStartIndex = 2;
+ core._portStartIndex = 3;
+ core._pathStartIndex = 4;
+ core._queryStartIndex = 5;
+ core._fragmentStartIndex = 6;
+ core._notSimpleIndex = 7;
+ core._uriStart = 0;
+ core._nonSimpleEndStates = 14;
+ core._schemeStart = 20;
+ dart.defineLazy(core, {
+ get _scannerTables() {
+ return core._createTables();
+ }
+ });
+ core._createTables = function() {
+ let stateCount = 22;
+ let schemeOrPath = 1;
+ let authOrPath = 2;
+ let authOrPathSlash = 3;
+ let uinfoOrHost0 = 4;
+ let uinfoOrHost = 5;
+ let uinfoOrPort0 = 6;
+ let uinfoOrPort = 7;
+ let ipv6Host = 8;
+ let relPathSeg = 9;
+ let pathSeg = 10;
+ let path = 11;
+ let query = 12;
+ let fragment = 13;
+ let schemeOrPathDot = 14;
+ let schemeOrPathDot2 = 15;
+ let relPathSegDot = 16;
+ let relPathSegDot2 = 17;
+ let pathSegDot = 18;
+ let pathSegDot2 = 19;
+ let scheme0 = core._schemeStart;
+ let scheme = 21;
+ let schemeEnd = core._schemeEndIndex << 5;
+ let hostStart = core._hostStartIndex << 5;
+ let portStart = core._portStartIndex << 5;
+ let pathStart = core._pathStartIndex << 5;
+ let queryStart = core._queryStartIndex << 5;
+ let fragmentStart = core._fragmentStartIndex << 5;
+ let notSimple = core._notSimpleIndex << 5;
+ let unreserved = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-._~";
+ let subDelims = "!$&'()*+,;=";
+ let pchar = dart.str`${unreserved}${subDelims}`;
+ let tables = ListOfUint8List().generate(stateCount, dart.fn(_ => typed_data.Uint8List.new(96), intToUint8List()));
+ function build(state, defaultTransition) {
+ return (() => {
+ let _ = tables[dartx._get](core.int._check(state));
+ _[dartx.fillRange](0, 96, core.int._check(defaultTransition));
+ return _;
+ })();
+ }
+ dart.fn(build, dynamicAnddynamicToUint8List());
+ function setChars(target, chars, transition) {
+ for (let i = 0; i < dart.notNull(chars[dartx.length]); i++) {
+ let char = chars[dartx.codeUnitAt](i);
+ target[dartx._set]((dart.notNull(char) ^ 96) >>> 0, transition);
+ }
+ }
+ dart.fn(setChars, Uint8ListAndStringAndintTovoid());
+ function setRange(target, range, transition) {
+ for (let i = range[dartx.codeUnitAt](0), n = range[dartx.codeUnitAt](1); dart.notNull(i) <= dart.notNull(n); i = dart.notNull(i) + 1) {
+ target[dartx._set]((dart.notNull(i) ^ 96) >>> 0, transition);
+ }
+ }
+ dart.fn(setRange, Uint8ListAndStringAndintTovoid());
+ let b = null;
+ b = build(core._uriStart, (schemeOrPath | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), pchar, schemeOrPath);
+ setChars(typed_data.Uint8List._check(b), ".", schemeOrPathDot);
+ setChars(typed_data.Uint8List._check(b), ":", (authOrPath | schemeEnd) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "/", authOrPathSlash);
+ setChars(typed_data.Uint8List._check(b), "?", (query | queryStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "#", (fragment | fragmentStart) >>> 0);
+ b = build(schemeOrPathDot, (schemeOrPath | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), pchar, schemeOrPath);
+ setChars(typed_data.Uint8List._check(b), ".", schemeOrPathDot2);
+ setChars(typed_data.Uint8List._check(b), ':', (authOrPath | schemeEnd) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "/", (pathSeg | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "?", (query | queryStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "#", (fragment | fragmentStart) >>> 0);
+ b = build(schemeOrPathDot2, (schemeOrPath | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), pchar, schemeOrPath);
+ setChars(typed_data.Uint8List._check(b), "%", (schemeOrPath | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), ':', (authOrPath | schemeEnd) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "/", relPathSeg);
+ setChars(typed_data.Uint8List._check(b), "?", (query | queryStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "#", (fragment | fragmentStart) >>> 0);
+ b = build(schemeOrPath, (schemeOrPath | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), pchar, schemeOrPath);
+ setChars(typed_data.Uint8List._check(b), ':', (authOrPath | schemeEnd) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "/", pathSeg);
+ setChars(typed_data.Uint8List._check(b), "?", (query | queryStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "#", (fragment | fragmentStart) >>> 0);
+ b = build(authOrPath, (path | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), pchar, (path | pathStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "/", (authOrPathSlash | pathStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), ".", (pathSegDot | pathStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "?", (query | queryStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "#", (fragment | fragmentStart) >>> 0);
+ b = build(authOrPathSlash, (path | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), pchar, path);
+ setChars(typed_data.Uint8List._check(b), "/", (uinfoOrHost0 | hostStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), ".", pathSegDot);
+ setChars(typed_data.Uint8List._check(b), "?", (query | queryStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "#", (fragment | fragmentStart) >>> 0);
+ b = build(uinfoOrHost0, (uinfoOrHost | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), pchar, uinfoOrHost);
+ setRange(typed_data.Uint8List._check(b), "AZ", (uinfoOrHost | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), ":", (uinfoOrPort0 | portStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "@", (uinfoOrHost0 | hostStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "[", (ipv6Host | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "/", (pathSeg | pathStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "?", (query | queryStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "#", (fragment | fragmentStart) >>> 0);
+ b = build(uinfoOrHost, (uinfoOrHost | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), pchar, uinfoOrHost);
+ setRange(typed_data.Uint8List._check(b), "AZ", (uinfoOrHost | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), ":", (uinfoOrPort0 | portStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "@", (uinfoOrHost0 | hostStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "/", (pathSeg | pathStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "?", (query | queryStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "#", (fragment | fragmentStart) >>> 0);
+ b = build(uinfoOrPort0, (uinfoOrPort | notSimple) >>> 0);
+ setRange(typed_data.Uint8List._check(b), "19", uinfoOrPort);
+ setChars(typed_data.Uint8List._check(b), "@", (uinfoOrHost0 | hostStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "/", (pathSeg | pathStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "?", (query | queryStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "#", (fragment | fragmentStart) >>> 0);
+ b = build(uinfoOrPort, (uinfoOrPort | notSimple) >>> 0);
+ setRange(typed_data.Uint8List._check(b), "09", uinfoOrPort);
+ setChars(typed_data.Uint8List._check(b), "@", (uinfoOrHost0 | hostStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "/", (pathSeg | pathStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "?", (query | queryStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "#", (fragment | fragmentStart) >>> 0);
+ b = build(ipv6Host, ipv6Host);
+ setChars(typed_data.Uint8List._check(b), "]", uinfoOrHost);
+ b = build(relPathSeg, (path | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), pchar, path);
+ setChars(typed_data.Uint8List._check(b), ".", relPathSegDot);
+ setChars(typed_data.Uint8List._check(b), "/", (pathSeg | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "?", (query | queryStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "#", (fragment | fragmentStart) >>> 0);
+ b = build(relPathSegDot, (path | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), pchar, path);
+ setChars(typed_data.Uint8List._check(b), ".", relPathSegDot2);
+ setChars(typed_data.Uint8List._check(b), "/", (pathSeg | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "?", (query | queryStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "#", (fragment | fragmentStart) >>> 0);
+ b = build(relPathSegDot2, (path | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), pchar, path);
+ setChars(typed_data.Uint8List._check(b), "/", relPathSeg);
+ setChars(typed_data.Uint8List._check(b), "?", (query | queryStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "#", (fragment | fragmentStart) >>> 0);
+ b = build(pathSeg, (path | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), pchar, path);
+ setChars(typed_data.Uint8List._check(b), ".", pathSegDot);
+ setChars(typed_data.Uint8List._check(b), "/", (pathSeg | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "?", (query | queryStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "#", (fragment | fragmentStart) >>> 0);
+ b = build(pathSegDot, (path | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), pchar, path);
+ setChars(typed_data.Uint8List._check(b), ".", pathSegDot2);
+ setChars(typed_data.Uint8List._check(b), "/", (pathSeg | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "?", (query | queryStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "#", (fragment | fragmentStart) >>> 0);
+ b = build(pathSegDot2, (path | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), pchar, path);
+ setChars(typed_data.Uint8List._check(b), "/", (pathSeg | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "?", (query | queryStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "#", (fragment | fragmentStart) >>> 0);
+ b = build(path, (path | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), pchar, path);
+ setChars(typed_data.Uint8List._check(b), "/", pathSeg);
+ setChars(typed_data.Uint8List._check(b), "?", (query | queryStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "#", (fragment | fragmentStart) >>> 0);
+ b = build(query, (query | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), pchar, query);
+ setChars(typed_data.Uint8List._check(b), "?", query);
+ setChars(typed_data.Uint8List._check(b), "#", (fragment | fragmentStart) >>> 0);
+ b = build(fragment, (fragment | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), pchar, fragment);
+ setChars(typed_data.Uint8List._check(b), "?", fragment);
+ b = build(scheme0, (scheme | notSimple) >>> 0);
+ setRange(typed_data.Uint8List._check(b), "az", scheme);
+ b = build(scheme, (scheme | notSimple) >>> 0);
+ setRange(typed_data.Uint8List._check(b), "az", scheme);
+ setRange(typed_data.Uint8List._check(b), "09", scheme);
+ setChars(typed_data.Uint8List._check(b), "+-.", scheme);
+ return tables;
+ };
+ dart.lazyFn(core._createTables, () => VoidToListOfUint8List());
+ core._scan = function(uri, start, end, state, indices) {
+ let tables = core._scannerTables;
+ dart.assert(dart.notNull(end) <= dart.notNull(uri[dartx.length]));
+ for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(i) + 1) {
+ let table = tables[dartx._get](state);
+ let char = (dart.notNull(uri[dartx.codeUnitAt](i)) ^ 96) >>> 0;
+ if (char > 95) char = 31;
+ let transition = table[dartx._get](char);
+ state = dart.notNull(transition) & 31;
+ indices[dartx._set](transition[dartx['>>']](5), i);
+ }
+ return state;
+ };
+ dart.fn(core._scan, StringAndintAndint__Toint());
+ const _uri = Symbol('_uri');
+ const _schemeEnd = Symbol('_schemeEnd');
+ const _hostStart = Symbol('_hostStart');
+ const _portStart = Symbol('_portStart');
+ const _pathStart = Symbol('_pathStart');
+ const _queryStart = Symbol('_queryStart');
+ const _fragmentStart = Symbol('_fragmentStart');
+ const _schemeCache = Symbol('_schemeCache');
+ const _isFile = Symbol('_isFile');
+ const _isHttp = Symbol('_isHttp');
+ const _isHttps = Symbol('_isHttps');
+ const _isPackage = Symbol('_isPackage');
+ const _isScheme = Symbol('_isScheme');
+ let const$52;
+ let const$53;
+ let const$54;
+ const _isPort = Symbol('_isPort');
+ const _simpleMerge = Symbol('_simpleMerge');
+ const _toNonSimple = Symbol('_toNonSimple');
+ core._SimpleUri = class _SimpleUri extends core.Object {
+ new(uri, schemeEnd, hostStart, portStart, pathStart, queryStart, fragmentStart, schemeCache) {
+ this[_uri] = uri;
+ this[_schemeEnd] = schemeEnd;
+ this[_hostStart] = hostStart;
+ this[_portStart] = portStart;
+ this[_pathStart] = pathStart;
+ this[_queryStart] = queryStart;
+ this[_fragmentStart] = fragmentStart;
+ this[_schemeCache] = schemeCache;
+ this[_hashCodeCache] = null;
+ }
+ get hasScheme() {
+ return dart.notNull(this[_schemeEnd]) > 0;
+ }
+ get hasAuthority() {
+ return dart.notNull(this[_hostStart]) > 0;
+ }
+ get hasUserInfo() {
+ return dart.notNull(this[_hostStart]) > dart.notNull(this[_schemeEnd]) + 4;
+ }
+ get hasPort() {
+ return dart.notNull(this[_hostStart]) > 0 && dart.notNull(this[_portStart]) + 1 < dart.notNull(this[_pathStart]);
+ }
+ get hasQuery() {
+ return dart.notNull(this[_queryStart]) < dart.notNull(this[_fragmentStart]);
+ }
+ get hasFragment() {
+ return dart.notNull(this[_fragmentStart]) < dart.notNull(this[_uri][dartx.length]);
+ }
+ get [_isFile]() {
+ return this[_schemeEnd] == 4 && dart.test(this[_uri][dartx.startsWith]("file"));
+ }
+ get [_isHttp]() {
+ return this[_schemeEnd] == 4 && dart.test(this[_uri][dartx.startsWith]("http"));
+ }
+ get [_isHttps]() {
+ return this[_schemeEnd] == 5 && dart.test(this[_uri][dartx.startsWith]("https"));
+ }
+ get [_isPackage]() {
+ return this[_schemeEnd] == 7 && dart.test(this[_uri][dartx.startsWith]("package"));
+ }
+ [_isScheme](scheme) {
+ return this[_schemeEnd] == scheme[dartx.length] && dart.test(this[_uri][dartx.startsWith](scheme));
+ }
+ get hasAbsolutePath() {
+ return this[_uri][dartx.startsWith]("/", this[_pathStart]);
+ }
+ get hasEmptyPath() {
+ return this[_pathStart] == this[_queryStart];
+ }
+ get isAbsolute() {
+ return dart.test(this.hasScheme) && !dart.test(this.hasFragment);
+ }
+ isScheme(scheme) {
+ if (scheme == null || dart.test(scheme[dartx.isEmpty])) return dart.notNull(this[_schemeEnd]) < 0;
+ if (scheme[dartx.length] != this[_schemeEnd]) return false;
+ return core._Uri._compareScheme(scheme, this[_uri]);
+ }
+ get scheme() {
+ if (dart.notNull(this[_schemeEnd]) <= 0) return "";
+ if (this[_schemeCache] != null) return this[_schemeCache];
+ if (dart.test(this[_isHttp])) {
+ this[_schemeCache] = "http";
+ } else if (dart.test(this[_isHttps])) {
+ this[_schemeCache] = "https";
+ } else if (dart.test(this[_isFile])) {
+ this[_schemeCache] = "file";
+ } else if (dart.test(this[_isPackage])) {
+ this[_schemeCache] = "package";
+ } else {
+ this[_schemeCache] = this[_uri][dartx.substring](0, this[_schemeEnd]);
+ }
+ return this[_schemeCache];
+ }
+ get authority() {
+ return dart.notNull(this[_hostStart]) > 0 ? this[_uri][dartx.substring](dart.notNull(this[_schemeEnd]) + 3, this[_pathStart]) : "";
+ }
+ get userInfo() {
+ return dart.notNull(this[_hostStart]) > dart.notNull(this[_schemeEnd]) + 3 ? this[_uri][dartx.substring](dart.notNull(this[_schemeEnd]) + 3, dart.notNull(this[_hostStart]) - 1) : "";
+ }
+ get host() {
+ return dart.notNull(this[_hostStart]) > 0 ? this[_uri][dartx.substring](this[_hostStart], this[_portStart]) : "";
+ }
+ get port() {
+ if (dart.test(this.hasPort)) return core.int.parse(this[_uri][dartx.substring](dart.notNull(this[_portStart]) + 1, this[_pathStart]));
+ if (dart.test(this[_isHttp])) return 80;
+ if (dart.test(this[_isHttps])) return 443;
+ return 0;
+ }
+ get path() {
+ return this[_uri][dartx.substring](this[_pathStart], this[_queryStart]);
+ }
+ get query() {
+ return dart.notNull(this[_queryStart]) < dart.notNull(this[_fragmentStart]) ? this[_uri][dartx.substring](dart.notNull(this[_queryStart]) + 1, this[_fragmentStart]) : "";
+ }
+ get fragment() {
+ return dart.notNull(this[_fragmentStart]) < dart.notNull(this[_uri][dartx.length]) ? this[_uri][dartx.substring](dart.notNull(this[_fragmentStart]) + 1) : "";
+ }
+ get origin() {
+ let isHttp = this[_isHttp];
+ if (dart.notNull(this[_schemeEnd]) < 0) {
+ dart.throw(new core.StateError(dart.str`Cannot use origin without a scheme: ${this}`));
+ }
+ if (!dart.test(isHttp) && !dart.test(this[_isHttps])) {
+ dart.throw(new core.StateError(dart.str`Origin is only applicable schemes http and https: ${this}`));
+ }
+ if (this[_hostStart] == this[_portStart]) {
+ dart.throw(new core.StateError(dart.str`A ${this.scheme}: URI should have a non-empty host name: ${this}`));
+ }
+ if (this[_hostStart] == dart.notNull(this[_schemeEnd]) + 3) {
+ return this[_uri][dartx.substring](0, this[_pathStart]);
+ }
+ return dart.notNull(this[_uri][dartx.substring](0, dart.notNull(this[_schemeEnd]) + 3)) + dart.notNull(this[_uri][dartx.substring](this[_hostStart], this[_pathStart]));
+ }
+ get pathSegments() {
+ let start = this[_pathStart];
+ let end = this[_queryStart];
+ if (dart.test(this[_uri][dartx.startsWith]("/", start))) {
+ start = dart.notNull(start) + 1;
+ }
+ if (start == end) return const$52 || (const$52 = dart.constList([], core.String));
+ let parts = JSArrayOfString().of([]);
+ for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(i) + 1) {
+ let char = this[_uri][dartx.codeUnitAt](i);
+ if (char == core._SLASH) {
+ parts[dartx.add](this[_uri][dartx.substring](start, i));
+ start = dart.notNull(i) + 1;
+ }
+ }
+ parts[dartx.add](this[_uri][dartx.substring](start, end));
+ return ListOfString().unmodifiable(parts);
+ }
+ get queryParameters() {
+ if (!dart.test(this.hasQuery)) return const$53 || (const$53 = dart.const(dart.map({}, core.String, core.String)));
+ return new (UnmodifiableMapViewOfString$String())(core.Uri.splitQueryString(this.query));
+ }
+ get queryParametersAll() {
+ if (!dart.test(this.hasQuery)) return const$54 || (const$54 = dart.const(dart.map({}, core.String, ListOfString())));
+ let queryParameterLists = core._Uri._splitQueryStringAll(this.query);
+ for (let key of queryParameterLists[dartx.keys]) {
+ queryParameterLists[dartx._set](key, ListOfString().unmodifiable(core.Iterable._check(queryParameterLists[dartx._get](key))));
+ }
+ return MapOfString$ListOfString().unmodifiable(queryParameterLists);
+ }
+ [_isPort](port) {
+ let portDigitStart = dart.notNull(this[_portStart]) + 1;
+ return portDigitStart + dart.notNull(port[dartx.length]) == this[_pathStart] && dart.test(this[_uri][dartx.startsWith](port, portDigitStart));
+ }
+ normalizePath() {
+ return this;
+ }
+ removeFragment() {
+ if (!dart.test(this.hasFragment)) return this;
+ return new core._SimpleUri(this[_uri][dartx.substring](0, this[_fragmentStart]), this[_schemeEnd], this[_hostStart], this[_portStart], this[_pathStart], this[_queryStart], this[_fragmentStart], this[_schemeCache]);
+ }
+ replace(opts) {
+ let scheme = opts && 'scheme' in opts ? opts.scheme : null;
+ let userInfo = opts && 'userInfo' in opts ? opts.userInfo : null;
+ let host = opts && 'host' in opts ? opts.host : null;
+ let port = opts && 'port' in opts ? opts.port : null;
+ let path = opts && 'path' in opts ? opts.path : null;
+ let pathSegments = opts && 'pathSegments' in opts ? opts.pathSegments : null;
+ let query = opts && 'query' in opts ? opts.query : null;
+ let queryParameters = opts && 'queryParameters' in opts ? opts.queryParameters : null;
+ let fragment = opts && 'fragment' in opts ? opts.fragment : null;
+ let schemeChanged = false;
+ if (scheme != null) {
+ scheme = core._Uri._makeScheme(scheme, 0, scheme[dartx.length]);
+ schemeChanged = !dart.test(this[_isScheme](scheme));
+ } else {
+ scheme = this.scheme;
+ }
+ let isFile = scheme == "file";
+ if (userInfo != null) {
+ userInfo = core._Uri._makeUserInfo(userInfo, 0, userInfo[dartx.length]);
+ } else if (dart.notNull(this[_hostStart]) > 0) {
+ userInfo = this[_uri][dartx.substring](dart.notNull(this[_schemeEnd]) + 3, this[_hostStart]);
+ } else {
+ userInfo = "";
+ }
+ if (port != null) {
+ port = core._Uri._makePort(port, scheme);
+ } else {
+ port = dart.test(this.hasPort) ? this.port : null;
+ if (schemeChanged) {
+ port = core._Uri._makePort(port, scheme);
+ }
+ }
+ if (host != null) {
+ host = core._Uri._makeHost(host, 0, host[dartx.length], false);
+ } else if (dart.notNull(this[_hostStart]) > 0) {
+ host = this[_uri][dartx.substring](this[_hostStart], this[_portStart]);
+ } else if (dart.test(userInfo[dartx.isNotEmpty]) || port != null || isFile) {
+ host = "";
+ }
+ let hasAuthority = host != null;
+ if (path != null || pathSegments != null) {
+ path = core._Uri._makePath(path, 0, core._stringOrNullLength(path), pathSegments, scheme, hasAuthority);
+ } else {
+ path = this[_uri][dartx.substring](this[_pathStart], this[_queryStart]);
+ if ((isFile || hasAuthority && !dart.test(path[dartx.isEmpty])) && !dart.test(path[dartx.startsWith]('/'))) {
+ path = "/" + dart.notNull(path);
+ }
+ }
+ if (query != null || queryParameters != null) {
+ query = core._Uri._makeQuery(query, 0, core._stringOrNullLength(query), queryParameters);
+ } else if (dart.notNull(this[_queryStart]) < dart.notNull(this[_fragmentStart])) {
+ query = this[_uri][dartx.substring](dart.notNull(this[_queryStart]) + 1, this[_fragmentStart]);
+ }
+ if (fragment != null) {
+ fragment = core._Uri._makeFragment(fragment, 0, fragment[dartx.length]);
+ } else if (dart.notNull(this[_fragmentStart]) < dart.notNull(this[_uri][dartx.length])) {
+ fragment = this[_uri][dartx.substring](dart.notNull(this[_fragmentStart]) + 1);
+ }
+ return new core._Uri._internal(scheme, userInfo, host, port, path, query, fragment);
+ }
+ resolve(reference) {
+ return this.resolveUri(core.Uri.parse(reference));
+ }
+ resolveUri(reference) {
+ if (core._SimpleUri.is(reference)) {
+ return this[_simpleMerge](this, reference);
+ }
+ return this[_toNonSimple]().resolveUri(reference);
+ }
+ [_simpleMerge](base, ref) {
+ if (dart.test(ref.hasScheme)) return ref;
+ if (dart.test(ref.hasAuthority)) {
+ if (!dart.test(base.hasScheme)) return ref;
+ let isSimple = true;
+ if (dart.test(base[_isFile])) {
+ isSimple = !dart.test(ref.hasEmptyPath);
+ } else if (dart.test(base[_isHttp])) {
+ isSimple = !dart.test(ref[_isPort]("80"));
+ } else if (dart.test(base[_isHttps])) {
+ isSimple = !dart.test(ref[_isPort]("443"));
+ }
+ if (isSimple) {
+ let delta = dart.notNull(base[_schemeEnd]) + 1;
+ let newUri = dart.notNull(base[_uri][dartx.substring](0, dart.notNull(base[_schemeEnd]) + 1)) + dart.notNull(ref[_uri][dartx.substring](dart.notNull(ref[_schemeEnd]) + 1));
+ return new core._SimpleUri(newUri, base[_schemeEnd], dart.notNull(ref[_hostStart]) + delta, dart.notNull(ref[_portStart]) + delta, dart.notNull(ref[_pathStart]) + delta, dart.notNull(ref[_queryStart]) + delta, dart.notNull(ref[_fragmentStart]) + delta, base[_schemeCache]);
+ } else {
+ return this[_toNonSimple]().resolveUri(ref);
+ }
+ }
+ if (dart.test(ref.hasEmptyPath)) {
+ if (dart.test(ref.hasQuery)) {
+ let delta = dart.notNull(base[_queryStart]) - dart.notNull(ref[_queryStart]);
+ let newUri = dart.notNull(base[_uri][dartx.substring](0, base[_queryStart])) + dart.notNull(ref[_uri][dartx.substring](ref[_queryStart]));
+ return new core._SimpleUri(newUri, base[_schemeEnd], base[_hostStart], base[_portStart], base[_pathStart], dart.notNull(ref[_queryStart]) + delta, dart.notNull(ref[_fragmentStart]) + delta, base[_schemeCache]);
+ }
+ if (dart.test(ref.hasFragment)) {
+ let delta = dart.notNull(base[_fragmentStart]) - dart.notNull(ref[_fragmentStart]);
+ let newUri = dart.notNull(base[_uri][dartx.substring](0, base[_fragmentStart])) + dart.notNull(ref[_uri][dartx.substring](ref[_fragmentStart]));
+ return new core._SimpleUri(newUri, base[_schemeEnd], base[_hostStart], base[_portStart], base[_pathStart], base[_queryStart], dart.notNull(ref[_fragmentStart]) + delta, base[_schemeCache]);
+ }
+ return base.removeFragment();
+ }
+ if (dart.test(ref.hasAbsolutePath)) {
+ let delta = dart.notNull(base[_pathStart]) - dart.notNull(ref[_pathStart]);
+ let newUri = dart.notNull(base[_uri][dartx.substring](0, base[_pathStart])) + dart.notNull(ref[_uri][dartx.substring](ref[_pathStart]));
+ return new core._SimpleUri(newUri, base[_schemeEnd], base[_hostStart], base[_portStart], base[_pathStart], dart.notNull(ref[_queryStart]) + delta, dart.notNull(ref[_fragmentStart]) + delta, base[_schemeCache]);
+ }
+ if (dart.test(base.hasEmptyPath) && dart.test(base.hasAuthority)) {
+ let refStart = ref[_pathStart];
+ while (dart.test(ref[_uri][dartx.startsWith]("../", refStart))) {
+ refStart = dart.notNull(refStart) + 3;
+ }
+ let delta = dart.notNull(base[_pathStart]) - dart.notNull(refStart) + 1;
+ let newUri = dart.str`${base[_uri][dartx.substring](0, base[_pathStart])}/` + dart.str`${ref[_uri][dartx.substring](refStart)}`;
+ return new core._SimpleUri(newUri, base[_schemeEnd], base[_hostStart], base[_portStart], base[_pathStart], dart.notNull(ref[_queryStart]) + delta, dart.notNull(ref[_fragmentStart]) + delta, base[_schemeCache]);
+ }
+ let baseUri = base[_uri];
+ let refUri = ref[_uri];
+ let baseStart = base[_pathStart];
+ let baseEnd = base[_queryStart];
+ while (dart.test(baseUri[dartx.startsWith]("../", baseStart))) {
+ baseStart = dart.notNull(baseStart) + 3;
+ }
+ let refStart = ref[_pathStart];
+ let refEnd = ref[_queryStart];
+ let backCount = 0;
+ while (dart.notNull(refStart) + 3 <= dart.notNull(refEnd) && dart.test(refUri[dartx.startsWith]("../", refStart))) {
+ refStart = dart.notNull(refStart) + 3;
+ backCount = backCount + 1;
+ }
+ let insert = "";
+ while (dart.notNull(baseEnd) > dart.notNull(baseStart)) {
+ baseEnd = dart.notNull(baseEnd) - 1;
+ let char = baseUri[dartx.codeUnitAt](baseEnd);
+ if (char == core._SLASH) {
+ insert = "/";
+ if (backCount == 0) break;
+ backCount--;
+ }
+ }
+ if (baseEnd == baseStart && !dart.test(base.hasScheme) && !dart.test(base.hasAbsolutePath)) {
+ insert = "";
+ refStart = dart.notNull(refStart) - backCount * 3;
+ }
+ let delta = dart.notNull(baseEnd) - dart.notNull(refStart) + dart.notNull(insert[dartx.length]);
+ let newUri = dart.str`${base[_uri][dartx.substring](0, baseEnd)}${insert}` + dart.str`${ref[_uri][dartx.substring](refStart)}`;
+ return new core._SimpleUri(newUri, base[_schemeEnd], base[_hostStart], base[_portStart], base[_pathStart], dart.notNull(ref[_queryStart]) + delta, dart.notNull(ref[_fragmentStart]) + delta, base[_schemeCache]);
+ }
+ toFilePath(opts) {
+ let windows = opts && 'windows' in opts ? opts.windows : null;
+ if (dart.notNull(this[_schemeEnd]) >= 0 && !dart.test(this[_isFile])) {
+ dart.throw(new core.UnsupportedError(dart.str`Cannot extract a file path from a ${this.scheme} URI`));
+ }
+ if (dart.notNull(this[_queryStart]) < dart.notNull(this[_uri][dartx.length])) {
+ if (dart.notNull(this[_queryStart]) < dart.notNull(this[_fragmentStart])) {
+ dart.throw(new core.UnsupportedError("Cannot extract a file path from a URI with a query component"));
+ }
+ dart.throw(new core.UnsupportedError("Cannot extract a file path from a URI with a fragment component"));
+ }
+ if (windows == null) windows = core._Uri._isWindows;
+ return dart.test(windows) ? core._Uri._toWindowsFilePath(this) : this[_toFilePath]();
+ }
+ [_toFilePath]() {
+ if (dart.notNull(this[_hostStart]) < dart.notNull(this[_portStart])) {
+ dart.throw(new core.UnsupportedError("Cannot extract a non-Windows file path from a file URI " + "with an authority"));
+ }
+ return this.path;
+ }
+ get data() {
+ dart.assert(this.scheme != "data");
+ return null;
+ }
+ get hashCode() {
+ return (() => {
+ let t = this[_hashCodeCache];
+ return t == null ? this[_hashCodeCache] = dart.hashCode(this[_uri]) : t;
+ })();
+ }
+ ['=='](other) {
+ if (core.identical(this, other)) return true;
+ if (core.Uri.is(other)) return this[_uri] == dart.toString(other);
+ return false;
+ }
+ [_toNonSimple]() {
+ return new core._Uri._internal(this.scheme, this.userInfo, dart.test(this.hasAuthority) ? this.host : null, dart.test(this.hasPort) ? this.port : null, this.path, dart.test(this.hasQuery) ? this.query : null, dart.test(this.hasFragment) ? this.fragment : null);
+ }
+ toString() {
+ return this[_uri];
+ }
+ };
+ core._SimpleUri[dart.implements] = () => [core.Uri];
+ dart.setSignature(core._SimpleUri, {
+ fields: () => ({
+ [_uri]: core.String,
+ [_schemeEnd]: core.int,
+ [_hostStart]: core.int,
+ [_portStart]: core.int,
+ [_pathStart]: core.int,
+ [_queryStart]: core.int,
+ [_fragmentStart]: core.int,
+ [_schemeCache]: core.String,
+ [_hashCodeCache]: core.int
+ }),
+ getters: () => ({
+ hasScheme: dart.definiteFunctionType(core.bool, []),
+ hasAuthority: dart.definiteFunctionType(core.bool, []),
+ hasUserInfo: dart.definiteFunctionType(core.bool, []),
+ hasPort: dart.definiteFunctionType(core.bool, []),
+ hasQuery: dart.definiteFunctionType(core.bool, []),
+ hasFragment: dart.definiteFunctionType(core.bool, []),
+ [_isFile]: dart.definiteFunctionType(core.bool, []),
+ [_isHttp]: dart.definiteFunctionType(core.bool, []),
+ [_isHttps]: dart.definiteFunctionType(core.bool, []),
+ [_isPackage]: dart.definiteFunctionType(core.bool, []),
+ hasAbsolutePath: dart.definiteFunctionType(core.bool, []),
+ hasEmptyPath: dart.definiteFunctionType(core.bool, []),
+ isAbsolute: dart.definiteFunctionType(core.bool, []),
+ scheme: dart.definiteFunctionType(core.String, []),
+ authority: dart.definiteFunctionType(core.String, []),
+ userInfo: dart.definiteFunctionType(core.String, []),
+ host: dart.definiteFunctionType(core.String, []),
+ port: dart.definiteFunctionType(core.int, []),
+ path: dart.definiteFunctionType(core.String, []),
+ query: dart.definiteFunctionType(core.String, []),
+ fragment: dart.definiteFunctionType(core.String, []),
+ origin: dart.definiteFunctionType(core.String, []),
+ pathSegments: dart.definiteFunctionType(core.List$(core.String), []),
+ queryParameters: dart.definiteFunctionType(core.Map$(core.String, core.String), []),
+ queryParametersAll: dart.definiteFunctionType(core.Map$(core.String, core.List$(core.String)), []),
+ data: dart.definiteFunctionType(core.UriData, [])
+ }),
+ methods: () => ({
+ [_isScheme]: dart.definiteFunctionType(core.bool, [core.String]),
+ isScheme: dart.definiteFunctionType(core.bool, [core.String]),
+ [_isPort]: dart.definiteFunctionType(core.bool, [core.String]),
+ normalizePath: dart.definiteFunctionType(core.Uri, []),
+ removeFragment: dart.definiteFunctionType(core.Uri, []),
+ replace: dart.definiteFunctionType(core.Uri, [], {scheme: core.String, userInfo: core.String, host: core.String, port: core.int, path: core.String, pathSegments: IterableOfString(), query: core.String, queryParameters: MapOfString$dynamic(), fragment: core.String}),
+ resolve: dart.definiteFunctionType(core.Uri, [core.String]),
+ resolveUri: dart.definiteFunctionType(core.Uri, [core.Uri]),
+ [_simpleMerge]: dart.definiteFunctionType(core.Uri, [core._SimpleUri, core._SimpleUri]),
+ toFilePath: dart.definiteFunctionType(core.String, [], {windows: core.bool}),
+ [_toFilePath]: dart.definiteFunctionType(core.String, []),
+ '==': dart.definiteFunctionType(core.bool, [core.Object]),
+ [_toNonSimple]: dart.definiteFunctionType(core.Uri, [])
+ })
+ });
+ const _data$ = Symbol('_data');
+ core._DataUri = class _DataUri extends core._Uri {
+ new(data, path, query) {
+ this[_data$] = data;
+ super._internal("data", null, null, null, path, query, null);
+ }
+ get data() {
+ return this[_data$];
+ }
+ };
+ dart.setSignature(core._DataUri, {
+ fields: () => ({[_data$]: core.UriData})
+ });
+ core._startsWithData = function(text, start) {
+ let delta = ((dart.notNull(text[dartx.codeUnitAt](dart.notNull(start) + 4)) ^ core._COLON) >>> 0) * 3;
+ delta = (delta | dart.notNull(text[dartx.codeUnitAt](start)) ^ 100) >>> 0;
+ delta = (delta | dart.notNull(text[dartx.codeUnitAt](dart.notNull(start) + 1)) ^ 97) >>> 0;
+ delta = (delta | dart.notNull(text[dartx.codeUnitAt](dart.notNull(start) + 2)) ^ 116) >>> 0;
+ delta = (delta | dart.notNull(text[dartx.codeUnitAt](dart.notNull(start) + 3)) ^ 97) >>> 0;
+ return delta;
+ };
+ dart.fn(core._startsWithData, StringAndintToint());
+ core._stringOrNullLength = function(s) {
+ return s == null ? 0 : s[dartx.length];
+ };
+ dart.fn(core._stringOrNullLength, StringToint$());
developer.debugger = function(opts) {
let when = opts && 'when' in opts ? opts.when : true;
let message = opts && 'message' in opts ? opts.message : null;
@@ -35136,6 +35970,49 @@
}
});
developer._clockValue = 0;
+ developer._FakeUserTag = class _FakeUserTag extends core.Object {
+ real(label) {
+ this.label = label;
+ }
+ static new(label) {
+ let existingTag = developer._FakeUserTag._instances[dartx._get](label);
+ if (existingTag != null) {
+ return developer._FakeUserTag._check(existingTag);
+ }
+ if (developer._FakeUserTag._instances[dartx.length] == developer.UserTag.MAX_USER_TAGS) {
+ dart.throw(new core.UnsupportedError(dart.str`UserTag instance limit (${developer.UserTag.MAX_USER_TAGS}) reached.`));
+ }
+ let instance = new developer._FakeUserTag.real(label);
+ developer._FakeUserTag._instances[dartx._set](label, instance);
+ return instance;
+ }
+ makeCurrent() {
+ let old = developer._currentTag;
+ developer._currentTag = this;
+ return old;
+ }
+ };
+ dart.defineNamedConstructor(developer._FakeUserTag, 'real');
+ developer._FakeUserTag[dart.implements] = () => [developer.UserTag];
+ dart.setSignature(developer._FakeUserTag, {
+ fields: () => ({label: core.String}),
+ methods: () => ({makeCurrent: dart.definiteFunctionType(developer.UserTag, [])})
+ });
+ dart.defineLazy(developer._FakeUserTag, {
+ get _instances() {
+ return dart.map();
+ },
+ set _instances(_) {},
+ get _defaultTag() {
+ return developer._FakeUserTag.new('Default');
+ }
+ });
+ dart.defineLazy(developer, {
+ get _currentTag() {
+ return developer._FakeUserTag._defaultTag;
+ },
+ set _currentTag(_) {}
+ });
const _result = Symbol('_result');
const _errorCode = Symbol('_errorCode');
const _errorDetail = Symbol('_errorDetail');
@@ -35257,7 +36134,7 @@
dart.fn(developer.postEvent, StringAndMapTovoid());
developer._postEvent = function(eventKind, eventData) {
};
- dart.fn(developer._postEvent, StringAndStringTodynamic());
+ dart.fn(developer._postEvent, StringAndStringTovoid$());
developer._lookupExtension = function(method) {
return developer._extensions[dartx._get](method);
};
@@ -35275,49 +36152,6 @@
}
};
developer.UserTag.MAX_USER_TAGS = 64;
- developer._FakeUserTag = class _FakeUserTag extends core.Object {
- real(label) {
- this.label = label;
- }
- static new(label) {
- let existingTag = developer._FakeUserTag._instances[dartx._get](label);
- if (existingTag != null) {
- return developer._FakeUserTag._check(existingTag);
- }
- if (developer._FakeUserTag._instances[dartx.length] == developer.UserTag.MAX_USER_TAGS) {
- dart.throw(new core.UnsupportedError(dart.str`UserTag instance limit (${developer.UserTag.MAX_USER_TAGS}) reached.`));
- }
- let instance = new developer._FakeUserTag.real(label);
- developer._FakeUserTag._instances[dartx._set](label, instance);
- return instance;
- }
- makeCurrent() {
- let old = developer._currentTag;
- developer._currentTag = this;
- return old;
- }
- };
- dart.defineNamedConstructor(developer._FakeUserTag, 'real');
- developer._FakeUserTag[dart.implements] = () => [developer.UserTag];
- dart.setSignature(developer._FakeUserTag, {
- fields: () => ({label: core.String}),
- methods: () => ({makeCurrent: dart.definiteFunctionType(developer.UserTag, [])})
- });
- dart.defineLazy(developer._FakeUserTag, {
- get _instances() {
- return dart.map();
- },
- set _instances(_) {},
- get _defaultTag() {
- return developer._FakeUserTag.new('Default');
- }
- });
- dart.defineLazy(developer, {
- get _currentTag() {
- return developer._FakeUserTag._defaultTag;
- },
- set _currentTag(_) {}
- });
developer.getCurrentTag = function() {
return developer._currentTag;
};
@@ -35750,7 +36584,7 @@
developer.Service = class Service extends core.Object {
static getInfo() {
return dart.async(function*() {
- let receivePort = isolate.RawReceivePort.new();
+ let receivePort = isolate$.RawReceivePort.new();
let uriCompleter = CompleterOfUri().new();
receivePort.handler = dart.fn(uri => uriCompleter.complete(uri), UriTovoid());
developer._getServerInfo(receivePort.sendPort);
@@ -35765,7 +36599,7 @@
if (!(typeof enable == 'boolean')) {
dart.throw(new core.ArgumentError.value(enable, 'enable', 'Must be a bool'));
}
- let receivePort = isolate.RawReceivePort.new();
+ let receivePort = isolate$.RawReceivePort.new();
let uriCompleter = CompleterOfUri().new();
receivePort.handler = dart.fn(uri => uriCompleter.complete(uri), UriTovoid());
developer._webServerControl(receivePort.sendPort, enable);
@@ -35774,20 +36608,27 @@
return new developer.ServiceProtocolInfo(uri);
}, developer.ServiceProtocolInfo, opts);
}
+ static getIsolateID(isolate) {
+ if (!isolate$.Isolate.is(isolate)) {
+ dart.throw(new core.ArgumentError.value(isolate, 'isolate', 'Must be an Isolate'));
+ }
+ return developer._getIsolateIDFromSendPort(isolate.controlPort);
+ }
};
dart.setSignature(developer.Service, {
statics: () => ({
getInfo: dart.definiteFunctionType(async.Future$(developer.ServiceProtocolInfo), []),
- controlWebServer: dart.definiteFunctionType(async.Future$(developer.ServiceProtocolInfo), [], {enable: core.bool})
+ controlWebServer: dart.definiteFunctionType(async.Future$(developer.ServiceProtocolInfo), [], {enable: core.bool}),
+ getIsolateID: dart.definiteFunctionType(core.String, [isolate$.Isolate])
}),
- names: ['getInfo', 'controlWebServer']
+ names: ['getInfo', 'controlWebServer', 'getIsolateID']
});
- developer._getServerInfo = function(sp) {
- sp.send(null);
+ developer._getServerInfo = function(sendPort) {
+ sendPort.send(null);
};
dart.lazyFn(developer._getServerInfo, () => SendPortTovoid());
- developer._webServerControl = function(sp, enable) {
- sp.send(null);
+ developer._webServerControl = function(sendPort, enable) {
+ sendPort.send(null);
};
dart.lazyFn(developer._webServerControl, () => SendPortAndboolTovoid());
developer._getServiceMajorVersion = function() {
@@ -35798,6 +36639,10 @@
return 0;
};
dart.fn(developer._getServiceMinorVersion, VoidToint());
+ developer._getIsolateIDFromSendPort = function(sendPort) {
+ return null;
+ };
+ dart.lazyFn(developer._getIsolateIDFromSendPort, () => SendPortToString());
io.BytesBuilder = class BytesBuilder extends core.Object {
static new(opts) {
let copy = opts && 'copy' in opts ? opts.copy : true;
@@ -35808,27 +36653,21 @@
}
}
};
- const _length$2 = Symbol('_length');
const _buffer$ = Symbol('_buffer');
- const _pow2roundup = Symbol('_pow2roundup');
+ const _length$2 = Symbol('_length');
+ const _grow$ = Symbol('_grow');
io._CopyingBytesBuilder = class _CopyingBytesBuilder extends core.Object {
- new() {
+ new(initialCapacity) {
+ if (initialCapacity === void 0) initialCapacity = 0;
+ this[_buffer$] = dart.notNull(initialCapacity) <= 0 ? io._CopyingBytesBuilder._emptyList : typed_data.Uint8List.new(io._CopyingBytesBuilder._pow2roundup(initialCapacity));
this[_length$2] = 0;
- this[_buffer$] = null;
}
add(bytes) {
let bytesLength = bytes[dartx.length];
if (bytesLength == 0) return;
let required = dart.notNull(this[_length$2]) + dart.notNull(bytesLength);
- if (this[_buffer$] == null) {
- let size = this[_pow2roundup](required);
- size = math.max(core.int)(size, io._CopyingBytesBuilder._INIT_SIZE);
- this[_buffer$] = typed_data.Uint8List.new(size);
- } else if (dart.notNull(this[_buffer$][dartx.length]) < required) {
- let size = dart.notNull(this[_pow2roundup](required)) * 2;
- let newBuffer = typed_data.Uint8List.new(size);
- newBuffer[dartx.setRange](0, this[_buffer$][dartx.length], this[_buffer$]);
- this[_buffer$] = newBuffer;
+ if (dart.notNull(this[_buffer$][dartx.length]) < required) {
+ this[_grow$](required);
}
dart.assert(dart.notNull(this[_buffer$][dartx.length]) >= required);
if (typed_data.Uint8List.is(bytes)) {
@@ -35841,16 +36680,32 @@
this[_length$2] = required;
}
addByte(byte) {
- this.add(JSArrayOfint().of([byte]));
+ if (this[_buffer$][dartx.length] == this[_length$2]) {
+ this[_grow$](this[_length$2]);
+ }
+ dart.assert(dart.notNull(this[_buffer$][dartx.length]) > dart.notNull(this[_length$2]));
+ this[_buffer$][dartx._set](this[_length$2], byte);
+ this[_length$2] = dart.notNull(this[_length$2]) + 1;
+ }
+ [_grow$](required) {
+ let newSize = dart.notNull(required) * 2;
+ if (dart.notNull(newSize) < io._CopyingBytesBuilder._INIT_SIZE) {
+ newSize = io._CopyingBytesBuilder._INIT_SIZE;
+ } else {
+ newSize = io._CopyingBytesBuilder._pow2roundup(newSize);
+ }
+ let newBuffer = typed_data.Uint8List.new(newSize);
+ newBuffer[dartx.setRange](0, this[_buffer$][dartx.length], this[_buffer$]);
+ this[_buffer$] = newBuffer;
}
takeBytes() {
- if (this[_buffer$] == null) return typed_data.Uint8List.new(0);
+ if (this[_length$2] == 0) return io._CopyingBytesBuilder._emptyList;
let buffer = typed_data.Uint8List.view(this[_buffer$][dartx.buffer], 0, this[_length$2]);
this.clear();
return buffer;
}
toBytes() {
- if (this[_buffer$] == null) return typed_data.Uint8List.new(0);
+ if (this[_length$2] == 0) return io._CopyingBytesBuilder._emptyList;
return typed_data.Uint8List.fromList(typed_data.Uint8List.view(this[_buffer$][dartx.buffer], 0, this[_length$2]));
}
get length() {
@@ -35864,9 +36719,10 @@
}
clear() {
this[_length$2] = 0;
- this[_buffer$] = null;
+ this[_buffer$] = io._CopyingBytesBuilder._emptyList;
}
- [_pow2roundup](x) {
+ static _pow2roundup(x) {
+ dart.assert(dart.notNull(x) > 0);
x = dart.notNull(x) - 1;
x = (dart.notNull(x) | x[dartx['>>']](1)) >>> 0;
x = (dart.notNull(x) | x[dartx['>>']](2)) >>> 0;
@@ -35890,33 +36746,48 @@
methods: () => ({
add: dart.definiteFunctionType(dart.void, [ListOfint()]),
addByte: dart.definiteFunctionType(dart.void, [core.int]),
+ [_grow$]: dart.definiteFunctionType(dart.void, [core.int]),
takeBytes: dart.definiteFunctionType(core.List$(core.int), []),
toBytes: dart.definiteFunctionType(core.List$(core.int), []),
- clear: dart.definiteFunctionType(dart.void, []),
- [_pow2roundup]: dart.definiteFunctionType(core.int, [core.int])
- })
+ clear: dart.definiteFunctionType(dart.void, [])
+ }),
+ statics: () => ({_pow2roundup: dart.definiteFunctionType(core.int, [core.int])}),
+ names: ['_pow2roundup']
});
io._CopyingBytesBuilder._INIT_SIZE = 1024;
+ dart.defineLazy(io._CopyingBytesBuilder, {
+ get _emptyList() {
+ return typed_data.Uint8List.new(0);
+ }
+ });
const _chunks = Symbol('_chunks');
io._BytesBuilder = class _BytesBuilder extends core.Object {
new() {
- this[_chunks] = JSArrayOfListOfint().of([]);
+ this[_chunks] = JSArrayOfUint8List().of([]);
this[_length$2] = 0;
}
add(bytes) {
- if (!typed_data.Uint8List.is(bytes)) {
- bytes = typed_data.Uint8List.fromList(bytes);
+ let typedBytes = null;
+ if (typed_data.Uint8List.is(bytes)) {
+ typedBytes = bytes;
+ } else {
+ typedBytes = typed_data.Uint8List.fromList(bytes);
}
- this[_chunks][dartx.add](bytes);
- this[_length$2] = dart.notNull(this[_length$2]) + dart.notNull(bytes[dartx.length]);
+ this[_chunks][dartx.add](typedBytes);
+ this[_length$2] = dart.notNull(this[_length$2]) + dart.notNull(typedBytes[dartx.length]);
}
addByte(byte) {
- this.add(JSArrayOfint().of([byte]));
+ this[_chunks][dartx.add]((() => {
+ let _ = typed_data.Uint8List.new(1);
+ _[dartx._set](0, byte);
+ return _;
+ })());
+ this[_length$2] = dart.notNull(this[_length$2]) + 1;
}
takeBytes() {
- if (this[_chunks][dartx.length] == 0) return typed_data.Uint8List.new(0);
+ if (this[_length$2] == 0) return io._CopyingBytesBuilder._emptyList;
if (this[_chunks][dartx.length] == 1) {
- let buffer = this[_chunks][dartx.single];
+ let buffer = this[_chunks][dartx._get](0);
this.clear();
return buffer;
}
@@ -35930,7 +36801,7 @@
return buffer;
}
toBytes() {
- if (this[_chunks][dartx.length] == 0) return typed_data.Uint8List.new(0);
+ if (this[_length$2] == 0) return io._CopyingBytesBuilder._emptyList;
let buffer = typed_data.Uint8List.new(this[_length$2]);
let offset = 0;
for (let chunk of this[_chunks]) {
@@ -35957,7 +36828,7 @@
dart.setSignature(io._BytesBuilder, {
fields: () => ({
[_length$2]: core.int,
- [_chunks]: ListOfListOfint()
+ [_chunks]: ListOfUint8List()
}),
getters: () => ({
length: dart.definiteFunctionType(core.int, []),
@@ -35988,7 +36859,7 @@
switch (dart.dindex(response, io._ERROR_RESPONSE_ERROR_TYPE)) {
case io._ILLEGAL_ARGUMENT_RESPONSE:
{
- return new core.ArgumentError();
+ return new core.ArgumentError(dart.str`${message}: ${path}`);
}
case io._OSERROR_RESPONSE:
{
@@ -36051,7 +36922,7 @@
};
dart.setSignature(io._BufferAndStart, {
fields: () => ({
- buffer: core.List,
+ buffer: ListOfint(),
start: core.int
})
});
@@ -36063,7 +36934,7 @@
let newBuffer = typed_data.Uint8List.new(length);
let j = start;
for (let i = 0; i < length; i++) {
- let value = core.int._check(buffer[dartx._get](j));
+ let value = buffer[dartx._get](j);
if (!(typeof value == 'number')) {
dart.throw(new core.ArgumentError(dart.str`List element is not an integer at index ${j}`));
}
@@ -36072,7 +36943,7 @@
}
return new io._BufferAndStart(newBuffer, 0);
};
- dart.fn(io._ensureFastAndSerializableByteData, ListAndintAndintTo_BufferAndStart());
+ dart.fn(io._ensureFastAndSerializableByteData, ListOfintAndintAndintTo_BufferAndStart());
io._IOCrypto = class _IOCrypto extends core.Object {
static getRandomBytes(count) {
dart.throw(new core.UnsupportedError("_IOCrypto.getRandomBytes"));
@@ -36238,13 +37109,13 @@
}
close() {
if (dart.test(this[_digestCalled])) {
- return ListOfint()._check(this[_resultAsBytes]());
+ return this[_resultAsBytes]();
}
this[_digestCalled] = true;
this[_finalizeData]();
this[_iterate]();
dart.assert(this[_pendingData][dartx.length] == 0);
- return ListOfint()._check(this[_resultAsBytes]());
+ return this[_resultAsBytes]();
}
get blockSize() {
return dart.notNull(this[_chunkSizeInWords]) * io._BYTES_PER_WORD;
@@ -36260,9 +37131,9 @@
return (val[dartx['<<']](mod_shift) & io._MASK_32 | ((dart.notNull(val) & io._MASK_32) >>> 0)[dartx['>>']](32 - mod_shift)) >>> 0;
}
[_resultAsBytes]() {
- let result = [];
+ let result = JSArrayOfint().of([]);
for (let i = 0; i < dart.notNull(this[_h][dartx.length]); i++) {
- result[dartx.addAll](core.Iterable._check(this[_wordToBytes](this[_h][dartx._get](i))));
+ result[dartx.addAll](this[_wordToBytes](this[_h][dartx._get](i)));
}
return result;
}
@@ -36313,11 +37184,11 @@
let lengthInBits = dart.notNull(this[_lengthInBytes]) * io._BITS_PER_BYTE;
dart.assert(lengthInBits < dart.notNull(math.pow(2, 32)));
if (dart.test(this[_bigEndianWords])) {
- this[_pendingData][dartx.addAll](IterableOfint()._check(this[_wordToBytes](0)));
- this[_pendingData][dartx.addAll](IterableOfint()._check(this[_wordToBytes]((lengthInBits & io._MASK_32) >>> 0)));
+ this[_pendingData][dartx.addAll](this[_wordToBytes](0));
+ this[_pendingData][dartx.addAll](this[_wordToBytes]((lengthInBits & io._MASK_32) >>> 0));
} else {
- this[_pendingData][dartx.addAll](IterableOfint()._check(this[_wordToBytes]((lengthInBits & io._MASK_32) >>> 0)));
- this[_pendingData][dartx.addAll](IterableOfint()._check(this[_wordToBytes](0)));
+ this[_pendingData][dartx.addAll](this[_wordToBytes]((lengthInBits & io._MASK_32) >>> 0));
+ this[_pendingData][dartx.addAll](this[_wordToBytes](0));
}
}
};
@@ -36339,9 +37210,9 @@
[_add32]: dart.definiteFunctionType(dart.dynamic, [dart.dynamic, dart.dynamic]),
[_roundUp]: dart.definiteFunctionType(dart.dynamic, [dart.dynamic, dart.dynamic]),
[_rotl32]: dart.definiteFunctionType(core.int, [core.int, core.int]),
- [_resultAsBytes]: dart.definiteFunctionType(dart.dynamic, []),
+ [_resultAsBytes]: dart.definiteFunctionType(core.List$(core.int), []),
[_bytesToChunk]: dart.definiteFunctionType(dart.dynamic, [ListOfint(), core.int]),
- [_wordToBytes]: dart.definiteFunctionType(dart.dynamic, [core.int]),
+ [_wordToBytes]: dart.definiteFunctionType(core.List$(core.int), [core.int]),
[_iterate]: dart.definiteFunctionType(dart.dynamic, []),
[_finalizeData]: dart.definiteFunctionType(dart.dynamic, [])
})
@@ -36623,6 +37494,7 @@
}
};
dart.addSimpleTypeTests(io.ZLibEncoder);
+ io.ZLibEncoder[dart.implements] = () => [ChunkedConverterOfListOfint$ListOfint$ListOfint$ListOfint()];
dart.setSignature(io.ZLibEncoder, {
fields: () => ({
gzip: core.bool,
@@ -36705,7 +37577,7 @@
const _filter$ = Symbol('_filter');
const _closed = Symbol('_closed');
const _empty = Symbol('_empty');
- let const$52;
+ let const$55;
io._FilterSink = class _FilterSink extends convert.ByteConversionSink {
new(sink, filter) {
this[_sink$0] = sink;
@@ -36724,10 +37596,10 @@
try {
this[_empty] = false;
let bufferAndStart = io._ensureFastAndSerializableByteData(data, start, end);
- this[_filter$].process(ListOfint()._check(bufferAndStart.buffer), bufferAndStart.start, dart.notNull(end) - (dart.notNull(start) - dart.notNull(bufferAndStart.start)));
+ this[_filter$].process(bufferAndStart.buffer, bufferAndStart.start, dart.notNull(end) - (dart.notNull(start) - dart.notNull(bufferAndStart.start)));
let out = null;
while ((out = this[_filter$].processed({flush: false})) != null) {
- this[_sink$0].add(ListOfint()._check(out));
+ this[_sink$0].add(out);
}
} catch (e) {
this[_closed] = true;
@@ -36738,11 +37610,11 @@
}
close() {
if (dart.test(this[_closed])) return;
- if (dart.test(this[_empty])) this[_filter$].process(const$52 || (const$52 = dart.constList([], core.int)), 0, 0);
+ if (dart.test(this[_empty])) this[_filter$].process(const$55 || (const$55 = dart.constList([], core.int)), 0, 0);
try {
let out = null;
while ((out = this[_filter$].processed({end: true})) != null) {
- this[_sink$0].add(ListOfint()._check(out));
+ this[_sink$0].add(out);
}
} catch (e) {
this[_closed] = true;
@@ -36809,9 +37681,9 @@
}
};
dart.fn(io._validateZLibMemLevel, intTovoid());
- let const$53;
+ let const$56;
io._validateZLibStrategy = function(strategy) {
- let strategies = const$53 || (const$53 = dart.constList([io.ZLibOption.STRATEGY_FILTERED, io.ZLibOption.STRATEGY_HUFFMAN_ONLY, io.ZLibOption.STRATEGY_RLE, io.ZLibOption.STRATEGY_FIXED, io.ZLibOption.STRATEGY_DEFAULT], core.int));
+ let strategies = const$56 || (const$56 = dart.constList([io.ZLibOption.STRATEGY_FILTERED, io.ZLibOption.STRATEGY_HUFFMAN_ONLY, io.ZLibOption.STRATEGY_RLE, io.ZLibOption.STRATEGY_FIXED, io.ZLibOption.STRATEGY_DEFAULT], core.int));
if (strategies[dartx.indexOf](strategy) == -1) {
dart.throw(new core.ArgumentError("Unsupported 'strategy'"));
}
@@ -36841,7 +37713,6 @@
const _isErrorResponse = Symbol('_isErrorResponse');
const _exceptionOrErrorFromResponse = Symbol('_exceptionOrErrorFromResponse');
const _absolutePath = Symbol('_absolutePath');
- const _computeExistingIndex = Symbol('_computeExistingIndex');
const _delete = Symbol('_delete');
const _deleteSync = Symbol('_deleteSync');
const _type = Symbol('_type');
@@ -36862,6 +37733,12 @@
io.FileSystemEntity._throwIfError(result, "Cannot resolve symbolic links", this.path);
return core.String._check(result);
}
+ stat() {
+ return io.FileStat.stat(this.path);
+ }
+ statSync() {
+ return io.FileStat.statSync(this.path);
+ }
delete(opts) {
let recursive = opts && 'recursive' in opts ? opts.recursive : false;
return this[_delete]({recursive: recursive});
@@ -37025,6 +37902,8 @@
methods: () => ({
resolveSymbolicLinks: dart.definiteFunctionType(async.Future$(core.String), []),
resolveSymbolicLinksSync: dart.definiteFunctionType(core.String, []),
+ stat: dart.definiteFunctionType(async.Future$(io.FileStat), []),
+ statSync: dart.definiteFunctionType(io.FileStat, []),
delete: dart.definiteFunctionType(async.Future$(io.FileSystemEntity), [], {recursive: core.bool}),
deleteSync: dart.definiteFunctionType(dart.void, [], {recursive: core.bool}),
watch: dart.definiteFunctionType(async.Stream$(io.FileSystemEvent), [], {events: core.int, recursive: core.bool})
@@ -37130,33 +38009,6 @@
get absolute() {
return io.Directory.new(this[_absolutePath]);
}
- stat() {
- return io.FileStat.stat(this.path);
- }
- statSync() {
- return io.FileStat.statSync(this.path);
- }
- [_computeExistingIndex](dirsToCreate) {
- let future = null;
- let notFound = dirsToCreate[dartx.length];
- for (let i = 0; i < dart.notNull(dirsToCreate[dartx.length]); i++) {
- if (future == null) {
- future = dart.dsend(dart.dsend(dirsToCreate[dartx._get](i), 'exists'), 'then', dart.fn(e => dart.test(e) ? i : notFound, dynamicToint()));
- } else {
- future = dart.dsend(future, 'then', dart.fn(index => {
- if (!dart.equals(index, notFound)) {
- return async.Future.value(index);
- }
- return dart.dsend(dart.dsend(dirsToCreate[dartx._get](i), 'exists'), 'then', dart.fn(e => dart.test(e) ? i : notFound, dynamicToint()));
- }, dynamicTodynamic$()));
- }
- }
- if (future == null) {
- return FutureOfint().value(notFound);
- } else {
- return FutureOfint()._check(future);
- }
- }
create(opts) {
let recursive = opts && 'recursive' in opts ? opts.recursive : false;
if (dart.test(recursive)) {
@@ -37267,7 +38119,7 @@
list(opts) {
let recursive = opts && 'recursive' in opts ? opts.recursive : false;
let followLinks = opts && 'followLinks' in opts ? opts.followLinks : true;
- return StreamOfFileSystemEntity()._check(new io._AsyncDirectoryLister(io.FileSystemEntity._ensureTrailingPathSeparators(this.path), recursive, followLinks).stream);
+ return new io._AsyncDirectoryLister(io.FileSystemEntity._ensureTrailingPathSeparators(this.path), recursive, followLinks).stream;
}
listSync(opts) {
let recursive = opts && 'recursive' in opts ? opts.recursive : false;
@@ -37311,9 +38163,6 @@
methods: () => ({
exists: dart.definiteFunctionType(async.Future$(core.bool), []),
existsSync: dart.definiteFunctionType(core.bool, []),
- stat: dart.definiteFunctionType(async.Future$(io.FileStat), []),
- statSync: dart.definiteFunctionType(io.FileStat, []),
- [_computeExistingIndex]: dart.definiteFunctionType(async.Future$(core.int), [core.List]),
create: dart.definiteFunctionType(async.Future$(io.Directory), [], {recursive: core.bool}),
createSync: dart.definiteFunctionType(dart.void, [], {recursive: core.bool}),
createTemp: dart.definiteFunctionType(async.Future$(io.Directory), [], [core.String]),
@@ -37359,7 +38208,7 @@
this.nextRunning = false;
this.closed = false;
this[_ops] = null;
- this.controller = async.StreamController.new({onListen: dart.bind(this, 'onListen'), onResume: dart.bind(this, 'onResume'), onCancel: dart.bind(this, 'onCancel'), sync: true});
+ this.controller = StreamControllerOfFileSystemEntity().new({onListen: dart.bind(this, 'onListen'), onResume: dart.bind(this, 'onResume'), onCancel: dart.bind(this, 'onCancel'), sync: true});
}
[_pointer]() {
return this[_ops] == null ? null : this[_ops].getPointer();
@@ -37486,14 +38335,14 @@
path: core.String,
recursive: core.bool,
followLinks: core.bool,
- controller: async.StreamController,
+ controller: StreamControllerOfFileSystemEntity(),
canceled: core.bool,
nextRunning: core.bool,
closed: core.bool,
[_ops]: io._AsyncDirectoryListerOps,
closeCompleter: async.Completer
}),
- getters: () => ({stream: dart.definiteFunctionType(async.Stream, [])}),
+ getters: () => ({stream: dart.definiteFunctionType(async.Stream$(io.FileSystemEntity), [])}),
methods: () => ({
[_pointer]: dart.definiteFunctionType(core.int, []),
onListen: dart.definiteFunctionType(dart.void, []),
@@ -37520,7 +38369,7 @@
}
};
dart.setSignature(io._EventHandler, {
- statics: () => ({_sendData: dart.definiteFunctionType(dart.void, [core.Object, isolate.SendPort, core.int])}),
+ statics: () => ({_sendData: dart.definiteFunctionType(dart.void, [core.Object, isolate$.SendPort, core.int])}),
names: ['_sendData']
});
const _mode = Symbol('_mode');
@@ -37562,7 +38411,9 @@
toString() {
return {
0: "FileLock.SHARED",
- 1: "FileLock.EXCLUSIVE"
+ 1: "FileLock.EXCLUSIVE",
+ 2: "FileLock.BLOCKING_SHARED",
+ 3: "FileLock.BLOCKING_EXCLUSIVE"
}[this.index];
}
};
@@ -37571,7 +38422,9 @@
});
dart.defineEnumValues(io.FileLock, [
'SHARED',
- 'EXCLUSIVE'
+ 'EXCLUSIVE',
+ 'BLOCKING_SHARED',
+ 'BLOCKING_EXCLUSIVE'
]);
io.File = class File extends core.Object {
static new(path) {
@@ -37624,9 +38477,9 @@
});
io._BLOCK_SIZE = 64 * 1024;
const _closeCompleter = Symbol('_closeCompleter');
- const _path$ = Symbol('_path');
+ const _path = Symbol('_path');
const _position$0 = Symbol('_position');
- const _end$0 = Symbol('_end');
+ const _end$ = Symbol('_end');
const _controller$0 = Symbol('_controller');
const _openedFile = Symbol('_openedFile');
const _unsubscribed = Symbol('_unsubscribed');
@@ -37639,9 +38492,9 @@
io._FileStream = class _FileStream extends async.Stream$(core.List$(core.int)) {
new(path, position, end) {
this[_closeCompleter] = async.Completer.new();
- this[_path$] = path;
+ this[_path] = path;
this[_position$0] = position;
- this[_end$0] = end;
+ this[_end$] = end;
this[_controller$0] = null;
this[_openedFile] = null;
this[_unsubscribed] = false;
@@ -37655,9 +38508,9 @@
this[_closeCompleter] = async.Completer.new();
this[_position$0] = 0;
this[_controller$0] = null;
- this[_path$] = null;
+ this[_path] = null;
this[_openedFile] = null;
- this[_end$0] = null;
+ this[_end$] = null;
this[_unsubscribed] = false;
this[_readInProgress] = true;
this[_closed] = false;
@@ -37698,12 +38551,12 @@
}
this[_readInProgress] = true;
let readBytes = io._BLOCK_SIZE;
- if (this[_end$0] != null) {
- readBytes = math.min(core.int)(readBytes, dart.notNull(this[_end$0]) - dart.notNull(this[_position$0]));
+ if (this[_end$] != null) {
+ readBytes = math.min(core.int)(readBytes, dart.notNull(this[_end$]) - dart.notNull(this[_position$0]));
if (dart.notNull(readBytes) < 0) {
this[_readInProgress] = false;
if (!dart.test(this[_unsubscribed])) {
- this[_controller$0].addError(new core.RangeError(dart.str`Bad end position: ${this[_end$0]}`));
+ this[_controller$0].addError(new core.RangeError(dart.str`Bad end position: ${this[_end$]}`));
this[_closeFile]();
this[_unsubscribed] = true;
}
@@ -37717,7 +38570,7 @@
return;
}
this[_position$0] = dart.notNull(this[_position$0]) + dart.notNull(block[dartx.length]);
- if (dart.notNull(block[dartx.length]) < dart.notNull(readBytes) || this[_end$0] != null && this[_position$0] == this[_end$0]) {
+ if (dart.notNull(block[dartx.length]) < dart.notNull(readBytes) || this[_end$] != null && this[_position$0] == this[_end$]) {
this[_atEnd] = true;
}
if (!dart.test(this[_atEnd]) && !dart.test(this[_controller$0].isPaused)) {
@@ -37766,8 +38619,8 @@
this[_closeCompleter].complete();
}).bind(this);
dart.fn(openFailed, dynamicAnddynamicTovoid$());
- if (this[_path$] != null) {
- io.File.new(this[_path$]).open({mode: io.FileMode.READ}).then(dart.void)(onOpenFile, {onError: openFailed});
+ if (this[_path] != null) {
+ io.File.new(this[_path]).open({mode: io.FileMode.READ}).then(dart.void)(onOpenFile, {onError: openFailed});
} else {
try {
onOpenFile(io._File._openStdioSync(0));
@@ -37784,10 +38637,10 @@
dart.setSignature(io._FileStream, {
fields: () => ({
[_controller$0]: StreamControllerOfListOfint(),
- [_path$]: core.String,
+ [_path]: core.String,
[_openedFile]: io.RandomAccessFile,
[_position$0]: core.int,
- [_end$0]: core.int,
+ [_end$]: core.int,
[_closeCompleter]: async.Completer,
[_unsubscribed]: core.bool,
[_readInProgress]: core.bool,
@@ -37859,8 +38712,8 @@
})
});
const _tryDecode = Symbol('_tryDecode');
- let const$54;
- let const$55;
+ let const$57;
+ let const$58;
io._File = class _File extends io.FileSystemEntity {
new(path) {
this.path = path;
@@ -37887,12 +38740,6 @@
get absolute() {
return io.File.new(this[_absolutePath]);
}
- stat() {
- return io.FileStat.stat(this.path);
- }
- statSync() {
- return io.FileStat.statSync(this.path);
- }
create(opts) {
let recursive = opts && 'recursive' in opts ? opts.recursive : false;
let result = dart.test(recursive) ? this.parent.create({recursive: true}) : async.Future.value(null);
@@ -38009,6 +38856,41 @@
io._File.throwIfError(result, "Cannot retrieve length of file", this.path);
return core.int._check(result);
}
+ lastAccessed() {
+ return io._IOService._dispatch(io._FILE_LAST_ACCESSED, JSArrayOfString().of([this.path])).then(core.DateTime)(dart.fn(response => {
+ if (dart.test(io._isErrorResponse(response))) {
+ dart.throw(io._exceptionFromResponse(response, "Cannot retrieve access time", this.path));
+ }
+ return new core.DateTime.fromMillisecondsSinceEpoch(core.int._check(response));
+ }, dynamicToDateTime()));
+ }
+ static _lastAccessed(path) {
+ dart.throw(new core.UnsupportedError("File._lastAccessed"));
+ }
+ lastAccessedSync() {
+ let ms = io._File._lastAccessed(this.path);
+ io._File.throwIfError(ms, "Cannot retrieve access time", this.path);
+ return new core.DateTime.fromMillisecondsSinceEpoch(core.int._check(ms));
+ }
+ setLastAccessed(time) {
+ let millis = time.millisecondsSinceEpoch;
+ return io._IOService._dispatch(io._FILE_SET_LAST_ACCESSED, JSArrayOfObject().of([this.path, millis])).then(dart.dynamic)(dart.fn(response => {
+ if (dart.test(io._isErrorResponse(response))) {
+ dart.throw(io._exceptionFromResponse(response, "Cannot set access time", this.path));
+ }
+ return null;
+ }, dynamicToNull$()));
+ }
+ static _setLastAccessed(path, millis) {
+ dart.throw(new core.UnsupportedError("File._setLastAccessed"));
+ }
+ setLastAccessedSync(time) {
+ let millis = time.millisecondsSinceEpoch;
+ let result = io._File._setLastAccessed(this.path, millis);
+ if (io.OSError.is(result)) {
+ dart.throw(new io.FileSystemException("Failed to set file access time", this.path, result));
+ }
+ }
lastModified() {
return io._IOService._dispatch(io._FILE_LAST_MODIFIED, JSArrayOfString().of([this.path])).then(core.DateTime)(dart.fn(response => {
if (dart.test(io._isErrorResponse(response))) {
@@ -38025,6 +38907,25 @@
io._File.throwIfError(ms, "Cannot retrieve modification time", this.path);
return new core.DateTime.fromMillisecondsSinceEpoch(core.int._check(ms));
}
+ setLastModified(time) {
+ let millis = time.millisecondsSinceEpoch;
+ return io._IOService._dispatch(io._FILE_SET_LAST_MODIFIED, JSArrayOfObject().of([this.path, millis])).then(dart.dynamic)(dart.fn(response => {
+ if (dart.test(io._isErrorResponse(response))) {
+ dart.throw(io._exceptionFromResponse(response, "Cannot set modification time", this.path));
+ }
+ return null;
+ }, dynamicToNull$()));
+ }
+ static _setLastModified(path, millis) {
+ dart.throw(new core.UnsupportedError("File._setLastModified"));
+ }
+ setLastModifiedSync(time) {
+ let millis = time.millisecondsSinceEpoch;
+ let result = io._File._setLastModified(this.path, millis);
+ if (io.OSError.is(result)) {
+ dart.throw(new io.FileSystemException("Failed to set file modification time", this.path, result));
+ }
+ }
static _open(path, mode) {
dart.throw(new core.UnsupportedError("File._open"));
}
@@ -38064,22 +38965,22 @@
readAsBytes() {
function readDataChunked(file) {
let builder = io.BytesBuilder.new({copy: false});
- let completer = async.Completer.new();
+ let completer = CompleterOfListOfint().new();
function read() {
- dart.dsend(dart.dsend(file, 'read', io._BLOCK_SIZE), 'then', dart.fn(data => {
- if (dart.test(dart.dsend(dart.dload(data, 'length'), '>', 0))) {
- builder.add(ListOfint()._check(data));
+ file.read(io._BLOCK_SIZE).then(dart.dynamic)(dart.fn(data => {
+ if (dart.notNull(data[dartx.length]) > 0) {
+ builder.add(data);
read();
} else {
completer.complete(builder.takeBytes());
}
- }, dynamicToNull$()), {onError: dart.bind(completer, 'completeError')});
+ }, ListOfintToNull()), {onError: dart.bind(completer, 'completeError')});
}
dart.fn(read, VoidTovoid$());
read();
- return FutureOfListOfint()._check(completer.future);
+ return completer.future;
}
- dart.fn(readDataChunked, dynamicToFutureOfListOfint());
+ dart.fn(readDataChunked, RandomAccessFileToFutureOfListOfint());
return this.open().then(ListOfint())(dart.fn(file => file.length().then(ListOfint())(dart.fn(length => {
if (length == 0) {
return readDataChunked(file);
@@ -38096,13 +38997,13 @@
let builder = io.BytesBuilder.new({copy: false});
do {
data = opened.readSync(io._BLOCK_SIZE);
- if (dart.test(dart.dsend(dart.dload(data, 'length'), '>', 0))) builder.add(ListOfint()._check(data));
- } while (dart.test(dart.dsend(dart.dload(data, 'length'), '>', 0)));
+ if (dart.notNull(data[dartx.length]) > 0) builder.add(data);
+ } while (dart.notNull(data[dartx.length]) > 0);
data = builder.takeBytes();
} else {
data = opened.readSync(length);
}
- return ListOfint()._check(data);
+ return data;
} finally {
opened.closeSync();
}
@@ -38125,11 +39026,11 @@
}
readAsLines(opts) {
let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
- return this.readAsString({encoding: encoding}).then(ListOfString())(dart.bind(const$54 || (const$54 = dart.const(new convert.LineSplitter())), 'convert'));
+ return this.readAsString({encoding: encoding}).then(ListOfString())(dart.bind(const$57 || (const$57 = dart.const(new convert.LineSplitter())), 'convert'));
}
readAsLinesSync(opts) {
let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
- return (const$55 || (const$55 = dart.const(new convert.LineSplitter()))).convert(this.readAsStringSync({encoding: encoding}));
+ return (const$58 || (const$58 = dart.const(new convert.LineSplitter()))).convert(this.readAsStringSync({encoding: encoding}));
}
writeAsBytes(bytes, opts) {
let mode = opts && 'mode' in opts ? opts.mode : io.FileMode.WRITE;
@@ -38183,8 +39084,6 @@
methods: () => ({
exists: dart.definiteFunctionType(async.Future$(core.bool), []),
existsSync: dart.definiteFunctionType(core.bool, []),
- stat: dart.definiteFunctionType(async.Future$(io.FileStat), []),
- statSync: dart.definiteFunctionType(io.FileStat, []),
create: dart.definiteFunctionType(async.Future$(io.File), [], {recursive: core.bool}),
createSync: dart.definiteFunctionType(dart.void, [], {recursive: core.bool}),
[_delete]: dart.definiteFunctionType(async.Future$(io.File), [], {recursive: core.bool}),
@@ -38196,8 +39095,14 @@
open: dart.definiteFunctionType(async.Future$(io.RandomAccessFile), [], {mode: io.FileMode}),
length: dart.definiteFunctionType(async.Future$(core.int), []),
lengthSync: dart.definiteFunctionType(core.int, []),
+ lastAccessed: dart.definiteFunctionType(async.Future$(core.DateTime), []),
+ lastAccessedSync: dart.definiteFunctionType(core.DateTime, []),
+ setLastAccessed: dart.definiteFunctionType(async.Future, [core.DateTime]),
+ setLastAccessedSync: dart.definiteFunctionType(dart.void, [core.DateTime]),
lastModified: dart.definiteFunctionType(async.Future$(core.DateTime), []),
lastModifiedSync: dart.definiteFunctionType(core.DateTime, []),
+ setLastModified: dart.definiteFunctionType(async.Future, [core.DateTime]),
+ setLastModifiedSync: dart.definiteFunctionType(dart.void, [core.DateTime]),
openSync: dart.definiteFunctionType(io.RandomAccessFile, [], {mode: io.FileMode}),
openRead: dart.definiteFunctionType(async.Stream$(core.List$(core.int)), [], [core.int, core.int]),
openWrite: dart.definiteFunctionType(io.IOSink, [], {mode: io.FileMode, encoding: convert.Encoding}),
@@ -38224,26 +39129,49 @@
_renameLink: dart.definiteFunctionType(dart.dynamic, [core.String, core.String]),
_copy: dart.definiteFunctionType(dart.dynamic, [core.String, core.String]),
_lengthFromPath: dart.definiteFunctionType(dart.dynamic, [core.String]),
+ _lastAccessed: dart.definiteFunctionType(dart.dynamic, [core.String]),
+ _setLastAccessed: dart.definiteFunctionType(dart.dynamic, [core.String, core.int]),
_lastModified: dart.definiteFunctionType(dart.dynamic, [core.String]),
+ _setLastModified: dart.definiteFunctionType(dart.dynamic, [core.String, core.int]),
_open: dart.definiteFunctionType(dart.dynamic, [core.String, core.int]),
_openStdio: dart.definiteFunctionType(core.int, [core.int]),
_openStdioSync: dart.definiteFunctionType(io.RandomAccessFile, [core.int]),
throwIfError: dart.definiteFunctionType(dart.dynamic, [core.Object, core.String, core.String])
}),
- names: ['_exists', '_create', '_createLink', '_linkTarget', '_deleteNative', '_deleteLinkNative', '_rename', '_renameLink', '_copy', '_lengthFromPath', '_lastModified', '_open', '_openStdio', '_openStdioSync', 'throwIfError']
+ names: ['_exists', '_create', '_createLink', '_linkTarget', '_deleteNative', '_deleteLinkNative', '_rename', '_renameLink', '_copy', '_lengthFromPath', '_lastAccessed', '_setLastAccessed', '_lastModified', '_setLastModified', '_open', '_openStdio', '_openStdioSync', 'throwIfError']
});
io._RandomAccessFileOps = class _RandomAccessFileOps extends core.Object {
static new(pointer) {
dart.throw(new core.UnsupportedError("RandomAccessFile"));
}
};
+ io._FileTranslation = class _FileTranslation extends core.Object {
+ new(index) {
+ this.index = index;
+ }
+ toString() {
+ return {
+ 0: "_FileTranslation.text",
+ 1: "_FileTranslation.binary"
+ }[this.index];
+ }
+ };
+ dart.setSignature(io._FileTranslation, {
+ fields: () => ({index: core.int})
+ });
+ dart.defineEnumValues(io._FileTranslation, [
+ 'text',
+ 'binary'
+ ]);
const _asyncDispatched = Symbol('_asyncDispatched');
const _fileService = Symbol('_fileService');
const _resourceInfo = Symbol('_resourceInfo');
+ const _translation = Symbol('_translation');
const _maybeConnectHandler = Symbol('_maybeConnectHandler');
const _maybePerformCleanup = Symbol('_maybePerformCleanup');
const _dispatch = Symbol('_dispatch');
const _checkAvailable = Symbol('_checkAvailable');
+ const _fileLockValue = Symbol('_fileLockValue');
io._RandomAccessFile = class _RandomAccessFile extends core.Object {
new(pointer, path) {
this.path = path;
@@ -38251,9 +39179,11 @@
this[_fileService] = null;
this[_resourceInfo] = null;
this[_ops] = null;
+ this[_translation] = null;
this.closed = false;
this[_ops] = io._RandomAccessFileOps.new(pointer);
this[_resourceInfo] = new io._FileResourceInfo(this);
+ this[_translation] = io._FileTranslation.binary;
this[_maybeConnectHandler]();
}
[_maybePerformCleanup]() {
@@ -38315,8 +39245,8 @@
dart.throw(io._exceptionFromResponse(response, "read failed", this.path));
}
this[_resourceInfo].addRead(core.int._check(dart.dload(dart.dindex(response, 1), 'length')));
- return FutureOrOfListOfint()._check(dart.dindex(response, 1));
- }, dynamicToFutureOrOfListOfint()));
+ return ListOfint().as(dart.dindex(response, 1));
+ }, dynamicToListOfint()));
}
readSync(bytes) {
this[_checkAvailable]();
@@ -38328,7 +39258,7 @@
dart.throw(new io.FileSystemException("readSync failed", this.path, result));
}
this[_resourceInfo].addRead(core.int._check(dart.dload(result, 'length')));
- return ListOfint()._check(result);
+ return ListOfint().as(result);
}
readInto(buffer, start, end) {
if (start === void 0) start = 0;
@@ -38346,8 +39276,8 @@
dart.throw(io._exceptionFromResponse(response, "readInto failed", this.path));
}
let read = dart.dindex(response, 1);
- let data = dart.dindex(response, 2);
- buffer[dartx.setRange](start, dart.asInt(dart.notNull(start) + dart.notNull(core.num._check(read))), IterableOfint()._check(data));
+ let data = ListOfint().as(dart.dindex(response, 2));
+ buffer[dartx.setRange](start, dart.asInt(dart.notNull(start) + dart.notNull(core.num._check(read))), data);
this[_resourceInfo].addRead(core.int._check(read));
return FutureOrOfint()._check(read);
}, dynamicToFutureOrOfint()));
@@ -38436,7 +39366,7 @@
return;
}
let bufferAndStart = io._ensureFastAndSerializableByteData(buffer, start, end);
- let result = this[_ops].writeFrom(ListOfint()._check(bufferAndStart.buffer), bufferAndStart.start, dart.notNull(end) - (dart.notNull(start) - dart.notNull(bufferAndStart.start)));
+ let result = this[_ops].writeFrom(bufferAndStart.buffer, bufferAndStart.start, dart.notNull(end) - (dart.notNull(start) - dart.notNull(bufferAndStart.start)));
if (io.OSError.is(result)) {
dart.throw(new io.FileSystemException("writeFrom failed", this.path, result));
}
@@ -38535,6 +39465,30 @@
dart.throw(new io.FileSystemException("flush failed", this.path, result));
}
}
+ [_fileLockValue](fl) {
+ switch (fl) {
+ case io.FileLock.SHARED:
+ {
+ return io._RandomAccessFile.LOCK_SHARED;
+ }
+ case io.FileLock.EXCLUSIVE:
+ {
+ return io._RandomAccessFile.LOCK_EXCLUSIVE;
+ }
+ case io.FileLock.BLOCKING_SHARED:
+ {
+ return io._RandomAccessFile.LOCK_BLOCKING_SHARED;
+ }
+ case io.FileLock.BLOCKING_EXCLUSIVE:
+ {
+ return io._RandomAccessFile.LOCK_BLOCKING_EXCLUSIVE;
+ }
+ default:
+ {
+ return -1;
+ }
+ }
+ }
lock(mode, start, end) {
if (mode === void 0) mode = io.FileLock.EXCLUSIVE;
if (start === void 0) start = 0;
@@ -38545,7 +39499,7 @@
if (dart.notNull(start) < 0 || dart.notNull(end) < -1 || end != -1 && dart.notNull(start) >= dart.notNull(end)) {
dart.throw(new core.ArgumentError());
}
- let lock = dart.equals(mode, io.FileLock.EXCLUSIVE) ? io._RandomAccessFile.LOCK_EXCLUSIVE : io._RandomAccessFile.LOCK_SHARED;
+ let lock = this[_fileLockValue](mode);
return this[_dispatch](io._FILE_LOCK, JSArrayOfint().of([null, lock, start, end])).then(io._RandomAccessFile)(dart.fn(response => {
if (dart.test(io._isErrorResponse(response))) {
dart.throw(io._exceptionFromResponse(response, 'lock failed', this.path));
@@ -38580,7 +39534,7 @@
if (dart.notNull(start) < 0 || dart.notNull(end) < -1 || end != -1 && dart.notNull(start) >= dart.notNull(end)) {
dart.throw(new core.ArgumentError());
}
- let lock = dart.equals(mode, io.FileLock.EXCLUSIVE) ? io._RandomAccessFile.LOCK_EXCLUSIVE : io._RandomAccessFile.LOCK_SHARED;
+ let lock = this[_fileLockValue](mode);
let result = this[_ops].lock(lock, start, end);
if (io.OSError.is(result)) {
dart.throw(new io.FileSystemException('lock failed', this.path, result));
@@ -38601,6 +39555,15 @@
dart.throw(new io.FileSystemException('unlock failed', this.path, result));
}
}
+ get translation() {
+ return this[_translation];
+ }
+ set translation(translation) {
+ if (!dart.equals(this[_translation], translation)) {
+ this[_ops].setTranslation(translation.index);
+ this[_translation] = translation;
+ }
+ }
[_pointer]() {
return this[_ops].getPointer();
}
@@ -38636,11 +39599,14 @@
fields: () => ({
path: core.String,
[_asyncDispatched]: core.bool,
- [_fileService]: isolate.SendPort,
+ [_fileService]: isolate$.SendPort,
[_resourceInfo]: io._FileResourceInfo,
[_ops]: io._RandomAccessFileOps,
+ [_translation]: io._FileTranslation,
closed: core.bool
}),
+ getters: () => ({translation: dart.definiteFunctionType(io._FileTranslation, [])}),
+ setters: () => ({translation: dart.definiteFunctionType(dart.void, [io._FileTranslation])}),
methods: () => ({
[_maybePerformCleanup]: dart.definiteFunctionType(dart.void, []),
[_maybeConnectHandler]: dart.definiteFunctionType(dart.dynamic, []),
@@ -38668,6 +39634,7 @@
lengthSync: dart.definiteFunctionType(core.int, []),
flush: dart.definiteFunctionType(async.Future$(io.RandomAccessFile), []),
flushSync: dart.definiteFunctionType(dart.void, []),
+ [_fileLockValue]: dart.definiteFunctionType(core.int, [io.FileLock]),
lock: dart.definiteFunctionType(async.Future$(io.RandomAccessFile), [], [io.FileLock, core.int, core.int]),
unlock: dart.definiteFunctionType(async.Future$(io.RandomAccessFile), [], [core.int, core.int]),
lockSync: dart.definiteFunctionType(dart.void, [], [io.FileLock, core.int, core.int]),
@@ -38681,7 +39648,9 @@
io._RandomAccessFile.LOCK_UNLOCK = 0;
io._RandomAccessFile.LOCK_SHARED = 1;
io._RandomAccessFile.LOCK_EXCLUSIVE = 2;
- let const$56;
+ io._RandomAccessFile.LOCK_BLOCKING_SHARED = 3;
+ io._RandomAccessFile.LOCK_BLOCKING_EXCLUSIVE = 4;
+ let const$59;
io.FileSystemEntityType = class FileSystemEntityType extends core.Object {
_internal(type) {
this[_type] = type;
@@ -38690,7 +39659,7 @@
return io.FileSystemEntityType._typeList[dartx._get](type);
}
toString() {
- return (const$56 || (const$56 = dart.constList(['FILE', 'DIRECTORY', 'LINK', 'NOT_FOUND'], core.String)))[dartx._get](this[_type]);
+ return (const$59 || (const$59 = dart.constList(['FILE', 'DIRECTORY', 'LINK', 'NOT_FOUND'], core.String)))[dartx._get](this[_type]);
}
};
dart.defineNamedConstructor(io.FileSystemEntityType, '_internal');
@@ -38716,7 +39685,7 @@
return dart.constList([io.FileSystemEntityType.FILE, io.FileSystemEntityType.DIRECTORY, io.FileSystemEntityType.LINK, io.FileSystemEntityType.NOT_FOUND], io.FileSystemEntityType);
}
});
- let const$57;
+ let const$60;
io.FileStat = class FileStat extends core.Object {
_internal(changed, modified, accessed, type, mode, size) {
this.changed = changed;
@@ -38762,7 +39731,7 @@
}
modeString() {
let permissions = dart.notNull(this.mode) & 4095;
- let codes = const$57 || (const$57 = dart.constList(['---', '--x', '-w-', '-wx', 'r--', 'r-x', 'rw-', 'rwx'], core.String));
+ let codes = const$60 || (const$60 = dart.constList(['---', '--x', '-w-', '-wx', 'r--', 'r-x', 'rw-', 'rwx'], core.String));
let result = [];
if ((permissions & 2048) != 0) result[dartx.add]("(suid) ");
if ((permissions & 1024) != 0) result[dartx.add]("(guid) ");
@@ -39262,19 +40231,19 @@
}),
getters: () => ({uri: dart.definiteFunctionType(core.Uri, [])})
});
- let const$58;
- let const$59;
- let const$60;
let const$61;
let const$62;
let const$63;
let const$64;
let const$65;
let const$66;
+ let const$67;
+ let const$68;
+ let const$69;
io.HttpDate = class HttpDate extends core.Object {
static format(date) {
- let wkday = const$58 || (const$58 = dart.constList(["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"], core.String));
- let month = const$59 || (const$59 = dart.constList(["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], core.String));
+ let wkday = const$61 || (const$61 = dart.constList(["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"], core.String));
+ let month = const$62 || (const$62 = dart.constList(["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], core.String));
let d = date.toUtc();
let sb = new core.StringBuffer();
sb.write(wkday[dartx._get](dart.notNull(d.weekday) - 1));
@@ -39296,12 +40265,12 @@
}
static parse(date) {
let SP = 32;
- let wkdays = const$60 || (const$60 = dart.constList(["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"], core.String));
- let weekdays = const$61 || (const$61 = dart.constList(["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"], core.String));
- let months = const$62 || (const$62 = dart.constList(["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], core.String));
- let wkdaysLowerCase = const$63 || (const$63 = dart.constList(["mon", "tue", "wed", "thu", "fri", "sat", "sun"], core.String));
- let weekdaysLowerCase = const$64 || (const$64 = dart.constList(["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"], core.String));
- let monthsLowerCase = const$65 || (const$65 = dart.constList(["jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"], core.String));
+ let wkdays = const$63 || (const$63 = dart.constList(["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"], core.String));
+ let weekdays = const$64 || (const$64 = dart.constList(["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"], core.String));
+ let months = const$65 || (const$65 = dart.constList(["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], core.String));
+ let wkdaysLowerCase = const$66 || (const$66 = dart.constList(["mon", "tue", "wed", "thu", "fri", "sat", "sun"], core.String));
+ let weekdaysLowerCase = const$67 || (const$67 = dart.constList(["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"], core.String));
+ let monthsLowerCase = const$68 || (const$68 = dart.constList(["jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"], core.String));
let formatRfc1123 = 0;
let formatRfc850 = 1;
let formatAsctime = 2;
@@ -39417,7 +40386,7 @@
return new core.DateTime.utc(year, dart.notNull(month) + 1, day, hours, minutes, seconds, 0);
}
static _parseCookieDate(date) {
- let monthsLowerCase = const$66 || (const$66 = dart.constList(["jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"], core.String));
+ let monthsLowerCase = const$69 || (const$69 = dart.constList(["jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"], core.String));
let position = 0;
function error() {
dart.throw(new io.HttpException(dart.str`Invalid cookie date ${date}`));
@@ -39551,7 +40520,7 @@
const _addIfModifiedSince = Symbol('_addIfModifiedSince');
const _foldHeader = Symbol('_foldHeader');
const _finalize = Symbol('_finalize');
- const _write = Symbol('_write');
+ const _build = Symbol('_build');
const _parseCookies = Symbol('_parseCookies');
io._HttpHeaders = class _HttpHeaders extends core.Object {
new(protocolVersion, opts) {
@@ -39987,81 +40956,32 @@
[_finalize]() {
this[_mutable] = false;
}
- [_write](buffer, offset) {
- function write(bytes) {
- let len = bytes[dartx.length];
- for (let i = 0; i < dart.notNull(len); i++) {
- buffer[dartx._set](dart.notNull(offset) + i, bytes[dartx._get](i));
- }
- offset = dart.notNull(offset) + dart.notNull(len);
- }
- dart.fn(write, ListOfintTovoid());
+ [_build](builder) {
for (let name of this[_headers][dartx.keys]) {
let values = this[_headers][dartx._get](name);
let fold = core.bool._check(this[_foldHeader](name));
let nameData = name[dartx.codeUnits];
- write(nameData);
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.COLON);
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.SP);
+ builder.add(nameData);
+ builder.addByte(io._CharCode.COLON);
+ builder.addByte(io._CharCode.SP);
for (let i = 0; i < dart.notNull(values[dartx.length]); i++) {
if (i > 0) {
if (dart.test(fold)) {
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.COMMA);
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.SP);
+ builder.addByte(io._CharCode.COMMA);
+ builder.addByte(io._CharCode.SP);
} else {
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.CR);
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.LF);
- write(nameData);
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.COLON);
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.SP);
+ builder.addByte(io._CharCode.CR);
+ builder.addByte(io._CharCode.LF);
+ builder.add(nameData);
+ builder.addByte(io._CharCode.COLON);
+ builder.addByte(io._CharCode.SP);
}
}
- write(values[dartx._get](i)[dartx.codeUnits]);
+ builder.add(values[dartx._get](i)[dartx.codeUnits]);
}
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.CR);
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.LF);
+ builder.addByte(io._CharCode.CR);
+ builder.addByte(io._CharCode.LF);
}
- return offset;
}
toString() {
let sb = new core.StringBuffer();
@@ -40236,7 +41156,7 @@
[_updateHostHeader]: dart.definiteFunctionType(dart.dynamic, []),
[_foldHeader]: dart.definiteFunctionType(dart.dynamic, [core.String]),
[_finalize]: dart.definiteFunctionType(dart.void, []),
- [_write]: dart.definiteFunctionType(core.int, [typed_data.Uint8List, core.int]),
+ [_build]: dart.definiteFunctionType(dart.void, [io.BytesBuilder]),
[_parseCookies]: dart.definiteFunctionType(core.List$(io.Cookie), [])
}),
statics: () => ({
@@ -40385,7 +41305,7 @@
return;
}
let value = parseParameterValue();
- if (name == 'charset' && io._ContentType.is(this)) {
+ if (name == 'charset' && io._ContentType.is(this) && value != null) {
value = value[dartx.toLowerCase]();
}
parameters._set(name, value);
@@ -40496,7 +41416,7 @@
});
const _validate = Symbol('_validate');
const _parseSetCookieValue = Symbol('_parseSetCookieValue');
- let const$67;
+ let const$70;
io._Cookie = class _Cookie extends core.Object {
new(name, value) {
if (name === void 0) name = null;
@@ -40635,7 +41555,7 @@
return sb.toString();
}
[_validate]() {
- let SEPERATORS = const$67 || (const$67 = dart.constList(["(", ")", "<", ">", "@", ",", ";", ":", "\\", '"', "/", "[", "]", "?", "=", "{", "}"], core.String));
+ let SEPERATORS = const$70 || (const$70 = dart.constList(["(", ")", "<", ">", "@", ",", ";", ":", "\\", '"', "/", "[", "]", "?", "=", "{", "}"], core.String));
for (let i = 0; i < dart.notNull(this.name[dartx.length]); i++) {
let codeUnit = this.name[dartx.codeUnits][dartx._get](i);
if (dart.notNull(codeUnit) <= 32 || dart.notNull(codeUnit) >= 127 || dart.notNull(SEPERATORS[dartx.indexOf](this.name[dartx._get](i))) >= 0) {
@@ -40669,6 +41589,7 @@
})
});
io._OUTGOING_BUFFER_SIZE = 8 * 1024;
+ io._BytesConsumer = dart.typedef('_BytesConsumer', () => dart.functionType(dart.void, [ListOfint()]));
const _transferLength = Symbol('_transferLength');
const _dataCompleter = Symbol('_dataCompleter');
const _stream$ = Symbol('_stream');
@@ -40967,7 +41888,7 @@
let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : null;
if (dart.test(this[_incoming].upgraded)) {
this[_httpRequest][_httpClientConnection].destroy();
- return StreamSubscriptionOfListOfint()._check(async.Stream.fromIterable([]).listen(null, {onDone: onDone}));
+ return StreamOfListOfint().empty().listen(null, {onDone: onDone});
}
let stream = this[_incoming];
if (dart.test(this[_httpClient].autoUncompress) && this.headers.value(io.HttpHeaders.CONTENT_ENCODING) == "gzip") {
@@ -41089,7 +42010,7 @@
[_authenticate]: dart.definiteFunctionType(async.Future$(io.HttpClientResponse), [core.bool])
})
});
- const _uri = Symbol('_uri');
+ const _uri$ = Symbol('_uri');
const _outgoing = Symbol('_outgoing');
const _encodingSet = Symbol('_encodingSet');
const _bufferOutput = Symbol('_bufferOutput');
@@ -41317,7 +42238,7 @@
class _HttpOutboundMessage extends io._IOSinkImpl {
new(uri, protocolVersion, outgoing, opts) {
let initialHeaders = opts && 'initialHeaders' in opts ? opts.initialHeaders : null;
- this[_uri] = uri;
+ this[_uri$] = uri;
this.headers = new io._HttpHeaders(protocolVersion, {defaultPortForScheme: uri.scheme == 'https' ? io.HttpClient.DEFAULT_HTTPS_PORT : io.HttpClient.DEFAULT_HTTP_PORT, initialHeaders: initialHeaders});
this[_outgoing] = outgoing;
this[_encodingSet] = false;
@@ -41380,7 +42301,7 @@
fields: () => ({
[_encodingSet]: core.bool,
[_bufferOutput]: core.bool,
- [_uri]: core.Uri,
+ [_uri$]: core.Uri,
[_outgoing]: io._HttpOutgoing,
headers: io._HttpHeaders
}),
@@ -41477,43 +42398,18 @@
}, VoidToNull()));
}
[_writeHeader]() {
- let buffer = typed_data.Uint8List.new(io._OUTGOING_BUFFER_SIZE);
- let offset = 0;
- function write(bytes) {
- let len = bytes[dartx.length];
- for (let i = 0; i < dart.notNull(len); i++) {
- buffer[dartx._set](dart.notNull(offset) + i, bytes[dartx._get](i));
- }
- offset = dart.notNull(offset) + dart.notNull(len);
- }
- dart.fn(write, ListOfintTovoid());
+ let buffer = new io._CopyingBytesBuilder(io._OUTGOING_BUFFER_SIZE);
if (this.headers.protocolVersion == "1.1") {
- write(io._Const.HTTP11);
+ buffer.add(io._Const.HTTP11);
} else {
- write(io._Const.HTTP10);
+ buffer.add(io._Const.HTTP10);
}
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.SP);
- write(dart.toString(this.statusCode)[dartx.codeUnits]);
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.SP);
- write(this.reasonPhrase[dartx.codeUnits]);
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.CR);
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.LF);
+ buffer.addByte(io._CharCode.SP);
+ buffer.add(dart.toString(this.statusCode)[dartx.codeUnits]);
+ buffer.addByte(io._CharCode.SP);
+ buffer.add(this.reasonPhrase[dartx.codeUnits]);
+ buffer.addByte(io._CharCode.CR);
+ buffer.addByte(io._CharCode.LF);
let session = this[_httpRequest][_session];
if (session != null && !dart.test(session[_destroyed])) {
session[_isNew] = false;
@@ -41542,18 +42438,11 @@
}, CookieToNull()));
}
this.headers[_finalize]();
- offset = this.headers[_write](buffer, offset);
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.CR);
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.LF);
- this[_outgoing].setHeader(buffer, offset);
+ this.headers[_build](buffer);
+ buffer.addByte(io._CharCode.CR);
+ buffer.addByte(io._CharCode.LF);
+ let headerBytes = typed_data.Uint8List._check(buffer.takeBytes());
+ this[_outgoing].setHeader(headerBytes, headerBytes[dartx.length]);
}
[_findReasonPhrase](statusCode) {
if (this[_reasonPhrase] != null) {
@@ -41858,39 +42747,14 @@
}
}
[_writeHeader]() {
- let buffer = typed_data.Uint8List.new(io._OUTGOING_BUFFER_SIZE);
- let offset = 0;
- function write(bytes) {
- let len = bytes[dartx.length];
- for (let i = 0; i < dart.notNull(len); i++) {
- buffer[dartx._set](dart.notNull(offset) + i, bytes[dartx._get](i));
- }
- offset = dart.notNull(offset) + dart.notNull(len);
- }
- dart.fn(write, ListOfintTovoid());
- write(this.method[dartx.codeUnits]);
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.SP);
- write(this[_requestUri]()[dartx.codeUnits]);
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.SP);
- write(io._Const.HTTP11);
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.CR);
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.LF);
+ let buffer = new io._CopyingBytesBuilder(io._OUTGOING_BUFFER_SIZE);
+ buffer.add(this.method[dartx.codeUnits]);
+ buffer.addByte(io._CharCode.SP);
+ buffer.add(this[_requestUri]()[dartx.codeUnits]);
+ buffer.addByte(io._CharCode.SP);
+ buffer.add(io._Const.HTTP11);
+ buffer.addByte(io._CharCode.CR);
+ buffer.addByte(io._CharCode.LF);
if (!dart.test(this.cookies[dartx.isEmpty])) {
let sb = new core.StringBuffer();
for (let i = 0; i < dart.notNull(this.cookies[dartx.length]); i++) {
@@ -41902,18 +42766,11 @@
this.headers.add(io.HttpHeaders.COOKIE, sb.toString());
}
this.headers[_finalize]();
- offset = this.headers[_write](buffer, offset);
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.CR);
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.LF);
- this[_outgoing].setHeader(buffer, offset);
+ this.headers[_build](buffer);
+ buffer.addByte(io._CharCode.CR);
+ buffer.addByte(io._CharCode.LF);
+ let headerBytes = typed_data.Uint8List._check(buffer.takeBytes());
+ this[_outgoing].setHeader(headerBytes, headerBytes[dartx.length]);
}
};
dart.addSimpleTypeTests(io._HttpClientRequest);
@@ -41957,19 +42814,19 @@
super.new();
}
add(chunk) {
- dart.dcall(this[_consume], chunk);
+ this[_consume](chunk);
}
addSlice(chunk, start, end, isLast) {
if (typed_data.Uint8List.is(chunk)) {
- dart.dcall(this[_consume], typed_data.Uint8List.view(chunk[dartx.buffer], start, dart.notNull(end) - dart.notNull(start)));
+ this[_consume](typed_data.Uint8List.view(chunk[dartx.buffer], start, dart.notNull(end) - dart.notNull(start)));
} else {
- dart.dcall(this[_consume], chunk[dartx.sublist](start, dart.notNull(end) - dart.notNull(start)));
+ this[_consume](chunk[dartx.sublist](start, dart.notNull(end) - dart.notNull(start)));
}
}
close() {}
};
dart.setSignature(io._HttpGZipSink, {
- fields: () => ({[_consume]: core.Function}),
+ fields: () => ({[_consume]: io._BytesConsumer}),
methods: () => ({
add: dart.definiteFunctionType(dart.void, [ListOfint()]),
addSlice: dart.definiteFunctionType(dart.void, [ListOfint(), core.int, core.int, core.bool]),
@@ -41989,10 +42846,10 @@
const _addChunk$ = Symbol('_addChunk');
const _chunkHeader = Symbol('_chunkHeader');
const _ignoreError = Symbol('_ignoreError');
- let const$68;
+ let const$71;
io._HttpOutgoing = class _HttpOutgoing extends core.Object {
new(socket) {
- this[_doneCompleter] = async.Completer.new();
+ this[_doneCompleter] = CompleterOfSocket().new();
this.socket = socket;
this.ignoreBody = false;
this.headersWritten = false;
@@ -42014,16 +42871,6 @@
writeHeaders(opts) {
let drainRequest = opts && 'drainRequest' in opts ? opts.drainRequest : true;
let setOutgoing = opts && 'setOutgoing' in opts ? opts.setOutgoing : true;
- const write = (function() {
- try {
- this.outbound[_writeHeader]();
- } catch (_) {
- return async.Future.error(new io.HttpException(dart.str`Headers size exceeded the of '${io._OUTGOING_BUFFER_SIZE}'` + " bytes"));
- }
-
- return null;
- }).bind(this);
- dart.fn(write, VoidToFuture());
if (dart.test(this.headersWritten)) return null;
this.headersWritten = true;
let drainFuture = null;
@@ -42045,22 +42892,22 @@
} else {
drainRequest = false;
}
- if (dart.test(this.ignoreBody)) {
- return write();
- }
- if (dart.test(setOutgoing)) {
- let contentLength = this.outbound.headers.contentLength;
- if (dart.test(this.outbound.headers.chunkedTransferEncoding)) {
- this.chunked = true;
- if (gzip) this.gzip = true;
- } else if (dart.notNull(contentLength) >= 0) {
- this.contentLength = contentLength;
+ if (!dart.test(this.ignoreBody)) {
+ if (dart.test(setOutgoing)) {
+ let contentLength = this.outbound.headers.contentLength;
+ if (dart.test(this.outbound.headers.chunkedTransferEncoding)) {
+ this.chunked = true;
+ if (gzip) this.gzip = true;
+ } else if (dart.notNull(contentLength) >= 0) {
+ this.contentLength = contentLength;
+ }
+ }
+ if (drainFuture != null) {
+ return drainFuture.then(dart.void)(dart.fn(_ => this.outbound[_writeHeader](), dynamicTovoid$()));
}
}
- if (drainFuture != null) {
- return drainFuture.then(dart.dynamic)(dart.fn(_ => write(), dynamicToFuture()));
- }
- return write();
+ this.outbound[_writeHeader]();
+ return null;
}
addStream(stream) {
if (dart.test(this[_socketError])) {
@@ -42077,10 +42924,10 @@
return this.close();
}
let sub = null;
- let controller = async.StreamController.new({onPause: dart.fn(() => dart.dsend(sub, 'pause'), VoidTovoid$()), onResume: dart.fn(() => dart.dsend(sub, 'resume'), VoidTovoid$()), sync: true});
+ let controller = StreamControllerOfListOfint().new({onPause: dart.fn(() => sub.pause(), VoidTovoid$()), onResume: dart.fn(() => sub.resume(), VoidTovoid$()), sync: true});
const onData = (function(data) {
if (dart.test(this[_socketError])) return;
- if (dart.equals(dart.dload(data, 'length'), 0)) return;
+ if (data[dartx.length] == 0) return;
if (dart.test(this.chunked)) {
if (dart.test(this[_gzip])) {
this[_gzipAdd] = dart.bind(controller, 'add');
@@ -42088,28 +42935,28 @@
this[_gzipAdd] = null;
return;
}
- this[_addChunk$](this[_chunkHeader](core.int._check(dart.dload(data, 'length'))), dart.bind(controller, 'add'));
+ this[_addChunk$](this[_chunkHeader](data[dartx.length]), dart.bind(controller, 'add'));
this[_pendingChunkedFooter] = 2;
} else {
if (this.contentLength != null) {
- this[_bytesWritten] = dart.notNull(this[_bytesWritten]) + dart.notNull(core.num._check(dart.dload(data, 'length')));
+ this[_bytesWritten] = dart.notNull(this[_bytesWritten]) + dart.notNull(data[dartx.length]);
if (dart.notNull(this[_bytesWritten]) > dart.notNull(this.contentLength)) {
- controller.addError(new io.HttpException("Content size exceeds specified contentLength. " + dart.str`${this[_bytesWritten]} bytes written while expected ` + dart.str`${this.contentLength}. ` + dart.str`[${core.String.fromCharCodes(IterableOfint()._check(data))}]`));
+ controller.addError(new io.HttpException("Content size exceeds specified contentLength. " + dart.str`${this[_bytesWritten]} bytes written while expected ` + dart.str`${this.contentLength}. ` + dart.str`[${core.String.fromCharCodes(data)}]`));
return;
}
}
}
this[_addChunk$](data, dart.bind(controller, 'add'));
}).bind(this);
- dart.fn(onData, dynamicTovoid$());
+ dart.fn(onData, ListOfintTovoid());
sub = stream.listen(onData, {onError: dart.bind(controller, 'addError'), onDone: dart.bind(controller, 'close'), cancelOnError: true});
if (!dart.test(this.headersWritten)) {
let future = this.writeHeaders();
if (future != null) {
- dart.dsend(sub, 'pause', future);
+ sub.pause(future);
}
}
- return this.socket.addStream(StreamOfListOfint()._check(controller.stream)).then(io._HttpOutboundMessage)(dart.fn(_ => this.outbound, dynamicTo_HttpOutboundMessage()), {onError: dart.fn((error, stackTrace) => {
+ return this.socket.addStream(controller.stream).then(io._HttpOutboundMessage)(dart.fn(_ => this.outbound, dynamicTo_HttpOutboundMessage()), {onError: dart.fn((error, stackTrace) => {
if (dart.test(this[_gzip])) this[_gzipSink].close();
this[_socketError] = true;
this[_doneCompleter].completeError(error, core.StackTrace._check(stackTrace));
@@ -42129,14 +42976,14 @@
this.outbound.headers.chunkedTransferEncoding = false;
this.outbound.headers.contentLength = 0;
} else if (dart.notNull(this.outbound.headers.contentLength) > 0) {
- let error = new io.HttpException("No content even though contentLength was specified to be " + dart.str`greater than 0: ${this.outbound.headers.contentLength}.`, {uri: this.outbound[_uri]});
+ let error = new io.HttpException("No content even though contentLength was specified to be " + dart.str`greater than 0: ${this.outbound.headers.contentLength}.`, {uri: this.outbound[_uri$]});
this[_doneCompleter].completeError(error);
return this[_closeFuture] = async.Future.error(error);
}
}
if (this.contentLength != null) {
if (dart.notNull(this[_bytesWritten]) < dart.notNull(this.contentLength)) {
- let error = new io.HttpException("Content size below specified contentLength. " + dart.str` ${this[_bytesWritten]} bytes written but expected ` + dart.str`${this.contentLength}.`, {uri: this.outbound[_uri]});
+ let error = new io.HttpException("Content size below specified contentLength. " + dart.str` ${this[_bytesWritten]} bytes written but expected ` + dart.str`${this.contentLength}.`, {uri: this.outbound[_uri$]});
this[_doneCompleter].completeError(error);
return this[_closeFuture] = async.Future.error(error);
}
@@ -42182,7 +43029,6 @@
}
setHeader(data, length) {
dart.assert(this[_length$2] == 0);
- dart.assert(data[dartx.length] == io._OUTGOING_BUFFER_SIZE);
this[_buffer$] = typed_data.Uint8List._check(data);
this[_length$2] = length;
}
@@ -42193,10 +43039,10 @@
dart.assert(this[_gzipSink] == null);
this[_gzipSink] = new io.ZLibEncoder({gzip: true}).startChunkedConversion(new io._HttpGZipSink(dart.fn(data => {
if (this[_gzipAdd] == null) return;
- this[_addChunk$](this[_chunkHeader](core.int._check(dart.dload(data, 'length'))), _ChunkedConversionCallbackOfListOfint()._check(this[_gzipAdd]));
+ this[_addChunk$](this[_chunkHeader](data[dartx.length]), this[_gzipAdd]);
this[_pendingChunkedFooter] = 2;
- this[_addChunk$](data, _ChunkedConversionCallbackOfListOfint()._check(this[_gzipAdd]));
- }, dynamicToNull$())));
+ this[_addChunk$](data, this[_gzipAdd]);
+ }, ListOfintToNull())));
}
}
[_ignoreError](error) {
@@ -42204,19 +43050,19 @@
}
[_addGZipChunk](chunk, add) {
if (!dart.test(this.outbound.bufferOutput)) {
- add(ListOfint()._check(chunk));
+ add(chunk);
return;
}
- if (dart.test(dart.dsend(dart.dload(chunk, 'length'), '>', dart.notNull(this[_gzipBuffer][dartx.length]) - dart.notNull(this[_gzipBufferLength])))) {
+ if (dart.notNull(chunk[dartx.length]) > dart.notNull(this[_gzipBuffer][dartx.length]) - dart.notNull(this[_gzipBufferLength])) {
add(typed_data.Uint8List.view(this[_gzipBuffer][dartx.buffer], 0, this[_gzipBufferLength]));
this[_gzipBuffer] = typed_data.Uint8List.new(io._OUTGOING_BUFFER_SIZE);
this[_gzipBufferLength] = 0;
}
- if (dart.test(dart.dsend(dart.dload(chunk, 'length'), '>', io._OUTGOING_BUFFER_SIZE))) {
- add(ListOfint()._check(chunk));
+ if (dart.notNull(chunk[dartx.length]) > io._OUTGOING_BUFFER_SIZE) {
+ add(chunk);
} else {
- this[_gzipBuffer][dartx.setRange](this[_gzipBufferLength], dart.asInt(dart.notNull(this[_gzipBufferLength]) + dart.notNull(core.num._check(dart.dload(chunk, 'length')))), IterableOfint()._check(chunk));
- this[_gzipBufferLength] = dart.notNull(this[_gzipBufferLength]) + dart.notNull(core.num._check(dart.dload(chunk, 'length')));
+ this[_gzipBuffer][dartx.setRange](this[_gzipBufferLength], dart.notNull(this[_gzipBufferLength]) + dart.notNull(chunk[dartx.length]), chunk);
+ this[_gzipBufferLength] = dart.notNull(this[_gzipBufferLength]) + dart.notNull(chunk[dartx.length]);
}
}
[_addChunk$](chunk, add) {
@@ -42226,23 +43072,23 @@
this[_buffer$] = null;
this[_length$2] = 0;
}
- add(ListOfint()._check(chunk));
+ add(chunk);
return;
}
- if (dart.test(dart.dsend(dart.dload(chunk, 'length'), '>', dart.notNull(this[_buffer$][dartx.length]) - dart.notNull(this[_length$2])))) {
+ if (dart.notNull(chunk[dartx.length]) > dart.notNull(this[_buffer$][dartx.length]) - dart.notNull(this[_length$2])) {
add(typed_data.Uint8List.view(this[_buffer$][dartx.buffer], 0, this[_length$2]));
this[_buffer$] = typed_data.Uint8List.new(io._OUTGOING_BUFFER_SIZE);
this[_length$2] = 0;
}
- if (dart.test(dart.dsend(dart.dload(chunk, 'length'), '>', io._OUTGOING_BUFFER_SIZE))) {
- add(ListOfint()._check(chunk));
+ if (dart.notNull(chunk[dartx.length]) > io._OUTGOING_BUFFER_SIZE) {
+ add(chunk);
} else {
- this[_buffer$][dartx.setRange](this[_length$2], dart.asInt(dart.notNull(this[_length$2]) + dart.notNull(core.num._check(dart.dload(chunk, 'length')))), IterableOfint()._check(chunk));
- this[_length$2] = dart.notNull(this[_length$2]) + dart.notNull(core.num._check(dart.dload(chunk, 'length')));
+ this[_buffer$][dartx.setRange](this[_length$2], dart.notNull(this[_length$2]) + dart.notNull(chunk[dartx.length]), chunk);
+ this[_length$2] = dart.notNull(this[_length$2]) + dart.notNull(chunk[dartx.length]);
}
}
[_chunkHeader](length) {
- let hexDigits = const$68 || (const$68 = dart.constList([48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70], core.int));
+ let hexDigits = const$71 || (const$71 = dart.constList([48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70], core.int));
if (length == 0) {
if (this[_pendingChunkedFooter] == 2) return io._HttpOutgoing._footerAndChunk0Length;
return io._HttpOutgoing._chunk0Length;
@@ -42271,7 +43117,7 @@
io._HttpOutgoing[dart.implements] = () => [StreamConsumerOfListOfint()];
dart.setSignature(io._HttpOutgoing, {
fields: () => ({
- [_doneCompleter]: async.Completer,
+ [_doneCompleter]: CompleterOfSocket(),
socket: io.Socket,
ignoreBody: core.bool,
headersWritten: core.bool,
@@ -42284,13 +43130,13 @@
[_bytesWritten]: core.int,
[_gzip]: core.bool,
[_gzipSink]: convert.ByteConversionSink,
- [_gzipAdd]: core.Function,
+ [_gzipAdd]: io._BytesConsumer,
[_gzipBuffer]: typed_data.Uint8List,
[_gzipBufferLength]: core.int,
[_socketError]: core.bool,
outbound: io._HttpOutboundMessage
}),
- getters: () => ({done: dart.definiteFunctionType(async.Future, [])}),
+ getters: () => ({done: dart.definiteFunctionType(async.Future$(io.Socket), [])}),
setters: () => ({gzip: dart.definiteFunctionType(dart.void, [core.bool])}),
methods: () => ({
writeHeaders: dart.definiteFunctionType(async.Future, [], {drainRequest: core.bool, setOutgoing: core.bool}),
@@ -42298,8 +43144,8 @@
close: dart.definiteFunctionType(async.Future, []),
setHeader: dart.definiteFunctionType(dart.void, [ListOfint(), core.int]),
[_ignoreError]: dart.definiteFunctionType(core.bool, [dart.dynamic]),
- [_addGZipChunk]: dart.definiteFunctionType(dart.void, [dart.dynamic, _ChunkedConversionCallbackOfListOfint()]),
- [_addChunk$]: dart.definiteFunctionType(dart.void, [dart.dynamic, _ChunkedConversionCallbackOfListOfint()]),
+ [_addGZipChunk]: dart.definiteFunctionType(dart.void, [ListOfint(), _ChunkedConversionCallbackOfListOfint()]),
+ [_addChunk$]: dart.definiteFunctionType(dart.void, [ListOfint(), _ChunkedConversionCallbackOfListOfint()]),
[_chunkHeader]: dart.definiteFunctionType(core.List$(core.int), [core.int])
})
});
@@ -42407,7 +43253,7 @@
}
}
this[_httpParser].isHead = method == "HEAD";
- this[_streamFuture] = outgoing.done.then(dart.dynamic)(dart.fn(s => {
+ this[_streamFuture] = outgoing.done.then(io.Socket)(dart.fn(s => {
this[_nextResponseCompleter] = CompleterOf_HttpIncoming().new();
this[_nextResponseCompleter].future.then(dart.dynamic)(dart.fn(incoming => {
this[_currentUri] = null;
@@ -42450,13 +43296,13 @@
}, dynamicAnddynamicToNull()));
this[_subscription$].resume();
return s;
- }, dynamicTodynamic$()), {onError: dart.fn(e => {
+ }, SocketToSocket()), {onError: dart.fn(e => {
this.destroy();
}, dynamicToNull$())});
return request;
}
detachSocket() {
- return this[_streamFuture].then(io._DetachedSocket)(dart.fn(_ => new io._DetachedSocket(this[_socket], this[_httpParser].detachIncoming()), dynamicTo_DetachedSocket()));
+ return this[_streamFuture].then(io._DetachedSocket)(dart.fn(_ => new io._DetachedSocket(this[_socket], this[_httpParser].detachIncoming()), SocketTo_DetachedSocket()));
}
destroy() {
this.closed = true;
@@ -42466,12 +43312,12 @@
close() {
this.closed = true;
this[_httpClient][_connectionClosed](this);
- this[_streamFuture].then(dart.void)(dart.fn(_ => this[_socket].destroy(), dynamicTovoid$()));
+ this[_streamFuture].then(dart.void)(dart.fn(_ => this[_socket].destroy(), SocketTovoid()));
}
createProxyTunnel(host, port, proxy, callback) {
- let request = this.send(core.Uri.new({host: core.String._check(host), port: core.int._check(port)}), core.int._check(port), "CONNECT", io._Proxy._check(proxy));
- if (dart.test(dart.dload(proxy, 'isAuthenticated'))) {
- let auth = io._CryptoUtils.bytesToBase64(convert.UTF8.encode(dart.str`${dart.dload(proxy, 'username')}:${dart.dload(proxy, 'password')}`));
+ let request = this.send(core.Uri.new({host: host, port: port}), port, "CONNECT", proxy);
+ if (dart.test(proxy.isAuthenticated)) {
+ let auth = io._CryptoUtils.bytesToBase64(convert.UTF8.encode(dart.str`${proxy.username}:${proxy.password}`));
request.headers.set(io.HttpHeaders.PROXY_AUTHORIZATION, dart.str`Basic ${auth}`);
}
return request.close().then(io.SecureSocket)(dart.fn(response => {
@@ -42479,9 +43325,9 @@
dart.throw("Proxy failed to establish tunnel " + dart.str`(${response.statusCode} ${response.reasonPhrase})`);
}
let socket = io._HttpClientResponse.as(response)[_httpRequest][_httpClientConnection][_socket];
- return io.SecureSocket.secure(socket, {host: host, context: this[_context], onBadCertificate: X509CertificateTobool()._check(callback)});
+ return io.SecureSocket.secure(socket, {host: host, context: this[_context], onBadCertificate: callback});
}, HttpClientResponseToFutureOfSecureSocket())).then(io._HttpClientConnection)(dart.fn(secureSocket => {
- let key = core.String._check(io._HttpClientConnection.makeKey(true, core.String._check(host), core.int._check(port)));
+ let key = core.String._check(io._HttpClientConnection.makeKey(true, host, port));
return new io._HttpClientConnection(key, secureSocket, request[_httpClient], true);
}, SecureSocketTo_HttpClientConnection()));
}
@@ -42519,7 +43365,7 @@
closed: core.bool,
[_currentUri]: core.Uri,
[_nextResponseCompleter]: CompleterOf_HttpIncoming(),
- [_streamFuture]: async.Future
+ [_streamFuture]: FutureOfSocket()
}),
getters: () => ({connectionInfo: dart.definiteFunctionType(io.HttpConnectionInfo, [])}),
methods: () => ({
@@ -42527,7 +43373,7 @@
detachSocket: dart.definiteFunctionType(async.Future$(io.Socket), []),
destroy: dart.definiteFunctionType(dart.void, []),
close: dart.definiteFunctionType(dart.void, []),
- createProxyTunnel: dart.definiteFunctionType(async.Future$(io._HttpClientConnection), [dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic]),
+ createProxyTunnel: dart.definiteFunctionType(async.Future$(io._HttpClientConnection), [core.String, core.int, io._Proxy, X509CertificateTobool()]),
stopTimer: dart.definiteFunctionType(dart.void, []),
startTimer: dart.definiteFunctionType(dart.void, [])
}),
@@ -42621,11 +43467,11 @@
return FutureOf_ConnectionInfo().value(new io._ConnectionInfo(connection, proxy));
}
if (client.maxConnectionsPerHost != null && dart.notNull(this[_active].length) + dart.notNull(this[_connecting]) >= dart.notNull(client.maxConnectionsPerHost)) {
- let completer = async.Completer.new();
+ let completer = CompleterOf_ConnectionInfo().new();
this[_pending$].add(dart.fn(() => {
- this.connect(uriHost, uriPort, proxy, client).then(dart.void)(dart.bind(completer, 'complete'), {onError: dart.bind(completer, 'completeError')});
+ completer.complete(this.connect(uriHost, uriPort, proxy, client));
}, VoidToNull()));
- return FutureOf_ConnectionInfo()._check(completer.future);
+ return completer.future;
}
let currentBadCertificateCallback = client[_badCertificateCallback];
function callback(certificate) {
@@ -42685,7 +43531,7 @@
});
io.BadCertificateCallback = dart.typedef('BadCertificateCallback', () => dart.functionType(core.bool, [io.X509Certificate, core.String, core.int]));
const _idleTimeout = Symbol('_idleTimeout');
- let const$69;
+ let const$72;
const _connectionTargets = Symbol('_connectionTargets');
const _credentials = Symbol('_credentials');
const _closing = Symbol('_closing');
@@ -42693,7 +43539,7 @@
const _findProxy = Symbol('_findProxy');
const _openUrl = Symbol('_openUrl');
const _closeConnections = Symbol('_closeConnections');
- let const$70;
+ let const$73;
const _getConnection = Symbol('_getConnection');
io._HttpClient = class _HttpClient extends core.Object {
get idleTimeout() {
@@ -42710,7 +43556,7 @@
this[_authenticate] = null;
this[_authenticateProxy] = null;
this[_findProxy] = io.HttpClient.findProxyFromEnvironment;
- this[_idleTimeout] = const$69 || (const$69 = dart.const(new core.Duration({seconds: 15})));
+ this[_idleTimeout] = const$72 || (const$72 = dart.const(new core.Duration({seconds: 15})));
this[_badCertificateCallback] = null;
this.maxConnectionsPerHost = null;
this.autoUncompress = true;
@@ -42828,7 +43674,7 @@
if (port == 0) {
port = isSecure ? io.HttpClient.DEFAULT_HTTPS_PORT : io.HttpClient.DEFAULT_HTTP_PORT;
}
- let proxyConf = const$70 || (const$70 = dart.const(new io._ProxyConfiguration.direct()));
+ let proxyConf = const$73 || (const$73 = dart.const(new io._ProxyConfiguration.direct()));
if (this[_findProxy] != null) {
try {
proxyConf = new io._ProxyConfiguration(core.String._check(dart.dcall(this[_findProxy], uri)));
@@ -43124,7 +43970,7 @@
}
io._HttpConnection._connections[dartx._set](this[_serviceId], this);
- this[_httpParser].listenToStream(StreamOfListOfint()._check(this[_socket]));
+ this[_httpParser].listenToStream(io.Socket.as(this[_socket]));
this[_subscription$] = this[_httpParser].listen(dart.fn(incoming => {
this[_httpServer][_markActive](this);
incoming.dataDone.then(dart.dynamic)(dart.fn(closing => {
@@ -43146,7 +43992,7 @@
} else {
this.destroy();
}
- }, dynamicToNull$()), {onError: dart.fn(_ => {
+ }, SocketToNull()), {onError: dart.fn(_ => {
this.destroy();
}, dynamicToNull$())});
outgoing.ignoreBody = request.method == "HEAD";
@@ -43177,7 +44023,7 @@
let detachedIncoming = this[_httpParser].detachIncoming();
return this[_streamFuture].then(io._DetachedSocket)(dart.fn(_ => {
io._HttpConnection._connections[dartx.remove](this[_serviceId]);
- return new io._DetachedSocket(this[_socket], detachedIncoming);
+ return new io._DetachedSocket(io.Socket._check(this[_socket]), detachedIncoming);
}, dynamicTo_DetachedSocket()));
}
get connectionInfo() {
@@ -43287,8 +44133,8 @@
const _idleConnections = Symbol('_idleConnections');
const _serverSocket = Symbol('_serverSocket');
const _closeServer = Symbol('_closeServer');
- let const$71;
- let const$72;
+ let const$74;
+ let const$75;
io._HttpServer = class _HttpServer extends dart.mixin(async.Stream$(io.HttpRequest), io._ServiceObject) {
static bind(address, port, backlog, v6Only, shared) {
return io.ServerSocket.bind(address, port, {backlog: backlog, v6Only: v6Only, shared: shared}).then(io._HttpServer)(dart.fn(socket => new io._HttpServer._(socket, true), ServerSocketTo_HttpServer()));
@@ -43311,7 +44157,7 @@
this[_controller$0] = null;
super.new();
this[_controller$0] = StreamControllerOfHttpRequest().new({sync: true, onCancel: dart.bind(this, 'close')});
- this.idleTimeout = const$71 || (const$71 = dart.const(new core.Duration({seconds: 120})));
+ this.idleTimeout = const$74 || (const$74 = dart.const(new core.Duration({seconds: 120})));
io._HttpServer._servers[dartx._set](this[_serviceId], this);
dart.dput(this[_serverSocket], _owner, this);
}
@@ -43330,7 +44176,7 @@
this[_controller$0] = null;
super.new();
this[_controller$0] = StreamControllerOfHttpRequest().new({sync: true, onCancel: dart.bind(this, 'close')});
- this.idleTimeout = const$72 || (const$72 = dart.const(new core.Duration({seconds: 120})));
+ this.idleTimeout = const$75 || (const$75 = dart.const(new core.Duration({seconds: 120})));
io._HttpServer._servers[dartx._set](this[_serviceId], this);
try {
dart.dput(this[_serverSocket], _owner, this);
@@ -43574,8 +44420,8 @@
}),
getters: () => ({isAuthenticated: dart.definiteFunctionType(core.bool, [])})
});
- let const$73;
- let const$74;
+ let const$76;
+ let const$77;
io._ProxyConfiguration = class _ProxyConfiguration extends core.Object {
new(configuration) {
this.proxies = ListOf_Proxy().new();
@@ -43630,7 +44476,7 @@
}, StringToNull()));
}
direct() {
- this.proxies = const$74 || (const$74 = dart.constList([const$73 || (const$73 = dart.const(new io._Proxy.direct()))], io._Proxy));
+ this.proxies = const$77 || (const$77 = dart.constList([const$76 || (const$76 = dart.const(new io._Proxy.direct()))], io._Proxy));
}
};
dart.defineNamedConstructor(io._ProxyConfiguration, 'direct');
@@ -43682,61 +44528,61 @@
return this[_incoming].listen(onData, {onError: onError, onDone: onDone, cancelOnError: cancelOnError});
}
get encoding() {
- return convert.Encoding._check(dart.dload(this[_socket], 'encoding'));
+ return this[_socket].encoding;
}
set encoding(value) {
- dart.dput(this[_socket], 'encoding', value);
+ this[_socket].encoding = value;
}
write(obj) {
- dart.dsend(this[_socket], 'write', obj);
+ this[_socket].write(obj);
}
writeln(obj) {
if (obj === void 0) obj = "";
- dart.dsend(this[_socket], 'writeln', obj);
+ this[_socket].writeln(obj);
}
writeCharCode(charCode) {
- dart.dsend(this[_socket], 'writeCharCode', charCode);
+ this[_socket].writeCharCode(charCode);
}
writeAll(objects, separator) {
if (separator === void 0) separator = "";
- dart.dsend(this[_socket], 'writeAll', objects, separator);
+ this[_socket].writeAll(objects, separator);
}
add(bytes) {
- dart.dsend(this[_socket], 'add', bytes);
+ this[_socket].add(bytes);
}
addError(error, stackTrace) {
if (stackTrace === void 0) stackTrace = null;
- return dart.dsend(this[_socket], 'addError', error, stackTrace);
+ return this[_socket].addError(error, stackTrace);
}
addStream(stream) {
- return FutureOfSocket()._check(dart.dsend(this[_socket], 'addStream', stream));
+ return this[_socket].addStream(stream);
}
destroy() {
- dart.dsend(this[_socket], 'destroy');
+ this[_socket].destroy();
}
flush() {
- return async.Future._check(dart.dsend(this[_socket], 'flush'));
+ return this[_socket].flush();
}
close() {
- return async.Future._check(dart.dsend(this[_socket], 'close'));
+ return this[_socket].close();
}
get done() {
- return FutureOfSocket()._check(dart.dload(this[_socket], 'done'));
+ return this[_socket].done;
}
get port() {
- return core.int._check(dart.dload(this[_socket], 'port'));
+ return this[_socket].port;
}
get address() {
- return io.InternetAddress._check(dart.dload(this[_socket], 'address'));
+ return this[_socket].address;
}
get remoteAddress() {
- return io.InternetAddress._check(dart.dload(this[_socket], 'remoteAddress'));
+ return this[_socket].remoteAddress;
}
get remotePort() {
- return core.int._check(dart.dload(this[_socket], 'remotePort'));
+ return this[_socket].remotePort;
}
setOption(option, enabled) {
- return core.bool._check(dart.dsend(this[_socket], 'setOption', option, enabled));
+ return this[_socket].setOption(option, enabled);
}
[_toJSON$](ref) {
return core.Map._check(dart.dsend(this[_socket], _toJSON$, ref));
@@ -43750,7 +44596,7 @@
dart.setSignature(io._DetachedSocket, {
fields: () => ({
[_incoming]: StreamOfListOfint(),
- [_socket]: dart.dynamic
+ [_socket]: io.Socket
}),
getters: () => ({
encoding: dart.definiteFunctionType(convert.Encoding, []),
@@ -43772,10 +44618,10 @@
writeAll: dart.definiteFunctionType(dart.void, [core.Iterable], [core.String]),
add: dart.definiteFunctionType(dart.void, [ListOfint()]),
addError: dart.definiteFunctionType(dart.void, [dart.dynamic], [core.StackTrace]),
- addStream: dart.definiteFunctionType(async.Future$(io.Socket), [StreamOfListOfint()]),
+ addStream: dart.definiteFunctionType(async.Future, [StreamOfListOfint()]),
destroy: dart.definiteFunctionType(dart.void, []),
flush: dart.definiteFunctionType(async.Future, []),
- close: dart.definiteFunctionType(async.Future, []),
+ close: dart.definiteFunctionType(async.Future$(io.Socket), []),
setOption: dart.definiteFunctionType(core.bool, [io.SocketOption, core.bool]),
[_toJSON$]: dart.definiteFunctionType(core.Map, [core.bool])
})
@@ -44216,23 +45062,21 @@
this.subscription.onError(onError);
this.subscription.onDone(onDone);
if (this.bufferedData == null) {
- return StreamSubscriptionOfListOfint()._check(((() => {
- this.subscription.resume();
- return this.subscription;
- })()));
+ this.subscription.resume();
+ return this.subscription;
}
- let _ = new io._HttpDetachedStreamSubscription(StreamSubscriptionOfListOfint()._check(this.subscription), this.bufferedData, onData);
+ let _ = new io._HttpDetachedStreamSubscription(this.subscription, this.bufferedData, onData);
_.resume();
return _;
} else {
- return StreamOfint().fromIterable(this.bufferedData).listen(onData, {onError: onError, onDone: onDone, cancelOnError: cancelOnError});
+ return StreamOfListOfint().fromIterable(JSArrayOfListOfint().of([this.bufferedData])).listen(onData, {onError: onError, onDone: onDone, cancelOnError: cancelOnError});
}
}
};
dart.addSimpleTypeTests(io._HttpDetachedIncoming);
dart.setSignature(io._HttpDetachedIncoming, {
fields: () => ({
- subscription: async.StreamSubscription,
+ subscription: StreamSubscriptionOfListOfint(),
bufferedData: ListOfint()
}),
methods: () => ({listen: dart.definiteFunctionType(async.StreamSubscription$(core.List$(core.int)), [_ChunkedConversionCallbackOfListOfint()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool})})
@@ -44243,7 +45087,7 @@
const _headerValue = Symbol('_headerValue');
const _requestParser = Symbol('_requestParser');
const _parserCalled = Symbol('_parserCalled');
- const _index$2 = Symbol('_index');
+ const _index$1 = Symbol('_index');
const _httpVersionIndex = Symbol('_httpVersionIndex');
const _messageType = Symbol('_messageType');
const _statusCodeLength = Symbol('_statusCodeLength');
@@ -44284,7 +45128,7 @@
this[_requestParser] = requestParser;
this[_parserCalled] = false;
this[_buffer$] = null;
- this[_index$2] = null;
+ this[_index$1] = null;
this[_state$1] = null;
this[_httpVersionIndex] = null;
this[_messageType] = null;
@@ -44396,14 +45240,14 @@
if (this[_state$1] == io._State.FAILURE) {
dart.throw(new io.HttpException("Data on failed connection"));
}
- while (this[_buffer$] != null && dart.notNull(this[_index$2]) < dart.notNull(this[_buffer$][dartx.length]) && this[_state$1] != io._State.FAILURE && this[_state$1] != io._State.UPGRADED) {
+ while (this[_buffer$] != null && dart.notNull(this[_index$1]) < dart.notNull(this[_buffer$][dartx.length]) && this[_state$1] != io._State.FAILURE && this[_state$1] != io._State.UPGRADED) {
if (this[_incoming] != null && dart.test(this[_bodyPaused]) || this[_incoming] == null && dart.test(this[_paused])) {
this[_parserCalled] = false;
return;
}
let byte = this[_buffer$][dartx._get]((() => {
- let x = this[_index$2];
- this[_index$2] = dart.notNull(x) + 1;
+ let x = this[_index$1];
+ this[_index$1] = dart.notNull(x) + 1;
return x;
})());
switch (this[_state$1]) {
@@ -44584,7 +45428,7 @@
this[_state$1] = io._State.HEADER_ENDING;
} else if (byte == io._CharCode.LF) {
this[_state$1] = io._State.HEADER_ENDING;
- this[_index$2] = dart.notNull(this[_index$2]) - 1;
+ this[_index$1] = dart.notNull(this[_index$1]) - 1;
} else {
this[_headerField][dartx.add](io._HttpParser._toLowerCaseByte(byte));
this[_state$1] = io._State.HEADER_FIELD;
@@ -44659,7 +45503,7 @@
this[_state$1] = io._State.HEADER_ENDING;
} else if (byte == io._CharCode.LF) {
this[_state$1] = io._State.HEADER_ENDING;
- this[_index$2] = dart.notNull(this[_index$2]) - 1;
+ this[_index$1] = dart.notNull(this[_index$1]) - 1;
} else {
this[_headerField][dartx.add](io._HttpParser._toLowerCaseByte(byte));
this[_state$1] = io._State.HEADER_FIELD;
@@ -44733,17 +45577,17 @@
}
case io._State.BODY:
{
- this[_index$2] = dart.notNull(this[_index$2]) - 1;
- let dataAvailable = dart.notNull(this[_buffer$][dartx.length]) - dart.notNull(this[_index$2]);
+ this[_index$1] = dart.notNull(this[_index$1]) - 1;
+ let dataAvailable = dart.notNull(this[_buffer$][dartx.length]) - dart.notNull(this[_index$1]);
if (dart.notNull(this[_remainingContent]) >= 0 && dart.notNull(dataAvailable) > dart.notNull(this[_remainingContent])) {
dataAvailable = this[_remainingContent];
}
- let data = typed_data.Uint8List.view(this[_buffer$][dartx.buffer], dart.notNull(this[_buffer$][dartx.offsetInBytes]) + dart.notNull(this[_index$2]), dataAvailable);
+ let data = typed_data.Uint8List.view(this[_buffer$][dartx.buffer], dart.notNull(this[_buffer$][dartx.offsetInBytes]) + dart.notNull(this[_index$1]), dataAvailable);
this[_bodyController].add(data);
if (this[_remainingContent] != -1) {
this[_remainingContent] = dart.notNull(this[_remainingContent]) - dart.notNull(data[dartx.length]);
}
- this[_index$2] = dart.notNull(this[_index$2]) + dart.notNull(data[dartx.length]);
+ this[_index$1] = dart.notNull(this[_index$1]) + dart.notNull(data[dartx.length]);
if (this[_remainingContent] == 0) {
if (!dart.test(this[_chunked])) {
this[_reset]();
@@ -44767,7 +45611,7 @@
}
}
this[_parserCalled] = false;
- if (this[_buffer$] != null && this[_index$2] == this[_buffer$][dartx.length]) {
+ if (this[_buffer$] != null && this[_index$1] == this[_buffer$][dartx.length]) {
this[_releaseBuffer]();
if (this[_state$1] != io._State.UPGRADED && this[_state$1] != io._State.FAILURE) {
this[_socketSubscription].resume();
@@ -44778,7 +45622,7 @@
this[_socketSubscription].pause();
dart.assert(this[_buffer$] == null);
this[_buffer$] = typed_data.Uint8List._check(buffer);
- this[_index$2] = 0;
+ this[_index$1] = 0;
this[_parse]();
}
[_onDone$]() {
@@ -44851,8 +45695,8 @@
}
readUnparsedData() {
if (this[_buffer$] == null) return null;
- if (this[_index$2] == this[_buffer$][dartx.length]) return null;
- let result = this[_buffer$][dartx.sublist](this[_index$2]);
+ if (this[_index$1] == this[_buffer$][dartx.length]) return null;
+ let result = this[_buffer$][dartx.sublist](this[_index$1]);
this[_releaseBuffer]();
return result;
}
@@ -44877,7 +45721,7 @@
}
[_releaseBuffer]() {
this[_buffer$] = null;
- this[_index$2] = null;
+ this[_index$1] = null;
}
static _isTokenChar(byte) {
return dart.notNull(byte) > 31 && dart.notNull(byte) < 128 && !dart.test(io._Const.SEPARATOR_MAP[dartx._get](byte));
@@ -44997,7 +45841,7 @@
fields: () => ({
[_parserCalled]: core.bool,
[_buffer$]: typed_data.Uint8List,
- [_index$2]: core.int,
+ [_index$1]: core.int,
[_requestParser]: core.bool,
[_state$1]: core.int,
[_httpVersionIndex]: core.int,
@@ -45017,7 +45861,7 @@
[_remainingContent]: core.int,
[_headers]: io._HttpHeaders,
[_incoming]: io._HttpIncoming,
- [_socketSubscription]: async.StreamSubscription,
+ [_socketSubscription]: StreamSubscriptionOfListOfint(),
[_paused]: core.bool,
[_bodyPaused]: core.bool,
[_controller$0]: StreamControllerOf_HttpIncoming(),
@@ -45060,7 +45904,7 @@
names: ['_isTokenChar', '_isValueChar', '_tokenizeFieldValue', '_toLowerCaseByte']
});
io._DART_SESSION_ID = "DARTSESSID";
- const _data$ = Symbol('_data');
+ const _data$0 = Symbol('_data');
const _lastSeen = Symbol('_lastSeen');
const _timeoutCallback = Symbol('_timeoutCallback');
const _prev = Symbol('_prev');
@@ -45070,7 +45914,7 @@
const _bumpToEnd = Symbol('_bumpToEnd');
io._HttpSession = class _HttpSession extends core.Object {
new(sessionManager, id) {
- this[_data$] = collection.HashMap.new();
+ this[_data$0] = collection.HashMap.new();
this[_sessionManager] = sessionManager;
this.id = id;
this[_lastSeen] = new core.DateTime.now();
@@ -45099,50 +45943,50 @@
this[_timeoutCallback] = callback;
}
containsValue(value) {
- return this[_data$][dartx.containsValue](value);
+ return this[_data$0][dartx.containsValue](value);
}
containsKey(key) {
- return this[_data$][dartx.containsKey](key);
+ return this[_data$0][dartx.containsKey](key);
}
_get(key) {
- return this[_data$][dartx._get](key);
+ return this[_data$0][dartx._get](key);
}
_set(key, value) {
- this[_data$][dartx._set](key, value);
+ this[_data$0][dartx._set](key, value);
return value;
}
putIfAbsent(key, ifAbsent) {
- return this[_data$][dartx.putIfAbsent](key, ifAbsent);
+ return this[_data$0][dartx.putIfAbsent](key, ifAbsent);
}
addAll(other) {
- return this[_data$][dartx.addAll](other);
+ return this[_data$0][dartx.addAll](other);
}
remove(key) {
- return this[_data$][dartx.remove](key);
+ return this[_data$0][dartx.remove](key);
}
clear() {
- this[_data$][dartx.clear]();
+ this[_data$0][dartx.clear]();
}
forEach(f) {
- this[_data$][dartx.forEach](f);
+ this[_data$0][dartx.forEach](f);
}
get keys() {
- return this[_data$][dartx.keys];
+ return this[_data$0][dartx.keys];
}
get values() {
- return this[_data$][dartx.values];
+ return this[_data$0][dartx.values];
}
get length() {
- return this[_data$][dartx.length];
+ return this[_data$0][dartx.length];
}
get isEmpty() {
- return this[_data$][dartx.isEmpty];
+ return this[_data$0][dartx.isEmpty];
}
get isNotEmpty() {
- return this[_data$][dartx.isNotEmpty];
+ return this[_data$0][dartx.isNotEmpty];
}
toString() {
- return dart.str`HttpSession id:${this.id} ${this[_data$]}`;
+ return dart.str`HttpSession id:${this.id} ${this[_data$0]}`;
}
};
io._HttpSession[dart.implements] = () => [io.HttpSession];
@@ -45156,7 +46000,7 @@
[_prev]: io._HttpSession,
[_next$1]: io._HttpSession,
id: core.String,
- [_data$]: core.Map
+ [_data$0]: core.Map
}),
getters: () => ({
lastSeen: dart.definiteFunctionType(core.DateTime, []),
@@ -45327,7 +46171,7 @@
this.id = io._IOResourceInfo.getNextID();
}
get referenceValueMap() {
- return dart.map({type: dart.str`@${this.type}`, id: this.id, name: this.name}, core.String, core.String);
+ return dart.map({type: dart.str`@${this.type}`, id: this.id, name: this.name}, core.String, core.Object);
}
static getNextID() {
return (() => {
@@ -45342,7 +46186,7 @@
type: core.String,
id: core.int
}),
- getters: () => ({referenceValueMap: dart.definiteFunctionType(core.Map$(core.String, core.String), [])}),
+ getters: () => ({referenceValueMap: dart.definiteFunctionType(core.Map$(core.String, dart.dynamic), [])}),
statics: () => ({getNextID: dart.definiteFunctionType(core.int, [])}),
names: ['getNextID']
});
@@ -45383,7 +46227,7 @@
super.new(type);
}
get fullValueMap() {
- return dart.map({type: this.type, id: this.id, name: this.name, totalRead: this.totalRead, totalWritten: this.totalWritten, readCount: this.readCount, writeCount: this.writeCount, lastRead: this.lastRead, lastWrite: this.lastWrite}, core.String, core.String);
+ return dart.map({type: this.type, id: this.id, name: this.name, totalRead: this.totalRead, totalWritten: this.totalWritten, readCount: this.readCount, writeCount: this.writeCount, lastRead: this.lastRead, lastWrite: this.lastWrite}, core.String, core.Object);
}
};
dart.setSignature(io._ReadWriteResourceInfo, {
@@ -45395,7 +46239,7 @@
lastRead: core.double,
lastWrite: core.double
}),
- getters: () => ({fullValueMap: dart.definiteFunctionType(core.Map$(core.String, core.String), [])}),
+ getters: () => ({fullValueMap: dart.definiteFunctionType(core.Map$(core.String, dart.dynamic), [])}),
methods: () => ({
addRead: dart.definiteFunctionType(dart.void, [core.int]),
didRead: dart.definiteFunctionType(dart.void, []),
@@ -45417,7 +46261,7 @@
io._FileResourceInfo.openFiles[dartx.remove](info.id);
}
static getOpenFilesList() {
- return ListOfMapOfString$String().from(io._FileResourceInfo.openFiles[dartx.values][dartx.map](MapOfString$String())(dart.fn(e => e.referenceValueMap, _FileResourceInfoToMapOfString$String())));
+ return ListOfMapOfString$String().from(io._FileResourceInfo.openFiles[dartx.values][dartx.map](MapOfString$dynamic())(dart.fn(e => e.referenceValueMap, _FileResourceInfoToMapOfString$dynamic())));
}
static getOpenFiles(func, params) {
dart.assert(dart.equals(func, 'ext.dart.io.getOpenFiles'));
@@ -45426,8 +46270,7 @@
return FutureOfServiceExtensionResponse().value(new developer.ServiceExtensionResponse.result(json));
}
getFileInfoMap() {
- let result = this.fullValueMap;
- return result;
+ return this.fullValueMap;
}
static getFileInfoMapByID(func, params) {
dart.assert(dart.dsend(params, 'containsKey', 'id'));
@@ -45443,7 +46286,7 @@
dart.setSignature(io._FileResourceInfo, {
fields: () => ({file: dart.dynamic}),
getters: () => ({name: dart.definiteFunctionType(core.String, [])}),
- methods: () => ({getFileInfoMap: dart.definiteFunctionType(core.Map$(core.String, core.String), [])}),
+ methods: () => ({getFileInfoMap: dart.definiteFunctionType(core.Map$(core.String, dart.dynamic), [])}),
statics: () => ({
FileOpened: dart.definiteFunctionType(dart.dynamic, [io._FileResourceInfo]),
FileClosed: dart.definiteFunctionType(dart.dynamic, [io._FileResourceInfo]),
@@ -45470,13 +46313,13 @@
io._ProcessResourceInfo.ProcessStarted(this);
}
get name() {
- return core.String._check(dart.dload(this.process, _path$));
+ return core.String._check(dart.dload(this.process, _path));
}
stopped() {
io._ProcessResourceInfo.ProcessStopped(this);
}
get fullValueMap() {
- return dart.map({type: this.type, id: this.id, name: this.name, pid: core.String._check(dart.dload(this.process, 'pid')), startedAt: this.startedAt, arguments: core.String._check(dart.dload(this.process, _arguments$0)), workingDirectory: core.String._check(dart.dload(this.process, _workingDirectory) == null ? '.' : dart.dload(this.process, _workingDirectory))}, core.String, core.String);
+ return dart.map({type: this.type, id: this.id, name: this.name, pid: dart.dload(this.process, 'pid'), startedAt: this.startedAt, arguments: dart.dload(this.process, _arguments$0), workingDirectory: dart.dload(this.process, _workingDirectory) == null ? '.' : dart.dload(this.process, _workingDirectory)}, core.String, core.Object);
}
static ProcessStarted(info) {
dart.assert(!dart.test(io._ProcessResourceInfo.startedProcesses[dartx.containsKey](info.id)));
@@ -45487,7 +46330,7 @@
io._ProcessResourceInfo.startedProcesses[dartx.remove](info.id);
}
static getStartedProcessesList() {
- return ListOfMapOfString$String().from(io._ProcessResourceInfo.startedProcesses[dartx.values][dartx.map](MapOfString$String())(dart.fn(e => e.referenceValueMap, _ProcessResourceInfoToMapOfString$String())));
+ return ListOfMapOfString$String().from(io._ProcessResourceInfo.startedProcesses[dartx.values][dartx.map](MapOfString$dynamic())(dart.fn(e => e.referenceValueMap, _ProcessResourceInfoToMapOfString$dynamic())));
}
static getStartedProcesses(func, params) {
dart.assert(func == 'ext.dart.io.getProcesses');
@@ -45509,7 +46352,7 @@
}),
getters: () => ({
name: dart.definiteFunctionType(core.String, []),
- fullValueMap: dart.definiteFunctionType(core.Map$(core.String, core.String), [])
+ fullValueMap: dart.definiteFunctionType(core.Map$(core.String, dart.dynamic), [])
}),
methods: () => ({stopped: dart.definiteFunctionType(dart.void, [])}),
statics: () => ({
@@ -45549,18 +46392,18 @@
return dart.str`${dart.dload(dart.dload(this.socket, 'address'), 'host')}:${dart.dload(this.socket, 'port')}${remote}`;
}
static getOpenSocketsList() {
- return ListOfMapOfString$String().from(io._SocketResourceInfo.openSockets[dartx.values][dartx.map](MapOfString$String())(dart.fn(e => e.referenceValueMap, _SocketResourceInfoToMapOfString$String())));
+ return ListOfMapOfString$String().from(io._SocketResourceInfo.openSockets[dartx.values][dartx.map](MapOfString$dynamic())(dart.fn(e => e.referenceValueMap, _SocketResourceInfoToMapOfString$dynamic())));
}
getSocketInfoMap() {
let result = this.fullValueMap;
result[dartx._set]('socketType', dart.test(dart.dload(this.socket, 'isTcp')) ? io._SocketResourceInfo.TCP_STRING : io._SocketResourceInfo.UDP_STRING);
- result[dartx._set]('listening', core.String._check(dart.dload(this.socket, 'isListening')));
- result[dartx._set]('host', core.String._check(dart.dload(dart.dload(this.socket, 'address'), 'host')));
- result[dartx._set]('port', core.String._check(dart.dload(this.socket, 'port')));
+ result[dartx._set]('listening', dart.dload(this.socket, 'isListening'));
+ result[dartx._set]('host', dart.dload(dart.dload(this.socket, 'address'), 'host'));
+ result[dartx._set]('port', dart.dload(this.socket, 'port'));
if (!dart.test(dart.dload(this.socket, 'isListening'))) {
try {
- result[dartx._set]('remoteHost', core.String._check(dart.dload(dart.dload(this.socket, 'remoteAddress'), 'host')));
- result[dartx._set]('remotePort', core.String._check(dart.dload(this.socket, 'remotePort')));
+ result[dartx._set]('remoteHost', dart.dload(dart.dload(this.socket, 'remoteAddress'), 'host'));
+ result[dartx._set]('remotePort', dart.dload(this.socket, 'remotePort'));
} catch (e) {
result[dartx._set]('remotePort', 'NA');
result[dartx._set]('remoteHost', 'NA');
@@ -45570,7 +46413,7 @@
result[dartx._set]('remotePort', 'NA');
result[dartx._set]('remoteHost', 'NA');
}
- result[dartx._set]('addressType', core.String._check(dart.dload(dart.dload(dart.dload(this.socket, 'address'), 'type'), 'name')));
+ result[dartx._set]('addressType', dart.dload(dart.dload(dart.dload(this.socket, 'address'), 'type'), 'name'));
return result;
}
static getSocketInfoMapByID(func, params) {
@@ -45598,7 +46441,7 @@
dart.setSignature(io._SocketResourceInfo, {
fields: () => ({socket: dart.dynamic}),
getters: () => ({name: dart.definiteFunctionType(core.String, [])}),
- methods: () => ({getSocketInfoMap: dart.definiteFunctionType(core.Map$(core.String, core.String), [])}),
+ methods: () => ({getSocketInfoMap: dart.definiteFunctionType(core.Map$(core.String, dart.dynamic), [])}),
statics: () => ({
getOpenSocketsList: dart.definiteFunctionType(core.Iterable$(core.Map$(core.String, core.String)), []),
getSocketInfoMapByID: dart.definiteFunctionType(async.Future$(developer.ServiceExtensionResponse), [core.String, MapOfString$String()]),
@@ -45640,33 +46483,36 @@
io._FILE_TRUNCATE = 10;
io._FILE_LENGTH = 11;
io._FILE_LENGTH_FROM_PATH = 12;
- io._FILE_LAST_MODIFIED = 13;
- io._FILE_FLUSH = 14;
- io._FILE_READ_BYTE = 15;
- io._FILE_WRITE_BYTE = 16;
- io._FILE_READ = 17;
- io._FILE_READ_INTO = 18;
- io._FILE_WRITE_FROM = 19;
- io._FILE_CREATE_LINK = 20;
- io._FILE_DELETE_LINK = 21;
- io._FILE_RENAME_LINK = 22;
- io._FILE_LINK_TARGET = 23;
- io._FILE_TYPE = 24;
- io._FILE_IDENTICAL = 25;
- io._FILE_STAT = 26;
- io._FILE_LOCK = 27;
- io._SOCKET_LOOKUP = 28;
- io._SOCKET_LIST_INTERFACES = 29;
- io._SOCKET_REVERSE_LOOKUP = 30;
- io._DIRECTORY_CREATE = 31;
- io._DIRECTORY_DELETE = 32;
- io._DIRECTORY_EXISTS = 33;
- io._DIRECTORY_CREATE_TEMP = 34;
- io._DIRECTORY_LIST_START = 35;
- io._DIRECTORY_LIST_NEXT = 36;
- io._DIRECTORY_LIST_STOP = 37;
- io._DIRECTORY_RENAME = 38;
- io._SSL_PROCESS_FILTER = 39;
+ io._FILE_LAST_ACCESSED = 13;
+ io._FILE_SET_LAST_ACCESSED = 14;
+ io._FILE_LAST_MODIFIED = 15;
+ io._FILE_SET_LAST_MODIFIED = 16;
+ io._FILE_FLUSH = 17;
+ io._FILE_READ_BYTE = 18;
+ io._FILE_WRITE_BYTE = 19;
+ io._FILE_READ = 20;
+ io._FILE_READ_INTO = 21;
+ io._FILE_WRITE_FROM = 22;
+ io._FILE_CREATE_LINK = 23;
+ io._FILE_DELETE_LINK = 24;
+ io._FILE_RENAME_LINK = 25;
+ io._FILE_LINK_TARGET = 26;
+ io._FILE_TYPE = 27;
+ io._FILE_IDENTICAL = 28;
+ io._FILE_STAT = 29;
+ io._FILE_LOCK = 30;
+ io._SOCKET_LOOKUP = 31;
+ io._SOCKET_LIST_INTERFACES = 32;
+ io._SOCKET_REVERSE_LOOKUP = 33;
+ io._DIRECTORY_CREATE = 34;
+ io._DIRECTORY_DELETE = 35;
+ io._DIRECTORY_EXISTS = 36;
+ io._DIRECTORY_CREATE_TEMP = 37;
+ io._DIRECTORY_LIST_START = 38;
+ io._DIRECTORY_LIST_NEXT = 39;
+ io._DIRECTORY_LIST_STOP = 40;
+ io._DIRECTORY_RENAME = 41;
+ io._SSL_PROCESS_FILTER = 42;
io._IOService = class _IOService extends core.Object {
static _dispatch(request, data) {
dart.throw(new core.UnsupportedError("_IOService._dispatch"));
@@ -45706,12 +46552,6 @@
get absolute() {
return io.Link.new(this[_absolutePath]);
}
- stat() {
- return io.FileStat.stat(this.path);
- }
- statSync() {
- return io.FileStat.statSync(this.path);
- }
create(target, opts) {
let recursive = opts && 'recursive' in opts ? opts.recursive : false;
if (dart.test(io.Platform.isWindows)) {
@@ -45835,8 +46675,6 @@
methods: () => ({
exists: dart.definiteFunctionType(async.Future$(core.bool), []),
existsSync: dart.definiteFunctionType(core.bool, []),
- stat: dart.definiteFunctionType(async.Future$(io.FileStat), []),
- statSync: dart.definiteFunctionType(io.FileStat, []),
create: dart.definiteFunctionType(async.Future$(io.Link), [core.String], {recursive: core.bool}),
createSync: dart.definiteFunctionType(dart.void, [core.String], {recursive: core.bool}),
[_makeWindowsLinkTarget]: dart.definiteFunctionType(core.String, [core.String]),
@@ -45922,6 +46760,9 @@
},
get isIOS() {
return io.Platform._operatingSystem == "ios";
+ },
+ get isFuchsia() {
+ return io.Platform._operatingSystem == "fuchsia";
}
});
io._Platform = class _Platform extends core.Object {
@@ -45983,14 +46824,17 @@
let env = io._Platform._environment();
if (!io.OSError.is(env)) {
let isWindows = io._Platform.operatingSystem == 'windows';
- let result = isWindows ? new io._CaseInsensitiveStringMap() : core.Map.new();
+ let result = isWindows ? new (_CaseInsensitiveStringMapOfString())() : MapOfString$String().new();
for (let str of core.Iterable._check(env)) {
+ if (str == null) {
+ continue;
+ }
let equalsIndex = dart.dsend(str, 'indexOf', '=');
if (dart.test(dart.dsend(equalsIndex, '>', 0))) {
- result[dartx._set](dart.dsend(str, 'substring', 0, equalsIndex), dart.dsend(str, 'substring', dart.dsend(equalsIndex, '+', 1)));
+ result[dartx._set](core.String._check(dart.dsend(str, 'substring', 0, equalsIndex)), core.String._check(dart.dsend(str, 'substring', dart.dsend(equalsIndex, '+', 1))));
}
}
- io._Platform._environmentCache = new (UnmodifiableMapViewOfString$String())(MapOfString$String()._check(result));
+ io._Platform._environmentCache = new (UnmodifiableMapViewOfString$String())(result);
} else {
io._Platform._environmentCache = env;
}
@@ -45998,7 +46842,7 @@
if (io.OSError.is(io._Platform._environmentCache)) {
dart.throw(io._Platform._environmentCache);
} else {
- return MapOfString$String()._check(io._Platform._environmentCache);
+ return MapOfString$String().as(io._Platform._environmentCache);
}
}
static get version() {
@@ -46046,6 +46890,7 @@
let MapOfString$V = () => (MapOfString$V = dart.constFn(core.Map$(core.String, V)))();
let VoidToV = () => (VoidToV = dart.constFn(dart.functionType(V, [])))();
let StringAndVTovoid = () => (StringAndVTovoid = dart.constFn(dart.functionType(dart.void, [core.String, V])))();
+ let StringAndVToV = () => (StringAndVToV = dart.constFn(dart.definiteFunctionType(V, [core.String, V])))();
class _CaseInsensitiveStringMap extends core.Object {
new() {
this[_map$1] = MapOfString$V().new();
@@ -46069,7 +46914,8 @@
return this[_map$1][dartx.putIfAbsent](key[dartx.toUpperCase](), ifAbsent);
}
addAll(other) {
- other[dartx.forEach](dart.fn((key, value) => this._set(core.String._check(dart.dsend(key, 'toUpperCase')), V._check(value)), dynamicAnddynamicTovoid$()));
+ MapOfString$V()._check(other);
+ other[dartx.forEach](dart.fn((key, value) => this._set(key[dartx.toUpperCase](), value), StringAndVToV()));
}
remove(key) {
return typeof key == 'string' ? this[_map$1][dartx.remove](key[dartx.toUpperCase]()) : null;
@@ -46116,7 +46962,7 @@
_get: dart.definiteFunctionType(V, [core.Object]),
_set: dart.definiteFunctionType(dart.void, [core.String, V]),
putIfAbsent: dart.definiteFunctionType(V, [core.String, VoidToV()]),
- addAll: dart.definiteFunctionType(dart.void, [core.Map]),
+ addAll: dart.definiteFunctionType(dart.void, [MapOfString$V()]),
remove: dart.definiteFunctionType(V, [core.Object]),
clear: dart.definiteFunctionType(dart.void, []),
forEach: dart.definiteFunctionType(dart.void, [StringAndVTovoid()])
@@ -46224,9 +47070,6 @@
'DETACHED_WITH_STDIO'
]);
io.Process = class Process extends core.Object {
- new() {
- this.exitCode = null;
- }
static start(executable, arguments$, opts) {
let workingDirectory = opts && 'workingDirectory' in opts ? opts.workingDirectory : null;
let environment = opts && 'environment' in opts ? opts.environment : null;
@@ -46259,7 +47102,6 @@
}
};
dart.setSignature(io.Process, {
- fields: () => ({exitCode: FutureOfint()}),
statics: () => ({
start: dart.definiteFunctionType(async.Future$(io.Process), [core.String, ListOfString()], {workingDirectory: core.String, environment: MapOfString$String(), includeParentEnvironment: core.bool, runInShell: core.bool, mode: io.ProcessStartMode}),
run: dart.definiteFunctionType(async.Future$(io.ProcessResult), [core.String, ListOfString()], {workingDirectory: core.String, environment: MapOfString$String(), includeParentEnvironment: core.bool, runInShell: core.bool, stdoutEncoding: convert.Encoding, stderrEncoding: convert.Encoding}),
@@ -46455,22 +47297,14 @@
let host = opts && 'host' in opts ? opts.host : null;
let context = opts && 'context' in opts ? opts.context : null;
let onBadCertificate = opts && 'onBadCertificate' in opts ? opts.onBadCertificate : null;
- let completer = async.Completer.new();
- dart.dsend(dart.dsend(dart.dsend(socket, _detachRaw), 'then', dart.fn(detachedRaw => io.RawSecureSocket.secure(io.RawSocket._check(dart.dindex(detachedRaw, 0)), {subscription: async.StreamSubscription._check(dart.dindex(detachedRaw, 1)), host: host, context: context, onBadCertificate: onBadCertificate}), dynamicToFutureOfRawSecureSocket())), 'then', dart.fn(raw => {
- completer.complete(io.SecureSocket._(io.RawSecureSocket._check(raw)));
- }, dynamicToNull$()));
- return FutureOfSecureSocket()._check(completer.future);
+ return async.Future.as(dart.dsend(socket, _detachRaw)).then(io.RawSecureSocket)(dart.fn(detachedRaw => io.RawSecureSocket.secure(io.RawSocket.as(dart.dindex(detachedRaw, 0)), {subscription: StreamSubscriptionOfRawSocketEvent().as(dart.dindex(detachedRaw, 1)), host: host, context: context, onBadCertificate: onBadCertificate}), dynamicToFutureOfRawSecureSocket())).then(io.SecureSocket)(dart.fn(raw => io.SecureSocket._(raw), RawSecureSocketToSecureSocket()));
}
static secureServer(socket, context, opts) {
let bufferedData = opts && 'bufferedData' in opts ? opts.bufferedData : null;
let requestClientCertificate = opts && 'requestClientCertificate' in opts ? opts.requestClientCertificate : false;
let requireClientCertificate = opts && 'requireClientCertificate' in opts ? opts.requireClientCertificate : false;
let supportedProtocols = opts && 'supportedProtocols' in opts ? opts.supportedProtocols : null;
- let completer = async.Completer.new();
- dart.dsend(dart.dsend(dart.dsend(socket, _detachRaw), 'then', dart.fn(detachedRaw => io.RawSecureSocket.secureServer(io.RawSocket._check(dart.dindex(detachedRaw, 0)), context, {subscription: async.StreamSubscription._check(dart.dindex(detachedRaw, 1)), bufferedData: bufferedData, requestClientCertificate: requestClientCertificate, requireClientCertificate: requireClientCertificate, supportedProtocols: supportedProtocols}), dynamicToFutureOfRawSecureSocket())), 'then', dart.fn(raw => {
- completer.complete(io.SecureSocket._(io.RawSecureSocket._check(raw)));
- }, dynamicToNull$()));
- return FutureOfSecureSocket()._check(completer.future);
+ return async.Future.as(dart.dsend(socket, _detachRaw)).then(io.RawSecureSocket)(dart.fn(detachedRaw => io.RawSecureSocket.secureServer(io.RawSocket.as(dart.dindex(detachedRaw, 0)), context, {subscription: StreamSubscriptionOfRawSocketEvent().as(dart.dindex(detachedRaw, 1)), bufferedData: bufferedData, requestClientCertificate: requestClientCertificate, requireClientCertificate: requireClientCertificate, supportedProtocols: supportedProtocols}), dynamicToFutureOfRawSecureSocket())).then(io.SecureSocket)(dart.fn(raw => io.SecureSocket._(raw), RawSecureSocketToSecureSocket()));
}
};
io.SecureSocket[dart.implements] = () => [io.Socket];
@@ -46566,8 +47400,8 @@
dart.setSignature(io.RawSecureSocket, {
statics: () => ({
connect: dart.definiteFunctionType(async.Future$(io.RawSecureSocket), [dart.dynamic, core.int], {context: io.SecurityContext, onBadCertificate: X509CertificateTobool(), supportedProtocols: ListOfString()}),
- secure: dart.definiteFunctionType(async.Future$(io.RawSecureSocket), [io.RawSocket], {subscription: async.StreamSubscription, host: dart.dynamic, context: io.SecurityContext, onBadCertificate: X509CertificateTobool(), supportedProtocols: ListOfString()}),
- secureServer: dart.definiteFunctionType(async.Future$(io.RawSecureSocket), [io.RawSocket, io.SecurityContext], {subscription: async.StreamSubscription, bufferedData: ListOfint(), requestClientCertificate: core.bool, requireClientCertificate: core.bool, supportedProtocols: ListOfString()})
+ secure: dart.definiteFunctionType(async.Future$(io.RawSecureSocket), [io.RawSocket], {subscription: StreamSubscriptionOfRawSocketEvent(), host: dart.dynamic, context: io.SecurityContext, onBadCertificate: X509CertificateTobool(), supportedProtocols: ListOfString()}),
+ secureServer: dart.definiteFunctionType(async.Future$(io.RawSecureSocket), [io.RawSocket, io.SecurityContext], {subscription: StreamSubscriptionOfRawSocketEvent(), bufferedData: ListOfint(), requestClientCertificate: core.bool, requireClientCertificate: core.bool, supportedProtocols: ListOfString()})
}),
names: ['connect', 'secure', 'secureServer']
});
@@ -46738,13 +47572,13 @@
const _pushAllFilterStages = Symbol('_pushAllFilterStages');
const _readSocketOrBufferedData = Symbol('_readSocketOrBufferedData');
const _sendReadEvent = Symbol('_sendReadEvent');
- let const$75;
+ let const$78;
io.RawSocketEvent = class RawSocketEvent extends core.Object {
_(value) {
this[_value$1] = value;
}
toString() {
- return (const$75 || (const$75 = dart.constList(['RawSocketEvent:READ', 'RawSocketEvent:WRITE', 'RawSocketEvent:READ_CLOSED', 'RawSocketEvent:CLOSED'], core.String)))[dartx._get](this[_value$1]);
+ return (const$78 || (const$78 = dart.constList(['RawSocketEvent:READ', 'RawSocketEvent:WRITE', 'RawSocketEvent:READ_CLOSED', 'RawSocketEvent:CLOSED'], core.String)))[dartx._get](this[_value$1]);
}
};
dart.defineNamedConstructor(io.RawSocketEvent, '_');
@@ -46785,12 +47619,12 @@
if (host != null) {
address = io.InternetAddress._cloneWithNewHost(address, core.String._check(host));
}
- return new io._RawSecureSocket(address, requestedPort, is_server, context, socket, StreamSubscriptionOfRawSocketEvent()._check(subscription), bufferedData, requestClientCertificate, requireClientCertificate, onBadCertificate, supportedProtocols)[_handshakeComplete].future;
+ return new io._RawSecureSocket(address, requestedPort, is_server, context, socket, subscription, bufferedData, requestClientCertificate, requireClientCertificate, onBadCertificate, supportedProtocols)[_handshakeComplete].future;
}
new(address, requestedPort, is_server, context, socket, socketSubscription, bufferedData, requestClientCertificate, requireClientCertificate, onBadCertificate, supportedProtocols) {
this[_handshakeComplete] = CompleterOf_RawSecureSocket().new();
this[_status] = io._RawSecureSocket.HANDSHAKE;
- this[_closeCompleter] = async.Completer.new();
+ this[_closeCompleter] = CompleterOfRawSecureSocket().new();
this[_filterStatus] = new io._FilterStatus();
this[_secureFilter] = io._SecureFilter.new();
this.address = address;
@@ -46900,7 +47734,7 @@
}
close() {
this.shutdown(io.SocketDirection.BOTH);
- return FutureOfRawSecureSocket()._check(this[_closeCompleter].future);
+ return this[_closeCompleter].future;
}
[_completeCloseCompleter](dummy) {
if (dummy === void 0) dummy = null;
@@ -47346,7 +48180,7 @@
[_socketClosedWrite]: core.bool,
[_closedRead]: core.bool,
[_closedWrite]: core.bool,
- [_closeCompleter]: async.Completer,
+ [_closeCompleter]: CompleterOfRawSecureSocket(),
[_filterStatus]: io._FilterStatus,
[_connectPending]: core.bool,
[_filterPending]: core.bool,
@@ -47372,7 +48206,7 @@
listen: dart.definiteFunctionType(async.StreamSubscription$(io.RawSocketEvent), [RawSocketEventTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool}),
available: dart.definiteFunctionType(core.int, []),
close: dart.definiteFunctionType(async.Future$(io.RawSecureSocket), []),
- [_completeCloseCompleter]: dart.definiteFunctionType(dart.void, [], [dart.dynamic]),
+ [_completeCloseCompleter]: dart.definiteFunctionType(dart.void, [], [io.RawSocket]),
[_close$0]: dart.definiteFunctionType(dart.void, []),
shutdown: dart.definiteFunctionType(dart.void, [io.SocketDirection]),
read: dart.definiteFunctionType(core.List$(core.int), [], [core.int]),
@@ -47402,7 +48236,7 @@
}),
statics: () => ({
_isBufferEncrypted: dart.definiteFunctionType(core.bool, [core.int]),
- connect: dart.definiteFunctionType(async.Future$(io._RawSecureSocket), [dart.dynamic, core.int], {is_server: core.bool, context: io.SecurityContext, socket: io.RawSocket, subscription: async.StreamSubscription, bufferedData: ListOfint(), requestClientCertificate: core.bool, requireClientCertificate: core.bool, onBadCertificate: X509CertificateTobool(), supportedProtocols: ListOfString()}),
+ connect: dart.definiteFunctionType(async.Future$(io._RawSecureSocket), [dart.dynamic, core.int], {is_server: core.bool, context: io.SecurityContext, socket: io.RawSocket, subscription: StreamSubscriptionOfRawSocketEvent(), bufferedData: ListOfint(), requestClientCertificate: core.bool, requireClientCertificate: core.bool, onBadCertificate: X509CertificateTobool(), supportedProtocols: ListOfString()}),
_verifyFields: dart.definiteFunctionType(dart.void, [dart.dynamic, core.int, core.bool, core.bool, core.bool, core.Function])
}),
names: ['_isBufferEncrypted', 'connect', '_verifyFields']
@@ -47508,7 +48342,7 @@
while (true) {
let toWrite = this.linearLength;
if (toWrite == 0) return false;
- let bytes = socket.write(ListOfint()._check(this.data), this.start, toWrite);
+ let bytes = socket.write(this.data, this.start, toWrite);
this.advanceStart(bytes);
if (dart.notNull(bytes) < dart.notNull(toWrite)) {
return true;
@@ -47518,7 +48352,7 @@
};
dart.setSignature(io._ExternalBuffer, {
fields: () => ({
- data: core.List,
+ data: ListOfint(),
start: core.int,
end: core.int,
size: dart.dynamic
@@ -47982,7 +48816,7 @@
let retainNewlines = opts && 'retainNewlines' in opts ? opts.retainNewlines : false;
let CR = 13;
let LF = 10;
- let line = [];
+ let line = JSArrayOfint().of([]);
let crIsNewline = dart.test(io.Platform.isWindows) && dart.equals(io.stdioType(io.stdin), io.StdioType.TERMINAL) && !dart.test(/* Unimplemented unknown name */lineMode);
if (dart.test(retainNewlines)) {
let byte = null;
@@ -48025,7 +48859,7 @@
line[dartx.add](byte);
}
}
- return encoding.decode(ListOfint()._check(line));
+ return encoding.decode(line);
}
set echoMode(enabled) {
dart.throw(new core.UnsupportedError("Stdin.echoMode"));
@@ -48062,9 +48896,11 @@
const _hasTerminal = Symbol('_hasTerminal');
const _terminalColumns = Symbol('_terminalColumns');
const _terminalLines = Symbol('_terminalLines');
- io._StdSink = class _StdSink extends core.Object {
- new(sink) {
+ const _isTranslatable = Symbol('_isTranslatable');
+ io._StdSinkHelper = class _StdSinkHelper extends core.Object {
+ new(sink, isTranslatable) {
this[_sink$0] = sink;
+ this[_isTranslatable] = isTranslatable;
}
get encoding() {
return this[_sink$0].encoding;
@@ -48072,18 +48908,29 @@
set encoding(encoding) {
this[_sink$0].encoding = encoding;
}
+ set [_translation](t) {
+ if (dart.test(this[_isTranslatable])) {
+ let sink = io._IOSinkImpl._check(this[_sink$0]);
+ let target = io._StdConsumer._check(sink[_target$]);
+ dart.dput(target[_file], 'translation', t);
+ }
+ }
write(object) {
+ this[_translation] = io._FileTranslation.text;
this[_sink$0].write(object);
}
writeln(object) {
if (object === void 0) object = "";
+ this[_translation] = io._FileTranslation.text;
this[_sink$0].writeln(object);
}
writeAll(objects, sep) {
if (sep === void 0) sep = "";
+ this[_translation] = io._FileTranslation.text;
this[_sink$0].writeAll(objects, sep);
}
add(data) {
+ this[_translation] = io._FileTranslation.binary;
this[_sink$0].add(data);
}
addError(error, stackTrace) {
@@ -48091,9 +48938,11 @@
this[_sink$0].addError(error, stackTrace);
}
writeCharCode(charCode) {
+ this[_translation] = io._FileTranslation.text;
this[_sink$0].writeCharCode(charCode);
}
addStream(stream) {
+ this[_translation] = io._FileTranslation.binary;
return this[_sink$0].addStream(stream);
}
flush() {
@@ -48106,14 +48955,20 @@
return this[_sink$0].done;
}
};
- io._StdSink[dart.implements] = () => [io.IOSink];
- dart.setSignature(io._StdSink, {
- fields: () => ({[_sink$0]: io.IOSink}),
+ io._StdSinkHelper[dart.implements] = () => [io.IOSink];
+ dart.setSignature(io._StdSinkHelper, {
+ fields: () => ({
+ [_sink$0]: io.IOSink,
+ [_isTranslatable]: core.bool
+ }),
getters: () => ({
encoding: dart.definiteFunctionType(convert.Encoding, []),
done: dart.definiteFunctionType(async.Future, [])
}),
- setters: () => ({encoding: dart.definiteFunctionType(dart.void, [convert.Encoding])}),
+ setters: () => ({
+ encoding: dart.definiteFunctionType(dart.void, [convert.Encoding]),
+ [_translation]: dart.definiteFunctionType(dart.void, [io._FileTranslation])
+ }),
methods: () => ({
write: dart.definiteFunctionType(dart.void, [core.Object]),
writeln: dart.definiteFunctionType(dart.void, [], [core.Object]),
@@ -48126,7 +48981,12 @@
close: dart.definiteFunctionType(async.Future, [])
})
});
- io.Stdout = class Stdout extends io._StdSink {
+ io._StdFileSink = class _StdFileSink extends io._StdSinkHelper {
+ new(sink) {
+ super.new(sink, true);
+ }
+ };
+ io.Stdout = class Stdout extends io._StdFileSink {
_(sink, fd) {
this[_fd] = fd;
this[_nonBlocking] = null;
@@ -48193,6 +49053,23 @@
osError: io.OSError
})
});
+ io.StdinException = class StdinException extends core.Object {
+ new(message, osError) {
+ if (osError === void 0) osError = null;
+ this.message = message;
+ this.osError = osError;
+ }
+ toString() {
+ return dart.str`StdinException: ${this.message}${this.osError == null ? "" : dart.str`, ${this.osError}`}`;
+ }
+ };
+ io.StdinException[dart.implements] = () => [io.IOException];
+ dart.setSignature(io.StdinException, {
+ fields: () => ({
+ message: core.String,
+ osError: io.OSError
+ })
+ });
io._StdConsumer = class _StdConsumer extends core.Object {
new(fd) {
this[_file] = io._File._openStdioSync(fd);
@@ -48225,6 +49102,11 @@
close: dart.definiteFunctionType(async.Future, [])
})
});
+ io._StdSocketSink = class _StdSocketSink extends io._StdSinkHelper {
+ new(sink) {
+ super.new(sink, false);
+ }
+ };
io.StdioType = class StdioType extends core.Object {
_(name) {
this.name = name;
@@ -48353,10 +49235,10 @@
}),
names: ['_getStdioOutputStream', '_getStdioInputStream', '_socketType', '_getStdioHandleType']
});
- let const$76;
- let const$77;
- let const$78;
let const$79;
+ let const$80;
+ let const$81;
+ let const$82;
io.SystemEncoding = class SystemEncoding extends convert.Encoding {
new() {
super.new();
@@ -48372,16 +49254,16 @@
}
get encoder() {
if (io.Platform.operatingSystem == "windows") {
- return const$76 || (const$76 = dart.const(new io._WindowsCodePageEncoder()));
+ return const$79 || (const$79 = dart.const(new io._WindowsCodePageEncoder()));
} else {
- return const$77 || (const$77 = dart.const(new convert.Utf8Encoder()));
+ return const$80 || (const$80 = dart.const(new convert.Utf8Encoder()));
}
}
get decoder() {
if (io.Platform.operatingSystem == "windows") {
- return const$78 || (const$78 = dart.const(new io._WindowsCodePageDecoder()));
+ return const$81 || (const$81 = dart.const(new io._WindowsCodePageDecoder()));
} else {
- return const$79 || (const$79 = dart.const(new convert.Utf8Decoder()));
+ return const$82 || (const$82 = dart.const(new convert.Utf8Decoder()));
}
}
};
@@ -48412,6 +49294,7 @@
}
};
dart.addSimpleTypeTests(io._WindowsCodePageEncoder);
+ io._WindowsCodePageEncoder[dart.implements] = () => [ChunkedConverterOfString$ListOfint$String$ListOfint()];
dart.setSignature(io._WindowsCodePageEncoder, {
methods: () => ({
convert: dart.definiteFunctionType(core.List$(core.int), [core.String]),
@@ -48464,6 +49347,7 @@
}
};
dart.addSimpleTypeTests(io._WindowsCodePageDecoder);
+ io._WindowsCodePageDecoder[dart.implements] = () => [ChunkedConverterOfListOfint$String$ListOfint$String()];
dart.setSignature(io._WindowsCodePageDecoder, {
methods: () => ({
convert: dart.definiteFunctionType(core.String, [ListOfint()]),
@@ -48692,6 +49576,14 @@
io._WebSocketOpcode.RESERVED_D = 13;
io._WebSocketOpcode.RESERVED_E = 14;
io._WebSocketOpcode.RESERVED_F = 15;
+ io._EncodedString = class _EncodedString extends core.Object {
+ new(bytes) {
+ this.bytes = bytes;
+ }
+ };
+ dart.setSignature(io._EncodedString, {
+ fields: () => ({bytes: ListOfint()})
+ });
io._CompressionMaxWindowBits = class _CompressionMaxWindowBits extends core.Object {
new(headerValue, maxWindowBits) {
if (headerValue === void 0) headerValue = null;
@@ -49031,7 +49923,7 @@
this[_unmaskingIndex] = 0;
}
};
- io._WebSocketProtocolTransformer[dart.implements] = () => [StreamTransformerOfListOfint$dynamic(), EventSinkOfUint8List()];
+ io._WebSocketProtocolTransformer[dart.implements] = () => [EventSinkOfListOfint(), StreamTransformerOfListOfint$dynamic()];
dart.setSignature(io._WebSocketProtocolTransformer, {
fields: () => ({
[_state$1]: core.int,
@@ -49054,7 +49946,7 @@
[_deflate]: io._WebSocketPerMessageDeflate
}),
methods: () => ({
- bind: dart.definiteFunctionType(async.Stream, [async.Stream]),
+ bind: dart.definiteFunctionType(async.Stream, [StreamOfListOfint()]),
addError: dart.definiteFunctionType(dart.void, [core.Object], [core.StackTrace]),
close: dart.definiteFunctionType(dart.void, []),
add: dart.definiteFunctionType(dart.void, [ListOfint()]),
@@ -49098,6 +49990,7 @@
dart.setSignature(io._WebSocketPong, {
fields: () => ({payload: ListOfint()})
});
+ io._ProtocolSelector = dart.typedef('_ProtocolSelector', () => dart.functionType(dart.dynamic, [ListOfString()]));
const _protocolSelector = Symbol('_protocolSelector');
const _compression = Symbol('_compression');
io._WebSocketTransformerImpl = class _WebSocketTransformerImpl extends core.Object {
@@ -49135,24 +50028,24 @@
}
let deflate = io._WebSocketTransformerImpl._negotiateCompression(request, response, compression);
response.headers.contentLength = 0;
- return response.detachSocket().then(io._WebSocketImpl)(dart.fn(socket => new io._WebSocketImpl._fromSocket(socket, protocol, compression, true, deflate), SocketTo_WebSocketImpl()));
+ return response.detachSocket().then(io.WebSocket)(dart.fn(socket => new io._WebSocketImpl._fromSocket(socket, protocol, compression, true, deflate), SocketTo_WebSocketImpl()));
}
- dart.fn(upgrade, StringToFuture());
+ dart.fn(upgrade, StringToFutureOfWebSocket());
let protocols = request.headers._get('Sec-WebSocket-Protocol');
if (protocols != null && _protocolSelector != null) {
protocols = io._HttpParser._tokenizeFieldValue(protocols[dartx.join](', '));
- return async.Future.new(dart.fn(() => dart.dcall(_protocolSelector, protocols), VoidTodynamic$())).then(dart.dynamic)(dart.fn(protocol => {
- if (dart.notNull(protocols[dartx.indexOf](core.String._check(protocol))) < 0) {
+ return FutureOfString().new(dart.fn(() => _protocolSelector(protocols), VoidTodynamic$())).then(core.String)(dart.fn(protocol => {
+ if (dart.notNull(protocols[dartx.indexOf](protocol)) < 0) {
dart.throw(new io.WebSocketException("Selected protocol is not in the list of available protocols"));
}
return protocol;
- }, dynamicTodynamic$())).catchError(dart.fn(error => {
+ }, StringToString$())).catchError(dart.fn(error => {
response.statusCode = io.HttpStatus.INTERNAL_SERVER_ERROR;
response.close();
dart.throw(error);
}, dynamicToNull$())).then(io.WebSocket)(upgrade);
} else {
- return FutureOfWebSocket()._check(upgrade(null));
+ return upgrade(null);
}
}
static _negotiateCompression(request, response, compression) {
@@ -49201,12 +50094,12 @@
dart.setSignature(io._WebSocketTransformerImpl, {
fields: () => ({
[_controller$0]: StreamControllerOfWebSocket(),
- [_protocolSelector]: core.Function,
+ [_protocolSelector]: io._ProtocolSelector,
[_compression]: io.CompressionOptions
}),
methods: () => ({bind: dart.definiteFunctionType(async.Stream$(io.WebSocket), [StreamOfHttpRequest()])}),
statics: () => ({
- _upgrade: dart.definiteFunctionType(async.Future$(io.WebSocket), [io.HttpRequest, dart.dynamic, io.CompressionOptions]),
+ _upgrade: dart.definiteFunctionType(async.Future$(io.WebSocket), [io.HttpRequest, io._ProtocolSelector, io.CompressionOptions]),
_negotiateCompression: dart.definiteFunctionType(io._WebSocketPerMessageDeflate, [io.HttpRequest, io.HttpResponse, io.CompressionOptions]),
_isUpgradeRequest: dart.definiteFunctionType(core.bool, [io.HttpRequest])
}),
@@ -49214,7 +50107,7 @@
});
const _ensureDecoder = Symbol('_ensureDecoder');
const _ensureEncoder = Symbol('_ensureEncoder');
- let const$80;
+ let const$83;
io._WebSocketPerMessageDeflate = class _WebSocketPerMessageDeflate extends core.Object {
new(opts) {
let clientMaxWindowBits = opts && 'clientMaxWindowBits' in opts ? opts.clientMaxWindowBits : io._WebSocketImpl.DEFAULT_WINDOW_BITS;
@@ -49242,25 +50135,24 @@
}
processIncomingMessage(msg) {
this[_ensureDecoder]();
- let data = [];
+ let data = JSArrayOfint().of([]);
data[dartx.addAll](msg);
- data[dartx.addAll](const$80 || (const$80 = dart.constList([0, 0, 255, 255], core.int)));
- this.decoder.process(ListOfint()._check(data), 0, data[dartx.length]);
- let result = [];
+ data[dartx.addAll](const$83 || (const$83 = dart.constList([0, 0, 255, 255], core.int)));
+ this.decoder.process(data, 0, data[dartx.length]);
+ let result = JSArrayOfint().of([]);
let out = null;
while ((out = this.decoder.processed()) != null) {
- result[dartx.addAll](core.Iterable._check(out));
+ result[dartx.addAll](out);
}
if (dart.test(this.serverSide) && dart.test(this.clientNoContextTakeover) || !dart.test(this.serverSide) && dart.test(this.serverNoContextTakeover)) {
this.decoder = null;
}
- return typed_data.Uint8List.fromList(ListOfint()._check(result));
+ return typed_data.Uint8List.fromList(result);
}
processOutgoingMessage(msg) {
this[_ensureEncoder]();
- let result = [];
+ let result = JSArrayOfint().of([]);
let buffer = null;
- let out = null;
if (!typed_data.Uint8List.is(msg)) {
for (let i = 0; i < dart.notNull(msg[dartx.length]); i++) {
if (dart.notNull(msg[dartx._get](i)) < 0 || 255 < dart.notNull(msg[dartx._get](i))) {
@@ -49272,8 +50164,9 @@
buffer = typed_data.Uint8List._check(msg);
}
this.encoder.process(buffer, 0, buffer[dartx.length]);
+ let out = null;
while ((out = this.encoder.processed()) != null) {
- result[dartx.addAll](core.Iterable._check(out));
+ result[dartx.addAll](out);
}
if (!dart.test(this.serverSide) && dart.test(this.clientNoContextTakeover) || dart.test(this.serverSide) && dart.test(this.serverNoContextTakeover)) {
this.encoder = null;
@@ -49281,7 +50174,7 @@
if (dart.notNull(result[dartx.length]) > 4) {
result = result[dartx.sublist](0, dart.notNull(result[dartx.length]) - 4);
}
- return ListOfint()._check(result);
+ return result;
}
};
dart.setSignature(io._WebSocketPerMessageDeflate, {
@@ -49335,13 +50228,14 @@
if (typeof message == 'string') {
opcode = io._WebSocketOpcode.TEXT;
data = convert.UTF8.encode(message);
+ } else if (ListOfint().is(message)) {
+ opcode = io._WebSocketOpcode.BINARY;
+ data = message;
+ } else if (io._EncodedString.is(message)) {
+ opcode = io._WebSocketOpcode.TEXT;
+ data = message.bytes;
} else {
- if (ListOfint().is(message)) {
- data = message;
- opcode = io._WebSocketOpcode.BINARY;
- } else {
- dart.throw(new core.ArgumentError(message));
- }
+ dart.throw(new core.ArgumentError(message));
}
if (this[_deflateHelper] != null) {
data = this[_deflateHelper].processOutgoingMessage(data);
@@ -49371,7 +50265,7 @@
this[_eventSink$].close();
}
addFrame(opcode, data) {
- return io._WebSocketOutgoingTransformer.createFrame(opcode, data, this.webSocket[_serverSide], this[_deflateHelper] != null && (opcode == io._WebSocketOpcode.TEXT || opcode == io._WebSocketOpcode.BINARY))[dartx.forEach](dart.fn(e => {
+ io._WebSocketOutgoingTransformer.createFrame(opcode, data, this.webSocket[_serverSide], this[_deflateHelper] != null && (opcode == io._WebSocketOpcode.TEXT || opcode == io._WebSocketOpcode.BINARY))[dartx.forEach](dart.fn(e => {
this[_eventSink$].add(e);
}, ListOfintToNull()));
}
@@ -49563,7 +50457,7 @@
this[_ensureController]();
const closeSocket = (function() {
return this.socket.close().catchError(dart.fn(_ => {
- }, dynamicToNull$())).then(io._WebSocketImpl)(dart.fn(_ => this.webSocket, dynamicTo_WebSocketImpl()));
+ }, dynamicToNull$())).then(io._WebSocketImpl)(dart.fn(_ => this.webSocket, SocketTo_WebSocketImpl()));
}).bind(this);
dart.fn(closeSocket, VoidToFuture());
this[_controller$0].close();
@@ -49613,7 +50507,7 @@
const _pingTimer = Symbol('_pingTimer');
const _consumer = Symbol('_consumer');
const _closeTimer = Symbol('_closeTimer');
- let const$81;
+ let const$84;
io._WebSocketImpl = class _WebSocketImpl extends dart.mixin(async.Stream, io._ServiceObject) {
static connect(url, protocols, headers, opts) {
let compression = opts && 'compression' in opts ? opts.compression : io.CompressionOptions.DEFAULT;
@@ -49810,6 +50704,12 @@
add(data) {
this[_sink$0].add(data);
}
+ addUtf8Text(bytes) {
+ if (!ListOfint().is(bytes)) {
+ dart.throw(new core.ArgumentError.value(bytes, "bytes", "Is not a list of bytes"));
+ }
+ this[_sink$0].add(new io._EncodedString(bytes));
+ }
addError(error, stackTrace) {
if (stackTrace === void 0) stackTrace = null;
this[_sink$0].addError(error, stackTrace);
@@ -49835,7 +50735,7 @@
this[_controller$0].stream.drain(dart.dynamic)().catchError(dart.fn(_ => dart.map(), dynamicToMap()));
}
if (this[_closeTimer] == null) {
- this[_closeTimer] = async.Timer.new(const$81 || (const$81 = dart.const(new core.Duration({seconds: 5}))), dart.fn(() => {
+ this[_closeTimer] = async.Timer.new(const$84 || (const$84 = dart.const(new core.Duration({seconds: 5}))), dart.fn(() => {
this[_closeCode] = this[_outCloseCode];
this[_closeReason] = this[_outCloseReason];
if (this[_subscription$] != null) this[_subscription$].cancel();
@@ -49919,6 +50819,7 @@
methods: () => ({
listen: dart.definiteFunctionType(async.StreamSubscription, [dynamicTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool}),
add: dart.definiteFunctionType(dart.void, [dart.dynamic]),
+ addUtf8Text: dart.definiteFunctionType(dart.void, [ListOfint()]),
addError: dart.definiteFunctionType(dart.void, [dart.dynamic], [core.StackTrace]),
addStream: dart.definiteFunctionType(async.Future, [async.Stream]),
close: dart.definiteFunctionType(async.Future, [], [core.int, core.String]),
@@ -49943,7 +50844,7 @@
return io.HttpClient.new();
}
});
- isolate.IsolateSpawnException = class IsolateSpawnException extends core.Object {
+ isolate$.IsolateSpawnException = class IsolateSpawnException extends core.Object {
new(message) {
this.message = message;
}
@@ -49951,12 +50852,12 @@
return dart.str`IsolateSpawnException: ${this.message}`;
}
};
- isolate.IsolateSpawnException[dart.implements] = () => [core.Exception];
- dart.setSignature(isolate.IsolateSpawnException, {
+ isolate$.IsolateSpawnException[dart.implements] = () => [core.Exception];
+ dart.setSignature(isolate$.IsolateSpawnException, {
fields: () => ({message: core.String})
});
const _pause = Symbol('_pause');
- isolate.Isolate = class Isolate extends core.Object {
+ isolate$.Isolate = class Isolate extends core.Object {
new(controlPort, opts) {
let pauseCapability = opts && 'pauseCapability' in opts ? opts.pauseCapability : null;
let terminateCapability = opts && 'terminateCapability' in opts ? opts.terminateCapability : null;
@@ -49965,12 +50866,48 @@
this.terminateCapability = terminateCapability;
}
static get current() {
- return isolate.Isolate._currentIsolateCache;
+ return isolate$.Isolate._currentIsolateCache;
+ }
+ static get packageRoot() {
+ dart.throw(new core.UnsupportedError("Isolate.packageRoot"));
+ }
+ static get packageConfig() {
+ dart.throw(new core.UnsupportedError("Isolate.packageConfig"));
+ }
+ static resolvePackageUri(packageUri) {
+ return dart.async(function*(packageUri) {
+ if (packageUri.scheme != 'package') return packageUri;
+ return isolate$.Isolate._packageBase.resolveUri(packageUri.replace({scheme: ''}));
+ }, core.Uri, packageUri);
}
static spawn(entryPoint, message, opts) {
let paused = opts && 'paused' in opts ? opts.paused : false;
+ let errorsAreFatal = opts && 'errorsAreFatal' in opts ? opts.errorsAreFatal : null;
+ let onExit = opts && 'onExit' in opts ? opts.onExit : null;
+ let onError = opts && 'onError' in opts ? opts.onError : null;
+ let forcePause = errorsAreFatal != null || onExit != null || onError != null;
try {
- return _isolate_helper.IsolateNatives.spawnFunction(entryPoint, message, paused).then(isolate.Isolate)(dart.fn(msg => new isolate.Isolate(isolate.SendPort._check(msg[dartx._get](1)), {pauseCapability: isolate.Capability._check(msg[dartx._get](2)), terminateCapability: isolate.Capability._check(msg[dartx._get](3))}), ListToIsolate()));
+ if (!isolate$._UnaryFunction.is(entryPoint)) {
+ dart.throw(new core.ArgumentError(entryPoint));
+ }
+ return _isolate_helper.IsolateNatives.spawnFunction(entryPoint, message, dart.test(paused) || forcePause).then(isolate$.Isolate)(dart.fn(msg => {
+ let isolate = new isolate$.Isolate(isolate$.SendPort._check(msg[dartx._get](1)), {pauseCapability: isolate$.Capability._check(msg[dartx._get](2)), terminateCapability: isolate$.Capability._check(msg[dartx._get](3))});
+ if (forcePause) {
+ if (errorsAreFatal != null) {
+ isolate.setErrorsFatal(errorsAreFatal);
+ }
+ if (onExit != null) {
+ isolate.addOnExitListener(onExit);
+ }
+ if (onError != null) {
+ isolate.addErrorListener(onError);
+ }
+ if (!dart.test(paused)) {
+ isolate.resume(isolate.pauseCapability);
+ }
+ }
+ return isolate;
+ }, ListToIsolate()));
} catch (e) {
let st = dart.stackTrace(e);
return FutureOfIsolate().error(e, st);
@@ -49979,10 +50916,20 @@
}
static spawnUri(uri, args, message, opts) {
let paused = opts && 'paused' in opts ? opts.paused : false;
+ let onExit = opts && 'onExit' in opts ? opts.onExit : null;
+ let onError = opts && 'onError' in opts ? opts.onError : null;
+ let errorsAreFatal = opts && 'errorsAreFatal' in opts ? opts.errorsAreFatal : null;
+ let checked = opts && 'checked' in opts ? opts.checked : null;
+ let environment = opts && 'environment' in opts ? opts.environment : null;
let packageRoot = opts && 'packageRoot' in opts ? opts.packageRoot : null;
+ let packageConfig = opts && 'packageConfig' in opts ? opts.packageConfig : null;
+ let automaticPackageResolution = opts && 'automaticPackageResolution' in opts ? opts.automaticPackageResolution : false;
+ if (environment != null) dart.throw(new core.UnimplementedError("environment"));
if (packageRoot != null) dart.throw(new core.UnimplementedError("packageRoot"));
+ if (packageConfig != null) dart.throw(new core.UnimplementedError("packageConfig"));
+ let forcePause = errorsAreFatal != null || onExit != null || onError != null;
try {
- if (core.List.is(args)) {
+ if (ListOfString().is(args)) {
for (let i = 0; i < dart.notNull(args[dartx.length]); i++) {
if (!(typeof args[dartx._get](i) == 'string')) {
dart.throw(new core.ArgumentError(dart.str`Args must be a list of Strings ${args}`));
@@ -49991,7 +50938,24 @@
} else if (args != null) {
dart.throw(new core.ArgumentError(dart.str`Args must be a list of Strings ${args}`));
}
- return _isolate_helper.IsolateNatives.spawnUri(uri, args, message, paused).then(isolate.Isolate)(dart.fn(msg => new isolate.Isolate(isolate.SendPort._check(msg[dartx._get](1)), {pauseCapability: isolate.Capability._check(msg[dartx._get](2)), terminateCapability: isolate.Capability._check(msg[dartx._get](3))}), ListToIsolate()));
+ return _isolate_helper.IsolateNatives.spawnUri(uri, args, message, dart.test(paused) || forcePause).then(isolate$.Isolate)(dart.fn(msg => {
+ let isolate = new isolate$.Isolate(isolate$.SendPort._check(msg[dartx._get](1)), {pauseCapability: isolate$.Capability._check(msg[dartx._get](2)), terminateCapability: isolate$.Capability._check(msg[dartx._get](3))});
+ if (forcePause) {
+ if (errorsAreFatal != null) {
+ isolate.setErrorsFatal(errorsAreFatal);
+ }
+ if (onExit != null) {
+ isolate.addOnExitListener(onExit);
+ }
+ if (onError != null) {
+ isolate.addErrorListener(onError);
+ }
+ if (!dart.test(paused)) {
+ isolate.resume(isolate.pauseCapability);
+ }
+ }
+ return isolate;
+ }, ListToIsolate()));
} catch (e) {
let st = dart.stackTrace(e);
return FutureOfIsolate().error(e, st);
@@ -50000,7 +50964,8 @@
}
pause(resumeCapability) {
if (resumeCapability === void 0) resumeCapability = null;
- if (resumeCapability == null) resumeCapability = isolate.Capability.new();
+ let t = resumeCapability;
+ t == null ? resumeCapability = isolate$.Capability.new() : t;
this[_pause](resumeCapability);
return resumeCapability;
}
@@ -50017,10 +50982,12 @@
message[dartx._set](1, resumeCapability);
this.controlPort.send(message);
}
- addOnExitListener(responsePort) {
- let message = core.List.new(2);
+ addOnExitListener(responsePort, opts) {
+ let response = opts && 'response' in opts ? opts.response : null;
+ let message = core.List.new(3);
message[dartx._set](0, "add-ondone");
message[dartx._set](1, responsePort);
+ message[dartx._set](2, response);
this.controlPort.send(message);
}
removeOnExitListener(responsePort) {
@@ -50036,16 +51003,18 @@
message[dartx._set](2, errorsAreFatal);
this.controlPort.send(message);
}
- kill(priority) {
- if (priority === void 0) priority = isolate.Isolate.BEFORE_NEXT_EVENT;
+ kill(opts) {
+ let priority = opts && 'priority' in opts ? opts.priority : isolate$.Isolate.BEFORE_NEXT_EVENT;
this.controlPort.send(JSArrayOfObject().of(["kill", this.terminateCapability, priority]));
}
- ping(responsePort, pingType) {
- if (pingType === void 0) pingType = isolate.Isolate.IMMEDIATE;
- let message = core.List.new(3);
+ ping(responsePort, opts) {
+ let response = opts && 'response' in opts ? opts.response : null;
+ let priority = opts && 'priority' in opts ? opts.priority : isolate$.Isolate.IMMEDIATE;
+ let message = core.List.new(4);
message[dartx._set](0, "ping");
message[dartx._set](1, responsePort);
- message[dartx._set](2, pingType);
+ message[dartx._set](2, priority);
+ message[dartx._set](3, response);
this.controlPort.send(message);
}
addErrorListener(port) {
@@ -50066,12 +51035,12 @@
function handleError(message) {
let errorDescription = core.String._check(dart.dindex(message, 0));
let stackDescription = core.String._check(dart.dindex(message, 1));
- let error = new isolate.RemoteError(errorDescription, stackDescription);
+ let error = new isolate$.RemoteError(errorDescription, stackDescription);
controller.addError(error, error.stackTrace);
}
dart.fn(handleError, dynamicTovoid$());
controller = async.StreamController.broadcast({sync: true, onListen: dart.fn(() => {
- port = isolate.RawReceivePort.new(handleError);
+ port = isolate$.RawReceivePort.new(handleError);
this.addErrorListener(port.sendPort);
}, VoidToNull()), onCancel: dart.fn(() => {
this.removeErrorListener(port.sendPort);
@@ -50081,42 +51050,46 @@
return controller.stream;
}
};
- dart.setSignature(isolate.Isolate, {
+ dart.setSignature(isolate$.Isolate, {
fields: () => ({
- controlPort: isolate.SendPort,
- pauseCapability: isolate.Capability,
- terminateCapability: isolate.Capability
+ controlPort: isolate$.SendPort,
+ pauseCapability: isolate$.Capability,
+ terminateCapability: isolate$.Capability
}),
getters: () => ({errors: dart.definiteFunctionType(async.Stream, [])}),
methods: () => ({
- pause: dart.definiteFunctionType(isolate.Capability, [], [isolate.Capability]),
- [_pause]: dart.definiteFunctionType(dart.void, [isolate.Capability]),
- resume: dart.definiteFunctionType(dart.void, [isolate.Capability]),
- addOnExitListener: dart.definiteFunctionType(dart.void, [isolate.SendPort]),
- removeOnExitListener: dart.definiteFunctionType(dart.void, [isolate.SendPort]),
+ pause: dart.definiteFunctionType(isolate$.Capability, [], [isolate$.Capability]),
+ [_pause]: dart.definiteFunctionType(dart.void, [isolate$.Capability]),
+ resume: dart.definiteFunctionType(dart.void, [isolate$.Capability]),
+ addOnExitListener: dart.definiteFunctionType(dart.void, [isolate$.SendPort], {response: core.Object}),
+ removeOnExitListener: dart.definiteFunctionType(dart.void, [isolate$.SendPort]),
setErrorsFatal: dart.definiteFunctionType(dart.void, [core.bool]),
- kill: dart.definiteFunctionType(dart.void, [], [core.int]),
- ping: dart.definiteFunctionType(dart.void, [isolate.SendPort], [core.int]),
- addErrorListener: dart.definiteFunctionType(dart.void, [isolate.SendPort]),
- removeErrorListener: dart.definiteFunctionType(dart.void, [isolate.SendPort])
+ kill: dart.definiteFunctionType(dart.void, [], {priority: core.int}),
+ ping: dart.definiteFunctionType(dart.void, [isolate$.SendPort], {response: core.Object, priority: core.int}),
+ addErrorListener: dart.definiteFunctionType(dart.void, [isolate$.SendPort]),
+ removeErrorListener: dart.definiteFunctionType(dart.void, [isolate$.SendPort])
}),
statics: () => ({
- spawn: dart.definiteFunctionType(async.Future$(isolate.Isolate), [dynamicTovoid(), dart.dynamic], {paused: core.bool}),
- spawnUri: dart.definiteFunctionType(async.Future$(isolate.Isolate), [core.Uri, ListOfString(), dart.dynamic], {paused: core.bool, packageRoot: core.Uri})
+ resolvePackageUri: dart.definiteFunctionType(async.Future$(core.Uri), [core.Uri]),
+ spawn: dart.definiteFunctionType(async.Future$(isolate$.Isolate), [dynamicTovoid(), dart.dynamic], {paused: core.bool, errorsAreFatal: core.bool, onExit: isolate$.SendPort, onError: isolate$.SendPort}),
+ spawnUri: dart.definiteFunctionType(async.Future$(isolate$.Isolate), [core.Uri, ListOfString(), dart.dynamic], {paused: core.bool, onExit: isolate$.SendPort, onError: isolate$.SendPort, errorsAreFatal: core.bool, checked: core.bool, environment: MapOfString$String(), packageRoot: core.Uri, packageConfig: core.Uri, automaticPackageResolution: core.bool})
}),
- names: ['spawn', 'spawnUri']
+ names: ['resolvePackageUri', 'spawn', 'spawnUri']
});
- isolate.Isolate.IMMEDIATE = 0;
- isolate.Isolate.BEFORE_NEXT_EVENT = 1;
- isolate.Isolate.AS_EVENT = 2;
- dart.defineLazy(isolate.Isolate, {
+ isolate$.Isolate.IMMEDIATE = 0;
+ isolate$.Isolate.BEFORE_NEXT_EVENT = 1;
+ dart.defineLazy(isolate$.Isolate, {
get _currentIsolateCache() {
return _isolate_helper.IsolateNatives.currentIsolate;
- }
+ },
+ get _packageBase() {
+ return core.Uri.base.resolve(core.String._check(dart.dload(_isolate_helper.IsolateNatives, 'packagesBase')));
+ },
+ set _packageBase(_) {}
});
- isolate.SendPort = class SendPort extends core.Object {};
- isolate.SendPort[dart.implements] = () => [isolate.Capability];
- isolate.ReceivePort = class ReceivePort extends core.Object {
+ isolate$.SendPort = class SendPort extends core.Object {};
+ isolate$.SendPort[dart.implements] = () => [isolate$.Capability];
+ isolate$.ReceivePort = class ReceivePort extends core.Object {
static new() {
return new _isolate_helper.ReceivePortImpl();
}
@@ -50124,62 +51097,32 @@
return new _isolate_helper.ReceivePortImpl.fromRawReceivePort(rawPort);
}
};
- isolate.ReceivePort[dart.implements] = () => [async.Stream];
- isolate.RawReceivePort = class RawReceivePort extends core.Object {
+ isolate$.ReceivePort[dart.implements] = () => [async.Stream];
+ isolate$.RawReceivePort = class RawReceivePort extends core.Object {
static new(handler) {
if (handler === void 0) handler = null;
return new _isolate_helper.RawReceivePortImpl(handler);
}
};
- isolate._IsolateUnhandledException = class _IsolateUnhandledException extends core.Object {
- new(message, source, stackTrace) {
- this.message = message;
- this.source = source;
- this.stackTrace = stackTrace;
- }
- toString() {
- return 'IsolateUnhandledException: exception while handling message: ' + dart.str`${this.message} \n ` + dart.str`${dart.toString(this.source)[dartx.replaceAll]("\n", "\n ")}\n` + 'original stack trace:\n ' + dart.str`${dart.toString(this.stackTrace)[dartx.replaceAll]("\n", "\n ")}`;
- }
- };
- isolate._IsolateUnhandledException[dart.implements] = () => [core.Exception];
- dart.setSignature(isolate._IsolateUnhandledException, {
- fields: () => ({
- message: dart.dynamic,
- source: dart.dynamic,
- stackTrace: core.StackTrace
- })
- });
const _description = Symbol('_description');
- isolate.RemoteError = class RemoteError extends core.Object {
+ isolate$.RemoteError = class RemoteError extends core.Object {
new(description, stackDescription) {
this[_description] = description;
- this.stackTrace = new isolate._RemoteStackTrace(stackDescription);
+ this.stackTrace = core.StackTrace.fromString(stackDescription);
}
toString() {
return this[_description];
}
};
- isolate.RemoteError[dart.implements] = () => [core.Error];
- dart.setSignature(isolate.RemoteError, {
+ isolate$.RemoteError[dart.implements] = () => [core.Error];
+ dart.setSignature(isolate$.RemoteError, {
fields: () => ({
[_description]: core.String,
stackTrace: core.StackTrace
})
});
- const _trace$ = Symbol('_trace');
- isolate._RemoteStackTrace = class _RemoteStackTrace extends core.Object {
- new(trace) {
- this[_trace$] = trace;
- }
- toString() {
- return this[_trace$];
- }
- };
- isolate._RemoteStackTrace[dart.implements] = () => [core.StackTrace];
- dart.setSignature(isolate._RemoteStackTrace, {
- fields: () => ({[_trace$]: core.String})
- });
- isolate.Capability = class Capability extends core.Object {
+ isolate$._UnaryFunction = dart.typedef('_UnaryFunction', () => dart.functionType(dart.dynamic, [dart.dynamic]));
+ isolate$.Capability = class Capability extends core.Object {
static new() {
return new _isolate_helper.CapabilityImpl();
}
@@ -50696,13 +51639,40 @@
math.SQRT2 = 1.4142135623730951;
math.min = function(T) {
return (a, b) => {
- return Math.min(_js_helper.checkNum(a), _js_helper.checkNum(b));
+ if (!(typeof a == 'number')) dart.throw(new core.ArgumentError(a));
+ if (!(typeof b == 'number')) dart.throw(new core.ArgumentError(b));
+ if (dart.notNull(a) > dart.notNull(b)) return b;
+ if (dart.notNull(a) < dart.notNull(b)) return a;
+ if (typeof b == 'number') {
+ if (typeof a == 'number') {
+ if (a == 0.0) {
+ return (dart.notNull(a) + dart.notNull(b)) * dart.notNull(a) * dart.notNull(b);
+ }
+ }
+ if (a == 0 && dart.test(b[dartx.isNegative]) || dart.test(b[dartx.isNaN])) return b;
+ return a;
+ }
+ return a;
};
};
dart.fn(math.min, TAndTToT());
math.max = function(T) {
return (a, b) => {
- return Math.max(_js_helper.checkNum(a), _js_helper.checkNum(b));
+ if (!(typeof a == 'number')) dart.throw(new core.ArgumentError(a));
+ if (!(typeof b == 'number')) dart.throw(new core.ArgumentError(b));
+ if (dart.notNull(a) > dart.notNull(b)) return a;
+ if (dart.notNull(a) < dart.notNull(b)) return b;
+ if (typeof b == 'number') {
+ if (typeof a == 'number') {
+ if (a == 0.0) {
+ return dart.notNull(a) + dart.notNull(b);
+ }
+ }
+ if (dart.test(b[dartx.isNaN])) return b;
+ return a;
+ }
+ if (b == 0 && dart.test(a[dartx.isNegative])) return b;
+ return a;
};
};
dart.fn(math.max, TAndTToT$());
@@ -51055,11 +52025,11 @@
return Point;
});
math.Point = Point$();
- let const$82;
+ let const$85;
math.Random = class Random extends core.Object {
static new(seed) {
if (seed === void 0) seed = null;
- return seed == null ? const$82 || (const$82 = dart.const(new math._JSRandom())) : new math._Random(seed);
+ return seed == null ? const$85 || (const$85 = dart.const(new math._JSRandom())) : new math._Random(seed);
}
static secure() {
return math.Random._secureRandom;
@@ -51103,8 +52073,7 @@
}
['=='](other) {
if (!RectangleOfnum().is(other)) return false;
- let otherRect = RectangleOfnum().as(other);
- return this[dartx.left] == otherRect[dartx.left] && this[dartx.top] == otherRect[dartx.top] && this[dartx.right] == otherRect[dartx.right] && this[dartx.bottom] == otherRect[dartx.bottom];
+ return dart.equals(this[dartx.left], dart.dload(other, 'left')) && dart.equals(this[dartx.top], dart.dload(other, 'top')) && dart.equals(this[dartx.right], dart.dload(other, 'right')) && dart.equals(this[dartx.bottom], dart.dload(other, 'bottom'));
}
get hashCode() {
return math._JenkinsSmiHash.hash4(dart.hashCode(this[dartx.left]), dart.hashCode(this[dartx.top]), dart.hashCode(this[dartx.right]), dart.hashCode(this[dartx.bottom]));
@@ -52414,7 +53383,7 @@
});
dart.registerExtension(dart.global.IDBKeyRange, indexed_db.KeyRange);
const _add$3 = Symbol('_add');
- const _clear$0 = Symbol('_clear');
+ const _clear$ = Symbol('_clear');
const _put = Symbol('_put');
const _createIndex = Symbol('_createIndex');
const _add_1 = Symbol('_add_1');
@@ -52462,7 +53431,7 @@
}
[dartx.clear]() {
try {
- return indexed_db._completeRequest(dart.dynamic)(this[_clear$0]());
+ return indexed_db._completeRequest(dart.dynamic)(this[_clear$]());
} catch (e) {
let stacktrace = dart.stackTrace(e);
return async.Future.error(e, stacktrace);
@@ -52583,7 +53552,7 @@
[_add_2](...args) {
return this.add.apply(this, args);
}
- [_clear$0](...args) {
+ [_clear$](...args) {
return this.clear.apply(this, args);
}
[_count$0](...args) {
@@ -52682,7 +53651,7 @@
[_add$3]: dart.definiteFunctionType(indexed_db.Request, [dart.dynamic], [dart.dynamic]),
[_add_1]: dart.definiteFunctionType(indexed_db.Request, [dart.dynamic, dart.dynamic]),
[_add_2]: dart.definiteFunctionType(indexed_db.Request, [dart.dynamic]),
- [_clear$0]: dart.definiteFunctionType(indexed_db.Request, []),
+ [_clear$]: dart.definiteFunctionType(indexed_db.Request, []),
[_count$0]: dart.definiteFunctionType(indexed_db.Request, [core.Object]),
[_createIndex]: dart.definiteFunctionType(indexed_db.Index, [core.String, core.Object], [core.Map]),
[_createIndex_1]: dart.definiteFunctionType(indexed_db.Index, [dart.dynamic, dart.dynamic, dart.dynamic]),
@@ -59471,7 +60440,7 @@
const _borderWidth = Symbol('_borderWidth');
const _bottom = Symbol('_bottom');
const _captionSide = Symbol('_captionSide');
- const _clear$1 = Symbol('_clear');
+ const _clear$0 = Symbol('_clear');
const _clip = Symbol('_clip');
const _color = Symbol('_color');
const _content = Symbol('_content');
@@ -64286,15 +65255,15 @@
this.captionSide = value;
}
get [dartx.clear]() {
- return this[_clear$1];
+ return this[_clear$0];
}
set [dartx.clear](value) {
- this[_clear$1] = value == null ? '' : value;
+ this[_clear$0] = value == null ? '' : value;
}
- get [_clear$1]() {
+ get [_clear$0]() {
return this.clear;
}
- set [_clear$1](value) {
+ set [_clear$0](value) {
this.clear = value;
}
get [dartx.clip]() {
@@ -65041,7 +66010,7 @@
[_borderWidth]: core.String,
[_bottom]: core.String,
[_captionSide]: core.String,
- [_clear$1]: core.String,
+ [_clear$0]: core.String,
[_clip]: core.String,
[_color]: core.String,
[_content]: core.String,
@@ -84089,7 +85058,7 @@
return value;
}
[dartx.clear]() {
- return this[_clear$1]();
+ return this[_clear$0]();
}
[dartx.forEach](f) {
for (let i = 0; true; i++) {
@@ -84132,7 +85101,7 @@
[__setter__](...args) {
return this.__setter__.apply(this, args);
}
- [_clear$1](...args) {
+ [_clear$0](...args) {
return this.clear.apply(this, args);
}
[_getItem](...args) {
@@ -84171,7 +85140,7 @@
[__delete__]: dart.definiteFunctionType(core.bool, [dart.dynamic]),
[__getter__]: dart.definiteFunctionType(core.String, [dart.dynamic]),
[__setter__]: dart.definiteFunctionType(dart.void, [dart.dynamic, core.String]),
- [_clear$1]: dart.definiteFunctionType(dart.void, []),
+ [_clear$0]: dart.definiteFunctionType(dart.void, []),
[_getItem]: dart.definiteFunctionType(core.String, [core.String]),
[_key]: dart.definiteFunctionType(core.String, [core.int]),
[_removeItem]: dart.definiteFunctionType(dart.void, [core.String]),
@@ -93181,9 +94150,6 @@
allowsAttribute: dart.definiteFunctionType(core.bool, [html$.Element, core.String, core.String])
})
});
- let const$83;
- let const$84;
- let const$85;
let const$86;
let const$87;
let const$88;
@@ -93191,15 +94157,18 @@
let const$90;
let const$91;
let const$92;
+ let const$93;
+ let const$94;
+ let const$95;
html$._SimpleNodeValidator = class _SimpleNodeValidator extends core.Object {
static allowNavigation(uriPolicy) {
- return new html$._SimpleNodeValidator(uriPolicy, {allowedElements: const$83 || (const$83 = dart.constList(['A', 'FORM'], core.String)), allowedAttributes: const$84 || (const$84 = dart.constList(['A::accesskey', 'A::coords', 'A::hreflang', 'A::name', 'A::shape', 'A::tabindex', 'A::target', 'A::type', 'FORM::accept', 'FORM::autocomplete', 'FORM::enctype', 'FORM::method', 'FORM::name', 'FORM::novalidate', 'FORM::target'], core.String)), allowedUriAttributes: const$85 || (const$85 = dart.constList(['A::href', 'FORM::action'], core.String))});
+ return new html$._SimpleNodeValidator(uriPolicy, {allowedElements: const$86 || (const$86 = dart.constList(['A', 'FORM'], core.String)), allowedAttributes: const$87 || (const$87 = dart.constList(['A::accesskey', 'A::coords', 'A::hreflang', 'A::name', 'A::shape', 'A::tabindex', 'A::target', 'A::type', 'FORM::accept', 'FORM::autocomplete', 'FORM::enctype', 'FORM::method', 'FORM::name', 'FORM::novalidate', 'FORM::target'], core.String)), allowedUriAttributes: const$88 || (const$88 = dart.constList(['A::href', 'FORM::action'], core.String))});
}
static allowImages(uriPolicy) {
- return new html$._SimpleNodeValidator(uriPolicy, {allowedElements: const$86 || (const$86 = dart.constList(['IMG'], core.String)), allowedAttributes: const$87 || (const$87 = dart.constList(['IMG::align', 'IMG::alt', 'IMG::border', 'IMG::height', 'IMG::hspace', 'IMG::ismap', 'IMG::name', 'IMG::usemap', 'IMG::vspace', 'IMG::width'], core.String)), allowedUriAttributes: const$88 || (const$88 = dart.constList(['IMG::src'], core.String))});
+ return new html$._SimpleNodeValidator(uriPolicy, {allowedElements: const$89 || (const$89 = dart.constList(['IMG'], core.String)), allowedAttributes: const$90 || (const$90 = dart.constList(['IMG::align', 'IMG::alt', 'IMG::border', 'IMG::height', 'IMG::hspace', 'IMG::ismap', 'IMG::name', 'IMG::usemap', 'IMG::vspace', 'IMG::width'], core.String)), allowedUriAttributes: const$91 || (const$91 = dart.constList(['IMG::src'], core.String))});
}
static allowTextElements() {
- return new html$._SimpleNodeValidator(null, {allowedElements: const$89 || (const$89 = dart.constList(['B', 'BLOCKQUOTE', 'BR', 'EM', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'HR', 'I', 'LI', 'OL', 'P', 'SPAN', 'UL'], core.String))});
+ return new html$._SimpleNodeValidator(null, {allowedElements: const$92 || (const$92 = dart.constList(['B', 'BLOCKQUOTE', 'BR', 'EM', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'HR', 'I', 'LI', 'OL', 'P', 'SPAN', 'UL'], core.String))});
}
new(uriPolicy, opts) {
let allowedElements = opts && 'allowedElements' in opts ? opts.allowedElements : null;
@@ -93209,9 +94178,9 @@
this.allowedAttributes = SetOfString().new();
this.allowedUriAttributes = SetOfString().new();
this.uriPolicy = uriPolicy;
- this.allowedElements.addAll((allowedElements != null ? allowedElements : const$90 || (const$90 = dart.constList([], core.String))));
- allowedAttributes = allowedAttributes != null ? allowedAttributes : const$91 || (const$91 = dart.constList([], core.String));
- allowedUriAttributes = allowedUriAttributes != null ? allowedUriAttributes : const$92 || (const$92 = dart.constList([], core.String));
+ this.allowedElements.addAll((allowedElements != null ? allowedElements : const$93 || (const$93 = dart.constList([], core.String))));
+ allowedAttributes = allowedAttributes != null ? allowedAttributes : const$94 || (const$94 = dart.constList([], core.String));
+ allowedUriAttributes = allowedUriAttributes != null ? allowedUriAttributes : const$95 || (const$95 = dart.constList([], core.String));
let legalAttributes = allowedAttributes[dartx.where](dart.fn(x => !dart.test(html$._Html5NodeValidator._uriAttributes[dartx.contains](x)), StringTobool$()));
let extraUriAttributes = allowedAttributes[dartx.where](dart.fn(x => html$._Html5NodeValidator._uriAttributes[dartx.contains](x), StringTobool$()));
this.allowedAttributes.addAll(legalAttributes);
@@ -93497,7 +94466,7 @@
names: ['get']
});
const _array = Symbol('_array');
- const _current$4 = Symbol('_current');
+ const _current$2 = Symbol('_current');
html$.FixedSizeListIterator$ = dart.generic(T => {
let IteratorOfT = () => (IteratorOfT = dart.constFn(core.Iterator$(T)))();
let ListOfT = () => (ListOfT = dart.constFn(core.List$(T)))();
@@ -93506,21 +94475,21 @@
this[_array] = array;
this[_position$1] = -1;
this[_length$3] = array[dartx.length];
- this[_current$4] = null;
+ this[_current$2] = null;
}
moveNext() {
let nextPosition = dart.notNull(this[_position$1]) + 1;
if (nextPosition < dart.notNull(this[_length$3])) {
- this[_current$4] = this[_array][dartx._get](nextPosition);
+ this[_current$2] = this[_array][dartx._get](nextPosition);
this[_position$1] = nextPosition;
return true;
}
- this[_current$4] = null;
+ this[_current$2] = null;
this[_position$1] = this[_length$3];
return false;
}
get current() {
- return this[_current$4];
+ return this[_current$2];
}
}
dart.addTypeTests(FixedSizeListIterator);
@@ -93530,7 +94499,7 @@
[_array]: ListOfT(),
[_length$3]: core.int,
[_position$1]: core.int,
- [_current$4]: T
+ [_current$2]: T
}),
getters: () => ({current: dart.definiteFunctionType(T, [])}),
methods: () => ({moveNext: dart.definiteFunctionType(core.bool, [])})
@@ -93545,21 +94514,21 @@
new(array) {
this[_array] = array;
this[_position$1] = -1;
- this[_current$4] = null;
+ this[_current$2] = null;
}
moveNext() {
let nextPosition = dart.notNull(this[_position$1]) + 1;
if (nextPosition < dart.notNull(this[_array][dartx.length])) {
- this[_current$4] = this[_array][dartx._get](nextPosition);
+ this[_current$2] = this[_array][dartx._get](nextPosition);
this[_position$1] = nextPosition;
return true;
}
- this[_current$4] = null;
+ this[_current$2] = null;
this[_position$1] = this[_array][dartx.length];
return false;
}
get current() {
- return this[_current$4];
+ return this[_current$2];
}
}
dart.addTypeTests(_VariableSizeListIterator);
@@ -93568,7 +94537,7 @@
fields: () => ({
[_array]: ListOfT(),
[_position$1]: core.int,
- [_current$4]: T
+ [_current$2]: T
}),
getters: () => ({current: dart.definiteFunctionType(T, [])}),
methods: () => ({moveNext: dart.definiteFunctionType(core.bool, [])})
@@ -104476,6 +105445,7 @@
methods: () => ({[dartx.executeSql]: dart.definiteFunctionType(dart.void, [core.String, ListOfObject()], [web_sql.SqlStatementCallback, web_sql.SqlStatementErrorCallback])})
});
dart.registerExtension(dart.global.SQLTransaction, web_sql.SqlTransaction);
+ dart.trackLibraries("dart_sdk", {"dart:_runtime": dart, "dart:_debugger": _debugger, "dart:_foreign_helper": _foreign_helper, "dart:_interceptors": _interceptors, "dart:_internal": _internal, "dart:_isolate_helper": _isolate_helper, "dart:_js_embedded_names": _js_embedded_names, "dart:_js_helper": _js_helper, "dart:_js_mirrors": _js_mirrors, "dart:_js_primitives": _js_primitives, "dart:_metadata": _metadata, "dart:_native_typed_data": _native_typed_data, "dart:async": async, "dart:collection": collection, "dart:convert": convert, "dart:core": core, "dart:developer": developer, "dart:io": io, "dart:isolate": isolate$, "dart:js": js, "dart:js_util": js_util, "dart:math": math, "dart:mirrors": mirrors, "dart:typed_data": typed_data, "dart:indexed_db": indexed_db, "dart:html": html$, "dart:html_common": html_common, "dart:svg": svg$, "dart:web_audio": web_audio, "dart:web_gl": web_gl, "dart:web_sql": web_sql});
// Exports:
return {
dart: dart,
@@ -104497,7 +105467,7 @@
core: core,
developer: developer,
io: io,
- isolate: isolate,
+ isolate: isolate$,
js: js,
js_util: js_util,
math: math,
diff --git a/pkg/dev_compiler/lib/js/common/dart_sdk.js b/pkg/dev_compiler/lib/js/common/dart_sdk.js
index 0b3212c..0237cf3 100644
--- a/pkg/dev_compiler/lib/js/common/dart_sdk.js
+++ b/pkg/dev_compiler/lib/js/common/dart_sdk.js
@@ -18,7 +18,7 @@
const core = Object.create(null);
const developer = Object.create(null);
const io = Object.create(null);
-const isolate = Object.create(null);
+const isolate$ = Object.create(null);
const js = Object.create(null);
const js_util = Object.create(null);
const math = Object.create(null);
@@ -38,16 +38,14 @@
let MapOfString$_MethodStats = () => (MapOfString$_MethodStats = dart.constFn(core.Map$(core.String, dart._MethodStats)))();
let ListOfString = () => (ListOfString = dart.constFn(core.List$(core.String)))();
let SetOfNameValuePair = () => (SetOfNameValuePair = dart.constFn(core.Set$(_debugger.NameValuePair)))();
+let ListOfNameValuePair = () => (ListOfNameValuePair = dart.constFn(core.List$(_debugger.NameValuePair)))();
+let IterableOfNameValuePair = () => (IterableOfNameValuePair = dart.constFn(core.Iterable$(_debugger.NameValuePair)))();
let JSArrayOfNameValuePair = () => (JSArrayOfNameValuePair = dart.constFn(_interceptors.JSArray$(_debugger.NameValuePair)))();
let MapOfdynamic$Object = () => (MapOfdynamic$Object = dart.constFn(core.Map$(dart.dynamic, core.Object)))();
let JSArrayOfFormatter = () => (JSArrayOfFormatter = dart.constFn(_interceptors.JSArray$(_debugger.Formatter)))();
let ListOfFormatter = () => (ListOfFormatter = dart.constFn(core.List$(_debugger.Formatter)))();
let LinkedHashSetOfNameValuePair = () => (LinkedHashSetOfNameValuePair = dart.constFn(collection.LinkedHashSet$(_debugger.NameValuePair)))();
-let SetOfString = () => (SetOfString = dart.constFn(core.Set$(core.String)))();
let HashMapOfString$String = () => (HashMapOfString$String = dart.constFn(collection.HashMap$(core.String, core.String)))();
-let LinkedHashMapOfString$Object = () => (LinkedHashMapOfString$Object = dart.constFn(collection.LinkedHashMap$(core.String, core.Object)))();
-let ListOfNameValuePair = () => (ListOfNameValuePair = dart.constFn(core.List$(_debugger.NameValuePair)))();
-let JSArrayOfString = () => (JSArrayOfString = dart.constFn(_interceptors.JSArray$(core.String)))();
let JSArrayOfJsonMLFormatter = () => (JSArrayOfJsonMLFormatter = dart.constFn(_interceptors.JSArray$(_debugger.JsonMLFormatter)))();
let JSIndexable = () => (JSIndexable = dart.constFn(_interceptors.JSIndexable$()))();
let JSArray = () => (JSArray = dart.constFn(_interceptors.JSArray$()))();
@@ -56,6 +54,7 @@
let JSExtendableArray = () => (JSExtendableArray = dart.constFn(_interceptors.JSExtendableArray$()))();
let JSUnmodifiableArray = () => (JSUnmodifiableArray = dart.constFn(_interceptors.JSUnmodifiableArray$()))();
let ArrayIterator = () => (ArrayIterator = dart.constFn(_interceptors.ArrayIterator$()))();
+let JSArrayOfString = () => (JSArrayOfString = dart.constFn(_interceptors.JSArray$(core.String)))();
let JSIndexableOfString = () => (JSIndexableOfString = dart.constFn(_interceptors.JSIndexable$(core.String)))();
let MatchToString = () => (MatchToString = dart.constFn(dart.functionType(core.String, [core.Match])))();
let StringToString = () => (StringToString = dart.constFn(dart.functionType(core.String, [core.String])))();
@@ -69,6 +68,7 @@
let UnmodifiableListBase = () => (UnmodifiableListBase = dart.constFn(_internal.UnmodifiableListBase$()))();
let StringToint = () => (StringToint = dart.constFn(dart.functionType(core.int, [core.String])))();
let Iterable = () => (Iterable = dart.constFn(core.Iterable$()))();
+let EfficientLengthIterable = () => (EfficientLengthIterable = dart.constFn(_internal.EfficientLengthIterable$()))();
let ListIterable = () => (ListIterable = dart.constFn(_internal.ListIterable$()))();
let SubListIterable = () => (SubListIterable = dart.constFn(_internal.SubListIterable$()))();
let ListIterator = () => (ListIterator = dart.constFn(_internal.ListIterator$()))();
@@ -105,8 +105,8 @@
let MapOfint$RawReceivePortImpl = () => (MapOfint$RawReceivePortImpl = dart.constFn(core.Map$(core.int, _isolate_helper.RawReceivePortImpl)))();
let SetOfint = () => (SetOfint = dart.constFn(core.Set$(core.int)))();
let JSArrayOf_IsolateEvent = () => (JSArrayOf_IsolateEvent = dart.constFn(_interceptors.JSArray$(_isolate_helper._IsolateEvent)))();
-let SetOfCapability = () => (SetOfCapability = dart.constFn(core.Set$(isolate.Capability)))();
-let SetOfSendPort = () => (SetOfSendPort = dart.constFn(core.Set$(isolate.SendPort)))();
+let SetOfCapability = () => (SetOfCapability = dart.constFn(core.Set$(isolate$.Capability)))();
+let SetOfSendPort = () => (SetOfSendPort = dart.constFn(core.Set$(isolate$.SendPort)))();
let ListOf_IsolateEvent = () => (ListOf_IsolateEvent = dart.constFn(core.List$(_isolate_helper._IsolateEvent)))();
let QueueOf_IsolateEvent = () => (QueueOf_IsolateEvent = dart.constFn(collection.Queue$(_isolate_helper._IsolateEvent)))();
let CompleterOfList = () => (CompleterOfList = dart.constFn(async.Completer$(core.List)))();
@@ -137,6 +137,7 @@
let _Lazy = () => (_Lazy = dart.constFn(_js_mirrors._Lazy$()))();
let ListOfSymbol = () => (ListOfSymbol = dart.constFn(core.List$(core.Symbol)))();
let ListOfInstanceMirror = () => (ListOfInstanceMirror = dart.constFn(core.List$(mirrors.InstanceMirror)))();
+let FutureOfLibraryMirror = () => (FutureOfLibraryMirror = dart.constFn(async.Future$(mirrors.LibraryMirror)))();
let ListOfCombinatorMirror = () => (ListOfCombinatorMirror = dart.constFn(core.List$(mirrors.CombinatorMirror)))();
let MapOfSymbol$DeclarationMirror = () => (MapOfSymbol$DeclarationMirror = dart.constFn(core.Map$(core.Symbol, mirrors.DeclarationMirror)))();
let ListOfTypeMirror = () => (ListOfTypeMirror = dart.constFn(core.List$(mirrors.TypeMirror)))();
@@ -148,7 +149,6 @@
let ListOfParameterMirror = () => (ListOfParameterMirror = dart.constFn(core.List$(mirrors.ParameterMirror)))();
let IterableOfdouble = () => (IterableOfdouble = dart.constFn(core.Iterable$(core.double)))();
let IterableOfint = () => (IterableOfint = dart.constFn(core.Iterable$(core.int)))();
-let ZoneBinaryCallbackOfdynamic$dynamic$StackTrace = () => (ZoneBinaryCallbackOfdynamic$dynamic$StackTrace = dart.constFn(async.ZoneBinaryCallback$(dart.dynamic, dart.dynamic, core.StackTrace)))();
let _StreamImpl = () => (_StreamImpl = dart.constFn(async._StreamImpl$()))();
let _ControllerStream = () => (_ControllerStream = dart.constFn(async._ControllerStream$()))();
let _BroadcastStream = () => (_BroadcastStream = dart.constFn(async._BroadcastStream$()))();
@@ -170,7 +170,6 @@
let _Completer = () => (_Completer = dart.constFn(async._Completer$()))();
let _AsyncCompleter = () => (_AsyncCompleter = dart.constFn(async._AsyncCompleter$()))();
let _SyncCompleter = () => (_SyncCompleter = dart.constFn(async._SyncCompleter$()))();
-let ZoneBinaryCallbackOfObject$Object$StackTrace = () => (ZoneBinaryCallbackOfObject$Object$StackTrace = dart.constFn(async.ZoneBinaryCallback$(core.Object, core.Object, core.StackTrace)))();
let _FutureListener = () => (_FutureListener = dart.constFn(async._FutureListener$()))();
let _Future = () => (_Future = dart.constFn(async._Future$()))();
let StreamSubscription = () => (StreamSubscription = dart.constFn(async.StreamSubscription$()))();
@@ -206,8 +205,9 @@
let _DoneStreamSubscription = () => (_DoneStreamSubscription = dart.constFn(async._DoneStreamSubscription$()))();
let _AsBroadcastStream = () => (_AsBroadcastStream = dart.constFn(async._AsBroadcastStream$()))();
let _BroadcastSubscriptionWrapper = () => (_BroadcastSubscriptionWrapper = dart.constFn(async._BroadcastSubscriptionWrapper$()))();
-let _StreamIteratorImpl = () => (_StreamIteratorImpl = dart.constFn(async._StreamIteratorImpl$()))();
+let _StreamIterator = () => (_StreamIterator = dart.constFn(async._StreamIterator$()))();
let _EmptyStream = () => (_EmptyStream = dart.constFn(async._EmptyStream$()))();
+let dynamicAndStackTraceTodynamic = () => (dynamicAndStackTraceTodynamic = dart.constFn(dart.functionType(dart.dynamic, [dart.dynamic, core.StackTrace])))();
let _ForwardingStream = () => (_ForwardingStream = dart.constFn(async._ForwardingStream$()))();
let _ForwardingStreamSubscription = () => (_ForwardingStreamSubscription = dart.constFn(async._ForwardingStreamSubscription$()))();
let _Predicate = () => (_Predicate = dart.constFn(async._Predicate$()))();
@@ -310,7 +310,6 @@
let Queue = () => (Queue = dart.constFn(collection.Queue$()))();
let _DoubleLink = () => (_DoubleLink = dart.constFn(collection._DoubleLink$()))();
let DoubleLinkedQueueEntry = () => (DoubleLinkedQueueEntry = dart.constFn(collection.DoubleLinkedQueueEntry$()))();
-let _UserDoubleLinkedQueueEntry = () => (_UserDoubleLinkedQueueEntry = dart.constFn(collection._UserDoubleLinkedQueueEntry$()))();
let _DoubleLinkedQueueEntry = () => (_DoubleLinkedQueueEntry = dart.constFn(collection._DoubleLinkedQueueEntry$()))();
let _DoubleLinkedQueueElement = () => (_DoubleLinkedQueueElement = dart.constFn(collection._DoubleLinkedQueueElement$()))();
let _DoubleLinkedQueueSentinel = () => (_DoubleLinkedQueueSentinel = dart.constFn(collection._DoubleLinkedQueueSentinel$()))();
@@ -339,8 +338,10 @@
let List = () => (List = dart.constFn(core.List$()))();
let StreamOfListOfint = () => (StreamOfListOfint = dart.constFn(async.Stream$(ListOfint())))();
let Converter = () => (Converter = dart.constFn(convert.Converter$()))();
+let ChunkedConverterOfString$ListOfint$String$ListOfint = () => (ChunkedConverterOfString$ListOfint$String$ListOfint = dart.constFn(convert.ChunkedConverter$(core.String, ListOfint(), core.String, ListOfint())))();
let SinkOfListOfint = () => (SinkOfListOfint = dart.constFn(core.Sink$(ListOfint())))();
let StreamOfString = () => (StreamOfString = dart.constFn(async.Stream$(core.String)))();
+let ChunkedConverterOfListOfint$String$ListOfint$String = () => (ChunkedConverterOfListOfint$String$ListOfint$String = dart.constFn(convert.ChunkedConverter$(ListOfint(), core.String, ListOfint(), core.String)))();
let SinkOfString = () => (SinkOfString = dart.constFn(core.Sink$(core.String)))();
let ChunkedConversionSink = () => (ChunkedConversionSink = dart.constFn(convert.ChunkedConversionSink$()))();
let _ChunkedConversionCallbackOfListOfint = () => (_ChunkedConversionCallbackOfListOfint = dart.constFn(convert._ChunkedConversionCallback$(ListOfint())))();
@@ -351,8 +352,12 @@
let _FusedCodec = () => (_FusedCodec = dart.constFn(convert._FusedCodec$()))();
let _InvertedCodec = () => (_InvertedCodec = dart.constFn(convert._InvertedCodec$()))();
let _FusedConverter = () => (_FusedConverter = dart.constFn(convert._FusedConverter$()))();
+let ChunkedConverterOfString$String$String$String = () => (ChunkedConverterOfString$String$String$String = dart.constFn(convert.ChunkedConverter$(core.String, core.String, core.String, core.String)))();
+let ChunkedConverterOfObject$String$Object$String = () => (ChunkedConverterOfObject$String$Object$String = dart.constFn(convert.ChunkedConverter$(core.Object, core.String, core.Object, core.String)))();
let StreamOfObject = () => (StreamOfObject = dart.constFn(async.Stream$(core.Object)))();
let JSArrayOfListOfint = () => (JSArrayOfListOfint = dart.constFn(_interceptors.JSArray$(ListOfint())))();
+let ChunkedConverterOfObject$ListOfint$Object$ListOfint = () => (ChunkedConverterOfObject$ListOfint$Object$ListOfint = dart.constFn(convert.ChunkedConverter$(core.Object, ListOfint(), core.Object, ListOfint())))();
+let ChunkedConverterOfString$Object$String$Object = () => (ChunkedConverterOfString$Object$String$Object = dart.constFn(convert.ChunkedConverter$(core.String, core.Object, core.String, core.Object)))();
let Uint8ListAndintAndintTovoid = () => (Uint8ListAndintAndintTovoid = dart.constFn(dart.functionType(dart.void, [typed_data.Uint8List, core.int, core.int])))();
let EventSinkOfString = () => (EventSinkOfString = dart.constFn(async.EventSink$(core.String)))();
let StreamTransformerOfString$String = () => (StreamTransformerOfString$String = dart.constFn(async.StreamTransformer$(core.String, core.String)))();
@@ -363,59 +368,62 @@
let Expando = () => (Expando = dart.constFn(core.Expando$()))();
let _Generator = () => (_Generator = dart.constFn(core._Generator$()))();
let _GeneratorIterable = () => (_GeneratorIterable = dart.constFn(core._GeneratorIterable$()))();
-let _GeneratorIterator = () => (_GeneratorIterator = dart.constFn(core._GeneratorIterator$()))();
let BidirectionalIterator = () => (BidirectionalIterator = dart.constFn(core.BidirectionalIterator$()))();
let Map$ = () => (Map$ = dart.constFn(core.Map$()))();
let Set = () => (Set = dart.constFn(core.Set$()))();
let Sink = () => (Sink = dart.constFn(core.Sink$()))();
let BidirectionalIteratorOfint = () => (BidirectionalIteratorOfint = dart.constFn(core.BidirectionalIterator$(core.int)))();
+let MapOfString$String = () => (MapOfString$String = dart.constFn(core.Map$(core.String, core.String)))();
let UnmodifiableMapViewOfString$String = () => (UnmodifiableMapViewOfString$String = dart.constFn(collection.UnmodifiableMapView$(core.String, core.String)))();
let MapOfString$ListOfString = () => (MapOfString$ListOfString = dart.constFn(core.Map$(core.String, ListOfString())))();
-let MapOfString$String = () => (MapOfString$String = dart.constFn(core.Map$(core.String, core.String)))();
let IterableOfString = () => (IterableOfString = dart.constFn(core.Iterable$(core.String)))();
let MapOfString$dynamic = () => (MapOfString$dynamic = dart.constFn(core.Map$(core.String, dart.dynamic)))();
+let ListOfUint8List = () => (ListOfUint8List = dart.constFn(core.List$(typed_data.Uint8List)))();
let MapOfString$ServiceExtensionHandler = () => (MapOfString$ServiceExtensionHandler = dart.constFn(core.Map$(core.String, developer.ServiceExtensionHandler)))();
let MapOfString$Metric = () => (MapOfString$Metric = dart.constFn(core.Map$(core.String, developer.Metric)))();
let ListOf_SyncBlock = () => (ListOf_SyncBlock = dart.constFn(core.List$(developer._SyncBlock)))();
let JSArrayOf_AsyncBlock = () => (JSArrayOf_AsyncBlock = dart.constFn(_interceptors.JSArray$(developer._AsyncBlock)))();
let ListOf_AsyncBlock = () => (ListOf_AsyncBlock = dart.constFn(core.List$(developer._AsyncBlock)))();
let CompleterOfUri = () => (CompleterOfUri = dart.constFn(async.Completer$(core.Uri)))();
-let ListOfListOfint = () => (ListOfListOfint = dart.constFn(core.List$(ListOfint())))();
-let FutureOfint = () => (FutureOfint = dart.constFn(async.Future$(core.int)))();
+let JSArrayOfUint8List = () => (JSArrayOfUint8List = dart.constFn(_interceptors.JSArray$(typed_data.Uint8List)))();
+let ChunkedConverterOfListOfint$ListOfint$ListOfint$ListOfint = () => (ChunkedConverterOfListOfint$ListOfint$ListOfint$ListOfint = dart.constFn(convert.ChunkedConverter$(ListOfint(), ListOfint(), ListOfint(), ListOfint())))();
let FutureOfDirectory = () => (FutureOfDirectory = dart.constFn(async.Future$(io.Directory)))();
let FutureOrOfDirectory = () => (FutureOrOfDirectory = dart.constFn(async.FutureOr$(io.Directory)))();
-let StreamOfFileSystemEntity = () => (StreamOfFileSystemEntity = dart.constFn(async.Stream$(io.FileSystemEntity)))();
let JSArrayOfFileSystemEntity = () => (JSArrayOfFileSystemEntity = dart.constFn(_interceptors.JSArray$(io.FileSystemEntity)))();
let FutureOrOfString = () => (FutureOrOfString = dart.constFn(async.FutureOr$(core.String)))();
let FutureOrOfbool = () => (FutureOrOfbool = dart.constFn(async.FutureOr$(core.bool)))();
let FutureOrOfint = () => (FutureOrOfint = dart.constFn(async.FutureOr$(core.int)))();
let ListOfFileSystemEntity = () => (ListOfFileSystemEntity = dart.constFn(core.List$(io.FileSystemEntity)))();
+let StreamControllerOfFileSystemEntity = () => (StreamControllerOfFileSystemEntity = dart.constFn(async.StreamController$(io.FileSystemEntity)))();
let StreamControllerOfListOfint = () => (StreamControllerOfListOfint = dart.constFn(async.StreamController$(ListOfint())))();
let FutureOfRandomAccessFile = () => (FutureOfRandomAccessFile = dart.constFn(async.Future$(io.RandomAccessFile)))();
let CompleterOfFile = () => (CompleterOfFile = dart.constFn(async.Completer$(io.File)))();
+let CompleterOfListOfint = () => (CompleterOfListOfint = dart.constFn(async.Completer$(ListOfint())))();
let FutureOfListOfint = () => (FutureOfListOfint = dart.constFn(async.Future$(ListOfint())))();
let FutureOrOfFile = () => (FutureOrOfFile = dart.constFn(async.FutureOr$(io.File)))();
let FutureOfFile = () => (FutureOfFile = dart.constFn(async.Future$(io.File)))();
-let FutureOrOfListOfint = () => (FutureOrOfListOfint = dart.constFn(async.FutureOr$(ListOfint())))();
+let FutureOfint = () => (FutureOfint = dart.constFn(async.Future$(core.int)))();
let StreamOfHttpRequest = () => (StreamOfHttpRequest = dart.constFn(async.Stream$(io.HttpRequest)))();
let ListOfRedirectInfo = () => (ListOfRedirectInfo = dart.constFn(core.List$(io.RedirectInfo)))();
let HashMapOfString$ListOfString = () => (HashMapOfString$ListOfString = dart.constFn(collection.HashMap$(core.String, ListOfString())))();
let ListOfCookie = () => (ListOfCookie = dart.constFn(core.List$(io.Cookie)))();
let StringAndListOfStringTovoid = () => (StringAndListOfStringTovoid = dart.constFn(dart.functionType(dart.void, [core.String, ListOfString()])))();
let FutureOfHttpClientResponse = () => (FutureOfHttpClientResponse = dart.constFn(async.Future$(io.HttpClientResponse)))();
-let StreamSubscriptionOfListOfint = () => (StreamSubscriptionOfListOfint = dart.constFn(async.StreamSubscription$(ListOfint())))();
let FutureOrOfHttpClientResponse = () => (FutureOrOfHttpClientResponse = dart.constFn(async.FutureOr$(io.HttpClientResponse)))();
let _StreamSinkImpl = () => (_StreamSinkImpl = dart.constFn(io._StreamSinkImpl$()))();
let _HttpOutboundMessage = () => (_HttpOutboundMessage = dart.constFn(io._HttpOutboundMessage$()))();
let CompleterOfHttpClientResponse = () => (CompleterOfHttpClientResponse = dart.constFn(async.Completer$(io.HttpClientResponse)))();
let JSArrayOfRedirectInfo = () => (JSArrayOfRedirectInfo = dart.constFn(_interceptors.JSArray$(io.RedirectInfo)))();
let JSArrayOfFuture = () => (JSArrayOfFuture = dart.constFn(_interceptors.JSArray$(async.Future)))();
+let CompleterOfSocket = () => (CompleterOfSocket = dart.constFn(async.Completer$(io.Socket)))();
let StreamConsumerOfListOfint = () => (StreamConsumerOfListOfint = dart.constFn(async.StreamConsumer$(ListOfint())))();
let CompleterOf_HttpIncoming = () => (CompleterOf_HttpIncoming = dart.constFn(async.Completer$(io._HttpIncoming)))();
-let X509CertificateTobool = () => (X509CertificateTobool = dart.constFn(dart.functionType(core.bool, [io.X509Certificate])))();
let FutureOfSecureSocket = () => (FutureOfSecureSocket = dart.constFn(async.Future$(io.SecureSocket)))();
+let X509CertificateTobool = () => (X509CertificateTobool = dart.constFn(dart.functionType(core.bool, [io.X509Certificate])))();
+let FutureOfSocket = () => (FutureOfSocket = dart.constFn(async.Future$(io.Socket)))();
let HashSetOf_HttpClientConnection = () => (HashSetOf_HttpClientConnection = dart.constFn(collection.HashSet$(io._HttpClientConnection)))();
let FutureOf_ConnectionInfo = () => (FutureOf_ConnectionInfo = dart.constFn(async.Future$(io._ConnectionInfo)))();
+let CompleterOf_ConnectionInfo = () => (CompleterOf_ConnectionInfo = dart.constFn(async.Completer$(io._ConnectionInfo)))();
let FutureOrOf_ConnectionInfo = () => (FutureOrOf_ConnectionInfo = dart.constFn(async.FutureOr$(io._ConnectionInfo)))();
let SetOf_HttpClientConnection = () => (SetOf_HttpClientConnection = dart.constFn(core.Set$(io._HttpClientConnection)))();
let HashMapOfString$_ConnectionTarget = () => (HashMapOfString$_ConnectionTarget = dart.constFn(collection.HashMap$(core.String, io._ConnectionTarget)))();
@@ -437,8 +445,7 @@
let HttpRequestTovoid = () => (HttpRequestTovoid = dart.constFn(dart.functionType(dart.void, [io.HttpRequest])))();
let MapOfint$_HttpServer = () => (MapOfint$_HttpServer = dart.constFn(core.Map$(core.int, io._HttpServer)))();
let ListOf_Proxy = () => (ListOf_Proxy = dart.constFn(core.List$(io._Proxy)))();
-let FutureOfSocket = () => (FutureOfSocket = dart.constFn(async.Future$(io.Socket)))();
-let StreamOfint = () => (StreamOfint = dart.constFn(async.Stream$(core.int)))();
+let StreamSubscriptionOfListOfint = () => (StreamSubscriptionOfListOfint = dart.constFn(async.StreamSubscription$(ListOfint())))();
let StreamControllerOf_HttpIncoming = () => (StreamControllerOf_HttpIncoming = dart.constFn(async.StreamController$(io._HttpIncoming)))();
let _HttpIncomingTovoid = () => (_HttpIncomingTovoid = dart.constFn(dart.functionType(dart.void, [io._HttpIncoming])))();
let MapOfString$_HttpSession = () => (MapOfString$_HttpSession = dart.constFn(core.Map$(core.String, io._HttpSession)))();
@@ -449,14 +456,16 @@
let MapOfint$_SocketResourceInfo = () => (MapOfint$_SocketResourceInfo = dart.constFn(core.Map$(core.int, io._SocketResourceInfo)))();
let StreamSinkOfListOfint = () => (StreamSinkOfListOfint = dart.constFn(async.StreamSink$(ListOfint())))();
let FutureOfLink = () => (FutureOfLink = dart.constFn(async.Future$(io.Link)))();
+let _CaseInsensitiveStringMapOfString = () => (_CaseInsensitiveStringMapOfString = dart.constFn(io._CaseInsensitiveStringMap$(core.String)))();
let _CaseInsensitiveStringMap = () => (_CaseInsensitiveStringMap = dart.constFn(io._CaseInsensitiveStringMap$()))();
+let StreamSubscriptionOfRawSocketEvent = () => (StreamSubscriptionOfRawSocketEvent = dart.constFn(async.StreamSubscription$(io.RawSocketEvent)))();
let FutureOfRawSecureSocket = () => (FutureOfRawSecureSocket = dart.constFn(async.Future$(io.RawSecureSocket)))();
let SecureSocketTovoid = () => (SecureSocketTovoid = dart.constFn(dart.functionType(dart.void, [io.SecureSocket])))();
let StreamControllerOfRawSecureSocket = () => (StreamControllerOfRawSecureSocket = dart.constFn(async.StreamController$(io.RawSecureSocket)))();
let RawSecureSocketTovoid = () => (RawSecureSocketTovoid = dart.constFn(dart.functionType(dart.void, [io.RawSecureSocket])))();
let StreamSubscriptionOfRawSocket = () => (StreamSubscriptionOfRawSocket = dart.constFn(async.StreamSubscription$(io.RawSocket)))();
-let StreamSubscriptionOfRawSocketEvent = () => (StreamSubscriptionOfRawSocketEvent = dart.constFn(async.StreamSubscription$(io.RawSocketEvent)))();
let CompleterOf_RawSecureSocket = () => (CompleterOf_RawSecureSocket = dart.constFn(async.Completer$(io._RawSecureSocket)))();
+let CompleterOfRawSecureSocket = () => (CompleterOfRawSecureSocket = dart.constFn(async.Completer$(io.RawSecureSocket)))();
let StreamControllerOfRawSocketEvent = () => (StreamControllerOfRawSocketEvent = dart.constFn(async.StreamController$(io.RawSocketEvent)))();
let RawSocketEventTovoid = () => (RawSocketEventTovoid = dart.constFn(dart.functionType(dart.void, [io.RawSocketEvent])))();
let StreamOfRawSocketEvent = () => (StreamOfRawSocketEvent = dart.constFn(async.Stream$(io.RawSocketEvent)))();
@@ -465,15 +474,14 @@
let StreamOfSocket = () => (StreamOfSocket = dart.constFn(async.Stream$(io.Socket)))();
let StreamTransformerOfHttpRequest$WebSocket = () => (StreamTransformerOfHttpRequest$WebSocket = dart.constFn(async.StreamTransformer$(io.HttpRequest, io.WebSocket)))();
let ListOfStringTodynamic = () => (ListOfStringTodynamic = dart.constFn(dart.functionType(dart.dynamic, [ListOfString()])))();
+let EventSinkOfListOfint = () => (EventSinkOfListOfint = dart.constFn(async.EventSink$(ListOfint())))();
let StreamTransformerOfListOfint$dynamic = () => (StreamTransformerOfListOfint$dynamic = dart.constFn(async.StreamTransformer$(ListOfint(), dart.dynamic)))();
-let EventSinkOfUint8List = () => (EventSinkOfUint8List = dart.constFn(async.EventSink$(typed_data.Uint8List)))();
let StreamControllerOfWebSocket = () => (StreamControllerOfWebSocket = dart.constFn(async.StreamController$(io.WebSocket)))();
let FutureOfWebSocket = () => (FutureOfWebSocket = dart.constFn(async.Future$(io.WebSocket)))();
-let EventSinkOfListOfint = () => (EventSinkOfListOfint = dart.constFn(async.EventSink$(ListOfint())))();
-let JSArrayOfUint8List = () => (JSArrayOfUint8List = dart.constFn(_interceptors.JSArray$(typed_data.Uint8List)))();
+let FutureOfString = () => (FutureOfString = dart.constFn(async.Future$(core.String)))();
let StreamTransformerOfdynamic$ListOfint = () => (StreamTransformerOfdynamic$ListOfint = dart.constFn(async.StreamTransformer$(dart.dynamic, ListOfint())))();
let MapOfint$_WebSocketImpl = () => (MapOfint$_WebSocketImpl = dart.constFn(core.Map$(core.int, io._WebSocketImpl)))();
-let FutureOfIsolate = () => (FutureOfIsolate = dart.constFn(async.Future$(isolate.Isolate)))();
+let FutureOfIsolate = () => (FutureOfIsolate = dart.constFn(async.Future$(isolate$.Isolate)))();
let JsArray = () => (JsArray = dart.constFn(js.JsArray$()))();
let ExpandoOfFunction = () => (ExpandoOfFunction = dart.constFn(core.Expando$(core.Function)))();
let PointOfnum = () => (PointOfnum = dart.constFn(math.Point$(core.num)))();
@@ -594,6 +602,7 @@
let ElementListOfElement = () => (ElementListOfElement = dart.constFn(html$.ElementList$(html$.Element)))();
let ListOfRectangleOfnum = () => (ListOfRectangleOfnum = dart.constFn(core.List$(RectangleOfnum())))();
let ListOfGamepad = () => (ListOfGamepad = dart.constFn(core.List$(html$.Gamepad)))();
+let SetOfString = () => (SetOfString = dart.constFn(core.Set$(core.String)))();
let ListOfCssClassSetImpl = () => (ListOfCssClassSetImpl = dart.constFn(core.List$(html_common.CssClassSetImpl)))();
let LinkedHashSetOfString = () => (LinkedHashSetOfString = dart.constFn(collection.LinkedHashSet$(core.String)))();
let StringTobool = () => (StringTobool = dart.constFn(dart.functionType(core.bool, [core.String])))();
@@ -639,18 +648,20 @@
let dynamicToListOfString = () => (dynamicToListOfString = dart.constFn(dart.definiteFunctionType(ListOfString(), [dart.dynamic])))();
let dynamicToList = () => (dynamicToList = dart.constFn(dart.definiteFunctionType(core.List, [dart.dynamic])))();
let dynamicAndSetOfNameValuePairTovoid = () => (dynamicAndSetOfNameValuePairTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [dart.dynamic, SetOfNameValuePair()])))();
-let TypeToString = () => (TypeToString = dart.constFn(dart.definiteFunctionType(core.String, [core.Type])))();
-let dynamicToObject = () => (dynamicToObject = dart.constFn(dart.definiteFunctionType(core.Object, [dart.dynamic])))();
+let dynamicAndSetOfNameValuePairAnddynamic__Tovoid = () => (dynamicAndSetOfNameValuePairAnddynamic__Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [dart.dynamic, SetOfNameValuePair(), dart.dynamic, core.bool], {tagTypes: dart.dynamic})))();
+let NameValuePairAndNameValuePairToint = () => (NameValuePairAndNameValuePairToint = dart.constFn(dart.definiteFunctionType(core.int, [_debugger.NameValuePair, _debugger.NameValuePair])))();
+let IterableOfNameValuePairToListOfNameValuePair = () => (IterableOfNameValuePairToListOfNameValuePair = dart.constFn(dart.definiteFunctionType(ListOfNameValuePair(), [IterableOfNameValuePair()])))();
let dynamicAnddynamicToString = () => (dynamicAnddynamicToString = dart.constFn(dart.definiteFunctionType(core.String, [dart.dynamic, dart.dynamic])))();
let dynamicAndStringTobool = () => (dynamicAndStringTobool = dart.constFn(dart.definiteFunctionType(core.bool, [dart.dynamic, core.String])))();
let intAnddynamicToNull = () => (intAnddynamicToNull = dart.constFn(dart.definiteFunctionType(core.Null, [core.int, dart.dynamic])))();
let ObjectAndObjectToObject = () => (ObjectAndObjectToObject = dart.constFn(dart.definiteFunctionType(core.Object, [core.Object, core.Object])))();
let StringTobool$ = () => (StringTobool$ = dart.constFn(dart.definiteFunctionType(core.bool, [core.String])))();
+let dynamicToObject = () => (dynamicToObject = dart.constFn(dart.definiteFunctionType(core.Object, [dart.dynamic])))();
let dynamicTobool$ = () => (dynamicTobool$ = dart.constFn(dart.definiteFunctionType(core.bool, [dart.dynamic])))();
let dynamicAnddynamicToNull = () => (dynamicAnddynamicToNull = dart.constFn(dart.definiteFunctionType(core.Null, [dart.dynamic, dart.dynamic])))();
-let StringAndObjectToNull = () => (StringAndObjectToNull = dart.constFn(dart.definiteFunctionType(core.Null, [core.String, core.Object])))();
let StringToNameValuePair = () => (StringToNameValuePair = dart.constFn(dart.definiteFunctionType(_debugger.NameValuePair, [core.String])))();
let VoidTodynamic$ = () => (VoidTodynamic$ = dart.constFn(dart.definiteFunctionType(dart.dynamic, [])))();
+let StringTodynamic = () => (StringTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.String])))();
let StringAndString__Todynamic = () => (StringAndString__Todynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.String, core.String], [dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic])))();
let VoidToIsolateContext = () => (VoidToIsolateContext = dart.constFn(dart.definiteFunctionType(_foreign_helper.IsolateContext, [])))();
let dynamicAndFunctionTodynamic = () => (dynamicAndFunctionTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [dart.dynamic, core.Function])))();
@@ -664,6 +675,8 @@
let TypeAndStringTodynamic = () => (TypeAndStringTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.Type, core.String])))();
let dynamicAnddynamicTodynamic$ = () => (dynamicAnddynamicTodynamic$ = dart.constFn(dart.definiteFunctionType(dart.dynamic, [dart.dynamic, dart.dynamic])))();
let dynamicAnddynamicToint = () => (dynamicAnddynamicToint = dart.constFn(dart.definiteFunctionType(core.int, [dart.dynamic, dart.dynamic])))();
+let intToint = () => (intToint = dart.constFn(dart.definiteFunctionType(core.int, [core.int])))();
+let StringAndintToint = () => (StringAndintToint = dart.constFn(dart.definiteFunctionType(core.int, [core.String, core.int])))();
let ListOfEToListOfE = () => (ListOfEToListOfE = dart.constFn(dart.definiteFunctionType(E => [core.List$(E), [core.List$(E)]])))();
let StringTovoid$ = () => (StringTovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [core.String])))();
let _IsolateContextAndFunctionTodynamic = () => (_IsolateContextAndFunctionTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [_isolate_helper._IsolateContext, core.Function])))();
@@ -676,10 +689,11 @@
let StringToNull = () => (StringToNull = dart.constFn(dart.definiteFunctionType(core.Null, [core.String])))();
let dynamicToNull$ = () => (dynamicToNull$ = dart.constFn(dart.definiteFunctionType(core.Null, [dart.dynamic])))();
let TimerToNull = () => (TimerToNull = dart.constFn(dart.definiteFunctionType(core.Null, [async.Timer])))();
+let VoidTo_Future = () => (VoidTo_Future = dart.constFn(dart.definiteFunctionType(async._Future, [])))();
+let VoidToFuture = () => (VoidToFuture = dart.constFn(dart.definiteFunctionType(async.Future, [])))();
let dynamicToFuture = () => (dynamicToFuture = dart.constFn(dart.definiteFunctionType(async.Future, [dart.dynamic])))();
let boolToNull = () => (boolToNull = dart.constFn(dart.definiteFunctionType(core.Null, [core.bool])))();
let dynamicAndStackTraceTovoid = () => (dynamicAndStackTraceTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [dart.dynamic, core.StackTrace])))();
-let VoidToFuture = () => (VoidToFuture = dart.constFn(dart.definiteFunctionType(async.Future, [])))();
let VoidToint = () => (VoidToint = dart.constFn(dart.definiteFunctionType(core.int, [])))();
let dynamicAnddynamicToError = () => (dynamicAnddynamicToError = dart.constFn(dart.definiteFunctionType(core.Error, [dart.dynamic, dart.dynamic])))();
let dynamicAnddynamicAnddynamicToError = () => (dynamicAnddynamicAnddynamicToError = dart.constFn(dart.definiteFunctionType(core.Error, [dart.dynamic, dart.dynamic, dart.dynamic])))();
@@ -740,7 +754,7 @@
let _NotificationHandlerToFuture = () => (_NotificationHandlerToFuture = dart.constFn(dart.definiteFunctionType(async.Future, [async._NotificationHandler])))();
let dynamicAndStackTraceToNull = () => (dynamicAndStackTraceToNull = dart.constFn(dart.definiteFunctionType(core.Null, [dart.dynamic, core.StackTrace])))();
let dynamic__Tovoid = () => (dynamic__Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [dart.dynamic], [core.StackTrace])))();
-let FnAndFnAndFnTodynamic = () => (FnAndFnAndFnTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [VoidTodynamic(), dynamicTodynamic(), ZoneBinaryCallbackOfdynamic$dynamic$StackTrace()])))();
+let FnAndFnAndFnTodynamic = () => (FnAndFnAndFnTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [VoidTodynamic(), dynamicTodynamic(), dynamicAndStackTraceTodynamic()])))();
let StreamSubscriptionAnd_FutureAnddynamic__Tovoid = () => (StreamSubscriptionAnd_FutureAnddynamic__Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [async.StreamSubscription, async._Future, dart.dynamic, core.StackTrace])))();
let StreamSubscriptionAnd_FutureTo_ErrorCallback = () => (StreamSubscriptionAnd_FutureTo_ErrorCallback = dart.constFn(dart.definiteFunctionType(async._ErrorCallback, [async.StreamSubscription, async._Future])))();
let StreamSubscriptionAnd_FutureAnddynamicTovoid = () => (StreamSubscriptionAnd_FutureAnddynamicTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [async.StreamSubscription, async._Future, dart.dynamic])))();
@@ -778,12 +792,18 @@
let ObjectAndObjectTobool = () => (ObjectAndObjectTobool = dart.constFn(dart.definiteFunctionType(core.bool, [core.Object, core.Object])))();
let ObjectToint = () => (ObjectToint = dart.constFn(dart.definiteFunctionType(core.int, [core.Object])))();
let ObjectTovoid = () => (ObjectTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.Object])))();
+let MapOfString$StringAndStringToMapOfString$String = () => (MapOfString$StringAndStringToMapOfString$String = dart.constFn(dart.definiteFunctionType(MapOfString$String(), [MapOfString$String(), core.String])))();
+let StringAndintTovoid = () => (StringAndintTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String, core.int])))();
+let String__Tovoid = () => (String__Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String], [dart.dynamic])))();
let StringAndStringTovoid$ = () => (StringAndStringTovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [core.String, core.String])))();
let StringAnddynamicToNull = () => (StringAnddynamicToNull = dart.constFn(dart.definiteFunctionType(core.Null, [core.String, dart.dynamic])))();
-let MapOfString$StringAndStringToMapOfString$String = () => (MapOfString$StringAndStringToMapOfString$String = dart.constFn(dart.definiteFunctionType(MapOfString$String(), [MapOfString$String(), core.String])))();
let intAndintAndintTovoid = () => (intAndintAndintTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.int, core.int, core.int])))();
-let String__Tovoid = () => (String__Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String], [dart.dynamic])))();
let StringAndStringToNull = () => (StringAndStringToNull = dart.constFn(dart.definiteFunctionType(core.Null, [core.String, core.String])))();
+let intToUint8List = () => (intToUint8List = dart.constFn(dart.definiteFunctionType(typed_data.Uint8List, [core.int])))();
+let dynamicAnddynamicToUint8List = () => (dynamicAnddynamicToUint8List = dart.constFn(dart.definiteFunctionType(typed_data.Uint8List, [dart.dynamic, dart.dynamic])))();
+let Uint8ListAndStringAndintTovoid = () => (Uint8ListAndStringAndintTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [typed_data.Uint8List, core.String, core.int])))();
+let VoidToListOfUint8List = () => (VoidToListOfUint8List = dart.constFn(dart.definiteFunctionType(ListOfUint8List(), [])))();
+let StringAndintAndint__Toint = () => (StringAndintAndint__Toint = dart.constFn(dart.definiteFunctionType(core.int, [core.String, core.int, core.int, core.int, ListOfint()])))();
let __Tobool = () => (__Tobool = dart.constFn(dart.definiteFunctionType(core.bool, [], {when: core.bool, message: core.String})))();
let String__Tovoid$ = () => (String__Tovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [core.String], {time: core.DateTime, sequenceNumber: core.int, level: core.int, name: core.String, zone: async.Zone, error: core.Object, stackTrace: core.StackTrace})))();
let StringAndServiceExtensionHandlerTovoid = () => (StringAndServiceExtensionHandlerTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String, developer.ServiceExtensionHandler])))();
@@ -796,10 +816,11 @@
let intAndintAndString__Tovoid$ = () => (intAndintAndString__Tovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [core.int, core.int, core.String, core.String, core.String])))();
let intAndStringAndString__Tovoid = () => (intAndStringAndString__Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.int, core.String, core.String, core.String])))();
let UriTovoid = () => (UriTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.Uri])))();
-let SendPortTovoid = () => (SendPortTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [isolate.SendPort])))();
-let SendPortAndboolTovoid = () => (SendPortAndboolTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [isolate.SendPort, core.bool])))();
+let SendPortTovoid = () => (SendPortTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [isolate$.SendPort])))();
+let SendPortAndboolTovoid = () => (SendPortAndboolTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [isolate$.SendPort, core.bool])))();
+let SendPortToString = () => (SendPortToString = dart.constFn(dart.definiteFunctionType(core.String, [isolate$.SendPort])))();
let dynamicAndStringAndStringTodynamic = () => (dynamicAndStringAndStringTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [dart.dynamic, core.String, core.String])))();
-let ListAndintAndintTo_BufferAndStart = () => (ListAndintAndintTo_BufferAndStart = dart.constFn(dart.definiteFunctionType(io._BufferAndStart, [core.List, core.int, core.int])))();
+let ListOfintAndintAndintTo_BufferAndStart = () => (ListOfintAndintAndintTo_BufferAndStart = dart.constFn(dart.definiteFunctionType(io._BufferAndStart, [ListOfint(), core.int, core.int])))();
let intTovoid = () => (intTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.int])))();
let DirectoryToFutureOfDirectory = () => (DirectoryToFutureOfDirectory = dart.constFn(dart.definiteFunctionType(FutureOfDirectory(), [io.Directory])))();
let boolToFutureOrOfDirectory = () => (boolToFutureOrOfDirectory = dart.constFn(dart.definiteFunctionType(FutureOrOfDirectory(), [core.bool])))();
@@ -818,17 +839,15 @@
let dynamicToFile = () => (dynamicToFile = dart.constFn(dart.definiteFunctionType(io.File, [dart.dynamic])))();
let dynamicTo_RandomAccessFile = () => (dynamicTo_RandomAccessFile = dart.constFn(dart.definiteFunctionType(io._RandomAccessFile, [dart.dynamic])))();
let dynamicToDateTime = () => (dynamicToDateTime = dart.constFn(dart.definiteFunctionType(core.DateTime, [dart.dynamic])))();
-let dynamicToFutureOfListOfint = () => (dynamicToFutureOfListOfint = dart.constFn(dart.definiteFunctionType(FutureOfListOfint(), [dart.dynamic])))();
-let intToFutureOfListOfint = () => (intToFutureOfListOfint = dart.constFn(dart.definiteFunctionType(FutureOfListOfint(), [core.int])))();
let RandomAccessFileToFutureOfListOfint = () => (RandomAccessFileToFutureOfListOfint = dart.constFn(dart.definiteFunctionType(FutureOfListOfint(), [io.RandomAccessFile])))();
+let intToFutureOfListOfint = () => (intToFutureOfListOfint = dart.constFn(dart.definiteFunctionType(FutureOfListOfint(), [core.int])))();
let ListOfintToString = () => (ListOfintToString = dart.constFn(dart.definiteFunctionType(core.String, [ListOfint()])))();
let RandomAccessFileTo_File = () => (RandomAccessFileTo_File = dart.constFn(dart.definiteFunctionType(io._File, [io.RandomAccessFile])))();
let RandomAccessFileToObject = () => (RandomAccessFileToObject = dart.constFn(dart.definiteFunctionType(core.Object, [io.RandomAccessFile])))();
let RandomAccessFileToFutureOrOfFile = () => (RandomAccessFileToFutureOrOfFile = dart.constFn(dart.definiteFunctionType(FutureOrOfFile(), [io.RandomAccessFile])))();
-let dynamicToFutureOrOfListOfint = () => (dynamicToFutureOrOfListOfint = dart.constFn(dart.definiteFunctionType(FutureOrOfListOfint(), [dart.dynamic])))();
+let dynamicToListOfint = () => (dynamicToListOfint = dart.constFn(dart.definiteFunctionType(ListOfint(), [dart.dynamic])))();
let dynamicToFileStat = () => (dynamicToFileStat = dart.constFn(dart.definiteFunctionType(io.FileStat, [dart.dynamic])))();
let StringAndListOfStringToListOfString = () => (StringAndListOfStringToListOfString = dart.constFn(dart.definiteFunctionType(ListOfString(), [core.String, ListOfString()])))();
-let ListOfintTovoid = () => (ListOfintTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [ListOfint()])))();
let StringAndListOfStringToNull = () => (StringAndListOfStringToNull = dart.constFn(dart.definiteFunctionType(core.Null, [core.String, ListOfString()])))();
let CookieToString = () => (CookieToString = dart.constFn(dart.definiteFunctionType(core.String, [io.Cookie])))();
let CookieTobool = () => (CookieTobool = dart.constFn(dart.definiteFunctionType(core.bool, [io.Cookie])))();
@@ -844,11 +863,14 @@
let ListToFutureOrOfHttpClientResponse = () => (ListToFutureOrOfHttpClientResponse = dart.constFn(dart.definiteFunctionType(FutureOrOfHttpClientResponse(), [core.List])))();
let HttpClientResponseTovoid = () => (HttpClientResponseTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [io.HttpClientResponse])))();
let dynamicToIterable = () => (dynamicToIterable = dart.constFn(dart.definiteFunctionType(core.Iterable, [dart.dynamic])))();
+let ListOfintTovoid = () => (ListOfintTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [ListOfint()])))();
let dynamicTo_HttpOutboundMessage = () => (dynamicTo_HttpOutboundMessage = dart.constFn(dart.definiteFunctionType(io._HttpOutboundMessage, [dart.dynamic])))();
let dynamicAnddynamicTo_HttpOutboundMessage = () => (dynamicAnddynamicTo_HttpOutboundMessage = dart.constFn(dart.definiteFunctionType(io._HttpOutboundMessage, [dart.dynamic, dart.dynamic])))();
let dynamic__ToNull$ = () => (dynamic__ToNull$ = dart.constFn(dart.definiteFunctionType(core.Null, [dart.dynamic], [core.StackTrace])))();
let _HttpIncomingToNull = () => (_HttpIncomingToNull = dart.constFn(dart.definiteFunctionType(core.Null, [io._HttpIncoming])))();
-let dynamicTo_DetachedSocket = () => (dynamicTo_DetachedSocket = dart.constFn(dart.definiteFunctionType(io._DetachedSocket, [dart.dynamic])))();
+let SocketToSocket = () => (SocketToSocket = dart.constFn(dart.definiteFunctionType(io.Socket, [io.Socket])))();
+let SocketTo_DetachedSocket = () => (SocketTo_DetachedSocket = dart.constFn(dart.definiteFunctionType(io._DetachedSocket, [io.Socket])))();
+let SocketTovoid = () => (SocketTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [io.Socket])))();
let SecureSocketTo_HttpClientConnection = () => (SecureSocketTo_HttpClientConnection = dart.constFn(dart.definiteFunctionType(io._HttpClientConnection, [io.SecureSocket])))();
let HttpClientResponseToFutureOfSecureSocket = () => (HttpClientResponseToFutureOfSecureSocket = dart.constFn(dart.definiteFunctionType(FutureOfSecureSocket(), [io.HttpClientResponse])))();
let X509CertificateTobool$ = () => (X509CertificateTobool$ = dart.constFn(dart.definiteFunctionType(core.bool, [io.X509Certificate])))();
@@ -862,14 +884,15 @@
let dynamicToFutureOf_ConnectionInfo = () => (dynamicToFutureOf_ConnectionInfo = dart.constFn(dart.definiteFunctionType(FutureOf_ConnectionInfo(), [dart.dynamic])))();
let VoidToFutureOf_ConnectionInfo = () => (VoidToFutureOf_ConnectionInfo = dart.constFn(dart.definiteFunctionType(FutureOf_ConnectionInfo(), [])))();
let _SiteCredentialsAnd_CredentialsTo_SiteCredentials = () => (_SiteCredentialsAnd_CredentialsTo_SiteCredentials = dart.constFn(dart.definiteFunctionType(io._SiteCredentials, [io._SiteCredentials, io._Credentials])))();
+let SocketToNull = () => (SocketToNull = dart.constFn(dart.definiteFunctionType(core.Null, [io.Socket])))();
+let dynamicTo_DetachedSocket = () => (dynamicTo_DetachedSocket = dart.constFn(dart.definiteFunctionType(io._DetachedSocket, [dart.dynamic])))();
let ServerSocketTo_HttpServer = () => (ServerSocketTo_HttpServer = dart.constFn(dart.definiteFunctionType(io._HttpServer, [io.ServerSocket])))();
let SecureServerSocketTo_HttpServer = () => (SecureServerSocketTo_HttpServer = dart.constFn(dart.definiteFunctionType(io._HttpServer, [io.SecureServerSocket])))();
-let SocketToNull = () => (SocketToNull = dart.constFn(dart.definiteFunctionType(core.Null, [io.Socket])))();
let _HttpConnectionToNull = () => (_HttpConnectionToNull = dart.constFn(dart.definiteFunctionType(core.Null, [io._HttpConnection])))();
let _HttpConnectionToMap = () => (_HttpConnectionToMap = dart.constFn(dart.definiteFunctionType(core.Map, [io._HttpConnection])))();
-let _FileResourceInfoToMapOfString$String = () => (_FileResourceInfoToMapOfString$String = dart.constFn(dart.definiteFunctionType(MapOfString$String(), [io._FileResourceInfo])))();
-let _ProcessResourceInfoToMapOfString$String = () => (_ProcessResourceInfoToMapOfString$String = dart.constFn(dart.definiteFunctionType(MapOfString$String(), [io._ProcessResourceInfo])))();
-let _SocketResourceInfoToMapOfString$String = () => (_SocketResourceInfoToMapOfString$String = dart.constFn(dart.definiteFunctionType(MapOfString$String(), [io._SocketResourceInfo])))();
+let _FileResourceInfoToMapOfString$dynamic = () => (_FileResourceInfoToMapOfString$dynamic = dart.constFn(dart.definiteFunctionType(MapOfString$dynamic(), [io._FileResourceInfo])))();
+let _ProcessResourceInfoToMapOfString$dynamic = () => (_ProcessResourceInfoToMapOfString$dynamic = dart.constFn(dart.definiteFunctionType(MapOfString$dynamic(), [io._ProcessResourceInfo])))();
+let _SocketResourceInfoToMapOfString$dynamic = () => (_SocketResourceInfoToMapOfString$dynamic = dart.constFn(dart.definiteFunctionType(MapOfString$dynamic(), [io._SocketResourceInfo])))();
let dynamicTo_Link = () => (dynamicTo_Link = dart.constFn(dart.definiteFunctionType(io._Link, [dart.dynamic])))();
let FileSystemEntityToFutureOfLink = () => (FileSystemEntityToFutureOfLink = dart.constFn(dart.definiteFunctionType(FutureOfLink(), [io.FileSystemEntity])))();
let FileSystemEntityTo_Link = () => (FileSystemEntityTo_Link = dart.constFn(dart.definiteFunctionType(io._Link, [io.FileSystemEntity])))();
@@ -882,7 +905,6 @@
let RawSecureSocketToNull = () => (RawSecureSocketToNull = dart.constFn(dart.definiteFunctionType(core.Null, [io.RawSecureSocket])))();
let RawSocketToFutureOfRawSecureSocket = () => (RawSocketToFutureOfRawSecureSocket = dart.constFn(dart.definiteFunctionType(FutureOfRawSecureSocket(), [io.RawSocket])))();
let _FilterStatusToNull = () => (_FilterStatusToNull = dart.constFn(dart.definiteFunctionType(core.Null, [io._FilterStatus])))();
-let intToint = () => (intToint = dart.constFn(dart.definiteFunctionType(core.int, [core.int])))();
let dynamicTo_FilterStatus = () => (dynamicTo_FilterStatus = dart.constFn(dart.definiteFunctionType(io._FilterStatus, [dart.dynamic])))();
let ListOfintAndStringTovoid = () => (ListOfintAndStringTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [ListOfint(), core.String])))();
let dynamicToStdioType = () => (dynamicToStdioType = dart.constFn(dart.definiteFunctionType(io.StdioType, [dart.dynamic])))();
@@ -890,14 +912,13 @@
let WebSocketTovoid = () => (WebSocketTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [io.WebSocket])))();
let HttpRequestToNull = () => (HttpRequestToNull = dart.constFn(dart.definiteFunctionType(core.Null, [io.HttpRequest])))();
let SocketTo_WebSocketImpl = () => (SocketTo_WebSocketImpl = dart.constFn(dart.definiteFunctionType(io._WebSocketImpl, [io.Socket])))();
-let StringToFuture = () => (StringToFuture = dart.constFn(dart.definiteFunctionType(async.Future, [core.String])))();
+let StringToFutureOfWebSocket = () => (StringToFutureOfWebSocket = dart.constFn(dart.definiteFunctionType(FutureOfWebSocket(), [core.String])))();
let EventSinkOfListOfintTo_WebSocketOutgoingTransformer = () => (EventSinkOfListOfintTo_WebSocketOutgoingTransformer = dart.constFn(dart.definiteFunctionType(io._WebSocketOutgoingTransformer, [EventSinkOfListOfint()])))();
-let dynamicTo_WebSocketImpl = () => (dynamicTo_WebSocketImpl = dart.constFn(dart.definiteFunctionType(io._WebSocketImpl, [dart.dynamic])))();
let HttpClientResponseToFutureOfWebSocket = () => (HttpClientResponseToFutureOfWebSocket = dart.constFn(dart.definiteFunctionType(FutureOfWebSocket(), [io.HttpClientResponse])))();
let StringAnddynamicTovoid = () => (StringAnddynamicTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String, dart.dynamic])))();
let HttpClientRequestToFutureOfHttpClientResponse = () => (HttpClientRequestToFutureOfHttpClientResponse = dart.constFn(dart.definiteFunctionType(FutureOfHttpClientResponse(), [io.HttpClientRequest])))();
let dynamicToMap = () => (dynamicToMap = dart.constFn(dart.definiteFunctionType(core.Map, [dart.dynamic])))();
-let ListToIsolate = () => (ListToIsolate = dart.constFn(dart.definiteFunctionType(isolate.Isolate, [core.List])))();
+let ListToIsolate = () => (ListToIsolate = dart.constFn(dart.definiteFunctionType(isolate$.Isolate, [core.List])))();
let dynamicTo_DartObject = () => (dynamicTo_DartObject = dart.constFn(dart.definiteFunctionType(js._DartObject, [dart.dynamic])))();
let dynamicAnddynamicAndFnToObject = () => (dynamicAnddynamicAndFnToObject = dart.constFn(dart.definiteFunctionType(core.Object, [dart.dynamic, dart.dynamic, dynamicTodynamic()])))();
let FToF = () => (FToF = dart.constFn(dart.definiteFunctionType(F => [F, [F]])))();
@@ -1462,8 +1483,8 @@
dart.getIsNamedConstructor = function(value) {
return value[dart.isNamedConstructor];
};
-dart.getDartLibraryName = function(value) {
- return value[dart_library.dartLibraryName];
+dart.getModuleName = function(value) {
+ return value[dart._moduleName];
};
dart.tag = function(value, t) {
value[dart._runtimeType] = t;
@@ -1474,6 +1495,18 @@
dart.tagLazy = function(value, compute) {
dart.defineLazyProperty(value, dart._runtimeType, {get: compute});
};
+dart.getModuleNames = function() {
+ return Array.from(dart._loadedModules.keys());
+};
+dart.getModuleLibraries = function(name) {
+ let module = dart._loadedModules.get(name);
+ if (module == null) return null;
+ module[dart._moduleName] = name;
+ return module;
+};
+dart.trackLibraries = function(moduleName, libraries) {
+ dart._loadedModules.set(moduleName, libraries);
+};
dart._warn = function(arg) {
console.warn(arg);
};
@@ -1616,6 +1649,9 @@
dart.definiteFunctionType = function(returnType, args, extra) {
return dart._functionType(true, returnType, args, extra);
};
+dart.isType = function(obj) {
+ return dart._getRuntimeType(obj) === core.Type;
+};
dart.typeName = function(type) {
if (type === void 0) return "undefined type";
if (type === null) return "null type";
@@ -2040,7 +2076,7 @@
return name;
};
dart._dartSymbol = function(name) {
- return core.Symbol._check(typeof name === "symbol" ? dart.const(new _internal.Symbol.es6(dart._toSymbolName(name), name)) : dart.const(core.Symbol.new(dart._toDisplayName(name))));
+ return core.Symbol._check(typeof name === "symbol" ? dart.const(new _internal.PrivateSymbol(dart._toSymbolName(name), name)) : dart.const(core.Symbol.new(dart._toDisplayName(name))));
};
dart.extractNamedArgs = function(args) {
if (args.length > 0) {
@@ -2434,6 +2470,7 @@
return obj[dartx.toString]();
}
if (typeof obj == "function") {
+ if (dart.test(dart.isType(obj))) return dart.typeName(obj);
return "Closure: " + dart.getReifiedType(obj) + " from: " + obj;
}
return obj.toString();
@@ -2638,12 +2675,19 @@
dart.dartx = dartx;
dart._runtimeType = Symbol("_runtimeType");
dart.isNamedConstructor = Symbol("isNamedConstructor");
+dart._moduleName = Symbol("_moduleName");
dart.defineLazy(dart, {
get _lazyJSTypes() {
return new Map();
},
set _lazyJSTypes(_) {}
});
+dart.defineLazy(dart, {
+ get _loadedModules() {
+ return new Map();
+ },
+ set _loadedModules(_) {}
+});
dart.metadata = Symbol("metadata");
dart._typeObject = Symbol("typeObject");
core.Object = class Object {
@@ -3197,9 +3241,51 @@
names: ['getProperty', 'setProperty']
});
_debugger.addMetadataChildren = function(object, ret) {
- ret.add(new _debugger.NameValuePair({name: _debugger.getTypeName(core.Type._check(_debugger._getType(object))), value: object, config: _debugger.JsonMLConfig.asClass}));
+ ret.add(new _debugger.NameValuePair({name: "[[class]]", value: dart.getReifiedType(object), config: _debugger.JsonMLConfig.asClass}));
};
dart.lazyFn(_debugger.addMetadataChildren, () => dynamicAndSetOfNameValuePairTovoid());
+_debugger.addPropertiesFromSignature = function(sig, properties, object, walkPrototypeChain, opts) {
+ let tagTypes = opts && 'tagTypes' in opts ? opts.tagTypes : false;
+ let skippedNames = core.Set.new();
+ skippedNames.add('hashCode');
+ while (sig != null) {
+ for (let symbol of _debugger.getOwnPropertySymbols(sig)) {
+ let dartName = _debugger.symbolName(symbol);
+ let dartXPrefix = 'dartx.';
+ if (dart.test(dartName[dartx.startsWith](dartXPrefix))) {
+ dartName = dartName[dartx.substring](dartXPrefix[dartx.length]);
+ }
+ if (dart.test(skippedNames.contains(dartName))) continue;
+ let value = _debugger.safeGetProperty(object, symbol);
+ if (dart.test(tagTypes) && _debugger._typeof(value) == 'function') {
+ dart.tag(value, sig[symbol]);
+ }
+ properties.add(new _debugger.NameValuePair({name: dartName, value: value}));
+ }
+ for (let name of _debugger.getOwnPropertyNames(sig)) {
+ let value = _debugger.safeGetProperty(object, name);
+ if (dart.test(skippedNames.contains(name))) continue;
+ if (dart.test(tagTypes) && _debugger._typeof(value) == 'function') {
+ dart.tag(value, sig[name]);
+ }
+ properties.add(new _debugger.NameValuePair({name: name, value: value}));
+ }
+ if (!dart.test(walkPrototypeChain)) break;
+ sig = _debugger.safeGetProperty(sig, '__proto__');
+ }
+};
+dart.lazyFn(_debugger.addPropertiesFromSignature, () => dynamicAndSetOfNameValuePairAnddynamic__Tovoid());
+_debugger.sortProperties = function(properties) {
+ let sortedProperties = properties[dartx.toList]();
+ sortedProperties[dartx.sort](dart.fn((a, b) => {
+ let aPrivate = a.name[dartx.startsWith]('_');
+ let bPrivate = b.name[dartx.startsWith]('_');
+ if (aPrivate != bPrivate) return dart.test(aPrivate) ? 1 : -1;
+ return a.name[dartx.compareTo](b.name);
+ }, NameValuePairAndNameValuePairToint()));
+ return sortedProperties;
+};
+dart.lazyFn(_debugger.sortProperties, () => IterableOfNameValuePairToListOfNameValuePair());
_debugger.getObjectTypeName = function(object) {
let reifiedType = dart.getReifiedType(object);
if (reifiedType == null) {
@@ -3208,7 +3294,7 @@
}
return '<Error getting type name>';
}
- return _debugger.getTypeName(core.Type._check(reifiedType));
+ return _debugger.getTypeName(reifiedType);
};
dart.lazyFn(_debugger.getObjectTypeName, () => dynamicToString());
_debugger.getTypeName = function(type) {
@@ -3216,11 +3302,7 @@
if (name == 'JSArray<dynamic>' || name == 'JSObject<Array>') return 'List<dynamic>';
return name;
};
-dart.lazyFn(_debugger.getTypeName, () => TypeToString());
-_debugger._getType = function(object) {
- return core.Type.is(object) ? object : dart.getReifiedType(object);
-};
-dart.fn(_debugger._getType, dynamicToObject());
+dart.lazyFn(_debugger.getTypeName, () => dynamicToString());
const _simpleFormatter = Symbol('_simpleFormatter');
_debugger.safePreview = function(object, config) {
try {
@@ -3260,7 +3342,9 @@
this.hideName = hideName;
}
['=='](other) {
- return _debugger.NameValuePair.is(other) && other.name == this.name;
+ if (!_debugger.NameValuePair.is(other)) return false;
+ if (dart.test(this.hideName) || dart.test(dart.dload(other, 'hideName'))) return core.identical(this, other);
+ return dart.equals(dart.dload(other, 'name'), this.name);
}
get hashCode() {
return dart.hashCode(this.name);
@@ -3453,7 +3537,7 @@
});
_debugger.isNativeJavaScriptObject = function(object) {
let type = _debugger._typeof(object);
- return type != 'object' && type != 'function' || dart.JSObject.is(object) || html$.Node.is(object);
+ return type != 'object' && type != 'function' || dart.test(dart.isJsInterop(object)) || html$.Node.is(object);
};
dart.lazyFn(_debugger.isNativeJavaScriptObject, () => dynamicTobool$());
_debugger.JsonMLFormatter = class JsonMLFormatter extends core.Object {
@@ -3489,24 +3573,37 @@
body.addStyle('color: rgb(196, 26, 22);');
}
let children = this[_simpleFormatter].children(object, config);
+ if (children == null) return body.toJsonML();
for (let child of children) {
let li = body.createChild('li');
- let nameSpan = new _debugger.JsonMLElement('span');
- nameSpan.createTextChild(dart.test(child.displayName[dartx.isNotEmpty]) ? dart.str`${child.displayName}: ` : '');
- nameSpan.setStyle('color: rgb(136, 19, 145);');
+ li.setStyle("padding-left: 13px;");
+ let nameSpan = null;
+ let valueStyle = '';
+ if (!dart.test(child.hideName)) {
+ nameSpan = new _debugger.JsonMLElement('span');
+ nameSpan.createTextChild(dart.test(child.displayName[dartx.isNotEmpty]) ? dart.str`${child.displayName}: ` : '');
+ nameSpan.setStyle('color: rgb(136, 19, 145); margin-right: -13px');
+ valueStyle = 'margin-left: 13px';
+ }
if (_debugger._typeof(child.value) == 'object' || _debugger._typeof(child.value) == 'function') {
- nameSpan.addStyle("padding-left: 13px;");
- li.appendChild(nameSpan);
- let objectTag = li.createObjectTag(child.value);
- objectTag.addAttribute('config', child.config);
- if (!dart.test(this[_simpleFormatter].hasChildren(child.value, child.config))) {
- li.setStyle("padding-left: 13px;");
+ let valueSpan = new _debugger.JsonMLElement('span');
+ valueSpan.setStyle(valueStyle);
+ valueSpan.createObjectTag(child.value).addAttribute('config', child.config);
+ if (nameSpan != null) {
+ li.appendChild(nameSpan);
}
+ li.appendChild(valueSpan);
} else {
- li.setStyle("padding-left: 13px;");
- let _ = li.createChild('span');
- _.appendChild(nameSpan);
- _.createTextChild(_debugger.safePreview(child.value, child.config));
+ let line = li.createChild('span');
+ if (nameSpan != null) {
+ line.appendChild(nameSpan);
+ }
+ line.appendChild((() => {
+ let _ = new _debugger.JsonMLElement('span');
+ _.createTextChild(_debugger.safePreview(child.value, child.config));
+ _.setStyle(valueStyle);
+ return _;
+ })());
}
}
return body.toJsonML();
@@ -3529,7 +3626,7 @@
_debugger.DartFormatter = class DartFormatter extends core.Object {
new() {
this[_formatters] = null;
- this[_formatters] = JSArrayOfFormatter().of([new _debugger.ClassFormatter(), new _debugger.NamedConstructorFormatter(), new _debugger.MapFormatter(), new _debugger.IterableFormatter(), new _debugger.IterableSpanFormatter(), new _debugger.MapEntryFormatter(), new _debugger.StackTraceFormatter(), new _debugger.FunctionFormatter(), new _debugger.HeritageClauseFormatter(), new _debugger.LibraryModuleFormatter(), new _debugger.LibraryFormatter(), new _debugger.ObjectFormatter()]);
+ this[_formatters] = JSArrayOfFormatter().of([new _debugger.ClassFormatter(), new _debugger.TypeFormatter(), new _debugger.NamedConstructorFormatter(), new _debugger.MapFormatter(), new _debugger.IterableFormatter(), new _debugger.IterableSpanFormatter(), new _debugger.MapEntryFormatter(), new _debugger.StackTraceFormatter(), new _debugger.FunctionFormatter(), new _debugger.HeritageClauseFormatter(), new _debugger.LibraryModuleFormatter(), new _debugger.LibraryFormatter(), new _debugger.ObjectFormatter()]);
}
preview(object, config) {
try {
@@ -3593,42 +3690,14 @@
return true;
}
children(object) {
- let properties = LinkedHashSetOfNameValuePair().new();
- _debugger.addMetadataChildren(object, properties);
- let current = object;
- let protoChain = JSArrayOfObject().of([]);
- while (current != null && !dart.test(_debugger.isNativeJavaScriptObject(current)) && current !== Object.prototype) {
- protoChain[dartx.add](current);
- current = _debugger.safeGetProperty(current, '__proto__');
- }
- for (current of protoChain) {
- for (let symbol of _debugger.getOwnPropertySymbols(current)) {
- let dartName = _debugger.symbolName(symbol);
- if (dart.test(_debugger.hasMethod(object, dartName))) {
- continue;
- }
- let dartXPrefix = 'dartx.';
- if (dart.test(dartName[dartx.startsWith](dartXPrefix))) {
- dartName = dartName[dartx.substring](dartXPrefix[dartx.length]);
- } else if (!dart.test(dartName[dartx.startsWith]('_'))) {
- continue;
- }
- let value = _debugger.safeGetProperty(object, symbol);
- properties.add(new _debugger.NameValuePair({name: dartName, value: value}));
- }
- }
- for (current of protoChain) {
- let className = dart.dload(dart.getReifiedType(current), 'name');
- for (let name of _debugger.getOwnPropertyNames(current)) {
- if (dart.test(_debugger.ObjectFormatter._customNames.contains(name)) || dart.equals(name, className)) continue;
- if (dart.test(_debugger.hasMethod(object, name))) {
- continue;
- }
- let value = _debugger.safeGetProperty(object, name);
- properties.add(new _debugger.NameValuePair({name: name, value: value}));
- }
- }
- return properties.toList();
+ let type = dart.getType(object);
+ let ret = LinkedHashSetOfNameValuePair().new();
+ let properties = SetOfNameValuePair().new();
+ _debugger.addPropertiesFromSignature(dart.getFieldSig(type), properties, object, true);
+ _debugger.addPropertiesFromSignature(dart.getGetterSig(type), properties, object, true);
+ ret.addAll(_debugger.sortProperties(properties));
+ _debugger.addMetadataChildren(object, ret);
+ return ret.toList();
}
};
dart.setSignature(_debugger.ObjectFormatter, {
@@ -3639,28 +3708,16 @@
children: dart.definiteFunctionType(core.List$(_debugger.NameValuePair), [dart.dynamic])
})
});
-dart.defineLazy(_debugger.ObjectFormatter, {
- get _customNames() {
- return (() => {
- let _ = SetOfString().new();
- _.add('constructor');
- _.add('prototype');
- _.add('__proto__');
- return _;
- })();
- },
- set _customNames(_) {}
-});
_debugger.LibraryModuleFormatter = class LibraryModuleFormatter extends core.Object {
accept(object, config) {
- return dart.getDartLibraryName(object) != null;
+ return dart.getModuleName(object) != null;
}
hasChildren(object) {
return true;
}
preview(object) {
- let libraryNames = dart.dsend(dart.getDartLibraryName(object), 'split', '/');
- if (dart.test(dart.dsend(dart.dload(libraryNames, 'length'), '>', 1))) {
+ let libraryNames = dart.dsend(dart.getModuleName(object), 'split', '/');
+ if (dart.test(dart.dsend(dart.dload(libraryNames, 'length'), '>', 1)) && dart.equals(dart.dload(libraryNames, 'last'), dart.dindex(libraryNames, dart.dsend(dart.dload(libraryNames, 'length'), '-', 2)))) {
dart.dsetindex(libraryNames, dart.dsend(dart.dload(libraryNames, 'length'), '-', 1), '');
}
return dart.str`Library Module: ${dart.dsend(libraryNames, 'join', '/')}`;
@@ -3669,7 +3726,6 @@
let children = LinkedHashSetOfNameValuePair().new();
for (let name of _debugger.getOwnPropertyNames(object)) {
let value = _debugger.safeGetProperty(object, name);
- name = dart.str`${name[dartx.replaceAll]("__", "/")}.dart`;
children.add(new _debugger.NameValuePair({name: name, value: new _debugger.Library(name, value), hideName: true}));
}
return children.toList();
@@ -3699,36 +3755,16 @@
}
children(object) {
let children = LinkedHashSetOfNameValuePair().new();
- let nonGenericProperties = LinkedHashMapOfString$Object().new();
let objectProperties = _debugger.safeProperties(dart.dload(object, 'object'));
dart.dsend(objectProperties, 'forEach', dart.fn((name, value) => {
- let genericTypeConstructor = dart.getGenericTypeCtor(value);
- if (genericTypeConstructor != null) {
- this.recordGenericParameters(core.String._check(name), genericTypeConstructor);
- } else {
- nonGenericProperties._set(core.String._check(name), value);
- }
+ if (dart.getGenericTypeCtor(value) != null) return;
+ children.add(_debugger.NameValuePair._check(dart.test(dart.isType(value)) ? this.classChild(core.String._check(name), value) : new _debugger.NameValuePair({name: core.String._check(name), value: value})));
}, dynamicAnddynamicToNull()));
- nonGenericProperties.forEach(dart.fn((name, value) => {
- if (core.Type.is(value)) {
- children.add(_debugger.NameValuePair._check(this.classChild(name, value)));
- } else {
- children.add(new _debugger.NameValuePair({name: name, value: value}));
- }
- }, StringAndObjectToNull()));
return children.toList();
}
- recordGenericParameters(name, genericTypeConstructor) {
- this.genericParameters._set(name, genericTypeConstructor.toString()[dartx.split](' =>')[dartx.first][dartx.replaceAll](core.RegExp.new('[(|)]'), ''));
- }
classChild(name, child) {
- let typeName = _debugger.getTypeName(core.Type._check(child));
- let parameterName = dart.str`${name}\$`;
- if (dart.test(this.genericParameters.keys[dartx.contains](parameterName))) {
- typeName = dart.str`${typeName}<${this.genericParameters._get(parameterName)}>`;
- _debugger.JSNative.setProperty(child, 'genericTypeName', typeName);
- }
- return new _debugger.NameValuePair({name: typeName, value: child});
+ let typeName = _debugger.getTypeName(child);
+ return new _debugger.NameValuePair({name: typeName, value: child, config: _debugger.JsonMLConfig.asClass});
}
};
_debugger.LibraryFormatter[dart.implements] = () => [_debugger.Formatter];
@@ -3739,7 +3775,6 @@
hasChildren: dart.definiteFunctionType(core.bool, [dart.dynamic]),
preview: dart.definiteFunctionType(core.String, [dart.dynamic]),
children: dart.definiteFunctionType(core.List$(_debugger.NameValuePair), [dart.dynamic]),
- recordGenericParameters: dart.definiteFunctionType(dart.dynamic, [core.String, core.Object]),
classChild: dart.definiteFunctionType(dart.dynamic, [core.String, core.Object])
})
});
@@ -3956,60 +3991,49 @@
});
_debugger.ClassFormatter = class ClassFormatter extends core.Object {
accept(object, config) {
- return core.Type.is(object) || dart.equals(config, _debugger.JsonMLConfig.asClass);
+ return dart.equals(config, _debugger.JsonMLConfig.asClass);
}
- preview(object) {
- let typeName = _debugger.safeGetProperty(object, 'genericTypeName');
- if (typeName != null) return core.String._check(typeName);
- let type = _debugger._getType(object);
+ preview(type) {
let implements$ = dart.getImplements(type);
- typeName = _debugger.getTypeName(core.Type._check(type));
+ let typeName = _debugger.getTypeName(type);
if (implements$ != null) {
let typeNames = dart.dsend(dart.dcall(implements$), 'map', _debugger.getTypeName);
return dart.str`${typeName} implements ${dart.dsend(typeNames, 'join', ", ")}`;
} else {
- return core.String._check(typeName);
+ return typeName;
}
}
hasChildren(object) {
return true;
}
- children(object) {
- let type = _debugger._getType(object);
- let children = JSArrayOfNameValuePair().of([]);
- let typeName = _debugger.getTypeName(core.Type._check(_debugger._getType(object)));
+ children(type) {
+ let ret = LinkedHashSetOfNameValuePair().new();
+ let staticProperties = SetOfNameValuePair().new();
+ let staticMethods = SetOfNameValuePair().new();
+ _debugger.addPropertiesFromSignature(dart.getStaticFieldSig(type), staticProperties, type, false);
+ _debugger.addPropertiesFromSignature(dart.getStaticGetterSig(type), staticProperties, type, false);
+ _debugger.addPropertiesFromSignature(dart.getStaticSig(type), staticMethods, type, false);
+ if (dart.test(staticProperties.isNotEmpty) || dart.test(staticMethods.isNotEmpty)) {
+ ret.add(new _debugger.NameValuePair({value: '[[Static members]]', hideName: true}));
+ ret.addAll(_debugger.sortProperties(staticProperties));
+ ret.addAll(_debugger.sortProperties(staticMethods));
+ }
+ let instanceMethods = SetOfNameValuePair().new();
+ _debugger.addPropertiesFromSignature(dart.getMethodSig(type), instanceMethods, type.prototype, false, {tagTypes: true});
+ if (dart.test(instanceMethods.isNotEmpty)) {
+ ret.add(new _debugger.NameValuePair({value: '[[Instance Methods]]', hideName: true}));
+ ret.addAll(_debugger.sortProperties(instanceMethods));
+ }
+ let typeName = _debugger.getTypeName(type);
let mixins = dart.getMixins(type);
if (mixins != null && dart.test(dart.dload(mixins, 'isNotEmpty'))) {
- children[dartx.add](new _debugger.NameValuePair({name: '[[Mixins]]', value: new _debugger.HeritageClause('mixins', core.List._check(mixins))}));
+ ret.add(new _debugger.NameValuePair({name: '[[Mixins]]', value: new _debugger.HeritageClause('mixins', core.List._check(mixins))}));
}
- let hiddenProperties = JSArrayOfString().of(['length', 'name', 'prototype', 'genericTypeName']);
- for (let name of _debugger.getOwnPropertyNames(object)) {
- if (dart.test(hiddenProperties[dartx.contains](name))) continue;
- let value = _debugger.safeGetProperty(object, name);
- if (value != null && dart.getIsNamedConstructor(value) != null) {
- value = new _debugger.NamedConstructor(value);
- name = dart.str`${typeName}.${name}`;
- }
- children[dartx.add](new _debugger.NameValuePair({name: name, value: value}));
+ let baseProto = type.__proto__;
+ if (baseProto != null && !dart.test(dart.isJsInterop(baseProto))) {
+ ret.add(new _debugger.NameValuePair({name: "[[base class]]", value: baseProto, config: _debugger.JsonMLConfig.asClass}));
}
- let hiddenPrototypeProperties = JSArrayOfString().of(['constructor', 'new', '$identityHash']);
- let prototype = object.prototype;
- if (prototype != null) {
- for (let name of _debugger.getOwnPropertyNames(prototype)) {
- if (dart.test(hiddenPrototypeProperties[dartx.contains](name))) continue;
- let func = _debugger.safeGetProperty(prototype, name);
- let constructor = _debugger.safeGetProperty(prototype, 'constructor');
- let sigObj = dart.getMethodSig(constructor);
- if (sigObj != null) {
- let value = _debugger.safeGetProperty(sigObj, name);
- if (_debugger.getTypeName(core.Type._check(dart.getReifiedType(value))) != 'Null') {
- dart.tag(func, value);
- children[dartx.add](new _debugger.NameValuePair({name: name, value: func}));
- }
- }
- }
- }
- return children;
+ return ret.toList();
}
};
_debugger.ClassFormatter[dart.implements] = () => [_debugger.Formatter];
@@ -4021,11 +4045,42 @@
children: dart.definiteFunctionType(core.List$(_debugger.NameValuePair), [dart.dynamic])
})
});
+_debugger.TypeFormatter = class TypeFormatter extends core.Object {
+ accept(object, config) {
+ return core.Type.is(object);
+ }
+ preview(object) {
+ return dart.toString(object);
+ }
+ hasChildren(object) {
+ return false;
+ }
+ children(object) {
+ return JSArrayOfNameValuePair().of([]);
+ }
+};
+_debugger.TypeFormatter[dart.implements] = () => [_debugger.Formatter];
+dart.setSignature(_debugger.TypeFormatter, {
+ methods: () => ({
+ accept: dart.definiteFunctionType(core.bool, [dart.dynamic, dart.dynamic]),
+ preview: dart.definiteFunctionType(core.String, [dart.dynamic]),
+ hasChildren: dart.definiteFunctionType(core.bool, [dart.dynamic]),
+ children: dart.definiteFunctionType(core.List$(_debugger.NameValuePair), [dart.dynamic])
+ })
+});
_debugger.registerDevtoolsFormatter = function() {
let formatters = JSArrayOfJsonMLFormatter().of([_debugger._devtoolsFormatter]);
dart.global.devtoolsFormatters = formatters;
};
dart.fn(_debugger.registerDevtoolsFormatter, VoidTodynamic$());
+_debugger.getModuleNames = function() {
+ return dart.getModuleNames();
+};
+dart.fn(_debugger.getModuleNames, VoidTodynamic$());
+_debugger.getModuleLibraries = function(name) {
+ return dart.getModuleLibraries(name);
+};
+dart.lazyFn(_debugger.getModuleLibraries, () => StringTodynamic());
_foreign_helper.JS = function(typeDescription, codeTemplate, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11) {
if (arg0 === void 0) arg0 = null;
if (arg1 === void 0) arg1 = null;
@@ -4359,7 +4414,7 @@
IterableOfE()._check(iterable);
this[dartx.checkGrowable]('insertAll');
core.RangeError.checkValueInInterval(index, 0, this[dartx.length], "index");
- if (!_internal.EfficientLength.is(iterable)) {
+ if (!_internal.EfficientLengthIterable.is(iterable)) {
iterable = iterable[dartx.toList]();
}
let insertionLength = iterable[dartx.length];
@@ -4632,7 +4687,7 @@
IterableOfE()._check(replacement);
this[dartx.checkGrowable]('replace range');
core.RangeError.checkValidRange(start, end, this[dartx.length]);
- if (!_internal.EfficientLength.is(replacement)) {
+ if (!_internal.EfficientLengthIterable.is(replacement)) {
replacement = replacement[dartx.toList]();
}
let removeLength = dart.notNull(end) - dart.notNull(start);
@@ -6347,21 +6402,20 @@
this[_filter](test, true);
}
[_filter](test, retainMatching) {
- let source = this;
let retained = JSArrayOfE().of([]);
- let length = source[dartx.length];
+ let length = this[dartx.length];
for (let i = 0; i < dart.notNull(length); i++) {
- let element = source[dartx._get](i);
+ let element = this[dartx._get](i);
if (dart.dcall(test, element) == retainMatching) {
retained[dartx.add](element);
}
- if (length != source[dartx.length]) {
- dart.throw(new core.ConcurrentModificationError(source));
+ if (length != this[dartx.length]) {
+ dart.throw(new core.ConcurrentModificationError(this));
}
}
- if (retained[dartx.length] != source[dartx.length]) {
- source[dartx.setRange](0, retained[dartx.length], retained);
- source[dartx.length] = retained[dartx.length];
+ if (retained[dartx.length] != this[dartx.length]) {
+ this[dartx.setRange](0, retained[dartx.length], retained);
+ this[dartx.length] = retained[dartx.length];
}
}
clear() {
@@ -6377,11 +6431,10 @@
}
sort(compare) {
if (compare === void 0) compare = null;
- if (compare == null) {
- _internal.Sort.sort(E)(this, dart.fn((a, b) => core.Comparable.compare(core.Comparable._check(a), core.Comparable._check(b)), dynamicAnddynamicToint()));
- } else {
- _internal.Sort.sort(E)(this, compare);
- }
+ _internal.Sort.sort(E)(this, (compare != null ? compare : collection.ListMixin._compareAny));
+ }
+ static _compareAny(a, b) {
+ return core.Comparable.compare(core.Comparable._check(a), core.Comparable._check(b));
}
shuffle(random) {
if (random === void 0) random = null;
@@ -6461,7 +6514,7 @@
replaceRange(start, end, newContents) {
IterableOfE()._check(newContents);
core.RangeError.checkValidRange(start, end, this[dartx.length]);
- if (!_internal.EfficientLength.is(newContents)) {
+ if (!_internal.EfficientLengthIterable.is(newContents)) {
newContents = newContents[dartx.toList]();
}
let removeLength = dart.notNull(end) - dart.notNull(start);
@@ -6539,7 +6592,7 @@
insertAll(index, iterable) {
IterableOfE()._check(iterable);
core.RangeError.checkValueInInterval(index, 0, this[dartx.length], "index");
- if (!_internal.EfficientLength.is(iterable) || core.identical(iterable, this)) {
+ if (!_internal.EfficientLengthIterable.is(iterable) || core.identical(iterable, this)) {
iterable = iterable[dartx.toList]();
}
let insertionLength = iterable[dartx.length];
@@ -6628,7 +6681,9 @@
removeAt: dart.definiteFunctionType(E, [core.int]),
insertAll: dart.definiteFunctionType(dart.void, [core.int, IterableOfE()]),
setAll: dart.definiteFunctionType(dart.void, [core.int, IterableOfE()])
- })
+ }),
+ statics: () => ({_compareAny: dart.definiteFunctionType(core.int, [dart.dynamic, dart.dynamic])}),
+ names: ['_compareAny']
});
dart.defineExtensionMembers(ListMixin, [
'elementAt',
@@ -6887,7 +6942,66 @@
names: ['stringOf']
});
dart.defineExtensionMembers(_internal.CodeUnits, ['_get', 'length']);
-_internal.EfficientLength = class EfficientLength extends core.Object {};
+_internal.ExternalName = class ExternalName extends core.Object {
+ new(name) {
+ this.name = name;
+ }
+};
+dart.setSignature(_internal.ExternalName, {
+ fields: () => ({name: core.String})
+});
+_internal.hexDigitValue = function(char) {
+ dart.assert(dart.notNull(char) >= 0 && dart.notNull(char) <= 65535);
+ let digit0 = 48;
+ let a = 97;
+ let f = 102;
+ let digit = (dart.notNull(char) ^ digit0) >>> 0;
+ if (digit <= 9) return digit;
+ let letter = (dart.notNull(char) | 32) >>> 0;
+ if (a <= letter && letter <= f) return letter - (a - 10);
+ return -1;
+};
+dart.fn(_internal.hexDigitValue, intToint());
+_internal.parseHexByte = function(source, index) {
+ dart.assert(dart.notNull(index) + 2 <= dart.notNull(source[dartx.length]));
+ let digit1 = _internal.hexDigitValue(source[dartx.codeUnitAt](index));
+ let digit2 = _internal.hexDigitValue(source[dartx.codeUnitAt](dart.notNull(index) + 1));
+ return dart.notNull(digit1) * 16 + dart.notNull(digit2) - (dart.notNull(digit2) & 256);
+};
+dart.lazyFn(_internal.parseHexByte, () => StringAndintToint());
+const _name$ = Symbol('_name');
+const _nativeSymbol = Symbol('_nativeSymbol');
+_internal.PrivateSymbol = class PrivateSymbol extends core.Object {
+ new(name, nativeSymbol) {
+ this[_name$] = name;
+ this[_nativeSymbol] = nativeSymbol;
+ }
+ static getName(symbol) {
+ return _internal.PrivateSymbol.as(symbol)[_name$];
+ }
+ static getNativeSymbol(symbol) {
+ if (_internal.PrivateSymbol.is(symbol)) return symbol[_nativeSymbol];
+ return null;
+ }
+ ['=='](other) {
+ return _internal.PrivateSymbol.is(other) && core.identical(this[_nativeSymbol], other[_nativeSymbol]);
+ }
+ toString() {
+ return dart.str`Symbol("${this[_name$]}")`;
+ }
+};
+_internal.PrivateSymbol[dart.implements] = () => [core.Symbol];
+dart.setSignature(_internal.PrivateSymbol, {
+ fields: () => ({
+ [_name$]: core.String,
+ [_nativeSymbol]: core.Object
+ }),
+ statics: () => ({
+ getName: dart.definiteFunctionType(core.String, [core.Symbol]),
+ getNativeSymbol: dart.definiteFunctionType(core.Object, [core.Symbol])
+ }),
+ names: ['getName', 'getNativeSymbol']
+});
core.Iterable$ = dart.generic(E => {
let EmptyIterableOfE = () => (EmptyIterableOfE = dart.constFn(_internal.EmptyIterable$(E)))();
let _GeneratorIterableOfE = () => (_GeneratorIterableOfE = dart.constFn(core._GeneratorIterable$(E)))();
@@ -7026,7 +7140,7 @@
return SetOfE().from(this);
}
get length() {
- dart.assert(!_internal.EfficientLength.is(this));
+ dart.assert(!_internal.EfficientLengthIterable.is(this));
let count = 0;
let it = this[dartx.iterator];
while (dart.test(it.moveNext())) {
@@ -7195,6 +7309,15 @@
return Iterable;
});
core.Iterable = Iterable();
+_internal.EfficientLengthIterable$ = dart.generic(T => {
+ class EfficientLengthIterable extends core.Iterable$(T) {
+ new() {
+ super.new();
+ }
+ }
+ return EfficientLengthIterable;
+});
+_internal.EfficientLengthIterable = EfficientLengthIterable();
_internal.ListIterable$ = dart.generic(E => {
let ListIteratorOfE = () => (ListIteratorOfE = dart.constFn(_internal.ListIterator$(E)))();
let VoidToE = () => (VoidToE = dart.constFn(dart.functionType(E, [])))();
@@ -7204,7 +7327,7 @@
let SetOfE = () => (SetOfE = dart.constFn(core.Set$(E)))();
let ETovoid = () => (ETovoid = dart.constFn(dart.functionType(dart.void, [E])))();
let ETobool = () => (ETobool = dart.constFn(dart.functionType(core.bool, [E])))();
- class ListIterable extends core.Iterable$(E) {
+ class ListIterable extends _internal.EfficientLengthIterable$(E) {
new() {
super.new();
}
@@ -7411,7 +7534,6 @@
return result;
}
}
- ListIterable[dart.implements] = () => [_internal.EfficientLength];
dart.setSignature(ListIterable, {
getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])}),
methods: () => ({reduce: dart.definiteFunctionType(E, [dynamicAndEToE()])})
@@ -7610,7 +7732,7 @@
let _TransformationOfS$T = () => (_TransformationOfS$T = dart.constFn(_internal._Transformation$(S, T)))();
class MappedIterable extends core.Iterable$(T) {
static new(iterable, func) {
- if (_internal.EfficientLength.is(iterable)) {
+ if (_internal.EfficientLengthIterable.is(iterable)) {
return new (EfficientLengthMappedIterableOfS$T())(iterable, func);
}
return new (MappedIterableOfS$T())._(iterable, func);
@@ -7663,12 +7785,13 @@
});
_internal.MappedIterable = MappedIterable();
_internal.EfficientLengthMappedIterable$ = dart.generic((S, T) => {
+ let EfficientLengthIterableOfT = () => (EfficientLengthIterableOfT = dart.constFn(_internal.EfficientLengthIterable$(T)))();
class EfficientLengthMappedIterable extends _internal.MappedIterable$(S, T) {
new(iterable, func) {
super._(iterable, func);
}
}
- EfficientLengthMappedIterable[dart.implements] = () => [_internal.EfficientLength];
+ EfficientLengthMappedIterable[dart.implements] = () => [EfficientLengthIterableOfT()];
return EfficientLengthMappedIterable;
});
_internal.EfficientLengthMappedIterable = EfficientLengthMappedIterable();
@@ -7729,7 +7852,6 @@
return this[_f](this[_source][dartx.elementAt](index));
}
}
- MappedListIterable[dart.implements] = () => [_internal.EfficientLength];
dart.setSignature(MappedListIterable, {
fields: () => ({
[_source]: IterableOfS(),
@@ -7758,6 +7880,11 @@
get iterator() {
return new (WhereIteratorOfE())(this[_iterable$][dartx.iterator], this[_f]);
}
+ map(T) {
+ return f => {
+ return new (_internal.MappedIterable$(E, T))._(this, f);
+ };
+ }
}
dart.setSignature(WhereIterable, {
fields: () => ({
@@ -7766,13 +7893,12 @@
}),
getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])})
});
- dart.defineExtensionMembers(WhereIterable, ['iterator']);
+ dart.defineExtensionMembers(WhereIterable, ['map', 'iterator']);
return WhereIterable;
});
_internal.WhereIterable = WhereIterable();
_internal.WhereIterator$ = dart.generic(E => {
let IteratorOfE = () => (IteratorOfE = dart.constFn(core.Iterator$(E)))();
- let _ElementPredicateOfE = () => (_ElementPredicateOfE = dart.constFn(_internal._ElementPredicate$(E)))();
class WhereIterator extends core.Iterator$(E) {
new(iterator, f) {
this[_iterator] = iterator;
@@ -7780,7 +7906,7 @@
}
moveNext() {
while (dart.test(this[_iterator].moveNext())) {
- if (dart.test(this[_f](this[_iterator].current))) {
+ if (dart.test(dart.dcall(this[_f], this[_iterator].current))) {
return true;
}
}
@@ -7793,7 +7919,7 @@
dart.setSignature(WhereIterator, {
fields: () => ({
[_iterator]: IteratorOfE(),
- [_f]: _ElementPredicateOfE()
+ [_f]: _internal._ElementPredicate
}),
getters: () => ({current: dart.definiteFunctionType(E, [])}),
methods: () => ({moveNext: dart.definiteFunctionType(core.bool, [])})
@@ -7888,7 +8014,7 @@
if (!(typeof takeCount == 'number') || dart.notNull(takeCount) < 0) {
dart.throw(new core.ArgumentError(takeCount));
}
- if (_internal.EfficientLength.is(iterable)) {
+ if (_internal.EfficientLengthIterable.is(iterable)) {
return new (EfficientLengthTakeIterableOfE())(iterable, takeCount);
}
return new (TakeIterableOfE())._(iterable, takeCount);
@@ -7915,6 +8041,7 @@
});
_internal.TakeIterable = TakeIterable();
_internal.EfficientLengthTakeIterable$ = dart.generic(E => {
+ let EfficientLengthIterableOfE = () => (EfficientLengthIterableOfE = dart.constFn(_internal.EfficientLengthIterable$(E)))();
class EfficientLengthTakeIterable extends _internal.TakeIterable$(E) {
new(iterable, takeCount) {
super._(iterable, takeCount);
@@ -7925,7 +8052,7 @@
return iterableLength;
}
}
- EfficientLengthTakeIterable[dart.implements] = () => [_internal.EfficientLength];
+ EfficientLengthTakeIterable[dart.implements] = () => [EfficientLengthIterableOfE()];
dart.setSignature(EfficientLengthTakeIterable, {});
dart.defineExtensionMembers(EfficientLengthTakeIterable, ['length']);
return EfficientLengthTakeIterable;
@@ -8032,7 +8159,7 @@
let IterableOfE = () => (IterableOfE = dart.constFn(core.Iterable$(E)))();
class SkipIterable extends core.Iterable$(E) {
static new(iterable, count) {
- if (_internal.EfficientLength.is(iterable)) {
+ if (_internal.EfficientLengthIterable.is(iterable)) {
return new (EfficientLengthSkipIterableOfE())(iterable, count);
}
return new (SkipIterableOfE())._(iterable, count);
@@ -8070,6 +8197,7 @@
});
_internal.SkipIterable = SkipIterable();
_internal.EfficientLengthSkipIterable$ = dart.generic(E => {
+ let EfficientLengthIterableOfE = () => (EfficientLengthIterableOfE = dart.constFn(_internal.EfficientLengthIterable$(E)))();
class EfficientLengthSkipIterable extends _internal.SkipIterable$(E) {
new(iterable, skipCount) {
super._(iterable, skipCount);
@@ -8080,7 +8208,7 @@
return 0;
}
}
- EfficientLengthSkipIterable[dart.implements] = () => [_internal.EfficientLength];
+ EfficientLengthSkipIterable[dart.implements] = () => [EfficientLengthIterableOfE()];
dart.setSignature(EfficientLengthSkipIterable, {});
dart.defineExtensionMembers(EfficientLengthSkipIterable, ['length']);
return EfficientLengthSkipIterable;
@@ -8184,7 +8312,7 @@
let SetOfE = () => (SetOfE = dart.constFn(core.Set$(E)))();
let ETovoid = () => (ETovoid = dart.constFn(dart.functionType(dart.void, [E])))();
let ETobool = () => (ETobool = dart.constFn(dart.functionType(core.bool, [E])))();
- class EmptyIterable extends core.Iterable$(E) {
+ class EmptyIterable extends _internal.EfficientLengthIterable$(E) {
new() {
super.new();
}
@@ -8280,7 +8408,6 @@
return SetOfE().new();
}
}
- EmptyIterable[dart.implements] = () => [_internal.EfficientLength];
dart.setSignature(EmptyIterable, {
getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])}),
methods: () => ({singleWhere: dart.definiteFunctionType(E, [ETobool()], {orElse: VoidToE()})})
@@ -8669,79 +8796,6 @@
};
};
dart.lazyFn(_internal.makeFixedListUnmodifiable, () => ListOfEToListOfE());
-_internal.Lists = class Lists extends core.Object {
- static copy(src, srcStart, dst, dstStart, count) {
- if (dart.notNull(srcStart) < dart.notNull(dstStart)) {
- for (let i = dart.notNull(srcStart) + dart.notNull(count) - 1, j = dart.notNull(dstStart) + dart.notNull(count) - 1; i >= dart.notNull(srcStart); i--, j--) {
- dst[dartx._set](j, src[dartx._get](i));
- }
- } else {
- for (let i = srcStart, j = dstStart; dart.notNull(i) < dart.notNull(srcStart) + dart.notNull(count); i = dart.notNull(i) + 1, j = dart.notNull(j) + 1) {
- dst[dartx._set](j, src[dartx._get](i));
- }
- }
- }
- static areEqual(a, b) {
- if (core.identical(a, b)) return true;
- if (!core.List.is(b)) return false;
- let length = a[dartx.length];
- if (!dart.equals(length, dart.dload(b, 'length'))) return false;
- for (let i = 0; i < dart.notNull(length); i++) {
- if (!core.identical(a[dartx._get](i), dart.dindex(b, i))) return false;
- }
- return true;
- }
- static indexOf(a, element, startIndex, endIndex) {
- if (dart.notNull(startIndex) >= dart.notNull(a[dartx.length])) {
- return -1;
- }
- if (dart.notNull(startIndex) < 0) {
- startIndex = 0;
- }
- for (let i = startIndex; dart.notNull(i) < dart.notNull(endIndex); i = dart.notNull(i) + 1) {
- if (dart.equals(a[dartx._get](i), element)) {
- return i;
- }
- }
- return -1;
- }
- static lastIndexOf(a, element, startIndex) {
- if (dart.notNull(startIndex) < 0) {
- return -1;
- }
- if (dart.notNull(startIndex) >= dart.notNull(a[dartx.length])) {
- startIndex = dart.notNull(a[dartx.length]) - 1;
- }
- for (let i = startIndex; dart.notNull(i) >= 0; i = dart.notNull(i) - 1) {
- if (dart.equals(a[dartx._get](i), element)) {
- return i;
- }
- }
- return -1;
- }
- static indicesCheck(a, start, end) {
- core.RangeError.checkValidRange(start, end, a[dartx.length]);
- }
- static rangeCheck(a, start, length) {
- core.RangeError.checkNotNegative(length);
- core.RangeError.checkNotNegative(start);
- if (dart.notNull(start) + dart.notNull(length) > dart.notNull(a[dartx.length])) {
- let message = dart.str`${start} + ${length} must be in the range [0..${a[dartx.length]}]`;
- dart.throw(new core.RangeError.range(length, 0, dart.notNull(a[dartx.length]) - dart.notNull(start), "length", message));
- }
- }
-};
-dart.setSignature(_internal.Lists, {
- statics: () => ({
- copy: dart.definiteFunctionType(dart.void, [core.List, core.int, core.List, core.int, core.int]),
- areEqual: dart.definiteFunctionType(core.bool, [core.List, dart.dynamic]),
- indexOf: dart.definiteFunctionType(core.int, [core.List, core.Object, core.int, core.int]),
- lastIndexOf: dart.definiteFunctionType(core.int, [core.List, core.Object, core.int]),
- indicesCheck: dart.definiteFunctionType(dart.void, [core.List, core.int, core.int]),
- rangeCheck: dart.definiteFunctionType(dart.void, [core.List, core.int, core.int])
- }),
- names: ['copy', 'areEqual', 'indexOf', 'lastIndexOf', 'indicesCheck', 'rangeCheck']
-});
_internal.printToZone = null;
_internal.printToConsole = function(line) {
_js_primitives.printString(dart.str`${line}`);
@@ -8987,27 +9041,18 @@
names: ['sort', 'sortRange', '_doSort', '_insertionSort', '_dualPivotQuicksort']
});
_internal.Sort._INSERTION_SORT_THRESHOLD = 32;
-const _name$ = Symbol('_name');
-const _nativeSymbol = Symbol('_nativeSymbol');
_internal.Symbol = class Symbol extends core.Object {
new(name) {
this[_name$] = name;
- this[_nativeSymbol] = null;
- }
- es6(name, nativeSymbol) {
- this[_name$] = name;
- this[_nativeSymbol] = nativeSymbol;
}
unvalidated(name) {
this[_name$] = name;
- this[_nativeSymbol] = null;
}
validated(name) {
this[_name$] = _internal.Symbol.validatePublicSymbol(name);
- this[_nativeSymbol] = null;
}
['=='](other) {
- return _internal.Symbol.is(other) && this[_name$] == other[_name$] && dart.equals(this[_nativeSymbol], other[_nativeSymbol]);
+ return _internal.Symbol.is(other) && this[_name$] == other[_name$];
}
get hashCode() {
let hash = this._hashCode;
@@ -9023,9 +9068,6 @@
static getName(symbol) {
return symbol[_name$];
}
- static getNativeSymbol(symbol) {
- return symbol[_nativeSymbol];
- }
static validatePublicSymbol(name) {
if (dart.test(name[dartx.isEmpty]) || dart.test(_internal.Symbol.publicSymbolPattern.hasMatch(name))) return name;
if (dart.test(name[dartx.startsWith]('_'))) {
@@ -9037,23 +9079,17 @@
return dart.test(name[dartx.isEmpty]) || dart.test(_internal.Symbol.symbolPattern.hasMatch(name));
}
};
-dart.defineNamedConstructor(_internal.Symbol, 'es6');
dart.defineNamedConstructor(_internal.Symbol, 'unvalidated');
dart.defineNamedConstructor(_internal.Symbol, 'validated');
_internal.Symbol[dart.implements] = () => [core.Symbol];
dart.setSignature(_internal.Symbol, {
- fields: () => ({
- [_name$]: core.String,
- [_nativeSymbol]: dart.dynamic
- }),
- methods: () => ({'==': dart.definiteFunctionType(core.bool, [core.Object])}),
+ fields: () => ({[_name$]: core.String}),
statics: () => ({
getName: dart.definiteFunctionType(core.String, [_internal.Symbol]),
- getNativeSymbol: dart.definiteFunctionType(dart.dynamic, [_internal.Symbol]),
validatePublicSymbol: dart.definiteFunctionType(core.String, [core.String]),
isValidSymbol: dart.definiteFunctionType(core.bool, [core.String])
}),
- names: ['getName', 'getNativeSymbol', 'validatePublicSymbol', 'isValidSymbol']
+ names: ['getName', 'validatePublicSymbol', 'isValidSymbol']
});
_internal.Symbol.reservedWordRE = '(?:assert|break|c(?:a(?:se|tch)|lass|on(?:st|tinue))|d(?:efault|o)|' + 'e(?:lse|num|xtends)|f(?:alse|inal(?:ly)?|or)|i[fns]|n(?:ew|ull)|' + 'ret(?:hrow|urn)|s(?:uper|witch)|t(?:h(?:is|row)|r(?:ue|y))|' + 'v(?:ar|oid)|w(?:hile|ith))';
_internal.Symbol.operatorRE = '(?:[\\-+*/%&|^]|\\[\\]=?|==|~/?|<[<=]?|>[>=]?|unary-)';
@@ -9236,8 +9272,8 @@
this.weakPorts = SetOfint().new();
this.isolateStatics = _foreign_helper.JS_CREATE_ISOLATE();
this.controlPort = new _isolate_helper.RawReceivePortImpl._controlPort();
- this.pauseCapability = isolate.Capability.new();
- this.terminateCapability = isolate.Capability.new();
+ this.pauseCapability = isolate$.Capability.new();
+ this.terminateCapability = isolate$.Capability.new();
this.delayedEvents = JSArrayOf_IsolateEvent().of([]);
this.pauseTokens = SetOfCapability().new();
this.errorPorts = SetOfSendPort().new();
@@ -9284,7 +9320,7 @@
this.errorsAreFatal = errorsAreFatal;
}
handlePing(responsePort, pingType) {
- if (pingType == isolate.Isolate.IMMEDIATE || pingType == isolate.Isolate.BEFORE_NEXT_EVENT && !dart.test(this[_isExecutingEvent])) {
+ if (pingType == isolate$.Isolate.IMMEDIATE || pingType == isolate$.Isolate.BEFORE_NEXT_EVENT && !dart.test(this[_isExecutingEvent])) {
responsePort.send(null);
return;
}
@@ -9292,11 +9328,7 @@
responsePort.send(null);
}
dart.fn(respond, VoidTovoid$());
- if (pingType == isolate.Isolate.AS_EVENT) {
- _isolate_helper._globalState.topEventLoop.enqueue(this, respond, "ping");
- return;
- }
- dart.assert(pingType == isolate.Isolate.BEFORE_NEXT_EVENT);
+ dart.assert(pingType == isolate$.Isolate.BEFORE_NEXT_EVENT);
if (this[_scheduledControlEvents] == null) {
this[_scheduledControlEvents] = collection.Queue.new();
}
@@ -9304,15 +9336,11 @@
}
handleKill(authentification, priority) {
if (!dart.equals(this.terminateCapability, authentification)) return;
- if (priority == isolate.Isolate.IMMEDIATE || priority == isolate.Isolate.BEFORE_NEXT_EVENT && !dart.test(this[_isExecutingEvent])) {
+ if (priority == isolate$.Isolate.IMMEDIATE || priority == isolate$.Isolate.BEFORE_NEXT_EVENT && !dart.test(this[_isExecutingEvent])) {
this.kill();
return;
}
- if (priority == isolate.Isolate.AS_EVENT) {
- _isolate_helper._globalState.topEventLoop.enqueue(this, dart.bind(this, 'kill'), "kill");
- return;
- }
- dart.assert(priority == isolate.Isolate.BEFORE_NEXT_EVENT);
+ dart.assert(priority == isolate$.Isolate.BEFORE_NEXT_EVENT);
if (this[_scheduledControlEvents] == null) {
this[_scheduledControlEvents] = collection.Queue.new();
}
@@ -9380,47 +9408,47 @@
switch (dart.dindex(message, 0)) {
case "pause":
{
- this.addPause(isolate.Capability._check(dart.dindex(message, 1)), isolate.Capability._check(dart.dindex(message, 2)));
+ this.addPause(isolate$.Capability._check(dart.dindex(message, 1)), isolate$.Capability._check(dart.dindex(message, 2)));
break;
}
case "resume":
{
- this.removePause(isolate.Capability._check(dart.dindex(message, 1)));
+ this.removePause(isolate$.Capability._check(dart.dindex(message, 1)));
break;
}
case 'add-ondone':
{
- this.addDoneListener(isolate.SendPort._check(dart.dindex(message, 1)));
+ this.addDoneListener(isolate$.SendPort._check(dart.dindex(message, 1)));
break;
}
case 'remove-ondone':
{
- this.removeDoneListener(isolate.SendPort._check(dart.dindex(message, 1)));
+ this.removeDoneListener(isolate$.SendPort._check(dart.dindex(message, 1)));
break;
}
case 'set-errors-fatal':
{
- this.setErrorsFatal(isolate.Capability._check(dart.dindex(message, 1)), core.bool._check(dart.dindex(message, 2)));
+ this.setErrorsFatal(isolate$.Capability._check(dart.dindex(message, 1)), core.bool._check(dart.dindex(message, 2)));
break;
}
case "ping":
{
- this.handlePing(isolate.SendPort._check(dart.dindex(message, 1)), core.int._check(dart.dindex(message, 2)));
+ this.handlePing(isolate$.SendPort._check(dart.dindex(message, 1)), core.int._check(dart.dindex(message, 2)));
break;
}
case "kill":
{
- this.handleKill(isolate.Capability._check(dart.dindex(message, 1)), core.int._check(dart.dindex(message, 2)));
+ this.handleKill(isolate$.Capability._check(dart.dindex(message, 1)), core.int._check(dart.dindex(message, 2)));
break;
}
case "getErrors":
{
- this.addErrorListener(isolate.SendPort._check(dart.dindex(message, 1)));
+ this.addErrorListener(isolate$.SendPort._check(dart.dindex(message, 1)));
break;
}
case "stopErrors":
{
- this.removeErrorListener(isolate.SendPort._check(dart.dindex(message, 1)));
+ this.removeErrorListener(isolate$.SendPort._check(dart.dindex(message, 1)));
break;
}
default:
@@ -9463,7 +9491,7 @@
this.errorPorts.clear();
if (this.doneHandlers != null) {
for (let port of core.Iterable._check(this.doneHandlers)) {
- isolate.SendPort._check(port);
+ isolate$.SendPort._check(port);
port.send(null);
}
this.doneHandlers = null;
@@ -9483,8 +9511,8 @@
weakPorts: SetOfint(),
isolateStatics: dart.dynamic,
controlPort: _isolate_helper.RawReceivePortImpl,
- pauseCapability: isolate.Capability,
- terminateCapability: isolate.Capability,
+ pauseCapability: isolate$.Capability,
+ terminateCapability: isolate$.Capability,
initialized: core.bool,
isPaused: core.bool,
delayedEvents: ListOf_IsolateEvent(),
@@ -9496,15 +9524,15 @@
errorPorts: SetOfSendPort()
}),
methods: () => ({
- addPause: dart.definiteFunctionType(dart.void, [isolate.Capability, isolate.Capability]),
- removePause: dart.definiteFunctionType(dart.void, [isolate.Capability]),
- addDoneListener: dart.definiteFunctionType(dart.void, [isolate.SendPort]),
- removeDoneListener: dart.definiteFunctionType(dart.void, [isolate.SendPort]),
- setErrorsFatal: dart.definiteFunctionType(dart.void, [isolate.Capability, core.bool]),
- handlePing: dart.definiteFunctionType(dart.void, [isolate.SendPort, core.int]),
- handleKill: dart.definiteFunctionType(dart.void, [isolate.Capability, core.int]),
- addErrorListener: dart.definiteFunctionType(dart.void, [isolate.SendPort]),
- removeErrorListener: dart.definiteFunctionType(dart.void, [isolate.SendPort]),
+ addPause: dart.definiteFunctionType(dart.void, [isolate$.Capability, isolate$.Capability]),
+ removePause: dart.definiteFunctionType(dart.void, [isolate$.Capability]),
+ addDoneListener: dart.definiteFunctionType(dart.void, [isolate$.SendPort]),
+ removeDoneListener: dart.definiteFunctionType(dart.void, [isolate$.SendPort]),
+ setErrorsFatal: dart.definiteFunctionType(dart.void, [isolate$.Capability, core.bool]),
+ handlePing: dart.definiteFunctionType(dart.void, [isolate$.SendPort, core.int]),
+ handleKill: dart.definiteFunctionType(dart.void, [isolate$.Capability, core.int]),
+ addErrorListener: dart.definiteFunctionType(dart.void, [isolate$.SendPort]),
+ removeErrorListener: dart.definiteFunctionType(dart.void, [isolate$.SendPort]),
handleUncaughtError: dart.definiteFunctionType(dart.void, [dart.dynamic, core.StackTrace]),
eval: dart.definiteFunctionType(dart.dynamic, [core.Function]),
[_setGlobals]: dart.definiteFunctionType(dart.void, []),
@@ -9705,7 +9733,7 @@
let replyTo = _isolate_helper._deserializeMessage(dart.dindex(msg, 'replyTo'));
let context = new _isolate_helper._IsolateContext();
_isolate_helper._globalState.topEventLoop.enqueue(context, dart.fn(() => {
- _isolate_helper.IsolateNatives._startIsolate(entryPoint, ListOfString()._check(args), message, core.bool._check(isSpawnUri), core.bool._check(startPaused), isolate.SendPort._check(replyTo));
+ _isolate_helper.IsolateNatives._startIsolate(entryPoint, ListOfString()._check(args), message, core.bool._check(isSpawnUri), core.bool._check(startPaused), isolate$.SendPort._check(replyTo));
}, VoidToNull()), 'worker-start');
_isolate_helper._globalState.currentContext = context;
_isolate_helper._globalState.topEventLoop.run();
@@ -9718,7 +9746,7 @@
}
case 'message':
{
- let port = isolate.SendPort._check(dart.dindex(msg, 'port'));
+ let port = isolate$.SendPort._check(dart.dindex(msg, 'port'));
if (port != null) {
dart.dsend(dart.dindex(msg, 'port'), 'send', dart.dindex(msg, 'msg'));
}
@@ -9806,7 +9834,7 @@
if (uri != null && dart.test(uri[dartx.endsWith](".dart"))) {
uri = dart.notNull(uri) + ".js";
}
- let port = isolate.ReceivePort.new();
+ let port = isolate$.ReceivePort.new();
let completer = CompleterOfList().new();
port.first.then(dart.dynamic)(dart.fn(msg => {
if (dart.equals(dart.dindex(msg, 0), _isolate_helper._SPAWNED_SIGNAL)) {
@@ -9845,7 +9873,7 @@
}
static get currentIsolate() {
let context = _isolate_helper._IsolateContext._check(_foreign_helper.JS_CURRENT_ISOLATE_CONTEXT());
- return new isolate.Isolate(context.controlPort.sendPort, {pauseCapability: context.pauseCapability, terminateCapability: context.terminateCapability});
+ return new isolate$.Isolate(context.controlPort.sendPort, {pauseCapability: context.pauseCapability, terminateCapability: context.terminateCapability});
}
static _startIsolate(topLevel, args, message, isSpawnUri, startPaused, replyTo) {
let context = _isolate_helper._IsolateContext._check(_foreign_helper.JS_CURRENT_ISOLATE_CONTEXT());
@@ -9923,10 +9951,10 @@
spawnFunction: dart.definiteFunctionType(async.Future$(core.List), [dynamicTovoid(), dart.dynamic, core.bool]),
spawnUri: dart.definiteFunctionType(async.Future$(core.List), [core.Uri, ListOfString(), dart.dynamic, core.bool]),
spawn: dart.definiteFunctionType(async.Future$(core.List), [core.String, core.String, ListOfString(), dart.dynamic, core.bool, core.bool, core.bool]),
- _startWorker: dart.definiteFunctionType(dart.void, [core.String, core.String, ListOfString(), dart.dynamic, core.bool, core.bool, isolate.SendPort, StringTovoid()]),
- _startNonWorker: dart.definiteFunctionType(dart.void, [core.String, core.String, ListOfString(), dart.dynamic, core.bool, core.bool, isolate.SendPort]),
- _startIsolate: dart.definiteFunctionType(dart.void, [core.Function, ListOfString(), dart.dynamic, core.bool, core.bool, isolate.SendPort]),
- _spawnWorker: dart.definiteFunctionType(dart.void, [dart.dynamic, core.String, ListOfString(), dart.dynamic, core.bool, core.bool, isolate.SendPort, StringTovoid()]),
+ _startWorker: dart.definiteFunctionType(dart.void, [core.String, core.String, ListOfString(), dart.dynamic, core.bool, core.bool, isolate$.SendPort, StringTovoid()]),
+ _startNonWorker: dart.definiteFunctionType(dart.void, [core.String, core.String, ListOfString(), dart.dynamic, core.bool, core.bool, isolate$.SendPort]),
+ _startIsolate: dart.definiteFunctionType(dart.void, [core.Function, ListOfString(), dart.dynamic, core.bool, core.bool, isolate$.SendPort]),
+ _spawnWorker: dart.definiteFunctionType(dart.void, [dart.dynamic, core.String, ListOfString(), dart.dynamic, core.bool, core.bool, isolate$.SendPort, StringTovoid()]),
workerOnError: dart.definiteFunctionType(core.bool, [dart.dynamic, core.String, StringTovoid()])
}),
names: ['computeThisScript', 'computeThisScriptJsshell', 'computeThisScriptD8', 'computeThisScriptFromTrace', '_getEventData', '_processWorkerMessage', 'handleSpawnWorkerRequest', '_log', '_consoleLog', '_getJSFunctionFromName', '_getJSFunctionName', '_allocate', 'spawnFunction', 'spawnUri', 'spawn', '_startWorker', '_startNonWorker', '_startIsolate', '_spawnWorker', 'workerOnError']
@@ -9953,10 +9981,10 @@
}
}
};
-_isolate_helper._BaseSendPort[dart.implements] = () => [isolate.SendPort];
+_isolate_helper._BaseSendPort[dart.implements] = () => [isolate$.SendPort];
dart.setSignature(_isolate_helper._BaseSendPort, {
fields: () => ({[_isolateId]: core.int}),
- methods: () => ({[_checkReplyTo]: dart.definiteFunctionType(dart.void, [isolate.SendPort])})
+ methods: () => ({[_checkReplyTo]: dart.definiteFunctionType(dart.void, [isolate$.SendPort])})
});
const _receivePort = Symbol('_receivePort');
const _isClosed = Symbol('_isClosed');
@@ -9988,7 +10016,7 @@
return this[_receivePort][_id];
}
};
-_isolate_helper._NativeJsSendPort[dart.implements] = () => [isolate.SendPort];
+_isolate_helper._NativeJsSendPort[dart.implements] = () => [isolate$.SendPort];
dart.setSignature(_isolate_helper._NativeJsSendPort, {
fields: () => ({[_receivePort]: _isolate_helper.RawReceivePortImpl}),
methods: () => ({send: dart.definiteFunctionType(dart.void, [dart.dynamic])})
@@ -10019,7 +10047,7 @@
return (dart.notNull(this[_workerId]) << 16 ^ dart.notNull(this[_isolateId]) << 8 ^ dart.notNull(this[_receivePortId])) >>> 0;
}
};
-_isolate_helper._WorkerSendPort[dart.implements] = () => [isolate.SendPort];
+_isolate_helper._WorkerSendPort[dart.implements] = () => [isolate$.SendPort];
dart.setSignature(_isolate_helper._WorkerSendPort, {
fields: () => ({
[_workerId]: core.int,
@@ -10077,14 +10105,14 @@
};
dart.defineNamedConstructor(_isolate_helper.RawReceivePortImpl, 'weak');
dart.defineNamedConstructor(_isolate_helper.RawReceivePortImpl, '_controlPort');
-_isolate_helper.RawReceivePortImpl[dart.implements] = () => [isolate.RawReceivePort];
+_isolate_helper.RawReceivePortImpl[dart.implements] = () => [isolate$.RawReceivePort];
dart.setSignature(_isolate_helper.RawReceivePortImpl, {
fields: () => ({
[_id]: core.int,
[_handler]: core.Function,
[_isClosed]: core.bool
}),
- getters: () => ({sendPort: dart.definiteFunctionType(isolate.SendPort, [])}),
+ getters: () => ({sendPort: dart.definiteFunctionType(isolate$.SendPort, [])}),
setters: () => ({handler: dart.definiteFunctionType(dart.void, [core.Function])}),
methods: () => ({
[_close]: dart.definiteFunctionType(dart.void, []),
@@ -10230,7 +10258,8 @@
}, VoidToNull()), onCancel: dart.fn(() => {
if (timer != null) timer.cancel();
timer = null;
- }, VoidToNull())});
+ return async.Future._nullFuture;
+ }, VoidTo_Future())});
return controller.stream;
}
static eventTransformed(source, mapSink) {
@@ -10289,9 +10318,7 @@
subscription.pause();
}, VoidToNull()), onResume: dart.fn(() => {
subscription.resume();
- }, VoidToNull()), onCancel: dart.fn(() => {
- subscription.cancel();
- }, VoidToNull()), sync: true});
+ }, VoidToNull()), onCancel: dart.fn(() => subscription.cancel(), VoidToFuture()), sync: true});
}
return controller.stream;
};
@@ -10329,9 +10356,7 @@
subscription.pause();
}, VoidToNull()), onResume: dart.fn(() => {
subscription.resume();
- }, VoidToNull()), onCancel: dart.fn(() => {
- subscription.cancel();
- }, VoidToNull()), sync: true});
+ }, VoidToNull()), onCancel: dart.fn(() => subscription.cancel(), VoidToFuture()), sync: true});
}
return controller.stream;
};
@@ -10862,13 +10887,13 @@
dart.addSimpleTypeTests(_isolate_helper.ReceivePortImpl);
dart.defineNamedConstructor(_isolate_helper.ReceivePortImpl, 'weak');
dart.defineNamedConstructor(_isolate_helper.ReceivePortImpl, 'fromRawReceivePort');
-_isolate_helper.ReceivePortImpl[dart.implements] = () => [isolate.ReceivePort];
+_isolate_helper.ReceivePortImpl[dart.implements] = () => [isolate$.ReceivePort];
dart.setSignature(_isolate_helper.ReceivePortImpl, {
fields: () => ({
- [_rawPort]: isolate.RawReceivePort,
+ [_rawPort]: isolate$.RawReceivePort,
[_controller]: async.StreamController
}),
- getters: () => ({sendPort: dart.definiteFunctionType(isolate.SendPort, [])}),
+ getters: () => ({sendPort: dart.definiteFunctionType(isolate$.SendPort, [])}),
methods: () => ({
listen: dart.definiteFunctionType(async.StreamSubscription, [dynamicTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool}),
close: dart.definiteFunctionType(dart.void, [])
@@ -10981,7 +11006,7 @@
}
};
dart.defineNamedConstructor(_isolate_helper.CapabilityImpl, '_internal');
-_isolate_helper.CapabilityImpl[dart.implements] = () => [isolate.Capability];
+_isolate_helper.CapabilityImpl[dart.implements] = () => [isolate$.Capability];
dart.setSignature(_isolate_helper.CapabilityImpl, {
fields: () => ({[_id]: core.int}),
methods: () => ({'==': dart.definiteFunctionType(core.bool, [core.Object])})
@@ -11019,7 +11044,7 @@
if (_js_helper.InternalMap.is(x)) return this.serializeMap(x);
if (_interceptors.JSObject.is(x)) return this.serializeJSObject(x);
if (_interceptors.Interceptor.is(x)) this.unsupported(x);
- if (isolate.RawReceivePort.is(x)) {
+ if (isolate$.RawReceivePort.is(x)) {
this.unsupported(x, "RawReceivePorts can't be transmitted:");
}
if (_isolate_helper._NativeJsSendPort.is(x)) return this.serializeJsSendPort(x);
@@ -11297,7 +11322,7 @@
}
deserializeRawSendPort(x) {
dart.assert(dart.equals(dart.dindex(x, 0), 'raw sendport'));
- let result = isolate.SendPort._check(dart.dindex(x, 1));
+ let result = isolate$.SendPort._check(dart.dindex(x, 1));
this.deserializedObjects[dartx.add](result);
return result;
}
@@ -11349,8 +11374,8 @@
deserializeMutable: dart.definiteFunctionType(core.List, [dart.dynamic]),
deserializeConst: dart.definiteFunctionType(core.List, [dart.dynamic]),
deserializeMap: dart.definiteFunctionType(core.Map, [_js_helper.InternalMap]),
- deserializeSendPort: dart.definiteFunctionType(isolate.SendPort, [dart.dynamic]),
- deserializeRawSendPort: dart.definiteFunctionType(isolate.SendPort, [dart.dynamic]),
+ deserializeSendPort: dart.definiteFunctionType(isolate$.SendPort, [dart.dynamic]),
+ deserializeRawSendPort: dart.definiteFunctionType(isolate$.SendPort, [dart.dynamic]),
deserializeJSObject: dart.definiteFunctionType(dart.dynamic, [dart.dynamic]),
deserializeClosure: dart.definiteFunctionType(core.Function, [dart.dynamic]),
deserializeDartObject: dart.definiteFunctionType(dart.dynamic, [dart.dynamic])
@@ -11387,6 +11412,11 @@
_js_embedded_names.TYPEDEF_PREDICATE_PROPERTY_NAME = "$$isTypedef";
_js_embedded_names.NATIVE_SUPERCLASS_TAG_NAME = "$nativeSuperclassTag";
_js_embedded_names.MAP_TYPE_TO_INTERCEPTOR = "mapTypeToInterceptor";
+dart.defineLazy(_js_helper, {
+ get _identityHashCode() {
+ return Symbol("_identityHashCode");
+ }
+});
_js_helper._Patch = class _Patch extends core.Object {
new() {
}
@@ -11406,10 +11436,10 @@
_js_helper.Primitives.mirrorInvokeCacheName = dart.notNull(_js_helper.Primitives.mirrorInvokeCacheName) + dart.str`_${id}`;
}
static objectHashCode(object) {
- let hash = object.$identityHash;
+ let hash = object[_js_helper._identityHashCode];
if (hash == null) {
hash = Math.random() * 0x3fffffff | 0;
- object.$identityHash = hash;
+ object[_js_helper._identityHashCode] = hash;
}
return hash;
}
@@ -12048,6 +12078,9 @@
new() {
super.new();
}
+ toString() {
+ return super.toString();
+ }
};
_js_helper.FallThroughErrorImplementation = class FallThroughErrorImplementation extends core.FallThroughError {
new() {
@@ -12070,13 +12103,18 @@
fields: () => ({message: dart.dynamic})
});
core.AssertionError = class AssertionError extends core.Error {
- new() {
+ new(message) {
+ if (message === void 0) message = null;
+ this.message = message;
super.new();
}
toString() {
return "Assertion failed";
}
};
+dart.setSignature(core.AssertionError, {
+ fields: () => ({message: core.Object})
+});
_js_helper.AssertionErrorWithMessage = class AssertionErrorWithMessage extends core.AssertionError {
new(message) {
this[_message] = message;
@@ -12681,7 +12719,7 @@
let LinkedHashMapKeyIteratorOfE = () => (LinkedHashMapKeyIteratorOfE = dart.constFn(_js_helper.LinkedHashMapKeyIterator$(E)))();
let ETovoid = () => (ETovoid = dart.constFn(dart.functionType(dart.void, [E])))();
let JsLinkedHashMapOfE$dynamic = () => (JsLinkedHashMapOfE$dynamic = dart.constFn(_js_helper.JsLinkedHashMap$(E, dart.dynamic)))();
- class LinkedHashMapKeyIterable extends core.Iterable$(E) {
+ class LinkedHashMapKeyIterable extends _internal.EfficientLengthIterable$(E) {
new(map) {
this[_map] = map;
super.new();
@@ -12710,7 +12748,6 @@
}
}
}
- LinkedHashMapKeyIterable[dart.implements] = () => [_internal.EfficientLength];
dart.setSignature(LinkedHashMapKeyIterable, {
fields: () => ({[_map]: JsLinkedHashMapOfE$dynamic()}),
getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])})
@@ -13381,7 +13418,11 @@
};
dart.lazyFn(_js_helper.isJsArray, () => dynamicTobool$());
_js_mirrors.getName = function(symbol) {
- return _internal.Symbol.getName(_internal.Symbol.as(symbol));
+ if (_internal.PrivateSymbol.is(symbol)) {
+ return _internal.PrivateSymbol.getName(symbol);
+ } else {
+ return _internal.Symbol.getName(_internal.Symbol.as(symbol));
+ }
};
dart.lazyFn(_js_mirrors.getName, () => SymbolToString());
_js_mirrors.getSymbol = function(name, library) {
@@ -13460,7 +13501,7 @@
});
_js_mirrors._Lazy = _Lazy();
_js_mirrors._getESSymbol = function(symbol) {
- return _internal.Symbol.getNativeSymbol(_internal.Symbol.as(symbol));
+ return _internal.PrivateSymbol.getNativeSymbol(symbol);
};
dart.lazyFn(_js_mirrors._getESSymbol, () => SymbolTodynamic());
_js_mirrors._getMember = function(symbol) {
@@ -13504,7 +13545,7 @@
dart.lazyFn(_js_mirrors._getNameForESSymbol, () => dynamicToString());
_js_mirrors._getSymbolForESSymbol = function(member) {
let name = _js_mirrors._getNameForESSymbol(member);
- return new _internal.Symbol.es6(name, member);
+ return new _internal.PrivateSymbol(name, member);
};
dart.lazyFn(_js_mirrors._getSymbolForESSymbol, () => dynamicToSymbol());
_js_mirrors._getSymbolForMember = function(member) {
@@ -13512,7 +13553,7 @@
return core.Symbol.new(member);
} else {
let name = _js_mirrors._getNameForESSymbol(member);
- return new _internal.Symbol.es6(name, member);
+ return new _internal.PrivateSymbol(name, member);
}
};
dart.lazyFn(_js_mirrors._getSymbolForMember, () => dynamicToSymbol());
@@ -13656,12 +13697,18 @@
};
_js_mirrors.JsIsolateMirror[dart.implements] = () => [mirrors.IsolateMirror];
_js_mirrors.JsLibraryDependencyMirror = class JsLibraryDependencyMirror extends _js_mirrors.JsMirror {
+ loadLibrary(...args) {
+ return FutureOfLibraryMirror()._check(this.noSuchMethod(new dart.InvocationImpl('loadLibrary', args, {isMethod: true})));
+ }
get isImport() {
return core.bool._check(this.noSuchMethod(new dart.InvocationImpl('isImport', [], {isGetter: true})));
}
get isExport() {
return core.bool._check(this.noSuchMethod(new dart.InvocationImpl('isExport', [], {isGetter: true})));
}
+ get isDeferred() {
+ return core.bool._check(this.noSuchMethod(new dart.InvocationImpl('isDeferred', [], {isGetter: true})));
+ }
get sourceLibrary() {
return mirrors.LibraryMirror._check(this.noSuchMethod(new dart.InvocationImpl('sourceLibrary', [], {isGetter: true})));
}
@@ -13692,6 +13739,9 @@
setField(...args) {
return mirrors.InstanceMirror._check(this.noSuchMethod(new dart.InvocationImpl('setField', args, {isMethod: true})));
}
+ delegate(...args) {
+ return this.noSuchMethod(new dart.InvocationImpl('delegate', args, {isMethod: true}));
+ }
};
_js_mirrors.JsObjectMirror[dart.implements] = () => [mirrors.ObjectMirror];
const _getAccessor = Symbol('_getAccessor');
@@ -13839,7 +13889,7 @@
let setters = _js_mirrors._getSetters(unwrapped);
setters[dartx.forEach](dart.fn((symbol, ft) => {
let name = dart.notNull(_js_mirrors.getName(symbol)) + '=';
- symbol = new _internal.Symbol.es6(name, _js_mirrors._getESSymbol(symbol));
+ symbol = new _internal.PrivateSymbol(name, _js_mirrors._getESSymbol(symbol));
this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._instanceMethod(this, symbol, ft));
}, SymbolAnddynamicToNull()));
let staticFields = _js_mirrors._getStaticFields(unwrapped);
@@ -13988,12 +14038,18 @@
get typeVariables() {
return ListOfTypeVariableMirror()._check(this.noSuchMethod(new dart.InvocationImpl('typeVariables', [], {isGetter: true})));
}
+ delegate(...args) {
+ return this.noSuchMethod(new dart.InvocationImpl('delegate', args, {isMethod: true}));
+ }
isSubclassOf(...args) {
return core.bool._check(this.noSuchMethod(new dart.InvocationImpl('isSubclassOf', args, {isMethod: true})));
}
get isAbstract() {
return core.bool._check(this.noSuchMethod(new dart.InvocationImpl('isAbstract', [], {isGetter: true})));
}
+ get isEnum() {
+ return core.bool._check(this.noSuchMethod(new dart.InvocationImpl('isEnum', [], {isGetter: true})));
+ }
get instanceMembers() {
return MapOfSymbol$MethodMirror()._check(this.noSuchMethod(new dart.InvocationImpl('instanceMembers', [], {isGetter: true})));
}
@@ -16799,9 +16855,9 @@
async._registerErrorHandler = function(R) {
return (errorHandler, zone) => {
if (async.ZoneBinaryCallback.is(errorHandler)) {
- return zone.registerBinaryCallback(dart.dynamic, dart.dynamic, core.StackTrace)(ZoneBinaryCallbackOfdynamic$dynamic$StackTrace().as(errorHandler));
+ return zone.registerBinaryCallback(R, dart.dynamic, core.StackTrace)(async.ZoneBinaryCallback$(R, dart.dynamic, core.StackTrace).as(errorHandler));
} else {
- return zone.registerUnaryCallback(dart.dynamic, dart.dynamic)(async.ZoneUnaryCallback.as(errorHandler));
+ return zone.registerUnaryCallback(R, dart.dynamic)(async.ZoneUnaryCallback$(R, dart.dynamic).as(errorHandler));
}
};
};
@@ -16955,7 +17011,6 @@
const _waitsForCancel = Symbol('_waitsForCancel');
const _canFire = Symbol('_canFire');
const _cancelOnError = Symbol('_cancelOnError');
-const _incrementPauseCount = Symbol('_incrementPauseCount');
const _sendData = Symbol('_sendData');
const _addPending = Symbol('_addPending');
const _sendError = Symbol('_sendError');
@@ -17000,7 +17055,7 @@
}
onError(handleError) {
if (handleError == null) handleError = async._nullErrorHandler;
- this[_onError] = async._registerErrorHandler(T)(handleError, this[_zone]);
+ this[_onError] = async._registerErrorHandler(dart.dynamic)(handleError, this[_zone]);
}
onDone(handleDone) {
if (handleDone == null) handleDone = async._nullDoneHandler;
@@ -17033,9 +17088,11 @@
}
cancel() {
this[_state] = (dart.notNull(this[_state]) & ~async._BufferingStreamSubscription._STATE_WAIT_FOR_CANCEL) >>> 0;
- if (dart.test(this[_isCanceled])) return this[_cancelFuture];
- this[_cancel]();
- return this[_cancelFuture];
+ if (!dart.test(this[_isCanceled])) {
+ this[_cancel]();
+ }
+ let l = this[_cancelFuture];
+ return l != null ? l : async.Future._nullFuture;
}
asFuture(E) {
return futureValue => {
@@ -17045,8 +17102,14 @@
result[_complete](futureValue);
}, VoidToNull());
this[_onError] = dart.fn((error, stackTrace) => {
- this.cancel();
- result[_completeError](error, core.StackTrace._check(stackTrace));
+ let cancelFuture = this.cancel();
+ if (!core.identical(cancelFuture, async.Future._nullFuture)) {
+ cancelFuture.whenComplete(dart.fn(() => {
+ result[_completeError](error, core.StackTrace._check(stackTrace));
+ }, VoidToNull()));
+ } else {
+ result[_completeError](error, core.StackTrace._check(stackTrace));
+ }
}, dynamicAnddynamicToNull());
return result;
};
@@ -17092,9 +17155,6 @@
if (!dart.test(this[_inCallback])) this[_pending] = null;
this[_cancelFuture] = this[_onCancel]();
}
- [_incrementPauseCount]() {
- this[_state] = (dart.notNull(this[_state]) + async._BufferingStreamSubscription._STATE_PAUSE_COUNT | async._BufferingStreamSubscription._STATE_INPUT_PAUSED) >>> 0;
- }
[_decrementPauseCount]() {
dart.assert(this[_isPaused]);
this[_state] = dart.notNull(this[_state]) - async._BufferingStreamSubscription._STATE_PAUSE_COUNT;
@@ -17181,7 +17241,7 @@
if (dart.test(this[_cancelOnError])) {
this[_state] = (dart.notNull(this[_state]) | async._BufferingStreamSubscription._STATE_WAIT_FOR_CANCEL) >>> 0;
this[_cancel]();
- if (async.Future.is(this[_cancelFuture])) {
+ if (async.Future.is(this[_cancelFuture]) && !core.identical(this[_cancelFuture], async.Future._nullFuture)) {
this[_cancelFuture].whenComplete(sendError);
} else {
sendError();
@@ -17204,7 +17264,7 @@
dart.fn(sendDone, VoidTovoid$());
this[_cancel]();
this[_state] = (dart.notNull(this[_state]) | async._BufferingStreamSubscription._STATE_WAIT_FOR_CANCEL) >>> 0;
- if (async.Future.is(this[_cancelFuture])) {
+ if (async.Future.is(this[_cancelFuture]) && !core.identical(this[_cancelFuture], async.Future._nullFuture)) {
this[_cancelFuture].whenComplete(sendDone);
} else {
sendDone();
@@ -17214,7 +17274,7 @@
dart.assert(!dart.test(this[_inCallback]));
let wasInputPaused = this[_isInputPaused];
this[_state] = (dart.notNull(this[_state]) | async._BufferingStreamSubscription._STATE_IN_CALLBACK) >>> 0;
- callback();
+ dart.dcall(callback);
this[_state] = (dart.notNull(this[_state]) & ~async._BufferingStreamSubscription._STATE_IN_CALLBACK) >>> 0;
this[_checkState](wasInputPaused);
}
@@ -17282,7 +17342,6 @@
cancel: dart.definiteFunctionType(async.Future, []),
asFuture: dart.definiteFunctionType(E => [async.Future$(E), [], [E]]),
[_cancel]: dart.definiteFunctionType(dart.void, []),
- [_incrementPauseCount]: dart.definiteFunctionType(dart.void, []),
[_decrementPauseCount]: dart.definiteFunctionType(dart.void, []),
[_add$]: dart.definiteFunctionType(dart.void, [T]),
[_addError]: dart.definiteFunctionType(dart.void, [core.Object, core.StackTrace]),
@@ -17294,7 +17353,7 @@
[_sendData]: dart.definiteFunctionType(dart.void, [T]),
[_sendError]: dart.definiteFunctionType(dart.void, [core.Object, core.StackTrace]),
[_sendDone]: dart.definiteFunctionType(dart.void, []),
- [_guardCallback]: dart.definiteFunctionType(dart.void, [VoidTovoid()]),
+ [_guardCallback]: dart.definiteFunctionType(dart.void, [dart.dynamic]),
[_checkState]: dart.definiteFunctionType(dart.void, [core.bool])
})
});
@@ -17309,7 +17368,6 @@
async._BufferingStreamSubscription._STATE_IN_CALLBACK = 32;
async._BufferingStreamSubscription._STATE_HAS_PENDING = 64;
async._BufferingStreamSubscription._STATE_PAUSE_COUNT = 128;
-async._BufferingStreamSubscription._STATE_PAUSE_COUNT_SHIFT = 7;
async._ControllerSubscription$ = dart.generic(T => {
let _StreamControllerLifecycleOfT = () => (_StreamControllerLifecycleOfT = dart.constFn(async._StreamControllerLifecycle$(T)))();
class _ControllerSubscription extends async._BufferingStreamSubscription$(T) {
@@ -18065,7 +18123,7 @@
result[_completeError](error, stackTrace);
}
}
- dart.fn(handleError, dynamicAnddynamicTovoid$());
+ dart.fn(handleError, dynamicAnddynamicToNull());
try {
for (let future of futures) {
let pos = remaining;
@@ -18211,7 +18269,7 @@
};
dart.fn(async._nonNullError, ObjectToObject());
async._FutureOnValue$ = dart.generic((S, T) => {
- const _FutureOnValue = dart.typedef('_FutureOnValue', () => dart.functionType(dart.dynamic, [S]));
+ const _FutureOnValue = dart.typedef('_FutureOnValue', () => dart.functionType(async.FutureOr$(T), [S]));
return _FutureOnValue;
});
async._FutureOnValue = _FutureOnValue();
@@ -18302,6 +18360,9 @@
const _whenCompleteAction = Symbol('_whenCompleteAction');
async._FutureListener$ = dart.generic((S, T) => {
let _FutureOnValueOfS$T = () => (_FutureOnValueOfS$T = dart.constFn(async._FutureOnValue$(S, T)))();
+ let FutureOrOfT = () => (FutureOrOfT = dart.constFn(async.FutureOr$(T)))();
+ let ZoneBinaryCallbackOfFutureOrOfT$Object$StackTrace = () => (ZoneBinaryCallbackOfFutureOrOfT$Object$StackTrace = dart.constFn(async.ZoneBinaryCallback$(FutureOrOfT(), core.Object, core.StackTrace)))();
+ let dynamicToFutureOrOfT = () => (dynamicToFutureOrOfT = dart.constFn(dart.functionType(FutureOrOfT(), [dart.dynamic])))();
let _FutureOfT = () => (_FutureOfT = dart.constFn(async._Future$(T)))();
class _FutureListener extends core.Object {
then(result, onValue, errorCallback) {
@@ -18361,7 +18422,7 @@
}
handleValue(sourceResult) {
S._check(sourceResult);
- return this[_zone].runUnary(dart.dynamic, S)(this[_onValue], sourceResult);
+ return this[_zone].runUnary(FutureOrOfT(), S)(this[_onValue], sourceResult);
}
matchesErrorTest(asyncError) {
if (!dart.test(this.hasErrorTest)) return true;
@@ -18371,10 +18432,10 @@
handleError(asyncError) {
dart.assert(dart.test(this.handlesError) && dart.test(this.hasErrorCallback));
if (async.ZoneBinaryCallback.is(this.errorCallback)) {
- let typedErrorCallback = ZoneBinaryCallbackOfObject$Object$StackTrace().as(this.errorCallback);
- return this[_zone].runBinary(core.Object, core.Object, core.StackTrace)(typedErrorCallback, asyncError.error, asyncError.stackTrace);
+ let typedErrorCallback = ZoneBinaryCallbackOfFutureOrOfT$Object$StackTrace().as(this.errorCallback);
+ return this[_zone].runBinary(FutureOrOfT(), core.Object, core.StackTrace)(typedErrorCallback, asyncError.error, asyncError.stackTrace);
} else {
- return this[_zone].runUnary(dart.dynamic, dart.dynamic)(dynamicTodynamic()._check(this.errorCallback), asyncError.error);
+ return this[_zone].runUnary(FutureOrOfT(), dart.dynamic)(dynamicToFutureOrOfT()._check(this.errorCallback), asyncError.error);
}
}
handleWhenComplete() {
@@ -18407,9 +18468,9 @@
hasErrorCallback: dart.definiteFunctionType(core.bool, [])
}),
methods: () => ({
- handleValue: dart.definiteFunctionType(dart.dynamic, [S]),
+ handleValue: dart.definiteFunctionType(async.FutureOr$(T), [S]),
matchesErrorTest: dart.definiteFunctionType(core.bool, [async.AsyncError]),
- handleError: dart.definiteFunctionType(dart.dynamic, [async.AsyncError]),
+ handleError: dart.definiteFunctionType(async.FutureOr$(T), [async.AsyncError]),
handleWhenComplete: dart.definiteFunctionType(dart.dynamic, [])
})
});
@@ -18510,7 +18571,7 @@
if (!core.identical(currentZone, async._ROOT_ZONE)) {
f = currentZone.registerUnaryCallback(async.FutureOr$(E), T)(f);
if (onError != null) {
- onError = async._registerErrorHandler(T)(onError, currentZone);
+ onError = async._registerErrorHandler(E)(onError, currentZone);
}
}
return this[_thenNoZoneRegistration](E)(f, onError);
@@ -18519,7 +18580,7 @@
[_thenNoZoneRegistration](E) {
return (f, onError) => {
let result = new (async._Future$(E))();
- this[_addListener](new (async._FutureListener$(T, E)).then(result, f, onError));
+ this[_addListener](new (async._FutureListener$(T, E)).then(result, async._FutureOnValue$(T, E)._check(f), onError));
return result;
};
}
@@ -19211,10 +19272,10 @@
});
async.StreamTransformer = StreamTransformer();
async.StreamIterator$ = dart.generic(T => {
- let _StreamIteratorImplOfT = () => (_StreamIteratorImplOfT = dart.constFn(async._StreamIteratorImpl$(T)))();
+ let _StreamIteratorOfT = () => (_StreamIteratorOfT = dart.constFn(async._StreamIterator$(T)))();
class StreamIterator extends core.Object {
static new(stream) {
- return new (_StreamIteratorImplOfT())(stream);
+ return new (_StreamIteratorOfT())(stream);
}
}
dart.addTypeTests(StreamIterator);
@@ -20082,36 +20143,6 @@
return _StreamImplEvents;
});
async._StreamImplEvents = _StreamImplEvents();
-const _unlink = Symbol('_unlink');
-const _insertBefore = Symbol('_insertBefore');
-async._BroadcastLinkedList = class _BroadcastLinkedList extends core.Object {
- new() {
- this[_next$] = null;
- this[_previous$] = null;
- }
- [_unlink]() {
- this[_previous$][_next$] = this[_next$];
- this[_next$][_previous$] = this[_previous$];
- this[_next$] = this[_previous$] = this;
- }
- [_insertBefore](newNext) {
- let newPrevious = newNext[_previous$];
- newPrevious[_next$] = this;
- newNext[_previous$] = this[_previous$];
- this[_previous$][_next$] = newNext;
- this[_previous$] = newPrevious;
- }
-};
-dart.setSignature(async._BroadcastLinkedList, {
- fields: () => ({
- [_next$]: async._BroadcastLinkedList,
- [_previous$]: async._BroadcastLinkedList
- }),
- methods: () => ({
- [_unlink]: dart.definiteFunctionType(dart.void, []),
- [_insertBefore]: dart.definiteFunctionType(dart.void, [async._BroadcastLinkedList])
- })
-});
async._BroadcastCallback$ = dart.generic(T => {
const _BroadcastCallback = dart.typedef('_BroadcastCallback', () => dart.functionType(dart.void, [async.StreamSubscription$(T)]));
return _BroadcastCallback;
@@ -20163,7 +20194,7 @@
}
}
cancel() {
- return null;
+ return async.Future._nullFuture;
}
asFuture(E) {
return futureValue => {
@@ -20339,7 +20370,7 @@
}
cancel() {
this[_stream][_cancelSubscription]();
- return null;
+ return async.Future._nullFuture;
}
get isPaused() {
return this[_stream][_isSubscriptionPaused];
@@ -20369,146 +20400,109 @@
return _BroadcastSubscriptionWrapper;
});
async._BroadcastSubscriptionWrapper = _BroadcastSubscriptionWrapper();
-const _current$1 = Symbol('_current');
-const _futureOrPrefetch = Symbol('_futureOrPrefetch');
-const _clear = Symbol('_clear');
-async._StreamIteratorImpl$ = dart.generic(T => {
+const _stateData = Symbol('_stateData');
+const _initializeOrDone = Symbol('_initializeOrDone');
+async._StreamIterator$ = dart.generic(T => {
+ let StreamOfT = () => (StreamOfT = dart.constFn(async.Stream$(T)))();
+ let StreamSubscriptionOfT = () => (StreamSubscriptionOfT = dart.constFn(async.StreamSubscription$(T)))();
let StreamIteratorOfT = () => (StreamIteratorOfT = dart.constFn(async.StreamIterator$(T)))();
- class _StreamIteratorImpl extends core.Object {
+ class _StreamIterator extends core.Object {
new(stream) {
+ this[_stateData] = stream;
this[_subscription] = null;
- this[_current$1] = null;
- this[_futureOrPrefetch] = null;
- this[_state] = async._StreamIteratorImpl._STATE_FOUND;
- this[_subscription] = stream.listen(dart.bind(this, _onData), {onError: dart.bind(this, _onError), onDone: dart.bind(this, _onDone), cancelOnError: true});
+ this[_isPaused] = false;
}
get current() {
- return this[_current$1];
+ if (this[_subscription] != null && dart.test(this[_isPaused])) {
+ return T.as(this[_stateData]);
+ }
+ return null;
}
moveNext() {
- if (this[_state] == async._StreamIteratorImpl._STATE_DONE) {
- return new (_FutureOfbool()).immediate(false);
- }
- if (this[_state] == async._StreamIteratorImpl._STATE_MOVING) {
+ if (this[_subscription] != null) {
+ if (dart.test(this[_isPaused])) {
+ let future = new (_FutureOfbool())();
+ this[_stateData] = future;
+ this[_isPaused] = false;
+ this[_subscription].resume();
+ return future;
+ }
dart.throw(new core.StateError("Already waiting for next."));
}
- if (this[_state] == async._StreamIteratorImpl._STATE_FOUND) {
- this[_state] = async._StreamIteratorImpl._STATE_MOVING;
- this[_current$1] = null;
- let result = new (_FutureOfbool())();
- this[_futureOrPrefetch] = result;
- return result;
- } else {
- dart.assert(dart.notNull(this[_state]) >= async._StreamIteratorImpl._STATE_EXTRA_DATA);
- switch (this[_state]) {
- case async._StreamIteratorImpl._STATE_EXTRA_DATA:
- {
- this[_state] = async._StreamIteratorImpl._STATE_FOUND;
- this[_current$1] = T.as(this[_futureOrPrefetch]);
- this[_futureOrPrefetch] = null;
- this[_subscription].resume();
- return new (_FutureOfbool()).immediate(true);
- }
- case async._StreamIteratorImpl._STATE_EXTRA_ERROR:
- {
- let prefetch = async.AsyncError._check(this[_futureOrPrefetch]);
- this[_clear]();
- return new (_FutureOfbool()).immediateError(prefetch.error, prefetch.stackTrace);
- }
- case async._StreamIteratorImpl._STATE_EXTRA_DONE:
- {
- this[_clear]();
- return new (_FutureOfbool()).immediate(false);
- }
- }
- }
+ return this[_initializeOrDone]();
}
- [_clear]() {
- this[_subscription] = null;
- this[_futureOrPrefetch] = null;
- this[_current$1] = null;
- this[_state] = async._StreamIteratorImpl._STATE_DONE;
+ [_initializeOrDone]() {
+ dart.assert(this[_subscription] == null);
+ let stateData = this[_stateData];
+ if (stateData != null) {
+ let stream = StreamOfT().as(stateData);
+ this[_subscription] = stream.listen(dart.bind(this, _onData), {onError: dart.bind(this, _onError), onDone: dart.bind(this, _onDone), cancelOnError: true});
+ let future = new (_FutureOfbool())();
+ this[_stateData] = future;
+ return future;
+ }
+ return new (_FutureOfbool()).immediate(false);
}
cancel() {
- let subscription = this[_subscription];
- if (subscription == null) return null;
- if (this[_state] == async._StreamIteratorImpl._STATE_MOVING) {
- let hasNext = _FutureOfbool().as(this[_futureOrPrefetch]);
- this[_clear]();
- hasNext[_complete](false);
- } else {
- this[_clear]();
+ let subscription = StreamSubscriptionOfT()._check(this[_subscription]);
+ let stateData = this[_stateData];
+ this[_stateData] = null;
+ if (subscription != null) {
+ this[_subscription] = null;
+ if (!dart.test(this[_isPaused])) {
+ let future = _FutureOfbool().as(stateData);
+ future[_asyncComplete](false);
+ }
+ return subscription.cancel();
}
- return subscription.cancel();
+ return async.Future._nullFuture;
}
[_onData](data) {
T._check(data);
- if (this[_state] == async._StreamIteratorImpl._STATE_MOVING) {
- this[_current$1] = data;
- let hasNext = _FutureOfbool().as(this[_futureOrPrefetch]);
- this[_futureOrPrefetch] = null;
- this[_state] = async._StreamIteratorImpl._STATE_FOUND;
- hasNext[_complete](true);
- return;
- }
- this[_subscription].pause();
- dart.assert(this[_futureOrPrefetch] == null);
- this[_futureOrPrefetch] = data;
- this[_state] = async._StreamIteratorImpl._STATE_EXTRA_DATA;
+ dart.assert(this[_subscription] != null && !dart.test(this[_isPaused]));
+ let moveNextFuture = _FutureOfbool().as(this[_stateData]);
+ this[_stateData] = data;
+ this[_isPaused] = true;
+ moveNextFuture[_complete](true);
+ if (this[_subscription] != null && dart.test(this[_isPaused])) this[_subscription].pause();
}
[_onError](error, stackTrace) {
if (stackTrace === void 0) stackTrace = null;
- if (this[_state] == async._StreamIteratorImpl._STATE_MOVING) {
- let hasNext = _FutureOfbool().as(this[_futureOrPrefetch]);
- this[_clear]();
- hasNext[_completeError](error, stackTrace);
- return;
- }
- this[_subscription].pause();
- dart.assert(this[_futureOrPrefetch] == null);
- this[_futureOrPrefetch] = new async.AsyncError(error, stackTrace);
- this[_state] = async._StreamIteratorImpl._STATE_EXTRA_ERROR;
+ dart.assert(this[_subscription] != null && !dart.test(this[_isPaused]));
+ let moveNextFuture = _FutureOfbool().as(this[_stateData]);
+ this[_subscription] = null;
+ this[_stateData] = null;
+ moveNextFuture[_completeError](error, stackTrace);
}
[_onDone]() {
- if (this[_state] == async._StreamIteratorImpl._STATE_MOVING) {
- let hasNext = _FutureOfbool().as(this[_futureOrPrefetch]);
- this[_clear]();
- hasNext[_complete](false);
- return;
- }
- this[_subscription].pause();
- this[_futureOrPrefetch] = null;
- this[_state] = async._StreamIteratorImpl._STATE_EXTRA_DONE;
+ dart.assert(this[_subscription] != null && !dart.test(this[_isPaused]));
+ let moveNextFuture = _FutureOfbool().as(this[_stateData]);
+ this[_subscription] = null;
+ this[_stateData] = null;
+ moveNextFuture[_complete](false);
}
}
- dart.addTypeTests(_StreamIteratorImpl);
- _StreamIteratorImpl[dart.implements] = () => [StreamIteratorOfT()];
- dart.setSignature(_StreamIteratorImpl, {
+ dart.addTypeTests(_StreamIterator);
+ _StreamIterator[dart.implements] = () => [StreamIteratorOfT()];
+ dart.setSignature(_StreamIterator, {
fields: () => ({
[_subscription]: async.StreamSubscription,
- [_current$1]: T,
- [_futureOrPrefetch]: dart.dynamic,
- [_state]: core.int
+ [_stateData]: core.Object,
+ [_isPaused]: core.bool
}),
getters: () => ({current: dart.definiteFunctionType(T, [])}),
methods: () => ({
moveNext: dart.definiteFunctionType(async.Future$(core.bool), []),
- [_clear]: dart.definiteFunctionType(dart.void, []),
+ [_initializeOrDone]: dart.definiteFunctionType(async.Future$(core.bool), []),
cancel: dart.definiteFunctionType(async.Future, []),
[_onData]: dart.definiteFunctionType(dart.void, [T]),
[_onError]: dart.definiteFunctionType(dart.void, [core.Object], [core.StackTrace]),
[_onDone]: dart.definiteFunctionType(dart.void, [])
})
});
- return _StreamIteratorImpl;
+ return _StreamIterator;
});
-async._StreamIteratorImpl = _StreamIteratorImpl();
-async._StreamIteratorImpl._STATE_FOUND = 0;
-async._StreamIteratorImpl._STATE_DONE = 1;
-async._StreamIteratorImpl._STATE_MOVING = 2;
-async._StreamIteratorImpl._STATE_EXTRA_DATA = 3;
-async._StreamIteratorImpl._STATE_EXTRA_ERROR = 4;
-async._StreamIteratorImpl._STATE_EXTRA_DONE = 5;
+async._StreamIterator = _StreamIterator();
async._EmptyStream$ = dart.generic(T => {
let _DoneStreamSubscriptionOfT = () => (_DoneStreamSubscriptionOfT = dart.constFn(async._DoneStreamSubscription$(T)))();
let TTovoid = () => (TTovoid = dart.constFn(dart.functionType(dart.void, [T])))();
@@ -20551,7 +20545,7 @@
dart.lazyFn(async._runUserCode, () => FnAndFnAndFnTodynamic());
async._cancelAndError = function(subscription, future, error, stackTrace) {
let cancelFuture = subscription.cancel();
- if (async.Future.is(cancelFuture)) {
+ if (async.Future.is(cancelFuture) && !core.identical(cancelFuture, async.Future._nullFuture)) {
cancelFuture.whenComplete(dart.fn(() => future[_completeError](error, stackTrace), VoidTovoid$()));
} else {
future[_completeError](error, stackTrace);
@@ -20576,7 +20570,7 @@
dart.fn(async._cancelAndErrorClosure, StreamSubscriptionAnd_FutureTo_ErrorCallback());
async._cancelAndValue = function(subscription, future, value) {
let cancelFuture = subscription.cancel();
- if (async.Future.is(cancelFuture)) {
+ if (async.Future.is(cancelFuture) && !core.identical(cancelFuture, async.Future._nullFuture)) {
cancelFuture.whenComplete(dart.fn(() => future[_complete](value), VoidTovoid$()));
} else {
future[_complete](value);
@@ -20859,6 +20853,7 @@
async._HandleErrorStream = _HandleErrorStream();
const _count = Symbol('_count');
async._TakeStream$ = dart.generic(T => {
+ let _DoneStreamSubscriptionOfT = () => (_DoneStreamSubscriptionOfT = dart.constFn(async._DoneStreamSubscription$(T)))();
let _StateStreamSubscriptionOfT = () => (_StateStreamSubscriptionOfT = dart.constFn(async._StateStreamSubscription$(T)))();
let _EventSinkOfT = () => (_EventSinkOfT = dart.constFn(async._EventSink$(T)))();
let TTovoid = () => (TTovoid = dart.constFn(dart.functionType(dart.void, [T])))();
@@ -20869,6 +20864,10 @@
if (!(typeof count == 'number')) dart.throw(new core.ArgumentError(count));
}
[_createSubscription](onData, onError, onDone, cancelOnError) {
+ if (this[_count] == 0) {
+ this[_source$].listen(null).cancel();
+ return new (_DoneStreamSubscriptionOfT())(onDone);
+ }
return new (_StateStreamSubscriptionOfT())(this, onData, onError, onDone, cancelOnError, this[_count]);
}
[_handleData](inputEvent, sink) {
@@ -21171,7 +21170,7 @@
if (dart.test(this[_isSubscribed])) {
let subscription = this[_subscription];
this[_subscription] = null;
- subscription.cancel();
+ return subscription.cancel();
}
return null;
}
@@ -22475,8 +22474,8 @@
if (onError != null) {
errorHandler = dart.fn((self, parent, zone, error, stackTrace) => {
try {
- if (ZoneBinaryCallbackOfdynamic$dynamic$StackTrace().is(onError)) {
- return R.as(self.parent.runBinary(dart.dynamic, dart.dynamic, core.StackTrace)(onError, error, stackTrace));
+ if (async.ZoneBinaryCallback$(R, dart.dynamic, core.StackTrace).is(onError)) {
+ return self.parent.runBinary(R, dart.dynamic, core.StackTrace)(onError, error, stackTrace);
}
return self.parent.runUnary(dart.dynamic, dart.dynamic)(dynamicTodynamic()._check(onError), error);
} catch (e) {
@@ -22938,7 +22937,7 @@
let _HashMapKeyIteratorOfE = () => (_HashMapKeyIteratorOfE = dart.constFn(collection._HashMapKeyIterator$(E)))();
let ETovoid = () => (ETovoid = dart.constFn(dart.functionType(dart.void, [E])))();
let _HashMapOfE$dynamic = () => (_HashMapOfE$dynamic = dart.constFn(collection._HashMap$(E, dart.dynamic)))();
- class _HashMapKeyIterable extends core.Iterable$(E) {
+ class _HashMapKeyIterable extends _internal.EfficientLengthIterable$(E) {
new(map) {
this[_map$0] = map;
super.new();
@@ -22965,7 +22964,6 @@
}
}
}
- _HashMapKeyIterable[dart.implements] = () => [_internal.EfficientLength];
dart.setSignature(_HashMapKeyIterable, {
fields: () => ({[_map$0]: _HashMapOfE$dynamic()}),
getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])})
@@ -22981,7 +22979,7 @@
});
collection._HashMapKeyIterable = _HashMapKeyIterable();
const _offset = Symbol('_offset');
-const _current$2 = Symbol('_current');
+const _current$1 = Symbol('_current');
collection._HashMapKeyIterator$ = dart.generic(E => {
let IteratorOfE = () => (IteratorOfE = dart.constFn(core.Iterator$(E)))();
let _HashMapOfE$dynamic = () => (_HashMapOfE$dynamic = dart.constFn(collection._HashMap$(E, dart.dynamic)))();
@@ -22991,10 +22989,10 @@
this[_map$0] = map;
this[_keys] = keys;
this[_offset] = 0;
- this[_current$2] = null;
+ this[_current$1] = null;
}
get current() {
- return this[_current$2];
+ return this[_current$1];
}
moveNext() {
let keys = this[_keys];
@@ -23002,10 +23000,10 @@
if (keys !== this[_map$0][_keys]) {
dart.throw(new core.ConcurrentModificationError(this[_map$0]));
} else if (dart.notNull(offset) >= keys.length) {
- this[_current$2] = null;
+ this[_current$1] = null;
return false;
} else {
- this[_current$2] = keys[offset];
+ this[_current$1] = keys[offset];
this[_offset] = dart.notNull(offset) + 1;
return true;
}
@@ -23018,7 +23016,7 @@
[_map$0]: _HashMapOfE$dynamic(),
[_keys]: ListOfE(),
[_offset]: core.int,
- [_current$2]: E
+ [_current$1]: E
}),
getters: () => ({current: dart.definiteFunctionType(E, [])}),
methods: () => ({moveNext: dart.definiteFunctionType(core.bool, [])})
@@ -23181,7 +23179,7 @@
collection._Es6MapIterable$ = dart.generic(E => {
let _Es6MapIteratorOfE = () => (_Es6MapIteratorOfE = dart.constFn(collection._Es6MapIterator$(E)))();
let ETovoid = () => (ETovoid = dart.constFn(dart.functionType(dart.void, [E])))();
- class _Es6MapIterable extends core.Iterable$(E) {
+ class _Es6MapIterable extends _internal.EfficientLengthIterable$(E) {
new(map, isKeys) {
this[_map$0] = map;
this[_isKeys] = isKeys;
@@ -23219,7 +23217,6 @@
}
}
}
- _Es6MapIterable[dart.implements] = () => [_internal.EfficientLength];
dart.setSignature(_Es6MapIterable, {
fields: () => ({
[_map$0]: dart.dynamic,
@@ -23249,7 +23246,7 @@
this[_isKeys] = isKeys;
this[_jsIterator$] = null;
this[_next$0] = null;
- this[_current$2] = null;
+ this[_current$1] = null;
this[_done] = null;
if (dart.test(this[_isKeys])) {
this[_jsIterator$] = dart.dload(this[_map$0], _map$0).keys();
@@ -23259,7 +23256,7 @@
this[_done] = false;
}
get current() {
- return this[_current$2];
+ return this[_current$1];
}
moveNext() {
if (!dart.equals(this[_modifications$], dart.dload(this[_map$0], _modifications$))) {
@@ -23269,11 +23266,11 @@
this[_next$0] = this[_jsIterator$].next();
let done = this[_next$0].done;
if (done) {
- this[_current$2] = null;
+ this[_current$1] = null;
this[_done] = true;
return false;
} else {
- this[_current$2] = this[_next$0].value;
+ this[_current$1] = this[_next$0].value;
return true;
}
}
@@ -23287,7 +23284,7 @@
[_isKeys]: core.bool,
[_jsIterator$]: dart.dynamic,
[_next$0]: dart.dynamic,
- [_current$2]: E,
+ [_current$1]: E,
[_done]: core.bool
}),
getters: () => ({current: dart.definiteFunctionType(E, [])}),
@@ -24078,10 +24075,10 @@
this[_set] = set;
this[_elements] = elements;
this[_offset] = 0;
- this[_current$2] = null;
+ this[_current$1] = null;
}
get current() {
- return this[_current$2];
+ return this[_current$1];
}
moveNext() {
let elements = this[_elements];
@@ -24089,10 +24086,10 @@
if (elements !== dart.dload(this[_set], _elements)) {
dart.throw(new core.ConcurrentModificationError(this[_set]));
} else if (dart.notNull(offset) >= elements.length) {
- this[_current$2] = null;
+ this[_current$1] = null;
return false;
} else {
- this[_current$2] = elements[offset];
+ this[_current$1] = elements[offset];
this[_offset] = dart.notNull(offset) + 1;
return true;
}
@@ -24105,7 +24102,7 @@
[_set]: dart.dynamic,
[_elements]: ListOfE(),
[_offset]: core.int,
- [_current$2]: E
+ [_current$1]: E
}),
getters: () => ({current: dart.definiteFunctionType(E, [])}),
methods: () => ({moveNext: dart.definiteFunctionType(core.bool, [])})
@@ -24559,20 +24556,20 @@
this[_set] = set;
this[_modifications$] = modifications;
this[_cell$] = null;
- this[_current$2] = null;
+ this[_current$1] = null;
this[_cell$] = this[_set][_first$];
}
get current() {
- return this[_current$2];
+ return this[_current$1];
}
moveNext() {
if (this[_modifications$] != this[_set][_modifications$]) {
dart.throw(new core.ConcurrentModificationError(this[_set]));
} else if (this[_cell$] == null) {
- this[_current$2] = null;
+ this[_current$1] = null;
return false;
} else {
- this[_current$2] = E._check(this[_cell$][_element]);
+ this[_current$1] = E._check(this[_cell$][_element]);
this[_cell$] = this[_cell$][_next$0];
return true;
}
@@ -24585,7 +24582,7 @@
[_set]: collection._LinkedHashSet,
[_modifications$]: core.int,
[_cell$]: collection._LinkedHashSetCell,
- [_current$2]: E
+ [_current$1]: E
}),
getters: () => ({current: dart.definiteFunctionType(E, [])}),
methods: () => ({moveNext: dart.definiteFunctionType(core.bool, [])})
@@ -24850,7 +24847,7 @@
return SetOfE().from(this);
}
get length() {
- dart.assert(!_internal.EfficientLength.is(this));
+ dart.assert(!_internal.EfficientLengthIterable.is(this));
let count = 0;
let it = this[dartx.iterator];
while (dart.test(it.moveNext())) {
@@ -25278,9 +25275,9 @@
});
collection.LinkedHashSet = LinkedHashSet();
const _modificationCount = Symbol('_modificationCount');
-const _insertBefore$ = Symbol('_insertBefore');
+const _insertBefore = Symbol('_insertBefore');
const _list = Symbol('_list');
-const _unlink$ = Symbol('_unlink');
+const _unlink = Symbol('_unlink');
collection.LinkedList$ = dart.generic(E => {
let IterableOfE = () => (IterableOfE = dart.constFn(core.Iterable$(E)))();
let _LinkedListIteratorOfE = () => (_LinkedListIteratorOfE = dart.constFn(collection._LinkedListIterator$(E)))();
@@ -25294,12 +25291,12 @@
}
addFirst(entry) {
E._check(entry);
- this[_insertBefore$](this[_first$], entry, {updateFirst: true});
+ this[_insertBefore](this[_first$], entry, {updateFirst: true});
this[_first$] = entry;
}
add(entry) {
E._check(entry);
- this[_insertBefore$](this[_first$], entry, {updateFirst: false});
+ this[_insertBefore](this[_first$], entry, {updateFirst: false});
}
addAll(entries) {
IterableOfE()._check(entries);
@@ -25308,7 +25305,7 @@
remove(entry) {
E._check(entry);
if (!dart.equals(entry[_list], this)) return false;
- this[_unlink$](entry);
+ this[_unlink](entry);
return true;
}
get iterator() {
@@ -25365,7 +25362,7 @@
get isEmpty() {
return this[_length$1] == 0;
}
- [_insertBefore$](entry, newEntry, opts) {
+ [_insertBefore](entry, newEntry, opts) {
E._check(entry);
E._check(newEntry);
let updateFirst = opts && 'updateFirst' in opts ? opts.updateFirst : null;
@@ -25392,7 +25389,7 @@
}
this[_length$1] = dart.notNull(this[_length$1]) + 1;
}
- [_unlink$](entry) {
+ [_unlink](entry) {
E._check(entry);
this[_modificationCount] = dart.notNull(this[_modificationCount]) + 1;
entry[_next$0][_previous$0] = entry[_previous$0];
@@ -25419,8 +25416,8 @@
addAll: dart.definiteFunctionType(dart.void, [IterableOfE()]),
remove: dart.definiteFunctionType(core.bool, [E]),
clear: dart.definiteFunctionType(dart.void, []),
- [_insertBefore$]: dart.definiteFunctionType(dart.void, [E, E], {updateFirst: core.bool}),
- [_unlink$]: dart.definiteFunctionType(dart.void, [E])
+ [_insertBefore]: dart.definiteFunctionType(dart.void, [E, E], {updateFirst: core.bool}),
+ [_unlink]: dart.definiteFunctionType(dart.void, [E])
})
});
dart.defineExtensionMembers(LinkedList, [
@@ -25446,21 +25443,21 @@
this[_modificationCount] = list[_modificationCount];
this[_next$0] = list[_first$];
this[_visitedFirst] = false;
- this[_current$2] = null;
+ this[_current$1] = null;
}
get current() {
- return this[_current$2];
+ return this[_current$1];
}
moveNext() {
if (this[_modificationCount] != this[_list][_modificationCount]) {
dart.throw(new core.ConcurrentModificationError(this));
}
if (dart.test(this[_list].isEmpty) || dart.test(this[_visitedFirst]) && core.identical(this[_next$0], this[_list].first)) {
- this[_current$2] = null;
+ this[_current$1] = null;
return false;
}
this[_visitedFirst] = true;
- this[_current$2] = E._check(this[_next$0]);
+ this[_current$1] = E._check(this[_next$0]);
this[_next$0] = this[_next$0][_next$0];
return true;
}
@@ -25471,7 +25468,7 @@
fields: () => ({
[_list]: LinkedListOfE(),
[_modificationCount]: core.int,
- [_current$2]: E,
+ [_current$1]: E,
[_next$0]: LinkedListEntryOfE(),
[_visitedFirst]: core.bool
}),
@@ -25493,23 +25490,23 @@
return this[_list];
}
unlink() {
- this[_list][_unlink$](E._check(this));
+ this[_list][_unlink](E._check(this));
}
get next() {
- if (core.identical(this, this[_next$0])) return null;
+ if (this[_list] == null || core.identical(this[_list].first, this[_next$0])) return null;
return this[_next$0];
}
get previous() {
- if (core.identical(this, this[_previous$0])) return null;
+ if (this[_list] == null || core.identical(this, this[_list].first)) return null;
return this[_previous$0];
}
insertAfter(entry) {
E._check(entry);
- this[_list][_insertBefore$](this[_next$0], entry, {updateFirst: false});
+ this[_list][_insertBefore](this[_next$0], entry, {updateFirst: false});
}
insertBefore(entry) {
E._check(entry);
- this[_list][_insertBefore$](E.as(this), entry, {updateFirst: true});
+ this[_list][_insertBefore](E.as(this), entry, {updateFirst: true});
}
}
dart.addTypeTests(LinkedListEntry);
@@ -25678,7 +25675,7 @@
collection._MapBaseValueIterable$ = dart.generic((K, V) => {
let _MapBaseValueIteratorOfK$V = () => (_MapBaseValueIteratorOfK$V = dart.constFn(collection._MapBaseValueIterator$(K, V)))();
let MapOfK$V = () => (MapOfK$V = dart.constFn(core.Map$(K, V)))();
- class _MapBaseValueIterable extends core.Iterable$(V) {
+ class _MapBaseValueIterable extends _internal.EfficientLengthIterable$(V) {
new(map) {
this[_map$0] = map;
super.new();
@@ -25705,7 +25702,6 @@
return new (_MapBaseValueIteratorOfK$V())(this[_map$0]);
}
}
- _MapBaseValueIterable[dart.implements] = () => [_internal.EfficientLength];
dart.setSignature(_MapBaseValueIterable, {
fields: () => ({[_map$0]: MapOfK$V()}),
getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(V), [])})
@@ -25730,18 +25726,18 @@
new(map) {
this[_map$0] = map;
this[_keys] = map[dartx.keys][dartx.iterator];
- this[_current$2] = null;
+ this[_current$1] = null;
}
moveNext() {
if (dart.test(this[_keys].moveNext())) {
- this[_current$2] = this[_map$0][dartx._get](this[_keys].current);
+ this[_current$1] = this[_map$0][dartx._get](this[_keys].current);
return true;
}
- this[_current$2] = null;
+ this[_current$1] = null;
return false;
}
get current() {
- return this[_current$2];
+ return this[_current$1];
}
}
dart.addTypeTests(_MapBaseValueIterator);
@@ -25750,7 +25746,7 @@
fields: () => ({
[_keys]: IteratorOfK(),
[_map$0]: MapOfK$V(),
- [_current$2]: V
+ [_current$1]: V
}),
getters: () => ({current: dart.definiteFunctionType(V, [])}),
methods: () => ({moveNext: dart.definiteFunctionType(core.bool, [])})
@@ -25986,7 +25982,7 @@
});
collection.Queue$ = dart.generic(E => {
let ListQueueOfE = () => (ListQueueOfE = dart.constFn(collection.ListQueue$(E)))();
- let IterableOfE = () => (IterableOfE = dart.constFn(core.Iterable$(E)))();
+ let EfficientLengthIterableOfE = () => (EfficientLengthIterableOfE = dart.constFn(_internal.EfficientLengthIterable$(E)))();
class Queue extends core.Object {
static new() {
return new (ListQueueOfE())();
@@ -25994,33 +25990,30 @@
static from(elements) {
return ListQueueOfE().from(elements);
}
- [Symbol.iterator]() {
- return new dart.JsIterator(this.iterator);
- }
}
dart.addTypeTests(Queue);
- Queue[dart.implements] = () => [IterableOfE(), _internal.EfficientLength];
+ Queue[dart.implements] = () => [EfficientLengthIterableOfE()];
return Queue;
});
collection.Queue = Queue();
const _previousLink = Symbol('_previousLink');
const _nextLink = Symbol('_nextLink');
const _link = Symbol('_link');
-collection._DoubleLink$ = dart.generic(E => {
+collection._DoubleLink$ = dart.generic(Link => {
class _DoubleLink extends core.Object {
new() {
this[_previousLink] = null;
this[_nextLink] = null;
}
[_link](previous, next) {
- E._check(previous);
- E._check(next);
+ Link._check(previous);
+ Link._check(next);
this[_nextLink] = next;
this[_previousLink] = previous;
if (previous != null) previous[_nextLink] = this;
if (next != null) next[_previousLink] = this;
}
- [_unlink$]() {
+ [_unlink]() {
if (this[_previousLink] != null) this[_previousLink][_nextLink] = this[_nextLink];
if (this[_nextLink] != null) this[_nextLink][_previousLink] = this[_previousLink];
this[_nextLink] = null;
@@ -26030,46 +26023,34 @@
dart.addTypeTests(_DoubleLink);
dart.setSignature(_DoubleLink, {
fields: () => ({
- [_previousLink]: E,
- [_nextLink]: E
+ [_previousLink]: Link,
+ [_nextLink]: Link
}),
methods: () => ({
- [_link]: dart.definiteFunctionType(dart.void, [E, E]),
- [_unlink$]: dart.definiteFunctionType(dart.void, [])
+ [_link]: dart.definiteFunctionType(dart.void, [Link, Link]),
+ [_unlink]: dart.definiteFunctionType(dart.void, [])
})
});
return _DoubleLink;
});
collection._DoubleLink = _DoubleLink();
collection.DoubleLinkedQueueEntry$ = dart.generic(E => {
- let _UserDoubleLinkedQueueEntryOfE = () => (_UserDoubleLinkedQueueEntryOfE = dart.constFn(collection._UserDoubleLinkedQueueEntry$(E)))();
- class DoubleLinkedQueueEntry extends core.Object {
- static new(element) {
- return new (_UserDoubleLinkedQueueEntryOfE())(element);
- }
- }
- dart.addTypeTests(DoubleLinkedQueueEntry);
- return DoubleLinkedQueueEntry;
-});
-collection.DoubleLinkedQueueEntry = DoubleLinkedQueueEntry();
-collection._UserDoubleLinkedQueueEntry$ = dart.generic(E => {
- let _UserDoubleLinkedQueueEntryOfE = () => (_UserDoubleLinkedQueueEntryOfE = dart.constFn(collection._UserDoubleLinkedQueueEntry$(E)))();
let DoubleLinkedQueueEntryOfE = () => (DoubleLinkedQueueEntryOfE = dart.constFn(collection.DoubleLinkedQueueEntry$(E)))();
- class _UserDoubleLinkedQueueEntry extends collection._DoubleLink {
+ class DoubleLinkedQueueEntry extends collection._DoubleLink {
new(element) {
this.element = element;
super.new();
}
append(e) {
E._check(e);
- new (_UserDoubleLinkedQueueEntryOfE())(e)[_link](this, this[_nextLink]);
+ new (DoubleLinkedQueueEntryOfE())(e)[_link](this, this[_nextLink]);
}
prepend(e) {
E._check(e);
- new (_UserDoubleLinkedQueueEntryOfE())(e)[_link](this[_previousLink], this);
+ new (DoubleLinkedQueueEntryOfE())(e)[_link](this[_previousLink], this);
}
remove() {
- this[_unlink$]();
+ this[_unlink]();
return this.element;
}
previousEntry() {
@@ -26079,8 +26060,7 @@
return this[_nextLink];
}
}
- _UserDoubleLinkedQueueEntry[dart.implements] = () => [DoubleLinkedQueueEntryOfE()];
- dart.setSignature(_UserDoubleLinkedQueueEntry, {
+ dart.setSignature(DoubleLinkedQueueEntry, {
fields: () => ({element: E}),
methods: () => ({
append: dart.definiteFunctionType(dart.void, [E]),
@@ -26090,22 +26070,23 @@
nextEntry: dart.definiteFunctionType(collection.DoubleLinkedQueueEntry$(E), [])
})
});
- return _UserDoubleLinkedQueueEntry;
-}, _UserDoubleLinkedQueueEntry => {
- dart.setBaseClass(_UserDoubleLinkedQueueEntry, collection._DoubleLink$(_UserDoubleLinkedQueueEntry));
+ return DoubleLinkedQueueEntry;
+}, DoubleLinkedQueueEntry => {
+ dart.setBaseClass(DoubleLinkedQueueEntry, collection._DoubleLink$(DoubleLinkedQueueEntry));
});
-collection._UserDoubleLinkedQueueEntry = _UserDoubleLinkedQueueEntry();
+collection.DoubleLinkedQueueEntry = DoubleLinkedQueueEntry();
const _queue = Symbol('_queue');
const _append = Symbol('_append');
const _prepend = Symbol('_prepend');
const _asNonSentinelEntry = Symbol('_asNonSentinelEntry');
collection._DoubleLinkedQueueEntry$ = dart.generic(E => {
let _DoubleLinkedQueueElementOfE = () => (_DoubleLinkedQueueElementOfE = dart.constFn(collection._DoubleLinkedQueueElement$(E)))();
+ let _DoubleLinkedQueueEntryOfE = () => (_DoubleLinkedQueueEntryOfE = dart.constFn(collection._DoubleLinkedQueueEntry$(E)))();
let DoubleLinkedQueueOfE = () => (DoubleLinkedQueueOfE = dart.constFn(collection.DoubleLinkedQueue$(E)))();
- class _DoubleLinkedQueueEntry extends collection._DoubleLink {
- new(queue) {
+ class _DoubleLinkedQueueEntry extends collection.DoubleLinkedQueueEntry$(E) {
+ new(element, queue) {
this[_queue] = queue;
- super.new();
+ super.new(element);
}
[_append](e) {
E._check(e);
@@ -26115,34 +26096,34 @@
E._check(e);
new (_DoubleLinkedQueueElementOfE())(e, this[_queue])[_link](this[_previousLink], this);
}
+ get [_element]() {
+ return this.element;
+ }
nextEntry() {
- return this[_nextLink][_asNonSentinelEntry]();
+ let entry = _DoubleLinkedQueueEntryOfE()._check(this[_nextLink]);
+ return entry[_asNonSentinelEntry]();
}
previousEntry() {
- return this[_previousLink][_asNonSentinelEntry]();
+ let entry = _DoubleLinkedQueueEntryOfE()._check(this[_previousLink]);
+ return entry[_asNonSentinelEntry]();
}
}
dart.setSignature(_DoubleLinkedQueueEntry, {
fields: () => ({[_queue]: DoubleLinkedQueueOfE()}),
+ getters: () => ({[_element]: dart.definiteFunctionType(E, [])}),
methods: () => ({
[_append]: dart.definiteFunctionType(dart.void, [E]),
- [_prepend]: dart.definiteFunctionType(dart.void, [E]),
- nextEntry: dart.definiteFunctionType(collection.DoubleLinkedQueueEntry$(E), []),
- previousEntry: dart.definiteFunctionType(collection.DoubleLinkedQueueEntry$(E), [])
+ [_prepend]: dart.definiteFunctionType(dart.void, [E])
})
});
return _DoubleLinkedQueueEntry;
-}, _DoubleLinkedQueueEntry => {
- dart.setBaseClass(_DoubleLinkedQueueEntry, collection._DoubleLink$(_DoubleLinkedQueueEntry));
});
collection._DoubleLinkedQueueEntry = _DoubleLinkedQueueEntry();
const _elementCount = Symbol('_elementCount');
collection._DoubleLinkedQueueElement$ = dart.generic(E => {
- let DoubleLinkedQueueEntryOfE = () => (DoubleLinkedQueueEntryOfE = dart.constFn(collection.DoubleLinkedQueueEntry$(E)))();
class _DoubleLinkedQueueElement extends collection._DoubleLinkedQueueEntry$(E) {
new(element, queue) {
- this.element = element;
- super.new(queue);
+ super.new(element, queue);
}
append(e) {
E._check(e);
@@ -26162,7 +26143,7 @@
}
[_remove]() {
this[_queue] = null;
- this[_unlink$]();
+ this[_unlink]();
return this.element;
}
remove() {
@@ -26176,14 +26157,9 @@
return this;
}
}
- _DoubleLinkedQueueElement[dart.implements] = () => [DoubleLinkedQueueEntryOfE()];
dart.setSignature(_DoubleLinkedQueueElement, {
- fields: () => ({element: E}),
methods: () => ({
- append: dart.definiteFunctionType(dart.void, [E]),
- prepend: dart.definiteFunctionType(dart.void, [E]),
[_remove]: dart.definiteFunctionType(E, []),
- remove: dart.definiteFunctionType(E, []),
[_asNonSentinelEntry]: dart.definiteFunctionType(collection._DoubleLinkedQueueElement$(E), [])
})
});
@@ -26193,7 +26169,7 @@
collection._DoubleLinkedQueueSentinel$ = dart.generic(E => {
class _DoubleLinkedQueueSentinel extends collection._DoubleLinkedQueueEntry$(E) {
new(queue) {
- super.new(queue);
+ super.new(null, queue);
this[_previousLink] = this;
this[_nextLink] = this;
}
@@ -26203,12 +26179,11 @@
[_remove]() {
dart.throw(_internal.IterableElementError.noElement());
}
- get element() {
+ get [_element]() {
dart.throw(_internal.IterableElementError.noElement());
}
}
dart.setSignature(_DoubleLinkedQueueSentinel, {
- getters: () => ({element: dart.definiteFunctionType(E, [])}),
methods: () => ({
[_asNonSentinelEntry]: dart.definiteFunctionType(collection.DoubleLinkedQueueEntry$(E), []),
[_remove]: dart.definiteFunctionType(E, [])
@@ -26222,6 +26197,7 @@
let _DoubleLinkedQueueSentinelOfE = () => (_DoubleLinkedQueueSentinelOfE = dart.constFn(collection._DoubleLinkedQueueSentinel$(E)))();
let DoubleLinkedQueueOfE = () => (DoubleLinkedQueueOfE = dart.constFn(collection.DoubleLinkedQueue$(E)))();
let IterableOfE = () => (IterableOfE = dart.constFn(core.Iterable$(E)))();
+ let _DoubleLinkedQueueEntryOfE = () => (_DoubleLinkedQueueEntryOfE = dart.constFn(collection._DoubleLinkedQueueEntry$(E)))();
let _DoubleLinkedQueueElementOfE = () => (_DoubleLinkedQueueElementOfE = dart.constFn(collection._DoubleLinkedQueueElement$(E)))();
let _DoubleLinkedQueueIteratorOfE = () => (_DoubleLinkedQueueIteratorOfE = dart.constFn(collection._DoubleLinkedQueueIterator$(E)))();
let QueueOfE = () => (QueueOfE = dart.constFn(collection.Queue$(E)))();
@@ -26269,34 +26245,42 @@
}
}
removeLast() {
- let lastEntry = this[_sentinel][_previousLink];
+ let lastEntry = _DoubleLinkedQueueEntryOfE()._check(this[_sentinel][_previousLink]);
let result = lastEntry[_remove]();
this[_elementCount] = dart.notNull(this[_elementCount]) - 1;
return result;
}
removeFirst() {
- let firstEntry = this[_sentinel][_nextLink];
+ let firstEntry = _DoubleLinkedQueueEntryOfE()._check(this[_sentinel][_nextLink]);
let result = firstEntry[_remove]();
this[_elementCount] = dart.notNull(this[_elementCount]) - 1;
return result;
}
remove(o) {
- let entry = this[_sentinel][_nextLink];
+ let entry = _DoubleLinkedQueueEntryOfE()._check(this[_sentinel][_nextLink]);
while (!core.identical(entry, this[_sentinel])) {
- if (dart.equals(entry.element, o)) {
+ let equals = dart.equals(entry[_element], o);
+ if (!core.identical(this, entry[_queue])) {
+ dart.throw(new core.ConcurrentModificationError(this));
+ }
+ if (equals) {
entry[_remove]();
this[_elementCount] = dart.notNull(this[_elementCount]) - 1;
return true;
}
- entry = entry[_nextLink];
+ entry = _DoubleLinkedQueueEntryOfE()._check(entry[_nextLink]);
}
return false;
}
[_filter](test, removeMatching) {
- let entry = this[_sentinel][_nextLink];
+ let entry = _DoubleLinkedQueueEntryOfE()._check(this[_sentinel][_nextLink]);
while (!core.identical(entry, this[_sentinel])) {
- let next = entry[_nextLink];
- if (core.identical(removeMatching, test(entry.element))) {
+ let matches = test(entry[_element]);
+ if (!core.identical(this, entry[_queue])) {
+ dart.throw(new core.ConcurrentModificationError(this));
+ }
+ let next = _DoubleLinkedQueueEntryOfE()._check(entry[_nextLink]);
+ if (core.identical(removeMatching, matches)) {
entry[_remove]();
this[_elementCount] = dart.notNull(this[_elementCount]) - 1;
}
@@ -26310,26 +26294,26 @@
this[_filter](test, false);
}
get first() {
- let firstEntry = this[_sentinel][_nextLink];
- return firstEntry.element;
+ let firstEntry = _DoubleLinkedQueueEntryOfE()._check(this[_sentinel][_nextLink]);
+ return firstEntry[_element];
}
get last() {
- let lastEntry = this[_sentinel][_previousLink];
- return lastEntry.element;
+ let lastEntry = _DoubleLinkedQueueEntryOfE()._check(this[_sentinel][_previousLink]);
+ return lastEntry[_element];
}
get single() {
if (core.identical(this[_sentinel][_nextLink], this[_sentinel][_previousLink])) {
- let entry = this[_sentinel][_nextLink];
- return entry.element;
+ let entry = _DoubleLinkedQueueEntryOfE()._check(this[_sentinel][_nextLink]);
+ return entry[_element];
}
dart.throw(_internal.IterableElementError.tooMany());
}
- lastEntry() {
- return this[_sentinel].previousEntry();
- }
firstEntry() {
return this[_sentinel].nextEntry();
}
+ lastEntry() {
+ return this[_sentinel].previousEntry();
+ }
get isEmpty() {
return core.identical(this[_sentinel][_nextLink], this[_sentinel]);
}
@@ -26338,13 +26322,18 @@
this[_sentinel][_previousLink] = this[_sentinel];
this[_elementCount] = 0;
}
- forEachEntry(f) {
- let entry = this[_sentinel][_nextLink];
+ forEachEntry(action) {
+ let entry = _DoubleLinkedQueueEntryOfE()._check(this[_sentinel][_nextLink]);
while (!core.identical(entry, this[_sentinel])) {
- let nextEntry = entry[_nextLink];
let element = _DoubleLinkedQueueElementOfE()._check(entry);
- f(element);
- entry = nextEntry;
+ let next = _DoubleLinkedQueueEntryOfE()._check(element[_nextLink]);
+ action(element);
+ if (core.identical(this, entry[_queue])) {
+ next = _DoubleLinkedQueueEntryOfE()._check(entry[_nextLink]);
+ } else if (!core.identical(this, next[_queue])) {
+ dart.throw(new core.ConcurrentModificationError(this));
+ }
+ entry = next;
}
}
get iterator() {
@@ -26372,8 +26361,8 @@
[_filter]: dart.definiteFunctionType(dart.void, [ETobool(), core.bool]),
removeWhere: dart.definiteFunctionType(dart.void, [ETobool()]),
retainWhere: dart.definiteFunctionType(dart.void, [ETobool()]),
- lastEntry: dart.definiteFunctionType(collection.DoubleLinkedQueueEntry$(E), []),
firstEntry: dart.definiteFunctionType(collection.DoubleLinkedQueueEntry$(E), []),
+ lastEntry: dart.definiteFunctionType(collection.DoubleLinkedQueueEntry$(E), []),
clear: dart.definiteFunctionType(dart.void, []),
forEachEntry: dart.definiteFunctionType(dart.void, [DoubleLinkedQueueEntryOfETovoid()])
})
@@ -26392,33 +26381,33 @@
collection.DoubleLinkedQueue = DoubleLinkedQueue();
const _nextEntry = Symbol('_nextEntry');
collection._DoubleLinkedQueueIterator$ = dart.generic(E => {
+ let _DoubleLinkedQueueEntryOfE = () => (_DoubleLinkedQueueEntryOfE = dart.constFn(collection._DoubleLinkedQueueEntry$(E)))();
let _DoubleLinkedQueueElementOfE = () => (_DoubleLinkedQueueElementOfE = dart.constFn(collection._DoubleLinkedQueueElement$(E)))();
let IteratorOfE = () => (IteratorOfE = dart.constFn(core.Iterator$(E)))();
let _DoubleLinkedQueueSentinelOfE = () => (_DoubleLinkedQueueSentinelOfE = dart.constFn(collection._DoubleLinkedQueueSentinel$(E)))();
- let _DoubleLinkedQueueEntryOfE = () => (_DoubleLinkedQueueEntryOfE = dart.constFn(collection._DoubleLinkedQueueEntry$(E)))();
class _DoubleLinkedQueueIterator extends core.Object {
new(sentinel) {
this[_sentinel] = sentinel;
- this[_nextEntry] = sentinel[_nextLink];
- this[_current$2] = null;
+ this[_nextEntry] = _DoubleLinkedQueueEntryOfE()._check(sentinel[_nextLink]);
+ this[_current$1] = null;
}
moveNext() {
if (core.identical(this[_nextEntry], this[_sentinel])) {
- this[_current$2] = null;
+ this[_current$1] = null;
this[_nextEntry] = null;
this[_sentinel] = null;
return false;
}
let elementEntry = _DoubleLinkedQueueElementOfE()._check(this[_nextEntry]);
- if (elementEntry[_queue] == null) {
+ if (!core.identical(this[_sentinel][_queue], elementEntry[_queue])) {
dart.throw(new core.ConcurrentModificationError(this[_sentinel][_queue]));
}
- this[_current$2] = elementEntry.element;
- this[_nextEntry] = elementEntry[_nextLink];
+ this[_current$1] = elementEntry[_element];
+ this[_nextEntry] = _DoubleLinkedQueueEntryOfE()._check(elementEntry[_nextLink]);
return true;
}
get current() {
- return this[_current$2];
+ return this[_current$1];
}
}
dart.addTypeTests(_DoubleLinkedQueueIterator);
@@ -26427,7 +26416,7 @@
fields: () => ({
[_sentinel]: _DoubleLinkedQueueSentinelOfE(),
[_nextEntry]: _DoubleLinkedQueueEntryOfE(),
- [_current$2]: E
+ [_current$1]: E
}),
getters: () => ({current: dart.definiteFunctionType(E, [])}),
methods: () => ({moveNext: dart.definiteFunctionType(core.bool, [])})
@@ -26450,7 +26439,7 @@
let QueueOfE = () => (QueueOfE = dart.constFn(collection.Queue$(E)))();
let ETovoid = () => (ETovoid = dart.constFn(dart.functionType(dart.void, [E])))();
let ETobool = () => (ETobool = dart.constFn(dart.functionType(core.bool, [E])))();
- class ListQueue extends core.Iterable$(E) {
+ class ListQueue extends _internal.ListIterable$(E) {
new(initialCapacity) {
if (initialCapacity === void 0) initialCapacity = null;
this[_head] = 0;
@@ -26478,7 +26467,7 @@
return queue;
} else {
let capacity = collection.ListQueue._INITIAL_CAPACITY;
- if (_internal.EfficientLength.is(elements)) {
+ if (_internal.EfficientLengthIterable.is(elements)) {
capacity = elements[dartx.length];
}
let result = new (ListQueueOfE())(capacity);
@@ -26727,7 +26716,6 @@
[_tail]: core.int,
[_modificationCount]: core.int
}),
- getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])}),
methods: () => ({
add: dart.definiteFunctionType(dart.void, [E]),
addAll: dart.definiteFunctionType(dart.void, [IterableOfE()]),
@@ -26780,18 +26768,18 @@
this[_end] = queue[_tail];
this[_modificationCount] = queue[_modificationCount];
this[_position] = queue[_head];
- this[_current$2] = null;
+ this[_current$1] = null;
}
get current() {
- return this[_current$2];
+ return this[_current$1];
}
moveNext() {
this[_queue][_checkModification](this[_modificationCount]);
if (this[_position] == this[_end]) {
- this[_current$2] = null;
+ this[_current$1] = null;
return false;
}
- this[_current$2] = this[_queue][_table][dartx._get](this[_position]);
+ this[_current$1] = this[_queue][_table][dartx._get](this[_position]);
this[_position] = (dart.notNull(this[_position]) + 1 & dart.notNull(this[_queue][_table][dartx.length]) - 1) >>> 0;
return true;
}
@@ -26804,7 +26792,7 @@
[_end]: core.int,
[_modificationCount]: core.int,
[_position]: core.int,
- [_current$2]: E
+ [_current$1]: E
}),
getters: () => ({current: dart.definiteFunctionType(E, [])}),
methods: () => ({moveNext: dart.definiteFunctionType(core.bool, [])})
@@ -26860,7 +26848,7 @@
const _splayMin = Symbol('_splayMin');
const _splayMax = Symbol('_splayMax');
const _addNewRoot = Symbol('_addNewRoot');
-const _clear$ = Symbol('_clear');
+const _clear = Symbol('_clear');
collection._SplayTree$ = dart.generic((K, Node) => {
class _SplayTree extends core.Object {
new() {
@@ -26985,7 +26973,7 @@
this[_root] = this[_splayMax](this[_root]);
return this[_root];
}
- [_clear$]() {
+ [_clear]() {
this[_root] = null;
this[_count$] = 0;
this[_modificationCount] = dart.notNull(this[_modificationCount]) + 1;
@@ -27008,7 +26996,7 @@
[_splayMax]: dart.definiteFunctionType(Node, [Node]),
[_remove]: dart.definiteFunctionType(Node, [K]),
[_addNewRoot]: dart.definiteFunctionType(dart.void, [Node, core.int]),
- [_clear$]: dart.definiteFunctionType(dart.void, [])
+ [_clear]: dart.definiteFunctionType(dart.void, [])
})
});
return _SplayTree;
@@ -27165,7 +27153,7 @@
return this[_count$];
}
clear() {
- this[_clear$]();
+ this[_clear]();
}
containsKey(key) {
return dart.test(dart.dcall(this[_validKey], key)) && this[_splay](K.as(key)) == 0;
@@ -27385,7 +27373,7 @@
let SplayTreeSetOfK = () => (SplayTreeSetOfK = dart.constFn(collection.SplayTreeSet$(K)))();
let _SplayTreeNodeOfK = () => (_SplayTreeNodeOfK = dart.constFn(collection._SplayTreeNode$(K)))();
let _SplayTreeOfK$_SplayTreeNodeOfK = () => (_SplayTreeOfK$_SplayTreeNodeOfK = dart.constFn(collection._SplayTree$(K, _SplayTreeNodeOfK())))();
- class _SplayTreeKeyIterable extends core.Iterable$(K) {
+ class _SplayTreeKeyIterable extends _internal.EfficientLengthIterable$(K) {
new(tree) {
this[_tree] = tree;
super.new();
@@ -27406,7 +27394,6 @@
return set;
}
}
- _SplayTreeKeyIterable[dart.implements] = () => [_internal.EfficientLength];
dart.setSignature(_SplayTreeKeyIterable, {
fields: () => ({[_tree]: _SplayTreeOfK$_SplayTreeNodeOfK()}),
getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(K), [])})
@@ -27418,7 +27405,7 @@
collection._SplayTreeValueIterable$ = dart.generic((K, V) => {
let _SplayTreeValueIteratorOfK$V = () => (_SplayTreeValueIteratorOfK$V = dart.constFn(collection._SplayTreeValueIterator$(K, V)))();
let SplayTreeMapOfK$V = () => (SplayTreeMapOfK$V = dart.constFn(collection.SplayTreeMap$(K, V)))();
- class _SplayTreeValueIterable extends core.Iterable$(V) {
+ class _SplayTreeValueIterable extends _internal.EfficientLengthIterable$(V) {
new(map) {
this[_map$0] = map;
super.new();
@@ -27433,7 +27420,6 @@
return new (_SplayTreeValueIteratorOfK$V())(this[_map$0]);
}
}
- _SplayTreeValueIterable[dart.implements] = () => [_internal.EfficientLength];
dart.setSignature(_SplayTreeValueIterable, {
fields: () => ({[_map$0]: SplayTreeMapOfK$V()}),
getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(V), [])})
@@ -27649,7 +27635,7 @@
return _;
}
clear() {
- this[_clear$]();
+ this[_clear]();
}
toSet() {
return this[_clone]();
@@ -28186,7 +28172,7 @@
core.List$ = dart.generic(E => {
let JSArrayOfE = () => (JSArrayOfE = dart.constFn(_interceptors.JSArray$(E)))();
let ListOfE = () => (ListOfE = dart.constFn(core.List$(E)))();
- let IterableOfE = () => (IterableOfE = dart.constFn(core.Iterable$(E)))();
+ let EfficientLengthIterableOfE = () => (EfficientLengthIterableOfE = dart.constFn(_internal.EfficientLengthIterable$(E)))();
class List extends core.Object {
static new(length) {
if (length === void 0) length = null;
@@ -28237,12 +28223,9 @@
let result = ListOfE().from(elements, {growable: false});
return _internal.makeFixedListUnmodifiable(E)(result);
}
- [Symbol.iterator]() {
- return new dart.JsIterator(this[dartx.iterator]);
- }
}
dart.addTypeTests(List);
- List[dart.implements] = () => [IterableOfE(), _internal.EfficientLength];
+ List[dart.implements] = () => [EfficientLengthIterableOfE()];
return List;
});
core.List = List();
@@ -28381,6 +28364,7 @@
}
};
dart.addSimpleTypeTests(convert._UnicodeSubsetEncoder);
+convert._UnicodeSubsetEncoder[dart.implements] = () => [ChunkedConverterOfString$ListOfint$String$ListOfint()];
dart.setSignature(convert._UnicodeSubsetEncoder, {
fields: () => ({[_subsetMask]: core.int}),
methods: () => ({
@@ -28463,6 +28447,7 @@
}
};
dart.addSimpleTypeTests(convert._UnicodeSubsetDecoder);
+convert._UnicodeSubsetDecoder[dart.implements] = () => [ChunkedConverterOfListOfint$String$ListOfint$String()];
dart.setSignature(convert._UnicodeSubsetDecoder, {
fields: () => ({
[_allowInvalid]: core.bool,
@@ -28627,6 +28612,7 @@
};
dart.addSimpleTypeTests(convert.Base64Encoder);
dart.defineNamedConstructor(convert.Base64Encoder, 'urlSafe');
+convert.Base64Encoder[dart.implements] = () => [ChunkedConverterOfListOfint$String$ListOfint$String()];
dart.setSignature(convert.Base64Encoder, {
fields: () => ({[_urlSafe]: core.bool}),
methods: () => ({
@@ -28653,6 +28639,104 @@
get decoder() {
return const$33 || (const$33 = dart.const(new convert.Base64Decoder()));
}
+ normalize(source, start, end) {
+ if (start === void 0) start = 0;
+ if (end === void 0) end = null;
+ end = core.RangeError.checkValidRange(start, end, source[dartx.length]);
+ let percent = 37;
+ let equals = 61;
+ let buffer = null;
+ let sliceStart = start;
+ let alphabet = convert._Base64Encoder._base64Alphabet;
+ let inverseAlphabet = convert._Base64Decoder._inverseAlphabet;
+ let firstPadding = -1;
+ let firstPaddingSourceIndex = -1;
+ let paddingCount = 0;
+ for (let i = start; dart.notNull(i) < dart.notNull(end);) {
+ let sliceEnd = i;
+ let char = source[dartx.codeUnitAt]((() => {
+ let x = i;
+ i = dart.notNull(x) + 1;
+ return x;
+ })());
+ let originalChar = char;
+ if (char == percent) {
+ if (dart.notNull(i) + 2 <= dart.notNull(end)) {
+ char = _internal.parseHexByte(source, i);
+ i = dart.notNull(i) + 2;
+ if (char == percent) char = -1;
+ } else {
+ char = -1;
+ }
+ }
+ if (0 <= dart.notNull(char) && dart.notNull(char) <= 127) {
+ let value = inverseAlphabet[dartx._get](char);
+ if (dart.notNull(value) >= 0) {
+ char = alphabet[dartx.codeUnitAt](value);
+ if (char == originalChar) continue;
+ } else if (value == convert._Base64Decoder._padding) {
+ if (dart.notNull(firstPadding) < 0) {
+ firstPadding = (() => {
+ let l = dart.nullSafe(buffer, _ => _.length);
+ return l != null ? l : 0;
+ })() + (dart.notNull(sliceEnd) - dart.notNull(sliceStart));
+ firstPaddingSourceIndex = sliceEnd;
+ }
+ paddingCount = dart.notNull(paddingCount) + 1;
+ if (originalChar == equals) continue;
+ }
+ if (value != convert._Base64Decoder._invalid) {
+ let t = buffer;
+ t == null ? buffer = new core.StringBuffer() : t;
+ buffer.write(source[dartx.substring](sliceStart, sliceEnd));
+ buffer.writeCharCode(char);
+ sliceStart = i;
+ continue;
+ }
+ }
+ dart.throw(new core.FormatException("Invalid base64 data", source, sliceEnd));
+ }
+ if (buffer != null) {
+ buffer.write(source[dartx.substring](sliceStart, end));
+ if (dart.notNull(firstPadding) >= 0) {
+ convert.Base64Codec._checkPadding(source, firstPaddingSourceIndex, end, firstPadding, paddingCount, buffer.length);
+ } else {
+ let endLength = (dart.notNull(buffer.length) - 1)[dartx['%']](4) + 1;
+ if (endLength == 1) {
+ dart.throw(new core.FormatException("Invalid base64 encoding length ", source, end));
+ }
+ while (dart.notNull(endLength) < 4) {
+ buffer.write("=");
+ endLength = dart.notNull(endLength) + 1;
+ }
+ }
+ return source[dartx.replaceRange](start, end, dart.toString(buffer));
+ }
+ let length = dart.notNull(end) - dart.notNull(start);
+ if (dart.notNull(firstPadding) >= 0) {
+ convert.Base64Codec._checkPadding(source, firstPaddingSourceIndex, end, firstPadding, paddingCount, length);
+ } else {
+ let endLength = length[dartx['%']](4);
+ if (endLength == 1) {
+ dart.throw(new core.FormatException("Invalid base64 encoding length ", source, end));
+ }
+ if (dart.notNull(endLength) > 1) {
+ source = source[dartx.replaceRange](end, end, endLength == 2 ? "==" : "=");
+ }
+ }
+ return source;
+ }
+ static _checkPadding(source, sourceIndex, sourceEnd, firstPadding, paddingCount, length) {
+ if (length[dartx['%']](4) != 0) {
+ dart.throw(new core.FormatException("Invalid base64 padding, padded length must be multiple of four, " + dart.str`is ${length}`, source, sourceEnd));
+ }
+ if (dart.notNull(firstPadding) + dart.notNull(paddingCount) != length) {
+ dart.throw(new core.FormatException("Invalid base64 padding, '=' not at the end", source, sourceIndex));
+ }
+ if (dart.notNull(paddingCount) > 2) {
+ dart.throw(new core.FormatException("Invalid base64 padding, more than two '=' characters", source, sourceIndex));
+ }
+ }
};
dart.addSimpleTypeTests(convert.Base64Codec);
dart.defineNamedConstructor(convert.Base64Codec, 'urlSafe');
@@ -28661,7 +28745,10 @@
getters: () => ({
encoder: dart.definiteFunctionType(convert.Base64Encoder, []),
decoder: dart.definiteFunctionType(convert.Base64Decoder, [])
- })
+ }),
+ methods: () => ({normalize: dart.definiteFunctionType(core.String, [core.String], [core.int, core.int])}),
+ statics: () => ({_checkPadding: dart.definiteFunctionType(core.int, [core.String, core.int, core.int, core.int, core.int, core.int])}),
+ names: ['_checkPadding']
});
convert.BASE64 = dart.const(new convert.Base64Codec());
convert.BASE64URL = dart.const(new convert.Base64Codec.urlSafe());
@@ -28925,6 +29012,7 @@
}
};
dart.addSimpleTypeTests(convert.Base64Decoder);
+convert.Base64Decoder[dart.implements] = () => [ChunkedConverterOfString$ListOfint$String$ListOfint()];
dart.setSignature(convert.Base64Decoder, {
methods: () => ({
convert: dart.definiteFunctionType(core.List$(core.int), [core.String], [core.int, core.int]),
@@ -29453,6 +29541,7 @@
});
convert._InvertedCodec = _InvertedCodec();
convert._FusedConverter$ = dart.generic((S, M, T) => {
+ let ChunkedConverterOfS$T$S$T = () => (ChunkedConverterOfS$T$S$T = dart.constFn(convert.ChunkedConverter$(S, T, S, T)))();
let ConverterOfS$M = () => (ConverterOfS$M = dart.constFn(convert.Converter$(S, M)))();
let ConverterOfM$T = () => (ConverterOfM$T = dart.constFn(convert.Converter$(M, T)))();
let SinkOfT = () => (SinkOfT = dart.constFn(core.Sink$(T)))();
@@ -29471,6 +29560,7 @@
return this[_first$0].startChunkedConversion(this[_second].startChunkedConversion(sink));
}
}
+ _FusedConverter[dart.implements] = () => [ChunkedConverterOfS$T$S$T()];
dart.setSignature(_FusedConverter, {
fields: () => ({
[_first$0]: ConverterOfS$M(),
@@ -29605,6 +29695,7 @@
}
};
dart.addSimpleTypeTests(convert.HtmlEscape);
+convert.HtmlEscape[dart.implements] = () => [ChunkedConverterOfString$String$String$String()];
dart.setSignature(convert.HtmlEscape, {
fields: () => ({mode: convert.HtmlEscapeMode}),
methods: () => ({
@@ -29764,6 +29855,7 @@
};
dart.addSimpleTypeTests(convert.JsonEncoder);
dart.defineNamedConstructor(convert.JsonEncoder, 'withIndent');
+convert.JsonEncoder[dart.implements] = () => [ChunkedConverterOfObject$String$Object$String()];
dart.setSignature(convert.JsonEncoder, {
fields: () => ({
indent: core.String,
@@ -29836,6 +29928,7 @@
}
};
dart.addSimpleTypeTests(convert.JsonUtf8Encoder);
+convert.JsonUtf8Encoder[dart.implements] = () => [ChunkedConverterOfObject$ListOfint$Object$ListOfint()];
dart.setSignature(convert.JsonUtf8Encoder, {
fields: () => ({
[_indent]: ListOfint(),
@@ -29943,6 +30036,7 @@
}
};
dart.addSimpleTypeTests(convert.JsonDecoder);
+convert.JsonDecoder[dart.implements] = () => [ChunkedConverterOfString$Object$String$Object()];
dart.setSignature(convert.JsonDecoder, {
fields: () => ({[_reviver]: convert._Reviver}),
methods: () => ({
@@ -31071,6 +31165,7 @@
}
};
dart.addSimpleTypeTests(convert.Utf8Encoder);
+convert.Utf8Encoder[dart.implements] = () => [ChunkedConverterOfString$ListOfint$String$ListOfint()];
dart.setSignature(convert.Utf8Encoder, {
methods: () => ({
convert: dart.definiteFunctionType(core.List$(core.int), [core.String], [core.int, core.int]),
@@ -31283,7 +31378,7 @@
let buffer = new core.StringBuffer();
let decoder = new convert._Utf8Decoder(buffer, this[_allowMalformed]);
decoder.convert(codeUnits, start, end);
- decoder.close();
+ decoder.flush(codeUnits, end);
return buffer.toString();
}
startChunkedConversion(sink) {
@@ -31308,6 +31403,7 @@
}
};
dart.addSimpleTypeTests(convert.Utf8Decoder);
+convert.Utf8Decoder[dart.implements] = () => [ChunkedConverterOfListOfint$String$ListOfint$String()];
dart.setSignature(convert.Utf8Decoder, {
fields: () => ({[_allowMalformed]: core.bool}),
methods: () => ({
@@ -31357,10 +31453,12 @@
close() {
this.flush();
}
- flush() {
+ flush(source, offset) {
+ if (source === void 0) source = null;
+ if (offset === void 0) offset = null;
if (dart.test(this.hasPartialInput)) {
if (!dart.test(this[_allowMalformed])) {
- dart.throw(new core.FormatException("Unfinished UTF-8 octet sequence"));
+ dart.throw(new core.FormatException("Unfinished UTF-8 octet sequence", source, offset));
}
this[_stringSink].writeCharCode(convert.UNICODE_REPLACEMENT_CHARACTER_RUNE);
this[_value] = 0;
@@ -31404,7 +31502,7 @@
if ((dart.notNull(unit) & 192) != 128) {
expectedUnits = 0;
if (!dart.test(this[_allowMalformed])) {
- dart.throw(new core.FormatException(dart.str`Bad UTF-8 encoding 0x${unit[dartx.toRadixString](16)}`));
+ dart.throw(new core.FormatException(dart.str`Bad UTF-8 encoding 0x${unit[dartx.toRadixString](16)}`, codeUnits, i));
}
this[_isFirstCharacter] = false;
this[_stringSink].writeCharCode(convert.UNICODE_REPLACEMENT_CHARACTER_RUNE);
@@ -31417,14 +31515,14 @@
} while (dart.notNull(expectedUnits) > 0);
if (dart.notNull(value) <= dart.notNull(convert._Utf8Decoder._LIMITS[dartx._get](dart.notNull(extraUnits) - 1))) {
if (!dart.test(this[_allowMalformed])) {
- dart.throw(new core.FormatException(dart.str`Overlong encoding of 0x${value[dartx.toRadixString](16)}`));
+ dart.throw(new core.FormatException(dart.str`Overlong encoding of 0x${value[dartx.toRadixString](16)}`, codeUnits, dart.notNull(i) - dart.notNull(extraUnits) - 1));
}
expectedUnits = extraUnits = 0;
value = convert.UNICODE_REPLACEMENT_CHARACTER_RUNE;
}
if (dart.notNull(value) > convert._FOUR_BYTE_LIMIT) {
if (!dart.test(this[_allowMalformed])) {
- dart.throw(new core.FormatException("Character outside valid Unicode range: " + dart.str`0x${value[dartx.toRadixString](16)}`));
+ dart.throw(new core.FormatException("Character outside valid Unicode range: " + dart.str`0x${value[dartx.toRadixString](16)}`, codeUnits, dart.notNull(i) - dart.notNull(extraUnits) - 1));
}
value = convert.UNICODE_REPLACEMENT_CHARACTER_RUNE;
}
@@ -31448,7 +31546,7 @@
})());
if (dart.notNull(unit) < 0) {
if (!dart.test(this[_allowMalformed])) {
- dart.throw(new core.FormatException(dart.str`Negative UTF-8 code unit: -0x${(-dart.notNull(unit))[dartx.toRadixString](16)}`));
+ dart.throw(new core.FormatException(dart.str`Negative UTF-8 code unit: -0x${(-dart.notNull(unit))[dartx.toRadixString](16)}`, codeUnits, dart.notNull(i) - 1));
}
this[_stringSink].writeCharCode(convert.UNICODE_REPLACEMENT_CHARACTER_RUNE);
} else {
@@ -31469,7 +31567,7 @@
continue loop;
}
if (!dart.test(this[_allowMalformed])) {
- dart.throw(new core.FormatException(dart.str`Bad UTF-8 encoding 0x${unit[dartx.toRadixString](16)}`));
+ dart.throw(new core.FormatException(dart.str`Bad UTF-8 encoding 0x${unit[dartx.toRadixString](16)}`, codeUnits, dart.notNull(i) - 1));
}
value = convert.UNICODE_REPLACEMENT_CHARACTER_RUNE;
expectedUnits = extraUnits = 0;
@@ -31498,7 +31596,7 @@
getters: () => ({hasPartialInput: dart.definiteFunctionType(core.bool, [])}),
methods: () => ({
close: dart.definiteFunctionType(dart.void, []),
- flush: dart.definiteFunctionType(dart.void, []),
+ flush: dart.definiteFunctionType(dart.void, [], [ListOfint(), core.int]),
convert: dart.definiteFunctionType(dart.void, [ListOfint(), core.int, core.int])
})
});
@@ -31535,6 +31633,7 @@
};
core.proxy = dart.const(new core._Proxy());
dart.defineExtensionNames([
+ 'hashCode',
'toString'
]);
core.bool = class bool extends core.Object {
@@ -31542,6 +31641,9 @@
let defaultValue = opts && 'defaultValue' in opts ? opts.defaultValue : false;
dart.throw(new core.UnsupportedError('bool.fromEnvironment can only be used as a const constructor'));
}
+ get [dartx.hashCode]() {
+ return super.hashCode;
+ }
[dartx.toString]() {
return this ? "true" : "false";
}
@@ -32678,108 +32780,42 @@
return _Generator;
});
core._Generator = _Generator();
-const _end$ = Symbol('_end');
-const _start$0 = Symbol('_start');
const _generator$ = Symbol('_generator');
core._GeneratorIterable$ = dart.generic(E => {
let _GeneratorOfE = () => (_GeneratorOfE = dart.constFn(core._Generator$(E)))();
- let _GeneratorIteratorOfE = () => (_GeneratorIteratorOfE = dart.constFn(core._GeneratorIterator$(E)))();
- let EmptyIterableOfE = () => (EmptyIterableOfE = dart.constFn(_internal.EmptyIterable$(E)))();
- let _GeneratorIterableOfE = () => (_GeneratorIterableOfE = dart.constFn(core._GeneratorIterable$(E)))();
- class _GeneratorIterable extends core.Iterable$(E) {
- new(end, generator) {
- this[_end$] = end;
- this[_start$0] = 0;
+ class _GeneratorIterable extends _internal.ListIterable$(E) {
+ get length() {
+ return this[length$];
+ }
+ set length(value) {
+ super.length = value;
+ }
+ new(length, generator) {
+ this[length$] = length;
this[_generator$] = generator != null ? generator : _GeneratorOfE().as(core._GeneratorIterable._id);
super.new();
}
- slice(start, end, generator) {
- this[_start$0] = start;
- this[_end$] = end;
- this[_generator$] = generator;
- super.new();
- }
- get iterator() {
- return new (_GeneratorIteratorOfE())(this[_start$0], this[_end$], this[_generator$]);
- }
- get length() {
- return dart.notNull(this[_end$]) - dart.notNull(this[_start$0]);
- }
- skip(count) {
- core.RangeError.checkNotNegative(count, "count");
- if (count == 0) return this;
- let newStart = dart.notNull(this[_start$0]) + dart.notNull(count);
- if (newStart >= dart.notNull(this[_end$])) return new (EmptyIterableOfE())();
- return new (_GeneratorIterableOfE()).slice(newStart, this[_end$], this[_generator$]);
- }
- take(count) {
- core.RangeError.checkNotNegative(count, "count");
- if (count == 0) return new (EmptyIterableOfE())();
- let newEnd = dart.notNull(this[_start$0]) + dart.notNull(count);
- if (newEnd >= dart.notNull(this[_end$])) return this;
- return new (_GeneratorIterableOfE()).slice(this[_start$0], newEnd, this[_generator$]);
+ elementAt(index) {
+ core.RangeError.checkValidIndex(index, this);
+ return this[_generator$](index);
}
static _id(n) {
return n;
}
}
- dart.defineNamedConstructor(_GeneratorIterable, 'slice');
- _GeneratorIterable[dart.implements] = () => [_internal.EfficientLength];
+ const length$ = Symbol("_GeneratorIterable.length");
dart.setSignature(_GeneratorIterable, {
fields: () => ({
- [_start$0]: core.int,
- [_end$]: core.int,
+ length: core.int,
[_generator$]: _GeneratorOfE()
}),
- getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])}),
statics: () => ({_id: dart.definiteFunctionType(core.int, [core.int])}),
names: ['_id']
});
- dart.defineExtensionMembers(_GeneratorIterable, ['skip', 'take', 'iterator', 'length']);
+ dart.defineExtensionMembers(_GeneratorIterable, ['elementAt', 'length']);
return _GeneratorIterable;
});
core._GeneratorIterable = _GeneratorIterable();
-const _index$1 = Symbol('_index');
-const _current$3 = Symbol('_current');
-core._GeneratorIterator$ = dart.generic(E => {
- let IteratorOfE = () => (IteratorOfE = dart.constFn(core.Iterator$(E)))();
- let _GeneratorOfE = () => (_GeneratorOfE = dart.constFn(core._Generator$(E)))();
- class _GeneratorIterator extends core.Object {
- new(index, end, generator) {
- this[_index$1] = index;
- this[_end$] = end;
- this[_generator$] = generator;
- this[_current$3] = null;
- }
- moveNext() {
- if (dart.notNull(this[_index$1]) < dart.notNull(this[_end$])) {
- this[_current$3] = this[_generator$](this[_index$1]);
- this[_index$1] = dart.notNull(this[_index$1]) + 1;
- return true;
- } else {
- this[_current$3] = null;
- return false;
- }
- }
- get current() {
- return this[_current$3];
- }
- }
- dart.addTypeTests(_GeneratorIterator);
- _GeneratorIterator[dart.implements] = () => [IteratorOfE()];
- dart.setSignature(_GeneratorIterator, {
- fields: () => ({
- [_end$]: core.int,
- [_generator$]: _GeneratorOfE(),
- [_index$1]: core.int,
- [_current$3]: E
- }),
- getters: () => ({current: dart.definiteFunctionType(E, [])}),
- methods: () => ({moveNext: dart.definiteFunctionType(core.bool, [])})
- });
- return _GeneratorIterator;
-});
-core._GeneratorIterator = _GeneratorIterator();
core.BidirectionalIterator$ = dart.generic(E => {
let IteratorOfE = () => (IteratorOfE = dart.constFn(core.Iterator$(E)))();
class BidirectionalIterator extends core.Object {}
@@ -32821,6 +32857,9 @@
static _uninstantiable() {
dart.throw(new core.UnsupportedError('class Null cannot be instantiated'));
}
+ get hashCode() {
+ return super.hashCode;
+ }
toString() {
return "null";
}
@@ -32856,7 +32895,7 @@
core.RegExp[dart.implements] = () => [core.Pattern];
core.Set$ = dart.generic(E => {
let LinkedHashSetOfE = () => (LinkedHashSetOfE = dart.constFn(collection.LinkedHashSet$(E)))();
- class Set extends core.Iterable$(E) {
+ class Set extends _internal.EfficientLengthIterable$(E) {
static new() {
return LinkedHashSetOfE().new();
}
@@ -32867,7 +32906,6 @@
return LinkedHashSetOfE().from(elements);
}
}
- Set[dart.implements] = () => [_internal.EfficientLength];
return Set;
});
core.Set = Set();
@@ -32900,41 +32938,38 @@
dart.setSignature(core._StringStackTrace, {
fields: () => ({[_stackTrace]: core.String})
});
+const _start$0 = Symbol('_start');
const _stop = Symbol('_stop');
core.Stopwatch = class Stopwatch extends core.Object {
+ new() {
+ this[_start$0] = 0;
+ this[_stop] = 0;
+ if (core.Stopwatch._frequency == null) core.Stopwatch._initTicker();
+ }
get frequency() {
return core.Stopwatch._frequency;
}
- new() {
- this[_start$0] = null;
- this[_stop] = null;
- core.Stopwatch._initTicker();
- }
start() {
- if (dart.test(this.isRunning)) return;
- if (this[_start$0] == null) {
- this[_start$0] = core.Stopwatch._now();
- } else {
- this[_start$0] = dart.notNull(core.Stopwatch._now()) - (dart.notNull(this[_stop]) - dart.notNull(this[_start$0]));
+ if (this[_stop] != null) {
+ this[_start$0] = dart.notNull(this[_start$0]) + (dart.notNull(core.Stopwatch._now()) - dart.notNull(this[_stop]));
this[_stop] = null;
}
}
stop() {
- if (!dart.test(this.isRunning)) return;
- this[_stop] = core.Stopwatch._now();
+ let t = this[_stop];
+ t == null ? this[_stop] = core.Stopwatch._now() : t;
}
reset() {
- if (this[_start$0] == null) return;
- this[_start$0] = core.Stopwatch._now();
- if (this[_stop] != null) {
- this[_stop] = this[_start$0];
- }
+ this[_start$0] = (() => {
+ let l = this[_stop];
+ return l != null ? l : core.Stopwatch._now();
+ })();
}
get elapsedTicks() {
- if (this[_start$0] == null) {
- return 0;
- }
- return this[_stop] == null ? dart.notNull(core.Stopwatch._now()) - dart.notNull(this[_start$0]) : dart.notNull(this[_stop]) - dart.notNull(this[_start$0]);
+ return dart.notNull((() => {
+ let l = this[_stop];
+ return l != null ? l : core.Stopwatch._now();
+ })()) - dart.notNull(this[_start$0]);
}
get elapsed() {
return new core.Duration({microseconds: this.elapsedMicroseconds});
@@ -32946,7 +32981,7 @@
return (dart.notNull(this.elapsedTicks) * 1000 / dart.notNull(this.frequency))[dartx.truncate]();
}
get isRunning() {
- return this[_start$0] != null && this[_stop] == null;
+ return this[_stop] == null;
}
static _initTicker() {
_js_helper.Primitives.initTicker();
@@ -33222,37 +33257,471 @@
return new _internal.Symbol(name);
}
};
+core._SPACE = 32;
+core._PERCENT = 37;
+core._AMPERSAND = 38;
+core._PLUS = 43;
+core._DOT = 46;
+core._SLASH = 47;
+core._COLON = 58;
+core._EQUALS = 61;
+core._UPPER_CASE_A = 65;
+core._UPPER_CASE_Z = 90;
+core._LEFT_BRACKET = 91;
+core._BACKSLASH = 92;
+core._RIGHT_BRACKET = 93;
+core._LOWER_CASE_A = 97;
+core._LOWER_CASE_F = 102;
+core._LOWER_CASE_Z = 122;
+core._hexDigits = "0123456789ABCDEF";
+core.Uri = class Uri extends core.Object {
+ static get base() {
+ let uri = _js_helper.Primitives.currentUri();
+ if (uri != null) return core.Uri.parse(uri);
+ dart.throw(new core.UnsupportedError("'Uri.base' is not supported"));
+ }
+ static new(opts) {
+ return core._Uri.new(opts);
+ }
+ static http(authority, unencodedPath, queryParameters) {
+ return core._Uri.http(authority, unencodedPath, queryParameters);
+ }
+ static https(authority, unencodedPath, queryParameters) {
+ return core._Uri.https(authority, unencodedPath, queryParameters);
+ }
+ static file(path, opts) {
+ return core._Uri.file(path, opts);
+ }
+ static directory(path, opts) {
+ return core._Uri.directory(path, opts);
+ }
+ static dataFromString(content, opts) {
+ let mimeType = opts && 'mimeType' in opts ? opts.mimeType : null;
+ let encoding = opts && 'encoding' in opts ? opts.encoding : null;
+ let parameters = opts && 'parameters' in opts ? opts.parameters : null;
+ let base64 = opts && 'base64' in opts ? opts.base64 : false;
+ let data = core.UriData.fromString(content, {mimeType: mimeType, encoding: encoding, parameters: parameters, base64: base64});
+ return data.uri;
+ }
+ static dataFromBytes(bytes, opts) {
+ let mimeType = opts && 'mimeType' in opts ? opts.mimeType : "application/octet-stream";
+ let parameters = opts && 'parameters' in opts ? opts.parameters : null;
+ let percentEncoded = opts && 'percentEncoded' in opts ? opts.percentEncoded : false;
+ let data = core.UriData.fromBytes(bytes, {mimeType: mimeType, parameters: parameters, percentEncoded: percentEncoded});
+ return data.uri;
+ }
+ get hasScheme() {
+ return this.scheme[dartx.isNotEmpty];
+ }
+ static parse(uri, start, end) {
+ if (start === void 0) start = 0;
+ if (end === void 0) end = null;
+ let t = end;
+ t == null ? end = uri[dartx.length] : t;
+ if (dart.notNull(end) >= dart.notNull(start) + 5) {
+ let dataDelta = core._startsWithData(uri, start);
+ if (dataDelta == 0) {
+ if (dart.notNull(start) > 0 || dart.notNull(end) < dart.notNull(uri[dartx.length])) uri = uri[dartx.substring](start, end);
+ return core.UriData._parse(uri, 5, null).uri;
+ } else if (dataDelta == 32) {
+ return core.UriData._parse(uri[dartx.substring](dart.notNull(start) + 5, end), 0, null).uri;
+ }
+ }
+ let indices = ListOfint().new(8);
+ indices[dartx._set](0, 0);
+ indices[dartx._set](core._schemeEndIndex, dart.notNull(start) - 1);
+ indices[dartx._set](core._hostStartIndex, dart.notNull(start) - 1);
+ indices[dartx._set](core._notSimpleIndex, dart.notNull(start) - 1);
+ indices[dartx._set](core._portStartIndex, start);
+ indices[dartx._set](core._pathStartIndex, start);
+ indices[dartx._set](core._queryStartIndex, end);
+ indices[dartx._set](core._fragmentStartIndex, end);
+ let state = core._scan(uri, start, end, core._uriStart, indices);
+ if (dart.notNull(state) >= core._nonSimpleEndStates) {
+ indices[dartx._set](core._notSimpleIndex, end);
+ }
+ let schemeEnd = indices[dartx._get](core._schemeEndIndex);
+ if (dart.notNull(schemeEnd) >= dart.notNull(start)) {
+ state = core._scan(uri, start, schemeEnd, core._schemeStart, indices);
+ if (state == core._schemeStart) {
+ indices[dartx._set](core._notSimpleIndex, schemeEnd);
+ }
+ }
+ let hostStart = dart.notNull(indices[dartx._get](core._hostStartIndex)) + 1;
+ let portStart = indices[dartx._get](core._portStartIndex);
+ let pathStart = indices[dartx._get](core._pathStartIndex);
+ let queryStart = indices[dartx._get](core._queryStartIndex);
+ let fragmentStart = indices[dartx._get](core._fragmentStartIndex);
+ let scheme = null;
+ if (dart.notNull(fragmentStart) < dart.notNull(queryStart)) queryStart = fragmentStart;
+ if (dart.notNull(pathStart) < dart.notNull(hostStart) || dart.notNull(pathStart) <= dart.notNull(schemeEnd)) {
+ pathStart = queryStart;
+ }
+ if (dart.notNull(portStart) < dart.notNull(hostStart)) portStart = pathStart;
+ dart.assert(hostStart == start || dart.notNull(schemeEnd) <= dart.notNull(hostStart));
+ dart.assert(dart.notNull(hostStart) <= dart.notNull(portStart));
+ dart.assert(dart.notNull(schemeEnd) <= dart.notNull(pathStart));
+ dart.assert(dart.notNull(portStart) <= dart.notNull(pathStart));
+ dart.assert(dart.notNull(pathStart) <= dart.notNull(queryStart));
+ dart.assert(dart.notNull(queryStart) <= dart.notNull(fragmentStart));
+ let isSimple = dart.notNull(indices[dartx._get](core._notSimpleIndex)) < dart.notNull(start);
+ if (isSimple) {
+ if (dart.notNull(hostStart) > dart.notNull(schemeEnd) + 3) {
+ isSimple = false;
+ } else if (dart.notNull(portStart) > dart.notNull(start) && dart.notNull(portStart) + 1 == pathStart) {
+ isSimple = false;
+ } else if (dart.notNull(queryStart) < dart.notNull(end) && queryStart == dart.notNull(pathStart) + 2 && dart.test(uri[dartx.startsWith]("..", pathStart)) || dart.notNull(queryStart) > dart.notNull(pathStart) + 2 && dart.test(uri[dartx.startsWith]("/..", dart.notNull(queryStart) - 3))) {
+ isSimple = false;
+ } else {
+ if (schemeEnd == dart.notNull(start) + 4) {
+ if (dart.test(uri[dartx.startsWith]("file", start))) {
+ scheme = "file";
+ if (dart.notNull(hostStart) <= dart.notNull(start)) {
+ let schemeAuth = "file://";
+ let delta = 2;
+ if (!dart.test(uri[dartx.startsWith]("/", pathStart))) {
+ schemeAuth = "file:///";
+ delta = 3;
+ }
+ uri = schemeAuth + dart.notNull(uri[dartx.substring](pathStart, end));
+ schemeEnd = dart.notNull(schemeEnd) - dart.notNull(start);
+ hostStart = 7;
+ portStart = 7;
+ pathStart = 7;
+ queryStart = dart.notNull(queryStart) + (delta - dart.notNull(start));
+ fragmentStart = dart.notNull(fragmentStart) + (delta - dart.notNull(start));
+ start = 0;
+ end = uri[dartx.length];
+ } else if (pathStart == queryStart) {
+ if (start == 0 && end == uri[dartx.length]) {
+ uri = uri[dartx.replaceRange](pathStart, queryStart, "/");
+ queryStart = dart.notNull(queryStart) + 1;
+ fragmentStart = dart.notNull(fragmentStart) + 1;
+ end = dart.notNull(end) + 1;
+ } else {
+ uri = dart.str`${uri[dartx.substring](start, pathStart)}/` + dart.str`${uri[dartx.substring](queryStart, end)}`;
+ schemeEnd = dart.notNull(schemeEnd) - dart.notNull(start);
+ hostStart = dart.notNull(hostStart) - dart.notNull(start);
+ portStart = dart.notNull(portStart) - dart.notNull(start);
+ pathStart = dart.notNull(pathStart) - dart.notNull(start);
+ queryStart = dart.notNull(queryStart) + (1 - dart.notNull(start));
+ fragmentStart = dart.notNull(fragmentStart) + (1 - dart.notNull(start));
+ start = 0;
+ end = uri[dartx.length];
+ }
+ }
+ } else if (dart.test(uri[dartx.startsWith]("http", start))) {
+ scheme = "http";
+ if (dart.notNull(portStart) > dart.notNull(start) && dart.notNull(portStart) + 3 == pathStart && dart.test(uri[dartx.startsWith]("80", dart.notNull(portStart) + 1))) {
+ if (start == 0 && end == uri[dartx.length]) {
+ uri = uri[dartx.replaceRange](portStart, pathStart, "");
+ pathStart = dart.notNull(pathStart) - 3;
+ queryStart = dart.notNull(queryStart) - 3;
+ fragmentStart = dart.notNull(fragmentStart) - 3;
+ end = dart.notNull(end) - 3;
+ } else {
+ uri = dart.notNull(uri[dartx.substring](start, portStart)) + dart.notNull(uri[dartx.substring](pathStart, end));
+ schemeEnd = dart.notNull(schemeEnd) - dart.notNull(start);
+ hostStart = dart.notNull(hostStart) - dart.notNull(start);
+ portStart = dart.notNull(portStart) - dart.notNull(start);
+ pathStart = dart.notNull(pathStart) - (3 + dart.notNull(start));
+ queryStart = dart.notNull(queryStart) - (3 + dart.notNull(start));
+ fragmentStart = dart.notNull(fragmentStart) - (3 + dart.notNull(start));
+ start = 0;
+ end = uri[dartx.length];
+ }
+ }
+ }
+ } else if (schemeEnd == dart.notNull(start) + 5 && dart.test(uri[dartx.startsWith]("https", start))) {
+ scheme = "https";
+ if (dart.notNull(portStart) > dart.notNull(start) && dart.notNull(portStart) + 4 == pathStart && dart.test(uri[dartx.startsWith]("443", dart.notNull(portStart) + 1))) {
+ if (start == 0 && end == uri[dartx.length]) {
+ uri = uri[dartx.replaceRange](portStart, pathStart, "");
+ pathStart = dart.notNull(pathStart) - 4;
+ queryStart = dart.notNull(queryStart) - 4;
+ fragmentStart = dart.notNull(fragmentStart) - 4;
+ end = dart.notNull(end) - 3;
+ } else {
+ uri = dart.notNull(uri[dartx.substring](start, portStart)) + dart.notNull(uri[dartx.substring](pathStart, end));
+ schemeEnd = dart.notNull(schemeEnd) - dart.notNull(start);
+ hostStart = dart.notNull(hostStart) - dart.notNull(start);
+ portStart = dart.notNull(portStart) - dart.notNull(start);
+ pathStart = dart.notNull(pathStart) - (4 + dart.notNull(start));
+ queryStart = dart.notNull(queryStart) - (4 + dart.notNull(start));
+ fragmentStart = dart.notNull(fragmentStart) - (4 + dart.notNull(start));
+ start = 0;
+ end = uri[dartx.length];
+ }
+ }
+ }
+ }
+ }
+ if (isSimple) {
+ if (dart.notNull(start) > 0 || dart.notNull(end) < dart.notNull(uri[dartx.length])) {
+ uri = uri[dartx.substring](start, end);
+ schemeEnd = dart.notNull(schemeEnd) - dart.notNull(start);
+ hostStart = dart.notNull(hostStart) - dart.notNull(start);
+ portStart = dart.notNull(portStart) - dart.notNull(start);
+ pathStart = dart.notNull(pathStart) - dart.notNull(start);
+ queryStart = dart.notNull(queryStart) - dart.notNull(start);
+ fragmentStart = dart.notNull(fragmentStart) - dart.notNull(start);
+ }
+ return new core._SimpleUri(uri, schemeEnd, hostStart, portStart, pathStart, queryStart, fragmentStart, scheme);
+ }
+ return core._Uri.notSimple(uri, start, end, schemeEnd, hostStart, portStart, pathStart, queryStart, fragmentStart, scheme);
+ }
+ static encodeComponent(component) {
+ return core._Uri._uriEncode(core._Uri._unreserved2396Table, component, convert.UTF8, false);
+ }
+ static encodeQueryComponent(component, opts) {
+ let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
+ return core._Uri._uriEncode(core._Uri._unreservedTable, component, encoding, true);
+ }
+ static decodeComponent(encodedComponent) {
+ return core._Uri._uriDecode(encodedComponent, 0, encodedComponent[dartx.length], convert.UTF8, false);
+ }
+ static decodeQueryComponent(encodedComponent, opts) {
+ let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
+ return core._Uri._uriDecode(encodedComponent, 0, encodedComponent[dartx.length], encoding, true);
+ }
+ static encodeFull(uri) {
+ return core._Uri._uriEncode(core._Uri._encodeFullTable, uri, convert.UTF8, false);
+ }
+ static decodeFull(uri) {
+ return core._Uri._uriDecode(uri, 0, uri[dartx.length], convert.UTF8, false);
+ }
+ static splitQueryString(query, opts) {
+ let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
+ return query[dartx.split]("&")[dartx.fold](MapOfString$String())(dart.map({}, core.String, core.String), dart.fn((map, element) => {
+ let index = element[dartx.indexOf]("=");
+ if (index == -1) {
+ if (element != "") {
+ map[dartx._set](core.Uri.decodeQueryComponent(element, {encoding: encoding}), "");
+ }
+ } else if (index != 0) {
+ let key = element[dartx.substring](0, index);
+ let value = element[dartx.substring](dart.notNull(index) + 1);
+ map[dartx._set](core.Uri.decodeQueryComponent(key, {encoding: encoding}), core.Uri.decodeQueryComponent(value, {encoding: encoding}));
+ }
+ return map;
+ }, MapOfString$StringAndStringToMapOfString$String()));
+ }
+ static parseIPv4Address(host) {
+ return core.Uri._parseIPv4Address(host, 0, host[dartx.length]);
+ }
+ static _parseIPv4Address(host, start, end) {
+ function error(msg, position) {
+ dart.throw(new core.FormatException(dart.str`Illegal IPv4 address, ${msg}`, host, position));
+ }
+ dart.fn(error, StringAndintTovoid());
+ let result = typed_data.Uint8List.new(4);
+ let partIndex = 0;
+ let partStart = start;
+ for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(i) + 1) {
+ let char = host[dartx.codeUnitAt](i);
+ if (char != core._DOT) {
+ if ((dart.notNull(char) ^ 48) >>> 0 > 9) {
+ error("invalid character", i);
+ }
+ } else {
+ if (partIndex == 3) {
+ error('IPv4 address should contain exactly 4 parts', i);
+ }
+ let part = core.int.parse(host[dartx.substring](partStart, i));
+ if (dart.notNull(part) > 255) {
+ error("each part must be in the range 0..255", partStart);
+ }
+ result[dartx._set](partIndex++, part);
+ partStart = dart.notNull(i) + 1;
+ }
+ }
+ if (partIndex != 3) {
+ error('IPv4 address should contain exactly 4 parts', end);
+ }
+ let part = core.int.parse(host[dartx.substring](partStart, end));
+ if (dart.notNull(part) > 255) {
+ error("each part must be in the range 0..255", partStart);
+ }
+ result[dartx._set](partIndex, part);
+ return result;
+ }
+ static parseIPv6Address(host, start, end) {
+ if (start === void 0) start = 0;
+ if (end === void 0) end = null;
+ if (end == null) end = host[dartx.length];
+ function error(msg, position) {
+ if (position === void 0) position = null;
+ dart.throw(new core.FormatException(dart.str`Illegal IPv6 address, ${msg}`, host, core.int._check(position)));
+ }
+ dart.fn(error, String__Tovoid());
+ function parseHex(start, end) {
+ if (dart.notNull(end) - dart.notNull(start) > 4) {
+ error('an IPv6 part can only contain a maximum of 4 hex digits', start);
+ }
+ let value = core.int.parse(host[dartx.substring](start, end), {radix: 16});
+ if (dart.notNull(value) < 0 || dart.notNull(value) > 65535) {
+ error('each part must be in the range of `0x0..0xFFFF`', start);
+ }
+ return value;
+ }
+ dart.fn(parseHex, intAndintToint());
+ if (dart.notNull(host[dartx.length]) < 2) error('address is too short');
+ let parts = JSArrayOfint().of([]);
+ let wildcardSeen = false;
+ let seenDot = false;
+ let partStart = start;
+ for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(i) + 1) {
+ let char = host[dartx.codeUnitAt](i);
+ if (char == core._COLON) {
+ if (i == start) {
+ i = dart.notNull(i) + 1;
+ if (host[dartx.codeUnitAt](i) != core._COLON) {
+ error('invalid start colon.', i);
+ }
+ partStart = i;
+ }
+ if (i == partStart) {
+ if (wildcardSeen) {
+ error('only one wildcard `::` is allowed', i);
+ }
+ wildcardSeen = true;
+ parts[dartx.add](-1);
+ } else {
+ parts[dartx.add](parseHex(partStart, i));
+ }
+ partStart = dart.notNull(i) + 1;
+ } else if (char == core._DOT) {
+ seenDot = true;
+ }
+ }
+ if (parts[dartx.length] == 0) error('too few parts');
+ let atEnd = partStart == end;
+ let isLastWildcard = parts[dartx.last] == -1;
+ if (atEnd && !isLastWildcard) {
+ error('expected a part after last `:`', end);
+ }
+ if (!atEnd) {
+ if (!seenDot) {
+ parts[dartx.add](parseHex(partStart, end));
+ } else {
+ let last = core.Uri._parseIPv4Address(host, partStart, end);
+ parts[dartx.add]((dart.notNull(last[dartx._get](0)) << 8 | dart.notNull(last[dartx._get](1))) >>> 0);
+ parts[dartx.add]((dart.notNull(last[dartx._get](2)) << 8 | dart.notNull(last[dartx._get](3))) >>> 0);
+ }
+ }
+ if (wildcardSeen) {
+ if (dart.notNull(parts[dartx.length]) > 7) {
+ error('an address with a wildcard must have less than 7 parts');
+ }
+ } else if (parts[dartx.length] != 8) {
+ error('an address without a wildcard must contain exactly 8 parts');
+ }
+ let bytes = typed_data.Uint8List.new(16);
+ for (let i = 0, index = 0; i < dart.notNull(parts[dartx.length]); i++) {
+ let value = parts[dartx._get](i);
+ if (value == -1) {
+ let wildCardLength = 9 - dart.notNull(parts[dartx.length]);
+ for (let j = 0; j < wildCardLength; j++) {
+ bytes[dartx._set](index, 0);
+ bytes[dartx._set](index + 1, 0);
+ index = index + 2;
+ }
+ } else {
+ bytes[dartx._set](index, value[dartx['>>']](8));
+ bytes[dartx._set](index + 1, dart.notNull(value) & 255);
+ index = index + 2;
+ }
+ }
+ return bytes;
+ }
+};
+dart.setSignature(core.Uri, {
+ getters: () => ({hasScheme: dart.definiteFunctionType(core.bool, [])}),
+ statics: () => ({
+ parse: dart.definiteFunctionType(core.Uri, [core.String], [core.int, core.int]),
+ encodeComponent: dart.definiteFunctionType(core.String, [core.String]),
+ encodeQueryComponent: dart.definiteFunctionType(core.String, [core.String], {encoding: convert.Encoding}),
+ decodeComponent: dart.definiteFunctionType(core.String, [core.String]),
+ decodeQueryComponent: dart.definiteFunctionType(core.String, [core.String], {encoding: convert.Encoding}),
+ encodeFull: dart.definiteFunctionType(core.String, [core.String]),
+ decodeFull: dart.definiteFunctionType(core.String, [core.String]),
+ splitQueryString: dart.definiteFunctionType(core.Map$(core.String, core.String), [core.String], {encoding: convert.Encoding}),
+ parseIPv4Address: dart.definiteFunctionType(core.List$(core.int), [core.String]),
+ _parseIPv4Address: dart.definiteFunctionType(core.List$(core.int), [core.String, core.int, core.int]),
+ parseIPv6Address: dart.definiteFunctionType(core.List$(core.int), [core.String], [core.int, core.int])
+ }),
+ names: ['parse', 'encodeComponent', 'encodeQueryComponent', 'decodeComponent', 'decodeQueryComponent', 'encodeFull', 'decodeFull', 'splitQueryString', 'parseIPv4Address', '_parseIPv4Address', 'parseIPv6Address']
+});
const _userInfo = Symbol('_userInfo');
const _host = Symbol('_host');
const _port = Symbol('_port');
-const _path = Symbol('_path');
const _query = Symbol('_query');
const _fragment = Symbol('_fragment');
const _pathSegments = Symbol('_pathSegments');
+const _text = Symbol('_text');
+const _hashCodeCache = Symbol('_hashCodeCache');
const _queryParameters = Symbol('_queryParameters');
const _queryParameterLists = Symbol('_queryParameterLists');
const _writeAuthority = Symbol('_writeAuthority');
let const$51;
const _mergePaths = Symbol('_mergePaths');
-const _toWindowsFilePath = Symbol('_toWindowsFilePath');
const _toFilePath = Symbol('_toFilePath');
const _isPathAbsolute = Symbol('_isPathAbsolute');
-core.Uri = class Uri extends core.Object {
+const _initializeText = Symbol('_initializeText');
+core._Uri = class _Uri extends core.Object {
_internal(scheme, userInfo, host, port, path, query, fragment) {
this.scheme = scheme;
this[_userInfo] = userInfo;
this[_host] = host;
this[_port] = port;
- this[_path] = path;
+ this.path = path;
this[_query] = query;
this[_fragment] = fragment;
this[_pathSegments] = null;
+ this[_text] = null;
+ this[_hashCodeCache] = null;
this[_queryParameters] = null;
this[_queryParameterLists] = null;
}
+ static notSimple(uri, start, end, schemeEnd, hostStart, portStart, pathStart, queryStart, fragmentStart, scheme) {
+ if (scheme == null) {
+ scheme = "";
+ if (dart.notNull(schemeEnd) > dart.notNull(start)) {
+ scheme = core._Uri._makeScheme(uri, start, schemeEnd);
+ } else if (schemeEnd == start) {
+ core._Uri._fail(uri, start, "Invalid empty scheme");
+ }
+ }
+ let userInfo = "";
+ let host = null;
+ let port = null;
+ if (dart.notNull(hostStart) > dart.notNull(start)) {
+ let userInfoStart = dart.notNull(schemeEnd) + 3;
+ if (userInfoStart < dart.notNull(hostStart)) {
+ userInfo = core._Uri._makeUserInfo(uri, userInfoStart, dart.notNull(hostStart) - 1);
+ }
+ host = core._Uri._makeHost(uri, hostStart, portStart, false);
+ if (dart.notNull(portStart) + 1 < dart.notNull(pathStart)) {
+ port = core.int.parse(uri[dartx.substring](dart.notNull(portStart) + 1, pathStart), {onError: dart.fn(_ => {
+ dart.throw(new core.FormatException("Invalid port", uri, dart.notNull(portStart) + 1));
+ }, StringToNull())});
+ port = core._Uri._makePort(port, scheme);
+ }
+ }
+ let path = core._Uri._makePath(uri, pathStart, queryStart, null, scheme, host != null);
+ let query = null;
+ if (dart.notNull(queryStart) < dart.notNull(fragmentStart)) {
+ query = core._Uri._makeQuery(uri, dart.notNull(queryStart) + 1, fragmentStart, null);
+ }
+ let fragment = null;
+ if (dart.notNull(fragmentStart) < dart.notNull(end)) {
+ fragment = core._Uri._makeFragment(uri, dart.notNull(fragmentStart) + 1, end);
+ }
+ return new core._Uri._internal(scheme, userInfo, host, port, path, query, fragment);
+ }
static new(opts) {
- let scheme = opts && 'scheme' in opts ? opts.scheme : "";
- let userInfo = opts && 'userInfo' in opts ? opts.userInfo : "";
+ let scheme = opts && 'scheme' in opts ? opts.scheme : null;
+ let userInfo = opts && 'userInfo' in opts ? opts.userInfo : null;
let host = opts && 'host' in opts ? opts.host : null;
let port = opts && 'port' in opts ? opts.port : null;
let path = opts && 'path' in opts ? opts.path : null;
@@ -33260,33 +33729,37 @@
let query = opts && 'query' in opts ? opts.query : null;
let queryParameters = opts && 'queryParameters' in opts ? opts.queryParameters : null;
let fragment = opts && 'fragment' in opts ? opts.fragment : null;
- scheme = core.Uri._makeScheme(scheme, 0, core.Uri._stringOrNullLength(scheme));
- userInfo = core.Uri._makeUserInfo(userInfo, 0, core.Uri._stringOrNullLength(userInfo));
- host = core.Uri._makeHost(host, 0, core.Uri._stringOrNullLength(host), false);
+ scheme = core._Uri._makeScheme(scheme, 0, core._stringOrNullLength(scheme));
+ userInfo = core._Uri._makeUserInfo(userInfo, 0, core._stringOrNullLength(userInfo));
+ host = core._Uri._makeHost(host, 0, core._stringOrNullLength(host), false);
if (query == "") query = null;
- query = core.Uri._makeQuery(query, 0, core.Uri._stringOrNullLength(query), queryParameters);
- fragment = core.Uri._makeFragment(fragment, 0, core.Uri._stringOrNullLength(fragment));
- port = core.Uri._makePort(port, scheme);
+ query = core._Uri._makeQuery(query, 0, core._stringOrNullLength(query), queryParameters);
+ fragment = core._Uri._makeFragment(fragment, 0, core._stringOrNullLength(fragment));
+ port = core._Uri._makePort(port, scheme);
let isFile = scheme == "file";
if (host == null && (dart.test(userInfo[dartx.isNotEmpty]) || port != null || isFile)) {
host = "";
}
let hasAuthority = host != null;
- path = core.Uri._makePath(path, 0, core.Uri._stringOrNullLength(path), pathSegments, scheme, hasAuthority);
+ path = core._Uri._makePath(path, 0, core._stringOrNullLength(path), pathSegments, scheme, hasAuthority);
if (dart.test(scheme[dartx.isEmpty]) && host == null && !dart.test(path[dartx.startsWith]('/'))) {
- path = core.Uri._normalizeRelativePath(path);
+ let allowScheme = dart.test(scheme[dartx.isNotEmpty]) || host != null;
+ path = core._Uri._normalizeRelativePath(path, allowScheme);
} else {
- path = core.Uri._removeDotSegments(path);
+ path = core._Uri._removeDotSegments(path);
}
- return new core.Uri._internal(scheme, userInfo, host, port, path, query, fragment);
+ if (host == null && dart.test(path[dartx.startsWith]("//"))) {
+ host = "";
+ }
+ return new core._Uri._internal(scheme, userInfo, host, port, path, query, fragment);
}
static http(authority, unencodedPath, queryParameters) {
if (queryParameters === void 0) queryParameters = null;
- return core.Uri._makeHttpUri("http", authority, unencodedPath, queryParameters);
+ return core._Uri._check(core._Uri._makeHttpUri("http", authority, unencodedPath, queryParameters));
}
static https(authority, unencodedPath, queryParameters) {
if (queryParameters === void 0) queryParameters = null;
- return core.Uri._makeHttpUri("https", authority, unencodedPath, queryParameters);
+ return core._Uri._check(core._Uri._makeHttpUri("https", authority, unencodedPath, queryParameters));
}
get authority() {
if (!dart.test(this.hasAuthority)) return "";
@@ -33305,7 +33778,7 @@
return this[_host];
}
get port() {
- if (this[_port] == null) return core.Uri._defaultPort(this.scheme);
+ if (this[_port] == null) return core._Uri._defaultPort(this.scheme);
return this[_port];
}
static _defaultPort(scheme) {
@@ -33313,181 +33786,34 @@
if (scheme == "https") return 443;
return 0;
}
- get path() {
- return this[_path];
- }
get query() {
- return this[_query] == null ? "" : this[_query];
+ return this[_query] != null ? this[_query] : "";
}
get fragment() {
- return this[_fragment] == null ? "" : this[_fragment];
+ return this[_fragment] != null ? this[_fragment] : "";
}
- static parse(uri, start, end) {
- if (start === void 0) start = 0;
- if (end === void 0) end = null;
- let EOI = -1;
- let scheme = "";
- let userinfo = "";
- let host = null;
- let port = null;
- let path = null;
- let query = null;
- let fragment = null;
- if (end == null) end = uri[dartx.length];
- let index = start;
- let pathStart = start;
- let char = EOI;
- function parseAuth() {
- if (index == end) {
- char = EOI;
- return;
- }
- let authStart = index;
- let lastColon = -1;
- let lastAt = -1;
- char = uri[dartx.codeUnitAt](index);
- while (dart.notNull(index) < dart.notNull(end)) {
- char = uri[dartx.codeUnitAt](index);
- if (char == core.Uri._SLASH || char == core.Uri._QUESTION || char == core.Uri._NUMBER_SIGN) {
- break;
- }
- if (char == core.Uri._AT_SIGN) {
- lastAt = index;
- lastColon = -1;
- } else if (char == core.Uri._COLON) {
- lastColon = index;
- } else if (char == core.Uri._LEFT_BRACKET) {
- lastColon = -1;
- let endBracket = uri[dartx.indexOf](']', dart.notNull(index) + 1);
- if (endBracket == -1) {
- index = end;
- char = EOI;
- break;
- } else {
- index = endBracket;
+ isScheme(scheme) {
+ let thisScheme = this.scheme;
+ if (scheme == null) return thisScheme[dartx.isEmpty];
+ if (scheme[dartx.length] != thisScheme[dartx.length]) return false;
+ return core._Uri._compareScheme(scheme, thisScheme);
+ }
+ static _compareScheme(scheme, uri) {
+ for (let i = 0; i < dart.notNull(scheme[dartx.length]); i++) {
+ let schemeChar = scheme[dartx.codeUnitAt](i);
+ let uriChar = uri[dartx.codeUnitAt](i);
+ let delta = (dart.notNull(schemeChar) ^ dart.notNull(uriChar)) >>> 0;
+ if (delta != 0) {
+ if (delta == 32) {
+ let lowerChar = (dart.notNull(uriChar) | delta) >>> 0;
+ if (97 <= lowerChar && lowerChar <= 122) {
+ continue;
}
}
- index = dart.notNull(index) + 1;
- char = EOI;
- }
- let hostStart = authStart;
- let hostEnd = index;
- if (dart.notNull(lastAt) >= 0) {
- userinfo = core.Uri._makeUserInfo(uri, authStart, lastAt);
- hostStart = dart.notNull(lastAt) + 1;
- }
- if (dart.notNull(lastColon) >= 0) {
- let portNumber = null;
- if (dart.notNull(lastColon) + 1 < dart.notNull(index)) {
- portNumber = 0;
- for (let i = dart.notNull(lastColon) + 1; i < dart.notNull(index); i++) {
- let digit = uri[dartx.codeUnitAt](i);
- if (core.Uri._ZERO > dart.notNull(digit) || core.Uri._NINE < dart.notNull(digit)) {
- core.Uri._fail(uri, i, "Invalid port number");
- }
- portNumber = dart.notNull(portNumber) * 10 + (dart.notNull(digit) - core.Uri._ZERO);
- }
- }
- port = core.Uri._makePort(portNumber, scheme);
- hostEnd = lastColon;
- }
- host = core.Uri._makeHost(uri, hostStart, hostEnd, true);
- if (dart.notNull(index) < dart.notNull(end)) {
- char = uri[dartx.codeUnitAt](index);
+ return false;
}
}
- dart.fn(parseAuth, VoidTovoid$());
- let NOT_IN_PATH = 0;
- let IN_PATH = 1;
- let ALLOW_AUTH = 2;
- let state = NOT_IN_PATH;
- let i = index;
- while (dart.notNull(i) < dart.notNull(end)) {
- char = uri[dartx.codeUnitAt](i);
- if (char == core.Uri._QUESTION || char == core.Uri._NUMBER_SIGN) {
- state = NOT_IN_PATH;
- break;
- }
- if (char == core.Uri._SLASH) {
- state = i == start ? ALLOW_AUTH : IN_PATH;
- break;
- }
- if (char == core.Uri._COLON) {
- if (i == start) core.Uri._fail(uri, start, "Invalid empty scheme");
- scheme = core.Uri._makeScheme(uri, start, i);
- i = dart.notNull(i) + 1;
- pathStart = i;
- if (i == end) {
- char = EOI;
- state = NOT_IN_PATH;
- } else {
- char = uri[dartx.codeUnitAt](i);
- if (char == core.Uri._QUESTION || char == core.Uri._NUMBER_SIGN) {
- state = NOT_IN_PATH;
- } else if (char == core.Uri._SLASH) {
- state = ALLOW_AUTH;
- } else {
- state = IN_PATH;
- }
- }
- break;
- }
- i = dart.notNull(i) + 1;
- char = EOI;
- }
- index = i;
- if (state == ALLOW_AUTH) {
- dart.assert(char == core.Uri._SLASH);
- index = dart.notNull(index) + 1;
- if (index == end) {
- char = EOI;
- state = NOT_IN_PATH;
- } else {
- char = uri[dartx.codeUnitAt](index);
- if (char == core.Uri._SLASH) {
- index = dart.notNull(index) + 1;
- parseAuth();
- pathStart = index;
- }
- if (char == core.Uri._QUESTION || char == core.Uri._NUMBER_SIGN || char == EOI) {
- state = NOT_IN_PATH;
- } else {
- state = IN_PATH;
- }
- }
- }
- dart.assert(state == IN_PATH || state == NOT_IN_PATH);
- if (state == IN_PATH) {
- while ((index = dart.notNull(index) + 1) < dart.notNull(end)) {
- char = uri[dartx.codeUnitAt](index);
- if (char == core.Uri._QUESTION || char == core.Uri._NUMBER_SIGN) {
- break;
- }
- char = EOI;
- }
- state = NOT_IN_PATH;
- }
- dart.assert(state == NOT_IN_PATH);
- let hasAuthority = host != null;
- path = core.Uri._makePath(uri, pathStart, index, null, scheme, hasAuthority);
- if (char == core.Uri._QUESTION) {
- let numberSignIndex = -1;
- for (let i = dart.notNull(index) + 1; i < dart.notNull(end); i++) {
- if (uri[dartx.codeUnitAt](i) == core.Uri._NUMBER_SIGN) {
- numberSignIndex = i;
- break;
- }
- }
- if (numberSignIndex < 0) {
- query = core.Uri._makeQuery(uri, dart.notNull(index) + 1, end, null);
- } else {
- query = core.Uri._makeQuery(uri, dart.notNull(index) + 1, numberSignIndex, null);
- fragment = core.Uri._makeFragment(uri, numberSignIndex + 1, end);
- }
- } else if (char == core.Uri._NUMBER_SIGN) {
- fragment = core.Uri._makeFragment(uri, dart.notNull(index) + 1, end);
- }
- return new core.Uri._internal(scheme, userinfo, host, port, path, query, fragment);
+ return true;
}
static _fail(uri, index, message) {
dart.throw(new core.FormatException(message, uri, index));
@@ -33500,7 +33826,8 @@
let hostStart = 0;
let hasUserInfo = false;
for (let i = 0; i < dart.notNull(authority[dartx.length]); i++) {
- if (authority[dartx.codeUnitAt](i) == core.Uri._AT_SIGN) {
+ let atSign = 64;
+ if (authority[dartx.codeUnitAt](i) == atSign) {
hasUserInfo = true;
userInfo = authority[dartx.substring](0, i);
hostStart = i + 1;
@@ -33508,22 +33835,22 @@
}
}
let hostEnd = hostStart;
- if (hostStart < dart.notNull(authority[dartx.length]) && authority[dartx.codeUnitAt](hostStart) == core.Uri._LEFT_BRACKET) {
+ if (hostStart < dart.notNull(authority[dartx.length]) && authority[dartx.codeUnitAt](hostStart) == core._LEFT_BRACKET) {
for (; hostEnd < dart.notNull(authority[dartx.length]); hostEnd++) {
- if (authority[dartx.codeUnitAt](hostEnd) == core.Uri._RIGHT_BRACKET) break;
+ if (authority[dartx.codeUnitAt](hostEnd) == core._RIGHT_BRACKET) break;
}
if (hostEnd == authority[dartx.length]) {
dart.throw(new core.FormatException("Invalid IPv6 host entry.", authority, hostStart));
}
core.Uri.parseIPv6Address(authority, hostStart + 1, hostEnd);
hostEnd++;
- if (hostEnd != authority[dartx.length] && authority[dartx.codeUnitAt](hostEnd) != core.Uri._COLON) {
+ if (hostEnd != authority[dartx.length] && authority[dartx.codeUnitAt](hostEnd) != core._COLON) {
dart.throw(new core.FormatException("Invalid end of authority", authority, hostEnd));
}
}
let hasPort = false;
for (; hostEnd < dart.notNull(authority[dartx.length]); hostEnd++) {
- if (authority[dartx.codeUnitAt](hostEnd) == core.Uri._COLON) {
+ if (authority[dartx.codeUnitAt](hostEnd) == core._COLON) {
let portString = authority[dartx.substring](hostEnd + 1);
if (dart.test(portString[dartx.isNotEmpty])) port = core.int.parse(portString);
break;
@@ -33535,33 +33862,13 @@
}
static file(path, opts) {
let windows = opts && 'windows' in opts ? opts.windows : null;
- windows = windows == null ? core.Uri._isWindows : windows;
- return core.Uri._check(dart.test(windows) ? core.Uri._makeWindowsFileUrl(path, false) : core.Uri._makeFileUri(path, false));
+ windows = windows == null ? core._Uri._isWindows : windows;
+ return core._Uri._check(dart.test(windows) ? core._Uri._makeWindowsFileUrl(path, false) : core._Uri._makeFileUri(path, false));
}
static directory(path, opts) {
let windows = opts && 'windows' in opts ? opts.windows : null;
- windows = windows == null ? core.Uri._isWindows : windows;
- return core.Uri._check(dart.test(windows) ? core.Uri._makeWindowsFileUrl(path, true) : core.Uri._makeFileUri(path, true));
- }
- static dataFromString(content, opts) {
- let mimeType = opts && 'mimeType' in opts ? opts.mimeType : null;
- let encoding = opts && 'encoding' in opts ? opts.encoding : null;
- let parameters = opts && 'parameters' in opts ? opts.parameters : null;
- let base64 = opts && 'base64' in opts ? opts.base64 : false;
- let data = core.UriData.fromString(content, {mimeType: mimeType, encoding: encoding, parameters: parameters, base64: base64});
- return data.uri;
- }
- static dataFromBytes(bytes, opts) {
- let mimeType = opts && 'mimeType' in opts ? opts.mimeType : "application/octet-stream";
- let parameters = opts && 'parameters' in opts ? opts.parameters : null;
- let percentEncoded = opts && 'percentEncoded' in opts ? opts.percentEncoded : false;
- let data = core.UriData.fromBytes(bytes, {mimeType: mimeType, parameters: parameters, percentEncoded: percentEncoded});
- return data.uri;
- }
- static get base() {
- let uri = _js_helper.Primitives.currentUri();
- if (uri != null) return core.Uri.parse(uri);
- dart.throw(new core.UnsupportedError("'Uri.base' is not supported"));
+ windows = windows == null ? core._Uri._isWindows : windows;
+ return core._Uri._check(dart.test(windows) ? core._Uri._makeWindowsFileUrl(path, true) : core._Uri._makeFileUri(path, true));
}
static get _isWindows() {
return false;
@@ -33590,7 +33897,7 @@
}
}
static _checkWindowsDriveLetter(charCode, argumentError) {
- if (core.Uri._UPPER_CASE_A <= dart.notNull(charCode) && dart.notNull(charCode) <= core.Uri._UPPER_CASE_Z || core.Uri._LOWER_CASE_A <= dart.notNull(charCode) && dart.notNull(charCode) <= core.Uri._LOWER_CASE_Z) {
+ if (core._UPPER_CASE_A <= dart.notNull(charCode) && dart.notNull(charCode) <= core._UPPER_CASE_Z || core._LOWER_CASE_A <= dart.notNull(charCode) && dart.notNull(charCode) <= core._LOWER_CASE_Z) {
return;
}
if (dart.test(argumentError)) {
@@ -33617,7 +33924,7 @@
path = path[dartx.replaceRange](0, 7, '\\');
} else {
path = path[dartx.substring](4);
- if (dart.notNull(path[dartx.length]) < 3 || path[dartx.codeUnitAt](1) != core.Uri._COLON || path[dartx.codeUnitAt](2) != core.Uri._BACKSLASH) {
+ if (dart.notNull(path[dartx.length]) < 3 || path[dartx.codeUnitAt](1) != core._COLON || path[dartx.codeUnitAt](2) != core._BACKSLASH) {
dart.throw(new core.ArgumentError("Windows paths with \\\\?\\ prefix must be absolute"));
}
}
@@ -33625,16 +33932,16 @@
path = path[dartx.replaceAll]("/", '\\');
}
let sep = '\\';
- if (dart.notNull(path[dartx.length]) > 1 && path[dartx.codeUnitAt](1) == core.Uri._COLON) {
- core.Uri._checkWindowsDriveLetter(path[dartx.codeUnitAt](0), true);
- if (path[dartx.length] == 2 || path[dartx.codeUnitAt](2) != core.Uri._BACKSLASH) {
+ if (dart.notNull(path[dartx.length]) > 1 && path[dartx.codeUnitAt](1) == core._COLON) {
+ core._Uri._checkWindowsDriveLetter(path[dartx.codeUnitAt](0), true);
+ if (path[dartx.length] == 2 || path[dartx.codeUnitAt](2) != core._BACKSLASH) {
dart.throw(new core.ArgumentError("Windows paths with drive letter must be absolute"));
}
let pathSegments = path[dartx.split](sep);
if (dart.test(slashTerminated) && dart.test(pathSegments[dartx.last][dartx.isNotEmpty])) {
pathSegments[dartx.add]("");
}
- core.Uri._checkWindowsPathReservedCharacters(pathSegments, true, 1);
+ core._Uri._checkWindowsPathReservedCharacters(pathSegments, true, 1);
return core.Uri.new({scheme: "file", pathSegments: pathSegments});
}
if (dart.test(path[dartx.startsWith](sep))) {
@@ -33643,7 +33950,7 @@
let hostPart = dart.notNull(pathStart) < 0 ? path[dartx.substring](2) : path[dartx.substring](2, pathStart);
let pathPart = dart.notNull(pathStart) < 0 ? "" : path[dartx.substring](dart.notNull(pathStart) + 1);
let pathSegments = pathPart[dartx.split](sep);
- core.Uri._checkWindowsPathReservedCharacters(pathSegments, true);
+ core._Uri._checkWindowsPathReservedCharacters(pathSegments, true);
if (dart.test(slashTerminated) && dart.test(pathSegments[dartx.last][dartx.isNotEmpty])) {
pathSegments[dartx.add]("");
}
@@ -33653,12 +33960,12 @@
if (dart.test(slashTerminated) && dart.test(pathSegments[dartx.last][dartx.isNotEmpty])) {
pathSegments[dartx.add]("");
}
- core.Uri._checkWindowsPathReservedCharacters(pathSegments, true);
+ core._Uri._checkWindowsPathReservedCharacters(pathSegments, true);
return core.Uri.new({scheme: "file", pathSegments: pathSegments});
}
} else {
let pathSegments = path[dartx.split](sep);
- core.Uri._checkWindowsPathReservedCharacters(pathSegments, true);
+ core._Uri._checkWindowsPathReservedCharacters(pathSegments, true);
if (dart.test(slashTerminated) && dart.test(pathSegments[dartx.isNotEmpty]) && dart.test(pathSegments[dartx.last][dartx.isNotEmpty])) {
pathSegments[dartx.add]("");
}
@@ -33677,27 +33984,27 @@
let fragment = opts && 'fragment' in opts ? opts.fragment : null;
let schemeChanged = false;
if (scheme != null) {
- scheme = core.Uri._makeScheme(scheme, 0, scheme[dartx.length]);
- schemeChanged = true;
+ scheme = core._Uri._makeScheme(scheme, 0, scheme[dartx.length]);
+ schemeChanged = scheme != this.scheme;
} else {
scheme = this.scheme;
}
let isFile = scheme == "file";
if (userInfo != null) {
- userInfo = core.Uri._makeUserInfo(userInfo, 0, userInfo[dartx.length]);
+ userInfo = core._Uri._makeUserInfo(userInfo, 0, userInfo[dartx.length]);
} else {
userInfo = this[_userInfo];
}
if (port != null) {
- port = core.Uri._makePort(port, scheme);
+ port = core._Uri._makePort(port, scheme);
} else {
port = this[_port];
if (schemeChanged) {
- port = core.Uri._makePort(port, scheme);
+ port = core._Uri._makePort(port, scheme);
}
}
if (host != null) {
- host = core.Uri._makeHost(host, 0, host[dartx.length], false);
+ host = core._Uri._makeHost(host, 0, host[dartx.length], false);
} else if (dart.test(this.hasAuthority)) {
host = this[_host];
} else if (dart.test(userInfo[dartx.isNotEmpty]) || port != null || isFile) {
@@ -33705,34 +34012,34 @@
}
let hasAuthority = host != null;
if (path != null || pathSegments != null) {
- path = core.Uri._makePath(path, 0, core.Uri._stringOrNullLength(path), pathSegments, scheme, hasAuthority);
+ path = core._Uri._makePath(path, 0, core._stringOrNullLength(path), pathSegments, scheme, hasAuthority);
} else {
- path = this[_path];
+ path = this.path;
if ((isFile || hasAuthority && !dart.test(path[dartx.isEmpty])) && !dart.test(path[dartx.startsWith]('/'))) {
path = "/" + dart.notNull(path);
}
}
if (query != null || queryParameters != null) {
- query = core.Uri._makeQuery(query, 0, core.Uri._stringOrNullLength(query), queryParameters);
+ query = core._Uri._makeQuery(query, 0, core._stringOrNullLength(query), queryParameters);
} else {
query = this[_query];
}
if (fragment != null) {
- fragment = core.Uri._makeFragment(fragment, 0, fragment[dartx.length]);
+ fragment = core._Uri._makeFragment(fragment, 0, fragment[dartx.length]);
} else {
fragment = this[_fragment];
}
- return new core.Uri._internal(scheme, userInfo, host, port, path, query, fragment);
+ return new core._Uri._internal(scheme, userInfo, host, port, path, query, fragment);
}
removeFragment() {
if (!dart.test(this.hasFragment)) return this;
- return new core.Uri._internal(this.scheme, this[_userInfo], this[_host], this[_port], this[_path], this[_query], null);
+ return new core._Uri._internal(this.scheme, this[_userInfo], this[_host], this[_port], this.path, this[_query], null);
}
get pathSegments() {
let result = this[_pathSegments];
if (result != null) return result;
let pathToSplit = this.path;
- if (dart.test(pathToSplit[dartx.isNotEmpty]) && pathToSplit[dartx.codeUnitAt](0) == core.Uri._SLASH) {
+ if (dart.test(pathToSplit[dartx.isNotEmpty]) && pathToSplit[dartx.codeUnitAt](0) == core._SLASH) {
pathToSplit = pathToSplit[dartx.substring](1);
}
result = pathToSplit == "" ? const$51 || (const$51 = dart.constList([], core.String)) : ListOfString().unmodifiable(pathToSplit[dartx.split]("/")[dartx.map](core.String)(core.Uri.decodeComponent));
@@ -33747,7 +34054,7 @@
}
get queryParametersAll() {
if (this[_queryParameterLists] == null) {
- let queryParameterLists = core.Uri._splitQueryStringAll(this.query);
+ let queryParameterLists = core._Uri._splitQueryStringAll(this.query);
for (let key of queryParameterLists[dartx.keys]) {
queryParameterLists[dartx._set](key, ListOfString().unmodifiable(core.Iterable._check(queryParameterLists[dartx._get](key))));
}
@@ -33756,36 +34063,36 @@
return this[_queryParameterLists];
}
normalizePath() {
- let path = core.Uri._normalizePath(this[_path], this.scheme, this.hasAuthority);
- if (core.identical(path, this[_path])) return this;
+ let path = core._Uri._normalizePath(this.path, this.scheme, this.hasAuthority);
+ if (core.identical(path, this.path)) return this;
return this.replace({path: path});
}
static _makePort(port, scheme) {
- if (port != null && port == core.Uri._defaultPort(scheme)) return null;
+ if (port != null && port == core._Uri._defaultPort(scheme)) return null;
return port;
}
static _makeHost(host, start, end, strictIPv6) {
if (host == null) return null;
if (start == end) return "";
- if (host[dartx.codeUnitAt](start) == core.Uri._LEFT_BRACKET) {
- if (host[dartx.codeUnitAt](dart.notNull(end) - 1) != core.Uri._RIGHT_BRACKET) {
- core.Uri._fail(host, start, 'Missing end `]` to match `[` in host');
+ if (host[dartx.codeUnitAt](start) == core._LEFT_BRACKET) {
+ if (host[dartx.codeUnitAt](dart.notNull(end) - 1) != core._RIGHT_BRACKET) {
+ core._Uri._fail(host, start, 'Missing end `]` to match `[` in host');
}
core.Uri.parseIPv6Address(host, dart.notNull(start) + 1, dart.notNull(end) - 1);
return host[dartx.substring](start, end)[dartx.toLowerCase]();
}
if (!dart.test(strictIPv6)) {
for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(i) + 1) {
- if (host[dartx.codeUnitAt](i) == core.Uri._COLON) {
+ if (host[dartx.codeUnitAt](i) == core._COLON) {
core.Uri.parseIPv6Address(host, start, end);
return dart.str`[${host}]`;
}
}
}
- return core.Uri._normalizeRegName(host, start, end);
+ return core._Uri._normalizeRegName(host, start, end);
}
static _isRegNameChar(char) {
- return dart.notNull(char) < 127 && (dart.notNull(core.Uri._regNameTable[dartx._get](char[dartx['>>']](4))) & 1 << (dart.notNull(char) & 15)) != 0;
+ return dart.notNull(char) < 127 && (dart.notNull(core._Uri._regNameTable[dartx._get](char[dartx['>>']](4))) & 1 << (dart.notNull(char) & 15)) != 0;
}
static _normalizeRegName(host, start, end) {
let buffer = null;
@@ -33794,8 +34101,8 @@
let isNormalized = true;
while (dart.notNull(index) < dart.notNull(end)) {
let char = host[dartx.codeUnitAt](index);
- if (char == core.Uri._PERCENT) {
- let replacement = core.Uri._normalizeEscape(host, index, true);
+ if (char == core._PERCENT) {
+ let replacement = core._Uri._normalizeEscape(host, index, true);
if (replacement == null && isNormalized) {
index = dart.notNull(index) + 3;
continue;
@@ -33815,8 +34122,8 @@
index = dart.notNull(index) + sourceLength;
sectionStart = index;
isNormalized = true;
- } else if (dart.test(core.Uri._isRegNameChar(char))) {
- if (isNormalized && core.Uri._UPPER_CASE_A <= dart.notNull(char) && core.Uri._UPPER_CASE_Z >= dart.notNull(char)) {
+ } else if (dart.test(core._Uri._isRegNameChar(char))) {
+ if (isNormalized && core._UPPER_CASE_A <= dart.notNull(char) && core._UPPER_CASE_Z >= dart.notNull(char)) {
if (buffer == null) buffer = new core.StringBuffer();
if (dart.notNull(sectionStart) < dart.notNull(index)) {
buffer.write(host[dartx.substring](sectionStart, index));
@@ -33825,8 +34132,8 @@
isNormalized = false;
}
index = dart.notNull(index) + 1;
- } else if (dart.test(core.Uri._isGeneralDelimiter(char))) {
- core.Uri._fail(host, index, "Invalid character");
+ } else if (dart.test(core._Uri._isGeneralDelimiter(char))) {
+ core._Uri._fail(host, index, "Invalid character");
} else {
let sourceLength = 1;
if ((dart.notNull(char) & 64512) == 55296 && dart.notNull(index) + 1 < dart.notNull(end)) {
@@ -33840,7 +34147,7 @@
let slice = host[dartx.substring](sectionStart, index);
if (!isNormalized) slice = slice[dartx.toLowerCase]();
buffer.write(slice);
- buffer.write(core.Uri._escapeChar(char));
+ buffer.write(core._Uri._escapeChar(char));
index = dart.notNull(index) + sourceLength;
sectionStart = index;
}
@@ -33856,26 +34163,33 @@
static _makeScheme(scheme, start, end) {
if (start == end) return "";
let firstCodeUnit = scheme[dartx.codeUnitAt](start);
- if (!dart.test(core.Uri._isAlphabeticCharacter(firstCodeUnit))) {
- core.Uri._fail(scheme, start, "Scheme not starting with alphabetic character");
+ if (!dart.test(core._Uri._isAlphabeticCharacter(firstCodeUnit))) {
+ core._Uri._fail(scheme, start, "Scheme not starting with alphabetic character");
}
let containsUpperCase = false;
for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(i) + 1) {
let codeUnit = scheme[dartx.codeUnitAt](i);
- if (!dart.test(core.Uri._isSchemeCharacter(codeUnit))) {
- core.Uri._fail(scheme, i, "Illegal scheme character");
+ if (!dart.test(core._Uri._isSchemeCharacter(codeUnit))) {
+ core._Uri._fail(scheme, i, "Illegal scheme character");
}
- if (core.Uri._UPPER_CASE_A <= dart.notNull(codeUnit) && dart.notNull(codeUnit) <= core.Uri._UPPER_CASE_Z) {
+ if (core._UPPER_CASE_A <= dart.notNull(codeUnit) && dart.notNull(codeUnit) <= core._UPPER_CASE_Z) {
containsUpperCase = true;
}
}
scheme = scheme[dartx.substring](start, end);
if (containsUpperCase) scheme = scheme[dartx.toLowerCase]();
+ return core._Uri._canonicalizeScheme(scheme);
+ }
+ static _canonicalizeScheme(scheme) {
+ if (scheme == "http") return "http";
+ if (scheme == "file") return "file";
+ if (scheme == "https") return "https";
+ if (scheme == "package") return "package";
return scheme;
}
static _makeUserInfo(userInfo, start, end) {
if (userInfo == null) return "";
- return core.Uri._normalize(userInfo, start, end, core.Uri._userinfoTable);
+ return core._Uri._normalizeOrSubstring(userInfo, start, end, core._Uri._userinfoTable);
}
static _makePath(path, start, end, pathSegments, scheme, hasAuthority) {
let isFile = scheme == "file";
@@ -33886,30 +34200,32 @@
}
let result = null;
if (path != null) {
- result = core.Uri._normalize(path, start, end, core.Uri._pathCharOrSlashTable);
+ result = core._Uri._normalizeOrSubstring(path, start, end, core._Uri._pathCharOrSlashTable);
} else {
- result = pathSegments[dartx.map](core.String)(dart.fn(s => core.Uri._uriEncode(core.Uri._pathCharTable, s, convert.UTF8, false), StringToString$()))[dartx.join]("/");
+ result = pathSegments[dartx.map](core.String)(dart.fn(s => core._Uri._uriEncode(core._Uri._pathCharTable, s, convert.UTF8, false), StringToString$()))[dartx.join]("/");
}
if (dart.test(dart.dload(result, 'isEmpty'))) {
if (isFile) return "/";
} else if (ensureLeadingSlash && !dart.test(dart.dsend(result, 'startsWith', '/'))) {
result = "/" + dart.notNull(core.String._check(result));
}
- result = core.Uri._normalizePath(core.String._check(result), scheme, hasAuthority);
+ result = core._Uri._normalizePath(core.String._check(result), scheme, hasAuthority);
return core.String._check(result);
}
static _normalizePath(path, scheme, hasAuthority) {
if (dart.test(scheme[dartx.isEmpty]) && !dart.test(hasAuthority) && !dart.test(path[dartx.startsWith]('/'))) {
- return core.Uri._normalizeRelativePath(path);
+ return core._Uri._normalizeRelativePath(path, dart.test(scheme[dartx.isNotEmpty]) || dart.test(hasAuthority));
}
- return core.Uri._removeDotSegments(path);
+ return core._Uri._removeDotSegments(path);
}
static _makeQuery(query, start, end, queryParameters) {
- if (query == null && queryParameters == null) return null;
- if (query != null && queryParameters != null) {
- dart.throw(new core.ArgumentError('Both query and queryParameters specified'));
+ if (query != null) {
+ if (queryParameters != null) {
+ dart.throw(new core.ArgumentError('Both query and queryParameters specified'));
+ }
+ return core._Uri._normalizeOrSubstring(query, start, end, core._Uri._queryCharTable);
}
- if (query != null) return core.Uri._normalize(query, start, end, core.Uri._queryCharTable);
+ if (queryParameters == null) return null;
let result = new core.StringBuffer();
let separator = "";
function writeParameter(key, value) {
@@ -33937,52 +34253,40 @@
}
static _makeFragment(fragment, start, end) {
if (fragment == null) return null;
- return core.Uri._normalize(fragment, start, end, core.Uri._queryCharTable);
- }
- static _stringOrNullLength(s) {
- return s == null ? 0 : s[dartx.length];
+ return core._Uri._normalizeOrSubstring(fragment, start, end, core._Uri._queryCharTable);
}
static _normalizeEscape(source, index, lowerCase) {
- dart.assert(source[dartx.codeUnitAt](index) == core.Uri._PERCENT);
+ dart.assert(source[dartx.codeUnitAt](index) == core._PERCENT);
if (dart.notNull(index) + 2 >= dart.notNull(source[dartx.length])) {
return "%";
}
let firstDigit = source[dartx.codeUnitAt](dart.notNull(index) + 1);
let secondDigit = source[dartx.codeUnitAt](dart.notNull(index) + 2);
- let firstDigitValue = core.Uri._parseHexDigit(firstDigit);
- let secondDigitValue = core.Uri._parseHexDigit(secondDigit);
+ let firstDigitValue = _internal.hexDigitValue(firstDigit);
+ let secondDigitValue = _internal.hexDigitValue(secondDigit);
if (dart.notNull(firstDigitValue) < 0 || dart.notNull(secondDigitValue) < 0) {
return "%";
}
let value = dart.notNull(firstDigitValue) * 16 + dart.notNull(secondDigitValue);
- if (dart.test(core.Uri._isUnreservedChar(value))) {
- if (dart.test(lowerCase) && core.Uri._UPPER_CASE_A <= value && core.Uri._UPPER_CASE_Z >= value) {
+ if (dart.test(core._Uri._isUnreservedChar(value))) {
+ if (dart.test(lowerCase) && core._UPPER_CASE_A <= value && core._UPPER_CASE_Z >= value) {
value = (value | 32) >>> 0;
}
return core.String.fromCharCode(value);
}
- if (dart.notNull(firstDigit) >= core.Uri._LOWER_CASE_A || dart.notNull(secondDigit) >= core.Uri._LOWER_CASE_A) {
+ if (dart.notNull(firstDigit) >= core._LOWER_CASE_A || dart.notNull(secondDigit) >= core._LOWER_CASE_A) {
return source[dartx.substring](index, dart.notNull(index) + 3)[dartx.toUpperCase]();
}
return null;
}
- static _parseHexDigit(char) {
- let digit = (dart.notNull(char) ^ core.Uri._ZERO) >>> 0;
- if (digit <= 9) return digit;
- let lowerCase = (dart.notNull(char) | 32) >>> 0;
- if (core.Uri._LOWER_CASE_A <= lowerCase && lowerCase <= core.Uri._LOWER_CASE_F) {
- return lowerCase - (core.Uri._LOWER_CASE_A - 10);
- }
- return -1;
- }
static _escapeChar(char) {
dart.assert(dart.notNull(char) <= 1114111);
let codeUnits = null;
if (dart.notNull(char) < 128) {
codeUnits = ListOfint().new(3);
- codeUnits[dartx._set](0, core.Uri._PERCENT);
- codeUnits[dartx._set](1, core.Uri._hexDigits[dartx.codeUnitAt](char[dartx['>>']](4)));
- codeUnits[dartx._set](2, core.Uri._hexDigits[dartx.codeUnitAt](dart.notNull(char) & 15));
+ codeUnits[dartx._set](0, core._PERCENT);
+ codeUnits[dartx._set](1, core._hexDigits[dartx.codeUnitAt](char[dartx['>>']](4)));
+ codeUnits[dartx._set](2, core._hexDigits[dartx.codeUnitAt](dart.notNull(char) & 15));
} else {
let flag = 192;
let encodedBytes = 2;
@@ -33998,16 +34302,21 @@
let index = 0;
while (--encodedBytes >= 0) {
let byte = (char[dartx['>>']](6 * encodedBytes) & 63 | flag) >>> 0;
- codeUnits[dartx._set](index, core.Uri._PERCENT);
- codeUnits[dartx._set](index + 1, core.Uri._hexDigits[dartx.codeUnitAt](byte[dartx['>>']](4)));
- codeUnits[dartx._set](index + 2, core.Uri._hexDigits[dartx.codeUnitAt](byte & 15));
+ codeUnits[dartx._set](index, core._PERCENT);
+ codeUnits[dartx._set](index + 1, core._hexDigits[dartx.codeUnitAt](byte[dartx['>>']](4)));
+ codeUnits[dartx._set](index + 2, core._hexDigits[dartx.codeUnitAt](byte & 15));
index = index + 3;
flag = 128;
}
}
return core.String.fromCharCodes(codeUnits);
}
- static _normalize(component, start, end, charTable) {
+ static _normalizeOrSubstring(component, start, end, charTable) {
+ let l = core._Uri._normalize(component, start, end, charTable);
+ return l != null ? l : component[dartx.substring](start, end);
+ }
+ static _normalize(component, start, end, charTable, opts) {
+ let escapeDelimiters = opts && 'escapeDelimiters' in opts ? opts.escapeDelimiters : false;
let buffer = null;
let sectionStart = start;
let index = start;
@@ -34018,8 +34327,8 @@
} else {
let replacement = null;
let sourceLength = null;
- if (char == core.Uri._PERCENT) {
- replacement = core.Uri._normalizeEscape(component, index, false);
+ if (char == core._PERCENT) {
+ replacement = core._Uri._normalizeEscape(component, index, false);
if (replacement == null) {
index = dart.notNull(index) + 3;
continue;
@@ -34030,8 +34339,8 @@
} else {
sourceLength = 3;
}
- } else if (dart.test(core.Uri._isGeneralDelimiter(char))) {
- core.Uri._fail(component, index, "Invalid character");
+ } else if (!dart.test(escapeDelimiters) && dart.test(core._Uri._isGeneralDelimiter(char))) {
+ core._Uri._fail(component, index, "Invalid character");
} else {
sourceLength = 1;
if ((dart.notNull(char) & 64512) == 55296) {
@@ -34043,7 +34352,7 @@
}
}
}
- replacement = core.Uri._escapeChar(char);
+ replacement = core._Uri._escapeChar(char);
}
if (buffer == null) buffer = new core.StringBuffer();
buffer.write(component[dartx.substring](sectionStart, index));
@@ -34053,7 +34362,7 @@
}
}
if (buffer == null) {
- return component[dartx.substring](start, end);
+ return null;
}
if (dart.notNull(sectionStart) < dart.notNull(end)) {
buffer.write(component[dartx.substring](sectionStart, end));
@@ -34061,10 +34370,10 @@
return dart.toString(buffer);
}
static _isSchemeCharacter(ch) {
- return dart.notNull(ch) < 128 && (dart.notNull(core.Uri._schemeTable[dartx._get](ch[dartx['>>']](4))) & 1 << (dart.notNull(ch) & 15)) != 0;
+ return dart.notNull(ch) < 128 && (dart.notNull(core._Uri._schemeTable[dartx._get](ch[dartx['>>']](4))) & 1 << (dart.notNull(ch) & 15)) != 0;
}
static _isGeneralDelimiter(ch) {
- return dart.notNull(ch) <= core.Uri._RIGHT_BRACKET && (dart.notNull(core.Uri._genDelimitersTable[dartx._get](ch[dartx['>>']](4))) & 1 << (dart.notNull(ch) & 15)) != 0;
+ return dart.notNull(ch) <= core._RIGHT_BRACKET && (dart.notNull(core._Uri._genDelimitersTable[dartx._get](ch[dartx['>>']](4))) & 1 << (dart.notNull(ch) & 15)) != 0;
}
get isAbsolute() {
return this.scheme != "" && this.fragment == "";
@@ -34083,7 +34392,7 @@
break;
}
let delta = dart.notNull(baseEnd) - dart.notNull(newEnd);
- if ((delta == 2 || delta == 3) && base[dartx.codeUnitAt](dart.notNull(newEnd) + 1) == core.Uri._DOT && (delta == 2 || base[dartx.codeUnitAt](dart.notNull(newEnd) + 2) == core.Uri._DOT)) {
+ if ((delta == 2 || delta == 3) && base[dartx.codeUnitAt](dart.notNull(newEnd) + 1) == core._DOT && (delta == 2 || base[dartx.codeUnitAt](dart.notNull(newEnd) + 2) == core._DOT)) {
break;
}
baseEnd = newEnd;
@@ -34097,7 +34406,7 @@
return index != -1;
}
static _removeDotSegments(path) {
- if (!dart.test(core.Uri._mayContainDotSegments(path))) return path;
+ if (!dart.test(core._Uri._mayContainDotSegments(path))) return path;
dart.assert(path[dartx.isNotEmpty]);
let output = JSArrayOfString().of([]);
let appendSlash = false;
@@ -34120,9 +34429,12 @@
if (appendSlash) output[dartx.add]("");
return output[dartx.join]("/");
}
- static _normalizeRelativePath(path) {
+ static _normalizeRelativePath(path, allowScheme) {
dart.assert(!dart.test(path[dartx.startsWith]('/')));
- if (!dart.test(core.Uri._mayContainDotSegments(path))) return path;
+ if (!dart.test(core._Uri._mayContainDotSegments(path))) {
+ if (!dart.test(allowScheme)) path = core._Uri._escapeScheme(path);
+ return path;
+ }
dart.assert(path[dartx.isNotEmpty]);
let output = JSArrayOfString().of([]);
let appendSlash = false;
@@ -34145,8 +34457,23 @@
return "./";
}
if (appendSlash || output[dartx.last] == '..') output[dartx.add]("");
+ if (!dart.test(allowScheme)) output[dartx._set](0, core._Uri._escapeScheme(output[dartx._get](0)));
return output[dartx.join]("/");
}
+ static _escapeScheme(path) {
+ if (dart.notNull(path[dartx.length]) >= 2 && dart.test(core._Uri._isAlphabeticCharacter(path[dartx.codeUnitAt](0)))) {
+ for (let i = 1; i < dart.notNull(path[dartx.length]); i++) {
+ let char = path[dartx.codeUnitAt](i);
+ if (char == core._COLON) {
+ return dart.str`${path[dartx.substring](0, i)}%3A${path[dartx.substring](i + 1)}`;
+ }
+ if (dart.notNull(char) > 127 || (dart.notNull(core._Uri._schemeTable[dartx._get](char[dartx['>>']](4))) & 1 << (dart.notNull(char) & 15)) == 0) {
+ break;
+ }
+ }
+ }
+ return path;
+ }
resolve(reference) {
return this.resolveUri(core.Uri.parse(reference));
}
@@ -34164,7 +34491,7 @@
targetHost = reference.host;
targetPort = dart.test(reference.hasPort) ? reference.port : null;
}
- targetPath = core.Uri._removeDotSegments(reference.path);
+ targetPath = core._Uri._removeDotSegments(reference.path);
if (dart.test(reference.hasQuery)) {
targetQuery = reference.query;
}
@@ -34173,15 +34500,15 @@
if (dart.test(reference.hasAuthority)) {
targetUserInfo = reference.userInfo;
targetHost = reference.host;
- targetPort = core.Uri._makePort(dart.test(reference.hasPort) ? reference.port : null, targetScheme);
- targetPath = core.Uri._removeDotSegments(reference.path);
+ targetPort = core._Uri._makePort(dart.test(reference.hasPort) ? reference.port : null, targetScheme);
+ targetPath = core._Uri._removeDotSegments(reference.path);
if (dart.test(reference.hasQuery)) targetQuery = reference.query;
} else {
targetUserInfo = this[_userInfo];
targetHost = this[_host];
targetPort = this[_port];
if (reference.path == "") {
- targetPath = this[_path];
+ targetPath = this.path;
if (dart.test(reference.hasQuery)) {
targetQuery = reference.query;
} else {
@@ -34189,20 +34516,24 @@
}
} else {
if (dart.test(reference.hasAbsolutePath)) {
- targetPath = core.Uri._removeDotSegments(reference.path);
+ targetPath = core._Uri._removeDotSegments(reference.path);
} else {
if (dart.test(this.hasEmptyPath)) {
- if (!dart.test(this.hasScheme) && !dart.test(this.hasAuthority)) {
- targetPath = reference.path;
+ if (!dart.test(this.hasAuthority)) {
+ if (!dart.test(this.hasScheme)) {
+ targetPath = reference.path;
+ } else {
+ targetPath = core._Uri._removeDotSegments(reference.path);
+ }
} else {
- targetPath = core.Uri._removeDotSegments("/" + dart.notNull(reference.path));
+ targetPath = core._Uri._removeDotSegments("/" + dart.notNull(reference.path));
}
} else {
- let mergedPath = this[_mergePaths](this[_path], reference.path);
+ let mergedPath = this[_mergePaths](this.path, reference.path);
if (dart.test(this.hasScheme) || dart.test(this.hasAuthority) || dart.test(this.hasAbsolutePath)) {
- targetPath = core.Uri._removeDotSegments(mergedPath);
+ targetPath = core._Uri._removeDotSegments(mergedPath);
} else {
- targetPath = core.Uri._normalizeRelativePath(mergedPath);
+ targetPath = core._Uri._normalizeRelativePath(mergedPath, dart.test(this.hasScheme) || dart.test(this.hasAuthority));
}
}
}
@@ -34211,7 +34542,7 @@
}
}
let fragment = dart.test(reference.hasFragment) ? reference.fragment : null;
- return new core.Uri._internal(targetScheme, targetUserInfo, targetHost, targetPort, targetPath, targetQuery, fragment);
+ return new core._Uri._internal(targetScheme, targetUserInfo, targetHost, targetPort, targetPath, targetQuery, fragment);
}
get hasScheme() {
return this.scheme[dartx.isNotEmpty];
@@ -34229,18 +34560,21 @@
return this[_fragment] != null;
}
get hasEmptyPath() {
- return this[_path][dartx.isEmpty];
+ return this.path[dartx.isEmpty];
}
get hasAbsolutePath() {
- return this[_path][dartx.startsWith]('/');
+ return this.path[dartx.startsWith]('/');
}
get origin() {
- if (this.scheme == "" || this[_host] == null || this[_host] == "") {
+ if (this.scheme == "") {
dart.throw(new core.StateError(dart.str`Cannot use origin without a scheme: ${this}`));
}
if (this.scheme != "http" && this.scheme != "https") {
dart.throw(new core.StateError(dart.str`Origin is only applicable schemes http and https: ${this}`));
}
+ if (this[_host] == null || this[_host] == "") {
+ dart.throw(new core.StateError(dart.str`A ${this.scheme}: URI should have a non-empty host name: ${this}`));
+ }
if (this[_port] == null) return dart.str`${this.scheme}://${this[_host]}`;
return dart.str`${this.scheme}://${this[_host]}:${this[_port]}`;
}
@@ -34255,43 +34589,46 @@
if (this.fragment != "") {
dart.throw(new core.UnsupportedError("Cannot extract a file path from a URI with a fragment component"));
}
- if (windows == null) windows = core.Uri._isWindows;
- return dart.test(windows) ? this[_toWindowsFilePath]() : this[_toFilePath]();
+ if (windows == null) windows = core._Uri._isWindows;
+ return dart.test(windows) ? core._Uri._toWindowsFilePath(this) : this[_toFilePath]();
}
[_toFilePath]() {
- if (this.host != "") {
+ if (dart.test(this.hasAuthority) && this.host != "") {
dart.throw(new core.UnsupportedError("Cannot extract a non-Windows file path from a file URI " + "with an authority"));
}
- core.Uri._checkNonWindowsPathReservedCharacters(this.pathSegments, false);
+ let pathSegments = this.pathSegments;
+ core._Uri._checkNonWindowsPathReservedCharacters(pathSegments, false);
let result = new core.StringBuffer();
- if (dart.test(this[_isPathAbsolute])) result.write("/");
- result.writeAll(this.pathSegments, "/");
+ if (dart.test(this.hasAbsolutePath)) result.write("/");
+ result.writeAll(pathSegments, "/");
return result.toString();
}
- [_toWindowsFilePath]() {
+ static _toWindowsFilePath(uri) {
let hasDriveLetter = false;
- let segments = this.pathSegments;
- if (dart.notNull(segments[dartx.length]) > 0 && segments[dartx._get](0)[dartx.length] == 2 && segments[dartx._get](0)[dartx.codeUnitAt](1) == core.Uri._COLON) {
- core.Uri._checkWindowsDriveLetter(segments[dartx._get](0)[dartx.codeUnitAt](0), false);
- core.Uri._checkWindowsPathReservedCharacters(segments, false, 1);
+ let segments = uri.pathSegments;
+ if (dart.notNull(segments[dartx.length]) > 0 && segments[dartx._get](0)[dartx.length] == 2 && segments[dartx._get](0)[dartx.codeUnitAt](1) == core._COLON) {
+ core._Uri._checkWindowsDriveLetter(segments[dartx._get](0)[dartx.codeUnitAt](0), false);
+ core._Uri._checkWindowsPathReservedCharacters(segments, false, 1);
hasDriveLetter = true;
} else {
- core.Uri._checkWindowsPathReservedCharacters(segments, false);
+ core._Uri._checkWindowsPathReservedCharacters(segments, false, 0);
}
let result = new core.StringBuffer();
- if (dart.test(this[_isPathAbsolute]) && !hasDriveLetter) result.write("\\");
- if (this.host != "") {
- result.write("\\");
- result.write(this.host);
- result.write("\\");
+ if (dart.test(uri.hasAbsolutePath) && !hasDriveLetter) result.write("\\");
+ if (dart.test(uri.hasAuthority)) {
+ let host = uri.host;
+ if (dart.test(host[dartx.isNotEmpty])) {
+ result.write("\\");
+ result.write(host);
+ result.write("\\");
+ }
}
result.writeAll(segments, "\\");
if (hasDriveLetter && segments[dartx.length] == 1) result.write("\\");
return result.toString();
}
get [_isPathAbsolute]() {
- if (this.path == null || dart.test(this.path[dartx.isEmpty])) return false;
- return this.path[dartx.startsWith]('/');
+ return this.path != null && dart.test(this.path[dartx.startsWith]('/'));
}
[_writeAuthority](ss) {
if (dart.test(this[_userInfo][dartx.isNotEmpty])) {
@@ -34308,9 +34645,17 @@
return this.scheme == "data" ? core.UriData.fromUri(this) : null;
}
toString() {
+ let t = this[_text];
+ return t == null ? this[_text] = this[_initializeText]() : t;
+ }
+ [_initializeText]() {
+ dart.assert(this[_text] == null);
let sb = new core.StringBuffer();
- core.Uri._addIfNonEmpty(sb, this.scheme, this.scheme, ':');
- if (dart.test(this.hasAuthority) || dart.test(this.path[dartx.startsWith]("//")) || this.scheme == "file") {
+ if (dart.test(this.scheme[dartx.isNotEmpty])) {
+ sb.write(this.scheme);
+ sb.write(":");
+ }
+ if (dart.test(this.hasAuthority) || this.scheme == "file") {
sb.write("//");
this[_writeAuthority](sb);
}
@@ -34326,58 +34671,16 @@
return sb.toString();
}
['=='](other) {
- if (!core.Uri.is(other)) return false;
- let uri = core.Uri._check(other);
- return this.scheme == uri.scheme && this.hasAuthority == uri.hasAuthority && this.userInfo == uri.userInfo && this.host == uri.host && this.port == uri.port && this.path == uri.path && this.hasQuery == uri.hasQuery && this.query == uri.query && this.hasFragment == uri.hasFragment && this.fragment == uri.fragment;
+ if (core.identical(this, other)) return true;
+ if (core.Uri.is(other)) {
+ let uri = other;
+ return this.scheme == uri.scheme && this.hasAuthority == uri.hasAuthority && this.userInfo == uri.userInfo && this.host == uri.host && this.port == uri.port && this.path == uri.path && this.hasQuery == uri.hasQuery && this.query == uri.query && this.hasFragment == uri.hasFragment && this.fragment == uri.fragment;
+ }
+ return false;
}
get hashCode() {
- function combine(part, current) {
- return core.int._check(dart.dsend(dart.dsend(dart.dsend(current, '*', 31), '+', dart.hashCode(part)), '&', 1073741823));
- }
- dart.fn(combine, dynamicAnddynamicToint());
- return combine(this.scheme, combine(this.userInfo, combine(this.host, combine(this.port, combine(this.path, combine(this.query, combine(this.fragment, 1)))))));
- }
- static _addIfNonEmpty(sb, test, first, second) {
- if ("" != test) {
- sb.write(first);
- sb.write(second);
- }
- }
- static encodeComponent(component) {
- return core.Uri._uriEncode(core.Uri._unreserved2396Table, component, convert.UTF8, false);
- }
- static encodeQueryComponent(component, opts) {
- let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
- return core.Uri._uriEncode(core.Uri._unreservedTable, component, encoding, true);
- }
- static decodeComponent(encodedComponent) {
- return core.Uri._uriDecode(encodedComponent, 0, encodedComponent[dartx.length], convert.UTF8, false);
- }
- static decodeQueryComponent(encodedComponent, opts) {
- let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
- return core.Uri._uriDecode(encodedComponent, 0, encodedComponent[dartx.length], encoding, true);
- }
- static encodeFull(uri) {
- return core.Uri._uriEncode(core.Uri._encodeFullTable, uri, convert.UTF8, false);
- }
- static decodeFull(uri) {
- return core.Uri._uriDecode(uri, 0, uri[dartx.length], convert.UTF8, false);
- }
- static splitQueryString(query, opts) {
- let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
- return query[dartx.split]("&")[dartx.fold](MapOfString$String())(dart.map({}, core.String, core.String), dart.fn((map, element) => {
- let index = element[dartx.indexOf]("=");
- if (index == -1) {
- if (element != "") {
- map[dartx._set](core.Uri.decodeQueryComponent(element, {encoding: encoding}), "");
- }
- } else if (index != 0) {
- let key = element[dartx.substring](0, index);
- let value = element[dartx.substring](dart.notNull(index) + 1);
- map[dartx._set](core.Uri.decodeQueryComponent(key, {encoding: encoding}), core.Uri.decodeQueryComponent(value, {encoding: encoding}));
- }
- return map;
- }, MapOfString$StringAndStringToMapOfString$String()));
+ let t = this[_hashCodeCache];
+ return t == null ? this[_hashCodeCache] = dart.hashCode(this.toString()) : t;
}
static _createList() {
return [];
@@ -34393,22 +34696,20 @@
let value = null;
if (start == end) return;
if (dart.notNull(equalsIndex) < 0) {
- key = core.Uri._uriDecode(query, start, end, encoding, true);
+ key = core._Uri._uriDecode(query, start, end, encoding, true);
value = "";
} else {
- key = core.Uri._uriDecode(query, start, equalsIndex, encoding, true);
- value = core.Uri._uriDecode(query, dart.notNull(equalsIndex) + 1, end, encoding, true);
+ key = core._Uri._uriDecode(query, start, equalsIndex, encoding, true);
+ value = core._Uri._uriDecode(query, dart.notNull(equalsIndex) + 1, end, encoding, true);
}
- dart.dsend(result[dartx.putIfAbsent](key, core.Uri._createList), 'add', value);
+ dart.dsend(result[dartx.putIfAbsent](key, core._Uri._createList), 'add', value);
}
dart.fn(parsePair, intAndintAndintTovoid());
- let _equals = 61;
- let _ampersand = 38;
while (i < dart.notNull(query[dartx.length])) {
let char = query[dartx.codeUnitAt](i);
- if (char == _equals) {
+ if (char == core._EQUALS) {
if (equalsIndex < 0) equalsIndex = i;
- } else if (char == _ampersand) {
+ } else if (char == core._AMPERSAND) {
parsePair(start, equalsIndex, i);
start = i + 1;
equalsIndex = -1;
@@ -34418,125 +34719,17 @@
parsePair(start, equalsIndex, i);
return result;
}
- static parseIPv4Address(host) {
- function error(msg) {
- dart.throw(new core.FormatException(dart.str`Illegal IPv4 address, ${msg}`));
- }
- dart.fn(error, StringTovoid$());
- let bytes = host[dartx.split]('.');
- if (bytes[dartx.length] != 4) {
- error('IPv4 address should contain exactly 4 parts');
- }
- return bytes[dartx.map](core.int)(dart.fn(byteString => {
- let byte = core.int.parse(byteString);
- if (dart.notNull(byte) < 0 || dart.notNull(byte) > 255) {
- error('each part must be in the range of `0..255`');
- }
- return byte;
- }, StringToint$()))[dartx.toList]();
- }
- static parseIPv6Address(host, start, end) {
- if (start === void 0) start = 0;
- if (end === void 0) end = null;
- if (end == null) end = host[dartx.length];
- function error(msg, position) {
- if (position === void 0) position = null;
- dart.throw(new core.FormatException(dart.str`Illegal IPv6 address, ${msg}`, host, core.int._check(position)));
- }
- dart.fn(error, String__Tovoid());
- function parseHex(start, end) {
- if (dart.notNull(end) - dart.notNull(start) > 4) {
- error('an IPv6 part can only contain a maximum of 4 hex digits', start);
- }
- let value = core.int.parse(host[dartx.substring](start, end), {radix: 16});
- if (dart.notNull(value) < 0 || dart.notNull(value) > (1 << 16) - 1) {
- error('each part must be in the range of `0x0..0xFFFF`', start);
- }
- return value;
- }
- dart.fn(parseHex, intAndintToint());
- if (dart.notNull(host[dartx.length]) < 2) error('address is too short');
- let parts = JSArrayOfint().of([]);
- let wildcardSeen = false;
- let partStart = start;
- for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(i) + 1) {
- if (host[dartx.codeUnitAt](i) == core.Uri._COLON) {
- if (i == start) {
- i = dart.notNull(i) + 1;
- if (host[dartx.codeUnitAt](i) != core.Uri._COLON) {
- error('invalid start colon.', i);
- }
- partStart = i;
- }
- if (i == partStart) {
- if (wildcardSeen) {
- error('only one wildcard `::` is allowed', i);
- }
- wildcardSeen = true;
- parts[dartx.add](-1);
- } else {
- parts[dartx.add](parseHex(partStart, i));
- }
- partStart = dart.notNull(i) + 1;
- }
- }
- if (parts[dartx.length] == 0) error('too few parts');
- let atEnd = partStart == end;
- let isLastWildcard = parts[dartx.last] == -1;
- if (atEnd && !isLastWildcard) {
- error('expected a part after last `:`', end);
- }
- if (!atEnd) {
- try {
- parts[dartx.add](parseHex(partStart, end));
- } catch (e) {
- try {
- let last = core.Uri.parseIPv4Address(host[dartx.substring](partStart, end));
- parts[dartx.add]((dart.notNull(last[dartx._get](0)) << 8 | dart.notNull(last[dartx._get](1))) >>> 0);
- parts[dartx.add]((dart.notNull(last[dartx._get](2)) << 8 | dart.notNull(last[dartx._get](3))) >>> 0);
- } catch (e) {
- error('invalid end of IPv6 address.', partStart);
- }
-
- }
-
- }
- if (wildcardSeen) {
- if (dart.notNull(parts[dartx.length]) > 7) {
- error('an address with a wildcard must have less than 7 parts');
- }
- } else if (parts[dartx.length] != 8) {
- error('an address without a wildcard must contain exactly 8 parts');
- }
- let bytes = typed_data.Uint8List.new(16);
- for (let i = 0, index = 0; i < dart.notNull(parts[dartx.length]); i++) {
- let value = parts[dartx._get](i);
- if (value == -1) {
- let wildCardLength = 9 - dart.notNull(parts[dartx.length]);
- for (let j = 0; j < wildCardLength; j++) {
- bytes[dartx._set](index, 0);
- bytes[dartx._set](index + 1, 0);
- index = index + 2;
- }
- } else {
- bytes[dartx._set](index, value[dartx['>>']](8));
- bytes[dartx._set](index + 1, dart.notNull(value) & 255);
- index = index + 2;
- }
- }
- return bytes;
- }
static _uriEncode(canonicalTable, text, encoding, spaceToPlus) {
- if (core.identical(encoding, convert.UTF8) && dart.test(core.Uri._needsNoEncoding.hasMatch(text))) {
+ if (core.identical(encoding, convert.UTF8) && dart.test(core._Uri._needsNoEncoding.hasMatch(text))) {
return text;
}
- let result = new core.StringBuffer();
+ let result = new core.StringBuffer('');
let bytes = encoding.encode(text);
for (let i = 0; i < dart.notNull(bytes[dartx.length]); i++) {
let byte = bytes[dartx._get](i);
if (dart.notNull(byte) < 128 && (dart.notNull(canonicalTable[dartx._get](byte[dartx['>>']](4))) & 1 << (dart.notNull(byte) & 15)) != 0) {
result.writeCharCode(byte);
- } else if (dart.test(spaceToPlus) && byte == core.Uri._SPACE) {
+ } else if (dart.test(spaceToPlus) && byte == core._SPACE) {
result.write('+');
} else {
let hexDigits = '0123456789ABCDEF';
@@ -34572,7 +34765,7 @@
let simple = true;
for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(i) + 1) {
let codeUnit = text[dartx.codeUnitAt](i);
- if (dart.notNull(codeUnit) > 127 || codeUnit == core.Uri._PERCENT || dart.test(plusToSpace) && codeUnit == core.Uri._PLUS) {
+ if (dart.notNull(codeUnit) > 127 || codeUnit == core._PERCENT || dart.test(plusToSpace) && codeUnit == core._PLUS) {
simple = false;
break;
}
@@ -34591,14 +34784,14 @@
if (dart.notNull(codeUnit) > 127) {
dart.throw(new core.ArgumentError("Illegal percent encoding in URI"));
}
- if (codeUnit == core.Uri._PERCENT) {
+ if (codeUnit == core._PERCENT) {
if (dart.notNull(i) + 3 > dart.notNull(text[dartx.length])) {
dart.throw(new core.ArgumentError('Truncated URI'));
}
- bytes[dartx.add](core.Uri._hexCharPairToByte(text, dart.notNull(i) + 1));
+ bytes[dartx.add](core._Uri._hexCharPairToByte(text, dart.notNull(i) + 1));
i = dart.notNull(i) + 2;
- } else if (dart.test(plusToSpace) && codeUnit == core.Uri._PLUS) {
- bytes[dartx.add](core.Uri._SPACE);
+ } else if (dart.test(plusToSpace) && codeUnit == core._PLUS) {
+ bytes[dartx.add](core._SPACE);
} else {
bytes[dartx.add](codeUnit);
}
@@ -34608,23 +34801,26 @@
}
static _isAlphabeticCharacter(codeUnit) {
let lowerCase = (dart.notNull(codeUnit) | 32) >>> 0;
- return core.Uri._LOWER_CASE_A <= lowerCase && lowerCase <= core.Uri._LOWER_CASE_Z;
+ return core._LOWER_CASE_A <= lowerCase && lowerCase <= core._LOWER_CASE_Z;
}
static _isUnreservedChar(char) {
- return dart.notNull(char) < 127 && (dart.notNull(core.Uri._unreservedTable[dartx._get](char[dartx['>>']](4))) & 1 << (dart.notNull(char) & 15)) != 0;
+ return dart.notNull(char) < 127 && (dart.notNull(core._Uri._unreservedTable[dartx._get](char[dartx['>>']](4))) & 1 << (dart.notNull(char) & 15)) != 0;
}
};
-dart.defineNamedConstructor(core.Uri, '_internal');
-dart.setSignature(core.Uri, {
+dart.defineNamedConstructor(core._Uri, '_internal');
+core._Uri[dart.implements] = () => [core.Uri];
+dart.setSignature(core._Uri, {
fields: () => ({
scheme: core.String,
[_userInfo]: core.String,
[_host]: core.String,
[_port]: core.int,
- [_path]: core.String,
+ path: core.String,
[_query]: core.String,
[_fragment]: core.String,
[_pathSegments]: ListOfString(),
+ [_text]: core.String,
+ [_hashCodeCache]: core.int,
[_queryParameters]: MapOfString$String(),
[_queryParameterLists]: MapOfString$ListOfString()
}),
@@ -34633,7 +34829,6 @@
userInfo: dart.definiteFunctionType(core.String, []),
host: dart.definiteFunctionType(core.String, []),
port: dart.definiteFunctionType(core.int, []),
- path: dart.definiteFunctionType(core.String, []),
query: dart.definiteFunctionType(core.String, []),
fragment: dart.definiteFunctionType(core.String, []),
pathSegments: dart.definiteFunctionType(core.List$(core.String), []),
@@ -34652,6 +34847,7 @@
data: dart.definiteFunctionType(core.UriData, [])
}),
methods: () => ({
+ isScheme: dart.definiteFunctionType(core.bool, [core.String]),
replace: dart.definiteFunctionType(core.Uri, [], {scheme: core.String, userInfo: core.String, host: core.String, port: core.int, path: core.String, pathSegments: IterableOfString(), query: core.String, queryParameters: MapOfString$dynamic(), fragment: core.String}),
removeFragment: dart.definiteFunctionType(core.Uri, []),
normalizePath: dart.definiteFunctionType(core.Uri, []),
@@ -34660,12 +34856,12 @@
resolveUri: dart.definiteFunctionType(core.Uri, [core.Uri]),
toFilePath: dart.definiteFunctionType(core.String, [], {windows: core.bool}),
[_toFilePath]: dart.definiteFunctionType(core.String, []),
- [_toWindowsFilePath]: dart.definiteFunctionType(core.String, []),
- [_writeAuthority]: dart.definiteFunctionType(dart.void, [core.StringSink])
+ [_writeAuthority]: dart.definiteFunctionType(dart.void, [core.StringSink]),
+ [_initializeText]: dart.definiteFunctionType(core.String, [])
}),
statics: () => ({
_defaultPort: dart.definiteFunctionType(core.int, [core.String]),
- parse: dart.definiteFunctionType(core.Uri, [core.String], [core.int, core.int]),
+ _compareScheme: dart.definiteFunctionType(core.bool, [core.String, core.String]),
_fail: dart.definiteFunctionType(dart.void, [core.String, core.int, core.String]),
_makeHttpUri: dart.definiteFunctionType(core.Uri, [core.String, core.String, core.String, MapOfString$String()]),
_checkNonWindowsPathReservedCharacters: dart.definiteFunctionType(dart.dynamic, [ListOfString(), core.bool]),
@@ -34678,85 +34874,50 @@
_isRegNameChar: dart.definiteFunctionType(core.bool, [core.int]),
_normalizeRegName: dart.definiteFunctionType(core.String, [core.String, core.int, core.int]),
_makeScheme: dart.definiteFunctionType(core.String, [core.String, core.int, core.int]),
+ _canonicalizeScheme: dart.definiteFunctionType(core.String, [core.String]),
_makeUserInfo: dart.definiteFunctionType(core.String, [core.String, core.int, core.int]),
_makePath: dart.definiteFunctionType(core.String, [core.String, core.int, core.int, IterableOfString(), core.String, core.bool]),
_normalizePath: dart.definiteFunctionType(core.String, [core.String, core.String, core.bool]),
_makeQuery: dart.definiteFunctionType(core.String, [core.String, core.int, core.int, MapOfString$dynamic()]),
_makeFragment: dart.definiteFunctionType(core.String, [core.String, core.int, core.int]),
- _stringOrNullLength: dart.definiteFunctionType(core.int, [core.String]),
_normalizeEscape: dart.definiteFunctionType(core.String, [core.String, core.int, core.bool]),
- _parseHexDigit: dart.definiteFunctionType(core.int, [core.int]),
_escapeChar: dart.definiteFunctionType(core.String, [core.int]),
- _normalize: dart.definiteFunctionType(core.String, [core.String, core.int, core.int, ListOfint()]),
+ _normalizeOrSubstring: dart.definiteFunctionType(core.String, [core.String, core.int, core.int, ListOfint()]),
+ _normalize: dart.definiteFunctionType(core.String, [core.String, core.int, core.int, ListOfint()], {escapeDelimiters: core.bool}),
_isSchemeCharacter: dart.definiteFunctionType(core.bool, [core.int]),
_isGeneralDelimiter: dart.definiteFunctionType(core.bool, [core.int]),
_mayContainDotSegments: dart.definiteFunctionType(core.bool, [core.String]),
_removeDotSegments: dart.definiteFunctionType(core.String, [core.String]),
- _normalizeRelativePath: dart.definiteFunctionType(core.String, [core.String]),
- _addIfNonEmpty: dart.definiteFunctionType(dart.void, [core.StringBuffer, core.String, core.String, core.String]),
- encodeComponent: dart.definiteFunctionType(core.String, [core.String]),
- encodeQueryComponent: dart.definiteFunctionType(core.String, [core.String], {encoding: convert.Encoding}),
- decodeComponent: dart.definiteFunctionType(core.String, [core.String]),
- decodeQueryComponent: dart.definiteFunctionType(core.String, [core.String], {encoding: convert.Encoding}),
- encodeFull: dart.definiteFunctionType(core.String, [core.String]),
- decodeFull: dart.definiteFunctionType(core.String, [core.String]),
- splitQueryString: dart.definiteFunctionType(core.Map$(core.String, core.String), [core.String], {encoding: convert.Encoding}),
+ _normalizeRelativePath: dart.definiteFunctionType(core.String, [core.String, core.bool]),
+ _escapeScheme: dart.definiteFunctionType(core.String, [core.String]),
+ _toWindowsFilePath: dart.definiteFunctionType(core.String, [core.Uri]),
_createList: dart.definiteFunctionType(core.List, []),
_splitQueryStringAll: dart.definiteFunctionType(core.Map, [core.String], {encoding: convert.Encoding}),
- parseIPv4Address: dart.definiteFunctionType(core.List$(core.int), [core.String]),
- parseIPv6Address: dart.definiteFunctionType(core.List$(core.int), [core.String], [core.int, core.int]),
_uriEncode: dart.definiteFunctionType(core.String, [ListOfint(), core.String, convert.Encoding, core.bool]),
_hexCharPairToByte: dart.definiteFunctionType(core.int, [core.String, core.int]),
_uriDecode: dart.definiteFunctionType(core.String, [core.String, core.int, core.int, convert.Encoding, core.bool]),
_isAlphabeticCharacter: dart.definiteFunctionType(core.bool, [core.int]),
_isUnreservedChar: dart.definiteFunctionType(core.bool, [core.int])
}),
- names: ['_defaultPort', 'parse', '_fail', '_makeHttpUri', '_checkNonWindowsPathReservedCharacters', '_checkWindowsPathReservedCharacters', '_checkWindowsDriveLetter', '_makeFileUri', '_makeWindowsFileUrl', '_makePort', '_makeHost', '_isRegNameChar', '_normalizeRegName', '_makeScheme', '_makeUserInfo', '_makePath', '_normalizePath', '_makeQuery', '_makeFragment', '_stringOrNullLength', '_normalizeEscape', '_parseHexDigit', '_escapeChar', '_normalize', '_isSchemeCharacter', '_isGeneralDelimiter', '_mayContainDotSegments', '_removeDotSegments', '_normalizeRelativePath', '_addIfNonEmpty', 'encodeComponent', 'encodeQueryComponent', 'decodeComponent', 'decodeQueryComponent', 'encodeFull', 'decodeFull', 'splitQueryString', '_createList', '_splitQueryStringAll', 'parseIPv4Address', 'parseIPv6Address', '_uriEncode', '_hexCharPairToByte', '_uriDecode', '_isAlphabeticCharacter', '_isUnreservedChar']
+ names: ['_defaultPort', '_compareScheme', '_fail', '_makeHttpUri', '_checkNonWindowsPathReservedCharacters', '_checkWindowsPathReservedCharacters', '_checkWindowsDriveLetter', '_makeFileUri', '_makeWindowsFileUrl', '_makePort', '_makeHost', '_isRegNameChar', '_normalizeRegName', '_makeScheme', '_canonicalizeScheme', '_makeUserInfo', '_makePath', '_normalizePath', '_makeQuery', '_makeFragment', '_normalizeEscape', '_escapeChar', '_normalizeOrSubstring', '_normalize', '_isSchemeCharacter', '_isGeneralDelimiter', '_mayContainDotSegments', '_removeDotSegments', '_normalizeRelativePath', '_escapeScheme', '_toWindowsFilePath', '_createList', '_splitQueryStringAll', '_uriEncode', '_hexCharPairToByte', '_uriDecode', '_isAlphabeticCharacter', '_isUnreservedChar']
});
-core.Uri._SPACE = 32;
-core.Uri._DOUBLE_QUOTE = 34;
-core.Uri._NUMBER_SIGN = 35;
-core.Uri._PERCENT = 37;
-core.Uri._ASTERISK = 42;
-core.Uri._PLUS = 43;
-core.Uri._DOT = 46;
-core.Uri._SLASH = 47;
-core.Uri._ZERO = 48;
-core.Uri._NINE = 57;
-core.Uri._COLON = 58;
-core.Uri._LESS = 60;
-core.Uri._GREATER = 62;
-core.Uri._QUESTION = 63;
-core.Uri._AT_SIGN = 64;
-core.Uri._UPPER_CASE_A = 65;
-core.Uri._UPPER_CASE_F = 70;
-core.Uri._UPPER_CASE_Z = 90;
-core.Uri._LEFT_BRACKET = 91;
-core.Uri._BACKSLASH = 92;
-core.Uri._RIGHT_BRACKET = 93;
-core.Uri._LOWER_CASE_A = 97;
-core.Uri._LOWER_CASE_F = 102;
-core.Uri._LOWER_CASE_Z = 122;
-core.Uri._BAR = 124;
-core.Uri._hexDigits = "0123456789ABCDEF";
-core.Uri._unreservedTable = dart.constList([0, 0, 24576, 1023, 65534, 34815, 65534, 18431], core.int);
-core.Uri._unreserved2396Table = dart.constList([0, 0, 26498, 1023, 65534, 34815, 65534, 18431], core.int);
-core.Uri._encodeFullTable = dart.constList([0, 0, 65498, 45055, 65535, 34815, 65534, 18431], core.int);
-core.Uri._schemeTable = dart.constList([0, 0, 26624, 1023, 65534, 2047, 65534, 2047], core.int);
-core.Uri._schemeLowerTable = dart.constList([0, 0, 26624, 1023, 0, 0, 65534, 2047], core.int);
-core.Uri._subDelimitersTable = dart.constList([0, 0, 32722, 11263, 65534, 34815, 65534, 18431], core.int);
-core.Uri._genDelimitersTable = dart.constList([0, 0, 32776, 33792, 1, 10240, 0, 0], core.int);
-core.Uri._userinfoTable = dart.constList([0, 0, 32722, 12287, 65534, 34815, 65534, 18431], core.int);
-core.Uri._regNameTable = dart.constList([0, 0, 32754, 11263, 65534, 34815, 65534, 18431], core.int);
-core.Uri._pathCharTable = dart.constList([0, 0, 32722, 12287, 65535, 34815, 65534, 18431], core.int);
-core.Uri._pathCharOrSlashTable = dart.constList([0, 0, 65490, 12287, 65535, 34815, 65534, 18431], core.int);
-core.Uri._queryCharTable = dart.constList([0, 0, 65490, 45055, 65535, 34815, 65534, 18431], core.int);
-dart.defineLazy(core.Uri, {
+core._Uri._unreservedTable = dart.constList([0, 0, 24576, 1023, 65534, 34815, 65534, 18431], core.int);
+core._Uri._unreserved2396Table = dart.constList([0, 0, 26498, 1023, 65534, 34815, 65534, 18431], core.int);
+core._Uri._encodeFullTable = dart.constList([0, 0, 65498, 45055, 65535, 34815, 65534, 18431], core.int);
+core._Uri._schemeTable = dart.constList([0, 0, 26624, 1023, 65534, 2047, 65534, 2047], core.int);
+core._Uri._schemeLowerTable = dart.constList([0, 0, 26624, 1023, 0, 0, 65534, 2047], core.int);
+core._Uri._subDelimitersTable = dart.constList([0, 0, 32722, 11263, 65534, 34815, 65534, 18431], core.int);
+core._Uri._genDelimitersTable = dart.constList([0, 0, 32776, 33792, 1, 10240, 0, 0], core.int);
+core._Uri._userinfoTable = dart.constList([0, 0, 32722, 12287, 65534, 34815, 65534, 18431], core.int);
+core._Uri._regNameTable = dart.constList([0, 0, 32754, 11263, 65534, 34815, 65534, 18431], core.int);
+core._Uri._pathCharTable = dart.constList([0, 0, 32722, 12287, 65535, 34815, 65534, 18431], core.int);
+core._Uri._pathCharOrSlashTable = dart.constList([0, 0, 65490, 12287, 65535, 34815, 65534, 18431], core.int);
+core._Uri._queryCharTable = dart.constList([0, 0, 65490, 45055, 65535, 34815, 65534, 18431], core.int);
+dart.defineLazy(core._Uri, {
get _needsNoEncoding() {
return core.RegExp.new('^[\\-\\.0-9A-Z_a-z~]*$');
}
});
-const _text = Symbol('_text');
const _separatorIndices = Symbol('_separatorIndices');
const _uriCache = Symbol('_uriCache');
core.UriData = class UriData extends core.Object {
@@ -34840,9 +35001,9 @@
if (dart.notNull(slashIndex) < 0) {
dart.throw(new core.ArgumentError.value(mimeType, "mimeType", "Invalid MIME type"));
}
- buffer.write(core.Uri._uriEncode(core.UriData._tokenCharTable, mimeType[dartx.substring](0, slashIndex), convert.UTF8, false));
+ buffer.write(core._Uri._uriEncode(core.UriData._tokenCharTable, mimeType[dartx.substring](0, slashIndex), convert.UTF8, false));
buffer.write("/");
- buffer.write(core.Uri._uriEncode(core.UriData._tokenCharTable, mimeType[dartx.substring](dart.notNull(slashIndex) + 1), convert.UTF8, false));
+ buffer.write(core._Uri._uriEncode(core.UriData._tokenCharTable, mimeType[dartx.substring](dart.notNull(slashIndex) + 1), convert.UTF8, false));
}
if (charsetName != null) {
if (indices != null) {
@@ -34850,7 +35011,7 @@
indices[dartx.add](dart.notNull(buffer.length) + 8);
}
buffer.write(";charset=");
- buffer.write(core.Uri._uriEncode(core.UriData._tokenCharTable, charsetName, convert.UTF8, false));
+ buffer.write(core._Uri._uriEncode(core.UriData._tokenCharTable, charsetName, convert.UTF8, false));
}
dart.nullSafe(parameters, _ => _[dartx.forEach](dart.fn((key, value) => {
if (dart.test(key[dartx.isEmpty])) {
@@ -34861,17 +35022,17 @@
}
if (indices != null) indices[dartx.add](buffer.length);
buffer.write(';');
- buffer.write(core.Uri._uriEncode(core.UriData._tokenCharTable, key, convert.UTF8, false));
+ buffer.write(core._Uri._uriEncode(core.UriData._tokenCharTable, key, convert.UTF8, false));
if (indices != null) indices[dartx.add](buffer.length);
buffer.write('=');
- buffer.write(core.Uri._uriEncode(core.UriData._tokenCharTable, value, convert.UTF8, false));
+ buffer.write(core._Uri._uriEncode(core.UriData._tokenCharTable, value, convert.UTF8, false));
}, StringAndStringToNull())));
}
static _validateMimeType(mimeType) {
let slashIndex = -1;
for (let i = 0; i < dart.notNull(mimeType[dartx.length]); i++) {
let char = mimeType[dartx.codeUnitAt](i);
- if (char != core.Uri._SLASH) continue;
+ if (char != core._SLASH) continue;
if (slashIndex < 0) {
slashIndex = i;
continue;
@@ -34881,10 +35042,16 @@
return slashIndex;
}
static parse(uri) {
- if (!dart.test(uri[dartx.startsWith]("data:"))) {
- dart.throw(new core.FormatException("Does not start with 'data:'", uri, 0));
+ if (dart.notNull(uri[dartx.length]) >= 5) {
+ let dataDelta = core._startsWithData(uri, 0);
+ if (dataDelta == 0) {
+ return core.UriData._parse(uri, 5, null);
+ }
+ if (dataDelta == 32) {
+ return core.UriData._parse(uri[dartx.substring](5), 0, null);
+ }
}
- return core.UriData._parse(uri, 5, null);
+ dart.throw(new core.FormatException("Does not start with 'data:'", uri, 0));
}
get uri() {
if (this[_uriCache] != null) return this[_uriCache];
@@ -34892,20 +35059,20 @@
let query = null;
let colonIndex = this[_separatorIndices][dartx._get](0);
let queryIndex = this[_text][dartx.indexOf]('?', dart.notNull(colonIndex) + 1);
- let end = null;
+ let end = this[_text][dartx.length];
if (dart.notNull(queryIndex) >= 0) {
- query = this[_text][dartx.substring](dart.notNull(queryIndex) + 1);
+ query = core._Uri._normalizeOrSubstring(this[_text], dart.notNull(queryIndex) + 1, end, core._Uri._queryCharTable);
end = queryIndex;
}
- path = this[_text][dartx.substring](dart.notNull(colonIndex) + 1, end);
- this[_uriCache] = new core.Uri._internal("data", "", null, null, path, query, null);
+ path = core._Uri._normalizeOrSubstring(this[_text], dart.notNull(colonIndex) + 1, end, core._Uri._pathCharOrSlashTable);
+ this[_uriCache] = new core._DataUri(this, path, query);
return this[_uriCache];
}
get mimeType() {
let start = dart.notNull(this[_separatorIndices][dartx._get](0)) + 1;
let end = this[_separatorIndices][dartx._get](1);
if (start == end) return "text/plain";
- return core.Uri._uriDecode(this[_text], start, end, convert.UTF8, false);
+ return core._Uri._uriDecode(this[_text], start, end, convert.UTF8, false);
}
get charset() {
let parameterStart = 1;
@@ -34917,7 +35084,7 @@
let keyStart = dart.notNull(this[_separatorIndices][dartx._get](i)) + 1;
let keyEnd = this[_separatorIndices][dartx._get](i + 1);
if (keyEnd == keyStart + 7 && dart.test(this[_text][dartx.startsWith]("charset", keyStart))) {
- return core.Uri._uriDecode(this[_text], dart.notNull(keyEnd) + 1, this[_separatorIndices][dartx._get](i + 2), convert.UTF8, false);
+ return core._Uri._uriDecode(this[_text], dart.notNull(keyEnd) + 1, this[_separatorIndices][dartx._get](i + 2), convert.UTF8, false);
}
}
return "US-ASCII";
@@ -34955,10 +35122,8 @@
result[dartx._set](index++, codeUnit);
} else {
if (i + 2 < dart.notNull(text[dartx.length])) {
- let digit1 = core.Uri._parseHexDigit(text[dartx.codeUnitAt](i + 1));
- let digit2 = core.Uri._parseHexDigit(text[dartx.codeUnitAt](i + 2));
- if (dart.notNull(digit1) >= 0 && dart.notNull(digit2) >= 0) {
- let byte = dart.notNull(digit1) * 16 + dart.notNull(digit2);
+ let byte = _internal.parseHexByte(text, i + 1);
+ if (dart.notNull(byte) >= 0) {
result[dartx._set](index++, byte);
i = i + 2;
continue;
@@ -34985,7 +35150,7 @@
let converter = convert.BASE64.decoder.fuse(core.String)(encoding.decoder);
return converter.convert(text[dartx.substring](start));
}
- return core.Uri._uriDecode(text, start, text[dartx.length], encoding, false);
+ return core._Uri._uriDecode(text, start, text[dartx.length], encoding, false);
}
get parameters() {
let result = dart.map({}, core.String, core.String);
@@ -34993,8 +35158,8 @@
let start = dart.notNull(this[_separatorIndices][dartx._get](i - 2)) + 1;
let equals = this[_separatorIndices][dartx._get](i - 1);
let end = this[_separatorIndices][dartx._get](i);
- let key = core.Uri._uriDecode(this[_text], start, equals, convert.UTF8, false);
- let value = core.Uri._uriDecode(this[_text], dart.notNull(equals) + 1, end, convert.UTF8, false);
+ let key = core._Uri._uriDecode(this[_text], start, equals, convert.UTF8, false);
+ let value = core._Uri._uriDecode(this[_text], dart.notNull(equals) + 1, end, convert.UTF8, false);
result[dartx._set](key, value);
}
return result;
@@ -35047,6 +35212,15 @@
}
}
indices[dartx.add](i);
+ let isBase64 = indices[dartx.length][dartx.isOdd];
+ if (dart.test(isBase64)) {
+ text = convert.BASE64.normalize(text, dart.notNull(i) + 1, text[dartx.length]);
+ } else {
+ let data = core._Uri._normalize(text, dart.notNull(i) + 1, text[dartx.length], core.UriData._uricTable, {escapeDelimiters: true});
+ if (data != null) {
+ text = text[dartx.replaceRange](dart.notNull(i) + 1, text[dartx.length], data);
+ }
+ }
return new core.UriData._(text, indices, sourceUri);
}
static _uriEncodeBytes(canonicalTable, bytes, buffer) {
@@ -35057,9 +35231,9 @@
if (dart.notNull(byte) < 128 && (dart.notNull(canonicalTable[dartx._get](byte[dartx['>>']](4))) & 1 << (dart.notNull(byte) & 15)) != 0) {
buffer.writeCharCode(byte);
} else {
- buffer.writeCharCode(core.Uri._PERCENT);
- buffer.writeCharCode(core.Uri._hexDigits[dartx.codeUnitAt](byte[dartx['>>']](4)));
- buffer.writeCharCode(core.Uri._hexDigits[dartx.codeUnitAt](dart.notNull(byte) & 15));
+ buffer.writeCharCode(core._PERCENT);
+ buffer.writeCharCode(core._hexDigits[dartx.codeUnitAt](byte[dartx['>>']](4)));
+ buffer.writeCharCode(core._hexDigits[dartx.codeUnitAt](dart.notNull(byte) & 15));
}
}
if ((dart.notNull(byteOr) & ~255) != 0) {
@@ -35105,7 +35279,667 @@
});
core.UriData._noScheme = -1;
core.UriData._tokenCharTable = dart.constList([0, 0, 27858, 1023, 65534, 51199, 65535, 32767], core.int);
-core.UriData._uricTable = core.Uri._queryCharTable;
+core.UriData._uricTable = core._Uri._queryCharTable;
+core.UriData._base64Table = dart.constList([0, 0, 34816, 1023, 65534, 2047, 65534, 2047], core.int);
+core._schemeEndIndex = 1;
+core._hostStartIndex = 2;
+core._portStartIndex = 3;
+core._pathStartIndex = 4;
+core._queryStartIndex = 5;
+core._fragmentStartIndex = 6;
+core._notSimpleIndex = 7;
+core._uriStart = 0;
+core._nonSimpleEndStates = 14;
+core._schemeStart = 20;
+dart.defineLazy(core, {
+ get _scannerTables() {
+ return core._createTables();
+ }
+});
+core._createTables = function() {
+ let stateCount = 22;
+ let schemeOrPath = 1;
+ let authOrPath = 2;
+ let authOrPathSlash = 3;
+ let uinfoOrHost0 = 4;
+ let uinfoOrHost = 5;
+ let uinfoOrPort0 = 6;
+ let uinfoOrPort = 7;
+ let ipv6Host = 8;
+ let relPathSeg = 9;
+ let pathSeg = 10;
+ let path = 11;
+ let query = 12;
+ let fragment = 13;
+ let schemeOrPathDot = 14;
+ let schemeOrPathDot2 = 15;
+ let relPathSegDot = 16;
+ let relPathSegDot2 = 17;
+ let pathSegDot = 18;
+ let pathSegDot2 = 19;
+ let scheme0 = core._schemeStart;
+ let scheme = 21;
+ let schemeEnd = core._schemeEndIndex << 5;
+ let hostStart = core._hostStartIndex << 5;
+ let portStart = core._portStartIndex << 5;
+ let pathStart = core._pathStartIndex << 5;
+ let queryStart = core._queryStartIndex << 5;
+ let fragmentStart = core._fragmentStartIndex << 5;
+ let notSimple = core._notSimpleIndex << 5;
+ let unreserved = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-._~";
+ let subDelims = "!$&'()*+,;=";
+ let pchar = dart.str`${unreserved}${subDelims}`;
+ let tables = ListOfUint8List().generate(stateCount, dart.fn(_ => typed_data.Uint8List.new(96), intToUint8List()));
+ function build(state, defaultTransition) {
+ return (() => {
+ let _ = tables[dartx._get](core.int._check(state));
+ _[dartx.fillRange](0, 96, core.int._check(defaultTransition));
+ return _;
+ })();
+ }
+ dart.fn(build, dynamicAnddynamicToUint8List());
+ function setChars(target, chars, transition) {
+ for (let i = 0; i < dart.notNull(chars[dartx.length]); i++) {
+ let char = chars[dartx.codeUnitAt](i);
+ target[dartx._set]((dart.notNull(char) ^ 96) >>> 0, transition);
+ }
+ }
+ dart.fn(setChars, Uint8ListAndStringAndintTovoid());
+ function setRange(target, range, transition) {
+ for (let i = range[dartx.codeUnitAt](0), n = range[dartx.codeUnitAt](1); dart.notNull(i) <= dart.notNull(n); i = dart.notNull(i) + 1) {
+ target[dartx._set]((dart.notNull(i) ^ 96) >>> 0, transition);
+ }
+ }
+ dart.fn(setRange, Uint8ListAndStringAndintTovoid());
+ let b = null;
+ b = build(core._uriStart, (schemeOrPath | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), pchar, schemeOrPath);
+ setChars(typed_data.Uint8List._check(b), ".", schemeOrPathDot);
+ setChars(typed_data.Uint8List._check(b), ":", (authOrPath | schemeEnd) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "/", authOrPathSlash);
+ setChars(typed_data.Uint8List._check(b), "?", (query | queryStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "#", (fragment | fragmentStart) >>> 0);
+ b = build(schemeOrPathDot, (schemeOrPath | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), pchar, schemeOrPath);
+ setChars(typed_data.Uint8List._check(b), ".", schemeOrPathDot2);
+ setChars(typed_data.Uint8List._check(b), ':', (authOrPath | schemeEnd) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "/", (pathSeg | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "?", (query | queryStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "#", (fragment | fragmentStart) >>> 0);
+ b = build(schemeOrPathDot2, (schemeOrPath | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), pchar, schemeOrPath);
+ setChars(typed_data.Uint8List._check(b), "%", (schemeOrPath | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), ':', (authOrPath | schemeEnd) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "/", relPathSeg);
+ setChars(typed_data.Uint8List._check(b), "?", (query | queryStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "#", (fragment | fragmentStart) >>> 0);
+ b = build(schemeOrPath, (schemeOrPath | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), pchar, schemeOrPath);
+ setChars(typed_data.Uint8List._check(b), ':', (authOrPath | schemeEnd) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "/", pathSeg);
+ setChars(typed_data.Uint8List._check(b), "?", (query | queryStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "#", (fragment | fragmentStart) >>> 0);
+ b = build(authOrPath, (path | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), pchar, (path | pathStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "/", (authOrPathSlash | pathStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), ".", (pathSegDot | pathStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "?", (query | queryStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "#", (fragment | fragmentStart) >>> 0);
+ b = build(authOrPathSlash, (path | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), pchar, path);
+ setChars(typed_data.Uint8List._check(b), "/", (uinfoOrHost0 | hostStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), ".", pathSegDot);
+ setChars(typed_data.Uint8List._check(b), "?", (query | queryStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "#", (fragment | fragmentStart) >>> 0);
+ b = build(uinfoOrHost0, (uinfoOrHost | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), pchar, uinfoOrHost);
+ setRange(typed_data.Uint8List._check(b), "AZ", (uinfoOrHost | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), ":", (uinfoOrPort0 | portStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "@", (uinfoOrHost0 | hostStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "[", (ipv6Host | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "/", (pathSeg | pathStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "?", (query | queryStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "#", (fragment | fragmentStart) >>> 0);
+ b = build(uinfoOrHost, (uinfoOrHost | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), pchar, uinfoOrHost);
+ setRange(typed_data.Uint8List._check(b), "AZ", (uinfoOrHost | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), ":", (uinfoOrPort0 | portStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "@", (uinfoOrHost0 | hostStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "/", (pathSeg | pathStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "?", (query | queryStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "#", (fragment | fragmentStart) >>> 0);
+ b = build(uinfoOrPort0, (uinfoOrPort | notSimple) >>> 0);
+ setRange(typed_data.Uint8List._check(b), "19", uinfoOrPort);
+ setChars(typed_data.Uint8List._check(b), "@", (uinfoOrHost0 | hostStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "/", (pathSeg | pathStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "?", (query | queryStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "#", (fragment | fragmentStart) >>> 0);
+ b = build(uinfoOrPort, (uinfoOrPort | notSimple) >>> 0);
+ setRange(typed_data.Uint8List._check(b), "09", uinfoOrPort);
+ setChars(typed_data.Uint8List._check(b), "@", (uinfoOrHost0 | hostStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "/", (pathSeg | pathStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "?", (query | queryStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "#", (fragment | fragmentStart) >>> 0);
+ b = build(ipv6Host, ipv6Host);
+ setChars(typed_data.Uint8List._check(b), "]", uinfoOrHost);
+ b = build(relPathSeg, (path | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), pchar, path);
+ setChars(typed_data.Uint8List._check(b), ".", relPathSegDot);
+ setChars(typed_data.Uint8List._check(b), "/", (pathSeg | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "?", (query | queryStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "#", (fragment | fragmentStart) >>> 0);
+ b = build(relPathSegDot, (path | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), pchar, path);
+ setChars(typed_data.Uint8List._check(b), ".", relPathSegDot2);
+ setChars(typed_data.Uint8List._check(b), "/", (pathSeg | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "?", (query | queryStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "#", (fragment | fragmentStart) >>> 0);
+ b = build(relPathSegDot2, (path | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), pchar, path);
+ setChars(typed_data.Uint8List._check(b), "/", relPathSeg);
+ setChars(typed_data.Uint8List._check(b), "?", (query | queryStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "#", (fragment | fragmentStart) >>> 0);
+ b = build(pathSeg, (path | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), pchar, path);
+ setChars(typed_data.Uint8List._check(b), ".", pathSegDot);
+ setChars(typed_data.Uint8List._check(b), "/", (pathSeg | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "?", (query | queryStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "#", (fragment | fragmentStart) >>> 0);
+ b = build(pathSegDot, (path | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), pchar, path);
+ setChars(typed_data.Uint8List._check(b), ".", pathSegDot2);
+ setChars(typed_data.Uint8List._check(b), "/", (pathSeg | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "?", (query | queryStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "#", (fragment | fragmentStart) >>> 0);
+ b = build(pathSegDot2, (path | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), pchar, path);
+ setChars(typed_data.Uint8List._check(b), "/", (pathSeg | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "?", (query | queryStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "#", (fragment | fragmentStart) >>> 0);
+ b = build(path, (path | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), pchar, path);
+ setChars(typed_data.Uint8List._check(b), "/", pathSeg);
+ setChars(typed_data.Uint8List._check(b), "?", (query | queryStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "#", (fragment | fragmentStart) >>> 0);
+ b = build(query, (query | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), pchar, query);
+ setChars(typed_data.Uint8List._check(b), "?", query);
+ setChars(typed_data.Uint8List._check(b), "#", (fragment | fragmentStart) >>> 0);
+ b = build(fragment, (fragment | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), pchar, fragment);
+ setChars(typed_data.Uint8List._check(b), "?", fragment);
+ b = build(scheme0, (scheme | notSimple) >>> 0);
+ setRange(typed_data.Uint8List._check(b), "az", scheme);
+ b = build(scheme, (scheme | notSimple) >>> 0);
+ setRange(typed_data.Uint8List._check(b), "az", scheme);
+ setRange(typed_data.Uint8List._check(b), "09", scheme);
+ setChars(typed_data.Uint8List._check(b), "+-.", scheme);
+ return tables;
+};
+dart.lazyFn(core._createTables, () => VoidToListOfUint8List());
+core._scan = function(uri, start, end, state, indices) {
+ let tables = core._scannerTables;
+ dart.assert(dart.notNull(end) <= dart.notNull(uri[dartx.length]));
+ for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(i) + 1) {
+ let table = tables[dartx._get](state);
+ let char = (dart.notNull(uri[dartx.codeUnitAt](i)) ^ 96) >>> 0;
+ if (char > 95) char = 31;
+ let transition = table[dartx._get](char);
+ state = dart.notNull(transition) & 31;
+ indices[dartx._set](transition[dartx['>>']](5), i);
+ }
+ return state;
+};
+dart.fn(core._scan, StringAndintAndint__Toint());
+const _uri = Symbol('_uri');
+const _schemeEnd = Symbol('_schemeEnd');
+const _hostStart = Symbol('_hostStart');
+const _portStart = Symbol('_portStart');
+const _pathStart = Symbol('_pathStart');
+const _queryStart = Symbol('_queryStart');
+const _fragmentStart = Symbol('_fragmentStart');
+const _schemeCache = Symbol('_schemeCache');
+const _isFile = Symbol('_isFile');
+const _isHttp = Symbol('_isHttp');
+const _isHttps = Symbol('_isHttps');
+const _isPackage = Symbol('_isPackage');
+const _isScheme = Symbol('_isScheme');
+let const$52;
+let const$53;
+let const$54;
+const _isPort = Symbol('_isPort');
+const _simpleMerge = Symbol('_simpleMerge');
+const _toNonSimple = Symbol('_toNonSimple');
+core._SimpleUri = class _SimpleUri extends core.Object {
+ new(uri, schemeEnd, hostStart, portStart, pathStart, queryStart, fragmentStart, schemeCache) {
+ this[_uri] = uri;
+ this[_schemeEnd] = schemeEnd;
+ this[_hostStart] = hostStart;
+ this[_portStart] = portStart;
+ this[_pathStart] = pathStart;
+ this[_queryStart] = queryStart;
+ this[_fragmentStart] = fragmentStart;
+ this[_schemeCache] = schemeCache;
+ this[_hashCodeCache] = null;
+ }
+ get hasScheme() {
+ return dart.notNull(this[_schemeEnd]) > 0;
+ }
+ get hasAuthority() {
+ return dart.notNull(this[_hostStart]) > 0;
+ }
+ get hasUserInfo() {
+ return dart.notNull(this[_hostStart]) > dart.notNull(this[_schemeEnd]) + 4;
+ }
+ get hasPort() {
+ return dart.notNull(this[_hostStart]) > 0 && dart.notNull(this[_portStart]) + 1 < dart.notNull(this[_pathStart]);
+ }
+ get hasQuery() {
+ return dart.notNull(this[_queryStart]) < dart.notNull(this[_fragmentStart]);
+ }
+ get hasFragment() {
+ return dart.notNull(this[_fragmentStart]) < dart.notNull(this[_uri][dartx.length]);
+ }
+ get [_isFile]() {
+ return this[_schemeEnd] == 4 && dart.test(this[_uri][dartx.startsWith]("file"));
+ }
+ get [_isHttp]() {
+ return this[_schemeEnd] == 4 && dart.test(this[_uri][dartx.startsWith]("http"));
+ }
+ get [_isHttps]() {
+ return this[_schemeEnd] == 5 && dart.test(this[_uri][dartx.startsWith]("https"));
+ }
+ get [_isPackage]() {
+ return this[_schemeEnd] == 7 && dart.test(this[_uri][dartx.startsWith]("package"));
+ }
+ [_isScheme](scheme) {
+ return this[_schemeEnd] == scheme[dartx.length] && dart.test(this[_uri][dartx.startsWith](scheme));
+ }
+ get hasAbsolutePath() {
+ return this[_uri][dartx.startsWith]("/", this[_pathStart]);
+ }
+ get hasEmptyPath() {
+ return this[_pathStart] == this[_queryStart];
+ }
+ get isAbsolute() {
+ return dart.test(this.hasScheme) && !dart.test(this.hasFragment);
+ }
+ isScheme(scheme) {
+ if (scheme == null || dart.test(scheme[dartx.isEmpty])) return dart.notNull(this[_schemeEnd]) < 0;
+ if (scheme[dartx.length] != this[_schemeEnd]) return false;
+ return core._Uri._compareScheme(scheme, this[_uri]);
+ }
+ get scheme() {
+ if (dart.notNull(this[_schemeEnd]) <= 0) return "";
+ if (this[_schemeCache] != null) return this[_schemeCache];
+ if (dart.test(this[_isHttp])) {
+ this[_schemeCache] = "http";
+ } else if (dart.test(this[_isHttps])) {
+ this[_schemeCache] = "https";
+ } else if (dart.test(this[_isFile])) {
+ this[_schemeCache] = "file";
+ } else if (dart.test(this[_isPackage])) {
+ this[_schemeCache] = "package";
+ } else {
+ this[_schemeCache] = this[_uri][dartx.substring](0, this[_schemeEnd]);
+ }
+ return this[_schemeCache];
+ }
+ get authority() {
+ return dart.notNull(this[_hostStart]) > 0 ? this[_uri][dartx.substring](dart.notNull(this[_schemeEnd]) + 3, this[_pathStart]) : "";
+ }
+ get userInfo() {
+ return dart.notNull(this[_hostStart]) > dart.notNull(this[_schemeEnd]) + 3 ? this[_uri][dartx.substring](dart.notNull(this[_schemeEnd]) + 3, dart.notNull(this[_hostStart]) - 1) : "";
+ }
+ get host() {
+ return dart.notNull(this[_hostStart]) > 0 ? this[_uri][dartx.substring](this[_hostStart], this[_portStart]) : "";
+ }
+ get port() {
+ if (dart.test(this.hasPort)) return core.int.parse(this[_uri][dartx.substring](dart.notNull(this[_portStart]) + 1, this[_pathStart]));
+ if (dart.test(this[_isHttp])) return 80;
+ if (dart.test(this[_isHttps])) return 443;
+ return 0;
+ }
+ get path() {
+ return this[_uri][dartx.substring](this[_pathStart], this[_queryStart]);
+ }
+ get query() {
+ return dart.notNull(this[_queryStart]) < dart.notNull(this[_fragmentStart]) ? this[_uri][dartx.substring](dart.notNull(this[_queryStart]) + 1, this[_fragmentStart]) : "";
+ }
+ get fragment() {
+ return dart.notNull(this[_fragmentStart]) < dart.notNull(this[_uri][dartx.length]) ? this[_uri][dartx.substring](dart.notNull(this[_fragmentStart]) + 1) : "";
+ }
+ get origin() {
+ let isHttp = this[_isHttp];
+ if (dart.notNull(this[_schemeEnd]) < 0) {
+ dart.throw(new core.StateError(dart.str`Cannot use origin without a scheme: ${this}`));
+ }
+ if (!dart.test(isHttp) && !dart.test(this[_isHttps])) {
+ dart.throw(new core.StateError(dart.str`Origin is only applicable schemes http and https: ${this}`));
+ }
+ if (this[_hostStart] == this[_portStart]) {
+ dart.throw(new core.StateError(dart.str`A ${this.scheme}: URI should have a non-empty host name: ${this}`));
+ }
+ if (this[_hostStart] == dart.notNull(this[_schemeEnd]) + 3) {
+ return this[_uri][dartx.substring](0, this[_pathStart]);
+ }
+ return dart.notNull(this[_uri][dartx.substring](0, dart.notNull(this[_schemeEnd]) + 3)) + dart.notNull(this[_uri][dartx.substring](this[_hostStart], this[_pathStart]));
+ }
+ get pathSegments() {
+ let start = this[_pathStart];
+ let end = this[_queryStart];
+ if (dart.test(this[_uri][dartx.startsWith]("/", start))) {
+ start = dart.notNull(start) + 1;
+ }
+ if (start == end) return const$52 || (const$52 = dart.constList([], core.String));
+ let parts = JSArrayOfString().of([]);
+ for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(i) + 1) {
+ let char = this[_uri][dartx.codeUnitAt](i);
+ if (char == core._SLASH) {
+ parts[dartx.add](this[_uri][dartx.substring](start, i));
+ start = dart.notNull(i) + 1;
+ }
+ }
+ parts[dartx.add](this[_uri][dartx.substring](start, end));
+ return ListOfString().unmodifiable(parts);
+ }
+ get queryParameters() {
+ if (!dart.test(this.hasQuery)) return const$53 || (const$53 = dart.const(dart.map({}, core.String, core.String)));
+ return new (UnmodifiableMapViewOfString$String())(core.Uri.splitQueryString(this.query));
+ }
+ get queryParametersAll() {
+ if (!dart.test(this.hasQuery)) return const$54 || (const$54 = dart.const(dart.map({}, core.String, ListOfString())));
+ let queryParameterLists = core._Uri._splitQueryStringAll(this.query);
+ for (let key of queryParameterLists[dartx.keys]) {
+ queryParameterLists[dartx._set](key, ListOfString().unmodifiable(core.Iterable._check(queryParameterLists[dartx._get](key))));
+ }
+ return MapOfString$ListOfString().unmodifiable(queryParameterLists);
+ }
+ [_isPort](port) {
+ let portDigitStart = dart.notNull(this[_portStart]) + 1;
+ return portDigitStart + dart.notNull(port[dartx.length]) == this[_pathStart] && dart.test(this[_uri][dartx.startsWith](port, portDigitStart));
+ }
+ normalizePath() {
+ return this;
+ }
+ removeFragment() {
+ if (!dart.test(this.hasFragment)) return this;
+ return new core._SimpleUri(this[_uri][dartx.substring](0, this[_fragmentStart]), this[_schemeEnd], this[_hostStart], this[_portStart], this[_pathStart], this[_queryStart], this[_fragmentStart], this[_schemeCache]);
+ }
+ replace(opts) {
+ let scheme = opts && 'scheme' in opts ? opts.scheme : null;
+ let userInfo = opts && 'userInfo' in opts ? opts.userInfo : null;
+ let host = opts && 'host' in opts ? opts.host : null;
+ let port = opts && 'port' in opts ? opts.port : null;
+ let path = opts && 'path' in opts ? opts.path : null;
+ let pathSegments = opts && 'pathSegments' in opts ? opts.pathSegments : null;
+ let query = opts && 'query' in opts ? opts.query : null;
+ let queryParameters = opts && 'queryParameters' in opts ? opts.queryParameters : null;
+ let fragment = opts && 'fragment' in opts ? opts.fragment : null;
+ let schemeChanged = false;
+ if (scheme != null) {
+ scheme = core._Uri._makeScheme(scheme, 0, scheme[dartx.length]);
+ schemeChanged = !dart.test(this[_isScheme](scheme));
+ } else {
+ scheme = this.scheme;
+ }
+ let isFile = scheme == "file";
+ if (userInfo != null) {
+ userInfo = core._Uri._makeUserInfo(userInfo, 0, userInfo[dartx.length]);
+ } else if (dart.notNull(this[_hostStart]) > 0) {
+ userInfo = this[_uri][dartx.substring](dart.notNull(this[_schemeEnd]) + 3, this[_hostStart]);
+ } else {
+ userInfo = "";
+ }
+ if (port != null) {
+ port = core._Uri._makePort(port, scheme);
+ } else {
+ port = dart.test(this.hasPort) ? this.port : null;
+ if (schemeChanged) {
+ port = core._Uri._makePort(port, scheme);
+ }
+ }
+ if (host != null) {
+ host = core._Uri._makeHost(host, 0, host[dartx.length], false);
+ } else if (dart.notNull(this[_hostStart]) > 0) {
+ host = this[_uri][dartx.substring](this[_hostStart], this[_portStart]);
+ } else if (dart.test(userInfo[dartx.isNotEmpty]) || port != null || isFile) {
+ host = "";
+ }
+ let hasAuthority = host != null;
+ if (path != null || pathSegments != null) {
+ path = core._Uri._makePath(path, 0, core._stringOrNullLength(path), pathSegments, scheme, hasAuthority);
+ } else {
+ path = this[_uri][dartx.substring](this[_pathStart], this[_queryStart]);
+ if ((isFile || hasAuthority && !dart.test(path[dartx.isEmpty])) && !dart.test(path[dartx.startsWith]('/'))) {
+ path = "/" + dart.notNull(path);
+ }
+ }
+ if (query != null || queryParameters != null) {
+ query = core._Uri._makeQuery(query, 0, core._stringOrNullLength(query), queryParameters);
+ } else if (dart.notNull(this[_queryStart]) < dart.notNull(this[_fragmentStart])) {
+ query = this[_uri][dartx.substring](dart.notNull(this[_queryStart]) + 1, this[_fragmentStart]);
+ }
+ if (fragment != null) {
+ fragment = core._Uri._makeFragment(fragment, 0, fragment[dartx.length]);
+ } else if (dart.notNull(this[_fragmentStart]) < dart.notNull(this[_uri][dartx.length])) {
+ fragment = this[_uri][dartx.substring](dart.notNull(this[_fragmentStart]) + 1);
+ }
+ return new core._Uri._internal(scheme, userInfo, host, port, path, query, fragment);
+ }
+ resolve(reference) {
+ return this.resolveUri(core.Uri.parse(reference));
+ }
+ resolveUri(reference) {
+ if (core._SimpleUri.is(reference)) {
+ return this[_simpleMerge](this, reference);
+ }
+ return this[_toNonSimple]().resolveUri(reference);
+ }
+ [_simpleMerge](base, ref) {
+ if (dart.test(ref.hasScheme)) return ref;
+ if (dart.test(ref.hasAuthority)) {
+ if (!dart.test(base.hasScheme)) return ref;
+ let isSimple = true;
+ if (dart.test(base[_isFile])) {
+ isSimple = !dart.test(ref.hasEmptyPath);
+ } else if (dart.test(base[_isHttp])) {
+ isSimple = !dart.test(ref[_isPort]("80"));
+ } else if (dart.test(base[_isHttps])) {
+ isSimple = !dart.test(ref[_isPort]("443"));
+ }
+ if (isSimple) {
+ let delta = dart.notNull(base[_schemeEnd]) + 1;
+ let newUri = dart.notNull(base[_uri][dartx.substring](0, dart.notNull(base[_schemeEnd]) + 1)) + dart.notNull(ref[_uri][dartx.substring](dart.notNull(ref[_schemeEnd]) + 1));
+ return new core._SimpleUri(newUri, base[_schemeEnd], dart.notNull(ref[_hostStart]) + delta, dart.notNull(ref[_portStart]) + delta, dart.notNull(ref[_pathStart]) + delta, dart.notNull(ref[_queryStart]) + delta, dart.notNull(ref[_fragmentStart]) + delta, base[_schemeCache]);
+ } else {
+ return this[_toNonSimple]().resolveUri(ref);
+ }
+ }
+ if (dart.test(ref.hasEmptyPath)) {
+ if (dart.test(ref.hasQuery)) {
+ let delta = dart.notNull(base[_queryStart]) - dart.notNull(ref[_queryStart]);
+ let newUri = dart.notNull(base[_uri][dartx.substring](0, base[_queryStart])) + dart.notNull(ref[_uri][dartx.substring](ref[_queryStart]));
+ return new core._SimpleUri(newUri, base[_schemeEnd], base[_hostStart], base[_portStart], base[_pathStart], dart.notNull(ref[_queryStart]) + delta, dart.notNull(ref[_fragmentStart]) + delta, base[_schemeCache]);
+ }
+ if (dart.test(ref.hasFragment)) {
+ let delta = dart.notNull(base[_fragmentStart]) - dart.notNull(ref[_fragmentStart]);
+ let newUri = dart.notNull(base[_uri][dartx.substring](0, base[_fragmentStart])) + dart.notNull(ref[_uri][dartx.substring](ref[_fragmentStart]));
+ return new core._SimpleUri(newUri, base[_schemeEnd], base[_hostStart], base[_portStart], base[_pathStart], base[_queryStart], dart.notNull(ref[_fragmentStart]) + delta, base[_schemeCache]);
+ }
+ return base.removeFragment();
+ }
+ if (dart.test(ref.hasAbsolutePath)) {
+ let delta = dart.notNull(base[_pathStart]) - dart.notNull(ref[_pathStart]);
+ let newUri = dart.notNull(base[_uri][dartx.substring](0, base[_pathStart])) + dart.notNull(ref[_uri][dartx.substring](ref[_pathStart]));
+ return new core._SimpleUri(newUri, base[_schemeEnd], base[_hostStart], base[_portStart], base[_pathStart], dart.notNull(ref[_queryStart]) + delta, dart.notNull(ref[_fragmentStart]) + delta, base[_schemeCache]);
+ }
+ if (dart.test(base.hasEmptyPath) && dart.test(base.hasAuthority)) {
+ let refStart = ref[_pathStart];
+ while (dart.test(ref[_uri][dartx.startsWith]("../", refStart))) {
+ refStart = dart.notNull(refStart) + 3;
+ }
+ let delta = dart.notNull(base[_pathStart]) - dart.notNull(refStart) + 1;
+ let newUri = dart.str`${base[_uri][dartx.substring](0, base[_pathStart])}/` + dart.str`${ref[_uri][dartx.substring](refStart)}`;
+ return new core._SimpleUri(newUri, base[_schemeEnd], base[_hostStart], base[_portStart], base[_pathStart], dart.notNull(ref[_queryStart]) + delta, dart.notNull(ref[_fragmentStart]) + delta, base[_schemeCache]);
+ }
+ let baseUri = base[_uri];
+ let refUri = ref[_uri];
+ let baseStart = base[_pathStart];
+ let baseEnd = base[_queryStart];
+ while (dart.test(baseUri[dartx.startsWith]("../", baseStart))) {
+ baseStart = dart.notNull(baseStart) + 3;
+ }
+ let refStart = ref[_pathStart];
+ let refEnd = ref[_queryStart];
+ let backCount = 0;
+ while (dart.notNull(refStart) + 3 <= dart.notNull(refEnd) && dart.test(refUri[dartx.startsWith]("../", refStart))) {
+ refStart = dart.notNull(refStart) + 3;
+ backCount = backCount + 1;
+ }
+ let insert = "";
+ while (dart.notNull(baseEnd) > dart.notNull(baseStart)) {
+ baseEnd = dart.notNull(baseEnd) - 1;
+ let char = baseUri[dartx.codeUnitAt](baseEnd);
+ if (char == core._SLASH) {
+ insert = "/";
+ if (backCount == 0) break;
+ backCount--;
+ }
+ }
+ if (baseEnd == baseStart && !dart.test(base.hasScheme) && !dart.test(base.hasAbsolutePath)) {
+ insert = "";
+ refStart = dart.notNull(refStart) - backCount * 3;
+ }
+ let delta = dart.notNull(baseEnd) - dart.notNull(refStart) + dart.notNull(insert[dartx.length]);
+ let newUri = dart.str`${base[_uri][dartx.substring](0, baseEnd)}${insert}` + dart.str`${ref[_uri][dartx.substring](refStart)}`;
+ return new core._SimpleUri(newUri, base[_schemeEnd], base[_hostStart], base[_portStart], base[_pathStart], dart.notNull(ref[_queryStart]) + delta, dart.notNull(ref[_fragmentStart]) + delta, base[_schemeCache]);
+ }
+ toFilePath(opts) {
+ let windows = opts && 'windows' in opts ? opts.windows : null;
+ if (dart.notNull(this[_schemeEnd]) >= 0 && !dart.test(this[_isFile])) {
+ dart.throw(new core.UnsupportedError(dart.str`Cannot extract a file path from a ${this.scheme} URI`));
+ }
+ if (dart.notNull(this[_queryStart]) < dart.notNull(this[_uri][dartx.length])) {
+ if (dart.notNull(this[_queryStart]) < dart.notNull(this[_fragmentStart])) {
+ dart.throw(new core.UnsupportedError("Cannot extract a file path from a URI with a query component"));
+ }
+ dart.throw(new core.UnsupportedError("Cannot extract a file path from a URI with a fragment component"));
+ }
+ if (windows == null) windows = core._Uri._isWindows;
+ return dart.test(windows) ? core._Uri._toWindowsFilePath(this) : this[_toFilePath]();
+ }
+ [_toFilePath]() {
+ if (dart.notNull(this[_hostStart]) < dart.notNull(this[_portStart])) {
+ dart.throw(new core.UnsupportedError("Cannot extract a non-Windows file path from a file URI " + "with an authority"));
+ }
+ return this.path;
+ }
+ get data() {
+ dart.assert(this.scheme != "data");
+ return null;
+ }
+ get hashCode() {
+ return (() => {
+ let t = this[_hashCodeCache];
+ return t == null ? this[_hashCodeCache] = dart.hashCode(this[_uri]) : t;
+ })();
+ }
+ ['=='](other) {
+ if (core.identical(this, other)) return true;
+ if (core.Uri.is(other)) return this[_uri] == dart.toString(other);
+ return false;
+ }
+ [_toNonSimple]() {
+ return new core._Uri._internal(this.scheme, this.userInfo, dart.test(this.hasAuthority) ? this.host : null, dart.test(this.hasPort) ? this.port : null, this.path, dart.test(this.hasQuery) ? this.query : null, dart.test(this.hasFragment) ? this.fragment : null);
+ }
+ toString() {
+ return this[_uri];
+ }
+};
+core._SimpleUri[dart.implements] = () => [core.Uri];
+dart.setSignature(core._SimpleUri, {
+ fields: () => ({
+ [_uri]: core.String,
+ [_schemeEnd]: core.int,
+ [_hostStart]: core.int,
+ [_portStart]: core.int,
+ [_pathStart]: core.int,
+ [_queryStart]: core.int,
+ [_fragmentStart]: core.int,
+ [_schemeCache]: core.String,
+ [_hashCodeCache]: core.int
+ }),
+ getters: () => ({
+ hasScheme: dart.definiteFunctionType(core.bool, []),
+ hasAuthority: dart.definiteFunctionType(core.bool, []),
+ hasUserInfo: dart.definiteFunctionType(core.bool, []),
+ hasPort: dart.definiteFunctionType(core.bool, []),
+ hasQuery: dart.definiteFunctionType(core.bool, []),
+ hasFragment: dart.definiteFunctionType(core.bool, []),
+ [_isFile]: dart.definiteFunctionType(core.bool, []),
+ [_isHttp]: dart.definiteFunctionType(core.bool, []),
+ [_isHttps]: dart.definiteFunctionType(core.bool, []),
+ [_isPackage]: dart.definiteFunctionType(core.bool, []),
+ hasAbsolutePath: dart.definiteFunctionType(core.bool, []),
+ hasEmptyPath: dart.definiteFunctionType(core.bool, []),
+ isAbsolute: dart.definiteFunctionType(core.bool, []),
+ scheme: dart.definiteFunctionType(core.String, []),
+ authority: dart.definiteFunctionType(core.String, []),
+ userInfo: dart.definiteFunctionType(core.String, []),
+ host: dart.definiteFunctionType(core.String, []),
+ port: dart.definiteFunctionType(core.int, []),
+ path: dart.definiteFunctionType(core.String, []),
+ query: dart.definiteFunctionType(core.String, []),
+ fragment: dart.definiteFunctionType(core.String, []),
+ origin: dart.definiteFunctionType(core.String, []),
+ pathSegments: dart.definiteFunctionType(core.List$(core.String), []),
+ queryParameters: dart.definiteFunctionType(core.Map$(core.String, core.String), []),
+ queryParametersAll: dart.definiteFunctionType(core.Map$(core.String, core.List$(core.String)), []),
+ data: dart.definiteFunctionType(core.UriData, [])
+ }),
+ methods: () => ({
+ [_isScheme]: dart.definiteFunctionType(core.bool, [core.String]),
+ isScheme: dart.definiteFunctionType(core.bool, [core.String]),
+ [_isPort]: dart.definiteFunctionType(core.bool, [core.String]),
+ normalizePath: dart.definiteFunctionType(core.Uri, []),
+ removeFragment: dart.definiteFunctionType(core.Uri, []),
+ replace: dart.definiteFunctionType(core.Uri, [], {scheme: core.String, userInfo: core.String, host: core.String, port: core.int, path: core.String, pathSegments: IterableOfString(), query: core.String, queryParameters: MapOfString$dynamic(), fragment: core.String}),
+ resolve: dart.definiteFunctionType(core.Uri, [core.String]),
+ resolveUri: dart.definiteFunctionType(core.Uri, [core.Uri]),
+ [_simpleMerge]: dart.definiteFunctionType(core.Uri, [core._SimpleUri, core._SimpleUri]),
+ toFilePath: dart.definiteFunctionType(core.String, [], {windows: core.bool}),
+ [_toFilePath]: dart.definiteFunctionType(core.String, []),
+ '==': dart.definiteFunctionType(core.bool, [core.Object]),
+ [_toNonSimple]: dart.definiteFunctionType(core.Uri, [])
+ })
+});
+const _data$ = Symbol('_data');
+core._DataUri = class _DataUri extends core._Uri {
+ new(data, path, query) {
+ this[_data$] = data;
+ super._internal("data", null, null, null, path, query, null);
+ }
+ get data() {
+ return this[_data$];
+ }
+};
+dart.setSignature(core._DataUri, {
+ fields: () => ({[_data$]: core.UriData})
+});
+core._startsWithData = function(text, start) {
+ let delta = ((dart.notNull(text[dartx.codeUnitAt](dart.notNull(start) + 4)) ^ core._COLON) >>> 0) * 3;
+ delta = (delta | dart.notNull(text[dartx.codeUnitAt](start)) ^ 100) >>> 0;
+ delta = (delta | dart.notNull(text[dartx.codeUnitAt](dart.notNull(start) + 1)) ^ 97) >>> 0;
+ delta = (delta | dart.notNull(text[dartx.codeUnitAt](dart.notNull(start) + 2)) ^ 116) >>> 0;
+ delta = (delta | dart.notNull(text[dartx.codeUnitAt](dart.notNull(start) + 3)) ^ 97) >>> 0;
+ return delta;
+};
+dart.fn(core._startsWithData, StringAndintToint());
+core._stringOrNullLength = function(s) {
+ return s == null ? 0 : s[dartx.length];
+};
+dart.fn(core._stringOrNullLength, StringToint$());
developer.debugger = function(opts) {
let when = opts && 'when' in opts ? opts.when : true;
let message = opts && 'message' in opts ? opts.message : null;
@@ -35135,6 +35969,49 @@
}
});
developer._clockValue = 0;
+developer._FakeUserTag = class _FakeUserTag extends core.Object {
+ real(label) {
+ this.label = label;
+ }
+ static new(label) {
+ let existingTag = developer._FakeUserTag._instances[dartx._get](label);
+ if (existingTag != null) {
+ return developer._FakeUserTag._check(existingTag);
+ }
+ if (developer._FakeUserTag._instances[dartx.length] == developer.UserTag.MAX_USER_TAGS) {
+ dart.throw(new core.UnsupportedError(dart.str`UserTag instance limit (${developer.UserTag.MAX_USER_TAGS}) reached.`));
+ }
+ let instance = new developer._FakeUserTag.real(label);
+ developer._FakeUserTag._instances[dartx._set](label, instance);
+ return instance;
+ }
+ makeCurrent() {
+ let old = developer._currentTag;
+ developer._currentTag = this;
+ return old;
+ }
+};
+dart.defineNamedConstructor(developer._FakeUserTag, 'real');
+developer._FakeUserTag[dart.implements] = () => [developer.UserTag];
+dart.setSignature(developer._FakeUserTag, {
+ fields: () => ({label: core.String}),
+ methods: () => ({makeCurrent: dart.definiteFunctionType(developer.UserTag, [])})
+});
+dart.defineLazy(developer._FakeUserTag, {
+ get _instances() {
+ return dart.map();
+ },
+ set _instances(_) {},
+ get _defaultTag() {
+ return developer._FakeUserTag.new('Default');
+ }
+});
+dart.defineLazy(developer, {
+ get _currentTag() {
+ return developer._FakeUserTag._defaultTag;
+ },
+ set _currentTag(_) {}
+});
const _result = Symbol('_result');
const _errorCode = Symbol('_errorCode');
const _errorDetail = Symbol('_errorDetail');
@@ -35256,7 +36133,7 @@
dart.fn(developer.postEvent, StringAndMapTovoid());
developer._postEvent = function(eventKind, eventData) {
};
-dart.fn(developer._postEvent, StringAndStringTodynamic());
+dart.fn(developer._postEvent, StringAndStringTovoid$());
developer._lookupExtension = function(method) {
return developer._extensions[dartx._get](method);
};
@@ -35274,49 +36151,6 @@
}
};
developer.UserTag.MAX_USER_TAGS = 64;
-developer._FakeUserTag = class _FakeUserTag extends core.Object {
- real(label) {
- this.label = label;
- }
- static new(label) {
- let existingTag = developer._FakeUserTag._instances[dartx._get](label);
- if (existingTag != null) {
- return developer._FakeUserTag._check(existingTag);
- }
- if (developer._FakeUserTag._instances[dartx.length] == developer.UserTag.MAX_USER_TAGS) {
- dart.throw(new core.UnsupportedError(dart.str`UserTag instance limit (${developer.UserTag.MAX_USER_TAGS}) reached.`));
- }
- let instance = new developer._FakeUserTag.real(label);
- developer._FakeUserTag._instances[dartx._set](label, instance);
- return instance;
- }
- makeCurrent() {
- let old = developer._currentTag;
- developer._currentTag = this;
- return old;
- }
-};
-dart.defineNamedConstructor(developer._FakeUserTag, 'real');
-developer._FakeUserTag[dart.implements] = () => [developer.UserTag];
-dart.setSignature(developer._FakeUserTag, {
- fields: () => ({label: core.String}),
- methods: () => ({makeCurrent: dart.definiteFunctionType(developer.UserTag, [])})
-});
-dart.defineLazy(developer._FakeUserTag, {
- get _instances() {
- return dart.map();
- },
- set _instances(_) {},
- get _defaultTag() {
- return developer._FakeUserTag.new('Default');
- }
-});
-dart.defineLazy(developer, {
- get _currentTag() {
- return developer._FakeUserTag._defaultTag;
- },
- set _currentTag(_) {}
-});
developer.getCurrentTag = function() {
return developer._currentTag;
};
@@ -35749,7 +36583,7 @@
developer.Service = class Service extends core.Object {
static getInfo() {
return dart.async(function*() {
- let receivePort = isolate.RawReceivePort.new();
+ let receivePort = isolate$.RawReceivePort.new();
let uriCompleter = CompleterOfUri().new();
receivePort.handler = dart.fn(uri => uriCompleter.complete(uri), UriTovoid());
developer._getServerInfo(receivePort.sendPort);
@@ -35764,7 +36598,7 @@
if (!(typeof enable == 'boolean')) {
dart.throw(new core.ArgumentError.value(enable, 'enable', 'Must be a bool'));
}
- let receivePort = isolate.RawReceivePort.new();
+ let receivePort = isolate$.RawReceivePort.new();
let uriCompleter = CompleterOfUri().new();
receivePort.handler = dart.fn(uri => uriCompleter.complete(uri), UriTovoid());
developer._webServerControl(receivePort.sendPort, enable);
@@ -35773,20 +36607,27 @@
return new developer.ServiceProtocolInfo(uri);
}, developer.ServiceProtocolInfo, opts);
}
+ static getIsolateID(isolate) {
+ if (!isolate$.Isolate.is(isolate)) {
+ dart.throw(new core.ArgumentError.value(isolate, 'isolate', 'Must be an Isolate'));
+ }
+ return developer._getIsolateIDFromSendPort(isolate.controlPort);
+ }
};
dart.setSignature(developer.Service, {
statics: () => ({
getInfo: dart.definiteFunctionType(async.Future$(developer.ServiceProtocolInfo), []),
- controlWebServer: dart.definiteFunctionType(async.Future$(developer.ServiceProtocolInfo), [], {enable: core.bool})
+ controlWebServer: dart.definiteFunctionType(async.Future$(developer.ServiceProtocolInfo), [], {enable: core.bool}),
+ getIsolateID: dart.definiteFunctionType(core.String, [isolate$.Isolate])
}),
- names: ['getInfo', 'controlWebServer']
+ names: ['getInfo', 'controlWebServer', 'getIsolateID']
});
-developer._getServerInfo = function(sp) {
- sp.send(null);
+developer._getServerInfo = function(sendPort) {
+ sendPort.send(null);
};
dart.lazyFn(developer._getServerInfo, () => SendPortTovoid());
-developer._webServerControl = function(sp, enable) {
- sp.send(null);
+developer._webServerControl = function(sendPort, enable) {
+ sendPort.send(null);
};
dart.lazyFn(developer._webServerControl, () => SendPortAndboolTovoid());
developer._getServiceMajorVersion = function() {
@@ -35797,6 +36638,10 @@
return 0;
};
dart.fn(developer._getServiceMinorVersion, VoidToint());
+developer._getIsolateIDFromSendPort = function(sendPort) {
+ return null;
+};
+dart.lazyFn(developer._getIsolateIDFromSendPort, () => SendPortToString());
io.BytesBuilder = class BytesBuilder extends core.Object {
static new(opts) {
let copy = opts && 'copy' in opts ? opts.copy : true;
@@ -35807,27 +36652,21 @@
}
}
};
-const _length$2 = Symbol('_length');
const _buffer$ = Symbol('_buffer');
-const _pow2roundup = Symbol('_pow2roundup');
+const _length$2 = Symbol('_length');
+const _grow$ = Symbol('_grow');
io._CopyingBytesBuilder = class _CopyingBytesBuilder extends core.Object {
- new() {
+ new(initialCapacity) {
+ if (initialCapacity === void 0) initialCapacity = 0;
+ this[_buffer$] = dart.notNull(initialCapacity) <= 0 ? io._CopyingBytesBuilder._emptyList : typed_data.Uint8List.new(io._CopyingBytesBuilder._pow2roundup(initialCapacity));
this[_length$2] = 0;
- this[_buffer$] = null;
}
add(bytes) {
let bytesLength = bytes[dartx.length];
if (bytesLength == 0) return;
let required = dart.notNull(this[_length$2]) + dart.notNull(bytesLength);
- if (this[_buffer$] == null) {
- let size = this[_pow2roundup](required);
- size = math.max(core.int)(size, io._CopyingBytesBuilder._INIT_SIZE);
- this[_buffer$] = typed_data.Uint8List.new(size);
- } else if (dart.notNull(this[_buffer$][dartx.length]) < required) {
- let size = dart.notNull(this[_pow2roundup](required)) * 2;
- let newBuffer = typed_data.Uint8List.new(size);
- newBuffer[dartx.setRange](0, this[_buffer$][dartx.length], this[_buffer$]);
- this[_buffer$] = newBuffer;
+ if (dart.notNull(this[_buffer$][dartx.length]) < required) {
+ this[_grow$](required);
}
dart.assert(dart.notNull(this[_buffer$][dartx.length]) >= required);
if (typed_data.Uint8List.is(bytes)) {
@@ -35840,16 +36679,32 @@
this[_length$2] = required;
}
addByte(byte) {
- this.add(JSArrayOfint().of([byte]));
+ if (this[_buffer$][dartx.length] == this[_length$2]) {
+ this[_grow$](this[_length$2]);
+ }
+ dart.assert(dart.notNull(this[_buffer$][dartx.length]) > dart.notNull(this[_length$2]));
+ this[_buffer$][dartx._set](this[_length$2], byte);
+ this[_length$2] = dart.notNull(this[_length$2]) + 1;
+ }
+ [_grow$](required) {
+ let newSize = dart.notNull(required) * 2;
+ if (dart.notNull(newSize) < io._CopyingBytesBuilder._INIT_SIZE) {
+ newSize = io._CopyingBytesBuilder._INIT_SIZE;
+ } else {
+ newSize = io._CopyingBytesBuilder._pow2roundup(newSize);
+ }
+ let newBuffer = typed_data.Uint8List.new(newSize);
+ newBuffer[dartx.setRange](0, this[_buffer$][dartx.length], this[_buffer$]);
+ this[_buffer$] = newBuffer;
}
takeBytes() {
- if (this[_buffer$] == null) return typed_data.Uint8List.new(0);
+ if (this[_length$2] == 0) return io._CopyingBytesBuilder._emptyList;
let buffer = typed_data.Uint8List.view(this[_buffer$][dartx.buffer], 0, this[_length$2]);
this.clear();
return buffer;
}
toBytes() {
- if (this[_buffer$] == null) return typed_data.Uint8List.new(0);
+ if (this[_length$2] == 0) return io._CopyingBytesBuilder._emptyList;
return typed_data.Uint8List.fromList(typed_data.Uint8List.view(this[_buffer$][dartx.buffer], 0, this[_length$2]));
}
get length() {
@@ -35863,9 +36718,10 @@
}
clear() {
this[_length$2] = 0;
- this[_buffer$] = null;
+ this[_buffer$] = io._CopyingBytesBuilder._emptyList;
}
- [_pow2roundup](x) {
+ static _pow2roundup(x) {
+ dart.assert(dart.notNull(x) > 0);
x = dart.notNull(x) - 1;
x = (dart.notNull(x) | x[dartx['>>']](1)) >>> 0;
x = (dart.notNull(x) | x[dartx['>>']](2)) >>> 0;
@@ -35889,33 +36745,48 @@
methods: () => ({
add: dart.definiteFunctionType(dart.void, [ListOfint()]),
addByte: dart.definiteFunctionType(dart.void, [core.int]),
+ [_grow$]: dart.definiteFunctionType(dart.void, [core.int]),
takeBytes: dart.definiteFunctionType(core.List$(core.int), []),
toBytes: dart.definiteFunctionType(core.List$(core.int), []),
- clear: dart.definiteFunctionType(dart.void, []),
- [_pow2roundup]: dart.definiteFunctionType(core.int, [core.int])
- })
+ clear: dart.definiteFunctionType(dart.void, [])
+ }),
+ statics: () => ({_pow2roundup: dart.definiteFunctionType(core.int, [core.int])}),
+ names: ['_pow2roundup']
});
io._CopyingBytesBuilder._INIT_SIZE = 1024;
+dart.defineLazy(io._CopyingBytesBuilder, {
+ get _emptyList() {
+ return typed_data.Uint8List.new(0);
+ }
+});
const _chunks = Symbol('_chunks');
io._BytesBuilder = class _BytesBuilder extends core.Object {
new() {
- this[_chunks] = JSArrayOfListOfint().of([]);
+ this[_chunks] = JSArrayOfUint8List().of([]);
this[_length$2] = 0;
}
add(bytes) {
- if (!typed_data.Uint8List.is(bytes)) {
- bytes = typed_data.Uint8List.fromList(bytes);
+ let typedBytes = null;
+ if (typed_data.Uint8List.is(bytes)) {
+ typedBytes = bytes;
+ } else {
+ typedBytes = typed_data.Uint8List.fromList(bytes);
}
- this[_chunks][dartx.add](bytes);
- this[_length$2] = dart.notNull(this[_length$2]) + dart.notNull(bytes[dartx.length]);
+ this[_chunks][dartx.add](typedBytes);
+ this[_length$2] = dart.notNull(this[_length$2]) + dart.notNull(typedBytes[dartx.length]);
}
addByte(byte) {
- this.add(JSArrayOfint().of([byte]));
+ this[_chunks][dartx.add]((() => {
+ let _ = typed_data.Uint8List.new(1);
+ _[dartx._set](0, byte);
+ return _;
+ })());
+ this[_length$2] = dart.notNull(this[_length$2]) + 1;
}
takeBytes() {
- if (this[_chunks][dartx.length] == 0) return typed_data.Uint8List.new(0);
+ if (this[_length$2] == 0) return io._CopyingBytesBuilder._emptyList;
if (this[_chunks][dartx.length] == 1) {
- let buffer = this[_chunks][dartx.single];
+ let buffer = this[_chunks][dartx._get](0);
this.clear();
return buffer;
}
@@ -35929,7 +36800,7 @@
return buffer;
}
toBytes() {
- if (this[_chunks][dartx.length] == 0) return typed_data.Uint8List.new(0);
+ if (this[_length$2] == 0) return io._CopyingBytesBuilder._emptyList;
let buffer = typed_data.Uint8List.new(this[_length$2]);
let offset = 0;
for (let chunk of this[_chunks]) {
@@ -35956,7 +36827,7 @@
dart.setSignature(io._BytesBuilder, {
fields: () => ({
[_length$2]: core.int,
- [_chunks]: ListOfListOfint()
+ [_chunks]: ListOfUint8List()
}),
getters: () => ({
length: dart.definiteFunctionType(core.int, []),
@@ -35987,7 +36858,7 @@
switch (dart.dindex(response, io._ERROR_RESPONSE_ERROR_TYPE)) {
case io._ILLEGAL_ARGUMENT_RESPONSE:
{
- return new core.ArgumentError();
+ return new core.ArgumentError(dart.str`${message}: ${path}`);
}
case io._OSERROR_RESPONSE:
{
@@ -36050,7 +36921,7 @@
};
dart.setSignature(io._BufferAndStart, {
fields: () => ({
- buffer: core.List,
+ buffer: ListOfint(),
start: core.int
})
});
@@ -36062,7 +36933,7 @@
let newBuffer = typed_data.Uint8List.new(length);
let j = start;
for (let i = 0; i < length; i++) {
- let value = core.int._check(buffer[dartx._get](j));
+ let value = buffer[dartx._get](j);
if (!(typeof value == 'number')) {
dart.throw(new core.ArgumentError(dart.str`List element is not an integer at index ${j}`));
}
@@ -36071,7 +36942,7 @@
}
return new io._BufferAndStart(newBuffer, 0);
};
-dart.fn(io._ensureFastAndSerializableByteData, ListAndintAndintTo_BufferAndStart());
+dart.fn(io._ensureFastAndSerializableByteData, ListOfintAndintAndintTo_BufferAndStart());
io._IOCrypto = class _IOCrypto extends core.Object {
static getRandomBytes(count) {
dart.throw(new core.UnsupportedError("_IOCrypto.getRandomBytes"));
@@ -36237,13 +37108,13 @@
}
close() {
if (dart.test(this[_digestCalled])) {
- return ListOfint()._check(this[_resultAsBytes]());
+ return this[_resultAsBytes]();
}
this[_digestCalled] = true;
this[_finalizeData]();
this[_iterate]();
dart.assert(this[_pendingData][dartx.length] == 0);
- return ListOfint()._check(this[_resultAsBytes]());
+ return this[_resultAsBytes]();
}
get blockSize() {
return dart.notNull(this[_chunkSizeInWords]) * io._BYTES_PER_WORD;
@@ -36259,9 +37130,9 @@
return (val[dartx['<<']](mod_shift) & io._MASK_32 | ((dart.notNull(val) & io._MASK_32) >>> 0)[dartx['>>']](32 - mod_shift)) >>> 0;
}
[_resultAsBytes]() {
- let result = [];
+ let result = JSArrayOfint().of([]);
for (let i = 0; i < dart.notNull(this[_h][dartx.length]); i++) {
- result[dartx.addAll](core.Iterable._check(this[_wordToBytes](this[_h][dartx._get](i))));
+ result[dartx.addAll](this[_wordToBytes](this[_h][dartx._get](i)));
}
return result;
}
@@ -36312,11 +37183,11 @@
let lengthInBits = dart.notNull(this[_lengthInBytes]) * io._BITS_PER_BYTE;
dart.assert(lengthInBits < dart.notNull(math.pow(2, 32)));
if (dart.test(this[_bigEndianWords])) {
- this[_pendingData][dartx.addAll](IterableOfint()._check(this[_wordToBytes](0)));
- this[_pendingData][dartx.addAll](IterableOfint()._check(this[_wordToBytes]((lengthInBits & io._MASK_32) >>> 0)));
+ this[_pendingData][dartx.addAll](this[_wordToBytes](0));
+ this[_pendingData][dartx.addAll](this[_wordToBytes]((lengthInBits & io._MASK_32) >>> 0));
} else {
- this[_pendingData][dartx.addAll](IterableOfint()._check(this[_wordToBytes]((lengthInBits & io._MASK_32) >>> 0)));
- this[_pendingData][dartx.addAll](IterableOfint()._check(this[_wordToBytes](0)));
+ this[_pendingData][dartx.addAll](this[_wordToBytes]((lengthInBits & io._MASK_32) >>> 0));
+ this[_pendingData][dartx.addAll](this[_wordToBytes](0));
}
}
};
@@ -36338,9 +37209,9 @@
[_add32]: dart.definiteFunctionType(dart.dynamic, [dart.dynamic, dart.dynamic]),
[_roundUp]: dart.definiteFunctionType(dart.dynamic, [dart.dynamic, dart.dynamic]),
[_rotl32]: dart.definiteFunctionType(core.int, [core.int, core.int]),
- [_resultAsBytes]: dart.definiteFunctionType(dart.dynamic, []),
+ [_resultAsBytes]: dart.definiteFunctionType(core.List$(core.int), []),
[_bytesToChunk]: dart.definiteFunctionType(dart.dynamic, [ListOfint(), core.int]),
- [_wordToBytes]: dart.definiteFunctionType(dart.dynamic, [core.int]),
+ [_wordToBytes]: dart.definiteFunctionType(core.List$(core.int), [core.int]),
[_iterate]: dart.definiteFunctionType(dart.dynamic, []),
[_finalizeData]: dart.definiteFunctionType(dart.dynamic, [])
})
@@ -36622,6 +37493,7 @@
}
};
dart.addSimpleTypeTests(io.ZLibEncoder);
+io.ZLibEncoder[dart.implements] = () => [ChunkedConverterOfListOfint$ListOfint$ListOfint$ListOfint()];
dart.setSignature(io.ZLibEncoder, {
fields: () => ({
gzip: core.bool,
@@ -36704,7 +37576,7 @@
const _filter$ = Symbol('_filter');
const _closed = Symbol('_closed');
const _empty = Symbol('_empty');
-let const$52;
+let const$55;
io._FilterSink = class _FilterSink extends convert.ByteConversionSink {
new(sink, filter) {
this[_sink$0] = sink;
@@ -36723,10 +37595,10 @@
try {
this[_empty] = false;
let bufferAndStart = io._ensureFastAndSerializableByteData(data, start, end);
- this[_filter$].process(ListOfint()._check(bufferAndStart.buffer), bufferAndStart.start, dart.notNull(end) - (dart.notNull(start) - dart.notNull(bufferAndStart.start)));
+ this[_filter$].process(bufferAndStart.buffer, bufferAndStart.start, dart.notNull(end) - (dart.notNull(start) - dart.notNull(bufferAndStart.start)));
let out = null;
while ((out = this[_filter$].processed({flush: false})) != null) {
- this[_sink$0].add(ListOfint()._check(out));
+ this[_sink$0].add(out);
}
} catch (e) {
this[_closed] = true;
@@ -36737,11 +37609,11 @@
}
close() {
if (dart.test(this[_closed])) return;
- if (dart.test(this[_empty])) this[_filter$].process(const$52 || (const$52 = dart.constList([], core.int)), 0, 0);
+ if (dart.test(this[_empty])) this[_filter$].process(const$55 || (const$55 = dart.constList([], core.int)), 0, 0);
try {
let out = null;
while ((out = this[_filter$].processed({end: true})) != null) {
- this[_sink$0].add(ListOfint()._check(out));
+ this[_sink$0].add(out);
}
} catch (e) {
this[_closed] = true;
@@ -36808,9 +37680,9 @@
}
};
dart.fn(io._validateZLibMemLevel, intTovoid());
-let const$53;
+let const$56;
io._validateZLibStrategy = function(strategy) {
- let strategies = const$53 || (const$53 = dart.constList([io.ZLibOption.STRATEGY_FILTERED, io.ZLibOption.STRATEGY_HUFFMAN_ONLY, io.ZLibOption.STRATEGY_RLE, io.ZLibOption.STRATEGY_FIXED, io.ZLibOption.STRATEGY_DEFAULT], core.int));
+ let strategies = const$56 || (const$56 = dart.constList([io.ZLibOption.STRATEGY_FILTERED, io.ZLibOption.STRATEGY_HUFFMAN_ONLY, io.ZLibOption.STRATEGY_RLE, io.ZLibOption.STRATEGY_FIXED, io.ZLibOption.STRATEGY_DEFAULT], core.int));
if (strategies[dartx.indexOf](strategy) == -1) {
dart.throw(new core.ArgumentError("Unsupported 'strategy'"));
}
@@ -36840,7 +37712,6 @@
const _isErrorResponse = Symbol('_isErrorResponse');
const _exceptionOrErrorFromResponse = Symbol('_exceptionOrErrorFromResponse');
const _absolutePath = Symbol('_absolutePath');
-const _computeExistingIndex = Symbol('_computeExistingIndex');
const _delete = Symbol('_delete');
const _deleteSync = Symbol('_deleteSync');
const _type = Symbol('_type');
@@ -36861,6 +37732,12 @@
io.FileSystemEntity._throwIfError(result, "Cannot resolve symbolic links", this.path);
return core.String._check(result);
}
+ stat() {
+ return io.FileStat.stat(this.path);
+ }
+ statSync() {
+ return io.FileStat.statSync(this.path);
+ }
delete(opts) {
let recursive = opts && 'recursive' in opts ? opts.recursive : false;
return this[_delete]({recursive: recursive});
@@ -37024,6 +37901,8 @@
methods: () => ({
resolveSymbolicLinks: dart.definiteFunctionType(async.Future$(core.String), []),
resolveSymbolicLinksSync: dart.definiteFunctionType(core.String, []),
+ stat: dart.definiteFunctionType(async.Future$(io.FileStat), []),
+ statSync: dart.definiteFunctionType(io.FileStat, []),
delete: dart.definiteFunctionType(async.Future$(io.FileSystemEntity), [], {recursive: core.bool}),
deleteSync: dart.definiteFunctionType(dart.void, [], {recursive: core.bool}),
watch: dart.definiteFunctionType(async.Stream$(io.FileSystemEvent), [], {events: core.int, recursive: core.bool})
@@ -37129,33 +38008,6 @@
get absolute() {
return io.Directory.new(this[_absolutePath]);
}
- stat() {
- return io.FileStat.stat(this.path);
- }
- statSync() {
- return io.FileStat.statSync(this.path);
- }
- [_computeExistingIndex](dirsToCreate) {
- let future = null;
- let notFound = dirsToCreate[dartx.length];
- for (let i = 0; i < dart.notNull(dirsToCreate[dartx.length]); i++) {
- if (future == null) {
- future = dart.dsend(dart.dsend(dirsToCreate[dartx._get](i), 'exists'), 'then', dart.fn(e => dart.test(e) ? i : notFound, dynamicToint()));
- } else {
- future = dart.dsend(future, 'then', dart.fn(index => {
- if (!dart.equals(index, notFound)) {
- return async.Future.value(index);
- }
- return dart.dsend(dart.dsend(dirsToCreate[dartx._get](i), 'exists'), 'then', dart.fn(e => dart.test(e) ? i : notFound, dynamicToint()));
- }, dynamicTodynamic$()));
- }
- }
- if (future == null) {
- return FutureOfint().value(notFound);
- } else {
- return FutureOfint()._check(future);
- }
- }
create(opts) {
let recursive = opts && 'recursive' in opts ? opts.recursive : false;
if (dart.test(recursive)) {
@@ -37266,7 +38118,7 @@
list(opts) {
let recursive = opts && 'recursive' in opts ? opts.recursive : false;
let followLinks = opts && 'followLinks' in opts ? opts.followLinks : true;
- return StreamOfFileSystemEntity()._check(new io._AsyncDirectoryLister(io.FileSystemEntity._ensureTrailingPathSeparators(this.path), recursive, followLinks).stream);
+ return new io._AsyncDirectoryLister(io.FileSystemEntity._ensureTrailingPathSeparators(this.path), recursive, followLinks).stream;
}
listSync(opts) {
let recursive = opts && 'recursive' in opts ? opts.recursive : false;
@@ -37310,9 +38162,6 @@
methods: () => ({
exists: dart.definiteFunctionType(async.Future$(core.bool), []),
existsSync: dart.definiteFunctionType(core.bool, []),
- stat: dart.definiteFunctionType(async.Future$(io.FileStat), []),
- statSync: dart.definiteFunctionType(io.FileStat, []),
- [_computeExistingIndex]: dart.definiteFunctionType(async.Future$(core.int), [core.List]),
create: dart.definiteFunctionType(async.Future$(io.Directory), [], {recursive: core.bool}),
createSync: dart.definiteFunctionType(dart.void, [], {recursive: core.bool}),
createTemp: dart.definiteFunctionType(async.Future$(io.Directory), [], [core.String]),
@@ -37358,7 +38207,7 @@
this.nextRunning = false;
this.closed = false;
this[_ops] = null;
- this.controller = async.StreamController.new({onListen: dart.bind(this, 'onListen'), onResume: dart.bind(this, 'onResume'), onCancel: dart.bind(this, 'onCancel'), sync: true});
+ this.controller = StreamControllerOfFileSystemEntity().new({onListen: dart.bind(this, 'onListen'), onResume: dart.bind(this, 'onResume'), onCancel: dart.bind(this, 'onCancel'), sync: true});
}
[_pointer]() {
return this[_ops] == null ? null : this[_ops].getPointer();
@@ -37485,14 +38334,14 @@
path: core.String,
recursive: core.bool,
followLinks: core.bool,
- controller: async.StreamController,
+ controller: StreamControllerOfFileSystemEntity(),
canceled: core.bool,
nextRunning: core.bool,
closed: core.bool,
[_ops]: io._AsyncDirectoryListerOps,
closeCompleter: async.Completer
}),
- getters: () => ({stream: dart.definiteFunctionType(async.Stream, [])}),
+ getters: () => ({stream: dart.definiteFunctionType(async.Stream$(io.FileSystemEntity), [])}),
methods: () => ({
[_pointer]: dart.definiteFunctionType(core.int, []),
onListen: dart.definiteFunctionType(dart.void, []),
@@ -37519,7 +38368,7 @@
}
};
dart.setSignature(io._EventHandler, {
- statics: () => ({_sendData: dart.definiteFunctionType(dart.void, [core.Object, isolate.SendPort, core.int])}),
+ statics: () => ({_sendData: dart.definiteFunctionType(dart.void, [core.Object, isolate$.SendPort, core.int])}),
names: ['_sendData']
});
const _mode = Symbol('_mode');
@@ -37561,7 +38410,9 @@
toString() {
return {
0: "FileLock.SHARED",
- 1: "FileLock.EXCLUSIVE"
+ 1: "FileLock.EXCLUSIVE",
+ 2: "FileLock.BLOCKING_SHARED",
+ 3: "FileLock.BLOCKING_EXCLUSIVE"
}[this.index];
}
};
@@ -37570,7 +38421,9 @@
});
dart.defineEnumValues(io.FileLock, [
'SHARED',
- 'EXCLUSIVE'
+ 'EXCLUSIVE',
+ 'BLOCKING_SHARED',
+ 'BLOCKING_EXCLUSIVE'
]);
io.File = class File extends core.Object {
static new(path) {
@@ -37623,9 +38476,9 @@
});
io._BLOCK_SIZE = 64 * 1024;
const _closeCompleter = Symbol('_closeCompleter');
-const _path$ = Symbol('_path');
+const _path = Symbol('_path');
const _position$0 = Symbol('_position');
-const _end$0 = Symbol('_end');
+const _end$ = Symbol('_end');
const _controller$0 = Symbol('_controller');
const _openedFile = Symbol('_openedFile');
const _unsubscribed = Symbol('_unsubscribed');
@@ -37638,9 +38491,9 @@
io._FileStream = class _FileStream extends async.Stream$(core.List$(core.int)) {
new(path, position, end) {
this[_closeCompleter] = async.Completer.new();
- this[_path$] = path;
+ this[_path] = path;
this[_position$0] = position;
- this[_end$0] = end;
+ this[_end$] = end;
this[_controller$0] = null;
this[_openedFile] = null;
this[_unsubscribed] = false;
@@ -37654,9 +38507,9 @@
this[_closeCompleter] = async.Completer.new();
this[_position$0] = 0;
this[_controller$0] = null;
- this[_path$] = null;
+ this[_path] = null;
this[_openedFile] = null;
- this[_end$0] = null;
+ this[_end$] = null;
this[_unsubscribed] = false;
this[_readInProgress] = true;
this[_closed] = false;
@@ -37697,12 +38550,12 @@
}
this[_readInProgress] = true;
let readBytes = io._BLOCK_SIZE;
- if (this[_end$0] != null) {
- readBytes = math.min(core.int)(readBytes, dart.notNull(this[_end$0]) - dart.notNull(this[_position$0]));
+ if (this[_end$] != null) {
+ readBytes = math.min(core.int)(readBytes, dart.notNull(this[_end$]) - dart.notNull(this[_position$0]));
if (dart.notNull(readBytes) < 0) {
this[_readInProgress] = false;
if (!dart.test(this[_unsubscribed])) {
- this[_controller$0].addError(new core.RangeError(dart.str`Bad end position: ${this[_end$0]}`));
+ this[_controller$0].addError(new core.RangeError(dart.str`Bad end position: ${this[_end$]}`));
this[_closeFile]();
this[_unsubscribed] = true;
}
@@ -37716,7 +38569,7 @@
return;
}
this[_position$0] = dart.notNull(this[_position$0]) + dart.notNull(block[dartx.length]);
- if (dart.notNull(block[dartx.length]) < dart.notNull(readBytes) || this[_end$0] != null && this[_position$0] == this[_end$0]) {
+ if (dart.notNull(block[dartx.length]) < dart.notNull(readBytes) || this[_end$] != null && this[_position$0] == this[_end$]) {
this[_atEnd] = true;
}
if (!dart.test(this[_atEnd]) && !dart.test(this[_controller$0].isPaused)) {
@@ -37765,8 +38618,8 @@
this[_closeCompleter].complete();
}).bind(this);
dart.fn(openFailed, dynamicAnddynamicTovoid$());
- if (this[_path$] != null) {
- io.File.new(this[_path$]).open({mode: io.FileMode.READ}).then(dart.void)(onOpenFile, {onError: openFailed});
+ if (this[_path] != null) {
+ io.File.new(this[_path]).open({mode: io.FileMode.READ}).then(dart.void)(onOpenFile, {onError: openFailed});
} else {
try {
onOpenFile(io._File._openStdioSync(0));
@@ -37783,10 +38636,10 @@
dart.setSignature(io._FileStream, {
fields: () => ({
[_controller$0]: StreamControllerOfListOfint(),
- [_path$]: core.String,
+ [_path]: core.String,
[_openedFile]: io.RandomAccessFile,
[_position$0]: core.int,
- [_end$0]: core.int,
+ [_end$]: core.int,
[_closeCompleter]: async.Completer,
[_unsubscribed]: core.bool,
[_readInProgress]: core.bool,
@@ -37858,8 +38711,8 @@
})
});
const _tryDecode = Symbol('_tryDecode');
-let const$54;
-let const$55;
+let const$57;
+let const$58;
io._File = class _File extends io.FileSystemEntity {
new(path) {
this.path = path;
@@ -37886,12 +38739,6 @@
get absolute() {
return io.File.new(this[_absolutePath]);
}
- stat() {
- return io.FileStat.stat(this.path);
- }
- statSync() {
- return io.FileStat.statSync(this.path);
- }
create(opts) {
let recursive = opts && 'recursive' in opts ? opts.recursive : false;
let result = dart.test(recursive) ? this.parent.create({recursive: true}) : async.Future.value(null);
@@ -38008,6 +38855,41 @@
io._File.throwIfError(result, "Cannot retrieve length of file", this.path);
return core.int._check(result);
}
+ lastAccessed() {
+ return io._IOService._dispatch(io._FILE_LAST_ACCESSED, JSArrayOfString().of([this.path])).then(core.DateTime)(dart.fn(response => {
+ if (dart.test(io._isErrorResponse(response))) {
+ dart.throw(io._exceptionFromResponse(response, "Cannot retrieve access time", this.path));
+ }
+ return new core.DateTime.fromMillisecondsSinceEpoch(core.int._check(response));
+ }, dynamicToDateTime()));
+ }
+ static _lastAccessed(path) {
+ dart.throw(new core.UnsupportedError("File._lastAccessed"));
+ }
+ lastAccessedSync() {
+ let ms = io._File._lastAccessed(this.path);
+ io._File.throwIfError(ms, "Cannot retrieve access time", this.path);
+ return new core.DateTime.fromMillisecondsSinceEpoch(core.int._check(ms));
+ }
+ setLastAccessed(time) {
+ let millis = time.millisecondsSinceEpoch;
+ return io._IOService._dispatch(io._FILE_SET_LAST_ACCESSED, JSArrayOfObject().of([this.path, millis])).then(dart.dynamic)(dart.fn(response => {
+ if (dart.test(io._isErrorResponse(response))) {
+ dart.throw(io._exceptionFromResponse(response, "Cannot set access time", this.path));
+ }
+ return null;
+ }, dynamicToNull$()));
+ }
+ static _setLastAccessed(path, millis) {
+ dart.throw(new core.UnsupportedError("File._setLastAccessed"));
+ }
+ setLastAccessedSync(time) {
+ let millis = time.millisecondsSinceEpoch;
+ let result = io._File._setLastAccessed(this.path, millis);
+ if (io.OSError.is(result)) {
+ dart.throw(new io.FileSystemException("Failed to set file access time", this.path, result));
+ }
+ }
lastModified() {
return io._IOService._dispatch(io._FILE_LAST_MODIFIED, JSArrayOfString().of([this.path])).then(core.DateTime)(dart.fn(response => {
if (dart.test(io._isErrorResponse(response))) {
@@ -38024,6 +38906,25 @@
io._File.throwIfError(ms, "Cannot retrieve modification time", this.path);
return new core.DateTime.fromMillisecondsSinceEpoch(core.int._check(ms));
}
+ setLastModified(time) {
+ let millis = time.millisecondsSinceEpoch;
+ return io._IOService._dispatch(io._FILE_SET_LAST_MODIFIED, JSArrayOfObject().of([this.path, millis])).then(dart.dynamic)(dart.fn(response => {
+ if (dart.test(io._isErrorResponse(response))) {
+ dart.throw(io._exceptionFromResponse(response, "Cannot set modification time", this.path));
+ }
+ return null;
+ }, dynamicToNull$()));
+ }
+ static _setLastModified(path, millis) {
+ dart.throw(new core.UnsupportedError("File._setLastModified"));
+ }
+ setLastModifiedSync(time) {
+ let millis = time.millisecondsSinceEpoch;
+ let result = io._File._setLastModified(this.path, millis);
+ if (io.OSError.is(result)) {
+ dart.throw(new io.FileSystemException("Failed to set file modification time", this.path, result));
+ }
+ }
static _open(path, mode) {
dart.throw(new core.UnsupportedError("File._open"));
}
@@ -38063,22 +38964,22 @@
readAsBytes() {
function readDataChunked(file) {
let builder = io.BytesBuilder.new({copy: false});
- let completer = async.Completer.new();
+ let completer = CompleterOfListOfint().new();
function read() {
- dart.dsend(dart.dsend(file, 'read', io._BLOCK_SIZE), 'then', dart.fn(data => {
- if (dart.test(dart.dsend(dart.dload(data, 'length'), '>', 0))) {
- builder.add(ListOfint()._check(data));
+ file.read(io._BLOCK_SIZE).then(dart.dynamic)(dart.fn(data => {
+ if (dart.notNull(data[dartx.length]) > 0) {
+ builder.add(data);
read();
} else {
completer.complete(builder.takeBytes());
}
- }, dynamicToNull$()), {onError: dart.bind(completer, 'completeError')});
+ }, ListOfintToNull()), {onError: dart.bind(completer, 'completeError')});
}
dart.fn(read, VoidTovoid$());
read();
- return FutureOfListOfint()._check(completer.future);
+ return completer.future;
}
- dart.fn(readDataChunked, dynamicToFutureOfListOfint());
+ dart.fn(readDataChunked, RandomAccessFileToFutureOfListOfint());
return this.open().then(ListOfint())(dart.fn(file => file.length().then(ListOfint())(dart.fn(length => {
if (length == 0) {
return readDataChunked(file);
@@ -38095,13 +38996,13 @@
let builder = io.BytesBuilder.new({copy: false});
do {
data = opened.readSync(io._BLOCK_SIZE);
- if (dart.test(dart.dsend(dart.dload(data, 'length'), '>', 0))) builder.add(ListOfint()._check(data));
- } while (dart.test(dart.dsend(dart.dload(data, 'length'), '>', 0)));
+ if (dart.notNull(data[dartx.length]) > 0) builder.add(data);
+ } while (dart.notNull(data[dartx.length]) > 0);
data = builder.takeBytes();
} else {
data = opened.readSync(length);
}
- return ListOfint()._check(data);
+ return data;
} finally {
opened.closeSync();
}
@@ -38124,11 +39025,11 @@
}
readAsLines(opts) {
let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
- return this.readAsString({encoding: encoding}).then(ListOfString())(dart.bind(const$54 || (const$54 = dart.const(new convert.LineSplitter())), 'convert'));
+ return this.readAsString({encoding: encoding}).then(ListOfString())(dart.bind(const$57 || (const$57 = dart.const(new convert.LineSplitter())), 'convert'));
}
readAsLinesSync(opts) {
let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
- return (const$55 || (const$55 = dart.const(new convert.LineSplitter()))).convert(this.readAsStringSync({encoding: encoding}));
+ return (const$58 || (const$58 = dart.const(new convert.LineSplitter()))).convert(this.readAsStringSync({encoding: encoding}));
}
writeAsBytes(bytes, opts) {
let mode = opts && 'mode' in opts ? opts.mode : io.FileMode.WRITE;
@@ -38182,8 +39083,6 @@
methods: () => ({
exists: dart.definiteFunctionType(async.Future$(core.bool), []),
existsSync: dart.definiteFunctionType(core.bool, []),
- stat: dart.definiteFunctionType(async.Future$(io.FileStat), []),
- statSync: dart.definiteFunctionType(io.FileStat, []),
create: dart.definiteFunctionType(async.Future$(io.File), [], {recursive: core.bool}),
createSync: dart.definiteFunctionType(dart.void, [], {recursive: core.bool}),
[_delete]: dart.definiteFunctionType(async.Future$(io.File), [], {recursive: core.bool}),
@@ -38195,8 +39094,14 @@
open: dart.definiteFunctionType(async.Future$(io.RandomAccessFile), [], {mode: io.FileMode}),
length: dart.definiteFunctionType(async.Future$(core.int), []),
lengthSync: dart.definiteFunctionType(core.int, []),
+ lastAccessed: dart.definiteFunctionType(async.Future$(core.DateTime), []),
+ lastAccessedSync: dart.definiteFunctionType(core.DateTime, []),
+ setLastAccessed: dart.definiteFunctionType(async.Future, [core.DateTime]),
+ setLastAccessedSync: dart.definiteFunctionType(dart.void, [core.DateTime]),
lastModified: dart.definiteFunctionType(async.Future$(core.DateTime), []),
lastModifiedSync: dart.definiteFunctionType(core.DateTime, []),
+ setLastModified: dart.definiteFunctionType(async.Future, [core.DateTime]),
+ setLastModifiedSync: dart.definiteFunctionType(dart.void, [core.DateTime]),
openSync: dart.definiteFunctionType(io.RandomAccessFile, [], {mode: io.FileMode}),
openRead: dart.definiteFunctionType(async.Stream$(core.List$(core.int)), [], [core.int, core.int]),
openWrite: dart.definiteFunctionType(io.IOSink, [], {mode: io.FileMode, encoding: convert.Encoding}),
@@ -38223,26 +39128,49 @@
_renameLink: dart.definiteFunctionType(dart.dynamic, [core.String, core.String]),
_copy: dart.definiteFunctionType(dart.dynamic, [core.String, core.String]),
_lengthFromPath: dart.definiteFunctionType(dart.dynamic, [core.String]),
+ _lastAccessed: dart.definiteFunctionType(dart.dynamic, [core.String]),
+ _setLastAccessed: dart.definiteFunctionType(dart.dynamic, [core.String, core.int]),
_lastModified: dart.definiteFunctionType(dart.dynamic, [core.String]),
+ _setLastModified: dart.definiteFunctionType(dart.dynamic, [core.String, core.int]),
_open: dart.definiteFunctionType(dart.dynamic, [core.String, core.int]),
_openStdio: dart.definiteFunctionType(core.int, [core.int]),
_openStdioSync: dart.definiteFunctionType(io.RandomAccessFile, [core.int]),
throwIfError: dart.definiteFunctionType(dart.dynamic, [core.Object, core.String, core.String])
}),
- names: ['_exists', '_create', '_createLink', '_linkTarget', '_deleteNative', '_deleteLinkNative', '_rename', '_renameLink', '_copy', '_lengthFromPath', '_lastModified', '_open', '_openStdio', '_openStdioSync', 'throwIfError']
+ names: ['_exists', '_create', '_createLink', '_linkTarget', '_deleteNative', '_deleteLinkNative', '_rename', '_renameLink', '_copy', '_lengthFromPath', '_lastAccessed', '_setLastAccessed', '_lastModified', '_setLastModified', '_open', '_openStdio', '_openStdioSync', 'throwIfError']
});
io._RandomAccessFileOps = class _RandomAccessFileOps extends core.Object {
static new(pointer) {
dart.throw(new core.UnsupportedError("RandomAccessFile"));
}
};
+io._FileTranslation = class _FileTranslation extends core.Object {
+ new(index) {
+ this.index = index;
+ }
+ toString() {
+ return {
+ 0: "_FileTranslation.text",
+ 1: "_FileTranslation.binary"
+ }[this.index];
+ }
+};
+dart.setSignature(io._FileTranslation, {
+ fields: () => ({index: core.int})
+});
+dart.defineEnumValues(io._FileTranslation, [
+ 'text',
+ 'binary'
+]);
const _asyncDispatched = Symbol('_asyncDispatched');
const _fileService = Symbol('_fileService');
const _resourceInfo = Symbol('_resourceInfo');
+const _translation = Symbol('_translation');
const _maybeConnectHandler = Symbol('_maybeConnectHandler');
const _maybePerformCleanup = Symbol('_maybePerformCleanup');
const _dispatch = Symbol('_dispatch');
const _checkAvailable = Symbol('_checkAvailable');
+const _fileLockValue = Symbol('_fileLockValue');
io._RandomAccessFile = class _RandomAccessFile extends core.Object {
new(pointer, path) {
this.path = path;
@@ -38250,9 +39178,11 @@
this[_fileService] = null;
this[_resourceInfo] = null;
this[_ops] = null;
+ this[_translation] = null;
this.closed = false;
this[_ops] = io._RandomAccessFileOps.new(pointer);
this[_resourceInfo] = new io._FileResourceInfo(this);
+ this[_translation] = io._FileTranslation.binary;
this[_maybeConnectHandler]();
}
[_maybePerformCleanup]() {
@@ -38314,8 +39244,8 @@
dart.throw(io._exceptionFromResponse(response, "read failed", this.path));
}
this[_resourceInfo].addRead(core.int._check(dart.dload(dart.dindex(response, 1), 'length')));
- return FutureOrOfListOfint()._check(dart.dindex(response, 1));
- }, dynamicToFutureOrOfListOfint()));
+ return ListOfint().as(dart.dindex(response, 1));
+ }, dynamicToListOfint()));
}
readSync(bytes) {
this[_checkAvailable]();
@@ -38327,7 +39257,7 @@
dart.throw(new io.FileSystemException("readSync failed", this.path, result));
}
this[_resourceInfo].addRead(core.int._check(dart.dload(result, 'length')));
- return ListOfint()._check(result);
+ return ListOfint().as(result);
}
readInto(buffer, start, end) {
if (start === void 0) start = 0;
@@ -38345,8 +39275,8 @@
dart.throw(io._exceptionFromResponse(response, "readInto failed", this.path));
}
let read = dart.dindex(response, 1);
- let data = dart.dindex(response, 2);
- buffer[dartx.setRange](start, dart.asInt(dart.notNull(start) + dart.notNull(core.num._check(read))), IterableOfint()._check(data));
+ let data = ListOfint().as(dart.dindex(response, 2));
+ buffer[dartx.setRange](start, dart.asInt(dart.notNull(start) + dart.notNull(core.num._check(read))), data);
this[_resourceInfo].addRead(core.int._check(read));
return FutureOrOfint()._check(read);
}, dynamicToFutureOrOfint()));
@@ -38435,7 +39365,7 @@
return;
}
let bufferAndStart = io._ensureFastAndSerializableByteData(buffer, start, end);
- let result = this[_ops].writeFrom(ListOfint()._check(bufferAndStart.buffer), bufferAndStart.start, dart.notNull(end) - (dart.notNull(start) - dart.notNull(bufferAndStart.start)));
+ let result = this[_ops].writeFrom(bufferAndStart.buffer, bufferAndStart.start, dart.notNull(end) - (dart.notNull(start) - dart.notNull(bufferAndStart.start)));
if (io.OSError.is(result)) {
dart.throw(new io.FileSystemException("writeFrom failed", this.path, result));
}
@@ -38534,6 +39464,30 @@
dart.throw(new io.FileSystemException("flush failed", this.path, result));
}
}
+ [_fileLockValue](fl) {
+ switch (fl) {
+ case io.FileLock.SHARED:
+ {
+ return io._RandomAccessFile.LOCK_SHARED;
+ }
+ case io.FileLock.EXCLUSIVE:
+ {
+ return io._RandomAccessFile.LOCK_EXCLUSIVE;
+ }
+ case io.FileLock.BLOCKING_SHARED:
+ {
+ return io._RandomAccessFile.LOCK_BLOCKING_SHARED;
+ }
+ case io.FileLock.BLOCKING_EXCLUSIVE:
+ {
+ return io._RandomAccessFile.LOCK_BLOCKING_EXCLUSIVE;
+ }
+ default:
+ {
+ return -1;
+ }
+ }
+ }
lock(mode, start, end) {
if (mode === void 0) mode = io.FileLock.EXCLUSIVE;
if (start === void 0) start = 0;
@@ -38544,7 +39498,7 @@
if (dart.notNull(start) < 0 || dart.notNull(end) < -1 || end != -1 && dart.notNull(start) >= dart.notNull(end)) {
dart.throw(new core.ArgumentError());
}
- let lock = dart.equals(mode, io.FileLock.EXCLUSIVE) ? io._RandomAccessFile.LOCK_EXCLUSIVE : io._RandomAccessFile.LOCK_SHARED;
+ let lock = this[_fileLockValue](mode);
return this[_dispatch](io._FILE_LOCK, JSArrayOfint().of([null, lock, start, end])).then(io._RandomAccessFile)(dart.fn(response => {
if (dart.test(io._isErrorResponse(response))) {
dart.throw(io._exceptionFromResponse(response, 'lock failed', this.path));
@@ -38579,7 +39533,7 @@
if (dart.notNull(start) < 0 || dart.notNull(end) < -1 || end != -1 && dart.notNull(start) >= dart.notNull(end)) {
dart.throw(new core.ArgumentError());
}
- let lock = dart.equals(mode, io.FileLock.EXCLUSIVE) ? io._RandomAccessFile.LOCK_EXCLUSIVE : io._RandomAccessFile.LOCK_SHARED;
+ let lock = this[_fileLockValue](mode);
let result = this[_ops].lock(lock, start, end);
if (io.OSError.is(result)) {
dart.throw(new io.FileSystemException('lock failed', this.path, result));
@@ -38600,6 +39554,15 @@
dart.throw(new io.FileSystemException('unlock failed', this.path, result));
}
}
+ get translation() {
+ return this[_translation];
+ }
+ set translation(translation) {
+ if (!dart.equals(this[_translation], translation)) {
+ this[_ops].setTranslation(translation.index);
+ this[_translation] = translation;
+ }
+ }
[_pointer]() {
return this[_ops].getPointer();
}
@@ -38635,11 +39598,14 @@
fields: () => ({
path: core.String,
[_asyncDispatched]: core.bool,
- [_fileService]: isolate.SendPort,
+ [_fileService]: isolate$.SendPort,
[_resourceInfo]: io._FileResourceInfo,
[_ops]: io._RandomAccessFileOps,
+ [_translation]: io._FileTranslation,
closed: core.bool
}),
+ getters: () => ({translation: dart.definiteFunctionType(io._FileTranslation, [])}),
+ setters: () => ({translation: dart.definiteFunctionType(dart.void, [io._FileTranslation])}),
methods: () => ({
[_maybePerformCleanup]: dart.definiteFunctionType(dart.void, []),
[_maybeConnectHandler]: dart.definiteFunctionType(dart.dynamic, []),
@@ -38667,6 +39633,7 @@
lengthSync: dart.definiteFunctionType(core.int, []),
flush: dart.definiteFunctionType(async.Future$(io.RandomAccessFile), []),
flushSync: dart.definiteFunctionType(dart.void, []),
+ [_fileLockValue]: dart.definiteFunctionType(core.int, [io.FileLock]),
lock: dart.definiteFunctionType(async.Future$(io.RandomAccessFile), [], [io.FileLock, core.int, core.int]),
unlock: dart.definiteFunctionType(async.Future$(io.RandomAccessFile), [], [core.int, core.int]),
lockSync: dart.definiteFunctionType(dart.void, [], [io.FileLock, core.int, core.int]),
@@ -38680,7 +39647,9 @@
io._RandomAccessFile.LOCK_UNLOCK = 0;
io._RandomAccessFile.LOCK_SHARED = 1;
io._RandomAccessFile.LOCK_EXCLUSIVE = 2;
-let const$56;
+io._RandomAccessFile.LOCK_BLOCKING_SHARED = 3;
+io._RandomAccessFile.LOCK_BLOCKING_EXCLUSIVE = 4;
+let const$59;
io.FileSystemEntityType = class FileSystemEntityType extends core.Object {
_internal(type) {
this[_type] = type;
@@ -38689,7 +39658,7 @@
return io.FileSystemEntityType._typeList[dartx._get](type);
}
toString() {
- return (const$56 || (const$56 = dart.constList(['FILE', 'DIRECTORY', 'LINK', 'NOT_FOUND'], core.String)))[dartx._get](this[_type]);
+ return (const$59 || (const$59 = dart.constList(['FILE', 'DIRECTORY', 'LINK', 'NOT_FOUND'], core.String)))[dartx._get](this[_type]);
}
};
dart.defineNamedConstructor(io.FileSystemEntityType, '_internal');
@@ -38715,7 +39684,7 @@
return dart.constList([io.FileSystemEntityType.FILE, io.FileSystemEntityType.DIRECTORY, io.FileSystemEntityType.LINK, io.FileSystemEntityType.NOT_FOUND], io.FileSystemEntityType);
}
});
-let const$57;
+let const$60;
io.FileStat = class FileStat extends core.Object {
_internal(changed, modified, accessed, type, mode, size) {
this.changed = changed;
@@ -38761,7 +39730,7 @@
}
modeString() {
let permissions = dart.notNull(this.mode) & 4095;
- let codes = const$57 || (const$57 = dart.constList(['---', '--x', '-w-', '-wx', 'r--', 'r-x', 'rw-', 'rwx'], core.String));
+ let codes = const$60 || (const$60 = dart.constList(['---', '--x', '-w-', '-wx', 'r--', 'r-x', 'rw-', 'rwx'], core.String));
let result = [];
if ((permissions & 2048) != 0) result[dartx.add]("(suid) ");
if ((permissions & 1024) != 0) result[dartx.add]("(guid) ");
@@ -39261,19 +40230,19 @@
}),
getters: () => ({uri: dart.definiteFunctionType(core.Uri, [])})
});
-let const$58;
-let const$59;
-let const$60;
let const$61;
let const$62;
let const$63;
let const$64;
let const$65;
let const$66;
+let const$67;
+let const$68;
+let const$69;
io.HttpDate = class HttpDate extends core.Object {
static format(date) {
- let wkday = const$58 || (const$58 = dart.constList(["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"], core.String));
- let month = const$59 || (const$59 = dart.constList(["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], core.String));
+ let wkday = const$61 || (const$61 = dart.constList(["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"], core.String));
+ let month = const$62 || (const$62 = dart.constList(["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], core.String));
let d = date.toUtc();
let sb = new core.StringBuffer();
sb.write(wkday[dartx._get](dart.notNull(d.weekday) - 1));
@@ -39295,12 +40264,12 @@
}
static parse(date) {
let SP = 32;
- let wkdays = const$60 || (const$60 = dart.constList(["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"], core.String));
- let weekdays = const$61 || (const$61 = dart.constList(["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"], core.String));
- let months = const$62 || (const$62 = dart.constList(["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], core.String));
- let wkdaysLowerCase = const$63 || (const$63 = dart.constList(["mon", "tue", "wed", "thu", "fri", "sat", "sun"], core.String));
- let weekdaysLowerCase = const$64 || (const$64 = dart.constList(["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"], core.String));
- let monthsLowerCase = const$65 || (const$65 = dart.constList(["jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"], core.String));
+ let wkdays = const$63 || (const$63 = dart.constList(["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"], core.String));
+ let weekdays = const$64 || (const$64 = dart.constList(["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"], core.String));
+ let months = const$65 || (const$65 = dart.constList(["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], core.String));
+ let wkdaysLowerCase = const$66 || (const$66 = dart.constList(["mon", "tue", "wed", "thu", "fri", "sat", "sun"], core.String));
+ let weekdaysLowerCase = const$67 || (const$67 = dart.constList(["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"], core.String));
+ let monthsLowerCase = const$68 || (const$68 = dart.constList(["jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"], core.String));
let formatRfc1123 = 0;
let formatRfc850 = 1;
let formatAsctime = 2;
@@ -39416,7 +40385,7 @@
return new core.DateTime.utc(year, dart.notNull(month) + 1, day, hours, minutes, seconds, 0);
}
static _parseCookieDate(date) {
- let monthsLowerCase = const$66 || (const$66 = dart.constList(["jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"], core.String));
+ let monthsLowerCase = const$69 || (const$69 = dart.constList(["jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"], core.String));
let position = 0;
function error() {
dart.throw(new io.HttpException(dart.str`Invalid cookie date ${date}`));
@@ -39550,7 +40519,7 @@
const _addIfModifiedSince = Symbol('_addIfModifiedSince');
const _foldHeader = Symbol('_foldHeader');
const _finalize = Symbol('_finalize');
-const _write = Symbol('_write');
+const _build = Symbol('_build');
const _parseCookies = Symbol('_parseCookies');
io._HttpHeaders = class _HttpHeaders extends core.Object {
new(protocolVersion, opts) {
@@ -39986,81 +40955,32 @@
[_finalize]() {
this[_mutable] = false;
}
- [_write](buffer, offset) {
- function write(bytes) {
- let len = bytes[dartx.length];
- for (let i = 0; i < dart.notNull(len); i++) {
- buffer[dartx._set](dart.notNull(offset) + i, bytes[dartx._get](i));
- }
- offset = dart.notNull(offset) + dart.notNull(len);
- }
- dart.fn(write, ListOfintTovoid());
+ [_build](builder) {
for (let name of this[_headers][dartx.keys]) {
let values = this[_headers][dartx._get](name);
let fold = core.bool._check(this[_foldHeader](name));
let nameData = name[dartx.codeUnits];
- write(nameData);
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.COLON);
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.SP);
+ builder.add(nameData);
+ builder.addByte(io._CharCode.COLON);
+ builder.addByte(io._CharCode.SP);
for (let i = 0; i < dart.notNull(values[dartx.length]); i++) {
if (i > 0) {
if (dart.test(fold)) {
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.COMMA);
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.SP);
+ builder.addByte(io._CharCode.COMMA);
+ builder.addByte(io._CharCode.SP);
} else {
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.CR);
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.LF);
- write(nameData);
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.COLON);
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.SP);
+ builder.addByte(io._CharCode.CR);
+ builder.addByte(io._CharCode.LF);
+ builder.add(nameData);
+ builder.addByte(io._CharCode.COLON);
+ builder.addByte(io._CharCode.SP);
}
}
- write(values[dartx._get](i)[dartx.codeUnits]);
+ builder.add(values[dartx._get](i)[dartx.codeUnits]);
}
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.CR);
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.LF);
+ builder.addByte(io._CharCode.CR);
+ builder.addByte(io._CharCode.LF);
}
- return offset;
}
toString() {
let sb = new core.StringBuffer();
@@ -40235,7 +41155,7 @@
[_updateHostHeader]: dart.definiteFunctionType(dart.dynamic, []),
[_foldHeader]: dart.definiteFunctionType(dart.dynamic, [core.String]),
[_finalize]: dart.definiteFunctionType(dart.void, []),
- [_write]: dart.definiteFunctionType(core.int, [typed_data.Uint8List, core.int]),
+ [_build]: dart.definiteFunctionType(dart.void, [io.BytesBuilder]),
[_parseCookies]: dart.definiteFunctionType(core.List$(io.Cookie), [])
}),
statics: () => ({
@@ -40384,7 +41304,7 @@
return;
}
let value = parseParameterValue();
- if (name == 'charset' && io._ContentType.is(this)) {
+ if (name == 'charset' && io._ContentType.is(this) && value != null) {
value = value[dartx.toLowerCase]();
}
parameters._set(name, value);
@@ -40495,7 +41415,7 @@
});
const _validate = Symbol('_validate');
const _parseSetCookieValue = Symbol('_parseSetCookieValue');
-let const$67;
+let const$70;
io._Cookie = class _Cookie extends core.Object {
new(name, value) {
if (name === void 0) name = null;
@@ -40634,7 +41554,7 @@
return sb.toString();
}
[_validate]() {
- let SEPERATORS = const$67 || (const$67 = dart.constList(["(", ")", "<", ">", "@", ",", ";", ":", "\\", '"', "/", "[", "]", "?", "=", "{", "}"], core.String));
+ let SEPERATORS = const$70 || (const$70 = dart.constList(["(", ")", "<", ">", "@", ",", ";", ":", "\\", '"', "/", "[", "]", "?", "=", "{", "}"], core.String));
for (let i = 0; i < dart.notNull(this.name[dartx.length]); i++) {
let codeUnit = this.name[dartx.codeUnits][dartx._get](i);
if (dart.notNull(codeUnit) <= 32 || dart.notNull(codeUnit) >= 127 || dart.notNull(SEPERATORS[dartx.indexOf](this.name[dartx._get](i))) >= 0) {
@@ -40668,6 +41588,7 @@
})
});
io._OUTGOING_BUFFER_SIZE = 8 * 1024;
+io._BytesConsumer = dart.typedef('_BytesConsumer', () => dart.functionType(dart.void, [ListOfint()]));
const _transferLength = Symbol('_transferLength');
const _dataCompleter = Symbol('_dataCompleter');
const _stream$ = Symbol('_stream');
@@ -40966,7 +41887,7 @@
let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : null;
if (dart.test(this[_incoming].upgraded)) {
this[_httpRequest][_httpClientConnection].destroy();
- return StreamSubscriptionOfListOfint()._check(async.Stream.fromIterable([]).listen(null, {onDone: onDone}));
+ return StreamOfListOfint().empty().listen(null, {onDone: onDone});
}
let stream = this[_incoming];
if (dart.test(this[_httpClient].autoUncompress) && this.headers.value(io.HttpHeaders.CONTENT_ENCODING) == "gzip") {
@@ -41088,7 +42009,7 @@
[_authenticate]: dart.definiteFunctionType(async.Future$(io.HttpClientResponse), [core.bool])
})
});
-const _uri = Symbol('_uri');
+const _uri$ = Symbol('_uri');
const _outgoing = Symbol('_outgoing');
const _encodingSet = Symbol('_encodingSet');
const _bufferOutput = Symbol('_bufferOutput');
@@ -41316,7 +42237,7 @@
class _HttpOutboundMessage extends io._IOSinkImpl {
new(uri, protocolVersion, outgoing, opts) {
let initialHeaders = opts && 'initialHeaders' in opts ? opts.initialHeaders : null;
- this[_uri] = uri;
+ this[_uri$] = uri;
this.headers = new io._HttpHeaders(protocolVersion, {defaultPortForScheme: uri.scheme == 'https' ? io.HttpClient.DEFAULT_HTTPS_PORT : io.HttpClient.DEFAULT_HTTP_PORT, initialHeaders: initialHeaders});
this[_outgoing] = outgoing;
this[_encodingSet] = false;
@@ -41379,7 +42300,7 @@
fields: () => ({
[_encodingSet]: core.bool,
[_bufferOutput]: core.bool,
- [_uri]: core.Uri,
+ [_uri$]: core.Uri,
[_outgoing]: io._HttpOutgoing,
headers: io._HttpHeaders
}),
@@ -41476,43 +42397,18 @@
}, VoidToNull()));
}
[_writeHeader]() {
- let buffer = typed_data.Uint8List.new(io._OUTGOING_BUFFER_SIZE);
- let offset = 0;
- function write(bytes) {
- let len = bytes[dartx.length];
- for (let i = 0; i < dart.notNull(len); i++) {
- buffer[dartx._set](dart.notNull(offset) + i, bytes[dartx._get](i));
- }
- offset = dart.notNull(offset) + dart.notNull(len);
- }
- dart.fn(write, ListOfintTovoid());
+ let buffer = new io._CopyingBytesBuilder(io._OUTGOING_BUFFER_SIZE);
if (this.headers.protocolVersion == "1.1") {
- write(io._Const.HTTP11);
+ buffer.add(io._Const.HTTP11);
} else {
- write(io._Const.HTTP10);
+ buffer.add(io._Const.HTTP10);
}
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.SP);
- write(dart.toString(this.statusCode)[dartx.codeUnits]);
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.SP);
- write(this.reasonPhrase[dartx.codeUnits]);
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.CR);
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.LF);
+ buffer.addByte(io._CharCode.SP);
+ buffer.add(dart.toString(this.statusCode)[dartx.codeUnits]);
+ buffer.addByte(io._CharCode.SP);
+ buffer.add(this.reasonPhrase[dartx.codeUnits]);
+ buffer.addByte(io._CharCode.CR);
+ buffer.addByte(io._CharCode.LF);
let session = this[_httpRequest][_session];
if (session != null && !dart.test(session[_destroyed])) {
session[_isNew] = false;
@@ -41541,18 +42437,11 @@
}, CookieToNull()));
}
this.headers[_finalize]();
- offset = this.headers[_write](buffer, offset);
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.CR);
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.LF);
- this[_outgoing].setHeader(buffer, offset);
+ this.headers[_build](buffer);
+ buffer.addByte(io._CharCode.CR);
+ buffer.addByte(io._CharCode.LF);
+ let headerBytes = typed_data.Uint8List._check(buffer.takeBytes());
+ this[_outgoing].setHeader(headerBytes, headerBytes[dartx.length]);
}
[_findReasonPhrase](statusCode) {
if (this[_reasonPhrase] != null) {
@@ -41857,39 +42746,14 @@
}
}
[_writeHeader]() {
- let buffer = typed_data.Uint8List.new(io._OUTGOING_BUFFER_SIZE);
- let offset = 0;
- function write(bytes) {
- let len = bytes[dartx.length];
- for (let i = 0; i < dart.notNull(len); i++) {
- buffer[dartx._set](dart.notNull(offset) + i, bytes[dartx._get](i));
- }
- offset = dart.notNull(offset) + dart.notNull(len);
- }
- dart.fn(write, ListOfintTovoid());
- write(this.method[dartx.codeUnits]);
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.SP);
- write(this[_requestUri]()[dartx.codeUnits]);
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.SP);
- write(io._Const.HTTP11);
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.CR);
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.LF);
+ let buffer = new io._CopyingBytesBuilder(io._OUTGOING_BUFFER_SIZE);
+ buffer.add(this.method[dartx.codeUnits]);
+ buffer.addByte(io._CharCode.SP);
+ buffer.add(this[_requestUri]()[dartx.codeUnits]);
+ buffer.addByte(io._CharCode.SP);
+ buffer.add(io._Const.HTTP11);
+ buffer.addByte(io._CharCode.CR);
+ buffer.addByte(io._CharCode.LF);
if (!dart.test(this.cookies[dartx.isEmpty])) {
let sb = new core.StringBuffer();
for (let i = 0; i < dart.notNull(this.cookies[dartx.length]); i++) {
@@ -41901,18 +42765,11 @@
this.headers.add(io.HttpHeaders.COOKIE, sb.toString());
}
this.headers[_finalize]();
- offset = this.headers[_write](buffer, offset);
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.CR);
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.LF);
- this[_outgoing].setHeader(buffer, offset);
+ this.headers[_build](buffer);
+ buffer.addByte(io._CharCode.CR);
+ buffer.addByte(io._CharCode.LF);
+ let headerBytes = typed_data.Uint8List._check(buffer.takeBytes());
+ this[_outgoing].setHeader(headerBytes, headerBytes[dartx.length]);
}
};
dart.addSimpleTypeTests(io._HttpClientRequest);
@@ -41956,19 +42813,19 @@
super.new();
}
add(chunk) {
- dart.dcall(this[_consume], chunk);
+ this[_consume](chunk);
}
addSlice(chunk, start, end, isLast) {
if (typed_data.Uint8List.is(chunk)) {
- dart.dcall(this[_consume], typed_data.Uint8List.view(chunk[dartx.buffer], start, dart.notNull(end) - dart.notNull(start)));
+ this[_consume](typed_data.Uint8List.view(chunk[dartx.buffer], start, dart.notNull(end) - dart.notNull(start)));
} else {
- dart.dcall(this[_consume], chunk[dartx.sublist](start, dart.notNull(end) - dart.notNull(start)));
+ this[_consume](chunk[dartx.sublist](start, dart.notNull(end) - dart.notNull(start)));
}
}
close() {}
};
dart.setSignature(io._HttpGZipSink, {
- fields: () => ({[_consume]: core.Function}),
+ fields: () => ({[_consume]: io._BytesConsumer}),
methods: () => ({
add: dart.definiteFunctionType(dart.void, [ListOfint()]),
addSlice: dart.definiteFunctionType(dart.void, [ListOfint(), core.int, core.int, core.bool]),
@@ -41988,10 +42845,10 @@
const _addChunk$ = Symbol('_addChunk');
const _chunkHeader = Symbol('_chunkHeader');
const _ignoreError = Symbol('_ignoreError');
-let const$68;
+let const$71;
io._HttpOutgoing = class _HttpOutgoing extends core.Object {
new(socket) {
- this[_doneCompleter] = async.Completer.new();
+ this[_doneCompleter] = CompleterOfSocket().new();
this.socket = socket;
this.ignoreBody = false;
this.headersWritten = false;
@@ -42013,16 +42870,6 @@
writeHeaders(opts) {
let drainRequest = opts && 'drainRequest' in opts ? opts.drainRequest : true;
let setOutgoing = opts && 'setOutgoing' in opts ? opts.setOutgoing : true;
- const write = (function() {
- try {
- this.outbound[_writeHeader]();
- } catch (_) {
- return async.Future.error(new io.HttpException(dart.str`Headers size exceeded the of '${io._OUTGOING_BUFFER_SIZE}'` + " bytes"));
- }
-
- return null;
- }).bind(this);
- dart.fn(write, VoidToFuture());
if (dart.test(this.headersWritten)) return null;
this.headersWritten = true;
let drainFuture = null;
@@ -42044,22 +42891,22 @@
} else {
drainRequest = false;
}
- if (dart.test(this.ignoreBody)) {
- return write();
- }
- if (dart.test(setOutgoing)) {
- let contentLength = this.outbound.headers.contentLength;
- if (dart.test(this.outbound.headers.chunkedTransferEncoding)) {
- this.chunked = true;
- if (gzip) this.gzip = true;
- } else if (dart.notNull(contentLength) >= 0) {
- this.contentLength = contentLength;
+ if (!dart.test(this.ignoreBody)) {
+ if (dart.test(setOutgoing)) {
+ let contentLength = this.outbound.headers.contentLength;
+ if (dart.test(this.outbound.headers.chunkedTransferEncoding)) {
+ this.chunked = true;
+ if (gzip) this.gzip = true;
+ } else if (dart.notNull(contentLength) >= 0) {
+ this.contentLength = contentLength;
+ }
+ }
+ if (drainFuture != null) {
+ return drainFuture.then(dart.void)(dart.fn(_ => this.outbound[_writeHeader](), dynamicTovoid$()));
}
}
- if (drainFuture != null) {
- return drainFuture.then(dart.dynamic)(dart.fn(_ => write(), dynamicToFuture()));
- }
- return write();
+ this.outbound[_writeHeader]();
+ return null;
}
addStream(stream) {
if (dart.test(this[_socketError])) {
@@ -42076,10 +42923,10 @@
return this.close();
}
let sub = null;
- let controller = async.StreamController.new({onPause: dart.fn(() => dart.dsend(sub, 'pause'), VoidTovoid$()), onResume: dart.fn(() => dart.dsend(sub, 'resume'), VoidTovoid$()), sync: true});
+ let controller = StreamControllerOfListOfint().new({onPause: dart.fn(() => sub.pause(), VoidTovoid$()), onResume: dart.fn(() => sub.resume(), VoidTovoid$()), sync: true});
const onData = (function(data) {
if (dart.test(this[_socketError])) return;
- if (dart.equals(dart.dload(data, 'length'), 0)) return;
+ if (data[dartx.length] == 0) return;
if (dart.test(this.chunked)) {
if (dart.test(this[_gzip])) {
this[_gzipAdd] = dart.bind(controller, 'add');
@@ -42087,28 +42934,28 @@
this[_gzipAdd] = null;
return;
}
- this[_addChunk$](this[_chunkHeader](core.int._check(dart.dload(data, 'length'))), dart.bind(controller, 'add'));
+ this[_addChunk$](this[_chunkHeader](data[dartx.length]), dart.bind(controller, 'add'));
this[_pendingChunkedFooter] = 2;
} else {
if (this.contentLength != null) {
- this[_bytesWritten] = dart.notNull(this[_bytesWritten]) + dart.notNull(core.num._check(dart.dload(data, 'length')));
+ this[_bytesWritten] = dart.notNull(this[_bytesWritten]) + dart.notNull(data[dartx.length]);
if (dart.notNull(this[_bytesWritten]) > dart.notNull(this.contentLength)) {
- controller.addError(new io.HttpException("Content size exceeds specified contentLength. " + dart.str`${this[_bytesWritten]} bytes written while expected ` + dart.str`${this.contentLength}. ` + dart.str`[${core.String.fromCharCodes(IterableOfint()._check(data))}]`));
+ controller.addError(new io.HttpException("Content size exceeds specified contentLength. " + dart.str`${this[_bytesWritten]} bytes written while expected ` + dart.str`${this.contentLength}. ` + dart.str`[${core.String.fromCharCodes(data)}]`));
return;
}
}
}
this[_addChunk$](data, dart.bind(controller, 'add'));
}).bind(this);
- dart.fn(onData, dynamicTovoid$());
+ dart.fn(onData, ListOfintTovoid());
sub = stream.listen(onData, {onError: dart.bind(controller, 'addError'), onDone: dart.bind(controller, 'close'), cancelOnError: true});
if (!dart.test(this.headersWritten)) {
let future = this.writeHeaders();
if (future != null) {
- dart.dsend(sub, 'pause', future);
+ sub.pause(future);
}
}
- return this.socket.addStream(StreamOfListOfint()._check(controller.stream)).then(io._HttpOutboundMessage)(dart.fn(_ => this.outbound, dynamicTo_HttpOutboundMessage()), {onError: dart.fn((error, stackTrace) => {
+ return this.socket.addStream(controller.stream).then(io._HttpOutboundMessage)(dart.fn(_ => this.outbound, dynamicTo_HttpOutboundMessage()), {onError: dart.fn((error, stackTrace) => {
if (dart.test(this[_gzip])) this[_gzipSink].close();
this[_socketError] = true;
this[_doneCompleter].completeError(error, core.StackTrace._check(stackTrace));
@@ -42128,14 +42975,14 @@
this.outbound.headers.chunkedTransferEncoding = false;
this.outbound.headers.contentLength = 0;
} else if (dart.notNull(this.outbound.headers.contentLength) > 0) {
- let error = new io.HttpException("No content even though contentLength was specified to be " + dart.str`greater than 0: ${this.outbound.headers.contentLength}.`, {uri: this.outbound[_uri]});
+ let error = new io.HttpException("No content even though contentLength was specified to be " + dart.str`greater than 0: ${this.outbound.headers.contentLength}.`, {uri: this.outbound[_uri$]});
this[_doneCompleter].completeError(error);
return this[_closeFuture] = async.Future.error(error);
}
}
if (this.contentLength != null) {
if (dart.notNull(this[_bytesWritten]) < dart.notNull(this.contentLength)) {
- let error = new io.HttpException("Content size below specified contentLength. " + dart.str` ${this[_bytesWritten]} bytes written but expected ` + dart.str`${this.contentLength}.`, {uri: this.outbound[_uri]});
+ let error = new io.HttpException("Content size below specified contentLength. " + dart.str` ${this[_bytesWritten]} bytes written but expected ` + dart.str`${this.contentLength}.`, {uri: this.outbound[_uri$]});
this[_doneCompleter].completeError(error);
return this[_closeFuture] = async.Future.error(error);
}
@@ -42181,7 +43028,6 @@
}
setHeader(data, length) {
dart.assert(this[_length$2] == 0);
- dart.assert(data[dartx.length] == io._OUTGOING_BUFFER_SIZE);
this[_buffer$] = typed_data.Uint8List._check(data);
this[_length$2] = length;
}
@@ -42192,10 +43038,10 @@
dart.assert(this[_gzipSink] == null);
this[_gzipSink] = new io.ZLibEncoder({gzip: true}).startChunkedConversion(new io._HttpGZipSink(dart.fn(data => {
if (this[_gzipAdd] == null) return;
- this[_addChunk$](this[_chunkHeader](core.int._check(dart.dload(data, 'length'))), _ChunkedConversionCallbackOfListOfint()._check(this[_gzipAdd]));
+ this[_addChunk$](this[_chunkHeader](data[dartx.length]), this[_gzipAdd]);
this[_pendingChunkedFooter] = 2;
- this[_addChunk$](data, _ChunkedConversionCallbackOfListOfint()._check(this[_gzipAdd]));
- }, dynamicToNull$())));
+ this[_addChunk$](data, this[_gzipAdd]);
+ }, ListOfintToNull())));
}
}
[_ignoreError](error) {
@@ -42203,19 +43049,19 @@
}
[_addGZipChunk](chunk, add) {
if (!dart.test(this.outbound.bufferOutput)) {
- add(ListOfint()._check(chunk));
+ add(chunk);
return;
}
- if (dart.test(dart.dsend(dart.dload(chunk, 'length'), '>', dart.notNull(this[_gzipBuffer][dartx.length]) - dart.notNull(this[_gzipBufferLength])))) {
+ if (dart.notNull(chunk[dartx.length]) > dart.notNull(this[_gzipBuffer][dartx.length]) - dart.notNull(this[_gzipBufferLength])) {
add(typed_data.Uint8List.view(this[_gzipBuffer][dartx.buffer], 0, this[_gzipBufferLength]));
this[_gzipBuffer] = typed_data.Uint8List.new(io._OUTGOING_BUFFER_SIZE);
this[_gzipBufferLength] = 0;
}
- if (dart.test(dart.dsend(dart.dload(chunk, 'length'), '>', io._OUTGOING_BUFFER_SIZE))) {
- add(ListOfint()._check(chunk));
+ if (dart.notNull(chunk[dartx.length]) > io._OUTGOING_BUFFER_SIZE) {
+ add(chunk);
} else {
- this[_gzipBuffer][dartx.setRange](this[_gzipBufferLength], dart.asInt(dart.notNull(this[_gzipBufferLength]) + dart.notNull(core.num._check(dart.dload(chunk, 'length')))), IterableOfint()._check(chunk));
- this[_gzipBufferLength] = dart.notNull(this[_gzipBufferLength]) + dart.notNull(core.num._check(dart.dload(chunk, 'length')));
+ this[_gzipBuffer][dartx.setRange](this[_gzipBufferLength], dart.notNull(this[_gzipBufferLength]) + dart.notNull(chunk[dartx.length]), chunk);
+ this[_gzipBufferLength] = dart.notNull(this[_gzipBufferLength]) + dart.notNull(chunk[dartx.length]);
}
}
[_addChunk$](chunk, add) {
@@ -42225,23 +43071,23 @@
this[_buffer$] = null;
this[_length$2] = 0;
}
- add(ListOfint()._check(chunk));
+ add(chunk);
return;
}
- if (dart.test(dart.dsend(dart.dload(chunk, 'length'), '>', dart.notNull(this[_buffer$][dartx.length]) - dart.notNull(this[_length$2])))) {
+ if (dart.notNull(chunk[dartx.length]) > dart.notNull(this[_buffer$][dartx.length]) - dart.notNull(this[_length$2])) {
add(typed_data.Uint8List.view(this[_buffer$][dartx.buffer], 0, this[_length$2]));
this[_buffer$] = typed_data.Uint8List.new(io._OUTGOING_BUFFER_SIZE);
this[_length$2] = 0;
}
- if (dart.test(dart.dsend(dart.dload(chunk, 'length'), '>', io._OUTGOING_BUFFER_SIZE))) {
- add(ListOfint()._check(chunk));
+ if (dart.notNull(chunk[dartx.length]) > io._OUTGOING_BUFFER_SIZE) {
+ add(chunk);
} else {
- this[_buffer$][dartx.setRange](this[_length$2], dart.asInt(dart.notNull(this[_length$2]) + dart.notNull(core.num._check(dart.dload(chunk, 'length')))), IterableOfint()._check(chunk));
- this[_length$2] = dart.notNull(this[_length$2]) + dart.notNull(core.num._check(dart.dload(chunk, 'length')));
+ this[_buffer$][dartx.setRange](this[_length$2], dart.notNull(this[_length$2]) + dart.notNull(chunk[dartx.length]), chunk);
+ this[_length$2] = dart.notNull(this[_length$2]) + dart.notNull(chunk[dartx.length]);
}
}
[_chunkHeader](length) {
- let hexDigits = const$68 || (const$68 = dart.constList([48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70], core.int));
+ let hexDigits = const$71 || (const$71 = dart.constList([48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70], core.int));
if (length == 0) {
if (this[_pendingChunkedFooter] == 2) return io._HttpOutgoing._footerAndChunk0Length;
return io._HttpOutgoing._chunk0Length;
@@ -42270,7 +43116,7 @@
io._HttpOutgoing[dart.implements] = () => [StreamConsumerOfListOfint()];
dart.setSignature(io._HttpOutgoing, {
fields: () => ({
- [_doneCompleter]: async.Completer,
+ [_doneCompleter]: CompleterOfSocket(),
socket: io.Socket,
ignoreBody: core.bool,
headersWritten: core.bool,
@@ -42283,13 +43129,13 @@
[_bytesWritten]: core.int,
[_gzip]: core.bool,
[_gzipSink]: convert.ByteConversionSink,
- [_gzipAdd]: core.Function,
+ [_gzipAdd]: io._BytesConsumer,
[_gzipBuffer]: typed_data.Uint8List,
[_gzipBufferLength]: core.int,
[_socketError]: core.bool,
outbound: io._HttpOutboundMessage
}),
- getters: () => ({done: dart.definiteFunctionType(async.Future, [])}),
+ getters: () => ({done: dart.definiteFunctionType(async.Future$(io.Socket), [])}),
setters: () => ({gzip: dart.definiteFunctionType(dart.void, [core.bool])}),
methods: () => ({
writeHeaders: dart.definiteFunctionType(async.Future, [], {drainRequest: core.bool, setOutgoing: core.bool}),
@@ -42297,8 +43143,8 @@
close: dart.definiteFunctionType(async.Future, []),
setHeader: dart.definiteFunctionType(dart.void, [ListOfint(), core.int]),
[_ignoreError]: dart.definiteFunctionType(core.bool, [dart.dynamic]),
- [_addGZipChunk]: dart.definiteFunctionType(dart.void, [dart.dynamic, _ChunkedConversionCallbackOfListOfint()]),
- [_addChunk$]: dart.definiteFunctionType(dart.void, [dart.dynamic, _ChunkedConversionCallbackOfListOfint()]),
+ [_addGZipChunk]: dart.definiteFunctionType(dart.void, [ListOfint(), _ChunkedConversionCallbackOfListOfint()]),
+ [_addChunk$]: dart.definiteFunctionType(dart.void, [ListOfint(), _ChunkedConversionCallbackOfListOfint()]),
[_chunkHeader]: dart.definiteFunctionType(core.List$(core.int), [core.int])
})
});
@@ -42406,7 +43252,7 @@
}
}
this[_httpParser].isHead = method == "HEAD";
- this[_streamFuture] = outgoing.done.then(dart.dynamic)(dart.fn(s => {
+ this[_streamFuture] = outgoing.done.then(io.Socket)(dart.fn(s => {
this[_nextResponseCompleter] = CompleterOf_HttpIncoming().new();
this[_nextResponseCompleter].future.then(dart.dynamic)(dart.fn(incoming => {
this[_currentUri] = null;
@@ -42449,13 +43295,13 @@
}, dynamicAnddynamicToNull()));
this[_subscription$].resume();
return s;
- }, dynamicTodynamic$()), {onError: dart.fn(e => {
+ }, SocketToSocket()), {onError: dart.fn(e => {
this.destroy();
}, dynamicToNull$())});
return request;
}
detachSocket() {
- return this[_streamFuture].then(io._DetachedSocket)(dart.fn(_ => new io._DetachedSocket(this[_socket], this[_httpParser].detachIncoming()), dynamicTo_DetachedSocket()));
+ return this[_streamFuture].then(io._DetachedSocket)(dart.fn(_ => new io._DetachedSocket(this[_socket], this[_httpParser].detachIncoming()), SocketTo_DetachedSocket()));
}
destroy() {
this.closed = true;
@@ -42465,12 +43311,12 @@
close() {
this.closed = true;
this[_httpClient][_connectionClosed](this);
- this[_streamFuture].then(dart.void)(dart.fn(_ => this[_socket].destroy(), dynamicTovoid$()));
+ this[_streamFuture].then(dart.void)(dart.fn(_ => this[_socket].destroy(), SocketTovoid()));
}
createProxyTunnel(host, port, proxy, callback) {
- let request = this.send(core.Uri.new({host: core.String._check(host), port: core.int._check(port)}), core.int._check(port), "CONNECT", io._Proxy._check(proxy));
- if (dart.test(dart.dload(proxy, 'isAuthenticated'))) {
- let auth = io._CryptoUtils.bytesToBase64(convert.UTF8.encode(dart.str`${dart.dload(proxy, 'username')}:${dart.dload(proxy, 'password')}`));
+ let request = this.send(core.Uri.new({host: host, port: port}), port, "CONNECT", proxy);
+ if (dart.test(proxy.isAuthenticated)) {
+ let auth = io._CryptoUtils.bytesToBase64(convert.UTF8.encode(dart.str`${proxy.username}:${proxy.password}`));
request.headers.set(io.HttpHeaders.PROXY_AUTHORIZATION, dart.str`Basic ${auth}`);
}
return request.close().then(io.SecureSocket)(dart.fn(response => {
@@ -42478,9 +43324,9 @@
dart.throw("Proxy failed to establish tunnel " + dart.str`(${response.statusCode} ${response.reasonPhrase})`);
}
let socket = io._HttpClientResponse.as(response)[_httpRequest][_httpClientConnection][_socket];
- return io.SecureSocket.secure(socket, {host: host, context: this[_context], onBadCertificate: X509CertificateTobool()._check(callback)});
+ return io.SecureSocket.secure(socket, {host: host, context: this[_context], onBadCertificate: callback});
}, HttpClientResponseToFutureOfSecureSocket())).then(io._HttpClientConnection)(dart.fn(secureSocket => {
- let key = core.String._check(io._HttpClientConnection.makeKey(true, core.String._check(host), core.int._check(port)));
+ let key = core.String._check(io._HttpClientConnection.makeKey(true, host, port));
return new io._HttpClientConnection(key, secureSocket, request[_httpClient], true);
}, SecureSocketTo_HttpClientConnection()));
}
@@ -42518,7 +43364,7 @@
closed: core.bool,
[_currentUri]: core.Uri,
[_nextResponseCompleter]: CompleterOf_HttpIncoming(),
- [_streamFuture]: async.Future
+ [_streamFuture]: FutureOfSocket()
}),
getters: () => ({connectionInfo: dart.definiteFunctionType(io.HttpConnectionInfo, [])}),
methods: () => ({
@@ -42526,7 +43372,7 @@
detachSocket: dart.definiteFunctionType(async.Future$(io.Socket), []),
destroy: dart.definiteFunctionType(dart.void, []),
close: dart.definiteFunctionType(dart.void, []),
- createProxyTunnel: dart.definiteFunctionType(async.Future$(io._HttpClientConnection), [dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic]),
+ createProxyTunnel: dart.definiteFunctionType(async.Future$(io._HttpClientConnection), [core.String, core.int, io._Proxy, X509CertificateTobool()]),
stopTimer: dart.definiteFunctionType(dart.void, []),
startTimer: dart.definiteFunctionType(dart.void, [])
}),
@@ -42620,11 +43466,11 @@
return FutureOf_ConnectionInfo().value(new io._ConnectionInfo(connection, proxy));
}
if (client.maxConnectionsPerHost != null && dart.notNull(this[_active].length) + dart.notNull(this[_connecting]) >= dart.notNull(client.maxConnectionsPerHost)) {
- let completer = async.Completer.new();
+ let completer = CompleterOf_ConnectionInfo().new();
this[_pending$].add(dart.fn(() => {
- this.connect(uriHost, uriPort, proxy, client).then(dart.void)(dart.bind(completer, 'complete'), {onError: dart.bind(completer, 'completeError')});
+ completer.complete(this.connect(uriHost, uriPort, proxy, client));
}, VoidToNull()));
- return FutureOf_ConnectionInfo()._check(completer.future);
+ return completer.future;
}
let currentBadCertificateCallback = client[_badCertificateCallback];
function callback(certificate) {
@@ -42684,7 +43530,7 @@
});
io.BadCertificateCallback = dart.typedef('BadCertificateCallback', () => dart.functionType(core.bool, [io.X509Certificate, core.String, core.int]));
const _idleTimeout = Symbol('_idleTimeout');
-let const$69;
+let const$72;
const _connectionTargets = Symbol('_connectionTargets');
const _credentials = Symbol('_credentials');
const _closing = Symbol('_closing');
@@ -42692,7 +43538,7 @@
const _findProxy = Symbol('_findProxy');
const _openUrl = Symbol('_openUrl');
const _closeConnections = Symbol('_closeConnections');
-let const$70;
+let const$73;
const _getConnection = Symbol('_getConnection');
io._HttpClient = class _HttpClient extends core.Object {
get idleTimeout() {
@@ -42709,7 +43555,7 @@
this[_authenticate] = null;
this[_authenticateProxy] = null;
this[_findProxy] = io.HttpClient.findProxyFromEnvironment;
- this[_idleTimeout] = const$69 || (const$69 = dart.const(new core.Duration({seconds: 15})));
+ this[_idleTimeout] = const$72 || (const$72 = dart.const(new core.Duration({seconds: 15})));
this[_badCertificateCallback] = null;
this.maxConnectionsPerHost = null;
this.autoUncompress = true;
@@ -42827,7 +43673,7 @@
if (port == 0) {
port = isSecure ? io.HttpClient.DEFAULT_HTTPS_PORT : io.HttpClient.DEFAULT_HTTP_PORT;
}
- let proxyConf = const$70 || (const$70 = dart.const(new io._ProxyConfiguration.direct()));
+ let proxyConf = const$73 || (const$73 = dart.const(new io._ProxyConfiguration.direct()));
if (this[_findProxy] != null) {
try {
proxyConf = new io._ProxyConfiguration(core.String._check(dart.dcall(this[_findProxy], uri)));
@@ -43123,7 +43969,7 @@
}
io._HttpConnection._connections[dartx._set](this[_serviceId], this);
- this[_httpParser].listenToStream(StreamOfListOfint()._check(this[_socket]));
+ this[_httpParser].listenToStream(io.Socket.as(this[_socket]));
this[_subscription$] = this[_httpParser].listen(dart.fn(incoming => {
this[_httpServer][_markActive](this);
incoming.dataDone.then(dart.dynamic)(dart.fn(closing => {
@@ -43145,7 +43991,7 @@
} else {
this.destroy();
}
- }, dynamicToNull$()), {onError: dart.fn(_ => {
+ }, SocketToNull()), {onError: dart.fn(_ => {
this.destroy();
}, dynamicToNull$())});
outgoing.ignoreBody = request.method == "HEAD";
@@ -43176,7 +44022,7 @@
let detachedIncoming = this[_httpParser].detachIncoming();
return this[_streamFuture].then(io._DetachedSocket)(dart.fn(_ => {
io._HttpConnection._connections[dartx.remove](this[_serviceId]);
- return new io._DetachedSocket(this[_socket], detachedIncoming);
+ return new io._DetachedSocket(io.Socket._check(this[_socket]), detachedIncoming);
}, dynamicTo_DetachedSocket()));
}
get connectionInfo() {
@@ -43286,8 +44132,8 @@
const _idleConnections = Symbol('_idleConnections');
const _serverSocket = Symbol('_serverSocket');
const _closeServer = Symbol('_closeServer');
-let const$71;
-let const$72;
+let const$74;
+let const$75;
io._HttpServer = class _HttpServer extends dart.mixin(async.Stream$(io.HttpRequest), io._ServiceObject) {
static bind(address, port, backlog, v6Only, shared) {
return io.ServerSocket.bind(address, port, {backlog: backlog, v6Only: v6Only, shared: shared}).then(io._HttpServer)(dart.fn(socket => new io._HttpServer._(socket, true), ServerSocketTo_HttpServer()));
@@ -43310,7 +44156,7 @@
this[_controller$0] = null;
super.new();
this[_controller$0] = StreamControllerOfHttpRequest().new({sync: true, onCancel: dart.bind(this, 'close')});
- this.idleTimeout = const$71 || (const$71 = dart.const(new core.Duration({seconds: 120})));
+ this.idleTimeout = const$74 || (const$74 = dart.const(new core.Duration({seconds: 120})));
io._HttpServer._servers[dartx._set](this[_serviceId], this);
dart.dput(this[_serverSocket], _owner, this);
}
@@ -43329,7 +44175,7 @@
this[_controller$0] = null;
super.new();
this[_controller$0] = StreamControllerOfHttpRequest().new({sync: true, onCancel: dart.bind(this, 'close')});
- this.idleTimeout = const$72 || (const$72 = dart.const(new core.Duration({seconds: 120})));
+ this.idleTimeout = const$75 || (const$75 = dart.const(new core.Duration({seconds: 120})));
io._HttpServer._servers[dartx._set](this[_serviceId], this);
try {
dart.dput(this[_serverSocket], _owner, this);
@@ -43573,8 +44419,8 @@
}),
getters: () => ({isAuthenticated: dart.definiteFunctionType(core.bool, [])})
});
-let const$73;
-let const$74;
+let const$76;
+let const$77;
io._ProxyConfiguration = class _ProxyConfiguration extends core.Object {
new(configuration) {
this.proxies = ListOf_Proxy().new();
@@ -43629,7 +44475,7 @@
}, StringToNull()));
}
direct() {
- this.proxies = const$74 || (const$74 = dart.constList([const$73 || (const$73 = dart.const(new io._Proxy.direct()))], io._Proxy));
+ this.proxies = const$77 || (const$77 = dart.constList([const$76 || (const$76 = dart.const(new io._Proxy.direct()))], io._Proxy));
}
};
dart.defineNamedConstructor(io._ProxyConfiguration, 'direct');
@@ -43681,61 +44527,61 @@
return this[_incoming].listen(onData, {onError: onError, onDone: onDone, cancelOnError: cancelOnError});
}
get encoding() {
- return convert.Encoding._check(dart.dload(this[_socket], 'encoding'));
+ return this[_socket].encoding;
}
set encoding(value) {
- dart.dput(this[_socket], 'encoding', value);
+ this[_socket].encoding = value;
}
write(obj) {
- dart.dsend(this[_socket], 'write', obj);
+ this[_socket].write(obj);
}
writeln(obj) {
if (obj === void 0) obj = "";
- dart.dsend(this[_socket], 'writeln', obj);
+ this[_socket].writeln(obj);
}
writeCharCode(charCode) {
- dart.dsend(this[_socket], 'writeCharCode', charCode);
+ this[_socket].writeCharCode(charCode);
}
writeAll(objects, separator) {
if (separator === void 0) separator = "";
- dart.dsend(this[_socket], 'writeAll', objects, separator);
+ this[_socket].writeAll(objects, separator);
}
add(bytes) {
- dart.dsend(this[_socket], 'add', bytes);
+ this[_socket].add(bytes);
}
addError(error, stackTrace) {
if (stackTrace === void 0) stackTrace = null;
- return dart.dsend(this[_socket], 'addError', error, stackTrace);
+ return this[_socket].addError(error, stackTrace);
}
addStream(stream) {
- return FutureOfSocket()._check(dart.dsend(this[_socket], 'addStream', stream));
+ return this[_socket].addStream(stream);
}
destroy() {
- dart.dsend(this[_socket], 'destroy');
+ this[_socket].destroy();
}
flush() {
- return async.Future._check(dart.dsend(this[_socket], 'flush'));
+ return this[_socket].flush();
}
close() {
- return async.Future._check(dart.dsend(this[_socket], 'close'));
+ return this[_socket].close();
}
get done() {
- return FutureOfSocket()._check(dart.dload(this[_socket], 'done'));
+ return this[_socket].done;
}
get port() {
- return core.int._check(dart.dload(this[_socket], 'port'));
+ return this[_socket].port;
}
get address() {
- return io.InternetAddress._check(dart.dload(this[_socket], 'address'));
+ return this[_socket].address;
}
get remoteAddress() {
- return io.InternetAddress._check(dart.dload(this[_socket], 'remoteAddress'));
+ return this[_socket].remoteAddress;
}
get remotePort() {
- return core.int._check(dart.dload(this[_socket], 'remotePort'));
+ return this[_socket].remotePort;
}
setOption(option, enabled) {
- return core.bool._check(dart.dsend(this[_socket], 'setOption', option, enabled));
+ return this[_socket].setOption(option, enabled);
}
[_toJSON$](ref) {
return core.Map._check(dart.dsend(this[_socket], _toJSON$, ref));
@@ -43749,7 +44595,7 @@
dart.setSignature(io._DetachedSocket, {
fields: () => ({
[_incoming]: StreamOfListOfint(),
- [_socket]: dart.dynamic
+ [_socket]: io.Socket
}),
getters: () => ({
encoding: dart.definiteFunctionType(convert.Encoding, []),
@@ -43771,10 +44617,10 @@
writeAll: dart.definiteFunctionType(dart.void, [core.Iterable], [core.String]),
add: dart.definiteFunctionType(dart.void, [ListOfint()]),
addError: dart.definiteFunctionType(dart.void, [dart.dynamic], [core.StackTrace]),
- addStream: dart.definiteFunctionType(async.Future$(io.Socket), [StreamOfListOfint()]),
+ addStream: dart.definiteFunctionType(async.Future, [StreamOfListOfint()]),
destroy: dart.definiteFunctionType(dart.void, []),
flush: dart.definiteFunctionType(async.Future, []),
- close: dart.definiteFunctionType(async.Future, []),
+ close: dart.definiteFunctionType(async.Future$(io.Socket), []),
setOption: dart.definiteFunctionType(core.bool, [io.SocketOption, core.bool]),
[_toJSON$]: dart.definiteFunctionType(core.Map, [core.bool])
})
@@ -44215,23 +45061,21 @@
this.subscription.onError(onError);
this.subscription.onDone(onDone);
if (this.bufferedData == null) {
- return StreamSubscriptionOfListOfint()._check(((() => {
- this.subscription.resume();
- return this.subscription;
- })()));
+ this.subscription.resume();
+ return this.subscription;
}
- let _ = new io._HttpDetachedStreamSubscription(StreamSubscriptionOfListOfint()._check(this.subscription), this.bufferedData, onData);
+ let _ = new io._HttpDetachedStreamSubscription(this.subscription, this.bufferedData, onData);
_.resume();
return _;
} else {
- return StreamOfint().fromIterable(this.bufferedData).listen(onData, {onError: onError, onDone: onDone, cancelOnError: cancelOnError});
+ return StreamOfListOfint().fromIterable(JSArrayOfListOfint().of([this.bufferedData])).listen(onData, {onError: onError, onDone: onDone, cancelOnError: cancelOnError});
}
}
};
dart.addSimpleTypeTests(io._HttpDetachedIncoming);
dart.setSignature(io._HttpDetachedIncoming, {
fields: () => ({
- subscription: async.StreamSubscription,
+ subscription: StreamSubscriptionOfListOfint(),
bufferedData: ListOfint()
}),
methods: () => ({listen: dart.definiteFunctionType(async.StreamSubscription$(core.List$(core.int)), [_ChunkedConversionCallbackOfListOfint()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool})})
@@ -44242,7 +45086,7 @@
const _headerValue = Symbol('_headerValue');
const _requestParser = Symbol('_requestParser');
const _parserCalled = Symbol('_parserCalled');
-const _index$2 = Symbol('_index');
+const _index$1 = Symbol('_index');
const _httpVersionIndex = Symbol('_httpVersionIndex');
const _messageType = Symbol('_messageType');
const _statusCodeLength = Symbol('_statusCodeLength');
@@ -44283,7 +45127,7 @@
this[_requestParser] = requestParser;
this[_parserCalled] = false;
this[_buffer$] = null;
- this[_index$2] = null;
+ this[_index$1] = null;
this[_state$1] = null;
this[_httpVersionIndex] = null;
this[_messageType] = null;
@@ -44395,14 +45239,14 @@
if (this[_state$1] == io._State.FAILURE) {
dart.throw(new io.HttpException("Data on failed connection"));
}
- while (this[_buffer$] != null && dart.notNull(this[_index$2]) < dart.notNull(this[_buffer$][dartx.length]) && this[_state$1] != io._State.FAILURE && this[_state$1] != io._State.UPGRADED) {
+ while (this[_buffer$] != null && dart.notNull(this[_index$1]) < dart.notNull(this[_buffer$][dartx.length]) && this[_state$1] != io._State.FAILURE && this[_state$1] != io._State.UPGRADED) {
if (this[_incoming] != null && dart.test(this[_bodyPaused]) || this[_incoming] == null && dart.test(this[_paused])) {
this[_parserCalled] = false;
return;
}
let byte = this[_buffer$][dartx._get]((() => {
- let x = this[_index$2];
- this[_index$2] = dart.notNull(x) + 1;
+ let x = this[_index$1];
+ this[_index$1] = dart.notNull(x) + 1;
return x;
})());
switch (this[_state$1]) {
@@ -44583,7 +45427,7 @@
this[_state$1] = io._State.HEADER_ENDING;
} else if (byte == io._CharCode.LF) {
this[_state$1] = io._State.HEADER_ENDING;
- this[_index$2] = dart.notNull(this[_index$2]) - 1;
+ this[_index$1] = dart.notNull(this[_index$1]) - 1;
} else {
this[_headerField][dartx.add](io._HttpParser._toLowerCaseByte(byte));
this[_state$1] = io._State.HEADER_FIELD;
@@ -44658,7 +45502,7 @@
this[_state$1] = io._State.HEADER_ENDING;
} else if (byte == io._CharCode.LF) {
this[_state$1] = io._State.HEADER_ENDING;
- this[_index$2] = dart.notNull(this[_index$2]) - 1;
+ this[_index$1] = dart.notNull(this[_index$1]) - 1;
} else {
this[_headerField][dartx.add](io._HttpParser._toLowerCaseByte(byte));
this[_state$1] = io._State.HEADER_FIELD;
@@ -44732,17 +45576,17 @@
}
case io._State.BODY:
{
- this[_index$2] = dart.notNull(this[_index$2]) - 1;
- let dataAvailable = dart.notNull(this[_buffer$][dartx.length]) - dart.notNull(this[_index$2]);
+ this[_index$1] = dart.notNull(this[_index$1]) - 1;
+ let dataAvailable = dart.notNull(this[_buffer$][dartx.length]) - dart.notNull(this[_index$1]);
if (dart.notNull(this[_remainingContent]) >= 0 && dart.notNull(dataAvailable) > dart.notNull(this[_remainingContent])) {
dataAvailable = this[_remainingContent];
}
- let data = typed_data.Uint8List.view(this[_buffer$][dartx.buffer], dart.notNull(this[_buffer$][dartx.offsetInBytes]) + dart.notNull(this[_index$2]), dataAvailable);
+ let data = typed_data.Uint8List.view(this[_buffer$][dartx.buffer], dart.notNull(this[_buffer$][dartx.offsetInBytes]) + dart.notNull(this[_index$1]), dataAvailable);
this[_bodyController].add(data);
if (this[_remainingContent] != -1) {
this[_remainingContent] = dart.notNull(this[_remainingContent]) - dart.notNull(data[dartx.length]);
}
- this[_index$2] = dart.notNull(this[_index$2]) + dart.notNull(data[dartx.length]);
+ this[_index$1] = dart.notNull(this[_index$1]) + dart.notNull(data[dartx.length]);
if (this[_remainingContent] == 0) {
if (!dart.test(this[_chunked])) {
this[_reset]();
@@ -44766,7 +45610,7 @@
}
}
this[_parserCalled] = false;
- if (this[_buffer$] != null && this[_index$2] == this[_buffer$][dartx.length]) {
+ if (this[_buffer$] != null && this[_index$1] == this[_buffer$][dartx.length]) {
this[_releaseBuffer]();
if (this[_state$1] != io._State.UPGRADED && this[_state$1] != io._State.FAILURE) {
this[_socketSubscription].resume();
@@ -44777,7 +45621,7 @@
this[_socketSubscription].pause();
dart.assert(this[_buffer$] == null);
this[_buffer$] = typed_data.Uint8List._check(buffer);
- this[_index$2] = 0;
+ this[_index$1] = 0;
this[_parse]();
}
[_onDone$]() {
@@ -44850,8 +45694,8 @@
}
readUnparsedData() {
if (this[_buffer$] == null) return null;
- if (this[_index$2] == this[_buffer$][dartx.length]) return null;
- let result = this[_buffer$][dartx.sublist](this[_index$2]);
+ if (this[_index$1] == this[_buffer$][dartx.length]) return null;
+ let result = this[_buffer$][dartx.sublist](this[_index$1]);
this[_releaseBuffer]();
return result;
}
@@ -44876,7 +45720,7 @@
}
[_releaseBuffer]() {
this[_buffer$] = null;
- this[_index$2] = null;
+ this[_index$1] = null;
}
static _isTokenChar(byte) {
return dart.notNull(byte) > 31 && dart.notNull(byte) < 128 && !dart.test(io._Const.SEPARATOR_MAP[dartx._get](byte));
@@ -44996,7 +45840,7 @@
fields: () => ({
[_parserCalled]: core.bool,
[_buffer$]: typed_data.Uint8List,
- [_index$2]: core.int,
+ [_index$1]: core.int,
[_requestParser]: core.bool,
[_state$1]: core.int,
[_httpVersionIndex]: core.int,
@@ -45016,7 +45860,7 @@
[_remainingContent]: core.int,
[_headers]: io._HttpHeaders,
[_incoming]: io._HttpIncoming,
- [_socketSubscription]: async.StreamSubscription,
+ [_socketSubscription]: StreamSubscriptionOfListOfint(),
[_paused]: core.bool,
[_bodyPaused]: core.bool,
[_controller$0]: StreamControllerOf_HttpIncoming(),
@@ -45059,7 +45903,7 @@
names: ['_isTokenChar', '_isValueChar', '_tokenizeFieldValue', '_toLowerCaseByte']
});
io._DART_SESSION_ID = "DARTSESSID";
-const _data$ = Symbol('_data');
+const _data$0 = Symbol('_data');
const _lastSeen = Symbol('_lastSeen');
const _timeoutCallback = Symbol('_timeoutCallback');
const _prev = Symbol('_prev');
@@ -45069,7 +45913,7 @@
const _bumpToEnd = Symbol('_bumpToEnd');
io._HttpSession = class _HttpSession extends core.Object {
new(sessionManager, id) {
- this[_data$] = collection.HashMap.new();
+ this[_data$0] = collection.HashMap.new();
this[_sessionManager] = sessionManager;
this.id = id;
this[_lastSeen] = new core.DateTime.now();
@@ -45098,50 +45942,50 @@
this[_timeoutCallback] = callback;
}
containsValue(value) {
- return this[_data$][dartx.containsValue](value);
+ return this[_data$0][dartx.containsValue](value);
}
containsKey(key) {
- return this[_data$][dartx.containsKey](key);
+ return this[_data$0][dartx.containsKey](key);
}
_get(key) {
- return this[_data$][dartx._get](key);
+ return this[_data$0][dartx._get](key);
}
_set(key, value) {
- this[_data$][dartx._set](key, value);
+ this[_data$0][dartx._set](key, value);
return value;
}
putIfAbsent(key, ifAbsent) {
- return this[_data$][dartx.putIfAbsent](key, ifAbsent);
+ return this[_data$0][dartx.putIfAbsent](key, ifAbsent);
}
addAll(other) {
- return this[_data$][dartx.addAll](other);
+ return this[_data$0][dartx.addAll](other);
}
remove(key) {
- return this[_data$][dartx.remove](key);
+ return this[_data$0][dartx.remove](key);
}
clear() {
- this[_data$][dartx.clear]();
+ this[_data$0][dartx.clear]();
}
forEach(f) {
- this[_data$][dartx.forEach](f);
+ this[_data$0][dartx.forEach](f);
}
get keys() {
- return this[_data$][dartx.keys];
+ return this[_data$0][dartx.keys];
}
get values() {
- return this[_data$][dartx.values];
+ return this[_data$0][dartx.values];
}
get length() {
- return this[_data$][dartx.length];
+ return this[_data$0][dartx.length];
}
get isEmpty() {
- return this[_data$][dartx.isEmpty];
+ return this[_data$0][dartx.isEmpty];
}
get isNotEmpty() {
- return this[_data$][dartx.isNotEmpty];
+ return this[_data$0][dartx.isNotEmpty];
}
toString() {
- return dart.str`HttpSession id:${this.id} ${this[_data$]}`;
+ return dart.str`HttpSession id:${this.id} ${this[_data$0]}`;
}
};
io._HttpSession[dart.implements] = () => [io.HttpSession];
@@ -45155,7 +45999,7 @@
[_prev]: io._HttpSession,
[_next$1]: io._HttpSession,
id: core.String,
- [_data$]: core.Map
+ [_data$0]: core.Map
}),
getters: () => ({
lastSeen: dart.definiteFunctionType(core.DateTime, []),
@@ -45326,7 +46170,7 @@
this.id = io._IOResourceInfo.getNextID();
}
get referenceValueMap() {
- return dart.map({type: dart.str`@${this.type}`, id: this.id, name: this.name}, core.String, core.String);
+ return dart.map({type: dart.str`@${this.type}`, id: this.id, name: this.name}, core.String, core.Object);
}
static getNextID() {
return (() => {
@@ -45341,7 +46185,7 @@
type: core.String,
id: core.int
}),
- getters: () => ({referenceValueMap: dart.definiteFunctionType(core.Map$(core.String, core.String), [])}),
+ getters: () => ({referenceValueMap: dart.definiteFunctionType(core.Map$(core.String, dart.dynamic), [])}),
statics: () => ({getNextID: dart.definiteFunctionType(core.int, [])}),
names: ['getNextID']
});
@@ -45382,7 +46226,7 @@
super.new(type);
}
get fullValueMap() {
- return dart.map({type: this.type, id: this.id, name: this.name, totalRead: this.totalRead, totalWritten: this.totalWritten, readCount: this.readCount, writeCount: this.writeCount, lastRead: this.lastRead, lastWrite: this.lastWrite}, core.String, core.String);
+ return dart.map({type: this.type, id: this.id, name: this.name, totalRead: this.totalRead, totalWritten: this.totalWritten, readCount: this.readCount, writeCount: this.writeCount, lastRead: this.lastRead, lastWrite: this.lastWrite}, core.String, core.Object);
}
};
dart.setSignature(io._ReadWriteResourceInfo, {
@@ -45394,7 +46238,7 @@
lastRead: core.double,
lastWrite: core.double
}),
- getters: () => ({fullValueMap: dart.definiteFunctionType(core.Map$(core.String, core.String), [])}),
+ getters: () => ({fullValueMap: dart.definiteFunctionType(core.Map$(core.String, dart.dynamic), [])}),
methods: () => ({
addRead: dart.definiteFunctionType(dart.void, [core.int]),
didRead: dart.definiteFunctionType(dart.void, []),
@@ -45416,7 +46260,7 @@
io._FileResourceInfo.openFiles[dartx.remove](info.id);
}
static getOpenFilesList() {
- return ListOfMapOfString$String().from(io._FileResourceInfo.openFiles[dartx.values][dartx.map](MapOfString$String())(dart.fn(e => e.referenceValueMap, _FileResourceInfoToMapOfString$String())));
+ return ListOfMapOfString$String().from(io._FileResourceInfo.openFiles[dartx.values][dartx.map](MapOfString$dynamic())(dart.fn(e => e.referenceValueMap, _FileResourceInfoToMapOfString$dynamic())));
}
static getOpenFiles(func, params) {
dart.assert(dart.equals(func, 'ext.dart.io.getOpenFiles'));
@@ -45425,8 +46269,7 @@
return FutureOfServiceExtensionResponse().value(new developer.ServiceExtensionResponse.result(json));
}
getFileInfoMap() {
- let result = this.fullValueMap;
- return result;
+ return this.fullValueMap;
}
static getFileInfoMapByID(func, params) {
dart.assert(dart.dsend(params, 'containsKey', 'id'));
@@ -45442,7 +46285,7 @@
dart.setSignature(io._FileResourceInfo, {
fields: () => ({file: dart.dynamic}),
getters: () => ({name: dart.definiteFunctionType(core.String, [])}),
- methods: () => ({getFileInfoMap: dart.definiteFunctionType(core.Map$(core.String, core.String), [])}),
+ methods: () => ({getFileInfoMap: dart.definiteFunctionType(core.Map$(core.String, dart.dynamic), [])}),
statics: () => ({
FileOpened: dart.definiteFunctionType(dart.dynamic, [io._FileResourceInfo]),
FileClosed: dart.definiteFunctionType(dart.dynamic, [io._FileResourceInfo]),
@@ -45469,13 +46312,13 @@
io._ProcessResourceInfo.ProcessStarted(this);
}
get name() {
- return core.String._check(dart.dload(this.process, _path$));
+ return core.String._check(dart.dload(this.process, _path));
}
stopped() {
io._ProcessResourceInfo.ProcessStopped(this);
}
get fullValueMap() {
- return dart.map({type: this.type, id: this.id, name: this.name, pid: core.String._check(dart.dload(this.process, 'pid')), startedAt: this.startedAt, arguments: core.String._check(dart.dload(this.process, _arguments$0)), workingDirectory: core.String._check(dart.dload(this.process, _workingDirectory) == null ? '.' : dart.dload(this.process, _workingDirectory))}, core.String, core.String);
+ return dart.map({type: this.type, id: this.id, name: this.name, pid: dart.dload(this.process, 'pid'), startedAt: this.startedAt, arguments: dart.dload(this.process, _arguments$0), workingDirectory: dart.dload(this.process, _workingDirectory) == null ? '.' : dart.dload(this.process, _workingDirectory)}, core.String, core.Object);
}
static ProcessStarted(info) {
dart.assert(!dart.test(io._ProcessResourceInfo.startedProcesses[dartx.containsKey](info.id)));
@@ -45486,7 +46329,7 @@
io._ProcessResourceInfo.startedProcesses[dartx.remove](info.id);
}
static getStartedProcessesList() {
- return ListOfMapOfString$String().from(io._ProcessResourceInfo.startedProcesses[dartx.values][dartx.map](MapOfString$String())(dart.fn(e => e.referenceValueMap, _ProcessResourceInfoToMapOfString$String())));
+ return ListOfMapOfString$String().from(io._ProcessResourceInfo.startedProcesses[dartx.values][dartx.map](MapOfString$dynamic())(dart.fn(e => e.referenceValueMap, _ProcessResourceInfoToMapOfString$dynamic())));
}
static getStartedProcesses(func, params) {
dart.assert(func == 'ext.dart.io.getProcesses');
@@ -45508,7 +46351,7 @@
}),
getters: () => ({
name: dart.definiteFunctionType(core.String, []),
- fullValueMap: dart.definiteFunctionType(core.Map$(core.String, core.String), [])
+ fullValueMap: dart.definiteFunctionType(core.Map$(core.String, dart.dynamic), [])
}),
methods: () => ({stopped: dart.definiteFunctionType(dart.void, [])}),
statics: () => ({
@@ -45548,18 +46391,18 @@
return dart.str`${dart.dload(dart.dload(this.socket, 'address'), 'host')}:${dart.dload(this.socket, 'port')}${remote}`;
}
static getOpenSocketsList() {
- return ListOfMapOfString$String().from(io._SocketResourceInfo.openSockets[dartx.values][dartx.map](MapOfString$String())(dart.fn(e => e.referenceValueMap, _SocketResourceInfoToMapOfString$String())));
+ return ListOfMapOfString$String().from(io._SocketResourceInfo.openSockets[dartx.values][dartx.map](MapOfString$dynamic())(dart.fn(e => e.referenceValueMap, _SocketResourceInfoToMapOfString$dynamic())));
}
getSocketInfoMap() {
let result = this.fullValueMap;
result[dartx._set]('socketType', dart.test(dart.dload(this.socket, 'isTcp')) ? io._SocketResourceInfo.TCP_STRING : io._SocketResourceInfo.UDP_STRING);
- result[dartx._set]('listening', core.String._check(dart.dload(this.socket, 'isListening')));
- result[dartx._set]('host', core.String._check(dart.dload(dart.dload(this.socket, 'address'), 'host')));
- result[dartx._set]('port', core.String._check(dart.dload(this.socket, 'port')));
+ result[dartx._set]('listening', dart.dload(this.socket, 'isListening'));
+ result[dartx._set]('host', dart.dload(dart.dload(this.socket, 'address'), 'host'));
+ result[dartx._set]('port', dart.dload(this.socket, 'port'));
if (!dart.test(dart.dload(this.socket, 'isListening'))) {
try {
- result[dartx._set]('remoteHost', core.String._check(dart.dload(dart.dload(this.socket, 'remoteAddress'), 'host')));
- result[dartx._set]('remotePort', core.String._check(dart.dload(this.socket, 'remotePort')));
+ result[dartx._set]('remoteHost', dart.dload(dart.dload(this.socket, 'remoteAddress'), 'host'));
+ result[dartx._set]('remotePort', dart.dload(this.socket, 'remotePort'));
} catch (e) {
result[dartx._set]('remotePort', 'NA');
result[dartx._set]('remoteHost', 'NA');
@@ -45569,7 +46412,7 @@
result[dartx._set]('remotePort', 'NA');
result[dartx._set]('remoteHost', 'NA');
}
- result[dartx._set]('addressType', core.String._check(dart.dload(dart.dload(dart.dload(this.socket, 'address'), 'type'), 'name')));
+ result[dartx._set]('addressType', dart.dload(dart.dload(dart.dload(this.socket, 'address'), 'type'), 'name'));
return result;
}
static getSocketInfoMapByID(func, params) {
@@ -45597,7 +46440,7 @@
dart.setSignature(io._SocketResourceInfo, {
fields: () => ({socket: dart.dynamic}),
getters: () => ({name: dart.definiteFunctionType(core.String, [])}),
- methods: () => ({getSocketInfoMap: dart.definiteFunctionType(core.Map$(core.String, core.String), [])}),
+ methods: () => ({getSocketInfoMap: dart.definiteFunctionType(core.Map$(core.String, dart.dynamic), [])}),
statics: () => ({
getOpenSocketsList: dart.definiteFunctionType(core.Iterable$(core.Map$(core.String, core.String)), []),
getSocketInfoMapByID: dart.definiteFunctionType(async.Future$(developer.ServiceExtensionResponse), [core.String, MapOfString$String()]),
@@ -45639,33 +46482,36 @@
io._FILE_TRUNCATE = 10;
io._FILE_LENGTH = 11;
io._FILE_LENGTH_FROM_PATH = 12;
-io._FILE_LAST_MODIFIED = 13;
-io._FILE_FLUSH = 14;
-io._FILE_READ_BYTE = 15;
-io._FILE_WRITE_BYTE = 16;
-io._FILE_READ = 17;
-io._FILE_READ_INTO = 18;
-io._FILE_WRITE_FROM = 19;
-io._FILE_CREATE_LINK = 20;
-io._FILE_DELETE_LINK = 21;
-io._FILE_RENAME_LINK = 22;
-io._FILE_LINK_TARGET = 23;
-io._FILE_TYPE = 24;
-io._FILE_IDENTICAL = 25;
-io._FILE_STAT = 26;
-io._FILE_LOCK = 27;
-io._SOCKET_LOOKUP = 28;
-io._SOCKET_LIST_INTERFACES = 29;
-io._SOCKET_REVERSE_LOOKUP = 30;
-io._DIRECTORY_CREATE = 31;
-io._DIRECTORY_DELETE = 32;
-io._DIRECTORY_EXISTS = 33;
-io._DIRECTORY_CREATE_TEMP = 34;
-io._DIRECTORY_LIST_START = 35;
-io._DIRECTORY_LIST_NEXT = 36;
-io._DIRECTORY_LIST_STOP = 37;
-io._DIRECTORY_RENAME = 38;
-io._SSL_PROCESS_FILTER = 39;
+io._FILE_LAST_ACCESSED = 13;
+io._FILE_SET_LAST_ACCESSED = 14;
+io._FILE_LAST_MODIFIED = 15;
+io._FILE_SET_LAST_MODIFIED = 16;
+io._FILE_FLUSH = 17;
+io._FILE_READ_BYTE = 18;
+io._FILE_WRITE_BYTE = 19;
+io._FILE_READ = 20;
+io._FILE_READ_INTO = 21;
+io._FILE_WRITE_FROM = 22;
+io._FILE_CREATE_LINK = 23;
+io._FILE_DELETE_LINK = 24;
+io._FILE_RENAME_LINK = 25;
+io._FILE_LINK_TARGET = 26;
+io._FILE_TYPE = 27;
+io._FILE_IDENTICAL = 28;
+io._FILE_STAT = 29;
+io._FILE_LOCK = 30;
+io._SOCKET_LOOKUP = 31;
+io._SOCKET_LIST_INTERFACES = 32;
+io._SOCKET_REVERSE_LOOKUP = 33;
+io._DIRECTORY_CREATE = 34;
+io._DIRECTORY_DELETE = 35;
+io._DIRECTORY_EXISTS = 36;
+io._DIRECTORY_CREATE_TEMP = 37;
+io._DIRECTORY_LIST_START = 38;
+io._DIRECTORY_LIST_NEXT = 39;
+io._DIRECTORY_LIST_STOP = 40;
+io._DIRECTORY_RENAME = 41;
+io._SSL_PROCESS_FILTER = 42;
io._IOService = class _IOService extends core.Object {
static _dispatch(request, data) {
dart.throw(new core.UnsupportedError("_IOService._dispatch"));
@@ -45705,12 +46551,6 @@
get absolute() {
return io.Link.new(this[_absolutePath]);
}
- stat() {
- return io.FileStat.stat(this.path);
- }
- statSync() {
- return io.FileStat.statSync(this.path);
- }
create(target, opts) {
let recursive = opts && 'recursive' in opts ? opts.recursive : false;
if (dart.test(io.Platform.isWindows)) {
@@ -45834,8 +46674,6 @@
methods: () => ({
exists: dart.definiteFunctionType(async.Future$(core.bool), []),
existsSync: dart.definiteFunctionType(core.bool, []),
- stat: dart.definiteFunctionType(async.Future$(io.FileStat), []),
- statSync: dart.definiteFunctionType(io.FileStat, []),
create: dart.definiteFunctionType(async.Future$(io.Link), [core.String], {recursive: core.bool}),
createSync: dart.definiteFunctionType(dart.void, [core.String], {recursive: core.bool}),
[_makeWindowsLinkTarget]: dart.definiteFunctionType(core.String, [core.String]),
@@ -45921,6 +46759,9 @@
},
get isIOS() {
return io.Platform._operatingSystem == "ios";
+ },
+ get isFuchsia() {
+ return io.Platform._operatingSystem == "fuchsia";
}
});
io._Platform = class _Platform extends core.Object {
@@ -45982,14 +46823,17 @@
let env = io._Platform._environment();
if (!io.OSError.is(env)) {
let isWindows = io._Platform.operatingSystem == 'windows';
- let result = isWindows ? new io._CaseInsensitiveStringMap() : core.Map.new();
+ let result = isWindows ? new (_CaseInsensitiveStringMapOfString())() : MapOfString$String().new();
for (let str of core.Iterable._check(env)) {
+ if (str == null) {
+ continue;
+ }
let equalsIndex = dart.dsend(str, 'indexOf', '=');
if (dart.test(dart.dsend(equalsIndex, '>', 0))) {
- result[dartx._set](dart.dsend(str, 'substring', 0, equalsIndex), dart.dsend(str, 'substring', dart.dsend(equalsIndex, '+', 1)));
+ result[dartx._set](core.String._check(dart.dsend(str, 'substring', 0, equalsIndex)), core.String._check(dart.dsend(str, 'substring', dart.dsend(equalsIndex, '+', 1))));
}
}
- io._Platform._environmentCache = new (UnmodifiableMapViewOfString$String())(MapOfString$String()._check(result));
+ io._Platform._environmentCache = new (UnmodifiableMapViewOfString$String())(result);
} else {
io._Platform._environmentCache = env;
}
@@ -45997,7 +46841,7 @@
if (io.OSError.is(io._Platform._environmentCache)) {
dart.throw(io._Platform._environmentCache);
} else {
- return MapOfString$String()._check(io._Platform._environmentCache);
+ return MapOfString$String().as(io._Platform._environmentCache);
}
}
static get version() {
@@ -46045,6 +46889,7 @@
let MapOfString$V = () => (MapOfString$V = dart.constFn(core.Map$(core.String, V)))();
let VoidToV = () => (VoidToV = dart.constFn(dart.functionType(V, [])))();
let StringAndVTovoid = () => (StringAndVTovoid = dart.constFn(dart.functionType(dart.void, [core.String, V])))();
+ let StringAndVToV = () => (StringAndVToV = dart.constFn(dart.definiteFunctionType(V, [core.String, V])))();
class _CaseInsensitiveStringMap extends core.Object {
new() {
this[_map$1] = MapOfString$V().new();
@@ -46068,7 +46913,8 @@
return this[_map$1][dartx.putIfAbsent](key[dartx.toUpperCase](), ifAbsent);
}
addAll(other) {
- other[dartx.forEach](dart.fn((key, value) => this._set(core.String._check(dart.dsend(key, 'toUpperCase')), V._check(value)), dynamicAnddynamicTovoid$()));
+ MapOfString$V()._check(other);
+ other[dartx.forEach](dart.fn((key, value) => this._set(key[dartx.toUpperCase](), value), StringAndVToV()));
}
remove(key) {
return typeof key == 'string' ? this[_map$1][dartx.remove](key[dartx.toUpperCase]()) : null;
@@ -46115,7 +46961,7 @@
_get: dart.definiteFunctionType(V, [core.Object]),
_set: dart.definiteFunctionType(dart.void, [core.String, V]),
putIfAbsent: dart.definiteFunctionType(V, [core.String, VoidToV()]),
- addAll: dart.definiteFunctionType(dart.void, [core.Map]),
+ addAll: dart.definiteFunctionType(dart.void, [MapOfString$V()]),
remove: dart.definiteFunctionType(V, [core.Object]),
clear: dart.definiteFunctionType(dart.void, []),
forEach: dart.definiteFunctionType(dart.void, [StringAndVTovoid()])
@@ -46223,9 +47069,6 @@
'DETACHED_WITH_STDIO'
]);
io.Process = class Process extends core.Object {
- new() {
- this.exitCode = null;
- }
static start(executable, arguments$, opts) {
let workingDirectory = opts && 'workingDirectory' in opts ? opts.workingDirectory : null;
let environment = opts && 'environment' in opts ? opts.environment : null;
@@ -46258,7 +47101,6 @@
}
};
dart.setSignature(io.Process, {
- fields: () => ({exitCode: FutureOfint()}),
statics: () => ({
start: dart.definiteFunctionType(async.Future$(io.Process), [core.String, ListOfString()], {workingDirectory: core.String, environment: MapOfString$String(), includeParentEnvironment: core.bool, runInShell: core.bool, mode: io.ProcessStartMode}),
run: dart.definiteFunctionType(async.Future$(io.ProcessResult), [core.String, ListOfString()], {workingDirectory: core.String, environment: MapOfString$String(), includeParentEnvironment: core.bool, runInShell: core.bool, stdoutEncoding: convert.Encoding, stderrEncoding: convert.Encoding}),
@@ -46454,22 +47296,14 @@
let host = opts && 'host' in opts ? opts.host : null;
let context = opts && 'context' in opts ? opts.context : null;
let onBadCertificate = opts && 'onBadCertificate' in opts ? opts.onBadCertificate : null;
- let completer = async.Completer.new();
- dart.dsend(dart.dsend(dart.dsend(socket, _detachRaw), 'then', dart.fn(detachedRaw => io.RawSecureSocket.secure(io.RawSocket._check(dart.dindex(detachedRaw, 0)), {subscription: async.StreamSubscription._check(dart.dindex(detachedRaw, 1)), host: host, context: context, onBadCertificate: onBadCertificate}), dynamicToFutureOfRawSecureSocket())), 'then', dart.fn(raw => {
- completer.complete(io.SecureSocket._(io.RawSecureSocket._check(raw)));
- }, dynamicToNull$()));
- return FutureOfSecureSocket()._check(completer.future);
+ return async.Future.as(dart.dsend(socket, _detachRaw)).then(io.RawSecureSocket)(dart.fn(detachedRaw => io.RawSecureSocket.secure(io.RawSocket.as(dart.dindex(detachedRaw, 0)), {subscription: StreamSubscriptionOfRawSocketEvent().as(dart.dindex(detachedRaw, 1)), host: host, context: context, onBadCertificate: onBadCertificate}), dynamicToFutureOfRawSecureSocket())).then(io.SecureSocket)(dart.fn(raw => io.SecureSocket._(raw), RawSecureSocketToSecureSocket()));
}
static secureServer(socket, context, opts) {
let bufferedData = opts && 'bufferedData' in opts ? opts.bufferedData : null;
let requestClientCertificate = opts && 'requestClientCertificate' in opts ? opts.requestClientCertificate : false;
let requireClientCertificate = opts && 'requireClientCertificate' in opts ? opts.requireClientCertificate : false;
let supportedProtocols = opts && 'supportedProtocols' in opts ? opts.supportedProtocols : null;
- let completer = async.Completer.new();
- dart.dsend(dart.dsend(dart.dsend(socket, _detachRaw), 'then', dart.fn(detachedRaw => io.RawSecureSocket.secureServer(io.RawSocket._check(dart.dindex(detachedRaw, 0)), context, {subscription: async.StreamSubscription._check(dart.dindex(detachedRaw, 1)), bufferedData: bufferedData, requestClientCertificate: requestClientCertificate, requireClientCertificate: requireClientCertificate, supportedProtocols: supportedProtocols}), dynamicToFutureOfRawSecureSocket())), 'then', dart.fn(raw => {
- completer.complete(io.SecureSocket._(io.RawSecureSocket._check(raw)));
- }, dynamicToNull$()));
- return FutureOfSecureSocket()._check(completer.future);
+ return async.Future.as(dart.dsend(socket, _detachRaw)).then(io.RawSecureSocket)(dart.fn(detachedRaw => io.RawSecureSocket.secureServer(io.RawSocket.as(dart.dindex(detachedRaw, 0)), context, {subscription: StreamSubscriptionOfRawSocketEvent().as(dart.dindex(detachedRaw, 1)), bufferedData: bufferedData, requestClientCertificate: requestClientCertificate, requireClientCertificate: requireClientCertificate, supportedProtocols: supportedProtocols}), dynamicToFutureOfRawSecureSocket())).then(io.SecureSocket)(dart.fn(raw => io.SecureSocket._(raw), RawSecureSocketToSecureSocket()));
}
};
io.SecureSocket[dart.implements] = () => [io.Socket];
@@ -46565,8 +47399,8 @@
dart.setSignature(io.RawSecureSocket, {
statics: () => ({
connect: dart.definiteFunctionType(async.Future$(io.RawSecureSocket), [dart.dynamic, core.int], {context: io.SecurityContext, onBadCertificate: X509CertificateTobool(), supportedProtocols: ListOfString()}),
- secure: dart.definiteFunctionType(async.Future$(io.RawSecureSocket), [io.RawSocket], {subscription: async.StreamSubscription, host: dart.dynamic, context: io.SecurityContext, onBadCertificate: X509CertificateTobool(), supportedProtocols: ListOfString()}),
- secureServer: dart.definiteFunctionType(async.Future$(io.RawSecureSocket), [io.RawSocket, io.SecurityContext], {subscription: async.StreamSubscription, bufferedData: ListOfint(), requestClientCertificate: core.bool, requireClientCertificate: core.bool, supportedProtocols: ListOfString()})
+ secure: dart.definiteFunctionType(async.Future$(io.RawSecureSocket), [io.RawSocket], {subscription: StreamSubscriptionOfRawSocketEvent(), host: dart.dynamic, context: io.SecurityContext, onBadCertificate: X509CertificateTobool(), supportedProtocols: ListOfString()}),
+ secureServer: dart.definiteFunctionType(async.Future$(io.RawSecureSocket), [io.RawSocket, io.SecurityContext], {subscription: StreamSubscriptionOfRawSocketEvent(), bufferedData: ListOfint(), requestClientCertificate: core.bool, requireClientCertificate: core.bool, supportedProtocols: ListOfString()})
}),
names: ['connect', 'secure', 'secureServer']
});
@@ -46737,13 +47571,13 @@
const _pushAllFilterStages = Symbol('_pushAllFilterStages');
const _readSocketOrBufferedData = Symbol('_readSocketOrBufferedData');
const _sendReadEvent = Symbol('_sendReadEvent');
-let const$75;
+let const$78;
io.RawSocketEvent = class RawSocketEvent extends core.Object {
_(value) {
this[_value$1] = value;
}
toString() {
- return (const$75 || (const$75 = dart.constList(['RawSocketEvent:READ', 'RawSocketEvent:WRITE', 'RawSocketEvent:READ_CLOSED', 'RawSocketEvent:CLOSED'], core.String)))[dartx._get](this[_value$1]);
+ return (const$78 || (const$78 = dart.constList(['RawSocketEvent:READ', 'RawSocketEvent:WRITE', 'RawSocketEvent:READ_CLOSED', 'RawSocketEvent:CLOSED'], core.String)))[dartx._get](this[_value$1]);
}
};
dart.defineNamedConstructor(io.RawSocketEvent, '_');
@@ -46784,12 +47618,12 @@
if (host != null) {
address = io.InternetAddress._cloneWithNewHost(address, core.String._check(host));
}
- return new io._RawSecureSocket(address, requestedPort, is_server, context, socket, StreamSubscriptionOfRawSocketEvent()._check(subscription), bufferedData, requestClientCertificate, requireClientCertificate, onBadCertificate, supportedProtocols)[_handshakeComplete].future;
+ return new io._RawSecureSocket(address, requestedPort, is_server, context, socket, subscription, bufferedData, requestClientCertificate, requireClientCertificate, onBadCertificate, supportedProtocols)[_handshakeComplete].future;
}
new(address, requestedPort, is_server, context, socket, socketSubscription, bufferedData, requestClientCertificate, requireClientCertificate, onBadCertificate, supportedProtocols) {
this[_handshakeComplete] = CompleterOf_RawSecureSocket().new();
this[_status] = io._RawSecureSocket.HANDSHAKE;
- this[_closeCompleter] = async.Completer.new();
+ this[_closeCompleter] = CompleterOfRawSecureSocket().new();
this[_filterStatus] = new io._FilterStatus();
this[_secureFilter] = io._SecureFilter.new();
this.address = address;
@@ -46899,7 +47733,7 @@
}
close() {
this.shutdown(io.SocketDirection.BOTH);
- return FutureOfRawSecureSocket()._check(this[_closeCompleter].future);
+ return this[_closeCompleter].future;
}
[_completeCloseCompleter](dummy) {
if (dummy === void 0) dummy = null;
@@ -47345,7 +48179,7 @@
[_socketClosedWrite]: core.bool,
[_closedRead]: core.bool,
[_closedWrite]: core.bool,
- [_closeCompleter]: async.Completer,
+ [_closeCompleter]: CompleterOfRawSecureSocket(),
[_filterStatus]: io._FilterStatus,
[_connectPending]: core.bool,
[_filterPending]: core.bool,
@@ -47371,7 +48205,7 @@
listen: dart.definiteFunctionType(async.StreamSubscription$(io.RawSocketEvent), [RawSocketEventTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool}),
available: dart.definiteFunctionType(core.int, []),
close: dart.definiteFunctionType(async.Future$(io.RawSecureSocket), []),
- [_completeCloseCompleter]: dart.definiteFunctionType(dart.void, [], [dart.dynamic]),
+ [_completeCloseCompleter]: dart.definiteFunctionType(dart.void, [], [io.RawSocket]),
[_close$0]: dart.definiteFunctionType(dart.void, []),
shutdown: dart.definiteFunctionType(dart.void, [io.SocketDirection]),
read: dart.definiteFunctionType(core.List$(core.int), [], [core.int]),
@@ -47401,7 +48235,7 @@
}),
statics: () => ({
_isBufferEncrypted: dart.definiteFunctionType(core.bool, [core.int]),
- connect: dart.definiteFunctionType(async.Future$(io._RawSecureSocket), [dart.dynamic, core.int], {is_server: core.bool, context: io.SecurityContext, socket: io.RawSocket, subscription: async.StreamSubscription, bufferedData: ListOfint(), requestClientCertificate: core.bool, requireClientCertificate: core.bool, onBadCertificate: X509CertificateTobool(), supportedProtocols: ListOfString()}),
+ connect: dart.definiteFunctionType(async.Future$(io._RawSecureSocket), [dart.dynamic, core.int], {is_server: core.bool, context: io.SecurityContext, socket: io.RawSocket, subscription: StreamSubscriptionOfRawSocketEvent(), bufferedData: ListOfint(), requestClientCertificate: core.bool, requireClientCertificate: core.bool, onBadCertificate: X509CertificateTobool(), supportedProtocols: ListOfString()}),
_verifyFields: dart.definiteFunctionType(dart.void, [dart.dynamic, core.int, core.bool, core.bool, core.bool, core.Function])
}),
names: ['_isBufferEncrypted', 'connect', '_verifyFields']
@@ -47507,7 +48341,7 @@
while (true) {
let toWrite = this.linearLength;
if (toWrite == 0) return false;
- let bytes = socket.write(ListOfint()._check(this.data), this.start, toWrite);
+ let bytes = socket.write(this.data, this.start, toWrite);
this.advanceStart(bytes);
if (dart.notNull(bytes) < dart.notNull(toWrite)) {
return true;
@@ -47517,7 +48351,7 @@
};
dart.setSignature(io._ExternalBuffer, {
fields: () => ({
- data: core.List,
+ data: ListOfint(),
start: core.int,
end: core.int,
size: dart.dynamic
@@ -47981,7 +48815,7 @@
let retainNewlines = opts && 'retainNewlines' in opts ? opts.retainNewlines : false;
let CR = 13;
let LF = 10;
- let line = [];
+ let line = JSArrayOfint().of([]);
let crIsNewline = dart.test(io.Platform.isWindows) && dart.equals(io.stdioType(io.stdin), io.StdioType.TERMINAL) && !dart.test(/* Unimplemented unknown name */lineMode);
if (dart.test(retainNewlines)) {
let byte = null;
@@ -48024,7 +48858,7 @@
line[dartx.add](byte);
}
}
- return encoding.decode(ListOfint()._check(line));
+ return encoding.decode(line);
}
set echoMode(enabled) {
dart.throw(new core.UnsupportedError("Stdin.echoMode"));
@@ -48061,9 +48895,11 @@
const _hasTerminal = Symbol('_hasTerminal');
const _terminalColumns = Symbol('_terminalColumns');
const _terminalLines = Symbol('_terminalLines');
-io._StdSink = class _StdSink extends core.Object {
- new(sink) {
+const _isTranslatable = Symbol('_isTranslatable');
+io._StdSinkHelper = class _StdSinkHelper extends core.Object {
+ new(sink, isTranslatable) {
this[_sink$0] = sink;
+ this[_isTranslatable] = isTranslatable;
}
get encoding() {
return this[_sink$0].encoding;
@@ -48071,18 +48907,29 @@
set encoding(encoding) {
this[_sink$0].encoding = encoding;
}
+ set [_translation](t) {
+ if (dart.test(this[_isTranslatable])) {
+ let sink = io._IOSinkImpl._check(this[_sink$0]);
+ let target = io._StdConsumer._check(sink[_target$]);
+ dart.dput(target[_file], 'translation', t);
+ }
+ }
write(object) {
+ this[_translation] = io._FileTranslation.text;
this[_sink$0].write(object);
}
writeln(object) {
if (object === void 0) object = "";
+ this[_translation] = io._FileTranslation.text;
this[_sink$0].writeln(object);
}
writeAll(objects, sep) {
if (sep === void 0) sep = "";
+ this[_translation] = io._FileTranslation.text;
this[_sink$0].writeAll(objects, sep);
}
add(data) {
+ this[_translation] = io._FileTranslation.binary;
this[_sink$0].add(data);
}
addError(error, stackTrace) {
@@ -48090,9 +48937,11 @@
this[_sink$0].addError(error, stackTrace);
}
writeCharCode(charCode) {
+ this[_translation] = io._FileTranslation.text;
this[_sink$0].writeCharCode(charCode);
}
addStream(stream) {
+ this[_translation] = io._FileTranslation.binary;
return this[_sink$0].addStream(stream);
}
flush() {
@@ -48105,14 +48954,20 @@
return this[_sink$0].done;
}
};
-io._StdSink[dart.implements] = () => [io.IOSink];
-dart.setSignature(io._StdSink, {
- fields: () => ({[_sink$0]: io.IOSink}),
+io._StdSinkHelper[dart.implements] = () => [io.IOSink];
+dart.setSignature(io._StdSinkHelper, {
+ fields: () => ({
+ [_sink$0]: io.IOSink,
+ [_isTranslatable]: core.bool
+ }),
getters: () => ({
encoding: dart.definiteFunctionType(convert.Encoding, []),
done: dart.definiteFunctionType(async.Future, [])
}),
- setters: () => ({encoding: dart.definiteFunctionType(dart.void, [convert.Encoding])}),
+ setters: () => ({
+ encoding: dart.definiteFunctionType(dart.void, [convert.Encoding]),
+ [_translation]: dart.definiteFunctionType(dart.void, [io._FileTranslation])
+ }),
methods: () => ({
write: dart.definiteFunctionType(dart.void, [core.Object]),
writeln: dart.definiteFunctionType(dart.void, [], [core.Object]),
@@ -48125,7 +48980,12 @@
close: dart.definiteFunctionType(async.Future, [])
})
});
-io.Stdout = class Stdout extends io._StdSink {
+io._StdFileSink = class _StdFileSink extends io._StdSinkHelper {
+ new(sink) {
+ super.new(sink, true);
+ }
+};
+io.Stdout = class Stdout extends io._StdFileSink {
_(sink, fd) {
this[_fd] = fd;
this[_nonBlocking] = null;
@@ -48192,6 +49052,23 @@
osError: io.OSError
})
});
+io.StdinException = class StdinException extends core.Object {
+ new(message, osError) {
+ if (osError === void 0) osError = null;
+ this.message = message;
+ this.osError = osError;
+ }
+ toString() {
+ return dart.str`StdinException: ${this.message}${this.osError == null ? "" : dart.str`, ${this.osError}`}`;
+ }
+};
+io.StdinException[dart.implements] = () => [io.IOException];
+dart.setSignature(io.StdinException, {
+ fields: () => ({
+ message: core.String,
+ osError: io.OSError
+ })
+});
io._StdConsumer = class _StdConsumer extends core.Object {
new(fd) {
this[_file] = io._File._openStdioSync(fd);
@@ -48224,6 +49101,11 @@
close: dart.definiteFunctionType(async.Future, [])
})
});
+io._StdSocketSink = class _StdSocketSink extends io._StdSinkHelper {
+ new(sink) {
+ super.new(sink, false);
+ }
+};
io.StdioType = class StdioType extends core.Object {
_(name) {
this.name = name;
@@ -48352,10 +49234,10 @@
}),
names: ['_getStdioOutputStream', '_getStdioInputStream', '_socketType', '_getStdioHandleType']
});
-let const$76;
-let const$77;
-let const$78;
let const$79;
+let const$80;
+let const$81;
+let const$82;
io.SystemEncoding = class SystemEncoding extends convert.Encoding {
new() {
super.new();
@@ -48371,16 +49253,16 @@
}
get encoder() {
if (io.Platform.operatingSystem == "windows") {
- return const$76 || (const$76 = dart.const(new io._WindowsCodePageEncoder()));
+ return const$79 || (const$79 = dart.const(new io._WindowsCodePageEncoder()));
} else {
- return const$77 || (const$77 = dart.const(new convert.Utf8Encoder()));
+ return const$80 || (const$80 = dart.const(new convert.Utf8Encoder()));
}
}
get decoder() {
if (io.Platform.operatingSystem == "windows") {
- return const$78 || (const$78 = dart.const(new io._WindowsCodePageDecoder()));
+ return const$81 || (const$81 = dart.const(new io._WindowsCodePageDecoder()));
} else {
- return const$79 || (const$79 = dart.const(new convert.Utf8Decoder()));
+ return const$82 || (const$82 = dart.const(new convert.Utf8Decoder()));
}
}
};
@@ -48411,6 +49293,7 @@
}
};
dart.addSimpleTypeTests(io._WindowsCodePageEncoder);
+io._WindowsCodePageEncoder[dart.implements] = () => [ChunkedConverterOfString$ListOfint$String$ListOfint()];
dart.setSignature(io._WindowsCodePageEncoder, {
methods: () => ({
convert: dart.definiteFunctionType(core.List$(core.int), [core.String]),
@@ -48463,6 +49346,7 @@
}
};
dart.addSimpleTypeTests(io._WindowsCodePageDecoder);
+io._WindowsCodePageDecoder[dart.implements] = () => [ChunkedConverterOfListOfint$String$ListOfint$String()];
dart.setSignature(io._WindowsCodePageDecoder, {
methods: () => ({
convert: dart.definiteFunctionType(core.String, [ListOfint()]),
@@ -48691,6 +49575,14 @@
io._WebSocketOpcode.RESERVED_D = 13;
io._WebSocketOpcode.RESERVED_E = 14;
io._WebSocketOpcode.RESERVED_F = 15;
+io._EncodedString = class _EncodedString extends core.Object {
+ new(bytes) {
+ this.bytes = bytes;
+ }
+};
+dart.setSignature(io._EncodedString, {
+ fields: () => ({bytes: ListOfint()})
+});
io._CompressionMaxWindowBits = class _CompressionMaxWindowBits extends core.Object {
new(headerValue, maxWindowBits) {
if (headerValue === void 0) headerValue = null;
@@ -49030,7 +49922,7 @@
this[_unmaskingIndex] = 0;
}
};
-io._WebSocketProtocolTransformer[dart.implements] = () => [StreamTransformerOfListOfint$dynamic(), EventSinkOfUint8List()];
+io._WebSocketProtocolTransformer[dart.implements] = () => [EventSinkOfListOfint(), StreamTransformerOfListOfint$dynamic()];
dart.setSignature(io._WebSocketProtocolTransformer, {
fields: () => ({
[_state$1]: core.int,
@@ -49053,7 +49945,7 @@
[_deflate]: io._WebSocketPerMessageDeflate
}),
methods: () => ({
- bind: dart.definiteFunctionType(async.Stream, [async.Stream]),
+ bind: dart.definiteFunctionType(async.Stream, [StreamOfListOfint()]),
addError: dart.definiteFunctionType(dart.void, [core.Object], [core.StackTrace]),
close: dart.definiteFunctionType(dart.void, []),
add: dart.definiteFunctionType(dart.void, [ListOfint()]),
@@ -49097,6 +49989,7 @@
dart.setSignature(io._WebSocketPong, {
fields: () => ({payload: ListOfint()})
});
+io._ProtocolSelector = dart.typedef('_ProtocolSelector', () => dart.functionType(dart.dynamic, [ListOfString()]));
const _protocolSelector = Symbol('_protocolSelector');
const _compression = Symbol('_compression');
io._WebSocketTransformerImpl = class _WebSocketTransformerImpl extends core.Object {
@@ -49134,24 +50027,24 @@
}
let deflate = io._WebSocketTransformerImpl._negotiateCompression(request, response, compression);
response.headers.contentLength = 0;
- return response.detachSocket().then(io._WebSocketImpl)(dart.fn(socket => new io._WebSocketImpl._fromSocket(socket, protocol, compression, true, deflate), SocketTo_WebSocketImpl()));
+ return response.detachSocket().then(io.WebSocket)(dart.fn(socket => new io._WebSocketImpl._fromSocket(socket, protocol, compression, true, deflate), SocketTo_WebSocketImpl()));
}
- dart.fn(upgrade, StringToFuture());
+ dart.fn(upgrade, StringToFutureOfWebSocket());
let protocols = request.headers._get('Sec-WebSocket-Protocol');
if (protocols != null && _protocolSelector != null) {
protocols = io._HttpParser._tokenizeFieldValue(protocols[dartx.join](', '));
- return async.Future.new(dart.fn(() => dart.dcall(_protocolSelector, protocols), VoidTodynamic$())).then(dart.dynamic)(dart.fn(protocol => {
- if (dart.notNull(protocols[dartx.indexOf](core.String._check(protocol))) < 0) {
+ return FutureOfString().new(dart.fn(() => _protocolSelector(protocols), VoidTodynamic$())).then(core.String)(dart.fn(protocol => {
+ if (dart.notNull(protocols[dartx.indexOf](protocol)) < 0) {
dart.throw(new io.WebSocketException("Selected protocol is not in the list of available protocols"));
}
return protocol;
- }, dynamicTodynamic$())).catchError(dart.fn(error => {
+ }, StringToString$())).catchError(dart.fn(error => {
response.statusCode = io.HttpStatus.INTERNAL_SERVER_ERROR;
response.close();
dart.throw(error);
}, dynamicToNull$())).then(io.WebSocket)(upgrade);
} else {
- return FutureOfWebSocket()._check(upgrade(null));
+ return upgrade(null);
}
}
static _negotiateCompression(request, response, compression) {
@@ -49200,12 +50093,12 @@
dart.setSignature(io._WebSocketTransformerImpl, {
fields: () => ({
[_controller$0]: StreamControllerOfWebSocket(),
- [_protocolSelector]: core.Function,
+ [_protocolSelector]: io._ProtocolSelector,
[_compression]: io.CompressionOptions
}),
methods: () => ({bind: dart.definiteFunctionType(async.Stream$(io.WebSocket), [StreamOfHttpRequest()])}),
statics: () => ({
- _upgrade: dart.definiteFunctionType(async.Future$(io.WebSocket), [io.HttpRequest, dart.dynamic, io.CompressionOptions]),
+ _upgrade: dart.definiteFunctionType(async.Future$(io.WebSocket), [io.HttpRequest, io._ProtocolSelector, io.CompressionOptions]),
_negotiateCompression: dart.definiteFunctionType(io._WebSocketPerMessageDeflate, [io.HttpRequest, io.HttpResponse, io.CompressionOptions]),
_isUpgradeRequest: dart.definiteFunctionType(core.bool, [io.HttpRequest])
}),
@@ -49213,7 +50106,7 @@
});
const _ensureDecoder = Symbol('_ensureDecoder');
const _ensureEncoder = Symbol('_ensureEncoder');
-let const$80;
+let const$83;
io._WebSocketPerMessageDeflate = class _WebSocketPerMessageDeflate extends core.Object {
new(opts) {
let clientMaxWindowBits = opts && 'clientMaxWindowBits' in opts ? opts.clientMaxWindowBits : io._WebSocketImpl.DEFAULT_WINDOW_BITS;
@@ -49241,25 +50134,24 @@
}
processIncomingMessage(msg) {
this[_ensureDecoder]();
- let data = [];
+ let data = JSArrayOfint().of([]);
data[dartx.addAll](msg);
- data[dartx.addAll](const$80 || (const$80 = dart.constList([0, 0, 255, 255], core.int)));
- this.decoder.process(ListOfint()._check(data), 0, data[dartx.length]);
- let result = [];
+ data[dartx.addAll](const$83 || (const$83 = dart.constList([0, 0, 255, 255], core.int)));
+ this.decoder.process(data, 0, data[dartx.length]);
+ let result = JSArrayOfint().of([]);
let out = null;
while ((out = this.decoder.processed()) != null) {
- result[dartx.addAll](core.Iterable._check(out));
+ result[dartx.addAll](out);
}
if (dart.test(this.serverSide) && dart.test(this.clientNoContextTakeover) || !dart.test(this.serverSide) && dart.test(this.serverNoContextTakeover)) {
this.decoder = null;
}
- return typed_data.Uint8List.fromList(ListOfint()._check(result));
+ return typed_data.Uint8List.fromList(result);
}
processOutgoingMessage(msg) {
this[_ensureEncoder]();
- let result = [];
+ let result = JSArrayOfint().of([]);
let buffer = null;
- let out = null;
if (!typed_data.Uint8List.is(msg)) {
for (let i = 0; i < dart.notNull(msg[dartx.length]); i++) {
if (dart.notNull(msg[dartx._get](i)) < 0 || 255 < dart.notNull(msg[dartx._get](i))) {
@@ -49271,8 +50163,9 @@
buffer = typed_data.Uint8List._check(msg);
}
this.encoder.process(buffer, 0, buffer[dartx.length]);
+ let out = null;
while ((out = this.encoder.processed()) != null) {
- result[dartx.addAll](core.Iterable._check(out));
+ result[dartx.addAll](out);
}
if (!dart.test(this.serverSide) && dart.test(this.clientNoContextTakeover) || dart.test(this.serverSide) && dart.test(this.serverNoContextTakeover)) {
this.encoder = null;
@@ -49280,7 +50173,7 @@
if (dart.notNull(result[dartx.length]) > 4) {
result = result[dartx.sublist](0, dart.notNull(result[dartx.length]) - 4);
}
- return ListOfint()._check(result);
+ return result;
}
};
dart.setSignature(io._WebSocketPerMessageDeflate, {
@@ -49334,13 +50227,14 @@
if (typeof message == 'string') {
opcode = io._WebSocketOpcode.TEXT;
data = convert.UTF8.encode(message);
+ } else if (ListOfint().is(message)) {
+ opcode = io._WebSocketOpcode.BINARY;
+ data = message;
+ } else if (io._EncodedString.is(message)) {
+ opcode = io._WebSocketOpcode.TEXT;
+ data = message.bytes;
} else {
- if (ListOfint().is(message)) {
- data = message;
- opcode = io._WebSocketOpcode.BINARY;
- } else {
- dart.throw(new core.ArgumentError(message));
- }
+ dart.throw(new core.ArgumentError(message));
}
if (this[_deflateHelper] != null) {
data = this[_deflateHelper].processOutgoingMessage(data);
@@ -49370,7 +50264,7 @@
this[_eventSink$].close();
}
addFrame(opcode, data) {
- return io._WebSocketOutgoingTransformer.createFrame(opcode, data, this.webSocket[_serverSide], this[_deflateHelper] != null && (opcode == io._WebSocketOpcode.TEXT || opcode == io._WebSocketOpcode.BINARY))[dartx.forEach](dart.fn(e => {
+ io._WebSocketOutgoingTransformer.createFrame(opcode, data, this.webSocket[_serverSide], this[_deflateHelper] != null && (opcode == io._WebSocketOpcode.TEXT || opcode == io._WebSocketOpcode.BINARY))[dartx.forEach](dart.fn(e => {
this[_eventSink$].add(e);
}, ListOfintToNull()));
}
@@ -49562,7 +50456,7 @@
this[_ensureController]();
const closeSocket = (function() {
return this.socket.close().catchError(dart.fn(_ => {
- }, dynamicToNull$())).then(io._WebSocketImpl)(dart.fn(_ => this.webSocket, dynamicTo_WebSocketImpl()));
+ }, dynamicToNull$())).then(io._WebSocketImpl)(dart.fn(_ => this.webSocket, SocketTo_WebSocketImpl()));
}).bind(this);
dart.fn(closeSocket, VoidToFuture());
this[_controller$0].close();
@@ -49612,7 +50506,7 @@
const _pingTimer = Symbol('_pingTimer');
const _consumer = Symbol('_consumer');
const _closeTimer = Symbol('_closeTimer');
-let const$81;
+let const$84;
io._WebSocketImpl = class _WebSocketImpl extends dart.mixin(async.Stream, io._ServiceObject) {
static connect(url, protocols, headers, opts) {
let compression = opts && 'compression' in opts ? opts.compression : io.CompressionOptions.DEFAULT;
@@ -49809,6 +50703,12 @@
add(data) {
this[_sink$0].add(data);
}
+ addUtf8Text(bytes) {
+ if (!ListOfint().is(bytes)) {
+ dart.throw(new core.ArgumentError.value(bytes, "bytes", "Is not a list of bytes"));
+ }
+ this[_sink$0].add(new io._EncodedString(bytes));
+ }
addError(error, stackTrace) {
if (stackTrace === void 0) stackTrace = null;
this[_sink$0].addError(error, stackTrace);
@@ -49834,7 +50734,7 @@
this[_controller$0].stream.drain(dart.dynamic)().catchError(dart.fn(_ => dart.map(), dynamicToMap()));
}
if (this[_closeTimer] == null) {
- this[_closeTimer] = async.Timer.new(const$81 || (const$81 = dart.const(new core.Duration({seconds: 5}))), dart.fn(() => {
+ this[_closeTimer] = async.Timer.new(const$84 || (const$84 = dart.const(new core.Duration({seconds: 5}))), dart.fn(() => {
this[_closeCode] = this[_outCloseCode];
this[_closeReason] = this[_outCloseReason];
if (this[_subscription$] != null) this[_subscription$].cancel();
@@ -49918,6 +50818,7 @@
methods: () => ({
listen: dart.definiteFunctionType(async.StreamSubscription, [dynamicTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool}),
add: dart.definiteFunctionType(dart.void, [dart.dynamic]),
+ addUtf8Text: dart.definiteFunctionType(dart.void, [ListOfint()]),
addError: dart.definiteFunctionType(dart.void, [dart.dynamic], [core.StackTrace]),
addStream: dart.definiteFunctionType(async.Future, [async.Stream]),
close: dart.definiteFunctionType(async.Future, [], [core.int, core.String]),
@@ -49942,7 +50843,7 @@
return io.HttpClient.new();
}
});
-isolate.IsolateSpawnException = class IsolateSpawnException extends core.Object {
+isolate$.IsolateSpawnException = class IsolateSpawnException extends core.Object {
new(message) {
this.message = message;
}
@@ -49950,12 +50851,12 @@
return dart.str`IsolateSpawnException: ${this.message}`;
}
};
-isolate.IsolateSpawnException[dart.implements] = () => [core.Exception];
-dart.setSignature(isolate.IsolateSpawnException, {
+isolate$.IsolateSpawnException[dart.implements] = () => [core.Exception];
+dart.setSignature(isolate$.IsolateSpawnException, {
fields: () => ({message: core.String})
});
const _pause = Symbol('_pause');
-isolate.Isolate = class Isolate extends core.Object {
+isolate$.Isolate = class Isolate extends core.Object {
new(controlPort, opts) {
let pauseCapability = opts && 'pauseCapability' in opts ? opts.pauseCapability : null;
let terminateCapability = opts && 'terminateCapability' in opts ? opts.terminateCapability : null;
@@ -49964,12 +50865,48 @@
this.terminateCapability = terminateCapability;
}
static get current() {
- return isolate.Isolate._currentIsolateCache;
+ return isolate$.Isolate._currentIsolateCache;
+ }
+ static get packageRoot() {
+ dart.throw(new core.UnsupportedError("Isolate.packageRoot"));
+ }
+ static get packageConfig() {
+ dart.throw(new core.UnsupportedError("Isolate.packageConfig"));
+ }
+ static resolvePackageUri(packageUri) {
+ return dart.async(function*(packageUri) {
+ if (packageUri.scheme != 'package') return packageUri;
+ return isolate$.Isolate._packageBase.resolveUri(packageUri.replace({scheme: ''}));
+ }, core.Uri, packageUri);
}
static spawn(entryPoint, message, opts) {
let paused = opts && 'paused' in opts ? opts.paused : false;
+ let errorsAreFatal = opts && 'errorsAreFatal' in opts ? opts.errorsAreFatal : null;
+ let onExit = opts && 'onExit' in opts ? opts.onExit : null;
+ let onError = opts && 'onError' in opts ? opts.onError : null;
+ let forcePause = errorsAreFatal != null || onExit != null || onError != null;
try {
- return _isolate_helper.IsolateNatives.spawnFunction(entryPoint, message, paused).then(isolate.Isolate)(dart.fn(msg => new isolate.Isolate(isolate.SendPort._check(msg[dartx._get](1)), {pauseCapability: isolate.Capability._check(msg[dartx._get](2)), terminateCapability: isolate.Capability._check(msg[dartx._get](3))}), ListToIsolate()));
+ if (!isolate$._UnaryFunction.is(entryPoint)) {
+ dart.throw(new core.ArgumentError(entryPoint));
+ }
+ return _isolate_helper.IsolateNatives.spawnFunction(entryPoint, message, dart.test(paused) || forcePause).then(isolate$.Isolate)(dart.fn(msg => {
+ let isolate = new isolate$.Isolate(isolate$.SendPort._check(msg[dartx._get](1)), {pauseCapability: isolate$.Capability._check(msg[dartx._get](2)), terminateCapability: isolate$.Capability._check(msg[dartx._get](3))});
+ if (forcePause) {
+ if (errorsAreFatal != null) {
+ isolate.setErrorsFatal(errorsAreFatal);
+ }
+ if (onExit != null) {
+ isolate.addOnExitListener(onExit);
+ }
+ if (onError != null) {
+ isolate.addErrorListener(onError);
+ }
+ if (!dart.test(paused)) {
+ isolate.resume(isolate.pauseCapability);
+ }
+ }
+ return isolate;
+ }, ListToIsolate()));
} catch (e) {
let st = dart.stackTrace(e);
return FutureOfIsolate().error(e, st);
@@ -49978,10 +50915,20 @@
}
static spawnUri(uri, args, message, opts) {
let paused = opts && 'paused' in opts ? opts.paused : false;
+ let onExit = opts && 'onExit' in opts ? opts.onExit : null;
+ let onError = opts && 'onError' in opts ? opts.onError : null;
+ let errorsAreFatal = opts && 'errorsAreFatal' in opts ? opts.errorsAreFatal : null;
+ let checked = opts && 'checked' in opts ? opts.checked : null;
+ let environment = opts && 'environment' in opts ? opts.environment : null;
let packageRoot = opts && 'packageRoot' in opts ? opts.packageRoot : null;
+ let packageConfig = opts && 'packageConfig' in opts ? opts.packageConfig : null;
+ let automaticPackageResolution = opts && 'automaticPackageResolution' in opts ? opts.automaticPackageResolution : false;
+ if (environment != null) dart.throw(new core.UnimplementedError("environment"));
if (packageRoot != null) dart.throw(new core.UnimplementedError("packageRoot"));
+ if (packageConfig != null) dart.throw(new core.UnimplementedError("packageConfig"));
+ let forcePause = errorsAreFatal != null || onExit != null || onError != null;
try {
- if (core.List.is(args)) {
+ if (ListOfString().is(args)) {
for (let i = 0; i < dart.notNull(args[dartx.length]); i++) {
if (!(typeof args[dartx._get](i) == 'string')) {
dart.throw(new core.ArgumentError(dart.str`Args must be a list of Strings ${args}`));
@@ -49990,7 +50937,24 @@
} else if (args != null) {
dart.throw(new core.ArgumentError(dart.str`Args must be a list of Strings ${args}`));
}
- return _isolate_helper.IsolateNatives.spawnUri(uri, args, message, paused).then(isolate.Isolate)(dart.fn(msg => new isolate.Isolate(isolate.SendPort._check(msg[dartx._get](1)), {pauseCapability: isolate.Capability._check(msg[dartx._get](2)), terminateCapability: isolate.Capability._check(msg[dartx._get](3))}), ListToIsolate()));
+ return _isolate_helper.IsolateNatives.spawnUri(uri, args, message, dart.test(paused) || forcePause).then(isolate$.Isolate)(dart.fn(msg => {
+ let isolate = new isolate$.Isolate(isolate$.SendPort._check(msg[dartx._get](1)), {pauseCapability: isolate$.Capability._check(msg[dartx._get](2)), terminateCapability: isolate$.Capability._check(msg[dartx._get](3))});
+ if (forcePause) {
+ if (errorsAreFatal != null) {
+ isolate.setErrorsFatal(errorsAreFatal);
+ }
+ if (onExit != null) {
+ isolate.addOnExitListener(onExit);
+ }
+ if (onError != null) {
+ isolate.addErrorListener(onError);
+ }
+ if (!dart.test(paused)) {
+ isolate.resume(isolate.pauseCapability);
+ }
+ }
+ return isolate;
+ }, ListToIsolate()));
} catch (e) {
let st = dart.stackTrace(e);
return FutureOfIsolate().error(e, st);
@@ -49999,7 +50963,8 @@
}
pause(resumeCapability) {
if (resumeCapability === void 0) resumeCapability = null;
- if (resumeCapability == null) resumeCapability = isolate.Capability.new();
+ let t = resumeCapability;
+ t == null ? resumeCapability = isolate$.Capability.new() : t;
this[_pause](resumeCapability);
return resumeCapability;
}
@@ -50016,10 +50981,12 @@
message[dartx._set](1, resumeCapability);
this.controlPort.send(message);
}
- addOnExitListener(responsePort) {
- let message = core.List.new(2);
+ addOnExitListener(responsePort, opts) {
+ let response = opts && 'response' in opts ? opts.response : null;
+ let message = core.List.new(3);
message[dartx._set](0, "add-ondone");
message[dartx._set](1, responsePort);
+ message[dartx._set](2, response);
this.controlPort.send(message);
}
removeOnExitListener(responsePort) {
@@ -50035,16 +51002,18 @@
message[dartx._set](2, errorsAreFatal);
this.controlPort.send(message);
}
- kill(priority) {
- if (priority === void 0) priority = isolate.Isolate.BEFORE_NEXT_EVENT;
+ kill(opts) {
+ let priority = opts && 'priority' in opts ? opts.priority : isolate$.Isolate.BEFORE_NEXT_EVENT;
this.controlPort.send(JSArrayOfObject().of(["kill", this.terminateCapability, priority]));
}
- ping(responsePort, pingType) {
- if (pingType === void 0) pingType = isolate.Isolate.IMMEDIATE;
- let message = core.List.new(3);
+ ping(responsePort, opts) {
+ let response = opts && 'response' in opts ? opts.response : null;
+ let priority = opts && 'priority' in opts ? opts.priority : isolate$.Isolate.IMMEDIATE;
+ let message = core.List.new(4);
message[dartx._set](0, "ping");
message[dartx._set](1, responsePort);
- message[dartx._set](2, pingType);
+ message[dartx._set](2, priority);
+ message[dartx._set](3, response);
this.controlPort.send(message);
}
addErrorListener(port) {
@@ -50065,12 +51034,12 @@
function handleError(message) {
let errorDescription = core.String._check(dart.dindex(message, 0));
let stackDescription = core.String._check(dart.dindex(message, 1));
- let error = new isolate.RemoteError(errorDescription, stackDescription);
+ let error = new isolate$.RemoteError(errorDescription, stackDescription);
controller.addError(error, error.stackTrace);
}
dart.fn(handleError, dynamicTovoid$());
controller = async.StreamController.broadcast({sync: true, onListen: dart.fn(() => {
- port = isolate.RawReceivePort.new(handleError);
+ port = isolate$.RawReceivePort.new(handleError);
this.addErrorListener(port.sendPort);
}, VoidToNull()), onCancel: dart.fn(() => {
this.removeErrorListener(port.sendPort);
@@ -50080,42 +51049,46 @@
return controller.stream;
}
};
-dart.setSignature(isolate.Isolate, {
+dart.setSignature(isolate$.Isolate, {
fields: () => ({
- controlPort: isolate.SendPort,
- pauseCapability: isolate.Capability,
- terminateCapability: isolate.Capability
+ controlPort: isolate$.SendPort,
+ pauseCapability: isolate$.Capability,
+ terminateCapability: isolate$.Capability
}),
getters: () => ({errors: dart.definiteFunctionType(async.Stream, [])}),
methods: () => ({
- pause: dart.definiteFunctionType(isolate.Capability, [], [isolate.Capability]),
- [_pause]: dart.definiteFunctionType(dart.void, [isolate.Capability]),
- resume: dart.definiteFunctionType(dart.void, [isolate.Capability]),
- addOnExitListener: dart.definiteFunctionType(dart.void, [isolate.SendPort]),
- removeOnExitListener: dart.definiteFunctionType(dart.void, [isolate.SendPort]),
+ pause: dart.definiteFunctionType(isolate$.Capability, [], [isolate$.Capability]),
+ [_pause]: dart.definiteFunctionType(dart.void, [isolate$.Capability]),
+ resume: dart.definiteFunctionType(dart.void, [isolate$.Capability]),
+ addOnExitListener: dart.definiteFunctionType(dart.void, [isolate$.SendPort], {response: core.Object}),
+ removeOnExitListener: dart.definiteFunctionType(dart.void, [isolate$.SendPort]),
setErrorsFatal: dart.definiteFunctionType(dart.void, [core.bool]),
- kill: dart.definiteFunctionType(dart.void, [], [core.int]),
- ping: dart.definiteFunctionType(dart.void, [isolate.SendPort], [core.int]),
- addErrorListener: dart.definiteFunctionType(dart.void, [isolate.SendPort]),
- removeErrorListener: dart.definiteFunctionType(dart.void, [isolate.SendPort])
+ kill: dart.definiteFunctionType(dart.void, [], {priority: core.int}),
+ ping: dart.definiteFunctionType(dart.void, [isolate$.SendPort], {response: core.Object, priority: core.int}),
+ addErrorListener: dart.definiteFunctionType(dart.void, [isolate$.SendPort]),
+ removeErrorListener: dart.definiteFunctionType(dart.void, [isolate$.SendPort])
}),
statics: () => ({
- spawn: dart.definiteFunctionType(async.Future$(isolate.Isolate), [dynamicTovoid(), dart.dynamic], {paused: core.bool}),
- spawnUri: dart.definiteFunctionType(async.Future$(isolate.Isolate), [core.Uri, ListOfString(), dart.dynamic], {paused: core.bool, packageRoot: core.Uri})
+ resolvePackageUri: dart.definiteFunctionType(async.Future$(core.Uri), [core.Uri]),
+ spawn: dart.definiteFunctionType(async.Future$(isolate$.Isolate), [dynamicTovoid(), dart.dynamic], {paused: core.bool, errorsAreFatal: core.bool, onExit: isolate$.SendPort, onError: isolate$.SendPort}),
+ spawnUri: dart.definiteFunctionType(async.Future$(isolate$.Isolate), [core.Uri, ListOfString(), dart.dynamic], {paused: core.bool, onExit: isolate$.SendPort, onError: isolate$.SendPort, errorsAreFatal: core.bool, checked: core.bool, environment: MapOfString$String(), packageRoot: core.Uri, packageConfig: core.Uri, automaticPackageResolution: core.bool})
}),
- names: ['spawn', 'spawnUri']
+ names: ['resolvePackageUri', 'spawn', 'spawnUri']
});
-isolate.Isolate.IMMEDIATE = 0;
-isolate.Isolate.BEFORE_NEXT_EVENT = 1;
-isolate.Isolate.AS_EVENT = 2;
-dart.defineLazy(isolate.Isolate, {
+isolate$.Isolate.IMMEDIATE = 0;
+isolate$.Isolate.BEFORE_NEXT_EVENT = 1;
+dart.defineLazy(isolate$.Isolate, {
get _currentIsolateCache() {
return _isolate_helper.IsolateNatives.currentIsolate;
- }
+ },
+ get _packageBase() {
+ return core.Uri.base.resolve(core.String._check(dart.dload(_isolate_helper.IsolateNatives, 'packagesBase')));
+ },
+ set _packageBase(_) {}
});
-isolate.SendPort = class SendPort extends core.Object {};
-isolate.SendPort[dart.implements] = () => [isolate.Capability];
-isolate.ReceivePort = class ReceivePort extends core.Object {
+isolate$.SendPort = class SendPort extends core.Object {};
+isolate$.SendPort[dart.implements] = () => [isolate$.Capability];
+isolate$.ReceivePort = class ReceivePort extends core.Object {
static new() {
return new _isolate_helper.ReceivePortImpl();
}
@@ -50123,62 +51096,32 @@
return new _isolate_helper.ReceivePortImpl.fromRawReceivePort(rawPort);
}
};
-isolate.ReceivePort[dart.implements] = () => [async.Stream];
-isolate.RawReceivePort = class RawReceivePort extends core.Object {
+isolate$.ReceivePort[dart.implements] = () => [async.Stream];
+isolate$.RawReceivePort = class RawReceivePort extends core.Object {
static new(handler) {
if (handler === void 0) handler = null;
return new _isolate_helper.RawReceivePortImpl(handler);
}
};
-isolate._IsolateUnhandledException = class _IsolateUnhandledException extends core.Object {
- new(message, source, stackTrace) {
- this.message = message;
- this.source = source;
- this.stackTrace = stackTrace;
- }
- toString() {
- return 'IsolateUnhandledException: exception while handling message: ' + dart.str`${this.message} \n ` + dart.str`${dart.toString(this.source)[dartx.replaceAll]("\n", "\n ")}\n` + 'original stack trace:\n ' + dart.str`${dart.toString(this.stackTrace)[dartx.replaceAll]("\n", "\n ")}`;
- }
-};
-isolate._IsolateUnhandledException[dart.implements] = () => [core.Exception];
-dart.setSignature(isolate._IsolateUnhandledException, {
- fields: () => ({
- message: dart.dynamic,
- source: dart.dynamic,
- stackTrace: core.StackTrace
- })
-});
const _description = Symbol('_description');
-isolate.RemoteError = class RemoteError extends core.Object {
+isolate$.RemoteError = class RemoteError extends core.Object {
new(description, stackDescription) {
this[_description] = description;
- this.stackTrace = new isolate._RemoteStackTrace(stackDescription);
+ this.stackTrace = core.StackTrace.fromString(stackDescription);
}
toString() {
return this[_description];
}
};
-isolate.RemoteError[dart.implements] = () => [core.Error];
-dart.setSignature(isolate.RemoteError, {
+isolate$.RemoteError[dart.implements] = () => [core.Error];
+dart.setSignature(isolate$.RemoteError, {
fields: () => ({
[_description]: core.String,
stackTrace: core.StackTrace
})
});
-const _trace$ = Symbol('_trace');
-isolate._RemoteStackTrace = class _RemoteStackTrace extends core.Object {
- new(trace) {
- this[_trace$] = trace;
- }
- toString() {
- return this[_trace$];
- }
-};
-isolate._RemoteStackTrace[dart.implements] = () => [core.StackTrace];
-dart.setSignature(isolate._RemoteStackTrace, {
- fields: () => ({[_trace$]: core.String})
-});
-isolate.Capability = class Capability extends core.Object {
+isolate$._UnaryFunction = dart.typedef('_UnaryFunction', () => dart.functionType(dart.dynamic, [dart.dynamic]));
+isolate$.Capability = class Capability extends core.Object {
static new() {
return new _isolate_helper.CapabilityImpl();
}
@@ -50695,13 +51638,40 @@
math.SQRT2 = 1.4142135623730951;
math.min = function(T) {
return (a, b) => {
- return Math.min(_js_helper.checkNum(a), _js_helper.checkNum(b));
+ if (!(typeof a == 'number')) dart.throw(new core.ArgumentError(a));
+ if (!(typeof b == 'number')) dart.throw(new core.ArgumentError(b));
+ if (dart.notNull(a) > dart.notNull(b)) return b;
+ if (dart.notNull(a) < dart.notNull(b)) return a;
+ if (typeof b == 'number') {
+ if (typeof a == 'number') {
+ if (a == 0.0) {
+ return (dart.notNull(a) + dart.notNull(b)) * dart.notNull(a) * dart.notNull(b);
+ }
+ }
+ if (a == 0 && dart.test(b[dartx.isNegative]) || dart.test(b[dartx.isNaN])) return b;
+ return a;
+ }
+ return a;
};
};
dart.fn(math.min, TAndTToT());
math.max = function(T) {
return (a, b) => {
- return Math.max(_js_helper.checkNum(a), _js_helper.checkNum(b));
+ if (!(typeof a == 'number')) dart.throw(new core.ArgumentError(a));
+ if (!(typeof b == 'number')) dart.throw(new core.ArgumentError(b));
+ if (dart.notNull(a) > dart.notNull(b)) return a;
+ if (dart.notNull(a) < dart.notNull(b)) return b;
+ if (typeof b == 'number') {
+ if (typeof a == 'number') {
+ if (a == 0.0) {
+ return dart.notNull(a) + dart.notNull(b);
+ }
+ }
+ if (dart.test(b[dartx.isNaN])) return b;
+ return a;
+ }
+ if (b == 0 && dart.test(a[dartx.isNegative])) return b;
+ return a;
};
};
dart.fn(math.max, TAndTToT$());
@@ -51054,11 +52024,11 @@
return Point;
});
math.Point = Point$();
-let const$82;
+let const$85;
math.Random = class Random extends core.Object {
static new(seed) {
if (seed === void 0) seed = null;
- return seed == null ? const$82 || (const$82 = dart.const(new math._JSRandom())) : new math._Random(seed);
+ return seed == null ? const$85 || (const$85 = dart.const(new math._JSRandom())) : new math._Random(seed);
}
static secure() {
return math.Random._secureRandom;
@@ -51102,8 +52072,7 @@
}
['=='](other) {
if (!RectangleOfnum().is(other)) return false;
- let otherRect = RectangleOfnum().as(other);
- return this[dartx.left] == otherRect[dartx.left] && this[dartx.top] == otherRect[dartx.top] && this[dartx.right] == otherRect[dartx.right] && this[dartx.bottom] == otherRect[dartx.bottom];
+ return dart.equals(this[dartx.left], dart.dload(other, 'left')) && dart.equals(this[dartx.top], dart.dload(other, 'top')) && dart.equals(this[dartx.right], dart.dload(other, 'right')) && dart.equals(this[dartx.bottom], dart.dload(other, 'bottom'));
}
get hashCode() {
return math._JenkinsSmiHash.hash4(dart.hashCode(this[dartx.left]), dart.hashCode(this[dartx.top]), dart.hashCode(this[dartx.right]), dart.hashCode(this[dartx.bottom]));
@@ -52413,7 +53382,7 @@
});
dart.registerExtension(dart.global.IDBKeyRange, indexed_db.KeyRange);
const _add$3 = Symbol('_add');
-const _clear$0 = Symbol('_clear');
+const _clear$ = Symbol('_clear');
const _put = Symbol('_put');
const _createIndex = Symbol('_createIndex');
const _add_1 = Symbol('_add_1');
@@ -52461,7 +53430,7 @@
}
[dartx.clear]() {
try {
- return indexed_db._completeRequest(dart.dynamic)(this[_clear$0]());
+ return indexed_db._completeRequest(dart.dynamic)(this[_clear$]());
} catch (e) {
let stacktrace = dart.stackTrace(e);
return async.Future.error(e, stacktrace);
@@ -52582,7 +53551,7 @@
[_add_2](...args) {
return this.add.apply(this, args);
}
- [_clear$0](...args) {
+ [_clear$](...args) {
return this.clear.apply(this, args);
}
[_count$0](...args) {
@@ -52681,7 +53650,7 @@
[_add$3]: dart.definiteFunctionType(indexed_db.Request, [dart.dynamic], [dart.dynamic]),
[_add_1]: dart.definiteFunctionType(indexed_db.Request, [dart.dynamic, dart.dynamic]),
[_add_2]: dart.definiteFunctionType(indexed_db.Request, [dart.dynamic]),
- [_clear$0]: dart.definiteFunctionType(indexed_db.Request, []),
+ [_clear$]: dart.definiteFunctionType(indexed_db.Request, []),
[_count$0]: dart.definiteFunctionType(indexed_db.Request, [core.Object]),
[_createIndex]: dart.definiteFunctionType(indexed_db.Index, [core.String, core.Object], [core.Map]),
[_createIndex_1]: dart.definiteFunctionType(indexed_db.Index, [dart.dynamic, dart.dynamic, dart.dynamic]),
@@ -59470,7 +60439,7 @@
const _borderWidth = Symbol('_borderWidth');
const _bottom = Symbol('_bottom');
const _captionSide = Symbol('_captionSide');
-const _clear$1 = Symbol('_clear');
+const _clear$0 = Symbol('_clear');
const _clip = Symbol('_clip');
const _color = Symbol('_color');
const _content = Symbol('_content');
@@ -64285,15 +65254,15 @@
this.captionSide = value;
}
get [dartx.clear]() {
- return this[_clear$1];
+ return this[_clear$0];
}
set [dartx.clear](value) {
- this[_clear$1] = value == null ? '' : value;
+ this[_clear$0] = value == null ? '' : value;
}
- get [_clear$1]() {
+ get [_clear$0]() {
return this.clear;
}
- set [_clear$1](value) {
+ set [_clear$0](value) {
this.clear = value;
}
get [dartx.clip]() {
@@ -65040,7 +66009,7 @@
[_borderWidth]: core.String,
[_bottom]: core.String,
[_captionSide]: core.String,
- [_clear$1]: core.String,
+ [_clear$0]: core.String,
[_clip]: core.String,
[_color]: core.String,
[_content]: core.String,
@@ -84088,7 +85057,7 @@
return value;
}
[dartx.clear]() {
- return this[_clear$1]();
+ return this[_clear$0]();
}
[dartx.forEach](f) {
for (let i = 0; true; i++) {
@@ -84131,7 +85100,7 @@
[__setter__](...args) {
return this.__setter__.apply(this, args);
}
- [_clear$1](...args) {
+ [_clear$0](...args) {
return this.clear.apply(this, args);
}
[_getItem](...args) {
@@ -84170,7 +85139,7 @@
[__delete__]: dart.definiteFunctionType(core.bool, [dart.dynamic]),
[__getter__]: dart.definiteFunctionType(core.String, [dart.dynamic]),
[__setter__]: dart.definiteFunctionType(dart.void, [dart.dynamic, core.String]),
- [_clear$1]: dart.definiteFunctionType(dart.void, []),
+ [_clear$0]: dart.definiteFunctionType(dart.void, []),
[_getItem]: dart.definiteFunctionType(core.String, [core.String]),
[_key]: dart.definiteFunctionType(core.String, [core.int]),
[_removeItem]: dart.definiteFunctionType(dart.void, [core.String]),
@@ -93180,9 +94149,6 @@
allowsAttribute: dart.definiteFunctionType(core.bool, [html$.Element, core.String, core.String])
})
});
-let const$83;
-let const$84;
-let const$85;
let const$86;
let const$87;
let const$88;
@@ -93190,15 +94156,18 @@
let const$90;
let const$91;
let const$92;
+let const$93;
+let const$94;
+let const$95;
html$._SimpleNodeValidator = class _SimpleNodeValidator extends core.Object {
static allowNavigation(uriPolicy) {
- return new html$._SimpleNodeValidator(uriPolicy, {allowedElements: const$83 || (const$83 = dart.constList(['A', 'FORM'], core.String)), allowedAttributes: const$84 || (const$84 = dart.constList(['A::accesskey', 'A::coords', 'A::hreflang', 'A::name', 'A::shape', 'A::tabindex', 'A::target', 'A::type', 'FORM::accept', 'FORM::autocomplete', 'FORM::enctype', 'FORM::method', 'FORM::name', 'FORM::novalidate', 'FORM::target'], core.String)), allowedUriAttributes: const$85 || (const$85 = dart.constList(['A::href', 'FORM::action'], core.String))});
+ return new html$._SimpleNodeValidator(uriPolicy, {allowedElements: const$86 || (const$86 = dart.constList(['A', 'FORM'], core.String)), allowedAttributes: const$87 || (const$87 = dart.constList(['A::accesskey', 'A::coords', 'A::hreflang', 'A::name', 'A::shape', 'A::tabindex', 'A::target', 'A::type', 'FORM::accept', 'FORM::autocomplete', 'FORM::enctype', 'FORM::method', 'FORM::name', 'FORM::novalidate', 'FORM::target'], core.String)), allowedUriAttributes: const$88 || (const$88 = dart.constList(['A::href', 'FORM::action'], core.String))});
}
static allowImages(uriPolicy) {
- return new html$._SimpleNodeValidator(uriPolicy, {allowedElements: const$86 || (const$86 = dart.constList(['IMG'], core.String)), allowedAttributes: const$87 || (const$87 = dart.constList(['IMG::align', 'IMG::alt', 'IMG::border', 'IMG::height', 'IMG::hspace', 'IMG::ismap', 'IMG::name', 'IMG::usemap', 'IMG::vspace', 'IMG::width'], core.String)), allowedUriAttributes: const$88 || (const$88 = dart.constList(['IMG::src'], core.String))});
+ return new html$._SimpleNodeValidator(uriPolicy, {allowedElements: const$89 || (const$89 = dart.constList(['IMG'], core.String)), allowedAttributes: const$90 || (const$90 = dart.constList(['IMG::align', 'IMG::alt', 'IMG::border', 'IMG::height', 'IMG::hspace', 'IMG::ismap', 'IMG::name', 'IMG::usemap', 'IMG::vspace', 'IMG::width'], core.String)), allowedUriAttributes: const$91 || (const$91 = dart.constList(['IMG::src'], core.String))});
}
static allowTextElements() {
- return new html$._SimpleNodeValidator(null, {allowedElements: const$89 || (const$89 = dart.constList(['B', 'BLOCKQUOTE', 'BR', 'EM', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'HR', 'I', 'LI', 'OL', 'P', 'SPAN', 'UL'], core.String))});
+ return new html$._SimpleNodeValidator(null, {allowedElements: const$92 || (const$92 = dart.constList(['B', 'BLOCKQUOTE', 'BR', 'EM', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'HR', 'I', 'LI', 'OL', 'P', 'SPAN', 'UL'], core.String))});
}
new(uriPolicy, opts) {
let allowedElements = opts && 'allowedElements' in opts ? opts.allowedElements : null;
@@ -93208,9 +94177,9 @@
this.allowedAttributes = SetOfString().new();
this.allowedUriAttributes = SetOfString().new();
this.uriPolicy = uriPolicy;
- this.allowedElements.addAll((allowedElements != null ? allowedElements : const$90 || (const$90 = dart.constList([], core.String))));
- allowedAttributes = allowedAttributes != null ? allowedAttributes : const$91 || (const$91 = dart.constList([], core.String));
- allowedUriAttributes = allowedUriAttributes != null ? allowedUriAttributes : const$92 || (const$92 = dart.constList([], core.String));
+ this.allowedElements.addAll((allowedElements != null ? allowedElements : const$93 || (const$93 = dart.constList([], core.String))));
+ allowedAttributes = allowedAttributes != null ? allowedAttributes : const$94 || (const$94 = dart.constList([], core.String));
+ allowedUriAttributes = allowedUriAttributes != null ? allowedUriAttributes : const$95 || (const$95 = dart.constList([], core.String));
let legalAttributes = allowedAttributes[dartx.where](dart.fn(x => !dart.test(html$._Html5NodeValidator._uriAttributes[dartx.contains](x)), StringTobool$()));
let extraUriAttributes = allowedAttributes[dartx.where](dart.fn(x => html$._Html5NodeValidator._uriAttributes[dartx.contains](x), StringTobool$()));
this.allowedAttributes.addAll(legalAttributes);
@@ -93496,7 +94465,7 @@
names: ['get']
});
const _array = Symbol('_array');
-const _current$4 = Symbol('_current');
+const _current$2 = Symbol('_current');
html$.FixedSizeListIterator$ = dart.generic(T => {
let IteratorOfT = () => (IteratorOfT = dart.constFn(core.Iterator$(T)))();
let ListOfT = () => (ListOfT = dart.constFn(core.List$(T)))();
@@ -93505,21 +94474,21 @@
this[_array] = array;
this[_position$1] = -1;
this[_length$3] = array[dartx.length];
- this[_current$4] = null;
+ this[_current$2] = null;
}
moveNext() {
let nextPosition = dart.notNull(this[_position$1]) + 1;
if (nextPosition < dart.notNull(this[_length$3])) {
- this[_current$4] = this[_array][dartx._get](nextPosition);
+ this[_current$2] = this[_array][dartx._get](nextPosition);
this[_position$1] = nextPosition;
return true;
}
- this[_current$4] = null;
+ this[_current$2] = null;
this[_position$1] = this[_length$3];
return false;
}
get current() {
- return this[_current$4];
+ return this[_current$2];
}
}
dart.addTypeTests(FixedSizeListIterator);
@@ -93529,7 +94498,7 @@
[_array]: ListOfT(),
[_length$3]: core.int,
[_position$1]: core.int,
- [_current$4]: T
+ [_current$2]: T
}),
getters: () => ({current: dart.definiteFunctionType(T, [])}),
methods: () => ({moveNext: dart.definiteFunctionType(core.bool, [])})
@@ -93544,21 +94513,21 @@
new(array) {
this[_array] = array;
this[_position$1] = -1;
- this[_current$4] = null;
+ this[_current$2] = null;
}
moveNext() {
let nextPosition = dart.notNull(this[_position$1]) + 1;
if (nextPosition < dart.notNull(this[_array][dartx.length])) {
- this[_current$4] = this[_array][dartx._get](nextPosition);
+ this[_current$2] = this[_array][dartx._get](nextPosition);
this[_position$1] = nextPosition;
return true;
}
- this[_current$4] = null;
+ this[_current$2] = null;
this[_position$1] = this[_array][dartx.length];
return false;
}
get current() {
- return this[_current$4];
+ return this[_current$2];
}
}
dart.addTypeTests(_VariableSizeListIterator);
@@ -93567,7 +94536,7 @@
fields: () => ({
[_array]: ListOfT(),
[_position$1]: core.int,
- [_current$4]: T
+ [_current$2]: T
}),
getters: () => ({current: dart.definiteFunctionType(T, [])}),
methods: () => ({moveNext: dart.definiteFunctionType(core.bool, [])})
@@ -104475,6 +105444,7 @@
methods: () => ({[dartx.executeSql]: dart.definiteFunctionType(dart.void, [core.String, ListOfObject()], [web_sql.SqlStatementCallback, web_sql.SqlStatementErrorCallback])})
});
dart.registerExtension(dart.global.SQLTransaction, web_sql.SqlTransaction);
+dart.trackLibraries("dart_sdk", {"dart:_runtime": dart, "dart:_debugger": _debugger, "dart:_foreign_helper": _foreign_helper, "dart:_interceptors": _interceptors, "dart:_internal": _internal, "dart:_isolate_helper": _isolate_helper, "dart:_js_embedded_names": _js_embedded_names, "dart:_js_helper": _js_helper, "dart:_js_mirrors": _js_mirrors, "dart:_js_primitives": _js_primitives, "dart:_metadata": _metadata, "dart:_native_typed_data": _native_typed_data, "dart:async": async, "dart:collection": collection, "dart:convert": convert, "dart:core": core, "dart:developer": developer, "dart:io": io, "dart:isolate": isolate$, "dart:js": js, "dart:js_util": js_util, "dart:math": math, "dart:mirrors": mirrors, "dart:typed_data": typed_data, "dart:indexed_db": indexed_db, "dart:html": html$, "dart:html_common": html_common, "dart:svg": svg$, "dart:web_audio": web_audio, "dart:web_gl": web_gl, "dart:web_sql": web_sql});
// Exports:
exports.dart = dart;
exports.dartx = dartx;
@@ -104495,7 +105465,7 @@
exports.core = core;
exports.developer = developer;
exports.io = io;
-exports.isolate = isolate;
+exports.isolate = isolate$;
exports.js = js;
exports.js_util = js_util;
exports.math = math;
diff --git a/pkg/dev_compiler/lib/js/es6/dart_sdk.js b/pkg/dev_compiler/lib/js/es6/dart_sdk.js
index 91a48c5..3b8dcbc 100644
--- a/pkg/dev_compiler/lib/js/es6/dart_sdk.js
+++ b/pkg/dev_compiler/lib/js/es6/dart_sdk.js
@@ -17,7 +17,7 @@
export const core = Object.create(null);
export const developer = Object.create(null);
export const io = Object.create(null);
-export const isolate = Object.create(null);
+export const isolate$ = Object.create(null);
export const js = Object.create(null);
export const js_util = Object.create(null);
export const math = Object.create(null);
@@ -37,16 +37,14 @@
let MapOfString$_MethodStats = () => (MapOfString$_MethodStats = dart.constFn(core.Map$(core.String, dart._MethodStats)))();
let ListOfString = () => (ListOfString = dart.constFn(core.List$(core.String)))();
let SetOfNameValuePair = () => (SetOfNameValuePair = dart.constFn(core.Set$(_debugger.NameValuePair)))();
+let ListOfNameValuePair = () => (ListOfNameValuePair = dart.constFn(core.List$(_debugger.NameValuePair)))();
+let IterableOfNameValuePair = () => (IterableOfNameValuePair = dart.constFn(core.Iterable$(_debugger.NameValuePair)))();
let JSArrayOfNameValuePair = () => (JSArrayOfNameValuePair = dart.constFn(_interceptors.JSArray$(_debugger.NameValuePair)))();
let MapOfdynamic$Object = () => (MapOfdynamic$Object = dart.constFn(core.Map$(dart.dynamic, core.Object)))();
let JSArrayOfFormatter = () => (JSArrayOfFormatter = dart.constFn(_interceptors.JSArray$(_debugger.Formatter)))();
let ListOfFormatter = () => (ListOfFormatter = dart.constFn(core.List$(_debugger.Formatter)))();
let LinkedHashSetOfNameValuePair = () => (LinkedHashSetOfNameValuePair = dart.constFn(collection.LinkedHashSet$(_debugger.NameValuePair)))();
-let SetOfString = () => (SetOfString = dart.constFn(core.Set$(core.String)))();
let HashMapOfString$String = () => (HashMapOfString$String = dart.constFn(collection.HashMap$(core.String, core.String)))();
-let LinkedHashMapOfString$Object = () => (LinkedHashMapOfString$Object = dart.constFn(collection.LinkedHashMap$(core.String, core.Object)))();
-let ListOfNameValuePair = () => (ListOfNameValuePair = dart.constFn(core.List$(_debugger.NameValuePair)))();
-let JSArrayOfString = () => (JSArrayOfString = dart.constFn(_interceptors.JSArray$(core.String)))();
let JSArrayOfJsonMLFormatter = () => (JSArrayOfJsonMLFormatter = dart.constFn(_interceptors.JSArray$(_debugger.JsonMLFormatter)))();
let JSIndexable = () => (JSIndexable = dart.constFn(_interceptors.JSIndexable$()))();
let JSArray = () => (JSArray = dart.constFn(_interceptors.JSArray$()))();
@@ -55,6 +53,7 @@
let JSExtendableArray = () => (JSExtendableArray = dart.constFn(_interceptors.JSExtendableArray$()))();
let JSUnmodifiableArray = () => (JSUnmodifiableArray = dart.constFn(_interceptors.JSUnmodifiableArray$()))();
let ArrayIterator = () => (ArrayIterator = dart.constFn(_interceptors.ArrayIterator$()))();
+let JSArrayOfString = () => (JSArrayOfString = dart.constFn(_interceptors.JSArray$(core.String)))();
let JSIndexableOfString = () => (JSIndexableOfString = dart.constFn(_interceptors.JSIndexable$(core.String)))();
let MatchToString = () => (MatchToString = dart.constFn(dart.functionType(core.String, [core.Match])))();
let StringToString = () => (StringToString = dart.constFn(dart.functionType(core.String, [core.String])))();
@@ -68,6 +67,7 @@
let UnmodifiableListBase = () => (UnmodifiableListBase = dart.constFn(_internal.UnmodifiableListBase$()))();
let StringToint = () => (StringToint = dart.constFn(dart.functionType(core.int, [core.String])))();
let Iterable = () => (Iterable = dart.constFn(core.Iterable$()))();
+let EfficientLengthIterable = () => (EfficientLengthIterable = dart.constFn(_internal.EfficientLengthIterable$()))();
let ListIterable = () => (ListIterable = dart.constFn(_internal.ListIterable$()))();
let SubListIterable = () => (SubListIterable = dart.constFn(_internal.SubListIterable$()))();
let ListIterator = () => (ListIterator = dart.constFn(_internal.ListIterator$()))();
@@ -104,8 +104,8 @@
let MapOfint$RawReceivePortImpl = () => (MapOfint$RawReceivePortImpl = dart.constFn(core.Map$(core.int, _isolate_helper.RawReceivePortImpl)))();
let SetOfint = () => (SetOfint = dart.constFn(core.Set$(core.int)))();
let JSArrayOf_IsolateEvent = () => (JSArrayOf_IsolateEvent = dart.constFn(_interceptors.JSArray$(_isolate_helper._IsolateEvent)))();
-let SetOfCapability = () => (SetOfCapability = dart.constFn(core.Set$(isolate.Capability)))();
-let SetOfSendPort = () => (SetOfSendPort = dart.constFn(core.Set$(isolate.SendPort)))();
+let SetOfCapability = () => (SetOfCapability = dart.constFn(core.Set$(isolate$.Capability)))();
+let SetOfSendPort = () => (SetOfSendPort = dart.constFn(core.Set$(isolate$.SendPort)))();
let ListOf_IsolateEvent = () => (ListOf_IsolateEvent = dart.constFn(core.List$(_isolate_helper._IsolateEvent)))();
let QueueOf_IsolateEvent = () => (QueueOf_IsolateEvent = dart.constFn(collection.Queue$(_isolate_helper._IsolateEvent)))();
let CompleterOfList = () => (CompleterOfList = dart.constFn(async.Completer$(core.List)))();
@@ -136,6 +136,7 @@
let _Lazy = () => (_Lazy = dart.constFn(_js_mirrors._Lazy$()))();
let ListOfSymbol = () => (ListOfSymbol = dart.constFn(core.List$(core.Symbol)))();
let ListOfInstanceMirror = () => (ListOfInstanceMirror = dart.constFn(core.List$(mirrors.InstanceMirror)))();
+let FutureOfLibraryMirror = () => (FutureOfLibraryMirror = dart.constFn(async.Future$(mirrors.LibraryMirror)))();
let ListOfCombinatorMirror = () => (ListOfCombinatorMirror = dart.constFn(core.List$(mirrors.CombinatorMirror)))();
let MapOfSymbol$DeclarationMirror = () => (MapOfSymbol$DeclarationMirror = dart.constFn(core.Map$(core.Symbol, mirrors.DeclarationMirror)))();
let ListOfTypeMirror = () => (ListOfTypeMirror = dart.constFn(core.List$(mirrors.TypeMirror)))();
@@ -147,7 +148,6 @@
let ListOfParameterMirror = () => (ListOfParameterMirror = dart.constFn(core.List$(mirrors.ParameterMirror)))();
let IterableOfdouble = () => (IterableOfdouble = dart.constFn(core.Iterable$(core.double)))();
let IterableOfint = () => (IterableOfint = dart.constFn(core.Iterable$(core.int)))();
-let ZoneBinaryCallbackOfdynamic$dynamic$StackTrace = () => (ZoneBinaryCallbackOfdynamic$dynamic$StackTrace = dart.constFn(async.ZoneBinaryCallback$(dart.dynamic, dart.dynamic, core.StackTrace)))();
let _StreamImpl = () => (_StreamImpl = dart.constFn(async._StreamImpl$()))();
let _ControllerStream = () => (_ControllerStream = dart.constFn(async._ControllerStream$()))();
let _BroadcastStream = () => (_BroadcastStream = dart.constFn(async._BroadcastStream$()))();
@@ -169,7 +169,6 @@
let _Completer = () => (_Completer = dart.constFn(async._Completer$()))();
let _AsyncCompleter = () => (_AsyncCompleter = dart.constFn(async._AsyncCompleter$()))();
let _SyncCompleter = () => (_SyncCompleter = dart.constFn(async._SyncCompleter$()))();
-let ZoneBinaryCallbackOfObject$Object$StackTrace = () => (ZoneBinaryCallbackOfObject$Object$StackTrace = dart.constFn(async.ZoneBinaryCallback$(core.Object, core.Object, core.StackTrace)))();
let _FutureListener = () => (_FutureListener = dart.constFn(async._FutureListener$()))();
let _Future = () => (_Future = dart.constFn(async._Future$()))();
let StreamSubscription = () => (StreamSubscription = dart.constFn(async.StreamSubscription$()))();
@@ -205,8 +204,9 @@
let _DoneStreamSubscription = () => (_DoneStreamSubscription = dart.constFn(async._DoneStreamSubscription$()))();
let _AsBroadcastStream = () => (_AsBroadcastStream = dart.constFn(async._AsBroadcastStream$()))();
let _BroadcastSubscriptionWrapper = () => (_BroadcastSubscriptionWrapper = dart.constFn(async._BroadcastSubscriptionWrapper$()))();
-let _StreamIteratorImpl = () => (_StreamIteratorImpl = dart.constFn(async._StreamIteratorImpl$()))();
+let _StreamIterator = () => (_StreamIterator = dart.constFn(async._StreamIterator$()))();
let _EmptyStream = () => (_EmptyStream = dart.constFn(async._EmptyStream$()))();
+let dynamicAndStackTraceTodynamic = () => (dynamicAndStackTraceTodynamic = dart.constFn(dart.functionType(dart.dynamic, [dart.dynamic, core.StackTrace])))();
let _ForwardingStream = () => (_ForwardingStream = dart.constFn(async._ForwardingStream$()))();
let _ForwardingStreamSubscription = () => (_ForwardingStreamSubscription = dart.constFn(async._ForwardingStreamSubscription$()))();
let _Predicate = () => (_Predicate = dart.constFn(async._Predicate$()))();
@@ -309,7 +309,6 @@
let Queue = () => (Queue = dart.constFn(collection.Queue$()))();
let _DoubleLink = () => (_DoubleLink = dart.constFn(collection._DoubleLink$()))();
let DoubleLinkedQueueEntry = () => (DoubleLinkedQueueEntry = dart.constFn(collection.DoubleLinkedQueueEntry$()))();
-let _UserDoubleLinkedQueueEntry = () => (_UserDoubleLinkedQueueEntry = dart.constFn(collection._UserDoubleLinkedQueueEntry$()))();
let _DoubleLinkedQueueEntry = () => (_DoubleLinkedQueueEntry = dart.constFn(collection._DoubleLinkedQueueEntry$()))();
let _DoubleLinkedQueueElement = () => (_DoubleLinkedQueueElement = dart.constFn(collection._DoubleLinkedQueueElement$()))();
let _DoubleLinkedQueueSentinel = () => (_DoubleLinkedQueueSentinel = dart.constFn(collection._DoubleLinkedQueueSentinel$()))();
@@ -338,8 +337,10 @@
let List = () => (List = dart.constFn(core.List$()))();
let StreamOfListOfint = () => (StreamOfListOfint = dart.constFn(async.Stream$(ListOfint())))();
let Converter = () => (Converter = dart.constFn(convert.Converter$()))();
+let ChunkedConverterOfString$ListOfint$String$ListOfint = () => (ChunkedConverterOfString$ListOfint$String$ListOfint = dart.constFn(convert.ChunkedConverter$(core.String, ListOfint(), core.String, ListOfint())))();
let SinkOfListOfint = () => (SinkOfListOfint = dart.constFn(core.Sink$(ListOfint())))();
let StreamOfString = () => (StreamOfString = dart.constFn(async.Stream$(core.String)))();
+let ChunkedConverterOfListOfint$String$ListOfint$String = () => (ChunkedConverterOfListOfint$String$ListOfint$String = dart.constFn(convert.ChunkedConverter$(ListOfint(), core.String, ListOfint(), core.String)))();
let SinkOfString = () => (SinkOfString = dart.constFn(core.Sink$(core.String)))();
let ChunkedConversionSink = () => (ChunkedConversionSink = dart.constFn(convert.ChunkedConversionSink$()))();
let _ChunkedConversionCallbackOfListOfint = () => (_ChunkedConversionCallbackOfListOfint = dart.constFn(convert._ChunkedConversionCallback$(ListOfint())))();
@@ -350,8 +351,12 @@
let _FusedCodec = () => (_FusedCodec = dart.constFn(convert._FusedCodec$()))();
let _InvertedCodec = () => (_InvertedCodec = dart.constFn(convert._InvertedCodec$()))();
let _FusedConverter = () => (_FusedConverter = dart.constFn(convert._FusedConverter$()))();
+let ChunkedConverterOfString$String$String$String = () => (ChunkedConverterOfString$String$String$String = dart.constFn(convert.ChunkedConverter$(core.String, core.String, core.String, core.String)))();
+let ChunkedConverterOfObject$String$Object$String = () => (ChunkedConverterOfObject$String$Object$String = dart.constFn(convert.ChunkedConverter$(core.Object, core.String, core.Object, core.String)))();
let StreamOfObject = () => (StreamOfObject = dart.constFn(async.Stream$(core.Object)))();
let JSArrayOfListOfint = () => (JSArrayOfListOfint = dart.constFn(_interceptors.JSArray$(ListOfint())))();
+let ChunkedConverterOfObject$ListOfint$Object$ListOfint = () => (ChunkedConverterOfObject$ListOfint$Object$ListOfint = dart.constFn(convert.ChunkedConverter$(core.Object, ListOfint(), core.Object, ListOfint())))();
+let ChunkedConverterOfString$Object$String$Object = () => (ChunkedConverterOfString$Object$String$Object = dart.constFn(convert.ChunkedConverter$(core.String, core.Object, core.String, core.Object)))();
let Uint8ListAndintAndintTovoid = () => (Uint8ListAndintAndintTovoid = dart.constFn(dart.functionType(dart.void, [typed_data.Uint8List, core.int, core.int])))();
let EventSinkOfString = () => (EventSinkOfString = dart.constFn(async.EventSink$(core.String)))();
let StreamTransformerOfString$String = () => (StreamTransformerOfString$String = dart.constFn(async.StreamTransformer$(core.String, core.String)))();
@@ -362,59 +367,62 @@
let Expando = () => (Expando = dart.constFn(core.Expando$()))();
let _Generator = () => (_Generator = dart.constFn(core._Generator$()))();
let _GeneratorIterable = () => (_GeneratorIterable = dart.constFn(core._GeneratorIterable$()))();
-let _GeneratorIterator = () => (_GeneratorIterator = dart.constFn(core._GeneratorIterator$()))();
let BidirectionalIterator = () => (BidirectionalIterator = dart.constFn(core.BidirectionalIterator$()))();
let Map$ = () => (Map$ = dart.constFn(core.Map$()))();
let Set = () => (Set = dart.constFn(core.Set$()))();
let Sink = () => (Sink = dart.constFn(core.Sink$()))();
let BidirectionalIteratorOfint = () => (BidirectionalIteratorOfint = dart.constFn(core.BidirectionalIterator$(core.int)))();
+let MapOfString$String = () => (MapOfString$String = dart.constFn(core.Map$(core.String, core.String)))();
let UnmodifiableMapViewOfString$String = () => (UnmodifiableMapViewOfString$String = dart.constFn(collection.UnmodifiableMapView$(core.String, core.String)))();
let MapOfString$ListOfString = () => (MapOfString$ListOfString = dart.constFn(core.Map$(core.String, ListOfString())))();
-let MapOfString$String = () => (MapOfString$String = dart.constFn(core.Map$(core.String, core.String)))();
let IterableOfString = () => (IterableOfString = dart.constFn(core.Iterable$(core.String)))();
let MapOfString$dynamic = () => (MapOfString$dynamic = dart.constFn(core.Map$(core.String, dart.dynamic)))();
+let ListOfUint8List = () => (ListOfUint8List = dart.constFn(core.List$(typed_data.Uint8List)))();
let MapOfString$ServiceExtensionHandler = () => (MapOfString$ServiceExtensionHandler = dart.constFn(core.Map$(core.String, developer.ServiceExtensionHandler)))();
let MapOfString$Metric = () => (MapOfString$Metric = dart.constFn(core.Map$(core.String, developer.Metric)))();
let ListOf_SyncBlock = () => (ListOf_SyncBlock = dart.constFn(core.List$(developer._SyncBlock)))();
let JSArrayOf_AsyncBlock = () => (JSArrayOf_AsyncBlock = dart.constFn(_interceptors.JSArray$(developer._AsyncBlock)))();
let ListOf_AsyncBlock = () => (ListOf_AsyncBlock = dart.constFn(core.List$(developer._AsyncBlock)))();
let CompleterOfUri = () => (CompleterOfUri = dart.constFn(async.Completer$(core.Uri)))();
-let ListOfListOfint = () => (ListOfListOfint = dart.constFn(core.List$(ListOfint())))();
-let FutureOfint = () => (FutureOfint = dart.constFn(async.Future$(core.int)))();
+let JSArrayOfUint8List = () => (JSArrayOfUint8List = dart.constFn(_interceptors.JSArray$(typed_data.Uint8List)))();
+let ChunkedConverterOfListOfint$ListOfint$ListOfint$ListOfint = () => (ChunkedConverterOfListOfint$ListOfint$ListOfint$ListOfint = dart.constFn(convert.ChunkedConverter$(ListOfint(), ListOfint(), ListOfint(), ListOfint())))();
let FutureOfDirectory = () => (FutureOfDirectory = dart.constFn(async.Future$(io.Directory)))();
let FutureOrOfDirectory = () => (FutureOrOfDirectory = dart.constFn(async.FutureOr$(io.Directory)))();
-let StreamOfFileSystemEntity = () => (StreamOfFileSystemEntity = dart.constFn(async.Stream$(io.FileSystemEntity)))();
let JSArrayOfFileSystemEntity = () => (JSArrayOfFileSystemEntity = dart.constFn(_interceptors.JSArray$(io.FileSystemEntity)))();
let FutureOrOfString = () => (FutureOrOfString = dart.constFn(async.FutureOr$(core.String)))();
let FutureOrOfbool = () => (FutureOrOfbool = dart.constFn(async.FutureOr$(core.bool)))();
let FutureOrOfint = () => (FutureOrOfint = dart.constFn(async.FutureOr$(core.int)))();
let ListOfFileSystemEntity = () => (ListOfFileSystemEntity = dart.constFn(core.List$(io.FileSystemEntity)))();
+let StreamControllerOfFileSystemEntity = () => (StreamControllerOfFileSystemEntity = dart.constFn(async.StreamController$(io.FileSystemEntity)))();
let StreamControllerOfListOfint = () => (StreamControllerOfListOfint = dart.constFn(async.StreamController$(ListOfint())))();
let FutureOfRandomAccessFile = () => (FutureOfRandomAccessFile = dart.constFn(async.Future$(io.RandomAccessFile)))();
let CompleterOfFile = () => (CompleterOfFile = dart.constFn(async.Completer$(io.File)))();
+let CompleterOfListOfint = () => (CompleterOfListOfint = dart.constFn(async.Completer$(ListOfint())))();
let FutureOfListOfint = () => (FutureOfListOfint = dart.constFn(async.Future$(ListOfint())))();
let FutureOrOfFile = () => (FutureOrOfFile = dart.constFn(async.FutureOr$(io.File)))();
let FutureOfFile = () => (FutureOfFile = dart.constFn(async.Future$(io.File)))();
-let FutureOrOfListOfint = () => (FutureOrOfListOfint = dart.constFn(async.FutureOr$(ListOfint())))();
+let FutureOfint = () => (FutureOfint = dart.constFn(async.Future$(core.int)))();
let StreamOfHttpRequest = () => (StreamOfHttpRequest = dart.constFn(async.Stream$(io.HttpRequest)))();
let ListOfRedirectInfo = () => (ListOfRedirectInfo = dart.constFn(core.List$(io.RedirectInfo)))();
let HashMapOfString$ListOfString = () => (HashMapOfString$ListOfString = dart.constFn(collection.HashMap$(core.String, ListOfString())))();
let ListOfCookie = () => (ListOfCookie = dart.constFn(core.List$(io.Cookie)))();
let StringAndListOfStringTovoid = () => (StringAndListOfStringTovoid = dart.constFn(dart.functionType(dart.void, [core.String, ListOfString()])))();
let FutureOfHttpClientResponse = () => (FutureOfHttpClientResponse = dart.constFn(async.Future$(io.HttpClientResponse)))();
-let StreamSubscriptionOfListOfint = () => (StreamSubscriptionOfListOfint = dart.constFn(async.StreamSubscription$(ListOfint())))();
let FutureOrOfHttpClientResponse = () => (FutureOrOfHttpClientResponse = dart.constFn(async.FutureOr$(io.HttpClientResponse)))();
let _StreamSinkImpl = () => (_StreamSinkImpl = dart.constFn(io._StreamSinkImpl$()))();
let _HttpOutboundMessage = () => (_HttpOutboundMessage = dart.constFn(io._HttpOutboundMessage$()))();
let CompleterOfHttpClientResponse = () => (CompleterOfHttpClientResponse = dart.constFn(async.Completer$(io.HttpClientResponse)))();
let JSArrayOfRedirectInfo = () => (JSArrayOfRedirectInfo = dart.constFn(_interceptors.JSArray$(io.RedirectInfo)))();
let JSArrayOfFuture = () => (JSArrayOfFuture = dart.constFn(_interceptors.JSArray$(async.Future)))();
+let CompleterOfSocket = () => (CompleterOfSocket = dart.constFn(async.Completer$(io.Socket)))();
let StreamConsumerOfListOfint = () => (StreamConsumerOfListOfint = dart.constFn(async.StreamConsumer$(ListOfint())))();
let CompleterOf_HttpIncoming = () => (CompleterOf_HttpIncoming = dart.constFn(async.Completer$(io._HttpIncoming)))();
-let X509CertificateTobool = () => (X509CertificateTobool = dart.constFn(dart.functionType(core.bool, [io.X509Certificate])))();
let FutureOfSecureSocket = () => (FutureOfSecureSocket = dart.constFn(async.Future$(io.SecureSocket)))();
+let X509CertificateTobool = () => (X509CertificateTobool = dart.constFn(dart.functionType(core.bool, [io.X509Certificate])))();
+let FutureOfSocket = () => (FutureOfSocket = dart.constFn(async.Future$(io.Socket)))();
let HashSetOf_HttpClientConnection = () => (HashSetOf_HttpClientConnection = dart.constFn(collection.HashSet$(io._HttpClientConnection)))();
let FutureOf_ConnectionInfo = () => (FutureOf_ConnectionInfo = dart.constFn(async.Future$(io._ConnectionInfo)))();
+let CompleterOf_ConnectionInfo = () => (CompleterOf_ConnectionInfo = dart.constFn(async.Completer$(io._ConnectionInfo)))();
let FutureOrOf_ConnectionInfo = () => (FutureOrOf_ConnectionInfo = dart.constFn(async.FutureOr$(io._ConnectionInfo)))();
let SetOf_HttpClientConnection = () => (SetOf_HttpClientConnection = dart.constFn(core.Set$(io._HttpClientConnection)))();
let HashMapOfString$_ConnectionTarget = () => (HashMapOfString$_ConnectionTarget = dart.constFn(collection.HashMap$(core.String, io._ConnectionTarget)))();
@@ -436,8 +444,7 @@
let HttpRequestTovoid = () => (HttpRequestTovoid = dart.constFn(dart.functionType(dart.void, [io.HttpRequest])))();
let MapOfint$_HttpServer = () => (MapOfint$_HttpServer = dart.constFn(core.Map$(core.int, io._HttpServer)))();
let ListOf_Proxy = () => (ListOf_Proxy = dart.constFn(core.List$(io._Proxy)))();
-let FutureOfSocket = () => (FutureOfSocket = dart.constFn(async.Future$(io.Socket)))();
-let StreamOfint = () => (StreamOfint = dart.constFn(async.Stream$(core.int)))();
+let StreamSubscriptionOfListOfint = () => (StreamSubscriptionOfListOfint = dart.constFn(async.StreamSubscription$(ListOfint())))();
let StreamControllerOf_HttpIncoming = () => (StreamControllerOf_HttpIncoming = dart.constFn(async.StreamController$(io._HttpIncoming)))();
let _HttpIncomingTovoid = () => (_HttpIncomingTovoid = dart.constFn(dart.functionType(dart.void, [io._HttpIncoming])))();
let MapOfString$_HttpSession = () => (MapOfString$_HttpSession = dart.constFn(core.Map$(core.String, io._HttpSession)))();
@@ -448,14 +455,16 @@
let MapOfint$_SocketResourceInfo = () => (MapOfint$_SocketResourceInfo = dart.constFn(core.Map$(core.int, io._SocketResourceInfo)))();
let StreamSinkOfListOfint = () => (StreamSinkOfListOfint = dart.constFn(async.StreamSink$(ListOfint())))();
let FutureOfLink = () => (FutureOfLink = dart.constFn(async.Future$(io.Link)))();
+let _CaseInsensitiveStringMapOfString = () => (_CaseInsensitiveStringMapOfString = dart.constFn(io._CaseInsensitiveStringMap$(core.String)))();
let _CaseInsensitiveStringMap = () => (_CaseInsensitiveStringMap = dart.constFn(io._CaseInsensitiveStringMap$()))();
+let StreamSubscriptionOfRawSocketEvent = () => (StreamSubscriptionOfRawSocketEvent = dart.constFn(async.StreamSubscription$(io.RawSocketEvent)))();
let FutureOfRawSecureSocket = () => (FutureOfRawSecureSocket = dart.constFn(async.Future$(io.RawSecureSocket)))();
let SecureSocketTovoid = () => (SecureSocketTovoid = dart.constFn(dart.functionType(dart.void, [io.SecureSocket])))();
let StreamControllerOfRawSecureSocket = () => (StreamControllerOfRawSecureSocket = dart.constFn(async.StreamController$(io.RawSecureSocket)))();
let RawSecureSocketTovoid = () => (RawSecureSocketTovoid = dart.constFn(dart.functionType(dart.void, [io.RawSecureSocket])))();
let StreamSubscriptionOfRawSocket = () => (StreamSubscriptionOfRawSocket = dart.constFn(async.StreamSubscription$(io.RawSocket)))();
-let StreamSubscriptionOfRawSocketEvent = () => (StreamSubscriptionOfRawSocketEvent = dart.constFn(async.StreamSubscription$(io.RawSocketEvent)))();
let CompleterOf_RawSecureSocket = () => (CompleterOf_RawSecureSocket = dart.constFn(async.Completer$(io._RawSecureSocket)))();
+let CompleterOfRawSecureSocket = () => (CompleterOfRawSecureSocket = dart.constFn(async.Completer$(io.RawSecureSocket)))();
let StreamControllerOfRawSocketEvent = () => (StreamControllerOfRawSocketEvent = dart.constFn(async.StreamController$(io.RawSocketEvent)))();
let RawSocketEventTovoid = () => (RawSocketEventTovoid = dart.constFn(dart.functionType(dart.void, [io.RawSocketEvent])))();
let StreamOfRawSocketEvent = () => (StreamOfRawSocketEvent = dart.constFn(async.Stream$(io.RawSocketEvent)))();
@@ -464,15 +473,14 @@
let StreamOfSocket = () => (StreamOfSocket = dart.constFn(async.Stream$(io.Socket)))();
let StreamTransformerOfHttpRequest$WebSocket = () => (StreamTransformerOfHttpRequest$WebSocket = dart.constFn(async.StreamTransformer$(io.HttpRequest, io.WebSocket)))();
let ListOfStringTodynamic = () => (ListOfStringTodynamic = dart.constFn(dart.functionType(dart.dynamic, [ListOfString()])))();
+let EventSinkOfListOfint = () => (EventSinkOfListOfint = dart.constFn(async.EventSink$(ListOfint())))();
let StreamTransformerOfListOfint$dynamic = () => (StreamTransformerOfListOfint$dynamic = dart.constFn(async.StreamTransformer$(ListOfint(), dart.dynamic)))();
-let EventSinkOfUint8List = () => (EventSinkOfUint8List = dart.constFn(async.EventSink$(typed_data.Uint8List)))();
let StreamControllerOfWebSocket = () => (StreamControllerOfWebSocket = dart.constFn(async.StreamController$(io.WebSocket)))();
let FutureOfWebSocket = () => (FutureOfWebSocket = dart.constFn(async.Future$(io.WebSocket)))();
-let EventSinkOfListOfint = () => (EventSinkOfListOfint = dart.constFn(async.EventSink$(ListOfint())))();
-let JSArrayOfUint8List = () => (JSArrayOfUint8List = dart.constFn(_interceptors.JSArray$(typed_data.Uint8List)))();
+let FutureOfString = () => (FutureOfString = dart.constFn(async.Future$(core.String)))();
let StreamTransformerOfdynamic$ListOfint = () => (StreamTransformerOfdynamic$ListOfint = dart.constFn(async.StreamTransformer$(dart.dynamic, ListOfint())))();
let MapOfint$_WebSocketImpl = () => (MapOfint$_WebSocketImpl = dart.constFn(core.Map$(core.int, io._WebSocketImpl)))();
-let FutureOfIsolate = () => (FutureOfIsolate = dart.constFn(async.Future$(isolate.Isolate)))();
+let FutureOfIsolate = () => (FutureOfIsolate = dart.constFn(async.Future$(isolate$.Isolate)))();
let JsArray = () => (JsArray = dart.constFn(js.JsArray$()))();
let ExpandoOfFunction = () => (ExpandoOfFunction = dart.constFn(core.Expando$(core.Function)))();
let PointOfnum = () => (PointOfnum = dart.constFn(math.Point$(core.num)))();
@@ -593,6 +601,7 @@
let ElementListOfElement = () => (ElementListOfElement = dart.constFn(html$.ElementList$(html$.Element)))();
let ListOfRectangleOfnum = () => (ListOfRectangleOfnum = dart.constFn(core.List$(RectangleOfnum())))();
let ListOfGamepad = () => (ListOfGamepad = dart.constFn(core.List$(html$.Gamepad)))();
+let SetOfString = () => (SetOfString = dart.constFn(core.Set$(core.String)))();
let ListOfCssClassSetImpl = () => (ListOfCssClassSetImpl = dart.constFn(core.List$(html_common.CssClassSetImpl)))();
let LinkedHashSetOfString = () => (LinkedHashSetOfString = dart.constFn(collection.LinkedHashSet$(core.String)))();
let StringTobool = () => (StringTobool = dart.constFn(dart.functionType(core.bool, [core.String])))();
@@ -638,18 +647,20 @@
let dynamicToListOfString = () => (dynamicToListOfString = dart.constFn(dart.definiteFunctionType(ListOfString(), [dart.dynamic])))();
let dynamicToList = () => (dynamicToList = dart.constFn(dart.definiteFunctionType(core.List, [dart.dynamic])))();
let dynamicAndSetOfNameValuePairTovoid = () => (dynamicAndSetOfNameValuePairTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [dart.dynamic, SetOfNameValuePair()])))();
-let TypeToString = () => (TypeToString = dart.constFn(dart.definiteFunctionType(core.String, [core.Type])))();
-let dynamicToObject = () => (dynamicToObject = dart.constFn(dart.definiteFunctionType(core.Object, [dart.dynamic])))();
+let dynamicAndSetOfNameValuePairAnddynamic__Tovoid = () => (dynamicAndSetOfNameValuePairAnddynamic__Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [dart.dynamic, SetOfNameValuePair(), dart.dynamic, core.bool], {tagTypes: dart.dynamic})))();
+let NameValuePairAndNameValuePairToint = () => (NameValuePairAndNameValuePairToint = dart.constFn(dart.definiteFunctionType(core.int, [_debugger.NameValuePair, _debugger.NameValuePair])))();
+let IterableOfNameValuePairToListOfNameValuePair = () => (IterableOfNameValuePairToListOfNameValuePair = dart.constFn(dart.definiteFunctionType(ListOfNameValuePair(), [IterableOfNameValuePair()])))();
let dynamicAnddynamicToString = () => (dynamicAnddynamicToString = dart.constFn(dart.definiteFunctionType(core.String, [dart.dynamic, dart.dynamic])))();
let dynamicAndStringTobool = () => (dynamicAndStringTobool = dart.constFn(dart.definiteFunctionType(core.bool, [dart.dynamic, core.String])))();
let intAnddynamicToNull = () => (intAnddynamicToNull = dart.constFn(dart.definiteFunctionType(core.Null, [core.int, dart.dynamic])))();
let ObjectAndObjectToObject = () => (ObjectAndObjectToObject = dart.constFn(dart.definiteFunctionType(core.Object, [core.Object, core.Object])))();
let StringTobool$ = () => (StringTobool$ = dart.constFn(dart.definiteFunctionType(core.bool, [core.String])))();
+let dynamicToObject = () => (dynamicToObject = dart.constFn(dart.definiteFunctionType(core.Object, [dart.dynamic])))();
let dynamicTobool$ = () => (dynamicTobool$ = dart.constFn(dart.definiteFunctionType(core.bool, [dart.dynamic])))();
let dynamicAnddynamicToNull = () => (dynamicAnddynamicToNull = dart.constFn(dart.definiteFunctionType(core.Null, [dart.dynamic, dart.dynamic])))();
-let StringAndObjectToNull = () => (StringAndObjectToNull = dart.constFn(dart.definiteFunctionType(core.Null, [core.String, core.Object])))();
let StringToNameValuePair = () => (StringToNameValuePair = dart.constFn(dart.definiteFunctionType(_debugger.NameValuePair, [core.String])))();
let VoidTodynamic$ = () => (VoidTodynamic$ = dart.constFn(dart.definiteFunctionType(dart.dynamic, [])))();
+let StringTodynamic = () => (StringTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.String])))();
let StringAndString__Todynamic = () => (StringAndString__Todynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.String, core.String], [dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic])))();
let VoidToIsolateContext = () => (VoidToIsolateContext = dart.constFn(dart.definiteFunctionType(_foreign_helper.IsolateContext, [])))();
let dynamicAndFunctionTodynamic = () => (dynamicAndFunctionTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [dart.dynamic, core.Function])))();
@@ -663,6 +674,8 @@
let TypeAndStringTodynamic = () => (TypeAndStringTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.Type, core.String])))();
let dynamicAnddynamicTodynamic$ = () => (dynamicAnddynamicTodynamic$ = dart.constFn(dart.definiteFunctionType(dart.dynamic, [dart.dynamic, dart.dynamic])))();
let dynamicAnddynamicToint = () => (dynamicAnddynamicToint = dart.constFn(dart.definiteFunctionType(core.int, [dart.dynamic, dart.dynamic])))();
+let intToint = () => (intToint = dart.constFn(dart.definiteFunctionType(core.int, [core.int])))();
+let StringAndintToint = () => (StringAndintToint = dart.constFn(dart.definiteFunctionType(core.int, [core.String, core.int])))();
let ListOfEToListOfE = () => (ListOfEToListOfE = dart.constFn(dart.definiteFunctionType(E => [core.List$(E), [core.List$(E)]])))();
let StringTovoid$ = () => (StringTovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [core.String])))();
let _IsolateContextAndFunctionTodynamic = () => (_IsolateContextAndFunctionTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [_isolate_helper._IsolateContext, core.Function])))();
@@ -675,10 +688,11 @@
let StringToNull = () => (StringToNull = dart.constFn(dart.definiteFunctionType(core.Null, [core.String])))();
let dynamicToNull$ = () => (dynamicToNull$ = dart.constFn(dart.definiteFunctionType(core.Null, [dart.dynamic])))();
let TimerToNull = () => (TimerToNull = dart.constFn(dart.definiteFunctionType(core.Null, [async.Timer])))();
+let VoidTo_Future = () => (VoidTo_Future = dart.constFn(dart.definiteFunctionType(async._Future, [])))();
+let VoidToFuture = () => (VoidToFuture = dart.constFn(dart.definiteFunctionType(async.Future, [])))();
let dynamicToFuture = () => (dynamicToFuture = dart.constFn(dart.definiteFunctionType(async.Future, [dart.dynamic])))();
let boolToNull = () => (boolToNull = dart.constFn(dart.definiteFunctionType(core.Null, [core.bool])))();
let dynamicAndStackTraceTovoid = () => (dynamicAndStackTraceTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [dart.dynamic, core.StackTrace])))();
-let VoidToFuture = () => (VoidToFuture = dart.constFn(dart.definiteFunctionType(async.Future, [])))();
let VoidToint = () => (VoidToint = dart.constFn(dart.definiteFunctionType(core.int, [])))();
let dynamicAnddynamicToError = () => (dynamicAnddynamicToError = dart.constFn(dart.definiteFunctionType(core.Error, [dart.dynamic, dart.dynamic])))();
let dynamicAnddynamicAnddynamicToError = () => (dynamicAnddynamicAnddynamicToError = dart.constFn(dart.definiteFunctionType(core.Error, [dart.dynamic, dart.dynamic, dart.dynamic])))();
@@ -739,7 +753,7 @@
let _NotificationHandlerToFuture = () => (_NotificationHandlerToFuture = dart.constFn(dart.definiteFunctionType(async.Future, [async._NotificationHandler])))();
let dynamicAndStackTraceToNull = () => (dynamicAndStackTraceToNull = dart.constFn(dart.definiteFunctionType(core.Null, [dart.dynamic, core.StackTrace])))();
let dynamic__Tovoid = () => (dynamic__Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [dart.dynamic], [core.StackTrace])))();
-let FnAndFnAndFnTodynamic = () => (FnAndFnAndFnTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [VoidTodynamic(), dynamicTodynamic(), ZoneBinaryCallbackOfdynamic$dynamic$StackTrace()])))();
+let FnAndFnAndFnTodynamic = () => (FnAndFnAndFnTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [VoidTodynamic(), dynamicTodynamic(), dynamicAndStackTraceTodynamic()])))();
let StreamSubscriptionAnd_FutureAnddynamic__Tovoid = () => (StreamSubscriptionAnd_FutureAnddynamic__Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [async.StreamSubscription, async._Future, dart.dynamic, core.StackTrace])))();
let StreamSubscriptionAnd_FutureTo_ErrorCallback = () => (StreamSubscriptionAnd_FutureTo_ErrorCallback = dart.constFn(dart.definiteFunctionType(async._ErrorCallback, [async.StreamSubscription, async._Future])))();
let StreamSubscriptionAnd_FutureAnddynamicTovoid = () => (StreamSubscriptionAnd_FutureAnddynamicTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [async.StreamSubscription, async._Future, dart.dynamic])))();
@@ -777,12 +791,18 @@
let ObjectAndObjectTobool = () => (ObjectAndObjectTobool = dart.constFn(dart.definiteFunctionType(core.bool, [core.Object, core.Object])))();
let ObjectToint = () => (ObjectToint = dart.constFn(dart.definiteFunctionType(core.int, [core.Object])))();
let ObjectTovoid = () => (ObjectTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.Object])))();
+let MapOfString$StringAndStringToMapOfString$String = () => (MapOfString$StringAndStringToMapOfString$String = dart.constFn(dart.definiteFunctionType(MapOfString$String(), [MapOfString$String(), core.String])))();
+let StringAndintTovoid = () => (StringAndintTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String, core.int])))();
+let String__Tovoid = () => (String__Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String], [dart.dynamic])))();
let StringAndStringTovoid$ = () => (StringAndStringTovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [core.String, core.String])))();
let StringAnddynamicToNull = () => (StringAnddynamicToNull = dart.constFn(dart.definiteFunctionType(core.Null, [core.String, dart.dynamic])))();
-let MapOfString$StringAndStringToMapOfString$String = () => (MapOfString$StringAndStringToMapOfString$String = dart.constFn(dart.definiteFunctionType(MapOfString$String(), [MapOfString$String(), core.String])))();
let intAndintAndintTovoid = () => (intAndintAndintTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.int, core.int, core.int])))();
-let String__Tovoid = () => (String__Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String], [dart.dynamic])))();
let StringAndStringToNull = () => (StringAndStringToNull = dart.constFn(dart.definiteFunctionType(core.Null, [core.String, core.String])))();
+let intToUint8List = () => (intToUint8List = dart.constFn(dart.definiteFunctionType(typed_data.Uint8List, [core.int])))();
+let dynamicAnddynamicToUint8List = () => (dynamicAnddynamicToUint8List = dart.constFn(dart.definiteFunctionType(typed_data.Uint8List, [dart.dynamic, dart.dynamic])))();
+let Uint8ListAndStringAndintTovoid = () => (Uint8ListAndStringAndintTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [typed_data.Uint8List, core.String, core.int])))();
+let VoidToListOfUint8List = () => (VoidToListOfUint8List = dart.constFn(dart.definiteFunctionType(ListOfUint8List(), [])))();
+let StringAndintAndint__Toint = () => (StringAndintAndint__Toint = dart.constFn(dart.definiteFunctionType(core.int, [core.String, core.int, core.int, core.int, ListOfint()])))();
let __Tobool = () => (__Tobool = dart.constFn(dart.definiteFunctionType(core.bool, [], {when: core.bool, message: core.String})))();
let String__Tovoid$ = () => (String__Tovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [core.String], {time: core.DateTime, sequenceNumber: core.int, level: core.int, name: core.String, zone: async.Zone, error: core.Object, stackTrace: core.StackTrace})))();
let StringAndServiceExtensionHandlerTovoid = () => (StringAndServiceExtensionHandlerTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String, developer.ServiceExtensionHandler])))();
@@ -795,10 +815,11 @@
let intAndintAndString__Tovoid$ = () => (intAndintAndString__Tovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [core.int, core.int, core.String, core.String, core.String])))();
let intAndStringAndString__Tovoid = () => (intAndStringAndString__Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.int, core.String, core.String, core.String])))();
let UriTovoid = () => (UriTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.Uri])))();
-let SendPortTovoid = () => (SendPortTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [isolate.SendPort])))();
-let SendPortAndboolTovoid = () => (SendPortAndboolTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [isolate.SendPort, core.bool])))();
+let SendPortTovoid = () => (SendPortTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [isolate$.SendPort])))();
+let SendPortAndboolTovoid = () => (SendPortAndboolTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [isolate$.SendPort, core.bool])))();
+let SendPortToString = () => (SendPortToString = dart.constFn(dart.definiteFunctionType(core.String, [isolate$.SendPort])))();
let dynamicAndStringAndStringTodynamic = () => (dynamicAndStringAndStringTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [dart.dynamic, core.String, core.String])))();
-let ListAndintAndintTo_BufferAndStart = () => (ListAndintAndintTo_BufferAndStart = dart.constFn(dart.definiteFunctionType(io._BufferAndStart, [core.List, core.int, core.int])))();
+let ListOfintAndintAndintTo_BufferAndStart = () => (ListOfintAndintAndintTo_BufferAndStart = dart.constFn(dart.definiteFunctionType(io._BufferAndStart, [ListOfint(), core.int, core.int])))();
let intTovoid = () => (intTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.int])))();
let DirectoryToFutureOfDirectory = () => (DirectoryToFutureOfDirectory = dart.constFn(dart.definiteFunctionType(FutureOfDirectory(), [io.Directory])))();
let boolToFutureOrOfDirectory = () => (boolToFutureOrOfDirectory = dart.constFn(dart.definiteFunctionType(FutureOrOfDirectory(), [core.bool])))();
@@ -817,17 +838,15 @@
let dynamicToFile = () => (dynamicToFile = dart.constFn(dart.definiteFunctionType(io.File, [dart.dynamic])))();
let dynamicTo_RandomAccessFile = () => (dynamicTo_RandomAccessFile = dart.constFn(dart.definiteFunctionType(io._RandomAccessFile, [dart.dynamic])))();
let dynamicToDateTime = () => (dynamicToDateTime = dart.constFn(dart.definiteFunctionType(core.DateTime, [dart.dynamic])))();
-let dynamicToFutureOfListOfint = () => (dynamicToFutureOfListOfint = dart.constFn(dart.definiteFunctionType(FutureOfListOfint(), [dart.dynamic])))();
-let intToFutureOfListOfint = () => (intToFutureOfListOfint = dart.constFn(dart.definiteFunctionType(FutureOfListOfint(), [core.int])))();
let RandomAccessFileToFutureOfListOfint = () => (RandomAccessFileToFutureOfListOfint = dart.constFn(dart.definiteFunctionType(FutureOfListOfint(), [io.RandomAccessFile])))();
+let intToFutureOfListOfint = () => (intToFutureOfListOfint = dart.constFn(dart.definiteFunctionType(FutureOfListOfint(), [core.int])))();
let ListOfintToString = () => (ListOfintToString = dart.constFn(dart.definiteFunctionType(core.String, [ListOfint()])))();
let RandomAccessFileTo_File = () => (RandomAccessFileTo_File = dart.constFn(dart.definiteFunctionType(io._File, [io.RandomAccessFile])))();
let RandomAccessFileToObject = () => (RandomAccessFileToObject = dart.constFn(dart.definiteFunctionType(core.Object, [io.RandomAccessFile])))();
let RandomAccessFileToFutureOrOfFile = () => (RandomAccessFileToFutureOrOfFile = dart.constFn(dart.definiteFunctionType(FutureOrOfFile(), [io.RandomAccessFile])))();
-let dynamicToFutureOrOfListOfint = () => (dynamicToFutureOrOfListOfint = dart.constFn(dart.definiteFunctionType(FutureOrOfListOfint(), [dart.dynamic])))();
+let dynamicToListOfint = () => (dynamicToListOfint = dart.constFn(dart.definiteFunctionType(ListOfint(), [dart.dynamic])))();
let dynamicToFileStat = () => (dynamicToFileStat = dart.constFn(dart.definiteFunctionType(io.FileStat, [dart.dynamic])))();
let StringAndListOfStringToListOfString = () => (StringAndListOfStringToListOfString = dart.constFn(dart.definiteFunctionType(ListOfString(), [core.String, ListOfString()])))();
-let ListOfintTovoid = () => (ListOfintTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [ListOfint()])))();
let StringAndListOfStringToNull = () => (StringAndListOfStringToNull = dart.constFn(dart.definiteFunctionType(core.Null, [core.String, ListOfString()])))();
let CookieToString = () => (CookieToString = dart.constFn(dart.definiteFunctionType(core.String, [io.Cookie])))();
let CookieTobool = () => (CookieTobool = dart.constFn(dart.definiteFunctionType(core.bool, [io.Cookie])))();
@@ -843,11 +862,14 @@
let ListToFutureOrOfHttpClientResponse = () => (ListToFutureOrOfHttpClientResponse = dart.constFn(dart.definiteFunctionType(FutureOrOfHttpClientResponse(), [core.List])))();
let HttpClientResponseTovoid = () => (HttpClientResponseTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [io.HttpClientResponse])))();
let dynamicToIterable = () => (dynamicToIterable = dart.constFn(dart.definiteFunctionType(core.Iterable, [dart.dynamic])))();
+let ListOfintTovoid = () => (ListOfintTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [ListOfint()])))();
let dynamicTo_HttpOutboundMessage = () => (dynamicTo_HttpOutboundMessage = dart.constFn(dart.definiteFunctionType(io._HttpOutboundMessage, [dart.dynamic])))();
let dynamicAnddynamicTo_HttpOutboundMessage = () => (dynamicAnddynamicTo_HttpOutboundMessage = dart.constFn(dart.definiteFunctionType(io._HttpOutboundMessage, [dart.dynamic, dart.dynamic])))();
let dynamic__ToNull$ = () => (dynamic__ToNull$ = dart.constFn(dart.definiteFunctionType(core.Null, [dart.dynamic], [core.StackTrace])))();
let _HttpIncomingToNull = () => (_HttpIncomingToNull = dart.constFn(dart.definiteFunctionType(core.Null, [io._HttpIncoming])))();
-let dynamicTo_DetachedSocket = () => (dynamicTo_DetachedSocket = dart.constFn(dart.definiteFunctionType(io._DetachedSocket, [dart.dynamic])))();
+let SocketToSocket = () => (SocketToSocket = dart.constFn(dart.definiteFunctionType(io.Socket, [io.Socket])))();
+let SocketTo_DetachedSocket = () => (SocketTo_DetachedSocket = dart.constFn(dart.definiteFunctionType(io._DetachedSocket, [io.Socket])))();
+let SocketTovoid = () => (SocketTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [io.Socket])))();
let SecureSocketTo_HttpClientConnection = () => (SecureSocketTo_HttpClientConnection = dart.constFn(dart.definiteFunctionType(io._HttpClientConnection, [io.SecureSocket])))();
let HttpClientResponseToFutureOfSecureSocket = () => (HttpClientResponseToFutureOfSecureSocket = dart.constFn(dart.definiteFunctionType(FutureOfSecureSocket(), [io.HttpClientResponse])))();
let X509CertificateTobool$ = () => (X509CertificateTobool$ = dart.constFn(dart.definiteFunctionType(core.bool, [io.X509Certificate])))();
@@ -861,14 +883,15 @@
let dynamicToFutureOf_ConnectionInfo = () => (dynamicToFutureOf_ConnectionInfo = dart.constFn(dart.definiteFunctionType(FutureOf_ConnectionInfo(), [dart.dynamic])))();
let VoidToFutureOf_ConnectionInfo = () => (VoidToFutureOf_ConnectionInfo = dart.constFn(dart.definiteFunctionType(FutureOf_ConnectionInfo(), [])))();
let _SiteCredentialsAnd_CredentialsTo_SiteCredentials = () => (_SiteCredentialsAnd_CredentialsTo_SiteCredentials = dart.constFn(dart.definiteFunctionType(io._SiteCredentials, [io._SiteCredentials, io._Credentials])))();
+let SocketToNull = () => (SocketToNull = dart.constFn(dart.definiteFunctionType(core.Null, [io.Socket])))();
+let dynamicTo_DetachedSocket = () => (dynamicTo_DetachedSocket = dart.constFn(dart.definiteFunctionType(io._DetachedSocket, [dart.dynamic])))();
let ServerSocketTo_HttpServer = () => (ServerSocketTo_HttpServer = dart.constFn(dart.definiteFunctionType(io._HttpServer, [io.ServerSocket])))();
let SecureServerSocketTo_HttpServer = () => (SecureServerSocketTo_HttpServer = dart.constFn(dart.definiteFunctionType(io._HttpServer, [io.SecureServerSocket])))();
-let SocketToNull = () => (SocketToNull = dart.constFn(dart.definiteFunctionType(core.Null, [io.Socket])))();
let _HttpConnectionToNull = () => (_HttpConnectionToNull = dart.constFn(dart.definiteFunctionType(core.Null, [io._HttpConnection])))();
let _HttpConnectionToMap = () => (_HttpConnectionToMap = dart.constFn(dart.definiteFunctionType(core.Map, [io._HttpConnection])))();
-let _FileResourceInfoToMapOfString$String = () => (_FileResourceInfoToMapOfString$String = dart.constFn(dart.definiteFunctionType(MapOfString$String(), [io._FileResourceInfo])))();
-let _ProcessResourceInfoToMapOfString$String = () => (_ProcessResourceInfoToMapOfString$String = dart.constFn(dart.definiteFunctionType(MapOfString$String(), [io._ProcessResourceInfo])))();
-let _SocketResourceInfoToMapOfString$String = () => (_SocketResourceInfoToMapOfString$String = dart.constFn(dart.definiteFunctionType(MapOfString$String(), [io._SocketResourceInfo])))();
+let _FileResourceInfoToMapOfString$dynamic = () => (_FileResourceInfoToMapOfString$dynamic = dart.constFn(dart.definiteFunctionType(MapOfString$dynamic(), [io._FileResourceInfo])))();
+let _ProcessResourceInfoToMapOfString$dynamic = () => (_ProcessResourceInfoToMapOfString$dynamic = dart.constFn(dart.definiteFunctionType(MapOfString$dynamic(), [io._ProcessResourceInfo])))();
+let _SocketResourceInfoToMapOfString$dynamic = () => (_SocketResourceInfoToMapOfString$dynamic = dart.constFn(dart.definiteFunctionType(MapOfString$dynamic(), [io._SocketResourceInfo])))();
let dynamicTo_Link = () => (dynamicTo_Link = dart.constFn(dart.definiteFunctionType(io._Link, [dart.dynamic])))();
let FileSystemEntityToFutureOfLink = () => (FileSystemEntityToFutureOfLink = dart.constFn(dart.definiteFunctionType(FutureOfLink(), [io.FileSystemEntity])))();
let FileSystemEntityTo_Link = () => (FileSystemEntityTo_Link = dart.constFn(dart.definiteFunctionType(io._Link, [io.FileSystemEntity])))();
@@ -881,7 +904,6 @@
let RawSecureSocketToNull = () => (RawSecureSocketToNull = dart.constFn(dart.definiteFunctionType(core.Null, [io.RawSecureSocket])))();
let RawSocketToFutureOfRawSecureSocket = () => (RawSocketToFutureOfRawSecureSocket = dart.constFn(dart.definiteFunctionType(FutureOfRawSecureSocket(), [io.RawSocket])))();
let _FilterStatusToNull = () => (_FilterStatusToNull = dart.constFn(dart.definiteFunctionType(core.Null, [io._FilterStatus])))();
-let intToint = () => (intToint = dart.constFn(dart.definiteFunctionType(core.int, [core.int])))();
let dynamicTo_FilterStatus = () => (dynamicTo_FilterStatus = dart.constFn(dart.definiteFunctionType(io._FilterStatus, [dart.dynamic])))();
let ListOfintAndStringTovoid = () => (ListOfintAndStringTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [ListOfint(), core.String])))();
let dynamicToStdioType = () => (dynamicToStdioType = dart.constFn(dart.definiteFunctionType(io.StdioType, [dart.dynamic])))();
@@ -889,14 +911,13 @@
let WebSocketTovoid = () => (WebSocketTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [io.WebSocket])))();
let HttpRequestToNull = () => (HttpRequestToNull = dart.constFn(dart.definiteFunctionType(core.Null, [io.HttpRequest])))();
let SocketTo_WebSocketImpl = () => (SocketTo_WebSocketImpl = dart.constFn(dart.definiteFunctionType(io._WebSocketImpl, [io.Socket])))();
-let StringToFuture = () => (StringToFuture = dart.constFn(dart.definiteFunctionType(async.Future, [core.String])))();
+let StringToFutureOfWebSocket = () => (StringToFutureOfWebSocket = dart.constFn(dart.definiteFunctionType(FutureOfWebSocket(), [core.String])))();
let EventSinkOfListOfintTo_WebSocketOutgoingTransformer = () => (EventSinkOfListOfintTo_WebSocketOutgoingTransformer = dart.constFn(dart.definiteFunctionType(io._WebSocketOutgoingTransformer, [EventSinkOfListOfint()])))();
-let dynamicTo_WebSocketImpl = () => (dynamicTo_WebSocketImpl = dart.constFn(dart.definiteFunctionType(io._WebSocketImpl, [dart.dynamic])))();
let HttpClientResponseToFutureOfWebSocket = () => (HttpClientResponseToFutureOfWebSocket = dart.constFn(dart.definiteFunctionType(FutureOfWebSocket(), [io.HttpClientResponse])))();
let StringAnddynamicTovoid = () => (StringAnddynamicTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String, dart.dynamic])))();
let HttpClientRequestToFutureOfHttpClientResponse = () => (HttpClientRequestToFutureOfHttpClientResponse = dart.constFn(dart.definiteFunctionType(FutureOfHttpClientResponse(), [io.HttpClientRequest])))();
let dynamicToMap = () => (dynamicToMap = dart.constFn(dart.definiteFunctionType(core.Map, [dart.dynamic])))();
-let ListToIsolate = () => (ListToIsolate = dart.constFn(dart.definiteFunctionType(isolate.Isolate, [core.List])))();
+let ListToIsolate = () => (ListToIsolate = dart.constFn(dart.definiteFunctionType(isolate$.Isolate, [core.List])))();
let dynamicTo_DartObject = () => (dynamicTo_DartObject = dart.constFn(dart.definiteFunctionType(js._DartObject, [dart.dynamic])))();
let dynamicAnddynamicAndFnToObject = () => (dynamicAnddynamicAndFnToObject = dart.constFn(dart.definiteFunctionType(core.Object, [dart.dynamic, dart.dynamic, dynamicTodynamic()])))();
let FToF = () => (FToF = dart.constFn(dart.definiteFunctionType(F => [F, [F]])))();
@@ -1461,8 +1482,8 @@
dart.getIsNamedConstructor = function(value) {
return value[dart.isNamedConstructor];
};
-dart.getDartLibraryName = function(value) {
- return value[dart_library.dartLibraryName];
+dart.getModuleName = function(value) {
+ return value[dart._moduleName];
};
dart.tag = function(value, t) {
value[dart._runtimeType] = t;
@@ -1473,6 +1494,18 @@
dart.tagLazy = function(value, compute) {
dart.defineLazyProperty(value, dart._runtimeType, {get: compute});
};
+dart.getModuleNames = function() {
+ return Array.from(dart._loadedModules.keys());
+};
+dart.getModuleLibraries = function(name) {
+ let module = dart._loadedModules.get(name);
+ if (module == null) return null;
+ module[dart._moduleName] = name;
+ return module;
+};
+dart.trackLibraries = function(moduleName, libraries) {
+ dart._loadedModules.set(moduleName, libraries);
+};
dart._warn = function(arg) {
console.warn(arg);
};
@@ -1615,6 +1648,9 @@
dart.definiteFunctionType = function(returnType, args, extra) {
return dart._functionType(true, returnType, args, extra);
};
+dart.isType = function(obj) {
+ return dart._getRuntimeType(obj) === core.Type;
+};
dart.typeName = function(type) {
if (type === void 0) return "undefined type";
if (type === null) return "null type";
@@ -2039,7 +2075,7 @@
return name;
};
dart._dartSymbol = function(name) {
- return core.Symbol._check(typeof name === "symbol" ? dart.const(new _internal.Symbol.es6(dart._toSymbolName(name), name)) : dart.const(core.Symbol.new(dart._toDisplayName(name))));
+ return core.Symbol._check(typeof name === "symbol" ? dart.const(new _internal.PrivateSymbol(dart._toSymbolName(name), name)) : dart.const(core.Symbol.new(dart._toDisplayName(name))));
};
dart.extractNamedArgs = function(args) {
if (args.length > 0) {
@@ -2433,6 +2469,7 @@
return obj[dartx.toString]();
}
if (typeof obj == "function") {
+ if (dart.test(dart.isType(obj))) return dart.typeName(obj);
return "Closure: " + dart.getReifiedType(obj) + " from: " + obj;
}
return obj.toString();
@@ -2637,12 +2674,19 @@
dart.dartx = dartx;
dart._runtimeType = Symbol("_runtimeType");
dart.isNamedConstructor = Symbol("isNamedConstructor");
+dart._moduleName = Symbol("_moduleName");
dart.defineLazy(dart, {
get _lazyJSTypes() {
return new Map();
},
set _lazyJSTypes(_) {}
});
+dart.defineLazy(dart, {
+ get _loadedModules() {
+ return new Map();
+ },
+ set _loadedModules(_) {}
+});
dart.metadata = Symbol("metadata");
dart._typeObject = Symbol("typeObject");
core.Object = class Object {
@@ -3196,9 +3240,51 @@
names: ['getProperty', 'setProperty']
});
_debugger.addMetadataChildren = function(object, ret) {
- ret.add(new _debugger.NameValuePair({name: _debugger.getTypeName(core.Type._check(_debugger._getType(object))), value: object, config: _debugger.JsonMLConfig.asClass}));
+ ret.add(new _debugger.NameValuePair({name: "[[class]]", value: dart.getReifiedType(object), config: _debugger.JsonMLConfig.asClass}));
};
dart.lazyFn(_debugger.addMetadataChildren, () => dynamicAndSetOfNameValuePairTovoid());
+_debugger.addPropertiesFromSignature = function(sig, properties, object, walkPrototypeChain, opts) {
+ let tagTypes = opts && 'tagTypes' in opts ? opts.tagTypes : false;
+ let skippedNames = core.Set.new();
+ skippedNames.add('hashCode');
+ while (sig != null) {
+ for (let symbol of _debugger.getOwnPropertySymbols(sig)) {
+ let dartName = _debugger.symbolName(symbol);
+ let dartXPrefix = 'dartx.';
+ if (dart.test(dartName[dartx.startsWith](dartXPrefix))) {
+ dartName = dartName[dartx.substring](dartXPrefix[dartx.length]);
+ }
+ if (dart.test(skippedNames.contains(dartName))) continue;
+ let value = _debugger.safeGetProperty(object, symbol);
+ if (dart.test(tagTypes) && _debugger._typeof(value) == 'function') {
+ dart.tag(value, sig[symbol]);
+ }
+ properties.add(new _debugger.NameValuePair({name: dartName, value: value}));
+ }
+ for (let name of _debugger.getOwnPropertyNames(sig)) {
+ let value = _debugger.safeGetProperty(object, name);
+ if (dart.test(skippedNames.contains(name))) continue;
+ if (dart.test(tagTypes) && _debugger._typeof(value) == 'function') {
+ dart.tag(value, sig[name]);
+ }
+ properties.add(new _debugger.NameValuePair({name: name, value: value}));
+ }
+ if (!dart.test(walkPrototypeChain)) break;
+ sig = _debugger.safeGetProperty(sig, '__proto__');
+ }
+};
+dart.lazyFn(_debugger.addPropertiesFromSignature, () => dynamicAndSetOfNameValuePairAnddynamic__Tovoid());
+_debugger.sortProperties = function(properties) {
+ let sortedProperties = properties[dartx.toList]();
+ sortedProperties[dartx.sort](dart.fn((a, b) => {
+ let aPrivate = a.name[dartx.startsWith]('_');
+ let bPrivate = b.name[dartx.startsWith]('_');
+ if (aPrivate != bPrivate) return dart.test(aPrivate) ? 1 : -1;
+ return a.name[dartx.compareTo](b.name);
+ }, NameValuePairAndNameValuePairToint()));
+ return sortedProperties;
+};
+dart.lazyFn(_debugger.sortProperties, () => IterableOfNameValuePairToListOfNameValuePair());
_debugger.getObjectTypeName = function(object) {
let reifiedType = dart.getReifiedType(object);
if (reifiedType == null) {
@@ -3207,7 +3293,7 @@
}
return '<Error getting type name>';
}
- return _debugger.getTypeName(core.Type._check(reifiedType));
+ return _debugger.getTypeName(reifiedType);
};
dart.lazyFn(_debugger.getObjectTypeName, () => dynamicToString());
_debugger.getTypeName = function(type) {
@@ -3215,11 +3301,7 @@
if (name == 'JSArray<dynamic>' || name == 'JSObject<Array>') return 'List<dynamic>';
return name;
};
-dart.lazyFn(_debugger.getTypeName, () => TypeToString());
-_debugger._getType = function(object) {
- return core.Type.is(object) ? object : dart.getReifiedType(object);
-};
-dart.fn(_debugger._getType, dynamicToObject());
+dart.lazyFn(_debugger.getTypeName, () => dynamicToString());
const _simpleFormatter = Symbol('_simpleFormatter');
_debugger.safePreview = function(object, config) {
try {
@@ -3259,7 +3341,9 @@
this.hideName = hideName;
}
['=='](other) {
- return _debugger.NameValuePair.is(other) && other.name == this.name;
+ if (!_debugger.NameValuePair.is(other)) return false;
+ if (dart.test(this.hideName) || dart.test(dart.dload(other, 'hideName'))) return core.identical(this, other);
+ return dart.equals(dart.dload(other, 'name'), this.name);
}
get hashCode() {
return dart.hashCode(this.name);
@@ -3452,7 +3536,7 @@
});
_debugger.isNativeJavaScriptObject = function(object) {
let type = _debugger._typeof(object);
- return type != 'object' && type != 'function' || dart.JSObject.is(object) || html$.Node.is(object);
+ return type != 'object' && type != 'function' || dart.test(dart.isJsInterop(object)) || html$.Node.is(object);
};
dart.lazyFn(_debugger.isNativeJavaScriptObject, () => dynamicTobool$());
_debugger.JsonMLFormatter = class JsonMLFormatter extends core.Object {
@@ -3488,24 +3572,37 @@
body.addStyle('color: rgb(196, 26, 22);');
}
let children = this[_simpleFormatter].children(object, config);
+ if (children == null) return body.toJsonML();
for (let child of children) {
let li = body.createChild('li');
- let nameSpan = new _debugger.JsonMLElement('span');
- nameSpan.createTextChild(dart.test(child.displayName[dartx.isNotEmpty]) ? dart.str`${child.displayName}: ` : '');
- nameSpan.setStyle('color: rgb(136, 19, 145);');
+ li.setStyle("padding-left: 13px;");
+ let nameSpan = null;
+ let valueStyle = '';
+ if (!dart.test(child.hideName)) {
+ nameSpan = new _debugger.JsonMLElement('span');
+ nameSpan.createTextChild(dart.test(child.displayName[dartx.isNotEmpty]) ? dart.str`${child.displayName}: ` : '');
+ nameSpan.setStyle('color: rgb(136, 19, 145); margin-right: -13px');
+ valueStyle = 'margin-left: 13px';
+ }
if (_debugger._typeof(child.value) == 'object' || _debugger._typeof(child.value) == 'function') {
- nameSpan.addStyle("padding-left: 13px;");
- li.appendChild(nameSpan);
- let objectTag = li.createObjectTag(child.value);
- objectTag.addAttribute('config', child.config);
- if (!dart.test(this[_simpleFormatter].hasChildren(child.value, child.config))) {
- li.setStyle("padding-left: 13px;");
+ let valueSpan = new _debugger.JsonMLElement('span');
+ valueSpan.setStyle(valueStyle);
+ valueSpan.createObjectTag(child.value).addAttribute('config', child.config);
+ if (nameSpan != null) {
+ li.appendChild(nameSpan);
}
+ li.appendChild(valueSpan);
} else {
- li.setStyle("padding-left: 13px;");
- let _ = li.createChild('span');
- _.appendChild(nameSpan);
- _.createTextChild(_debugger.safePreview(child.value, child.config));
+ let line = li.createChild('span');
+ if (nameSpan != null) {
+ line.appendChild(nameSpan);
+ }
+ line.appendChild((() => {
+ let _ = new _debugger.JsonMLElement('span');
+ _.createTextChild(_debugger.safePreview(child.value, child.config));
+ _.setStyle(valueStyle);
+ return _;
+ })());
}
}
return body.toJsonML();
@@ -3528,7 +3625,7 @@
_debugger.DartFormatter = class DartFormatter extends core.Object {
new() {
this[_formatters] = null;
- this[_formatters] = JSArrayOfFormatter().of([new _debugger.ClassFormatter(), new _debugger.NamedConstructorFormatter(), new _debugger.MapFormatter(), new _debugger.IterableFormatter(), new _debugger.IterableSpanFormatter(), new _debugger.MapEntryFormatter(), new _debugger.StackTraceFormatter(), new _debugger.FunctionFormatter(), new _debugger.HeritageClauseFormatter(), new _debugger.LibraryModuleFormatter(), new _debugger.LibraryFormatter(), new _debugger.ObjectFormatter()]);
+ this[_formatters] = JSArrayOfFormatter().of([new _debugger.ClassFormatter(), new _debugger.TypeFormatter(), new _debugger.NamedConstructorFormatter(), new _debugger.MapFormatter(), new _debugger.IterableFormatter(), new _debugger.IterableSpanFormatter(), new _debugger.MapEntryFormatter(), new _debugger.StackTraceFormatter(), new _debugger.FunctionFormatter(), new _debugger.HeritageClauseFormatter(), new _debugger.LibraryModuleFormatter(), new _debugger.LibraryFormatter(), new _debugger.ObjectFormatter()]);
}
preview(object, config) {
try {
@@ -3592,42 +3689,14 @@
return true;
}
children(object) {
- let properties = LinkedHashSetOfNameValuePair().new();
- _debugger.addMetadataChildren(object, properties);
- let current = object;
- let protoChain = JSArrayOfObject().of([]);
- while (current != null && !dart.test(_debugger.isNativeJavaScriptObject(current)) && current !== Object.prototype) {
- protoChain[dartx.add](current);
- current = _debugger.safeGetProperty(current, '__proto__');
- }
- for (current of protoChain) {
- for (let symbol of _debugger.getOwnPropertySymbols(current)) {
- let dartName = _debugger.symbolName(symbol);
- if (dart.test(_debugger.hasMethod(object, dartName))) {
- continue;
- }
- let dartXPrefix = 'dartx.';
- if (dart.test(dartName[dartx.startsWith](dartXPrefix))) {
- dartName = dartName[dartx.substring](dartXPrefix[dartx.length]);
- } else if (!dart.test(dartName[dartx.startsWith]('_'))) {
- continue;
- }
- let value = _debugger.safeGetProperty(object, symbol);
- properties.add(new _debugger.NameValuePair({name: dartName, value: value}));
- }
- }
- for (current of protoChain) {
- let className = dart.dload(dart.getReifiedType(current), 'name');
- for (let name of _debugger.getOwnPropertyNames(current)) {
- if (dart.test(_debugger.ObjectFormatter._customNames.contains(name)) || dart.equals(name, className)) continue;
- if (dart.test(_debugger.hasMethod(object, name))) {
- continue;
- }
- let value = _debugger.safeGetProperty(object, name);
- properties.add(new _debugger.NameValuePair({name: name, value: value}));
- }
- }
- return properties.toList();
+ let type = dart.getType(object);
+ let ret = LinkedHashSetOfNameValuePair().new();
+ let properties = SetOfNameValuePair().new();
+ _debugger.addPropertiesFromSignature(dart.getFieldSig(type), properties, object, true);
+ _debugger.addPropertiesFromSignature(dart.getGetterSig(type), properties, object, true);
+ ret.addAll(_debugger.sortProperties(properties));
+ _debugger.addMetadataChildren(object, ret);
+ return ret.toList();
}
};
dart.setSignature(_debugger.ObjectFormatter, {
@@ -3638,28 +3707,16 @@
children: dart.definiteFunctionType(core.List$(_debugger.NameValuePair), [dart.dynamic])
})
});
-dart.defineLazy(_debugger.ObjectFormatter, {
- get _customNames() {
- return (() => {
- let _ = SetOfString().new();
- _.add('constructor');
- _.add('prototype');
- _.add('__proto__');
- return _;
- })();
- },
- set _customNames(_) {}
-});
_debugger.LibraryModuleFormatter = class LibraryModuleFormatter extends core.Object {
accept(object, config) {
- return dart.getDartLibraryName(object) != null;
+ return dart.getModuleName(object) != null;
}
hasChildren(object) {
return true;
}
preview(object) {
- let libraryNames = dart.dsend(dart.getDartLibraryName(object), 'split', '/');
- if (dart.test(dart.dsend(dart.dload(libraryNames, 'length'), '>', 1))) {
+ let libraryNames = dart.dsend(dart.getModuleName(object), 'split', '/');
+ if (dart.test(dart.dsend(dart.dload(libraryNames, 'length'), '>', 1)) && dart.equals(dart.dload(libraryNames, 'last'), dart.dindex(libraryNames, dart.dsend(dart.dload(libraryNames, 'length'), '-', 2)))) {
dart.dsetindex(libraryNames, dart.dsend(dart.dload(libraryNames, 'length'), '-', 1), '');
}
return dart.str`Library Module: ${dart.dsend(libraryNames, 'join', '/')}`;
@@ -3668,7 +3725,6 @@
let children = LinkedHashSetOfNameValuePair().new();
for (let name of _debugger.getOwnPropertyNames(object)) {
let value = _debugger.safeGetProperty(object, name);
- name = dart.str`${name[dartx.replaceAll]("__", "/")}.dart`;
children.add(new _debugger.NameValuePair({name: name, value: new _debugger.Library(name, value), hideName: true}));
}
return children.toList();
@@ -3698,36 +3754,16 @@
}
children(object) {
let children = LinkedHashSetOfNameValuePair().new();
- let nonGenericProperties = LinkedHashMapOfString$Object().new();
let objectProperties = _debugger.safeProperties(dart.dload(object, 'object'));
dart.dsend(objectProperties, 'forEach', dart.fn((name, value) => {
- let genericTypeConstructor = dart.getGenericTypeCtor(value);
- if (genericTypeConstructor != null) {
- this.recordGenericParameters(core.String._check(name), genericTypeConstructor);
- } else {
- nonGenericProperties._set(core.String._check(name), value);
- }
+ if (dart.getGenericTypeCtor(value) != null) return;
+ children.add(_debugger.NameValuePair._check(dart.test(dart.isType(value)) ? this.classChild(core.String._check(name), value) : new _debugger.NameValuePair({name: core.String._check(name), value: value})));
}, dynamicAnddynamicToNull()));
- nonGenericProperties.forEach(dart.fn((name, value) => {
- if (core.Type.is(value)) {
- children.add(_debugger.NameValuePair._check(this.classChild(name, value)));
- } else {
- children.add(new _debugger.NameValuePair({name: name, value: value}));
- }
- }, StringAndObjectToNull()));
return children.toList();
}
- recordGenericParameters(name, genericTypeConstructor) {
- this.genericParameters._set(name, genericTypeConstructor.toString()[dartx.split](' =>')[dartx.first][dartx.replaceAll](core.RegExp.new('[(|)]'), ''));
- }
classChild(name, child) {
- let typeName = _debugger.getTypeName(core.Type._check(child));
- let parameterName = dart.str`${name}\$`;
- if (dart.test(this.genericParameters.keys[dartx.contains](parameterName))) {
- typeName = dart.str`${typeName}<${this.genericParameters._get(parameterName)}>`;
- _debugger.JSNative.setProperty(child, 'genericTypeName', typeName);
- }
- return new _debugger.NameValuePair({name: typeName, value: child});
+ let typeName = _debugger.getTypeName(child);
+ return new _debugger.NameValuePair({name: typeName, value: child, config: _debugger.JsonMLConfig.asClass});
}
};
_debugger.LibraryFormatter[dart.implements] = () => [_debugger.Formatter];
@@ -3738,7 +3774,6 @@
hasChildren: dart.definiteFunctionType(core.bool, [dart.dynamic]),
preview: dart.definiteFunctionType(core.String, [dart.dynamic]),
children: dart.definiteFunctionType(core.List$(_debugger.NameValuePair), [dart.dynamic]),
- recordGenericParameters: dart.definiteFunctionType(dart.dynamic, [core.String, core.Object]),
classChild: dart.definiteFunctionType(dart.dynamic, [core.String, core.Object])
})
});
@@ -3955,60 +3990,49 @@
});
_debugger.ClassFormatter = class ClassFormatter extends core.Object {
accept(object, config) {
- return core.Type.is(object) || dart.equals(config, _debugger.JsonMLConfig.asClass);
+ return dart.equals(config, _debugger.JsonMLConfig.asClass);
}
- preview(object) {
- let typeName = _debugger.safeGetProperty(object, 'genericTypeName');
- if (typeName != null) return core.String._check(typeName);
- let type = _debugger._getType(object);
+ preview(type) {
let implements$ = dart.getImplements(type);
- typeName = _debugger.getTypeName(core.Type._check(type));
+ let typeName = _debugger.getTypeName(type);
if (implements$ != null) {
let typeNames = dart.dsend(dart.dcall(implements$), 'map', _debugger.getTypeName);
return dart.str`${typeName} implements ${dart.dsend(typeNames, 'join', ", ")}`;
} else {
- return core.String._check(typeName);
+ return typeName;
}
}
hasChildren(object) {
return true;
}
- children(object) {
- let type = _debugger._getType(object);
- let children = JSArrayOfNameValuePair().of([]);
- let typeName = _debugger.getTypeName(core.Type._check(_debugger._getType(object)));
+ children(type) {
+ let ret = LinkedHashSetOfNameValuePair().new();
+ let staticProperties = SetOfNameValuePair().new();
+ let staticMethods = SetOfNameValuePair().new();
+ _debugger.addPropertiesFromSignature(dart.getStaticFieldSig(type), staticProperties, type, false);
+ _debugger.addPropertiesFromSignature(dart.getStaticGetterSig(type), staticProperties, type, false);
+ _debugger.addPropertiesFromSignature(dart.getStaticSig(type), staticMethods, type, false);
+ if (dart.test(staticProperties.isNotEmpty) || dart.test(staticMethods.isNotEmpty)) {
+ ret.add(new _debugger.NameValuePair({value: '[[Static members]]', hideName: true}));
+ ret.addAll(_debugger.sortProperties(staticProperties));
+ ret.addAll(_debugger.sortProperties(staticMethods));
+ }
+ let instanceMethods = SetOfNameValuePair().new();
+ _debugger.addPropertiesFromSignature(dart.getMethodSig(type), instanceMethods, type.prototype, false, {tagTypes: true});
+ if (dart.test(instanceMethods.isNotEmpty)) {
+ ret.add(new _debugger.NameValuePair({value: '[[Instance Methods]]', hideName: true}));
+ ret.addAll(_debugger.sortProperties(instanceMethods));
+ }
+ let typeName = _debugger.getTypeName(type);
let mixins = dart.getMixins(type);
if (mixins != null && dart.test(dart.dload(mixins, 'isNotEmpty'))) {
- children[dartx.add](new _debugger.NameValuePair({name: '[[Mixins]]', value: new _debugger.HeritageClause('mixins', core.List._check(mixins))}));
+ ret.add(new _debugger.NameValuePair({name: '[[Mixins]]', value: new _debugger.HeritageClause('mixins', core.List._check(mixins))}));
}
- let hiddenProperties = JSArrayOfString().of(['length', 'name', 'prototype', 'genericTypeName']);
- for (let name of _debugger.getOwnPropertyNames(object)) {
- if (dart.test(hiddenProperties[dartx.contains](name))) continue;
- let value = _debugger.safeGetProperty(object, name);
- if (value != null && dart.getIsNamedConstructor(value) != null) {
- value = new _debugger.NamedConstructor(value);
- name = dart.str`${typeName}.${name}`;
- }
- children[dartx.add](new _debugger.NameValuePair({name: name, value: value}));
+ let baseProto = type.__proto__;
+ if (baseProto != null && !dart.test(dart.isJsInterop(baseProto))) {
+ ret.add(new _debugger.NameValuePair({name: "[[base class]]", value: baseProto, config: _debugger.JsonMLConfig.asClass}));
}
- let hiddenPrototypeProperties = JSArrayOfString().of(['constructor', 'new', '$identityHash']);
- let prototype = object.prototype;
- if (prototype != null) {
- for (let name of _debugger.getOwnPropertyNames(prototype)) {
- if (dart.test(hiddenPrototypeProperties[dartx.contains](name))) continue;
- let func = _debugger.safeGetProperty(prototype, name);
- let constructor = _debugger.safeGetProperty(prototype, 'constructor');
- let sigObj = dart.getMethodSig(constructor);
- if (sigObj != null) {
- let value = _debugger.safeGetProperty(sigObj, name);
- if (_debugger.getTypeName(core.Type._check(dart.getReifiedType(value))) != 'Null') {
- dart.tag(func, value);
- children[dartx.add](new _debugger.NameValuePair({name: name, value: func}));
- }
- }
- }
- }
- return children;
+ return ret.toList();
}
};
_debugger.ClassFormatter[dart.implements] = () => [_debugger.Formatter];
@@ -4020,11 +4044,42 @@
children: dart.definiteFunctionType(core.List$(_debugger.NameValuePair), [dart.dynamic])
})
});
+_debugger.TypeFormatter = class TypeFormatter extends core.Object {
+ accept(object, config) {
+ return core.Type.is(object);
+ }
+ preview(object) {
+ return dart.toString(object);
+ }
+ hasChildren(object) {
+ return false;
+ }
+ children(object) {
+ return JSArrayOfNameValuePair().of([]);
+ }
+};
+_debugger.TypeFormatter[dart.implements] = () => [_debugger.Formatter];
+dart.setSignature(_debugger.TypeFormatter, {
+ methods: () => ({
+ accept: dart.definiteFunctionType(core.bool, [dart.dynamic, dart.dynamic]),
+ preview: dart.definiteFunctionType(core.String, [dart.dynamic]),
+ hasChildren: dart.definiteFunctionType(core.bool, [dart.dynamic]),
+ children: dart.definiteFunctionType(core.List$(_debugger.NameValuePair), [dart.dynamic])
+ })
+});
_debugger.registerDevtoolsFormatter = function() {
let formatters = JSArrayOfJsonMLFormatter().of([_debugger._devtoolsFormatter]);
dart.global.devtoolsFormatters = formatters;
};
dart.fn(_debugger.registerDevtoolsFormatter, VoidTodynamic$());
+_debugger.getModuleNames = function() {
+ return dart.getModuleNames();
+};
+dart.fn(_debugger.getModuleNames, VoidTodynamic$());
+_debugger.getModuleLibraries = function(name) {
+ return dart.getModuleLibraries(name);
+};
+dart.lazyFn(_debugger.getModuleLibraries, () => StringTodynamic());
_foreign_helper.JS = function(typeDescription, codeTemplate, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11) {
if (arg0 === void 0) arg0 = null;
if (arg1 === void 0) arg1 = null;
@@ -4358,7 +4413,7 @@
IterableOfE()._check(iterable);
this[dartx.checkGrowable]('insertAll');
core.RangeError.checkValueInInterval(index, 0, this[dartx.length], "index");
- if (!_internal.EfficientLength.is(iterable)) {
+ if (!_internal.EfficientLengthIterable.is(iterable)) {
iterable = iterable[dartx.toList]();
}
let insertionLength = iterable[dartx.length];
@@ -4631,7 +4686,7 @@
IterableOfE()._check(replacement);
this[dartx.checkGrowable]('replace range');
core.RangeError.checkValidRange(start, end, this[dartx.length]);
- if (!_internal.EfficientLength.is(replacement)) {
+ if (!_internal.EfficientLengthIterable.is(replacement)) {
replacement = replacement[dartx.toList]();
}
let removeLength = dart.notNull(end) - dart.notNull(start);
@@ -6346,21 +6401,20 @@
this[_filter](test, true);
}
[_filter](test, retainMatching) {
- let source = this;
let retained = JSArrayOfE().of([]);
- let length = source[dartx.length];
+ let length = this[dartx.length];
for (let i = 0; i < dart.notNull(length); i++) {
- let element = source[dartx._get](i);
+ let element = this[dartx._get](i);
if (dart.dcall(test, element) == retainMatching) {
retained[dartx.add](element);
}
- if (length != source[dartx.length]) {
- dart.throw(new core.ConcurrentModificationError(source));
+ if (length != this[dartx.length]) {
+ dart.throw(new core.ConcurrentModificationError(this));
}
}
- if (retained[dartx.length] != source[dartx.length]) {
- source[dartx.setRange](0, retained[dartx.length], retained);
- source[dartx.length] = retained[dartx.length];
+ if (retained[dartx.length] != this[dartx.length]) {
+ this[dartx.setRange](0, retained[dartx.length], retained);
+ this[dartx.length] = retained[dartx.length];
}
}
clear() {
@@ -6376,11 +6430,10 @@
}
sort(compare) {
if (compare === void 0) compare = null;
- if (compare == null) {
- _internal.Sort.sort(E)(this, dart.fn((a, b) => core.Comparable.compare(core.Comparable._check(a), core.Comparable._check(b)), dynamicAnddynamicToint()));
- } else {
- _internal.Sort.sort(E)(this, compare);
- }
+ _internal.Sort.sort(E)(this, (compare != null ? compare : collection.ListMixin._compareAny));
+ }
+ static _compareAny(a, b) {
+ return core.Comparable.compare(core.Comparable._check(a), core.Comparable._check(b));
}
shuffle(random) {
if (random === void 0) random = null;
@@ -6460,7 +6513,7 @@
replaceRange(start, end, newContents) {
IterableOfE()._check(newContents);
core.RangeError.checkValidRange(start, end, this[dartx.length]);
- if (!_internal.EfficientLength.is(newContents)) {
+ if (!_internal.EfficientLengthIterable.is(newContents)) {
newContents = newContents[dartx.toList]();
}
let removeLength = dart.notNull(end) - dart.notNull(start);
@@ -6538,7 +6591,7 @@
insertAll(index, iterable) {
IterableOfE()._check(iterable);
core.RangeError.checkValueInInterval(index, 0, this[dartx.length], "index");
- if (!_internal.EfficientLength.is(iterable) || core.identical(iterable, this)) {
+ if (!_internal.EfficientLengthIterable.is(iterable) || core.identical(iterable, this)) {
iterable = iterable[dartx.toList]();
}
let insertionLength = iterable[dartx.length];
@@ -6627,7 +6680,9 @@
removeAt: dart.definiteFunctionType(E, [core.int]),
insertAll: dart.definiteFunctionType(dart.void, [core.int, IterableOfE()]),
setAll: dart.definiteFunctionType(dart.void, [core.int, IterableOfE()])
- })
+ }),
+ statics: () => ({_compareAny: dart.definiteFunctionType(core.int, [dart.dynamic, dart.dynamic])}),
+ names: ['_compareAny']
});
dart.defineExtensionMembers(ListMixin, [
'elementAt',
@@ -6886,7 +6941,66 @@
names: ['stringOf']
});
dart.defineExtensionMembers(_internal.CodeUnits, ['_get', 'length']);
-_internal.EfficientLength = class EfficientLength extends core.Object {};
+_internal.ExternalName = class ExternalName extends core.Object {
+ new(name) {
+ this.name = name;
+ }
+};
+dart.setSignature(_internal.ExternalName, {
+ fields: () => ({name: core.String})
+});
+_internal.hexDigitValue = function(char) {
+ dart.assert(dart.notNull(char) >= 0 && dart.notNull(char) <= 65535);
+ let digit0 = 48;
+ let a = 97;
+ let f = 102;
+ let digit = (dart.notNull(char) ^ digit0) >>> 0;
+ if (digit <= 9) return digit;
+ let letter = (dart.notNull(char) | 32) >>> 0;
+ if (a <= letter && letter <= f) return letter - (a - 10);
+ return -1;
+};
+dart.fn(_internal.hexDigitValue, intToint());
+_internal.parseHexByte = function(source, index) {
+ dart.assert(dart.notNull(index) + 2 <= dart.notNull(source[dartx.length]));
+ let digit1 = _internal.hexDigitValue(source[dartx.codeUnitAt](index));
+ let digit2 = _internal.hexDigitValue(source[dartx.codeUnitAt](dart.notNull(index) + 1));
+ return dart.notNull(digit1) * 16 + dart.notNull(digit2) - (dart.notNull(digit2) & 256);
+};
+dart.lazyFn(_internal.parseHexByte, () => StringAndintToint());
+const _name$ = Symbol('_name');
+const _nativeSymbol = Symbol('_nativeSymbol');
+_internal.PrivateSymbol = class PrivateSymbol extends core.Object {
+ new(name, nativeSymbol) {
+ this[_name$] = name;
+ this[_nativeSymbol] = nativeSymbol;
+ }
+ static getName(symbol) {
+ return _internal.PrivateSymbol.as(symbol)[_name$];
+ }
+ static getNativeSymbol(symbol) {
+ if (_internal.PrivateSymbol.is(symbol)) return symbol[_nativeSymbol];
+ return null;
+ }
+ ['=='](other) {
+ return _internal.PrivateSymbol.is(other) && core.identical(this[_nativeSymbol], other[_nativeSymbol]);
+ }
+ toString() {
+ return dart.str`Symbol("${this[_name$]}")`;
+ }
+};
+_internal.PrivateSymbol[dart.implements] = () => [core.Symbol];
+dart.setSignature(_internal.PrivateSymbol, {
+ fields: () => ({
+ [_name$]: core.String,
+ [_nativeSymbol]: core.Object
+ }),
+ statics: () => ({
+ getName: dart.definiteFunctionType(core.String, [core.Symbol]),
+ getNativeSymbol: dart.definiteFunctionType(core.Object, [core.Symbol])
+ }),
+ names: ['getName', 'getNativeSymbol']
+});
core.Iterable$ = dart.generic(E => {
let EmptyIterableOfE = () => (EmptyIterableOfE = dart.constFn(_internal.EmptyIterable$(E)))();
let _GeneratorIterableOfE = () => (_GeneratorIterableOfE = dart.constFn(core._GeneratorIterable$(E)))();
@@ -7025,7 +7139,7 @@
return SetOfE().from(this);
}
get length() {
- dart.assert(!_internal.EfficientLength.is(this));
+ dart.assert(!_internal.EfficientLengthIterable.is(this));
let count = 0;
let it = this[dartx.iterator];
while (dart.test(it.moveNext())) {
@@ -7194,6 +7308,15 @@
return Iterable;
});
core.Iterable = Iterable();
+_internal.EfficientLengthIterable$ = dart.generic(T => {
+ class EfficientLengthIterable extends core.Iterable$(T) {
+ new() {
+ super.new();
+ }
+ }
+ return EfficientLengthIterable;
+});
+_internal.EfficientLengthIterable = EfficientLengthIterable();
_internal.ListIterable$ = dart.generic(E => {
let ListIteratorOfE = () => (ListIteratorOfE = dart.constFn(_internal.ListIterator$(E)))();
let VoidToE = () => (VoidToE = dart.constFn(dart.functionType(E, [])))();
@@ -7203,7 +7326,7 @@
let SetOfE = () => (SetOfE = dart.constFn(core.Set$(E)))();
let ETovoid = () => (ETovoid = dart.constFn(dart.functionType(dart.void, [E])))();
let ETobool = () => (ETobool = dart.constFn(dart.functionType(core.bool, [E])))();
- class ListIterable extends core.Iterable$(E) {
+ class ListIterable extends _internal.EfficientLengthIterable$(E) {
new() {
super.new();
}
@@ -7410,7 +7533,6 @@
return result;
}
}
- ListIterable[dart.implements] = () => [_internal.EfficientLength];
dart.setSignature(ListIterable, {
getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])}),
methods: () => ({reduce: dart.definiteFunctionType(E, [dynamicAndEToE()])})
@@ -7609,7 +7731,7 @@
let _TransformationOfS$T = () => (_TransformationOfS$T = dart.constFn(_internal._Transformation$(S, T)))();
class MappedIterable extends core.Iterable$(T) {
static new(iterable, func) {
- if (_internal.EfficientLength.is(iterable)) {
+ if (_internal.EfficientLengthIterable.is(iterable)) {
return new (EfficientLengthMappedIterableOfS$T())(iterable, func);
}
return new (MappedIterableOfS$T())._(iterable, func);
@@ -7662,12 +7784,13 @@
});
_internal.MappedIterable = MappedIterable();
_internal.EfficientLengthMappedIterable$ = dart.generic((S, T) => {
+ let EfficientLengthIterableOfT = () => (EfficientLengthIterableOfT = dart.constFn(_internal.EfficientLengthIterable$(T)))();
class EfficientLengthMappedIterable extends _internal.MappedIterable$(S, T) {
new(iterable, func) {
super._(iterable, func);
}
}
- EfficientLengthMappedIterable[dart.implements] = () => [_internal.EfficientLength];
+ EfficientLengthMappedIterable[dart.implements] = () => [EfficientLengthIterableOfT()];
return EfficientLengthMappedIterable;
});
_internal.EfficientLengthMappedIterable = EfficientLengthMappedIterable();
@@ -7728,7 +7851,6 @@
return this[_f](this[_source][dartx.elementAt](index));
}
}
- MappedListIterable[dart.implements] = () => [_internal.EfficientLength];
dart.setSignature(MappedListIterable, {
fields: () => ({
[_source]: IterableOfS(),
@@ -7757,6 +7879,11 @@
get iterator() {
return new (WhereIteratorOfE())(this[_iterable$][dartx.iterator], this[_f]);
}
+ map(T) {
+ return f => {
+ return new (_internal.MappedIterable$(E, T))._(this, f);
+ };
+ }
}
dart.setSignature(WhereIterable, {
fields: () => ({
@@ -7765,13 +7892,12 @@
}),
getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])})
});
- dart.defineExtensionMembers(WhereIterable, ['iterator']);
+ dart.defineExtensionMembers(WhereIterable, ['map', 'iterator']);
return WhereIterable;
});
_internal.WhereIterable = WhereIterable();
_internal.WhereIterator$ = dart.generic(E => {
let IteratorOfE = () => (IteratorOfE = dart.constFn(core.Iterator$(E)))();
- let _ElementPredicateOfE = () => (_ElementPredicateOfE = dart.constFn(_internal._ElementPredicate$(E)))();
class WhereIterator extends core.Iterator$(E) {
new(iterator, f) {
this[_iterator] = iterator;
@@ -7779,7 +7905,7 @@
}
moveNext() {
while (dart.test(this[_iterator].moveNext())) {
- if (dart.test(this[_f](this[_iterator].current))) {
+ if (dart.test(dart.dcall(this[_f], this[_iterator].current))) {
return true;
}
}
@@ -7792,7 +7918,7 @@
dart.setSignature(WhereIterator, {
fields: () => ({
[_iterator]: IteratorOfE(),
- [_f]: _ElementPredicateOfE()
+ [_f]: _internal._ElementPredicate
}),
getters: () => ({current: dart.definiteFunctionType(E, [])}),
methods: () => ({moveNext: dart.definiteFunctionType(core.bool, [])})
@@ -7887,7 +8013,7 @@
if (!(typeof takeCount == 'number') || dart.notNull(takeCount) < 0) {
dart.throw(new core.ArgumentError(takeCount));
}
- if (_internal.EfficientLength.is(iterable)) {
+ if (_internal.EfficientLengthIterable.is(iterable)) {
return new (EfficientLengthTakeIterableOfE())(iterable, takeCount);
}
return new (TakeIterableOfE())._(iterable, takeCount);
@@ -7914,6 +8040,7 @@
});
_internal.TakeIterable = TakeIterable();
_internal.EfficientLengthTakeIterable$ = dart.generic(E => {
+ let EfficientLengthIterableOfE = () => (EfficientLengthIterableOfE = dart.constFn(_internal.EfficientLengthIterable$(E)))();
class EfficientLengthTakeIterable extends _internal.TakeIterable$(E) {
new(iterable, takeCount) {
super._(iterable, takeCount);
@@ -7924,7 +8051,7 @@
return iterableLength;
}
}
- EfficientLengthTakeIterable[dart.implements] = () => [_internal.EfficientLength];
+ EfficientLengthTakeIterable[dart.implements] = () => [EfficientLengthIterableOfE()];
dart.setSignature(EfficientLengthTakeIterable, {});
dart.defineExtensionMembers(EfficientLengthTakeIterable, ['length']);
return EfficientLengthTakeIterable;
@@ -8031,7 +8158,7 @@
let IterableOfE = () => (IterableOfE = dart.constFn(core.Iterable$(E)))();
class SkipIterable extends core.Iterable$(E) {
static new(iterable, count) {
- if (_internal.EfficientLength.is(iterable)) {
+ if (_internal.EfficientLengthIterable.is(iterable)) {
return new (EfficientLengthSkipIterableOfE())(iterable, count);
}
return new (SkipIterableOfE())._(iterable, count);
@@ -8069,6 +8196,7 @@
});
_internal.SkipIterable = SkipIterable();
_internal.EfficientLengthSkipIterable$ = dart.generic(E => {
+ let EfficientLengthIterableOfE = () => (EfficientLengthIterableOfE = dart.constFn(_internal.EfficientLengthIterable$(E)))();
class EfficientLengthSkipIterable extends _internal.SkipIterable$(E) {
new(iterable, skipCount) {
super._(iterable, skipCount);
@@ -8079,7 +8207,7 @@
return 0;
}
}
- EfficientLengthSkipIterable[dart.implements] = () => [_internal.EfficientLength];
+ EfficientLengthSkipIterable[dart.implements] = () => [EfficientLengthIterableOfE()];
dart.setSignature(EfficientLengthSkipIterable, {});
dart.defineExtensionMembers(EfficientLengthSkipIterable, ['length']);
return EfficientLengthSkipIterable;
@@ -8183,7 +8311,7 @@
let SetOfE = () => (SetOfE = dart.constFn(core.Set$(E)))();
let ETovoid = () => (ETovoid = dart.constFn(dart.functionType(dart.void, [E])))();
let ETobool = () => (ETobool = dart.constFn(dart.functionType(core.bool, [E])))();
- class EmptyIterable extends core.Iterable$(E) {
+ class EmptyIterable extends _internal.EfficientLengthIterable$(E) {
new() {
super.new();
}
@@ -8279,7 +8407,6 @@
return SetOfE().new();
}
}
- EmptyIterable[dart.implements] = () => [_internal.EfficientLength];
dart.setSignature(EmptyIterable, {
getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])}),
methods: () => ({singleWhere: dart.definiteFunctionType(E, [ETobool()], {orElse: VoidToE()})})
@@ -8668,79 +8795,6 @@
};
};
dart.lazyFn(_internal.makeFixedListUnmodifiable, () => ListOfEToListOfE());
-_internal.Lists = class Lists extends core.Object {
- static copy(src, srcStart, dst, dstStart, count) {
- if (dart.notNull(srcStart) < dart.notNull(dstStart)) {
- for (let i = dart.notNull(srcStart) + dart.notNull(count) - 1, j = dart.notNull(dstStart) + dart.notNull(count) - 1; i >= dart.notNull(srcStart); i--, j--) {
- dst[dartx._set](j, src[dartx._get](i));
- }
- } else {
- for (let i = srcStart, j = dstStart; dart.notNull(i) < dart.notNull(srcStart) + dart.notNull(count); i = dart.notNull(i) + 1, j = dart.notNull(j) + 1) {
- dst[dartx._set](j, src[dartx._get](i));
- }
- }
- }
- static areEqual(a, b) {
- if (core.identical(a, b)) return true;
- if (!core.List.is(b)) return false;
- let length = a[dartx.length];
- if (!dart.equals(length, dart.dload(b, 'length'))) return false;
- for (let i = 0; i < dart.notNull(length); i++) {
- if (!core.identical(a[dartx._get](i), dart.dindex(b, i))) return false;
- }
- return true;
- }
- static indexOf(a, element, startIndex, endIndex) {
- if (dart.notNull(startIndex) >= dart.notNull(a[dartx.length])) {
- return -1;
- }
- if (dart.notNull(startIndex) < 0) {
- startIndex = 0;
- }
- for (let i = startIndex; dart.notNull(i) < dart.notNull(endIndex); i = dart.notNull(i) + 1) {
- if (dart.equals(a[dartx._get](i), element)) {
- return i;
- }
- }
- return -1;
- }
- static lastIndexOf(a, element, startIndex) {
- if (dart.notNull(startIndex) < 0) {
- return -1;
- }
- if (dart.notNull(startIndex) >= dart.notNull(a[dartx.length])) {
- startIndex = dart.notNull(a[dartx.length]) - 1;
- }
- for (let i = startIndex; dart.notNull(i) >= 0; i = dart.notNull(i) - 1) {
- if (dart.equals(a[dartx._get](i), element)) {
- return i;
- }
- }
- return -1;
- }
- static indicesCheck(a, start, end) {
- core.RangeError.checkValidRange(start, end, a[dartx.length]);
- }
- static rangeCheck(a, start, length) {
- core.RangeError.checkNotNegative(length);
- core.RangeError.checkNotNegative(start);
- if (dart.notNull(start) + dart.notNull(length) > dart.notNull(a[dartx.length])) {
- let message = dart.str`${start} + ${length} must be in the range [0..${a[dartx.length]}]`;
- dart.throw(new core.RangeError.range(length, 0, dart.notNull(a[dartx.length]) - dart.notNull(start), "length", message));
- }
- }
-};
-dart.setSignature(_internal.Lists, {
- statics: () => ({
- copy: dart.definiteFunctionType(dart.void, [core.List, core.int, core.List, core.int, core.int]),
- areEqual: dart.definiteFunctionType(core.bool, [core.List, dart.dynamic]),
- indexOf: dart.definiteFunctionType(core.int, [core.List, core.Object, core.int, core.int]),
- lastIndexOf: dart.definiteFunctionType(core.int, [core.List, core.Object, core.int]),
- indicesCheck: dart.definiteFunctionType(dart.void, [core.List, core.int, core.int]),
- rangeCheck: dart.definiteFunctionType(dart.void, [core.List, core.int, core.int])
- }),
- names: ['copy', 'areEqual', 'indexOf', 'lastIndexOf', 'indicesCheck', 'rangeCheck']
-});
_internal.printToZone = null;
_internal.printToConsole = function(line) {
_js_primitives.printString(dart.str`${line}`);
@@ -8986,27 +9040,18 @@
names: ['sort', 'sortRange', '_doSort', '_insertionSort', '_dualPivotQuicksort']
});
_internal.Sort._INSERTION_SORT_THRESHOLD = 32;
-const _name$ = Symbol('_name');
-const _nativeSymbol = Symbol('_nativeSymbol');
_internal.Symbol = class Symbol extends core.Object {
new(name) {
this[_name$] = name;
- this[_nativeSymbol] = null;
- }
- es6(name, nativeSymbol) {
- this[_name$] = name;
- this[_nativeSymbol] = nativeSymbol;
}
unvalidated(name) {
this[_name$] = name;
- this[_nativeSymbol] = null;
}
validated(name) {
this[_name$] = _internal.Symbol.validatePublicSymbol(name);
- this[_nativeSymbol] = null;
}
['=='](other) {
- return _internal.Symbol.is(other) && this[_name$] == other[_name$] && dart.equals(this[_nativeSymbol], other[_nativeSymbol]);
+ return _internal.Symbol.is(other) && this[_name$] == other[_name$];
}
get hashCode() {
let hash = this._hashCode;
@@ -9022,9 +9067,6 @@
static getName(symbol) {
return symbol[_name$];
}
- static getNativeSymbol(symbol) {
- return symbol[_nativeSymbol];
- }
static validatePublicSymbol(name) {
if (dart.test(name[dartx.isEmpty]) || dart.test(_internal.Symbol.publicSymbolPattern.hasMatch(name))) return name;
if (dart.test(name[dartx.startsWith]('_'))) {
@@ -9036,23 +9078,17 @@
return dart.test(name[dartx.isEmpty]) || dart.test(_internal.Symbol.symbolPattern.hasMatch(name));
}
};
-dart.defineNamedConstructor(_internal.Symbol, 'es6');
dart.defineNamedConstructor(_internal.Symbol, 'unvalidated');
dart.defineNamedConstructor(_internal.Symbol, 'validated');
_internal.Symbol[dart.implements] = () => [core.Symbol];
dart.setSignature(_internal.Symbol, {
- fields: () => ({
- [_name$]: core.String,
- [_nativeSymbol]: dart.dynamic
- }),
- methods: () => ({'==': dart.definiteFunctionType(core.bool, [core.Object])}),
+ fields: () => ({[_name$]: core.String}),
statics: () => ({
getName: dart.definiteFunctionType(core.String, [_internal.Symbol]),
- getNativeSymbol: dart.definiteFunctionType(dart.dynamic, [_internal.Symbol]),
validatePublicSymbol: dart.definiteFunctionType(core.String, [core.String]),
isValidSymbol: dart.definiteFunctionType(core.bool, [core.String])
}),
- names: ['getName', 'getNativeSymbol', 'validatePublicSymbol', 'isValidSymbol']
+ names: ['getName', 'validatePublicSymbol', 'isValidSymbol']
});
_internal.Symbol.reservedWordRE = '(?:assert|break|c(?:a(?:se|tch)|lass|on(?:st|tinue))|d(?:efault|o)|' + 'e(?:lse|num|xtends)|f(?:alse|inal(?:ly)?|or)|i[fns]|n(?:ew|ull)|' + 'ret(?:hrow|urn)|s(?:uper|witch)|t(?:h(?:is|row)|r(?:ue|y))|' + 'v(?:ar|oid)|w(?:hile|ith))';
_internal.Symbol.operatorRE = '(?:[\\-+*/%&|^]|\\[\\]=?|==|~/?|<[<=]?|>[>=]?|unary-)';
@@ -9235,8 +9271,8 @@
this.weakPorts = SetOfint().new();
this.isolateStatics = _foreign_helper.JS_CREATE_ISOLATE();
this.controlPort = new _isolate_helper.RawReceivePortImpl._controlPort();
- this.pauseCapability = isolate.Capability.new();
- this.terminateCapability = isolate.Capability.new();
+ this.pauseCapability = isolate$.Capability.new();
+ this.terminateCapability = isolate$.Capability.new();
this.delayedEvents = JSArrayOf_IsolateEvent().of([]);
this.pauseTokens = SetOfCapability().new();
this.errorPorts = SetOfSendPort().new();
@@ -9283,7 +9319,7 @@
this.errorsAreFatal = errorsAreFatal;
}
handlePing(responsePort, pingType) {
- if (pingType == isolate.Isolate.IMMEDIATE || pingType == isolate.Isolate.BEFORE_NEXT_EVENT && !dart.test(this[_isExecutingEvent])) {
+ if (pingType == isolate$.Isolate.IMMEDIATE || pingType == isolate$.Isolate.BEFORE_NEXT_EVENT && !dart.test(this[_isExecutingEvent])) {
responsePort.send(null);
return;
}
@@ -9291,11 +9327,7 @@
responsePort.send(null);
}
dart.fn(respond, VoidTovoid$());
- if (pingType == isolate.Isolate.AS_EVENT) {
- _isolate_helper._globalState.topEventLoop.enqueue(this, respond, "ping");
- return;
- }
- dart.assert(pingType == isolate.Isolate.BEFORE_NEXT_EVENT);
+ dart.assert(pingType == isolate$.Isolate.BEFORE_NEXT_EVENT);
if (this[_scheduledControlEvents] == null) {
this[_scheduledControlEvents] = collection.Queue.new();
}
@@ -9303,15 +9335,11 @@
}
handleKill(authentification, priority) {
if (!dart.equals(this.terminateCapability, authentification)) return;
- if (priority == isolate.Isolate.IMMEDIATE || priority == isolate.Isolate.BEFORE_NEXT_EVENT && !dart.test(this[_isExecutingEvent])) {
+ if (priority == isolate$.Isolate.IMMEDIATE || priority == isolate$.Isolate.BEFORE_NEXT_EVENT && !dart.test(this[_isExecutingEvent])) {
this.kill();
return;
}
- if (priority == isolate.Isolate.AS_EVENT) {
- _isolate_helper._globalState.topEventLoop.enqueue(this, dart.bind(this, 'kill'), "kill");
- return;
- }
- dart.assert(priority == isolate.Isolate.BEFORE_NEXT_EVENT);
+ dart.assert(priority == isolate$.Isolate.BEFORE_NEXT_EVENT);
if (this[_scheduledControlEvents] == null) {
this[_scheduledControlEvents] = collection.Queue.new();
}
@@ -9379,47 +9407,47 @@
switch (dart.dindex(message, 0)) {
case "pause":
{
- this.addPause(isolate.Capability._check(dart.dindex(message, 1)), isolate.Capability._check(dart.dindex(message, 2)));
+ this.addPause(isolate$.Capability._check(dart.dindex(message, 1)), isolate$.Capability._check(dart.dindex(message, 2)));
break;
}
case "resume":
{
- this.removePause(isolate.Capability._check(dart.dindex(message, 1)));
+ this.removePause(isolate$.Capability._check(dart.dindex(message, 1)));
break;
}
case 'add-ondone':
{
- this.addDoneListener(isolate.SendPort._check(dart.dindex(message, 1)));
+ this.addDoneListener(isolate$.SendPort._check(dart.dindex(message, 1)));
break;
}
case 'remove-ondone':
{
- this.removeDoneListener(isolate.SendPort._check(dart.dindex(message, 1)));
+ this.removeDoneListener(isolate$.SendPort._check(dart.dindex(message, 1)));
break;
}
case 'set-errors-fatal':
{
- this.setErrorsFatal(isolate.Capability._check(dart.dindex(message, 1)), core.bool._check(dart.dindex(message, 2)));
+ this.setErrorsFatal(isolate$.Capability._check(dart.dindex(message, 1)), core.bool._check(dart.dindex(message, 2)));
break;
}
case "ping":
{
- this.handlePing(isolate.SendPort._check(dart.dindex(message, 1)), core.int._check(dart.dindex(message, 2)));
+ this.handlePing(isolate$.SendPort._check(dart.dindex(message, 1)), core.int._check(dart.dindex(message, 2)));
break;
}
case "kill":
{
- this.handleKill(isolate.Capability._check(dart.dindex(message, 1)), core.int._check(dart.dindex(message, 2)));
+ this.handleKill(isolate$.Capability._check(dart.dindex(message, 1)), core.int._check(dart.dindex(message, 2)));
break;
}
case "getErrors":
{
- this.addErrorListener(isolate.SendPort._check(dart.dindex(message, 1)));
+ this.addErrorListener(isolate$.SendPort._check(dart.dindex(message, 1)));
break;
}
case "stopErrors":
{
- this.removeErrorListener(isolate.SendPort._check(dart.dindex(message, 1)));
+ this.removeErrorListener(isolate$.SendPort._check(dart.dindex(message, 1)));
break;
}
default:
@@ -9462,7 +9490,7 @@
this.errorPorts.clear();
if (this.doneHandlers != null) {
for (let port of core.Iterable._check(this.doneHandlers)) {
- isolate.SendPort._check(port);
+ isolate$.SendPort._check(port);
port.send(null);
}
this.doneHandlers = null;
@@ -9482,8 +9510,8 @@
weakPorts: SetOfint(),
isolateStatics: dart.dynamic,
controlPort: _isolate_helper.RawReceivePortImpl,
- pauseCapability: isolate.Capability,
- terminateCapability: isolate.Capability,
+ pauseCapability: isolate$.Capability,
+ terminateCapability: isolate$.Capability,
initialized: core.bool,
isPaused: core.bool,
delayedEvents: ListOf_IsolateEvent(),
@@ -9495,15 +9523,15 @@
errorPorts: SetOfSendPort()
}),
methods: () => ({
- addPause: dart.definiteFunctionType(dart.void, [isolate.Capability, isolate.Capability]),
- removePause: dart.definiteFunctionType(dart.void, [isolate.Capability]),
- addDoneListener: dart.definiteFunctionType(dart.void, [isolate.SendPort]),
- removeDoneListener: dart.definiteFunctionType(dart.void, [isolate.SendPort]),
- setErrorsFatal: dart.definiteFunctionType(dart.void, [isolate.Capability, core.bool]),
- handlePing: dart.definiteFunctionType(dart.void, [isolate.SendPort, core.int]),
- handleKill: dart.definiteFunctionType(dart.void, [isolate.Capability, core.int]),
- addErrorListener: dart.definiteFunctionType(dart.void, [isolate.SendPort]),
- removeErrorListener: dart.definiteFunctionType(dart.void, [isolate.SendPort]),
+ addPause: dart.definiteFunctionType(dart.void, [isolate$.Capability, isolate$.Capability]),
+ removePause: dart.definiteFunctionType(dart.void, [isolate$.Capability]),
+ addDoneListener: dart.definiteFunctionType(dart.void, [isolate$.SendPort]),
+ removeDoneListener: dart.definiteFunctionType(dart.void, [isolate$.SendPort]),
+ setErrorsFatal: dart.definiteFunctionType(dart.void, [isolate$.Capability, core.bool]),
+ handlePing: dart.definiteFunctionType(dart.void, [isolate$.SendPort, core.int]),
+ handleKill: dart.definiteFunctionType(dart.void, [isolate$.Capability, core.int]),
+ addErrorListener: dart.definiteFunctionType(dart.void, [isolate$.SendPort]),
+ removeErrorListener: dart.definiteFunctionType(dart.void, [isolate$.SendPort]),
handleUncaughtError: dart.definiteFunctionType(dart.void, [dart.dynamic, core.StackTrace]),
eval: dart.definiteFunctionType(dart.dynamic, [core.Function]),
[_setGlobals]: dart.definiteFunctionType(dart.void, []),
@@ -9704,7 +9732,7 @@
let replyTo = _isolate_helper._deserializeMessage(dart.dindex(msg, 'replyTo'));
let context = new _isolate_helper._IsolateContext();
_isolate_helper._globalState.topEventLoop.enqueue(context, dart.fn(() => {
- _isolate_helper.IsolateNatives._startIsolate(entryPoint, ListOfString()._check(args), message, core.bool._check(isSpawnUri), core.bool._check(startPaused), isolate.SendPort._check(replyTo));
+ _isolate_helper.IsolateNatives._startIsolate(entryPoint, ListOfString()._check(args), message, core.bool._check(isSpawnUri), core.bool._check(startPaused), isolate$.SendPort._check(replyTo));
}, VoidToNull()), 'worker-start');
_isolate_helper._globalState.currentContext = context;
_isolate_helper._globalState.topEventLoop.run();
@@ -9717,7 +9745,7 @@
}
case 'message':
{
- let port = isolate.SendPort._check(dart.dindex(msg, 'port'));
+ let port = isolate$.SendPort._check(dart.dindex(msg, 'port'));
if (port != null) {
dart.dsend(dart.dindex(msg, 'port'), 'send', dart.dindex(msg, 'msg'));
}
@@ -9805,7 +9833,7 @@
if (uri != null && dart.test(uri[dartx.endsWith](".dart"))) {
uri = dart.notNull(uri) + ".js";
}
- let port = isolate.ReceivePort.new();
+ let port = isolate$.ReceivePort.new();
let completer = CompleterOfList().new();
port.first.then(dart.dynamic)(dart.fn(msg => {
if (dart.equals(dart.dindex(msg, 0), _isolate_helper._SPAWNED_SIGNAL)) {
@@ -9844,7 +9872,7 @@
}
static get currentIsolate() {
let context = _isolate_helper._IsolateContext._check(_foreign_helper.JS_CURRENT_ISOLATE_CONTEXT());
- return new isolate.Isolate(context.controlPort.sendPort, {pauseCapability: context.pauseCapability, terminateCapability: context.terminateCapability});
+ return new isolate$.Isolate(context.controlPort.sendPort, {pauseCapability: context.pauseCapability, terminateCapability: context.terminateCapability});
}
static _startIsolate(topLevel, args, message, isSpawnUri, startPaused, replyTo) {
let context = _isolate_helper._IsolateContext._check(_foreign_helper.JS_CURRENT_ISOLATE_CONTEXT());
@@ -9922,10 +9950,10 @@
spawnFunction: dart.definiteFunctionType(async.Future$(core.List), [dynamicTovoid(), dart.dynamic, core.bool]),
spawnUri: dart.definiteFunctionType(async.Future$(core.List), [core.Uri, ListOfString(), dart.dynamic, core.bool]),
spawn: dart.definiteFunctionType(async.Future$(core.List), [core.String, core.String, ListOfString(), dart.dynamic, core.bool, core.bool, core.bool]),
- _startWorker: dart.definiteFunctionType(dart.void, [core.String, core.String, ListOfString(), dart.dynamic, core.bool, core.bool, isolate.SendPort, StringTovoid()]),
- _startNonWorker: dart.definiteFunctionType(dart.void, [core.String, core.String, ListOfString(), dart.dynamic, core.bool, core.bool, isolate.SendPort]),
- _startIsolate: dart.definiteFunctionType(dart.void, [core.Function, ListOfString(), dart.dynamic, core.bool, core.bool, isolate.SendPort]),
- _spawnWorker: dart.definiteFunctionType(dart.void, [dart.dynamic, core.String, ListOfString(), dart.dynamic, core.bool, core.bool, isolate.SendPort, StringTovoid()]),
+ _startWorker: dart.definiteFunctionType(dart.void, [core.String, core.String, ListOfString(), dart.dynamic, core.bool, core.bool, isolate$.SendPort, StringTovoid()]),
+ _startNonWorker: dart.definiteFunctionType(dart.void, [core.String, core.String, ListOfString(), dart.dynamic, core.bool, core.bool, isolate$.SendPort]),
+ _startIsolate: dart.definiteFunctionType(dart.void, [core.Function, ListOfString(), dart.dynamic, core.bool, core.bool, isolate$.SendPort]),
+ _spawnWorker: dart.definiteFunctionType(dart.void, [dart.dynamic, core.String, ListOfString(), dart.dynamic, core.bool, core.bool, isolate$.SendPort, StringTovoid()]),
workerOnError: dart.definiteFunctionType(core.bool, [dart.dynamic, core.String, StringTovoid()])
}),
names: ['computeThisScript', 'computeThisScriptJsshell', 'computeThisScriptD8', 'computeThisScriptFromTrace', '_getEventData', '_processWorkerMessage', 'handleSpawnWorkerRequest', '_log', '_consoleLog', '_getJSFunctionFromName', '_getJSFunctionName', '_allocate', 'spawnFunction', 'spawnUri', 'spawn', '_startWorker', '_startNonWorker', '_startIsolate', '_spawnWorker', 'workerOnError']
@@ -9952,10 +9980,10 @@
}
}
};
-_isolate_helper._BaseSendPort[dart.implements] = () => [isolate.SendPort];
+_isolate_helper._BaseSendPort[dart.implements] = () => [isolate$.SendPort];
dart.setSignature(_isolate_helper._BaseSendPort, {
fields: () => ({[_isolateId]: core.int}),
- methods: () => ({[_checkReplyTo]: dart.definiteFunctionType(dart.void, [isolate.SendPort])})
+ methods: () => ({[_checkReplyTo]: dart.definiteFunctionType(dart.void, [isolate$.SendPort])})
});
const _receivePort = Symbol('_receivePort');
const _isClosed = Symbol('_isClosed');
@@ -9987,7 +10015,7 @@
return this[_receivePort][_id];
}
};
-_isolate_helper._NativeJsSendPort[dart.implements] = () => [isolate.SendPort];
+_isolate_helper._NativeJsSendPort[dart.implements] = () => [isolate$.SendPort];
dart.setSignature(_isolate_helper._NativeJsSendPort, {
fields: () => ({[_receivePort]: _isolate_helper.RawReceivePortImpl}),
methods: () => ({send: dart.definiteFunctionType(dart.void, [dart.dynamic])})
@@ -10018,7 +10046,7 @@
return (dart.notNull(this[_workerId]) << 16 ^ dart.notNull(this[_isolateId]) << 8 ^ dart.notNull(this[_receivePortId])) >>> 0;
}
};
-_isolate_helper._WorkerSendPort[dart.implements] = () => [isolate.SendPort];
+_isolate_helper._WorkerSendPort[dart.implements] = () => [isolate$.SendPort];
dart.setSignature(_isolate_helper._WorkerSendPort, {
fields: () => ({
[_workerId]: core.int,
@@ -10076,14 +10104,14 @@
};
dart.defineNamedConstructor(_isolate_helper.RawReceivePortImpl, 'weak');
dart.defineNamedConstructor(_isolate_helper.RawReceivePortImpl, '_controlPort');
-_isolate_helper.RawReceivePortImpl[dart.implements] = () => [isolate.RawReceivePort];
+_isolate_helper.RawReceivePortImpl[dart.implements] = () => [isolate$.RawReceivePort];
dart.setSignature(_isolate_helper.RawReceivePortImpl, {
fields: () => ({
[_id]: core.int,
[_handler]: core.Function,
[_isClosed]: core.bool
}),
- getters: () => ({sendPort: dart.definiteFunctionType(isolate.SendPort, [])}),
+ getters: () => ({sendPort: dart.definiteFunctionType(isolate$.SendPort, [])}),
setters: () => ({handler: dart.definiteFunctionType(dart.void, [core.Function])}),
methods: () => ({
[_close]: dart.definiteFunctionType(dart.void, []),
@@ -10229,7 +10257,8 @@
}, VoidToNull()), onCancel: dart.fn(() => {
if (timer != null) timer.cancel();
timer = null;
- }, VoidToNull())});
+ return async.Future._nullFuture;
+ }, VoidTo_Future())});
return controller.stream;
}
static eventTransformed(source, mapSink) {
@@ -10288,9 +10317,7 @@
subscription.pause();
}, VoidToNull()), onResume: dart.fn(() => {
subscription.resume();
- }, VoidToNull()), onCancel: dart.fn(() => {
- subscription.cancel();
- }, VoidToNull()), sync: true});
+ }, VoidToNull()), onCancel: dart.fn(() => subscription.cancel(), VoidToFuture()), sync: true});
}
return controller.stream;
};
@@ -10328,9 +10355,7 @@
subscription.pause();
}, VoidToNull()), onResume: dart.fn(() => {
subscription.resume();
- }, VoidToNull()), onCancel: dart.fn(() => {
- subscription.cancel();
- }, VoidToNull()), sync: true});
+ }, VoidToNull()), onCancel: dart.fn(() => subscription.cancel(), VoidToFuture()), sync: true});
}
return controller.stream;
};
@@ -10861,13 +10886,13 @@
dart.addSimpleTypeTests(_isolate_helper.ReceivePortImpl);
dart.defineNamedConstructor(_isolate_helper.ReceivePortImpl, 'weak');
dart.defineNamedConstructor(_isolate_helper.ReceivePortImpl, 'fromRawReceivePort');
-_isolate_helper.ReceivePortImpl[dart.implements] = () => [isolate.ReceivePort];
+_isolate_helper.ReceivePortImpl[dart.implements] = () => [isolate$.ReceivePort];
dart.setSignature(_isolate_helper.ReceivePortImpl, {
fields: () => ({
- [_rawPort]: isolate.RawReceivePort,
+ [_rawPort]: isolate$.RawReceivePort,
[_controller]: async.StreamController
}),
- getters: () => ({sendPort: dart.definiteFunctionType(isolate.SendPort, [])}),
+ getters: () => ({sendPort: dart.definiteFunctionType(isolate$.SendPort, [])}),
methods: () => ({
listen: dart.definiteFunctionType(async.StreamSubscription, [dynamicTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool}),
close: dart.definiteFunctionType(dart.void, [])
@@ -10980,7 +11005,7 @@
}
};
dart.defineNamedConstructor(_isolate_helper.CapabilityImpl, '_internal');
-_isolate_helper.CapabilityImpl[dart.implements] = () => [isolate.Capability];
+_isolate_helper.CapabilityImpl[dart.implements] = () => [isolate$.Capability];
dart.setSignature(_isolate_helper.CapabilityImpl, {
fields: () => ({[_id]: core.int}),
methods: () => ({'==': dart.definiteFunctionType(core.bool, [core.Object])})
@@ -11018,7 +11043,7 @@
if (_js_helper.InternalMap.is(x)) return this.serializeMap(x);
if (_interceptors.JSObject.is(x)) return this.serializeJSObject(x);
if (_interceptors.Interceptor.is(x)) this.unsupported(x);
- if (isolate.RawReceivePort.is(x)) {
+ if (isolate$.RawReceivePort.is(x)) {
this.unsupported(x, "RawReceivePorts can't be transmitted:");
}
if (_isolate_helper._NativeJsSendPort.is(x)) return this.serializeJsSendPort(x);
@@ -11296,7 +11321,7 @@
}
deserializeRawSendPort(x) {
dart.assert(dart.equals(dart.dindex(x, 0), 'raw sendport'));
- let result = isolate.SendPort._check(dart.dindex(x, 1));
+ let result = isolate$.SendPort._check(dart.dindex(x, 1));
this.deserializedObjects[dartx.add](result);
return result;
}
@@ -11348,8 +11373,8 @@
deserializeMutable: dart.definiteFunctionType(core.List, [dart.dynamic]),
deserializeConst: dart.definiteFunctionType(core.List, [dart.dynamic]),
deserializeMap: dart.definiteFunctionType(core.Map, [_js_helper.InternalMap]),
- deserializeSendPort: dart.definiteFunctionType(isolate.SendPort, [dart.dynamic]),
- deserializeRawSendPort: dart.definiteFunctionType(isolate.SendPort, [dart.dynamic]),
+ deserializeSendPort: dart.definiteFunctionType(isolate$.SendPort, [dart.dynamic]),
+ deserializeRawSendPort: dart.definiteFunctionType(isolate$.SendPort, [dart.dynamic]),
deserializeJSObject: dart.definiteFunctionType(dart.dynamic, [dart.dynamic]),
deserializeClosure: dart.definiteFunctionType(core.Function, [dart.dynamic]),
deserializeDartObject: dart.definiteFunctionType(dart.dynamic, [dart.dynamic])
@@ -11386,6 +11411,11 @@
_js_embedded_names.TYPEDEF_PREDICATE_PROPERTY_NAME = "$$isTypedef";
_js_embedded_names.NATIVE_SUPERCLASS_TAG_NAME = "$nativeSuperclassTag";
_js_embedded_names.MAP_TYPE_TO_INTERCEPTOR = "mapTypeToInterceptor";
+dart.defineLazy(_js_helper, {
+ get _identityHashCode() {
+ return Symbol("_identityHashCode");
+ }
+});
_js_helper._Patch = class _Patch extends core.Object {
new() {
}
@@ -11405,10 +11435,10 @@
_js_helper.Primitives.mirrorInvokeCacheName = dart.notNull(_js_helper.Primitives.mirrorInvokeCacheName) + dart.str`_${id}`;
}
static objectHashCode(object) {
- let hash = object.$identityHash;
+ let hash = object[_js_helper._identityHashCode];
if (hash == null) {
hash = Math.random() * 0x3fffffff | 0;
- object.$identityHash = hash;
+ object[_js_helper._identityHashCode] = hash;
}
return hash;
}
@@ -12047,6 +12077,9 @@
new() {
super.new();
}
+ toString() {
+ return super.toString();
+ }
};
_js_helper.FallThroughErrorImplementation = class FallThroughErrorImplementation extends core.FallThroughError {
new() {
@@ -12069,13 +12102,18 @@
fields: () => ({message: dart.dynamic})
});
core.AssertionError = class AssertionError extends core.Error {
- new() {
+ new(message) {
+ if (message === void 0) message = null;
+ this.message = message;
super.new();
}
toString() {
return "Assertion failed";
}
};
+dart.setSignature(core.AssertionError, {
+ fields: () => ({message: core.Object})
+});
_js_helper.AssertionErrorWithMessage = class AssertionErrorWithMessage extends core.AssertionError {
new(message) {
this[_message] = message;
@@ -12680,7 +12718,7 @@
let LinkedHashMapKeyIteratorOfE = () => (LinkedHashMapKeyIteratorOfE = dart.constFn(_js_helper.LinkedHashMapKeyIterator$(E)))();
let ETovoid = () => (ETovoid = dart.constFn(dart.functionType(dart.void, [E])))();
let JsLinkedHashMapOfE$dynamic = () => (JsLinkedHashMapOfE$dynamic = dart.constFn(_js_helper.JsLinkedHashMap$(E, dart.dynamic)))();
- class LinkedHashMapKeyIterable extends core.Iterable$(E) {
+ class LinkedHashMapKeyIterable extends _internal.EfficientLengthIterable$(E) {
new(map) {
this[_map] = map;
super.new();
@@ -12709,7 +12747,6 @@
}
}
}
- LinkedHashMapKeyIterable[dart.implements] = () => [_internal.EfficientLength];
dart.setSignature(LinkedHashMapKeyIterable, {
fields: () => ({[_map]: JsLinkedHashMapOfE$dynamic()}),
getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])})
@@ -13380,7 +13417,11 @@
};
dart.lazyFn(_js_helper.isJsArray, () => dynamicTobool$());
_js_mirrors.getName = function(symbol) {
- return _internal.Symbol.getName(_internal.Symbol.as(symbol));
+ if (_internal.PrivateSymbol.is(symbol)) {
+ return _internal.PrivateSymbol.getName(symbol);
+ } else {
+ return _internal.Symbol.getName(_internal.Symbol.as(symbol));
+ }
};
dart.lazyFn(_js_mirrors.getName, () => SymbolToString());
_js_mirrors.getSymbol = function(name, library) {
@@ -13459,7 +13500,7 @@
});
_js_mirrors._Lazy = _Lazy();
_js_mirrors._getESSymbol = function(symbol) {
- return _internal.Symbol.getNativeSymbol(_internal.Symbol.as(symbol));
+ return _internal.PrivateSymbol.getNativeSymbol(symbol);
};
dart.lazyFn(_js_mirrors._getESSymbol, () => SymbolTodynamic());
_js_mirrors._getMember = function(symbol) {
@@ -13503,7 +13544,7 @@
dart.lazyFn(_js_mirrors._getNameForESSymbol, () => dynamicToString());
_js_mirrors._getSymbolForESSymbol = function(member) {
let name = _js_mirrors._getNameForESSymbol(member);
- return new _internal.Symbol.es6(name, member);
+ return new _internal.PrivateSymbol(name, member);
};
dart.lazyFn(_js_mirrors._getSymbolForESSymbol, () => dynamicToSymbol());
_js_mirrors._getSymbolForMember = function(member) {
@@ -13511,7 +13552,7 @@
return core.Symbol.new(member);
} else {
let name = _js_mirrors._getNameForESSymbol(member);
- return new _internal.Symbol.es6(name, member);
+ return new _internal.PrivateSymbol(name, member);
}
};
dart.lazyFn(_js_mirrors._getSymbolForMember, () => dynamicToSymbol());
@@ -13655,12 +13696,18 @@
};
_js_mirrors.JsIsolateMirror[dart.implements] = () => [mirrors.IsolateMirror];
_js_mirrors.JsLibraryDependencyMirror = class JsLibraryDependencyMirror extends _js_mirrors.JsMirror {
+ loadLibrary(...args) {
+ return FutureOfLibraryMirror()._check(this.noSuchMethod(new dart.InvocationImpl('loadLibrary', args, {isMethod: true})));
+ }
get isImport() {
return core.bool._check(this.noSuchMethod(new dart.InvocationImpl('isImport', [], {isGetter: true})));
}
get isExport() {
return core.bool._check(this.noSuchMethod(new dart.InvocationImpl('isExport', [], {isGetter: true})));
}
+ get isDeferred() {
+ return core.bool._check(this.noSuchMethod(new dart.InvocationImpl('isDeferred', [], {isGetter: true})));
+ }
get sourceLibrary() {
return mirrors.LibraryMirror._check(this.noSuchMethod(new dart.InvocationImpl('sourceLibrary', [], {isGetter: true})));
}
@@ -13691,6 +13738,9 @@
setField(...args) {
return mirrors.InstanceMirror._check(this.noSuchMethod(new dart.InvocationImpl('setField', args, {isMethod: true})));
}
+ delegate(...args) {
+ return this.noSuchMethod(new dart.InvocationImpl('delegate', args, {isMethod: true}));
+ }
};
_js_mirrors.JsObjectMirror[dart.implements] = () => [mirrors.ObjectMirror];
const _getAccessor = Symbol('_getAccessor');
@@ -13838,7 +13888,7 @@
let setters = _js_mirrors._getSetters(unwrapped);
setters[dartx.forEach](dart.fn((symbol, ft) => {
let name = dart.notNull(_js_mirrors.getName(symbol)) + '=';
- symbol = new _internal.Symbol.es6(name, _js_mirrors._getESSymbol(symbol));
+ symbol = new _internal.PrivateSymbol(name, _js_mirrors._getESSymbol(symbol));
this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._instanceMethod(this, symbol, ft));
}, SymbolAnddynamicToNull()));
let staticFields = _js_mirrors._getStaticFields(unwrapped);
@@ -13987,12 +14037,18 @@
get typeVariables() {
return ListOfTypeVariableMirror()._check(this.noSuchMethod(new dart.InvocationImpl('typeVariables', [], {isGetter: true})));
}
+ delegate(...args) {
+ return this.noSuchMethod(new dart.InvocationImpl('delegate', args, {isMethod: true}));
+ }
isSubclassOf(...args) {
return core.bool._check(this.noSuchMethod(new dart.InvocationImpl('isSubclassOf', args, {isMethod: true})));
}
get isAbstract() {
return core.bool._check(this.noSuchMethod(new dart.InvocationImpl('isAbstract', [], {isGetter: true})));
}
+ get isEnum() {
+ return core.bool._check(this.noSuchMethod(new dart.InvocationImpl('isEnum', [], {isGetter: true})));
+ }
get instanceMembers() {
return MapOfSymbol$MethodMirror()._check(this.noSuchMethod(new dart.InvocationImpl('instanceMembers', [], {isGetter: true})));
}
@@ -16798,9 +16854,9 @@
async._registerErrorHandler = function(R) {
return (errorHandler, zone) => {
if (async.ZoneBinaryCallback.is(errorHandler)) {
- return zone.registerBinaryCallback(dart.dynamic, dart.dynamic, core.StackTrace)(ZoneBinaryCallbackOfdynamic$dynamic$StackTrace().as(errorHandler));
+ return zone.registerBinaryCallback(R, dart.dynamic, core.StackTrace)(async.ZoneBinaryCallback$(R, dart.dynamic, core.StackTrace).as(errorHandler));
} else {
- return zone.registerUnaryCallback(dart.dynamic, dart.dynamic)(async.ZoneUnaryCallback.as(errorHandler));
+ return zone.registerUnaryCallback(R, dart.dynamic)(async.ZoneUnaryCallback$(R, dart.dynamic).as(errorHandler));
}
};
};
@@ -16954,7 +17010,6 @@
const _waitsForCancel = Symbol('_waitsForCancel');
const _canFire = Symbol('_canFire');
const _cancelOnError = Symbol('_cancelOnError');
-const _incrementPauseCount = Symbol('_incrementPauseCount');
const _sendData = Symbol('_sendData');
const _addPending = Symbol('_addPending');
const _sendError = Symbol('_sendError');
@@ -16999,7 +17054,7 @@
}
onError(handleError) {
if (handleError == null) handleError = async._nullErrorHandler;
- this[_onError] = async._registerErrorHandler(T)(handleError, this[_zone]);
+ this[_onError] = async._registerErrorHandler(dart.dynamic)(handleError, this[_zone]);
}
onDone(handleDone) {
if (handleDone == null) handleDone = async._nullDoneHandler;
@@ -17032,9 +17087,11 @@
}
cancel() {
this[_state] = (dart.notNull(this[_state]) & ~async._BufferingStreamSubscription._STATE_WAIT_FOR_CANCEL) >>> 0;
- if (dart.test(this[_isCanceled])) return this[_cancelFuture];
- this[_cancel]();
- return this[_cancelFuture];
+ if (!dart.test(this[_isCanceled])) {
+ this[_cancel]();
+ }
+ let l = this[_cancelFuture];
+ return l != null ? l : async.Future._nullFuture;
}
asFuture(E) {
return futureValue => {
@@ -17044,8 +17101,14 @@
result[_complete](futureValue);
}, VoidToNull());
this[_onError] = dart.fn((error, stackTrace) => {
- this.cancel();
- result[_completeError](error, core.StackTrace._check(stackTrace));
+ let cancelFuture = this.cancel();
+ if (!core.identical(cancelFuture, async.Future._nullFuture)) {
+ cancelFuture.whenComplete(dart.fn(() => {
+ result[_completeError](error, core.StackTrace._check(stackTrace));
+ }, VoidToNull()));
+ } else {
+ result[_completeError](error, core.StackTrace._check(stackTrace));
+ }
}, dynamicAnddynamicToNull());
return result;
};
@@ -17091,9 +17154,6 @@
if (!dart.test(this[_inCallback])) this[_pending] = null;
this[_cancelFuture] = this[_onCancel]();
}
- [_incrementPauseCount]() {
- this[_state] = (dart.notNull(this[_state]) + async._BufferingStreamSubscription._STATE_PAUSE_COUNT | async._BufferingStreamSubscription._STATE_INPUT_PAUSED) >>> 0;
- }
[_decrementPauseCount]() {
dart.assert(this[_isPaused]);
this[_state] = dart.notNull(this[_state]) - async._BufferingStreamSubscription._STATE_PAUSE_COUNT;
@@ -17180,7 +17240,7 @@
if (dart.test(this[_cancelOnError])) {
this[_state] = (dart.notNull(this[_state]) | async._BufferingStreamSubscription._STATE_WAIT_FOR_CANCEL) >>> 0;
this[_cancel]();
- if (async.Future.is(this[_cancelFuture])) {
+ if (async.Future.is(this[_cancelFuture]) && !core.identical(this[_cancelFuture], async.Future._nullFuture)) {
this[_cancelFuture].whenComplete(sendError);
} else {
sendError();
@@ -17203,7 +17263,7 @@
dart.fn(sendDone, VoidTovoid$());
this[_cancel]();
this[_state] = (dart.notNull(this[_state]) | async._BufferingStreamSubscription._STATE_WAIT_FOR_CANCEL) >>> 0;
- if (async.Future.is(this[_cancelFuture])) {
+ if (async.Future.is(this[_cancelFuture]) && !core.identical(this[_cancelFuture], async.Future._nullFuture)) {
this[_cancelFuture].whenComplete(sendDone);
} else {
sendDone();
@@ -17213,7 +17273,7 @@
dart.assert(!dart.test(this[_inCallback]));
let wasInputPaused = this[_isInputPaused];
this[_state] = (dart.notNull(this[_state]) | async._BufferingStreamSubscription._STATE_IN_CALLBACK) >>> 0;
- callback();
+ dart.dcall(callback);
this[_state] = (dart.notNull(this[_state]) & ~async._BufferingStreamSubscription._STATE_IN_CALLBACK) >>> 0;
this[_checkState](wasInputPaused);
}
@@ -17281,7 +17341,6 @@
cancel: dart.definiteFunctionType(async.Future, []),
asFuture: dart.definiteFunctionType(E => [async.Future$(E), [], [E]]),
[_cancel]: dart.definiteFunctionType(dart.void, []),
- [_incrementPauseCount]: dart.definiteFunctionType(dart.void, []),
[_decrementPauseCount]: dart.definiteFunctionType(dart.void, []),
[_add$]: dart.definiteFunctionType(dart.void, [T]),
[_addError]: dart.definiteFunctionType(dart.void, [core.Object, core.StackTrace]),
@@ -17293,7 +17352,7 @@
[_sendData]: dart.definiteFunctionType(dart.void, [T]),
[_sendError]: dart.definiteFunctionType(dart.void, [core.Object, core.StackTrace]),
[_sendDone]: dart.definiteFunctionType(dart.void, []),
- [_guardCallback]: dart.definiteFunctionType(dart.void, [VoidTovoid()]),
+ [_guardCallback]: dart.definiteFunctionType(dart.void, [dart.dynamic]),
[_checkState]: dart.definiteFunctionType(dart.void, [core.bool])
})
});
@@ -17308,7 +17367,6 @@
async._BufferingStreamSubscription._STATE_IN_CALLBACK = 32;
async._BufferingStreamSubscription._STATE_HAS_PENDING = 64;
async._BufferingStreamSubscription._STATE_PAUSE_COUNT = 128;
-async._BufferingStreamSubscription._STATE_PAUSE_COUNT_SHIFT = 7;
async._ControllerSubscription$ = dart.generic(T => {
let _StreamControllerLifecycleOfT = () => (_StreamControllerLifecycleOfT = dart.constFn(async._StreamControllerLifecycle$(T)))();
class _ControllerSubscription extends async._BufferingStreamSubscription$(T) {
@@ -18064,7 +18122,7 @@
result[_completeError](error, stackTrace);
}
}
- dart.fn(handleError, dynamicAnddynamicTovoid$());
+ dart.fn(handleError, dynamicAnddynamicToNull());
try {
for (let future of futures) {
let pos = remaining;
@@ -18210,7 +18268,7 @@
};
dart.fn(async._nonNullError, ObjectToObject());
async._FutureOnValue$ = dart.generic((S, T) => {
- const _FutureOnValue = dart.typedef('_FutureOnValue', () => dart.functionType(dart.dynamic, [S]));
+ const _FutureOnValue = dart.typedef('_FutureOnValue', () => dart.functionType(async.FutureOr$(T), [S]));
return _FutureOnValue;
});
async._FutureOnValue = _FutureOnValue();
@@ -18301,6 +18359,9 @@
const _whenCompleteAction = Symbol('_whenCompleteAction');
async._FutureListener$ = dart.generic((S, T) => {
let _FutureOnValueOfS$T = () => (_FutureOnValueOfS$T = dart.constFn(async._FutureOnValue$(S, T)))();
+ let FutureOrOfT = () => (FutureOrOfT = dart.constFn(async.FutureOr$(T)))();
+ let ZoneBinaryCallbackOfFutureOrOfT$Object$StackTrace = () => (ZoneBinaryCallbackOfFutureOrOfT$Object$StackTrace = dart.constFn(async.ZoneBinaryCallback$(FutureOrOfT(), core.Object, core.StackTrace)))();
+ let dynamicToFutureOrOfT = () => (dynamicToFutureOrOfT = dart.constFn(dart.functionType(FutureOrOfT(), [dart.dynamic])))();
let _FutureOfT = () => (_FutureOfT = dart.constFn(async._Future$(T)))();
class _FutureListener extends core.Object {
then(result, onValue, errorCallback) {
@@ -18360,7 +18421,7 @@
}
handleValue(sourceResult) {
S._check(sourceResult);
- return this[_zone].runUnary(dart.dynamic, S)(this[_onValue], sourceResult);
+ return this[_zone].runUnary(FutureOrOfT(), S)(this[_onValue], sourceResult);
}
matchesErrorTest(asyncError) {
if (!dart.test(this.hasErrorTest)) return true;
@@ -18370,10 +18431,10 @@
handleError(asyncError) {
dart.assert(dart.test(this.handlesError) && dart.test(this.hasErrorCallback));
if (async.ZoneBinaryCallback.is(this.errorCallback)) {
- let typedErrorCallback = ZoneBinaryCallbackOfObject$Object$StackTrace().as(this.errorCallback);
- return this[_zone].runBinary(core.Object, core.Object, core.StackTrace)(typedErrorCallback, asyncError.error, asyncError.stackTrace);
+ let typedErrorCallback = ZoneBinaryCallbackOfFutureOrOfT$Object$StackTrace().as(this.errorCallback);
+ return this[_zone].runBinary(FutureOrOfT(), core.Object, core.StackTrace)(typedErrorCallback, asyncError.error, asyncError.stackTrace);
} else {
- return this[_zone].runUnary(dart.dynamic, dart.dynamic)(dynamicTodynamic()._check(this.errorCallback), asyncError.error);
+ return this[_zone].runUnary(FutureOrOfT(), dart.dynamic)(dynamicToFutureOrOfT()._check(this.errorCallback), asyncError.error);
}
}
handleWhenComplete() {
@@ -18406,9 +18467,9 @@
hasErrorCallback: dart.definiteFunctionType(core.bool, [])
}),
methods: () => ({
- handleValue: dart.definiteFunctionType(dart.dynamic, [S]),
+ handleValue: dart.definiteFunctionType(async.FutureOr$(T), [S]),
matchesErrorTest: dart.definiteFunctionType(core.bool, [async.AsyncError]),
- handleError: dart.definiteFunctionType(dart.dynamic, [async.AsyncError]),
+ handleError: dart.definiteFunctionType(async.FutureOr$(T), [async.AsyncError]),
handleWhenComplete: dart.definiteFunctionType(dart.dynamic, [])
})
});
@@ -18509,7 +18570,7 @@
if (!core.identical(currentZone, async._ROOT_ZONE)) {
f = currentZone.registerUnaryCallback(async.FutureOr$(E), T)(f);
if (onError != null) {
- onError = async._registerErrorHandler(T)(onError, currentZone);
+ onError = async._registerErrorHandler(E)(onError, currentZone);
}
}
return this[_thenNoZoneRegistration](E)(f, onError);
@@ -18518,7 +18579,7 @@
[_thenNoZoneRegistration](E) {
return (f, onError) => {
let result = new (async._Future$(E))();
- this[_addListener](new (async._FutureListener$(T, E)).then(result, f, onError));
+ this[_addListener](new (async._FutureListener$(T, E)).then(result, async._FutureOnValue$(T, E)._check(f), onError));
return result;
};
}
@@ -19210,10 +19271,10 @@
});
async.StreamTransformer = StreamTransformer();
async.StreamIterator$ = dart.generic(T => {
- let _StreamIteratorImplOfT = () => (_StreamIteratorImplOfT = dart.constFn(async._StreamIteratorImpl$(T)))();
+ let _StreamIteratorOfT = () => (_StreamIteratorOfT = dart.constFn(async._StreamIterator$(T)))();
class StreamIterator extends core.Object {
static new(stream) {
- return new (_StreamIteratorImplOfT())(stream);
+ return new (_StreamIteratorOfT())(stream);
}
}
dart.addTypeTests(StreamIterator);
@@ -20081,36 +20142,6 @@
return _StreamImplEvents;
});
async._StreamImplEvents = _StreamImplEvents();
-const _unlink = Symbol('_unlink');
-const _insertBefore = Symbol('_insertBefore');
-async._BroadcastLinkedList = class _BroadcastLinkedList extends core.Object {
- new() {
- this[_next$] = null;
- this[_previous$] = null;
- }
- [_unlink]() {
- this[_previous$][_next$] = this[_next$];
- this[_next$][_previous$] = this[_previous$];
- this[_next$] = this[_previous$] = this;
- }
- [_insertBefore](newNext) {
- let newPrevious = newNext[_previous$];
- newPrevious[_next$] = this;
- newNext[_previous$] = this[_previous$];
- this[_previous$][_next$] = newNext;
- this[_previous$] = newPrevious;
- }
-};
-dart.setSignature(async._BroadcastLinkedList, {
- fields: () => ({
- [_next$]: async._BroadcastLinkedList,
- [_previous$]: async._BroadcastLinkedList
- }),
- methods: () => ({
- [_unlink]: dart.definiteFunctionType(dart.void, []),
- [_insertBefore]: dart.definiteFunctionType(dart.void, [async._BroadcastLinkedList])
- })
-});
async._BroadcastCallback$ = dart.generic(T => {
const _BroadcastCallback = dart.typedef('_BroadcastCallback', () => dart.functionType(dart.void, [async.StreamSubscription$(T)]));
return _BroadcastCallback;
@@ -20162,7 +20193,7 @@
}
}
cancel() {
- return null;
+ return async.Future._nullFuture;
}
asFuture(E) {
return futureValue => {
@@ -20338,7 +20369,7 @@
}
cancel() {
this[_stream][_cancelSubscription]();
- return null;
+ return async.Future._nullFuture;
}
get isPaused() {
return this[_stream][_isSubscriptionPaused];
@@ -20368,146 +20399,109 @@
return _BroadcastSubscriptionWrapper;
});
async._BroadcastSubscriptionWrapper = _BroadcastSubscriptionWrapper();
-const _current$1 = Symbol('_current');
-const _futureOrPrefetch = Symbol('_futureOrPrefetch');
-const _clear = Symbol('_clear');
-async._StreamIteratorImpl$ = dart.generic(T => {
+const _stateData = Symbol('_stateData');
+const _initializeOrDone = Symbol('_initializeOrDone');
+async._StreamIterator$ = dart.generic(T => {
+ let StreamOfT = () => (StreamOfT = dart.constFn(async.Stream$(T)))();
+ let StreamSubscriptionOfT = () => (StreamSubscriptionOfT = dart.constFn(async.StreamSubscription$(T)))();
let StreamIteratorOfT = () => (StreamIteratorOfT = dart.constFn(async.StreamIterator$(T)))();
- class _StreamIteratorImpl extends core.Object {
+ class _StreamIterator extends core.Object {
new(stream) {
+ this[_stateData] = stream;
this[_subscription] = null;
- this[_current$1] = null;
- this[_futureOrPrefetch] = null;
- this[_state] = async._StreamIteratorImpl._STATE_FOUND;
- this[_subscription] = stream.listen(dart.bind(this, _onData), {onError: dart.bind(this, _onError), onDone: dart.bind(this, _onDone), cancelOnError: true});
+ this[_isPaused] = false;
}
get current() {
- return this[_current$1];
+ if (this[_subscription] != null && dart.test(this[_isPaused])) {
+ return T.as(this[_stateData]);
+ }
+ return null;
}
moveNext() {
- if (this[_state] == async._StreamIteratorImpl._STATE_DONE) {
- return new (_FutureOfbool()).immediate(false);
- }
- if (this[_state] == async._StreamIteratorImpl._STATE_MOVING) {
+ if (this[_subscription] != null) {
+ if (dart.test(this[_isPaused])) {
+ let future = new (_FutureOfbool())();
+ this[_stateData] = future;
+ this[_isPaused] = false;
+ this[_subscription].resume();
+ return future;
+ }
dart.throw(new core.StateError("Already waiting for next."));
}
- if (this[_state] == async._StreamIteratorImpl._STATE_FOUND) {
- this[_state] = async._StreamIteratorImpl._STATE_MOVING;
- this[_current$1] = null;
- let result = new (_FutureOfbool())();
- this[_futureOrPrefetch] = result;
- return result;
- } else {
- dart.assert(dart.notNull(this[_state]) >= async._StreamIteratorImpl._STATE_EXTRA_DATA);
- switch (this[_state]) {
- case async._StreamIteratorImpl._STATE_EXTRA_DATA:
- {
- this[_state] = async._StreamIteratorImpl._STATE_FOUND;
- this[_current$1] = T.as(this[_futureOrPrefetch]);
- this[_futureOrPrefetch] = null;
- this[_subscription].resume();
- return new (_FutureOfbool()).immediate(true);
- }
- case async._StreamIteratorImpl._STATE_EXTRA_ERROR:
- {
- let prefetch = async.AsyncError._check(this[_futureOrPrefetch]);
- this[_clear]();
- return new (_FutureOfbool()).immediateError(prefetch.error, prefetch.stackTrace);
- }
- case async._StreamIteratorImpl._STATE_EXTRA_DONE:
- {
- this[_clear]();
- return new (_FutureOfbool()).immediate(false);
- }
- }
- }
+ return this[_initializeOrDone]();
}
- [_clear]() {
- this[_subscription] = null;
- this[_futureOrPrefetch] = null;
- this[_current$1] = null;
- this[_state] = async._StreamIteratorImpl._STATE_DONE;
+ [_initializeOrDone]() {
+ dart.assert(this[_subscription] == null);
+ let stateData = this[_stateData];
+ if (stateData != null) {
+ let stream = StreamOfT().as(stateData);
+ this[_subscription] = stream.listen(dart.bind(this, _onData), {onError: dart.bind(this, _onError), onDone: dart.bind(this, _onDone), cancelOnError: true});
+ let future = new (_FutureOfbool())();
+ this[_stateData] = future;
+ return future;
+ }
+ return new (_FutureOfbool()).immediate(false);
}
cancel() {
- let subscription = this[_subscription];
- if (subscription == null) return null;
- if (this[_state] == async._StreamIteratorImpl._STATE_MOVING) {
- let hasNext = _FutureOfbool().as(this[_futureOrPrefetch]);
- this[_clear]();
- hasNext[_complete](false);
- } else {
- this[_clear]();
+ let subscription = StreamSubscriptionOfT()._check(this[_subscription]);
+ let stateData = this[_stateData];
+ this[_stateData] = null;
+ if (subscription != null) {
+ this[_subscription] = null;
+ if (!dart.test(this[_isPaused])) {
+ let future = _FutureOfbool().as(stateData);
+ future[_asyncComplete](false);
+ }
+ return subscription.cancel();
}
- return subscription.cancel();
+ return async.Future._nullFuture;
}
[_onData](data) {
T._check(data);
- if (this[_state] == async._StreamIteratorImpl._STATE_MOVING) {
- this[_current$1] = data;
- let hasNext = _FutureOfbool().as(this[_futureOrPrefetch]);
- this[_futureOrPrefetch] = null;
- this[_state] = async._StreamIteratorImpl._STATE_FOUND;
- hasNext[_complete](true);
- return;
- }
- this[_subscription].pause();
- dart.assert(this[_futureOrPrefetch] == null);
- this[_futureOrPrefetch] = data;
- this[_state] = async._StreamIteratorImpl._STATE_EXTRA_DATA;
+ dart.assert(this[_subscription] != null && !dart.test(this[_isPaused]));
+ let moveNextFuture = _FutureOfbool().as(this[_stateData]);
+ this[_stateData] = data;
+ this[_isPaused] = true;
+ moveNextFuture[_complete](true);
+ if (this[_subscription] != null && dart.test(this[_isPaused])) this[_subscription].pause();
}
[_onError](error, stackTrace) {
if (stackTrace === void 0) stackTrace = null;
- if (this[_state] == async._StreamIteratorImpl._STATE_MOVING) {
- let hasNext = _FutureOfbool().as(this[_futureOrPrefetch]);
- this[_clear]();
- hasNext[_completeError](error, stackTrace);
- return;
- }
- this[_subscription].pause();
- dart.assert(this[_futureOrPrefetch] == null);
- this[_futureOrPrefetch] = new async.AsyncError(error, stackTrace);
- this[_state] = async._StreamIteratorImpl._STATE_EXTRA_ERROR;
+ dart.assert(this[_subscription] != null && !dart.test(this[_isPaused]));
+ let moveNextFuture = _FutureOfbool().as(this[_stateData]);
+ this[_subscription] = null;
+ this[_stateData] = null;
+ moveNextFuture[_completeError](error, stackTrace);
}
[_onDone]() {
- if (this[_state] == async._StreamIteratorImpl._STATE_MOVING) {
- let hasNext = _FutureOfbool().as(this[_futureOrPrefetch]);
- this[_clear]();
- hasNext[_complete](false);
- return;
- }
- this[_subscription].pause();
- this[_futureOrPrefetch] = null;
- this[_state] = async._StreamIteratorImpl._STATE_EXTRA_DONE;
+ dart.assert(this[_subscription] != null && !dart.test(this[_isPaused]));
+ let moveNextFuture = _FutureOfbool().as(this[_stateData]);
+ this[_subscription] = null;
+ this[_stateData] = null;
+ moveNextFuture[_complete](false);
}
}
- dart.addTypeTests(_StreamIteratorImpl);
- _StreamIteratorImpl[dart.implements] = () => [StreamIteratorOfT()];
- dart.setSignature(_StreamIteratorImpl, {
+ dart.addTypeTests(_StreamIterator);
+ _StreamIterator[dart.implements] = () => [StreamIteratorOfT()];
+ dart.setSignature(_StreamIterator, {
fields: () => ({
[_subscription]: async.StreamSubscription,
- [_current$1]: T,
- [_futureOrPrefetch]: dart.dynamic,
- [_state]: core.int
+ [_stateData]: core.Object,
+ [_isPaused]: core.bool
}),
getters: () => ({current: dart.definiteFunctionType(T, [])}),
methods: () => ({
moveNext: dart.definiteFunctionType(async.Future$(core.bool), []),
- [_clear]: dart.definiteFunctionType(dart.void, []),
+ [_initializeOrDone]: dart.definiteFunctionType(async.Future$(core.bool), []),
cancel: dart.definiteFunctionType(async.Future, []),
[_onData]: dart.definiteFunctionType(dart.void, [T]),
[_onError]: dart.definiteFunctionType(dart.void, [core.Object], [core.StackTrace]),
[_onDone]: dart.definiteFunctionType(dart.void, [])
})
});
- return _StreamIteratorImpl;
+ return _StreamIterator;
});
-async._StreamIteratorImpl = _StreamIteratorImpl();
-async._StreamIteratorImpl._STATE_FOUND = 0;
-async._StreamIteratorImpl._STATE_DONE = 1;
-async._StreamIteratorImpl._STATE_MOVING = 2;
-async._StreamIteratorImpl._STATE_EXTRA_DATA = 3;
-async._StreamIteratorImpl._STATE_EXTRA_ERROR = 4;
-async._StreamIteratorImpl._STATE_EXTRA_DONE = 5;
+async._StreamIterator = _StreamIterator();
async._EmptyStream$ = dart.generic(T => {
let _DoneStreamSubscriptionOfT = () => (_DoneStreamSubscriptionOfT = dart.constFn(async._DoneStreamSubscription$(T)))();
let TTovoid = () => (TTovoid = dart.constFn(dart.functionType(dart.void, [T])))();
@@ -20550,7 +20544,7 @@
dart.lazyFn(async._runUserCode, () => FnAndFnAndFnTodynamic());
async._cancelAndError = function(subscription, future, error, stackTrace) {
let cancelFuture = subscription.cancel();
- if (async.Future.is(cancelFuture)) {
+ if (async.Future.is(cancelFuture) && !core.identical(cancelFuture, async.Future._nullFuture)) {
cancelFuture.whenComplete(dart.fn(() => future[_completeError](error, stackTrace), VoidTovoid$()));
} else {
future[_completeError](error, stackTrace);
@@ -20575,7 +20569,7 @@
dart.fn(async._cancelAndErrorClosure, StreamSubscriptionAnd_FutureTo_ErrorCallback());
async._cancelAndValue = function(subscription, future, value) {
let cancelFuture = subscription.cancel();
- if (async.Future.is(cancelFuture)) {
+ if (async.Future.is(cancelFuture) && !core.identical(cancelFuture, async.Future._nullFuture)) {
cancelFuture.whenComplete(dart.fn(() => future[_complete](value), VoidTovoid$()));
} else {
future[_complete](value);
@@ -20858,6 +20852,7 @@
async._HandleErrorStream = _HandleErrorStream();
const _count = Symbol('_count');
async._TakeStream$ = dart.generic(T => {
+ let _DoneStreamSubscriptionOfT = () => (_DoneStreamSubscriptionOfT = dart.constFn(async._DoneStreamSubscription$(T)))();
let _StateStreamSubscriptionOfT = () => (_StateStreamSubscriptionOfT = dart.constFn(async._StateStreamSubscription$(T)))();
let _EventSinkOfT = () => (_EventSinkOfT = dart.constFn(async._EventSink$(T)))();
let TTovoid = () => (TTovoid = dart.constFn(dart.functionType(dart.void, [T])))();
@@ -20868,6 +20863,10 @@
if (!(typeof count == 'number')) dart.throw(new core.ArgumentError(count));
}
[_createSubscription](onData, onError, onDone, cancelOnError) {
+ if (this[_count] == 0) {
+ this[_source$].listen(null).cancel();
+ return new (_DoneStreamSubscriptionOfT())(onDone);
+ }
return new (_StateStreamSubscriptionOfT())(this, onData, onError, onDone, cancelOnError, this[_count]);
}
[_handleData](inputEvent, sink) {
@@ -21170,7 +21169,7 @@
if (dart.test(this[_isSubscribed])) {
let subscription = this[_subscription];
this[_subscription] = null;
- subscription.cancel();
+ return subscription.cancel();
}
return null;
}
@@ -22474,8 +22473,8 @@
if (onError != null) {
errorHandler = dart.fn((self, parent, zone, error, stackTrace) => {
try {
- if (ZoneBinaryCallbackOfdynamic$dynamic$StackTrace().is(onError)) {
- return R.as(self.parent.runBinary(dart.dynamic, dart.dynamic, core.StackTrace)(onError, error, stackTrace));
+ if (async.ZoneBinaryCallback$(R, dart.dynamic, core.StackTrace).is(onError)) {
+ return self.parent.runBinary(R, dart.dynamic, core.StackTrace)(onError, error, stackTrace);
}
return self.parent.runUnary(dart.dynamic, dart.dynamic)(dynamicTodynamic()._check(onError), error);
} catch (e) {
@@ -22937,7 +22936,7 @@
let _HashMapKeyIteratorOfE = () => (_HashMapKeyIteratorOfE = dart.constFn(collection._HashMapKeyIterator$(E)))();
let ETovoid = () => (ETovoid = dart.constFn(dart.functionType(dart.void, [E])))();
let _HashMapOfE$dynamic = () => (_HashMapOfE$dynamic = dart.constFn(collection._HashMap$(E, dart.dynamic)))();
- class _HashMapKeyIterable extends core.Iterable$(E) {
+ class _HashMapKeyIterable extends _internal.EfficientLengthIterable$(E) {
new(map) {
this[_map$0] = map;
super.new();
@@ -22964,7 +22963,6 @@
}
}
}
- _HashMapKeyIterable[dart.implements] = () => [_internal.EfficientLength];
dart.setSignature(_HashMapKeyIterable, {
fields: () => ({[_map$0]: _HashMapOfE$dynamic()}),
getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])})
@@ -22980,7 +22978,7 @@
});
collection._HashMapKeyIterable = _HashMapKeyIterable();
const _offset = Symbol('_offset');
-const _current$2 = Symbol('_current');
+const _current$1 = Symbol('_current');
collection._HashMapKeyIterator$ = dart.generic(E => {
let IteratorOfE = () => (IteratorOfE = dart.constFn(core.Iterator$(E)))();
let _HashMapOfE$dynamic = () => (_HashMapOfE$dynamic = dart.constFn(collection._HashMap$(E, dart.dynamic)))();
@@ -22990,10 +22988,10 @@
this[_map$0] = map;
this[_keys] = keys;
this[_offset] = 0;
- this[_current$2] = null;
+ this[_current$1] = null;
}
get current() {
- return this[_current$2];
+ return this[_current$1];
}
moveNext() {
let keys = this[_keys];
@@ -23001,10 +22999,10 @@
if (keys !== this[_map$0][_keys]) {
dart.throw(new core.ConcurrentModificationError(this[_map$0]));
} else if (dart.notNull(offset) >= keys.length) {
- this[_current$2] = null;
+ this[_current$1] = null;
return false;
} else {
- this[_current$2] = keys[offset];
+ this[_current$1] = keys[offset];
this[_offset] = dart.notNull(offset) + 1;
return true;
}
@@ -23017,7 +23015,7 @@
[_map$0]: _HashMapOfE$dynamic(),
[_keys]: ListOfE(),
[_offset]: core.int,
- [_current$2]: E
+ [_current$1]: E
}),
getters: () => ({current: dart.definiteFunctionType(E, [])}),
methods: () => ({moveNext: dart.definiteFunctionType(core.bool, [])})
@@ -23180,7 +23178,7 @@
collection._Es6MapIterable$ = dart.generic(E => {
let _Es6MapIteratorOfE = () => (_Es6MapIteratorOfE = dart.constFn(collection._Es6MapIterator$(E)))();
let ETovoid = () => (ETovoid = dart.constFn(dart.functionType(dart.void, [E])))();
- class _Es6MapIterable extends core.Iterable$(E) {
+ class _Es6MapIterable extends _internal.EfficientLengthIterable$(E) {
new(map, isKeys) {
this[_map$0] = map;
this[_isKeys] = isKeys;
@@ -23218,7 +23216,6 @@
}
}
}
- _Es6MapIterable[dart.implements] = () => [_internal.EfficientLength];
dart.setSignature(_Es6MapIterable, {
fields: () => ({
[_map$0]: dart.dynamic,
@@ -23248,7 +23245,7 @@
this[_isKeys] = isKeys;
this[_jsIterator$] = null;
this[_next$0] = null;
- this[_current$2] = null;
+ this[_current$1] = null;
this[_done] = null;
if (dart.test(this[_isKeys])) {
this[_jsIterator$] = dart.dload(this[_map$0], _map$0).keys();
@@ -23258,7 +23255,7 @@
this[_done] = false;
}
get current() {
- return this[_current$2];
+ return this[_current$1];
}
moveNext() {
if (!dart.equals(this[_modifications$], dart.dload(this[_map$0], _modifications$))) {
@@ -23268,11 +23265,11 @@
this[_next$0] = this[_jsIterator$].next();
let done = this[_next$0].done;
if (done) {
- this[_current$2] = null;
+ this[_current$1] = null;
this[_done] = true;
return false;
} else {
- this[_current$2] = this[_next$0].value;
+ this[_current$1] = this[_next$0].value;
return true;
}
}
@@ -23286,7 +23283,7 @@
[_isKeys]: core.bool,
[_jsIterator$]: dart.dynamic,
[_next$0]: dart.dynamic,
- [_current$2]: E,
+ [_current$1]: E,
[_done]: core.bool
}),
getters: () => ({current: dart.definiteFunctionType(E, [])}),
@@ -24077,10 +24074,10 @@
this[_set] = set;
this[_elements] = elements;
this[_offset] = 0;
- this[_current$2] = null;
+ this[_current$1] = null;
}
get current() {
- return this[_current$2];
+ return this[_current$1];
}
moveNext() {
let elements = this[_elements];
@@ -24088,10 +24085,10 @@
if (elements !== dart.dload(this[_set], _elements)) {
dart.throw(new core.ConcurrentModificationError(this[_set]));
} else if (dart.notNull(offset) >= elements.length) {
- this[_current$2] = null;
+ this[_current$1] = null;
return false;
} else {
- this[_current$2] = elements[offset];
+ this[_current$1] = elements[offset];
this[_offset] = dart.notNull(offset) + 1;
return true;
}
@@ -24104,7 +24101,7 @@
[_set]: dart.dynamic,
[_elements]: ListOfE(),
[_offset]: core.int,
- [_current$2]: E
+ [_current$1]: E
}),
getters: () => ({current: dart.definiteFunctionType(E, [])}),
methods: () => ({moveNext: dart.definiteFunctionType(core.bool, [])})
@@ -24558,20 +24555,20 @@
this[_set] = set;
this[_modifications$] = modifications;
this[_cell$] = null;
- this[_current$2] = null;
+ this[_current$1] = null;
this[_cell$] = this[_set][_first$];
}
get current() {
- return this[_current$2];
+ return this[_current$1];
}
moveNext() {
if (this[_modifications$] != this[_set][_modifications$]) {
dart.throw(new core.ConcurrentModificationError(this[_set]));
} else if (this[_cell$] == null) {
- this[_current$2] = null;
+ this[_current$1] = null;
return false;
} else {
- this[_current$2] = E._check(this[_cell$][_element]);
+ this[_current$1] = E._check(this[_cell$][_element]);
this[_cell$] = this[_cell$][_next$0];
return true;
}
@@ -24584,7 +24581,7 @@
[_set]: collection._LinkedHashSet,
[_modifications$]: core.int,
[_cell$]: collection._LinkedHashSetCell,
- [_current$2]: E
+ [_current$1]: E
}),
getters: () => ({current: dart.definiteFunctionType(E, [])}),
methods: () => ({moveNext: dart.definiteFunctionType(core.bool, [])})
@@ -24849,7 +24846,7 @@
return SetOfE().from(this);
}
get length() {
- dart.assert(!_internal.EfficientLength.is(this));
+ dart.assert(!_internal.EfficientLengthIterable.is(this));
let count = 0;
let it = this[dartx.iterator];
while (dart.test(it.moveNext())) {
@@ -25277,9 +25274,9 @@
});
collection.LinkedHashSet = LinkedHashSet();
const _modificationCount = Symbol('_modificationCount');
-const _insertBefore$ = Symbol('_insertBefore');
+const _insertBefore = Symbol('_insertBefore');
const _list = Symbol('_list');
-const _unlink$ = Symbol('_unlink');
+const _unlink = Symbol('_unlink');
collection.LinkedList$ = dart.generic(E => {
let IterableOfE = () => (IterableOfE = dart.constFn(core.Iterable$(E)))();
let _LinkedListIteratorOfE = () => (_LinkedListIteratorOfE = dart.constFn(collection._LinkedListIterator$(E)))();
@@ -25293,12 +25290,12 @@
}
addFirst(entry) {
E._check(entry);
- this[_insertBefore$](this[_first$], entry, {updateFirst: true});
+ this[_insertBefore](this[_first$], entry, {updateFirst: true});
this[_first$] = entry;
}
add(entry) {
E._check(entry);
- this[_insertBefore$](this[_first$], entry, {updateFirst: false});
+ this[_insertBefore](this[_first$], entry, {updateFirst: false});
}
addAll(entries) {
IterableOfE()._check(entries);
@@ -25307,7 +25304,7 @@
remove(entry) {
E._check(entry);
if (!dart.equals(entry[_list], this)) return false;
- this[_unlink$](entry);
+ this[_unlink](entry);
return true;
}
get iterator() {
@@ -25364,7 +25361,7 @@
get isEmpty() {
return this[_length$1] == 0;
}
- [_insertBefore$](entry, newEntry, opts) {
+ [_insertBefore](entry, newEntry, opts) {
E._check(entry);
E._check(newEntry);
let updateFirst = opts && 'updateFirst' in opts ? opts.updateFirst : null;
@@ -25391,7 +25388,7 @@
}
this[_length$1] = dart.notNull(this[_length$1]) + 1;
}
- [_unlink$](entry) {
+ [_unlink](entry) {
E._check(entry);
this[_modificationCount] = dart.notNull(this[_modificationCount]) + 1;
entry[_next$0][_previous$0] = entry[_previous$0];
@@ -25418,8 +25415,8 @@
addAll: dart.definiteFunctionType(dart.void, [IterableOfE()]),
remove: dart.definiteFunctionType(core.bool, [E]),
clear: dart.definiteFunctionType(dart.void, []),
- [_insertBefore$]: dart.definiteFunctionType(dart.void, [E, E], {updateFirst: core.bool}),
- [_unlink$]: dart.definiteFunctionType(dart.void, [E])
+ [_insertBefore]: dart.definiteFunctionType(dart.void, [E, E], {updateFirst: core.bool}),
+ [_unlink]: dart.definiteFunctionType(dart.void, [E])
})
});
dart.defineExtensionMembers(LinkedList, [
@@ -25445,21 +25442,21 @@
this[_modificationCount] = list[_modificationCount];
this[_next$0] = list[_first$];
this[_visitedFirst] = false;
- this[_current$2] = null;
+ this[_current$1] = null;
}
get current() {
- return this[_current$2];
+ return this[_current$1];
}
moveNext() {
if (this[_modificationCount] != this[_list][_modificationCount]) {
dart.throw(new core.ConcurrentModificationError(this));
}
if (dart.test(this[_list].isEmpty) || dart.test(this[_visitedFirst]) && core.identical(this[_next$0], this[_list].first)) {
- this[_current$2] = null;
+ this[_current$1] = null;
return false;
}
this[_visitedFirst] = true;
- this[_current$2] = E._check(this[_next$0]);
+ this[_current$1] = E._check(this[_next$0]);
this[_next$0] = this[_next$0][_next$0];
return true;
}
@@ -25470,7 +25467,7 @@
fields: () => ({
[_list]: LinkedListOfE(),
[_modificationCount]: core.int,
- [_current$2]: E,
+ [_current$1]: E,
[_next$0]: LinkedListEntryOfE(),
[_visitedFirst]: core.bool
}),
@@ -25492,23 +25489,23 @@
return this[_list];
}
unlink() {
- this[_list][_unlink$](E._check(this));
+ this[_list][_unlink](E._check(this));
}
get next() {
- if (core.identical(this, this[_next$0])) return null;
+ if (this[_list] == null || core.identical(this[_list].first, this[_next$0])) return null;
return this[_next$0];
}
get previous() {
- if (core.identical(this, this[_previous$0])) return null;
+ if (this[_list] == null || core.identical(this, this[_list].first)) return null;
return this[_previous$0];
}
insertAfter(entry) {
E._check(entry);
- this[_list][_insertBefore$](this[_next$0], entry, {updateFirst: false});
+ this[_list][_insertBefore](this[_next$0], entry, {updateFirst: false});
}
insertBefore(entry) {
E._check(entry);
- this[_list][_insertBefore$](E.as(this), entry, {updateFirst: true});
+ this[_list][_insertBefore](E.as(this), entry, {updateFirst: true});
}
}
dart.addTypeTests(LinkedListEntry);
@@ -25677,7 +25674,7 @@
collection._MapBaseValueIterable$ = dart.generic((K, V) => {
let _MapBaseValueIteratorOfK$V = () => (_MapBaseValueIteratorOfK$V = dart.constFn(collection._MapBaseValueIterator$(K, V)))();
let MapOfK$V = () => (MapOfK$V = dart.constFn(core.Map$(K, V)))();
- class _MapBaseValueIterable extends core.Iterable$(V) {
+ class _MapBaseValueIterable extends _internal.EfficientLengthIterable$(V) {
new(map) {
this[_map$0] = map;
super.new();
@@ -25704,7 +25701,6 @@
return new (_MapBaseValueIteratorOfK$V())(this[_map$0]);
}
}
- _MapBaseValueIterable[dart.implements] = () => [_internal.EfficientLength];
dart.setSignature(_MapBaseValueIterable, {
fields: () => ({[_map$0]: MapOfK$V()}),
getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(V), [])})
@@ -25729,18 +25725,18 @@
new(map) {
this[_map$0] = map;
this[_keys] = map[dartx.keys][dartx.iterator];
- this[_current$2] = null;
+ this[_current$1] = null;
}
moveNext() {
if (dart.test(this[_keys].moveNext())) {
- this[_current$2] = this[_map$0][dartx._get](this[_keys].current);
+ this[_current$1] = this[_map$0][dartx._get](this[_keys].current);
return true;
}
- this[_current$2] = null;
+ this[_current$1] = null;
return false;
}
get current() {
- return this[_current$2];
+ return this[_current$1];
}
}
dart.addTypeTests(_MapBaseValueIterator);
@@ -25749,7 +25745,7 @@
fields: () => ({
[_keys]: IteratorOfK(),
[_map$0]: MapOfK$V(),
- [_current$2]: V
+ [_current$1]: V
}),
getters: () => ({current: dart.definiteFunctionType(V, [])}),
methods: () => ({moveNext: dart.definiteFunctionType(core.bool, [])})
@@ -25985,7 +25981,7 @@
});
collection.Queue$ = dart.generic(E => {
let ListQueueOfE = () => (ListQueueOfE = dart.constFn(collection.ListQueue$(E)))();
- let IterableOfE = () => (IterableOfE = dart.constFn(core.Iterable$(E)))();
+ let EfficientLengthIterableOfE = () => (EfficientLengthIterableOfE = dart.constFn(_internal.EfficientLengthIterable$(E)))();
class Queue extends core.Object {
static new() {
return new (ListQueueOfE())();
@@ -25993,33 +25989,30 @@
static from(elements) {
return ListQueueOfE().from(elements);
}
- [Symbol.iterator]() {
- return new dart.JsIterator(this.iterator);
- }
}
dart.addTypeTests(Queue);
- Queue[dart.implements] = () => [IterableOfE(), _internal.EfficientLength];
+ Queue[dart.implements] = () => [EfficientLengthIterableOfE()];
return Queue;
});
collection.Queue = Queue();
const _previousLink = Symbol('_previousLink');
const _nextLink = Symbol('_nextLink');
const _link = Symbol('_link');
-collection._DoubleLink$ = dart.generic(E => {
+collection._DoubleLink$ = dart.generic(Link => {
class _DoubleLink extends core.Object {
new() {
this[_previousLink] = null;
this[_nextLink] = null;
}
[_link](previous, next) {
- E._check(previous);
- E._check(next);
+ Link._check(previous);
+ Link._check(next);
this[_nextLink] = next;
this[_previousLink] = previous;
if (previous != null) previous[_nextLink] = this;
if (next != null) next[_previousLink] = this;
}
- [_unlink$]() {
+ [_unlink]() {
if (this[_previousLink] != null) this[_previousLink][_nextLink] = this[_nextLink];
if (this[_nextLink] != null) this[_nextLink][_previousLink] = this[_previousLink];
this[_nextLink] = null;
@@ -26029,46 +26022,34 @@
dart.addTypeTests(_DoubleLink);
dart.setSignature(_DoubleLink, {
fields: () => ({
- [_previousLink]: E,
- [_nextLink]: E
+ [_previousLink]: Link,
+ [_nextLink]: Link
}),
methods: () => ({
- [_link]: dart.definiteFunctionType(dart.void, [E, E]),
- [_unlink$]: dart.definiteFunctionType(dart.void, [])
+ [_link]: dart.definiteFunctionType(dart.void, [Link, Link]),
+ [_unlink]: dart.definiteFunctionType(dart.void, [])
})
});
return _DoubleLink;
});
collection._DoubleLink = _DoubleLink();
collection.DoubleLinkedQueueEntry$ = dart.generic(E => {
- let _UserDoubleLinkedQueueEntryOfE = () => (_UserDoubleLinkedQueueEntryOfE = dart.constFn(collection._UserDoubleLinkedQueueEntry$(E)))();
- class DoubleLinkedQueueEntry extends core.Object {
- static new(element) {
- return new (_UserDoubleLinkedQueueEntryOfE())(element);
- }
- }
- dart.addTypeTests(DoubleLinkedQueueEntry);
- return DoubleLinkedQueueEntry;
-});
-collection.DoubleLinkedQueueEntry = DoubleLinkedQueueEntry();
-collection._UserDoubleLinkedQueueEntry$ = dart.generic(E => {
- let _UserDoubleLinkedQueueEntryOfE = () => (_UserDoubleLinkedQueueEntryOfE = dart.constFn(collection._UserDoubleLinkedQueueEntry$(E)))();
let DoubleLinkedQueueEntryOfE = () => (DoubleLinkedQueueEntryOfE = dart.constFn(collection.DoubleLinkedQueueEntry$(E)))();
- class _UserDoubleLinkedQueueEntry extends collection._DoubleLink {
+ class DoubleLinkedQueueEntry extends collection._DoubleLink {
new(element) {
this.element = element;
super.new();
}
append(e) {
E._check(e);
- new (_UserDoubleLinkedQueueEntryOfE())(e)[_link](this, this[_nextLink]);
+ new (DoubleLinkedQueueEntryOfE())(e)[_link](this, this[_nextLink]);
}
prepend(e) {
E._check(e);
- new (_UserDoubleLinkedQueueEntryOfE())(e)[_link](this[_previousLink], this);
+ new (DoubleLinkedQueueEntryOfE())(e)[_link](this[_previousLink], this);
}
remove() {
- this[_unlink$]();
+ this[_unlink]();
return this.element;
}
previousEntry() {
@@ -26078,8 +26059,7 @@
return this[_nextLink];
}
}
- _UserDoubleLinkedQueueEntry[dart.implements] = () => [DoubleLinkedQueueEntryOfE()];
- dart.setSignature(_UserDoubleLinkedQueueEntry, {
+ dart.setSignature(DoubleLinkedQueueEntry, {
fields: () => ({element: E}),
methods: () => ({
append: dart.definiteFunctionType(dart.void, [E]),
@@ -26089,22 +26069,23 @@
nextEntry: dart.definiteFunctionType(collection.DoubleLinkedQueueEntry$(E), [])
})
});
- return _UserDoubleLinkedQueueEntry;
-}, _UserDoubleLinkedQueueEntry => {
- dart.setBaseClass(_UserDoubleLinkedQueueEntry, collection._DoubleLink$(_UserDoubleLinkedQueueEntry));
+ return DoubleLinkedQueueEntry;
+}, DoubleLinkedQueueEntry => {
+ dart.setBaseClass(DoubleLinkedQueueEntry, collection._DoubleLink$(DoubleLinkedQueueEntry));
});
-collection._UserDoubleLinkedQueueEntry = _UserDoubleLinkedQueueEntry();
+collection.DoubleLinkedQueueEntry = DoubleLinkedQueueEntry();
const _queue = Symbol('_queue');
const _append = Symbol('_append');
const _prepend = Symbol('_prepend');
const _asNonSentinelEntry = Symbol('_asNonSentinelEntry');
collection._DoubleLinkedQueueEntry$ = dart.generic(E => {
let _DoubleLinkedQueueElementOfE = () => (_DoubleLinkedQueueElementOfE = dart.constFn(collection._DoubleLinkedQueueElement$(E)))();
+ let _DoubleLinkedQueueEntryOfE = () => (_DoubleLinkedQueueEntryOfE = dart.constFn(collection._DoubleLinkedQueueEntry$(E)))();
let DoubleLinkedQueueOfE = () => (DoubleLinkedQueueOfE = dart.constFn(collection.DoubleLinkedQueue$(E)))();
- class _DoubleLinkedQueueEntry extends collection._DoubleLink {
- new(queue) {
+ class _DoubleLinkedQueueEntry extends collection.DoubleLinkedQueueEntry$(E) {
+ new(element, queue) {
this[_queue] = queue;
- super.new();
+ super.new(element);
}
[_append](e) {
E._check(e);
@@ -26114,34 +26095,34 @@
E._check(e);
new (_DoubleLinkedQueueElementOfE())(e, this[_queue])[_link](this[_previousLink], this);
}
+ get [_element]() {
+ return this.element;
+ }
nextEntry() {
- return this[_nextLink][_asNonSentinelEntry]();
+ let entry = _DoubleLinkedQueueEntryOfE()._check(this[_nextLink]);
+ return entry[_asNonSentinelEntry]();
}
previousEntry() {
- return this[_previousLink][_asNonSentinelEntry]();
+ let entry = _DoubleLinkedQueueEntryOfE()._check(this[_previousLink]);
+ return entry[_asNonSentinelEntry]();
}
}
dart.setSignature(_DoubleLinkedQueueEntry, {
fields: () => ({[_queue]: DoubleLinkedQueueOfE()}),
+ getters: () => ({[_element]: dart.definiteFunctionType(E, [])}),
methods: () => ({
[_append]: dart.definiteFunctionType(dart.void, [E]),
- [_prepend]: dart.definiteFunctionType(dart.void, [E]),
- nextEntry: dart.definiteFunctionType(collection.DoubleLinkedQueueEntry$(E), []),
- previousEntry: dart.definiteFunctionType(collection.DoubleLinkedQueueEntry$(E), [])
+ [_prepend]: dart.definiteFunctionType(dart.void, [E])
})
});
return _DoubleLinkedQueueEntry;
-}, _DoubleLinkedQueueEntry => {
- dart.setBaseClass(_DoubleLinkedQueueEntry, collection._DoubleLink$(_DoubleLinkedQueueEntry));
});
collection._DoubleLinkedQueueEntry = _DoubleLinkedQueueEntry();
const _elementCount = Symbol('_elementCount');
collection._DoubleLinkedQueueElement$ = dart.generic(E => {
- let DoubleLinkedQueueEntryOfE = () => (DoubleLinkedQueueEntryOfE = dart.constFn(collection.DoubleLinkedQueueEntry$(E)))();
class _DoubleLinkedQueueElement extends collection._DoubleLinkedQueueEntry$(E) {
new(element, queue) {
- this.element = element;
- super.new(queue);
+ super.new(element, queue);
}
append(e) {
E._check(e);
@@ -26161,7 +26142,7 @@
}
[_remove]() {
this[_queue] = null;
- this[_unlink$]();
+ this[_unlink]();
return this.element;
}
remove() {
@@ -26175,14 +26156,9 @@
return this;
}
}
- _DoubleLinkedQueueElement[dart.implements] = () => [DoubleLinkedQueueEntryOfE()];
dart.setSignature(_DoubleLinkedQueueElement, {
- fields: () => ({element: E}),
methods: () => ({
- append: dart.definiteFunctionType(dart.void, [E]),
- prepend: dart.definiteFunctionType(dart.void, [E]),
[_remove]: dart.definiteFunctionType(E, []),
- remove: dart.definiteFunctionType(E, []),
[_asNonSentinelEntry]: dart.definiteFunctionType(collection._DoubleLinkedQueueElement$(E), [])
})
});
@@ -26192,7 +26168,7 @@
collection._DoubleLinkedQueueSentinel$ = dart.generic(E => {
class _DoubleLinkedQueueSentinel extends collection._DoubleLinkedQueueEntry$(E) {
new(queue) {
- super.new(queue);
+ super.new(null, queue);
this[_previousLink] = this;
this[_nextLink] = this;
}
@@ -26202,12 +26178,11 @@
[_remove]() {
dart.throw(_internal.IterableElementError.noElement());
}
- get element() {
+ get [_element]() {
dart.throw(_internal.IterableElementError.noElement());
}
}
dart.setSignature(_DoubleLinkedQueueSentinel, {
- getters: () => ({element: dart.definiteFunctionType(E, [])}),
methods: () => ({
[_asNonSentinelEntry]: dart.definiteFunctionType(collection.DoubleLinkedQueueEntry$(E), []),
[_remove]: dart.definiteFunctionType(E, [])
@@ -26221,6 +26196,7 @@
let _DoubleLinkedQueueSentinelOfE = () => (_DoubleLinkedQueueSentinelOfE = dart.constFn(collection._DoubleLinkedQueueSentinel$(E)))();
let DoubleLinkedQueueOfE = () => (DoubleLinkedQueueOfE = dart.constFn(collection.DoubleLinkedQueue$(E)))();
let IterableOfE = () => (IterableOfE = dart.constFn(core.Iterable$(E)))();
+ let _DoubleLinkedQueueEntryOfE = () => (_DoubleLinkedQueueEntryOfE = dart.constFn(collection._DoubleLinkedQueueEntry$(E)))();
let _DoubleLinkedQueueElementOfE = () => (_DoubleLinkedQueueElementOfE = dart.constFn(collection._DoubleLinkedQueueElement$(E)))();
let _DoubleLinkedQueueIteratorOfE = () => (_DoubleLinkedQueueIteratorOfE = dart.constFn(collection._DoubleLinkedQueueIterator$(E)))();
let QueueOfE = () => (QueueOfE = dart.constFn(collection.Queue$(E)))();
@@ -26268,34 +26244,42 @@
}
}
removeLast() {
- let lastEntry = this[_sentinel][_previousLink];
+ let lastEntry = _DoubleLinkedQueueEntryOfE()._check(this[_sentinel][_previousLink]);
let result = lastEntry[_remove]();
this[_elementCount] = dart.notNull(this[_elementCount]) - 1;
return result;
}
removeFirst() {
- let firstEntry = this[_sentinel][_nextLink];
+ let firstEntry = _DoubleLinkedQueueEntryOfE()._check(this[_sentinel][_nextLink]);
let result = firstEntry[_remove]();
this[_elementCount] = dart.notNull(this[_elementCount]) - 1;
return result;
}
remove(o) {
- let entry = this[_sentinel][_nextLink];
+ let entry = _DoubleLinkedQueueEntryOfE()._check(this[_sentinel][_nextLink]);
while (!core.identical(entry, this[_sentinel])) {
- if (dart.equals(entry.element, o)) {
+ let equals = dart.equals(entry[_element], o);
+ if (!core.identical(this, entry[_queue])) {
+ dart.throw(new core.ConcurrentModificationError(this));
+ }
+ if (equals) {
entry[_remove]();
this[_elementCount] = dart.notNull(this[_elementCount]) - 1;
return true;
}
- entry = entry[_nextLink];
+ entry = _DoubleLinkedQueueEntryOfE()._check(entry[_nextLink]);
}
return false;
}
[_filter](test, removeMatching) {
- let entry = this[_sentinel][_nextLink];
+ let entry = _DoubleLinkedQueueEntryOfE()._check(this[_sentinel][_nextLink]);
while (!core.identical(entry, this[_sentinel])) {
- let next = entry[_nextLink];
- if (core.identical(removeMatching, test(entry.element))) {
+ let matches = test(entry[_element]);
+ if (!core.identical(this, entry[_queue])) {
+ dart.throw(new core.ConcurrentModificationError(this));
+ }
+ let next = _DoubleLinkedQueueEntryOfE()._check(entry[_nextLink]);
+ if (core.identical(removeMatching, matches)) {
entry[_remove]();
this[_elementCount] = dart.notNull(this[_elementCount]) - 1;
}
@@ -26309,26 +26293,26 @@
this[_filter](test, false);
}
get first() {
- let firstEntry = this[_sentinel][_nextLink];
- return firstEntry.element;
+ let firstEntry = _DoubleLinkedQueueEntryOfE()._check(this[_sentinel][_nextLink]);
+ return firstEntry[_element];
}
get last() {
- let lastEntry = this[_sentinel][_previousLink];
- return lastEntry.element;
+ let lastEntry = _DoubleLinkedQueueEntryOfE()._check(this[_sentinel][_previousLink]);
+ return lastEntry[_element];
}
get single() {
if (core.identical(this[_sentinel][_nextLink], this[_sentinel][_previousLink])) {
- let entry = this[_sentinel][_nextLink];
- return entry.element;
+ let entry = _DoubleLinkedQueueEntryOfE()._check(this[_sentinel][_nextLink]);
+ return entry[_element];
}
dart.throw(_internal.IterableElementError.tooMany());
}
- lastEntry() {
- return this[_sentinel].previousEntry();
- }
firstEntry() {
return this[_sentinel].nextEntry();
}
+ lastEntry() {
+ return this[_sentinel].previousEntry();
+ }
get isEmpty() {
return core.identical(this[_sentinel][_nextLink], this[_sentinel]);
}
@@ -26337,13 +26321,18 @@
this[_sentinel][_previousLink] = this[_sentinel];
this[_elementCount] = 0;
}
- forEachEntry(f) {
- let entry = this[_sentinel][_nextLink];
+ forEachEntry(action) {
+ let entry = _DoubleLinkedQueueEntryOfE()._check(this[_sentinel][_nextLink]);
while (!core.identical(entry, this[_sentinel])) {
- let nextEntry = entry[_nextLink];
let element = _DoubleLinkedQueueElementOfE()._check(entry);
- f(element);
- entry = nextEntry;
+ let next = _DoubleLinkedQueueEntryOfE()._check(element[_nextLink]);
+ action(element);
+ if (core.identical(this, entry[_queue])) {
+ next = _DoubleLinkedQueueEntryOfE()._check(entry[_nextLink]);
+ } else if (!core.identical(this, next[_queue])) {
+ dart.throw(new core.ConcurrentModificationError(this));
+ }
+ entry = next;
}
}
get iterator() {
@@ -26371,8 +26360,8 @@
[_filter]: dart.definiteFunctionType(dart.void, [ETobool(), core.bool]),
removeWhere: dart.definiteFunctionType(dart.void, [ETobool()]),
retainWhere: dart.definiteFunctionType(dart.void, [ETobool()]),
- lastEntry: dart.definiteFunctionType(collection.DoubleLinkedQueueEntry$(E), []),
firstEntry: dart.definiteFunctionType(collection.DoubleLinkedQueueEntry$(E), []),
+ lastEntry: dart.definiteFunctionType(collection.DoubleLinkedQueueEntry$(E), []),
clear: dart.definiteFunctionType(dart.void, []),
forEachEntry: dart.definiteFunctionType(dart.void, [DoubleLinkedQueueEntryOfETovoid()])
})
@@ -26391,33 +26380,33 @@
collection.DoubleLinkedQueue = DoubleLinkedQueue();
const _nextEntry = Symbol('_nextEntry');
collection._DoubleLinkedQueueIterator$ = dart.generic(E => {
+ let _DoubleLinkedQueueEntryOfE = () => (_DoubleLinkedQueueEntryOfE = dart.constFn(collection._DoubleLinkedQueueEntry$(E)))();
let _DoubleLinkedQueueElementOfE = () => (_DoubleLinkedQueueElementOfE = dart.constFn(collection._DoubleLinkedQueueElement$(E)))();
let IteratorOfE = () => (IteratorOfE = dart.constFn(core.Iterator$(E)))();
let _DoubleLinkedQueueSentinelOfE = () => (_DoubleLinkedQueueSentinelOfE = dart.constFn(collection._DoubleLinkedQueueSentinel$(E)))();
- let _DoubleLinkedQueueEntryOfE = () => (_DoubleLinkedQueueEntryOfE = dart.constFn(collection._DoubleLinkedQueueEntry$(E)))();
class _DoubleLinkedQueueIterator extends core.Object {
new(sentinel) {
this[_sentinel] = sentinel;
- this[_nextEntry] = sentinel[_nextLink];
- this[_current$2] = null;
+ this[_nextEntry] = _DoubleLinkedQueueEntryOfE()._check(sentinel[_nextLink]);
+ this[_current$1] = null;
}
moveNext() {
if (core.identical(this[_nextEntry], this[_sentinel])) {
- this[_current$2] = null;
+ this[_current$1] = null;
this[_nextEntry] = null;
this[_sentinel] = null;
return false;
}
let elementEntry = _DoubleLinkedQueueElementOfE()._check(this[_nextEntry]);
- if (elementEntry[_queue] == null) {
+ if (!core.identical(this[_sentinel][_queue], elementEntry[_queue])) {
dart.throw(new core.ConcurrentModificationError(this[_sentinel][_queue]));
}
- this[_current$2] = elementEntry.element;
- this[_nextEntry] = elementEntry[_nextLink];
+ this[_current$1] = elementEntry[_element];
+ this[_nextEntry] = _DoubleLinkedQueueEntryOfE()._check(elementEntry[_nextLink]);
return true;
}
get current() {
- return this[_current$2];
+ return this[_current$1];
}
}
dart.addTypeTests(_DoubleLinkedQueueIterator);
@@ -26426,7 +26415,7 @@
fields: () => ({
[_sentinel]: _DoubleLinkedQueueSentinelOfE(),
[_nextEntry]: _DoubleLinkedQueueEntryOfE(),
- [_current$2]: E
+ [_current$1]: E
}),
getters: () => ({current: dart.definiteFunctionType(E, [])}),
methods: () => ({moveNext: dart.definiteFunctionType(core.bool, [])})
@@ -26449,7 +26438,7 @@
let QueueOfE = () => (QueueOfE = dart.constFn(collection.Queue$(E)))();
let ETovoid = () => (ETovoid = dart.constFn(dart.functionType(dart.void, [E])))();
let ETobool = () => (ETobool = dart.constFn(dart.functionType(core.bool, [E])))();
- class ListQueue extends core.Iterable$(E) {
+ class ListQueue extends _internal.ListIterable$(E) {
new(initialCapacity) {
if (initialCapacity === void 0) initialCapacity = null;
this[_head] = 0;
@@ -26477,7 +26466,7 @@
return queue;
} else {
let capacity = collection.ListQueue._INITIAL_CAPACITY;
- if (_internal.EfficientLength.is(elements)) {
+ if (_internal.EfficientLengthIterable.is(elements)) {
capacity = elements[dartx.length];
}
let result = new (ListQueueOfE())(capacity);
@@ -26726,7 +26715,6 @@
[_tail]: core.int,
[_modificationCount]: core.int
}),
- getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])}),
methods: () => ({
add: dart.definiteFunctionType(dart.void, [E]),
addAll: dart.definiteFunctionType(dart.void, [IterableOfE()]),
@@ -26779,18 +26767,18 @@
this[_end] = queue[_tail];
this[_modificationCount] = queue[_modificationCount];
this[_position] = queue[_head];
- this[_current$2] = null;
+ this[_current$1] = null;
}
get current() {
- return this[_current$2];
+ return this[_current$1];
}
moveNext() {
this[_queue][_checkModification](this[_modificationCount]);
if (this[_position] == this[_end]) {
- this[_current$2] = null;
+ this[_current$1] = null;
return false;
}
- this[_current$2] = this[_queue][_table][dartx._get](this[_position]);
+ this[_current$1] = this[_queue][_table][dartx._get](this[_position]);
this[_position] = (dart.notNull(this[_position]) + 1 & dart.notNull(this[_queue][_table][dartx.length]) - 1) >>> 0;
return true;
}
@@ -26803,7 +26791,7 @@
[_end]: core.int,
[_modificationCount]: core.int,
[_position]: core.int,
- [_current$2]: E
+ [_current$1]: E
}),
getters: () => ({current: dart.definiteFunctionType(E, [])}),
methods: () => ({moveNext: dart.definiteFunctionType(core.bool, [])})
@@ -26859,7 +26847,7 @@
const _splayMin = Symbol('_splayMin');
const _splayMax = Symbol('_splayMax');
const _addNewRoot = Symbol('_addNewRoot');
-const _clear$ = Symbol('_clear');
+const _clear = Symbol('_clear');
collection._SplayTree$ = dart.generic((K, Node) => {
class _SplayTree extends core.Object {
new() {
@@ -26984,7 +26972,7 @@
this[_root] = this[_splayMax](this[_root]);
return this[_root];
}
- [_clear$]() {
+ [_clear]() {
this[_root] = null;
this[_count$] = 0;
this[_modificationCount] = dart.notNull(this[_modificationCount]) + 1;
@@ -27007,7 +26995,7 @@
[_splayMax]: dart.definiteFunctionType(Node, [Node]),
[_remove]: dart.definiteFunctionType(Node, [K]),
[_addNewRoot]: dart.definiteFunctionType(dart.void, [Node, core.int]),
- [_clear$]: dart.definiteFunctionType(dart.void, [])
+ [_clear]: dart.definiteFunctionType(dart.void, [])
})
});
return _SplayTree;
@@ -27164,7 +27152,7 @@
return this[_count$];
}
clear() {
- this[_clear$]();
+ this[_clear]();
}
containsKey(key) {
return dart.test(dart.dcall(this[_validKey], key)) && this[_splay](K.as(key)) == 0;
@@ -27384,7 +27372,7 @@
let SplayTreeSetOfK = () => (SplayTreeSetOfK = dart.constFn(collection.SplayTreeSet$(K)))();
let _SplayTreeNodeOfK = () => (_SplayTreeNodeOfK = dart.constFn(collection._SplayTreeNode$(K)))();
let _SplayTreeOfK$_SplayTreeNodeOfK = () => (_SplayTreeOfK$_SplayTreeNodeOfK = dart.constFn(collection._SplayTree$(K, _SplayTreeNodeOfK())))();
- class _SplayTreeKeyIterable extends core.Iterable$(K) {
+ class _SplayTreeKeyIterable extends _internal.EfficientLengthIterable$(K) {
new(tree) {
this[_tree] = tree;
super.new();
@@ -27405,7 +27393,6 @@
return set;
}
}
- _SplayTreeKeyIterable[dart.implements] = () => [_internal.EfficientLength];
dart.setSignature(_SplayTreeKeyIterable, {
fields: () => ({[_tree]: _SplayTreeOfK$_SplayTreeNodeOfK()}),
getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(K), [])})
@@ -27417,7 +27404,7 @@
collection._SplayTreeValueIterable$ = dart.generic((K, V) => {
let _SplayTreeValueIteratorOfK$V = () => (_SplayTreeValueIteratorOfK$V = dart.constFn(collection._SplayTreeValueIterator$(K, V)))();
let SplayTreeMapOfK$V = () => (SplayTreeMapOfK$V = dart.constFn(collection.SplayTreeMap$(K, V)))();
- class _SplayTreeValueIterable extends core.Iterable$(V) {
+ class _SplayTreeValueIterable extends _internal.EfficientLengthIterable$(V) {
new(map) {
this[_map$0] = map;
super.new();
@@ -27432,7 +27419,6 @@
return new (_SplayTreeValueIteratorOfK$V())(this[_map$0]);
}
}
- _SplayTreeValueIterable[dart.implements] = () => [_internal.EfficientLength];
dart.setSignature(_SplayTreeValueIterable, {
fields: () => ({[_map$0]: SplayTreeMapOfK$V()}),
getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(V), [])})
@@ -27648,7 +27634,7 @@
return _;
}
clear() {
- this[_clear$]();
+ this[_clear]();
}
toSet() {
return this[_clone]();
@@ -28185,7 +28171,7 @@
core.List$ = dart.generic(E => {
let JSArrayOfE = () => (JSArrayOfE = dart.constFn(_interceptors.JSArray$(E)))();
let ListOfE = () => (ListOfE = dart.constFn(core.List$(E)))();
- let IterableOfE = () => (IterableOfE = dart.constFn(core.Iterable$(E)))();
+ let EfficientLengthIterableOfE = () => (EfficientLengthIterableOfE = dart.constFn(_internal.EfficientLengthIterable$(E)))();
class List extends core.Object {
static new(length) {
if (length === void 0) length = null;
@@ -28236,12 +28222,9 @@
let result = ListOfE().from(elements, {growable: false});
return _internal.makeFixedListUnmodifiable(E)(result);
}
- [Symbol.iterator]() {
- return new dart.JsIterator(this[dartx.iterator]);
- }
}
dart.addTypeTests(List);
- List[dart.implements] = () => [IterableOfE(), _internal.EfficientLength];
+ List[dart.implements] = () => [EfficientLengthIterableOfE()];
return List;
});
core.List = List();
@@ -28380,6 +28363,7 @@
}
};
dart.addSimpleTypeTests(convert._UnicodeSubsetEncoder);
+convert._UnicodeSubsetEncoder[dart.implements] = () => [ChunkedConverterOfString$ListOfint$String$ListOfint()];
dart.setSignature(convert._UnicodeSubsetEncoder, {
fields: () => ({[_subsetMask]: core.int}),
methods: () => ({
@@ -28462,6 +28446,7 @@
}
};
dart.addSimpleTypeTests(convert._UnicodeSubsetDecoder);
+convert._UnicodeSubsetDecoder[dart.implements] = () => [ChunkedConverterOfListOfint$String$ListOfint$String()];
dart.setSignature(convert._UnicodeSubsetDecoder, {
fields: () => ({
[_allowInvalid]: core.bool,
@@ -28626,6 +28611,7 @@
};
dart.addSimpleTypeTests(convert.Base64Encoder);
dart.defineNamedConstructor(convert.Base64Encoder, 'urlSafe');
+convert.Base64Encoder[dart.implements] = () => [ChunkedConverterOfListOfint$String$ListOfint$String()];
dart.setSignature(convert.Base64Encoder, {
fields: () => ({[_urlSafe]: core.bool}),
methods: () => ({
@@ -28652,6 +28638,104 @@
get decoder() {
return const$33 || (const$33 = dart.const(new convert.Base64Decoder()));
}
+ normalize(source, start, end) {
+ if (start === void 0) start = 0;
+ if (end === void 0) end = null;
+ end = core.RangeError.checkValidRange(start, end, source[dartx.length]);
+ let percent = 37;
+ let equals = 61;
+ let buffer = null;
+ let sliceStart = start;
+ let alphabet = convert._Base64Encoder._base64Alphabet;
+ let inverseAlphabet = convert._Base64Decoder._inverseAlphabet;
+ let firstPadding = -1;
+ let firstPaddingSourceIndex = -1;
+ let paddingCount = 0;
+ for (let i = start; dart.notNull(i) < dart.notNull(end);) {
+ let sliceEnd = i;
+ let char = source[dartx.codeUnitAt]((() => {
+ let x = i;
+ i = dart.notNull(x) + 1;
+ return x;
+ })());
+ let originalChar = char;
+ if (char == percent) {
+ if (dart.notNull(i) + 2 <= dart.notNull(end)) {
+ char = _internal.parseHexByte(source, i);
+ i = dart.notNull(i) + 2;
+ if (char == percent) char = -1;
+ } else {
+ char = -1;
+ }
+ }
+ if (0 <= dart.notNull(char) && dart.notNull(char) <= 127) {
+ let value = inverseAlphabet[dartx._get](char);
+ if (dart.notNull(value) >= 0) {
+ char = alphabet[dartx.codeUnitAt](value);
+ if (char == originalChar) continue;
+ } else if (value == convert._Base64Decoder._padding) {
+ if (dart.notNull(firstPadding) < 0) {
+ firstPadding = (() => {
+ let l = dart.nullSafe(buffer, _ => _.length);
+ return l != null ? l : 0;
+ })() + (dart.notNull(sliceEnd) - dart.notNull(sliceStart));
+ firstPaddingSourceIndex = sliceEnd;
+ }
+ paddingCount = dart.notNull(paddingCount) + 1;
+ if (originalChar == equals) continue;
+ }
+ if (value != convert._Base64Decoder._invalid) {
+ let t = buffer;
+ t == null ? buffer = new core.StringBuffer() : t;
+ buffer.write(source[dartx.substring](sliceStart, sliceEnd));
+ buffer.writeCharCode(char);
+ sliceStart = i;
+ continue;
+ }
+ }
+ dart.throw(new core.FormatException("Invalid base64 data", source, sliceEnd));
+ }
+ if (buffer != null) {
+ buffer.write(source[dartx.substring](sliceStart, end));
+ if (dart.notNull(firstPadding) >= 0) {
+ convert.Base64Codec._checkPadding(source, firstPaddingSourceIndex, end, firstPadding, paddingCount, buffer.length);
+ } else {
+ let endLength = (dart.notNull(buffer.length) - 1)[dartx['%']](4) + 1;
+ if (endLength == 1) {
+ dart.throw(new core.FormatException("Invalid base64 encoding length ", source, end));
+ }
+ while (dart.notNull(endLength) < 4) {
+ buffer.write("=");
+ endLength = dart.notNull(endLength) + 1;
+ }
+ }
+ return source[dartx.replaceRange](start, end, dart.toString(buffer));
+ }
+ let length = dart.notNull(end) - dart.notNull(start);
+ if (dart.notNull(firstPadding) >= 0) {
+ convert.Base64Codec._checkPadding(source, firstPaddingSourceIndex, end, firstPadding, paddingCount, length);
+ } else {
+ let endLength = length[dartx['%']](4);
+ if (endLength == 1) {
+ dart.throw(new core.FormatException("Invalid base64 encoding length ", source, end));
+ }
+ if (dart.notNull(endLength) > 1) {
+ source = source[dartx.replaceRange](end, end, endLength == 2 ? "==" : "=");
+ }
+ }
+ return source;
+ }
+ static _checkPadding(source, sourceIndex, sourceEnd, firstPadding, paddingCount, length) {
+ if (length[dartx['%']](4) != 0) {
+ dart.throw(new core.FormatException("Invalid base64 padding, padded length must be multiple of four, " + dart.str`is ${length}`, source, sourceEnd));
+ }
+ if (dart.notNull(firstPadding) + dart.notNull(paddingCount) != length) {
+ dart.throw(new core.FormatException("Invalid base64 padding, '=' not at the end", source, sourceIndex));
+ }
+ if (dart.notNull(paddingCount) > 2) {
+ dart.throw(new core.FormatException("Invalid base64 padding, more than two '=' characters", source, sourceIndex));
+ }
+ }
};
dart.addSimpleTypeTests(convert.Base64Codec);
dart.defineNamedConstructor(convert.Base64Codec, 'urlSafe');
@@ -28660,7 +28744,10 @@
getters: () => ({
encoder: dart.definiteFunctionType(convert.Base64Encoder, []),
decoder: dart.definiteFunctionType(convert.Base64Decoder, [])
- })
+ }),
+ methods: () => ({normalize: dart.definiteFunctionType(core.String, [core.String], [core.int, core.int])}),
+ statics: () => ({_checkPadding: dart.definiteFunctionType(core.int, [core.String, core.int, core.int, core.int, core.int, core.int])}),
+ names: ['_checkPadding']
});
convert.BASE64 = dart.const(new convert.Base64Codec());
convert.BASE64URL = dart.const(new convert.Base64Codec.urlSafe());
@@ -28924,6 +29011,7 @@
}
};
dart.addSimpleTypeTests(convert.Base64Decoder);
+convert.Base64Decoder[dart.implements] = () => [ChunkedConverterOfString$ListOfint$String$ListOfint()];
dart.setSignature(convert.Base64Decoder, {
methods: () => ({
convert: dart.definiteFunctionType(core.List$(core.int), [core.String], [core.int, core.int]),
@@ -29452,6 +29540,7 @@
});
convert._InvertedCodec = _InvertedCodec();
convert._FusedConverter$ = dart.generic((S, M, T) => {
+ let ChunkedConverterOfS$T$S$T = () => (ChunkedConverterOfS$T$S$T = dart.constFn(convert.ChunkedConverter$(S, T, S, T)))();
let ConverterOfS$M = () => (ConverterOfS$M = dart.constFn(convert.Converter$(S, M)))();
let ConverterOfM$T = () => (ConverterOfM$T = dart.constFn(convert.Converter$(M, T)))();
let SinkOfT = () => (SinkOfT = dart.constFn(core.Sink$(T)))();
@@ -29470,6 +29559,7 @@
return this[_first$0].startChunkedConversion(this[_second].startChunkedConversion(sink));
}
}
+ _FusedConverter[dart.implements] = () => [ChunkedConverterOfS$T$S$T()];
dart.setSignature(_FusedConverter, {
fields: () => ({
[_first$0]: ConverterOfS$M(),
@@ -29604,6 +29694,7 @@
}
};
dart.addSimpleTypeTests(convert.HtmlEscape);
+convert.HtmlEscape[dart.implements] = () => [ChunkedConverterOfString$String$String$String()];
dart.setSignature(convert.HtmlEscape, {
fields: () => ({mode: convert.HtmlEscapeMode}),
methods: () => ({
@@ -29763,6 +29854,7 @@
};
dart.addSimpleTypeTests(convert.JsonEncoder);
dart.defineNamedConstructor(convert.JsonEncoder, 'withIndent');
+convert.JsonEncoder[dart.implements] = () => [ChunkedConverterOfObject$String$Object$String()];
dart.setSignature(convert.JsonEncoder, {
fields: () => ({
indent: core.String,
@@ -29835,6 +29927,7 @@
}
};
dart.addSimpleTypeTests(convert.JsonUtf8Encoder);
+convert.JsonUtf8Encoder[dart.implements] = () => [ChunkedConverterOfObject$ListOfint$Object$ListOfint()];
dart.setSignature(convert.JsonUtf8Encoder, {
fields: () => ({
[_indent]: ListOfint(),
@@ -29942,6 +30035,7 @@
}
};
dart.addSimpleTypeTests(convert.JsonDecoder);
+convert.JsonDecoder[dart.implements] = () => [ChunkedConverterOfString$Object$String$Object()];
dart.setSignature(convert.JsonDecoder, {
fields: () => ({[_reviver]: convert._Reviver}),
methods: () => ({
@@ -31070,6 +31164,7 @@
}
};
dart.addSimpleTypeTests(convert.Utf8Encoder);
+convert.Utf8Encoder[dart.implements] = () => [ChunkedConverterOfString$ListOfint$String$ListOfint()];
dart.setSignature(convert.Utf8Encoder, {
methods: () => ({
convert: dart.definiteFunctionType(core.List$(core.int), [core.String], [core.int, core.int]),
@@ -31282,7 +31377,7 @@
let buffer = new core.StringBuffer();
let decoder = new convert._Utf8Decoder(buffer, this[_allowMalformed]);
decoder.convert(codeUnits, start, end);
- decoder.close();
+ decoder.flush(codeUnits, end);
return buffer.toString();
}
startChunkedConversion(sink) {
@@ -31307,6 +31402,7 @@
}
};
dart.addSimpleTypeTests(convert.Utf8Decoder);
+convert.Utf8Decoder[dart.implements] = () => [ChunkedConverterOfListOfint$String$ListOfint$String()];
dart.setSignature(convert.Utf8Decoder, {
fields: () => ({[_allowMalformed]: core.bool}),
methods: () => ({
@@ -31356,10 +31452,12 @@
close() {
this.flush();
}
- flush() {
+ flush(source, offset) {
+ if (source === void 0) source = null;
+ if (offset === void 0) offset = null;
if (dart.test(this.hasPartialInput)) {
if (!dart.test(this[_allowMalformed])) {
- dart.throw(new core.FormatException("Unfinished UTF-8 octet sequence"));
+ dart.throw(new core.FormatException("Unfinished UTF-8 octet sequence", source, offset));
}
this[_stringSink].writeCharCode(convert.UNICODE_REPLACEMENT_CHARACTER_RUNE);
this[_value] = 0;
@@ -31403,7 +31501,7 @@
if ((dart.notNull(unit) & 192) != 128) {
expectedUnits = 0;
if (!dart.test(this[_allowMalformed])) {
- dart.throw(new core.FormatException(dart.str`Bad UTF-8 encoding 0x${unit[dartx.toRadixString](16)}`));
+ dart.throw(new core.FormatException(dart.str`Bad UTF-8 encoding 0x${unit[dartx.toRadixString](16)}`, codeUnits, i));
}
this[_isFirstCharacter] = false;
this[_stringSink].writeCharCode(convert.UNICODE_REPLACEMENT_CHARACTER_RUNE);
@@ -31416,14 +31514,14 @@
} while (dart.notNull(expectedUnits) > 0);
if (dart.notNull(value) <= dart.notNull(convert._Utf8Decoder._LIMITS[dartx._get](dart.notNull(extraUnits) - 1))) {
if (!dart.test(this[_allowMalformed])) {
- dart.throw(new core.FormatException(dart.str`Overlong encoding of 0x${value[dartx.toRadixString](16)}`));
+ dart.throw(new core.FormatException(dart.str`Overlong encoding of 0x${value[dartx.toRadixString](16)}`, codeUnits, dart.notNull(i) - dart.notNull(extraUnits) - 1));
}
expectedUnits = extraUnits = 0;
value = convert.UNICODE_REPLACEMENT_CHARACTER_RUNE;
}
if (dart.notNull(value) > convert._FOUR_BYTE_LIMIT) {
if (!dart.test(this[_allowMalformed])) {
- dart.throw(new core.FormatException("Character outside valid Unicode range: " + dart.str`0x${value[dartx.toRadixString](16)}`));
+ dart.throw(new core.FormatException("Character outside valid Unicode range: " + dart.str`0x${value[dartx.toRadixString](16)}`, codeUnits, dart.notNull(i) - dart.notNull(extraUnits) - 1));
}
value = convert.UNICODE_REPLACEMENT_CHARACTER_RUNE;
}
@@ -31447,7 +31545,7 @@
})());
if (dart.notNull(unit) < 0) {
if (!dart.test(this[_allowMalformed])) {
- dart.throw(new core.FormatException(dart.str`Negative UTF-8 code unit: -0x${(-dart.notNull(unit))[dartx.toRadixString](16)}`));
+ dart.throw(new core.FormatException(dart.str`Negative UTF-8 code unit: -0x${(-dart.notNull(unit))[dartx.toRadixString](16)}`, codeUnits, dart.notNull(i) - 1));
}
this[_stringSink].writeCharCode(convert.UNICODE_REPLACEMENT_CHARACTER_RUNE);
} else {
@@ -31468,7 +31566,7 @@
continue loop;
}
if (!dart.test(this[_allowMalformed])) {
- dart.throw(new core.FormatException(dart.str`Bad UTF-8 encoding 0x${unit[dartx.toRadixString](16)}`));
+ dart.throw(new core.FormatException(dart.str`Bad UTF-8 encoding 0x${unit[dartx.toRadixString](16)}`, codeUnits, dart.notNull(i) - 1));
}
value = convert.UNICODE_REPLACEMENT_CHARACTER_RUNE;
expectedUnits = extraUnits = 0;
@@ -31497,7 +31595,7 @@
getters: () => ({hasPartialInput: dart.definiteFunctionType(core.bool, [])}),
methods: () => ({
close: dart.definiteFunctionType(dart.void, []),
- flush: dart.definiteFunctionType(dart.void, []),
+ flush: dart.definiteFunctionType(dart.void, [], [ListOfint(), core.int]),
convert: dart.definiteFunctionType(dart.void, [ListOfint(), core.int, core.int])
})
});
@@ -31534,6 +31632,7 @@
};
core.proxy = dart.const(new core._Proxy());
dart.defineExtensionNames([
+ 'hashCode',
'toString'
]);
core.bool = class bool extends core.Object {
@@ -31541,6 +31640,9 @@
let defaultValue = opts && 'defaultValue' in opts ? opts.defaultValue : false;
dart.throw(new core.UnsupportedError('bool.fromEnvironment can only be used as a const constructor'));
}
+ get [dartx.hashCode]() {
+ return super.hashCode;
+ }
[dartx.toString]() {
return this ? "true" : "false";
}
@@ -32677,108 +32779,42 @@
return _Generator;
});
core._Generator = _Generator();
-const _end$ = Symbol('_end');
-const _start$0 = Symbol('_start');
const _generator$ = Symbol('_generator');
core._GeneratorIterable$ = dart.generic(E => {
let _GeneratorOfE = () => (_GeneratorOfE = dart.constFn(core._Generator$(E)))();
- let _GeneratorIteratorOfE = () => (_GeneratorIteratorOfE = dart.constFn(core._GeneratorIterator$(E)))();
- let EmptyIterableOfE = () => (EmptyIterableOfE = dart.constFn(_internal.EmptyIterable$(E)))();
- let _GeneratorIterableOfE = () => (_GeneratorIterableOfE = dart.constFn(core._GeneratorIterable$(E)))();
- class _GeneratorIterable extends core.Iterable$(E) {
- new(end, generator) {
- this[_end$] = end;
- this[_start$0] = 0;
+ class _GeneratorIterable extends _internal.ListIterable$(E) {
+ get length() {
+ return this[length$];
+ }
+ set length(value) {
+ super.length = value;
+ }
+ new(length, generator) {
+ this[length$] = length;
this[_generator$] = generator != null ? generator : _GeneratorOfE().as(core._GeneratorIterable._id);
super.new();
}
- slice(start, end, generator) {
- this[_start$0] = start;
- this[_end$] = end;
- this[_generator$] = generator;
- super.new();
- }
- get iterator() {
- return new (_GeneratorIteratorOfE())(this[_start$0], this[_end$], this[_generator$]);
- }
- get length() {
- return dart.notNull(this[_end$]) - dart.notNull(this[_start$0]);
- }
- skip(count) {
- core.RangeError.checkNotNegative(count, "count");
- if (count == 0) return this;
- let newStart = dart.notNull(this[_start$0]) + dart.notNull(count);
- if (newStart >= dart.notNull(this[_end$])) return new (EmptyIterableOfE())();
- return new (_GeneratorIterableOfE()).slice(newStart, this[_end$], this[_generator$]);
- }
- take(count) {
- core.RangeError.checkNotNegative(count, "count");
- if (count == 0) return new (EmptyIterableOfE())();
- let newEnd = dart.notNull(this[_start$0]) + dart.notNull(count);
- if (newEnd >= dart.notNull(this[_end$])) return this;
- return new (_GeneratorIterableOfE()).slice(this[_start$0], newEnd, this[_generator$]);
+ elementAt(index) {
+ core.RangeError.checkValidIndex(index, this);
+ return this[_generator$](index);
}
static _id(n) {
return n;
}
}
- dart.defineNamedConstructor(_GeneratorIterable, 'slice');
- _GeneratorIterable[dart.implements] = () => [_internal.EfficientLength];
+ const length$ = Symbol("_GeneratorIterable.length");
dart.setSignature(_GeneratorIterable, {
fields: () => ({
- [_start$0]: core.int,
- [_end$]: core.int,
+ length: core.int,
[_generator$]: _GeneratorOfE()
}),
- getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])}),
statics: () => ({_id: dart.definiteFunctionType(core.int, [core.int])}),
names: ['_id']
});
- dart.defineExtensionMembers(_GeneratorIterable, ['skip', 'take', 'iterator', 'length']);
+ dart.defineExtensionMembers(_GeneratorIterable, ['elementAt', 'length']);
return _GeneratorIterable;
});
core._GeneratorIterable = _GeneratorIterable();
-const _index$1 = Symbol('_index');
-const _current$3 = Symbol('_current');
-core._GeneratorIterator$ = dart.generic(E => {
- let IteratorOfE = () => (IteratorOfE = dart.constFn(core.Iterator$(E)))();
- let _GeneratorOfE = () => (_GeneratorOfE = dart.constFn(core._Generator$(E)))();
- class _GeneratorIterator extends core.Object {
- new(index, end, generator) {
- this[_index$1] = index;
- this[_end$] = end;
- this[_generator$] = generator;
- this[_current$3] = null;
- }
- moveNext() {
- if (dart.notNull(this[_index$1]) < dart.notNull(this[_end$])) {
- this[_current$3] = this[_generator$](this[_index$1]);
- this[_index$1] = dart.notNull(this[_index$1]) + 1;
- return true;
- } else {
- this[_current$3] = null;
- return false;
- }
- }
- get current() {
- return this[_current$3];
- }
- }
- dart.addTypeTests(_GeneratorIterator);
- _GeneratorIterator[dart.implements] = () => [IteratorOfE()];
- dart.setSignature(_GeneratorIterator, {
- fields: () => ({
- [_end$]: core.int,
- [_generator$]: _GeneratorOfE(),
- [_index$1]: core.int,
- [_current$3]: E
- }),
- getters: () => ({current: dart.definiteFunctionType(E, [])}),
- methods: () => ({moveNext: dart.definiteFunctionType(core.bool, [])})
- });
- return _GeneratorIterator;
-});
-core._GeneratorIterator = _GeneratorIterator();
core.BidirectionalIterator$ = dart.generic(E => {
let IteratorOfE = () => (IteratorOfE = dart.constFn(core.Iterator$(E)))();
class BidirectionalIterator extends core.Object {}
@@ -32820,6 +32856,9 @@
static _uninstantiable() {
dart.throw(new core.UnsupportedError('class Null cannot be instantiated'));
}
+ get hashCode() {
+ return super.hashCode;
+ }
toString() {
return "null";
}
@@ -32855,7 +32894,7 @@
core.RegExp[dart.implements] = () => [core.Pattern];
core.Set$ = dart.generic(E => {
let LinkedHashSetOfE = () => (LinkedHashSetOfE = dart.constFn(collection.LinkedHashSet$(E)))();
- class Set extends core.Iterable$(E) {
+ class Set extends _internal.EfficientLengthIterable$(E) {
static new() {
return LinkedHashSetOfE().new();
}
@@ -32866,7 +32905,6 @@
return LinkedHashSetOfE().from(elements);
}
}
- Set[dart.implements] = () => [_internal.EfficientLength];
return Set;
});
core.Set = Set();
@@ -32899,41 +32937,38 @@
dart.setSignature(core._StringStackTrace, {
fields: () => ({[_stackTrace]: core.String})
});
+const _start$0 = Symbol('_start');
const _stop = Symbol('_stop');
core.Stopwatch = class Stopwatch extends core.Object {
+ new() {
+ this[_start$0] = 0;
+ this[_stop] = 0;
+ if (core.Stopwatch._frequency == null) core.Stopwatch._initTicker();
+ }
get frequency() {
return core.Stopwatch._frequency;
}
- new() {
- this[_start$0] = null;
- this[_stop] = null;
- core.Stopwatch._initTicker();
- }
start() {
- if (dart.test(this.isRunning)) return;
- if (this[_start$0] == null) {
- this[_start$0] = core.Stopwatch._now();
- } else {
- this[_start$0] = dart.notNull(core.Stopwatch._now()) - (dart.notNull(this[_stop]) - dart.notNull(this[_start$0]));
+ if (this[_stop] != null) {
+ this[_start$0] = dart.notNull(this[_start$0]) + (dart.notNull(core.Stopwatch._now()) - dart.notNull(this[_stop]));
this[_stop] = null;
}
}
stop() {
- if (!dart.test(this.isRunning)) return;
- this[_stop] = core.Stopwatch._now();
+ let t = this[_stop];
+ t == null ? this[_stop] = core.Stopwatch._now() : t;
}
reset() {
- if (this[_start$0] == null) return;
- this[_start$0] = core.Stopwatch._now();
- if (this[_stop] != null) {
- this[_stop] = this[_start$0];
- }
+ this[_start$0] = (() => {
+ let l = this[_stop];
+ return l != null ? l : core.Stopwatch._now();
+ })();
}
get elapsedTicks() {
- if (this[_start$0] == null) {
- return 0;
- }
- return this[_stop] == null ? dart.notNull(core.Stopwatch._now()) - dart.notNull(this[_start$0]) : dart.notNull(this[_stop]) - dart.notNull(this[_start$0]);
+ return dart.notNull((() => {
+ let l = this[_stop];
+ return l != null ? l : core.Stopwatch._now();
+ })()) - dart.notNull(this[_start$0]);
}
get elapsed() {
return new core.Duration({microseconds: this.elapsedMicroseconds});
@@ -32945,7 +32980,7 @@
return (dart.notNull(this.elapsedTicks) * 1000 / dart.notNull(this.frequency))[dartx.truncate]();
}
get isRunning() {
- return this[_start$0] != null && this[_stop] == null;
+ return this[_stop] == null;
}
static _initTicker() {
_js_helper.Primitives.initTicker();
@@ -33221,37 +33256,471 @@
return new _internal.Symbol(name);
}
};
+core._SPACE = 32;
+core._PERCENT = 37;
+core._AMPERSAND = 38;
+core._PLUS = 43;
+core._DOT = 46;
+core._SLASH = 47;
+core._COLON = 58;
+core._EQUALS = 61;
+core._UPPER_CASE_A = 65;
+core._UPPER_CASE_Z = 90;
+core._LEFT_BRACKET = 91;
+core._BACKSLASH = 92;
+core._RIGHT_BRACKET = 93;
+core._LOWER_CASE_A = 97;
+core._LOWER_CASE_F = 102;
+core._LOWER_CASE_Z = 122;
+core._hexDigits = "0123456789ABCDEF";
+core.Uri = class Uri extends core.Object {
+ static get base() {
+ let uri = _js_helper.Primitives.currentUri();
+ if (uri != null) return core.Uri.parse(uri);
+ dart.throw(new core.UnsupportedError("'Uri.base' is not supported"));
+ }
+ static new(opts) {
+ return core._Uri.new(opts);
+ }
+ static http(authority, unencodedPath, queryParameters) {
+ return core._Uri.http(authority, unencodedPath, queryParameters);
+ }
+ static https(authority, unencodedPath, queryParameters) {
+ return core._Uri.https(authority, unencodedPath, queryParameters);
+ }
+ static file(path, opts) {
+ return core._Uri.file(path, opts);
+ }
+ static directory(path, opts) {
+ return core._Uri.directory(path, opts);
+ }
+ static dataFromString(content, opts) {
+ let mimeType = opts && 'mimeType' in opts ? opts.mimeType : null;
+ let encoding = opts && 'encoding' in opts ? opts.encoding : null;
+ let parameters = opts && 'parameters' in opts ? opts.parameters : null;
+ let base64 = opts && 'base64' in opts ? opts.base64 : false;
+ let data = core.UriData.fromString(content, {mimeType: mimeType, encoding: encoding, parameters: parameters, base64: base64});
+ return data.uri;
+ }
+ static dataFromBytes(bytes, opts) {
+ let mimeType = opts && 'mimeType' in opts ? opts.mimeType : "application/octet-stream";
+ let parameters = opts && 'parameters' in opts ? opts.parameters : null;
+ let percentEncoded = opts && 'percentEncoded' in opts ? opts.percentEncoded : false;
+ let data = core.UriData.fromBytes(bytes, {mimeType: mimeType, parameters: parameters, percentEncoded: percentEncoded});
+ return data.uri;
+ }
+ get hasScheme() {
+ return this.scheme[dartx.isNotEmpty];
+ }
+ static parse(uri, start, end) {
+ if (start === void 0) start = 0;
+ if (end === void 0) end = null;
+ let t = end;
+ t == null ? end = uri[dartx.length] : t;
+ if (dart.notNull(end) >= dart.notNull(start) + 5) {
+ let dataDelta = core._startsWithData(uri, start);
+ if (dataDelta == 0) {
+ if (dart.notNull(start) > 0 || dart.notNull(end) < dart.notNull(uri[dartx.length])) uri = uri[dartx.substring](start, end);
+ return core.UriData._parse(uri, 5, null).uri;
+ } else if (dataDelta == 32) {
+ return core.UriData._parse(uri[dartx.substring](dart.notNull(start) + 5, end), 0, null).uri;
+ }
+ }
+ let indices = ListOfint().new(8);
+ indices[dartx._set](0, 0);
+ indices[dartx._set](core._schemeEndIndex, dart.notNull(start) - 1);
+ indices[dartx._set](core._hostStartIndex, dart.notNull(start) - 1);
+ indices[dartx._set](core._notSimpleIndex, dart.notNull(start) - 1);
+ indices[dartx._set](core._portStartIndex, start);
+ indices[dartx._set](core._pathStartIndex, start);
+ indices[dartx._set](core._queryStartIndex, end);
+ indices[dartx._set](core._fragmentStartIndex, end);
+ let state = core._scan(uri, start, end, core._uriStart, indices);
+ if (dart.notNull(state) >= core._nonSimpleEndStates) {
+ indices[dartx._set](core._notSimpleIndex, end);
+ }
+ let schemeEnd = indices[dartx._get](core._schemeEndIndex);
+ if (dart.notNull(schemeEnd) >= dart.notNull(start)) {
+ state = core._scan(uri, start, schemeEnd, core._schemeStart, indices);
+ if (state == core._schemeStart) {
+ indices[dartx._set](core._notSimpleIndex, schemeEnd);
+ }
+ }
+ let hostStart = dart.notNull(indices[dartx._get](core._hostStartIndex)) + 1;
+ let portStart = indices[dartx._get](core._portStartIndex);
+ let pathStart = indices[dartx._get](core._pathStartIndex);
+ let queryStart = indices[dartx._get](core._queryStartIndex);
+ let fragmentStart = indices[dartx._get](core._fragmentStartIndex);
+ let scheme = null;
+ if (dart.notNull(fragmentStart) < dart.notNull(queryStart)) queryStart = fragmentStart;
+ if (dart.notNull(pathStart) < dart.notNull(hostStart) || dart.notNull(pathStart) <= dart.notNull(schemeEnd)) {
+ pathStart = queryStart;
+ }
+ if (dart.notNull(portStart) < dart.notNull(hostStart)) portStart = pathStart;
+ dart.assert(hostStart == start || dart.notNull(schemeEnd) <= dart.notNull(hostStart));
+ dart.assert(dart.notNull(hostStart) <= dart.notNull(portStart));
+ dart.assert(dart.notNull(schemeEnd) <= dart.notNull(pathStart));
+ dart.assert(dart.notNull(portStart) <= dart.notNull(pathStart));
+ dart.assert(dart.notNull(pathStart) <= dart.notNull(queryStart));
+ dart.assert(dart.notNull(queryStart) <= dart.notNull(fragmentStart));
+ let isSimple = dart.notNull(indices[dartx._get](core._notSimpleIndex)) < dart.notNull(start);
+ if (isSimple) {
+ if (dart.notNull(hostStart) > dart.notNull(schemeEnd) + 3) {
+ isSimple = false;
+ } else if (dart.notNull(portStart) > dart.notNull(start) && dart.notNull(portStart) + 1 == pathStart) {
+ isSimple = false;
+ } else if (dart.notNull(queryStart) < dart.notNull(end) && queryStart == dart.notNull(pathStart) + 2 && dart.test(uri[dartx.startsWith]("..", pathStart)) || dart.notNull(queryStart) > dart.notNull(pathStart) + 2 && dart.test(uri[dartx.startsWith]("/..", dart.notNull(queryStart) - 3))) {
+ isSimple = false;
+ } else {
+ if (schemeEnd == dart.notNull(start) + 4) {
+ if (dart.test(uri[dartx.startsWith]("file", start))) {
+ scheme = "file";
+ if (dart.notNull(hostStart) <= dart.notNull(start)) {
+ let schemeAuth = "file://";
+ let delta = 2;
+ if (!dart.test(uri[dartx.startsWith]("/", pathStart))) {
+ schemeAuth = "file:///";
+ delta = 3;
+ }
+ uri = schemeAuth + dart.notNull(uri[dartx.substring](pathStart, end));
+ schemeEnd = dart.notNull(schemeEnd) - dart.notNull(start);
+ hostStart = 7;
+ portStart = 7;
+ pathStart = 7;
+ queryStart = dart.notNull(queryStart) + (delta - dart.notNull(start));
+ fragmentStart = dart.notNull(fragmentStart) + (delta - dart.notNull(start));
+ start = 0;
+ end = uri[dartx.length];
+ } else if (pathStart == queryStart) {
+ if (start == 0 && end == uri[dartx.length]) {
+ uri = uri[dartx.replaceRange](pathStart, queryStart, "/");
+ queryStart = dart.notNull(queryStart) + 1;
+ fragmentStart = dart.notNull(fragmentStart) + 1;
+ end = dart.notNull(end) + 1;
+ } else {
+ uri = dart.str`${uri[dartx.substring](start, pathStart)}/` + dart.str`${uri[dartx.substring](queryStart, end)}`;
+ schemeEnd = dart.notNull(schemeEnd) - dart.notNull(start);
+ hostStart = dart.notNull(hostStart) - dart.notNull(start);
+ portStart = dart.notNull(portStart) - dart.notNull(start);
+ pathStart = dart.notNull(pathStart) - dart.notNull(start);
+ queryStart = dart.notNull(queryStart) + (1 - dart.notNull(start));
+ fragmentStart = dart.notNull(fragmentStart) + (1 - dart.notNull(start));
+ start = 0;
+ end = uri[dartx.length];
+ }
+ }
+ } else if (dart.test(uri[dartx.startsWith]("http", start))) {
+ scheme = "http";
+ if (dart.notNull(portStart) > dart.notNull(start) && dart.notNull(portStart) + 3 == pathStart && dart.test(uri[dartx.startsWith]("80", dart.notNull(portStart) + 1))) {
+ if (start == 0 && end == uri[dartx.length]) {
+ uri = uri[dartx.replaceRange](portStart, pathStart, "");
+ pathStart = dart.notNull(pathStart) - 3;
+ queryStart = dart.notNull(queryStart) - 3;
+ fragmentStart = dart.notNull(fragmentStart) - 3;
+ end = dart.notNull(end) - 3;
+ } else {
+ uri = dart.notNull(uri[dartx.substring](start, portStart)) + dart.notNull(uri[dartx.substring](pathStart, end));
+ schemeEnd = dart.notNull(schemeEnd) - dart.notNull(start);
+ hostStart = dart.notNull(hostStart) - dart.notNull(start);
+ portStart = dart.notNull(portStart) - dart.notNull(start);
+ pathStart = dart.notNull(pathStart) - (3 + dart.notNull(start));
+ queryStart = dart.notNull(queryStart) - (3 + dart.notNull(start));
+ fragmentStart = dart.notNull(fragmentStart) - (3 + dart.notNull(start));
+ start = 0;
+ end = uri[dartx.length];
+ }
+ }
+ }
+ } else if (schemeEnd == dart.notNull(start) + 5 && dart.test(uri[dartx.startsWith]("https", start))) {
+ scheme = "https";
+ if (dart.notNull(portStart) > dart.notNull(start) && dart.notNull(portStart) + 4 == pathStart && dart.test(uri[dartx.startsWith]("443", dart.notNull(portStart) + 1))) {
+ if (start == 0 && end == uri[dartx.length]) {
+ uri = uri[dartx.replaceRange](portStart, pathStart, "");
+ pathStart = dart.notNull(pathStart) - 4;
+ queryStart = dart.notNull(queryStart) - 4;
+ fragmentStart = dart.notNull(fragmentStart) - 4;
+ end = dart.notNull(end) - 3;
+ } else {
+ uri = dart.notNull(uri[dartx.substring](start, portStart)) + dart.notNull(uri[dartx.substring](pathStart, end));
+ schemeEnd = dart.notNull(schemeEnd) - dart.notNull(start);
+ hostStart = dart.notNull(hostStart) - dart.notNull(start);
+ portStart = dart.notNull(portStart) - dart.notNull(start);
+ pathStart = dart.notNull(pathStart) - (4 + dart.notNull(start));
+ queryStart = dart.notNull(queryStart) - (4 + dart.notNull(start));
+ fragmentStart = dart.notNull(fragmentStart) - (4 + dart.notNull(start));
+ start = 0;
+ end = uri[dartx.length];
+ }
+ }
+ }
+ }
+ }
+ if (isSimple) {
+ if (dart.notNull(start) > 0 || dart.notNull(end) < dart.notNull(uri[dartx.length])) {
+ uri = uri[dartx.substring](start, end);
+ schemeEnd = dart.notNull(schemeEnd) - dart.notNull(start);
+ hostStart = dart.notNull(hostStart) - dart.notNull(start);
+ portStart = dart.notNull(portStart) - dart.notNull(start);
+ pathStart = dart.notNull(pathStart) - dart.notNull(start);
+ queryStart = dart.notNull(queryStart) - dart.notNull(start);
+ fragmentStart = dart.notNull(fragmentStart) - dart.notNull(start);
+ }
+ return new core._SimpleUri(uri, schemeEnd, hostStart, portStart, pathStart, queryStart, fragmentStart, scheme);
+ }
+ return core._Uri.notSimple(uri, start, end, schemeEnd, hostStart, portStart, pathStart, queryStart, fragmentStart, scheme);
+ }
+ static encodeComponent(component) {
+ return core._Uri._uriEncode(core._Uri._unreserved2396Table, component, convert.UTF8, false);
+ }
+ static encodeQueryComponent(component, opts) {
+ let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
+ return core._Uri._uriEncode(core._Uri._unreservedTable, component, encoding, true);
+ }
+ static decodeComponent(encodedComponent) {
+ return core._Uri._uriDecode(encodedComponent, 0, encodedComponent[dartx.length], convert.UTF8, false);
+ }
+ static decodeQueryComponent(encodedComponent, opts) {
+ let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
+ return core._Uri._uriDecode(encodedComponent, 0, encodedComponent[dartx.length], encoding, true);
+ }
+ static encodeFull(uri) {
+ return core._Uri._uriEncode(core._Uri._encodeFullTable, uri, convert.UTF8, false);
+ }
+ static decodeFull(uri) {
+ return core._Uri._uriDecode(uri, 0, uri[dartx.length], convert.UTF8, false);
+ }
+ static splitQueryString(query, opts) {
+ let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
+ return query[dartx.split]("&")[dartx.fold](MapOfString$String())(dart.map({}, core.String, core.String), dart.fn((map, element) => {
+ let index = element[dartx.indexOf]("=");
+ if (index == -1) {
+ if (element != "") {
+ map[dartx._set](core.Uri.decodeQueryComponent(element, {encoding: encoding}), "");
+ }
+ } else if (index != 0) {
+ let key = element[dartx.substring](0, index);
+ let value = element[dartx.substring](dart.notNull(index) + 1);
+ map[dartx._set](core.Uri.decodeQueryComponent(key, {encoding: encoding}), core.Uri.decodeQueryComponent(value, {encoding: encoding}));
+ }
+ return map;
+ }, MapOfString$StringAndStringToMapOfString$String()));
+ }
+ static parseIPv4Address(host) {
+ return core.Uri._parseIPv4Address(host, 0, host[dartx.length]);
+ }
+ static _parseIPv4Address(host, start, end) {
+ function error(msg, position) {
+ dart.throw(new core.FormatException(dart.str`Illegal IPv4 address, ${msg}`, host, position));
+ }
+ dart.fn(error, StringAndintTovoid());
+ let result = typed_data.Uint8List.new(4);
+ let partIndex = 0;
+ let partStart = start;
+ for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(i) + 1) {
+ let char = host[dartx.codeUnitAt](i);
+ if (char != core._DOT) {
+ if ((dart.notNull(char) ^ 48) >>> 0 > 9) {
+ error("invalid character", i);
+ }
+ } else {
+ if (partIndex == 3) {
+ error('IPv4 address should contain exactly 4 parts', i);
+ }
+ let part = core.int.parse(host[dartx.substring](partStart, i));
+ if (dart.notNull(part) > 255) {
+ error("each part must be in the range 0..255", partStart);
+ }
+ result[dartx._set](partIndex++, part);
+ partStart = dart.notNull(i) + 1;
+ }
+ }
+ if (partIndex != 3) {
+ error('IPv4 address should contain exactly 4 parts', end);
+ }
+ let part = core.int.parse(host[dartx.substring](partStart, end));
+ if (dart.notNull(part) > 255) {
+ error("each part must be in the range 0..255", partStart);
+ }
+ result[dartx._set](partIndex, part);
+ return result;
+ }
+ static parseIPv6Address(host, start, end) {
+ if (start === void 0) start = 0;
+ if (end === void 0) end = null;
+ if (end == null) end = host[dartx.length];
+ function error(msg, position) {
+ if (position === void 0) position = null;
+ dart.throw(new core.FormatException(dart.str`Illegal IPv6 address, ${msg}`, host, core.int._check(position)));
+ }
+ dart.fn(error, String__Tovoid());
+ function parseHex(start, end) {
+ if (dart.notNull(end) - dart.notNull(start) > 4) {
+ error('an IPv6 part can only contain a maximum of 4 hex digits', start);
+ }
+ let value = core.int.parse(host[dartx.substring](start, end), {radix: 16});
+ if (dart.notNull(value) < 0 || dart.notNull(value) > 65535) {
+ error('each part must be in the range of `0x0..0xFFFF`', start);
+ }
+ return value;
+ }
+ dart.fn(parseHex, intAndintToint());
+ if (dart.notNull(host[dartx.length]) < 2) error('address is too short');
+ let parts = JSArrayOfint().of([]);
+ let wildcardSeen = false;
+ let seenDot = false;
+ let partStart = start;
+ for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(i) + 1) {
+ let char = host[dartx.codeUnitAt](i);
+ if (char == core._COLON) {
+ if (i == start) {
+ i = dart.notNull(i) + 1;
+ if (host[dartx.codeUnitAt](i) != core._COLON) {
+ error('invalid start colon.', i);
+ }
+ partStart = i;
+ }
+ if (i == partStart) {
+ if (wildcardSeen) {
+ error('only one wildcard `::` is allowed', i);
+ }
+ wildcardSeen = true;
+ parts[dartx.add](-1);
+ } else {
+ parts[dartx.add](parseHex(partStart, i));
+ }
+ partStart = dart.notNull(i) + 1;
+ } else if (char == core._DOT) {
+ seenDot = true;
+ }
+ }
+ if (parts[dartx.length] == 0) error('too few parts');
+ let atEnd = partStart == end;
+ let isLastWildcard = parts[dartx.last] == -1;
+ if (atEnd && !isLastWildcard) {
+ error('expected a part after last `:`', end);
+ }
+ if (!atEnd) {
+ if (!seenDot) {
+ parts[dartx.add](parseHex(partStart, end));
+ } else {
+ let last = core.Uri._parseIPv4Address(host, partStart, end);
+ parts[dartx.add]((dart.notNull(last[dartx._get](0)) << 8 | dart.notNull(last[dartx._get](1))) >>> 0);
+ parts[dartx.add]((dart.notNull(last[dartx._get](2)) << 8 | dart.notNull(last[dartx._get](3))) >>> 0);
+ }
+ }
+ if (wildcardSeen) {
+ if (dart.notNull(parts[dartx.length]) > 7) {
+ error('an address with a wildcard must have less than 7 parts');
+ }
+ } else if (parts[dartx.length] != 8) {
+ error('an address without a wildcard must contain exactly 8 parts');
+ }
+ let bytes = typed_data.Uint8List.new(16);
+ for (let i = 0, index = 0; i < dart.notNull(parts[dartx.length]); i++) {
+ let value = parts[dartx._get](i);
+ if (value == -1) {
+ let wildCardLength = 9 - dart.notNull(parts[dartx.length]);
+ for (let j = 0; j < wildCardLength; j++) {
+ bytes[dartx._set](index, 0);
+ bytes[dartx._set](index + 1, 0);
+ index = index + 2;
+ }
+ } else {
+ bytes[dartx._set](index, value[dartx['>>']](8));
+ bytes[dartx._set](index + 1, dart.notNull(value) & 255);
+ index = index + 2;
+ }
+ }
+ return bytes;
+ }
+};
+dart.setSignature(core.Uri, {
+ getters: () => ({hasScheme: dart.definiteFunctionType(core.bool, [])}),
+ statics: () => ({
+ parse: dart.definiteFunctionType(core.Uri, [core.String], [core.int, core.int]),
+ encodeComponent: dart.definiteFunctionType(core.String, [core.String]),
+ encodeQueryComponent: dart.definiteFunctionType(core.String, [core.String], {encoding: convert.Encoding}),
+ decodeComponent: dart.definiteFunctionType(core.String, [core.String]),
+ decodeQueryComponent: dart.definiteFunctionType(core.String, [core.String], {encoding: convert.Encoding}),
+ encodeFull: dart.definiteFunctionType(core.String, [core.String]),
+ decodeFull: dart.definiteFunctionType(core.String, [core.String]),
+ splitQueryString: dart.definiteFunctionType(core.Map$(core.String, core.String), [core.String], {encoding: convert.Encoding}),
+ parseIPv4Address: dart.definiteFunctionType(core.List$(core.int), [core.String]),
+ _parseIPv4Address: dart.definiteFunctionType(core.List$(core.int), [core.String, core.int, core.int]),
+ parseIPv6Address: dart.definiteFunctionType(core.List$(core.int), [core.String], [core.int, core.int])
+ }),
+ names: ['parse', 'encodeComponent', 'encodeQueryComponent', 'decodeComponent', 'decodeQueryComponent', 'encodeFull', 'decodeFull', 'splitQueryString', 'parseIPv4Address', '_parseIPv4Address', 'parseIPv6Address']
+});
const _userInfo = Symbol('_userInfo');
const _host = Symbol('_host');
const _port = Symbol('_port');
-const _path = Symbol('_path');
const _query = Symbol('_query');
const _fragment = Symbol('_fragment');
const _pathSegments = Symbol('_pathSegments');
+const _text = Symbol('_text');
+const _hashCodeCache = Symbol('_hashCodeCache');
const _queryParameters = Symbol('_queryParameters');
const _queryParameterLists = Symbol('_queryParameterLists');
const _writeAuthority = Symbol('_writeAuthority');
let const$51;
const _mergePaths = Symbol('_mergePaths');
-const _toWindowsFilePath = Symbol('_toWindowsFilePath');
const _toFilePath = Symbol('_toFilePath');
const _isPathAbsolute = Symbol('_isPathAbsolute');
-core.Uri = class Uri extends core.Object {
+const _initializeText = Symbol('_initializeText');
+core._Uri = class _Uri extends core.Object {
_internal(scheme, userInfo, host, port, path, query, fragment) {
this.scheme = scheme;
this[_userInfo] = userInfo;
this[_host] = host;
this[_port] = port;
- this[_path] = path;
+ this.path = path;
this[_query] = query;
this[_fragment] = fragment;
this[_pathSegments] = null;
+ this[_text] = null;
+ this[_hashCodeCache] = null;
this[_queryParameters] = null;
this[_queryParameterLists] = null;
}
+ static notSimple(uri, start, end, schemeEnd, hostStart, portStart, pathStart, queryStart, fragmentStart, scheme) {
+ if (scheme == null) {
+ scheme = "";
+ if (dart.notNull(schemeEnd) > dart.notNull(start)) {
+ scheme = core._Uri._makeScheme(uri, start, schemeEnd);
+ } else if (schemeEnd == start) {
+ core._Uri._fail(uri, start, "Invalid empty scheme");
+ }
+ }
+ let userInfo = "";
+ let host = null;
+ let port = null;
+ if (dart.notNull(hostStart) > dart.notNull(start)) {
+ let userInfoStart = dart.notNull(schemeEnd) + 3;
+ if (userInfoStart < dart.notNull(hostStart)) {
+ userInfo = core._Uri._makeUserInfo(uri, userInfoStart, dart.notNull(hostStart) - 1);
+ }
+ host = core._Uri._makeHost(uri, hostStart, portStart, false);
+ if (dart.notNull(portStart) + 1 < dart.notNull(pathStart)) {
+ port = core.int.parse(uri[dartx.substring](dart.notNull(portStart) + 1, pathStart), {onError: dart.fn(_ => {
+ dart.throw(new core.FormatException("Invalid port", uri, dart.notNull(portStart) + 1));
+ }, StringToNull())});
+ port = core._Uri._makePort(port, scheme);
+ }
+ }
+ let path = core._Uri._makePath(uri, pathStart, queryStart, null, scheme, host != null);
+ let query = null;
+ if (dart.notNull(queryStart) < dart.notNull(fragmentStart)) {
+ query = core._Uri._makeQuery(uri, dart.notNull(queryStart) + 1, fragmentStart, null);
+ }
+ let fragment = null;
+ if (dart.notNull(fragmentStart) < dart.notNull(end)) {
+ fragment = core._Uri._makeFragment(uri, dart.notNull(fragmentStart) + 1, end);
+ }
+ return new core._Uri._internal(scheme, userInfo, host, port, path, query, fragment);
+ }
static new(opts) {
- let scheme = opts && 'scheme' in opts ? opts.scheme : "";
- let userInfo = opts && 'userInfo' in opts ? opts.userInfo : "";
+ let scheme = opts && 'scheme' in opts ? opts.scheme : null;
+ let userInfo = opts && 'userInfo' in opts ? opts.userInfo : null;
let host = opts && 'host' in opts ? opts.host : null;
let port = opts && 'port' in opts ? opts.port : null;
let path = opts && 'path' in opts ? opts.path : null;
@@ -33259,33 +33728,37 @@
let query = opts && 'query' in opts ? opts.query : null;
let queryParameters = opts && 'queryParameters' in opts ? opts.queryParameters : null;
let fragment = opts && 'fragment' in opts ? opts.fragment : null;
- scheme = core.Uri._makeScheme(scheme, 0, core.Uri._stringOrNullLength(scheme));
- userInfo = core.Uri._makeUserInfo(userInfo, 0, core.Uri._stringOrNullLength(userInfo));
- host = core.Uri._makeHost(host, 0, core.Uri._stringOrNullLength(host), false);
+ scheme = core._Uri._makeScheme(scheme, 0, core._stringOrNullLength(scheme));
+ userInfo = core._Uri._makeUserInfo(userInfo, 0, core._stringOrNullLength(userInfo));
+ host = core._Uri._makeHost(host, 0, core._stringOrNullLength(host), false);
if (query == "") query = null;
- query = core.Uri._makeQuery(query, 0, core.Uri._stringOrNullLength(query), queryParameters);
- fragment = core.Uri._makeFragment(fragment, 0, core.Uri._stringOrNullLength(fragment));
- port = core.Uri._makePort(port, scheme);
+ query = core._Uri._makeQuery(query, 0, core._stringOrNullLength(query), queryParameters);
+ fragment = core._Uri._makeFragment(fragment, 0, core._stringOrNullLength(fragment));
+ port = core._Uri._makePort(port, scheme);
let isFile = scheme == "file";
if (host == null && (dart.test(userInfo[dartx.isNotEmpty]) || port != null || isFile)) {
host = "";
}
let hasAuthority = host != null;
- path = core.Uri._makePath(path, 0, core.Uri._stringOrNullLength(path), pathSegments, scheme, hasAuthority);
+ path = core._Uri._makePath(path, 0, core._stringOrNullLength(path), pathSegments, scheme, hasAuthority);
if (dart.test(scheme[dartx.isEmpty]) && host == null && !dart.test(path[dartx.startsWith]('/'))) {
- path = core.Uri._normalizeRelativePath(path);
+ let allowScheme = dart.test(scheme[dartx.isNotEmpty]) || host != null;
+ path = core._Uri._normalizeRelativePath(path, allowScheme);
} else {
- path = core.Uri._removeDotSegments(path);
+ path = core._Uri._removeDotSegments(path);
}
- return new core.Uri._internal(scheme, userInfo, host, port, path, query, fragment);
+ if (host == null && dart.test(path[dartx.startsWith]("//"))) {
+ host = "";
+ }
+ return new core._Uri._internal(scheme, userInfo, host, port, path, query, fragment);
}
static http(authority, unencodedPath, queryParameters) {
if (queryParameters === void 0) queryParameters = null;
- return core.Uri._makeHttpUri("http", authority, unencodedPath, queryParameters);
+ return core._Uri._check(core._Uri._makeHttpUri("http", authority, unencodedPath, queryParameters));
}
static https(authority, unencodedPath, queryParameters) {
if (queryParameters === void 0) queryParameters = null;
- return core.Uri._makeHttpUri("https", authority, unencodedPath, queryParameters);
+ return core._Uri._check(core._Uri._makeHttpUri("https", authority, unencodedPath, queryParameters));
}
get authority() {
if (!dart.test(this.hasAuthority)) return "";
@@ -33304,7 +33777,7 @@
return this[_host];
}
get port() {
- if (this[_port] == null) return core.Uri._defaultPort(this.scheme);
+ if (this[_port] == null) return core._Uri._defaultPort(this.scheme);
return this[_port];
}
static _defaultPort(scheme) {
@@ -33312,181 +33785,34 @@
if (scheme == "https") return 443;
return 0;
}
- get path() {
- return this[_path];
- }
get query() {
- return this[_query] == null ? "" : this[_query];
+ return this[_query] != null ? this[_query] : "";
}
get fragment() {
- return this[_fragment] == null ? "" : this[_fragment];
+ return this[_fragment] != null ? this[_fragment] : "";
}
- static parse(uri, start, end) {
- if (start === void 0) start = 0;
- if (end === void 0) end = null;
- let EOI = -1;
- let scheme = "";
- let userinfo = "";
- let host = null;
- let port = null;
- let path = null;
- let query = null;
- let fragment = null;
- if (end == null) end = uri[dartx.length];
- let index = start;
- let pathStart = start;
- let char = EOI;
- function parseAuth() {
- if (index == end) {
- char = EOI;
- return;
- }
- let authStart = index;
- let lastColon = -1;
- let lastAt = -1;
- char = uri[dartx.codeUnitAt](index);
- while (dart.notNull(index) < dart.notNull(end)) {
- char = uri[dartx.codeUnitAt](index);
- if (char == core.Uri._SLASH || char == core.Uri._QUESTION || char == core.Uri._NUMBER_SIGN) {
- break;
- }
- if (char == core.Uri._AT_SIGN) {
- lastAt = index;
- lastColon = -1;
- } else if (char == core.Uri._COLON) {
- lastColon = index;
- } else if (char == core.Uri._LEFT_BRACKET) {
- lastColon = -1;
- let endBracket = uri[dartx.indexOf](']', dart.notNull(index) + 1);
- if (endBracket == -1) {
- index = end;
- char = EOI;
- break;
- } else {
- index = endBracket;
+ isScheme(scheme) {
+ let thisScheme = this.scheme;
+ if (scheme == null) return thisScheme[dartx.isEmpty];
+ if (scheme[dartx.length] != thisScheme[dartx.length]) return false;
+ return core._Uri._compareScheme(scheme, thisScheme);
+ }
+ static _compareScheme(scheme, uri) {
+ for (let i = 0; i < dart.notNull(scheme[dartx.length]); i++) {
+ let schemeChar = scheme[dartx.codeUnitAt](i);
+ let uriChar = uri[dartx.codeUnitAt](i);
+ let delta = (dart.notNull(schemeChar) ^ dart.notNull(uriChar)) >>> 0;
+ if (delta != 0) {
+ if (delta == 32) {
+ let lowerChar = (dart.notNull(uriChar) | delta) >>> 0;
+ if (97 <= lowerChar && lowerChar <= 122) {
+ continue;
}
}
- index = dart.notNull(index) + 1;
- char = EOI;
- }
- let hostStart = authStart;
- let hostEnd = index;
- if (dart.notNull(lastAt) >= 0) {
- userinfo = core.Uri._makeUserInfo(uri, authStart, lastAt);
- hostStart = dart.notNull(lastAt) + 1;
- }
- if (dart.notNull(lastColon) >= 0) {
- let portNumber = null;
- if (dart.notNull(lastColon) + 1 < dart.notNull(index)) {
- portNumber = 0;
- for (let i = dart.notNull(lastColon) + 1; i < dart.notNull(index); i++) {
- let digit = uri[dartx.codeUnitAt](i);
- if (core.Uri._ZERO > dart.notNull(digit) || core.Uri._NINE < dart.notNull(digit)) {
- core.Uri._fail(uri, i, "Invalid port number");
- }
- portNumber = dart.notNull(portNumber) * 10 + (dart.notNull(digit) - core.Uri._ZERO);
- }
- }
- port = core.Uri._makePort(portNumber, scheme);
- hostEnd = lastColon;
- }
- host = core.Uri._makeHost(uri, hostStart, hostEnd, true);
- if (dart.notNull(index) < dart.notNull(end)) {
- char = uri[dartx.codeUnitAt](index);
+ return false;
}
}
- dart.fn(parseAuth, VoidTovoid$());
- let NOT_IN_PATH = 0;
- let IN_PATH = 1;
- let ALLOW_AUTH = 2;
- let state = NOT_IN_PATH;
- let i = index;
- while (dart.notNull(i) < dart.notNull(end)) {
- char = uri[dartx.codeUnitAt](i);
- if (char == core.Uri._QUESTION || char == core.Uri._NUMBER_SIGN) {
- state = NOT_IN_PATH;
- break;
- }
- if (char == core.Uri._SLASH) {
- state = i == start ? ALLOW_AUTH : IN_PATH;
- break;
- }
- if (char == core.Uri._COLON) {
- if (i == start) core.Uri._fail(uri, start, "Invalid empty scheme");
- scheme = core.Uri._makeScheme(uri, start, i);
- i = dart.notNull(i) + 1;
- pathStart = i;
- if (i == end) {
- char = EOI;
- state = NOT_IN_PATH;
- } else {
- char = uri[dartx.codeUnitAt](i);
- if (char == core.Uri._QUESTION || char == core.Uri._NUMBER_SIGN) {
- state = NOT_IN_PATH;
- } else if (char == core.Uri._SLASH) {
- state = ALLOW_AUTH;
- } else {
- state = IN_PATH;
- }
- }
- break;
- }
- i = dart.notNull(i) + 1;
- char = EOI;
- }
- index = i;
- if (state == ALLOW_AUTH) {
- dart.assert(char == core.Uri._SLASH);
- index = dart.notNull(index) + 1;
- if (index == end) {
- char = EOI;
- state = NOT_IN_PATH;
- } else {
- char = uri[dartx.codeUnitAt](index);
- if (char == core.Uri._SLASH) {
- index = dart.notNull(index) + 1;
- parseAuth();
- pathStart = index;
- }
- if (char == core.Uri._QUESTION || char == core.Uri._NUMBER_SIGN || char == EOI) {
- state = NOT_IN_PATH;
- } else {
- state = IN_PATH;
- }
- }
- }
- dart.assert(state == IN_PATH || state == NOT_IN_PATH);
- if (state == IN_PATH) {
- while ((index = dart.notNull(index) + 1) < dart.notNull(end)) {
- char = uri[dartx.codeUnitAt](index);
- if (char == core.Uri._QUESTION || char == core.Uri._NUMBER_SIGN) {
- break;
- }
- char = EOI;
- }
- state = NOT_IN_PATH;
- }
- dart.assert(state == NOT_IN_PATH);
- let hasAuthority = host != null;
- path = core.Uri._makePath(uri, pathStart, index, null, scheme, hasAuthority);
- if (char == core.Uri._QUESTION) {
- let numberSignIndex = -1;
- for (let i = dart.notNull(index) + 1; i < dart.notNull(end); i++) {
- if (uri[dartx.codeUnitAt](i) == core.Uri._NUMBER_SIGN) {
- numberSignIndex = i;
- break;
- }
- }
- if (numberSignIndex < 0) {
- query = core.Uri._makeQuery(uri, dart.notNull(index) + 1, end, null);
- } else {
- query = core.Uri._makeQuery(uri, dart.notNull(index) + 1, numberSignIndex, null);
- fragment = core.Uri._makeFragment(uri, numberSignIndex + 1, end);
- }
- } else if (char == core.Uri._NUMBER_SIGN) {
- fragment = core.Uri._makeFragment(uri, dart.notNull(index) + 1, end);
- }
- return new core.Uri._internal(scheme, userinfo, host, port, path, query, fragment);
+ return true;
}
static _fail(uri, index, message) {
dart.throw(new core.FormatException(message, uri, index));
@@ -33499,7 +33825,8 @@
let hostStart = 0;
let hasUserInfo = false;
for (let i = 0; i < dart.notNull(authority[dartx.length]); i++) {
- if (authority[dartx.codeUnitAt](i) == core.Uri._AT_SIGN) {
+ let atSign = 64;
+ if (authority[dartx.codeUnitAt](i) == atSign) {
hasUserInfo = true;
userInfo = authority[dartx.substring](0, i);
hostStart = i + 1;
@@ -33507,22 +33834,22 @@
}
}
let hostEnd = hostStart;
- if (hostStart < dart.notNull(authority[dartx.length]) && authority[dartx.codeUnitAt](hostStart) == core.Uri._LEFT_BRACKET) {
+ if (hostStart < dart.notNull(authority[dartx.length]) && authority[dartx.codeUnitAt](hostStart) == core._LEFT_BRACKET) {
for (; hostEnd < dart.notNull(authority[dartx.length]); hostEnd++) {
- if (authority[dartx.codeUnitAt](hostEnd) == core.Uri._RIGHT_BRACKET) break;
+ if (authority[dartx.codeUnitAt](hostEnd) == core._RIGHT_BRACKET) break;
}
if (hostEnd == authority[dartx.length]) {
dart.throw(new core.FormatException("Invalid IPv6 host entry.", authority, hostStart));
}
core.Uri.parseIPv6Address(authority, hostStart + 1, hostEnd);
hostEnd++;
- if (hostEnd != authority[dartx.length] && authority[dartx.codeUnitAt](hostEnd) != core.Uri._COLON) {
+ if (hostEnd != authority[dartx.length] && authority[dartx.codeUnitAt](hostEnd) != core._COLON) {
dart.throw(new core.FormatException("Invalid end of authority", authority, hostEnd));
}
}
let hasPort = false;
for (; hostEnd < dart.notNull(authority[dartx.length]); hostEnd++) {
- if (authority[dartx.codeUnitAt](hostEnd) == core.Uri._COLON) {
+ if (authority[dartx.codeUnitAt](hostEnd) == core._COLON) {
let portString = authority[dartx.substring](hostEnd + 1);
if (dart.test(portString[dartx.isNotEmpty])) port = core.int.parse(portString);
break;
@@ -33534,33 +33861,13 @@
}
static file(path, opts) {
let windows = opts && 'windows' in opts ? opts.windows : null;
- windows = windows == null ? core.Uri._isWindows : windows;
- return core.Uri._check(dart.test(windows) ? core.Uri._makeWindowsFileUrl(path, false) : core.Uri._makeFileUri(path, false));
+ windows = windows == null ? core._Uri._isWindows : windows;
+ return core._Uri._check(dart.test(windows) ? core._Uri._makeWindowsFileUrl(path, false) : core._Uri._makeFileUri(path, false));
}
static directory(path, opts) {
let windows = opts && 'windows' in opts ? opts.windows : null;
- windows = windows == null ? core.Uri._isWindows : windows;
- return core.Uri._check(dart.test(windows) ? core.Uri._makeWindowsFileUrl(path, true) : core.Uri._makeFileUri(path, true));
- }
- static dataFromString(content, opts) {
- let mimeType = opts && 'mimeType' in opts ? opts.mimeType : null;
- let encoding = opts && 'encoding' in opts ? opts.encoding : null;
- let parameters = opts && 'parameters' in opts ? opts.parameters : null;
- let base64 = opts && 'base64' in opts ? opts.base64 : false;
- let data = core.UriData.fromString(content, {mimeType: mimeType, encoding: encoding, parameters: parameters, base64: base64});
- return data.uri;
- }
- static dataFromBytes(bytes, opts) {
- let mimeType = opts && 'mimeType' in opts ? opts.mimeType : "application/octet-stream";
- let parameters = opts && 'parameters' in opts ? opts.parameters : null;
- let percentEncoded = opts && 'percentEncoded' in opts ? opts.percentEncoded : false;
- let data = core.UriData.fromBytes(bytes, {mimeType: mimeType, parameters: parameters, percentEncoded: percentEncoded});
- return data.uri;
- }
- static get base() {
- let uri = _js_helper.Primitives.currentUri();
- if (uri != null) return core.Uri.parse(uri);
- dart.throw(new core.UnsupportedError("'Uri.base' is not supported"));
+ windows = windows == null ? core._Uri._isWindows : windows;
+ return core._Uri._check(dart.test(windows) ? core._Uri._makeWindowsFileUrl(path, true) : core._Uri._makeFileUri(path, true));
}
static get _isWindows() {
return false;
@@ -33589,7 +33896,7 @@
}
}
static _checkWindowsDriveLetter(charCode, argumentError) {
- if (core.Uri._UPPER_CASE_A <= dart.notNull(charCode) && dart.notNull(charCode) <= core.Uri._UPPER_CASE_Z || core.Uri._LOWER_CASE_A <= dart.notNull(charCode) && dart.notNull(charCode) <= core.Uri._LOWER_CASE_Z) {
+ if (core._UPPER_CASE_A <= dart.notNull(charCode) && dart.notNull(charCode) <= core._UPPER_CASE_Z || core._LOWER_CASE_A <= dart.notNull(charCode) && dart.notNull(charCode) <= core._LOWER_CASE_Z) {
return;
}
if (dart.test(argumentError)) {
@@ -33616,7 +33923,7 @@
path = path[dartx.replaceRange](0, 7, '\\');
} else {
path = path[dartx.substring](4);
- if (dart.notNull(path[dartx.length]) < 3 || path[dartx.codeUnitAt](1) != core.Uri._COLON || path[dartx.codeUnitAt](2) != core.Uri._BACKSLASH) {
+ if (dart.notNull(path[dartx.length]) < 3 || path[dartx.codeUnitAt](1) != core._COLON || path[dartx.codeUnitAt](2) != core._BACKSLASH) {
dart.throw(new core.ArgumentError("Windows paths with \\\\?\\ prefix must be absolute"));
}
}
@@ -33624,16 +33931,16 @@
path = path[dartx.replaceAll]("/", '\\');
}
let sep = '\\';
- if (dart.notNull(path[dartx.length]) > 1 && path[dartx.codeUnitAt](1) == core.Uri._COLON) {
- core.Uri._checkWindowsDriveLetter(path[dartx.codeUnitAt](0), true);
- if (path[dartx.length] == 2 || path[dartx.codeUnitAt](2) != core.Uri._BACKSLASH) {
+ if (dart.notNull(path[dartx.length]) > 1 && path[dartx.codeUnitAt](1) == core._COLON) {
+ core._Uri._checkWindowsDriveLetter(path[dartx.codeUnitAt](0), true);
+ if (path[dartx.length] == 2 || path[dartx.codeUnitAt](2) != core._BACKSLASH) {
dart.throw(new core.ArgumentError("Windows paths with drive letter must be absolute"));
}
let pathSegments = path[dartx.split](sep);
if (dart.test(slashTerminated) && dart.test(pathSegments[dartx.last][dartx.isNotEmpty])) {
pathSegments[dartx.add]("");
}
- core.Uri._checkWindowsPathReservedCharacters(pathSegments, true, 1);
+ core._Uri._checkWindowsPathReservedCharacters(pathSegments, true, 1);
return core.Uri.new({scheme: "file", pathSegments: pathSegments});
}
if (dart.test(path[dartx.startsWith](sep))) {
@@ -33642,7 +33949,7 @@
let hostPart = dart.notNull(pathStart) < 0 ? path[dartx.substring](2) : path[dartx.substring](2, pathStart);
let pathPart = dart.notNull(pathStart) < 0 ? "" : path[dartx.substring](dart.notNull(pathStart) + 1);
let pathSegments = pathPart[dartx.split](sep);
- core.Uri._checkWindowsPathReservedCharacters(pathSegments, true);
+ core._Uri._checkWindowsPathReservedCharacters(pathSegments, true);
if (dart.test(slashTerminated) && dart.test(pathSegments[dartx.last][dartx.isNotEmpty])) {
pathSegments[dartx.add]("");
}
@@ -33652,12 +33959,12 @@
if (dart.test(slashTerminated) && dart.test(pathSegments[dartx.last][dartx.isNotEmpty])) {
pathSegments[dartx.add]("");
}
- core.Uri._checkWindowsPathReservedCharacters(pathSegments, true);
+ core._Uri._checkWindowsPathReservedCharacters(pathSegments, true);
return core.Uri.new({scheme: "file", pathSegments: pathSegments});
}
} else {
let pathSegments = path[dartx.split](sep);
- core.Uri._checkWindowsPathReservedCharacters(pathSegments, true);
+ core._Uri._checkWindowsPathReservedCharacters(pathSegments, true);
if (dart.test(slashTerminated) && dart.test(pathSegments[dartx.isNotEmpty]) && dart.test(pathSegments[dartx.last][dartx.isNotEmpty])) {
pathSegments[dartx.add]("");
}
@@ -33676,27 +33983,27 @@
let fragment = opts && 'fragment' in opts ? opts.fragment : null;
let schemeChanged = false;
if (scheme != null) {
- scheme = core.Uri._makeScheme(scheme, 0, scheme[dartx.length]);
- schemeChanged = true;
+ scheme = core._Uri._makeScheme(scheme, 0, scheme[dartx.length]);
+ schemeChanged = scheme != this.scheme;
} else {
scheme = this.scheme;
}
let isFile = scheme == "file";
if (userInfo != null) {
- userInfo = core.Uri._makeUserInfo(userInfo, 0, userInfo[dartx.length]);
+ userInfo = core._Uri._makeUserInfo(userInfo, 0, userInfo[dartx.length]);
} else {
userInfo = this[_userInfo];
}
if (port != null) {
- port = core.Uri._makePort(port, scheme);
+ port = core._Uri._makePort(port, scheme);
} else {
port = this[_port];
if (schemeChanged) {
- port = core.Uri._makePort(port, scheme);
+ port = core._Uri._makePort(port, scheme);
}
}
if (host != null) {
- host = core.Uri._makeHost(host, 0, host[dartx.length], false);
+ host = core._Uri._makeHost(host, 0, host[dartx.length], false);
} else if (dart.test(this.hasAuthority)) {
host = this[_host];
} else if (dart.test(userInfo[dartx.isNotEmpty]) || port != null || isFile) {
@@ -33704,34 +34011,34 @@
}
let hasAuthority = host != null;
if (path != null || pathSegments != null) {
- path = core.Uri._makePath(path, 0, core.Uri._stringOrNullLength(path), pathSegments, scheme, hasAuthority);
+ path = core._Uri._makePath(path, 0, core._stringOrNullLength(path), pathSegments, scheme, hasAuthority);
} else {
- path = this[_path];
+ path = this.path;
if ((isFile || hasAuthority && !dart.test(path[dartx.isEmpty])) && !dart.test(path[dartx.startsWith]('/'))) {
path = "/" + dart.notNull(path);
}
}
if (query != null || queryParameters != null) {
- query = core.Uri._makeQuery(query, 0, core.Uri._stringOrNullLength(query), queryParameters);
+ query = core._Uri._makeQuery(query, 0, core._stringOrNullLength(query), queryParameters);
} else {
query = this[_query];
}
if (fragment != null) {
- fragment = core.Uri._makeFragment(fragment, 0, fragment[dartx.length]);
+ fragment = core._Uri._makeFragment(fragment, 0, fragment[dartx.length]);
} else {
fragment = this[_fragment];
}
- return new core.Uri._internal(scheme, userInfo, host, port, path, query, fragment);
+ return new core._Uri._internal(scheme, userInfo, host, port, path, query, fragment);
}
removeFragment() {
if (!dart.test(this.hasFragment)) return this;
- return new core.Uri._internal(this.scheme, this[_userInfo], this[_host], this[_port], this[_path], this[_query], null);
+ return new core._Uri._internal(this.scheme, this[_userInfo], this[_host], this[_port], this.path, this[_query], null);
}
get pathSegments() {
let result = this[_pathSegments];
if (result != null) return result;
let pathToSplit = this.path;
- if (dart.test(pathToSplit[dartx.isNotEmpty]) && pathToSplit[dartx.codeUnitAt](0) == core.Uri._SLASH) {
+ if (dart.test(pathToSplit[dartx.isNotEmpty]) && pathToSplit[dartx.codeUnitAt](0) == core._SLASH) {
pathToSplit = pathToSplit[dartx.substring](1);
}
result = pathToSplit == "" ? const$51 || (const$51 = dart.constList([], core.String)) : ListOfString().unmodifiable(pathToSplit[dartx.split]("/")[dartx.map](core.String)(core.Uri.decodeComponent));
@@ -33746,7 +34053,7 @@
}
get queryParametersAll() {
if (this[_queryParameterLists] == null) {
- let queryParameterLists = core.Uri._splitQueryStringAll(this.query);
+ let queryParameterLists = core._Uri._splitQueryStringAll(this.query);
for (let key of queryParameterLists[dartx.keys]) {
queryParameterLists[dartx._set](key, ListOfString().unmodifiable(core.Iterable._check(queryParameterLists[dartx._get](key))));
}
@@ -33755,36 +34062,36 @@
return this[_queryParameterLists];
}
normalizePath() {
- let path = core.Uri._normalizePath(this[_path], this.scheme, this.hasAuthority);
- if (core.identical(path, this[_path])) return this;
+ let path = core._Uri._normalizePath(this.path, this.scheme, this.hasAuthority);
+ if (core.identical(path, this.path)) return this;
return this.replace({path: path});
}
static _makePort(port, scheme) {
- if (port != null && port == core.Uri._defaultPort(scheme)) return null;
+ if (port != null && port == core._Uri._defaultPort(scheme)) return null;
return port;
}
static _makeHost(host, start, end, strictIPv6) {
if (host == null) return null;
if (start == end) return "";
- if (host[dartx.codeUnitAt](start) == core.Uri._LEFT_BRACKET) {
- if (host[dartx.codeUnitAt](dart.notNull(end) - 1) != core.Uri._RIGHT_BRACKET) {
- core.Uri._fail(host, start, 'Missing end `]` to match `[` in host');
+ if (host[dartx.codeUnitAt](start) == core._LEFT_BRACKET) {
+ if (host[dartx.codeUnitAt](dart.notNull(end) - 1) != core._RIGHT_BRACKET) {
+ core._Uri._fail(host, start, 'Missing end `]` to match `[` in host');
}
core.Uri.parseIPv6Address(host, dart.notNull(start) + 1, dart.notNull(end) - 1);
return host[dartx.substring](start, end)[dartx.toLowerCase]();
}
if (!dart.test(strictIPv6)) {
for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(i) + 1) {
- if (host[dartx.codeUnitAt](i) == core.Uri._COLON) {
+ if (host[dartx.codeUnitAt](i) == core._COLON) {
core.Uri.parseIPv6Address(host, start, end);
return dart.str`[${host}]`;
}
}
}
- return core.Uri._normalizeRegName(host, start, end);
+ return core._Uri._normalizeRegName(host, start, end);
}
static _isRegNameChar(char) {
- return dart.notNull(char) < 127 && (dart.notNull(core.Uri._regNameTable[dartx._get](char[dartx['>>']](4))) & 1 << (dart.notNull(char) & 15)) != 0;
+ return dart.notNull(char) < 127 && (dart.notNull(core._Uri._regNameTable[dartx._get](char[dartx['>>']](4))) & 1 << (dart.notNull(char) & 15)) != 0;
}
static _normalizeRegName(host, start, end) {
let buffer = null;
@@ -33793,8 +34100,8 @@
let isNormalized = true;
while (dart.notNull(index) < dart.notNull(end)) {
let char = host[dartx.codeUnitAt](index);
- if (char == core.Uri._PERCENT) {
- let replacement = core.Uri._normalizeEscape(host, index, true);
+ if (char == core._PERCENT) {
+ let replacement = core._Uri._normalizeEscape(host, index, true);
if (replacement == null && isNormalized) {
index = dart.notNull(index) + 3;
continue;
@@ -33814,8 +34121,8 @@
index = dart.notNull(index) + sourceLength;
sectionStart = index;
isNormalized = true;
- } else if (dart.test(core.Uri._isRegNameChar(char))) {
- if (isNormalized && core.Uri._UPPER_CASE_A <= dart.notNull(char) && core.Uri._UPPER_CASE_Z >= dart.notNull(char)) {
+ } else if (dart.test(core._Uri._isRegNameChar(char))) {
+ if (isNormalized && core._UPPER_CASE_A <= dart.notNull(char) && core._UPPER_CASE_Z >= dart.notNull(char)) {
if (buffer == null) buffer = new core.StringBuffer();
if (dart.notNull(sectionStart) < dart.notNull(index)) {
buffer.write(host[dartx.substring](sectionStart, index));
@@ -33824,8 +34131,8 @@
isNormalized = false;
}
index = dart.notNull(index) + 1;
- } else if (dart.test(core.Uri._isGeneralDelimiter(char))) {
- core.Uri._fail(host, index, "Invalid character");
+ } else if (dart.test(core._Uri._isGeneralDelimiter(char))) {
+ core._Uri._fail(host, index, "Invalid character");
} else {
let sourceLength = 1;
if ((dart.notNull(char) & 64512) == 55296 && dart.notNull(index) + 1 < dart.notNull(end)) {
@@ -33839,7 +34146,7 @@
let slice = host[dartx.substring](sectionStart, index);
if (!isNormalized) slice = slice[dartx.toLowerCase]();
buffer.write(slice);
- buffer.write(core.Uri._escapeChar(char));
+ buffer.write(core._Uri._escapeChar(char));
index = dart.notNull(index) + sourceLength;
sectionStart = index;
}
@@ -33855,26 +34162,33 @@
static _makeScheme(scheme, start, end) {
if (start == end) return "";
let firstCodeUnit = scheme[dartx.codeUnitAt](start);
- if (!dart.test(core.Uri._isAlphabeticCharacter(firstCodeUnit))) {
- core.Uri._fail(scheme, start, "Scheme not starting with alphabetic character");
+ if (!dart.test(core._Uri._isAlphabeticCharacter(firstCodeUnit))) {
+ core._Uri._fail(scheme, start, "Scheme not starting with alphabetic character");
}
let containsUpperCase = false;
for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(i) + 1) {
let codeUnit = scheme[dartx.codeUnitAt](i);
- if (!dart.test(core.Uri._isSchemeCharacter(codeUnit))) {
- core.Uri._fail(scheme, i, "Illegal scheme character");
+ if (!dart.test(core._Uri._isSchemeCharacter(codeUnit))) {
+ core._Uri._fail(scheme, i, "Illegal scheme character");
}
- if (core.Uri._UPPER_CASE_A <= dart.notNull(codeUnit) && dart.notNull(codeUnit) <= core.Uri._UPPER_CASE_Z) {
+ if (core._UPPER_CASE_A <= dart.notNull(codeUnit) && dart.notNull(codeUnit) <= core._UPPER_CASE_Z) {
containsUpperCase = true;
}
}
scheme = scheme[dartx.substring](start, end);
if (containsUpperCase) scheme = scheme[dartx.toLowerCase]();
+ return core._Uri._canonicalizeScheme(scheme);
+ }
+ static _canonicalizeScheme(scheme) {
+ if (scheme == "http") return "http";
+ if (scheme == "file") return "file";
+ if (scheme == "https") return "https";
+ if (scheme == "package") return "package";
return scheme;
}
static _makeUserInfo(userInfo, start, end) {
if (userInfo == null) return "";
- return core.Uri._normalize(userInfo, start, end, core.Uri._userinfoTable);
+ return core._Uri._normalizeOrSubstring(userInfo, start, end, core._Uri._userinfoTable);
}
static _makePath(path, start, end, pathSegments, scheme, hasAuthority) {
let isFile = scheme == "file";
@@ -33885,30 +34199,32 @@
}
let result = null;
if (path != null) {
- result = core.Uri._normalize(path, start, end, core.Uri._pathCharOrSlashTable);
+ result = core._Uri._normalizeOrSubstring(path, start, end, core._Uri._pathCharOrSlashTable);
} else {
- result = pathSegments[dartx.map](core.String)(dart.fn(s => core.Uri._uriEncode(core.Uri._pathCharTable, s, convert.UTF8, false), StringToString$()))[dartx.join]("/");
+ result = pathSegments[dartx.map](core.String)(dart.fn(s => core._Uri._uriEncode(core._Uri._pathCharTable, s, convert.UTF8, false), StringToString$()))[dartx.join]("/");
}
if (dart.test(dart.dload(result, 'isEmpty'))) {
if (isFile) return "/";
} else if (ensureLeadingSlash && !dart.test(dart.dsend(result, 'startsWith', '/'))) {
result = "/" + dart.notNull(core.String._check(result));
}
- result = core.Uri._normalizePath(core.String._check(result), scheme, hasAuthority);
+ result = core._Uri._normalizePath(core.String._check(result), scheme, hasAuthority);
return core.String._check(result);
}
static _normalizePath(path, scheme, hasAuthority) {
if (dart.test(scheme[dartx.isEmpty]) && !dart.test(hasAuthority) && !dart.test(path[dartx.startsWith]('/'))) {
- return core.Uri._normalizeRelativePath(path);
+ return core._Uri._normalizeRelativePath(path, dart.test(scheme[dartx.isNotEmpty]) || dart.test(hasAuthority));
}
- return core.Uri._removeDotSegments(path);
+ return core._Uri._removeDotSegments(path);
}
static _makeQuery(query, start, end, queryParameters) {
- if (query == null && queryParameters == null) return null;
- if (query != null && queryParameters != null) {
- dart.throw(new core.ArgumentError('Both query and queryParameters specified'));
+ if (query != null) {
+ if (queryParameters != null) {
+ dart.throw(new core.ArgumentError('Both query and queryParameters specified'));
+ }
+ return core._Uri._normalizeOrSubstring(query, start, end, core._Uri._queryCharTable);
}
- if (query != null) return core.Uri._normalize(query, start, end, core.Uri._queryCharTable);
+ if (queryParameters == null) return null;
let result = new core.StringBuffer();
let separator = "";
function writeParameter(key, value) {
@@ -33936,52 +34252,40 @@
}
static _makeFragment(fragment, start, end) {
if (fragment == null) return null;
- return core.Uri._normalize(fragment, start, end, core.Uri._queryCharTable);
- }
- static _stringOrNullLength(s) {
- return s == null ? 0 : s[dartx.length];
+ return core._Uri._normalizeOrSubstring(fragment, start, end, core._Uri._queryCharTable);
}
static _normalizeEscape(source, index, lowerCase) {
- dart.assert(source[dartx.codeUnitAt](index) == core.Uri._PERCENT);
+ dart.assert(source[dartx.codeUnitAt](index) == core._PERCENT);
if (dart.notNull(index) + 2 >= dart.notNull(source[dartx.length])) {
return "%";
}
let firstDigit = source[dartx.codeUnitAt](dart.notNull(index) + 1);
let secondDigit = source[dartx.codeUnitAt](dart.notNull(index) + 2);
- let firstDigitValue = core.Uri._parseHexDigit(firstDigit);
- let secondDigitValue = core.Uri._parseHexDigit(secondDigit);
+ let firstDigitValue = _internal.hexDigitValue(firstDigit);
+ let secondDigitValue = _internal.hexDigitValue(secondDigit);
if (dart.notNull(firstDigitValue) < 0 || dart.notNull(secondDigitValue) < 0) {
return "%";
}
let value = dart.notNull(firstDigitValue) * 16 + dart.notNull(secondDigitValue);
- if (dart.test(core.Uri._isUnreservedChar(value))) {
- if (dart.test(lowerCase) && core.Uri._UPPER_CASE_A <= value && core.Uri._UPPER_CASE_Z >= value) {
+ if (dart.test(core._Uri._isUnreservedChar(value))) {
+ if (dart.test(lowerCase) && core._UPPER_CASE_A <= value && core._UPPER_CASE_Z >= value) {
value = (value | 32) >>> 0;
}
return core.String.fromCharCode(value);
}
- if (dart.notNull(firstDigit) >= core.Uri._LOWER_CASE_A || dart.notNull(secondDigit) >= core.Uri._LOWER_CASE_A) {
+ if (dart.notNull(firstDigit) >= core._LOWER_CASE_A || dart.notNull(secondDigit) >= core._LOWER_CASE_A) {
return source[dartx.substring](index, dart.notNull(index) + 3)[dartx.toUpperCase]();
}
return null;
}
- static _parseHexDigit(char) {
- let digit = (dart.notNull(char) ^ core.Uri._ZERO) >>> 0;
- if (digit <= 9) return digit;
- let lowerCase = (dart.notNull(char) | 32) >>> 0;
- if (core.Uri._LOWER_CASE_A <= lowerCase && lowerCase <= core.Uri._LOWER_CASE_F) {
- return lowerCase - (core.Uri._LOWER_CASE_A - 10);
- }
- return -1;
- }
static _escapeChar(char) {
dart.assert(dart.notNull(char) <= 1114111);
let codeUnits = null;
if (dart.notNull(char) < 128) {
codeUnits = ListOfint().new(3);
- codeUnits[dartx._set](0, core.Uri._PERCENT);
- codeUnits[dartx._set](1, core.Uri._hexDigits[dartx.codeUnitAt](char[dartx['>>']](4)));
- codeUnits[dartx._set](2, core.Uri._hexDigits[dartx.codeUnitAt](dart.notNull(char) & 15));
+ codeUnits[dartx._set](0, core._PERCENT);
+ codeUnits[dartx._set](1, core._hexDigits[dartx.codeUnitAt](char[dartx['>>']](4)));
+ codeUnits[dartx._set](2, core._hexDigits[dartx.codeUnitAt](dart.notNull(char) & 15));
} else {
let flag = 192;
let encodedBytes = 2;
@@ -33997,16 +34301,21 @@
let index = 0;
while (--encodedBytes >= 0) {
let byte = (char[dartx['>>']](6 * encodedBytes) & 63 | flag) >>> 0;
- codeUnits[dartx._set](index, core.Uri._PERCENT);
- codeUnits[dartx._set](index + 1, core.Uri._hexDigits[dartx.codeUnitAt](byte[dartx['>>']](4)));
- codeUnits[dartx._set](index + 2, core.Uri._hexDigits[dartx.codeUnitAt](byte & 15));
+ codeUnits[dartx._set](index, core._PERCENT);
+ codeUnits[dartx._set](index + 1, core._hexDigits[dartx.codeUnitAt](byte[dartx['>>']](4)));
+ codeUnits[dartx._set](index + 2, core._hexDigits[dartx.codeUnitAt](byte & 15));
index = index + 3;
flag = 128;
}
}
return core.String.fromCharCodes(codeUnits);
}
- static _normalize(component, start, end, charTable) {
+ static _normalizeOrSubstring(component, start, end, charTable) {
+ let l = core._Uri._normalize(component, start, end, charTable);
+ return l != null ? l : component[dartx.substring](start, end);
+ }
+ static _normalize(component, start, end, charTable, opts) {
+ let escapeDelimiters = opts && 'escapeDelimiters' in opts ? opts.escapeDelimiters : false;
let buffer = null;
let sectionStart = start;
let index = start;
@@ -34017,8 +34326,8 @@
} else {
let replacement = null;
let sourceLength = null;
- if (char == core.Uri._PERCENT) {
- replacement = core.Uri._normalizeEscape(component, index, false);
+ if (char == core._PERCENT) {
+ replacement = core._Uri._normalizeEscape(component, index, false);
if (replacement == null) {
index = dart.notNull(index) + 3;
continue;
@@ -34029,8 +34338,8 @@
} else {
sourceLength = 3;
}
- } else if (dart.test(core.Uri._isGeneralDelimiter(char))) {
- core.Uri._fail(component, index, "Invalid character");
+ } else if (!dart.test(escapeDelimiters) && dart.test(core._Uri._isGeneralDelimiter(char))) {
+ core._Uri._fail(component, index, "Invalid character");
} else {
sourceLength = 1;
if ((dart.notNull(char) & 64512) == 55296) {
@@ -34042,7 +34351,7 @@
}
}
}
- replacement = core.Uri._escapeChar(char);
+ replacement = core._Uri._escapeChar(char);
}
if (buffer == null) buffer = new core.StringBuffer();
buffer.write(component[dartx.substring](sectionStart, index));
@@ -34052,7 +34361,7 @@
}
}
if (buffer == null) {
- return component[dartx.substring](start, end);
+ return null;
}
if (dart.notNull(sectionStart) < dart.notNull(end)) {
buffer.write(component[dartx.substring](sectionStart, end));
@@ -34060,10 +34369,10 @@
return dart.toString(buffer);
}
static _isSchemeCharacter(ch) {
- return dart.notNull(ch) < 128 && (dart.notNull(core.Uri._schemeTable[dartx._get](ch[dartx['>>']](4))) & 1 << (dart.notNull(ch) & 15)) != 0;
+ return dart.notNull(ch) < 128 && (dart.notNull(core._Uri._schemeTable[dartx._get](ch[dartx['>>']](4))) & 1 << (dart.notNull(ch) & 15)) != 0;
}
static _isGeneralDelimiter(ch) {
- return dart.notNull(ch) <= core.Uri._RIGHT_BRACKET && (dart.notNull(core.Uri._genDelimitersTable[dartx._get](ch[dartx['>>']](4))) & 1 << (dart.notNull(ch) & 15)) != 0;
+ return dart.notNull(ch) <= core._RIGHT_BRACKET && (dart.notNull(core._Uri._genDelimitersTable[dartx._get](ch[dartx['>>']](4))) & 1 << (dart.notNull(ch) & 15)) != 0;
}
get isAbsolute() {
return this.scheme != "" && this.fragment == "";
@@ -34082,7 +34391,7 @@
break;
}
let delta = dart.notNull(baseEnd) - dart.notNull(newEnd);
- if ((delta == 2 || delta == 3) && base[dartx.codeUnitAt](dart.notNull(newEnd) + 1) == core.Uri._DOT && (delta == 2 || base[dartx.codeUnitAt](dart.notNull(newEnd) + 2) == core.Uri._DOT)) {
+ if ((delta == 2 || delta == 3) && base[dartx.codeUnitAt](dart.notNull(newEnd) + 1) == core._DOT && (delta == 2 || base[dartx.codeUnitAt](dart.notNull(newEnd) + 2) == core._DOT)) {
break;
}
baseEnd = newEnd;
@@ -34096,7 +34405,7 @@
return index != -1;
}
static _removeDotSegments(path) {
- if (!dart.test(core.Uri._mayContainDotSegments(path))) return path;
+ if (!dart.test(core._Uri._mayContainDotSegments(path))) return path;
dart.assert(path[dartx.isNotEmpty]);
let output = JSArrayOfString().of([]);
let appendSlash = false;
@@ -34119,9 +34428,12 @@
if (appendSlash) output[dartx.add]("");
return output[dartx.join]("/");
}
- static _normalizeRelativePath(path) {
+ static _normalizeRelativePath(path, allowScheme) {
dart.assert(!dart.test(path[dartx.startsWith]('/')));
- if (!dart.test(core.Uri._mayContainDotSegments(path))) return path;
+ if (!dart.test(core._Uri._mayContainDotSegments(path))) {
+ if (!dart.test(allowScheme)) path = core._Uri._escapeScheme(path);
+ return path;
+ }
dart.assert(path[dartx.isNotEmpty]);
let output = JSArrayOfString().of([]);
let appendSlash = false;
@@ -34144,8 +34456,23 @@
return "./";
}
if (appendSlash || output[dartx.last] == '..') output[dartx.add]("");
+ if (!dart.test(allowScheme)) output[dartx._set](0, core._Uri._escapeScheme(output[dartx._get](0)));
return output[dartx.join]("/");
}
+ static _escapeScheme(path) {
+ if (dart.notNull(path[dartx.length]) >= 2 && dart.test(core._Uri._isAlphabeticCharacter(path[dartx.codeUnitAt](0)))) {
+ for (let i = 1; i < dart.notNull(path[dartx.length]); i++) {
+ let char = path[dartx.codeUnitAt](i);
+ if (char == core._COLON) {
+ return dart.str`${path[dartx.substring](0, i)}%3A${path[dartx.substring](i + 1)}`;
+ }
+ if (dart.notNull(char) > 127 || (dart.notNull(core._Uri._schemeTable[dartx._get](char[dartx['>>']](4))) & 1 << (dart.notNull(char) & 15)) == 0) {
+ break;
+ }
+ }
+ }
+ return path;
+ }
resolve(reference) {
return this.resolveUri(core.Uri.parse(reference));
}
@@ -34163,7 +34490,7 @@
targetHost = reference.host;
targetPort = dart.test(reference.hasPort) ? reference.port : null;
}
- targetPath = core.Uri._removeDotSegments(reference.path);
+ targetPath = core._Uri._removeDotSegments(reference.path);
if (dart.test(reference.hasQuery)) {
targetQuery = reference.query;
}
@@ -34172,15 +34499,15 @@
if (dart.test(reference.hasAuthority)) {
targetUserInfo = reference.userInfo;
targetHost = reference.host;
- targetPort = core.Uri._makePort(dart.test(reference.hasPort) ? reference.port : null, targetScheme);
- targetPath = core.Uri._removeDotSegments(reference.path);
+ targetPort = core._Uri._makePort(dart.test(reference.hasPort) ? reference.port : null, targetScheme);
+ targetPath = core._Uri._removeDotSegments(reference.path);
if (dart.test(reference.hasQuery)) targetQuery = reference.query;
} else {
targetUserInfo = this[_userInfo];
targetHost = this[_host];
targetPort = this[_port];
if (reference.path == "") {
- targetPath = this[_path];
+ targetPath = this.path;
if (dart.test(reference.hasQuery)) {
targetQuery = reference.query;
} else {
@@ -34188,20 +34515,24 @@
}
} else {
if (dart.test(reference.hasAbsolutePath)) {
- targetPath = core.Uri._removeDotSegments(reference.path);
+ targetPath = core._Uri._removeDotSegments(reference.path);
} else {
if (dart.test(this.hasEmptyPath)) {
- if (!dart.test(this.hasScheme) && !dart.test(this.hasAuthority)) {
- targetPath = reference.path;
+ if (!dart.test(this.hasAuthority)) {
+ if (!dart.test(this.hasScheme)) {
+ targetPath = reference.path;
+ } else {
+ targetPath = core._Uri._removeDotSegments(reference.path);
+ }
} else {
- targetPath = core.Uri._removeDotSegments("/" + dart.notNull(reference.path));
+ targetPath = core._Uri._removeDotSegments("/" + dart.notNull(reference.path));
}
} else {
- let mergedPath = this[_mergePaths](this[_path], reference.path);
+ let mergedPath = this[_mergePaths](this.path, reference.path);
if (dart.test(this.hasScheme) || dart.test(this.hasAuthority) || dart.test(this.hasAbsolutePath)) {
- targetPath = core.Uri._removeDotSegments(mergedPath);
+ targetPath = core._Uri._removeDotSegments(mergedPath);
} else {
- targetPath = core.Uri._normalizeRelativePath(mergedPath);
+ targetPath = core._Uri._normalizeRelativePath(mergedPath, dart.test(this.hasScheme) || dart.test(this.hasAuthority));
}
}
}
@@ -34210,7 +34541,7 @@
}
}
let fragment = dart.test(reference.hasFragment) ? reference.fragment : null;
- return new core.Uri._internal(targetScheme, targetUserInfo, targetHost, targetPort, targetPath, targetQuery, fragment);
+ return new core._Uri._internal(targetScheme, targetUserInfo, targetHost, targetPort, targetPath, targetQuery, fragment);
}
get hasScheme() {
return this.scheme[dartx.isNotEmpty];
@@ -34228,18 +34559,21 @@
return this[_fragment] != null;
}
get hasEmptyPath() {
- return this[_path][dartx.isEmpty];
+ return this.path[dartx.isEmpty];
}
get hasAbsolutePath() {
- return this[_path][dartx.startsWith]('/');
+ return this.path[dartx.startsWith]('/');
}
get origin() {
- if (this.scheme == "" || this[_host] == null || this[_host] == "") {
+ if (this.scheme == "") {
dart.throw(new core.StateError(dart.str`Cannot use origin without a scheme: ${this}`));
}
if (this.scheme != "http" && this.scheme != "https") {
dart.throw(new core.StateError(dart.str`Origin is only applicable schemes http and https: ${this}`));
}
+ if (this[_host] == null || this[_host] == "") {
+ dart.throw(new core.StateError(dart.str`A ${this.scheme}: URI should have a non-empty host name: ${this}`));
+ }
if (this[_port] == null) return dart.str`${this.scheme}://${this[_host]}`;
return dart.str`${this.scheme}://${this[_host]}:${this[_port]}`;
}
@@ -34254,43 +34588,46 @@
if (this.fragment != "") {
dart.throw(new core.UnsupportedError("Cannot extract a file path from a URI with a fragment component"));
}
- if (windows == null) windows = core.Uri._isWindows;
- return dart.test(windows) ? this[_toWindowsFilePath]() : this[_toFilePath]();
+ if (windows == null) windows = core._Uri._isWindows;
+ return dart.test(windows) ? core._Uri._toWindowsFilePath(this) : this[_toFilePath]();
}
[_toFilePath]() {
- if (this.host != "") {
+ if (dart.test(this.hasAuthority) && this.host != "") {
dart.throw(new core.UnsupportedError("Cannot extract a non-Windows file path from a file URI " + "with an authority"));
}
- core.Uri._checkNonWindowsPathReservedCharacters(this.pathSegments, false);
+ let pathSegments = this.pathSegments;
+ core._Uri._checkNonWindowsPathReservedCharacters(pathSegments, false);
let result = new core.StringBuffer();
- if (dart.test(this[_isPathAbsolute])) result.write("/");
- result.writeAll(this.pathSegments, "/");
+ if (dart.test(this.hasAbsolutePath)) result.write("/");
+ result.writeAll(pathSegments, "/");
return result.toString();
}
- [_toWindowsFilePath]() {
+ static _toWindowsFilePath(uri) {
let hasDriveLetter = false;
- let segments = this.pathSegments;
- if (dart.notNull(segments[dartx.length]) > 0 && segments[dartx._get](0)[dartx.length] == 2 && segments[dartx._get](0)[dartx.codeUnitAt](1) == core.Uri._COLON) {
- core.Uri._checkWindowsDriveLetter(segments[dartx._get](0)[dartx.codeUnitAt](0), false);
- core.Uri._checkWindowsPathReservedCharacters(segments, false, 1);
+ let segments = uri.pathSegments;
+ if (dart.notNull(segments[dartx.length]) > 0 && segments[dartx._get](0)[dartx.length] == 2 && segments[dartx._get](0)[dartx.codeUnitAt](1) == core._COLON) {
+ core._Uri._checkWindowsDriveLetter(segments[dartx._get](0)[dartx.codeUnitAt](0), false);
+ core._Uri._checkWindowsPathReservedCharacters(segments, false, 1);
hasDriveLetter = true;
} else {
- core.Uri._checkWindowsPathReservedCharacters(segments, false);
+ core._Uri._checkWindowsPathReservedCharacters(segments, false, 0);
}
let result = new core.StringBuffer();
- if (dart.test(this[_isPathAbsolute]) && !hasDriveLetter) result.write("\\");
- if (this.host != "") {
- result.write("\\");
- result.write(this.host);
- result.write("\\");
+ if (dart.test(uri.hasAbsolutePath) && !hasDriveLetter) result.write("\\");
+ if (dart.test(uri.hasAuthority)) {
+ let host = uri.host;
+ if (dart.test(host[dartx.isNotEmpty])) {
+ result.write("\\");
+ result.write(host);
+ result.write("\\");
+ }
}
result.writeAll(segments, "\\");
if (hasDriveLetter && segments[dartx.length] == 1) result.write("\\");
return result.toString();
}
get [_isPathAbsolute]() {
- if (this.path == null || dart.test(this.path[dartx.isEmpty])) return false;
- return this.path[dartx.startsWith]('/');
+ return this.path != null && dart.test(this.path[dartx.startsWith]('/'));
}
[_writeAuthority](ss) {
if (dart.test(this[_userInfo][dartx.isNotEmpty])) {
@@ -34307,9 +34644,17 @@
return this.scheme == "data" ? core.UriData.fromUri(this) : null;
}
toString() {
+ let t = this[_text];
+ return t == null ? this[_text] = this[_initializeText]() : t;
+ }
+ [_initializeText]() {
+ dart.assert(this[_text] == null);
let sb = new core.StringBuffer();
- core.Uri._addIfNonEmpty(sb, this.scheme, this.scheme, ':');
- if (dart.test(this.hasAuthority) || dart.test(this.path[dartx.startsWith]("//")) || this.scheme == "file") {
+ if (dart.test(this.scheme[dartx.isNotEmpty])) {
+ sb.write(this.scheme);
+ sb.write(":");
+ }
+ if (dart.test(this.hasAuthority) || this.scheme == "file") {
sb.write("//");
this[_writeAuthority](sb);
}
@@ -34325,58 +34670,16 @@
return sb.toString();
}
['=='](other) {
- if (!core.Uri.is(other)) return false;
- let uri = core.Uri._check(other);
- return this.scheme == uri.scheme && this.hasAuthority == uri.hasAuthority && this.userInfo == uri.userInfo && this.host == uri.host && this.port == uri.port && this.path == uri.path && this.hasQuery == uri.hasQuery && this.query == uri.query && this.hasFragment == uri.hasFragment && this.fragment == uri.fragment;
+ if (core.identical(this, other)) return true;
+ if (core.Uri.is(other)) {
+ let uri = other;
+ return this.scheme == uri.scheme && this.hasAuthority == uri.hasAuthority && this.userInfo == uri.userInfo && this.host == uri.host && this.port == uri.port && this.path == uri.path && this.hasQuery == uri.hasQuery && this.query == uri.query && this.hasFragment == uri.hasFragment && this.fragment == uri.fragment;
+ }
+ return false;
}
get hashCode() {
- function combine(part, current) {
- return core.int._check(dart.dsend(dart.dsend(dart.dsend(current, '*', 31), '+', dart.hashCode(part)), '&', 1073741823));
- }
- dart.fn(combine, dynamicAnddynamicToint());
- return combine(this.scheme, combine(this.userInfo, combine(this.host, combine(this.port, combine(this.path, combine(this.query, combine(this.fragment, 1)))))));
- }
- static _addIfNonEmpty(sb, test, first, second) {
- if ("" != test) {
- sb.write(first);
- sb.write(second);
- }
- }
- static encodeComponent(component) {
- return core.Uri._uriEncode(core.Uri._unreserved2396Table, component, convert.UTF8, false);
- }
- static encodeQueryComponent(component, opts) {
- let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
- return core.Uri._uriEncode(core.Uri._unreservedTable, component, encoding, true);
- }
- static decodeComponent(encodedComponent) {
- return core.Uri._uriDecode(encodedComponent, 0, encodedComponent[dartx.length], convert.UTF8, false);
- }
- static decodeQueryComponent(encodedComponent, opts) {
- let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
- return core.Uri._uriDecode(encodedComponent, 0, encodedComponent[dartx.length], encoding, true);
- }
- static encodeFull(uri) {
- return core.Uri._uriEncode(core.Uri._encodeFullTable, uri, convert.UTF8, false);
- }
- static decodeFull(uri) {
- return core.Uri._uriDecode(uri, 0, uri[dartx.length], convert.UTF8, false);
- }
- static splitQueryString(query, opts) {
- let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
- return query[dartx.split]("&")[dartx.fold](MapOfString$String())(dart.map({}, core.String, core.String), dart.fn((map, element) => {
- let index = element[dartx.indexOf]("=");
- if (index == -1) {
- if (element != "") {
- map[dartx._set](core.Uri.decodeQueryComponent(element, {encoding: encoding}), "");
- }
- } else if (index != 0) {
- let key = element[dartx.substring](0, index);
- let value = element[dartx.substring](dart.notNull(index) + 1);
- map[dartx._set](core.Uri.decodeQueryComponent(key, {encoding: encoding}), core.Uri.decodeQueryComponent(value, {encoding: encoding}));
- }
- return map;
- }, MapOfString$StringAndStringToMapOfString$String()));
+ let t = this[_hashCodeCache];
+ return t == null ? this[_hashCodeCache] = dart.hashCode(this.toString()) : t;
}
static _createList() {
return [];
@@ -34392,22 +34695,20 @@
let value = null;
if (start == end) return;
if (dart.notNull(equalsIndex) < 0) {
- key = core.Uri._uriDecode(query, start, end, encoding, true);
+ key = core._Uri._uriDecode(query, start, end, encoding, true);
value = "";
} else {
- key = core.Uri._uriDecode(query, start, equalsIndex, encoding, true);
- value = core.Uri._uriDecode(query, dart.notNull(equalsIndex) + 1, end, encoding, true);
+ key = core._Uri._uriDecode(query, start, equalsIndex, encoding, true);
+ value = core._Uri._uriDecode(query, dart.notNull(equalsIndex) + 1, end, encoding, true);
}
- dart.dsend(result[dartx.putIfAbsent](key, core.Uri._createList), 'add', value);
+ dart.dsend(result[dartx.putIfAbsent](key, core._Uri._createList), 'add', value);
}
dart.fn(parsePair, intAndintAndintTovoid());
- let _equals = 61;
- let _ampersand = 38;
while (i < dart.notNull(query[dartx.length])) {
let char = query[dartx.codeUnitAt](i);
- if (char == _equals) {
+ if (char == core._EQUALS) {
if (equalsIndex < 0) equalsIndex = i;
- } else if (char == _ampersand) {
+ } else if (char == core._AMPERSAND) {
parsePair(start, equalsIndex, i);
start = i + 1;
equalsIndex = -1;
@@ -34417,125 +34718,17 @@
parsePair(start, equalsIndex, i);
return result;
}
- static parseIPv4Address(host) {
- function error(msg) {
- dart.throw(new core.FormatException(dart.str`Illegal IPv4 address, ${msg}`));
- }
- dart.fn(error, StringTovoid$());
- let bytes = host[dartx.split]('.');
- if (bytes[dartx.length] != 4) {
- error('IPv4 address should contain exactly 4 parts');
- }
- return bytes[dartx.map](core.int)(dart.fn(byteString => {
- let byte = core.int.parse(byteString);
- if (dart.notNull(byte) < 0 || dart.notNull(byte) > 255) {
- error('each part must be in the range of `0..255`');
- }
- return byte;
- }, StringToint$()))[dartx.toList]();
- }
- static parseIPv6Address(host, start, end) {
- if (start === void 0) start = 0;
- if (end === void 0) end = null;
- if (end == null) end = host[dartx.length];
- function error(msg, position) {
- if (position === void 0) position = null;
- dart.throw(new core.FormatException(dart.str`Illegal IPv6 address, ${msg}`, host, core.int._check(position)));
- }
- dart.fn(error, String__Tovoid());
- function parseHex(start, end) {
- if (dart.notNull(end) - dart.notNull(start) > 4) {
- error('an IPv6 part can only contain a maximum of 4 hex digits', start);
- }
- let value = core.int.parse(host[dartx.substring](start, end), {radix: 16});
- if (dart.notNull(value) < 0 || dart.notNull(value) > (1 << 16) - 1) {
- error('each part must be in the range of `0x0..0xFFFF`', start);
- }
- return value;
- }
- dart.fn(parseHex, intAndintToint());
- if (dart.notNull(host[dartx.length]) < 2) error('address is too short');
- let parts = JSArrayOfint().of([]);
- let wildcardSeen = false;
- let partStart = start;
- for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(i) + 1) {
- if (host[dartx.codeUnitAt](i) == core.Uri._COLON) {
- if (i == start) {
- i = dart.notNull(i) + 1;
- if (host[dartx.codeUnitAt](i) != core.Uri._COLON) {
- error('invalid start colon.', i);
- }
- partStart = i;
- }
- if (i == partStart) {
- if (wildcardSeen) {
- error('only one wildcard `::` is allowed', i);
- }
- wildcardSeen = true;
- parts[dartx.add](-1);
- } else {
- parts[dartx.add](parseHex(partStart, i));
- }
- partStart = dart.notNull(i) + 1;
- }
- }
- if (parts[dartx.length] == 0) error('too few parts');
- let atEnd = partStart == end;
- let isLastWildcard = parts[dartx.last] == -1;
- if (atEnd && !isLastWildcard) {
- error('expected a part after last `:`', end);
- }
- if (!atEnd) {
- try {
- parts[dartx.add](parseHex(partStart, end));
- } catch (e) {
- try {
- let last = core.Uri.parseIPv4Address(host[dartx.substring](partStart, end));
- parts[dartx.add]((dart.notNull(last[dartx._get](0)) << 8 | dart.notNull(last[dartx._get](1))) >>> 0);
- parts[dartx.add]((dart.notNull(last[dartx._get](2)) << 8 | dart.notNull(last[dartx._get](3))) >>> 0);
- } catch (e) {
- error('invalid end of IPv6 address.', partStart);
- }
-
- }
-
- }
- if (wildcardSeen) {
- if (dart.notNull(parts[dartx.length]) > 7) {
- error('an address with a wildcard must have less than 7 parts');
- }
- } else if (parts[dartx.length] != 8) {
- error('an address without a wildcard must contain exactly 8 parts');
- }
- let bytes = typed_data.Uint8List.new(16);
- for (let i = 0, index = 0; i < dart.notNull(parts[dartx.length]); i++) {
- let value = parts[dartx._get](i);
- if (value == -1) {
- let wildCardLength = 9 - dart.notNull(parts[dartx.length]);
- for (let j = 0; j < wildCardLength; j++) {
- bytes[dartx._set](index, 0);
- bytes[dartx._set](index + 1, 0);
- index = index + 2;
- }
- } else {
- bytes[dartx._set](index, value[dartx['>>']](8));
- bytes[dartx._set](index + 1, dart.notNull(value) & 255);
- index = index + 2;
- }
- }
- return bytes;
- }
static _uriEncode(canonicalTable, text, encoding, spaceToPlus) {
- if (core.identical(encoding, convert.UTF8) && dart.test(core.Uri._needsNoEncoding.hasMatch(text))) {
+ if (core.identical(encoding, convert.UTF8) && dart.test(core._Uri._needsNoEncoding.hasMatch(text))) {
return text;
}
- let result = new core.StringBuffer();
+ let result = new core.StringBuffer('');
let bytes = encoding.encode(text);
for (let i = 0; i < dart.notNull(bytes[dartx.length]); i++) {
let byte = bytes[dartx._get](i);
if (dart.notNull(byte) < 128 && (dart.notNull(canonicalTable[dartx._get](byte[dartx['>>']](4))) & 1 << (dart.notNull(byte) & 15)) != 0) {
result.writeCharCode(byte);
- } else if (dart.test(spaceToPlus) && byte == core.Uri._SPACE) {
+ } else if (dart.test(spaceToPlus) && byte == core._SPACE) {
result.write('+');
} else {
let hexDigits = '0123456789ABCDEF';
@@ -34571,7 +34764,7 @@
let simple = true;
for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(i) + 1) {
let codeUnit = text[dartx.codeUnitAt](i);
- if (dart.notNull(codeUnit) > 127 || codeUnit == core.Uri._PERCENT || dart.test(plusToSpace) && codeUnit == core.Uri._PLUS) {
+ if (dart.notNull(codeUnit) > 127 || codeUnit == core._PERCENT || dart.test(plusToSpace) && codeUnit == core._PLUS) {
simple = false;
break;
}
@@ -34590,14 +34783,14 @@
if (dart.notNull(codeUnit) > 127) {
dart.throw(new core.ArgumentError("Illegal percent encoding in URI"));
}
- if (codeUnit == core.Uri._PERCENT) {
+ if (codeUnit == core._PERCENT) {
if (dart.notNull(i) + 3 > dart.notNull(text[dartx.length])) {
dart.throw(new core.ArgumentError('Truncated URI'));
}
- bytes[dartx.add](core.Uri._hexCharPairToByte(text, dart.notNull(i) + 1));
+ bytes[dartx.add](core._Uri._hexCharPairToByte(text, dart.notNull(i) + 1));
i = dart.notNull(i) + 2;
- } else if (dart.test(plusToSpace) && codeUnit == core.Uri._PLUS) {
- bytes[dartx.add](core.Uri._SPACE);
+ } else if (dart.test(plusToSpace) && codeUnit == core._PLUS) {
+ bytes[dartx.add](core._SPACE);
} else {
bytes[dartx.add](codeUnit);
}
@@ -34607,23 +34800,26 @@
}
static _isAlphabeticCharacter(codeUnit) {
let lowerCase = (dart.notNull(codeUnit) | 32) >>> 0;
- return core.Uri._LOWER_CASE_A <= lowerCase && lowerCase <= core.Uri._LOWER_CASE_Z;
+ return core._LOWER_CASE_A <= lowerCase && lowerCase <= core._LOWER_CASE_Z;
}
static _isUnreservedChar(char) {
- return dart.notNull(char) < 127 && (dart.notNull(core.Uri._unreservedTable[dartx._get](char[dartx['>>']](4))) & 1 << (dart.notNull(char) & 15)) != 0;
+ return dart.notNull(char) < 127 && (dart.notNull(core._Uri._unreservedTable[dartx._get](char[dartx['>>']](4))) & 1 << (dart.notNull(char) & 15)) != 0;
}
};
-dart.defineNamedConstructor(core.Uri, '_internal');
-dart.setSignature(core.Uri, {
+dart.defineNamedConstructor(core._Uri, '_internal');
+core._Uri[dart.implements] = () => [core.Uri];
+dart.setSignature(core._Uri, {
fields: () => ({
scheme: core.String,
[_userInfo]: core.String,
[_host]: core.String,
[_port]: core.int,
- [_path]: core.String,
+ path: core.String,
[_query]: core.String,
[_fragment]: core.String,
[_pathSegments]: ListOfString(),
+ [_text]: core.String,
+ [_hashCodeCache]: core.int,
[_queryParameters]: MapOfString$String(),
[_queryParameterLists]: MapOfString$ListOfString()
}),
@@ -34632,7 +34828,6 @@
userInfo: dart.definiteFunctionType(core.String, []),
host: dart.definiteFunctionType(core.String, []),
port: dart.definiteFunctionType(core.int, []),
- path: dart.definiteFunctionType(core.String, []),
query: dart.definiteFunctionType(core.String, []),
fragment: dart.definiteFunctionType(core.String, []),
pathSegments: dart.definiteFunctionType(core.List$(core.String), []),
@@ -34651,6 +34846,7 @@
data: dart.definiteFunctionType(core.UriData, [])
}),
methods: () => ({
+ isScheme: dart.definiteFunctionType(core.bool, [core.String]),
replace: dart.definiteFunctionType(core.Uri, [], {scheme: core.String, userInfo: core.String, host: core.String, port: core.int, path: core.String, pathSegments: IterableOfString(), query: core.String, queryParameters: MapOfString$dynamic(), fragment: core.String}),
removeFragment: dart.definiteFunctionType(core.Uri, []),
normalizePath: dart.definiteFunctionType(core.Uri, []),
@@ -34659,12 +34855,12 @@
resolveUri: dart.definiteFunctionType(core.Uri, [core.Uri]),
toFilePath: dart.definiteFunctionType(core.String, [], {windows: core.bool}),
[_toFilePath]: dart.definiteFunctionType(core.String, []),
- [_toWindowsFilePath]: dart.definiteFunctionType(core.String, []),
- [_writeAuthority]: dart.definiteFunctionType(dart.void, [core.StringSink])
+ [_writeAuthority]: dart.definiteFunctionType(dart.void, [core.StringSink]),
+ [_initializeText]: dart.definiteFunctionType(core.String, [])
}),
statics: () => ({
_defaultPort: dart.definiteFunctionType(core.int, [core.String]),
- parse: dart.definiteFunctionType(core.Uri, [core.String], [core.int, core.int]),
+ _compareScheme: dart.definiteFunctionType(core.bool, [core.String, core.String]),
_fail: dart.definiteFunctionType(dart.void, [core.String, core.int, core.String]),
_makeHttpUri: dart.definiteFunctionType(core.Uri, [core.String, core.String, core.String, MapOfString$String()]),
_checkNonWindowsPathReservedCharacters: dart.definiteFunctionType(dart.dynamic, [ListOfString(), core.bool]),
@@ -34677,85 +34873,50 @@
_isRegNameChar: dart.definiteFunctionType(core.bool, [core.int]),
_normalizeRegName: dart.definiteFunctionType(core.String, [core.String, core.int, core.int]),
_makeScheme: dart.definiteFunctionType(core.String, [core.String, core.int, core.int]),
+ _canonicalizeScheme: dart.definiteFunctionType(core.String, [core.String]),
_makeUserInfo: dart.definiteFunctionType(core.String, [core.String, core.int, core.int]),
_makePath: dart.definiteFunctionType(core.String, [core.String, core.int, core.int, IterableOfString(), core.String, core.bool]),
_normalizePath: dart.definiteFunctionType(core.String, [core.String, core.String, core.bool]),
_makeQuery: dart.definiteFunctionType(core.String, [core.String, core.int, core.int, MapOfString$dynamic()]),
_makeFragment: dart.definiteFunctionType(core.String, [core.String, core.int, core.int]),
- _stringOrNullLength: dart.definiteFunctionType(core.int, [core.String]),
_normalizeEscape: dart.definiteFunctionType(core.String, [core.String, core.int, core.bool]),
- _parseHexDigit: dart.definiteFunctionType(core.int, [core.int]),
_escapeChar: dart.definiteFunctionType(core.String, [core.int]),
- _normalize: dart.definiteFunctionType(core.String, [core.String, core.int, core.int, ListOfint()]),
+ _normalizeOrSubstring: dart.definiteFunctionType(core.String, [core.String, core.int, core.int, ListOfint()]),
+ _normalize: dart.definiteFunctionType(core.String, [core.String, core.int, core.int, ListOfint()], {escapeDelimiters: core.bool}),
_isSchemeCharacter: dart.definiteFunctionType(core.bool, [core.int]),
_isGeneralDelimiter: dart.definiteFunctionType(core.bool, [core.int]),
_mayContainDotSegments: dart.definiteFunctionType(core.bool, [core.String]),
_removeDotSegments: dart.definiteFunctionType(core.String, [core.String]),
- _normalizeRelativePath: dart.definiteFunctionType(core.String, [core.String]),
- _addIfNonEmpty: dart.definiteFunctionType(dart.void, [core.StringBuffer, core.String, core.String, core.String]),
- encodeComponent: dart.definiteFunctionType(core.String, [core.String]),
- encodeQueryComponent: dart.definiteFunctionType(core.String, [core.String], {encoding: convert.Encoding}),
- decodeComponent: dart.definiteFunctionType(core.String, [core.String]),
- decodeQueryComponent: dart.definiteFunctionType(core.String, [core.String], {encoding: convert.Encoding}),
- encodeFull: dart.definiteFunctionType(core.String, [core.String]),
- decodeFull: dart.definiteFunctionType(core.String, [core.String]),
- splitQueryString: dart.definiteFunctionType(core.Map$(core.String, core.String), [core.String], {encoding: convert.Encoding}),
+ _normalizeRelativePath: dart.definiteFunctionType(core.String, [core.String, core.bool]),
+ _escapeScheme: dart.definiteFunctionType(core.String, [core.String]),
+ _toWindowsFilePath: dart.definiteFunctionType(core.String, [core.Uri]),
_createList: dart.definiteFunctionType(core.List, []),
_splitQueryStringAll: dart.definiteFunctionType(core.Map, [core.String], {encoding: convert.Encoding}),
- parseIPv4Address: dart.definiteFunctionType(core.List$(core.int), [core.String]),
- parseIPv6Address: dart.definiteFunctionType(core.List$(core.int), [core.String], [core.int, core.int]),
_uriEncode: dart.definiteFunctionType(core.String, [ListOfint(), core.String, convert.Encoding, core.bool]),
_hexCharPairToByte: dart.definiteFunctionType(core.int, [core.String, core.int]),
_uriDecode: dart.definiteFunctionType(core.String, [core.String, core.int, core.int, convert.Encoding, core.bool]),
_isAlphabeticCharacter: dart.definiteFunctionType(core.bool, [core.int]),
_isUnreservedChar: dart.definiteFunctionType(core.bool, [core.int])
}),
- names: ['_defaultPort', 'parse', '_fail', '_makeHttpUri', '_checkNonWindowsPathReservedCharacters', '_checkWindowsPathReservedCharacters', '_checkWindowsDriveLetter', '_makeFileUri', '_makeWindowsFileUrl', '_makePort', '_makeHost', '_isRegNameChar', '_normalizeRegName', '_makeScheme', '_makeUserInfo', '_makePath', '_normalizePath', '_makeQuery', '_makeFragment', '_stringOrNullLength', '_normalizeEscape', '_parseHexDigit', '_escapeChar', '_normalize', '_isSchemeCharacter', '_isGeneralDelimiter', '_mayContainDotSegments', '_removeDotSegments', '_normalizeRelativePath', '_addIfNonEmpty', 'encodeComponent', 'encodeQueryComponent', 'decodeComponent', 'decodeQueryComponent', 'encodeFull', 'decodeFull', 'splitQueryString', '_createList', '_splitQueryStringAll', 'parseIPv4Address', 'parseIPv6Address', '_uriEncode', '_hexCharPairToByte', '_uriDecode', '_isAlphabeticCharacter', '_isUnreservedChar']
+ names: ['_defaultPort', '_compareScheme', '_fail', '_makeHttpUri', '_checkNonWindowsPathReservedCharacters', '_checkWindowsPathReservedCharacters', '_checkWindowsDriveLetter', '_makeFileUri', '_makeWindowsFileUrl', '_makePort', '_makeHost', '_isRegNameChar', '_normalizeRegName', '_makeScheme', '_canonicalizeScheme', '_makeUserInfo', '_makePath', '_normalizePath', '_makeQuery', '_makeFragment', '_normalizeEscape', '_escapeChar', '_normalizeOrSubstring', '_normalize', '_isSchemeCharacter', '_isGeneralDelimiter', '_mayContainDotSegments', '_removeDotSegments', '_normalizeRelativePath', '_escapeScheme', '_toWindowsFilePath', '_createList', '_splitQueryStringAll', '_uriEncode', '_hexCharPairToByte', '_uriDecode', '_isAlphabeticCharacter', '_isUnreservedChar']
});
-core.Uri._SPACE = 32;
-core.Uri._DOUBLE_QUOTE = 34;
-core.Uri._NUMBER_SIGN = 35;
-core.Uri._PERCENT = 37;
-core.Uri._ASTERISK = 42;
-core.Uri._PLUS = 43;
-core.Uri._DOT = 46;
-core.Uri._SLASH = 47;
-core.Uri._ZERO = 48;
-core.Uri._NINE = 57;
-core.Uri._COLON = 58;
-core.Uri._LESS = 60;
-core.Uri._GREATER = 62;
-core.Uri._QUESTION = 63;
-core.Uri._AT_SIGN = 64;
-core.Uri._UPPER_CASE_A = 65;
-core.Uri._UPPER_CASE_F = 70;
-core.Uri._UPPER_CASE_Z = 90;
-core.Uri._LEFT_BRACKET = 91;
-core.Uri._BACKSLASH = 92;
-core.Uri._RIGHT_BRACKET = 93;
-core.Uri._LOWER_CASE_A = 97;
-core.Uri._LOWER_CASE_F = 102;
-core.Uri._LOWER_CASE_Z = 122;
-core.Uri._BAR = 124;
-core.Uri._hexDigits = "0123456789ABCDEF";
-core.Uri._unreservedTable = dart.constList([0, 0, 24576, 1023, 65534, 34815, 65534, 18431], core.int);
-core.Uri._unreserved2396Table = dart.constList([0, 0, 26498, 1023, 65534, 34815, 65534, 18431], core.int);
-core.Uri._encodeFullTable = dart.constList([0, 0, 65498, 45055, 65535, 34815, 65534, 18431], core.int);
-core.Uri._schemeTable = dart.constList([0, 0, 26624, 1023, 65534, 2047, 65534, 2047], core.int);
-core.Uri._schemeLowerTable = dart.constList([0, 0, 26624, 1023, 0, 0, 65534, 2047], core.int);
-core.Uri._subDelimitersTable = dart.constList([0, 0, 32722, 11263, 65534, 34815, 65534, 18431], core.int);
-core.Uri._genDelimitersTable = dart.constList([0, 0, 32776, 33792, 1, 10240, 0, 0], core.int);
-core.Uri._userinfoTable = dart.constList([0, 0, 32722, 12287, 65534, 34815, 65534, 18431], core.int);
-core.Uri._regNameTable = dart.constList([0, 0, 32754, 11263, 65534, 34815, 65534, 18431], core.int);
-core.Uri._pathCharTable = dart.constList([0, 0, 32722, 12287, 65535, 34815, 65534, 18431], core.int);
-core.Uri._pathCharOrSlashTable = dart.constList([0, 0, 65490, 12287, 65535, 34815, 65534, 18431], core.int);
-core.Uri._queryCharTable = dart.constList([0, 0, 65490, 45055, 65535, 34815, 65534, 18431], core.int);
-dart.defineLazy(core.Uri, {
+core._Uri._unreservedTable = dart.constList([0, 0, 24576, 1023, 65534, 34815, 65534, 18431], core.int);
+core._Uri._unreserved2396Table = dart.constList([0, 0, 26498, 1023, 65534, 34815, 65534, 18431], core.int);
+core._Uri._encodeFullTable = dart.constList([0, 0, 65498, 45055, 65535, 34815, 65534, 18431], core.int);
+core._Uri._schemeTable = dart.constList([0, 0, 26624, 1023, 65534, 2047, 65534, 2047], core.int);
+core._Uri._schemeLowerTable = dart.constList([0, 0, 26624, 1023, 0, 0, 65534, 2047], core.int);
+core._Uri._subDelimitersTable = dart.constList([0, 0, 32722, 11263, 65534, 34815, 65534, 18431], core.int);
+core._Uri._genDelimitersTable = dart.constList([0, 0, 32776, 33792, 1, 10240, 0, 0], core.int);
+core._Uri._userinfoTable = dart.constList([0, 0, 32722, 12287, 65534, 34815, 65534, 18431], core.int);
+core._Uri._regNameTable = dart.constList([0, 0, 32754, 11263, 65534, 34815, 65534, 18431], core.int);
+core._Uri._pathCharTable = dart.constList([0, 0, 32722, 12287, 65535, 34815, 65534, 18431], core.int);
+core._Uri._pathCharOrSlashTable = dart.constList([0, 0, 65490, 12287, 65535, 34815, 65534, 18431], core.int);
+core._Uri._queryCharTable = dart.constList([0, 0, 65490, 45055, 65535, 34815, 65534, 18431], core.int);
+dart.defineLazy(core._Uri, {
get _needsNoEncoding() {
return core.RegExp.new('^[\\-\\.0-9A-Z_a-z~]*$');
}
});
-const _text = Symbol('_text');
const _separatorIndices = Symbol('_separatorIndices');
const _uriCache = Symbol('_uriCache');
core.UriData = class UriData extends core.Object {
@@ -34839,9 +35000,9 @@
if (dart.notNull(slashIndex) < 0) {
dart.throw(new core.ArgumentError.value(mimeType, "mimeType", "Invalid MIME type"));
}
- buffer.write(core.Uri._uriEncode(core.UriData._tokenCharTable, mimeType[dartx.substring](0, slashIndex), convert.UTF8, false));
+ buffer.write(core._Uri._uriEncode(core.UriData._tokenCharTable, mimeType[dartx.substring](0, slashIndex), convert.UTF8, false));
buffer.write("/");
- buffer.write(core.Uri._uriEncode(core.UriData._tokenCharTable, mimeType[dartx.substring](dart.notNull(slashIndex) + 1), convert.UTF8, false));
+ buffer.write(core._Uri._uriEncode(core.UriData._tokenCharTable, mimeType[dartx.substring](dart.notNull(slashIndex) + 1), convert.UTF8, false));
}
if (charsetName != null) {
if (indices != null) {
@@ -34849,7 +35010,7 @@
indices[dartx.add](dart.notNull(buffer.length) + 8);
}
buffer.write(";charset=");
- buffer.write(core.Uri._uriEncode(core.UriData._tokenCharTable, charsetName, convert.UTF8, false));
+ buffer.write(core._Uri._uriEncode(core.UriData._tokenCharTable, charsetName, convert.UTF8, false));
}
dart.nullSafe(parameters, _ => _[dartx.forEach](dart.fn((key, value) => {
if (dart.test(key[dartx.isEmpty])) {
@@ -34860,17 +35021,17 @@
}
if (indices != null) indices[dartx.add](buffer.length);
buffer.write(';');
- buffer.write(core.Uri._uriEncode(core.UriData._tokenCharTable, key, convert.UTF8, false));
+ buffer.write(core._Uri._uriEncode(core.UriData._tokenCharTable, key, convert.UTF8, false));
if (indices != null) indices[dartx.add](buffer.length);
buffer.write('=');
- buffer.write(core.Uri._uriEncode(core.UriData._tokenCharTable, value, convert.UTF8, false));
+ buffer.write(core._Uri._uriEncode(core.UriData._tokenCharTable, value, convert.UTF8, false));
}, StringAndStringToNull())));
}
static _validateMimeType(mimeType) {
let slashIndex = -1;
for (let i = 0; i < dart.notNull(mimeType[dartx.length]); i++) {
let char = mimeType[dartx.codeUnitAt](i);
- if (char != core.Uri._SLASH) continue;
+ if (char != core._SLASH) continue;
if (slashIndex < 0) {
slashIndex = i;
continue;
@@ -34880,10 +35041,16 @@
return slashIndex;
}
static parse(uri) {
- if (!dart.test(uri[dartx.startsWith]("data:"))) {
- dart.throw(new core.FormatException("Does not start with 'data:'", uri, 0));
+ if (dart.notNull(uri[dartx.length]) >= 5) {
+ let dataDelta = core._startsWithData(uri, 0);
+ if (dataDelta == 0) {
+ return core.UriData._parse(uri, 5, null);
+ }
+ if (dataDelta == 32) {
+ return core.UriData._parse(uri[dartx.substring](5), 0, null);
+ }
}
- return core.UriData._parse(uri, 5, null);
+ dart.throw(new core.FormatException("Does not start with 'data:'", uri, 0));
}
get uri() {
if (this[_uriCache] != null) return this[_uriCache];
@@ -34891,20 +35058,20 @@
let query = null;
let colonIndex = this[_separatorIndices][dartx._get](0);
let queryIndex = this[_text][dartx.indexOf]('?', dart.notNull(colonIndex) + 1);
- let end = null;
+ let end = this[_text][dartx.length];
if (dart.notNull(queryIndex) >= 0) {
- query = this[_text][dartx.substring](dart.notNull(queryIndex) + 1);
+ query = core._Uri._normalizeOrSubstring(this[_text], dart.notNull(queryIndex) + 1, end, core._Uri._queryCharTable);
end = queryIndex;
}
- path = this[_text][dartx.substring](dart.notNull(colonIndex) + 1, end);
- this[_uriCache] = new core.Uri._internal("data", "", null, null, path, query, null);
+ path = core._Uri._normalizeOrSubstring(this[_text], dart.notNull(colonIndex) + 1, end, core._Uri._pathCharOrSlashTable);
+ this[_uriCache] = new core._DataUri(this, path, query);
return this[_uriCache];
}
get mimeType() {
let start = dart.notNull(this[_separatorIndices][dartx._get](0)) + 1;
let end = this[_separatorIndices][dartx._get](1);
if (start == end) return "text/plain";
- return core.Uri._uriDecode(this[_text], start, end, convert.UTF8, false);
+ return core._Uri._uriDecode(this[_text], start, end, convert.UTF8, false);
}
get charset() {
let parameterStart = 1;
@@ -34916,7 +35083,7 @@
let keyStart = dart.notNull(this[_separatorIndices][dartx._get](i)) + 1;
let keyEnd = this[_separatorIndices][dartx._get](i + 1);
if (keyEnd == keyStart + 7 && dart.test(this[_text][dartx.startsWith]("charset", keyStart))) {
- return core.Uri._uriDecode(this[_text], dart.notNull(keyEnd) + 1, this[_separatorIndices][dartx._get](i + 2), convert.UTF8, false);
+ return core._Uri._uriDecode(this[_text], dart.notNull(keyEnd) + 1, this[_separatorIndices][dartx._get](i + 2), convert.UTF8, false);
}
}
return "US-ASCII";
@@ -34954,10 +35121,8 @@
result[dartx._set](index++, codeUnit);
} else {
if (i + 2 < dart.notNull(text[dartx.length])) {
- let digit1 = core.Uri._parseHexDigit(text[dartx.codeUnitAt](i + 1));
- let digit2 = core.Uri._parseHexDigit(text[dartx.codeUnitAt](i + 2));
- if (dart.notNull(digit1) >= 0 && dart.notNull(digit2) >= 0) {
- let byte = dart.notNull(digit1) * 16 + dart.notNull(digit2);
+ let byte = _internal.parseHexByte(text, i + 1);
+ if (dart.notNull(byte) >= 0) {
result[dartx._set](index++, byte);
i = i + 2;
continue;
@@ -34984,7 +35149,7 @@
let converter = convert.BASE64.decoder.fuse(core.String)(encoding.decoder);
return converter.convert(text[dartx.substring](start));
}
- return core.Uri._uriDecode(text, start, text[dartx.length], encoding, false);
+ return core._Uri._uriDecode(text, start, text[dartx.length], encoding, false);
}
get parameters() {
let result = dart.map({}, core.String, core.String);
@@ -34992,8 +35157,8 @@
let start = dart.notNull(this[_separatorIndices][dartx._get](i - 2)) + 1;
let equals = this[_separatorIndices][dartx._get](i - 1);
let end = this[_separatorIndices][dartx._get](i);
- let key = core.Uri._uriDecode(this[_text], start, equals, convert.UTF8, false);
- let value = core.Uri._uriDecode(this[_text], dart.notNull(equals) + 1, end, convert.UTF8, false);
+ let key = core._Uri._uriDecode(this[_text], start, equals, convert.UTF8, false);
+ let value = core._Uri._uriDecode(this[_text], dart.notNull(equals) + 1, end, convert.UTF8, false);
result[dartx._set](key, value);
}
return result;
@@ -35046,6 +35211,15 @@
}
}
indices[dartx.add](i);
+ let isBase64 = indices[dartx.length][dartx.isOdd];
+ if (dart.test(isBase64)) {
+ text = convert.BASE64.normalize(text, dart.notNull(i) + 1, text[dartx.length]);
+ } else {
+ let data = core._Uri._normalize(text, dart.notNull(i) + 1, text[dartx.length], core.UriData._uricTable, {escapeDelimiters: true});
+ if (data != null) {
+ text = text[dartx.replaceRange](dart.notNull(i) + 1, text[dartx.length], data);
+ }
+ }
return new core.UriData._(text, indices, sourceUri);
}
static _uriEncodeBytes(canonicalTable, bytes, buffer) {
@@ -35056,9 +35230,9 @@
if (dart.notNull(byte) < 128 && (dart.notNull(canonicalTable[dartx._get](byte[dartx['>>']](4))) & 1 << (dart.notNull(byte) & 15)) != 0) {
buffer.writeCharCode(byte);
} else {
- buffer.writeCharCode(core.Uri._PERCENT);
- buffer.writeCharCode(core.Uri._hexDigits[dartx.codeUnitAt](byte[dartx['>>']](4)));
- buffer.writeCharCode(core.Uri._hexDigits[dartx.codeUnitAt](dart.notNull(byte) & 15));
+ buffer.writeCharCode(core._PERCENT);
+ buffer.writeCharCode(core._hexDigits[dartx.codeUnitAt](byte[dartx['>>']](4)));
+ buffer.writeCharCode(core._hexDigits[dartx.codeUnitAt](dart.notNull(byte) & 15));
}
}
if ((dart.notNull(byteOr) & ~255) != 0) {
@@ -35104,7 +35278,667 @@
});
core.UriData._noScheme = -1;
core.UriData._tokenCharTable = dart.constList([0, 0, 27858, 1023, 65534, 51199, 65535, 32767], core.int);
-core.UriData._uricTable = core.Uri._queryCharTable;
+core.UriData._uricTable = core._Uri._queryCharTable;
+core.UriData._base64Table = dart.constList([0, 0, 34816, 1023, 65534, 2047, 65534, 2047], core.int);
+core._schemeEndIndex = 1;
+core._hostStartIndex = 2;
+core._portStartIndex = 3;
+core._pathStartIndex = 4;
+core._queryStartIndex = 5;
+core._fragmentStartIndex = 6;
+core._notSimpleIndex = 7;
+core._uriStart = 0;
+core._nonSimpleEndStates = 14;
+core._schemeStart = 20;
+dart.defineLazy(core, {
+ get _scannerTables() {
+ return core._createTables();
+ }
+});
+core._createTables = function() {
+ let stateCount = 22;
+ let schemeOrPath = 1;
+ let authOrPath = 2;
+ let authOrPathSlash = 3;
+ let uinfoOrHost0 = 4;
+ let uinfoOrHost = 5;
+ let uinfoOrPort0 = 6;
+ let uinfoOrPort = 7;
+ let ipv6Host = 8;
+ let relPathSeg = 9;
+ let pathSeg = 10;
+ let path = 11;
+ let query = 12;
+ let fragment = 13;
+ let schemeOrPathDot = 14;
+ let schemeOrPathDot2 = 15;
+ let relPathSegDot = 16;
+ let relPathSegDot2 = 17;
+ let pathSegDot = 18;
+ let pathSegDot2 = 19;
+ let scheme0 = core._schemeStart;
+ let scheme = 21;
+ let schemeEnd = core._schemeEndIndex << 5;
+ let hostStart = core._hostStartIndex << 5;
+ let portStart = core._portStartIndex << 5;
+ let pathStart = core._pathStartIndex << 5;
+ let queryStart = core._queryStartIndex << 5;
+ let fragmentStart = core._fragmentStartIndex << 5;
+ let notSimple = core._notSimpleIndex << 5;
+ let unreserved = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-._~";
+ let subDelims = "!$&'()*+,;=";
+ let pchar = dart.str`${unreserved}${subDelims}`;
+ let tables = ListOfUint8List().generate(stateCount, dart.fn(_ => typed_data.Uint8List.new(96), intToUint8List()));
+ function build(state, defaultTransition) {
+ return (() => {
+ let _ = tables[dartx._get](core.int._check(state));
+ _[dartx.fillRange](0, 96, core.int._check(defaultTransition));
+ return _;
+ })();
+ }
+ dart.fn(build, dynamicAnddynamicToUint8List());
+ function setChars(target, chars, transition) {
+ for (let i = 0; i < dart.notNull(chars[dartx.length]); i++) {
+ let char = chars[dartx.codeUnitAt](i);
+ target[dartx._set]((dart.notNull(char) ^ 96) >>> 0, transition);
+ }
+ }
+ dart.fn(setChars, Uint8ListAndStringAndintTovoid());
+ function setRange(target, range, transition) {
+ for (let i = range[dartx.codeUnitAt](0), n = range[dartx.codeUnitAt](1); dart.notNull(i) <= dart.notNull(n); i = dart.notNull(i) + 1) {
+ target[dartx._set]((dart.notNull(i) ^ 96) >>> 0, transition);
+ }
+ }
+ dart.fn(setRange, Uint8ListAndStringAndintTovoid());
+ let b = null;
+ b = build(core._uriStart, (schemeOrPath | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), pchar, schemeOrPath);
+ setChars(typed_data.Uint8List._check(b), ".", schemeOrPathDot);
+ setChars(typed_data.Uint8List._check(b), ":", (authOrPath | schemeEnd) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "/", authOrPathSlash);
+ setChars(typed_data.Uint8List._check(b), "?", (query | queryStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "#", (fragment | fragmentStart) >>> 0);
+ b = build(schemeOrPathDot, (schemeOrPath | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), pchar, schemeOrPath);
+ setChars(typed_data.Uint8List._check(b), ".", schemeOrPathDot2);
+ setChars(typed_data.Uint8List._check(b), ':', (authOrPath | schemeEnd) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "/", (pathSeg | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "?", (query | queryStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "#", (fragment | fragmentStart) >>> 0);
+ b = build(schemeOrPathDot2, (schemeOrPath | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), pchar, schemeOrPath);
+ setChars(typed_data.Uint8List._check(b), "%", (schemeOrPath | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), ':', (authOrPath | schemeEnd) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "/", relPathSeg);
+ setChars(typed_data.Uint8List._check(b), "?", (query | queryStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "#", (fragment | fragmentStart) >>> 0);
+ b = build(schemeOrPath, (schemeOrPath | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), pchar, schemeOrPath);
+ setChars(typed_data.Uint8List._check(b), ':', (authOrPath | schemeEnd) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "/", pathSeg);
+ setChars(typed_data.Uint8List._check(b), "?", (query | queryStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "#", (fragment | fragmentStart) >>> 0);
+ b = build(authOrPath, (path | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), pchar, (path | pathStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "/", (authOrPathSlash | pathStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), ".", (pathSegDot | pathStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "?", (query | queryStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "#", (fragment | fragmentStart) >>> 0);
+ b = build(authOrPathSlash, (path | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), pchar, path);
+ setChars(typed_data.Uint8List._check(b), "/", (uinfoOrHost0 | hostStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), ".", pathSegDot);
+ setChars(typed_data.Uint8List._check(b), "?", (query | queryStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "#", (fragment | fragmentStart) >>> 0);
+ b = build(uinfoOrHost0, (uinfoOrHost | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), pchar, uinfoOrHost);
+ setRange(typed_data.Uint8List._check(b), "AZ", (uinfoOrHost | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), ":", (uinfoOrPort0 | portStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "@", (uinfoOrHost0 | hostStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "[", (ipv6Host | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "/", (pathSeg | pathStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "?", (query | queryStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "#", (fragment | fragmentStart) >>> 0);
+ b = build(uinfoOrHost, (uinfoOrHost | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), pchar, uinfoOrHost);
+ setRange(typed_data.Uint8List._check(b), "AZ", (uinfoOrHost | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), ":", (uinfoOrPort0 | portStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "@", (uinfoOrHost0 | hostStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "/", (pathSeg | pathStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "?", (query | queryStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "#", (fragment | fragmentStart) >>> 0);
+ b = build(uinfoOrPort0, (uinfoOrPort | notSimple) >>> 0);
+ setRange(typed_data.Uint8List._check(b), "19", uinfoOrPort);
+ setChars(typed_data.Uint8List._check(b), "@", (uinfoOrHost0 | hostStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "/", (pathSeg | pathStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "?", (query | queryStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "#", (fragment | fragmentStart) >>> 0);
+ b = build(uinfoOrPort, (uinfoOrPort | notSimple) >>> 0);
+ setRange(typed_data.Uint8List._check(b), "09", uinfoOrPort);
+ setChars(typed_data.Uint8List._check(b), "@", (uinfoOrHost0 | hostStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "/", (pathSeg | pathStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "?", (query | queryStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "#", (fragment | fragmentStart) >>> 0);
+ b = build(ipv6Host, ipv6Host);
+ setChars(typed_data.Uint8List._check(b), "]", uinfoOrHost);
+ b = build(relPathSeg, (path | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), pchar, path);
+ setChars(typed_data.Uint8List._check(b), ".", relPathSegDot);
+ setChars(typed_data.Uint8List._check(b), "/", (pathSeg | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "?", (query | queryStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "#", (fragment | fragmentStart) >>> 0);
+ b = build(relPathSegDot, (path | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), pchar, path);
+ setChars(typed_data.Uint8List._check(b), ".", relPathSegDot2);
+ setChars(typed_data.Uint8List._check(b), "/", (pathSeg | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "?", (query | queryStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "#", (fragment | fragmentStart) >>> 0);
+ b = build(relPathSegDot2, (path | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), pchar, path);
+ setChars(typed_data.Uint8List._check(b), "/", relPathSeg);
+ setChars(typed_data.Uint8List._check(b), "?", (query | queryStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "#", (fragment | fragmentStart) >>> 0);
+ b = build(pathSeg, (path | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), pchar, path);
+ setChars(typed_data.Uint8List._check(b), ".", pathSegDot);
+ setChars(typed_data.Uint8List._check(b), "/", (pathSeg | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "?", (query | queryStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "#", (fragment | fragmentStart) >>> 0);
+ b = build(pathSegDot, (path | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), pchar, path);
+ setChars(typed_data.Uint8List._check(b), ".", pathSegDot2);
+ setChars(typed_data.Uint8List._check(b), "/", (pathSeg | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "?", (query | queryStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "#", (fragment | fragmentStart) >>> 0);
+ b = build(pathSegDot2, (path | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), pchar, path);
+ setChars(typed_data.Uint8List._check(b), "/", (pathSeg | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "?", (query | queryStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "#", (fragment | fragmentStart) >>> 0);
+ b = build(path, (path | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), pchar, path);
+ setChars(typed_data.Uint8List._check(b), "/", pathSeg);
+ setChars(typed_data.Uint8List._check(b), "?", (query | queryStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "#", (fragment | fragmentStart) >>> 0);
+ b = build(query, (query | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), pchar, query);
+ setChars(typed_data.Uint8List._check(b), "?", query);
+ setChars(typed_data.Uint8List._check(b), "#", (fragment | fragmentStart) >>> 0);
+ b = build(fragment, (fragment | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), pchar, fragment);
+ setChars(typed_data.Uint8List._check(b), "?", fragment);
+ b = build(scheme0, (scheme | notSimple) >>> 0);
+ setRange(typed_data.Uint8List._check(b), "az", scheme);
+ b = build(scheme, (scheme | notSimple) >>> 0);
+ setRange(typed_data.Uint8List._check(b), "az", scheme);
+ setRange(typed_data.Uint8List._check(b), "09", scheme);
+ setChars(typed_data.Uint8List._check(b), "+-.", scheme);
+ return tables;
+};
+dart.lazyFn(core._createTables, () => VoidToListOfUint8List());
+core._scan = function(uri, start, end, state, indices) {
+ let tables = core._scannerTables;
+ dart.assert(dart.notNull(end) <= dart.notNull(uri[dartx.length]));
+ for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(i) + 1) {
+ let table = tables[dartx._get](state);
+ let char = (dart.notNull(uri[dartx.codeUnitAt](i)) ^ 96) >>> 0;
+ if (char > 95) char = 31;
+ let transition = table[dartx._get](char);
+ state = dart.notNull(transition) & 31;
+ indices[dartx._set](transition[dartx['>>']](5), i);
+ }
+ return state;
+};
+dart.fn(core._scan, StringAndintAndint__Toint());
+const _uri = Symbol('_uri');
+const _schemeEnd = Symbol('_schemeEnd');
+const _hostStart = Symbol('_hostStart');
+const _portStart = Symbol('_portStart');
+const _pathStart = Symbol('_pathStart');
+const _queryStart = Symbol('_queryStart');
+const _fragmentStart = Symbol('_fragmentStart');
+const _schemeCache = Symbol('_schemeCache');
+const _isFile = Symbol('_isFile');
+const _isHttp = Symbol('_isHttp');
+const _isHttps = Symbol('_isHttps');
+const _isPackage = Symbol('_isPackage');
+const _isScheme = Symbol('_isScheme');
+let const$52;
+let const$53;
+let const$54;
+const _isPort = Symbol('_isPort');
+const _simpleMerge = Symbol('_simpleMerge');
+const _toNonSimple = Symbol('_toNonSimple');
+core._SimpleUri = class _SimpleUri extends core.Object {
+ new(uri, schemeEnd, hostStart, portStart, pathStart, queryStart, fragmentStart, schemeCache) {
+ this[_uri] = uri;
+ this[_schemeEnd] = schemeEnd;
+ this[_hostStart] = hostStart;
+ this[_portStart] = portStart;
+ this[_pathStart] = pathStart;
+ this[_queryStart] = queryStart;
+ this[_fragmentStart] = fragmentStart;
+ this[_schemeCache] = schemeCache;
+ this[_hashCodeCache] = null;
+ }
+ get hasScheme() {
+ return dart.notNull(this[_schemeEnd]) > 0;
+ }
+ get hasAuthority() {
+ return dart.notNull(this[_hostStart]) > 0;
+ }
+ get hasUserInfo() {
+ return dart.notNull(this[_hostStart]) > dart.notNull(this[_schemeEnd]) + 4;
+ }
+ get hasPort() {
+ return dart.notNull(this[_hostStart]) > 0 && dart.notNull(this[_portStart]) + 1 < dart.notNull(this[_pathStart]);
+ }
+ get hasQuery() {
+ return dart.notNull(this[_queryStart]) < dart.notNull(this[_fragmentStart]);
+ }
+ get hasFragment() {
+ return dart.notNull(this[_fragmentStart]) < dart.notNull(this[_uri][dartx.length]);
+ }
+ get [_isFile]() {
+ return this[_schemeEnd] == 4 && dart.test(this[_uri][dartx.startsWith]("file"));
+ }
+ get [_isHttp]() {
+ return this[_schemeEnd] == 4 && dart.test(this[_uri][dartx.startsWith]("http"));
+ }
+ get [_isHttps]() {
+ return this[_schemeEnd] == 5 && dart.test(this[_uri][dartx.startsWith]("https"));
+ }
+ get [_isPackage]() {
+ return this[_schemeEnd] == 7 && dart.test(this[_uri][dartx.startsWith]("package"));
+ }
+ [_isScheme](scheme) {
+ return this[_schemeEnd] == scheme[dartx.length] && dart.test(this[_uri][dartx.startsWith](scheme));
+ }
+ get hasAbsolutePath() {
+ return this[_uri][dartx.startsWith]("/", this[_pathStart]);
+ }
+ get hasEmptyPath() {
+ return this[_pathStart] == this[_queryStart];
+ }
+ get isAbsolute() {
+ return dart.test(this.hasScheme) && !dart.test(this.hasFragment);
+ }
+ isScheme(scheme) {
+ if (scheme == null || dart.test(scheme[dartx.isEmpty])) return dart.notNull(this[_schemeEnd]) < 0;
+ if (scheme[dartx.length] != this[_schemeEnd]) return false;
+ return core._Uri._compareScheme(scheme, this[_uri]);
+ }
+ get scheme() {
+ if (dart.notNull(this[_schemeEnd]) <= 0) return "";
+ if (this[_schemeCache] != null) return this[_schemeCache];
+ if (dart.test(this[_isHttp])) {
+ this[_schemeCache] = "http";
+ } else if (dart.test(this[_isHttps])) {
+ this[_schemeCache] = "https";
+ } else if (dart.test(this[_isFile])) {
+ this[_schemeCache] = "file";
+ } else if (dart.test(this[_isPackage])) {
+ this[_schemeCache] = "package";
+ } else {
+ this[_schemeCache] = this[_uri][dartx.substring](0, this[_schemeEnd]);
+ }
+ return this[_schemeCache];
+ }
+ get authority() {
+ return dart.notNull(this[_hostStart]) > 0 ? this[_uri][dartx.substring](dart.notNull(this[_schemeEnd]) + 3, this[_pathStart]) : "";
+ }
+ get userInfo() {
+ return dart.notNull(this[_hostStart]) > dart.notNull(this[_schemeEnd]) + 3 ? this[_uri][dartx.substring](dart.notNull(this[_schemeEnd]) + 3, dart.notNull(this[_hostStart]) - 1) : "";
+ }
+ get host() {
+ return dart.notNull(this[_hostStart]) > 0 ? this[_uri][dartx.substring](this[_hostStart], this[_portStart]) : "";
+ }
+ get port() {
+ if (dart.test(this.hasPort)) return core.int.parse(this[_uri][dartx.substring](dart.notNull(this[_portStart]) + 1, this[_pathStart]));
+ if (dart.test(this[_isHttp])) return 80;
+ if (dart.test(this[_isHttps])) return 443;
+ return 0;
+ }
+ get path() {
+ return this[_uri][dartx.substring](this[_pathStart], this[_queryStart]);
+ }
+ get query() {
+ return dart.notNull(this[_queryStart]) < dart.notNull(this[_fragmentStart]) ? this[_uri][dartx.substring](dart.notNull(this[_queryStart]) + 1, this[_fragmentStart]) : "";
+ }
+ get fragment() {
+ return dart.notNull(this[_fragmentStart]) < dart.notNull(this[_uri][dartx.length]) ? this[_uri][dartx.substring](dart.notNull(this[_fragmentStart]) + 1) : "";
+ }
+ get origin() {
+ let isHttp = this[_isHttp];
+ if (dart.notNull(this[_schemeEnd]) < 0) {
+ dart.throw(new core.StateError(dart.str`Cannot use origin without a scheme: ${this}`));
+ }
+ if (!dart.test(isHttp) && !dart.test(this[_isHttps])) {
+ dart.throw(new core.StateError(dart.str`Origin is only applicable schemes http and https: ${this}`));
+ }
+ if (this[_hostStart] == this[_portStart]) {
+ dart.throw(new core.StateError(dart.str`A ${this.scheme}: URI should have a non-empty host name: ${this}`));
+ }
+ if (this[_hostStart] == dart.notNull(this[_schemeEnd]) + 3) {
+ return this[_uri][dartx.substring](0, this[_pathStart]);
+ }
+ return dart.notNull(this[_uri][dartx.substring](0, dart.notNull(this[_schemeEnd]) + 3)) + dart.notNull(this[_uri][dartx.substring](this[_hostStart], this[_pathStart]));
+ }
+ get pathSegments() {
+ let start = this[_pathStart];
+ let end = this[_queryStart];
+ if (dart.test(this[_uri][dartx.startsWith]("/", start))) {
+ start = dart.notNull(start) + 1;
+ }
+ if (start == end) return const$52 || (const$52 = dart.constList([], core.String));
+ let parts = JSArrayOfString().of([]);
+ for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(i) + 1) {
+ let char = this[_uri][dartx.codeUnitAt](i);
+ if (char == core._SLASH) {
+ parts[dartx.add](this[_uri][dartx.substring](start, i));
+ start = dart.notNull(i) + 1;
+ }
+ }
+ parts[dartx.add](this[_uri][dartx.substring](start, end));
+ return ListOfString().unmodifiable(parts);
+ }
+ get queryParameters() {
+ if (!dart.test(this.hasQuery)) return const$53 || (const$53 = dart.const(dart.map({}, core.String, core.String)));
+ return new (UnmodifiableMapViewOfString$String())(core.Uri.splitQueryString(this.query));
+ }
+ get queryParametersAll() {
+ if (!dart.test(this.hasQuery)) return const$54 || (const$54 = dart.const(dart.map({}, core.String, ListOfString())));
+ let queryParameterLists = core._Uri._splitQueryStringAll(this.query);
+ for (let key of queryParameterLists[dartx.keys]) {
+ queryParameterLists[dartx._set](key, ListOfString().unmodifiable(core.Iterable._check(queryParameterLists[dartx._get](key))));
+ }
+ return MapOfString$ListOfString().unmodifiable(queryParameterLists);
+ }
+ [_isPort](port) {
+ let portDigitStart = dart.notNull(this[_portStart]) + 1;
+ return portDigitStart + dart.notNull(port[dartx.length]) == this[_pathStart] && dart.test(this[_uri][dartx.startsWith](port, portDigitStart));
+ }
+ normalizePath() {
+ return this;
+ }
+ removeFragment() {
+ if (!dart.test(this.hasFragment)) return this;
+ return new core._SimpleUri(this[_uri][dartx.substring](0, this[_fragmentStart]), this[_schemeEnd], this[_hostStart], this[_portStart], this[_pathStart], this[_queryStart], this[_fragmentStart], this[_schemeCache]);
+ }
+ replace(opts) {
+ let scheme = opts && 'scheme' in opts ? opts.scheme : null;
+ let userInfo = opts && 'userInfo' in opts ? opts.userInfo : null;
+ let host = opts && 'host' in opts ? opts.host : null;
+ let port = opts && 'port' in opts ? opts.port : null;
+ let path = opts && 'path' in opts ? opts.path : null;
+ let pathSegments = opts && 'pathSegments' in opts ? opts.pathSegments : null;
+ let query = opts && 'query' in opts ? opts.query : null;
+ let queryParameters = opts && 'queryParameters' in opts ? opts.queryParameters : null;
+ let fragment = opts && 'fragment' in opts ? opts.fragment : null;
+ let schemeChanged = false;
+ if (scheme != null) {
+ scheme = core._Uri._makeScheme(scheme, 0, scheme[dartx.length]);
+ schemeChanged = !dart.test(this[_isScheme](scheme));
+ } else {
+ scheme = this.scheme;
+ }
+ let isFile = scheme == "file";
+ if (userInfo != null) {
+ userInfo = core._Uri._makeUserInfo(userInfo, 0, userInfo[dartx.length]);
+ } else if (dart.notNull(this[_hostStart]) > 0) {
+ userInfo = this[_uri][dartx.substring](dart.notNull(this[_schemeEnd]) + 3, this[_hostStart]);
+ } else {
+ userInfo = "";
+ }
+ if (port != null) {
+ port = core._Uri._makePort(port, scheme);
+ } else {
+ port = dart.test(this.hasPort) ? this.port : null;
+ if (schemeChanged) {
+ port = core._Uri._makePort(port, scheme);
+ }
+ }
+ if (host != null) {
+ host = core._Uri._makeHost(host, 0, host[dartx.length], false);
+ } else if (dart.notNull(this[_hostStart]) > 0) {
+ host = this[_uri][dartx.substring](this[_hostStart], this[_portStart]);
+ } else if (dart.test(userInfo[dartx.isNotEmpty]) || port != null || isFile) {
+ host = "";
+ }
+ let hasAuthority = host != null;
+ if (path != null || pathSegments != null) {
+ path = core._Uri._makePath(path, 0, core._stringOrNullLength(path), pathSegments, scheme, hasAuthority);
+ } else {
+ path = this[_uri][dartx.substring](this[_pathStart], this[_queryStart]);
+ if ((isFile || hasAuthority && !dart.test(path[dartx.isEmpty])) && !dart.test(path[dartx.startsWith]('/'))) {
+ path = "/" + dart.notNull(path);
+ }
+ }
+ if (query != null || queryParameters != null) {
+ query = core._Uri._makeQuery(query, 0, core._stringOrNullLength(query), queryParameters);
+ } else if (dart.notNull(this[_queryStart]) < dart.notNull(this[_fragmentStart])) {
+ query = this[_uri][dartx.substring](dart.notNull(this[_queryStart]) + 1, this[_fragmentStart]);
+ }
+ if (fragment != null) {
+ fragment = core._Uri._makeFragment(fragment, 0, fragment[dartx.length]);
+ } else if (dart.notNull(this[_fragmentStart]) < dart.notNull(this[_uri][dartx.length])) {
+ fragment = this[_uri][dartx.substring](dart.notNull(this[_fragmentStart]) + 1);
+ }
+ return new core._Uri._internal(scheme, userInfo, host, port, path, query, fragment);
+ }
+ resolve(reference) {
+ return this.resolveUri(core.Uri.parse(reference));
+ }
+ resolveUri(reference) {
+ if (core._SimpleUri.is(reference)) {
+ return this[_simpleMerge](this, reference);
+ }
+ return this[_toNonSimple]().resolveUri(reference);
+ }
+ [_simpleMerge](base, ref) {
+ if (dart.test(ref.hasScheme)) return ref;
+ if (dart.test(ref.hasAuthority)) {
+ if (!dart.test(base.hasScheme)) return ref;
+ let isSimple = true;
+ if (dart.test(base[_isFile])) {
+ isSimple = !dart.test(ref.hasEmptyPath);
+ } else if (dart.test(base[_isHttp])) {
+ isSimple = !dart.test(ref[_isPort]("80"));
+ } else if (dart.test(base[_isHttps])) {
+ isSimple = !dart.test(ref[_isPort]("443"));
+ }
+ if (isSimple) {
+ let delta = dart.notNull(base[_schemeEnd]) + 1;
+ let newUri = dart.notNull(base[_uri][dartx.substring](0, dart.notNull(base[_schemeEnd]) + 1)) + dart.notNull(ref[_uri][dartx.substring](dart.notNull(ref[_schemeEnd]) + 1));
+ return new core._SimpleUri(newUri, base[_schemeEnd], dart.notNull(ref[_hostStart]) + delta, dart.notNull(ref[_portStart]) + delta, dart.notNull(ref[_pathStart]) + delta, dart.notNull(ref[_queryStart]) + delta, dart.notNull(ref[_fragmentStart]) + delta, base[_schemeCache]);
+ } else {
+ return this[_toNonSimple]().resolveUri(ref);
+ }
+ }
+ if (dart.test(ref.hasEmptyPath)) {
+ if (dart.test(ref.hasQuery)) {
+ let delta = dart.notNull(base[_queryStart]) - dart.notNull(ref[_queryStart]);
+ let newUri = dart.notNull(base[_uri][dartx.substring](0, base[_queryStart])) + dart.notNull(ref[_uri][dartx.substring](ref[_queryStart]));
+ return new core._SimpleUri(newUri, base[_schemeEnd], base[_hostStart], base[_portStart], base[_pathStart], dart.notNull(ref[_queryStart]) + delta, dart.notNull(ref[_fragmentStart]) + delta, base[_schemeCache]);
+ }
+ if (dart.test(ref.hasFragment)) {
+ let delta = dart.notNull(base[_fragmentStart]) - dart.notNull(ref[_fragmentStart]);
+ let newUri = dart.notNull(base[_uri][dartx.substring](0, base[_fragmentStart])) + dart.notNull(ref[_uri][dartx.substring](ref[_fragmentStart]));
+ return new core._SimpleUri(newUri, base[_schemeEnd], base[_hostStart], base[_portStart], base[_pathStart], base[_queryStart], dart.notNull(ref[_fragmentStart]) + delta, base[_schemeCache]);
+ }
+ return base.removeFragment();
+ }
+ if (dart.test(ref.hasAbsolutePath)) {
+ let delta = dart.notNull(base[_pathStart]) - dart.notNull(ref[_pathStart]);
+ let newUri = dart.notNull(base[_uri][dartx.substring](0, base[_pathStart])) + dart.notNull(ref[_uri][dartx.substring](ref[_pathStart]));
+ return new core._SimpleUri(newUri, base[_schemeEnd], base[_hostStart], base[_portStart], base[_pathStart], dart.notNull(ref[_queryStart]) + delta, dart.notNull(ref[_fragmentStart]) + delta, base[_schemeCache]);
+ }
+ if (dart.test(base.hasEmptyPath) && dart.test(base.hasAuthority)) {
+ let refStart = ref[_pathStart];
+ while (dart.test(ref[_uri][dartx.startsWith]("../", refStart))) {
+ refStart = dart.notNull(refStart) + 3;
+ }
+ let delta = dart.notNull(base[_pathStart]) - dart.notNull(refStart) + 1;
+ let newUri = dart.str`${base[_uri][dartx.substring](0, base[_pathStart])}/` + dart.str`${ref[_uri][dartx.substring](refStart)}`;
+ return new core._SimpleUri(newUri, base[_schemeEnd], base[_hostStart], base[_portStart], base[_pathStart], dart.notNull(ref[_queryStart]) + delta, dart.notNull(ref[_fragmentStart]) + delta, base[_schemeCache]);
+ }
+ let baseUri = base[_uri];
+ let refUri = ref[_uri];
+ let baseStart = base[_pathStart];
+ let baseEnd = base[_queryStart];
+ while (dart.test(baseUri[dartx.startsWith]("../", baseStart))) {
+ baseStart = dart.notNull(baseStart) + 3;
+ }
+ let refStart = ref[_pathStart];
+ let refEnd = ref[_queryStart];
+ let backCount = 0;
+ while (dart.notNull(refStart) + 3 <= dart.notNull(refEnd) && dart.test(refUri[dartx.startsWith]("../", refStart))) {
+ refStart = dart.notNull(refStart) + 3;
+ backCount = backCount + 1;
+ }
+ let insert = "";
+ while (dart.notNull(baseEnd) > dart.notNull(baseStart)) {
+ baseEnd = dart.notNull(baseEnd) - 1;
+ let char = baseUri[dartx.codeUnitAt](baseEnd);
+ if (char == core._SLASH) {
+ insert = "/";
+ if (backCount == 0) break;
+ backCount--;
+ }
+ }
+ if (baseEnd == baseStart && !dart.test(base.hasScheme) && !dart.test(base.hasAbsolutePath)) {
+ insert = "";
+ refStart = dart.notNull(refStart) - backCount * 3;
+ }
+ let delta = dart.notNull(baseEnd) - dart.notNull(refStart) + dart.notNull(insert[dartx.length]);
+ let newUri = dart.str`${base[_uri][dartx.substring](0, baseEnd)}${insert}` + dart.str`${ref[_uri][dartx.substring](refStart)}`;
+ return new core._SimpleUri(newUri, base[_schemeEnd], base[_hostStart], base[_portStart], base[_pathStart], dart.notNull(ref[_queryStart]) + delta, dart.notNull(ref[_fragmentStart]) + delta, base[_schemeCache]);
+ }
+ toFilePath(opts) {
+ let windows = opts && 'windows' in opts ? opts.windows : null;
+ if (dart.notNull(this[_schemeEnd]) >= 0 && !dart.test(this[_isFile])) {
+ dart.throw(new core.UnsupportedError(dart.str`Cannot extract a file path from a ${this.scheme} URI`));
+ }
+ if (dart.notNull(this[_queryStart]) < dart.notNull(this[_uri][dartx.length])) {
+ if (dart.notNull(this[_queryStart]) < dart.notNull(this[_fragmentStart])) {
+ dart.throw(new core.UnsupportedError("Cannot extract a file path from a URI with a query component"));
+ }
+ dart.throw(new core.UnsupportedError("Cannot extract a file path from a URI with a fragment component"));
+ }
+ if (windows == null) windows = core._Uri._isWindows;
+ return dart.test(windows) ? core._Uri._toWindowsFilePath(this) : this[_toFilePath]();
+ }
+ [_toFilePath]() {
+ if (dart.notNull(this[_hostStart]) < dart.notNull(this[_portStart])) {
+ dart.throw(new core.UnsupportedError("Cannot extract a non-Windows file path from a file URI " + "with an authority"));
+ }
+ return this.path;
+ }
+ get data() {
+ dart.assert(this.scheme != "data");
+ return null;
+ }
+ get hashCode() {
+ return (() => {
+ let t = this[_hashCodeCache];
+ return t == null ? this[_hashCodeCache] = dart.hashCode(this[_uri]) : t;
+ })();
+ }
+ ['=='](other) {
+ if (core.identical(this, other)) return true;
+ if (core.Uri.is(other)) return this[_uri] == dart.toString(other);
+ return false;
+ }
+ [_toNonSimple]() {
+ return new core._Uri._internal(this.scheme, this.userInfo, dart.test(this.hasAuthority) ? this.host : null, dart.test(this.hasPort) ? this.port : null, this.path, dart.test(this.hasQuery) ? this.query : null, dart.test(this.hasFragment) ? this.fragment : null);
+ }
+ toString() {
+ return this[_uri];
+ }
+};
+core._SimpleUri[dart.implements] = () => [core.Uri];
+dart.setSignature(core._SimpleUri, {
+ fields: () => ({
+ [_uri]: core.String,
+ [_schemeEnd]: core.int,
+ [_hostStart]: core.int,
+ [_portStart]: core.int,
+ [_pathStart]: core.int,
+ [_queryStart]: core.int,
+ [_fragmentStart]: core.int,
+ [_schemeCache]: core.String,
+ [_hashCodeCache]: core.int
+ }),
+ getters: () => ({
+ hasScheme: dart.definiteFunctionType(core.bool, []),
+ hasAuthority: dart.definiteFunctionType(core.bool, []),
+ hasUserInfo: dart.definiteFunctionType(core.bool, []),
+ hasPort: dart.definiteFunctionType(core.bool, []),
+ hasQuery: dart.definiteFunctionType(core.bool, []),
+ hasFragment: dart.definiteFunctionType(core.bool, []),
+ [_isFile]: dart.definiteFunctionType(core.bool, []),
+ [_isHttp]: dart.definiteFunctionType(core.bool, []),
+ [_isHttps]: dart.definiteFunctionType(core.bool, []),
+ [_isPackage]: dart.definiteFunctionType(core.bool, []),
+ hasAbsolutePath: dart.definiteFunctionType(core.bool, []),
+ hasEmptyPath: dart.definiteFunctionType(core.bool, []),
+ isAbsolute: dart.definiteFunctionType(core.bool, []),
+ scheme: dart.definiteFunctionType(core.String, []),
+ authority: dart.definiteFunctionType(core.String, []),
+ userInfo: dart.definiteFunctionType(core.String, []),
+ host: dart.definiteFunctionType(core.String, []),
+ port: dart.definiteFunctionType(core.int, []),
+ path: dart.definiteFunctionType(core.String, []),
+ query: dart.definiteFunctionType(core.String, []),
+ fragment: dart.definiteFunctionType(core.String, []),
+ origin: dart.definiteFunctionType(core.String, []),
+ pathSegments: dart.definiteFunctionType(core.List$(core.String), []),
+ queryParameters: dart.definiteFunctionType(core.Map$(core.String, core.String), []),
+ queryParametersAll: dart.definiteFunctionType(core.Map$(core.String, core.List$(core.String)), []),
+ data: dart.definiteFunctionType(core.UriData, [])
+ }),
+ methods: () => ({
+ [_isScheme]: dart.definiteFunctionType(core.bool, [core.String]),
+ isScheme: dart.definiteFunctionType(core.bool, [core.String]),
+ [_isPort]: dart.definiteFunctionType(core.bool, [core.String]),
+ normalizePath: dart.definiteFunctionType(core.Uri, []),
+ removeFragment: dart.definiteFunctionType(core.Uri, []),
+ replace: dart.definiteFunctionType(core.Uri, [], {scheme: core.String, userInfo: core.String, host: core.String, port: core.int, path: core.String, pathSegments: IterableOfString(), query: core.String, queryParameters: MapOfString$dynamic(), fragment: core.String}),
+ resolve: dart.definiteFunctionType(core.Uri, [core.String]),
+ resolveUri: dart.definiteFunctionType(core.Uri, [core.Uri]),
+ [_simpleMerge]: dart.definiteFunctionType(core.Uri, [core._SimpleUri, core._SimpleUri]),
+ toFilePath: dart.definiteFunctionType(core.String, [], {windows: core.bool}),
+ [_toFilePath]: dart.definiteFunctionType(core.String, []),
+ '==': dart.definiteFunctionType(core.bool, [core.Object]),
+ [_toNonSimple]: dart.definiteFunctionType(core.Uri, [])
+ })
+});
+const _data$ = Symbol('_data');
+core._DataUri = class _DataUri extends core._Uri {
+ new(data, path, query) {
+ this[_data$] = data;
+ super._internal("data", null, null, null, path, query, null);
+ }
+ get data() {
+ return this[_data$];
+ }
+};
+dart.setSignature(core._DataUri, {
+ fields: () => ({[_data$]: core.UriData})
+});
+core._startsWithData = function(text, start) {
+ let delta = ((dart.notNull(text[dartx.codeUnitAt](dart.notNull(start) + 4)) ^ core._COLON) >>> 0) * 3;
+ delta = (delta | dart.notNull(text[dartx.codeUnitAt](start)) ^ 100) >>> 0;
+ delta = (delta | dart.notNull(text[dartx.codeUnitAt](dart.notNull(start) + 1)) ^ 97) >>> 0;
+ delta = (delta | dart.notNull(text[dartx.codeUnitAt](dart.notNull(start) + 2)) ^ 116) >>> 0;
+ delta = (delta | dart.notNull(text[dartx.codeUnitAt](dart.notNull(start) + 3)) ^ 97) >>> 0;
+ return delta;
+};
+dart.fn(core._startsWithData, StringAndintToint());
+core._stringOrNullLength = function(s) {
+ return s == null ? 0 : s[dartx.length];
+};
+dart.fn(core._stringOrNullLength, StringToint$());
developer.debugger = function(opts) {
let when = opts && 'when' in opts ? opts.when : true;
let message = opts && 'message' in opts ? opts.message : null;
@@ -35134,6 +35968,49 @@
}
});
developer._clockValue = 0;
+developer._FakeUserTag = class _FakeUserTag extends core.Object {
+ real(label) {
+ this.label = label;
+ }
+ static new(label) {
+ let existingTag = developer._FakeUserTag._instances[dartx._get](label);
+ if (existingTag != null) {
+ return developer._FakeUserTag._check(existingTag);
+ }
+ if (developer._FakeUserTag._instances[dartx.length] == developer.UserTag.MAX_USER_TAGS) {
+ dart.throw(new core.UnsupportedError(dart.str`UserTag instance limit (${developer.UserTag.MAX_USER_TAGS}) reached.`));
+ }
+ let instance = new developer._FakeUserTag.real(label);
+ developer._FakeUserTag._instances[dartx._set](label, instance);
+ return instance;
+ }
+ makeCurrent() {
+ let old = developer._currentTag;
+ developer._currentTag = this;
+ return old;
+ }
+};
+dart.defineNamedConstructor(developer._FakeUserTag, 'real');
+developer._FakeUserTag[dart.implements] = () => [developer.UserTag];
+dart.setSignature(developer._FakeUserTag, {
+ fields: () => ({label: core.String}),
+ methods: () => ({makeCurrent: dart.definiteFunctionType(developer.UserTag, [])})
+});
+dart.defineLazy(developer._FakeUserTag, {
+ get _instances() {
+ return dart.map();
+ },
+ set _instances(_) {},
+ get _defaultTag() {
+ return developer._FakeUserTag.new('Default');
+ }
+});
+dart.defineLazy(developer, {
+ get _currentTag() {
+ return developer._FakeUserTag._defaultTag;
+ },
+ set _currentTag(_) {}
+});
const _result = Symbol('_result');
const _errorCode = Symbol('_errorCode');
const _errorDetail = Symbol('_errorDetail');
@@ -35255,7 +36132,7 @@
dart.fn(developer.postEvent, StringAndMapTovoid());
developer._postEvent = function(eventKind, eventData) {
};
-dart.fn(developer._postEvent, StringAndStringTodynamic());
+dart.fn(developer._postEvent, StringAndStringTovoid$());
developer._lookupExtension = function(method) {
return developer._extensions[dartx._get](method);
};
@@ -35273,49 +36150,6 @@
}
};
developer.UserTag.MAX_USER_TAGS = 64;
-developer._FakeUserTag = class _FakeUserTag extends core.Object {
- real(label) {
- this.label = label;
- }
- static new(label) {
- let existingTag = developer._FakeUserTag._instances[dartx._get](label);
- if (existingTag != null) {
- return developer._FakeUserTag._check(existingTag);
- }
- if (developer._FakeUserTag._instances[dartx.length] == developer.UserTag.MAX_USER_TAGS) {
- dart.throw(new core.UnsupportedError(dart.str`UserTag instance limit (${developer.UserTag.MAX_USER_TAGS}) reached.`));
- }
- let instance = new developer._FakeUserTag.real(label);
- developer._FakeUserTag._instances[dartx._set](label, instance);
- return instance;
- }
- makeCurrent() {
- let old = developer._currentTag;
- developer._currentTag = this;
- return old;
- }
-};
-dart.defineNamedConstructor(developer._FakeUserTag, 'real');
-developer._FakeUserTag[dart.implements] = () => [developer.UserTag];
-dart.setSignature(developer._FakeUserTag, {
- fields: () => ({label: core.String}),
- methods: () => ({makeCurrent: dart.definiteFunctionType(developer.UserTag, [])})
-});
-dart.defineLazy(developer._FakeUserTag, {
- get _instances() {
- return dart.map();
- },
- set _instances(_) {},
- get _defaultTag() {
- return developer._FakeUserTag.new('Default');
- }
-});
-dart.defineLazy(developer, {
- get _currentTag() {
- return developer._FakeUserTag._defaultTag;
- },
- set _currentTag(_) {}
-});
developer.getCurrentTag = function() {
return developer._currentTag;
};
@@ -35748,7 +36582,7 @@
developer.Service = class Service extends core.Object {
static getInfo() {
return dart.async(function*() {
- let receivePort = isolate.RawReceivePort.new();
+ let receivePort = isolate$.RawReceivePort.new();
let uriCompleter = CompleterOfUri().new();
receivePort.handler = dart.fn(uri => uriCompleter.complete(uri), UriTovoid());
developer._getServerInfo(receivePort.sendPort);
@@ -35763,7 +36597,7 @@
if (!(typeof enable == 'boolean')) {
dart.throw(new core.ArgumentError.value(enable, 'enable', 'Must be a bool'));
}
- let receivePort = isolate.RawReceivePort.new();
+ let receivePort = isolate$.RawReceivePort.new();
let uriCompleter = CompleterOfUri().new();
receivePort.handler = dart.fn(uri => uriCompleter.complete(uri), UriTovoid());
developer._webServerControl(receivePort.sendPort, enable);
@@ -35772,20 +36606,27 @@
return new developer.ServiceProtocolInfo(uri);
}, developer.ServiceProtocolInfo, opts);
}
+ static getIsolateID(isolate) {
+ if (!isolate$.Isolate.is(isolate)) {
+ dart.throw(new core.ArgumentError.value(isolate, 'isolate', 'Must be an Isolate'));
+ }
+ return developer._getIsolateIDFromSendPort(isolate.controlPort);
+ }
};
dart.setSignature(developer.Service, {
statics: () => ({
getInfo: dart.definiteFunctionType(async.Future$(developer.ServiceProtocolInfo), []),
- controlWebServer: dart.definiteFunctionType(async.Future$(developer.ServiceProtocolInfo), [], {enable: core.bool})
+ controlWebServer: dart.definiteFunctionType(async.Future$(developer.ServiceProtocolInfo), [], {enable: core.bool}),
+ getIsolateID: dart.definiteFunctionType(core.String, [isolate$.Isolate])
}),
- names: ['getInfo', 'controlWebServer']
+ names: ['getInfo', 'controlWebServer', 'getIsolateID']
});
-developer._getServerInfo = function(sp) {
- sp.send(null);
+developer._getServerInfo = function(sendPort) {
+ sendPort.send(null);
};
dart.lazyFn(developer._getServerInfo, () => SendPortTovoid());
-developer._webServerControl = function(sp, enable) {
- sp.send(null);
+developer._webServerControl = function(sendPort, enable) {
+ sendPort.send(null);
};
dart.lazyFn(developer._webServerControl, () => SendPortAndboolTovoid());
developer._getServiceMajorVersion = function() {
@@ -35796,6 +36637,10 @@
return 0;
};
dart.fn(developer._getServiceMinorVersion, VoidToint());
+developer._getIsolateIDFromSendPort = function(sendPort) {
+ return null;
+};
+dart.lazyFn(developer._getIsolateIDFromSendPort, () => SendPortToString());
io.BytesBuilder = class BytesBuilder extends core.Object {
static new(opts) {
let copy = opts && 'copy' in opts ? opts.copy : true;
@@ -35806,27 +36651,21 @@
}
}
};
-const _length$2 = Symbol('_length');
const _buffer$ = Symbol('_buffer');
-const _pow2roundup = Symbol('_pow2roundup');
+const _length$2 = Symbol('_length');
+const _grow$ = Symbol('_grow');
io._CopyingBytesBuilder = class _CopyingBytesBuilder extends core.Object {
- new() {
+ new(initialCapacity) {
+ if (initialCapacity === void 0) initialCapacity = 0;
+ this[_buffer$] = dart.notNull(initialCapacity) <= 0 ? io._CopyingBytesBuilder._emptyList : typed_data.Uint8List.new(io._CopyingBytesBuilder._pow2roundup(initialCapacity));
this[_length$2] = 0;
- this[_buffer$] = null;
}
add(bytes) {
let bytesLength = bytes[dartx.length];
if (bytesLength == 0) return;
let required = dart.notNull(this[_length$2]) + dart.notNull(bytesLength);
- if (this[_buffer$] == null) {
- let size = this[_pow2roundup](required);
- size = math.max(core.int)(size, io._CopyingBytesBuilder._INIT_SIZE);
- this[_buffer$] = typed_data.Uint8List.new(size);
- } else if (dart.notNull(this[_buffer$][dartx.length]) < required) {
- let size = dart.notNull(this[_pow2roundup](required)) * 2;
- let newBuffer = typed_data.Uint8List.new(size);
- newBuffer[dartx.setRange](0, this[_buffer$][dartx.length], this[_buffer$]);
- this[_buffer$] = newBuffer;
+ if (dart.notNull(this[_buffer$][dartx.length]) < required) {
+ this[_grow$](required);
}
dart.assert(dart.notNull(this[_buffer$][dartx.length]) >= required);
if (typed_data.Uint8List.is(bytes)) {
@@ -35839,16 +36678,32 @@
this[_length$2] = required;
}
addByte(byte) {
- this.add(JSArrayOfint().of([byte]));
+ if (this[_buffer$][dartx.length] == this[_length$2]) {
+ this[_grow$](this[_length$2]);
+ }
+ dart.assert(dart.notNull(this[_buffer$][dartx.length]) > dart.notNull(this[_length$2]));
+ this[_buffer$][dartx._set](this[_length$2], byte);
+ this[_length$2] = dart.notNull(this[_length$2]) + 1;
+ }
+ [_grow$](required) {
+ let newSize = dart.notNull(required) * 2;
+ if (dart.notNull(newSize) < io._CopyingBytesBuilder._INIT_SIZE) {
+ newSize = io._CopyingBytesBuilder._INIT_SIZE;
+ } else {
+ newSize = io._CopyingBytesBuilder._pow2roundup(newSize);
+ }
+ let newBuffer = typed_data.Uint8List.new(newSize);
+ newBuffer[dartx.setRange](0, this[_buffer$][dartx.length], this[_buffer$]);
+ this[_buffer$] = newBuffer;
}
takeBytes() {
- if (this[_buffer$] == null) return typed_data.Uint8List.new(0);
+ if (this[_length$2] == 0) return io._CopyingBytesBuilder._emptyList;
let buffer = typed_data.Uint8List.view(this[_buffer$][dartx.buffer], 0, this[_length$2]);
this.clear();
return buffer;
}
toBytes() {
- if (this[_buffer$] == null) return typed_data.Uint8List.new(0);
+ if (this[_length$2] == 0) return io._CopyingBytesBuilder._emptyList;
return typed_data.Uint8List.fromList(typed_data.Uint8List.view(this[_buffer$][dartx.buffer], 0, this[_length$2]));
}
get length() {
@@ -35862,9 +36717,10 @@
}
clear() {
this[_length$2] = 0;
- this[_buffer$] = null;
+ this[_buffer$] = io._CopyingBytesBuilder._emptyList;
}
- [_pow2roundup](x) {
+ static _pow2roundup(x) {
+ dart.assert(dart.notNull(x) > 0);
x = dart.notNull(x) - 1;
x = (dart.notNull(x) | x[dartx['>>']](1)) >>> 0;
x = (dart.notNull(x) | x[dartx['>>']](2)) >>> 0;
@@ -35888,33 +36744,48 @@
methods: () => ({
add: dart.definiteFunctionType(dart.void, [ListOfint()]),
addByte: dart.definiteFunctionType(dart.void, [core.int]),
+ [_grow$]: dart.definiteFunctionType(dart.void, [core.int]),
takeBytes: dart.definiteFunctionType(core.List$(core.int), []),
toBytes: dart.definiteFunctionType(core.List$(core.int), []),
- clear: dart.definiteFunctionType(dart.void, []),
- [_pow2roundup]: dart.definiteFunctionType(core.int, [core.int])
- })
+ clear: dart.definiteFunctionType(dart.void, [])
+ }),
+ statics: () => ({_pow2roundup: dart.definiteFunctionType(core.int, [core.int])}),
+ names: ['_pow2roundup']
});
io._CopyingBytesBuilder._INIT_SIZE = 1024;
+dart.defineLazy(io._CopyingBytesBuilder, {
+ get _emptyList() {
+ return typed_data.Uint8List.new(0);
+ }
+});
const _chunks = Symbol('_chunks');
io._BytesBuilder = class _BytesBuilder extends core.Object {
new() {
- this[_chunks] = JSArrayOfListOfint().of([]);
+ this[_chunks] = JSArrayOfUint8List().of([]);
this[_length$2] = 0;
}
add(bytes) {
- if (!typed_data.Uint8List.is(bytes)) {
- bytes = typed_data.Uint8List.fromList(bytes);
+ let typedBytes = null;
+ if (typed_data.Uint8List.is(bytes)) {
+ typedBytes = bytes;
+ } else {
+ typedBytes = typed_data.Uint8List.fromList(bytes);
}
- this[_chunks][dartx.add](bytes);
- this[_length$2] = dart.notNull(this[_length$2]) + dart.notNull(bytes[dartx.length]);
+ this[_chunks][dartx.add](typedBytes);
+ this[_length$2] = dart.notNull(this[_length$2]) + dart.notNull(typedBytes[dartx.length]);
}
addByte(byte) {
- this.add(JSArrayOfint().of([byte]));
+ this[_chunks][dartx.add]((() => {
+ let _ = typed_data.Uint8List.new(1);
+ _[dartx._set](0, byte);
+ return _;
+ })());
+ this[_length$2] = dart.notNull(this[_length$2]) + 1;
}
takeBytes() {
- if (this[_chunks][dartx.length] == 0) return typed_data.Uint8List.new(0);
+ if (this[_length$2] == 0) return io._CopyingBytesBuilder._emptyList;
if (this[_chunks][dartx.length] == 1) {
- let buffer = this[_chunks][dartx.single];
+ let buffer = this[_chunks][dartx._get](0);
this.clear();
return buffer;
}
@@ -35928,7 +36799,7 @@
return buffer;
}
toBytes() {
- if (this[_chunks][dartx.length] == 0) return typed_data.Uint8List.new(0);
+ if (this[_length$2] == 0) return io._CopyingBytesBuilder._emptyList;
let buffer = typed_data.Uint8List.new(this[_length$2]);
let offset = 0;
for (let chunk of this[_chunks]) {
@@ -35955,7 +36826,7 @@
dart.setSignature(io._BytesBuilder, {
fields: () => ({
[_length$2]: core.int,
- [_chunks]: ListOfListOfint()
+ [_chunks]: ListOfUint8List()
}),
getters: () => ({
length: dart.definiteFunctionType(core.int, []),
@@ -35986,7 +36857,7 @@
switch (dart.dindex(response, io._ERROR_RESPONSE_ERROR_TYPE)) {
case io._ILLEGAL_ARGUMENT_RESPONSE:
{
- return new core.ArgumentError();
+ return new core.ArgumentError(dart.str`${message}: ${path}`);
}
case io._OSERROR_RESPONSE:
{
@@ -36049,7 +36920,7 @@
};
dart.setSignature(io._BufferAndStart, {
fields: () => ({
- buffer: core.List,
+ buffer: ListOfint(),
start: core.int
})
});
@@ -36061,7 +36932,7 @@
let newBuffer = typed_data.Uint8List.new(length);
let j = start;
for (let i = 0; i < length; i++) {
- let value = core.int._check(buffer[dartx._get](j));
+ let value = buffer[dartx._get](j);
if (!(typeof value == 'number')) {
dart.throw(new core.ArgumentError(dart.str`List element is not an integer at index ${j}`));
}
@@ -36070,7 +36941,7 @@
}
return new io._BufferAndStart(newBuffer, 0);
};
-dart.fn(io._ensureFastAndSerializableByteData, ListAndintAndintTo_BufferAndStart());
+dart.fn(io._ensureFastAndSerializableByteData, ListOfintAndintAndintTo_BufferAndStart());
io._IOCrypto = class _IOCrypto extends core.Object {
static getRandomBytes(count) {
dart.throw(new core.UnsupportedError("_IOCrypto.getRandomBytes"));
@@ -36236,13 +37107,13 @@
}
close() {
if (dart.test(this[_digestCalled])) {
- return ListOfint()._check(this[_resultAsBytes]());
+ return this[_resultAsBytes]();
}
this[_digestCalled] = true;
this[_finalizeData]();
this[_iterate]();
dart.assert(this[_pendingData][dartx.length] == 0);
- return ListOfint()._check(this[_resultAsBytes]());
+ return this[_resultAsBytes]();
}
get blockSize() {
return dart.notNull(this[_chunkSizeInWords]) * io._BYTES_PER_WORD;
@@ -36258,9 +37129,9 @@
return (val[dartx['<<']](mod_shift) & io._MASK_32 | ((dart.notNull(val) & io._MASK_32) >>> 0)[dartx['>>']](32 - mod_shift)) >>> 0;
}
[_resultAsBytes]() {
- let result = [];
+ let result = JSArrayOfint().of([]);
for (let i = 0; i < dart.notNull(this[_h][dartx.length]); i++) {
- result[dartx.addAll](core.Iterable._check(this[_wordToBytes](this[_h][dartx._get](i))));
+ result[dartx.addAll](this[_wordToBytes](this[_h][dartx._get](i)));
}
return result;
}
@@ -36311,11 +37182,11 @@
let lengthInBits = dart.notNull(this[_lengthInBytes]) * io._BITS_PER_BYTE;
dart.assert(lengthInBits < dart.notNull(math.pow(2, 32)));
if (dart.test(this[_bigEndianWords])) {
- this[_pendingData][dartx.addAll](IterableOfint()._check(this[_wordToBytes](0)));
- this[_pendingData][dartx.addAll](IterableOfint()._check(this[_wordToBytes]((lengthInBits & io._MASK_32) >>> 0)));
+ this[_pendingData][dartx.addAll](this[_wordToBytes](0));
+ this[_pendingData][dartx.addAll](this[_wordToBytes]((lengthInBits & io._MASK_32) >>> 0));
} else {
- this[_pendingData][dartx.addAll](IterableOfint()._check(this[_wordToBytes]((lengthInBits & io._MASK_32) >>> 0)));
- this[_pendingData][dartx.addAll](IterableOfint()._check(this[_wordToBytes](0)));
+ this[_pendingData][dartx.addAll](this[_wordToBytes]((lengthInBits & io._MASK_32) >>> 0));
+ this[_pendingData][dartx.addAll](this[_wordToBytes](0));
}
}
};
@@ -36337,9 +37208,9 @@
[_add32]: dart.definiteFunctionType(dart.dynamic, [dart.dynamic, dart.dynamic]),
[_roundUp]: dart.definiteFunctionType(dart.dynamic, [dart.dynamic, dart.dynamic]),
[_rotl32]: dart.definiteFunctionType(core.int, [core.int, core.int]),
- [_resultAsBytes]: dart.definiteFunctionType(dart.dynamic, []),
+ [_resultAsBytes]: dart.definiteFunctionType(core.List$(core.int), []),
[_bytesToChunk]: dart.definiteFunctionType(dart.dynamic, [ListOfint(), core.int]),
- [_wordToBytes]: dart.definiteFunctionType(dart.dynamic, [core.int]),
+ [_wordToBytes]: dart.definiteFunctionType(core.List$(core.int), [core.int]),
[_iterate]: dart.definiteFunctionType(dart.dynamic, []),
[_finalizeData]: dart.definiteFunctionType(dart.dynamic, [])
})
@@ -36621,6 +37492,7 @@
}
};
dart.addSimpleTypeTests(io.ZLibEncoder);
+io.ZLibEncoder[dart.implements] = () => [ChunkedConverterOfListOfint$ListOfint$ListOfint$ListOfint()];
dart.setSignature(io.ZLibEncoder, {
fields: () => ({
gzip: core.bool,
@@ -36703,7 +37575,7 @@
const _filter$ = Symbol('_filter');
const _closed = Symbol('_closed');
const _empty = Symbol('_empty');
-let const$52;
+let const$55;
io._FilterSink = class _FilterSink extends convert.ByteConversionSink {
new(sink, filter) {
this[_sink$0] = sink;
@@ -36722,10 +37594,10 @@
try {
this[_empty] = false;
let bufferAndStart = io._ensureFastAndSerializableByteData(data, start, end);
- this[_filter$].process(ListOfint()._check(bufferAndStart.buffer), bufferAndStart.start, dart.notNull(end) - (dart.notNull(start) - dart.notNull(bufferAndStart.start)));
+ this[_filter$].process(bufferAndStart.buffer, bufferAndStart.start, dart.notNull(end) - (dart.notNull(start) - dart.notNull(bufferAndStart.start)));
let out = null;
while ((out = this[_filter$].processed({flush: false})) != null) {
- this[_sink$0].add(ListOfint()._check(out));
+ this[_sink$0].add(out);
}
} catch (e) {
this[_closed] = true;
@@ -36736,11 +37608,11 @@
}
close() {
if (dart.test(this[_closed])) return;
- if (dart.test(this[_empty])) this[_filter$].process(const$52 || (const$52 = dart.constList([], core.int)), 0, 0);
+ if (dart.test(this[_empty])) this[_filter$].process(const$55 || (const$55 = dart.constList([], core.int)), 0, 0);
try {
let out = null;
while ((out = this[_filter$].processed({end: true})) != null) {
- this[_sink$0].add(ListOfint()._check(out));
+ this[_sink$0].add(out);
}
} catch (e) {
this[_closed] = true;
@@ -36807,9 +37679,9 @@
}
};
dart.fn(io._validateZLibMemLevel, intTovoid());
-let const$53;
+let const$56;
io._validateZLibStrategy = function(strategy) {
- let strategies = const$53 || (const$53 = dart.constList([io.ZLibOption.STRATEGY_FILTERED, io.ZLibOption.STRATEGY_HUFFMAN_ONLY, io.ZLibOption.STRATEGY_RLE, io.ZLibOption.STRATEGY_FIXED, io.ZLibOption.STRATEGY_DEFAULT], core.int));
+ let strategies = const$56 || (const$56 = dart.constList([io.ZLibOption.STRATEGY_FILTERED, io.ZLibOption.STRATEGY_HUFFMAN_ONLY, io.ZLibOption.STRATEGY_RLE, io.ZLibOption.STRATEGY_FIXED, io.ZLibOption.STRATEGY_DEFAULT], core.int));
if (strategies[dartx.indexOf](strategy) == -1) {
dart.throw(new core.ArgumentError("Unsupported 'strategy'"));
}
@@ -36839,7 +37711,6 @@
const _isErrorResponse = Symbol('_isErrorResponse');
const _exceptionOrErrorFromResponse = Symbol('_exceptionOrErrorFromResponse');
const _absolutePath = Symbol('_absolutePath');
-const _computeExistingIndex = Symbol('_computeExistingIndex');
const _delete = Symbol('_delete');
const _deleteSync = Symbol('_deleteSync');
const _type = Symbol('_type');
@@ -36860,6 +37731,12 @@
io.FileSystemEntity._throwIfError(result, "Cannot resolve symbolic links", this.path);
return core.String._check(result);
}
+ stat() {
+ return io.FileStat.stat(this.path);
+ }
+ statSync() {
+ return io.FileStat.statSync(this.path);
+ }
delete(opts) {
let recursive = opts && 'recursive' in opts ? opts.recursive : false;
return this[_delete]({recursive: recursive});
@@ -37023,6 +37900,8 @@
methods: () => ({
resolveSymbolicLinks: dart.definiteFunctionType(async.Future$(core.String), []),
resolveSymbolicLinksSync: dart.definiteFunctionType(core.String, []),
+ stat: dart.definiteFunctionType(async.Future$(io.FileStat), []),
+ statSync: dart.definiteFunctionType(io.FileStat, []),
delete: dart.definiteFunctionType(async.Future$(io.FileSystemEntity), [], {recursive: core.bool}),
deleteSync: dart.definiteFunctionType(dart.void, [], {recursive: core.bool}),
watch: dart.definiteFunctionType(async.Stream$(io.FileSystemEvent), [], {events: core.int, recursive: core.bool})
@@ -37128,33 +38007,6 @@
get absolute() {
return io.Directory.new(this[_absolutePath]);
}
- stat() {
- return io.FileStat.stat(this.path);
- }
- statSync() {
- return io.FileStat.statSync(this.path);
- }
- [_computeExistingIndex](dirsToCreate) {
- let future = null;
- let notFound = dirsToCreate[dartx.length];
- for (let i = 0; i < dart.notNull(dirsToCreate[dartx.length]); i++) {
- if (future == null) {
- future = dart.dsend(dart.dsend(dirsToCreate[dartx._get](i), 'exists'), 'then', dart.fn(e => dart.test(e) ? i : notFound, dynamicToint()));
- } else {
- future = dart.dsend(future, 'then', dart.fn(index => {
- if (!dart.equals(index, notFound)) {
- return async.Future.value(index);
- }
- return dart.dsend(dart.dsend(dirsToCreate[dartx._get](i), 'exists'), 'then', dart.fn(e => dart.test(e) ? i : notFound, dynamicToint()));
- }, dynamicTodynamic$()));
- }
- }
- if (future == null) {
- return FutureOfint().value(notFound);
- } else {
- return FutureOfint()._check(future);
- }
- }
create(opts) {
let recursive = opts && 'recursive' in opts ? opts.recursive : false;
if (dart.test(recursive)) {
@@ -37265,7 +38117,7 @@
list(opts) {
let recursive = opts && 'recursive' in opts ? opts.recursive : false;
let followLinks = opts && 'followLinks' in opts ? opts.followLinks : true;
- return StreamOfFileSystemEntity()._check(new io._AsyncDirectoryLister(io.FileSystemEntity._ensureTrailingPathSeparators(this.path), recursive, followLinks).stream);
+ return new io._AsyncDirectoryLister(io.FileSystemEntity._ensureTrailingPathSeparators(this.path), recursive, followLinks).stream;
}
listSync(opts) {
let recursive = opts && 'recursive' in opts ? opts.recursive : false;
@@ -37309,9 +38161,6 @@
methods: () => ({
exists: dart.definiteFunctionType(async.Future$(core.bool), []),
existsSync: dart.definiteFunctionType(core.bool, []),
- stat: dart.definiteFunctionType(async.Future$(io.FileStat), []),
- statSync: dart.definiteFunctionType(io.FileStat, []),
- [_computeExistingIndex]: dart.definiteFunctionType(async.Future$(core.int), [core.List]),
create: dart.definiteFunctionType(async.Future$(io.Directory), [], {recursive: core.bool}),
createSync: dart.definiteFunctionType(dart.void, [], {recursive: core.bool}),
createTemp: dart.definiteFunctionType(async.Future$(io.Directory), [], [core.String]),
@@ -37357,7 +38206,7 @@
this.nextRunning = false;
this.closed = false;
this[_ops] = null;
- this.controller = async.StreamController.new({onListen: dart.bind(this, 'onListen'), onResume: dart.bind(this, 'onResume'), onCancel: dart.bind(this, 'onCancel'), sync: true});
+ this.controller = StreamControllerOfFileSystemEntity().new({onListen: dart.bind(this, 'onListen'), onResume: dart.bind(this, 'onResume'), onCancel: dart.bind(this, 'onCancel'), sync: true});
}
[_pointer]() {
return this[_ops] == null ? null : this[_ops].getPointer();
@@ -37484,14 +38333,14 @@
path: core.String,
recursive: core.bool,
followLinks: core.bool,
- controller: async.StreamController,
+ controller: StreamControllerOfFileSystemEntity(),
canceled: core.bool,
nextRunning: core.bool,
closed: core.bool,
[_ops]: io._AsyncDirectoryListerOps,
closeCompleter: async.Completer
}),
- getters: () => ({stream: dart.definiteFunctionType(async.Stream, [])}),
+ getters: () => ({stream: dart.definiteFunctionType(async.Stream$(io.FileSystemEntity), [])}),
methods: () => ({
[_pointer]: dart.definiteFunctionType(core.int, []),
onListen: dart.definiteFunctionType(dart.void, []),
@@ -37518,7 +38367,7 @@
}
};
dart.setSignature(io._EventHandler, {
- statics: () => ({_sendData: dart.definiteFunctionType(dart.void, [core.Object, isolate.SendPort, core.int])}),
+ statics: () => ({_sendData: dart.definiteFunctionType(dart.void, [core.Object, isolate$.SendPort, core.int])}),
names: ['_sendData']
});
const _mode = Symbol('_mode');
@@ -37560,7 +38409,9 @@
toString() {
return {
0: "FileLock.SHARED",
- 1: "FileLock.EXCLUSIVE"
+ 1: "FileLock.EXCLUSIVE",
+ 2: "FileLock.BLOCKING_SHARED",
+ 3: "FileLock.BLOCKING_EXCLUSIVE"
}[this.index];
}
};
@@ -37569,7 +38420,9 @@
});
dart.defineEnumValues(io.FileLock, [
'SHARED',
- 'EXCLUSIVE'
+ 'EXCLUSIVE',
+ 'BLOCKING_SHARED',
+ 'BLOCKING_EXCLUSIVE'
]);
io.File = class File extends core.Object {
static new(path) {
@@ -37622,9 +38475,9 @@
});
io._BLOCK_SIZE = 64 * 1024;
const _closeCompleter = Symbol('_closeCompleter');
-const _path$ = Symbol('_path');
+const _path = Symbol('_path');
const _position$0 = Symbol('_position');
-const _end$0 = Symbol('_end');
+const _end$ = Symbol('_end');
const _controller$0 = Symbol('_controller');
const _openedFile = Symbol('_openedFile');
const _unsubscribed = Symbol('_unsubscribed');
@@ -37637,9 +38490,9 @@
io._FileStream = class _FileStream extends async.Stream$(core.List$(core.int)) {
new(path, position, end) {
this[_closeCompleter] = async.Completer.new();
- this[_path$] = path;
+ this[_path] = path;
this[_position$0] = position;
- this[_end$0] = end;
+ this[_end$] = end;
this[_controller$0] = null;
this[_openedFile] = null;
this[_unsubscribed] = false;
@@ -37653,9 +38506,9 @@
this[_closeCompleter] = async.Completer.new();
this[_position$0] = 0;
this[_controller$0] = null;
- this[_path$] = null;
+ this[_path] = null;
this[_openedFile] = null;
- this[_end$0] = null;
+ this[_end$] = null;
this[_unsubscribed] = false;
this[_readInProgress] = true;
this[_closed] = false;
@@ -37696,12 +38549,12 @@
}
this[_readInProgress] = true;
let readBytes = io._BLOCK_SIZE;
- if (this[_end$0] != null) {
- readBytes = math.min(core.int)(readBytes, dart.notNull(this[_end$0]) - dart.notNull(this[_position$0]));
+ if (this[_end$] != null) {
+ readBytes = math.min(core.int)(readBytes, dart.notNull(this[_end$]) - dart.notNull(this[_position$0]));
if (dart.notNull(readBytes) < 0) {
this[_readInProgress] = false;
if (!dart.test(this[_unsubscribed])) {
- this[_controller$0].addError(new core.RangeError(dart.str`Bad end position: ${this[_end$0]}`));
+ this[_controller$0].addError(new core.RangeError(dart.str`Bad end position: ${this[_end$]}`));
this[_closeFile]();
this[_unsubscribed] = true;
}
@@ -37715,7 +38568,7 @@
return;
}
this[_position$0] = dart.notNull(this[_position$0]) + dart.notNull(block[dartx.length]);
- if (dart.notNull(block[dartx.length]) < dart.notNull(readBytes) || this[_end$0] != null && this[_position$0] == this[_end$0]) {
+ if (dart.notNull(block[dartx.length]) < dart.notNull(readBytes) || this[_end$] != null && this[_position$0] == this[_end$]) {
this[_atEnd] = true;
}
if (!dart.test(this[_atEnd]) && !dart.test(this[_controller$0].isPaused)) {
@@ -37764,8 +38617,8 @@
this[_closeCompleter].complete();
}).bind(this);
dart.fn(openFailed, dynamicAnddynamicTovoid$());
- if (this[_path$] != null) {
- io.File.new(this[_path$]).open({mode: io.FileMode.READ}).then(dart.void)(onOpenFile, {onError: openFailed});
+ if (this[_path] != null) {
+ io.File.new(this[_path]).open({mode: io.FileMode.READ}).then(dart.void)(onOpenFile, {onError: openFailed});
} else {
try {
onOpenFile(io._File._openStdioSync(0));
@@ -37782,10 +38635,10 @@
dart.setSignature(io._FileStream, {
fields: () => ({
[_controller$0]: StreamControllerOfListOfint(),
- [_path$]: core.String,
+ [_path]: core.String,
[_openedFile]: io.RandomAccessFile,
[_position$0]: core.int,
- [_end$0]: core.int,
+ [_end$]: core.int,
[_closeCompleter]: async.Completer,
[_unsubscribed]: core.bool,
[_readInProgress]: core.bool,
@@ -37857,8 +38710,8 @@
})
});
const _tryDecode = Symbol('_tryDecode');
-let const$54;
-let const$55;
+let const$57;
+let const$58;
io._File = class _File extends io.FileSystemEntity {
new(path) {
this.path = path;
@@ -37885,12 +38738,6 @@
get absolute() {
return io.File.new(this[_absolutePath]);
}
- stat() {
- return io.FileStat.stat(this.path);
- }
- statSync() {
- return io.FileStat.statSync(this.path);
- }
create(opts) {
let recursive = opts && 'recursive' in opts ? opts.recursive : false;
let result = dart.test(recursive) ? this.parent.create({recursive: true}) : async.Future.value(null);
@@ -38007,6 +38854,41 @@
io._File.throwIfError(result, "Cannot retrieve length of file", this.path);
return core.int._check(result);
}
+ lastAccessed() {
+ return io._IOService._dispatch(io._FILE_LAST_ACCESSED, JSArrayOfString().of([this.path])).then(core.DateTime)(dart.fn(response => {
+ if (dart.test(io._isErrorResponse(response))) {
+ dart.throw(io._exceptionFromResponse(response, "Cannot retrieve access time", this.path));
+ }
+ return new core.DateTime.fromMillisecondsSinceEpoch(core.int._check(response));
+ }, dynamicToDateTime()));
+ }
+ static _lastAccessed(path) {
+ dart.throw(new core.UnsupportedError("File._lastAccessed"));
+ }
+ lastAccessedSync() {
+ let ms = io._File._lastAccessed(this.path);
+ io._File.throwIfError(ms, "Cannot retrieve access time", this.path);
+ return new core.DateTime.fromMillisecondsSinceEpoch(core.int._check(ms));
+ }
+ setLastAccessed(time) {
+ let millis = time.millisecondsSinceEpoch;
+ return io._IOService._dispatch(io._FILE_SET_LAST_ACCESSED, JSArrayOfObject().of([this.path, millis])).then(dart.dynamic)(dart.fn(response => {
+ if (dart.test(io._isErrorResponse(response))) {
+ dart.throw(io._exceptionFromResponse(response, "Cannot set access time", this.path));
+ }
+ return null;
+ }, dynamicToNull$()));
+ }
+ static _setLastAccessed(path, millis) {
+ dart.throw(new core.UnsupportedError("File._setLastAccessed"));
+ }
+ setLastAccessedSync(time) {
+ let millis = time.millisecondsSinceEpoch;
+ let result = io._File._setLastAccessed(this.path, millis);
+ if (io.OSError.is(result)) {
+ dart.throw(new io.FileSystemException("Failed to set file access time", this.path, result));
+ }
+ }
lastModified() {
return io._IOService._dispatch(io._FILE_LAST_MODIFIED, JSArrayOfString().of([this.path])).then(core.DateTime)(dart.fn(response => {
if (dart.test(io._isErrorResponse(response))) {
@@ -38023,6 +38905,25 @@
io._File.throwIfError(ms, "Cannot retrieve modification time", this.path);
return new core.DateTime.fromMillisecondsSinceEpoch(core.int._check(ms));
}
+ setLastModified(time) {
+ let millis = time.millisecondsSinceEpoch;
+ return io._IOService._dispatch(io._FILE_SET_LAST_MODIFIED, JSArrayOfObject().of([this.path, millis])).then(dart.dynamic)(dart.fn(response => {
+ if (dart.test(io._isErrorResponse(response))) {
+ dart.throw(io._exceptionFromResponse(response, "Cannot set modification time", this.path));
+ }
+ return null;
+ }, dynamicToNull$()));
+ }
+ static _setLastModified(path, millis) {
+ dart.throw(new core.UnsupportedError("File._setLastModified"));
+ }
+ setLastModifiedSync(time) {
+ let millis = time.millisecondsSinceEpoch;
+ let result = io._File._setLastModified(this.path, millis);
+ if (io.OSError.is(result)) {
+ dart.throw(new io.FileSystemException("Failed to set file modification time", this.path, result));
+ }
+ }
static _open(path, mode) {
dart.throw(new core.UnsupportedError("File._open"));
}
@@ -38062,22 +38963,22 @@
readAsBytes() {
function readDataChunked(file) {
let builder = io.BytesBuilder.new({copy: false});
- let completer = async.Completer.new();
+ let completer = CompleterOfListOfint().new();
function read() {
- dart.dsend(dart.dsend(file, 'read', io._BLOCK_SIZE), 'then', dart.fn(data => {
- if (dart.test(dart.dsend(dart.dload(data, 'length'), '>', 0))) {
- builder.add(ListOfint()._check(data));
+ file.read(io._BLOCK_SIZE).then(dart.dynamic)(dart.fn(data => {
+ if (dart.notNull(data[dartx.length]) > 0) {
+ builder.add(data);
read();
} else {
completer.complete(builder.takeBytes());
}
- }, dynamicToNull$()), {onError: dart.bind(completer, 'completeError')});
+ }, ListOfintToNull()), {onError: dart.bind(completer, 'completeError')});
}
dart.fn(read, VoidTovoid$());
read();
- return FutureOfListOfint()._check(completer.future);
+ return completer.future;
}
- dart.fn(readDataChunked, dynamicToFutureOfListOfint());
+ dart.fn(readDataChunked, RandomAccessFileToFutureOfListOfint());
return this.open().then(ListOfint())(dart.fn(file => file.length().then(ListOfint())(dart.fn(length => {
if (length == 0) {
return readDataChunked(file);
@@ -38094,13 +38995,13 @@
let builder = io.BytesBuilder.new({copy: false});
do {
data = opened.readSync(io._BLOCK_SIZE);
- if (dart.test(dart.dsend(dart.dload(data, 'length'), '>', 0))) builder.add(ListOfint()._check(data));
- } while (dart.test(dart.dsend(dart.dload(data, 'length'), '>', 0)));
+ if (dart.notNull(data[dartx.length]) > 0) builder.add(data);
+ } while (dart.notNull(data[dartx.length]) > 0);
data = builder.takeBytes();
} else {
data = opened.readSync(length);
}
- return ListOfint()._check(data);
+ return data;
} finally {
opened.closeSync();
}
@@ -38123,11 +39024,11 @@
}
readAsLines(opts) {
let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
- return this.readAsString({encoding: encoding}).then(ListOfString())(dart.bind(const$54 || (const$54 = dart.const(new convert.LineSplitter())), 'convert'));
+ return this.readAsString({encoding: encoding}).then(ListOfString())(dart.bind(const$57 || (const$57 = dart.const(new convert.LineSplitter())), 'convert'));
}
readAsLinesSync(opts) {
let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
- return (const$55 || (const$55 = dart.const(new convert.LineSplitter()))).convert(this.readAsStringSync({encoding: encoding}));
+ return (const$58 || (const$58 = dart.const(new convert.LineSplitter()))).convert(this.readAsStringSync({encoding: encoding}));
}
writeAsBytes(bytes, opts) {
let mode = opts && 'mode' in opts ? opts.mode : io.FileMode.WRITE;
@@ -38181,8 +39082,6 @@
methods: () => ({
exists: dart.definiteFunctionType(async.Future$(core.bool), []),
existsSync: dart.definiteFunctionType(core.bool, []),
- stat: dart.definiteFunctionType(async.Future$(io.FileStat), []),
- statSync: dart.definiteFunctionType(io.FileStat, []),
create: dart.definiteFunctionType(async.Future$(io.File), [], {recursive: core.bool}),
createSync: dart.definiteFunctionType(dart.void, [], {recursive: core.bool}),
[_delete]: dart.definiteFunctionType(async.Future$(io.File), [], {recursive: core.bool}),
@@ -38194,8 +39093,14 @@
open: dart.definiteFunctionType(async.Future$(io.RandomAccessFile), [], {mode: io.FileMode}),
length: dart.definiteFunctionType(async.Future$(core.int), []),
lengthSync: dart.definiteFunctionType(core.int, []),
+ lastAccessed: dart.definiteFunctionType(async.Future$(core.DateTime), []),
+ lastAccessedSync: dart.definiteFunctionType(core.DateTime, []),
+ setLastAccessed: dart.definiteFunctionType(async.Future, [core.DateTime]),
+ setLastAccessedSync: dart.definiteFunctionType(dart.void, [core.DateTime]),
lastModified: dart.definiteFunctionType(async.Future$(core.DateTime), []),
lastModifiedSync: dart.definiteFunctionType(core.DateTime, []),
+ setLastModified: dart.definiteFunctionType(async.Future, [core.DateTime]),
+ setLastModifiedSync: dart.definiteFunctionType(dart.void, [core.DateTime]),
openSync: dart.definiteFunctionType(io.RandomAccessFile, [], {mode: io.FileMode}),
openRead: dart.definiteFunctionType(async.Stream$(core.List$(core.int)), [], [core.int, core.int]),
openWrite: dart.definiteFunctionType(io.IOSink, [], {mode: io.FileMode, encoding: convert.Encoding}),
@@ -38222,26 +39127,49 @@
_renameLink: dart.definiteFunctionType(dart.dynamic, [core.String, core.String]),
_copy: dart.definiteFunctionType(dart.dynamic, [core.String, core.String]),
_lengthFromPath: dart.definiteFunctionType(dart.dynamic, [core.String]),
+ _lastAccessed: dart.definiteFunctionType(dart.dynamic, [core.String]),
+ _setLastAccessed: dart.definiteFunctionType(dart.dynamic, [core.String, core.int]),
_lastModified: dart.definiteFunctionType(dart.dynamic, [core.String]),
+ _setLastModified: dart.definiteFunctionType(dart.dynamic, [core.String, core.int]),
_open: dart.definiteFunctionType(dart.dynamic, [core.String, core.int]),
_openStdio: dart.definiteFunctionType(core.int, [core.int]),
_openStdioSync: dart.definiteFunctionType(io.RandomAccessFile, [core.int]),
throwIfError: dart.definiteFunctionType(dart.dynamic, [core.Object, core.String, core.String])
}),
- names: ['_exists', '_create', '_createLink', '_linkTarget', '_deleteNative', '_deleteLinkNative', '_rename', '_renameLink', '_copy', '_lengthFromPath', '_lastModified', '_open', '_openStdio', '_openStdioSync', 'throwIfError']
+ names: ['_exists', '_create', '_createLink', '_linkTarget', '_deleteNative', '_deleteLinkNative', '_rename', '_renameLink', '_copy', '_lengthFromPath', '_lastAccessed', '_setLastAccessed', '_lastModified', '_setLastModified', '_open', '_openStdio', '_openStdioSync', 'throwIfError']
});
io._RandomAccessFileOps = class _RandomAccessFileOps extends core.Object {
static new(pointer) {
dart.throw(new core.UnsupportedError("RandomAccessFile"));
}
};
+io._FileTranslation = class _FileTranslation extends core.Object {
+ new(index) {
+ this.index = index;
+ }
+ toString() {
+ return {
+ 0: "_FileTranslation.text",
+ 1: "_FileTranslation.binary"
+ }[this.index];
+ }
+};
+dart.setSignature(io._FileTranslation, {
+ fields: () => ({index: core.int})
+});
+dart.defineEnumValues(io._FileTranslation, [
+ 'text',
+ 'binary'
+]);
const _asyncDispatched = Symbol('_asyncDispatched');
const _fileService = Symbol('_fileService');
const _resourceInfo = Symbol('_resourceInfo');
+const _translation = Symbol('_translation');
const _maybeConnectHandler = Symbol('_maybeConnectHandler');
const _maybePerformCleanup = Symbol('_maybePerformCleanup');
const _dispatch = Symbol('_dispatch');
const _checkAvailable = Symbol('_checkAvailable');
+const _fileLockValue = Symbol('_fileLockValue');
io._RandomAccessFile = class _RandomAccessFile extends core.Object {
new(pointer, path) {
this.path = path;
@@ -38249,9 +39177,11 @@
this[_fileService] = null;
this[_resourceInfo] = null;
this[_ops] = null;
+ this[_translation] = null;
this.closed = false;
this[_ops] = io._RandomAccessFileOps.new(pointer);
this[_resourceInfo] = new io._FileResourceInfo(this);
+ this[_translation] = io._FileTranslation.binary;
this[_maybeConnectHandler]();
}
[_maybePerformCleanup]() {
@@ -38313,8 +39243,8 @@
dart.throw(io._exceptionFromResponse(response, "read failed", this.path));
}
this[_resourceInfo].addRead(core.int._check(dart.dload(dart.dindex(response, 1), 'length')));
- return FutureOrOfListOfint()._check(dart.dindex(response, 1));
- }, dynamicToFutureOrOfListOfint()));
+ return ListOfint().as(dart.dindex(response, 1));
+ }, dynamicToListOfint()));
}
readSync(bytes) {
this[_checkAvailable]();
@@ -38326,7 +39256,7 @@
dart.throw(new io.FileSystemException("readSync failed", this.path, result));
}
this[_resourceInfo].addRead(core.int._check(dart.dload(result, 'length')));
- return ListOfint()._check(result);
+ return ListOfint().as(result);
}
readInto(buffer, start, end) {
if (start === void 0) start = 0;
@@ -38344,8 +39274,8 @@
dart.throw(io._exceptionFromResponse(response, "readInto failed", this.path));
}
let read = dart.dindex(response, 1);
- let data = dart.dindex(response, 2);
- buffer[dartx.setRange](start, dart.asInt(dart.notNull(start) + dart.notNull(core.num._check(read))), IterableOfint()._check(data));
+ let data = ListOfint().as(dart.dindex(response, 2));
+ buffer[dartx.setRange](start, dart.asInt(dart.notNull(start) + dart.notNull(core.num._check(read))), data);
this[_resourceInfo].addRead(core.int._check(read));
return FutureOrOfint()._check(read);
}, dynamicToFutureOrOfint()));
@@ -38434,7 +39364,7 @@
return;
}
let bufferAndStart = io._ensureFastAndSerializableByteData(buffer, start, end);
- let result = this[_ops].writeFrom(ListOfint()._check(bufferAndStart.buffer), bufferAndStart.start, dart.notNull(end) - (dart.notNull(start) - dart.notNull(bufferAndStart.start)));
+ let result = this[_ops].writeFrom(bufferAndStart.buffer, bufferAndStart.start, dart.notNull(end) - (dart.notNull(start) - dart.notNull(bufferAndStart.start)));
if (io.OSError.is(result)) {
dart.throw(new io.FileSystemException("writeFrom failed", this.path, result));
}
@@ -38533,6 +39463,30 @@
dart.throw(new io.FileSystemException("flush failed", this.path, result));
}
}
+ [_fileLockValue](fl) {
+ switch (fl) {
+ case io.FileLock.SHARED:
+ {
+ return io._RandomAccessFile.LOCK_SHARED;
+ }
+ case io.FileLock.EXCLUSIVE:
+ {
+ return io._RandomAccessFile.LOCK_EXCLUSIVE;
+ }
+ case io.FileLock.BLOCKING_SHARED:
+ {
+ return io._RandomAccessFile.LOCK_BLOCKING_SHARED;
+ }
+ case io.FileLock.BLOCKING_EXCLUSIVE:
+ {
+ return io._RandomAccessFile.LOCK_BLOCKING_EXCLUSIVE;
+ }
+ default:
+ {
+ return -1;
+ }
+ }
+ }
lock(mode, start, end) {
if (mode === void 0) mode = io.FileLock.EXCLUSIVE;
if (start === void 0) start = 0;
@@ -38543,7 +39497,7 @@
if (dart.notNull(start) < 0 || dart.notNull(end) < -1 || end != -1 && dart.notNull(start) >= dart.notNull(end)) {
dart.throw(new core.ArgumentError());
}
- let lock = dart.equals(mode, io.FileLock.EXCLUSIVE) ? io._RandomAccessFile.LOCK_EXCLUSIVE : io._RandomAccessFile.LOCK_SHARED;
+ let lock = this[_fileLockValue](mode);
return this[_dispatch](io._FILE_LOCK, JSArrayOfint().of([null, lock, start, end])).then(io._RandomAccessFile)(dart.fn(response => {
if (dart.test(io._isErrorResponse(response))) {
dart.throw(io._exceptionFromResponse(response, 'lock failed', this.path));
@@ -38578,7 +39532,7 @@
if (dart.notNull(start) < 0 || dart.notNull(end) < -1 || end != -1 && dart.notNull(start) >= dart.notNull(end)) {
dart.throw(new core.ArgumentError());
}
- let lock = dart.equals(mode, io.FileLock.EXCLUSIVE) ? io._RandomAccessFile.LOCK_EXCLUSIVE : io._RandomAccessFile.LOCK_SHARED;
+ let lock = this[_fileLockValue](mode);
let result = this[_ops].lock(lock, start, end);
if (io.OSError.is(result)) {
dart.throw(new io.FileSystemException('lock failed', this.path, result));
@@ -38599,6 +39553,15 @@
dart.throw(new io.FileSystemException('unlock failed', this.path, result));
}
}
+ get translation() {
+ return this[_translation];
+ }
+ set translation(translation) {
+ if (!dart.equals(this[_translation], translation)) {
+ this[_ops].setTranslation(translation.index);
+ this[_translation] = translation;
+ }
+ }
[_pointer]() {
return this[_ops].getPointer();
}
@@ -38634,11 +39597,14 @@
fields: () => ({
path: core.String,
[_asyncDispatched]: core.bool,
- [_fileService]: isolate.SendPort,
+ [_fileService]: isolate$.SendPort,
[_resourceInfo]: io._FileResourceInfo,
[_ops]: io._RandomAccessFileOps,
+ [_translation]: io._FileTranslation,
closed: core.bool
}),
+ getters: () => ({translation: dart.definiteFunctionType(io._FileTranslation, [])}),
+ setters: () => ({translation: dart.definiteFunctionType(dart.void, [io._FileTranslation])}),
methods: () => ({
[_maybePerformCleanup]: dart.definiteFunctionType(dart.void, []),
[_maybeConnectHandler]: dart.definiteFunctionType(dart.dynamic, []),
@@ -38666,6 +39632,7 @@
lengthSync: dart.definiteFunctionType(core.int, []),
flush: dart.definiteFunctionType(async.Future$(io.RandomAccessFile), []),
flushSync: dart.definiteFunctionType(dart.void, []),
+ [_fileLockValue]: dart.definiteFunctionType(core.int, [io.FileLock]),
lock: dart.definiteFunctionType(async.Future$(io.RandomAccessFile), [], [io.FileLock, core.int, core.int]),
unlock: dart.definiteFunctionType(async.Future$(io.RandomAccessFile), [], [core.int, core.int]),
lockSync: dart.definiteFunctionType(dart.void, [], [io.FileLock, core.int, core.int]),
@@ -38679,7 +39646,9 @@
io._RandomAccessFile.LOCK_UNLOCK = 0;
io._RandomAccessFile.LOCK_SHARED = 1;
io._RandomAccessFile.LOCK_EXCLUSIVE = 2;
-let const$56;
+io._RandomAccessFile.LOCK_BLOCKING_SHARED = 3;
+io._RandomAccessFile.LOCK_BLOCKING_EXCLUSIVE = 4;
+let const$59;
io.FileSystemEntityType = class FileSystemEntityType extends core.Object {
_internal(type) {
this[_type] = type;
@@ -38688,7 +39657,7 @@
return io.FileSystemEntityType._typeList[dartx._get](type);
}
toString() {
- return (const$56 || (const$56 = dart.constList(['FILE', 'DIRECTORY', 'LINK', 'NOT_FOUND'], core.String)))[dartx._get](this[_type]);
+ return (const$59 || (const$59 = dart.constList(['FILE', 'DIRECTORY', 'LINK', 'NOT_FOUND'], core.String)))[dartx._get](this[_type]);
}
};
dart.defineNamedConstructor(io.FileSystemEntityType, '_internal');
@@ -38714,7 +39683,7 @@
return dart.constList([io.FileSystemEntityType.FILE, io.FileSystemEntityType.DIRECTORY, io.FileSystemEntityType.LINK, io.FileSystemEntityType.NOT_FOUND], io.FileSystemEntityType);
}
});
-let const$57;
+let const$60;
io.FileStat = class FileStat extends core.Object {
_internal(changed, modified, accessed, type, mode, size) {
this.changed = changed;
@@ -38760,7 +39729,7 @@
}
modeString() {
let permissions = dart.notNull(this.mode) & 4095;
- let codes = const$57 || (const$57 = dart.constList(['---', '--x', '-w-', '-wx', 'r--', 'r-x', 'rw-', 'rwx'], core.String));
+ let codes = const$60 || (const$60 = dart.constList(['---', '--x', '-w-', '-wx', 'r--', 'r-x', 'rw-', 'rwx'], core.String));
let result = [];
if ((permissions & 2048) != 0) result[dartx.add]("(suid) ");
if ((permissions & 1024) != 0) result[dartx.add]("(guid) ");
@@ -39260,19 +40229,19 @@
}),
getters: () => ({uri: dart.definiteFunctionType(core.Uri, [])})
});
-let const$58;
-let const$59;
-let const$60;
let const$61;
let const$62;
let const$63;
let const$64;
let const$65;
let const$66;
+let const$67;
+let const$68;
+let const$69;
io.HttpDate = class HttpDate extends core.Object {
static format(date) {
- let wkday = const$58 || (const$58 = dart.constList(["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"], core.String));
- let month = const$59 || (const$59 = dart.constList(["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], core.String));
+ let wkday = const$61 || (const$61 = dart.constList(["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"], core.String));
+ let month = const$62 || (const$62 = dart.constList(["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], core.String));
let d = date.toUtc();
let sb = new core.StringBuffer();
sb.write(wkday[dartx._get](dart.notNull(d.weekday) - 1));
@@ -39294,12 +40263,12 @@
}
static parse(date) {
let SP = 32;
- let wkdays = const$60 || (const$60 = dart.constList(["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"], core.String));
- let weekdays = const$61 || (const$61 = dart.constList(["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"], core.String));
- let months = const$62 || (const$62 = dart.constList(["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], core.String));
- let wkdaysLowerCase = const$63 || (const$63 = dart.constList(["mon", "tue", "wed", "thu", "fri", "sat", "sun"], core.String));
- let weekdaysLowerCase = const$64 || (const$64 = dart.constList(["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"], core.String));
- let monthsLowerCase = const$65 || (const$65 = dart.constList(["jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"], core.String));
+ let wkdays = const$63 || (const$63 = dart.constList(["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"], core.String));
+ let weekdays = const$64 || (const$64 = dart.constList(["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"], core.String));
+ let months = const$65 || (const$65 = dart.constList(["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], core.String));
+ let wkdaysLowerCase = const$66 || (const$66 = dart.constList(["mon", "tue", "wed", "thu", "fri", "sat", "sun"], core.String));
+ let weekdaysLowerCase = const$67 || (const$67 = dart.constList(["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"], core.String));
+ let monthsLowerCase = const$68 || (const$68 = dart.constList(["jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"], core.String));
let formatRfc1123 = 0;
let formatRfc850 = 1;
let formatAsctime = 2;
@@ -39415,7 +40384,7 @@
return new core.DateTime.utc(year, dart.notNull(month) + 1, day, hours, minutes, seconds, 0);
}
static _parseCookieDate(date) {
- let monthsLowerCase = const$66 || (const$66 = dart.constList(["jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"], core.String));
+ let monthsLowerCase = const$69 || (const$69 = dart.constList(["jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"], core.String));
let position = 0;
function error() {
dart.throw(new io.HttpException(dart.str`Invalid cookie date ${date}`));
@@ -39549,7 +40518,7 @@
const _addIfModifiedSince = Symbol('_addIfModifiedSince');
const _foldHeader = Symbol('_foldHeader');
const _finalize = Symbol('_finalize');
-const _write = Symbol('_write');
+const _build = Symbol('_build');
const _parseCookies = Symbol('_parseCookies');
io._HttpHeaders = class _HttpHeaders extends core.Object {
new(protocolVersion, opts) {
@@ -39985,81 +40954,32 @@
[_finalize]() {
this[_mutable] = false;
}
- [_write](buffer, offset) {
- function write(bytes) {
- let len = bytes[dartx.length];
- for (let i = 0; i < dart.notNull(len); i++) {
- buffer[dartx._set](dart.notNull(offset) + i, bytes[dartx._get](i));
- }
- offset = dart.notNull(offset) + dart.notNull(len);
- }
- dart.fn(write, ListOfintTovoid());
+ [_build](builder) {
for (let name of this[_headers][dartx.keys]) {
let values = this[_headers][dartx._get](name);
let fold = core.bool._check(this[_foldHeader](name));
let nameData = name[dartx.codeUnits];
- write(nameData);
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.COLON);
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.SP);
+ builder.add(nameData);
+ builder.addByte(io._CharCode.COLON);
+ builder.addByte(io._CharCode.SP);
for (let i = 0; i < dart.notNull(values[dartx.length]); i++) {
if (i > 0) {
if (dart.test(fold)) {
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.COMMA);
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.SP);
+ builder.addByte(io._CharCode.COMMA);
+ builder.addByte(io._CharCode.SP);
} else {
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.CR);
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.LF);
- write(nameData);
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.COLON);
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.SP);
+ builder.addByte(io._CharCode.CR);
+ builder.addByte(io._CharCode.LF);
+ builder.add(nameData);
+ builder.addByte(io._CharCode.COLON);
+ builder.addByte(io._CharCode.SP);
}
}
- write(values[dartx._get](i)[dartx.codeUnits]);
+ builder.add(values[dartx._get](i)[dartx.codeUnits]);
}
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.CR);
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.LF);
+ builder.addByte(io._CharCode.CR);
+ builder.addByte(io._CharCode.LF);
}
- return offset;
}
toString() {
let sb = new core.StringBuffer();
@@ -40234,7 +41154,7 @@
[_updateHostHeader]: dart.definiteFunctionType(dart.dynamic, []),
[_foldHeader]: dart.definiteFunctionType(dart.dynamic, [core.String]),
[_finalize]: dart.definiteFunctionType(dart.void, []),
- [_write]: dart.definiteFunctionType(core.int, [typed_data.Uint8List, core.int]),
+ [_build]: dart.definiteFunctionType(dart.void, [io.BytesBuilder]),
[_parseCookies]: dart.definiteFunctionType(core.List$(io.Cookie), [])
}),
statics: () => ({
@@ -40383,7 +41303,7 @@
return;
}
let value = parseParameterValue();
- if (name == 'charset' && io._ContentType.is(this)) {
+ if (name == 'charset' && io._ContentType.is(this) && value != null) {
value = value[dartx.toLowerCase]();
}
parameters._set(name, value);
@@ -40494,7 +41414,7 @@
});
const _validate = Symbol('_validate');
const _parseSetCookieValue = Symbol('_parseSetCookieValue');
-let const$67;
+let const$70;
io._Cookie = class _Cookie extends core.Object {
new(name, value) {
if (name === void 0) name = null;
@@ -40633,7 +41553,7 @@
return sb.toString();
}
[_validate]() {
- let SEPERATORS = const$67 || (const$67 = dart.constList(["(", ")", "<", ">", "@", ",", ";", ":", "\\", '"', "/", "[", "]", "?", "=", "{", "}"], core.String));
+ let SEPERATORS = const$70 || (const$70 = dart.constList(["(", ")", "<", ">", "@", ",", ";", ":", "\\", '"', "/", "[", "]", "?", "=", "{", "}"], core.String));
for (let i = 0; i < dart.notNull(this.name[dartx.length]); i++) {
let codeUnit = this.name[dartx.codeUnits][dartx._get](i);
if (dart.notNull(codeUnit) <= 32 || dart.notNull(codeUnit) >= 127 || dart.notNull(SEPERATORS[dartx.indexOf](this.name[dartx._get](i))) >= 0) {
@@ -40667,6 +41587,7 @@
})
});
io._OUTGOING_BUFFER_SIZE = 8 * 1024;
+io._BytesConsumer = dart.typedef('_BytesConsumer', () => dart.functionType(dart.void, [ListOfint()]));
const _transferLength = Symbol('_transferLength');
const _dataCompleter = Symbol('_dataCompleter');
const _stream$ = Symbol('_stream');
@@ -40965,7 +41886,7 @@
let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : null;
if (dart.test(this[_incoming].upgraded)) {
this[_httpRequest][_httpClientConnection].destroy();
- return StreamSubscriptionOfListOfint()._check(async.Stream.fromIterable([]).listen(null, {onDone: onDone}));
+ return StreamOfListOfint().empty().listen(null, {onDone: onDone});
}
let stream = this[_incoming];
if (dart.test(this[_httpClient].autoUncompress) && this.headers.value(io.HttpHeaders.CONTENT_ENCODING) == "gzip") {
@@ -41087,7 +42008,7 @@
[_authenticate]: dart.definiteFunctionType(async.Future$(io.HttpClientResponse), [core.bool])
})
});
-const _uri = Symbol('_uri');
+const _uri$ = Symbol('_uri');
const _outgoing = Symbol('_outgoing');
const _encodingSet = Symbol('_encodingSet');
const _bufferOutput = Symbol('_bufferOutput');
@@ -41315,7 +42236,7 @@
class _HttpOutboundMessage extends io._IOSinkImpl {
new(uri, protocolVersion, outgoing, opts) {
let initialHeaders = opts && 'initialHeaders' in opts ? opts.initialHeaders : null;
- this[_uri] = uri;
+ this[_uri$] = uri;
this.headers = new io._HttpHeaders(protocolVersion, {defaultPortForScheme: uri.scheme == 'https' ? io.HttpClient.DEFAULT_HTTPS_PORT : io.HttpClient.DEFAULT_HTTP_PORT, initialHeaders: initialHeaders});
this[_outgoing] = outgoing;
this[_encodingSet] = false;
@@ -41378,7 +42299,7 @@
fields: () => ({
[_encodingSet]: core.bool,
[_bufferOutput]: core.bool,
- [_uri]: core.Uri,
+ [_uri$]: core.Uri,
[_outgoing]: io._HttpOutgoing,
headers: io._HttpHeaders
}),
@@ -41475,43 +42396,18 @@
}, VoidToNull()));
}
[_writeHeader]() {
- let buffer = typed_data.Uint8List.new(io._OUTGOING_BUFFER_SIZE);
- let offset = 0;
- function write(bytes) {
- let len = bytes[dartx.length];
- for (let i = 0; i < dart.notNull(len); i++) {
- buffer[dartx._set](dart.notNull(offset) + i, bytes[dartx._get](i));
- }
- offset = dart.notNull(offset) + dart.notNull(len);
- }
- dart.fn(write, ListOfintTovoid());
+ let buffer = new io._CopyingBytesBuilder(io._OUTGOING_BUFFER_SIZE);
if (this.headers.protocolVersion == "1.1") {
- write(io._Const.HTTP11);
+ buffer.add(io._Const.HTTP11);
} else {
- write(io._Const.HTTP10);
+ buffer.add(io._Const.HTTP10);
}
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.SP);
- write(dart.toString(this.statusCode)[dartx.codeUnits]);
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.SP);
- write(this.reasonPhrase[dartx.codeUnits]);
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.CR);
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.LF);
+ buffer.addByte(io._CharCode.SP);
+ buffer.add(dart.toString(this.statusCode)[dartx.codeUnits]);
+ buffer.addByte(io._CharCode.SP);
+ buffer.add(this.reasonPhrase[dartx.codeUnits]);
+ buffer.addByte(io._CharCode.CR);
+ buffer.addByte(io._CharCode.LF);
let session = this[_httpRequest][_session];
if (session != null && !dart.test(session[_destroyed])) {
session[_isNew] = false;
@@ -41540,18 +42436,11 @@
}, CookieToNull()));
}
this.headers[_finalize]();
- offset = this.headers[_write](buffer, offset);
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.CR);
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.LF);
- this[_outgoing].setHeader(buffer, offset);
+ this.headers[_build](buffer);
+ buffer.addByte(io._CharCode.CR);
+ buffer.addByte(io._CharCode.LF);
+ let headerBytes = typed_data.Uint8List._check(buffer.takeBytes());
+ this[_outgoing].setHeader(headerBytes, headerBytes[dartx.length]);
}
[_findReasonPhrase](statusCode) {
if (this[_reasonPhrase] != null) {
@@ -41856,39 +42745,14 @@
}
}
[_writeHeader]() {
- let buffer = typed_data.Uint8List.new(io._OUTGOING_BUFFER_SIZE);
- let offset = 0;
- function write(bytes) {
- let len = bytes[dartx.length];
- for (let i = 0; i < dart.notNull(len); i++) {
- buffer[dartx._set](dart.notNull(offset) + i, bytes[dartx._get](i));
- }
- offset = dart.notNull(offset) + dart.notNull(len);
- }
- dart.fn(write, ListOfintTovoid());
- write(this.method[dartx.codeUnits]);
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.SP);
- write(this[_requestUri]()[dartx.codeUnits]);
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.SP);
- write(io._Const.HTTP11);
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.CR);
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.LF);
+ let buffer = new io._CopyingBytesBuilder(io._OUTGOING_BUFFER_SIZE);
+ buffer.add(this.method[dartx.codeUnits]);
+ buffer.addByte(io._CharCode.SP);
+ buffer.add(this[_requestUri]()[dartx.codeUnits]);
+ buffer.addByte(io._CharCode.SP);
+ buffer.add(io._Const.HTTP11);
+ buffer.addByte(io._CharCode.CR);
+ buffer.addByte(io._CharCode.LF);
if (!dart.test(this.cookies[dartx.isEmpty])) {
let sb = new core.StringBuffer();
for (let i = 0; i < dart.notNull(this.cookies[dartx.length]); i++) {
@@ -41900,18 +42764,11 @@
this.headers.add(io.HttpHeaders.COOKIE, sb.toString());
}
this.headers[_finalize]();
- offset = this.headers[_write](buffer, offset);
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.CR);
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.LF);
- this[_outgoing].setHeader(buffer, offset);
+ this.headers[_build](buffer);
+ buffer.addByte(io._CharCode.CR);
+ buffer.addByte(io._CharCode.LF);
+ let headerBytes = typed_data.Uint8List._check(buffer.takeBytes());
+ this[_outgoing].setHeader(headerBytes, headerBytes[dartx.length]);
}
};
dart.addSimpleTypeTests(io._HttpClientRequest);
@@ -41955,19 +42812,19 @@
super.new();
}
add(chunk) {
- dart.dcall(this[_consume], chunk);
+ this[_consume](chunk);
}
addSlice(chunk, start, end, isLast) {
if (typed_data.Uint8List.is(chunk)) {
- dart.dcall(this[_consume], typed_data.Uint8List.view(chunk[dartx.buffer], start, dart.notNull(end) - dart.notNull(start)));
+ this[_consume](typed_data.Uint8List.view(chunk[dartx.buffer], start, dart.notNull(end) - dart.notNull(start)));
} else {
- dart.dcall(this[_consume], chunk[dartx.sublist](start, dart.notNull(end) - dart.notNull(start)));
+ this[_consume](chunk[dartx.sublist](start, dart.notNull(end) - dart.notNull(start)));
}
}
close() {}
};
dart.setSignature(io._HttpGZipSink, {
- fields: () => ({[_consume]: core.Function}),
+ fields: () => ({[_consume]: io._BytesConsumer}),
methods: () => ({
add: dart.definiteFunctionType(dart.void, [ListOfint()]),
addSlice: dart.definiteFunctionType(dart.void, [ListOfint(), core.int, core.int, core.bool]),
@@ -41987,10 +42844,10 @@
const _addChunk$ = Symbol('_addChunk');
const _chunkHeader = Symbol('_chunkHeader');
const _ignoreError = Symbol('_ignoreError');
-let const$68;
+let const$71;
io._HttpOutgoing = class _HttpOutgoing extends core.Object {
new(socket) {
- this[_doneCompleter] = async.Completer.new();
+ this[_doneCompleter] = CompleterOfSocket().new();
this.socket = socket;
this.ignoreBody = false;
this.headersWritten = false;
@@ -42012,16 +42869,6 @@
writeHeaders(opts) {
let drainRequest = opts && 'drainRequest' in opts ? opts.drainRequest : true;
let setOutgoing = opts && 'setOutgoing' in opts ? opts.setOutgoing : true;
- const write = (function() {
- try {
- this.outbound[_writeHeader]();
- } catch (_) {
- return async.Future.error(new io.HttpException(dart.str`Headers size exceeded the of '${io._OUTGOING_BUFFER_SIZE}'` + " bytes"));
- }
-
- return null;
- }).bind(this);
- dart.fn(write, VoidToFuture());
if (dart.test(this.headersWritten)) return null;
this.headersWritten = true;
let drainFuture = null;
@@ -42043,22 +42890,22 @@
} else {
drainRequest = false;
}
- if (dart.test(this.ignoreBody)) {
- return write();
- }
- if (dart.test(setOutgoing)) {
- let contentLength = this.outbound.headers.contentLength;
- if (dart.test(this.outbound.headers.chunkedTransferEncoding)) {
- this.chunked = true;
- if (gzip) this.gzip = true;
- } else if (dart.notNull(contentLength) >= 0) {
- this.contentLength = contentLength;
+ if (!dart.test(this.ignoreBody)) {
+ if (dart.test(setOutgoing)) {
+ let contentLength = this.outbound.headers.contentLength;
+ if (dart.test(this.outbound.headers.chunkedTransferEncoding)) {
+ this.chunked = true;
+ if (gzip) this.gzip = true;
+ } else if (dart.notNull(contentLength) >= 0) {
+ this.contentLength = contentLength;
+ }
+ }
+ if (drainFuture != null) {
+ return drainFuture.then(dart.void)(dart.fn(_ => this.outbound[_writeHeader](), dynamicTovoid$()));
}
}
- if (drainFuture != null) {
- return drainFuture.then(dart.dynamic)(dart.fn(_ => write(), dynamicToFuture()));
- }
- return write();
+ this.outbound[_writeHeader]();
+ return null;
}
addStream(stream) {
if (dart.test(this[_socketError])) {
@@ -42075,10 +42922,10 @@
return this.close();
}
let sub = null;
- let controller = async.StreamController.new({onPause: dart.fn(() => dart.dsend(sub, 'pause'), VoidTovoid$()), onResume: dart.fn(() => dart.dsend(sub, 'resume'), VoidTovoid$()), sync: true});
+ let controller = StreamControllerOfListOfint().new({onPause: dart.fn(() => sub.pause(), VoidTovoid$()), onResume: dart.fn(() => sub.resume(), VoidTovoid$()), sync: true});
const onData = (function(data) {
if (dart.test(this[_socketError])) return;
- if (dart.equals(dart.dload(data, 'length'), 0)) return;
+ if (data[dartx.length] == 0) return;
if (dart.test(this.chunked)) {
if (dart.test(this[_gzip])) {
this[_gzipAdd] = dart.bind(controller, 'add');
@@ -42086,28 +42933,28 @@
this[_gzipAdd] = null;
return;
}
- this[_addChunk$](this[_chunkHeader](core.int._check(dart.dload(data, 'length'))), dart.bind(controller, 'add'));
+ this[_addChunk$](this[_chunkHeader](data[dartx.length]), dart.bind(controller, 'add'));
this[_pendingChunkedFooter] = 2;
} else {
if (this.contentLength != null) {
- this[_bytesWritten] = dart.notNull(this[_bytesWritten]) + dart.notNull(core.num._check(dart.dload(data, 'length')));
+ this[_bytesWritten] = dart.notNull(this[_bytesWritten]) + dart.notNull(data[dartx.length]);
if (dart.notNull(this[_bytesWritten]) > dart.notNull(this.contentLength)) {
- controller.addError(new io.HttpException("Content size exceeds specified contentLength. " + dart.str`${this[_bytesWritten]} bytes written while expected ` + dart.str`${this.contentLength}. ` + dart.str`[${core.String.fromCharCodes(IterableOfint()._check(data))}]`));
+ controller.addError(new io.HttpException("Content size exceeds specified contentLength. " + dart.str`${this[_bytesWritten]} bytes written while expected ` + dart.str`${this.contentLength}. ` + dart.str`[${core.String.fromCharCodes(data)}]`));
return;
}
}
}
this[_addChunk$](data, dart.bind(controller, 'add'));
}).bind(this);
- dart.fn(onData, dynamicTovoid$());
+ dart.fn(onData, ListOfintTovoid());
sub = stream.listen(onData, {onError: dart.bind(controller, 'addError'), onDone: dart.bind(controller, 'close'), cancelOnError: true});
if (!dart.test(this.headersWritten)) {
let future = this.writeHeaders();
if (future != null) {
- dart.dsend(sub, 'pause', future);
+ sub.pause(future);
}
}
- return this.socket.addStream(StreamOfListOfint()._check(controller.stream)).then(io._HttpOutboundMessage)(dart.fn(_ => this.outbound, dynamicTo_HttpOutboundMessage()), {onError: dart.fn((error, stackTrace) => {
+ return this.socket.addStream(controller.stream).then(io._HttpOutboundMessage)(dart.fn(_ => this.outbound, dynamicTo_HttpOutboundMessage()), {onError: dart.fn((error, stackTrace) => {
if (dart.test(this[_gzip])) this[_gzipSink].close();
this[_socketError] = true;
this[_doneCompleter].completeError(error, core.StackTrace._check(stackTrace));
@@ -42127,14 +42974,14 @@
this.outbound.headers.chunkedTransferEncoding = false;
this.outbound.headers.contentLength = 0;
} else if (dart.notNull(this.outbound.headers.contentLength) > 0) {
- let error = new io.HttpException("No content even though contentLength was specified to be " + dart.str`greater than 0: ${this.outbound.headers.contentLength}.`, {uri: this.outbound[_uri]});
+ let error = new io.HttpException("No content even though contentLength was specified to be " + dart.str`greater than 0: ${this.outbound.headers.contentLength}.`, {uri: this.outbound[_uri$]});
this[_doneCompleter].completeError(error);
return this[_closeFuture] = async.Future.error(error);
}
}
if (this.contentLength != null) {
if (dart.notNull(this[_bytesWritten]) < dart.notNull(this.contentLength)) {
- let error = new io.HttpException("Content size below specified contentLength. " + dart.str` ${this[_bytesWritten]} bytes written but expected ` + dart.str`${this.contentLength}.`, {uri: this.outbound[_uri]});
+ let error = new io.HttpException("Content size below specified contentLength. " + dart.str` ${this[_bytesWritten]} bytes written but expected ` + dart.str`${this.contentLength}.`, {uri: this.outbound[_uri$]});
this[_doneCompleter].completeError(error);
return this[_closeFuture] = async.Future.error(error);
}
@@ -42180,7 +43027,6 @@
}
setHeader(data, length) {
dart.assert(this[_length$2] == 0);
- dart.assert(data[dartx.length] == io._OUTGOING_BUFFER_SIZE);
this[_buffer$] = typed_data.Uint8List._check(data);
this[_length$2] = length;
}
@@ -42191,10 +43037,10 @@
dart.assert(this[_gzipSink] == null);
this[_gzipSink] = new io.ZLibEncoder({gzip: true}).startChunkedConversion(new io._HttpGZipSink(dart.fn(data => {
if (this[_gzipAdd] == null) return;
- this[_addChunk$](this[_chunkHeader](core.int._check(dart.dload(data, 'length'))), _ChunkedConversionCallbackOfListOfint()._check(this[_gzipAdd]));
+ this[_addChunk$](this[_chunkHeader](data[dartx.length]), this[_gzipAdd]);
this[_pendingChunkedFooter] = 2;
- this[_addChunk$](data, _ChunkedConversionCallbackOfListOfint()._check(this[_gzipAdd]));
- }, dynamicToNull$())));
+ this[_addChunk$](data, this[_gzipAdd]);
+ }, ListOfintToNull())));
}
}
[_ignoreError](error) {
@@ -42202,19 +43048,19 @@
}
[_addGZipChunk](chunk, add) {
if (!dart.test(this.outbound.bufferOutput)) {
- add(ListOfint()._check(chunk));
+ add(chunk);
return;
}
- if (dart.test(dart.dsend(dart.dload(chunk, 'length'), '>', dart.notNull(this[_gzipBuffer][dartx.length]) - dart.notNull(this[_gzipBufferLength])))) {
+ if (dart.notNull(chunk[dartx.length]) > dart.notNull(this[_gzipBuffer][dartx.length]) - dart.notNull(this[_gzipBufferLength])) {
add(typed_data.Uint8List.view(this[_gzipBuffer][dartx.buffer], 0, this[_gzipBufferLength]));
this[_gzipBuffer] = typed_data.Uint8List.new(io._OUTGOING_BUFFER_SIZE);
this[_gzipBufferLength] = 0;
}
- if (dart.test(dart.dsend(dart.dload(chunk, 'length'), '>', io._OUTGOING_BUFFER_SIZE))) {
- add(ListOfint()._check(chunk));
+ if (dart.notNull(chunk[dartx.length]) > io._OUTGOING_BUFFER_SIZE) {
+ add(chunk);
} else {
- this[_gzipBuffer][dartx.setRange](this[_gzipBufferLength], dart.asInt(dart.notNull(this[_gzipBufferLength]) + dart.notNull(core.num._check(dart.dload(chunk, 'length')))), IterableOfint()._check(chunk));
- this[_gzipBufferLength] = dart.notNull(this[_gzipBufferLength]) + dart.notNull(core.num._check(dart.dload(chunk, 'length')));
+ this[_gzipBuffer][dartx.setRange](this[_gzipBufferLength], dart.notNull(this[_gzipBufferLength]) + dart.notNull(chunk[dartx.length]), chunk);
+ this[_gzipBufferLength] = dart.notNull(this[_gzipBufferLength]) + dart.notNull(chunk[dartx.length]);
}
}
[_addChunk$](chunk, add) {
@@ -42224,23 +43070,23 @@
this[_buffer$] = null;
this[_length$2] = 0;
}
- add(ListOfint()._check(chunk));
+ add(chunk);
return;
}
- if (dart.test(dart.dsend(dart.dload(chunk, 'length'), '>', dart.notNull(this[_buffer$][dartx.length]) - dart.notNull(this[_length$2])))) {
+ if (dart.notNull(chunk[dartx.length]) > dart.notNull(this[_buffer$][dartx.length]) - dart.notNull(this[_length$2])) {
add(typed_data.Uint8List.view(this[_buffer$][dartx.buffer], 0, this[_length$2]));
this[_buffer$] = typed_data.Uint8List.new(io._OUTGOING_BUFFER_SIZE);
this[_length$2] = 0;
}
- if (dart.test(dart.dsend(dart.dload(chunk, 'length'), '>', io._OUTGOING_BUFFER_SIZE))) {
- add(ListOfint()._check(chunk));
+ if (dart.notNull(chunk[dartx.length]) > io._OUTGOING_BUFFER_SIZE) {
+ add(chunk);
} else {
- this[_buffer$][dartx.setRange](this[_length$2], dart.asInt(dart.notNull(this[_length$2]) + dart.notNull(core.num._check(dart.dload(chunk, 'length')))), IterableOfint()._check(chunk));
- this[_length$2] = dart.notNull(this[_length$2]) + dart.notNull(core.num._check(dart.dload(chunk, 'length')));
+ this[_buffer$][dartx.setRange](this[_length$2], dart.notNull(this[_length$2]) + dart.notNull(chunk[dartx.length]), chunk);
+ this[_length$2] = dart.notNull(this[_length$2]) + dart.notNull(chunk[dartx.length]);
}
}
[_chunkHeader](length) {
- let hexDigits = const$68 || (const$68 = dart.constList([48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70], core.int));
+ let hexDigits = const$71 || (const$71 = dart.constList([48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70], core.int));
if (length == 0) {
if (this[_pendingChunkedFooter] == 2) return io._HttpOutgoing._footerAndChunk0Length;
return io._HttpOutgoing._chunk0Length;
@@ -42269,7 +43115,7 @@
io._HttpOutgoing[dart.implements] = () => [StreamConsumerOfListOfint()];
dart.setSignature(io._HttpOutgoing, {
fields: () => ({
- [_doneCompleter]: async.Completer,
+ [_doneCompleter]: CompleterOfSocket(),
socket: io.Socket,
ignoreBody: core.bool,
headersWritten: core.bool,
@@ -42282,13 +43128,13 @@
[_bytesWritten]: core.int,
[_gzip]: core.bool,
[_gzipSink]: convert.ByteConversionSink,
- [_gzipAdd]: core.Function,
+ [_gzipAdd]: io._BytesConsumer,
[_gzipBuffer]: typed_data.Uint8List,
[_gzipBufferLength]: core.int,
[_socketError]: core.bool,
outbound: io._HttpOutboundMessage
}),
- getters: () => ({done: dart.definiteFunctionType(async.Future, [])}),
+ getters: () => ({done: dart.definiteFunctionType(async.Future$(io.Socket), [])}),
setters: () => ({gzip: dart.definiteFunctionType(dart.void, [core.bool])}),
methods: () => ({
writeHeaders: dart.definiteFunctionType(async.Future, [], {drainRequest: core.bool, setOutgoing: core.bool}),
@@ -42296,8 +43142,8 @@
close: dart.definiteFunctionType(async.Future, []),
setHeader: dart.definiteFunctionType(dart.void, [ListOfint(), core.int]),
[_ignoreError]: dart.definiteFunctionType(core.bool, [dart.dynamic]),
- [_addGZipChunk]: dart.definiteFunctionType(dart.void, [dart.dynamic, _ChunkedConversionCallbackOfListOfint()]),
- [_addChunk$]: dart.definiteFunctionType(dart.void, [dart.dynamic, _ChunkedConversionCallbackOfListOfint()]),
+ [_addGZipChunk]: dart.definiteFunctionType(dart.void, [ListOfint(), _ChunkedConversionCallbackOfListOfint()]),
+ [_addChunk$]: dart.definiteFunctionType(dart.void, [ListOfint(), _ChunkedConversionCallbackOfListOfint()]),
[_chunkHeader]: dart.definiteFunctionType(core.List$(core.int), [core.int])
})
});
@@ -42405,7 +43251,7 @@
}
}
this[_httpParser].isHead = method == "HEAD";
- this[_streamFuture] = outgoing.done.then(dart.dynamic)(dart.fn(s => {
+ this[_streamFuture] = outgoing.done.then(io.Socket)(dart.fn(s => {
this[_nextResponseCompleter] = CompleterOf_HttpIncoming().new();
this[_nextResponseCompleter].future.then(dart.dynamic)(dart.fn(incoming => {
this[_currentUri] = null;
@@ -42448,13 +43294,13 @@
}, dynamicAnddynamicToNull()));
this[_subscription$].resume();
return s;
- }, dynamicTodynamic$()), {onError: dart.fn(e => {
+ }, SocketToSocket()), {onError: dart.fn(e => {
this.destroy();
}, dynamicToNull$())});
return request;
}
detachSocket() {
- return this[_streamFuture].then(io._DetachedSocket)(dart.fn(_ => new io._DetachedSocket(this[_socket], this[_httpParser].detachIncoming()), dynamicTo_DetachedSocket()));
+ return this[_streamFuture].then(io._DetachedSocket)(dart.fn(_ => new io._DetachedSocket(this[_socket], this[_httpParser].detachIncoming()), SocketTo_DetachedSocket()));
}
destroy() {
this.closed = true;
@@ -42464,12 +43310,12 @@
close() {
this.closed = true;
this[_httpClient][_connectionClosed](this);
- this[_streamFuture].then(dart.void)(dart.fn(_ => this[_socket].destroy(), dynamicTovoid$()));
+ this[_streamFuture].then(dart.void)(dart.fn(_ => this[_socket].destroy(), SocketTovoid()));
}
createProxyTunnel(host, port, proxy, callback) {
- let request = this.send(core.Uri.new({host: core.String._check(host), port: core.int._check(port)}), core.int._check(port), "CONNECT", io._Proxy._check(proxy));
- if (dart.test(dart.dload(proxy, 'isAuthenticated'))) {
- let auth = io._CryptoUtils.bytesToBase64(convert.UTF8.encode(dart.str`${dart.dload(proxy, 'username')}:${dart.dload(proxy, 'password')}`));
+ let request = this.send(core.Uri.new({host: host, port: port}), port, "CONNECT", proxy);
+ if (dart.test(proxy.isAuthenticated)) {
+ let auth = io._CryptoUtils.bytesToBase64(convert.UTF8.encode(dart.str`${proxy.username}:${proxy.password}`));
request.headers.set(io.HttpHeaders.PROXY_AUTHORIZATION, dart.str`Basic ${auth}`);
}
return request.close().then(io.SecureSocket)(dart.fn(response => {
@@ -42477,9 +43323,9 @@
dart.throw("Proxy failed to establish tunnel " + dart.str`(${response.statusCode} ${response.reasonPhrase})`);
}
let socket = io._HttpClientResponse.as(response)[_httpRequest][_httpClientConnection][_socket];
- return io.SecureSocket.secure(socket, {host: host, context: this[_context], onBadCertificate: X509CertificateTobool()._check(callback)});
+ return io.SecureSocket.secure(socket, {host: host, context: this[_context], onBadCertificate: callback});
}, HttpClientResponseToFutureOfSecureSocket())).then(io._HttpClientConnection)(dart.fn(secureSocket => {
- let key = core.String._check(io._HttpClientConnection.makeKey(true, core.String._check(host), core.int._check(port)));
+ let key = core.String._check(io._HttpClientConnection.makeKey(true, host, port));
return new io._HttpClientConnection(key, secureSocket, request[_httpClient], true);
}, SecureSocketTo_HttpClientConnection()));
}
@@ -42517,7 +43363,7 @@
closed: core.bool,
[_currentUri]: core.Uri,
[_nextResponseCompleter]: CompleterOf_HttpIncoming(),
- [_streamFuture]: async.Future
+ [_streamFuture]: FutureOfSocket()
}),
getters: () => ({connectionInfo: dart.definiteFunctionType(io.HttpConnectionInfo, [])}),
methods: () => ({
@@ -42525,7 +43371,7 @@
detachSocket: dart.definiteFunctionType(async.Future$(io.Socket), []),
destroy: dart.definiteFunctionType(dart.void, []),
close: dart.definiteFunctionType(dart.void, []),
- createProxyTunnel: dart.definiteFunctionType(async.Future$(io._HttpClientConnection), [dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic]),
+ createProxyTunnel: dart.definiteFunctionType(async.Future$(io._HttpClientConnection), [core.String, core.int, io._Proxy, X509CertificateTobool()]),
stopTimer: dart.definiteFunctionType(dart.void, []),
startTimer: dart.definiteFunctionType(dart.void, [])
}),
@@ -42619,11 +43465,11 @@
return FutureOf_ConnectionInfo().value(new io._ConnectionInfo(connection, proxy));
}
if (client.maxConnectionsPerHost != null && dart.notNull(this[_active].length) + dart.notNull(this[_connecting]) >= dart.notNull(client.maxConnectionsPerHost)) {
- let completer = async.Completer.new();
+ let completer = CompleterOf_ConnectionInfo().new();
this[_pending$].add(dart.fn(() => {
- this.connect(uriHost, uriPort, proxy, client).then(dart.void)(dart.bind(completer, 'complete'), {onError: dart.bind(completer, 'completeError')});
+ completer.complete(this.connect(uriHost, uriPort, proxy, client));
}, VoidToNull()));
- return FutureOf_ConnectionInfo()._check(completer.future);
+ return completer.future;
}
let currentBadCertificateCallback = client[_badCertificateCallback];
function callback(certificate) {
@@ -42683,7 +43529,7 @@
});
io.BadCertificateCallback = dart.typedef('BadCertificateCallback', () => dart.functionType(core.bool, [io.X509Certificate, core.String, core.int]));
const _idleTimeout = Symbol('_idleTimeout');
-let const$69;
+let const$72;
const _connectionTargets = Symbol('_connectionTargets');
const _credentials = Symbol('_credentials');
const _closing = Symbol('_closing');
@@ -42691,7 +43537,7 @@
const _findProxy = Symbol('_findProxy');
const _openUrl = Symbol('_openUrl');
const _closeConnections = Symbol('_closeConnections');
-let const$70;
+let const$73;
const _getConnection = Symbol('_getConnection');
io._HttpClient = class _HttpClient extends core.Object {
get idleTimeout() {
@@ -42708,7 +43554,7 @@
this[_authenticate] = null;
this[_authenticateProxy] = null;
this[_findProxy] = io.HttpClient.findProxyFromEnvironment;
- this[_idleTimeout] = const$69 || (const$69 = dart.const(new core.Duration({seconds: 15})));
+ this[_idleTimeout] = const$72 || (const$72 = dart.const(new core.Duration({seconds: 15})));
this[_badCertificateCallback] = null;
this.maxConnectionsPerHost = null;
this.autoUncompress = true;
@@ -42826,7 +43672,7 @@
if (port == 0) {
port = isSecure ? io.HttpClient.DEFAULT_HTTPS_PORT : io.HttpClient.DEFAULT_HTTP_PORT;
}
- let proxyConf = const$70 || (const$70 = dart.const(new io._ProxyConfiguration.direct()));
+ let proxyConf = const$73 || (const$73 = dart.const(new io._ProxyConfiguration.direct()));
if (this[_findProxy] != null) {
try {
proxyConf = new io._ProxyConfiguration(core.String._check(dart.dcall(this[_findProxy], uri)));
@@ -43122,7 +43968,7 @@
}
io._HttpConnection._connections[dartx._set](this[_serviceId], this);
- this[_httpParser].listenToStream(StreamOfListOfint()._check(this[_socket]));
+ this[_httpParser].listenToStream(io.Socket.as(this[_socket]));
this[_subscription$] = this[_httpParser].listen(dart.fn(incoming => {
this[_httpServer][_markActive](this);
incoming.dataDone.then(dart.dynamic)(dart.fn(closing => {
@@ -43144,7 +43990,7 @@
} else {
this.destroy();
}
- }, dynamicToNull$()), {onError: dart.fn(_ => {
+ }, SocketToNull()), {onError: dart.fn(_ => {
this.destroy();
}, dynamicToNull$())});
outgoing.ignoreBody = request.method == "HEAD";
@@ -43175,7 +44021,7 @@
let detachedIncoming = this[_httpParser].detachIncoming();
return this[_streamFuture].then(io._DetachedSocket)(dart.fn(_ => {
io._HttpConnection._connections[dartx.remove](this[_serviceId]);
- return new io._DetachedSocket(this[_socket], detachedIncoming);
+ return new io._DetachedSocket(io.Socket._check(this[_socket]), detachedIncoming);
}, dynamicTo_DetachedSocket()));
}
get connectionInfo() {
@@ -43285,8 +44131,8 @@
const _idleConnections = Symbol('_idleConnections');
const _serverSocket = Symbol('_serverSocket');
const _closeServer = Symbol('_closeServer');
-let const$71;
-let const$72;
+let const$74;
+let const$75;
io._HttpServer = class _HttpServer extends dart.mixin(async.Stream$(io.HttpRequest), io._ServiceObject) {
static bind(address, port, backlog, v6Only, shared) {
return io.ServerSocket.bind(address, port, {backlog: backlog, v6Only: v6Only, shared: shared}).then(io._HttpServer)(dart.fn(socket => new io._HttpServer._(socket, true), ServerSocketTo_HttpServer()));
@@ -43309,7 +44155,7 @@
this[_controller$0] = null;
super.new();
this[_controller$0] = StreamControllerOfHttpRequest().new({sync: true, onCancel: dart.bind(this, 'close')});
- this.idleTimeout = const$71 || (const$71 = dart.const(new core.Duration({seconds: 120})));
+ this.idleTimeout = const$74 || (const$74 = dart.const(new core.Duration({seconds: 120})));
io._HttpServer._servers[dartx._set](this[_serviceId], this);
dart.dput(this[_serverSocket], _owner, this);
}
@@ -43328,7 +44174,7 @@
this[_controller$0] = null;
super.new();
this[_controller$0] = StreamControllerOfHttpRequest().new({sync: true, onCancel: dart.bind(this, 'close')});
- this.idleTimeout = const$72 || (const$72 = dart.const(new core.Duration({seconds: 120})));
+ this.idleTimeout = const$75 || (const$75 = dart.const(new core.Duration({seconds: 120})));
io._HttpServer._servers[dartx._set](this[_serviceId], this);
try {
dart.dput(this[_serverSocket], _owner, this);
@@ -43572,8 +44418,8 @@
}),
getters: () => ({isAuthenticated: dart.definiteFunctionType(core.bool, [])})
});
-let const$73;
-let const$74;
+let const$76;
+let const$77;
io._ProxyConfiguration = class _ProxyConfiguration extends core.Object {
new(configuration) {
this.proxies = ListOf_Proxy().new();
@@ -43628,7 +44474,7 @@
}, StringToNull()));
}
direct() {
- this.proxies = const$74 || (const$74 = dart.constList([const$73 || (const$73 = dart.const(new io._Proxy.direct()))], io._Proxy));
+ this.proxies = const$77 || (const$77 = dart.constList([const$76 || (const$76 = dart.const(new io._Proxy.direct()))], io._Proxy));
}
};
dart.defineNamedConstructor(io._ProxyConfiguration, 'direct');
@@ -43680,61 +44526,61 @@
return this[_incoming].listen(onData, {onError: onError, onDone: onDone, cancelOnError: cancelOnError});
}
get encoding() {
- return convert.Encoding._check(dart.dload(this[_socket], 'encoding'));
+ return this[_socket].encoding;
}
set encoding(value) {
- dart.dput(this[_socket], 'encoding', value);
+ this[_socket].encoding = value;
}
write(obj) {
- dart.dsend(this[_socket], 'write', obj);
+ this[_socket].write(obj);
}
writeln(obj) {
if (obj === void 0) obj = "";
- dart.dsend(this[_socket], 'writeln', obj);
+ this[_socket].writeln(obj);
}
writeCharCode(charCode) {
- dart.dsend(this[_socket], 'writeCharCode', charCode);
+ this[_socket].writeCharCode(charCode);
}
writeAll(objects, separator) {
if (separator === void 0) separator = "";
- dart.dsend(this[_socket], 'writeAll', objects, separator);
+ this[_socket].writeAll(objects, separator);
}
add(bytes) {
- dart.dsend(this[_socket], 'add', bytes);
+ this[_socket].add(bytes);
}
addError(error, stackTrace) {
if (stackTrace === void 0) stackTrace = null;
- return dart.dsend(this[_socket], 'addError', error, stackTrace);
+ return this[_socket].addError(error, stackTrace);
}
addStream(stream) {
- return FutureOfSocket()._check(dart.dsend(this[_socket], 'addStream', stream));
+ return this[_socket].addStream(stream);
}
destroy() {
- dart.dsend(this[_socket], 'destroy');
+ this[_socket].destroy();
}
flush() {
- return async.Future._check(dart.dsend(this[_socket], 'flush'));
+ return this[_socket].flush();
}
close() {
- return async.Future._check(dart.dsend(this[_socket], 'close'));
+ return this[_socket].close();
}
get done() {
- return FutureOfSocket()._check(dart.dload(this[_socket], 'done'));
+ return this[_socket].done;
}
get port() {
- return core.int._check(dart.dload(this[_socket], 'port'));
+ return this[_socket].port;
}
get address() {
- return io.InternetAddress._check(dart.dload(this[_socket], 'address'));
+ return this[_socket].address;
}
get remoteAddress() {
- return io.InternetAddress._check(dart.dload(this[_socket], 'remoteAddress'));
+ return this[_socket].remoteAddress;
}
get remotePort() {
- return core.int._check(dart.dload(this[_socket], 'remotePort'));
+ return this[_socket].remotePort;
}
setOption(option, enabled) {
- return core.bool._check(dart.dsend(this[_socket], 'setOption', option, enabled));
+ return this[_socket].setOption(option, enabled);
}
[_toJSON$](ref) {
return core.Map._check(dart.dsend(this[_socket], _toJSON$, ref));
@@ -43748,7 +44594,7 @@
dart.setSignature(io._DetachedSocket, {
fields: () => ({
[_incoming]: StreamOfListOfint(),
- [_socket]: dart.dynamic
+ [_socket]: io.Socket
}),
getters: () => ({
encoding: dart.definiteFunctionType(convert.Encoding, []),
@@ -43770,10 +44616,10 @@
writeAll: dart.definiteFunctionType(dart.void, [core.Iterable], [core.String]),
add: dart.definiteFunctionType(dart.void, [ListOfint()]),
addError: dart.definiteFunctionType(dart.void, [dart.dynamic], [core.StackTrace]),
- addStream: dart.definiteFunctionType(async.Future$(io.Socket), [StreamOfListOfint()]),
+ addStream: dart.definiteFunctionType(async.Future, [StreamOfListOfint()]),
destroy: dart.definiteFunctionType(dart.void, []),
flush: dart.definiteFunctionType(async.Future, []),
- close: dart.definiteFunctionType(async.Future, []),
+ close: dart.definiteFunctionType(async.Future$(io.Socket), []),
setOption: dart.definiteFunctionType(core.bool, [io.SocketOption, core.bool]),
[_toJSON$]: dart.definiteFunctionType(core.Map, [core.bool])
})
@@ -44214,23 +45060,21 @@
this.subscription.onError(onError);
this.subscription.onDone(onDone);
if (this.bufferedData == null) {
- return StreamSubscriptionOfListOfint()._check(((() => {
- this.subscription.resume();
- return this.subscription;
- })()));
+ this.subscription.resume();
+ return this.subscription;
}
- let _ = new io._HttpDetachedStreamSubscription(StreamSubscriptionOfListOfint()._check(this.subscription), this.bufferedData, onData);
+ let _ = new io._HttpDetachedStreamSubscription(this.subscription, this.bufferedData, onData);
_.resume();
return _;
} else {
- return StreamOfint().fromIterable(this.bufferedData).listen(onData, {onError: onError, onDone: onDone, cancelOnError: cancelOnError});
+ return StreamOfListOfint().fromIterable(JSArrayOfListOfint().of([this.bufferedData])).listen(onData, {onError: onError, onDone: onDone, cancelOnError: cancelOnError});
}
}
};
dart.addSimpleTypeTests(io._HttpDetachedIncoming);
dart.setSignature(io._HttpDetachedIncoming, {
fields: () => ({
- subscription: async.StreamSubscription,
+ subscription: StreamSubscriptionOfListOfint(),
bufferedData: ListOfint()
}),
methods: () => ({listen: dart.definiteFunctionType(async.StreamSubscription$(core.List$(core.int)), [_ChunkedConversionCallbackOfListOfint()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool})})
@@ -44241,7 +45085,7 @@
const _headerValue = Symbol('_headerValue');
const _requestParser = Symbol('_requestParser');
const _parserCalled = Symbol('_parserCalled');
-const _index$2 = Symbol('_index');
+const _index$1 = Symbol('_index');
const _httpVersionIndex = Symbol('_httpVersionIndex');
const _messageType = Symbol('_messageType');
const _statusCodeLength = Symbol('_statusCodeLength');
@@ -44282,7 +45126,7 @@
this[_requestParser] = requestParser;
this[_parserCalled] = false;
this[_buffer$] = null;
- this[_index$2] = null;
+ this[_index$1] = null;
this[_state$1] = null;
this[_httpVersionIndex] = null;
this[_messageType] = null;
@@ -44394,14 +45238,14 @@
if (this[_state$1] == io._State.FAILURE) {
dart.throw(new io.HttpException("Data on failed connection"));
}
- while (this[_buffer$] != null && dart.notNull(this[_index$2]) < dart.notNull(this[_buffer$][dartx.length]) && this[_state$1] != io._State.FAILURE && this[_state$1] != io._State.UPGRADED) {
+ while (this[_buffer$] != null && dart.notNull(this[_index$1]) < dart.notNull(this[_buffer$][dartx.length]) && this[_state$1] != io._State.FAILURE && this[_state$1] != io._State.UPGRADED) {
if (this[_incoming] != null && dart.test(this[_bodyPaused]) || this[_incoming] == null && dart.test(this[_paused])) {
this[_parserCalled] = false;
return;
}
let byte = this[_buffer$][dartx._get]((() => {
- let x = this[_index$2];
- this[_index$2] = dart.notNull(x) + 1;
+ let x = this[_index$1];
+ this[_index$1] = dart.notNull(x) + 1;
return x;
})());
switch (this[_state$1]) {
@@ -44582,7 +45426,7 @@
this[_state$1] = io._State.HEADER_ENDING;
} else if (byte == io._CharCode.LF) {
this[_state$1] = io._State.HEADER_ENDING;
- this[_index$2] = dart.notNull(this[_index$2]) - 1;
+ this[_index$1] = dart.notNull(this[_index$1]) - 1;
} else {
this[_headerField][dartx.add](io._HttpParser._toLowerCaseByte(byte));
this[_state$1] = io._State.HEADER_FIELD;
@@ -44657,7 +45501,7 @@
this[_state$1] = io._State.HEADER_ENDING;
} else if (byte == io._CharCode.LF) {
this[_state$1] = io._State.HEADER_ENDING;
- this[_index$2] = dart.notNull(this[_index$2]) - 1;
+ this[_index$1] = dart.notNull(this[_index$1]) - 1;
} else {
this[_headerField][dartx.add](io._HttpParser._toLowerCaseByte(byte));
this[_state$1] = io._State.HEADER_FIELD;
@@ -44731,17 +45575,17 @@
}
case io._State.BODY:
{
- this[_index$2] = dart.notNull(this[_index$2]) - 1;
- let dataAvailable = dart.notNull(this[_buffer$][dartx.length]) - dart.notNull(this[_index$2]);
+ this[_index$1] = dart.notNull(this[_index$1]) - 1;
+ let dataAvailable = dart.notNull(this[_buffer$][dartx.length]) - dart.notNull(this[_index$1]);
if (dart.notNull(this[_remainingContent]) >= 0 && dart.notNull(dataAvailable) > dart.notNull(this[_remainingContent])) {
dataAvailable = this[_remainingContent];
}
- let data = typed_data.Uint8List.view(this[_buffer$][dartx.buffer], dart.notNull(this[_buffer$][dartx.offsetInBytes]) + dart.notNull(this[_index$2]), dataAvailable);
+ let data = typed_data.Uint8List.view(this[_buffer$][dartx.buffer], dart.notNull(this[_buffer$][dartx.offsetInBytes]) + dart.notNull(this[_index$1]), dataAvailable);
this[_bodyController].add(data);
if (this[_remainingContent] != -1) {
this[_remainingContent] = dart.notNull(this[_remainingContent]) - dart.notNull(data[dartx.length]);
}
- this[_index$2] = dart.notNull(this[_index$2]) + dart.notNull(data[dartx.length]);
+ this[_index$1] = dart.notNull(this[_index$1]) + dart.notNull(data[dartx.length]);
if (this[_remainingContent] == 0) {
if (!dart.test(this[_chunked])) {
this[_reset]();
@@ -44765,7 +45609,7 @@
}
}
this[_parserCalled] = false;
- if (this[_buffer$] != null && this[_index$2] == this[_buffer$][dartx.length]) {
+ if (this[_buffer$] != null && this[_index$1] == this[_buffer$][dartx.length]) {
this[_releaseBuffer]();
if (this[_state$1] != io._State.UPGRADED && this[_state$1] != io._State.FAILURE) {
this[_socketSubscription].resume();
@@ -44776,7 +45620,7 @@
this[_socketSubscription].pause();
dart.assert(this[_buffer$] == null);
this[_buffer$] = typed_data.Uint8List._check(buffer);
- this[_index$2] = 0;
+ this[_index$1] = 0;
this[_parse]();
}
[_onDone$]() {
@@ -44849,8 +45693,8 @@
}
readUnparsedData() {
if (this[_buffer$] == null) return null;
- if (this[_index$2] == this[_buffer$][dartx.length]) return null;
- let result = this[_buffer$][dartx.sublist](this[_index$2]);
+ if (this[_index$1] == this[_buffer$][dartx.length]) return null;
+ let result = this[_buffer$][dartx.sublist](this[_index$1]);
this[_releaseBuffer]();
return result;
}
@@ -44875,7 +45719,7 @@
}
[_releaseBuffer]() {
this[_buffer$] = null;
- this[_index$2] = null;
+ this[_index$1] = null;
}
static _isTokenChar(byte) {
return dart.notNull(byte) > 31 && dart.notNull(byte) < 128 && !dart.test(io._Const.SEPARATOR_MAP[dartx._get](byte));
@@ -44995,7 +45839,7 @@
fields: () => ({
[_parserCalled]: core.bool,
[_buffer$]: typed_data.Uint8List,
- [_index$2]: core.int,
+ [_index$1]: core.int,
[_requestParser]: core.bool,
[_state$1]: core.int,
[_httpVersionIndex]: core.int,
@@ -45015,7 +45859,7 @@
[_remainingContent]: core.int,
[_headers]: io._HttpHeaders,
[_incoming]: io._HttpIncoming,
- [_socketSubscription]: async.StreamSubscription,
+ [_socketSubscription]: StreamSubscriptionOfListOfint(),
[_paused]: core.bool,
[_bodyPaused]: core.bool,
[_controller$0]: StreamControllerOf_HttpIncoming(),
@@ -45058,7 +45902,7 @@
names: ['_isTokenChar', '_isValueChar', '_tokenizeFieldValue', '_toLowerCaseByte']
});
io._DART_SESSION_ID = "DARTSESSID";
-const _data$ = Symbol('_data');
+const _data$0 = Symbol('_data');
const _lastSeen = Symbol('_lastSeen');
const _timeoutCallback = Symbol('_timeoutCallback');
const _prev = Symbol('_prev');
@@ -45068,7 +45912,7 @@
const _bumpToEnd = Symbol('_bumpToEnd');
io._HttpSession = class _HttpSession extends core.Object {
new(sessionManager, id) {
- this[_data$] = collection.HashMap.new();
+ this[_data$0] = collection.HashMap.new();
this[_sessionManager] = sessionManager;
this.id = id;
this[_lastSeen] = new core.DateTime.now();
@@ -45097,50 +45941,50 @@
this[_timeoutCallback] = callback;
}
containsValue(value) {
- return this[_data$][dartx.containsValue](value);
+ return this[_data$0][dartx.containsValue](value);
}
containsKey(key) {
- return this[_data$][dartx.containsKey](key);
+ return this[_data$0][dartx.containsKey](key);
}
_get(key) {
- return this[_data$][dartx._get](key);
+ return this[_data$0][dartx._get](key);
}
_set(key, value) {
- this[_data$][dartx._set](key, value);
+ this[_data$0][dartx._set](key, value);
return value;
}
putIfAbsent(key, ifAbsent) {
- return this[_data$][dartx.putIfAbsent](key, ifAbsent);
+ return this[_data$0][dartx.putIfAbsent](key, ifAbsent);
}
addAll(other) {
- return this[_data$][dartx.addAll](other);
+ return this[_data$0][dartx.addAll](other);
}
remove(key) {
- return this[_data$][dartx.remove](key);
+ return this[_data$0][dartx.remove](key);
}
clear() {
- this[_data$][dartx.clear]();
+ this[_data$0][dartx.clear]();
}
forEach(f) {
- this[_data$][dartx.forEach](f);
+ this[_data$0][dartx.forEach](f);
}
get keys() {
- return this[_data$][dartx.keys];
+ return this[_data$0][dartx.keys];
}
get values() {
- return this[_data$][dartx.values];
+ return this[_data$0][dartx.values];
}
get length() {
- return this[_data$][dartx.length];
+ return this[_data$0][dartx.length];
}
get isEmpty() {
- return this[_data$][dartx.isEmpty];
+ return this[_data$0][dartx.isEmpty];
}
get isNotEmpty() {
- return this[_data$][dartx.isNotEmpty];
+ return this[_data$0][dartx.isNotEmpty];
}
toString() {
- return dart.str`HttpSession id:${this.id} ${this[_data$]}`;
+ return dart.str`HttpSession id:${this.id} ${this[_data$0]}`;
}
};
io._HttpSession[dart.implements] = () => [io.HttpSession];
@@ -45154,7 +45998,7 @@
[_prev]: io._HttpSession,
[_next$1]: io._HttpSession,
id: core.String,
- [_data$]: core.Map
+ [_data$0]: core.Map
}),
getters: () => ({
lastSeen: dart.definiteFunctionType(core.DateTime, []),
@@ -45325,7 +46169,7 @@
this.id = io._IOResourceInfo.getNextID();
}
get referenceValueMap() {
- return dart.map({type: dart.str`@${this.type}`, id: this.id, name: this.name}, core.String, core.String);
+ return dart.map({type: dart.str`@${this.type}`, id: this.id, name: this.name}, core.String, core.Object);
}
static getNextID() {
return (() => {
@@ -45340,7 +46184,7 @@
type: core.String,
id: core.int
}),
- getters: () => ({referenceValueMap: dart.definiteFunctionType(core.Map$(core.String, core.String), [])}),
+ getters: () => ({referenceValueMap: dart.definiteFunctionType(core.Map$(core.String, dart.dynamic), [])}),
statics: () => ({getNextID: dart.definiteFunctionType(core.int, [])}),
names: ['getNextID']
});
@@ -45381,7 +46225,7 @@
super.new(type);
}
get fullValueMap() {
- return dart.map({type: this.type, id: this.id, name: this.name, totalRead: this.totalRead, totalWritten: this.totalWritten, readCount: this.readCount, writeCount: this.writeCount, lastRead: this.lastRead, lastWrite: this.lastWrite}, core.String, core.String);
+ return dart.map({type: this.type, id: this.id, name: this.name, totalRead: this.totalRead, totalWritten: this.totalWritten, readCount: this.readCount, writeCount: this.writeCount, lastRead: this.lastRead, lastWrite: this.lastWrite}, core.String, core.Object);
}
};
dart.setSignature(io._ReadWriteResourceInfo, {
@@ -45393,7 +46237,7 @@
lastRead: core.double,
lastWrite: core.double
}),
- getters: () => ({fullValueMap: dart.definiteFunctionType(core.Map$(core.String, core.String), [])}),
+ getters: () => ({fullValueMap: dart.definiteFunctionType(core.Map$(core.String, dart.dynamic), [])}),
methods: () => ({
addRead: dart.definiteFunctionType(dart.void, [core.int]),
didRead: dart.definiteFunctionType(dart.void, []),
@@ -45415,7 +46259,7 @@
io._FileResourceInfo.openFiles[dartx.remove](info.id);
}
static getOpenFilesList() {
- return ListOfMapOfString$String().from(io._FileResourceInfo.openFiles[dartx.values][dartx.map](MapOfString$String())(dart.fn(e => e.referenceValueMap, _FileResourceInfoToMapOfString$String())));
+ return ListOfMapOfString$String().from(io._FileResourceInfo.openFiles[dartx.values][dartx.map](MapOfString$dynamic())(dart.fn(e => e.referenceValueMap, _FileResourceInfoToMapOfString$dynamic())));
}
static getOpenFiles(func, params) {
dart.assert(dart.equals(func, 'ext.dart.io.getOpenFiles'));
@@ -45424,8 +46268,7 @@
return FutureOfServiceExtensionResponse().value(new developer.ServiceExtensionResponse.result(json));
}
getFileInfoMap() {
- let result = this.fullValueMap;
- return result;
+ return this.fullValueMap;
}
static getFileInfoMapByID(func, params) {
dart.assert(dart.dsend(params, 'containsKey', 'id'));
@@ -45441,7 +46284,7 @@
dart.setSignature(io._FileResourceInfo, {
fields: () => ({file: dart.dynamic}),
getters: () => ({name: dart.definiteFunctionType(core.String, [])}),
- methods: () => ({getFileInfoMap: dart.definiteFunctionType(core.Map$(core.String, core.String), [])}),
+ methods: () => ({getFileInfoMap: dart.definiteFunctionType(core.Map$(core.String, dart.dynamic), [])}),
statics: () => ({
FileOpened: dart.definiteFunctionType(dart.dynamic, [io._FileResourceInfo]),
FileClosed: dart.definiteFunctionType(dart.dynamic, [io._FileResourceInfo]),
@@ -45468,13 +46311,13 @@
io._ProcessResourceInfo.ProcessStarted(this);
}
get name() {
- return core.String._check(dart.dload(this.process, _path$));
+ return core.String._check(dart.dload(this.process, _path));
}
stopped() {
io._ProcessResourceInfo.ProcessStopped(this);
}
get fullValueMap() {
- return dart.map({type: this.type, id: this.id, name: this.name, pid: core.String._check(dart.dload(this.process, 'pid')), startedAt: this.startedAt, arguments: core.String._check(dart.dload(this.process, _arguments$0)), workingDirectory: core.String._check(dart.dload(this.process, _workingDirectory) == null ? '.' : dart.dload(this.process, _workingDirectory))}, core.String, core.String);
+ return dart.map({type: this.type, id: this.id, name: this.name, pid: dart.dload(this.process, 'pid'), startedAt: this.startedAt, arguments: dart.dload(this.process, _arguments$0), workingDirectory: dart.dload(this.process, _workingDirectory) == null ? '.' : dart.dload(this.process, _workingDirectory)}, core.String, core.Object);
}
static ProcessStarted(info) {
dart.assert(!dart.test(io._ProcessResourceInfo.startedProcesses[dartx.containsKey](info.id)));
@@ -45485,7 +46328,7 @@
io._ProcessResourceInfo.startedProcesses[dartx.remove](info.id);
}
static getStartedProcessesList() {
- return ListOfMapOfString$String().from(io._ProcessResourceInfo.startedProcesses[dartx.values][dartx.map](MapOfString$String())(dart.fn(e => e.referenceValueMap, _ProcessResourceInfoToMapOfString$String())));
+ return ListOfMapOfString$String().from(io._ProcessResourceInfo.startedProcesses[dartx.values][dartx.map](MapOfString$dynamic())(dart.fn(e => e.referenceValueMap, _ProcessResourceInfoToMapOfString$dynamic())));
}
static getStartedProcesses(func, params) {
dart.assert(func == 'ext.dart.io.getProcesses');
@@ -45507,7 +46350,7 @@
}),
getters: () => ({
name: dart.definiteFunctionType(core.String, []),
- fullValueMap: dart.definiteFunctionType(core.Map$(core.String, core.String), [])
+ fullValueMap: dart.definiteFunctionType(core.Map$(core.String, dart.dynamic), [])
}),
methods: () => ({stopped: dart.definiteFunctionType(dart.void, [])}),
statics: () => ({
@@ -45547,18 +46390,18 @@
return dart.str`${dart.dload(dart.dload(this.socket, 'address'), 'host')}:${dart.dload(this.socket, 'port')}${remote}`;
}
static getOpenSocketsList() {
- return ListOfMapOfString$String().from(io._SocketResourceInfo.openSockets[dartx.values][dartx.map](MapOfString$String())(dart.fn(e => e.referenceValueMap, _SocketResourceInfoToMapOfString$String())));
+ return ListOfMapOfString$String().from(io._SocketResourceInfo.openSockets[dartx.values][dartx.map](MapOfString$dynamic())(dart.fn(e => e.referenceValueMap, _SocketResourceInfoToMapOfString$dynamic())));
}
getSocketInfoMap() {
let result = this.fullValueMap;
result[dartx._set]('socketType', dart.test(dart.dload(this.socket, 'isTcp')) ? io._SocketResourceInfo.TCP_STRING : io._SocketResourceInfo.UDP_STRING);
- result[dartx._set]('listening', core.String._check(dart.dload(this.socket, 'isListening')));
- result[dartx._set]('host', core.String._check(dart.dload(dart.dload(this.socket, 'address'), 'host')));
- result[dartx._set]('port', core.String._check(dart.dload(this.socket, 'port')));
+ result[dartx._set]('listening', dart.dload(this.socket, 'isListening'));
+ result[dartx._set]('host', dart.dload(dart.dload(this.socket, 'address'), 'host'));
+ result[dartx._set]('port', dart.dload(this.socket, 'port'));
if (!dart.test(dart.dload(this.socket, 'isListening'))) {
try {
- result[dartx._set]('remoteHost', core.String._check(dart.dload(dart.dload(this.socket, 'remoteAddress'), 'host')));
- result[dartx._set]('remotePort', core.String._check(dart.dload(this.socket, 'remotePort')));
+ result[dartx._set]('remoteHost', dart.dload(dart.dload(this.socket, 'remoteAddress'), 'host'));
+ result[dartx._set]('remotePort', dart.dload(this.socket, 'remotePort'));
} catch (e) {
result[dartx._set]('remotePort', 'NA');
result[dartx._set]('remoteHost', 'NA');
@@ -45568,7 +46411,7 @@
result[dartx._set]('remotePort', 'NA');
result[dartx._set]('remoteHost', 'NA');
}
- result[dartx._set]('addressType', core.String._check(dart.dload(dart.dload(dart.dload(this.socket, 'address'), 'type'), 'name')));
+ result[dartx._set]('addressType', dart.dload(dart.dload(dart.dload(this.socket, 'address'), 'type'), 'name'));
return result;
}
static getSocketInfoMapByID(func, params) {
@@ -45596,7 +46439,7 @@
dart.setSignature(io._SocketResourceInfo, {
fields: () => ({socket: dart.dynamic}),
getters: () => ({name: dart.definiteFunctionType(core.String, [])}),
- methods: () => ({getSocketInfoMap: dart.definiteFunctionType(core.Map$(core.String, core.String), [])}),
+ methods: () => ({getSocketInfoMap: dart.definiteFunctionType(core.Map$(core.String, dart.dynamic), [])}),
statics: () => ({
getOpenSocketsList: dart.definiteFunctionType(core.Iterable$(core.Map$(core.String, core.String)), []),
getSocketInfoMapByID: dart.definiteFunctionType(async.Future$(developer.ServiceExtensionResponse), [core.String, MapOfString$String()]),
@@ -45638,33 +46481,36 @@
io._FILE_TRUNCATE = 10;
io._FILE_LENGTH = 11;
io._FILE_LENGTH_FROM_PATH = 12;
-io._FILE_LAST_MODIFIED = 13;
-io._FILE_FLUSH = 14;
-io._FILE_READ_BYTE = 15;
-io._FILE_WRITE_BYTE = 16;
-io._FILE_READ = 17;
-io._FILE_READ_INTO = 18;
-io._FILE_WRITE_FROM = 19;
-io._FILE_CREATE_LINK = 20;
-io._FILE_DELETE_LINK = 21;
-io._FILE_RENAME_LINK = 22;
-io._FILE_LINK_TARGET = 23;
-io._FILE_TYPE = 24;
-io._FILE_IDENTICAL = 25;
-io._FILE_STAT = 26;
-io._FILE_LOCK = 27;
-io._SOCKET_LOOKUP = 28;
-io._SOCKET_LIST_INTERFACES = 29;
-io._SOCKET_REVERSE_LOOKUP = 30;
-io._DIRECTORY_CREATE = 31;
-io._DIRECTORY_DELETE = 32;
-io._DIRECTORY_EXISTS = 33;
-io._DIRECTORY_CREATE_TEMP = 34;
-io._DIRECTORY_LIST_START = 35;
-io._DIRECTORY_LIST_NEXT = 36;
-io._DIRECTORY_LIST_STOP = 37;
-io._DIRECTORY_RENAME = 38;
-io._SSL_PROCESS_FILTER = 39;
+io._FILE_LAST_ACCESSED = 13;
+io._FILE_SET_LAST_ACCESSED = 14;
+io._FILE_LAST_MODIFIED = 15;
+io._FILE_SET_LAST_MODIFIED = 16;
+io._FILE_FLUSH = 17;
+io._FILE_READ_BYTE = 18;
+io._FILE_WRITE_BYTE = 19;
+io._FILE_READ = 20;
+io._FILE_READ_INTO = 21;
+io._FILE_WRITE_FROM = 22;
+io._FILE_CREATE_LINK = 23;
+io._FILE_DELETE_LINK = 24;
+io._FILE_RENAME_LINK = 25;
+io._FILE_LINK_TARGET = 26;
+io._FILE_TYPE = 27;
+io._FILE_IDENTICAL = 28;
+io._FILE_STAT = 29;
+io._FILE_LOCK = 30;
+io._SOCKET_LOOKUP = 31;
+io._SOCKET_LIST_INTERFACES = 32;
+io._SOCKET_REVERSE_LOOKUP = 33;
+io._DIRECTORY_CREATE = 34;
+io._DIRECTORY_DELETE = 35;
+io._DIRECTORY_EXISTS = 36;
+io._DIRECTORY_CREATE_TEMP = 37;
+io._DIRECTORY_LIST_START = 38;
+io._DIRECTORY_LIST_NEXT = 39;
+io._DIRECTORY_LIST_STOP = 40;
+io._DIRECTORY_RENAME = 41;
+io._SSL_PROCESS_FILTER = 42;
io._IOService = class _IOService extends core.Object {
static _dispatch(request, data) {
dart.throw(new core.UnsupportedError("_IOService._dispatch"));
@@ -45704,12 +46550,6 @@
get absolute() {
return io.Link.new(this[_absolutePath]);
}
- stat() {
- return io.FileStat.stat(this.path);
- }
- statSync() {
- return io.FileStat.statSync(this.path);
- }
create(target, opts) {
let recursive = opts && 'recursive' in opts ? opts.recursive : false;
if (dart.test(io.Platform.isWindows)) {
@@ -45833,8 +46673,6 @@
methods: () => ({
exists: dart.definiteFunctionType(async.Future$(core.bool), []),
existsSync: dart.definiteFunctionType(core.bool, []),
- stat: dart.definiteFunctionType(async.Future$(io.FileStat), []),
- statSync: dart.definiteFunctionType(io.FileStat, []),
create: dart.definiteFunctionType(async.Future$(io.Link), [core.String], {recursive: core.bool}),
createSync: dart.definiteFunctionType(dart.void, [core.String], {recursive: core.bool}),
[_makeWindowsLinkTarget]: dart.definiteFunctionType(core.String, [core.String]),
@@ -45920,6 +46758,9 @@
},
get isIOS() {
return io.Platform._operatingSystem == "ios";
+ },
+ get isFuchsia() {
+ return io.Platform._operatingSystem == "fuchsia";
}
});
io._Platform = class _Platform extends core.Object {
@@ -45981,14 +46822,17 @@
let env = io._Platform._environment();
if (!io.OSError.is(env)) {
let isWindows = io._Platform.operatingSystem == 'windows';
- let result = isWindows ? new io._CaseInsensitiveStringMap() : core.Map.new();
+ let result = isWindows ? new (_CaseInsensitiveStringMapOfString())() : MapOfString$String().new();
for (let str of core.Iterable._check(env)) {
+ if (str == null) {
+ continue;
+ }
let equalsIndex = dart.dsend(str, 'indexOf', '=');
if (dart.test(dart.dsend(equalsIndex, '>', 0))) {
- result[dartx._set](dart.dsend(str, 'substring', 0, equalsIndex), dart.dsend(str, 'substring', dart.dsend(equalsIndex, '+', 1)));
+ result[dartx._set](core.String._check(dart.dsend(str, 'substring', 0, equalsIndex)), core.String._check(dart.dsend(str, 'substring', dart.dsend(equalsIndex, '+', 1))));
}
}
- io._Platform._environmentCache = new (UnmodifiableMapViewOfString$String())(MapOfString$String()._check(result));
+ io._Platform._environmentCache = new (UnmodifiableMapViewOfString$String())(result);
} else {
io._Platform._environmentCache = env;
}
@@ -45996,7 +46840,7 @@
if (io.OSError.is(io._Platform._environmentCache)) {
dart.throw(io._Platform._environmentCache);
} else {
- return MapOfString$String()._check(io._Platform._environmentCache);
+ return MapOfString$String().as(io._Platform._environmentCache);
}
}
static get version() {
@@ -46044,6 +46888,7 @@
let MapOfString$V = () => (MapOfString$V = dart.constFn(core.Map$(core.String, V)))();
let VoidToV = () => (VoidToV = dart.constFn(dart.functionType(V, [])))();
let StringAndVTovoid = () => (StringAndVTovoid = dart.constFn(dart.functionType(dart.void, [core.String, V])))();
+ let StringAndVToV = () => (StringAndVToV = dart.constFn(dart.definiteFunctionType(V, [core.String, V])))();
class _CaseInsensitiveStringMap extends core.Object {
new() {
this[_map$1] = MapOfString$V().new();
@@ -46067,7 +46912,8 @@
return this[_map$1][dartx.putIfAbsent](key[dartx.toUpperCase](), ifAbsent);
}
addAll(other) {
- other[dartx.forEach](dart.fn((key, value) => this._set(core.String._check(dart.dsend(key, 'toUpperCase')), V._check(value)), dynamicAnddynamicTovoid$()));
+ MapOfString$V()._check(other);
+ other[dartx.forEach](dart.fn((key, value) => this._set(key[dartx.toUpperCase](), value), StringAndVToV()));
}
remove(key) {
return typeof key == 'string' ? this[_map$1][dartx.remove](key[dartx.toUpperCase]()) : null;
@@ -46114,7 +46960,7 @@
_get: dart.definiteFunctionType(V, [core.Object]),
_set: dart.definiteFunctionType(dart.void, [core.String, V]),
putIfAbsent: dart.definiteFunctionType(V, [core.String, VoidToV()]),
- addAll: dart.definiteFunctionType(dart.void, [core.Map]),
+ addAll: dart.definiteFunctionType(dart.void, [MapOfString$V()]),
remove: dart.definiteFunctionType(V, [core.Object]),
clear: dart.definiteFunctionType(dart.void, []),
forEach: dart.definiteFunctionType(dart.void, [StringAndVTovoid()])
@@ -46222,9 +47068,6 @@
'DETACHED_WITH_STDIO'
]);
io.Process = class Process extends core.Object {
- new() {
- this.exitCode = null;
- }
static start(executable, arguments$, opts) {
let workingDirectory = opts && 'workingDirectory' in opts ? opts.workingDirectory : null;
let environment = opts && 'environment' in opts ? opts.environment : null;
@@ -46257,7 +47100,6 @@
}
};
dart.setSignature(io.Process, {
- fields: () => ({exitCode: FutureOfint()}),
statics: () => ({
start: dart.definiteFunctionType(async.Future$(io.Process), [core.String, ListOfString()], {workingDirectory: core.String, environment: MapOfString$String(), includeParentEnvironment: core.bool, runInShell: core.bool, mode: io.ProcessStartMode}),
run: dart.definiteFunctionType(async.Future$(io.ProcessResult), [core.String, ListOfString()], {workingDirectory: core.String, environment: MapOfString$String(), includeParentEnvironment: core.bool, runInShell: core.bool, stdoutEncoding: convert.Encoding, stderrEncoding: convert.Encoding}),
@@ -46453,22 +47295,14 @@
let host = opts && 'host' in opts ? opts.host : null;
let context = opts && 'context' in opts ? opts.context : null;
let onBadCertificate = opts && 'onBadCertificate' in opts ? opts.onBadCertificate : null;
- let completer = async.Completer.new();
- dart.dsend(dart.dsend(dart.dsend(socket, _detachRaw), 'then', dart.fn(detachedRaw => io.RawSecureSocket.secure(io.RawSocket._check(dart.dindex(detachedRaw, 0)), {subscription: async.StreamSubscription._check(dart.dindex(detachedRaw, 1)), host: host, context: context, onBadCertificate: onBadCertificate}), dynamicToFutureOfRawSecureSocket())), 'then', dart.fn(raw => {
- completer.complete(io.SecureSocket._(io.RawSecureSocket._check(raw)));
- }, dynamicToNull$()));
- return FutureOfSecureSocket()._check(completer.future);
+ return async.Future.as(dart.dsend(socket, _detachRaw)).then(io.RawSecureSocket)(dart.fn(detachedRaw => io.RawSecureSocket.secure(io.RawSocket.as(dart.dindex(detachedRaw, 0)), {subscription: StreamSubscriptionOfRawSocketEvent().as(dart.dindex(detachedRaw, 1)), host: host, context: context, onBadCertificate: onBadCertificate}), dynamicToFutureOfRawSecureSocket())).then(io.SecureSocket)(dart.fn(raw => io.SecureSocket._(raw), RawSecureSocketToSecureSocket()));
}
static secureServer(socket, context, opts) {
let bufferedData = opts && 'bufferedData' in opts ? opts.bufferedData : null;
let requestClientCertificate = opts && 'requestClientCertificate' in opts ? opts.requestClientCertificate : false;
let requireClientCertificate = opts && 'requireClientCertificate' in opts ? opts.requireClientCertificate : false;
let supportedProtocols = opts && 'supportedProtocols' in opts ? opts.supportedProtocols : null;
- let completer = async.Completer.new();
- dart.dsend(dart.dsend(dart.dsend(socket, _detachRaw), 'then', dart.fn(detachedRaw => io.RawSecureSocket.secureServer(io.RawSocket._check(dart.dindex(detachedRaw, 0)), context, {subscription: async.StreamSubscription._check(dart.dindex(detachedRaw, 1)), bufferedData: bufferedData, requestClientCertificate: requestClientCertificate, requireClientCertificate: requireClientCertificate, supportedProtocols: supportedProtocols}), dynamicToFutureOfRawSecureSocket())), 'then', dart.fn(raw => {
- completer.complete(io.SecureSocket._(io.RawSecureSocket._check(raw)));
- }, dynamicToNull$()));
- return FutureOfSecureSocket()._check(completer.future);
+ return async.Future.as(dart.dsend(socket, _detachRaw)).then(io.RawSecureSocket)(dart.fn(detachedRaw => io.RawSecureSocket.secureServer(io.RawSocket.as(dart.dindex(detachedRaw, 0)), context, {subscription: StreamSubscriptionOfRawSocketEvent().as(dart.dindex(detachedRaw, 1)), bufferedData: bufferedData, requestClientCertificate: requestClientCertificate, requireClientCertificate: requireClientCertificate, supportedProtocols: supportedProtocols}), dynamicToFutureOfRawSecureSocket())).then(io.SecureSocket)(dart.fn(raw => io.SecureSocket._(raw), RawSecureSocketToSecureSocket()));
}
};
io.SecureSocket[dart.implements] = () => [io.Socket];
@@ -46564,8 +47398,8 @@
dart.setSignature(io.RawSecureSocket, {
statics: () => ({
connect: dart.definiteFunctionType(async.Future$(io.RawSecureSocket), [dart.dynamic, core.int], {context: io.SecurityContext, onBadCertificate: X509CertificateTobool(), supportedProtocols: ListOfString()}),
- secure: dart.definiteFunctionType(async.Future$(io.RawSecureSocket), [io.RawSocket], {subscription: async.StreamSubscription, host: dart.dynamic, context: io.SecurityContext, onBadCertificate: X509CertificateTobool(), supportedProtocols: ListOfString()}),
- secureServer: dart.definiteFunctionType(async.Future$(io.RawSecureSocket), [io.RawSocket, io.SecurityContext], {subscription: async.StreamSubscription, bufferedData: ListOfint(), requestClientCertificate: core.bool, requireClientCertificate: core.bool, supportedProtocols: ListOfString()})
+ secure: dart.definiteFunctionType(async.Future$(io.RawSecureSocket), [io.RawSocket], {subscription: StreamSubscriptionOfRawSocketEvent(), host: dart.dynamic, context: io.SecurityContext, onBadCertificate: X509CertificateTobool(), supportedProtocols: ListOfString()}),
+ secureServer: dart.definiteFunctionType(async.Future$(io.RawSecureSocket), [io.RawSocket, io.SecurityContext], {subscription: StreamSubscriptionOfRawSocketEvent(), bufferedData: ListOfint(), requestClientCertificate: core.bool, requireClientCertificate: core.bool, supportedProtocols: ListOfString()})
}),
names: ['connect', 'secure', 'secureServer']
});
@@ -46736,13 +47570,13 @@
const _pushAllFilterStages = Symbol('_pushAllFilterStages');
const _readSocketOrBufferedData = Symbol('_readSocketOrBufferedData');
const _sendReadEvent = Symbol('_sendReadEvent');
-let const$75;
+let const$78;
io.RawSocketEvent = class RawSocketEvent extends core.Object {
_(value) {
this[_value$1] = value;
}
toString() {
- return (const$75 || (const$75 = dart.constList(['RawSocketEvent:READ', 'RawSocketEvent:WRITE', 'RawSocketEvent:READ_CLOSED', 'RawSocketEvent:CLOSED'], core.String)))[dartx._get](this[_value$1]);
+ return (const$78 || (const$78 = dart.constList(['RawSocketEvent:READ', 'RawSocketEvent:WRITE', 'RawSocketEvent:READ_CLOSED', 'RawSocketEvent:CLOSED'], core.String)))[dartx._get](this[_value$1]);
}
};
dart.defineNamedConstructor(io.RawSocketEvent, '_');
@@ -46783,12 +47617,12 @@
if (host != null) {
address = io.InternetAddress._cloneWithNewHost(address, core.String._check(host));
}
- return new io._RawSecureSocket(address, requestedPort, is_server, context, socket, StreamSubscriptionOfRawSocketEvent()._check(subscription), bufferedData, requestClientCertificate, requireClientCertificate, onBadCertificate, supportedProtocols)[_handshakeComplete].future;
+ return new io._RawSecureSocket(address, requestedPort, is_server, context, socket, subscription, bufferedData, requestClientCertificate, requireClientCertificate, onBadCertificate, supportedProtocols)[_handshakeComplete].future;
}
new(address, requestedPort, is_server, context, socket, socketSubscription, bufferedData, requestClientCertificate, requireClientCertificate, onBadCertificate, supportedProtocols) {
this[_handshakeComplete] = CompleterOf_RawSecureSocket().new();
this[_status] = io._RawSecureSocket.HANDSHAKE;
- this[_closeCompleter] = async.Completer.new();
+ this[_closeCompleter] = CompleterOfRawSecureSocket().new();
this[_filterStatus] = new io._FilterStatus();
this[_secureFilter] = io._SecureFilter.new();
this.address = address;
@@ -46898,7 +47732,7 @@
}
close() {
this.shutdown(io.SocketDirection.BOTH);
- return FutureOfRawSecureSocket()._check(this[_closeCompleter].future);
+ return this[_closeCompleter].future;
}
[_completeCloseCompleter](dummy) {
if (dummy === void 0) dummy = null;
@@ -47344,7 +48178,7 @@
[_socketClosedWrite]: core.bool,
[_closedRead]: core.bool,
[_closedWrite]: core.bool,
- [_closeCompleter]: async.Completer,
+ [_closeCompleter]: CompleterOfRawSecureSocket(),
[_filterStatus]: io._FilterStatus,
[_connectPending]: core.bool,
[_filterPending]: core.bool,
@@ -47370,7 +48204,7 @@
listen: dart.definiteFunctionType(async.StreamSubscription$(io.RawSocketEvent), [RawSocketEventTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool}),
available: dart.definiteFunctionType(core.int, []),
close: dart.definiteFunctionType(async.Future$(io.RawSecureSocket), []),
- [_completeCloseCompleter]: dart.definiteFunctionType(dart.void, [], [dart.dynamic]),
+ [_completeCloseCompleter]: dart.definiteFunctionType(dart.void, [], [io.RawSocket]),
[_close$0]: dart.definiteFunctionType(dart.void, []),
shutdown: dart.definiteFunctionType(dart.void, [io.SocketDirection]),
read: dart.definiteFunctionType(core.List$(core.int), [], [core.int]),
@@ -47400,7 +48234,7 @@
}),
statics: () => ({
_isBufferEncrypted: dart.definiteFunctionType(core.bool, [core.int]),
- connect: dart.definiteFunctionType(async.Future$(io._RawSecureSocket), [dart.dynamic, core.int], {is_server: core.bool, context: io.SecurityContext, socket: io.RawSocket, subscription: async.StreamSubscription, bufferedData: ListOfint(), requestClientCertificate: core.bool, requireClientCertificate: core.bool, onBadCertificate: X509CertificateTobool(), supportedProtocols: ListOfString()}),
+ connect: dart.definiteFunctionType(async.Future$(io._RawSecureSocket), [dart.dynamic, core.int], {is_server: core.bool, context: io.SecurityContext, socket: io.RawSocket, subscription: StreamSubscriptionOfRawSocketEvent(), bufferedData: ListOfint(), requestClientCertificate: core.bool, requireClientCertificate: core.bool, onBadCertificate: X509CertificateTobool(), supportedProtocols: ListOfString()}),
_verifyFields: dart.definiteFunctionType(dart.void, [dart.dynamic, core.int, core.bool, core.bool, core.bool, core.Function])
}),
names: ['_isBufferEncrypted', 'connect', '_verifyFields']
@@ -47506,7 +48340,7 @@
while (true) {
let toWrite = this.linearLength;
if (toWrite == 0) return false;
- let bytes = socket.write(ListOfint()._check(this.data), this.start, toWrite);
+ let bytes = socket.write(this.data, this.start, toWrite);
this.advanceStart(bytes);
if (dart.notNull(bytes) < dart.notNull(toWrite)) {
return true;
@@ -47516,7 +48350,7 @@
};
dart.setSignature(io._ExternalBuffer, {
fields: () => ({
- data: core.List,
+ data: ListOfint(),
start: core.int,
end: core.int,
size: dart.dynamic
@@ -47980,7 +48814,7 @@
let retainNewlines = opts && 'retainNewlines' in opts ? opts.retainNewlines : false;
let CR = 13;
let LF = 10;
- let line = [];
+ let line = JSArrayOfint().of([]);
let crIsNewline = dart.test(io.Platform.isWindows) && dart.equals(io.stdioType(io.stdin), io.StdioType.TERMINAL) && !dart.test(/* Unimplemented unknown name */lineMode);
if (dart.test(retainNewlines)) {
let byte = null;
@@ -48023,7 +48857,7 @@
line[dartx.add](byte);
}
}
- return encoding.decode(ListOfint()._check(line));
+ return encoding.decode(line);
}
set echoMode(enabled) {
dart.throw(new core.UnsupportedError("Stdin.echoMode"));
@@ -48060,9 +48894,11 @@
const _hasTerminal = Symbol('_hasTerminal');
const _terminalColumns = Symbol('_terminalColumns');
const _terminalLines = Symbol('_terminalLines');
-io._StdSink = class _StdSink extends core.Object {
- new(sink) {
+const _isTranslatable = Symbol('_isTranslatable');
+io._StdSinkHelper = class _StdSinkHelper extends core.Object {
+ new(sink, isTranslatable) {
this[_sink$0] = sink;
+ this[_isTranslatable] = isTranslatable;
}
get encoding() {
return this[_sink$0].encoding;
@@ -48070,18 +48906,29 @@
set encoding(encoding) {
this[_sink$0].encoding = encoding;
}
+ set [_translation](t) {
+ if (dart.test(this[_isTranslatable])) {
+ let sink = io._IOSinkImpl._check(this[_sink$0]);
+ let target = io._StdConsumer._check(sink[_target$]);
+ dart.dput(target[_file], 'translation', t);
+ }
+ }
write(object) {
+ this[_translation] = io._FileTranslation.text;
this[_sink$0].write(object);
}
writeln(object) {
if (object === void 0) object = "";
+ this[_translation] = io._FileTranslation.text;
this[_sink$0].writeln(object);
}
writeAll(objects, sep) {
if (sep === void 0) sep = "";
+ this[_translation] = io._FileTranslation.text;
this[_sink$0].writeAll(objects, sep);
}
add(data) {
+ this[_translation] = io._FileTranslation.binary;
this[_sink$0].add(data);
}
addError(error, stackTrace) {
@@ -48089,9 +48936,11 @@
this[_sink$0].addError(error, stackTrace);
}
writeCharCode(charCode) {
+ this[_translation] = io._FileTranslation.text;
this[_sink$0].writeCharCode(charCode);
}
addStream(stream) {
+ this[_translation] = io._FileTranslation.binary;
return this[_sink$0].addStream(stream);
}
flush() {
@@ -48104,14 +48953,20 @@
return this[_sink$0].done;
}
};
-io._StdSink[dart.implements] = () => [io.IOSink];
-dart.setSignature(io._StdSink, {
- fields: () => ({[_sink$0]: io.IOSink}),
+io._StdSinkHelper[dart.implements] = () => [io.IOSink];
+dart.setSignature(io._StdSinkHelper, {
+ fields: () => ({
+ [_sink$0]: io.IOSink,
+ [_isTranslatable]: core.bool
+ }),
getters: () => ({
encoding: dart.definiteFunctionType(convert.Encoding, []),
done: dart.definiteFunctionType(async.Future, [])
}),
- setters: () => ({encoding: dart.definiteFunctionType(dart.void, [convert.Encoding])}),
+ setters: () => ({
+ encoding: dart.definiteFunctionType(dart.void, [convert.Encoding]),
+ [_translation]: dart.definiteFunctionType(dart.void, [io._FileTranslation])
+ }),
methods: () => ({
write: dart.definiteFunctionType(dart.void, [core.Object]),
writeln: dart.definiteFunctionType(dart.void, [], [core.Object]),
@@ -48124,7 +48979,12 @@
close: dart.definiteFunctionType(async.Future, [])
})
});
-io.Stdout = class Stdout extends io._StdSink {
+io._StdFileSink = class _StdFileSink extends io._StdSinkHelper {
+ new(sink) {
+ super.new(sink, true);
+ }
+};
+io.Stdout = class Stdout extends io._StdFileSink {
_(sink, fd) {
this[_fd] = fd;
this[_nonBlocking] = null;
@@ -48191,6 +49051,23 @@
osError: io.OSError
})
});
+io.StdinException = class StdinException extends core.Object {
+ new(message, osError) {
+ if (osError === void 0) osError = null;
+ this.message = message;
+ this.osError = osError;
+ }
+ toString() {
+ return dart.str`StdinException: ${this.message}${this.osError == null ? "" : dart.str`, ${this.osError}`}`;
+ }
+};
+io.StdinException[dart.implements] = () => [io.IOException];
+dart.setSignature(io.StdinException, {
+ fields: () => ({
+ message: core.String,
+ osError: io.OSError
+ })
+});
io._StdConsumer = class _StdConsumer extends core.Object {
new(fd) {
this[_file] = io._File._openStdioSync(fd);
@@ -48223,6 +49100,11 @@
close: dart.definiteFunctionType(async.Future, [])
})
});
+io._StdSocketSink = class _StdSocketSink extends io._StdSinkHelper {
+ new(sink) {
+ super.new(sink, false);
+ }
+};
io.StdioType = class StdioType extends core.Object {
_(name) {
this.name = name;
@@ -48351,10 +49233,10 @@
}),
names: ['_getStdioOutputStream', '_getStdioInputStream', '_socketType', '_getStdioHandleType']
});
-let const$76;
-let const$77;
-let const$78;
let const$79;
+let const$80;
+let const$81;
+let const$82;
io.SystemEncoding = class SystemEncoding extends convert.Encoding {
new() {
super.new();
@@ -48370,16 +49252,16 @@
}
get encoder() {
if (io.Platform.operatingSystem == "windows") {
- return const$76 || (const$76 = dart.const(new io._WindowsCodePageEncoder()));
+ return const$79 || (const$79 = dart.const(new io._WindowsCodePageEncoder()));
} else {
- return const$77 || (const$77 = dart.const(new convert.Utf8Encoder()));
+ return const$80 || (const$80 = dart.const(new convert.Utf8Encoder()));
}
}
get decoder() {
if (io.Platform.operatingSystem == "windows") {
- return const$78 || (const$78 = dart.const(new io._WindowsCodePageDecoder()));
+ return const$81 || (const$81 = dart.const(new io._WindowsCodePageDecoder()));
} else {
- return const$79 || (const$79 = dart.const(new convert.Utf8Decoder()));
+ return const$82 || (const$82 = dart.const(new convert.Utf8Decoder()));
}
}
};
@@ -48410,6 +49292,7 @@
}
};
dart.addSimpleTypeTests(io._WindowsCodePageEncoder);
+io._WindowsCodePageEncoder[dart.implements] = () => [ChunkedConverterOfString$ListOfint$String$ListOfint()];
dart.setSignature(io._WindowsCodePageEncoder, {
methods: () => ({
convert: dart.definiteFunctionType(core.List$(core.int), [core.String]),
@@ -48462,6 +49345,7 @@
}
};
dart.addSimpleTypeTests(io._WindowsCodePageDecoder);
+io._WindowsCodePageDecoder[dart.implements] = () => [ChunkedConverterOfListOfint$String$ListOfint$String()];
dart.setSignature(io._WindowsCodePageDecoder, {
methods: () => ({
convert: dart.definiteFunctionType(core.String, [ListOfint()]),
@@ -48690,6 +49574,14 @@
io._WebSocketOpcode.RESERVED_D = 13;
io._WebSocketOpcode.RESERVED_E = 14;
io._WebSocketOpcode.RESERVED_F = 15;
+io._EncodedString = class _EncodedString extends core.Object {
+ new(bytes) {
+ this.bytes = bytes;
+ }
+};
+dart.setSignature(io._EncodedString, {
+ fields: () => ({bytes: ListOfint()})
+});
io._CompressionMaxWindowBits = class _CompressionMaxWindowBits extends core.Object {
new(headerValue, maxWindowBits) {
if (headerValue === void 0) headerValue = null;
@@ -49029,7 +49921,7 @@
this[_unmaskingIndex] = 0;
}
};
-io._WebSocketProtocolTransformer[dart.implements] = () => [StreamTransformerOfListOfint$dynamic(), EventSinkOfUint8List()];
+io._WebSocketProtocolTransformer[dart.implements] = () => [EventSinkOfListOfint(), StreamTransformerOfListOfint$dynamic()];
dart.setSignature(io._WebSocketProtocolTransformer, {
fields: () => ({
[_state$1]: core.int,
@@ -49052,7 +49944,7 @@
[_deflate]: io._WebSocketPerMessageDeflate
}),
methods: () => ({
- bind: dart.definiteFunctionType(async.Stream, [async.Stream]),
+ bind: dart.definiteFunctionType(async.Stream, [StreamOfListOfint()]),
addError: dart.definiteFunctionType(dart.void, [core.Object], [core.StackTrace]),
close: dart.definiteFunctionType(dart.void, []),
add: dart.definiteFunctionType(dart.void, [ListOfint()]),
@@ -49096,6 +49988,7 @@
dart.setSignature(io._WebSocketPong, {
fields: () => ({payload: ListOfint()})
});
+io._ProtocolSelector = dart.typedef('_ProtocolSelector', () => dart.functionType(dart.dynamic, [ListOfString()]));
const _protocolSelector = Symbol('_protocolSelector');
const _compression = Symbol('_compression');
io._WebSocketTransformerImpl = class _WebSocketTransformerImpl extends core.Object {
@@ -49133,24 +50026,24 @@
}
let deflate = io._WebSocketTransformerImpl._negotiateCompression(request, response, compression);
response.headers.contentLength = 0;
- return response.detachSocket().then(io._WebSocketImpl)(dart.fn(socket => new io._WebSocketImpl._fromSocket(socket, protocol, compression, true, deflate), SocketTo_WebSocketImpl()));
+ return response.detachSocket().then(io.WebSocket)(dart.fn(socket => new io._WebSocketImpl._fromSocket(socket, protocol, compression, true, deflate), SocketTo_WebSocketImpl()));
}
- dart.fn(upgrade, StringToFuture());
+ dart.fn(upgrade, StringToFutureOfWebSocket());
let protocols = request.headers._get('Sec-WebSocket-Protocol');
if (protocols != null && _protocolSelector != null) {
protocols = io._HttpParser._tokenizeFieldValue(protocols[dartx.join](', '));
- return async.Future.new(dart.fn(() => dart.dcall(_protocolSelector, protocols), VoidTodynamic$())).then(dart.dynamic)(dart.fn(protocol => {
- if (dart.notNull(protocols[dartx.indexOf](core.String._check(protocol))) < 0) {
+ return FutureOfString().new(dart.fn(() => _protocolSelector(protocols), VoidTodynamic$())).then(core.String)(dart.fn(protocol => {
+ if (dart.notNull(protocols[dartx.indexOf](protocol)) < 0) {
dart.throw(new io.WebSocketException("Selected protocol is not in the list of available protocols"));
}
return protocol;
- }, dynamicTodynamic$())).catchError(dart.fn(error => {
+ }, StringToString$())).catchError(dart.fn(error => {
response.statusCode = io.HttpStatus.INTERNAL_SERVER_ERROR;
response.close();
dart.throw(error);
}, dynamicToNull$())).then(io.WebSocket)(upgrade);
} else {
- return FutureOfWebSocket()._check(upgrade(null));
+ return upgrade(null);
}
}
static _negotiateCompression(request, response, compression) {
@@ -49199,12 +50092,12 @@
dart.setSignature(io._WebSocketTransformerImpl, {
fields: () => ({
[_controller$0]: StreamControllerOfWebSocket(),
- [_protocolSelector]: core.Function,
+ [_protocolSelector]: io._ProtocolSelector,
[_compression]: io.CompressionOptions
}),
methods: () => ({bind: dart.definiteFunctionType(async.Stream$(io.WebSocket), [StreamOfHttpRequest()])}),
statics: () => ({
- _upgrade: dart.definiteFunctionType(async.Future$(io.WebSocket), [io.HttpRequest, dart.dynamic, io.CompressionOptions]),
+ _upgrade: dart.definiteFunctionType(async.Future$(io.WebSocket), [io.HttpRequest, io._ProtocolSelector, io.CompressionOptions]),
_negotiateCompression: dart.definiteFunctionType(io._WebSocketPerMessageDeflate, [io.HttpRequest, io.HttpResponse, io.CompressionOptions]),
_isUpgradeRequest: dart.definiteFunctionType(core.bool, [io.HttpRequest])
}),
@@ -49212,7 +50105,7 @@
});
const _ensureDecoder = Symbol('_ensureDecoder');
const _ensureEncoder = Symbol('_ensureEncoder');
-let const$80;
+let const$83;
io._WebSocketPerMessageDeflate = class _WebSocketPerMessageDeflate extends core.Object {
new(opts) {
let clientMaxWindowBits = opts && 'clientMaxWindowBits' in opts ? opts.clientMaxWindowBits : io._WebSocketImpl.DEFAULT_WINDOW_BITS;
@@ -49240,25 +50133,24 @@
}
processIncomingMessage(msg) {
this[_ensureDecoder]();
- let data = [];
+ let data = JSArrayOfint().of([]);
data[dartx.addAll](msg);
- data[dartx.addAll](const$80 || (const$80 = dart.constList([0, 0, 255, 255], core.int)));
- this.decoder.process(ListOfint()._check(data), 0, data[dartx.length]);
- let result = [];
+ data[dartx.addAll](const$83 || (const$83 = dart.constList([0, 0, 255, 255], core.int)));
+ this.decoder.process(data, 0, data[dartx.length]);
+ let result = JSArrayOfint().of([]);
let out = null;
while ((out = this.decoder.processed()) != null) {
- result[dartx.addAll](core.Iterable._check(out));
+ result[dartx.addAll](out);
}
if (dart.test(this.serverSide) && dart.test(this.clientNoContextTakeover) || !dart.test(this.serverSide) && dart.test(this.serverNoContextTakeover)) {
this.decoder = null;
}
- return typed_data.Uint8List.fromList(ListOfint()._check(result));
+ return typed_data.Uint8List.fromList(result);
}
processOutgoingMessage(msg) {
this[_ensureEncoder]();
- let result = [];
+ let result = JSArrayOfint().of([]);
let buffer = null;
- let out = null;
if (!typed_data.Uint8List.is(msg)) {
for (let i = 0; i < dart.notNull(msg[dartx.length]); i++) {
if (dart.notNull(msg[dartx._get](i)) < 0 || 255 < dart.notNull(msg[dartx._get](i))) {
@@ -49270,8 +50162,9 @@
buffer = typed_data.Uint8List._check(msg);
}
this.encoder.process(buffer, 0, buffer[dartx.length]);
+ let out = null;
while ((out = this.encoder.processed()) != null) {
- result[dartx.addAll](core.Iterable._check(out));
+ result[dartx.addAll](out);
}
if (!dart.test(this.serverSide) && dart.test(this.clientNoContextTakeover) || dart.test(this.serverSide) && dart.test(this.serverNoContextTakeover)) {
this.encoder = null;
@@ -49279,7 +50172,7 @@
if (dart.notNull(result[dartx.length]) > 4) {
result = result[dartx.sublist](0, dart.notNull(result[dartx.length]) - 4);
}
- return ListOfint()._check(result);
+ return result;
}
};
dart.setSignature(io._WebSocketPerMessageDeflate, {
@@ -49333,13 +50226,14 @@
if (typeof message == 'string') {
opcode = io._WebSocketOpcode.TEXT;
data = convert.UTF8.encode(message);
+ } else if (ListOfint().is(message)) {
+ opcode = io._WebSocketOpcode.BINARY;
+ data = message;
+ } else if (io._EncodedString.is(message)) {
+ opcode = io._WebSocketOpcode.TEXT;
+ data = message.bytes;
} else {
- if (ListOfint().is(message)) {
- data = message;
- opcode = io._WebSocketOpcode.BINARY;
- } else {
- dart.throw(new core.ArgumentError(message));
- }
+ dart.throw(new core.ArgumentError(message));
}
if (this[_deflateHelper] != null) {
data = this[_deflateHelper].processOutgoingMessage(data);
@@ -49369,7 +50263,7 @@
this[_eventSink$].close();
}
addFrame(opcode, data) {
- return io._WebSocketOutgoingTransformer.createFrame(opcode, data, this.webSocket[_serverSide], this[_deflateHelper] != null && (opcode == io._WebSocketOpcode.TEXT || opcode == io._WebSocketOpcode.BINARY))[dartx.forEach](dart.fn(e => {
+ io._WebSocketOutgoingTransformer.createFrame(opcode, data, this.webSocket[_serverSide], this[_deflateHelper] != null && (opcode == io._WebSocketOpcode.TEXT || opcode == io._WebSocketOpcode.BINARY))[dartx.forEach](dart.fn(e => {
this[_eventSink$].add(e);
}, ListOfintToNull()));
}
@@ -49561,7 +50455,7 @@
this[_ensureController]();
const closeSocket = (function() {
return this.socket.close().catchError(dart.fn(_ => {
- }, dynamicToNull$())).then(io._WebSocketImpl)(dart.fn(_ => this.webSocket, dynamicTo_WebSocketImpl()));
+ }, dynamicToNull$())).then(io._WebSocketImpl)(dart.fn(_ => this.webSocket, SocketTo_WebSocketImpl()));
}).bind(this);
dart.fn(closeSocket, VoidToFuture());
this[_controller$0].close();
@@ -49611,7 +50505,7 @@
const _pingTimer = Symbol('_pingTimer');
const _consumer = Symbol('_consumer');
const _closeTimer = Symbol('_closeTimer');
-let const$81;
+let const$84;
io._WebSocketImpl = class _WebSocketImpl extends dart.mixin(async.Stream, io._ServiceObject) {
static connect(url, protocols, headers, opts) {
let compression = opts && 'compression' in opts ? opts.compression : io.CompressionOptions.DEFAULT;
@@ -49808,6 +50702,12 @@
add(data) {
this[_sink$0].add(data);
}
+ addUtf8Text(bytes) {
+ if (!ListOfint().is(bytes)) {
+ dart.throw(new core.ArgumentError.value(bytes, "bytes", "Is not a list of bytes"));
+ }
+ this[_sink$0].add(new io._EncodedString(bytes));
+ }
addError(error, stackTrace) {
if (stackTrace === void 0) stackTrace = null;
this[_sink$0].addError(error, stackTrace);
@@ -49833,7 +50733,7 @@
this[_controller$0].stream.drain(dart.dynamic)().catchError(dart.fn(_ => dart.map(), dynamicToMap()));
}
if (this[_closeTimer] == null) {
- this[_closeTimer] = async.Timer.new(const$81 || (const$81 = dart.const(new core.Duration({seconds: 5}))), dart.fn(() => {
+ this[_closeTimer] = async.Timer.new(const$84 || (const$84 = dart.const(new core.Duration({seconds: 5}))), dart.fn(() => {
this[_closeCode] = this[_outCloseCode];
this[_closeReason] = this[_outCloseReason];
if (this[_subscription$] != null) this[_subscription$].cancel();
@@ -49917,6 +50817,7 @@
methods: () => ({
listen: dart.definiteFunctionType(async.StreamSubscription, [dynamicTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool}),
add: dart.definiteFunctionType(dart.void, [dart.dynamic]),
+ addUtf8Text: dart.definiteFunctionType(dart.void, [ListOfint()]),
addError: dart.definiteFunctionType(dart.void, [dart.dynamic], [core.StackTrace]),
addStream: dart.definiteFunctionType(async.Future, [async.Stream]),
close: dart.definiteFunctionType(async.Future, [], [core.int, core.String]),
@@ -49941,7 +50842,7 @@
return io.HttpClient.new();
}
});
-isolate.IsolateSpawnException = class IsolateSpawnException extends core.Object {
+isolate$.IsolateSpawnException = class IsolateSpawnException extends core.Object {
new(message) {
this.message = message;
}
@@ -49949,12 +50850,12 @@
return dart.str`IsolateSpawnException: ${this.message}`;
}
};
-isolate.IsolateSpawnException[dart.implements] = () => [core.Exception];
-dart.setSignature(isolate.IsolateSpawnException, {
+isolate$.IsolateSpawnException[dart.implements] = () => [core.Exception];
+dart.setSignature(isolate$.IsolateSpawnException, {
fields: () => ({message: core.String})
});
const _pause = Symbol('_pause');
-isolate.Isolate = class Isolate extends core.Object {
+isolate$.Isolate = class Isolate extends core.Object {
new(controlPort, opts) {
let pauseCapability = opts && 'pauseCapability' in opts ? opts.pauseCapability : null;
let terminateCapability = opts && 'terminateCapability' in opts ? opts.terminateCapability : null;
@@ -49963,12 +50864,48 @@
this.terminateCapability = terminateCapability;
}
static get current() {
- return isolate.Isolate._currentIsolateCache;
+ return isolate$.Isolate._currentIsolateCache;
+ }
+ static get packageRoot() {
+ dart.throw(new core.UnsupportedError("Isolate.packageRoot"));
+ }
+ static get packageConfig() {
+ dart.throw(new core.UnsupportedError("Isolate.packageConfig"));
+ }
+ static resolvePackageUri(packageUri) {
+ return dart.async(function*(packageUri) {
+ if (packageUri.scheme != 'package') return packageUri;
+ return isolate$.Isolate._packageBase.resolveUri(packageUri.replace({scheme: ''}));
+ }, core.Uri, packageUri);
}
static spawn(entryPoint, message, opts) {
let paused = opts && 'paused' in opts ? opts.paused : false;
+ let errorsAreFatal = opts && 'errorsAreFatal' in opts ? opts.errorsAreFatal : null;
+ let onExit = opts && 'onExit' in opts ? opts.onExit : null;
+ let onError = opts && 'onError' in opts ? opts.onError : null;
+ let forcePause = errorsAreFatal != null || onExit != null || onError != null;
try {
- return _isolate_helper.IsolateNatives.spawnFunction(entryPoint, message, paused).then(isolate.Isolate)(dart.fn(msg => new isolate.Isolate(isolate.SendPort._check(msg[dartx._get](1)), {pauseCapability: isolate.Capability._check(msg[dartx._get](2)), terminateCapability: isolate.Capability._check(msg[dartx._get](3))}), ListToIsolate()));
+ if (!isolate$._UnaryFunction.is(entryPoint)) {
+ dart.throw(new core.ArgumentError(entryPoint));
+ }
+ return _isolate_helper.IsolateNatives.spawnFunction(entryPoint, message, dart.test(paused) || forcePause).then(isolate$.Isolate)(dart.fn(msg => {
+ let isolate = new isolate$.Isolate(isolate$.SendPort._check(msg[dartx._get](1)), {pauseCapability: isolate$.Capability._check(msg[dartx._get](2)), terminateCapability: isolate$.Capability._check(msg[dartx._get](3))});
+ if (forcePause) {
+ if (errorsAreFatal != null) {
+ isolate.setErrorsFatal(errorsAreFatal);
+ }
+ if (onExit != null) {
+ isolate.addOnExitListener(onExit);
+ }
+ if (onError != null) {
+ isolate.addErrorListener(onError);
+ }
+ if (!dart.test(paused)) {
+ isolate.resume(isolate.pauseCapability);
+ }
+ }
+ return isolate;
+ }, ListToIsolate()));
} catch (e) {
let st = dart.stackTrace(e);
return FutureOfIsolate().error(e, st);
@@ -49977,10 +50914,20 @@
}
static spawnUri(uri, args, message, opts) {
let paused = opts && 'paused' in opts ? opts.paused : false;
+ let onExit = opts && 'onExit' in opts ? opts.onExit : null;
+ let onError = opts && 'onError' in opts ? opts.onError : null;
+ let errorsAreFatal = opts && 'errorsAreFatal' in opts ? opts.errorsAreFatal : null;
+ let checked = opts && 'checked' in opts ? opts.checked : null;
+ let environment = opts && 'environment' in opts ? opts.environment : null;
let packageRoot = opts && 'packageRoot' in opts ? opts.packageRoot : null;
+ let packageConfig = opts && 'packageConfig' in opts ? opts.packageConfig : null;
+ let automaticPackageResolution = opts && 'automaticPackageResolution' in opts ? opts.automaticPackageResolution : false;
+ if (environment != null) dart.throw(new core.UnimplementedError("environment"));
if (packageRoot != null) dart.throw(new core.UnimplementedError("packageRoot"));
+ if (packageConfig != null) dart.throw(new core.UnimplementedError("packageConfig"));
+ let forcePause = errorsAreFatal != null || onExit != null || onError != null;
try {
- if (core.List.is(args)) {
+ if (ListOfString().is(args)) {
for (let i = 0; i < dart.notNull(args[dartx.length]); i++) {
if (!(typeof args[dartx._get](i) == 'string')) {
dart.throw(new core.ArgumentError(dart.str`Args must be a list of Strings ${args}`));
@@ -49989,7 +50936,24 @@
} else if (args != null) {
dart.throw(new core.ArgumentError(dart.str`Args must be a list of Strings ${args}`));
}
- return _isolate_helper.IsolateNatives.spawnUri(uri, args, message, paused).then(isolate.Isolate)(dart.fn(msg => new isolate.Isolate(isolate.SendPort._check(msg[dartx._get](1)), {pauseCapability: isolate.Capability._check(msg[dartx._get](2)), terminateCapability: isolate.Capability._check(msg[dartx._get](3))}), ListToIsolate()));
+ return _isolate_helper.IsolateNatives.spawnUri(uri, args, message, dart.test(paused) || forcePause).then(isolate$.Isolate)(dart.fn(msg => {
+ let isolate = new isolate$.Isolate(isolate$.SendPort._check(msg[dartx._get](1)), {pauseCapability: isolate$.Capability._check(msg[dartx._get](2)), terminateCapability: isolate$.Capability._check(msg[dartx._get](3))});
+ if (forcePause) {
+ if (errorsAreFatal != null) {
+ isolate.setErrorsFatal(errorsAreFatal);
+ }
+ if (onExit != null) {
+ isolate.addOnExitListener(onExit);
+ }
+ if (onError != null) {
+ isolate.addErrorListener(onError);
+ }
+ if (!dart.test(paused)) {
+ isolate.resume(isolate.pauseCapability);
+ }
+ }
+ return isolate;
+ }, ListToIsolate()));
} catch (e) {
let st = dart.stackTrace(e);
return FutureOfIsolate().error(e, st);
@@ -49998,7 +50962,8 @@
}
pause(resumeCapability) {
if (resumeCapability === void 0) resumeCapability = null;
- if (resumeCapability == null) resumeCapability = isolate.Capability.new();
+ let t = resumeCapability;
+ t == null ? resumeCapability = isolate$.Capability.new() : t;
this[_pause](resumeCapability);
return resumeCapability;
}
@@ -50015,10 +50980,12 @@
message[dartx._set](1, resumeCapability);
this.controlPort.send(message);
}
- addOnExitListener(responsePort) {
- let message = core.List.new(2);
+ addOnExitListener(responsePort, opts) {
+ let response = opts && 'response' in opts ? opts.response : null;
+ let message = core.List.new(3);
message[dartx._set](0, "add-ondone");
message[dartx._set](1, responsePort);
+ message[dartx._set](2, response);
this.controlPort.send(message);
}
removeOnExitListener(responsePort) {
@@ -50034,16 +51001,18 @@
message[dartx._set](2, errorsAreFatal);
this.controlPort.send(message);
}
- kill(priority) {
- if (priority === void 0) priority = isolate.Isolate.BEFORE_NEXT_EVENT;
+ kill(opts) {
+ let priority = opts && 'priority' in opts ? opts.priority : isolate$.Isolate.BEFORE_NEXT_EVENT;
this.controlPort.send(JSArrayOfObject().of(["kill", this.terminateCapability, priority]));
}
- ping(responsePort, pingType) {
- if (pingType === void 0) pingType = isolate.Isolate.IMMEDIATE;
- let message = core.List.new(3);
+ ping(responsePort, opts) {
+ let response = opts && 'response' in opts ? opts.response : null;
+ let priority = opts && 'priority' in opts ? opts.priority : isolate$.Isolate.IMMEDIATE;
+ let message = core.List.new(4);
message[dartx._set](0, "ping");
message[dartx._set](1, responsePort);
- message[dartx._set](2, pingType);
+ message[dartx._set](2, priority);
+ message[dartx._set](3, response);
this.controlPort.send(message);
}
addErrorListener(port) {
@@ -50064,12 +51033,12 @@
function handleError(message) {
let errorDescription = core.String._check(dart.dindex(message, 0));
let stackDescription = core.String._check(dart.dindex(message, 1));
- let error = new isolate.RemoteError(errorDescription, stackDescription);
+ let error = new isolate$.RemoteError(errorDescription, stackDescription);
controller.addError(error, error.stackTrace);
}
dart.fn(handleError, dynamicTovoid$());
controller = async.StreamController.broadcast({sync: true, onListen: dart.fn(() => {
- port = isolate.RawReceivePort.new(handleError);
+ port = isolate$.RawReceivePort.new(handleError);
this.addErrorListener(port.sendPort);
}, VoidToNull()), onCancel: dart.fn(() => {
this.removeErrorListener(port.sendPort);
@@ -50079,42 +51048,46 @@
return controller.stream;
}
};
-dart.setSignature(isolate.Isolate, {
+dart.setSignature(isolate$.Isolate, {
fields: () => ({
- controlPort: isolate.SendPort,
- pauseCapability: isolate.Capability,
- terminateCapability: isolate.Capability
+ controlPort: isolate$.SendPort,
+ pauseCapability: isolate$.Capability,
+ terminateCapability: isolate$.Capability
}),
getters: () => ({errors: dart.definiteFunctionType(async.Stream, [])}),
methods: () => ({
- pause: dart.definiteFunctionType(isolate.Capability, [], [isolate.Capability]),
- [_pause]: dart.definiteFunctionType(dart.void, [isolate.Capability]),
- resume: dart.definiteFunctionType(dart.void, [isolate.Capability]),
- addOnExitListener: dart.definiteFunctionType(dart.void, [isolate.SendPort]),
- removeOnExitListener: dart.definiteFunctionType(dart.void, [isolate.SendPort]),
+ pause: dart.definiteFunctionType(isolate$.Capability, [], [isolate$.Capability]),
+ [_pause]: dart.definiteFunctionType(dart.void, [isolate$.Capability]),
+ resume: dart.definiteFunctionType(dart.void, [isolate$.Capability]),
+ addOnExitListener: dart.definiteFunctionType(dart.void, [isolate$.SendPort], {response: core.Object}),
+ removeOnExitListener: dart.definiteFunctionType(dart.void, [isolate$.SendPort]),
setErrorsFatal: dart.definiteFunctionType(dart.void, [core.bool]),
- kill: dart.definiteFunctionType(dart.void, [], [core.int]),
- ping: dart.definiteFunctionType(dart.void, [isolate.SendPort], [core.int]),
- addErrorListener: dart.definiteFunctionType(dart.void, [isolate.SendPort]),
- removeErrorListener: dart.definiteFunctionType(dart.void, [isolate.SendPort])
+ kill: dart.definiteFunctionType(dart.void, [], {priority: core.int}),
+ ping: dart.definiteFunctionType(dart.void, [isolate$.SendPort], {response: core.Object, priority: core.int}),
+ addErrorListener: dart.definiteFunctionType(dart.void, [isolate$.SendPort]),
+ removeErrorListener: dart.definiteFunctionType(dart.void, [isolate$.SendPort])
}),
statics: () => ({
- spawn: dart.definiteFunctionType(async.Future$(isolate.Isolate), [dynamicTovoid(), dart.dynamic], {paused: core.bool}),
- spawnUri: dart.definiteFunctionType(async.Future$(isolate.Isolate), [core.Uri, ListOfString(), dart.dynamic], {paused: core.bool, packageRoot: core.Uri})
+ resolvePackageUri: dart.definiteFunctionType(async.Future$(core.Uri), [core.Uri]),
+ spawn: dart.definiteFunctionType(async.Future$(isolate$.Isolate), [dynamicTovoid(), dart.dynamic], {paused: core.bool, errorsAreFatal: core.bool, onExit: isolate$.SendPort, onError: isolate$.SendPort}),
+ spawnUri: dart.definiteFunctionType(async.Future$(isolate$.Isolate), [core.Uri, ListOfString(), dart.dynamic], {paused: core.bool, onExit: isolate$.SendPort, onError: isolate$.SendPort, errorsAreFatal: core.bool, checked: core.bool, environment: MapOfString$String(), packageRoot: core.Uri, packageConfig: core.Uri, automaticPackageResolution: core.bool})
}),
- names: ['spawn', 'spawnUri']
+ names: ['resolvePackageUri', 'spawn', 'spawnUri']
});
-isolate.Isolate.IMMEDIATE = 0;
-isolate.Isolate.BEFORE_NEXT_EVENT = 1;
-isolate.Isolate.AS_EVENT = 2;
-dart.defineLazy(isolate.Isolate, {
+isolate$.Isolate.IMMEDIATE = 0;
+isolate$.Isolate.BEFORE_NEXT_EVENT = 1;
+dart.defineLazy(isolate$.Isolate, {
get _currentIsolateCache() {
return _isolate_helper.IsolateNatives.currentIsolate;
- }
+ },
+ get _packageBase() {
+ return core.Uri.base.resolve(core.String._check(dart.dload(_isolate_helper.IsolateNatives, 'packagesBase')));
+ },
+ set _packageBase(_) {}
});
-isolate.SendPort = class SendPort extends core.Object {};
-isolate.SendPort[dart.implements] = () => [isolate.Capability];
-isolate.ReceivePort = class ReceivePort extends core.Object {
+isolate$.SendPort = class SendPort extends core.Object {};
+isolate$.SendPort[dart.implements] = () => [isolate$.Capability];
+isolate$.ReceivePort = class ReceivePort extends core.Object {
static new() {
return new _isolate_helper.ReceivePortImpl();
}
@@ -50122,62 +51095,32 @@
return new _isolate_helper.ReceivePortImpl.fromRawReceivePort(rawPort);
}
};
-isolate.ReceivePort[dart.implements] = () => [async.Stream];
-isolate.RawReceivePort = class RawReceivePort extends core.Object {
+isolate$.ReceivePort[dart.implements] = () => [async.Stream];
+isolate$.RawReceivePort = class RawReceivePort extends core.Object {
static new(handler) {
if (handler === void 0) handler = null;
return new _isolate_helper.RawReceivePortImpl(handler);
}
};
-isolate._IsolateUnhandledException = class _IsolateUnhandledException extends core.Object {
- new(message, source, stackTrace) {
- this.message = message;
- this.source = source;
- this.stackTrace = stackTrace;
- }
- toString() {
- return 'IsolateUnhandledException: exception while handling message: ' + dart.str`${this.message} \n ` + dart.str`${dart.toString(this.source)[dartx.replaceAll]("\n", "\n ")}\n` + 'original stack trace:\n ' + dart.str`${dart.toString(this.stackTrace)[dartx.replaceAll]("\n", "\n ")}`;
- }
-};
-isolate._IsolateUnhandledException[dart.implements] = () => [core.Exception];
-dart.setSignature(isolate._IsolateUnhandledException, {
- fields: () => ({
- message: dart.dynamic,
- source: dart.dynamic,
- stackTrace: core.StackTrace
- })
-});
const _description = Symbol('_description');
-isolate.RemoteError = class RemoteError extends core.Object {
+isolate$.RemoteError = class RemoteError extends core.Object {
new(description, stackDescription) {
this[_description] = description;
- this.stackTrace = new isolate._RemoteStackTrace(stackDescription);
+ this.stackTrace = core.StackTrace.fromString(stackDescription);
}
toString() {
return this[_description];
}
};
-isolate.RemoteError[dart.implements] = () => [core.Error];
-dart.setSignature(isolate.RemoteError, {
+isolate$.RemoteError[dart.implements] = () => [core.Error];
+dart.setSignature(isolate$.RemoteError, {
fields: () => ({
[_description]: core.String,
stackTrace: core.StackTrace
})
});
-const _trace$ = Symbol('_trace');
-isolate._RemoteStackTrace = class _RemoteStackTrace extends core.Object {
- new(trace) {
- this[_trace$] = trace;
- }
- toString() {
- return this[_trace$];
- }
-};
-isolate._RemoteStackTrace[dart.implements] = () => [core.StackTrace];
-dart.setSignature(isolate._RemoteStackTrace, {
- fields: () => ({[_trace$]: core.String})
-});
-isolate.Capability = class Capability extends core.Object {
+isolate$._UnaryFunction = dart.typedef('_UnaryFunction', () => dart.functionType(dart.dynamic, [dart.dynamic]));
+isolate$.Capability = class Capability extends core.Object {
static new() {
return new _isolate_helper.CapabilityImpl();
}
@@ -50694,13 +51637,40 @@
math.SQRT2 = 1.4142135623730951;
math.min = function(T) {
return (a, b) => {
- return Math.min(_js_helper.checkNum(a), _js_helper.checkNum(b));
+ if (!(typeof a == 'number')) dart.throw(new core.ArgumentError(a));
+ if (!(typeof b == 'number')) dart.throw(new core.ArgumentError(b));
+ if (dart.notNull(a) > dart.notNull(b)) return b;
+ if (dart.notNull(a) < dart.notNull(b)) return a;
+ if (typeof b == 'number') {
+ if (typeof a == 'number') {
+ if (a == 0.0) {
+ return (dart.notNull(a) + dart.notNull(b)) * dart.notNull(a) * dart.notNull(b);
+ }
+ }
+ if (a == 0 && dart.test(b[dartx.isNegative]) || dart.test(b[dartx.isNaN])) return b;
+ return a;
+ }
+ return a;
};
};
dart.fn(math.min, TAndTToT());
math.max = function(T) {
return (a, b) => {
- return Math.max(_js_helper.checkNum(a), _js_helper.checkNum(b));
+ if (!(typeof a == 'number')) dart.throw(new core.ArgumentError(a));
+ if (!(typeof b == 'number')) dart.throw(new core.ArgumentError(b));
+ if (dart.notNull(a) > dart.notNull(b)) return a;
+ if (dart.notNull(a) < dart.notNull(b)) return b;
+ if (typeof b == 'number') {
+ if (typeof a == 'number') {
+ if (a == 0.0) {
+ return dart.notNull(a) + dart.notNull(b);
+ }
+ }
+ if (dart.test(b[dartx.isNaN])) return b;
+ return a;
+ }
+ if (b == 0 && dart.test(a[dartx.isNegative])) return b;
+ return a;
};
};
dart.fn(math.max, TAndTToT$());
@@ -51053,11 +52023,11 @@
return Point;
});
math.Point = Point$();
-let const$82;
+let const$85;
math.Random = class Random extends core.Object {
static new(seed) {
if (seed === void 0) seed = null;
- return seed == null ? const$82 || (const$82 = dart.const(new math._JSRandom())) : new math._Random(seed);
+ return seed == null ? const$85 || (const$85 = dart.const(new math._JSRandom())) : new math._Random(seed);
}
static secure() {
return math.Random._secureRandom;
@@ -51101,8 +52071,7 @@
}
['=='](other) {
if (!RectangleOfnum().is(other)) return false;
- let otherRect = RectangleOfnum().as(other);
- return this[dartx.left] == otherRect[dartx.left] && this[dartx.top] == otherRect[dartx.top] && this[dartx.right] == otherRect[dartx.right] && this[dartx.bottom] == otherRect[dartx.bottom];
+ return dart.equals(this[dartx.left], dart.dload(other, 'left')) && dart.equals(this[dartx.top], dart.dload(other, 'top')) && dart.equals(this[dartx.right], dart.dload(other, 'right')) && dart.equals(this[dartx.bottom], dart.dload(other, 'bottom'));
}
get hashCode() {
return math._JenkinsSmiHash.hash4(dart.hashCode(this[dartx.left]), dart.hashCode(this[dartx.top]), dart.hashCode(this[dartx.right]), dart.hashCode(this[dartx.bottom]));
@@ -52412,7 +53381,7 @@
});
dart.registerExtension(dart.global.IDBKeyRange, indexed_db.KeyRange);
const _add$3 = Symbol('_add');
-const _clear$0 = Symbol('_clear');
+const _clear$ = Symbol('_clear');
const _put = Symbol('_put');
const _createIndex = Symbol('_createIndex');
const _add_1 = Symbol('_add_1');
@@ -52460,7 +53429,7 @@
}
[dartx.clear]() {
try {
- return indexed_db._completeRequest(dart.dynamic)(this[_clear$0]());
+ return indexed_db._completeRequest(dart.dynamic)(this[_clear$]());
} catch (e) {
let stacktrace = dart.stackTrace(e);
return async.Future.error(e, stacktrace);
@@ -52581,7 +53550,7 @@
[_add_2](...args) {
return this.add.apply(this, args);
}
- [_clear$0](...args) {
+ [_clear$](...args) {
return this.clear.apply(this, args);
}
[_count$0](...args) {
@@ -52680,7 +53649,7 @@
[_add$3]: dart.definiteFunctionType(indexed_db.Request, [dart.dynamic], [dart.dynamic]),
[_add_1]: dart.definiteFunctionType(indexed_db.Request, [dart.dynamic, dart.dynamic]),
[_add_2]: dart.definiteFunctionType(indexed_db.Request, [dart.dynamic]),
- [_clear$0]: dart.definiteFunctionType(indexed_db.Request, []),
+ [_clear$]: dart.definiteFunctionType(indexed_db.Request, []),
[_count$0]: dart.definiteFunctionType(indexed_db.Request, [core.Object]),
[_createIndex]: dart.definiteFunctionType(indexed_db.Index, [core.String, core.Object], [core.Map]),
[_createIndex_1]: dart.definiteFunctionType(indexed_db.Index, [dart.dynamic, dart.dynamic, dart.dynamic]),
@@ -59469,7 +60438,7 @@
const _borderWidth = Symbol('_borderWidth');
const _bottom = Symbol('_bottom');
const _captionSide = Symbol('_captionSide');
-const _clear$1 = Symbol('_clear');
+const _clear$0 = Symbol('_clear');
const _clip = Symbol('_clip');
const _color = Symbol('_color');
const _content = Symbol('_content');
@@ -64284,15 +65253,15 @@
this.captionSide = value;
}
get [dartx.clear]() {
- return this[_clear$1];
+ return this[_clear$0];
}
set [dartx.clear](value) {
- this[_clear$1] = value == null ? '' : value;
+ this[_clear$0] = value == null ? '' : value;
}
- get [_clear$1]() {
+ get [_clear$0]() {
return this.clear;
}
- set [_clear$1](value) {
+ set [_clear$0](value) {
this.clear = value;
}
get [dartx.clip]() {
@@ -65039,7 +66008,7 @@
[_borderWidth]: core.String,
[_bottom]: core.String,
[_captionSide]: core.String,
- [_clear$1]: core.String,
+ [_clear$0]: core.String,
[_clip]: core.String,
[_color]: core.String,
[_content]: core.String,
@@ -84087,7 +85056,7 @@
return value;
}
[dartx.clear]() {
- return this[_clear$1]();
+ return this[_clear$0]();
}
[dartx.forEach](f) {
for (let i = 0; true; i++) {
@@ -84130,7 +85099,7 @@
[__setter__](...args) {
return this.__setter__.apply(this, args);
}
- [_clear$1](...args) {
+ [_clear$0](...args) {
return this.clear.apply(this, args);
}
[_getItem](...args) {
@@ -84169,7 +85138,7 @@
[__delete__]: dart.definiteFunctionType(core.bool, [dart.dynamic]),
[__getter__]: dart.definiteFunctionType(core.String, [dart.dynamic]),
[__setter__]: dart.definiteFunctionType(dart.void, [dart.dynamic, core.String]),
- [_clear$1]: dart.definiteFunctionType(dart.void, []),
+ [_clear$0]: dart.definiteFunctionType(dart.void, []),
[_getItem]: dart.definiteFunctionType(core.String, [core.String]),
[_key]: dart.definiteFunctionType(core.String, [core.int]),
[_removeItem]: dart.definiteFunctionType(dart.void, [core.String]),
@@ -93179,9 +94148,6 @@
allowsAttribute: dart.definiteFunctionType(core.bool, [html$.Element, core.String, core.String])
})
});
-let const$83;
-let const$84;
-let const$85;
let const$86;
let const$87;
let const$88;
@@ -93189,15 +94155,18 @@
let const$90;
let const$91;
let const$92;
+let const$93;
+let const$94;
+let const$95;
html$._SimpleNodeValidator = class _SimpleNodeValidator extends core.Object {
static allowNavigation(uriPolicy) {
- return new html$._SimpleNodeValidator(uriPolicy, {allowedElements: const$83 || (const$83 = dart.constList(['A', 'FORM'], core.String)), allowedAttributes: const$84 || (const$84 = dart.constList(['A::accesskey', 'A::coords', 'A::hreflang', 'A::name', 'A::shape', 'A::tabindex', 'A::target', 'A::type', 'FORM::accept', 'FORM::autocomplete', 'FORM::enctype', 'FORM::method', 'FORM::name', 'FORM::novalidate', 'FORM::target'], core.String)), allowedUriAttributes: const$85 || (const$85 = dart.constList(['A::href', 'FORM::action'], core.String))});
+ return new html$._SimpleNodeValidator(uriPolicy, {allowedElements: const$86 || (const$86 = dart.constList(['A', 'FORM'], core.String)), allowedAttributes: const$87 || (const$87 = dart.constList(['A::accesskey', 'A::coords', 'A::hreflang', 'A::name', 'A::shape', 'A::tabindex', 'A::target', 'A::type', 'FORM::accept', 'FORM::autocomplete', 'FORM::enctype', 'FORM::method', 'FORM::name', 'FORM::novalidate', 'FORM::target'], core.String)), allowedUriAttributes: const$88 || (const$88 = dart.constList(['A::href', 'FORM::action'], core.String))});
}
static allowImages(uriPolicy) {
- return new html$._SimpleNodeValidator(uriPolicy, {allowedElements: const$86 || (const$86 = dart.constList(['IMG'], core.String)), allowedAttributes: const$87 || (const$87 = dart.constList(['IMG::align', 'IMG::alt', 'IMG::border', 'IMG::height', 'IMG::hspace', 'IMG::ismap', 'IMG::name', 'IMG::usemap', 'IMG::vspace', 'IMG::width'], core.String)), allowedUriAttributes: const$88 || (const$88 = dart.constList(['IMG::src'], core.String))});
+ return new html$._SimpleNodeValidator(uriPolicy, {allowedElements: const$89 || (const$89 = dart.constList(['IMG'], core.String)), allowedAttributes: const$90 || (const$90 = dart.constList(['IMG::align', 'IMG::alt', 'IMG::border', 'IMG::height', 'IMG::hspace', 'IMG::ismap', 'IMG::name', 'IMG::usemap', 'IMG::vspace', 'IMG::width'], core.String)), allowedUriAttributes: const$91 || (const$91 = dart.constList(['IMG::src'], core.String))});
}
static allowTextElements() {
- return new html$._SimpleNodeValidator(null, {allowedElements: const$89 || (const$89 = dart.constList(['B', 'BLOCKQUOTE', 'BR', 'EM', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'HR', 'I', 'LI', 'OL', 'P', 'SPAN', 'UL'], core.String))});
+ return new html$._SimpleNodeValidator(null, {allowedElements: const$92 || (const$92 = dart.constList(['B', 'BLOCKQUOTE', 'BR', 'EM', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'HR', 'I', 'LI', 'OL', 'P', 'SPAN', 'UL'], core.String))});
}
new(uriPolicy, opts) {
let allowedElements = opts && 'allowedElements' in opts ? opts.allowedElements : null;
@@ -93207,9 +94176,9 @@
this.allowedAttributes = SetOfString().new();
this.allowedUriAttributes = SetOfString().new();
this.uriPolicy = uriPolicy;
- this.allowedElements.addAll((allowedElements != null ? allowedElements : const$90 || (const$90 = dart.constList([], core.String))));
- allowedAttributes = allowedAttributes != null ? allowedAttributes : const$91 || (const$91 = dart.constList([], core.String));
- allowedUriAttributes = allowedUriAttributes != null ? allowedUriAttributes : const$92 || (const$92 = dart.constList([], core.String));
+ this.allowedElements.addAll((allowedElements != null ? allowedElements : const$93 || (const$93 = dart.constList([], core.String))));
+ allowedAttributes = allowedAttributes != null ? allowedAttributes : const$94 || (const$94 = dart.constList([], core.String));
+ allowedUriAttributes = allowedUriAttributes != null ? allowedUriAttributes : const$95 || (const$95 = dart.constList([], core.String));
let legalAttributes = allowedAttributes[dartx.where](dart.fn(x => !dart.test(html$._Html5NodeValidator._uriAttributes[dartx.contains](x)), StringTobool$()));
let extraUriAttributes = allowedAttributes[dartx.where](dart.fn(x => html$._Html5NodeValidator._uriAttributes[dartx.contains](x), StringTobool$()));
this.allowedAttributes.addAll(legalAttributes);
@@ -93495,7 +94464,7 @@
names: ['get']
});
const _array = Symbol('_array');
-const _current$4 = Symbol('_current');
+const _current$2 = Symbol('_current');
html$.FixedSizeListIterator$ = dart.generic(T => {
let IteratorOfT = () => (IteratorOfT = dart.constFn(core.Iterator$(T)))();
let ListOfT = () => (ListOfT = dart.constFn(core.List$(T)))();
@@ -93504,21 +94473,21 @@
this[_array] = array;
this[_position$1] = -1;
this[_length$3] = array[dartx.length];
- this[_current$4] = null;
+ this[_current$2] = null;
}
moveNext() {
let nextPosition = dart.notNull(this[_position$1]) + 1;
if (nextPosition < dart.notNull(this[_length$3])) {
- this[_current$4] = this[_array][dartx._get](nextPosition);
+ this[_current$2] = this[_array][dartx._get](nextPosition);
this[_position$1] = nextPosition;
return true;
}
- this[_current$4] = null;
+ this[_current$2] = null;
this[_position$1] = this[_length$3];
return false;
}
get current() {
- return this[_current$4];
+ return this[_current$2];
}
}
dart.addTypeTests(FixedSizeListIterator);
@@ -93528,7 +94497,7 @@
[_array]: ListOfT(),
[_length$3]: core.int,
[_position$1]: core.int,
- [_current$4]: T
+ [_current$2]: T
}),
getters: () => ({current: dart.definiteFunctionType(T, [])}),
methods: () => ({moveNext: dart.definiteFunctionType(core.bool, [])})
@@ -93543,21 +94512,21 @@
new(array) {
this[_array] = array;
this[_position$1] = -1;
- this[_current$4] = null;
+ this[_current$2] = null;
}
moveNext() {
let nextPosition = dart.notNull(this[_position$1]) + 1;
if (nextPosition < dart.notNull(this[_array][dartx.length])) {
- this[_current$4] = this[_array][dartx._get](nextPosition);
+ this[_current$2] = this[_array][dartx._get](nextPosition);
this[_position$1] = nextPosition;
return true;
}
- this[_current$4] = null;
+ this[_current$2] = null;
this[_position$1] = this[_array][dartx.length];
return false;
}
get current() {
- return this[_current$4];
+ return this[_current$2];
}
}
dart.addTypeTests(_VariableSizeListIterator);
@@ -93566,7 +94535,7 @@
fields: () => ({
[_array]: ListOfT(),
[_position$1]: core.int,
- [_current$4]: T
+ [_current$2]: T
}),
getters: () => ({current: dart.definiteFunctionType(T, [])}),
methods: () => ({moveNext: dart.definiteFunctionType(core.bool, [])})
@@ -104474,3 +105443,4 @@
methods: () => ({[dartx.executeSql]: dart.definiteFunctionType(dart.void, [core.String, ListOfObject()], [web_sql.SqlStatementCallback, web_sql.SqlStatementErrorCallback])})
});
dart.registerExtension(dart.global.SQLTransaction, web_sql.SqlTransaction);
+dart.trackLibraries("dart_sdk", {"dart:_runtime": dart, "dart:_debugger": _debugger, "dart:_foreign_helper": _foreign_helper, "dart:_interceptors": _interceptors, "dart:_internal": _internal, "dart:_isolate_helper": _isolate_helper, "dart:_js_embedded_names": _js_embedded_names, "dart:_js_helper": _js_helper, "dart:_js_mirrors": _js_mirrors, "dart:_js_primitives": _js_primitives, "dart:_metadata": _metadata, "dart:_native_typed_data": _native_typed_data, "dart:async": async, "dart:collection": collection, "dart:convert": convert, "dart:core": core, "dart:developer": developer, "dart:io": io, "dart:isolate": isolate$, "dart:js": js, "dart:js_util": js_util, "dart:math": math, "dart:mirrors": mirrors, "dart:typed_data": typed_data, "dart:indexed_db": indexed_db, "dart:html": html$, "dart:html_common": html_common, "dart:svg": svg$, "dart:web_audio": web_audio, "dart:web_gl": web_gl, "dart:web_sql": web_sql});
diff --git a/pkg/dev_compiler/lib/js/legacy/dart_library.js b/pkg/dev_compiler/lib/js/legacy/dart_library.js
index 585b7a4..bb6ab02 100644
--- a/pkg/dev_compiler/lib/js/legacy/dart_library.js
+++ b/pkg/dev_compiler/lib/js/legacy/dart_library.js
@@ -17,9 +17,6 @@
throw Error(message);
}
- const dartLibraryName = Symbol('dartLibraryName');
- dart_library.dartLibraryName = dartLibraryName;
-
const libraryImports = Symbol('libraryImports');
dart_library.libraryImports = libraryImports;
@@ -95,7 +92,7 @@
// Load the library
let loader = this;
let library = this._library;
- library[dartLibraryName] = this._name;
+
library[libraryImports] = this._imports;
library[loadedModule] = library;
args.unshift(library);
@@ -187,9 +184,6 @@
if (_bootstrapped) return;
_bootstrapped = true;
- // Force import of core.
- var dart_sdk = import_('dart_sdk');
-
// This import is only needed for chrome debugging. We should provide an
// option to compile without it.
dart_sdk._debugger.registerDevtoolsFormatter();
diff --git a/pkg/dev_compiler/lib/js/legacy/dart_sdk.js b/pkg/dev_compiler/lib/js/legacy/dart_sdk.js
index 175f986..b0a5605 100644
--- a/pkg/dev_compiler/lib/js/legacy/dart_sdk.js
+++ b/pkg/dev_compiler/lib/js/legacy/dart_sdk.js
@@ -20,7 +20,7 @@
const core = Object.create(null);
const developer = Object.create(null);
const io = Object.create(null);
- const isolate = Object.create(null);
+ const isolate$ = Object.create(null);
const js = Object.create(null);
const js_util = Object.create(null);
const math = Object.create(null);
@@ -40,16 +40,14 @@
let MapOfString$_MethodStats = () => (MapOfString$_MethodStats = dart.constFn(core.Map$(core.String, dart._MethodStats)))();
let ListOfString = () => (ListOfString = dart.constFn(core.List$(core.String)))();
let SetOfNameValuePair = () => (SetOfNameValuePair = dart.constFn(core.Set$(_debugger.NameValuePair)))();
+ let ListOfNameValuePair = () => (ListOfNameValuePair = dart.constFn(core.List$(_debugger.NameValuePair)))();
+ let IterableOfNameValuePair = () => (IterableOfNameValuePair = dart.constFn(core.Iterable$(_debugger.NameValuePair)))();
let JSArrayOfNameValuePair = () => (JSArrayOfNameValuePair = dart.constFn(_interceptors.JSArray$(_debugger.NameValuePair)))();
let MapOfdynamic$Object = () => (MapOfdynamic$Object = dart.constFn(core.Map$(dart.dynamic, core.Object)))();
let JSArrayOfFormatter = () => (JSArrayOfFormatter = dart.constFn(_interceptors.JSArray$(_debugger.Formatter)))();
let ListOfFormatter = () => (ListOfFormatter = dart.constFn(core.List$(_debugger.Formatter)))();
let LinkedHashSetOfNameValuePair = () => (LinkedHashSetOfNameValuePair = dart.constFn(collection.LinkedHashSet$(_debugger.NameValuePair)))();
- let SetOfString = () => (SetOfString = dart.constFn(core.Set$(core.String)))();
let HashMapOfString$String = () => (HashMapOfString$String = dart.constFn(collection.HashMap$(core.String, core.String)))();
- let LinkedHashMapOfString$Object = () => (LinkedHashMapOfString$Object = dart.constFn(collection.LinkedHashMap$(core.String, core.Object)))();
- let ListOfNameValuePair = () => (ListOfNameValuePair = dart.constFn(core.List$(_debugger.NameValuePair)))();
- let JSArrayOfString = () => (JSArrayOfString = dart.constFn(_interceptors.JSArray$(core.String)))();
let JSArrayOfJsonMLFormatter = () => (JSArrayOfJsonMLFormatter = dart.constFn(_interceptors.JSArray$(_debugger.JsonMLFormatter)))();
let JSIndexable = () => (JSIndexable = dart.constFn(_interceptors.JSIndexable$()))();
let JSArray = () => (JSArray = dart.constFn(_interceptors.JSArray$()))();
@@ -58,6 +56,7 @@
let JSExtendableArray = () => (JSExtendableArray = dart.constFn(_interceptors.JSExtendableArray$()))();
let JSUnmodifiableArray = () => (JSUnmodifiableArray = dart.constFn(_interceptors.JSUnmodifiableArray$()))();
let ArrayIterator = () => (ArrayIterator = dart.constFn(_interceptors.ArrayIterator$()))();
+ let JSArrayOfString = () => (JSArrayOfString = dart.constFn(_interceptors.JSArray$(core.String)))();
let JSIndexableOfString = () => (JSIndexableOfString = dart.constFn(_interceptors.JSIndexable$(core.String)))();
let MatchToString = () => (MatchToString = dart.constFn(dart.functionType(core.String, [core.Match])))();
let StringToString = () => (StringToString = dart.constFn(dart.functionType(core.String, [core.String])))();
@@ -71,6 +70,7 @@
let UnmodifiableListBase = () => (UnmodifiableListBase = dart.constFn(_internal.UnmodifiableListBase$()))();
let StringToint = () => (StringToint = dart.constFn(dart.functionType(core.int, [core.String])))();
let Iterable = () => (Iterable = dart.constFn(core.Iterable$()))();
+ let EfficientLengthIterable = () => (EfficientLengthIterable = dart.constFn(_internal.EfficientLengthIterable$()))();
let ListIterable = () => (ListIterable = dart.constFn(_internal.ListIterable$()))();
let SubListIterable = () => (SubListIterable = dart.constFn(_internal.SubListIterable$()))();
let ListIterator = () => (ListIterator = dart.constFn(_internal.ListIterator$()))();
@@ -107,8 +107,8 @@
let MapOfint$RawReceivePortImpl = () => (MapOfint$RawReceivePortImpl = dart.constFn(core.Map$(core.int, _isolate_helper.RawReceivePortImpl)))();
let SetOfint = () => (SetOfint = dart.constFn(core.Set$(core.int)))();
let JSArrayOf_IsolateEvent = () => (JSArrayOf_IsolateEvent = dart.constFn(_interceptors.JSArray$(_isolate_helper._IsolateEvent)))();
- let SetOfCapability = () => (SetOfCapability = dart.constFn(core.Set$(isolate.Capability)))();
- let SetOfSendPort = () => (SetOfSendPort = dart.constFn(core.Set$(isolate.SendPort)))();
+ let SetOfCapability = () => (SetOfCapability = dart.constFn(core.Set$(isolate$.Capability)))();
+ let SetOfSendPort = () => (SetOfSendPort = dart.constFn(core.Set$(isolate$.SendPort)))();
let ListOf_IsolateEvent = () => (ListOf_IsolateEvent = dart.constFn(core.List$(_isolate_helper._IsolateEvent)))();
let QueueOf_IsolateEvent = () => (QueueOf_IsolateEvent = dart.constFn(collection.Queue$(_isolate_helper._IsolateEvent)))();
let CompleterOfList = () => (CompleterOfList = dart.constFn(async.Completer$(core.List)))();
@@ -139,6 +139,7 @@
let _Lazy = () => (_Lazy = dart.constFn(_js_mirrors._Lazy$()))();
let ListOfSymbol = () => (ListOfSymbol = dart.constFn(core.List$(core.Symbol)))();
let ListOfInstanceMirror = () => (ListOfInstanceMirror = dart.constFn(core.List$(mirrors.InstanceMirror)))();
+ let FutureOfLibraryMirror = () => (FutureOfLibraryMirror = dart.constFn(async.Future$(mirrors.LibraryMirror)))();
let ListOfCombinatorMirror = () => (ListOfCombinatorMirror = dart.constFn(core.List$(mirrors.CombinatorMirror)))();
let MapOfSymbol$DeclarationMirror = () => (MapOfSymbol$DeclarationMirror = dart.constFn(core.Map$(core.Symbol, mirrors.DeclarationMirror)))();
let ListOfTypeMirror = () => (ListOfTypeMirror = dart.constFn(core.List$(mirrors.TypeMirror)))();
@@ -150,7 +151,6 @@
let ListOfParameterMirror = () => (ListOfParameterMirror = dart.constFn(core.List$(mirrors.ParameterMirror)))();
let IterableOfdouble = () => (IterableOfdouble = dart.constFn(core.Iterable$(core.double)))();
let IterableOfint = () => (IterableOfint = dart.constFn(core.Iterable$(core.int)))();
- let ZoneBinaryCallbackOfdynamic$dynamic$StackTrace = () => (ZoneBinaryCallbackOfdynamic$dynamic$StackTrace = dart.constFn(async.ZoneBinaryCallback$(dart.dynamic, dart.dynamic, core.StackTrace)))();
let _StreamImpl = () => (_StreamImpl = dart.constFn(async._StreamImpl$()))();
let _ControllerStream = () => (_ControllerStream = dart.constFn(async._ControllerStream$()))();
let _BroadcastStream = () => (_BroadcastStream = dart.constFn(async._BroadcastStream$()))();
@@ -172,7 +172,6 @@
let _Completer = () => (_Completer = dart.constFn(async._Completer$()))();
let _AsyncCompleter = () => (_AsyncCompleter = dart.constFn(async._AsyncCompleter$()))();
let _SyncCompleter = () => (_SyncCompleter = dart.constFn(async._SyncCompleter$()))();
- let ZoneBinaryCallbackOfObject$Object$StackTrace = () => (ZoneBinaryCallbackOfObject$Object$StackTrace = dart.constFn(async.ZoneBinaryCallback$(core.Object, core.Object, core.StackTrace)))();
let _FutureListener = () => (_FutureListener = dart.constFn(async._FutureListener$()))();
let _Future = () => (_Future = dart.constFn(async._Future$()))();
let StreamSubscription = () => (StreamSubscription = dart.constFn(async.StreamSubscription$()))();
@@ -208,8 +207,9 @@
let _DoneStreamSubscription = () => (_DoneStreamSubscription = dart.constFn(async._DoneStreamSubscription$()))();
let _AsBroadcastStream = () => (_AsBroadcastStream = dart.constFn(async._AsBroadcastStream$()))();
let _BroadcastSubscriptionWrapper = () => (_BroadcastSubscriptionWrapper = dart.constFn(async._BroadcastSubscriptionWrapper$()))();
- let _StreamIteratorImpl = () => (_StreamIteratorImpl = dart.constFn(async._StreamIteratorImpl$()))();
+ let _StreamIterator = () => (_StreamIterator = dart.constFn(async._StreamIterator$()))();
let _EmptyStream = () => (_EmptyStream = dart.constFn(async._EmptyStream$()))();
+ let dynamicAndStackTraceTodynamic = () => (dynamicAndStackTraceTodynamic = dart.constFn(dart.functionType(dart.dynamic, [dart.dynamic, core.StackTrace])))();
let _ForwardingStream = () => (_ForwardingStream = dart.constFn(async._ForwardingStream$()))();
let _ForwardingStreamSubscription = () => (_ForwardingStreamSubscription = dart.constFn(async._ForwardingStreamSubscription$()))();
let _Predicate = () => (_Predicate = dart.constFn(async._Predicate$()))();
@@ -312,7 +312,6 @@
let Queue = () => (Queue = dart.constFn(collection.Queue$()))();
let _DoubleLink = () => (_DoubleLink = dart.constFn(collection._DoubleLink$()))();
let DoubleLinkedQueueEntry = () => (DoubleLinkedQueueEntry = dart.constFn(collection.DoubleLinkedQueueEntry$()))();
- let _UserDoubleLinkedQueueEntry = () => (_UserDoubleLinkedQueueEntry = dart.constFn(collection._UserDoubleLinkedQueueEntry$()))();
let _DoubleLinkedQueueEntry = () => (_DoubleLinkedQueueEntry = dart.constFn(collection._DoubleLinkedQueueEntry$()))();
let _DoubleLinkedQueueElement = () => (_DoubleLinkedQueueElement = dart.constFn(collection._DoubleLinkedQueueElement$()))();
let _DoubleLinkedQueueSentinel = () => (_DoubleLinkedQueueSentinel = dart.constFn(collection._DoubleLinkedQueueSentinel$()))();
@@ -341,8 +340,10 @@
let List = () => (List = dart.constFn(core.List$()))();
let StreamOfListOfint = () => (StreamOfListOfint = dart.constFn(async.Stream$(ListOfint())))();
let Converter = () => (Converter = dart.constFn(convert.Converter$()))();
+ let ChunkedConverterOfString$ListOfint$String$ListOfint = () => (ChunkedConverterOfString$ListOfint$String$ListOfint = dart.constFn(convert.ChunkedConverter$(core.String, ListOfint(), core.String, ListOfint())))();
let SinkOfListOfint = () => (SinkOfListOfint = dart.constFn(core.Sink$(ListOfint())))();
let StreamOfString = () => (StreamOfString = dart.constFn(async.Stream$(core.String)))();
+ let ChunkedConverterOfListOfint$String$ListOfint$String = () => (ChunkedConverterOfListOfint$String$ListOfint$String = dart.constFn(convert.ChunkedConverter$(ListOfint(), core.String, ListOfint(), core.String)))();
let SinkOfString = () => (SinkOfString = dart.constFn(core.Sink$(core.String)))();
let ChunkedConversionSink = () => (ChunkedConversionSink = dart.constFn(convert.ChunkedConversionSink$()))();
let _ChunkedConversionCallbackOfListOfint = () => (_ChunkedConversionCallbackOfListOfint = dart.constFn(convert._ChunkedConversionCallback$(ListOfint())))();
@@ -353,8 +354,12 @@
let _FusedCodec = () => (_FusedCodec = dart.constFn(convert._FusedCodec$()))();
let _InvertedCodec = () => (_InvertedCodec = dart.constFn(convert._InvertedCodec$()))();
let _FusedConverter = () => (_FusedConverter = dart.constFn(convert._FusedConverter$()))();
+ let ChunkedConverterOfString$String$String$String = () => (ChunkedConverterOfString$String$String$String = dart.constFn(convert.ChunkedConverter$(core.String, core.String, core.String, core.String)))();
+ let ChunkedConverterOfObject$String$Object$String = () => (ChunkedConverterOfObject$String$Object$String = dart.constFn(convert.ChunkedConverter$(core.Object, core.String, core.Object, core.String)))();
let StreamOfObject = () => (StreamOfObject = dart.constFn(async.Stream$(core.Object)))();
let JSArrayOfListOfint = () => (JSArrayOfListOfint = dart.constFn(_interceptors.JSArray$(ListOfint())))();
+ let ChunkedConverterOfObject$ListOfint$Object$ListOfint = () => (ChunkedConverterOfObject$ListOfint$Object$ListOfint = dart.constFn(convert.ChunkedConverter$(core.Object, ListOfint(), core.Object, ListOfint())))();
+ let ChunkedConverterOfString$Object$String$Object = () => (ChunkedConverterOfString$Object$String$Object = dart.constFn(convert.ChunkedConverter$(core.String, core.Object, core.String, core.Object)))();
let Uint8ListAndintAndintTovoid = () => (Uint8ListAndintAndintTovoid = dart.constFn(dart.functionType(dart.void, [typed_data.Uint8List, core.int, core.int])))();
let EventSinkOfString = () => (EventSinkOfString = dart.constFn(async.EventSink$(core.String)))();
let StreamTransformerOfString$String = () => (StreamTransformerOfString$String = dart.constFn(async.StreamTransformer$(core.String, core.String)))();
@@ -365,59 +370,62 @@
let Expando = () => (Expando = dart.constFn(core.Expando$()))();
let _Generator = () => (_Generator = dart.constFn(core._Generator$()))();
let _GeneratorIterable = () => (_GeneratorIterable = dart.constFn(core._GeneratorIterable$()))();
- let _GeneratorIterator = () => (_GeneratorIterator = dart.constFn(core._GeneratorIterator$()))();
let BidirectionalIterator = () => (BidirectionalIterator = dart.constFn(core.BidirectionalIterator$()))();
let Map$ = () => (Map$ = dart.constFn(core.Map$()))();
let Set = () => (Set = dart.constFn(core.Set$()))();
let Sink = () => (Sink = dart.constFn(core.Sink$()))();
let BidirectionalIteratorOfint = () => (BidirectionalIteratorOfint = dart.constFn(core.BidirectionalIterator$(core.int)))();
+ let MapOfString$String = () => (MapOfString$String = dart.constFn(core.Map$(core.String, core.String)))();
let UnmodifiableMapViewOfString$String = () => (UnmodifiableMapViewOfString$String = dart.constFn(collection.UnmodifiableMapView$(core.String, core.String)))();
let MapOfString$ListOfString = () => (MapOfString$ListOfString = dart.constFn(core.Map$(core.String, ListOfString())))();
- let MapOfString$String = () => (MapOfString$String = dart.constFn(core.Map$(core.String, core.String)))();
let IterableOfString = () => (IterableOfString = dart.constFn(core.Iterable$(core.String)))();
let MapOfString$dynamic = () => (MapOfString$dynamic = dart.constFn(core.Map$(core.String, dart.dynamic)))();
+ let ListOfUint8List = () => (ListOfUint8List = dart.constFn(core.List$(typed_data.Uint8List)))();
let MapOfString$ServiceExtensionHandler = () => (MapOfString$ServiceExtensionHandler = dart.constFn(core.Map$(core.String, developer.ServiceExtensionHandler)))();
let MapOfString$Metric = () => (MapOfString$Metric = dart.constFn(core.Map$(core.String, developer.Metric)))();
let ListOf_SyncBlock = () => (ListOf_SyncBlock = dart.constFn(core.List$(developer._SyncBlock)))();
let JSArrayOf_AsyncBlock = () => (JSArrayOf_AsyncBlock = dart.constFn(_interceptors.JSArray$(developer._AsyncBlock)))();
let ListOf_AsyncBlock = () => (ListOf_AsyncBlock = dart.constFn(core.List$(developer._AsyncBlock)))();
let CompleterOfUri = () => (CompleterOfUri = dart.constFn(async.Completer$(core.Uri)))();
- let ListOfListOfint = () => (ListOfListOfint = dart.constFn(core.List$(ListOfint())))();
- let FutureOfint = () => (FutureOfint = dart.constFn(async.Future$(core.int)))();
+ let JSArrayOfUint8List = () => (JSArrayOfUint8List = dart.constFn(_interceptors.JSArray$(typed_data.Uint8List)))();
+ let ChunkedConverterOfListOfint$ListOfint$ListOfint$ListOfint = () => (ChunkedConverterOfListOfint$ListOfint$ListOfint$ListOfint = dart.constFn(convert.ChunkedConverter$(ListOfint(), ListOfint(), ListOfint(), ListOfint())))();
let FutureOfDirectory = () => (FutureOfDirectory = dart.constFn(async.Future$(io.Directory)))();
let FutureOrOfDirectory = () => (FutureOrOfDirectory = dart.constFn(async.FutureOr$(io.Directory)))();
- let StreamOfFileSystemEntity = () => (StreamOfFileSystemEntity = dart.constFn(async.Stream$(io.FileSystemEntity)))();
let JSArrayOfFileSystemEntity = () => (JSArrayOfFileSystemEntity = dart.constFn(_interceptors.JSArray$(io.FileSystemEntity)))();
let FutureOrOfString = () => (FutureOrOfString = dart.constFn(async.FutureOr$(core.String)))();
let FutureOrOfbool = () => (FutureOrOfbool = dart.constFn(async.FutureOr$(core.bool)))();
let FutureOrOfint = () => (FutureOrOfint = dart.constFn(async.FutureOr$(core.int)))();
let ListOfFileSystemEntity = () => (ListOfFileSystemEntity = dart.constFn(core.List$(io.FileSystemEntity)))();
+ let StreamControllerOfFileSystemEntity = () => (StreamControllerOfFileSystemEntity = dart.constFn(async.StreamController$(io.FileSystemEntity)))();
let StreamControllerOfListOfint = () => (StreamControllerOfListOfint = dart.constFn(async.StreamController$(ListOfint())))();
let FutureOfRandomAccessFile = () => (FutureOfRandomAccessFile = dart.constFn(async.Future$(io.RandomAccessFile)))();
let CompleterOfFile = () => (CompleterOfFile = dart.constFn(async.Completer$(io.File)))();
+ let CompleterOfListOfint = () => (CompleterOfListOfint = dart.constFn(async.Completer$(ListOfint())))();
let FutureOfListOfint = () => (FutureOfListOfint = dart.constFn(async.Future$(ListOfint())))();
let FutureOrOfFile = () => (FutureOrOfFile = dart.constFn(async.FutureOr$(io.File)))();
let FutureOfFile = () => (FutureOfFile = dart.constFn(async.Future$(io.File)))();
- let FutureOrOfListOfint = () => (FutureOrOfListOfint = dart.constFn(async.FutureOr$(ListOfint())))();
+ let FutureOfint = () => (FutureOfint = dart.constFn(async.Future$(core.int)))();
let StreamOfHttpRequest = () => (StreamOfHttpRequest = dart.constFn(async.Stream$(io.HttpRequest)))();
let ListOfRedirectInfo = () => (ListOfRedirectInfo = dart.constFn(core.List$(io.RedirectInfo)))();
let HashMapOfString$ListOfString = () => (HashMapOfString$ListOfString = dart.constFn(collection.HashMap$(core.String, ListOfString())))();
let ListOfCookie = () => (ListOfCookie = dart.constFn(core.List$(io.Cookie)))();
let StringAndListOfStringTovoid = () => (StringAndListOfStringTovoid = dart.constFn(dart.functionType(dart.void, [core.String, ListOfString()])))();
let FutureOfHttpClientResponse = () => (FutureOfHttpClientResponse = dart.constFn(async.Future$(io.HttpClientResponse)))();
- let StreamSubscriptionOfListOfint = () => (StreamSubscriptionOfListOfint = dart.constFn(async.StreamSubscription$(ListOfint())))();
let FutureOrOfHttpClientResponse = () => (FutureOrOfHttpClientResponse = dart.constFn(async.FutureOr$(io.HttpClientResponse)))();
let _StreamSinkImpl = () => (_StreamSinkImpl = dart.constFn(io._StreamSinkImpl$()))();
let _HttpOutboundMessage = () => (_HttpOutboundMessage = dart.constFn(io._HttpOutboundMessage$()))();
let CompleterOfHttpClientResponse = () => (CompleterOfHttpClientResponse = dart.constFn(async.Completer$(io.HttpClientResponse)))();
let JSArrayOfRedirectInfo = () => (JSArrayOfRedirectInfo = dart.constFn(_interceptors.JSArray$(io.RedirectInfo)))();
let JSArrayOfFuture = () => (JSArrayOfFuture = dart.constFn(_interceptors.JSArray$(async.Future)))();
+ let CompleterOfSocket = () => (CompleterOfSocket = dart.constFn(async.Completer$(io.Socket)))();
let StreamConsumerOfListOfint = () => (StreamConsumerOfListOfint = dart.constFn(async.StreamConsumer$(ListOfint())))();
let CompleterOf_HttpIncoming = () => (CompleterOf_HttpIncoming = dart.constFn(async.Completer$(io._HttpIncoming)))();
- let X509CertificateTobool = () => (X509CertificateTobool = dart.constFn(dart.functionType(core.bool, [io.X509Certificate])))();
let FutureOfSecureSocket = () => (FutureOfSecureSocket = dart.constFn(async.Future$(io.SecureSocket)))();
+ let X509CertificateTobool = () => (X509CertificateTobool = dart.constFn(dart.functionType(core.bool, [io.X509Certificate])))();
+ let FutureOfSocket = () => (FutureOfSocket = dart.constFn(async.Future$(io.Socket)))();
let HashSetOf_HttpClientConnection = () => (HashSetOf_HttpClientConnection = dart.constFn(collection.HashSet$(io._HttpClientConnection)))();
let FutureOf_ConnectionInfo = () => (FutureOf_ConnectionInfo = dart.constFn(async.Future$(io._ConnectionInfo)))();
+ let CompleterOf_ConnectionInfo = () => (CompleterOf_ConnectionInfo = dart.constFn(async.Completer$(io._ConnectionInfo)))();
let FutureOrOf_ConnectionInfo = () => (FutureOrOf_ConnectionInfo = dart.constFn(async.FutureOr$(io._ConnectionInfo)))();
let SetOf_HttpClientConnection = () => (SetOf_HttpClientConnection = dart.constFn(core.Set$(io._HttpClientConnection)))();
let HashMapOfString$_ConnectionTarget = () => (HashMapOfString$_ConnectionTarget = dart.constFn(collection.HashMap$(core.String, io._ConnectionTarget)))();
@@ -439,8 +447,7 @@
let HttpRequestTovoid = () => (HttpRequestTovoid = dart.constFn(dart.functionType(dart.void, [io.HttpRequest])))();
let MapOfint$_HttpServer = () => (MapOfint$_HttpServer = dart.constFn(core.Map$(core.int, io._HttpServer)))();
let ListOf_Proxy = () => (ListOf_Proxy = dart.constFn(core.List$(io._Proxy)))();
- let FutureOfSocket = () => (FutureOfSocket = dart.constFn(async.Future$(io.Socket)))();
- let StreamOfint = () => (StreamOfint = dart.constFn(async.Stream$(core.int)))();
+ let StreamSubscriptionOfListOfint = () => (StreamSubscriptionOfListOfint = dart.constFn(async.StreamSubscription$(ListOfint())))();
let StreamControllerOf_HttpIncoming = () => (StreamControllerOf_HttpIncoming = dart.constFn(async.StreamController$(io._HttpIncoming)))();
let _HttpIncomingTovoid = () => (_HttpIncomingTovoid = dart.constFn(dart.functionType(dart.void, [io._HttpIncoming])))();
let MapOfString$_HttpSession = () => (MapOfString$_HttpSession = dart.constFn(core.Map$(core.String, io._HttpSession)))();
@@ -451,14 +458,16 @@
let MapOfint$_SocketResourceInfo = () => (MapOfint$_SocketResourceInfo = dart.constFn(core.Map$(core.int, io._SocketResourceInfo)))();
let StreamSinkOfListOfint = () => (StreamSinkOfListOfint = dart.constFn(async.StreamSink$(ListOfint())))();
let FutureOfLink = () => (FutureOfLink = dart.constFn(async.Future$(io.Link)))();
+ let _CaseInsensitiveStringMapOfString = () => (_CaseInsensitiveStringMapOfString = dart.constFn(io._CaseInsensitiveStringMap$(core.String)))();
let _CaseInsensitiveStringMap = () => (_CaseInsensitiveStringMap = dart.constFn(io._CaseInsensitiveStringMap$()))();
+ let StreamSubscriptionOfRawSocketEvent = () => (StreamSubscriptionOfRawSocketEvent = dart.constFn(async.StreamSubscription$(io.RawSocketEvent)))();
let FutureOfRawSecureSocket = () => (FutureOfRawSecureSocket = dart.constFn(async.Future$(io.RawSecureSocket)))();
let SecureSocketTovoid = () => (SecureSocketTovoid = dart.constFn(dart.functionType(dart.void, [io.SecureSocket])))();
let StreamControllerOfRawSecureSocket = () => (StreamControllerOfRawSecureSocket = dart.constFn(async.StreamController$(io.RawSecureSocket)))();
let RawSecureSocketTovoid = () => (RawSecureSocketTovoid = dart.constFn(dart.functionType(dart.void, [io.RawSecureSocket])))();
let StreamSubscriptionOfRawSocket = () => (StreamSubscriptionOfRawSocket = dart.constFn(async.StreamSubscription$(io.RawSocket)))();
- let StreamSubscriptionOfRawSocketEvent = () => (StreamSubscriptionOfRawSocketEvent = dart.constFn(async.StreamSubscription$(io.RawSocketEvent)))();
let CompleterOf_RawSecureSocket = () => (CompleterOf_RawSecureSocket = dart.constFn(async.Completer$(io._RawSecureSocket)))();
+ let CompleterOfRawSecureSocket = () => (CompleterOfRawSecureSocket = dart.constFn(async.Completer$(io.RawSecureSocket)))();
let StreamControllerOfRawSocketEvent = () => (StreamControllerOfRawSocketEvent = dart.constFn(async.StreamController$(io.RawSocketEvent)))();
let RawSocketEventTovoid = () => (RawSocketEventTovoid = dart.constFn(dart.functionType(dart.void, [io.RawSocketEvent])))();
let StreamOfRawSocketEvent = () => (StreamOfRawSocketEvent = dart.constFn(async.Stream$(io.RawSocketEvent)))();
@@ -467,15 +476,14 @@
let StreamOfSocket = () => (StreamOfSocket = dart.constFn(async.Stream$(io.Socket)))();
let StreamTransformerOfHttpRequest$WebSocket = () => (StreamTransformerOfHttpRequest$WebSocket = dart.constFn(async.StreamTransformer$(io.HttpRequest, io.WebSocket)))();
let ListOfStringTodynamic = () => (ListOfStringTodynamic = dart.constFn(dart.functionType(dart.dynamic, [ListOfString()])))();
+ let EventSinkOfListOfint = () => (EventSinkOfListOfint = dart.constFn(async.EventSink$(ListOfint())))();
let StreamTransformerOfListOfint$dynamic = () => (StreamTransformerOfListOfint$dynamic = dart.constFn(async.StreamTransformer$(ListOfint(), dart.dynamic)))();
- let EventSinkOfUint8List = () => (EventSinkOfUint8List = dart.constFn(async.EventSink$(typed_data.Uint8List)))();
let StreamControllerOfWebSocket = () => (StreamControllerOfWebSocket = dart.constFn(async.StreamController$(io.WebSocket)))();
let FutureOfWebSocket = () => (FutureOfWebSocket = dart.constFn(async.Future$(io.WebSocket)))();
- let EventSinkOfListOfint = () => (EventSinkOfListOfint = dart.constFn(async.EventSink$(ListOfint())))();
- let JSArrayOfUint8List = () => (JSArrayOfUint8List = dart.constFn(_interceptors.JSArray$(typed_data.Uint8List)))();
+ let FutureOfString = () => (FutureOfString = dart.constFn(async.Future$(core.String)))();
let StreamTransformerOfdynamic$ListOfint = () => (StreamTransformerOfdynamic$ListOfint = dart.constFn(async.StreamTransformer$(dart.dynamic, ListOfint())))();
let MapOfint$_WebSocketImpl = () => (MapOfint$_WebSocketImpl = dart.constFn(core.Map$(core.int, io._WebSocketImpl)))();
- let FutureOfIsolate = () => (FutureOfIsolate = dart.constFn(async.Future$(isolate.Isolate)))();
+ let FutureOfIsolate = () => (FutureOfIsolate = dart.constFn(async.Future$(isolate$.Isolate)))();
let JsArray = () => (JsArray = dart.constFn(js.JsArray$()))();
let ExpandoOfFunction = () => (ExpandoOfFunction = dart.constFn(core.Expando$(core.Function)))();
let PointOfnum = () => (PointOfnum = dart.constFn(math.Point$(core.num)))();
@@ -596,6 +604,7 @@
let ElementListOfElement = () => (ElementListOfElement = dart.constFn(html$.ElementList$(html$.Element)))();
let ListOfRectangleOfnum = () => (ListOfRectangleOfnum = dart.constFn(core.List$(RectangleOfnum())))();
let ListOfGamepad = () => (ListOfGamepad = dart.constFn(core.List$(html$.Gamepad)))();
+ let SetOfString = () => (SetOfString = dart.constFn(core.Set$(core.String)))();
let ListOfCssClassSetImpl = () => (ListOfCssClassSetImpl = dart.constFn(core.List$(html_common.CssClassSetImpl)))();
let LinkedHashSetOfString = () => (LinkedHashSetOfString = dart.constFn(collection.LinkedHashSet$(core.String)))();
let StringTobool = () => (StringTobool = dart.constFn(dart.functionType(core.bool, [core.String])))();
@@ -641,18 +650,20 @@
let dynamicToListOfString = () => (dynamicToListOfString = dart.constFn(dart.definiteFunctionType(ListOfString(), [dart.dynamic])))();
let dynamicToList = () => (dynamicToList = dart.constFn(dart.definiteFunctionType(core.List, [dart.dynamic])))();
let dynamicAndSetOfNameValuePairTovoid = () => (dynamicAndSetOfNameValuePairTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [dart.dynamic, SetOfNameValuePair()])))();
- let TypeToString = () => (TypeToString = dart.constFn(dart.definiteFunctionType(core.String, [core.Type])))();
- let dynamicToObject = () => (dynamicToObject = dart.constFn(dart.definiteFunctionType(core.Object, [dart.dynamic])))();
+ let dynamicAndSetOfNameValuePairAnddynamic__Tovoid = () => (dynamicAndSetOfNameValuePairAnddynamic__Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [dart.dynamic, SetOfNameValuePair(), dart.dynamic, core.bool], {tagTypes: dart.dynamic})))();
+ let NameValuePairAndNameValuePairToint = () => (NameValuePairAndNameValuePairToint = dart.constFn(dart.definiteFunctionType(core.int, [_debugger.NameValuePair, _debugger.NameValuePair])))();
+ let IterableOfNameValuePairToListOfNameValuePair = () => (IterableOfNameValuePairToListOfNameValuePair = dart.constFn(dart.definiteFunctionType(ListOfNameValuePair(), [IterableOfNameValuePair()])))();
let dynamicAnddynamicToString = () => (dynamicAnddynamicToString = dart.constFn(dart.definiteFunctionType(core.String, [dart.dynamic, dart.dynamic])))();
let dynamicAndStringTobool = () => (dynamicAndStringTobool = dart.constFn(dart.definiteFunctionType(core.bool, [dart.dynamic, core.String])))();
let intAnddynamicToNull = () => (intAnddynamicToNull = dart.constFn(dart.definiteFunctionType(core.Null, [core.int, dart.dynamic])))();
let ObjectAndObjectToObject = () => (ObjectAndObjectToObject = dart.constFn(dart.definiteFunctionType(core.Object, [core.Object, core.Object])))();
let StringTobool$ = () => (StringTobool$ = dart.constFn(dart.definiteFunctionType(core.bool, [core.String])))();
+ let dynamicToObject = () => (dynamicToObject = dart.constFn(dart.definiteFunctionType(core.Object, [dart.dynamic])))();
let dynamicTobool$ = () => (dynamicTobool$ = dart.constFn(dart.definiteFunctionType(core.bool, [dart.dynamic])))();
let dynamicAnddynamicToNull = () => (dynamicAnddynamicToNull = dart.constFn(dart.definiteFunctionType(core.Null, [dart.dynamic, dart.dynamic])))();
- let StringAndObjectToNull = () => (StringAndObjectToNull = dart.constFn(dart.definiteFunctionType(core.Null, [core.String, core.Object])))();
let StringToNameValuePair = () => (StringToNameValuePair = dart.constFn(dart.definiteFunctionType(_debugger.NameValuePair, [core.String])))();
let VoidTodynamic$ = () => (VoidTodynamic$ = dart.constFn(dart.definiteFunctionType(dart.dynamic, [])))();
+ let StringTodynamic = () => (StringTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.String])))();
let StringAndString__Todynamic = () => (StringAndString__Todynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.String, core.String], [dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic])))();
let VoidToIsolateContext = () => (VoidToIsolateContext = dart.constFn(dart.definiteFunctionType(_foreign_helper.IsolateContext, [])))();
let dynamicAndFunctionTodynamic = () => (dynamicAndFunctionTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [dart.dynamic, core.Function])))();
@@ -666,6 +677,8 @@
let TypeAndStringTodynamic = () => (TypeAndStringTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.Type, core.String])))();
let dynamicAnddynamicTodynamic$ = () => (dynamicAnddynamicTodynamic$ = dart.constFn(dart.definiteFunctionType(dart.dynamic, [dart.dynamic, dart.dynamic])))();
let dynamicAnddynamicToint = () => (dynamicAnddynamicToint = dart.constFn(dart.definiteFunctionType(core.int, [dart.dynamic, dart.dynamic])))();
+ let intToint = () => (intToint = dart.constFn(dart.definiteFunctionType(core.int, [core.int])))();
+ let StringAndintToint = () => (StringAndintToint = dart.constFn(dart.definiteFunctionType(core.int, [core.String, core.int])))();
let ListOfEToListOfE = () => (ListOfEToListOfE = dart.constFn(dart.definiteFunctionType(E => [core.List$(E), [core.List$(E)]])))();
let StringTovoid$ = () => (StringTovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [core.String])))();
let _IsolateContextAndFunctionTodynamic = () => (_IsolateContextAndFunctionTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [_isolate_helper._IsolateContext, core.Function])))();
@@ -678,10 +691,11 @@
let StringToNull = () => (StringToNull = dart.constFn(dart.definiteFunctionType(core.Null, [core.String])))();
let dynamicToNull$ = () => (dynamicToNull$ = dart.constFn(dart.definiteFunctionType(core.Null, [dart.dynamic])))();
let TimerToNull = () => (TimerToNull = dart.constFn(dart.definiteFunctionType(core.Null, [async.Timer])))();
+ let VoidTo_Future = () => (VoidTo_Future = dart.constFn(dart.definiteFunctionType(async._Future, [])))();
+ let VoidToFuture = () => (VoidToFuture = dart.constFn(dart.definiteFunctionType(async.Future, [])))();
let dynamicToFuture = () => (dynamicToFuture = dart.constFn(dart.definiteFunctionType(async.Future, [dart.dynamic])))();
let boolToNull = () => (boolToNull = dart.constFn(dart.definiteFunctionType(core.Null, [core.bool])))();
let dynamicAndStackTraceTovoid = () => (dynamicAndStackTraceTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [dart.dynamic, core.StackTrace])))();
- let VoidToFuture = () => (VoidToFuture = dart.constFn(dart.definiteFunctionType(async.Future, [])))();
let VoidToint = () => (VoidToint = dart.constFn(dart.definiteFunctionType(core.int, [])))();
let dynamicAnddynamicToError = () => (dynamicAnddynamicToError = dart.constFn(dart.definiteFunctionType(core.Error, [dart.dynamic, dart.dynamic])))();
let dynamicAnddynamicAnddynamicToError = () => (dynamicAnddynamicAnddynamicToError = dart.constFn(dart.definiteFunctionType(core.Error, [dart.dynamic, dart.dynamic, dart.dynamic])))();
@@ -742,7 +756,7 @@
let _NotificationHandlerToFuture = () => (_NotificationHandlerToFuture = dart.constFn(dart.definiteFunctionType(async.Future, [async._NotificationHandler])))();
let dynamicAndStackTraceToNull = () => (dynamicAndStackTraceToNull = dart.constFn(dart.definiteFunctionType(core.Null, [dart.dynamic, core.StackTrace])))();
let dynamic__Tovoid = () => (dynamic__Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [dart.dynamic], [core.StackTrace])))();
- let FnAndFnAndFnTodynamic = () => (FnAndFnAndFnTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [VoidTodynamic(), dynamicTodynamic(), ZoneBinaryCallbackOfdynamic$dynamic$StackTrace()])))();
+ let FnAndFnAndFnTodynamic = () => (FnAndFnAndFnTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [VoidTodynamic(), dynamicTodynamic(), dynamicAndStackTraceTodynamic()])))();
let StreamSubscriptionAnd_FutureAnddynamic__Tovoid = () => (StreamSubscriptionAnd_FutureAnddynamic__Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [async.StreamSubscription, async._Future, dart.dynamic, core.StackTrace])))();
let StreamSubscriptionAnd_FutureTo_ErrorCallback = () => (StreamSubscriptionAnd_FutureTo_ErrorCallback = dart.constFn(dart.definiteFunctionType(async._ErrorCallback, [async.StreamSubscription, async._Future])))();
let StreamSubscriptionAnd_FutureAnddynamicTovoid = () => (StreamSubscriptionAnd_FutureAnddynamicTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [async.StreamSubscription, async._Future, dart.dynamic])))();
@@ -780,12 +794,18 @@
let ObjectAndObjectTobool = () => (ObjectAndObjectTobool = dart.constFn(dart.definiteFunctionType(core.bool, [core.Object, core.Object])))();
let ObjectToint = () => (ObjectToint = dart.constFn(dart.definiteFunctionType(core.int, [core.Object])))();
let ObjectTovoid = () => (ObjectTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.Object])))();
+ let MapOfString$StringAndStringToMapOfString$String = () => (MapOfString$StringAndStringToMapOfString$String = dart.constFn(dart.definiteFunctionType(MapOfString$String(), [MapOfString$String(), core.String])))();
+ let StringAndintTovoid = () => (StringAndintTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String, core.int])))();
+ let String__Tovoid = () => (String__Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String], [dart.dynamic])))();
let StringAndStringTovoid$ = () => (StringAndStringTovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [core.String, core.String])))();
let StringAnddynamicToNull = () => (StringAnddynamicToNull = dart.constFn(dart.definiteFunctionType(core.Null, [core.String, dart.dynamic])))();
- let MapOfString$StringAndStringToMapOfString$String = () => (MapOfString$StringAndStringToMapOfString$String = dart.constFn(dart.definiteFunctionType(MapOfString$String(), [MapOfString$String(), core.String])))();
let intAndintAndintTovoid = () => (intAndintAndintTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.int, core.int, core.int])))();
- let String__Tovoid = () => (String__Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String], [dart.dynamic])))();
let StringAndStringToNull = () => (StringAndStringToNull = dart.constFn(dart.definiteFunctionType(core.Null, [core.String, core.String])))();
+ let intToUint8List = () => (intToUint8List = dart.constFn(dart.definiteFunctionType(typed_data.Uint8List, [core.int])))();
+ let dynamicAnddynamicToUint8List = () => (dynamicAnddynamicToUint8List = dart.constFn(dart.definiteFunctionType(typed_data.Uint8List, [dart.dynamic, dart.dynamic])))();
+ let Uint8ListAndStringAndintTovoid = () => (Uint8ListAndStringAndintTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [typed_data.Uint8List, core.String, core.int])))();
+ let VoidToListOfUint8List = () => (VoidToListOfUint8List = dart.constFn(dart.definiteFunctionType(ListOfUint8List(), [])))();
+ let StringAndintAndint__Toint = () => (StringAndintAndint__Toint = dart.constFn(dart.definiteFunctionType(core.int, [core.String, core.int, core.int, core.int, ListOfint()])))();
let __Tobool = () => (__Tobool = dart.constFn(dart.definiteFunctionType(core.bool, [], {when: core.bool, message: core.String})))();
let String__Tovoid$ = () => (String__Tovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [core.String], {time: core.DateTime, sequenceNumber: core.int, level: core.int, name: core.String, zone: async.Zone, error: core.Object, stackTrace: core.StackTrace})))();
let StringAndServiceExtensionHandlerTovoid = () => (StringAndServiceExtensionHandlerTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String, developer.ServiceExtensionHandler])))();
@@ -798,10 +818,11 @@
let intAndintAndString__Tovoid$ = () => (intAndintAndString__Tovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [core.int, core.int, core.String, core.String, core.String])))();
let intAndStringAndString__Tovoid = () => (intAndStringAndString__Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.int, core.String, core.String, core.String])))();
let UriTovoid = () => (UriTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.Uri])))();
- let SendPortTovoid = () => (SendPortTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [isolate.SendPort])))();
- let SendPortAndboolTovoid = () => (SendPortAndboolTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [isolate.SendPort, core.bool])))();
+ let SendPortTovoid = () => (SendPortTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [isolate$.SendPort])))();
+ let SendPortAndboolTovoid = () => (SendPortAndboolTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [isolate$.SendPort, core.bool])))();
+ let SendPortToString = () => (SendPortToString = dart.constFn(dart.definiteFunctionType(core.String, [isolate$.SendPort])))();
let dynamicAndStringAndStringTodynamic = () => (dynamicAndStringAndStringTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [dart.dynamic, core.String, core.String])))();
- let ListAndintAndintTo_BufferAndStart = () => (ListAndintAndintTo_BufferAndStart = dart.constFn(dart.definiteFunctionType(io._BufferAndStart, [core.List, core.int, core.int])))();
+ let ListOfintAndintAndintTo_BufferAndStart = () => (ListOfintAndintAndintTo_BufferAndStart = dart.constFn(dart.definiteFunctionType(io._BufferAndStart, [ListOfint(), core.int, core.int])))();
let intTovoid = () => (intTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.int])))();
let DirectoryToFutureOfDirectory = () => (DirectoryToFutureOfDirectory = dart.constFn(dart.definiteFunctionType(FutureOfDirectory(), [io.Directory])))();
let boolToFutureOrOfDirectory = () => (boolToFutureOrOfDirectory = dart.constFn(dart.definiteFunctionType(FutureOrOfDirectory(), [core.bool])))();
@@ -820,17 +841,15 @@
let dynamicToFile = () => (dynamicToFile = dart.constFn(dart.definiteFunctionType(io.File, [dart.dynamic])))();
let dynamicTo_RandomAccessFile = () => (dynamicTo_RandomAccessFile = dart.constFn(dart.definiteFunctionType(io._RandomAccessFile, [dart.dynamic])))();
let dynamicToDateTime = () => (dynamicToDateTime = dart.constFn(dart.definiteFunctionType(core.DateTime, [dart.dynamic])))();
- let dynamicToFutureOfListOfint = () => (dynamicToFutureOfListOfint = dart.constFn(dart.definiteFunctionType(FutureOfListOfint(), [dart.dynamic])))();
- let intToFutureOfListOfint = () => (intToFutureOfListOfint = dart.constFn(dart.definiteFunctionType(FutureOfListOfint(), [core.int])))();
let RandomAccessFileToFutureOfListOfint = () => (RandomAccessFileToFutureOfListOfint = dart.constFn(dart.definiteFunctionType(FutureOfListOfint(), [io.RandomAccessFile])))();
+ let intToFutureOfListOfint = () => (intToFutureOfListOfint = dart.constFn(dart.definiteFunctionType(FutureOfListOfint(), [core.int])))();
let ListOfintToString = () => (ListOfintToString = dart.constFn(dart.definiteFunctionType(core.String, [ListOfint()])))();
let RandomAccessFileTo_File = () => (RandomAccessFileTo_File = dart.constFn(dart.definiteFunctionType(io._File, [io.RandomAccessFile])))();
let RandomAccessFileToObject = () => (RandomAccessFileToObject = dart.constFn(dart.definiteFunctionType(core.Object, [io.RandomAccessFile])))();
let RandomAccessFileToFutureOrOfFile = () => (RandomAccessFileToFutureOrOfFile = dart.constFn(dart.definiteFunctionType(FutureOrOfFile(), [io.RandomAccessFile])))();
- let dynamicToFutureOrOfListOfint = () => (dynamicToFutureOrOfListOfint = dart.constFn(dart.definiteFunctionType(FutureOrOfListOfint(), [dart.dynamic])))();
+ let dynamicToListOfint = () => (dynamicToListOfint = dart.constFn(dart.definiteFunctionType(ListOfint(), [dart.dynamic])))();
let dynamicToFileStat = () => (dynamicToFileStat = dart.constFn(dart.definiteFunctionType(io.FileStat, [dart.dynamic])))();
let StringAndListOfStringToListOfString = () => (StringAndListOfStringToListOfString = dart.constFn(dart.definiteFunctionType(ListOfString(), [core.String, ListOfString()])))();
- let ListOfintTovoid = () => (ListOfintTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [ListOfint()])))();
let StringAndListOfStringToNull = () => (StringAndListOfStringToNull = dart.constFn(dart.definiteFunctionType(core.Null, [core.String, ListOfString()])))();
let CookieToString = () => (CookieToString = dart.constFn(dart.definiteFunctionType(core.String, [io.Cookie])))();
let CookieTobool = () => (CookieTobool = dart.constFn(dart.definiteFunctionType(core.bool, [io.Cookie])))();
@@ -846,11 +865,14 @@
let ListToFutureOrOfHttpClientResponse = () => (ListToFutureOrOfHttpClientResponse = dart.constFn(dart.definiteFunctionType(FutureOrOfHttpClientResponse(), [core.List])))();
let HttpClientResponseTovoid = () => (HttpClientResponseTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [io.HttpClientResponse])))();
let dynamicToIterable = () => (dynamicToIterable = dart.constFn(dart.definiteFunctionType(core.Iterable, [dart.dynamic])))();
+ let ListOfintTovoid = () => (ListOfintTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [ListOfint()])))();
let dynamicTo_HttpOutboundMessage = () => (dynamicTo_HttpOutboundMessage = dart.constFn(dart.definiteFunctionType(io._HttpOutboundMessage, [dart.dynamic])))();
let dynamicAnddynamicTo_HttpOutboundMessage = () => (dynamicAnddynamicTo_HttpOutboundMessage = dart.constFn(dart.definiteFunctionType(io._HttpOutboundMessage, [dart.dynamic, dart.dynamic])))();
let dynamic__ToNull$ = () => (dynamic__ToNull$ = dart.constFn(dart.definiteFunctionType(core.Null, [dart.dynamic], [core.StackTrace])))();
let _HttpIncomingToNull = () => (_HttpIncomingToNull = dart.constFn(dart.definiteFunctionType(core.Null, [io._HttpIncoming])))();
- let dynamicTo_DetachedSocket = () => (dynamicTo_DetachedSocket = dart.constFn(dart.definiteFunctionType(io._DetachedSocket, [dart.dynamic])))();
+ let SocketToSocket = () => (SocketToSocket = dart.constFn(dart.definiteFunctionType(io.Socket, [io.Socket])))();
+ let SocketTo_DetachedSocket = () => (SocketTo_DetachedSocket = dart.constFn(dart.definiteFunctionType(io._DetachedSocket, [io.Socket])))();
+ let SocketTovoid = () => (SocketTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [io.Socket])))();
let SecureSocketTo_HttpClientConnection = () => (SecureSocketTo_HttpClientConnection = dart.constFn(dart.definiteFunctionType(io._HttpClientConnection, [io.SecureSocket])))();
let HttpClientResponseToFutureOfSecureSocket = () => (HttpClientResponseToFutureOfSecureSocket = dart.constFn(dart.definiteFunctionType(FutureOfSecureSocket(), [io.HttpClientResponse])))();
let X509CertificateTobool$ = () => (X509CertificateTobool$ = dart.constFn(dart.definiteFunctionType(core.bool, [io.X509Certificate])))();
@@ -864,14 +886,15 @@
let dynamicToFutureOf_ConnectionInfo = () => (dynamicToFutureOf_ConnectionInfo = dart.constFn(dart.definiteFunctionType(FutureOf_ConnectionInfo(), [dart.dynamic])))();
let VoidToFutureOf_ConnectionInfo = () => (VoidToFutureOf_ConnectionInfo = dart.constFn(dart.definiteFunctionType(FutureOf_ConnectionInfo(), [])))();
let _SiteCredentialsAnd_CredentialsTo_SiteCredentials = () => (_SiteCredentialsAnd_CredentialsTo_SiteCredentials = dart.constFn(dart.definiteFunctionType(io._SiteCredentials, [io._SiteCredentials, io._Credentials])))();
+ let SocketToNull = () => (SocketToNull = dart.constFn(dart.definiteFunctionType(core.Null, [io.Socket])))();
+ let dynamicTo_DetachedSocket = () => (dynamicTo_DetachedSocket = dart.constFn(dart.definiteFunctionType(io._DetachedSocket, [dart.dynamic])))();
let ServerSocketTo_HttpServer = () => (ServerSocketTo_HttpServer = dart.constFn(dart.definiteFunctionType(io._HttpServer, [io.ServerSocket])))();
let SecureServerSocketTo_HttpServer = () => (SecureServerSocketTo_HttpServer = dart.constFn(dart.definiteFunctionType(io._HttpServer, [io.SecureServerSocket])))();
- let SocketToNull = () => (SocketToNull = dart.constFn(dart.definiteFunctionType(core.Null, [io.Socket])))();
let _HttpConnectionToNull = () => (_HttpConnectionToNull = dart.constFn(dart.definiteFunctionType(core.Null, [io._HttpConnection])))();
let _HttpConnectionToMap = () => (_HttpConnectionToMap = dart.constFn(dart.definiteFunctionType(core.Map, [io._HttpConnection])))();
- let _FileResourceInfoToMapOfString$String = () => (_FileResourceInfoToMapOfString$String = dart.constFn(dart.definiteFunctionType(MapOfString$String(), [io._FileResourceInfo])))();
- let _ProcessResourceInfoToMapOfString$String = () => (_ProcessResourceInfoToMapOfString$String = dart.constFn(dart.definiteFunctionType(MapOfString$String(), [io._ProcessResourceInfo])))();
- let _SocketResourceInfoToMapOfString$String = () => (_SocketResourceInfoToMapOfString$String = dart.constFn(dart.definiteFunctionType(MapOfString$String(), [io._SocketResourceInfo])))();
+ let _FileResourceInfoToMapOfString$dynamic = () => (_FileResourceInfoToMapOfString$dynamic = dart.constFn(dart.definiteFunctionType(MapOfString$dynamic(), [io._FileResourceInfo])))();
+ let _ProcessResourceInfoToMapOfString$dynamic = () => (_ProcessResourceInfoToMapOfString$dynamic = dart.constFn(dart.definiteFunctionType(MapOfString$dynamic(), [io._ProcessResourceInfo])))();
+ let _SocketResourceInfoToMapOfString$dynamic = () => (_SocketResourceInfoToMapOfString$dynamic = dart.constFn(dart.definiteFunctionType(MapOfString$dynamic(), [io._SocketResourceInfo])))();
let dynamicTo_Link = () => (dynamicTo_Link = dart.constFn(dart.definiteFunctionType(io._Link, [dart.dynamic])))();
let FileSystemEntityToFutureOfLink = () => (FileSystemEntityToFutureOfLink = dart.constFn(dart.definiteFunctionType(FutureOfLink(), [io.FileSystemEntity])))();
let FileSystemEntityTo_Link = () => (FileSystemEntityTo_Link = dart.constFn(dart.definiteFunctionType(io._Link, [io.FileSystemEntity])))();
@@ -884,7 +907,6 @@
let RawSecureSocketToNull = () => (RawSecureSocketToNull = dart.constFn(dart.definiteFunctionType(core.Null, [io.RawSecureSocket])))();
let RawSocketToFutureOfRawSecureSocket = () => (RawSocketToFutureOfRawSecureSocket = dart.constFn(dart.definiteFunctionType(FutureOfRawSecureSocket(), [io.RawSocket])))();
let _FilterStatusToNull = () => (_FilterStatusToNull = dart.constFn(dart.definiteFunctionType(core.Null, [io._FilterStatus])))();
- let intToint = () => (intToint = dart.constFn(dart.definiteFunctionType(core.int, [core.int])))();
let dynamicTo_FilterStatus = () => (dynamicTo_FilterStatus = dart.constFn(dart.definiteFunctionType(io._FilterStatus, [dart.dynamic])))();
let ListOfintAndStringTovoid = () => (ListOfintAndStringTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [ListOfint(), core.String])))();
let dynamicToStdioType = () => (dynamicToStdioType = dart.constFn(dart.definiteFunctionType(io.StdioType, [dart.dynamic])))();
@@ -892,14 +914,13 @@
let WebSocketTovoid = () => (WebSocketTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [io.WebSocket])))();
let HttpRequestToNull = () => (HttpRequestToNull = dart.constFn(dart.definiteFunctionType(core.Null, [io.HttpRequest])))();
let SocketTo_WebSocketImpl = () => (SocketTo_WebSocketImpl = dart.constFn(dart.definiteFunctionType(io._WebSocketImpl, [io.Socket])))();
- let StringToFuture = () => (StringToFuture = dart.constFn(dart.definiteFunctionType(async.Future, [core.String])))();
+ let StringToFutureOfWebSocket = () => (StringToFutureOfWebSocket = dart.constFn(dart.definiteFunctionType(FutureOfWebSocket(), [core.String])))();
let EventSinkOfListOfintTo_WebSocketOutgoingTransformer = () => (EventSinkOfListOfintTo_WebSocketOutgoingTransformer = dart.constFn(dart.definiteFunctionType(io._WebSocketOutgoingTransformer, [EventSinkOfListOfint()])))();
- let dynamicTo_WebSocketImpl = () => (dynamicTo_WebSocketImpl = dart.constFn(dart.definiteFunctionType(io._WebSocketImpl, [dart.dynamic])))();
let HttpClientResponseToFutureOfWebSocket = () => (HttpClientResponseToFutureOfWebSocket = dart.constFn(dart.definiteFunctionType(FutureOfWebSocket(), [io.HttpClientResponse])))();
let StringAnddynamicTovoid = () => (StringAnddynamicTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String, dart.dynamic])))();
let HttpClientRequestToFutureOfHttpClientResponse = () => (HttpClientRequestToFutureOfHttpClientResponse = dart.constFn(dart.definiteFunctionType(FutureOfHttpClientResponse(), [io.HttpClientRequest])))();
let dynamicToMap = () => (dynamicToMap = dart.constFn(dart.definiteFunctionType(core.Map, [dart.dynamic])))();
- let ListToIsolate = () => (ListToIsolate = dart.constFn(dart.definiteFunctionType(isolate.Isolate, [core.List])))();
+ let ListToIsolate = () => (ListToIsolate = dart.constFn(dart.definiteFunctionType(isolate$.Isolate, [core.List])))();
let dynamicTo_DartObject = () => (dynamicTo_DartObject = dart.constFn(dart.definiteFunctionType(js._DartObject, [dart.dynamic])))();
let dynamicAnddynamicAndFnToObject = () => (dynamicAnddynamicAndFnToObject = dart.constFn(dart.definiteFunctionType(core.Object, [dart.dynamic, dart.dynamic, dynamicTodynamic()])))();
let FToF = () => (FToF = dart.constFn(dart.definiteFunctionType(F => [F, [F]])))();
@@ -1464,8 +1485,8 @@
dart.getIsNamedConstructor = function(value) {
return value[dart.isNamedConstructor];
};
- dart.getDartLibraryName = function(value) {
- return value[dart_library.dartLibraryName];
+ dart.getModuleName = function(value) {
+ return value[dart._moduleName];
};
dart.tag = function(value, t) {
value[dart._runtimeType] = t;
@@ -1476,6 +1497,18 @@
dart.tagLazy = function(value, compute) {
dart.defineLazyProperty(value, dart._runtimeType, {get: compute});
};
+ dart.getModuleNames = function() {
+ return Array.from(dart._loadedModules.keys());
+ };
+ dart.getModuleLibraries = function(name) {
+ let module = dart._loadedModules.get(name);
+ if (module == null) return null;
+ module[dart._moduleName] = name;
+ return module;
+ };
+ dart.trackLibraries = function(moduleName, libraries) {
+ dart._loadedModules.set(moduleName, libraries);
+ };
dart._warn = function(arg) {
console.warn(arg);
};
@@ -1618,6 +1651,9 @@
dart.definiteFunctionType = function(returnType, args, extra) {
return dart._functionType(true, returnType, args, extra);
};
+ dart.isType = function(obj) {
+ return dart._getRuntimeType(obj) === core.Type;
+ };
dart.typeName = function(type) {
if (type === void 0) return "undefined type";
if (type === null) return "null type";
@@ -2042,7 +2078,7 @@
return name;
};
dart._dartSymbol = function(name) {
- return core.Symbol._check(typeof name === "symbol" ? dart.const(new _internal.Symbol.es6(dart._toSymbolName(name), name)) : dart.const(core.Symbol.new(dart._toDisplayName(name))));
+ return core.Symbol._check(typeof name === "symbol" ? dart.const(new _internal.PrivateSymbol(dart._toSymbolName(name), name)) : dart.const(core.Symbol.new(dart._toDisplayName(name))));
};
dart.extractNamedArgs = function(args) {
if (args.length > 0) {
@@ -2436,6 +2472,7 @@
return obj[dartx.toString]();
}
if (typeof obj == "function") {
+ if (dart.test(dart.isType(obj))) return dart.typeName(obj);
return "Closure: " + dart.getReifiedType(obj) + " from: " + obj;
}
return obj.toString();
@@ -2640,12 +2677,19 @@
dart.dartx = dartx;
dart._runtimeType = Symbol("_runtimeType");
dart.isNamedConstructor = Symbol("isNamedConstructor");
+ dart._moduleName = Symbol("_moduleName");
dart.defineLazy(dart, {
get _lazyJSTypes() {
return new Map();
},
set _lazyJSTypes(_) {}
});
+ dart.defineLazy(dart, {
+ get _loadedModules() {
+ return new Map();
+ },
+ set _loadedModules(_) {}
+ });
dart.metadata = Symbol("metadata");
dart._typeObject = Symbol("typeObject");
core.Object = class Object {
@@ -3199,9 +3243,51 @@
names: ['getProperty', 'setProperty']
});
_debugger.addMetadataChildren = function(object, ret) {
- ret.add(new _debugger.NameValuePair({name: _debugger.getTypeName(core.Type._check(_debugger._getType(object))), value: object, config: _debugger.JsonMLConfig.asClass}));
+ ret.add(new _debugger.NameValuePair({name: "[[class]]", value: dart.getReifiedType(object), config: _debugger.JsonMLConfig.asClass}));
};
dart.lazyFn(_debugger.addMetadataChildren, () => dynamicAndSetOfNameValuePairTovoid());
+ _debugger.addPropertiesFromSignature = function(sig, properties, object, walkPrototypeChain, opts) {
+ let tagTypes = opts && 'tagTypes' in opts ? opts.tagTypes : false;
+ let skippedNames = core.Set.new();
+ skippedNames.add('hashCode');
+ while (sig != null) {
+ for (let symbol of _debugger.getOwnPropertySymbols(sig)) {
+ let dartName = _debugger.symbolName(symbol);
+ let dartXPrefix = 'dartx.';
+ if (dart.test(dartName[dartx.startsWith](dartXPrefix))) {
+ dartName = dartName[dartx.substring](dartXPrefix[dartx.length]);
+ }
+ if (dart.test(skippedNames.contains(dartName))) continue;
+ let value = _debugger.safeGetProperty(object, symbol);
+ if (dart.test(tagTypes) && _debugger._typeof(value) == 'function') {
+ dart.tag(value, sig[symbol]);
+ }
+ properties.add(new _debugger.NameValuePair({name: dartName, value: value}));
+ }
+ for (let name of _debugger.getOwnPropertyNames(sig)) {
+ let value = _debugger.safeGetProperty(object, name);
+ if (dart.test(skippedNames.contains(name))) continue;
+ if (dart.test(tagTypes) && _debugger._typeof(value) == 'function') {
+ dart.tag(value, sig[name]);
+ }
+ properties.add(new _debugger.NameValuePair({name: name, value: value}));
+ }
+ if (!dart.test(walkPrototypeChain)) break;
+ sig = _debugger.safeGetProperty(sig, '__proto__');
+ }
+ };
+ dart.lazyFn(_debugger.addPropertiesFromSignature, () => dynamicAndSetOfNameValuePairAnddynamic__Tovoid());
+ _debugger.sortProperties = function(properties) {
+ let sortedProperties = properties[dartx.toList]();
+ sortedProperties[dartx.sort](dart.fn((a, b) => {
+ let aPrivate = a.name[dartx.startsWith]('_');
+ let bPrivate = b.name[dartx.startsWith]('_');
+ if (aPrivate != bPrivate) return dart.test(aPrivate) ? 1 : -1;
+ return a.name[dartx.compareTo](b.name);
+ }, NameValuePairAndNameValuePairToint()));
+ return sortedProperties;
+ };
+ dart.lazyFn(_debugger.sortProperties, () => IterableOfNameValuePairToListOfNameValuePair());
_debugger.getObjectTypeName = function(object) {
let reifiedType = dart.getReifiedType(object);
if (reifiedType == null) {
@@ -3210,7 +3296,7 @@
}
return '<Error getting type name>';
}
- return _debugger.getTypeName(core.Type._check(reifiedType));
+ return _debugger.getTypeName(reifiedType);
};
dart.lazyFn(_debugger.getObjectTypeName, () => dynamicToString());
_debugger.getTypeName = function(type) {
@@ -3218,11 +3304,7 @@
if (name == 'JSArray<dynamic>' || name == 'JSObject<Array>') return 'List<dynamic>';
return name;
};
- dart.lazyFn(_debugger.getTypeName, () => TypeToString());
- _debugger._getType = function(object) {
- return core.Type.is(object) ? object : dart.getReifiedType(object);
- };
- dart.fn(_debugger._getType, dynamicToObject());
+ dart.lazyFn(_debugger.getTypeName, () => dynamicToString());
const _simpleFormatter = Symbol('_simpleFormatter');
_debugger.safePreview = function(object, config) {
try {
@@ -3262,7 +3344,9 @@
this.hideName = hideName;
}
['=='](other) {
- return _debugger.NameValuePair.is(other) && other.name == this.name;
+ if (!_debugger.NameValuePair.is(other)) return false;
+ if (dart.test(this.hideName) || dart.test(dart.dload(other, 'hideName'))) return core.identical(this, other);
+ return dart.equals(dart.dload(other, 'name'), this.name);
}
get hashCode() {
return dart.hashCode(this.name);
@@ -3455,7 +3539,7 @@
});
_debugger.isNativeJavaScriptObject = function(object) {
let type = _debugger._typeof(object);
- return type != 'object' && type != 'function' || dart.JSObject.is(object) || html$.Node.is(object);
+ return type != 'object' && type != 'function' || dart.test(dart.isJsInterop(object)) || html$.Node.is(object);
};
dart.lazyFn(_debugger.isNativeJavaScriptObject, () => dynamicTobool$());
_debugger.JsonMLFormatter = class JsonMLFormatter extends core.Object {
@@ -3491,24 +3575,37 @@
body.addStyle('color: rgb(196, 26, 22);');
}
let children = this[_simpleFormatter].children(object, config);
+ if (children == null) return body.toJsonML();
for (let child of children) {
let li = body.createChild('li');
- let nameSpan = new _debugger.JsonMLElement('span');
- nameSpan.createTextChild(dart.test(child.displayName[dartx.isNotEmpty]) ? dart.str`${child.displayName}: ` : '');
- nameSpan.setStyle('color: rgb(136, 19, 145);');
+ li.setStyle("padding-left: 13px;");
+ let nameSpan = null;
+ let valueStyle = '';
+ if (!dart.test(child.hideName)) {
+ nameSpan = new _debugger.JsonMLElement('span');
+ nameSpan.createTextChild(dart.test(child.displayName[dartx.isNotEmpty]) ? dart.str`${child.displayName}: ` : '');
+ nameSpan.setStyle('color: rgb(136, 19, 145); margin-right: -13px');
+ valueStyle = 'margin-left: 13px';
+ }
if (_debugger._typeof(child.value) == 'object' || _debugger._typeof(child.value) == 'function') {
- nameSpan.addStyle("padding-left: 13px;");
- li.appendChild(nameSpan);
- let objectTag = li.createObjectTag(child.value);
- objectTag.addAttribute('config', child.config);
- if (!dart.test(this[_simpleFormatter].hasChildren(child.value, child.config))) {
- li.setStyle("padding-left: 13px;");
+ let valueSpan = new _debugger.JsonMLElement('span');
+ valueSpan.setStyle(valueStyle);
+ valueSpan.createObjectTag(child.value).addAttribute('config', child.config);
+ if (nameSpan != null) {
+ li.appendChild(nameSpan);
}
+ li.appendChild(valueSpan);
} else {
- li.setStyle("padding-left: 13px;");
- let _ = li.createChild('span');
- _.appendChild(nameSpan);
- _.createTextChild(_debugger.safePreview(child.value, child.config));
+ let line = li.createChild('span');
+ if (nameSpan != null) {
+ line.appendChild(nameSpan);
+ }
+ line.appendChild((() => {
+ let _ = new _debugger.JsonMLElement('span');
+ _.createTextChild(_debugger.safePreview(child.value, child.config));
+ _.setStyle(valueStyle);
+ return _;
+ })());
}
}
return body.toJsonML();
@@ -3531,7 +3628,7 @@
_debugger.DartFormatter = class DartFormatter extends core.Object {
new() {
this[_formatters] = null;
- this[_formatters] = JSArrayOfFormatter().of([new _debugger.ClassFormatter(), new _debugger.NamedConstructorFormatter(), new _debugger.MapFormatter(), new _debugger.IterableFormatter(), new _debugger.IterableSpanFormatter(), new _debugger.MapEntryFormatter(), new _debugger.StackTraceFormatter(), new _debugger.FunctionFormatter(), new _debugger.HeritageClauseFormatter(), new _debugger.LibraryModuleFormatter(), new _debugger.LibraryFormatter(), new _debugger.ObjectFormatter()]);
+ this[_formatters] = JSArrayOfFormatter().of([new _debugger.ClassFormatter(), new _debugger.TypeFormatter(), new _debugger.NamedConstructorFormatter(), new _debugger.MapFormatter(), new _debugger.IterableFormatter(), new _debugger.IterableSpanFormatter(), new _debugger.MapEntryFormatter(), new _debugger.StackTraceFormatter(), new _debugger.FunctionFormatter(), new _debugger.HeritageClauseFormatter(), new _debugger.LibraryModuleFormatter(), new _debugger.LibraryFormatter(), new _debugger.ObjectFormatter()]);
}
preview(object, config) {
try {
@@ -3595,42 +3692,14 @@
return true;
}
children(object) {
- let properties = LinkedHashSetOfNameValuePair().new();
- _debugger.addMetadataChildren(object, properties);
- let current = object;
- let protoChain = JSArrayOfObject().of([]);
- while (current != null && !dart.test(_debugger.isNativeJavaScriptObject(current)) && current !== Object.prototype) {
- protoChain[dartx.add](current);
- current = _debugger.safeGetProperty(current, '__proto__');
- }
- for (current of protoChain) {
- for (let symbol of _debugger.getOwnPropertySymbols(current)) {
- let dartName = _debugger.symbolName(symbol);
- if (dart.test(_debugger.hasMethod(object, dartName))) {
- continue;
- }
- let dartXPrefix = 'dartx.';
- if (dart.test(dartName[dartx.startsWith](dartXPrefix))) {
- dartName = dartName[dartx.substring](dartXPrefix[dartx.length]);
- } else if (!dart.test(dartName[dartx.startsWith]('_'))) {
- continue;
- }
- let value = _debugger.safeGetProperty(object, symbol);
- properties.add(new _debugger.NameValuePair({name: dartName, value: value}));
- }
- }
- for (current of protoChain) {
- let className = dart.dload(dart.getReifiedType(current), 'name');
- for (let name of _debugger.getOwnPropertyNames(current)) {
- if (dart.test(_debugger.ObjectFormatter._customNames.contains(name)) || dart.equals(name, className)) continue;
- if (dart.test(_debugger.hasMethod(object, name))) {
- continue;
- }
- let value = _debugger.safeGetProperty(object, name);
- properties.add(new _debugger.NameValuePair({name: name, value: value}));
- }
- }
- return properties.toList();
+ let type = dart.getType(object);
+ let ret = LinkedHashSetOfNameValuePair().new();
+ let properties = SetOfNameValuePair().new();
+ _debugger.addPropertiesFromSignature(dart.getFieldSig(type), properties, object, true);
+ _debugger.addPropertiesFromSignature(dart.getGetterSig(type), properties, object, true);
+ ret.addAll(_debugger.sortProperties(properties));
+ _debugger.addMetadataChildren(object, ret);
+ return ret.toList();
}
};
dart.setSignature(_debugger.ObjectFormatter, {
@@ -3641,28 +3710,16 @@
children: dart.definiteFunctionType(core.List$(_debugger.NameValuePair), [dart.dynamic])
})
});
- dart.defineLazy(_debugger.ObjectFormatter, {
- get _customNames() {
- return (() => {
- let _ = SetOfString().new();
- _.add('constructor');
- _.add('prototype');
- _.add('__proto__');
- return _;
- })();
- },
- set _customNames(_) {}
- });
_debugger.LibraryModuleFormatter = class LibraryModuleFormatter extends core.Object {
accept(object, config) {
- return dart.getDartLibraryName(object) != null;
+ return dart.getModuleName(object) != null;
}
hasChildren(object) {
return true;
}
preview(object) {
- let libraryNames = dart.dsend(dart.getDartLibraryName(object), 'split', '/');
- if (dart.test(dart.dsend(dart.dload(libraryNames, 'length'), '>', 1))) {
+ let libraryNames = dart.dsend(dart.getModuleName(object), 'split', '/');
+ if (dart.test(dart.dsend(dart.dload(libraryNames, 'length'), '>', 1)) && dart.equals(dart.dload(libraryNames, 'last'), dart.dindex(libraryNames, dart.dsend(dart.dload(libraryNames, 'length'), '-', 2)))) {
dart.dsetindex(libraryNames, dart.dsend(dart.dload(libraryNames, 'length'), '-', 1), '');
}
return dart.str`Library Module: ${dart.dsend(libraryNames, 'join', '/')}`;
@@ -3671,7 +3728,6 @@
let children = LinkedHashSetOfNameValuePair().new();
for (let name of _debugger.getOwnPropertyNames(object)) {
let value = _debugger.safeGetProperty(object, name);
- name = dart.str`${name[dartx.replaceAll]("__", "/")}.dart`;
children.add(new _debugger.NameValuePair({name: name, value: new _debugger.Library(name, value), hideName: true}));
}
return children.toList();
@@ -3701,36 +3757,16 @@
}
children(object) {
let children = LinkedHashSetOfNameValuePair().new();
- let nonGenericProperties = LinkedHashMapOfString$Object().new();
let objectProperties = _debugger.safeProperties(dart.dload(object, 'object'));
dart.dsend(objectProperties, 'forEach', dart.fn((name, value) => {
- let genericTypeConstructor = dart.getGenericTypeCtor(value);
- if (genericTypeConstructor != null) {
- this.recordGenericParameters(core.String._check(name), genericTypeConstructor);
- } else {
- nonGenericProperties._set(core.String._check(name), value);
- }
+ if (dart.getGenericTypeCtor(value) != null) return;
+ children.add(_debugger.NameValuePair._check(dart.test(dart.isType(value)) ? this.classChild(core.String._check(name), value) : new _debugger.NameValuePair({name: core.String._check(name), value: value})));
}, dynamicAnddynamicToNull()));
- nonGenericProperties.forEach(dart.fn((name, value) => {
- if (core.Type.is(value)) {
- children.add(_debugger.NameValuePair._check(this.classChild(name, value)));
- } else {
- children.add(new _debugger.NameValuePair({name: name, value: value}));
- }
- }, StringAndObjectToNull()));
return children.toList();
}
- recordGenericParameters(name, genericTypeConstructor) {
- this.genericParameters._set(name, genericTypeConstructor.toString()[dartx.split](' =>')[dartx.first][dartx.replaceAll](core.RegExp.new('[(|)]'), ''));
- }
classChild(name, child) {
- let typeName = _debugger.getTypeName(core.Type._check(child));
- let parameterName = dart.str`${name}\$`;
- if (dart.test(this.genericParameters.keys[dartx.contains](parameterName))) {
- typeName = dart.str`${typeName}<${this.genericParameters._get(parameterName)}>`;
- _debugger.JSNative.setProperty(child, 'genericTypeName', typeName);
- }
- return new _debugger.NameValuePair({name: typeName, value: child});
+ let typeName = _debugger.getTypeName(child);
+ return new _debugger.NameValuePair({name: typeName, value: child, config: _debugger.JsonMLConfig.asClass});
}
};
_debugger.LibraryFormatter[dart.implements] = () => [_debugger.Formatter];
@@ -3741,7 +3777,6 @@
hasChildren: dart.definiteFunctionType(core.bool, [dart.dynamic]),
preview: dart.definiteFunctionType(core.String, [dart.dynamic]),
children: dart.definiteFunctionType(core.List$(_debugger.NameValuePair), [dart.dynamic]),
- recordGenericParameters: dart.definiteFunctionType(dart.dynamic, [core.String, core.Object]),
classChild: dart.definiteFunctionType(dart.dynamic, [core.String, core.Object])
})
});
@@ -3958,60 +3993,49 @@
});
_debugger.ClassFormatter = class ClassFormatter extends core.Object {
accept(object, config) {
- return core.Type.is(object) || dart.equals(config, _debugger.JsonMLConfig.asClass);
+ return dart.equals(config, _debugger.JsonMLConfig.asClass);
}
- preview(object) {
- let typeName = _debugger.safeGetProperty(object, 'genericTypeName');
- if (typeName != null) return core.String._check(typeName);
- let type = _debugger._getType(object);
+ preview(type) {
let implements$ = dart.getImplements(type);
- typeName = _debugger.getTypeName(core.Type._check(type));
+ let typeName = _debugger.getTypeName(type);
if (implements$ != null) {
let typeNames = dart.dsend(dart.dcall(implements$), 'map', _debugger.getTypeName);
return dart.str`${typeName} implements ${dart.dsend(typeNames, 'join', ", ")}`;
} else {
- return core.String._check(typeName);
+ return typeName;
}
}
hasChildren(object) {
return true;
}
- children(object) {
- let type = _debugger._getType(object);
- let children = JSArrayOfNameValuePair().of([]);
- let typeName = _debugger.getTypeName(core.Type._check(_debugger._getType(object)));
+ children(type) {
+ let ret = LinkedHashSetOfNameValuePair().new();
+ let staticProperties = SetOfNameValuePair().new();
+ let staticMethods = SetOfNameValuePair().new();
+ _debugger.addPropertiesFromSignature(dart.getStaticFieldSig(type), staticProperties, type, false);
+ _debugger.addPropertiesFromSignature(dart.getStaticGetterSig(type), staticProperties, type, false);
+ _debugger.addPropertiesFromSignature(dart.getStaticSig(type), staticMethods, type, false);
+ if (dart.test(staticProperties.isNotEmpty) || dart.test(staticMethods.isNotEmpty)) {
+ ret.add(new _debugger.NameValuePair({value: '[[Static members]]', hideName: true}));
+ ret.addAll(_debugger.sortProperties(staticProperties));
+ ret.addAll(_debugger.sortProperties(staticMethods));
+ }
+ let instanceMethods = SetOfNameValuePair().new();
+ _debugger.addPropertiesFromSignature(dart.getMethodSig(type), instanceMethods, type.prototype, false, {tagTypes: true});
+ if (dart.test(instanceMethods.isNotEmpty)) {
+ ret.add(new _debugger.NameValuePair({value: '[[Instance Methods]]', hideName: true}));
+ ret.addAll(_debugger.sortProperties(instanceMethods));
+ }
+ let typeName = _debugger.getTypeName(type);
let mixins = dart.getMixins(type);
if (mixins != null && dart.test(dart.dload(mixins, 'isNotEmpty'))) {
- children[dartx.add](new _debugger.NameValuePair({name: '[[Mixins]]', value: new _debugger.HeritageClause('mixins', core.List._check(mixins))}));
+ ret.add(new _debugger.NameValuePair({name: '[[Mixins]]', value: new _debugger.HeritageClause('mixins', core.List._check(mixins))}));
}
- let hiddenProperties = JSArrayOfString().of(['length', 'name', 'prototype', 'genericTypeName']);
- for (let name of _debugger.getOwnPropertyNames(object)) {
- if (dart.test(hiddenProperties[dartx.contains](name))) continue;
- let value = _debugger.safeGetProperty(object, name);
- if (value != null && dart.getIsNamedConstructor(value) != null) {
- value = new _debugger.NamedConstructor(value);
- name = dart.str`${typeName}.${name}`;
- }
- children[dartx.add](new _debugger.NameValuePair({name: name, value: value}));
+ let baseProto = type.__proto__;
+ if (baseProto != null && !dart.test(dart.isJsInterop(baseProto))) {
+ ret.add(new _debugger.NameValuePair({name: "[[base class]]", value: baseProto, config: _debugger.JsonMLConfig.asClass}));
}
- let hiddenPrototypeProperties = JSArrayOfString().of(['constructor', 'new', '$identityHash']);
- let prototype = object.prototype;
- if (prototype != null) {
- for (let name of _debugger.getOwnPropertyNames(prototype)) {
- if (dart.test(hiddenPrototypeProperties[dartx.contains](name))) continue;
- let func = _debugger.safeGetProperty(prototype, name);
- let constructor = _debugger.safeGetProperty(prototype, 'constructor');
- let sigObj = dart.getMethodSig(constructor);
- if (sigObj != null) {
- let value = _debugger.safeGetProperty(sigObj, name);
- if (_debugger.getTypeName(core.Type._check(dart.getReifiedType(value))) != 'Null') {
- dart.tag(func, value);
- children[dartx.add](new _debugger.NameValuePair({name: name, value: func}));
- }
- }
- }
- }
- return children;
+ return ret.toList();
}
};
_debugger.ClassFormatter[dart.implements] = () => [_debugger.Formatter];
@@ -4023,11 +4047,42 @@
children: dart.definiteFunctionType(core.List$(_debugger.NameValuePair), [dart.dynamic])
})
});
+ _debugger.TypeFormatter = class TypeFormatter extends core.Object {
+ accept(object, config) {
+ return core.Type.is(object);
+ }
+ preview(object) {
+ return dart.toString(object);
+ }
+ hasChildren(object) {
+ return false;
+ }
+ children(object) {
+ return JSArrayOfNameValuePair().of([]);
+ }
+ };
+ _debugger.TypeFormatter[dart.implements] = () => [_debugger.Formatter];
+ dart.setSignature(_debugger.TypeFormatter, {
+ methods: () => ({
+ accept: dart.definiteFunctionType(core.bool, [dart.dynamic, dart.dynamic]),
+ preview: dart.definiteFunctionType(core.String, [dart.dynamic]),
+ hasChildren: dart.definiteFunctionType(core.bool, [dart.dynamic]),
+ children: dart.definiteFunctionType(core.List$(_debugger.NameValuePair), [dart.dynamic])
+ })
+ });
_debugger.registerDevtoolsFormatter = function() {
let formatters = JSArrayOfJsonMLFormatter().of([_debugger._devtoolsFormatter]);
dart.global.devtoolsFormatters = formatters;
};
dart.fn(_debugger.registerDevtoolsFormatter, VoidTodynamic$());
+ _debugger.getModuleNames = function() {
+ return dart.getModuleNames();
+ };
+ dart.fn(_debugger.getModuleNames, VoidTodynamic$());
+ _debugger.getModuleLibraries = function(name) {
+ return dart.getModuleLibraries(name);
+ };
+ dart.lazyFn(_debugger.getModuleLibraries, () => StringTodynamic());
_foreign_helper.JS = function(typeDescription, codeTemplate, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11) {
if (arg0 === void 0) arg0 = null;
if (arg1 === void 0) arg1 = null;
@@ -4361,7 +4416,7 @@
IterableOfE()._check(iterable);
this[dartx.checkGrowable]('insertAll');
core.RangeError.checkValueInInterval(index, 0, this[dartx.length], "index");
- if (!_internal.EfficientLength.is(iterable)) {
+ if (!_internal.EfficientLengthIterable.is(iterable)) {
iterable = iterable[dartx.toList]();
}
let insertionLength = iterable[dartx.length];
@@ -4634,7 +4689,7 @@
IterableOfE()._check(replacement);
this[dartx.checkGrowable]('replace range');
core.RangeError.checkValidRange(start, end, this[dartx.length]);
- if (!_internal.EfficientLength.is(replacement)) {
+ if (!_internal.EfficientLengthIterable.is(replacement)) {
replacement = replacement[dartx.toList]();
}
let removeLength = dart.notNull(end) - dart.notNull(start);
@@ -6349,21 +6404,20 @@
this[_filter](test, true);
}
[_filter](test, retainMatching) {
- let source = this;
let retained = JSArrayOfE().of([]);
- let length = source[dartx.length];
+ let length = this[dartx.length];
for (let i = 0; i < dart.notNull(length); i++) {
- let element = source[dartx._get](i);
+ let element = this[dartx._get](i);
if (dart.dcall(test, element) == retainMatching) {
retained[dartx.add](element);
}
- if (length != source[dartx.length]) {
- dart.throw(new core.ConcurrentModificationError(source));
+ if (length != this[dartx.length]) {
+ dart.throw(new core.ConcurrentModificationError(this));
}
}
- if (retained[dartx.length] != source[dartx.length]) {
- source[dartx.setRange](0, retained[dartx.length], retained);
- source[dartx.length] = retained[dartx.length];
+ if (retained[dartx.length] != this[dartx.length]) {
+ this[dartx.setRange](0, retained[dartx.length], retained);
+ this[dartx.length] = retained[dartx.length];
}
}
clear() {
@@ -6379,11 +6433,10 @@
}
sort(compare) {
if (compare === void 0) compare = null;
- if (compare == null) {
- _internal.Sort.sort(E)(this, dart.fn((a, b) => core.Comparable.compare(core.Comparable._check(a), core.Comparable._check(b)), dynamicAnddynamicToint()));
- } else {
- _internal.Sort.sort(E)(this, compare);
- }
+ _internal.Sort.sort(E)(this, (compare != null ? compare : collection.ListMixin._compareAny));
+ }
+ static _compareAny(a, b) {
+ return core.Comparable.compare(core.Comparable._check(a), core.Comparable._check(b));
}
shuffle(random) {
if (random === void 0) random = null;
@@ -6463,7 +6516,7 @@
replaceRange(start, end, newContents) {
IterableOfE()._check(newContents);
core.RangeError.checkValidRange(start, end, this[dartx.length]);
- if (!_internal.EfficientLength.is(newContents)) {
+ if (!_internal.EfficientLengthIterable.is(newContents)) {
newContents = newContents[dartx.toList]();
}
let removeLength = dart.notNull(end) - dart.notNull(start);
@@ -6541,7 +6594,7 @@
insertAll(index, iterable) {
IterableOfE()._check(iterable);
core.RangeError.checkValueInInterval(index, 0, this[dartx.length], "index");
- if (!_internal.EfficientLength.is(iterable) || core.identical(iterable, this)) {
+ if (!_internal.EfficientLengthIterable.is(iterable) || core.identical(iterable, this)) {
iterable = iterable[dartx.toList]();
}
let insertionLength = iterable[dartx.length];
@@ -6630,7 +6683,9 @@
removeAt: dart.definiteFunctionType(E, [core.int]),
insertAll: dart.definiteFunctionType(dart.void, [core.int, IterableOfE()]),
setAll: dart.definiteFunctionType(dart.void, [core.int, IterableOfE()])
- })
+ }),
+ statics: () => ({_compareAny: dart.definiteFunctionType(core.int, [dart.dynamic, dart.dynamic])}),
+ names: ['_compareAny']
});
dart.defineExtensionMembers(ListMixin, [
'elementAt',
@@ -6889,7 +6944,66 @@
names: ['stringOf']
});
dart.defineExtensionMembers(_internal.CodeUnits, ['_get', 'length']);
- _internal.EfficientLength = class EfficientLength extends core.Object {};
+ _internal.ExternalName = class ExternalName extends core.Object {
+ new(name) {
+ this.name = name;
+ }
+ };
+ dart.setSignature(_internal.ExternalName, {
+ fields: () => ({name: core.String})
+ });
+ _internal.hexDigitValue = function(char) {
+ dart.assert(dart.notNull(char) >= 0 && dart.notNull(char) <= 65535);
+ let digit0 = 48;
+ let a = 97;
+ let f = 102;
+ let digit = (dart.notNull(char) ^ digit0) >>> 0;
+ if (digit <= 9) return digit;
+ let letter = (dart.notNull(char) | 32) >>> 0;
+ if (a <= letter && letter <= f) return letter - (a - 10);
+ return -1;
+ };
+ dart.fn(_internal.hexDigitValue, intToint());
+ _internal.parseHexByte = function(source, index) {
+ dart.assert(dart.notNull(index) + 2 <= dart.notNull(source[dartx.length]));
+ let digit1 = _internal.hexDigitValue(source[dartx.codeUnitAt](index));
+ let digit2 = _internal.hexDigitValue(source[dartx.codeUnitAt](dart.notNull(index) + 1));
+ return dart.notNull(digit1) * 16 + dart.notNull(digit2) - (dart.notNull(digit2) & 256);
+ };
+ dart.lazyFn(_internal.parseHexByte, () => StringAndintToint());
+ const _name$ = Symbol('_name');
+ const _nativeSymbol = Symbol('_nativeSymbol');
+ _internal.PrivateSymbol = class PrivateSymbol extends core.Object {
+ new(name, nativeSymbol) {
+ this[_name$] = name;
+ this[_nativeSymbol] = nativeSymbol;
+ }
+ static getName(symbol) {
+ return _internal.PrivateSymbol.as(symbol)[_name$];
+ }
+ static getNativeSymbol(symbol) {
+ if (_internal.PrivateSymbol.is(symbol)) return symbol[_nativeSymbol];
+ return null;
+ }
+ ['=='](other) {
+ return _internal.PrivateSymbol.is(other) && core.identical(this[_nativeSymbol], other[_nativeSymbol]);
+ }
+ toString() {
+ return dart.str`Symbol("${this[_name$]}")`;
+ }
+ };
+ _internal.PrivateSymbol[dart.implements] = () => [core.Symbol];
+ dart.setSignature(_internal.PrivateSymbol, {
+ fields: () => ({
+ [_name$]: core.String,
+ [_nativeSymbol]: core.Object
+ }),
+ statics: () => ({
+ getName: dart.definiteFunctionType(core.String, [core.Symbol]),
+ getNativeSymbol: dart.definiteFunctionType(core.Object, [core.Symbol])
+ }),
+ names: ['getName', 'getNativeSymbol']
+ });
core.Iterable$ = dart.generic(E => {
let EmptyIterableOfE = () => (EmptyIterableOfE = dart.constFn(_internal.EmptyIterable$(E)))();
let _GeneratorIterableOfE = () => (_GeneratorIterableOfE = dart.constFn(core._GeneratorIterable$(E)))();
@@ -7028,7 +7142,7 @@
return SetOfE().from(this);
}
get length() {
- dart.assert(!_internal.EfficientLength.is(this));
+ dart.assert(!_internal.EfficientLengthIterable.is(this));
let count = 0;
let it = this[dartx.iterator];
while (dart.test(it.moveNext())) {
@@ -7197,6 +7311,15 @@
return Iterable;
});
core.Iterable = Iterable();
+ _internal.EfficientLengthIterable$ = dart.generic(T => {
+ class EfficientLengthIterable extends core.Iterable$(T) {
+ new() {
+ super.new();
+ }
+ }
+ return EfficientLengthIterable;
+ });
+ _internal.EfficientLengthIterable = EfficientLengthIterable();
_internal.ListIterable$ = dart.generic(E => {
let ListIteratorOfE = () => (ListIteratorOfE = dart.constFn(_internal.ListIterator$(E)))();
let VoidToE = () => (VoidToE = dart.constFn(dart.functionType(E, [])))();
@@ -7206,7 +7329,7 @@
let SetOfE = () => (SetOfE = dart.constFn(core.Set$(E)))();
let ETovoid = () => (ETovoid = dart.constFn(dart.functionType(dart.void, [E])))();
let ETobool = () => (ETobool = dart.constFn(dart.functionType(core.bool, [E])))();
- class ListIterable extends core.Iterable$(E) {
+ class ListIterable extends _internal.EfficientLengthIterable$(E) {
new() {
super.new();
}
@@ -7413,7 +7536,6 @@
return result;
}
}
- ListIterable[dart.implements] = () => [_internal.EfficientLength];
dart.setSignature(ListIterable, {
getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])}),
methods: () => ({reduce: dart.definiteFunctionType(E, [dynamicAndEToE()])})
@@ -7612,7 +7734,7 @@
let _TransformationOfS$T = () => (_TransformationOfS$T = dart.constFn(_internal._Transformation$(S, T)))();
class MappedIterable extends core.Iterable$(T) {
static new(iterable, func) {
- if (_internal.EfficientLength.is(iterable)) {
+ if (_internal.EfficientLengthIterable.is(iterable)) {
return new (EfficientLengthMappedIterableOfS$T())(iterable, func);
}
return new (MappedIterableOfS$T())._(iterable, func);
@@ -7665,12 +7787,13 @@
});
_internal.MappedIterable = MappedIterable();
_internal.EfficientLengthMappedIterable$ = dart.generic((S, T) => {
+ let EfficientLengthIterableOfT = () => (EfficientLengthIterableOfT = dart.constFn(_internal.EfficientLengthIterable$(T)))();
class EfficientLengthMappedIterable extends _internal.MappedIterable$(S, T) {
new(iterable, func) {
super._(iterable, func);
}
}
- EfficientLengthMappedIterable[dart.implements] = () => [_internal.EfficientLength];
+ EfficientLengthMappedIterable[dart.implements] = () => [EfficientLengthIterableOfT()];
return EfficientLengthMappedIterable;
});
_internal.EfficientLengthMappedIterable = EfficientLengthMappedIterable();
@@ -7731,7 +7854,6 @@
return this[_f](this[_source][dartx.elementAt](index));
}
}
- MappedListIterable[dart.implements] = () => [_internal.EfficientLength];
dart.setSignature(MappedListIterable, {
fields: () => ({
[_source]: IterableOfS(),
@@ -7760,6 +7882,11 @@
get iterator() {
return new (WhereIteratorOfE())(this[_iterable$][dartx.iterator], this[_f]);
}
+ map(T) {
+ return f => {
+ return new (_internal.MappedIterable$(E, T))._(this, f);
+ };
+ }
}
dart.setSignature(WhereIterable, {
fields: () => ({
@@ -7768,13 +7895,12 @@
}),
getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])})
});
- dart.defineExtensionMembers(WhereIterable, ['iterator']);
+ dart.defineExtensionMembers(WhereIterable, ['map', 'iterator']);
return WhereIterable;
});
_internal.WhereIterable = WhereIterable();
_internal.WhereIterator$ = dart.generic(E => {
let IteratorOfE = () => (IteratorOfE = dart.constFn(core.Iterator$(E)))();
- let _ElementPredicateOfE = () => (_ElementPredicateOfE = dart.constFn(_internal._ElementPredicate$(E)))();
class WhereIterator extends core.Iterator$(E) {
new(iterator, f) {
this[_iterator] = iterator;
@@ -7782,7 +7908,7 @@
}
moveNext() {
while (dart.test(this[_iterator].moveNext())) {
- if (dart.test(this[_f](this[_iterator].current))) {
+ if (dart.test(dart.dcall(this[_f], this[_iterator].current))) {
return true;
}
}
@@ -7795,7 +7921,7 @@
dart.setSignature(WhereIterator, {
fields: () => ({
[_iterator]: IteratorOfE(),
- [_f]: _ElementPredicateOfE()
+ [_f]: _internal._ElementPredicate
}),
getters: () => ({current: dart.definiteFunctionType(E, [])}),
methods: () => ({moveNext: dart.definiteFunctionType(core.bool, [])})
@@ -7890,7 +8016,7 @@
if (!(typeof takeCount == 'number') || dart.notNull(takeCount) < 0) {
dart.throw(new core.ArgumentError(takeCount));
}
- if (_internal.EfficientLength.is(iterable)) {
+ if (_internal.EfficientLengthIterable.is(iterable)) {
return new (EfficientLengthTakeIterableOfE())(iterable, takeCount);
}
return new (TakeIterableOfE())._(iterable, takeCount);
@@ -7917,6 +8043,7 @@
});
_internal.TakeIterable = TakeIterable();
_internal.EfficientLengthTakeIterable$ = dart.generic(E => {
+ let EfficientLengthIterableOfE = () => (EfficientLengthIterableOfE = dart.constFn(_internal.EfficientLengthIterable$(E)))();
class EfficientLengthTakeIterable extends _internal.TakeIterable$(E) {
new(iterable, takeCount) {
super._(iterable, takeCount);
@@ -7927,7 +8054,7 @@
return iterableLength;
}
}
- EfficientLengthTakeIterable[dart.implements] = () => [_internal.EfficientLength];
+ EfficientLengthTakeIterable[dart.implements] = () => [EfficientLengthIterableOfE()];
dart.setSignature(EfficientLengthTakeIterable, {});
dart.defineExtensionMembers(EfficientLengthTakeIterable, ['length']);
return EfficientLengthTakeIterable;
@@ -8034,7 +8161,7 @@
let IterableOfE = () => (IterableOfE = dart.constFn(core.Iterable$(E)))();
class SkipIterable extends core.Iterable$(E) {
static new(iterable, count) {
- if (_internal.EfficientLength.is(iterable)) {
+ if (_internal.EfficientLengthIterable.is(iterable)) {
return new (EfficientLengthSkipIterableOfE())(iterable, count);
}
return new (SkipIterableOfE())._(iterable, count);
@@ -8072,6 +8199,7 @@
});
_internal.SkipIterable = SkipIterable();
_internal.EfficientLengthSkipIterable$ = dart.generic(E => {
+ let EfficientLengthIterableOfE = () => (EfficientLengthIterableOfE = dart.constFn(_internal.EfficientLengthIterable$(E)))();
class EfficientLengthSkipIterable extends _internal.SkipIterable$(E) {
new(iterable, skipCount) {
super._(iterable, skipCount);
@@ -8082,7 +8210,7 @@
return 0;
}
}
- EfficientLengthSkipIterable[dart.implements] = () => [_internal.EfficientLength];
+ EfficientLengthSkipIterable[dart.implements] = () => [EfficientLengthIterableOfE()];
dart.setSignature(EfficientLengthSkipIterable, {});
dart.defineExtensionMembers(EfficientLengthSkipIterable, ['length']);
return EfficientLengthSkipIterable;
@@ -8186,7 +8314,7 @@
let SetOfE = () => (SetOfE = dart.constFn(core.Set$(E)))();
let ETovoid = () => (ETovoid = dart.constFn(dart.functionType(dart.void, [E])))();
let ETobool = () => (ETobool = dart.constFn(dart.functionType(core.bool, [E])))();
- class EmptyIterable extends core.Iterable$(E) {
+ class EmptyIterable extends _internal.EfficientLengthIterable$(E) {
new() {
super.new();
}
@@ -8282,7 +8410,6 @@
return SetOfE().new();
}
}
- EmptyIterable[dart.implements] = () => [_internal.EfficientLength];
dart.setSignature(EmptyIterable, {
getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])}),
methods: () => ({singleWhere: dart.definiteFunctionType(E, [ETobool()], {orElse: VoidToE()})})
@@ -8671,79 +8798,6 @@
};
};
dart.lazyFn(_internal.makeFixedListUnmodifiable, () => ListOfEToListOfE());
- _internal.Lists = class Lists extends core.Object {
- static copy(src, srcStart, dst, dstStart, count) {
- if (dart.notNull(srcStart) < dart.notNull(dstStart)) {
- for (let i = dart.notNull(srcStart) + dart.notNull(count) - 1, j = dart.notNull(dstStart) + dart.notNull(count) - 1; i >= dart.notNull(srcStart); i--, j--) {
- dst[dartx._set](j, src[dartx._get](i));
- }
- } else {
- for (let i = srcStart, j = dstStart; dart.notNull(i) < dart.notNull(srcStart) + dart.notNull(count); i = dart.notNull(i) + 1, j = dart.notNull(j) + 1) {
- dst[dartx._set](j, src[dartx._get](i));
- }
- }
- }
- static areEqual(a, b) {
- if (core.identical(a, b)) return true;
- if (!core.List.is(b)) return false;
- let length = a[dartx.length];
- if (!dart.equals(length, dart.dload(b, 'length'))) return false;
- for (let i = 0; i < dart.notNull(length); i++) {
- if (!core.identical(a[dartx._get](i), dart.dindex(b, i))) return false;
- }
- return true;
- }
- static indexOf(a, element, startIndex, endIndex) {
- if (dart.notNull(startIndex) >= dart.notNull(a[dartx.length])) {
- return -1;
- }
- if (dart.notNull(startIndex) < 0) {
- startIndex = 0;
- }
- for (let i = startIndex; dart.notNull(i) < dart.notNull(endIndex); i = dart.notNull(i) + 1) {
- if (dart.equals(a[dartx._get](i), element)) {
- return i;
- }
- }
- return -1;
- }
- static lastIndexOf(a, element, startIndex) {
- if (dart.notNull(startIndex) < 0) {
- return -1;
- }
- if (dart.notNull(startIndex) >= dart.notNull(a[dartx.length])) {
- startIndex = dart.notNull(a[dartx.length]) - 1;
- }
- for (let i = startIndex; dart.notNull(i) >= 0; i = dart.notNull(i) - 1) {
- if (dart.equals(a[dartx._get](i), element)) {
- return i;
- }
- }
- return -1;
- }
- static indicesCheck(a, start, end) {
- core.RangeError.checkValidRange(start, end, a[dartx.length]);
- }
- static rangeCheck(a, start, length) {
- core.RangeError.checkNotNegative(length);
- core.RangeError.checkNotNegative(start);
- if (dart.notNull(start) + dart.notNull(length) > dart.notNull(a[dartx.length])) {
- let message = dart.str`${start} + ${length} must be in the range [0..${a[dartx.length]}]`;
- dart.throw(new core.RangeError.range(length, 0, dart.notNull(a[dartx.length]) - dart.notNull(start), "length", message));
- }
- }
- };
- dart.setSignature(_internal.Lists, {
- statics: () => ({
- copy: dart.definiteFunctionType(dart.void, [core.List, core.int, core.List, core.int, core.int]),
- areEqual: dart.definiteFunctionType(core.bool, [core.List, dart.dynamic]),
- indexOf: dart.definiteFunctionType(core.int, [core.List, core.Object, core.int, core.int]),
- lastIndexOf: dart.definiteFunctionType(core.int, [core.List, core.Object, core.int]),
- indicesCheck: dart.definiteFunctionType(dart.void, [core.List, core.int, core.int]),
- rangeCheck: dart.definiteFunctionType(dart.void, [core.List, core.int, core.int])
- }),
- names: ['copy', 'areEqual', 'indexOf', 'lastIndexOf', 'indicesCheck', 'rangeCheck']
- });
_internal.printToZone = null;
_internal.printToConsole = function(line) {
_js_primitives.printString(dart.str`${line}`);
@@ -8989,27 +9043,18 @@
names: ['sort', 'sortRange', '_doSort', '_insertionSort', '_dualPivotQuicksort']
});
_internal.Sort._INSERTION_SORT_THRESHOLD = 32;
- const _name$ = Symbol('_name');
- const _nativeSymbol = Symbol('_nativeSymbol');
_internal.Symbol = class Symbol extends core.Object {
new(name) {
this[_name$] = name;
- this[_nativeSymbol] = null;
- }
- es6(name, nativeSymbol) {
- this[_name$] = name;
- this[_nativeSymbol] = nativeSymbol;
}
unvalidated(name) {
this[_name$] = name;
- this[_nativeSymbol] = null;
}
validated(name) {
this[_name$] = _internal.Symbol.validatePublicSymbol(name);
- this[_nativeSymbol] = null;
}
['=='](other) {
- return _internal.Symbol.is(other) && this[_name$] == other[_name$] && dart.equals(this[_nativeSymbol], other[_nativeSymbol]);
+ return _internal.Symbol.is(other) && this[_name$] == other[_name$];
}
get hashCode() {
let hash = this._hashCode;
@@ -9025,9 +9070,6 @@
static getName(symbol) {
return symbol[_name$];
}
- static getNativeSymbol(symbol) {
- return symbol[_nativeSymbol];
- }
static validatePublicSymbol(name) {
if (dart.test(name[dartx.isEmpty]) || dart.test(_internal.Symbol.publicSymbolPattern.hasMatch(name))) return name;
if (dart.test(name[dartx.startsWith]('_'))) {
@@ -9039,23 +9081,17 @@
return dart.test(name[dartx.isEmpty]) || dart.test(_internal.Symbol.symbolPattern.hasMatch(name));
}
};
- dart.defineNamedConstructor(_internal.Symbol, 'es6');
dart.defineNamedConstructor(_internal.Symbol, 'unvalidated');
dart.defineNamedConstructor(_internal.Symbol, 'validated');
_internal.Symbol[dart.implements] = () => [core.Symbol];
dart.setSignature(_internal.Symbol, {
- fields: () => ({
- [_name$]: core.String,
- [_nativeSymbol]: dart.dynamic
- }),
- methods: () => ({'==': dart.definiteFunctionType(core.bool, [core.Object])}),
+ fields: () => ({[_name$]: core.String}),
statics: () => ({
getName: dart.definiteFunctionType(core.String, [_internal.Symbol]),
- getNativeSymbol: dart.definiteFunctionType(dart.dynamic, [_internal.Symbol]),
validatePublicSymbol: dart.definiteFunctionType(core.String, [core.String]),
isValidSymbol: dart.definiteFunctionType(core.bool, [core.String])
}),
- names: ['getName', 'getNativeSymbol', 'validatePublicSymbol', 'isValidSymbol']
+ names: ['getName', 'validatePublicSymbol', 'isValidSymbol']
});
_internal.Symbol.reservedWordRE = '(?:assert|break|c(?:a(?:se|tch)|lass|on(?:st|tinue))|d(?:efault|o)|' + 'e(?:lse|num|xtends)|f(?:alse|inal(?:ly)?|or)|i[fns]|n(?:ew|ull)|' + 'ret(?:hrow|urn)|s(?:uper|witch)|t(?:h(?:is|row)|r(?:ue|y))|' + 'v(?:ar|oid)|w(?:hile|ith))';
_internal.Symbol.operatorRE = '(?:[\\-+*/%&|^]|\\[\\]=?|==|~/?|<[<=]?|>[>=]?|unary-)';
@@ -9238,8 +9274,8 @@
this.weakPorts = SetOfint().new();
this.isolateStatics = _foreign_helper.JS_CREATE_ISOLATE();
this.controlPort = new _isolate_helper.RawReceivePortImpl._controlPort();
- this.pauseCapability = isolate.Capability.new();
- this.terminateCapability = isolate.Capability.new();
+ this.pauseCapability = isolate$.Capability.new();
+ this.terminateCapability = isolate$.Capability.new();
this.delayedEvents = JSArrayOf_IsolateEvent().of([]);
this.pauseTokens = SetOfCapability().new();
this.errorPorts = SetOfSendPort().new();
@@ -9286,7 +9322,7 @@
this.errorsAreFatal = errorsAreFatal;
}
handlePing(responsePort, pingType) {
- if (pingType == isolate.Isolate.IMMEDIATE || pingType == isolate.Isolate.BEFORE_NEXT_EVENT && !dart.test(this[_isExecutingEvent])) {
+ if (pingType == isolate$.Isolate.IMMEDIATE || pingType == isolate$.Isolate.BEFORE_NEXT_EVENT && !dart.test(this[_isExecutingEvent])) {
responsePort.send(null);
return;
}
@@ -9294,11 +9330,7 @@
responsePort.send(null);
}
dart.fn(respond, VoidTovoid$());
- if (pingType == isolate.Isolate.AS_EVENT) {
- _isolate_helper._globalState.topEventLoop.enqueue(this, respond, "ping");
- return;
- }
- dart.assert(pingType == isolate.Isolate.BEFORE_NEXT_EVENT);
+ dart.assert(pingType == isolate$.Isolate.BEFORE_NEXT_EVENT);
if (this[_scheduledControlEvents] == null) {
this[_scheduledControlEvents] = collection.Queue.new();
}
@@ -9306,15 +9338,11 @@
}
handleKill(authentification, priority) {
if (!dart.equals(this.terminateCapability, authentification)) return;
- if (priority == isolate.Isolate.IMMEDIATE || priority == isolate.Isolate.BEFORE_NEXT_EVENT && !dart.test(this[_isExecutingEvent])) {
+ if (priority == isolate$.Isolate.IMMEDIATE || priority == isolate$.Isolate.BEFORE_NEXT_EVENT && !dart.test(this[_isExecutingEvent])) {
this.kill();
return;
}
- if (priority == isolate.Isolate.AS_EVENT) {
- _isolate_helper._globalState.topEventLoop.enqueue(this, dart.bind(this, 'kill'), "kill");
- return;
- }
- dart.assert(priority == isolate.Isolate.BEFORE_NEXT_EVENT);
+ dart.assert(priority == isolate$.Isolate.BEFORE_NEXT_EVENT);
if (this[_scheduledControlEvents] == null) {
this[_scheduledControlEvents] = collection.Queue.new();
}
@@ -9382,47 +9410,47 @@
switch (dart.dindex(message, 0)) {
case "pause":
{
- this.addPause(isolate.Capability._check(dart.dindex(message, 1)), isolate.Capability._check(dart.dindex(message, 2)));
+ this.addPause(isolate$.Capability._check(dart.dindex(message, 1)), isolate$.Capability._check(dart.dindex(message, 2)));
break;
}
case "resume":
{
- this.removePause(isolate.Capability._check(dart.dindex(message, 1)));
+ this.removePause(isolate$.Capability._check(dart.dindex(message, 1)));
break;
}
case 'add-ondone':
{
- this.addDoneListener(isolate.SendPort._check(dart.dindex(message, 1)));
+ this.addDoneListener(isolate$.SendPort._check(dart.dindex(message, 1)));
break;
}
case 'remove-ondone':
{
- this.removeDoneListener(isolate.SendPort._check(dart.dindex(message, 1)));
+ this.removeDoneListener(isolate$.SendPort._check(dart.dindex(message, 1)));
break;
}
case 'set-errors-fatal':
{
- this.setErrorsFatal(isolate.Capability._check(dart.dindex(message, 1)), core.bool._check(dart.dindex(message, 2)));
+ this.setErrorsFatal(isolate$.Capability._check(dart.dindex(message, 1)), core.bool._check(dart.dindex(message, 2)));
break;
}
case "ping":
{
- this.handlePing(isolate.SendPort._check(dart.dindex(message, 1)), core.int._check(dart.dindex(message, 2)));
+ this.handlePing(isolate$.SendPort._check(dart.dindex(message, 1)), core.int._check(dart.dindex(message, 2)));
break;
}
case "kill":
{
- this.handleKill(isolate.Capability._check(dart.dindex(message, 1)), core.int._check(dart.dindex(message, 2)));
+ this.handleKill(isolate$.Capability._check(dart.dindex(message, 1)), core.int._check(dart.dindex(message, 2)));
break;
}
case "getErrors":
{
- this.addErrorListener(isolate.SendPort._check(dart.dindex(message, 1)));
+ this.addErrorListener(isolate$.SendPort._check(dart.dindex(message, 1)));
break;
}
case "stopErrors":
{
- this.removeErrorListener(isolate.SendPort._check(dart.dindex(message, 1)));
+ this.removeErrorListener(isolate$.SendPort._check(dart.dindex(message, 1)));
break;
}
default:
@@ -9465,7 +9493,7 @@
this.errorPorts.clear();
if (this.doneHandlers != null) {
for (let port of core.Iterable._check(this.doneHandlers)) {
- isolate.SendPort._check(port);
+ isolate$.SendPort._check(port);
port.send(null);
}
this.doneHandlers = null;
@@ -9485,8 +9513,8 @@
weakPorts: SetOfint(),
isolateStatics: dart.dynamic,
controlPort: _isolate_helper.RawReceivePortImpl,
- pauseCapability: isolate.Capability,
- terminateCapability: isolate.Capability,
+ pauseCapability: isolate$.Capability,
+ terminateCapability: isolate$.Capability,
initialized: core.bool,
isPaused: core.bool,
delayedEvents: ListOf_IsolateEvent(),
@@ -9498,15 +9526,15 @@
errorPorts: SetOfSendPort()
}),
methods: () => ({
- addPause: dart.definiteFunctionType(dart.void, [isolate.Capability, isolate.Capability]),
- removePause: dart.definiteFunctionType(dart.void, [isolate.Capability]),
- addDoneListener: dart.definiteFunctionType(dart.void, [isolate.SendPort]),
- removeDoneListener: dart.definiteFunctionType(dart.void, [isolate.SendPort]),
- setErrorsFatal: dart.definiteFunctionType(dart.void, [isolate.Capability, core.bool]),
- handlePing: dart.definiteFunctionType(dart.void, [isolate.SendPort, core.int]),
- handleKill: dart.definiteFunctionType(dart.void, [isolate.Capability, core.int]),
- addErrorListener: dart.definiteFunctionType(dart.void, [isolate.SendPort]),
- removeErrorListener: dart.definiteFunctionType(dart.void, [isolate.SendPort]),
+ addPause: dart.definiteFunctionType(dart.void, [isolate$.Capability, isolate$.Capability]),
+ removePause: dart.definiteFunctionType(dart.void, [isolate$.Capability]),
+ addDoneListener: dart.definiteFunctionType(dart.void, [isolate$.SendPort]),
+ removeDoneListener: dart.definiteFunctionType(dart.void, [isolate$.SendPort]),
+ setErrorsFatal: dart.definiteFunctionType(dart.void, [isolate$.Capability, core.bool]),
+ handlePing: dart.definiteFunctionType(dart.void, [isolate$.SendPort, core.int]),
+ handleKill: dart.definiteFunctionType(dart.void, [isolate$.Capability, core.int]),
+ addErrorListener: dart.definiteFunctionType(dart.void, [isolate$.SendPort]),
+ removeErrorListener: dart.definiteFunctionType(dart.void, [isolate$.SendPort]),
handleUncaughtError: dart.definiteFunctionType(dart.void, [dart.dynamic, core.StackTrace]),
eval: dart.definiteFunctionType(dart.dynamic, [core.Function]),
[_setGlobals]: dart.definiteFunctionType(dart.void, []),
@@ -9707,7 +9735,7 @@
let replyTo = _isolate_helper._deserializeMessage(dart.dindex(msg, 'replyTo'));
let context = new _isolate_helper._IsolateContext();
_isolate_helper._globalState.topEventLoop.enqueue(context, dart.fn(() => {
- _isolate_helper.IsolateNatives._startIsolate(entryPoint, ListOfString()._check(args), message, core.bool._check(isSpawnUri), core.bool._check(startPaused), isolate.SendPort._check(replyTo));
+ _isolate_helper.IsolateNatives._startIsolate(entryPoint, ListOfString()._check(args), message, core.bool._check(isSpawnUri), core.bool._check(startPaused), isolate$.SendPort._check(replyTo));
}, VoidToNull()), 'worker-start');
_isolate_helper._globalState.currentContext = context;
_isolate_helper._globalState.topEventLoop.run();
@@ -9720,7 +9748,7 @@
}
case 'message':
{
- let port = isolate.SendPort._check(dart.dindex(msg, 'port'));
+ let port = isolate$.SendPort._check(dart.dindex(msg, 'port'));
if (port != null) {
dart.dsend(dart.dindex(msg, 'port'), 'send', dart.dindex(msg, 'msg'));
}
@@ -9808,7 +9836,7 @@
if (uri != null && dart.test(uri[dartx.endsWith](".dart"))) {
uri = dart.notNull(uri) + ".js";
}
- let port = isolate.ReceivePort.new();
+ let port = isolate$.ReceivePort.new();
let completer = CompleterOfList().new();
port.first.then(dart.dynamic)(dart.fn(msg => {
if (dart.equals(dart.dindex(msg, 0), _isolate_helper._SPAWNED_SIGNAL)) {
@@ -9847,7 +9875,7 @@
}
static get currentIsolate() {
let context = _isolate_helper._IsolateContext._check(_foreign_helper.JS_CURRENT_ISOLATE_CONTEXT());
- return new isolate.Isolate(context.controlPort.sendPort, {pauseCapability: context.pauseCapability, terminateCapability: context.terminateCapability});
+ return new isolate$.Isolate(context.controlPort.sendPort, {pauseCapability: context.pauseCapability, terminateCapability: context.terminateCapability});
}
static _startIsolate(topLevel, args, message, isSpawnUri, startPaused, replyTo) {
let context = _isolate_helper._IsolateContext._check(_foreign_helper.JS_CURRENT_ISOLATE_CONTEXT());
@@ -9925,10 +9953,10 @@
spawnFunction: dart.definiteFunctionType(async.Future$(core.List), [dynamicTovoid(), dart.dynamic, core.bool]),
spawnUri: dart.definiteFunctionType(async.Future$(core.List), [core.Uri, ListOfString(), dart.dynamic, core.bool]),
spawn: dart.definiteFunctionType(async.Future$(core.List), [core.String, core.String, ListOfString(), dart.dynamic, core.bool, core.bool, core.bool]),
- _startWorker: dart.definiteFunctionType(dart.void, [core.String, core.String, ListOfString(), dart.dynamic, core.bool, core.bool, isolate.SendPort, StringTovoid()]),
- _startNonWorker: dart.definiteFunctionType(dart.void, [core.String, core.String, ListOfString(), dart.dynamic, core.bool, core.bool, isolate.SendPort]),
- _startIsolate: dart.definiteFunctionType(dart.void, [core.Function, ListOfString(), dart.dynamic, core.bool, core.bool, isolate.SendPort]),
- _spawnWorker: dart.definiteFunctionType(dart.void, [dart.dynamic, core.String, ListOfString(), dart.dynamic, core.bool, core.bool, isolate.SendPort, StringTovoid()]),
+ _startWorker: dart.definiteFunctionType(dart.void, [core.String, core.String, ListOfString(), dart.dynamic, core.bool, core.bool, isolate$.SendPort, StringTovoid()]),
+ _startNonWorker: dart.definiteFunctionType(dart.void, [core.String, core.String, ListOfString(), dart.dynamic, core.bool, core.bool, isolate$.SendPort]),
+ _startIsolate: dart.definiteFunctionType(dart.void, [core.Function, ListOfString(), dart.dynamic, core.bool, core.bool, isolate$.SendPort]),
+ _spawnWorker: dart.definiteFunctionType(dart.void, [dart.dynamic, core.String, ListOfString(), dart.dynamic, core.bool, core.bool, isolate$.SendPort, StringTovoid()]),
workerOnError: dart.definiteFunctionType(core.bool, [dart.dynamic, core.String, StringTovoid()])
}),
names: ['computeThisScript', 'computeThisScriptJsshell', 'computeThisScriptD8', 'computeThisScriptFromTrace', '_getEventData', '_processWorkerMessage', 'handleSpawnWorkerRequest', '_log', '_consoleLog', '_getJSFunctionFromName', '_getJSFunctionName', '_allocate', 'spawnFunction', 'spawnUri', 'spawn', '_startWorker', '_startNonWorker', '_startIsolate', '_spawnWorker', 'workerOnError']
@@ -9955,10 +9983,10 @@
}
}
};
- _isolate_helper._BaseSendPort[dart.implements] = () => [isolate.SendPort];
+ _isolate_helper._BaseSendPort[dart.implements] = () => [isolate$.SendPort];
dart.setSignature(_isolate_helper._BaseSendPort, {
fields: () => ({[_isolateId]: core.int}),
- methods: () => ({[_checkReplyTo]: dart.definiteFunctionType(dart.void, [isolate.SendPort])})
+ methods: () => ({[_checkReplyTo]: dart.definiteFunctionType(dart.void, [isolate$.SendPort])})
});
const _receivePort = Symbol('_receivePort');
const _isClosed = Symbol('_isClosed');
@@ -9990,7 +10018,7 @@
return this[_receivePort][_id];
}
};
- _isolate_helper._NativeJsSendPort[dart.implements] = () => [isolate.SendPort];
+ _isolate_helper._NativeJsSendPort[dart.implements] = () => [isolate$.SendPort];
dart.setSignature(_isolate_helper._NativeJsSendPort, {
fields: () => ({[_receivePort]: _isolate_helper.RawReceivePortImpl}),
methods: () => ({send: dart.definiteFunctionType(dart.void, [dart.dynamic])})
@@ -10021,7 +10049,7 @@
return (dart.notNull(this[_workerId]) << 16 ^ dart.notNull(this[_isolateId]) << 8 ^ dart.notNull(this[_receivePortId])) >>> 0;
}
};
- _isolate_helper._WorkerSendPort[dart.implements] = () => [isolate.SendPort];
+ _isolate_helper._WorkerSendPort[dart.implements] = () => [isolate$.SendPort];
dart.setSignature(_isolate_helper._WorkerSendPort, {
fields: () => ({
[_workerId]: core.int,
@@ -10079,14 +10107,14 @@
};
dart.defineNamedConstructor(_isolate_helper.RawReceivePortImpl, 'weak');
dart.defineNamedConstructor(_isolate_helper.RawReceivePortImpl, '_controlPort');
- _isolate_helper.RawReceivePortImpl[dart.implements] = () => [isolate.RawReceivePort];
+ _isolate_helper.RawReceivePortImpl[dart.implements] = () => [isolate$.RawReceivePort];
dart.setSignature(_isolate_helper.RawReceivePortImpl, {
fields: () => ({
[_id]: core.int,
[_handler]: core.Function,
[_isClosed]: core.bool
}),
- getters: () => ({sendPort: dart.definiteFunctionType(isolate.SendPort, [])}),
+ getters: () => ({sendPort: dart.definiteFunctionType(isolate$.SendPort, [])}),
setters: () => ({handler: dart.definiteFunctionType(dart.void, [core.Function])}),
methods: () => ({
[_close]: dart.definiteFunctionType(dart.void, []),
@@ -10232,7 +10260,8 @@
}, VoidToNull()), onCancel: dart.fn(() => {
if (timer != null) timer.cancel();
timer = null;
- }, VoidToNull())});
+ return async.Future._nullFuture;
+ }, VoidTo_Future())});
return controller.stream;
}
static eventTransformed(source, mapSink) {
@@ -10291,9 +10320,7 @@
subscription.pause();
}, VoidToNull()), onResume: dart.fn(() => {
subscription.resume();
- }, VoidToNull()), onCancel: dart.fn(() => {
- subscription.cancel();
- }, VoidToNull()), sync: true});
+ }, VoidToNull()), onCancel: dart.fn(() => subscription.cancel(), VoidToFuture()), sync: true});
}
return controller.stream;
};
@@ -10331,9 +10358,7 @@
subscription.pause();
}, VoidToNull()), onResume: dart.fn(() => {
subscription.resume();
- }, VoidToNull()), onCancel: dart.fn(() => {
- subscription.cancel();
- }, VoidToNull()), sync: true});
+ }, VoidToNull()), onCancel: dart.fn(() => subscription.cancel(), VoidToFuture()), sync: true});
}
return controller.stream;
};
@@ -10864,13 +10889,13 @@
dart.addSimpleTypeTests(_isolate_helper.ReceivePortImpl);
dart.defineNamedConstructor(_isolate_helper.ReceivePortImpl, 'weak');
dart.defineNamedConstructor(_isolate_helper.ReceivePortImpl, 'fromRawReceivePort');
- _isolate_helper.ReceivePortImpl[dart.implements] = () => [isolate.ReceivePort];
+ _isolate_helper.ReceivePortImpl[dart.implements] = () => [isolate$.ReceivePort];
dart.setSignature(_isolate_helper.ReceivePortImpl, {
fields: () => ({
- [_rawPort]: isolate.RawReceivePort,
+ [_rawPort]: isolate$.RawReceivePort,
[_controller]: async.StreamController
}),
- getters: () => ({sendPort: dart.definiteFunctionType(isolate.SendPort, [])}),
+ getters: () => ({sendPort: dart.definiteFunctionType(isolate$.SendPort, [])}),
methods: () => ({
listen: dart.definiteFunctionType(async.StreamSubscription, [dynamicTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool}),
close: dart.definiteFunctionType(dart.void, [])
@@ -10983,7 +11008,7 @@
}
};
dart.defineNamedConstructor(_isolate_helper.CapabilityImpl, '_internal');
- _isolate_helper.CapabilityImpl[dart.implements] = () => [isolate.Capability];
+ _isolate_helper.CapabilityImpl[dart.implements] = () => [isolate$.Capability];
dart.setSignature(_isolate_helper.CapabilityImpl, {
fields: () => ({[_id]: core.int}),
methods: () => ({'==': dart.definiteFunctionType(core.bool, [core.Object])})
@@ -11021,7 +11046,7 @@
if (_js_helper.InternalMap.is(x)) return this.serializeMap(x);
if (_interceptors.JSObject.is(x)) return this.serializeJSObject(x);
if (_interceptors.Interceptor.is(x)) this.unsupported(x);
- if (isolate.RawReceivePort.is(x)) {
+ if (isolate$.RawReceivePort.is(x)) {
this.unsupported(x, "RawReceivePorts can't be transmitted:");
}
if (_isolate_helper._NativeJsSendPort.is(x)) return this.serializeJsSendPort(x);
@@ -11299,7 +11324,7 @@
}
deserializeRawSendPort(x) {
dart.assert(dart.equals(dart.dindex(x, 0), 'raw sendport'));
- let result = isolate.SendPort._check(dart.dindex(x, 1));
+ let result = isolate$.SendPort._check(dart.dindex(x, 1));
this.deserializedObjects[dartx.add](result);
return result;
}
@@ -11351,8 +11376,8 @@
deserializeMutable: dart.definiteFunctionType(core.List, [dart.dynamic]),
deserializeConst: dart.definiteFunctionType(core.List, [dart.dynamic]),
deserializeMap: dart.definiteFunctionType(core.Map, [_js_helper.InternalMap]),
- deserializeSendPort: dart.definiteFunctionType(isolate.SendPort, [dart.dynamic]),
- deserializeRawSendPort: dart.definiteFunctionType(isolate.SendPort, [dart.dynamic]),
+ deserializeSendPort: dart.definiteFunctionType(isolate$.SendPort, [dart.dynamic]),
+ deserializeRawSendPort: dart.definiteFunctionType(isolate$.SendPort, [dart.dynamic]),
deserializeJSObject: dart.definiteFunctionType(dart.dynamic, [dart.dynamic]),
deserializeClosure: dart.definiteFunctionType(core.Function, [dart.dynamic]),
deserializeDartObject: dart.definiteFunctionType(dart.dynamic, [dart.dynamic])
@@ -11389,6 +11414,11 @@
_js_embedded_names.TYPEDEF_PREDICATE_PROPERTY_NAME = "$$isTypedef";
_js_embedded_names.NATIVE_SUPERCLASS_TAG_NAME = "$nativeSuperclassTag";
_js_embedded_names.MAP_TYPE_TO_INTERCEPTOR = "mapTypeToInterceptor";
+ dart.defineLazy(_js_helper, {
+ get _identityHashCode() {
+ return Symbol("_identityHashCode");
+ }
+ });
_js_helper._Patch = class _Patch extends core.Object {
new() {
}
@@ -11408,10 +11438,10 @@
_js_helper.Primitives.mirrorInvokeCacheName = dart.notNull(_js_helper.Primitives.mirrorInvokeCacheName) + dart.str`_${id}`;
}
static objectHashCode(object) {
- let hash = object.$identityHash;
+ let hash = object[_js_helper._identityHashCode];
if (hash == null) {
hash = Math.random() * 0x3fffffff | 0;
- object.$identityHash = hash;
+ object[_js_helper._identityHashCode] = hash;
}
return hash;
}
@@ -12050,6 +12080,9 @@
new() {
super.new();
}
+ toString() {
+ return super.toString();
+ }
};
_js_helper.FallThroughErrorImplementation = class FallThroughErrorImplementation extends core.FallThroughError {
new() {
@@ -12072,13 +12105,18 @@
fields: () => ({message: dart.dynamic})
});
core.AssertionError = class AssertionError extends core.Error {
- new() {
+ new(message) {
+ if (message === void 0) message = null;
+ this.message = message;
super.new();
}
toString() {
return "Assertion failed";
}
};
+ dart.setSignature(core.AssertionError, {
+ fields: () => ({message: core.Object})
+ });
_js_helper.AssertionErrorWithMessage = class AssertionErrorWithMessage extends core.AssertionError {
new(message) {
this[_message] = message;
@@ -12683,7 +12721,7 @@
let LinkedHashMapKeyIteratorOfE = () => (LinkedHashMapKeyIteratorOfE = dart.constFn(_js_helper.LinkedHashMapKeyIterator$(E)))();
let ETovoid = () => (ETovoid = dart.constFn(dart.functionType(dart.void, [E])))();
let JsLinkedHashMapOfE$dynamic = () => (JsLinkedHashMapOfE$dynamic = dart.constFn(_js_helper.JsLinkedHashMap$(E, dart.dynamic)))();
- class LinkedHashMapKeyIterable extends core.Iterable$(E) {
+ class LinkedHashMapKeyIterable extends _internal.EfficientLengthIterable$(E) {
new(map) {
this[_map] = map;
super.new();
@@ -12712,7 +12750,6 @@
}
}
}
- LinkedHashMapKeyIterable[dart.implements] = () => [_internal.EfficientLength];
dart.setSignature(LinkedHashMapKeyIterable, {
fields: () => ({[_map]: JsLinkedHashMapOfE$dynamic()}),
getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])})
@@ -13383,7 +13420,11 @@
};
dart.lazyFn(_js_helper.isJsArray, () => dynamicTobool$());
_js_mirrors.getName = function(symbol) {
- return _internal.Symbol.getName(_internal.Symbol.as(symbol));
+ if (_internal.PrivateSymbol.is(symbol)) {
+ return _internal.PrivateSymbol.getName(symbol);
+ } else {
+ return _internal.Symbol.getName(_internal.Symbol.as(symbol));
+ }
};
dart.lazyFn(_js_mirrors.getName, () => SymbolToString());
_js_mirrors.getSymbol = function(name, library) {
@@ -13462,7 +13503,7 @@
});
_js_mirrors._Lazy = _Lazy();
_js_mirrors._getESSymbol = function(symbol) {
- return _internal.Symbol.getNativeSymbol(_internal.Symbol.as(symbol));
+ return _internal.PrivateSymbol.getNativeSymbol(symbol);
};
dart.lazyFn(_js_mirrors._getESSymbol, () => SymbolTodynamic());
_js_mirrors._getMember = function(symbol) {
@@ -13506,7 +13547,7 @@
dart.lazyFn(_js_mirrors._getNameForESSymbol, () => dynamicToString());
_js_mirrors._getSymbolForESSymbol = function(member) {
let name = _js_mirrors._getNameForESSymbol(member);
- return new _internal.Symbol.es6(name, member);
+ return new _internal.PrivateSymbol(name, member);
};
dart.lazyFn(_js_mirrors._getSymbolForESSymbol, () => dynamicToSymbol());
_js_mirrors._getSymbolForMember = function(member) {
@@ -13514,7 +13555,7 @@
return core.Symbol.new(member);
} else {
let name = _js_mirrors._getNameForESSymbol(member);
- return new _internal.Symbol.es6(name, member);
+ return new _internal.PrivateSymbol(name, member);
}
};
dart.lazyFn(_js_mirrors._getSymbolForMember, () => dynamicToSymbol());
@@ -13658,12 +13699,18 @@
};
_js_mirrors.JsIsolateMirror[dart.implements] = () => [mirrors.IsolateMirror];
_js_mirrors.JsLibraryDependencyMirror = class JsLibraryDependencyMirror extends _js_mirrors.JsMirror {
+ loadLibrary(...args) {
+ return FutureOfLibraryMirror()._check(this.noSuchMethod(new dart.InvocationImpl('loadLibrary', args, {isMethod: true})));
+ }
get isImport() {
return core.bool._check(this.noSuchMethod(new dart.InvocationImpl('isImport', [], {isGetter: true})));
}
get isExport() {
return core.bool._check(this.noSuchMethod(new dart.InvocationImpl('isExport', [], {isGetter: true})));
}
+ get isDeferred() {
+ return core.bool._check(this.noSuchMethod(new dart.InvocationImpl('isDeferred', [], {isGetter: true})));
+ }
get sourceLibrary() {
return mirrors.LibraryMirror._check(this.noSuchMethod(new dart.InvocationImpl('sourceLibrary', [], {isGetter: true})));
}
@@ -13694,6 +13741,9 @@
setField(...args) {
return mirrors.InstanceMirror._check(this.noSuchMethod(new dart.InvocationImpl('setField', args, {isMethod: true})));
}
+ delegate(...args) {
+ return this.noSuchMethod(new dart.InvocationImpl('delegate', args, {isMethod: true}));
+ }
};
_js_mirrors.JsObjectMirror[dart.implements] = () => [mirrors.ObjectMirror];
const _getAccessor = Symbol('_getAccessor');
@@ -13841,7 +13891,7 @@
let setters = _js_mirrors._getSetters(unwrapped);
setters[dartx.forEach](dart.fn((symbol, ft) => {
let name = dart.notNull(_js_mirrors.getName(symbol)) + '=';
- symbol = new _internal.Symbol.es6(name, _js_mirrors._getESSymbol(symbol));
+ symbol = new _internal.PrivateSymbol(name, _js_mirrors._getESSymbol(symbol));
this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._instanceMethod(this, symbol, ft));
}, SymbolAnddynamicToNull()));
let staticFields = _js_mirrors._getStaticFields(unwrapped);
@@ -13990,12 +14040,18 @@
get typeVariables() {
return ListOfTypeVariableMirror()._check(this.noSuchMethod(new dart.InvocationImpl('typeVariables', [], {isGetter: true})));
}
+ delegate(...args) {
+ return this.noSuchMethod(new dart.InvocationImpl('delegate', args, {isMethod: true}));
+ }
isSubclassOf(...args) {
return core.bool._check(this.noSuchMethod(new dart.InvocationImpl('isSubclassOf', args, {isMethod: true})));
}
get isAbstract() {
return core.bool._check(this.noSuchMethod(new dart.InvocationImpl('isAbstract', [], {isGetter: true})));
}
+ get isEnum() {
+ return core.bool._check(this.noSuchMethod(new dart.InvocationImpl('isEnum', [], {isGetter: true})));
+ }
get instanceMembers() {
return MapOfSymbol$MethodMirror()._check(this.noSuchMethod(new dart.InvocationImpl('instanceMembers', [], {isGetter: true})));
}
@@ -16801,9 +16857,9 @@
async._registerErrorHandler = function(R) {
return (errorHandler, zone) => {
if (async.ZoneBinaryCallback.is(errorHandler)) {
- return zone.registerBinaryCallback(dart.dynamic, dart.dynamic, core.StackTrace)(ZoneBinaryCallbackOfdynamic$dynamic$StackTrace().as(errorHandler));
+ return zone.registerBinaryCallback(R, dart.dynamic, core.StackTrace)(async.ZoneBinaryCallback$(R, dart.dynamic, core.StackTrace).as(errorHandler));
} else {
- return zone.registerUnaryCallback(dart.dynamic, dart.dynamic)(async.ZoneUnaryCallback.as(errorHandler));
+ return zone.registerUnaryCallback(R, dart.dynamic)(async.ZoneUnaryCallback$(R, dart.dynamic).as(errorHandler));
}
};
};
@@ -16957,7 +17013,6 @@
const _waitsForCancel = Symbol('_waitsForCancel');
const _canFire = Symbol('_canFire');
const _cancelOnError = Symbol('_cancelOnError');
- const _incrementPauseCount = Symbol('_incrementPauseCount');
const _sendData = Symbol('_sendData');
const _addPending = Symbol('_addPending');
const _sendError = Symbol('_sendError');
@@ -17002,7 +17057,7 @@
}
onError(handleError) {
if (handleError == null) handleError = async._nullErrorHandler;
- this[_onError] = async._registerErrorHandler(T)(handleError, this[_zone]);
+ this[_onError] = async._registerErrorHandler(dart.dynamic)(handleError, this[_zone]);
}
onDone(handleDone) {
if (handleDone == null) handleDone = async._nullDoneHandler;
@@ -17035,9 +17090,11 @@
}
cancel() {
this[_state] = (dart.notNull(this[_state]) & ~async._BufferingStreamSubscription._STATE_WAIT_FOR_CANCEL) >>> 0;
- if (dart.test(this[_isCanceled])) return this[_cancelFuture];
- this[_cancel]();
- return this[_cancelFuture];
+ if (!dart.test(this[_isCanceled])) {
+ this[_cancel]();
+ }
+ let l = this[_cancelFuture];
+ return l != null ? l : async.Future._nullFuture;
}
asFuture(E) {
return futureValue => {
@@ -17047,8 +17104,14 @@
result[_complete](futureValue);
}, VoidToNull());
this[_onError] = dart.fn((error, stackTrace) => {
- this.cancel();
- result[_completeError](error, core.StackTrace._check(stackTrace));
+ let cancelFuture = this.cancel();
+ if (!core.identical(cancelFuture, async.Future._nullFuture)) {
+ cancelFuture.whenComplete(dart.fn(() => {
+ result[_completeError](error, core.StackTrace._check(stackTrace));
+ }, VoidToNull()));
+ } else {
+ result[_completeError](error, core.StackTrace._check(stackTrace));
+ }
}, dynamicAnddynamicToNull());
return result;
};
@@ -17094,9 +17157,6 @@
if (!dart.test(this[_inCallback])) this[_pending] = null;
this[_cancelFuture] = this[_onCancel]();
}
- [_incrementPauseCount]() {
- this[_state] = (dart.notNull(this[_state]) + async._BufferingStreamSubscription._STATE_PAUSE_COUNT | async._BufferingStreamSubscription._STATE_INPUT_PAUSED) >>> 0;
- }
[_decrementPauseCount]() {
dart.assert(this[_isPaused]);
this[_state] = dart.notNull(this[_state]) - async._BufferingStreamSubscription._STATE_PAUSE_COUNT;
@@ -17183,7 +17243,7 @@
if (dart.test(this[_cancelOnError])) {
this[_state] = (dart.notNull(this[_state]) | async._BufferingStreamSubscription._STATE_WAIT_FOR_CANCEL) >>> 0;
this[_cancel]();
- if (async.Future.is(this[_cancelFuture])) {
+ if (async.Future.is(this[_cancelFuture]) && !core.identical(this[_cancelFuture], async.Future._nullFuture)) {
this[_cancelFuture].whenComplete(sendError);
} else {
sendError();
@@ -17206,7 +17266,7 @@
dart.fn(sendDone, VoidTovoid$());
this[_cancel]();
this[_state] = (dart.notNull(this[_state]) | async._BufferingStreamSubscription._STATE_WAIT_FOR_CANCEL) >>> 0;
- if (async.Future.is(this[_cancelFuture])) {
+ if (async.Future.is(this[_cancelFuture]) && !core.identical(this[_cancelFuture], async.Future._nullFuture)) {
this[_cancelFuture].whenComplete(sendDone);
} else {
sendDone();
@@ -17216,7 +17276,7 @@
dart.assert(!dart.test(this[_inCallback]));
let wasInputPaused = this[_isInputPaused];
this[_state] = (dart.notNull(this[_state]) | async._BufferingStreamSubscription._STATE_IN_CALLBACK) >>> 0;
- callback();
+ dart.dcall(callback);
this[_state] = (dart.notNull(this[_state]) & ~async._BufferingStreamSubscription._STATE_IN_CALLBACK) >>> 0;
this[_checkState](wasInputPaused);
}
@@ -17284,7 +17344,6 @@
cancel: dart.definiteFunctionType(async.Future, []),
asFuture: dart.definiteFunctionType(E => [async.Future$(E), [], [E]]),
[_cancel]: dart.definiteFunctionType(dart.void, []),
- [_incrementPauseCount]: dart.definiteFunctionType(dart.void, []),
[_decrementPauseCount]: dart.definiteFunctionType(dart.void, []),
[_add$]: dart.definiteFunctionType(dart.void, [T]),
[_addError]: dart.definiteFunctionType(dart.void, [core.Object, core.StackTrace]),
@@ -17296,7 +17355,7 @@
[_sendData]: dart.definiteFunctionType(dart.void, [T]),
[_sendError]: dart.definiteFunctionType(dart.void, [core.Object, core.StackTrace]),
[_sendDone]: dart.definiteFunctionType(dart.void, []),
- [_guardCallback]: dart.definiteFunctionType(dart.void, [VoidTovoid()]),
+ [_guardCallback]: dart.definiteFunctionType(dart.void, [dart.dynamic]),
[_checkState]: dart.definiteFunctionType(dart.void, [core.bool])
})
});
@@ -17311,7 +17370,6 @@
async._BufferingStreamSubscription._STATE_IN_CALLBACK = 32;
async._BufferingStreamSubscription._STATE_HAS_PENDING = 64;
async._BufferingStreamSubscription._STATE_PAUSE_COUNT = 128;
- async._BufferingStreamSubscription._STATE_PAUSE_COUNT_SHIFT = 7;
async._ControllerSubscription$ = dart.generic(T => {
let _StreamControllerLifecycleOfT = () => (_StreamControllerLifecycleOfT = dart.constFn(async._StreamControllerLifecycle$(T)))();
class _ControllerSubscription extends async._BufferingStreamSubscription$(T) {
@@ -18067,7 +18125,7 @@
result[_completeError](error, stackTrace);
}
}
- dart.fn(handleError, dynamicAnddynamicTovoid$());
+ dart.fn(handleError, dynamicAnddynamicToNull());
try {
for (let future of futures) {
let pos = remaining;
@@ -18213,7 +18271,7 @@
};
dart.fn(async._nonNullError, ObjectToObject());
async._FutureOnValue$ = dart.generic((S, T) => {
- const _FutureOnValue = dart.typedef('_FutureOnValue', () => dart.functionType(dart.dynamic, [S]));
+ const _FutureOnValue = dart.typedef('_FutureOnValue', () => dart.functionType(async.FutureOr$(T), [S]));
return _FutureOnValue;
});
async._FutureOnValue = _FutureOnValue();
@@ -18304,6 +18362,9 @@
const _whenCompleteAction = Symbol('_whenCompleteAction');
async._FutureListener$ = dart.generic((S, T) => {
let _FutureOnValueOfS$T = () => (_FutureOnValueOfS$T = dart.constFn(async._FutureOnValue$(S, T)))();
+ let FutureOrOfT = () => (FutureOrOfT = dart.constFn(async.FutureOr$(T)))();
+ let ZoneBinaryCallbackOfFutureOrOfT$Object$StackTrace = () => (ZoneBinaryCallbackOfFutureOrOfT$Object$StackTrace = dart.constFn(async.ZoneBinaryCallback$(FutureOrOfT(), core.Object, core.StackTrace)))();
+ let dynamicToFutureOrOfT = () => (dynamicToFutureOrOfT = dart.constFn(dart.functionType(FutureOrOfT(), [dart.dynamic])))();
let _FutureOfT = () => (_FutureOfT = dart.constFn(async._Future$(T)))();
class _FutureListener extends core.Object {
then(result, onValue, errorCallback) {
@@ -18363,7 +18424,7 @@
}
handleValue(sourceResult) {
S._check(sourceResult);
- return this[_zone].runUnary(dart.dynamic, S)(this[_onValue], sourceResult);
+ return this[_zone].runUnary(FutureOrOfT(), S)(this[_onValue], sourceResult);
}
matchesErrorTest(asyncError) {
if (!dart.test(this.hasErrorTest)) return true;
@@ -18373,10 +18434,10 @@
handleError(asyncError) {
dart.assert(dart.test(this.handlesError) && dart.test(this.hasErrorCallback));
if (async.ZoneBinaryCallback.is(this.errorCallback)) {
- let typedErrorCallback = ZoneBinaryCallbackOfObject$Object$StackTrace().as(this.errorCallback);
- return this[_zone].runBinary(core.Object, core.Object, core.StackTrace)(typedErrorCallback, asyncError.error, asyncError.stackTrace);
+ let typedErrorCallback = ZoneBinaryCallbackOfFutureOrOfT$Object$StackTrace().as(this.errorCallback);
+ return this[_zone].runBinary(FutureOrOfT(), core.Object, core.StackTrace)(typedErrorCallback, asyncError.error, asyncError.stackTrace);
} else {
- return this[_zone].runUnary(dart.dynamic, dart.dynamic)(dynamicTodynamic()._check(this.errorCallback), asyncError.error);
+ return this[_zone].runUnary(FutureOrOfT(), dart.dynamic)(dynamicToFutureOrOfT()._check(this.errorCallback), asyncError.error);
}
}
handleWhenComplete() {
@@ -18409,9 +18470,9 @@
hasErrorCallback: dart.definiteFunctionType(core.bool, [])
}),
methods: () => ({
- handleValue: dart.definiteFunctionType(dart.dynamic, [S]),
+ handleValue: dart.definiteFunctionType(async.FutureOr$(T), [S]),
matchesErrorTest: dart.definiteFunctionType(core.bool, [async.AsyncError]),
- handleError: dart.definiteFunctionType(dart.dynamic, [async.AsyncError]),
+ handleError: dart.definiteFunctionType(async.FutureOr$(T), [async.AsyncError]),
handleWhenComplete: dart.definiteFunctionType(dart.dynamic, [])
})
});
@@ -18512,7 +18573,7 @@
if (!core.identical(currentZone, async._ROOT_ZONE)) {
f = currentZone.registerUnaryCallback(async.FutureOr$(E), T)(f);
if (onError != null) {
- onError = async._registerErrorHandler(T)(onError, currentZone);
+ onError = async._registerErrorHandler(E)(onError, currentZone);
}
}
return this[_thenNoZoneRegistration](E)(f, onError);
@@ -18521,7 +18582,7 @@
[_thenNoZoneRegistration](E) {
return (f, onError) => {
let result = new (async._Future$(E))();
- this[_addListener](new (async._FutureListener$(T, E)).then(result, f, onError));
+ this[_addListener](new (async._FutureListener$(T, E)).then(result, async._FutureOnValue$(T, E)._check(f), onError));
return result;
};
}
@@ -19213,10 +19274,10 @@
});
async.StreamTransformer = StreamTransformer();
async.StreamIterator$ = dart.generic(T => {
- let _StreamIteratorImplOfT = () => (_StreamIteratorImplOfT = dart.constFn(async._StreamIteratorImpl$(T)))();
+ let _StreamIteratorOfT = () => (_StreamIteratorOfT = dart.constFn(async._StreamIterator$(T)))();
class StreamIterator extends core.Object {
static new(stream) {
- return new (_StreamIteratorImplOfT())(stream);
+ return new (_StreamIteratorOfT())(stream);
}
}
dart.addTypeTests(StreamIterator);
@@ -20084,36 +20145,6 @@
return _StreamImplEvents;
});
async._StreamImplEvents = _StreamImplEvents();
- const _unlink = Symbol('_unlink');
- const _insertBefore = Symbol('_insertBefore');
- async._BroadcastLinkedList = class _BroadcastLinkedList extends core.Object {
- new() {
- this[_next$] = null;
- this[_previous$] = null;
- }
- [_unlink]() {
- this[_previous$][_next$] = this[_next$];
- this[_next$][_previous$] = this[_previous$];
- this[_next$] = this[_previous$] = this;
- }
- [_insertBefore](newNext) {
- let newPrevious = newNext[_previous$];
- newPrevious[_next$] = this;
- newNext[_previous$] = this[_previous$];
- this[_previous$][_next$] = newNext;
- this[_previous$] = newPrevious;
- }
- };
- dart.setSignature(async._BroadcastLinkedList, {
- fields: () => ({
- [_next$]: async._BroadcastLinkedList,
- [_previous$]: async._BroadcastLinkedList
- }),
- methods: () => ({
- [_unlink]: dart.definiteFunctionType(dart.void, []),
- [_insertBefore]: dart.definiteFunctionType(dart.void, [async._BroadcastLinkedList])
- })
- });
async._BroadcastCallback$ = dart.generic(T => {
const _BroadcastCallback = dart.typedef('_BroadcastCallback', () => dart.functionType(dart.void, [async.StreamSubscription$(T)]));
return _BroadcastCallback;
@@ -20165,7 +20196,7 @@
}
}
cancel() {
- return null;
+ return async.Future._nullFuture;
}
asFuture(E) {
return futureValue => {
@@ -20341,7 +20372,7 @@
}
cancel() {
this[_stream][_cancelSubscription]();
- return null;
+ return async.Future._nullFuture;
}
get isPaused() {
return this[_stream][_isSubscriptionPaused];
@@ -20371,146 +20402,109 @@
return _BroadcastSubscriptionWrapper;
});
async._BroadcastSubscriptionWrapper = _BroadcastSubscriptionWrapper();
- const _current$1 = Symbol('_current');
- const _futureOrPrefetch = Symbol('_futureOrPrefetch');
- const _clear = Symbol('_clear');
- async._StreamIteratorImpl$ = dart.generic(T => {
+ const _stateData = Symbol('_stateData');
+ const _initializeOrDone = Symbol('_initializeOrDone');
+ async._StreamIterator$ = dart.generic(T => {
+ let StreamOfT = () => (StreamOfT = dart.constFn(async.Stream$(T)))();
+ let StreamSubscriptionOfT = () => (StreamSubscriptionOfT = dart.constFn(async.StreamSubscription$(T)))();
let StreamIteratorOfT = () => (StreamIteratorOfT = dart.constFn(async.StreamIterator$(T)))();
- class _StreamIteratorImpl extends core.Object {
+ class _StreamIterator extends core.Object {
new(stream) {
+ this[_stateData] = stream;
this[_subscription] = null;
- this[_current$1] = null;
- this[_futureOrPrefetch] = null;
- this[_state] = async._StreamIteratorImpl._STATE_FOUND;
- this[_subscription] = stream.listen(dart.bind(this, _onData), {onError: dart.bind(this, _onError), onDone: dart.bind(this, _onDone), cancelOnError: true});
+ this[_isPaused] = false;
}
get current() {
- return this[_current$1];
+ if (this[_subscription] != null && dart.test(this[_isPaused])) {
+ return T.as(this[_stateData]);
+ }
+ return null;
}
moveNext() {
- if (this[_state] == async._StreamIteratorImpl._STATE_DONE) {
- return new (_FutureOfbool()).immediate(false);
- }
- if (this[_state] == async._StreamIteratorImpl._STATE_MOVING) {
+ if (this[_subscription] != null) {
+ if (dart.test(this[_isPaused])) {
+ let future = new (_FutureOfbool())();
+ this[_stateData] = future;
+ this[_isPaused] = false;
+ this[_subscription].resume();
+ return future;
+ }
dart.throw(new core.StateError("Already waiting for next."));
}
- if (this[_state] == async._StreamIteratorImpl._STATE_FOUND) {
- this[_state] = async._StreamIteratorImpl._STATE_MOVING;
- this[_current$1] = null;
- let result = new (_FutureOfbool())();
- this[_futureOrPrefetch] = result;
- return result;
- } else {
- dart.assert(dart.notNull(this[_state]) >= async._StreamIteratorImpl._STATE_EXTRA_DATA);
- switch (this[_state]) {
- case async._StreamIteratorImpl._STATE_EXTRA_DATA:
- {
- this[_state] = async._StreamIteratorImpl._STATE_FOUND;
- this[_current$1] = T.as(this[_futureOrPrefetch]);
- this[_futureOrPrefetch] = null;
- this[_subscription].resume();
- return new (_FutureOfbool()).immediate(true);
- }
- case async._StreamIteratorImpl._STATE_EXTRA_ERROR:
- {
- let prefetch = async.AsyncError._check(this[_futureOrPrefetch]);
- this[_clear]();
- return new (_FutureOfbool()).immediateError(prefetch.error, prefetch.stackTrace);
- }
- case async._StreamIteratorImpl._STATE_EXTRA_DONE:
- {
- this[_clear]();
- return new (_FutureOfbool()).immediate(false);
- }
- }
- }
+ return this[_initializeOrDone]();
}
- [_clear]() {
- this[_subscription] = null;
- this[_futureOrPrefetch] = null;
- this[_current$1] = null;
- this[_state] = async._StreamIteratorImpl._STATE_DONE;
+ [_initializeOrDone]() {
+ dart.assert(this[_subscription] == null);
+ let stateData = this[_stateData];
+ if (stateData != null) {
+ let stream = StreamOfT().as(stateData);
+ this[_subscription] = stream.listen(dart.bind(this, _onData), {onError: dart.bind(this, _onError), onDone: dart.bind(this, _onDone), cancelOnError: true});
+ let future = new (_FutureOfbool())();
+ this[_stateData] = future;
+ return future;
+ }
+ return new (_FutureOfbool()).immediate(false);
}
cancel() {
- let subscription = this[_subscription];
- if (subscription == null) return null;
- if (this[_state] == async._StreamIteratorImpl._STATE_MOVING) {
- let hasNext = _FutureOfbool().as(this[_futureOrPrefetch]);
- this[_clear]();
- hasNext[_complete](false);
- } else {
- this[_clear]();
+ let subscription = StreamSubscriptionOfT()._check(this[_subscription]);
+ let stateData = this[_stateData];
+ this[_stateData] = null;
+ if (subscription != null) {
+ this[_subscription] = null;
+ if (!dart.test(this[_isPaused])) {
+ let future = _FutureOfbool().as(stateData);
+ future[_asyncComplete](false);
+ }
+ return subscription.cancel();
}
- return subscription.cancel();
+ return async.Future._nullFuture;
}
[_onData](data) {
T._check(data);
- if (this[_state] == async._StreamIteratorImpl._STATE_MOVING) {
- this[_current$1] = data;
- let hasNext = _FutureOfbool().as(this[_futureOrPrefetch]);
- this[_futureOrPrefetch] = null;
- this[_state] = async._StreamIteratorImpl._STATE_FOUND;
- hasNext[_complete](true);
- return;
- }
- this[_subscription].pause();
- dart.assert(this[_futureOrPrefetch] == null);
- this[_futureOrPrefetch] = data;
- this[_state] = async._StreamIteratorImpl._STATE_EXTRA_DATA;
+ dart.assert(this[_subscription] != null && !dart.test(this[_isPaused]));
+ let moveNextFuture = _FutureOfbool().as(this[_stateData]);
+ this[_stateData] = data;
+ this[_isPaused] = true;
+ moveNextFuture[_complete](true);
+ if (this[_subscription] != null && dart.test(this[_isPaused])) this[_subscription].pause();
}
[_onError](error, stackTrace) {
if (stackTrace === void 0) stackTrace = null;
- if (this[_state] == async._StreamIteratorImpl._STATE_MOVING) {
- let hasNext = _FutureOfbool().as(this[_futureOrPrefetch]);
- this[_clear]();
- hasNext[_completeError](error, stackTrace);
- return;
- }
- this[_subscription].pause();
- dart.assert(this[_futureOrPrefetch] == null);
- this[_futureOrPrefetch] = new async.AsyncError(error, stackTrace);
- this[_state] = async._StreamIteratorImpl._STATE_EXTRA_ERROR;
+ dart.assert(this[_subscription] != null && !dart.test(this[_isPaused]));
+ let moveNextFuture = _FutureOfbool().as(this[_stateData]);
+ this[_subscription] = null;
+ this[_stateData] = null;
+ moveNextFuture[_completeError](error, stackTrace);
}
[_onDone]() {
- if (this[_state] == async._StreamIteratorImpl._STATE_MOVING) {
- let hasNext = _FutureOfbool().as(this[_futureOrPrefetch]);
- this[_clear]();
- hasNext[_complete](false);
- return;
- }
- this[_subscription].pause();
- this[_futureOrPrefetch] = null;
- this[_state] = async._StreamIteratorImpl._STATE_EXTRA_DONE;
+ dart.assert(this[_subscription] != null && !dart.test(this[_isPaused]));
+ let moveNextFuture = _FutureOfbool().as(this[_stateData]);
+ this[_subscription] = null;
+ this[_stateData] = null;
+ moveNextFuture[_complete](false);
}
}
- dart.addTypeTests(_StreamIteratorImpl);
- _StreamIteratorImpl[dart.implements] = () => [StreamIteratorOfT()];
- dart.setSignature(_StreamIteratorImpl, {
+ dart.addTypeTests(_StreamIterator);
+ _StreamIterator[dart.implements] = () => [StreamIteratorOfT()];
+ dart.setSignature(_StreamIterator, {
fields: () => ({
[_subscription]: async.StreamSubscription,
- [_current$1]: T,
- [_futureOrPrefetch]: dart.dynamic,
- [_state]: core.int
+ [_stateData]: core.Object,
+ [_isPaused]: core.bool
}),
getters: () => ({current: dart.definiteFunctionType(T, [])}),
methods: () => ({
moveNext: dart.definiteFunctionType(async.Future$(core.bool), []),
- [_clear]: dart.definiteFunctionType(dart.void, []),
+ [_initializeOrDone]: dart.definiteFunctionType(async.Future$(core.bool), []),
cancel: dart.definiteFunctionType(async.Future, []),
[_onData]: dart.definiteFunctionType(dart.void, [T]),
[_onError]: dart.definiteFunctionType(dart.void, [core.Object], [core.StackTrace]),
[_onDone]: dart.definiteFunctionType(dart.void, [])
})
});
- return _StreamIteratorImpl;
+ return _StreamIterator;
});
- async._StreamIteratorImpl = _StreamIteratorImpl();
- async._StreamIteratorImpl._STATE_FOUND = 0;
- async._StreamIteratorImpl._STATE_DONE = 1;
- async._StreamIteratorImpl._STATE_MOVING = 2;
- async._StreamIteratorImpl._STATE_EXTRA_DATA = 3;
- async._StreamIteratorImpl._STATE_EXTRA_ERROR = 4;
- async._StreamIteratorImpl._STATE_EXTRA_DONE = 5;
+ async._StreamIterator = _StreamIterator();
async._EmptyStream$ = dart.generic(T => {
let _DoneStreamSubscriptionOfT = () => (_DoneStreamSubscriptionOfT = dart.constFn(async._DoneStreamSubscription$(T)))();
let TTovoid = () => (TTovoid = dart.constFn(dart.functionType(dart.void, [T])))();
@@ -20553,7 +20547,7 @@
dart.lazyFn(async._runUserCode, () => FnAndFnAndFnTodynamic());
async._cancelAndError = function(subscription, future, error, stackTrace) {
let cancelFuture = subscription.cancel();
- if (async.Future.is(cancelFuture)) {
+ if (async.Future.is(cancelFuture) && !core.identical(cancelFuture, async.Future._nullFuture)) {
cancelFuture.whenComplete(dart.fn(() => future[_completeError](error, stackTrace), VoidTovoid$()));
} else {
future[_completeError](error, stackTrace);
@@ -20578,7 +20572,7 @@
dart.fn(async._cancelAndErrorClosure, StreamSubscriptionAnd_FutureTo_ErrorCallback());
async._cancelAndValue = function(subscription, future, value) {
let cancelFuture = subscription.cancel();
- if (async.Future.is(cancelFuture)) {
+ if (async.Future.is(cancelFuture) && !core.identical(cancelFuture, async.Future._nullFuture)) {
cancelFuture.whenComplete(dart.fn(() => future[_complete](value), VoidTovoid$()));
} else {
future[_complete](value);
@@ -20861,6 +20855,7 @@
async._HandleErrorStream = _HandleErrorStream();
const _count = Symbol('_count');
async._TakeStream$ = dart.generic(T => {
+ let _DoneStreamSubscriptionOfT = () => (_DoneStreamSubscriptionOfT = dart.constFn(async._DoneStreamSubscription$(T)))();
let _StateStreamSubscriptionOfT = () => (_StateStreamSubscriptionOfT = dart.constFn(async._StateStreamSubscription$(T)))();
let _EventSinkOfT = () => (_EventSinkOfT = dart.constFn(async._EventSink$(T)))();
let TTovoid = () => (TTovoid = dart.constFn(dart.functionType(dart.void, [T])))();
@@ -20871,6 +20866,10 @@
if (!(typeof count == 'number')) dart.throw(new core.ArgumentError(count));
}
[_createSubscription](onData, onError, onDone, cancelOnError) {
+ if (this[_count] == 0) {
+ this[_source$].listen(null).cancel();
+ return new (_DoneStreamSubscriptionOfT())(onDone);
+ }
return new (_StateStreamSubscriptionOfT())(this, onData, onError, onDone, cancelOnError, this[_count]);
}
[_handleData](inputEvent, sink) {
@@ -21173,7 +21172,7 @@
if (dart.test(this[_isSubscribed])) {
let subscription = this[_subscription];
this[_subscription] = null;
- subscription.cancel();
+ return subscription.cancel();
}
return null;
}
@@ -22477,8 +22476,8 @@
if (onError != null) {
errorHandler = dart.fn((self, parent, zone, error, stackTrace) => {
try {
- if (ZoneBinaryCallbackOfdynamic$dynamic$StackTrace().is(onError)) {
- return R.as(self.parent.runBinary(dart.dynamic, dart.dynamic, core.StackTrace)(onError, error, stackTrace));
+ if (async.ZoneBinaryCallback$(R, dart.dynamic, core.StackTrace).is(onError)) {
+ return self.parent.runBinary(R, dart.dynamic, core.StackTrace)(onError, error, stackTrace);
}
return self.parent.runUnary(dart.dynamic, dart.dynamic)(dynamicTodynamic()._check(onError), error);
} catch (e) {
@@ -22940,7 +22939,7 @@
let _HashMapKeyIteratorOfE = () => (_HashMapKeyIteratorOfE = dart.constFn(collection._HashMapKeyIterator$(E)))();
let ETovoid = () => (ETovoid = dart.constFn(dart.functionType(dart.void, [E])))();
let _HashMapOfE$dynamic = () => (_HashMapOfE$dynamic = dart.constFn(collection._HashMap$(E, dart.dynamic)))();
- class _HashMapKeyIterable extends core.Iterable$(E) {
+ class _HashMapKeyIterable extends _internal.EfficientLengthIterable$(E) {
new(map) {
this[_map$0] = map;
super.new();
@@ -22967,7 +22966,6 @@
}
}
}
- _HashMapKeyIterable[dart.implements] = () => [_internal.EfficientLength];
dart.setSignature(_HashMapKeyIterable, {
fields: () => ({[_map$0]: _HashMapOfE$dynamic()}),
getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])})
@@ -22983,7 +22981,7 @@
});
collection._HashMapKeyIterable = _HashMapKeyIterable();
const _offset = Symbol('_offset');
- const _current$2 = Symbol('_current');
+ const _current$1 = Symbol('_current');
collection._HashMapKeyIterator$ = dart.generic(E => {
let IteratorOfE = () => (IteratorOfE = dart.constFn(core.Iterator$(E)))();
let _HashMapOfE$dynamic = () => (_HashMapOfE$dynamic = dart.constFn(collection._HashMap$(E, dart.dynamic)))();
@@ -22993,10 +22991,10 @@
this[_map$0] = map;
this[_keys] = keys;
this[_offset] = 0;
- this[_current$2] = null;
+ this[_current$1] = null;
}
get current() {
- return this[_current$2];
+ return this[_current$1];
}
moveNext() {
let keys = this[_keys];
@@ -23004,10 +23002,10 @@
if (keys !== this[_map$0][_keys]) {
dart.throw(new core.ConcurrentModificationError(this[_map$0]));
} else if (dart.notNull(offset) >= keys.length) {
- this[_current$2] = null;
+ this[_current$1] = null;
return false;
} else {
- this[_current$2] = keys[offset];
+ this[_current$1] = keys[offset];
this[_offset] = dart.notNull(offset) + 1;
return true;
}
@@ -23020,7 +23018,7 @@
[_map$0]: _HashMapOfE$dynamic(),
[_keys]: ListOfE(),
[_offset]: core.int,
- [_current$2]: E
+ [_current$1]: E
}),
getters: () => ({current: dart.definiteFunctionType(E, [])}),
methods: () => ({moveNext: dart.definiteFunctionType(core.bool, [])})
@@ -23183,7 +23181,7 @@
collection._Es6MapIterable$ = dart.generic(E => {
let _Es6MapIteratorOfE = () => (_Es6MapIteratorOfE = dart.constFn(collection._Es6MapIterator$(E)))();
let ETovoid = () => (ETovoid = dart.constFn(dart.functionType(dart.void, [E])))();
- class _Es6MapIterable extends core.Iterable$(E) {
+ class _Es6MapIterable extends _internal.EfficientLengthIterable$(E) {
new(map, isKeys) {
this[_map$0] = map;
this[_isKeys] = isKeys;
@@ -23221,7 +23219,6 @@
}
}
}
- _Es6MapIterable[dart.implements] = () => [_internal.EfficientLength];
dart.setSignature(_Es6MapIterable, {
fields: () => ({
[_map$0]: dart.dynamic,
@@ -23251,7 +23248,7 @@
this[_isKeys] = isKeys;
this[_jsIterator$] = null;
this[_next$0] = null;
- this[_current$2] = null;
+ this[_current$1] = null;
this[_done] = null;
if (dart.test(this[_isKeys])) {
this[_jsIterator$] = dart.dload(this[_map$0], _map$0).keys();
@@ -23261,7 +23258,7 @@
this[_done] = false;
}
get current() {
- return this[_current$2];
+ return this[_current$1];
}
moveNext() {
if (!dart.equals(this[_modifications$], dart.dload(this[_map$0], _modifications$))) {
@@ -23271,11 +23268,11 @@
this[_next$0] = this[_jsIterator$].next();
let done = this[_next$0].done;
if (done) {
- this[_current$2] = null;
+ this[_current$1] = null;
this[_done] = true;
return false;
} else {
- this[_current$2] = this[_next$0].value;
+ this[_current$1] = this[_next$0].value;
return true;
}
}
@@ -23289,7 +23286,7 @@
[_isKeys]: core.bool,
[_jsIterator$]: dart.dynamic,
[_next$0]: dart.dynamic,
- [_current$2]: E,
+ [_current$1]: E,
[_done]: core.bool
}),
getters: () => ({current: dart.definiteFunctionType(E, [])}),
@@ -24080,10 +24077,10 @@
this[_set] = set;
this[_elements] = elements;
this[_offset] = 0;
- this[_current$2] = null;
+ this[_current$1] = null;
}
get current() {
- return this[_current$2];
+ return this[_current$1];
}
moveNext() {
let elements = this[_elements];
@@ -24091,10 +24088,10 @@
if (elements !== dart.dload(this[_set], _elements)) {
dart.throw(new core.ConcurrentModificationError(this[_set]));
} else if (dart.notNull(offset) >= elements.length) {
- this[_current$2] = null;
+ this[_current$1] = null;
return false;
} else {
- this[_current$2] = elements[offset];
+ this[_current$1] = elements[offset];
this[_offset] = dart.notNull(offset) + 1;
return true;
}
@@ -24107,7 +24104,7 @@
[_set]: dart.dynamic,
[_elements]: ListOfE(),
[_offset]: core.int,
- [_current$2]: E
+ [_current$1]: E
}),
getters: () => ({current: dart.definiteFunctionType(E, [])}),
methods: () => ({moveNext: dart.definiteFunctionType(core.bool, [])})
@@ -24561,20 +24558,20 @@
this[_set] = set;
this[_modifications$] = modifications;
this[_cell$] = null;
- this[_current$2] = null;
+ this[_current$1] = null;
this[_cell$] = this[_set][_first$];
}
get current() {
- return this[_current$2];
+ return this[_current$1];
}
moveNext() {
if (this[_modifications$] != this[_set][_modifications$]) {
dart.throw(new core.ConcurrentModificationError(this[_set]));
} else if (this[_cell$] == null) {
- this[_current$2] = null;
+ this[_current$1] = null;
return false;
} else {
- this[_current$2] = E._check(this[_cell$][_element]);
+ this[_current$1] = E._check(this[_cell$][_element]);
this[_cell$] = this[_cell$][_next$0];
return true;
}
@@ -24587,7 +24584,7 @@
[_set]: collection._LinkedHashSet,
[_modifications$]: core.int,
[_cell$]: collection._LinkedHashSetCell,
- [_current$2]: E
+ [_current$1]: E
}),
getters: () => ({current: dart.definiteFunctionType(E, [])}),
methods: () => ({moveNext: dart.definiteFunctionType(core.bool, [])})
@@ -24852,7 +24849,7 @@
return SetOfE().from(this);
}
get length() {
- dart.assert(!_internal.EfficientLength.is(this));
+ dart.assert(!_internal.EfficientLengthIterable.is(this));
let count = 0;
let it = this[dartx.iterator];
while (dart.test(it.moveNext())) {
@@ -25280,9 +25277,9 @@
});
collection.LinkedHashSet = LinkedHashSet();
const _modificationCount = Symbol('_modificationCount');
- const _insertBefore$ = Symbol('_insertBefore');
+ const _insertBefore = Symbol('_insertBefore');
const _list = Symbol('_list');
- const _unlink$ = Symbol('_unlink');
+ const _unlink = Symbol('_unlink');
collection.LinkedList$ = dart.generic(E => {
let IterableOfE = () => (IterableOfE = dart.constFn(core.Iterable$(E)))();
let _LinkedListIteratorOfE = () => (_LinkedListIteratorOfE = dart.constFn(collection._LinkedListIterator$(E)))();
@@ -25296,12 +25293,12 @@
}
addFirst(entry) {
E._check(entry);
- this[_insertBefore$](this[_first$], entry, {updateFirst: true});
+ this[_insertBefore](this[_first$], entry, {updateFirst: true});
this[_first$] = entry;
}
add(entry) {
E._check(entry);
- this[_insertBefore$](this[_first$], entry, {updateFirst: false});
+ this[_insertBefore](this[_first$], entry, {updateFirst: false});
}
addAll(entries) {
IterableOfE()._check(entries);
@@ -25310,7 +25307,7 @@
remove(entry) {
E._check(entry);
if (!dart.equals(entry[_list], this)) return false;
- this[_unlink$](entry);
+ this[_unlink](entry);
return true;
}
get iterator() {
@@ -25367,7 +25364,7 @@
get isEmpty() {
return this[_length$1] == 0;
}
- [_insertBefore$](entry, newEntry, opts) {
+ [_insertBefore](entry, newEntry, opts) {
E._check(entry);
E._check(newEntry);
let updateFirst = opts && 'updateFirst' in opts ? opts.updateFirst : null;
@@ -25394,7 +25391,7 @@
}
this[_length$1] = dart.notNull(this[_length$1]) + 1;
}
- [_unlink$](entry) {
+ [_unlink](entry) {
E._check(entry);
this[_modificationCount] = dart.notNull(this[_modificationCount]) + 1;
entry[_next$0][_previous$0] = entry[_previous$0];
@@ -25421,8 +25418,8 @@
addAll: dart.definiteFunctionType(dart.void, [IterableOfE()]),
remove: dart.definiteFunctionType(core.bool, [E]),
clear: dart.definiteFunctionType(dart.void, []),
- [_insertBefore$]: dart.definiteFunctionType(dart.void, [E, E], {updateFirst: core.bool}),
- [_unlink$]: dart.definiteFunctionType(dart.void, [E])
+ [_insertBefore]: dart.definiteFunctionType(dart.void, [E, E], {updateFirst: core.bool}),
+ [_unlink]: dart.definiteFunctionType(dart.void, [E])
})
});
dart.defineExtensionMembers(LinkedList, [
@@ -25448,21 +25445,21 @@
this[_modificationCount] = list[_modificationCount];
this[_next$0] = list[_first$];
this[_visitedFirst] = false;
- this[_current$2] = null;
+ this[_current$1] = null;
}
get current() {
- return this[_current$2];
+ return this[_current$1];
}
moveNext() {
if (this[_modificationCount] != this[_list][_modificationCount]) {
dart.throw(new core.ConcurrentModificationError(this));
}
if (dart.test(this[_list].isEmpty) || dart.test(this[_visitedFirst]) && core.identical(this[_next$0], this[_list].first)) {
- this[_current$2] = null;
+ this[_current$1] = null;
return false;
}
this[_visitedFirst] = true;
- this[_current$2] = E._check(this[_next$0]);
+ this[_current$1] = E._check(this[_next$0]);
this[_next$0] = this[_next$0][_next$0];
return true;
}
@@ -25473,7 +25470,7 @@
fields: () => ({
[_list]: LinkedListOfE(),
[_modificationCount]: core.int,
- [_current$2]: E,
+ [_current$1]: E,
[_next$0]: LinkedListEntryOfE(),
[_visitedFirst]: core.bool
}),
@@ -25495,23 +25492,23 @@
return this[_list];
}
unlink() {
- this[_list][_unlink$](E._check(this));
+ this[_list][_unlink](E._check(this));
}
get next() {
- if (core.identical(this, this[_next$0])) return null;
+ if (this[_list] == null || core.identical(this[_list].first, this[_next$0])) return null;
return this[_next$0];
}
get previous() {
- if (core.identical(this, this[_previous$0])) return null;
+ if (this[_list] == null || core.identical(this, this[_list].first)) return null;
return this[_previous$0];
}
insertAfter(entry) {
E._check(entry);
- this[_list][_insertBefore$](this[_next$0], entry, {updateFirst: false});
+ this[_list][_insertBefore](this[_next$0], entry, {updateFirst: false});
}
insertBefore(entry) {
E._check(entry);
- this[_list][_insertBefore$](E.as(this), entry, {updateFirst: true});
+ this[_list][_insertBefore](E.as(this), entry, {updateFirst: true});
}
}
dart.addTypeTests(LinkedListEntry);
@@ -25680,7 +25677,7 @@
collection._MapBaseValueIterable$ = dart.generic((K, V) => {
let _MapBaseValueIteratorOfK$V = () => (_MapBaseValueIteratorOfK$V = dart.constFn(collection._MapBaseValueIterator$(K, V)))();
let MapOfK$V = () => (MapOfK$V = dart.constFn(core.Map$(K, V)))();
- class _MapBaseValueIterable extends core.Iterable$(V) {
+ class _MapBaseValueIterable extends _internal.EfficientLengthIterable$(V) {
new(map) {
this[_map$0] = map;
super.new();
@@ -25707,7 +25704,6 @@
return new (_MapBaseValueIteratorOfK$V())(this[_map$0]);
}
}
- _MapBaseValueIterable[dart.implements] = () => [_internal.EfficientLength];
dart.setSignature(_MapBaseValueIterable, {
fields: () => ({[_map$0]: MapOfK$V()}),
getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(V), [])})
@@ -25732,18 +25728,18 @@
new(map) {
this[_map$0] = map;
this[_keys] = map[dartx.keys][dartx.iterator];
- this[_current$2] = null;
+ this[_current$1] = null;
}
moveNext() {
if (dart.test(this[_keys].moveNext())) {
- this[_current$2] = this[_map$0][dartx._get](this[_keys].current);
+ this[_current$1] = this[_map$0][dartx._get](this[_keys].current);
return true;
}
- this[_current$2] = null;
+ this[_current$1] = null;
return false;
}
get current() {
- return this[_current$2];
+ return this[_current$1];
}
}
dart.addTypeTests(_MapBaseValueIterator);
@@ -25752,7 +25748,7 @@
fields: () => ({
[_keys]: IteratorOfK(),
[_map$0]: MapOfK$V(),
- [_current$2]: V
+ [_current$1]: V
}),
getters: () => ({current: dart.definiteFunctionType(V, [])}),
methods: () => ({moveNext: dart.definiteFunctionType(core.bool, [])})
@@ -25988,7 +25984,7 @@
});
collection.Queue$ = dart.generic(E => {
let ListQueueOfE = () => (ListQueueOfE = dart.constFn(collection.ListQueue$(E)))();
- let IterableOfE = () => (IterableOfE = dart.constFn(core.Iterable$(E)))();
+ let EfficientLengthIterableOfE = () => (EfficientLengthIterableOfE = dart.constFn(_internal.EfficientLengthIterable$(E)))();
class Queue extends core.Object {
static new() {
return new (ListQueueOfE())();
@@ -25996,33 +25992,30 @@
static from(elements) {
return ListQueueOfE().from(elements);
}
- [Symbol.iterator]() {
- return new dart.JsIterator(this.iterator);
- }
}
dart.addTypeTests(Queue);
- Queue[dart.implements] = () => [IterableOfE(), _internal.EfficientLength];
+ Queue[dart.implements] = () => [EfficientLengthIterableOfE()];
return Queue;
});
collection.Queue = Queue();
const _previousLink = Symbol('_previousLink');
const _nextLink = Symbol('_nextLink');
const _link = Symbol('_link');
- collection._DoubleLink$ = dart.generic(E => {
+ collection._DoubleLink$ = dart.generic(Link => {
class _DoubleLink extends core.Object {
new() {
this[_previousLink] = null;
this[_nextLink] = null;
}
[_link](previous, next) {
- E._check(previous);
- E._check(next);
+ Link._check(previous);
+ Link._check(next);
this[_nextLink] = next;
this[_previousLink] = previous;
if (previous != null) previous[_nextLink] = this;
if (next != null) next[_previousLink] = this;
}
- [_unlink$]() {
+ [_unlink]() {
if (this[_previousLink] != null) this[_previousLink][_nextLink] = this[_nextLink];
if (this[_nextLink] != null) this[_nextLink][_previousLink] = this[_previousLink];
this[_nextLink] = null;
@@ -26032,46 +26025,34 @@
dart.addTypeTests(_DoubleLink);
dart.setSignature(_DoubleLink, {
fields: () => ({
- [_previousLink]: E,
- [_nextLink]: E
+ [_previousLink]: Link,
+ [_nextLink]: Link
}),
methods: () => ({
- [_link]: dart.definiteFunctionType(dart.void, [E, E]),
- [_unlink$]: dart.definiteFunctionType(dart.void, [])
+ [_link]: dart.definiteFunctionType(dart.void, [Link, Link]),
+ [_unlink]: dart.definiteFunctionType(dart.void, [])
})
});
return _DoubleLink;
});
collection._DoubleLink = _DoubleLink();
collection.DoubleLinkedQueueEntry$ = dart.generic(E => {
- let _UserDoubleLinkedQueueEntryOfE = () => (_UserDoubleLinkedQueueEntryOfE = dart.constFn(collection._UserDoubleLinkedQueueEntry$(E)))();
- class DoubleLinkedQueueEntry extends core.Object {
- static new(element) {
- return new (_UserDoubleLinkedQueueEntryOfE())(element);
- }
- }
- dart.addTypeTests(DoubleLinkedQueueEntry);
- return DoubleLinkedQueueEntry;
- });
- collection.DoubleLinkedQueueEntry = DoubleLinkedQueueEntry();
- collection._UserDoubleLinkedQueueEntry$ = dart.generic(E => {
- let _UserDoubleLinkedQueueEntryOfE = () => (_UserDoubleLinkedQueueEntryOfE = dart.constFn(collection._UserDoubleLinkedQueueEntry$(E)))();
let DoubleLinkedQueueEntryOfE = () => (DoubleLinkedQueueEntryOfE = dart.constFn(collection.DoubleLinkedQueueEntry$(E)))();
- class _UserDoubleLinkedQueueEntry extends collection._DoubleLink {
+ class DoubleLinkedQueueEntry extends collection._DoubleLink {
new(element) {
this.element = element;
super.new();
}
append(e) {
E._check(e);
- new (_UserDoubleLinkedQueueEntryOfE())(e)[_link](this, this[_nextLink]);
+ new (DoubleLinkedQueueEntryOfE())(e)[_link](this, this[_nextLink]);
}
prepend(e) {
E._check(e);
- new (_UserDoubleLinkedQueueEntryOfE())(e)[_link](this[_previousLink], this);
+ new (DoubleLinkedQueueEntryOfE())(e)[_link](this[_previousLink], this);
}
remove() {
- this[_unlink$]();
+ this[_unlink]();
return this.element;
}
previousEntry() {
@@ -26081,8 +26062,7 @@
return this[_nextLink];
}
}
- _UserDoubleLinkedQueueEntry[dart.implements] = () => [DoubleLinkedQueueEntryOfE()];
- dart.setSignature(_UserDoubleLinkedQueueEntry, {
+ dart.setSignature(DoubleLinkedQueueEntry, {
fields: () => ({element: E}),
methods: () => ({
append: dart.definiteFunctionType(dart.void, [E]),
@@ -26092,22 +26072,23 @@
nextEntry: dart.definiteFunctionType(collection.DoubleLinkedQueueEntry$(E), [])
})
});
- return _UserDoubleLinkedQueueEntry;
- }, _UserDoubleLinkedQueueEntry => {
- dart.setBaseClass(_UserDoubleLinkedQueueEntry, collection._DoubleLink$(_UserDoubleLinkedQueueEntry));
+ return DoubleLinkedQueueEntry;
+ }, DoubleLinkedQueueEntry => {
+ dart.setBaseClass(DoubleLinkedQueueEntry, collection._DoubleLink$(DoubleLinkedQueueEntry));
});
- collection._UserDoubleLinkedQueueEntry = _UserDoubleLinkedQueueEntry();
+ collection.DoubleLinkedQueueEntry = DoubleLinkedQueueEntry();
const _queue = Symbol('_queue');
const _append = Symbol('_append');
const _prepend = Symbol('_prepend');
const _asNonSentinelEntry = Symbol('_asNonSentinelEntry');
collection._DoubleLinkedQueueEntry$ = dart.generic(E => {
let _DoubleLinkedQueueElementOfE = () => (_DoubleLinkedQueueElementOfE = dart.constFn(collection._DoubleLinkedQueueElement$(E)))();
+ let _DoubleLinkedQueueEntryOfE = () => (_DoubleLinkedQueueEntryOfE = dart.constFn(collection._DoubleLinkedQueueEntry$(E)))();
let DoubleLinkedQueueOfE = () => (DoubleLinkedQueueOfE = dart.constFn(collection.DoubleLinkedQueue$(E)))();
- class _DoubleLinkedQueueEntry extends collection._DoubleLink {
- new(queue) {
+ class _DoubleLinkedQueueEntry extends collection.DoubleLinkedQueueEntry$(E) {
+ new(element, queue) {
this[_queue] = queue;
- super.new();
+ super.new(element);
}
[_append](e) {
E._check(e);
@@ -26117,34 +26098,34 @@
E._check(e);
new (_DoubleLinkedQueueElementOfE())(e, this[_queue])[_link](this[_previousLink], this);
}
+ get [_element]() {
+ return this.element;
+ }
nextEntry() {
- return this[_nextLink][_asNonSentinelEntry]();
+ let entry = _DoubleLinkedQueueEntryOfE()._check(this[_nextLink]);
+ return entry[_asNonSentinelEntry]();
}
previousEntry() {
- return this[_previousLink][_asNonSentinelEntry]();
+ let entry = _DoubleLinkedQueueEntryOfE()._check(this[_previousLink]);
+ return entry[_asNonSentinelEntry]();
}
}
dart.setSignature(_DoubleLinkedQueueEntry, {
fields: () => ({[_queue]: DoubleLinkedQueueOfE()}),
+ getters: () => ({[_element]: dart.definiteFunctionType(E, [])}),
methods: () => ({
[_append]: dart.definiteFunctionType(dart.void, [E]),
- [_prepend]: dart.definiteFunctionType(dart.void, [E]),
- nextEntry: dart.definiteFunctionType(collection.DoubleLinkedQueueEntry$(E), []),
- previousEntry: dart.definiteFunctionType(collection.DoubleLinkedQueueEntry$(E), [])
+ [_prepend]: dart.definiteFunctionType(dart.void, [E])
})
});
return _DoubleLinkedQueueEntry;
- }, _DoubleLinkedQueueEntry => {
- dart.setBaseClass(_DoubleLinkedQueueEntry, collection._DoubleLink$(_DoubleLinkedQueueEntry));
});
collection._DoubleLinkedQueueEntry = _DoubleLinkedQueueEntry();
const _elementCount = Symbol('_elementCount');
collection._DoubleLinkedQueueElement$ = dart.generic(E => {
- let DoubleLinkedQueueEntryOfE = () => (DoubleLinkedQueueEntryOfE = dart.constFn(collection.DoubleLinkedQueueEntry$(E)))();
class _DoubleLinkedQueueElement extends collection._DoubleLinkedQueueEntry$(E) {
new(element, queue) {
- this.element = element;
- super.new(queue);
+ super.new(element, queue);
}
append(e) {
E._check(e);
@@ -26164,7 +26145,7 @@
}
[_remove]() {
this[_queue] = null;
- this[_unlink$]();
+ this[_unlink]();
return this.element;
}
remove() {
@@ -26178,14 +26159,9 @@
return this;
}
}
- _DoubleLinkedQueueElement[dart.implements] = () => [DoubleLinkedQueueEntryOfE()];
dart.setSignature(_DoubleLinkedQueueElement, {
- fields: () => ({element: E}),
methods: () => ({
- append: dart.definiteFunctionType(dart.void, [E]),
- prepend: dart.definiteFunctionType(dart.void, [E]),
[_remove]: dart.definiteFunctionType(E, []),
- remove: dart.definiteFunctionType(E, []),
[_asNonSentinelEntry]: dart.definiteFunctionType(collection._DoubleLinkedQueueElement$(E), [])
})
});
@@ -26195,7 +26171,7 @@
collection._DoubleLinkedQueueSentinel$ = dart.generic(E => {
class _DoubleLinkedQueueSentinel extends collection._DoubleLinkedQueueEntry$(E) {
new(queue) {
- super.new(queue);
+ super.new(null, queue);
this[_previousLink] = this;
this[_nextLink] = this;
}
@@ -26205,12 +26181,11 @@
[_remove]() {
dart.throw(_internal.IterableElementError.noElement());
}
- get element() {
+ get [_element]() {
dart.throw(_internal.IterableElementError.noElement());
}
}
dart.setSignature(_DoubleLinkedQueueSentinel, {
- getters: () => ({element: dart.definiteFunctionType(E, [])}),
methods: () => ({
[_asNonSentinelEntry]: dart.definiteFunctionType(collection.DoubleLinkedQueueEntry$(E), []),
[_remove]: dart.definiteFunctionType(E, [])
@@ -26224,6 +26199,7 @@
let _DoubleLinkedQueueSentinelOfE = () => (_DoubleLinkedQueueSentinelOfE = dart.constFn(collection._DoubleLinkedQueueSentinel$(E)))();
let DoubleLinkedQueueOfE = () => (DoubleLinkedQueueOfE = dart.constFn(collection.DoubleLinkedQueue$(E)))();
let IterableOfE = () => (IterableOfE = dart.constFn(core.Iterable$(E)))();
+ let _DoubleLinkedQueueEntryOfE = () => (_DoubleLinkedQueueEntryOfE = dart.constFn(collection._DoubleLinkedQueueEntry$(E)))();
let _DoubleLinkedQueueElementOfE = () => (_DoubleLinkedQueueElementOfE = dart.constFn(collection._DoubleLinkedQueueElement$(E)))();
let _DoubleLinkedQueueIteratorOfE = () => (_DoubleLinkedQueueIteratorOfE = dart.constFn(collection._DoubleLinkedQueueIterator$(E)))();
let QueueOfE = () => (QueueOfE = dart.constFn(collection.Queue$(E)))();
@@ -26271,34 +26247,42 @@
}
}
removeLast() {
- let lastEntry = this[_sentinel][_previousLink];
+ let lastEntry = _DoubleLinkedQueueEntryOfE()._check(this[_sentinel][_previousLink]);
let result = lastEntry[_remove]();
this[_elementCount] = dart.notNull(this[_elementCount]) - 1;
return result;
}
removeFirst() {
- let firstEntry = this[_sentinel][_nextLink];
+ let firstEntry = _DoubleLinkedQueueEntryOfE()._check(this[_sentinel][_nextLink]);
let result = firstEntry[_remove]();
this[_elementCount] = dart.notNull(this[_elementCount]) - 1;
return result;
}
remove(o) {
- let entry = this[_sentinel][_nextLink];
+ let entry = _DoubleLinkedQueueEntryOfE()._check(this[_sentinel][_nextLink]);
while (!core.identical(entry, this[_sentinel])) {
- if (dart.equals(entry.element, o)) {
+ let equals = dart.equals(entry[_element], o);
+ if (!core.identical(this, entry[_queue])) {
+ dart.throw(new core.ConcurrentModificationError(this));
+ }
+ if (equals) {
entry[_remove]();
this[_elementCount] = dart.notNull(this[_elementCount]) - 1;
return true;
}
- entry = entry[_nextLink];
+ entry = _DoubleLinkedQueueEntryOfE()._check(entry[_nextLink]);
}
return false;
}
[_filter](test, removeMatching) {
- let entry = this[_sentinel][_nextLink];
+ let entry = _DoubleLinkedQueueEntryOfE()._check(this[_sentinel][_nextLink]);
while (!core.identical(entry, this[_sentinel])) {
- let next = entry[_nextLink];
- if (core.identical(removeMatching, test(entry.element))) {
+ let matches = test(entry[_element]);
+ if (!core.identical(this, entry[_queue])) {
+ dart.throw(new core.ConcurrentModificationError(this));
+ }
+ let next = _DoubleLinkedQueueEntryOfE()._check(entry[_nextLink]);
+ if (core.identical(removeMatching, matches)) {
entry[_remove]();
this[_elementCount] = dart.notNull(this[_elementCount]) - 1;
}
@@ -26312,26 +26296,26 @@
this[_filter](test, false);
}
get first() {
- let firstEntry = this[_sentinel][_nextLink];
- return firstEntry.element;
+ let firstEntry = _DoubleLinkedQueueEntryOfE()._check(this[_sentinel][_nextLink]);
+ return firstEntry[_element];
}
get last() {
- let lastEntry = this[_sentinel][_previousLink];
- return lastEntry.element;
+ let lastEntry = _DoubleLinkedQueueEntryOfE()._check(this[_sentinel][_previousLink]);
+ return lastEntry[_element];
}
get single() {
if (core.identical(this[_sentinel][_nextLink], this[_sentinel][_previousLink])) {
- let entry = this[_sentinel][_nextLink];
- return entry.element;
+ let entry = _DoubleLinkedQueueEntryOfE()._check(this[_sentinel][_nextLink]);
+ return entry[_element];
}
dart.throw(_internal.IterableElementError.tooMany());
}
- lastEntry() {
- return this[_sentinel].previousEntry();
- }
firstEntry() {
return this[_sentinel].nextEntry();
}
+ lastEntry() {
+ return this[_sentinel].previousEntry();
+ }
get isEmpty() {
return core.identical(this[_sentinel][_nextLink], this[_sentinel]);
}
@@ -26340,13 +26324,18 @@
this[_sentinel][_previousLink] = this[_sentinel];
this[_elementCount] = 0;
}
- forEachEntry(f) {
- let entry = this[_sentinel][_nextLink];
+ forEachEntry(action) {
+ let entry = _DoubleLinkedQueueEntryOfE()._check(this[_sentinel][_nextLink]);
while (!core.identical(entry, this[_sentinel])) {
- let nextEntry = entry[_nextLink];
let element = _DoubleLinkedQueueElementOfE()._check(entry);
- f(element);
- entry = nextEntry;
+ let next = _DoubleLinkedQueueEntryOfE()._check(element[_nextLink]);
+ action(element);
+ if (core.identical(this, entry[_queue])) {
+ next = _DoubleLinkedQueueEntryOfE()._check(entry[_nextLink]);
+ } else if (!core.identical(this, next[_queue])) {
+ dart.throw(new core.ConcurrentModificationError(this));
+ }
+ entry = next;
}
}
get iterator() {
@@ -26374,8 +26363,8 @@
[_filter]: dart.definiteFunctionType(dart.void, [ETobool(), core.bool]),
removeWhere: dart.definiteFunctionType(dart.void, [ETobool()]),
retainWhere: dart.definiteFunctionType(dart.void, [ETobool()]),
- lastEntry: dart.definiteFunctionType(collection.DoubleLinkedQueueEntry$(E), []),
firstEntry: dart.definiteFunctionType(collection.DoubleLinkedQueueEntry$(E), []),
+ lastEntry: dart.definiteFunctionType(collection.DoubleLinkedQueueEntry$(E), []),
clear: dart.definiteFunctionType(dart.void, []),
forEachEntry: dart.definiteFunctionType(dart.void, [DoubleLinkedQueueEntryOfETovoid()])
})
@@ -26394,33 +26383,33 @@
collection.DoubleLinkedQueue = DoubleLinkedQueue();
const _nextEntry = Symbol('_nextEntry');
collection._DoubleLinkedQueueIterator$ = dart.generic(E => {
+ let _DoubleLinkedQueueEntryOfE = () => (_DoubleLinkedQueueEntryOfE = dart.constFn(collection._DoubleLinkedQueueEntry$(E)))();
let _DoubleLinkedQueueElementOfE = () => (_DoubleLinkedQueueElementOfE = dart.constFn(collection._DoubleLinkedQueueElement$(E)))();
let IteratorOfE = () => (IteratorOfE = dart.constFn(core.Iterator$(E)))();
let _DoubleLinkedQueueSentinelOfE = () => (_DoubleLinkedQueueSentinelOfE = dart.constFn(collection._DoubleLinkedQueueSentinel$(E)))();
- let _DoubleLinkedQueueEntryOfE = () => (_DoubleLinkedQueueEntryOfE = dart.constFn(collection._DoubleLinkedQueueEntry$(E)))();
class _DoubleLinkedQueueIterator extends core.Object {
new(sentinel) {
this[_sentinel] = sentinel;
- this[_nextEntry] = sentinel[_nextLink];
- this[_current$2] = null;
+ this[_nextEntry] = _DoubleLinkedQueueEntryOfE()._check(sentinel[_nextLink]);
+ this[_current$1] = null;
}
moveNext() {
if (core.identical(this[_nextEntry], this[_sentinel])) {
- this[_current$2] = null;
+ this[_current$1] = null;
this[_nextEntry] = null;
this[_sentinel] = null;
return false;
}
let elementEntry = _DoubleLinkedQueueElementOfE()._check(this[_nextEntry]);
- if (elementEntry[_queue] == null) {
+ if (!core.identical(this[_sentinel][_queue], elementEntry[_queue])) {
dart.throw(new core.ConcurrentModificationError(this[_sentinel][_queue]));
}
- this[_current$2] = elementEntry.element;
- this[_nextEntry] = elementEntry[_nextLink];
+ this[_current$1] = elementEntry[_element];
+ this[_nextEntry] = _DoubleLinkedQueueEntryOfE()._check(elementEntry[_nextLink]);
return true;
}
get current() {
- return this[_current$2];
+ return this[_current$1];
}
}
dart.addTypeTests(_DoubleLinkedQueueIterator);
@@ -26429,7 +26418,7 @@
fields: () => ({
[_sentinel]: _DoubleLinkedQueueSentinelOfE(),
[_nextEntry]: _DoubleLinkedQueueEntryOfE(),
- [_current$2]: E
+ [_current$1]: E
}),
getters: () => ({current: dart.definiteFunctionType(E, [])}),
methods: () => ({moveNext: dart.definiteFunctionType(core.bool, [])})
@@ -26452,7 +26441,7 @@
let QueueOfE = () => (QueueOfE = dart.constFn(collection.Queue$(E)))();
let ETovoid = () => (ETovoid = dart.constFn(dart.functionType(dart.void, [E])))();
let ETobool = () => (ETobool = dart.constFn(dart.functionType(core.bool, [E])))();
- class ListQueue extends core.Iterable$(E) {
+ class ListQueue extends _internal.ListIterable$(E) {
new(initialCapacity) {
if (initialCapacity === void 0) initialCapacity = null;
this[_head] = 0;
@@ -26480,7 +26469,7 @@
return queue;
} else {
let capacity = collection.ListQueue._INITIAL_CAPACITY;
- if (_internal.EfficientLength.is(elements)) {
+ if (_internal.EfficientLengthIterable.is(elements)) {
capacity = elements[dartx.length];
}
let result = new (ListQueueOfE())(capacity);
@@ -26729,7 +26718,6 @@
[_tail]: core.int,
[_modificationCount]: core.int
}),
- getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])}),
methods: () => ({
add: dart.definiteFunctionType(dart.void, [E]),
addAll: dart.definiteFunctionType(dart.void, [IterableOfE()]),
@@ -26782,18 +26770,18 @@
this[_end] = queue[_tail];
this[_modificationCount] = queue[_modificationCount];
this[_position] = queue[_head];
- this[_current$2] = null;
+ this[_current$1] = null;
}
get current() {
- return this[_current$2];
+ return this[_current$1];
}
moveNext() {
this[_queue][_checkModification](this[_modificationCount]);
if (this[_position] == this[_end]) {
- this[_current$2] = null;
+ this[_current$1] = null;
return false;
}
- this[_current$2] = this[_queue][_table][dartx._get](this[_position]);
+ this[_current$1] = this[_queue][_table][dartx._get](this[_position]);
this[_position] = (dart.notNull(this[_position]) + 1 & dart.notNull(this[_queue][_table][dartx.length]) - 1) >>> 0;
return true;
}
@@ -26806,7 +26794,7 @@
[_end]: core.int,
[_modificationCount]: core.int,
[_position]: core.int,
- [_current$2]: E
+ [_current$1]: E
}),
getters: () => ({current: dart.definiteFunctionType(E, [])}),
methods: () => ({moveNext: dart.definiteFunctionType(core.bool, [])})
@@ -26862,7 +26850,7 @@
const _splayMin = Symbol('_splayMin');
const _splayMax = Symbol('_splayMax');
const _addNewRoot = Symbol('_addNewRoot');
- const _clear$ = Symbol('_clear');
+ const _clear = Symbol('_clear');
collection._SplayTree$ = dart.generic((K, Node) => {
class _SplayTree extends core.Object {
new() {
@@ -26987,7 +26975,7 @@
this[_root] = this[_splayMax](this[_root]);
return this[_root];
}
- [_clear$]() {
+ [_clear]() {
this[_root] = null;
this[_count$] = 0;
this[_modificationCount] = dart.notNull(this[_modificationCount]) + 1;
@@ -27010,7 +26998,7 @@
[_splayMax]: dart.definiteFunctionType(Node, [Node]),
[_remove]: dart.definiteFunctionType(Node, [K]),
[_addNewRoot]: dart.definiteFunctionType(dart.void, [Node, core.int]),
- [_clear$]: dart.definiteFunctionType(dart.void, [])
+ [_clear]: dart.definiteFunctionType(dart.void, [])
})
});
return _SplayTree;
@@ -27167,7 +27155,7 @@
return this[_count$];
}
clear() {
- this[_clear$]();
+ this[_clear]();
}
containsKey(key) {
return dart.test(dart.dcall(this[_validKey], key)) && this[_splay](K.as(key)) == 0;
@@ -27387,7 +27375,7 @@
let SplayTreeSetOfK = () => (SplayTreeSetOfK = dart.constFn(collection.SplayTreeSet$(K)))();
let _SplayTreeNodeOfK = () => (_SplayTreeNodeOfK = dart.constFn(collection._SplayTreeNode$(K)))();
let _SplayTreeOfK$_SplayTreeNodeOfK = () => (_SplayTreeOfK$_SplayTreeNodeOfK = dart.constFn(collection._SplayTree$(K, _SplayTreeNodeOfK())))();
- class _SplayTreeKeyIterable extends core.Iterable$(K) {
+ class _SplayTreeKeyIterable extends _internal.EfficientLengthIterable$(K) {
new(tree) {
this[_tree] = tree;
super.new();
@@ -27408,7 +27396,6 @@
return set;
}
}
- _SplayTreeKeyIterable[dart.implements] = () => [_internal.EfficientLength];
dart.setSignature(_SplayTreeKeyIterable, {
fields: () => ({[_tree]: _SplayTreeOfK$_SplayTreeNodeOfK()}),
getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(K), [])})
@@ -27420,7 +27407,7 @@
collection._SplayTreeValueIterable$ = dart.generic((K, V) => {
let _SplayTreeValueIteratorOfK$V = () => (_SplayTreeValueIteratorOfK$V = dart.constFn(collection._SplayTreeValueIterator$(K, V)))();
let SplayTreeMapOfK$V = () => (SplayTreeMapOfK$V = dart.constFn(collection.SplayTreeMap$(K, V)))();
- class _SplayTreeValueIterable extends core.Iterable$(V) {
+ class _SplayTreeValueIterable extends _internal.EfficientLengthIterable$(V) {
new(map) {
this[_map$0] = map;
super.new();
@@ -27435,7 +27422,6 @@
return new (_SplayTreeValueIteratorOfK$V())(this[_map$0]);
}
}
- _SplayTreeValueIterable[dart.implements] = () => [_internal.EfficientLength];
dart.setSignature(_SplayTreeValueIterable, {
fields: () => ({[_map$0]: SplayTreeMapOfK$V()}),
getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(V), [])})
@@ -27651,7 +27637,7 @@
return _;
}
clear() {
- this[_clear$]();
+ this[_clear]();
}
toSet() {
return this[_clone]();
@@ -28188,7 +28174,7 @@
core.List$ = dart.generic(E => {
let JSArrayOfE = () => (JSArrayOfE = dart.constFn(_interceptors.JSArray$(E)))();
let ListOfE = () => (ListOfE = dart.constFn(core.List$(E)))();
- let IterableOfE = () => (IterableOfE = dart.constFn(core.Iterable$(E)))();
+ let EfficientLengthIterableOfE = () => (EfficientLengthIterableOfE = dart.constFn(_internal.EfficientLengthIterable$(E)))();
class List extends core.Object {
static new(length) {
if (length === void 0) length = null;
@@ -28239,12 +28225,9 @@
let result = ListOfE().from(elements, {growable: false});
return _internal.makeFixedListUnmodifiable(E)(result);
}
- [Symbol.iterator]() {
- return new dart.JsIterator(this[dartx.iterator]);
- }
}
dart.addTypeTests(List);
- List[dart.implements] = () => [IterableOfE(), _internal.EfficientLength];
+ List[dart.implements] = () => [EfficientLengthIterableOfE()];
return List;
});
core.List = List();
@@ -28383,6 +28366,7 @@
}
};
dart.addSimpleTypeTests(convert._UnicodeSubsetEncoder);
+ convert._UnicodeSubsetEncoder[dart.implements] = () => [ChunkedConverterOfString$ListOfint$String$ListOfint()];
dart.setSignature(convert._UnicodeSubsetEncoder, {
fields: () => ({[_subsetMask]: core.int}),
methods: () => ({
@@ -28465,6 +28449,7 @@
}
};
dart.addSimpleTypeTests(convert._UnicodeSubsetDecoder);
+ convert._UnicodeSubsetDecoder[dart.implements] = () => [ChunkedConverterOfListOfint$String$ListOfint$String()];
dart.setSignature(convert._UnicodeSubsetDecoder, {
fields: () => ({
[_allowInvalid]: core.bool,
@@ -28629,6 +28614,7 @@
};
dart.addSimpleTypeTests(convert.Base64Encoder);
dart.defineNamedConstructor(convert.Base64Encoder, 'urlSafe');
+ convert.Base64Encoder[dart.implements] = () => [ChunkedConverterOfListOfint$String$ListOfint$String()];
dart.setSignature(convert.Base64Encoder, {
fields: () => ({[_urlSafe]: core.bool}),
methods: () => ({
@@ -28655,6 +28641,104 @@
get decoder() {
return const$33 || (const$33 = dart.const(new convert.Base64Decoder()));
}
+ normalize(source, start, end) {
+ if (start === void 0) start = 0;
+ if (end === void 0) end = null;
+ end = core.RangeError.checkValidRange(start, end, source[dartx.length]);
+ let percent = 37;
+ let equals = 61;
+ let buffer = null;
+ let sliceStart = start;
+ let alphabet = convert._Base64Encoder._base64Alphabet;
+ let inverseAlphabet = convert._Base64Decoder._inverseAlphabet;
+ let firstPadding = -1;
+ let firstPaddingSourceIndex = -1;
+ let paddingCount = 0;
+ for (let i = start; dart.notNull(i) < dart.notNull(end);) {
+ let sliceEnd = i;
+ let char = source[dartx.codeUnitAt]((() => {
+ let x = i;
+ i = dart.notNull(x) + 1;
+ return x;
+ })());
+ let originalChar = char;
+ if (char == percent) {
+ if (dart.notNull(i) + 2 <= dart.notNull(end)) {
+ char = _internal.parseHexByte(source, i);
+ i = dart.notNull(i) + 2;
+ if (char == percent) char = -1;
+ } else {
+ char = -1;
+ }
+ }
+ if (0 <= dart.notNull(char) && dart.notNull(char) <= 127) {
+ let value = inverseAlphabet[dartx._get](char);
+ if (dart.notNull(value) >= 0) {
+ char = alphabet[dartx.codeUnitAt](value);
+ if (char == originalChar) continue;
+ } else if (value == convert._Base64Decoder._padding) {
+ if (dart.notNull(firstPadding) < 0) {
+ firstPadding = (() => {
+ let l = dart.nullSafe(buffer, _ => _.length);
+ return l != null ? l : 0;
+ })() + (dart.notNull(sliceEnd) - dart.notNull(sliceStart));
+ firstPaddingSourceIndex = sliceEnd;
+ }
+ paddingCount = dart.notNull(paddingCount) + 1;
+ if (originalChar == equals) continue;
+ }
+ if (value != convert._Base64Decoder._invalid) {
+ let t = buffer;
+ t == null ? buffer = new core.StringBuffer() : t;
+ buffer.write(source[dartx.substring](sliceStart, sliceEnd));
+ buffer.writeCharCode(char);
+ sliceStart = i;
+ continue;
+ }
+ }
+ dart.throw(new core.FormatException("Invalid base64 data", source, sliceEnd));
+ }
+ if (buffer != null) {
+ buffer.write(source[dartx.substring](sliceStart, end));
+ if (dart.notNull(firstPadding) >= 0) {
+ convert.Base64Codec._checkPadding(source, firstPaddingSourceIndex, end, firstPadding, paddingCount, buffer.length);
+ } else {
+ let endLength = (dart.notNull(buffer.length) - 1)[dartx['%']](4) + 1;
+ if (endLength == 1) {
+ dart.throw(new core.FormatException("Invalid base64 encoding length ", source, end));
+ }
+ while (dart.notNull(endLength) < 4) {
+ buffer.write("=");
+ endLength = dart.notNull(endLength) + 1;
+ }
+ }
+ return source[dartx.replaceRange](start, end, dart.toString(buffer));
+ }
+ let length = dart.notNull(end) - dart.notNull(start);
+ if (dart.notNull(firstPadding) >= 0) {
+ convert.Base64Codec._checkPadding(source, firstPaddingSourceIndex, end, firstPadding, paddingCount, length);
+ } else {
+ let endLength = length[dartx['%']](4);
+ if (endLength == 1) {
+ dart.throw(new core.FormatException("Invalid base64 encoding length ", source, end));
+ }
+ if (dart.notNull(endLength) > 1) {
+ source = source[dartx.replaceRange](end, end, endLength == 2 ? "==" : "=");
+ }
+ }
+ return source;
+ }
+ static _checkPadding(source, sourceIndex, sourceEnd, firstPadding, paddingCount, length) {
+ if (length[dartx['%']](4) != 0) {
+ dart.throw(new core.FormatException("Invalid base64 padding, padded length must be multiple of four, " + dart.str`is ${length}`, source, sourceEnd));
+ }
+ if (dart.notNull(firstPadding) + dart.notNull(paddingCount) != length) {
+ dart.throw(new core.FormatException("Invalid base64 padding, '=' not at the end", source, sourceIndex));
+ }
+ if (dart.notNull(paddingCount) > 2) {
+ dart.throw(new core.FormatException("Invalid base64 padding, more than two '=' characters", source, sourceIndex));
+ }
+ }
};
dart.addSimpleTypeTests(convert.Base64Codec);
dart.defineNamedConstructor(convert.Base64Codec, 'urlSafe');
@@ -28663,7 +28747,10 @@
getters: () => ({
encoder: dart.definiteFunctionType(convert.Base64Encoder, []),
decoder: dart.definiteFunctionType(convert.Base64Decoder, [])
- })
+ }),
+ methods: () => ({normalize: dart.definiteFunctionType(core.String, [core.String], [core.int, core.int])}),
+ statics: () => ({_checkPadding: dart.definiteFunctionType(core.int, [core.String, core.int, core.int, core.int, core.int, core.int])}),
+ names: ['_checkPadding']
});
convert.BASE64 = dart.const(new convert.Base64Codec());
convert.BASE64URL = dart.const(new convert.Base64Codec.urlSafe());
@@ -28927,6 +29014,7 @@
}
};
dart.addSimpleTypeTests(convert.Base64Decoder);
+ convert.Base64Decoder[dart.implements] = () => [ChunkedConverterOfString$ListOfint$String$ListOfint()];
dart.setSignature(convert.Base64Decoder, {
methods: () => ({
convert: dart.definiteFunctionType(core.List$(core.int), [core.String], [core.int, core.int]),
@@ -29455,6 +29543,7 @@
});
convert._InvertedCodec = _InvertedCodec();
convert._FusedConverter$ = dart.generic((S, M, T) => {
+ let ChunkedConverterOfS$T$S$T = () => (ChunkedConverterOfS$T$S$T = dart.constFn(convert.ChunkedConverter$(S, T, S, T)))();
let ConverterOfS$M = () => (ConverterOfS$M = dart.constFn(convert.Converter$(S, M)))();
let ConverterOfM$T = () => (ConverterOfM$T = dart.constFn(convert.Converter$(M, T)))();
let SinkOfT = () => (SinkOfT = dart.constFn(core.Sink$(T)))();
@@ -29473,6 +29562,7 @@
return this[_first$0].startChunkedConversion(this[_second].startChunkedConversion(sink));
}
}
+ _FusedConverter[dart.implements] = () => [ChunkedConverterOfS$T$S$T()];
dart.setSignature(_FusedConverter, {
fields: () => ({
[_first$0]: ConverterOfS$M(),
@@ -29607,6 +29697,7 @@
}
};
dart.addSimpleTypeTests(convert.HtmlEscape);
+ convert.HtmlEscape[dart.implements] = () => [ChunkedConverterOfString$String$String$String()];
dart.setSignature(convert.HtmlEscape, {
fields: () => ({mode: convert.HtmlEscapeMode}),
methods: () => ({
@@ -29766,6 +29857,7 @@
};
dart.addSimpleTypeTests(convert.JsonEncoder);
dart.defineNamedConstructor(convert.JsonEncoder, 'withIndent');
+ convert.JsonEncoder[dart.implements] = () => [ChunkedConverterOfObject$String$Object$String()];
dart.setSignature(convert.JsonEncoder, {
fields: () => ({
indent: core.String,
@@ -29838,6 +29930,7 @@
}
};
dart.addSimpleTypeTests(convert.JsonUtf8Encoder);
+ convert.JsonUtf8Encoder[dart.implements] = () => [ChunkedConverterOfObject$ListOfint$Object$ListOfint()];
dart.setSignature(convert.JsonUtf8Encoder, {
fields: () => ({
[_indent]: ListOfint(),
@@ -29945,6 +30038,7 @@
}
};
dart.addSimpleTypeTests(convert.JsonDecoder);
+ convert.JsonDecoder[dart.implements] = () => [ChunkedConverterOfString$Object$String$Object()];
dart.setSignature(convert.JsonDecoder, {
fields: () => ({[_reviver]: convert._Reviver}),
methods: () => ({
@@ -31073,6 +31167,7 @@
}
};
dart.addSimpleTypeTests(convert.Utf8Encoder);
+ convert.Utf8Encoder[dart.implements] = () => [ChunkedConverterOfString$ListOfint$String$ListOfint()];
dart.setSignature(convert.Utf8Encoder, {
methods: () => ({
convert: dart.definiteFunctionType(core.List$(core.int), [core.String], [core.int, core.int]),
@@ -31285,7 +31380,7 @@
let buffer = new core.StringBuffer();
let decoder = new convert._Utf8Decoder(buffer, this[_allowMalformed]);
decoder.convert(codeUnits, start, end);
- decoder.close();
+ decoder.flush(codeUnits, end);
return buffer.toString();
}
startChunkedConversion(sink) {
@@ -31310,6 +31405,7 @@
}
};
dart.addSimpleTypeTests(convert.Utf8Decoder);
+ convert.Utf8Decoder[dart.implements] = () => [ChunkedConverterOfListOfint$String$ListOfint$String()];
dart.setSignature(convert.Utf8Decoder, {
fields: () => ({[_allowMalformed]: core.bool}),
methods: () => ({
@@ -31359,10 +31455,12 @@
close() {
this.flush();
}
- flush() {
+ flush(source, offset) {
+ if (source === void 0) source = null;
+ if (offset === void 0) offset = null;
if (dart.test(this.hasPartialInput)) {
if (!dart.test(this[_allowMalformed])) {
- dart.throw(new core.FormatException("Unfinished UTF-8 octet sequence"));
+ dart.throw(new core.FormatException("Unfinished UTF-8 octet sequence", source, offset));
}
this[_stringSink].writeCharCode(convert.UNICODE_REPLACEMENT_CHARACTER_RUNE);
this[_value] = 0;
@@ -31406,7 +31504,7 @@
if ((dart.notNull(unit) & 192) != 128) {
expectedUnits = 0;
if (!dart.test(this[_allowMalformed])) {
- dart.throw(new core.FormatException(dart.str`Bad UTF-8 encoding 0x${unit[dartx.toRadixString](16)}`));
+ dart.throw(new core.FormatException(dart.str`Bad UTF-8 encoding 0x${unit[dartx.toRadixString](16)}`, codeUnits, i));
}
this[_isFirstCharacter] = false;
this[_stringSink].writeCharCode(convert.UNICODE_REPLACEMENT_CHARACTER_RUNE);
@@ -31419,14 +31517,14 @@
} while (dart.notNull(expectedUnits) > 0);
if (dart.notNull(value) <= dart.notNull(convert._Utf8Decoder._LIMITS[dartx._get](dart.notNull(extraUnits) - 1))) {
if (!dart.test(this[_allowMalformed])) {
- dart.throw(new core.FormatException(dart.str`Overlong encoding of 0x${value[dartx.toRadixString](16)}`));
+ dart.throw(new core.FormatException(dart.str`Overlong encoding of 0x${value[dartx.toRadixString](16)}`, codeUnits, dart.notNull(i) - dart.notNull(extraUnits) - 1));
}
expectedUnits = extraUnits = 0;
value = convert.UNICODE_REPLACEMENT_CHARACTER_RUNE;
}
if (dart.notNull(value) > convert._FOUR_BYTE_LIMIT) {
if (!dart.test(this[_allowMalformed])) {
- dart.throw(new core.FormatException("Character outside valid Unicode range: " + dart.str`0x${value[dartx.toRadixString](16)}`));
+ dart.throw(new core.FormatException("Character outside valid Unicode range: " + dart.str`0x${value[dartx.toRadixString](16)}`, codeUnits, dart.notNull(i) - dart.notNull(extraUnits) - 1));
}
value = convert.UNICODE_REPLACEMENT_CHARACTER_RUNE;
}
@@ -31450,7 +31548,7 @@
})());
if (dart.notNull(unit) < 0) {
if (!dart.test(this[_allowMalformed])) {
- dart.throw(new core.FormatException(dart.str`Negative UTF-8 code unit: -0x${(-dart.notNull(unit))[dartx.toRadixString](16)}`));
+ dart.throw(new core.FormatException(dart.str`Negative UTF-8 code unit: -0x${(-dart.notNull(unit))[dartx.toRadixString](16)}`, codeUnits, dart.notNull(i) - 1));
}
this[_stringSink].writeCharCode(convert.UNICODE_REPLACEMENT_CHARACTER_RUNE);
} else {
@@ -31471,7 +31569,7 @@
continue loop;
}
if (!dart.test(this[_allowMalformed])) {
- dart.throw(new core.FormatException(dart.str`Bad UTF-8 encoding 0x${unit[dartx.toRadixString](16)}`));
+ dart.throw(new core.FormatException(dart.str`Bad UTF-8 encoding 0x${unit[dartx.toRadixString](16)}`, codeUnits, dart.notNull(i) - 1));
}
value = convert.UNICODE_REPLACEMENT_CHARACTER_RUNE;
expectedUnits = extraUnits = 0;
@@ -31500,7 +31598,7 @@
getters: () => ({hasPartialInput: dart.definiteFunctionType(core.bool, [])}),
methods: () => ({
close: dart.definiteFunctionType(dart.void, []),
- flush: dart.definiteFunctionType(dart.void, []),
+ flush: dart.definiteFunctionType(dart.void, [], [ListOfint(), core.int]),
convert: dart.definiteFunctionType(dart.void, [ListOfint(), core.int, core.int])
})
});
@@ -31537,6 +31635,7 @@
};
core.proxy = dart.const(new core._Proxy());
dart.defineExtensionNames([
+ 'hashCode',
'toString'
]);
core.bool = class bool extends core.Object {
@@ -31544,6 +31643,9 @@
let defaultValue = opts && 'defaultValue' in opts ? opts.defaultValue : false;
dart.throw(new core.UnsupportedError('bool.fromEnvironment can only be used as a const constructor'));
}
+ get [dartx.hashCode]() {
+ return super.hashCode;
+ }
[dartx.toString]() {
return this ? "true" : "false";
}
@@ -32680,108 +32782,42 @@
return _Generator;
});
core._Generator = _Generator();
- const _end$ = Symbol('_end');
- const _start$0 = Symbol('_start');
const _generator$ = Symbol('_generator');
core._GeneratorIterable$ = dart.generic(E => {
let _GeneratorOfE = () => (_GeneratorOfE = dart.constFn(core._Generator$(E)))();
- let _GeneratorIteratorOfE = () => (_GeneratorIteratorOfE = dart.constFn(core._GeneratorIterator$(E)))();
- let EmptyIterableOfE = () => (EmptyIterableOfE = dart.constFn(_internal.EmptyIterable$(E)))();
- let _GeneratorIterableOfE = () => (_GeneratorIterableOfE = dart.constFn(core._GeneratorIterable$(E)))();
- class _GeneratorIterable extends core.Iterable$(E) {
- new(end, generator) {
- this[_end$] = end;
- this[_start$0] = 0;
+ class _GeneratorIterable extends _internal.ListIterable$(E) {
+ get length() {
+ return this[length$];
+ }
+ set length(value) {
+ super.length = value;
+ }
+ new(length, generator) {
+ this[length$] = length;
this[_generator$] = generator != null ? generator : _GeneratorOfE().as(core._GeneratorIterable._id);
super.new();
}
- slice(start, end, generator) {
- this[_start$0] = start;
- this[_end$] = end;
- this[_generator$] = generator;
- super.new();
- }
- get iterator() {
- return new (_GeneratorIteratorOfE())(this[_start$0], this[_end$], this[_generator$]);
- }
- get length() {
- return dart.notNull(this[_end$]) - dart.notNull(this[_start$0]);
- }
- skip(count) {
- core.RangeError.checkNotNegative(count, "count");
- if (count == 0) return this;
- let newStart = dart.notNull(this[_start$0]) + dart.notNull(count);
- if (newStart >= dart.notNull(this[_end$])) return new (EmptyIterableOfE())();
- return new (_GeneratorIterableOfE()).slice(newStart, this[_end$], this[_generator$]);
- }
- take(count) {
- core.RangeError.checkNotNegative(count, "count");
- if (count == 0) return new (EmptyIterableOfE())();
- let newEnd = dart.notNull(this[_start$0]) + dart.notNull(count);
- if (newEnd >= dart.notNull(this[_end$])) return this;
- return new (_GeneratorIterableOfE()).slice(this[_start$0], newEnd, this[_generator$]);
+ elementAt(index) {
+ core.RangeError.checkValidIndex(index, this);
+ return this[_generator$](index);
}
static _id(n) {
return n;
}
}
- dart.defineNamedConstructor(_GeneratorIterable, 'slice');
- _GeneratorIterable[dart.implements] = () => [_internal.EfficientLength];
+ const length$ = Symbol("_GeneratorIterable.length");
dart.setSignature(_GeneratorIterable, {
fields: () => ({
- [_start$0]: core.int,
- [_end$]: core.int,
+ length: core.int,
[_generator$]: _GeneratorOfE()
}),
- getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])}),
statics: () => ({_id: dart.definiteFunctionType(core.int, [core.int])}),
names: ['_id']
});
- dart.defineExtensionMembers(_GeneratorIterable, ['skip', 'take', 'iterator', 'length']);
+ dart.defineExtensionMembers(_GeneratorIterable, ['elementAt', 'length']);
return _GeneratorIterable;
});
core._GeneratorIterable = _GeneratorIterable();
- const _index$1 = Symbol('_index');
- const _current$3 = Symbol('_current');
- core._GeneratorIterator$ = dart.generic(E => {
- let IteratorOfE = () => (IteratorOfE = dart.constFn(core.Iterator$(E)))();
- let _GeneratorOfE = () => (_GeneratorOfE = dart.constFn(core._Generator$(E)))();
- class _GeneratorIterator extends core.Object {
- new(index, end, generator) {
- this[_index$1] = index;
- this[_end$] = end;
- this[_generator$] = generator;
- this[_current$3] = null;
- }
- moveNext() {
- if (dart.notNull(this[_index$1]) < dart.notNull(this[_end$])) {
- this[_current$3] = this[_generator$](this[_index$1]);
- this[_index$1] = dart.notNull(this[_index$1]) + 1;
- return true;
- } else {
- this[_current$3] = null;
- return false;
- }
- }
- get current() {
- return this[_current$3];
- }
- }
- dart.addTypeTests(_GeneratorIterator);
- _GeneratorIterator[dart.implements] = () => [IteratorOfE()];
- dart.setSignature(_GeneratorIterator, {
- fields: () => ({
- [_end$]: core.int,
- [_generator$]: _GeneratorOfE(),
- [_index$1]: core.int,
- [_current$3]: E
- }),
- getters: () => ({current: dart.definiteFunctionType(E, [])}),
- methods: () => ({moveNext: dart.definiteFunctionType(core.bool, [])})
- });
- return _GeneratorIterator;
- });
- core._GeneratorIterator = _GeneratorIterator();
core.BidirectionalIterator$ = dart.generic(E => {
let IteratorOfE = () => (IteratorOfE = dart.constFn(core.Iterator$(E)))();
class BidirectionalIterator extends core.Object {}
@@ -32823,6 +32859,9 @@
static _uninstantiable() {
dart.throw(new core.UnsupportedError('class Null cannot be instantiated'));
}
+ get hashCode() {
+ return super.hashCode;
+ }
toString() {
return "null";
}
@@ -32858,7 +32897,7 @@
core.RegExp[dart.implements] = () => [core.Pattern];
core.Set$ = dart.generic(E => {
let LinkedHashSetOfE = () => (LinkedHashSetOfE = dart.constFn(collection.LinkedHashSet$(E)))();
- class Set extends core.Iterable$(E) {
+ class Set extends _internal.EfficientLengthIterable$(E) {
static new() {
return LinkedHashSetOfE().new();
}
@@ -32869,7 +32908,6 @@
return LinkedHashSetOfE().from(elements);
}
}
- Set[dart.implements] = () => [_internal.EfficientLength];
return Set;
});
core.Set = Set();
@@ -32902,41 +32940,38 @@
dart.setSignature(core._StringStackTrace, {
fields: () => ({[_stackTrace]: core.String})
});
+ const _start$0 = Symbol('_start');
const _stop = Symbol('_stop');
core.Stopwatch = class Stopwatch extends core.Object {
+ new() {
+ this[_start$0] = 0;
+ this[_stop] = 0;
+ if (core.Stopwatch._frequency == null) core.Stopwatch._initTicker();
+ }
get frequency() {
return core.Stopwatch._frequency;
}
- new() {
- this[_start$0] = null;
- this[_stop] = null;
- core.Stopwatch._initTicker();
- }
start() {
- if (dart.test(this.isRunning)) return;
- if (this[_start$0] == null) {
- this[_start$0] = core.Stopwatch._now();
- } else {
- this[_start$0] = dart.notNull(core.Stopwatch._now()) - (dart.notNull(this[_stop]) - dart.notNull(this[_start$0]));
+ if (this[_stop] != null) {
+ this[_start$0] = dart.notNull(this[_start$0]) + (dart.notNull(core.Stopwatch._now()) - dart.notNull(this[_stop]));
this[_stop] = null;
}
}
stop() {
- if (!dart.test(this.isRunning)) return;
- this[_stop] = core.Stopwatch._now();
+ let t = this[_stop];
+ t == null ? this[_stop] = core.Stopwatch._now() : t;
}
reset() {
- if (this[_start$0] == null) return;
- this[_start$0] = core.Stopwatch._now();
- if (this[_stop] != null) {
- this[_stop] = this[_start$0];
- }
+ this[_start$0] = (() => {
+ let l = this[_stop];
+ return l != null ? l : core.Stopwatch._now();
+ })();
}
get elapsedTicks() {
- if (this[_start$0] == null) {
- return 0;
- }
- return this[_stop] == null ? dart.notNull(core.Stopwatch._now()) - dart.notNull(this[_start$0]) : dart.notNull(this[_stop]) - dart.notNull(this[_start$0]);
+ return dart.notNull((() => {
+ let l = this[_stop];
+ return l != null ? l : core.Stopwatch._now();
+ })()) - dart.notNull(this[_start$0]);
}
get elapsed() {
return new core.Duration({microseconds: this.elapsedMicroseconds});
@@ -32948,7 +32983,7 @@
return (dart.notNull(this.elapsedTicks) * 1000 / dart.notNull(this.frequency))[dartx.truncate]();
}
get isRunning() {
- return this[_start$0] != null && this[_stop] == null;
+ return this[_stop] == null;
}
static _initTicker() {
_js_helper.Primitives.initTicker();
@@ -33224,37 +33259,471 @@
return new _internal.Symbol(name);
}
};
+ core._SPACE = 32;
+ core._PERCENT = 37;
+ core._AMPERSAND = 38;
+ core._PLUS = 43;
+ core._DOT = 46;
+ core._SLASH = 47;
+ core._COLON = 58;
+ core._EQUALS = 61;
+ core._UPPER_CASE_A = 65;
+ core._UPPER_CASE_Z = 90;
+ core._LEFT_BRACKET = 91;
+ core._BACKSLASH = 92;
+ core._RIGHT_BRACKET = 93;
+ core._LOWER_CASE_A = 97;
+ core._LOWER_CASE_F = 102;
+ core._LOWER_CASE_Z = 122;
+ core._hexDigits = "0123456789ABCDEF";
+ core.Uri = class Uri extends core.Object {
+ static get base() {
+ let uri = _js_helper.Primitives.currentUri();
+ if (uri != null) return core.Uri.parse(uri);
+ dart.throw(new core.UnsupportedError("'Uri.base' is not supported"));
+ }
+ static new(opts) {
+ return core._Uri.new(opts);
+ }
+ static http(authority, unencodedPath, queryParameters) {
+ return core._Uri.http(authority, unencodedPath, queryParameters);
+ }
+ static https(authority, unencodedPath, queryParameters) {
+ return core._Uri.https(authority, unencodedPath, queryParameters);
+ }
+ static file(path, opts) {
+ return core._Uri.file(path, opts);
+ }
+ static directory(path, opts) {
+ return core._Uri.directory(path, opts);
+ }
+ static dataFromString(content, opts) {
+ let mimeType = opts && 'mimeType' in opts ? opts.mimeType : null;
+ let encoding = opts && 'encoding' in opts ? opts.encoding : null;
+ let parameters = opts && 'parameters' in opts ? opts.parameters : null;
+ let base64 = opts && 'base64' in opts ? opts.base64 : false;
+ let data = core.UriData.fromString(content, {mimeType: mimeType, encoding: encoding, parameters: parameters, base64: base64});
+ return data.uri;
+ }
+ static dataFromBytes(bytes, opts) {
+ let mimeType = opts && 'mimeType' in opts ? opts.mimeType : "application/octet-stream";
+ let parameters = opts && 'parameters' in opts ? opts.parameters : null;
+ let percentEncoded = opts && 'percentEncoded' in opts ? opts.percentEncoded : false;
+ let data = core.UriData.fromBytes(bytes, {mimeType: mimeType, parameters: parameters, percentEncoded: percentEncoded});
+ return data.uri;
+ }
+ get hasScheme() {
+ return this.scheme[dartx.isNotEmpty];
+ }
+ static parse(uri, start, end) {
+ if (start === void 0) start = 0;
+ if (end === void 0) end = null;
+ let t = end;
+ t == null ? end = uri[dartx.length] : t;
+ if (dart.notNull(end) >= dart.notNull(start) + 5) {
+ let dataDelta = core._startsWithData(uri, start);
+ if (dataDelta == 0) {
+ if (dart.notNull(start) > 0 || dart.notNull(end) < dart.notNull(uri[dartx.length])) uri = uri[dartx.substring](start, end);
+ return core.UriData._parse(uri, 5, null).uri;
+ } else if (dataDelta == 32) {
+ return core.UriData._parse(uri[dartx.substring](dart.notNull(start) + 5, end), 0, null).uri;
+ }
+ }
+ let indices = ListOfint().new(8);
+ indices[dartx._set](0, 0);
+ indices[dartx._set](core._schemeEndIndex, dart.notNull(start) - 1);
+ indices[dartx._set](core._hostStartIndex, dart.notNull(start) - 1);
+ indices[dartx._set](core._notSimpleIndex, dart.notNull(start) - 1);
+ indices[dartx._set](core._portStartIndex, start);
+ indices[dartx._set](core._pathStartIndex, start);
+ indices[dartx._set](core._queryStartIndex, end);
+ indices[dartx._set](core._fragmentStartIndex, end);
+ let state = core._scan(uri, start, end, core._uriStart, indices);
+ if (dart.notNull(state) >= core._nonSimpleEndStates) {
+ indices[dartx._set](core._notSimpleIndex, end);
+ }
+ let schemeEnd = indices[dartx._get](core._schemeEndIndex);
+ if (dart.notNull(schemeEnd) >= dart.notNull(start)) {
+ state = core._scan(uri, start, schemeEnd, core._schemeStart, indices);
+ if (state == core._schemeStart) {
+ indices[dartx._set](core._notSimpleIndex, schemeEnd);
+ }
+ }
+ let hostStart = dart.notNull(indices[dartx._get](core._hostStartIndex)) + 1;
+ let portStart = indices[dartx._get](core._portStartIndex);
+ let pathStart = indices[dartx._get](core._pathStartIndex);
+ let queryStart = indices[dartx._get](core._queryStartIndex);
+ let fragmentStart = indices[dartx._get](core._fragmentStartIndex);
+ let scheme = null;
+ if (dart.notNull(fragmentStart) < dart.notNull(queryStart)) queryStart = fragmentStart;
+ if (dart.notNull(pathStart) < dart.notNull(hostStart) || dart.notNull(pathStart) <= dart.notNull(schemeEnd)) {
+ pathStart = queryStart;
+ }
+ if (dart.notNull(portStart) < dart.notNull(hostStart)) portStart = pathStart;
+ dart.assert(hostStart == start || dart.notNull(schemeEnd) <= dart.notNull(hostStart));
+ dart.assert(dart.notNull(hostStart) <= dart.notNull(portStart));
+ dart.assert(dart.notNull(schemeEnd) <= dart.notNull(pathStart));
+ dart.assert(dart.notNull(portStart) <= dart.notNull(pathStart));
+ dart.assert(dart.notNull(pathStart) <= dart.notNull(queryStart));
+ dart.assert(dart.notNull(queryStart) <= dart.notNull(fragmentStart));
+ let isSimple = dart.notNull(indices[dartx._get](core._notSimpleIndex)) < dart.notNull(start);
+ if (isSimple) {
+ if (dart.notNull(hostStart) > dart.notNull(schemeEnd) + 3) {
+ isSimple = false;
+ } else if (dart.notNull(portStart) > dart.notNull(start) && dart.notNull(portStart) + 1 == pathStart) {
+ isSimple = false;
+ } else if (dart.notNull(queryStart) < dart.notNull(end) && queryStart == dart.notNull(pathStart) + 2 && dart.test(uri[dartx.startsWith]("..", pathStart)) || dart.notNull(queryStart) > dart.notNull(pathStart) + 2 && dart.test(uri[dartx.startsWith]("/..", dart.notNull(queryStart) - 3))) {
+ isSimple = false;
+ } else {
+ if (schemeEnd == dart.notNull(start) + 4) {
+ if (dart.test(uri[dartx.startsWith]("file", start))) {
+ scheme = "file";
+ if (dart.notNull(hostStart) <= dart.notNull(start)) {
+ let schemeAuth = "file://";
+ let delta = 2;
+ if (!dart.test(uri[dartx.startsWith]("/", pathStart))) {
+ schemeAuth = "file:///";
+ delta = 3;
+ }
+ uri = schemeAuth + dart.notNull(uri[dartx.substring](pathStart, end));
+ schemeEnd = dart.notNull(schemeEnd) - dart.notNull(start);
+ hostStart = 7;
+ portStart = 7;
+ pathStart = 7;
+ queryStart = dart.notNull(queryStart) + (delta - dart.notNull(start));
+ fragmentStart = dart.notNull(fragmentStart) + (delta - dart.notNull(start));
+ start = 0;
+ end = uri[dartx.length];
+ } else if (pathStart == queryStart) {
+ if (start == 0 && end == uri[dartx.length]) {
+ uri = uri[dartx.replaceRange](pathStart, queryStart, "/");
+ queryStart = dart.notNull(queryStart) + 1;
+ fragmentStart = dart.notNull(fragmentStart) + 1;
+ end = dart.notNull(end) + 1;
+ } else {
+ uri = dart.str`${uri[dartx.substring](start, pathStart)}/` + dart.str`${uri[dartx.substring](queryStart, end)}`;
+ schemeEnd = dart.notNull(schemeEnd) - dart.notNull(start);
+ hostStart = dart.notNull(hostStart) - dart.notNull(start);
+ portStart = dart.notNull(portStart) - dart.notNull(start);
+ pathStart = dart.notNull(pathStart) - dart.notNull(start);
+ queryStart = dart.notNull(queryStart) + (1 - dart.notNull(start));
+ fragmentStart = dart.notNull(fragmentStart) + (1 - dart.notNull(start));
+ start = 0;
+ end = uri[dartx.length];
+ }
+ }
+ } else if (dart.test(uri[dartx.startsWith]("http", start))) {
+ scheme = "http";
+ if (dart.notNull(portStart) > dart.notNull(start) && dart.notNull(portStart) + 3 == pathStart && dart.test(uri[dartx.startsWith]("80", dart.notNull(portStart) + 1))) {
+ if (start == 0 && end == uri[dartx.length]) {
+ uri = uri[dartx.replaceRange](portStart, pathStart, "");
+ pathStart = dart.notNull(pathStart) - 3;
+ queryStart = dart.notNull(queryStart) - 3;
+ fragmentStart = dart.notNull(fragmentStart) - 3;
+ end = dart.notNull(end) - 3;
+ } else {
+ uri = dart.notNull(uri[dartx.substring](start, portStart)) + dart.notNull(uri[dartx.substring](pathStart, end));
+ schemeEnd = dart.notNull(schemeEnd) - dart.notNull(start);
+ hostStart = dart.notNull(hostStart) - dart.notNull(start);
+ portStart = dart.notNull(portStart) - dart.notNull(start);
+ pathStart = dart.notNull(pathStart) - (3 + dart.notNull(start));
+ queryStart = dart.notNull(queryStart) - (3 + dart.notNull(start));
+ fragmentStart = dart.notNull(fragmentStart) - (3 + dart.notNull(start));
+ start = 0;
+ end = uri[dartx.length];
+ }
+ }
+ }
+ } else if (schemeEnd == dart.notNull(start) + 5 && dart.test(uri[dartx.startsWith]("https", start))) {
+ scheme = "https";
+ if (dart.notNull(portStart) > dart.notNull(start) && dart.notNull(portStart) + 4 == pathStart && dart.test(uri[dartx.startsWith]("443", dart.notNull(portStart) + 1))) {
+ if (start == 0 && end == uri[dartx.length]) {
+ uri = uri[dartx.replaceRange](portStart, pathStart, "");
+ pathStart = dart.notNull(pathStart) - 4;
+ queryStart = dart.notNull(queryStart) - 4;
+ fragmentStart = dart.notNull(fragmentStart) - 4;
+ end = dart.notNull(end) - 3;
+ } else {
+ uri = dart.notNull(uri[dartx.substring](start, portStart)) + dart.notNull(uri[dartx.substring](pathStart, end));
+ schemeEnd = dart.notNull(schemeEnd) - dart.notNull(start);
+ hostStart = dart.notNull(hostStart) - dart.notNull(start);
+ portStart = dart.notNull(portStart) - dart.notNull(start);
+ pathStart = dart.notNull(pathStart) - (4 + dart.notNull(start));
+ queryStart = dart.notNull(queryStart) - (4 + dart.notNull(start));
+ fragmentStart = dart.notNull(fragmentStart) - (4 + dart.notNull(start));
+ start = 0;
+ end = uri[dartx.length];
+ }
+ }
+ }
+ }
+ }
+ if (isSimple) {
+ if (dart.notNull(start) > 0 || dart.notNull(end) < dart.notNull(uri[dartx.length])) {
+ uri = uri[dartx.substring](start, end);
+ schemeEnd = dart.notNull(schemeEnd) - dart.notNull(start);
+ hostStart = dart.notNull(hostStart) - dart.notNull(start);
+ portStart = dart.notNull(portStart) - dart.notNull(start);
+ pathStart = dart.notNull(pathStart) - dart.notNull(start);
+ queryStart = dart.notNull(queryStart) - dart.notNull(start);
+ fragmentStart = dart.notNull(fragmentStart) - dart.notNull(start);
+ }
+ return new core._SimpleUri(uri, schemeEnd, hostStart, portStart, pathStart, queryStart, fragmentStart, scheme);
+ }
+ return core._Uri.notSimple(uri, start, end, schemeEnd, hostStart, portStart, pathStart, queryStart, fragmentStart, scheme);
+ }
+ static encodeComponent(component) {
+ return core._Uri._uriEncode(core._Uri._unreserved2396Table, component, convert.UTF8, false);
+ }
+ static encodeQueryComponent(component, opts) {
+ let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
+ return core._Uri._uriEncode(core._Uri._unreservedTable, component, encoding, true);
+ }
+ static decodeComponent(encodedComponent) {
+ return core._Uri._uriDecode(encodedComponent, 0, encodedComponent[dartx.length], convert.UTF8, false);
+ }
+ static decodeQueryComponent(encodedComponent, opts) {
+ let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
+ return core._Uri._uriDecode(encodedComponent, 0, encodedComponent[dartx.length], encoding, true);
+ }
+ static encodeFull(uri) {
+ return core._Uri._uriEncode(core._Uri._encodeFullTable, uri, convert.UTF8, false);
+ }
+ static decodeFull(uri) {
+ return core._Uri._uriDecode(uri, 0, uri[dartx.length], convert.UTF8, false);
+ }
+ static splitQueryString(query, opts) {
+ let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
+ return query[dartx.split]("&")[dartx.fold](MapOfString$String())(dart.map({}, core.String, core.String), dart.fn((map, element) => {
+ let index = element[dartx.indexOf]("=");
+ if (index == -1) {
+ if (element != "") {
+ map[dartx._set](core.Uri.decodeQueryComponent(element, {encoding: encoding}), "");
+ }
+ } else if (index != 0) {
+ let key = element[dartx.substring](0, index);
+ let value = element[dartx.substring](dart.notNull(index) + 1);
+ map[dartx._set](core.Uri.decodeQueryComponent(key, {encoding: encoding}), core.Uri.decodeQueryComponent(value, {encoding: encoding}));
+ }
+ return map;
+ }, MapOfString$StringAndStringToMapOfString$String()));
+ }
+ static parseIPv4Address(host) {
+ return core.Uri._parseIPv4Address(host, 0, host[dartx.length]);
+ }
+ static _parseIPv4Address(host, start, end) {
+ function error(msg, position) {
+ dart.throw(new core.FormatException(dart.str`Illegal IPv4 address, ${msg}`, host, position));
+ }
+ dart.fn(error, StringAndintTovoid());
+ let result = typed_data.Uint8List.new(4);
+ let partIndex = 0;
+ let partStart = start;
+ for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(i) + 1) {
+ let char = host[dartx.codeUnitAt](i);
+ if (char != core._DOT) {
+ if ((dart.notNull(char) ^ 48) >>> 0 > 9) {
+ error("invalid character", i);
+ }
+ } else {
+ if (partIndex == 3) {
+ error('IPv4 address should contain exactly 4 parts', i);
+ }
+ let part = core.int.parse(host[dartx.substring](partStart, i));
+ if (dart.notNull(part) > 255) {
+ error("each part must be in the range 0..255", partStart);
+ }
+ result[dartx._set](partIndex++, part);
+ partStart = dart.notNull(i) + 1;
+ }
+ }
+ if (partIndex != 3) {
+ error('IPv4 address should contain exactly 4 parts', end);
+ }
+ let part = core.int.parse(host[dartx.substring](partStart, end));
+ if (dart.notNull(part) > 255) {
+ error("each part must be in the range 0..255", partStart);
+ }
+ result[dartx._set](partIndex, part);
+ return result;
+ }
+ static parseIPv6Address(host, start, end) {
+ if (start === void 0) start = 0;
+ if (end === void 0) end = null;
+ if (end == null) end = host[dartx.length];
+ function error(msg, position) {
+ if (position === void 0) position = null;
+ dart.throw(new core.FormatException(dart.str`Illegal IPv6 address, ${msg}`, host, core.int._check(position)));
+ }
+ dart.fn(error, String__Tovoid());
+ function parseHex(start, end) {
+ if (dart.notNull(end) - dart.notNull(start) > 4) {
+ error('an IPv6 part can only contain a maximum of 4 hex digits', start);
+ }
+ let value = core.int.parse(host[dartx.substring](start, end), {radix: 16});
+ if (dart.notNull(value) < 0 || dart.notNull(value) > 65535) {
+ error('each part must be in the range of `0x0..0xFFFF`', start);
+ }
+ return value;
+ }
+ dart.fn(parseHex, intAndintToint());
+ if (dart.notNull(host[dartx.length]) < 2) error('address is too short');
+ let parts = JSArrayOfint().of([]);
+ let wildcardSeen = false;
+ let seenDot = false;
+ let partStart = start;
+ for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(i) + 1) {
+ let char = host[dartx.codeUnitAt](i);
+ if (char == core._COLON) {
+ if (i == start) {
+ i = dart.notNull(i) + 1;
+ if (host[dartx.codeUnitAt](i) != core._COLON) {
+ error('invalid start colon.', i);
+ }
+ partStart = i;
+ }
+ if (i == partStart) {
+ if (wildcardSeen) {
+ error('only one wildcard `::` is allowed', i);
+ }
+ wildcardSeen = true;
+ parts[dartx.add](-1);
+ } else {
+ parts[dartx.add](parseHex(partStart, i));
+ }
+ partStart = dart.notNull(i) + 1;
+ } else if (char == core._DOT) {
+ seenDot = true;
+ }
+ }
+ if (parts[dartx.length] == 0) error('too few parts');
+ let atEnd = partStart == end;
+ let isLastWildcard = parts[dartx.last] == -1;
+ if (atEnd && !isLastWildcard) {
+ error('expected a part after last `:`', end);
+ }
+ if (!atEnd) {
+ if (!seenDot) {
+ parts[dartx.add](parseHex(partStart, end));
+ } else {
+ let last = core.Uri._parseIPv4Address(host, partStart, end);
+ parts[dartx.add]((dart.notNull(last[dartx._get](0)) << 8 | dart.notNull(last[dartx._get](1))) >>> 0);
+ parts[dartx.add]((dart.notNull(last[dartx._get](2)) << 8 | dart.notNull(last[dartx._get](3))) >>> 0);
+ }
+ }
+ if (wildcardSeen) {
+ if (dart.notNull(parts[dartx.length]) > 7) {
+ error('an address with a wildcard must have less than 7 parts');
+ }
+ } else if (parts[dartx.length] != 8) {
+ error('an address without a wildcard must contain exactly 8 parts');
+ }
+ let bytes = typed_data.Uint8List.new(16);
+ for (let i = 0, index = 0; i < dart.notNull(parts[dartx.length]); i++) {
+ let value = parts[dartx._get](i);
+ if (value == -1) {
+ let wildCardLength = 9 - dart.notNull(parts[dartx.length]);
+ for (let j = 0; j < wildCardLength; j++) {
+ bytes[dartx._set](index, 0);
+ bytes[dartx._set](index + 1, 0);
+ index = index + 2;
+ }
+ } else {
+ bytes[dartx._set](index, value[dartx['>>']](8));
+ bytes[dartx._set](index + 1, dart.notNull(value) & 255);
+ index = index + 2;
+ }
+ }
+ return bytes;
+ }
+ };
+ dart.setSignature(core.Uri, {
+ getters: () => ({hasScheme: dart.definiteFunctionType(core.bool, [])}),
+ statics: () => ({
+ parse: dart.definiteFunctionType(core.Uri, [core.String], [core.int, core.int]),
+ encodeComponent: dart.definiteFunctionType(core.String, [core.String]),
+ encodeQueryComponent: dart.definiteFunctionType(core.String, [core.String], {encoding: convert.Encoding}),
+ decodeComponent: dart.definiteFunctionType(core.String, [core.String]),
+ decodeQueryComponent: dart.definiteFunctionType(core.String, [core.String], {encoding: convert.Encoding}),
+ encodeFull: dart.definiteFunctionType(core.String, [core.String]),
+ decodeFull: dart.definiteFunctionType(core.String, [core.String]),
+ splitQueryString: dart.definiteFunctionType(core.Map$(core.String, core.String), [core.String], {encoding: convert.Encoding}),
+ parseIPv4Address: dart.definiteFunctionType(core.List$(core.int), [core.String]),
+ _parseIPv4Address: dart.definiteFunctionType(core.List$(core.int), [core.String, core.int, core.int]),
+ parseIPv6Address: dart.definiteFunctionType(core.List$(core.int), [core.String], [core.int, core.int])
+ }),
+ names: ['parse', 'encodeComponent', 'encodeQueryComponent', 'decodeComponent', 'decodeQueryComponent', 'encodeFull', 'decodeFull', 'splitQueryString', 'parseIPv4Address', '_parseIPv4Address', 'parseIPv6Address']
+ });
const _userInfo = Symbol('_userInfo');
const _host = Symbol('_host');
const _port = Symbol('_port');
- const _path = Symbol('_path');
const _query = Symbol('_query');
const _fragment = Symbol('_fragment');
const _pathSegments = Symbol('_pathSegments');
+ const _text = Symbol('_text');
+ const _hashCodeCache = Symbol('_hashCodeCache');
const _queryParameters = Symbol('_queryParameters');
const _queryParameterLists = Symbol('_queryParameterLists');
const _writeAuthority = Symbol('_writeAuthority');
let const$51;
const _mergePaths = Symbol('_mergePaths');
- const _toWindowsFilePath = Symbol('_toWindowsFilePath');
const _toFilePath = Symbol('_toFilePath');
const _isPathAbsolute = Symbol('_isPathAbsolute');
- core.Uri = class Uri extends core.Object {
+ const _initializeText = Symbol('_initializeText');
+ core._Uri = class _Uri extends core.Object {
_internal(scheme, userInfo, host, port, path, query, fragment) {
this.scheme = scheme;
this[_userInfo] = userInfo;
this[_host] = host;
this[_port] = port;
- this[_path] = path;
+ this.path = path;
this[_query] = query;
this[_fragment] = fragment;
this[_pathSegments] = null;
+ this[_text] = null;
+ this[_hashCodeCache] = null;
this[_queryParameters] = null;
this[_queryParameterLists] = null;
}
+ static notSimple(uri, start, end, schemeEnd, hostStart, portStart, pathStart, queryStart, fragmentStart, scheme) {
+ if (scheme == null) {
+ scheme = "";
+ if (dart.notNull(schemeEnd) > dart.notNull(start)) {
+ scheme = core._Uri._makeScheme(uri, start, schemeEnd);
+ } else if (schemeEnd == start) {
+ core._Uri._fail(uri, start, "Invalid empty scheme");
+ }
+ }
+ let userInfo = "";
+ let host = null;
+ let port = null;
+ if (dart.notNull(hostStart) > dart.notNull(start)) {
+ let userInfoStart = dart.notNull(schemeEnd) + 3;
+ if (userInfoStart < dart.notNull(hostStart)) {
+ userInfo = core._Uri._makeUserInfo(uri, userInfoStart, dart.notNull(hostStart) - 1);
+ }
+ host = core._Uri._makeHost(uri, hostStart, portStart, false);
+ if (dart.notNull(portStart) + 1 < dart.notNull(pathStart)) {
+ port = core.int.parse(uri[dartx.substring](dart.notNull(portStart) + 1, pathStart), {onError: dart.fn(_ => {
+ dart.throw(new core.FormatException("Invalid port", uri, dart.notNull(portStart) + 1));
+ }, StringToNull())});
+ port = core._Uri._makePort(port, scheme);
+ }
+ }
+ let path = core._Uri._makePath(uri, pathStart, queryStart, null, scheme, host != null);
+ let query = null;
+ if (dart.notNull(queryStart) < dart.notNull(fragmentStart)) {
+ query = core._Uri._makeQuery(uri, dart.notNull(queryStart) + 1, fragmentStart, null);
+ }
+ let fragment = null;
+ if (dart.notNull(fragmentStart) < dart.notNull(end)) {
+ fragment = core._Uri._makeFragment(uri, dart.notNull(fragmentStart) + 1, end);
+ }
+ return new core._Uri._internal(scheme, userInfo, host, port, path, query, fragment);
+ }
static new(opts) {
- let scheme = opts && 'scheme' in opts ? opts.scheme : "";
- let userInfo = opts && 'userInfo' in opts ? opts.userInfo : "";
+ let scheme = opts && 'scheme' in opts ? opts.scheme : null;
+ let userInfo = opts && 'userInfo' in opts ? opts.userInfo : null;
let host = opts && 'host' in opts ? opts.host : null;
let port = opts && 'port' in opts ? opts.port : null;
let path = opts && 'path' in opts ? opts.path : null;
@@ -33262,33 +33731,37 @@
let query = opts && 'query' in opts ? opts.query : null;
let queryParameters = opts && 'queryParameters' in opts ? opts.queryParameters : null;
let fragment = opts && 'fragment' in opts ? opts.fragment : null;
- scheme = core.Uri._makeScheme(scheme, 0, core.Uri._stringOrNullLength(scheme));
- userInfo = core.Uri._makeUserInfo(userInfo, 0, core.Uri._stringOrNullLength(userInfo));
- host = core.Uri._makeHost(host, 0, core.Uri._stringOrNullLength(host), false);
+ scheme = core._Uri._makeScheme(scheme, 0, core._stringOrNullLength(scheme));
+ userInfo = core._Uri._makeUserInfo(userInfo, 0, core._stringOrNullLength(userInfo));
+ host = core._Uri._makeHost(host, 0, core._stringOrNullLength(host), false);
if (query == "") query = null;
- query = core.Uri._makeQuery(query, 0, core.Uri._stringOrNullLength(query), queryParameters);
- fragment = core.Uri._makeFragment(fragment, 0, core.Uri._stringOrNullLength(fragment));
- port = core.Uri._makePort(port, scheme);
+ query = core._Uri._makeQuery(query, 0, core._stringOrNullLength(query), queryParameters);
+ fragment = core._Uri._makeFragment(fragment, 0, core._stringOrNullLength(fragment));
+ port = core._Uri._makePort(port, scheme);
let isFile = scheme == "file";
if (host == null && (dart.test(userInfo[dartx.isNotEmpty]) || port != null || isFile)) {
host = "";
}
let hasAuthority = host != null;
- path = core.Uri._makePath(path, 0, core.Uri._stringOrNullLength(path), pathSegments, scheme, hasAuthority);
+ path = core._Uri._makePath(path, 0, core._stringOrNullLength(path), pathSegments, scheme, hasAuthority);
if (dart.test(scheme[dartx.isEmpty]) && host == null && !dart.test(path[dartx.startsWith]('/'))) {
- path = core.Uri._normalizeRelativePath(path);
+ let allowScheme = dart.test(scheme[dartx.isNotEmpty]) || host != null;
+ path = core._Uri._normalizeRelativePath(path, allowScheme);
} else {
- path = core.Uri._removeDotSegments(path);
+ path = core._Uri._removeDotSegments(path);
}
- return new core.Uri._internal(scheme, userInfo, host, port, path, query, fragment);
+ if (host == null && dart.test(path[dartx.startsWith]("//"))) {
+ host = "";
+ }
+ return new core._Uri._internal(scheme, userInfo, host, port, path, query, fragment);
}
static http(authority, unencodedPath, queryParameters) {
if (queryParameters === void 0) queryParameters = null;
- return core.Uri._makeHttpUri("http", authority, unencodedPath, queryParameters);
+ return core._Uri._check(core._Uri._makeHttpUri("http", authority, unencodedPath, queryParameters));
}
static https(authority, unencodedPath, queryParameters) {
if (queryParameters === void 0) queryParameters = null;
- return core.Uri._makeHttpUri("https", authority, unencodedPath, queryParameters);
+ return core._Uri._check(core._Uri._makeHttpUri("https", authority, unencodedPath, queryParameters));
}
get authority() {
if (!dart.test(this.hasAuthority)) return "";
@@ -33307,7 +33780,7 @@
return this[_host];
}
get port() {
- if (this[_port] == null) return core.Uri._defaultPort(this.scheme);
+ if (this[_port] == null) return core._Uri._defaultPort(this.scheme);
return this[_port];
}
static _defaultPort(scheme) {
@@ -33315,181 +33788,34 @@
if (scheme == "https") return 443;
return 0;
}
- get path() {
- return this[_path];
- }
get query() {
- return this[_query] == null ? "" : this[_query];
+ return this[_query] != null ? this[_query] : "";
}
get fragment() {
- return this[_fragment] == null ? "" : this[_fragment];
+ return this[_fragment] != null ? this[_fragment] : "";
}
- static parse(uri, start, end) {
- if (start === void 0) start = 0;
- if (end === void 0) end = null;
- let EOI = -1;
- let scheme = "";
- let userinfo = "";
- let host = null;
- let port = null;
- let path = null;
- let query = null;
- let fragment = null;
- if (end == null) end = uri[dartx.length];
- let index = start;
- let pathStart = start;
- let char = EOI;
- function parseAuth() {
- if (index == end) {
- char = EOI;
- return;
- }
- let authStart = index;
- let lastColon = -1;
- let lastAt = -1;
- char = uri[dartx.codeUnitAt](index);
- while (dart.notNull(index) < dart.notNull(end)) {
- char = uri[dartx.codeUnitAt](index);
- if (char == core.Uri._SLASH || char == core.Uri._QUESTION || char == core.Uri._NUMBER_SIGN) {
- break;
- }
- if (char == core.Uri._AT_SIGN) {
- lastAt = index;
- lastColon = -1;
- } else if (char == core.Uri._COLON) {
- lastColon = index;
- } else if (char == core.Uri._LEFT_BRACKET) {
- lastColon = -1;
- let endBracket = uri[dartx.indexOf](']', dart.notNull(index) + 1);
- if (endBracket == -1) {
- index = end;
- char = EOI;
- break;
- } else {
- index = endBracket;
+ isScheme(scheme) {
+ let thisScheme = this.scheme;
+ if (scheme == null) return thisScheme[dartx.isEmpty];
+ if (scheme[dartx.length] != thisScheme[dartx.length]) return false;
+ return core._Uri._compareScheme(scheme, thisScheme);
+ }
+ static _compareScheme(scheme, uri) {
+ for (let i = 0; i < dart.notNull(scheme[dartx.length]); i++) {
+ let schemeChar = scheme[dartx.codeUnitAt](i);
+ let uriChar = uri[dartx.codeUnitAt](i);
+ let delta = (dart.notNull(schemeChar) ^ dart.notNull(uriChar)) >>> 0;
+ if (delta != 0) {
+ if (delta == 32) {
+ let lowerChar = (dart.notNull(uriChar) | delta) >>> 0;
+ if (97 <= lowerChar && lowerChar <= 122) {
+ continue;
}
}
- index = dart.notNull(index) + 1;
- char = EOI;
- }
- let hostStart = authStart;
- let hostEnd = index;
- if (dart.notNull(lastAt) >= 0) {
- userinfo = core.Uri._makeUserInfo(uri, authStart, lastAt);
- hostStart = dart.notNull(lastAt) + 1;
- }
- if (dart.notNull(lastColon) >= 0) {
- let portNumber = null;
- if (dart.notNull(lastColon) + 1 < dart.notNull(index)) {
- portNumber = 0;
- for (let i = dart.notNull(lastColon) + 1; i < dart.notNull(index); i++) {
- let digit = uri[dartx.codeUnitAt](i);
- if (core.Uri._ZERO > dart.notNull(digit) || core.Uri._NINE < dart.notNull(digit)) {
- core.Uri._fail(uri, i, "Invalid port number");
- }
- portNumber = dart.notNull(portNumber) * 10 + (dart.notNull(digit) - core.Uri._ZERO);
- }
- }
- port = core.Uri._makePort(portNumber, scheme);
- hostEnd = lastColon;
- }
- host = core.Uri._makeHost(uri, hostStart, hostEnd, true);
- if (dart.notNull(index) < dart.notNull(end)) {
- char = uri[dartx.codeUnitAt](index);
+ return false;
}
}
- dart.fn(parseAuth, VoidTovoid$());
- let NOT_IN_PATH = 0;
- let IN_PATH = 1;
- let ALLOW_AUTH = 2;
- let state = NOT_IN_PATH;
- let i = index;
- while (dart.notNull(i) < dart.notNull(end)) {
- char = uri[dartx.codeUnitAt](i);
- if (char == core.Uri._QUESTION || char == core.Uri._NUMBER_SIGN) {
- state = NOT_IN_PATH;
- break;
- }
- if (char == core.Uri._SLASH) {
- state = i == start ? ALLOW_AUTH : IN_PATH;
- break;
- }
- if (char == core.Uri._COLON) {
- if (i == start) core.Uri._fail(uri, start, "Invalid empty scheme");
- scheme = core.Uri._makeScheme(uri, start, i);
- i = dart.notNull(i) + 1;
- pathStart = i;
- if (i == end) {
- char = EOI;
- state = NOT_IN_PATH;
- } else {
- char = uri[dartx.codeUnitAt](i);
- if (char == core.Uri._QUESTION || char == core.Uri._NUMBER_SIGN) {
- state = NOT_IN_PATH;
- } else if (char == core.Uri._SLASH) {
- state = ALLOW_AUTH;
- } else {
- state = IN_PATH;
- }
- }
- break;
- }
- i = dart.notNull(i) + 1;
- char = EOI;
- }
- index = i;
- if (state == ALLOW_AUTH) {
- dart.assert(char == core.Uri._SLASH);
- index = dart.notNull(index) + 1;
- if (index == end) {
- char = EOI;
- state = NOT_IN_PATH;
- } else {
- char = uri[dartx.codeUnitAt](index);
- if (char == core.Uri._SLASH) {
- index = dart.notNull(index) + 1;
- parseAuth();
- pathStart = index;
- }
- if (char == core.Uri._QUESTION || char == core.Uri._NUMBER_SIGN || char == EOI) {
- state = NOT_IN_PATH;
- } else {
- state = IN_PATH;
- }
- }
- }
- dart.assert(state == IN_PATH || state == NOT_IN_PATH);
- if (state == IN_PATH) {
- while ((index = dart.notNull(index) + 1) < dart.notNull(end)) {
- char = uri[dartx.codeUnitAt](index);
- if (char == core.Uri._QUESTION || char == core.Uri._NUMBER_SIGN) {
- break;
- }
- char = EOI;
- }
- state = NOT_IN_PATH;
- }
- dart.assert(state == NOT_IN_PATH);
- let hasAuthority = host != null;
- path = core.Uri._makePath(uri, pathStart, index, null, scheme, hasAuthority);
- if (char == core.Uri._QUESTION) {
- let numberSignIndex = -1;
- for (let i = dart.notNull(index) + 1; i < dart.notNull(end); i++) {
- if (uri[dartx.codeUnitAt](i) == core.Uri._NUMBER_SIGN) {
- numberSignIndex = i;
- break;
- }
- }
- if (numberSignIndex < 0) {
- query = core.Uri._makeQuery(uri, dart.notNull(index) + 1, end, null);
- } else {
- query = core.Uri._makeQuery(uri, dart.notNull(index) + 1, numberSignIndex, null);
- fragment = core.Uri._makeFragment(uri, numberSignIndex + 1, end);
- }
- } else if (char == core.Uri._NUMBER_SIGN) {
- fragment = core.Uri._makeFragment(uri, dart.notNull(index) + 1, end);
- }
- return new core.Uri._internal(scheme, userinfo, host, port, path, query, fragment);
+ return true;
}
static _fail(uri, index, message) {
dart.throw(new core.FormatException(message, uri, index));
@@ -33502,7 +33828,8 @@
let hostStart = 0;
let hasUserInfo = false;
for (let i = 0; i < dart.notNull(authority[dartx.length]); i++) {
- if (authority[dartx.codeUnitAt](i) == core.Uri._AT_SIGN) {
+ let atSign = 64;
+ if (authority[dartx.codeUnitAt](i) == atSign) {
hasUserInfo = true;
userInfo = authority[dartx.substring](0, i);
hostStart = i + 1;
@@ -33510,22 +33837,22 @@
}
}
let hostEnd = hostStart;
- if (hostStart < dart.notNull(authority[dartx.length]) && authority[dartx.codeUnitAt](hostStart) == core.Uri._LEFT_BRACKET) {
+ if (hostStart < dart.notNull(authority[dartx.length]) && authority[dartx.codeUnitAt](hostStart) == core._LEFT_BRACKET) {
for (; hostEnd < dart.notNull(authority[dartx.length]); hostEnd++) {
- if (authority[dartx.codeUnitAt](hostEnd) == core.Uri._RIGHT_BRACKET) break;
+ if (authority[dartx.codeUnitAt](hostEnd) == core._RIGHT_BRACKET) break;
}
if (hostEnd == authority[dartx.length]) {
dart.throw(new core.FormatException("Invalid IPv6 host entry.", authority, hostStart));
}
core.Uri.parseIPv6Address(authority, hostStart + 1, hostEnd);
hostEnd++;
- if (hostEnd != authority[dartx.length] && authority[dartx.codeUnitAt](hostEnd) != core.Uri._COLON) {
+ if (hostEnd != authority[dartx.length] && authority[dartx.codeUnitAt](hostEnd) != core._COLON) {
dart.throw(new core.FormatException("Invalid end of authority", authority, hostEnd));
}
}
let hasPort = false;
for (; hostEnd < dart.notNull(authority[dartx.length]); hostEnd++) {
- if (authority[dartx.codeUnitAt](hostEnd) == core.Uri._COLON) {
+ if (authority[dartx.codeUnitAt](hostEnd) == core._COLON) {
let portString = authority[dartx.substring](hostEnd + 1);
if (dart.test(portString[dartx.isNotEmpty])) port = core.int.parse(portString);
break;
@@ -33537,33 +33864,13 @@
}
static file(path, opts) {
let windows = opts && 'windows' in opts ? opts.windows : null;
- windows = windows == null ? core.Uri._isWindows : windows;
- return core.Uri._check(dart.test(windows) ? core.Uri._makeWindowsFileUrl(path, false) : core.Uri._makeFileUri(path, false));
+ windows = windows == null ? core._Uri._isWindows : windows;
+ return core._Uri._check(dart.test(windows) ? core._Uri._makeWindowsFileUrl(path, false) : core._Uri._makeFileUri(path, false));
}
static directory(path, opts) {
let windows = opts && 'windows' in opts ? opts.windows : null;
- windows = windows == null ? core.Uri._isWindows : windows;
- return core.Uri._check(dart.test(windows) ? core.Uri._makeWindowsFileUrl(path, true) : core.Uri._makeFileUri(path, true));
- }
- static dataFromString(content, opts) {
- let mimeType = opts && 'mimeType' in opts ? opts.mimeType : null;
- let encoding = opts && 'encoding' in opts ? opts.encoding : null;
- let parameters = opts && 'parameters' in opts ? opts.parameters : null;
- let base64 = opts && 'base64' in opts ? opts.base64 : false;
- let data = core.UriData.fromString(content, {mimeType: mimeType, encoding: encoding, parameters: parameters, base64: base64});
- return data.uri;
- }
- static dataFromBytes(bytes, opts) {
- let mimeType = opts && 'mimeType' in opts ? opts.mimeType : "application/octet-stream";
- let parameters = opts && 'parameters' in opts ? opts.parameters : null;
- let percentEncoded = opts && 'percentEncoded' in opts ? opts.percentEncoded : false;
- let data = core.UriData.fromBytes(bytes, {mimeType: mimeType, parameters: parameters, percentEncoded: percentEncoded});
- return data.uri;
- }
- static get base() {
- let uri = _js_helper.Primitives.currentUri();
- if (uri != null) return core.Uri.parse(uri);
- dart.throw(new core.UnsupportedError("'Uri.base' is not supported"));
+ windows = windows == null ? core._Uri._isWindows : windows;
+ return core._Uri._check(dart.test(windows) ? core._Uri._makeWindowsFileUrl(path, true) : core._Uri._makeFileUri(path, true));
}
static get _isWindows() {
return false;
@@ -33592,7 +33899,7 @@
}
}
static _checkWindowsDriveLetter(charCode, argumentError) {
- if (core.Uri._UPPER_CASE_A <= dart.notNull(charCode) && dart.notNull(charCode) <= core.Uri._UPPER_CASE_Z || core.Uri._LOWER_CASE_A <= dart.notNull(charCode) && dart.notNull(charCode) <= core.Uri._LOWER_CASE_Z) {
+ if (core._UPPER_CASE_A <= dart.notNull(charCode) && dart.notNull(charCode) <= core._UPPER_CASE_Z || core._LOWER_CASE_A <= dart.notNull(charCode) && dart.notNull(charCode) <= core._LOWER_CASE_Z) {
return;
}
if (dart.test(argumentError)) {
@@ -33619,7 +33926,7 @@
path = path[dartx.replaceRange](0, 7, '\\');
} else {
path = path[dartx.substring](4);
- if (dart.notNull(path[dartx.length]) < 3 || path[dartx.codeUnitAt](1) != core.Uri._COLON || path[dartx.codeUnitAt](2) != core.Uri._BACKSLASH) {
+ if (dart.notNull(path[dartx.length]) < 3 || path[dartx.codeUnitAt](1) != core._COLON || path[dartx.codeUnitAt](2) != core._BACKSLASH) {
dart.throw(new core.ArgumentError("Windows paths with \\\\?\\ prefix must be absolute"));
}
}
@@ -33627,16 +33934,16 @@
path = path[dartx.replaceAll]("/", '\\');
}
let sep = '\\';
- if (dart.notNull(path[dartx.length]) > 1 && path[dartx.codeUnitAt](1) == core.Uri._COLON) {
- core.Uri._checkWindowsDriveLetter(path[dartx.codeUnitAt](0), true);
- if (path[dartx.length] == 2 || path[dartx.codeUnitAt](2) != core.Uri._BACKSLASH) {
+ if (dart.notNull(path[dartx.length]) > 1 && path[dartx.codeUnitAt](1) == core._COLON) {
+ core._Uri._checkWindowsDriveLetter(path[dartx.codeUnitAt](0), true);
+ if (path[dartx.length] == 2 || path[dartx.codeUnitAt](2) != core._BACKSLASH) {
dart.throw(new core.ArgumentError("Windows paths with drive letter must be absolute"));
}
let pathSegments = path[dartx.split](sep);
if (dart.test(slashTerminated) && dart.test(pathSegments[dartx.last][dartx.isNotEmpty])) {
pathSegments[dartx.add]("");
}
- core.Uri._checkWindowsPathReservedCharacters(pathSegments, true, 1);
+ core._Uri._checkWindowsPathReservedCharacters(pathSegments, true, 1);
return core.Uri.new({scheme: "file", pathSegments: pathSegments});
}
if (dart.test(path[dartx.startsWith](sep))) {
@@ -33645,7 +33952,7 @@
let hostPart = dart.notNull(pathStart) < 0 ? path[dartx.substring](2) : path[dartx.substring](2, pathStart);
let pathPart = dart.notNull(pathStart) < 0 ? "" : path[dartx.substring](dart.notNull(pathStart) + 1);
let pathSegments = pathPart[dartx.split](sep);
- core.Uri._checkWindowsPathReservedCharacters(pathSegments, true);
+ core._Uri._checkWindowsPathReservedCharacters(pathSegments, true);
if (dart.test(slashTerminated) && dart.test(pathSegments[dartx.last][dartx.isNotEmpty])) {
pathSegments[dartx.add]("");
}
@@ -33655,12 +33962,12 @@
if (dart.test(slashTerminated) && dart.test(pathSegments[dartx.last][dartx.isNotEmpty])) {
pathSegments[dartx.add]("");
}
- core.Uri._checkWindowsPathReservedCharacters(pathSegments, true);
+ core._Uri._checkWindowsPathReservedCharacters(pathSegments, true);
return core.Uri.new({scheme: "file", pathSegments: pathSegments});
}
} else {
let pathSegments = path[dartx.split](sep);
- core.Uri._checkWindowsPathReservedCharacters(pathSegments, true);
+ core._Uri._checkWindowsPathReservedCharacters(pathSegments, true);
if (dart.test(slashTerminated) && dart.test(pathSegments[dartx.isNotEmpty]) && dart.test(pathSegments[dartx.last][dartx.isNotEmpty])) {
pathSegments[dartx.add]("");
}
@@ -33679,27 +33986,27 @@
let fragment = opts && 'fragment' in opts ? opts.fragment : null;
let schemeChanged = false;
if (scheme != null) {
- scheme = core.Uri._makeScheme(scheme, 0, scheme[dartx.length]);
- schemeChanged = true;
+ scheme = core._Uri._makeScheme(scheme, 0, scheme[dartx.length]);
+ schemeChanged = scheme != this.scheme;
} else {
scheme = this.scheme;
}
let isFile = scheme == "file";
if (userInfo != null) {
- userInfo = core.Uri._makeUserInfo(userInfo, 0, userInfo[dartx.length]);
+ userInfo = core._Uri._makeUserInfo(userInfo, 0, userInfo[dartx.length]);
} else {
userInfo = this[_userInfo];
}
if (port != null) {
- port = core.Uri._makePort(port, scheme);
+ port = core._Uri._makePort(port, scheme);
} else {
port = this[_port];
if (schemeChanged) {
- port = core.Uri._makePort(port, scheme);
+ port = core._Uri._makePort(port, scheme);
}
}
if (host != null) {
- host = core.Uri._makeHost(host, 0, host[dartx.length], false);
+ host = core._Uri._makeHost(host, 0, host[dartx.length], false);
} else if (dart.test(this.hasAuthority)) {
host = this[_host];
} else if (dart.test(userInfo[dartx.isNotEmpty]) || port != null || isFile) {
@@ -33707,34 +34014,34 @@
}
let hasAuthority = host != null;
if (path != null || pathSegments != null) {
- path = core.Uri._makePath(path, 0, core.Uri._stringOrNullLength(path), pathSegments, scheme, hasAuthority);
+ path = core._Uri._makePath(path, 0, core._stringOrNullLength(path), pathSegments, scheme, hasAuthority);
} else {
- path = this[_path];
+ path = this.path;
if ((isFile || hasAuthority && !dart.test(path[dartx.isEmpty])) && !dart.test(path[dartx.startsWith]('/'))) {
path = "/" + dart.notNull(path);
}
}
if (query != null || queryParameters != null) {
- query = core.Uri._makeQuery(query, 0, core.Uri._stringOrNullLength(query), queryParameters);
+ query = core._Uri._makeQuery(query, 0, core._stringOrNullLength(query), queryParameters);
} else {
query = this[_query];
}
if (fragment != null) {
- fragment = core.Uri._makeFragment(fragment, 0, fragment[dartx.length]);
+ fragment = core._Uri._makeFragment(fragment, 0, fragment[dartx.length]);
} else {
fragment = this[_fragment];
}
- return new core.Uri._internal(scheme, userInfo, host, port, path, query, fragment);
+ return new core._Uri._internal(scheme, userInfo, host, port, path, query, fragment);
}
removeFragment() {
if (!dart.test(this.hasFragment)) return this;
- return new core.Uri._internal(this.scheme, this[_userInfo], this[_host], this[_port], this[_path], this[_query], null);
+ return new core._Uri._internal(this.scheme, this[_userInfo], this[_host], this[_port], this.path, this[_query], null);
}
get pathSegments() {
let result = this[_pathSegments];
if (result != null) return result;
let pathToSplit = this.path;
- if (dart.test(pathToSplit[dartx.isNotEmpty]) && pathToSplit[dartx.codeUnitAt](0) == core.Uri._SLASH) {
+ if (dart.test(pathToSplit[dartx.isNotEmpty]) && pathToSplit[dartx.codeUnitAt](0) == core._SLASH) {
pathToSplit = pathToSplit[dartx.substring](1);
}
result = pathToSplit == "" ? const$51 || (const$51 = dart.constList([], core.String)) : ListOfString().unmodifiable(pathToSplit[dartx.split]("/")[dartx.map](core.String)(core.Uri.decodeComponent));
@@ -33749,7 +34056,7 @@
}
get queryParametersAll() {
if (this[_queryParameterLists] == null) {
- let queryParameterLists = core.Uri._splitQueryStringAll(this.query);
+ let queryParameterLists = core._Uri._splitQueryStringAll(this.query);
for (let key of queryParameterLists[dartx.keys]) {
queryParameterLists[dartx._set](key, ListOfString().unmodifiable(core.Iterable._check(queryParameterLists[dartx._get](key))));
}
@@ -33758,36 +34065,36 @@
return this[_queryParameterLists];
}
normalizePath() {
- let path = core.Uri._normalizePath(this[_path], this.scheme, this.hasAuthority);
- if (core.identical(path, this[_path])) return this;
+ let path = core._Uri._normalizePath(this.path, this.scheme, this.hasAuthority);
+ if (core.identical(path, this.path)) return this;
return this.replace({path: path});
}
static _makePort(port, scheme) {
- if (port != null && port == core.Uri._defaultPort(scheme)) return null;
+ if (port != null && port == core._Uri._defaultPort(scheme)) return null;
return port;
}
static _makeHost(host, start, end, strictIPv6) {
if (host == null) return null;
if (start == end) return "";
- if (host[dartx.codeUnitAt](start) == core.Uri._LEFT_BRACKET) {
- if (host[dartx.codeUnitAt](dart.notNull(end) - 1) != core.Uri._RIGHT_BRACKET) {
- core.Uri._fail(host, start, 'Missing end `]` to match `[` in host');
+ if (host[dartx.codeUnitAt](start) == core._LEFT_BRACKET) {
+ if (host[dartx.codeUnitAt](dart.notNull(end) - 1) != core._RIGHT_BRACKET) {
+ core._Uri._fail(host, start, 'Missing end `]` to match `[` in host');
}
core.Uri.parseIPv6Address(host, dart.notNull(start) + 1, dart.notNull(end) - 1);
return host[dartx.substring](start, end)[dartx.toLowerCase]();
}
if (!dart.test(strictIPv6)) {
for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(i) + 1) {
- if (host[dartx.codeUnitAt](i) == core.Uri._COLON) {
+ if (host[dartx.codeUnitAt](i) == core._COLON) {
core.Uri.parseIPv6Address(host, start, end);
return dart.str`[${host}]`;
}
}
}
- return core.Uri._normalizeRegName(host, start, end);
+ return core._Uri._normalizeRegName(host, start, end);
}
static _isRegNameChar(char) {
- return dart.notNull(char) < 127 && (dart.notNull(core.Uri._regNameTable[dartx._get](char[dartx['>>']](4))) & 1 << (dart.notNull(char) & 15)) != 0;
+ return dart.notNull(char) < 127 && (dart.notNull(core._Uri._regNameTable[dartx._get](char[dartx['>>']](4))) & 1 << (dart.notNull(char) & 15)) != 0;
}
static _normalizeRegName(host, start, end) {
let buffer = null;
@@ -33796,8 +34103,8 @@
let isNormalized = true;
while (dart.notNull(index) < dart.notNull(end)) {
let char = host[dartx.codeUnitAt](index);
- if (char == core.Uri._PERCENT) {
- let replacement = core.Uri._normalizeEscape(host, index, true);
+ if (char == core._PERCENT) {
+ let replacement = core._Uri._normalizeEscape(host, index, true);
if (replacement == null && isNormalized) {
index = dart.notNull(index) + 3;
continue;
@@ -33817,8 +34124,8 @@
index = dart.notNull(index) + sourceLength;
sectionStart = index;
isNormalized = true;
- } else if (dart.test(core.Uri._isRegNameChar(char))) {
- if (isNormalized && core.Uri._UPPER_CASE_A <= dart.notNull(char) && core.Uri._UPPER_CASE_Z >= dart.notNull(char)) {
+ } else if (dart.test(core._Uri._isRegNameChar(char))) {
+ if (isNormalized && core._UPPER_CASE_A <= dart.notNull(char) && core._UPPER_CASE_Z >= dart.notNull(char)) {
if (buffer == null) buffer = new core.StringBuffer();
if (dart.notNull(sectionStart) < dart.notNull(index)) {
buffer.write(host[dartx.substring](sectionStart, index));
@@ -33827,8 +34134,8 @@
isNormalized = false;
}
index = dart.notNull(index) + 1;
- } else if (dart.test(core.Uri._isGeneralDelimiter(char))) {
- core.Uri._fail(host, index, "Invalid character");
+ } else if (dart.test(core._Uri._isGeneralDelimiter(char))) {
+ core._Uri._fail(host, index, "Invalid character");
} else {
let sourceLength = 1;
if ((dart.notNull(char) & 64512) == 55296 && dart.notNull(index) + 1 < dart.notNull(end)) {
@@ -33842,7 +34149,7 @@
let slice = host[dartx.substring](sectionStart, index);
if (!isNormalized) slice = slice[dartx.toLowerCase]();
buffer.write(slice);
- buffer.write(core.Uri._escapeChar(char));
+ buffer.write(core._Uri._escapeChar(char));
index = dart.notNull(index) + sourceLength;
sectionStart = index;
}
@@ -33858,26 +34165,33 @@
static _makeScheme(scheme, start, end) {
if (start == end) return "";
let firstCodeUnit = scheme[dartx.codeUnitAt](start);
- if (!dart.test(core.Uri._isAlphabeticCharacter(firstCodeUnit))) {
- core.Uri._fail(scheme, start, "Scheme not starting with alphabetic character");
+ if (!dart.test(core._Uri._isAlphabeticCharacter(firstCodeUnit))) {
+ core._Uri._fail(scheme, start, "Scheme not starting with alphabetic character");
}
let containsUpperCase = false;
for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(i) + 1) {
let codeUnit = scheme[dartx.codeUnitAt](i);
- if (!dart.test(core.Uri._isSchemeCharacter(codeUnit))) {
- core.Uri._fail(scheme, i, "Illegal scheme character");
+ if (!dart.test(core._Uri._isSchemeCharacter(codeUnit))) {
+ core._Uri._fail(scheme, i, "Illegal scheme character");
}
- if (core.Uri._UPPER_CASE_A <= dart.notNull(codeUnit) && dart.notNull(codeUnit) <= core.Uri._UPPER_CASE_Z) {
+ if (core._UPPER_CASE_A <= dart.notNull(codeUnit) && dart.notNull(codeUnit) <= core._UPPER_CASE_Z) {
containsUpperCase = true;
}
}
scheme = scheme[dartx.substring](start, end);
if (containsUpperCase) scheme = scheme[dartx.toLowerCase]();
+ return core._Uri._canonicalizeScheme(scheme);
+ }
+ static _canonicalizeScheme(scheme) {
+ if (scheme == "http") return "http";
+ if (scheme == "file") return "file";
+ if (scheme == "https") return "https";
+ if (scheme == "package") return "package";
return scheme;
}
static _makeUserInfo(userInfo, start, end) {
if (userInfo == null) return "";
- return core.Uri._normalize(userInfo, start, end, core.Uri._userinfoTable);
+ return core._Uri._normalizeOrSubstring(userInfo, start, end, core._Uri._userinfoTable);
}
static _makePath(path, start, end, pathSegments, scheme, hasAuthority) {
let isFile = scheme == "file";
@@ -33888,30 +34202,32 @@
}
let result = null;
if (path != null) {
- result = core.Uri._normalize(path, start, end, core.Uri._pathCharOrSlashTable);
+ result = core._Uri._normalizeOrSubstring(path, start, end, core._Uri._pathCharOrSlashTable);
} else {
- result = pathSegments[dartx.map](core.String)(dart.fn(s => core.Uri._uriEncode(core.Uri._pathCharTable, s, convert.UTF8, false), StringToString$()))[dartx.join]("/");
+ result = pathSegments[dartx.map](core.String)(dart.fn(s => core._Uri._uriEncode(core._Uri._pathCharTable, s, convert.UTF8, false), StringToString$()))[dartx.join]("/");
}
if (dart.test(dart.dload(result, 'isEmpty'))) {
if (isFile) return "/";
} else if (ensureLeadingSlash && !dart.test(dart.dsend(result, 'startsWith', '/'))) {
result = "/" + dart.notNull(core.String._check(result));
}
- result = core.Uri._normalizePath(core.String._check(result), scheme, hasAuthority);
+ result = core._Uri._normalizePath(core.String._check(result), scheme, hasAuthority);
return core.String._check(result);
}
static _normalizePath(path, scheme, hasAuthority) {
if (dart.test(scheme[dartx.isEmpty]) && !dart.test(hasAuthority) && !dart.test(path[dartx.startsWith]('/'))) {
- return core.Uri._normalizeRelativePath(path);
+ return core._Uri._normalizeRelativePath(path, dart.test(scheme[dartx.isNotEmpty]) || dart.test(hasAuthority));
}
- return core.Uri._removeDotSegments(path);
+ return core._Uri._removeDotSegments(path);
}
static _makeQuery(query, start, end, queryParameters) {
- if (query == null && queryParameters == null) return null;
- if (query != null && queryParameters != null) {
- dart.throw(new core.ArgumentError('Both query and queryParameters specified'));
+ if (query != null) {
+ if (queryParameters != null) {
+ dart.throw(new core.ArgumentError('Both query and queryParameters specified'));
+ }
+ return core._Uri._normalizeOrSubstring(query, start, end, core._Uri._queryCharTable);
}
- if (query != null) return core.Uri._normalize(query, start, end, core.Uri._queryCharTable);
+ if (queryParameters == null) return null;
let result = new core.StringBuffer();
let separator = "";
function writeParameter(key, value) {
@@ -33939,52 +34255,40 @@
}
static _makeFragment(fragment, start, end) {
if (fragment == null) return null;
- return core.Uri._normalize(fragment, start, end, core.Uri._queryCharTable);
- }
- static _stringOrNullLength(s) {
- return s == null ? 0 : s[dartx.length];
+ return core._Uri._normalizeOrSubstring(fragment, start, end, core._Uri._queryCharTable);
}
static _normalizeEscape(source, index, lowerCase) {
- dart.assert(source[dartx.codeUnitAt](index) == core.Uri._PERCENT);
+ dart.assert(source[dartx.codeUnitAt](index) == core._PERCENT);
if (dart.notNull(index) + 2 >= dart.notNull(source[dartx.length])) {
return "%";
}
let firstDigit = source[dartx.codeUnitAt](dart.notNull(index) + 1);
let secondDigit = source[dartx.codeUnitAt](dart.notNull(index) + 2);
- let firstDigitValue = core.Uri._parseHexDigit(firstDigit);
- let secondDigitValue = core.Uri._parseHexDigit(secondDigit);
+ let firstDigitValue = _internal.hexDigitValue(firstDigit);
+ let secondDigitValue = _internal.hexDigitValue(secondDigit);
if (dart.notNull(firstDigitValue) < 0 || dart.notNull(secondDigitValue) < 0) {
return "%";
}
let value = dart.notNull(firstDigitValue) * 16 + dart.notNull(secondDigitValue);
- if (dart.test(core.Uri._isUnreservedChar(value))) {
- if (dart.test(lowerCase) && core.Uri._UPPER_CASE_A <= value && core.Uri._UPPER_CASE_Z >= value) {
+ if (dart.test(core._Uri._isUnreservedChar(value))) {
+ if (dart.test(lowerCase) && core._UPPER_CASE_A <= value && core._UPPER_CASE_Z >= value) {
value = (value | 32) >>> 0;
}
return core.String.fromCharCode(value);
}
- if (dart.notNull(firstDigit) >= core.Uri._LOWER_CASE_A || dart.notNull(secondDigit) >= core.Uri._LOWER_CASE_A) {
+ if (dart.notNull(firstDigit) >= core._LOWER_CASE_A || dart.notNull(secondDigit) >= core._LOWER_CASE_A) {
return source[dartx.substring](index, dart.notNull(index) + 3)[dartx.toUpperCase]();
}
return null;
}
- static _parseHexDigit(char) {
- let digit = (dart.notNull(char) ^ core.Uri._ZERO) >>> 0;
- if (digit <= 9) return digit;
- let lowerCase = (dart.notNull(char) | 32) >>> 0;
- if (core.Uri._LOWER_CASE_A <= lowerCase && lowerCase <= core.Uri._LOWER_CASE_F) {
- return lowerCase - (core.Uri._LOWER_CASE_A - 10);
- }
- return -1;
- }
static _escapeChar(char) {
dart.assert(dart.notNull(char) <= 1114111);
let codeUnits = null;
if (dart.notNull(char) < 128) {
codeUnits = ListOfint().new(3);
- codeUnits[dartx._set](0, core.Uri._PERCENT);
- codeUnits[dartx._set](1, core.Uri._hexDigits[dartx.codeUnitAt](char[dartx['>>']](4)));
- codeUnits[dartx._set](2, core.Uri._hexDigits[dartx.codeUnitAt](dart.notNull(char) & 15));
+ codeUnits[dartx._set](0, core._PERCENT);
+ codeUnits[dartx._set](1, core._hexDigits[dartx.codeUnitAt](char[dartx['>>']](4)));
+ codeUnits[dartx._set](2, core._hexDigits[dartx.codeUnitAt](dart.notNull(char) & 15));
} else {
let flag = 192;
let encodedBytes = 2;
@@ -34000,16 +34304,21 @@
let index = 0;
while (--encodedBytes >= 0) {
let byte = (char[dartx['>>']](6 * encodedBytes) & 63 | flag) >>> 0;
- codeUnits[dartx._set](index, core.Uri._PERCENT);
- codeUnits[dartx._set](index + 1, core.Uri._hexDigits[dartx.codeUnitAt](byte[dartx['>>']](4)));
- codeUnits[dartx._set](index + 2, core.Uri._hexDigits[dartx.codeUnitAt](byte & 15));
+ codeUnits[dartx._set](index, core._PERCENT);
+ codeUnits[dartx._set](index + 1, core._hexDigits[dartx.codeUnitAt](byte[dartx['>>']](4)));
+ codeUnits[dartx._set](index + 2, core._hexDigits[dartx.codeUnitAt](byte & 15));
index = index + 3;
flag = 128;
}
}
return core.String.fromCharCodes(codeUnits);
}
- static _normalize(component, start, end, charTable) {
+ static _normalizeOrSubstring(component, start, end, charTable) {
+ let l = core._Uri._normalize(component, start, end, charTable);
+ return l != null ? l : component[dartx.substring](start, end);
+ }
+ static _normalize(component, start, end, charTable, opts) {
+ let escapeDelimiters = opts && 'escapeDelimiters' in opts ? opts.escapeDelimiters : false;
let buffer = null;
let sectionStart = start;
let index = start;
@@ -34020,8 +34329,8 @@
} else {
let replacement = null;
let sourceLength = null;
- if (char == core.Uri._PERCENT) {
- replacement = core.Uri._normalizeEscape(component, index, false);
+ if (char == core._PERCENT) {
+ replacement = core._Uri._normalizeEscape(component, index, false);
if (replacement == null) {
index = dart.notNull(index) + 3;
continue;
@@ -34032,8 +34341,8 @@
} else {
sourceLength = 3;
}
- } else if (dart.test(core.Uri._isGeneralDelimiter(char))) {
- core.Uri._fail(component, index, "Invalid character");
+ } else if (!dart.test(escapeDelimiters) && dart.test(core._Uri._isGeneralDelimiter(char))) {
+ core._Uri._fail(component, index, "Invalid character");
} else {
sourceLength = 1;
if ((dart.notNull(char) & 64512) == 55296) {
@@ -34045,7 +34354,7 @@
}
}
}
- replacement = core.Uri._escapeChar(char);
+ replacement = core._Uri._escapeChar(char);
}
if (buffer == null) buffer = new core.StringBuffer();
buffer.write(component[dartx.substring](sectionStart, index));
@@ -34055,7 +34364,7 @@
}
}
if (buffer == null) {
- return component[dartx.substring](start, end);
+ return null;
}
if (dart.notNull(sectionStart) < dart.notNull(end)) {
buffer.write(component[dartx.substring](sectionStart, end));
@@ -34063,10 +34372,10 @@
return dart.toString(buffer);
}
static _isSchemeCharacter(ch) {
- return dart.notNull(ch) < 128 && (dart.notNull(core.Uri._schemeTable[dartx._get](ch[dartx['>>']](4))) & 1 << (dart.notNull(ch) & 15)) != 0;
+ return dart.notNull(ch) < 128 && (dart.notNull(core._Uri._schemeTable[dartx._get](ch[dartx['>>']](4))) & 1 << (dart.notNull(ch) & 15)) != 0;
}
static _isGeneralDelimiter(ch) {
- return dart.notNull(ch) <= core.Uri._RIGHT_BRACKET && (dart.notNull(core.Uri._genDelimitersTable[dartx._get](ch[dartx['>>']](4))) & 1 << (dart.notNull(ch) & 15)) != 0;
+ return dart.notNull(ch) <= core._RIGHT_BRACKET && (dart.notNull(core._Uri._genDelimitersTable[dartx._get](ch[dartx['>>']](4))) & 1 << (dart.notNull(ch) & 15)) != 0;
}
get isAbsolute() {
return this.scheme != "" && this.fragment == "";
@@ -34085,7 +34394,7 @@
break;
}
let delta = dart.notNull(baseEnd) - dart.notNull(newEnd);
- if ((delta == 2 || delta == 3) && base[dartx.codeUnitAt](dart.notNull(newEnd) + 1) == core.Uri._DOT && (delta == 2 || base[dartx.codeUnitAt](dart.notNull(newEnd) + 2) == core.Uri._DOT)) {
+ if ((delta == 2 || delta == 3) && base[dartx.codeUnitAt](dart.notNull(newEnd) + 1) == core._DOT && (delta == 2 || base[dartx.codeUnitAt](dart.notNull(newEnd) + 2) == core._DOT)) {
break;
}
baseEnd = newEnd;
@@ -34099,7 +34408,7 @@
return index != -1;
}
static _removeDotSegments(path) {
- if (!dart.test(core.Uri._mayContainDotSegments(path))) return path;
+ if (!dart.test(core._Uri._mayContainDotSegments(path))) return path;
dart.assert(path[dartx.isNotEmpty]);
let output = JSArrayOfString().of([]);
let appendSlash = false;
@@ -34122,9 +34431,12 @@
if (appendSlash) output[dartx.add]("");
return output[dartx.join]("/");
}
- static _normalizeRelativePath(path) {
+ static _normalizeRelativePath(path, allowScheme) {
dart.assert(!dart.test(path[dartx.startsWith]('/')));
- if (!dart.test(core.Uri._mayContainDotSegments(path))) return path;
+ if (!dart.test(core._Uri._mayContainDotSegments(path))) {
+ if (!dart.test(allowScheme)) path = core._Uri._escapeScheme(path);
+ return path;
+ }
dart.assert(path[dartx.isNotEmpty]);
let output = JSArrayOfString().of([]);
let appendSlash = false;
@@ -34147,8 +34459,23 @@
return "./";
}
if (appendSlash || output[dartx.last] == '..') output[dartx.add]("");
+ if (!dart.test(allowScheme)) output[dartx._set](0, core._Uri._escapeScheme(output[dartx._get](0)));
return output[dartx.join]("/");
}
+ static _escapeScheme(path) {
+ if (dart.notNull(path[dartx.length]) >= 2 && dart.test(core._Uri._isAlphabeticCharacter(path[dartx.codeUnitAt](0)))) {
+ for (let i = 1; i < dart.notNull(path[dartx.length]); i++) {
+ let char = path[dartx.codeUnitAt](i);
+ if (char == core._COLON) {
+ return dart.str`${path[dartx.substring](0, i)}%3A${path[dartx.substring](i + 1)}`;
+ }
+ if (dart.notNull(char) > 127 || (dart.notNull(core._Uri._schemeTable[dartx._get](char[dartx['>>']](4))) & 1 << (dart.notNull(char) & 15)) == 0) {
+ break;
+ }
+ }
+ }
+ return path;
+ }
resolve(reference) {
return this.resolveUri(core.Uri.parse(reference));
}
@@ -34166,7 +34493,7 @@
targetHost = reference.host;
targetPort = dart.test(reference.hasPort) ? reference.port : null;
}
- targetPath = core.Uri._removeDotSegments(reference.path);
+ targetPath = core._Uri._removeDotSegments(reference.path);
if (dart.test(reference.hasQuery)) {
targetQuery = reference.query;
}
@@ -34175,15 +34502,15 @@
if (dart.test(reference.hasAuthority)) {
targetUserInfo = reference.userInfo;
targetHost = reference.host;
- targetPort = core.Uri._makePort(dart.test(reference.hasPort) ? reference.port : null, targetScheme);
- targetPath = core.Uri._removeDotSegments(reference.path);
+ targetPort = core._Uri._makePort(dart.test(reference.hasPort) ? reference.port : null, targetScheme);
+ targetPath = core._Uri._removeDotSegments(reference.path);
if (dart.test(reference.hasQuery)) targetQuery = reference.query;
} else {
targetUserInfo = this[_userInfo];
targetHost = this[_host];
targetPort = this[_port];
if (reference.path == "") {
- targetPath = this[_path];
+ targetPath = this.path;
if (dart.test(reference.hasQuery)) {
targetQuery = reference.query;
} else {
@@ -34191,20 +34518,24 @@
}
} else {
if (dart.test(reference.hasAbsolutePath)) {
- targetPath = core.Uri._removeDotSegments(reference.path);
+ targetPath = core._Uri._removeDotSegments(reference.path);
} else {
if (dart.test(this.hasEmptyPath)) {
- if (!dart.test(this.hasScheme) && !dart.test(this.hasAuthority)) {
- targetPath = reference.path;
+ if (!dart.test(this.hasAuthority)) {
+ if (!dart.test(this.hasScheme)) {
+ targetPath = reference.path;
+ } else {
+ targetPath = core._Uri._removeDotSegments(reference.path);
+ }
} else {
- targetPath = core.Uri._removeDotSegments("/" + dart.notNull(reference.path));
+ targetPath = core._Uri._removeDotSegments("/" + dart.notNull(reference.path));
}
} else {
- let mergedPath = this[_mergePaths](this[_path], reference.path);
+ let mergedPath = this[_mergePaths](this.path, reference.path);
if (dart.test(this.hasScheme) || dart.test(this.hasAuthority) || dart.test(this.hasAbsolutePath)) {
- targetPath = core.Uri._removeDotSegments(mergedPath);
+ targetPath = core._Uri._removeDotSegments(mergedPath);
} else {
- targetPath = core.Uri._normalizeRelativePath(mergedPath);
+ targetPath = core._Uri._normalizeRelativePath(mergedPath, dart.test(this.hasScheme) || dart.test(this.hasAuthority));
}
}
}
@@ -34213,7 +34544,7 @@
}
}
let fragment = dart.test(reference.hasFragment) ? reference.fragment : null;
- return new core.Uri._internal(targetScheme, targetUserInfo, targetHost, targetPort, targetPath, targetQuery, fragment);
+ return new core._Uri._internal(targetScheme, targetUserInfo, targetHost, targetPort, targetPath, targetQuery, fragment);
}
get hasScheme() {
return this.scheme[dartx.isNotEmpty];
@@ -34231,18 +34562,21 @@
return this[_fragment] != null;
}
get hasEmptyPath() {
- return this[_path][dartx.isEmpty];
+ return this.path[dartx.isEmpty];
}
get hasAbsolutePath() {
- return this[_path][dartx.startsWith]('/');
+ return this.path[dartx.startsWith]('/');
}
get origin() {
- if (this.scheme == "" || this[_host] == null || this[_host] == "") {
+ if (this.scheme == "") {
dart.throw(new core.StateError(dart.str`Cannot use origin without a scheme: ${this}`));
}
if (this.scheme != "http" && this.scheme != "https") {
dart.throw(new core.StateError(dart.str`Origin is only applicable schemes http and https: ${this}`));
}
+ if (this[_host] == null || this[_host] == "") {
+ dart.throw(new core.StateError(dart.str`A ${this.scheme}: URI should have a non-empty host name: ${this}`));
+ }
if (this[_port] == null) return dart.str`${this.scheme}://${this[_host]}`;
return dart.str`${this.scheme}://${this[_host]}:${this[_port]}`;
}
@@ -34257,43 +34591,46 @@
if (this.fragment != "") {
dart.throw(new core.UnsupportedError("Cannot extract a file path from a URI with a fragment component"));
}
- if (windows == null) windows = core.Uri._isWindows;
- return dart.test(windows) ? this[_toWindowsFilePath]() : this[_toFilePath]();
+ if (windows == null) windows = core._Uri._isWindows;
+ return dart.test(windows) ? core._Uri._toWindowsFilePath(this) : this[_toFilePath]();
}
[_toFilePath]() {
- if (this.host != "") {
+ if (dart.test(this.hasAuthority) && this.host != "") {
dart.throw(new core.UnsupportedError("Cannot extract a non-Windows file path from a file URI " + "with an authority"));
}
- core.Uri._checkNonWindowsPathReservedCharacters(this.pathSegments, false);
+ let pathSegments = this.pathSegments;
+ core._Uri._checkNonWindowsPathReservedCharacters(pathSegments, false);
let result = new core.StringBuffer();
- if (dart.test(this[_isPathAbsolute])) result.write("/");
- result.writeAll(this.pathSegments, "/");
+ if (dart.test(this.hasAbsolutePath)) result.write("/");
+ result.writeAll(pathSegments, "/");
return result.toString();
}
- [_toWindowsFilePath]() {
+ static _toWindowsFilePath(uri) {
let hasDriveLetter = false;
- let segments = this.pathSegments;
- if (dart.notNull(segments[dartx.length]) > 0 && segments[dartx._get](0)[dartx.length] == 2 && segments[dartx._get](0)[dartx.codeUnitAt](1) == core.Uri._COLON) {
- core.Uri._checkWindowsDriveLetter(segments[dartx._get](0)[dartx.codeUnitAt](0), false);
- core.Uri._checkWindowsPathReservedCharacters(segments, false, 1);
+ let segments = uri.pathSegments;
+ if (dart.notNull(segments[dartx.length]) > 0 && segments[dartx._get](0)[dartx.length] == 2 && segments[dartx._get](0)[dartx.codeUnitAt](1) == core._COLON) {
+ core._Uri._checkWindowsDriveLetter(segments[dartx._get](0)[dartx.codeUnitAt](0), false);
+ core._Uri._checkWindowsPathReservedCharacters(segments, false, 1);
hasDriveLetter = true;
} else {
- core.Uri._checkWindowsPathReservedCharacters(segments, false);
+ core._Uri._checkWindowsPathReservedCharacters(segments, false, 0);
}
let result = new core.StringBuffer();
- if (dart.test(this[_isPathAbsolute]) && !hasDriveLetter) result.write("\\");
- if (this.host != "") {
- result.write("\\");
- result.write(this.host);
- result.write("\\");
+ if (dart.test(uri.hasAbsolutePath) && !hasDriveLetter) result.write("\\");
+ if (dart.test(uri.hasAuthority)) {
+ let host = uri.host;
+ if (dart.test(host[dartx.isNotEmpty])) {
+ result.write("\\");
+ result.write(host);
+ result.write("\\");
+ }
}
result.writeAll(segments, "\\");
if (hasDriveLetter && segments[dartx.length] == 1) result.write("\\");
return result.toString();
}
get [_isPathAbsolute]() {
- if (this.path == null || dart.test(this.path[dartx.isEmpty])) return false;
- return this.path[dartx.startsWith]('/');
+ return this.path != null && dart.test(this.path[dartx.startsWith]('/'));
}
[_writeAuthority](ss) {
if (dart.test(this[_userInfo][dartx.isNotEmpty])) {
@@ -34310,9 +34647,17 @@
return this.scheme == "data" ? core.UriData.fromUri(this) : null;
}
toString() {
+ let t = this[_text];
+ return t == null ? this[_text] = this[_initializeText]() : t;
+ }
+ [_initializeText]() {
+ dart.assert(this[_text] == null);
let sb = new core.StringBuffer();
- core.Uri._addIfNonEmpty(sb, this.scheme, this.scheme, ':');
- if (dart.test(this.hasAuthority) || dart.test(this.path[dartx.startsWith]("//")) || this.scheme == "file") {
+ if (dart.test(this.scheme[dartx.isNotEmpty])) {
+ sb.write(this.scheme);
+ sb.write(":");
+ }
+ if (dart.test(this.hasAuthority) || this.scheme == "file") {
sb.write("//");
this[_writeAuthority](sb);
}
@@ -34328,58 +34673,16 @@
return sb.toString();
}
['=='](other) {
- if (!core.Uri.is(other)) return false;
- let uri = core.Uri._check(other);
- return this.scheme == uri.scheme && this.hasAuthority == uri.hasAuthority && this.userInfo == uri.userInfo && this.host == uri.host && this.port == uri.port && this.path == uri.path && this.hasQuery == uri.hasQuery && this.query == uri.query && this.hasFragment == uri.hasFragment && this.fragment == uri.fragment;
+ if (core.identical(this, other)) return true;
+ if (core.Uri.is(other)) {
+ let uri = other;
+ return this.scheme == uri.scheme && this.hasAuthority == uri.hasAuthority && this.userInfo == uri.userInfo && this.host == uri.host && this.port == uri.port && this.path == uri.path && this.hasQuery == uri.hasQuery && this.query == uri.query && this.hasFragment == uri.hasFragment && this.fragment == uri.fragment;
+ }
+ return false;
}
get hashCode() {
- function combine(part, current) {
- return core.int._check(dart.dsend(dart.dsend(dart.dsend(current, '*', 31), '+', dart.hashCode(part)), '&', 1073741823));
- }
- dart.fn(combine, dynamicAnddynamicToint());
- return combine(this.scheme, combine(this.userInfo, combine(this.host, combine(this.port, combine(this.path, combine(this.query, combine(this.fragment, 1)))))));
- }
- static _addIfNonEmpty(sb, test, first, second) {
- if ("" != test) {
- sb.write(first);
- sb.write(second);
- }
- }
- static encodeComponent(component) {
- return core.Uri._uriEncode(core.Uri._unreserved2396Table, component, convert.UTF8, false);
- }
- static encodeQueryComponent(component, opts) {
- let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
- return core.Uri._uriEncode(core.Uri._unreservedTable, component, encoding, true);
- }
- static decodeComponent(encodedComponent) {
- return core.Uri._uriDecode(encodedComponent, 0, encodedComponent[dartx.length], convert.UTF8, false);
- }
- static decodeQueryComponent(encodedComponent, opts) {
- let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
- return core.Uri._uriDecode(encodedComponent, 0, encodedComponent[dartx.length], encoding, true);
- }
- static encodeFull(uri) {
- return core.Uri._uriEncode(core.Uri._encodeFullTable, uri, convert.UTF8, false);
- }
- static decodeFull(uri) {
- return core.Uri._uriDecode(uri, 0, uri[dartx.length], convert.UTF8, false);
- }
- static splitQueryString(query, opts) {
- let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
- return query[dartx.split]("&")[dartx.fold](MapOfString$String())(dart.map({}, core.String, core.String), dart.fn((map, element) => {
- let index = element[dartx.indexOf]("=");
- if (index == -1) {
- if (element != "") {
- map[dartx._set](core.Uri.decodeQueryComponent(element, {encoding: encoding}), "");
- }
- } else if (index != 0) {
- let key = element[dartx.substring](0, index);
- let value = element[dartx.substring](dart.notNull(index) + 1);
- map[dartx._set](core.Uri.decodeQueryComponent(key, {encoding: encoding}), core.Uri.decodeQueryComponent(value, {encoding: encoding}));
- }
- return map;
- }, MapOfString$StringAndStringToMapOfString$String()));
+ let t = this[_hashCodeCache];
+ return t == null ? this[_hashCodeCache] = dart.hashCode(this.toString()) : t;
}
static _createList() {
return [];
@@ -34395,22 +34698,20 @@
let value = null;
if (start == end) return;
if (dart.notNull(equalsIndex) < 0) {
- key = core.Uri._uriDecode(query, start, end, encoding, true);
+ key = core._Uri._uriDecode(query, start, end, encoding, true);
value = "";
} else {
- key = core.Uri._uriDecode(query, start, equalsIndex, encoding, true);
- value = core.Uri._uriDecode(query, dart.notNull(equalsIndex) + 1, end, encoding, true);
+ key = core._Uri._uriDecode(query, start, equalsIndex, encoding, true);
+ value = core._Uri._uriDecode(query, dart.notNull(equalsIndex) + 1, end, encoding, true);
}
- dart.dsend(result[dartx.putIfAbsent](key, core.Uri._createList), 'add', value);
+ dart.dsend(result[dartx.putIfAbsent](key, core._Uri._createList), 'add', value);
}
dart.fn(parsePair, intAndintAndintTovoid());
- let _equals = 61;
- let _ampersand = 38;
while (i < dart.notNull(query[dartx.length])) {
let char = query[dartx.codeUnitAt](i);
- if (char == _equals) {
+ if (char == core._EQUALS) {
if (equalsIndex < 0) equalsIndex = i;
- } else if (char == _ampersand) {
+ } else if (char == core._AMPERSAND) {
parsePair(start, equalsIndex, i);
start = i + 1;
equalsIndex = -1;
@@ -34420,125 +34721,17 @@
parsePair(start, equalsIndex, i);
return result;
}
- static parseIPv4Address(host) {
- function error(msg) {
- dart.throw(new core.FormatException(dart.str`Illegal IPv4 address, ${msg}`));
- }
- dart.fn(error, StringTovoid$());
- let bytes = host[dartx.split]('.');
- if (bytes[dartx.length] != 4) {
- error('IPv4 address should contain exactly 4 parts');
- }
- return bytes[dartx.map](core.int)(dart.fn(byteString => {
- let byte = core.int.parse(byteString);
- if (dart.notNull(byte) < 0 || dart.notNull(byte) > 255) {
- error('each part must be in the range of `0..255`');
- }
- return byte;
- }, StringToint$()))[dartx.toList]();
- }
- static parseIPv6Address(host, start, end) {
- if (start === void 0) start = 0;
- if (end === void 0) end = null;
- if (end == null) end = host[dartx.length];
- function error(msg, position) {
- if (position === void 0) position = null;
- dart.throw(new core.FormatException(dart.str`Illegal IPv6 address, ${msg}`, host, core.int._check(position)));
- }
- dart.fn(error, String__Tovoid());
- function parseHex(start, end) {
- if (dart.notNull(end) - dart.notNull(start) > 4) {
- error('an IPv6 part can only contain a maximum of 4 hex digits', start);
- }
- let value = core.int.parse(host[dartx.substring](start, end), {radix: 16});
- if (dart.notNull(value) < 0 || dart.notNull(value) > (1 << 16) - 1) {
- error('each part must be in the range of `0x0..0xFFFF`', start);
- }
- return value;
- }
- dart.fn(parseHex, intAndintToint());
- if (dart.notNull(host[dartx.length]) < 2) error('address is too short');
- let parts = JSArrayOfint().of([]);
- let wildcardSeen = false;
- let partStart = start;
- for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(i) + 1) {
- if (host[dartx.codeUnitAt](i) == core.Uri._COLON) {
- if (i == start) {
- i = dart.notNull(i) + 1;
- if (host[dartx.codeUnitAt](i) != core.Uri._COLON) {
- error('invalid start colon.', i);
- }
- partStart = i;
- }
- if (i == partStart) {
- if (wildcardSeen) {
- error('only one wildcard `::` is allowed', i);
- }
- wildcardSeen = true;
- parts[dartx.add](-1);
- } else {
- parts[dartx.add](parseHex(partStart, i));
- }
- partStart = dart.notNull(i) + 1;
- }
- }
- if (parts[dartx.length] == 0) error('too few parts');
- let atEnd = partStart == end;
- let isLastWildcard = parts[dartx.last] == -1;
- if (atEnd && !isLastWildcard) {
- error('expected a part after last `:`', end);
- }
- if (!atEnd) {
- try {
- parts[dartx.add](parseHex(partStart, end));
- } catch (e) {
- try {
- let last = core.Uri.parseIPv4Address(host[dartx.substring](partStart, end));
- parts[dartx.add]((dart.notNull(last[dartx._get](0)) << 8 | dart.notNull(last[dartx._get](1))) >>> 0);
- parts[dartx.add]((dart.notNull(last[dartx._get](2)) << 8 | dart.notNull(last[dartx._get](3))) >>> 0);
- } catch (e) {
- error('invalid end of IPv6 address.', partStart);
- }
-
- }
-
- }
- if (wildcardSeen) {
- if (dart.notNull(parts[dartx.length]) > 7) {
- error('an address with a wildcard must have less than 7 parts');
- }
- } else if (parts[dartx.length] != 8) {
- error('an address without a wildcard must contain exactly 8 parts');
- }
- let bytes = typed_data.Uint8List.new(16);
- for (let i = 0, index = 0; i < dart.notNull(parts[dartx.length]); i++) {
- let value = parts[dartx._get](i);
- if (value == -1) {
- let wildCardLength = 9 - dart.notNull(parts[dartx.length]);
- for (let j = 0; j < wildCardLength; j++) {
- bytes[dartx._set](index, 0);
- bytes[dartx._set](index + 1, 0);
- index = index + 2;
- }
- } else {
- bytes[dartx._set](index, value[dartx['>>']](8));
- bytes[dartx._set](index + 1, dart.notNull(value) & 255);
- index = index + 2;
- }
- }
- return bytes;
- }
static _uriEncode(canonicalTable, text, encoding, spaceToPlus) {
- if (core.identical(encoding, convert.UTF8) && dart.test(core.Uri._needsNoEncoding.hasMatch(text))) {
+ if (core.identical(encoding, convert.UTF8) && dart.test(core._Uri._needsNoEncoding.hasMatch(text))) {
return text;
}
- let result = new core.StringBuffer();
+ let result = new core.StringBuffer('');
let bytes = encoding.encode(text);
for (let i = 0; i < dart.notNull(bytes[dartx.length]); i++) {
let byte = bytes[dartx._get](i);
if (dart.notNull(byte) < 128 && (dart.notNull(canonicalTable[dartx._get](byte[dartx['>>']](4))) & 1 << (dart.notNull(byte) & 15)) != 0) {
result.writeCharCode(byte);
- } else if (dart.test(spaceToPlus) && byte == core.Uri._SPACE) {
+ } else if (dart.test(spaceToPlus) && byte == core._SPACE) {
result.write('+');
} else {
let hexDigits = '0123456789ABCDEF';
@@ -34574,7 +34767,7 @@
let simple = true;
for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(i) + 1) {
let codeUnit = text[dartx.codeUnitAt](i);
- if (dart.notNull(codeUnit) > 127 || codeUnit == core.Uri._PERCENT || dart.test(plusToSpace) && codeUnit == core.Uri._PLUS) {
+ if (dart.notNull(codeUnit) > 127 || codeUnit == core._PERCENT || dart.test(plusToSpace) && codeUnit == core._PLUS) {
simple = false;
break;
}
@@ -34593,14 +34786,14 @@
if (dart.notNull(codeUnit) > 127) {
dart.throw(new core.ArgumentError("Illegal percent encoding in URI"));
}
- if (codeUnit == core.Uri._PERCENT) {
+ if (codeUnit == core._PERCENT) {
if (dart.notNull(i) + 3 > dart.notNull(text[dartx.length])) {
dart.throw(new core.ArgumentError('Truncated URI'));
}
- bytes[dartx.add](core.Uri._hexCharPairToByte(text, dart.notNull(i) + 1));
+ bytes[dartx.add](core._Uri._hexCharPairToByte(text, dart.notNull(i) + 1));
i = dart.notNull(i) + 2;
- } else if (dart.test(plusToSpace) && codeUnit == core.Uri._PLUS) {
- bytes[dartx.add](core.Uri._SPACE);
+ } else if (dart.test(plusToSpace) && codeUnit == core._PLUS) {
+ bytes[dartx.add](core._SPACE);
} else {
bytes[dartx.add](codeUnit);
}
@@ -34610,23 +34803,26 @@
}
static _isAlphabeticCharacter(codeUnit) {
let lowerCase = (dart.notNull(codeUnit) | 32) >>> 0;
- return core.Uri._LOWER_CASE_A <= lowerCase && lowerCase <= core.Uri._LOWER_CASE_Z;
+ return core._LOWER_CASE_A <= lowerCase && lowerCase <= core._LOWER_CASE_Z;
}
static _isUnreservedChar(char) {
- return dart.notNull(char) < 127 && (dart.notNull(core.Uri._unreservedTable[dartx._get](char[dartx['>>']](4))) & 1 << (dart.notNull(char) & 15)) != 0;
+ return dart.notNull(char) < 127 && (dart.notNull(core._Uri._unreservedTable[dartx._get](char[dartx['>>']](4))) & 1 << (dart.notNull(char) & 15)) != 0;
}
};
- dart.defineNamedConstructor(core.Uri, '_internal');
- dart.setSignature(core.Uri, {
+ dart.defineNamedConstructor(core._Uri, '_internal');
+ core._Uri[dart.implements] = () => [core.Uri];
+ dart.setSignature(core._Uri, {
fields: () => ({
scheme: core.String,
[_userInfo]: core.String,
[_host]: core.String,
[_port]: core.int,
- [_path]: core.String,
+ path: core.String,
[_query]: core.String,
[_fragment]: core.String,
[_pathSegments]: ListOfString(),
+ [_text]: core.String,
+ [_hashCodeCache]: core.int,
[_queryParameters]: MapOfString$String(),
[_queryParameterLists]: MapOfString$ListOfString()
}),
@@ -34635,7 +34831,6 @@
userInfo: dart.definiteFunctionType(core.String, []),
host: dart.definiteFunctionType(core.String, []),
port: dart.definiteFunctionType(core.int, []),
- path: dart.definiteFunctionType(core.String, []),
query: dart.definiteFunctionType(core.String, []),
fragment: dart.definiteFunctionType(core.String, []),
pathSegments: dart.definiteFunctionType(core.List$(core.String), []),
@@ -34654,6 +34849,7 @@
data: dart.definiteFunctionType(core.UriData, [])
}),
methods: () => ({
+ isScheme: dart.definiteFunctionType(core.bool, [core.String]),
replace: dart.definiteFunctionType(core.Uri, [], {scheme: core.String, userInfo: core.String, host: core.String, port: core.int, path: core.String, pathSegments: IterableOfString(), query: core.String, queryParameters: MapOfString$dynamic(), fragment: core.String}),
removeFragment: dart.definiteFunctionType(core.Uri, []),
normalizePath: dart.definiteFunctionType(core.Uri, []),
@@ -34662,12 +34858,12 @@
resolveUri: dart.definiteFunctionType(core.Uri, [core.Uri]),
toFilePath: dart.definiteFunctionType(core.String, [], {windows: core.bool}),
[_toFilePath]: dart.definiteFunctionType(core.String, []),
- [_toWindowsFilePath]: dart.definiteFunctionType(core.String, []),
- [_writeAuthority]: dart.definiteFunctionType(dart.void, [core.StringSink])
+ [_writeAuthority]: dart.definiteFunctionType(dart.void, [core.StringSink]),
+ [_initializeText]: dart.definiteFunctionType(core.String, [])
}),
statics: () => ({
_defaultPort: dart.definiteFunctionType(core.int, [core.String]),
- parse: dart.definiteFunctionType(core.Uri, [core.String], [core.int, core.int]),
+ _compareScheme: dart.definiteFunctionType(core.bool, [core.String, core.String]),
_fail: dart.definiteFunctionType(dart.void, [core.String, core.int, core.String]),
_makeHttpUri: dart.definiteFunctionType(core.Uri, [core.String, core.String, core.String, MapOfString$String()]),
_checkNonWindowsPathReservedCharacters: dart.definiteFunctionType(dart.dynamic, [ListOfString(), core.bool]),
@@ -34680,85 +34876,50 @@
_isRegNameChar: dart.definiteFunctionType(core.bool, [core.int]),
_normalizeRegName: dart.definiteFunctionType(core.String, [core.String, core.int, core.int]),
_makeScheme: dart.definiteFunctionType(core.String, [core.String, core.int, core.int]),
+ _canonicalizeScheme: dart.definiteFunctionType(core.String, [core.String]),
_makeUserInfo: dart.definiteFunctionType(core.String, [core.String, core.int, core.int]),
_makePath: dart.definiteFunctionType(core.String, [core.String, core.int, core.int, IterableOfString(), core.String, core.bool]),
_normalizePath: dart.definiteFunctionType(core.String, [core.String, core.String, core.bool]),
_makeQuery: dart.definiteFunctionType(core.String, [core.String, core.int, core.int, MapOfString$dynamic()]),
_makeFragment: dart.definiteFunctionType(core.String, [core.String, core.int, core.int]),
- _stringOrNullLength: dart.definiteFunctionType(core.int, [core.String]),
_normalizeEscape: dart.definiteFunctionType(core.String, [core.String, core.int, core.bool]),
- _parseHexDigit: dart.definiteFunctionType(core.int, [core.int]),
_escapeChar: dart.definiteFunctionType(core.String, [core.int]),
- _normalize: dart.definiteFunctionType(core.String, [core.String, core.int, core.int, ListOfint()]),
+ _normalizeOrSubstring: dart.definiteFunctionType(core.String, [core.String, core.int, core.int, ListOfint()]),
+ _normalize: dart.definiteFunctionType(core.String, [core.String, core.int, core.int, ListOfint()], {escapeDelimiters: core.bool}),
_isSchemeCharacter: dart.definiteFunctionType(core.bool, [core.int]),
_isGeneralDelimiter: dart.definiteFunctionType(core.bool, [core.int]),
_mayContainDotSegments: dart.definiteFunctionType(core.bool, [core.String]),
_removeDotSegments: dart.definiteFunctionType(core.String, [core.String]),
- _normalizeRelativePath: dart.definiteFunctionType(core.String, [core.String]),
- _addIfNonEmpty: dart.definiteFunctionType(dart.void, [core.StringBuffer, core.String, core.String, core.String]),
- encodeComponent: dart.definiteFunctionType(core.String, [core.String]),
- encodeQueryComponent: dart.definiteFunctionType(core.String, [core.String], {encoding: convert.Encoding}),
- decodeComponent: dart.definiteFunctionType(core.String, [core.String]),
- decodeQueryComponent: dart.definiteFunctionType(core.String, [core.String], {encoding: convert.Encoding}),
- encodeFull: dart.definiteFunctionType(core.String, [core.String]),
- decodeFull: dart.definiteFunctionType(core.String, [core.String]),
- splitQueryString: dart.definiteFunctionType(core.Map$(core.String, core.String), [core.String], {encoding: convert.Encoding}),
+ _normalizeRelativePath: dart.definiteFunctionType(core.String, [core.String, core.bool]),
+ _escapeScheme: dart.definiteFunctionType(core.String, [core.String]),
+ _toWindowsFilePath: dart.definiteFunctionType(core.String, [core.Uri]),
_createList: dart.definiteFunctionType(core.List, []),
_splitQueryStringAll: dart.definiteFunctionType(core.Map, [core.String], {encoding: convert.Encoding}),
- parseIPv4Address: dart.definiteFunctionType(core.List$(core.int), [core.String]),
- parseIPv6Address: dart.definiteFunctionType(core.List$(core.int), [core.String], [core.int, core.int]),
_uriEncode: dart.definiteFunctionType(core.String, [ListOfint(), core.String, convert.Encoding, core.bool]),
_hexCharPairToByte: dart.definiteFunctionType(core.int, [core.String, core.int]),
_uriDecode: dart.definiteFunctionType(core.String, [core.String, core.int, core.int, convert.Encoding, core.bool]),
_isAlphabeticCharacter: dart.definiteFunctionType(core.bool, [core.int]),
_isUnreservedChar: dart.definiteFunctionType(core.bool, [core.int])
}),
- names: ['_defaultPort', 'parse', '_fail', '_makeHttpUri', '_checkNonWindowsPathReservedCharacters', '_checkWindowsPathReservedCharacters', '_checkWindowsDriveLetter', '_makeFileUri', '_makeWindowsFileUrl', '_makePort', '_makeHost', '_isRegNameChar', '_normalizeRegName', '_makeScheme', '_makeUserInfo', '_makePath', '_normalizePath', '_makeQuery', '_makeFragment', '_stringOrNullLength', '_normalizeEscape', '_parseHexDigit', '_escapeChar', '_normalize', '_isSchemeCharacter', '_isGeneralDelimiter', '_mayContainDotSegments', '_removeDotSegments', '_normalizeRelativePath', '_addIfNonEmpty', 'encodeComponent', 'encodeQueryComponent', 'decodeComponent', 'decodeQueryComponent', 'encodeFull', 'decodeFull', 'splitQueryString', '_createList', '_splitQueryStringAll', 'parseIPv4Address', 'parseIPv6Address', '_uriEncode', '_hexCharPairToByte', '_uriDecode', '_isAlphabeticCharacter', '_isUnreservedChar']
+ names: ['_defaultPort', '_compareScheme', '_fail', '_makeHttpUri', '_checkNonWindowsPathReservedCharacters', '_checkWindowsPathReservedCharacters', '_checkWindowsDriveLetter', '_makeFileUri', '_makeWindowsFileUrl', '_makePort', '_makeHost', '_isRegNameChar', '_normalizeRegName', '_makeScheme', '_canonicalizeScheme', '_makeUserInfo', '_makePath', '_normalizePath', '_makeQuery', '_makeFragment', '_normalizeEscape', '_escapeChar', '_normalizeOrSubstring', '_normalize', '_isSchemeCharacter', '_isGeneralDelimiter', '_mayContainDotSegments', '_removeDotSegments', '_normalizeRelativePath', '_escapeScheme', '_toWindowsFilePath', '_createList', '_splitQueryStringAll', '_uriEncode', '_hexCharPairToByte', '_uriDecode', '_isAlphabeticCharacter', '_isUnreservedChar']
});
- core.Uri._SPACE = 32;
- core.Uri._DOUBLE_QUOTE = 34;
- core.Uri._NUMBER_SIGN = 35;
- core.Uri._PERCENT = 37;
- core.Uri._ASTERISK = 42;
- core.Uri._PLUS = 43;
- core.Uri._DOT = 46;
- core.Uri._SLASH = 47;
- core.Uri._ZERO = 48;
- core.Uri._NINE = 57;
- core.Uri._COLON = 58;
- core.Uri._LESS = 60;
- core.Uri._GREATER = 62;
- core.Uri._QUESTION = 63;
- core.Uri._AT_SIGN = 64;
- core.Uri._UPPER_CASE_A = 65;
- core.Uri._UPPER_CASE_F = 70;
- core.Uri._UPPER_CASE_Z = 90;
- core.Uri._LEFT_BRACKET = 91;
- core.Uri._BACKSLASH = 92;
- core.Uri._RIGHT_BRACKET = 93;
- core.Uri._LOWER_CASE_A = 97;
- core.Uri._LOWER_CASE_F = 102;
- core.Uri._LOWER_CASE_Z = 122;
- core.Uri._BAR = 124;
- core.Uri._hexDigits = "0123456789ABCDEF";
- core.Uri._unreservedTable = dart.constList([0, 0, 24576, 1023, 65534, 34815, 65534, 18431], core.int);
- core.Uri._unreserved2396Table = dart.constList([0, 0, 26498, 1023, 65534, 34815, 65534, 18431], core.int);
- core.Uri._encodeFullTable = dart.constList([0, 0, 65498, 45055, 65535, 34815, 65534, 18431], core.int);
- core.Uri._schemeTable = dart.constList([0, 0, 26624, 1023, 65534, 2047, 65534, 2047], core.int);
- core.Uri._schemeLowerTable = dart.constList([0, 0, 26624, 1023, 0, 0, 65534, 2047], core.int);
- core.Uri._subDelimitersTable = dart.constList([0, 0, 32722, 11263, 65534, 34815, 65534, 18431], core.int);
- core.Uri._genDelimitersTable = dart.constList([0, 0, 32776, 33792, 1, 10240, 0, 0], core.int);
- core.Uri._userinfoTable = dart.constList([0, 0, 32722, 12287, 65534, 34815, 65534, 18431], core.int);
- core.Uri._regNameTable = dart.constList([0, 0, 32754, 11263, 65534, 34815, 65534, 18431], core.int);
- core.Uri._pathCharTable = dart.constList([0, 0, 32722, 12287, 65535, 34815, 65534, 18431], core.int);
- core.Uri._pathCharOrSlashTable = dart.constList([0, 0, 65490, 12287, 65535, 34815, 65534, 18431], core.int);
- core.Uri._queryCharTable = dart.constList([0, 0, 65490, 45055, 65535, 34815, 65534, 18431], core.int);
- dart.defineLazy(core.Uri, {
+ core._Uri._unreservedTable = dart.constList([0, 0, 24576, 1023, 65534, 34815, 65534, 18431], core.int);
+ core._Uri._unreserved2396Table = dart.constList([0, 0, 26498, 1023, 65534, 34815, 65534, 18431], core.int);
+ core._Uri._encodeFullTable = dart.constList([0, 0, 65498, 45055, 65535, 34815, 65534, 18431], core.int);
+ core._Uri._schemeTable = dart.constList([0, 0, 26624, 1023, 65534, 2047, 65534, 2047], core.int);
+ core._Uri._schemeLowerTable = dart.constList([0, 0, 26624, 1023, 0, 0, 65534, 2047], core.int);
+ core._Uri._subDelimitersTable = dart.constList([0, 0, 32722, 11263, 65534, 34815, 65534, 18431], core.int);
+ core._Uri._genDelimitersTable = dart.constList([0, 0, 32776, 33792, 1, 10240, 0, 0], core.int);
+ core._Uri._userinfoTable = dart.constList([0, 0, 32722, 12287, 65534, 34815, 65534, 18431], core.int);
+ core._Uri._regNameTable = dart.constList([0, 0, 32754, 11263, 65534, 34815, 65534, 18431], core.int);
+ core._Uri._pathCharTable = dart.constList([0, 0, 32722, 12287, 65535, 34815, 65534, 18431], core.int);
+ core._Uri._pathCharOrSlashTable = dart.constList([0, 0, 65490, 12287, 65535, 34815, 65534, 18431], core.int);
+ core._Uri._queryCharTable = dart.constList([0, 0, 65490, 45055, 65535, 34815, 65534, 18431], core.int);
+ dart.defineLazy(core._Uri, {
get _needsNoEncoding() {
return core.RegExp.new('^[\\-\\.0-9A-Z_a-z~]*$');
}
});
- const _text = Symbol('_text');
const _separatorIndices = Symbol('_separatorIndices');
const _uriCache = Symbol('_uriCache');
core.UriData = class UriData extends core.Object {
@@ -34842,9 +35003,9 @@
if (dart.notNull(slashIndex) < 0) {
dart.throw(new core.ArgumentError.value(mimeType, "mimeType", "Invalid MIME type"));
}
- buffer.write(core.Uri._uriEncode(core.UriData._tokenCharTable, mimeType[dartx.substring](0, slashIndex), convert.UTF8, false));
+ buffer.write(core._Uri._uriEncode(core.UriData._tokenCharTable, mimeType[dartx.substring](0, slashIndex), convert.UTF8, false));
buffer.write("/");
- buffer.write(core.Uri._uriEncode(core.UriData._tokenCharTable, mimeType[dartx.substring](dart.notNull(slashIndex) + 1), convert.UTF8, false));
+ buffer.write(core._Uri._uriEncode(core.UriData._tokenCharTable, mimeType[dartx.substring](dart.notNull(slashIndex) + 1), convert.UTF8, false));
}
if (charsetName != null) {
if (indices != null) {
@@ -34852,7 +35013,7 @@
indices[dartx.add](dart.notNull(buffer.length) + 8);
}
buffer.write(";charset=");
- buffer.write(core.Uri._uriEncode(core.UriData._tokenCharTable, charsetName, convert.UTF8, false));
+ buffer.write(core._Uri._uriEncode(core.UriData._tokenCharTable, charsetName, convert.UTF8, false));
}
dart.nullSafe(parameters, _ => _[dartx.forEach](dart.fn((key, value) => {
if (dart.test(key[dartx.isEmpty])) {
@@ -34863,17 +35024,17 @@
}
if (indices != null) indices[dartx.add](buffer.length);
buffer.write(';');
- buffer.write(core.Uri._uriEncode(core.UriData._tokenCharTable, key, convert.UTF8, false));
+ buffer.write(core._Uri._uriEncode(core.UriData._tokenCharTable, key, convert.UTF8, false));
if (indices != null) indices[dartx.add](buffer.length);
buffer.write('=');
- buffer.write(core.Uri._uriEncode(core.UriData._tokenCharTable, value, convert.UTF8, false));
+ buffer.write(core._Uri._uriEncode(core.UriData._tokenCharTable, value, convert.UTF8, false));
}, StringAndStringToNull())));
}
static _validateMimeType(mimeType) {
let slashIndex = -1;
for (let i = 0; i < dart.notNull(mimeType[dartx.length]); i++) {
let char = mimeType[dartx.codeUnitAt](i);
- if (char != core.Uri._SLASH) continue;
+ if (char != core._SLASH) continue;
if (slashIndex < 0) {
slashIndex = i;
continue;
@@ -34883,10 +35044,16 @@
return slashIndex;
}
static parse(uri) {
- if (!dart.test(uri[dartx.startsWith]("data:"))) {
- dart.throw(new core.FormatException("Does not start with 'data:'", uri, 0));
+ if (dart.notNull(uri[dartx.length]) >= 5) {
+ let dataDelta = core._startsWithData(uri, 0);
+ if (dataDelta == 0) {
+ return core.UriData._parse(uri, 5, null);
+ }
+ if (dataDelta == 32) {
+ return core.UriData._parse(uri[dartx.substring](5), 0, null);
+ }
}
- return core.UriData._parse(uri, 5, null);
+ dart.throw(new core.FormatException("Does not start with 'data:'", uri, 0));
}
get uri() {
if (this[_uriCache] != null) return this[_uriCache];
@@ -34894,20 +35061,20 @@
let query = null;
let colonIndex = this[_separatorIndices][dartx._get](0);
let queryIndex = this[_text][dartx.indexOf]('?', dart.notNull(colonIndex) + 1);
- let end = null;
+ let end = this[_text][dartx.length];
if (dart.notNull(queryIndex) >= 0) {
- query = this[_text][dartx.substring](dart.notNull(queryIndex) + 1);
+ query = core._Uri._normalizeOrSubstring(this[_text], dart.notNull(queryIndex) + 1, end, core._Uri._queryCharTable);
end = queryIndex;
}
- path = this[_text][dartx.substring](dart.notNull(colonIndex) + 1, end);
- this[_uriCache] = new core.Uri._internal("data", "", null, null, path, query, null);
+ path = core._Uri._normalizeOrSubstring(this[_text], dart.notNull(colonIndex) + 1, end, core._Uri._pathCharOrSlashTable);
+ this[_uriCache] = new core._DataUri(this, path, query);
return this[_uriCache];
}
get mimeType() {
let start = dart.notNull(this[_separatorIndices][dartx._get](0)) + 1;
let end = this[_separatorIndices][dartx._get](1);
if (start == end) return "text/plain";
- return core.Uri._uriDecode(this[_text], start, end, convert.UTF8, false);
+ return core._Uri._uriDecode(this[_text], start, end, convert.UTF8, false);
}
get charset() {
let parameterStart = 1;
@@ -34919,7 +35086,7 @@
let keyStart = dart.notNull(this[_separatorIndices][dartx._get](i)) + 1;
let keyEnd = this[_separatorIndices][dartx._get](i + 1);
if (keyEnd == keyStart + 7 && dart.test(this[_text][dartx.startsWith]("charset", keyStart))) {
- return core.Uri._uriDecode(this[_text], dart.notNull(keyEnd) + 1, this[_separatorIndices][dartx._get](i + 2), convert.UTF8, false);
+ return core._Uri._uriDecode(this[_text], dart.notNull(keyEnd) + 1, this[_separatorIndices][dartx._get](i + 2), convert.UTF8, false);
}
}
return "US-ASCII";
@@ -34957,10 +35124,8 @@
result[dartx._set](index++, codeUnit);
} else {
if (i + 2 < dart.notNull(text[dartx.length])) {
- let digit1 = core.Uri._parseHexDigit(text[dartx.codeUnitAt](i + 1));
- let digit2 = core.Uri._parseHexDigit(text[dartx.codeUnitAt](i + 2));
- if (dart.notNull(digit1) >= 0 && dart.notNull(digit2) >= 0) {
- let byte = dart.notNull(digit1) * 16 + dart.notNull(digit2);
+ let byte = _internal.parseHexByte(text, i + 1);
+ if (dart.notNull(byte) >= 0) {
result[dartx._set](index++, byte);
i = i + 2;
continue;
@@ -34987,7 +35152,7 @@
let converter = convert.BASE64.decoder.fuse(core.String)(encoding.decoder);
return converter.convert(text[dartx.substring](start));
}
- return core.Uri._uriDecode(text, start, text[dartx.length], encoding, false);
+ return core._Uri._uriDecode(text, start, text[dartx.length], encoding, false);
}
get parameters() {
let result = dart.map({}, core.String, core.String);
@@ -34995,8 +35160,8 @@
let start = dart.notNull(this[_separatorIndices][dartx._get](i - 2)) + 1;
let equals = this[_separatorIndices][dartx._get](i - 1);
let end = this[_separatorIndices][dartx._get](i);
- let key = core.Uri._uriDecode(this[_text], start, equals, convert.UTF8, false);
- let value = core.Uri._uriDecode(this[_text], dart.notNull(equals) + 1, end, convert.UTF8, false);
+ let key = core._Uri._uriDecode(this[_text], start, equals, convert.UTF8, false);
+ let value = core._Uri._uriDecode(this[_text], dart.notNull(equals) + 1, end, convert.UTF8, false);
result[dartx._set](key, value);
}
return result;
@@ -35049,6 +35214,15 @@
}
}
indices[dartx.add](i);
+ let isBase64 = indices[dartx.length][dartx.isOdd];
+ if (dart.test(isBase64)) {
+ text = convert.BASE64.normalize(text, dart.notNull(i) + 1, text[dartx.length]);
+ } else {
+ let data = core._Uri._normalize(text, dart.notNull(i) + 1, text[dartx.length], core.UriData._uricTable, {escapeDelimiters: true});
+ if (data != null) {
+ text = text[dartx.replaceRange](dart.notNull(i) + 1, text[dartx.length], data);
+ }
+ }
return new core.UriData._(text, indices, sourceUri);
}
static _uriEncodeBytes(canonicalTable, bytes, buffer) {
@@ -35059,9 +35233,9 @@
if (dart.notNull(byte) < 128 && (dart.notNull(canonicalTable[dartx._get](byte[dartx['>>']](4))) & 1 << (dart.notNull(byte) & 15)) != 0) {
buffer.writeCharCode(byte);
} else {
- buffer.writeCharCode(core.Uri._PERCENT);
- buffer.writeCharCode(core.Uri._hexDigits[dartx.codeUnitAt](byte[dartx['>>']](4)));
- buffer.writeCharCode(core.Uri._hexDigits[dartx.codeUnitAt](dart.notNull(byte) & 15));
+ buffer.writeCharCode(core._PERCENT);
+ buffer.writeCharCode(core._hexDigits[dartx.codeUnitAt](byte[dartx['>>']](4)));
+ buffer.writeCharCode(core._hexDigits[dartx.codeUnitAt](dart.notNull(byte) & 15));
}
}
if ((dart.notNull(byteOr) & ~255) != 0) {
@@ -35107,7 +35281,667 @@
});
core.UriData._noScheme = -1;
core.UriData._tokenCharTable = dart.constList([0, 0, 27858, 1023, 65534, 51199, 65535, 32767], core.int);
- core.UriData._uricTable = core.Uri._queryCharTable;
+ core.UriData._uricTable = core._Uri._queryCharTable;
+ core.UriData._base64Table = dart.constList([0, 0, 34816, 1023, 65534, 2047, 65534, 2047], core.int);
+ core._schemeEndIndex = 1;
+ core._hostStartIndex = 2;
+ core._portStartIndex = 3;
+ core._pathStartIndex = 4;
+ core._queryStartIndex = 5;
+ core._fragmentStartIndex = 6;
+ core._notSimpleIndex = 7;
+ core._uriStart = 0;
+ core._nonSimpleEndStates = 14;
+ core._schemeStart = 20;
+ dart.defineLazy(core, {
+ get _scannerTables() {
+ return core._createTables();
+ }
+ });
+ core._createTables = function() {
+ let stateCount = 22;
+ let schemeOrPath = 1;
+ let authOrPath = 2;
+ let authOrPathSlash = 3;
+ let uinfoOrHost0 = 4;
+ let uinfoOrHost = 5;
+ let uinfoOrPort0 = 6;
+ let uinfoOrPort = 7;
+ let ipv6Host = 8;
+ let relPathSeg = 9;
+ let pathSeg = 10;
+ let path = 11;
+ let query = 12;
+ let fragment = 13;
+ let schemeOrPathDot = 14;
+ let schemeOrPathDot2 = 15;
+ let relPathSegDot = 16;
+ let relPathSegDot2 = 17;
+ let pathSegDot = 18;
+ let pathSegDot2 = 19;
+ let scheme0 = core._schemeStart;
+ let scheme = 21;
+ let schemeEnd = core._schemeEndIndex << 5;
+ let hostStart = core._hostStartIndex << 5;
+ let portStart = core._portStartIndex << 5;
+ let pathStart = core._pathStartIndex << 5;
+ let queryStart = core._queryStartIndex << 5;
+ let fragmentStart = core._fragmentStartIndex << 5;
+ let notSimple = core._notSimpleIndex << 5;
+ let unreserved = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-._~";
+ let subDelims = "!$&'()*+,;=";
+ let pchar = dart.str`${unreserved}${subDelims}`;
+ let tables = ListOfUint8List().generate(stateCount, dart.fn(_ => typed_data.Uint8List.new(96), intToUint8List()));
+ function build(state, defaultTransition) {
+ return (() => {
+ let _ = tables[dartx._get](core.int._check(state));
+ _[dartx.fillRange](0, 96, core.int._check(defaultTransition));
+ return _;
+ })();
+ }
+ dart.fn(build, dynamicAnddynamicToUint8List());
+ function setChars(target, chars, transition) {
+ for (let i = 0; i < dart.notNull(chars[dartx.length]); i++) {
+ let char = chars[dartx.codeUnitAt](i);
+ target[dartx._set]((dart.notNull(char) ^ 96) >>> 0, transition);
+ }
+ }
+ dart.fn(setChars, Uint8ListAndStringAndintTovoid());
+ function setRange(target, range, transition) {
+ for (let i = range[dartx.codeUnitAt](0), n = range[dartx.codeUnitAt](1); dart.notNull(i) <= dart.notNull(n); i = dart.notNull(i) + 1) {
+ target[dartx._set]((dart.notNull(i) ^ 96) >>> 0, transition);
+ }
+ }
+ dart.fn(setRange, Uint8ListAndStringAndintTovoid());
+ let b = null;
+ b = build(core._uriStart, (schemeOrPath | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), pchar, schemeOrPath);
+ setChars(typed_data.Uint8List._check(b), ".", schemeOrPathDot);
+ setChars(typed_data.Uint8List._check(b), ":", (authOrPath | schemeEnd) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "/", authOrPathSlash);
+ setChars(typed_data.Uint8List._check(b), "?", (query | queryStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "#", (fragment | fragmentStart) >>> 0);
+ b = build(schemeOrPathDot, (schemeOrPath | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), pchar, schemeOrPath);
+ setChars(typed_data.Uint8List._check(b), ".", schemeOrPathDot2);
+ setChars(typed_data.Uint8List._check(b), ':', (authOrPath | schemeEnd) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "/", (pathSeg | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "?", (query | queryStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "#", (fragment | fragmentStart) >>> 0);
+ b = build(schemeOrPathDot2, (schemeOrPath | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), pchar, schemeOrPath);
+ setChars(typed_data.Uint8List._check(b), "%", (schemeOrPath | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), ':', (authOrPath | schemeEnd) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "/", relPathSeg);
+ setChars(typed_data.Uint8List._check(b), "?", (query | queryStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "#", (fragment | fragmentStart) >>> 0);
+ b = build(schemeOrPath, (schemeOrPath | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), pchar, schemeOrPath);
+ setChars(typed_data.Uint8List._check(b), ':', (authOrPath | schemeEnd) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "/", pathSeg);
+ setChars(typed_data.Uint8List._check(b), "?", (query | queryStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "#", (fragment | fragmentStart) >>> 0);
+ b = build(authOrPath, (path | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), pchar, (path | pathStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "/", (authOrPathSlash | pathStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), ".", (pathSegDot | pathStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "?", (query | queryStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "#", (fragment | fragmentStart) >>> 0);
+ b = build(authOrPathSlash, (path | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), pchar, path);
+ setChars(typed_data.Uint8List._check(b), "/", (uinfoOrHost0 | hostStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), ".", pathSegDot);
+ setChars(typed_data.Uint8List._check(b), "?", (query | queryStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "#", (fragment | fragmentStart) >>> 0);
+ b = build(uinfoOrHost0, (uinfoOrHost | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), pchar, uinfoOrHost);
+ setRange(typed_data.Uint8List._check(b), "AZ", (uinfoOrHost | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), ":", (uinfoOrPort0 | portStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "@", (uinfoOrHost0 | hostStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "[", (ipv6Host | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "/", (pathSeg | pathStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "?", (query | queryStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "#", (fragment | fragmentStart) >>> 0);
+ b = build(uinfoOrHost, (uinfoOrHost | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), pchar, uinfoOrHost);
+ setRange(typed_data.Uint8List._check(b), "AZ", (uinfoOrHost | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), ":", (uinfoOrPort0 | portStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "@", (uinfoOrHost0 | hostStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "/", (pathSeg | pathStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "?", (query | queryStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "#", (fragment | fragmentStart) >>> 0);
+ b = build(uinfoOrPort0, (uinfoOrPort | notSimple) >>> 0);
+ setRange(typed_data.Uint8List._check(b), "19", uinfoOrPort);
+ setChars(typed_data.Uint8List._check(b), "@", (uinfoOrHost0 | hostStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "/", (pathSeg | pathStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "?", (query | queryStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "#", (fragment | fragmentStart) >>> 0);
+ b = build(uinfoOrPort, (uinfoOrPort | notSimple) >>> 0);
+ setRange(typed_data.Uint8List._check(b), "09", uinfoOrPort);
+ setChars(typed_data.Uint8List._check(b), "@", (uinfoOrHost0 | hostStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "/", (pathSeg | pathStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "?", (query | queryStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "#", (fragment | fragmentStart) >>> 0);
+ b = build(ipv6Host, ipv6Host);
+ setChars(typed_data.Uint8List._check(b), "]", uinfoOrHost);
+ b = build(relPathSeg, (path | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), pchar, path);
+ setChars(typed_data.Uint8List._check(b), ".", relPathSegDot);
+ setChars(typed_data.Uint8List._check(b), "/", (pathSeg | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "?", (query | queryStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "#", (fragment | fragmentStart) >>> 0);
+ b = build(relPathSegDot, (path | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), pchar, path);
+ setChars(typed_data.Uint8List._check(b), ".", relPathSegDot2);
+ setChars(typed_data.Uint8List._check(b), "/", (pathSeg | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "?", (query | queryStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "#", (fragment | fragmentStart) >>> 0);
+ b = build(relPathSegDot2, (path | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), pchar, path);
+ setChars(typed_data.Uint8List._check(b), "/", relPathSeg);
+ setChars(typed_data.Uint8List._check(b), "?", (query | queryStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "#", (fragment | fragmentStart) >>> 0);
+ b = build(pathSeg, (path | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), pchar, path);
+ setChars(typed_data.Uint8List._check(b), ".", pathSegDot);
+ setChars(typed_data.Uint8List._check(b), "/", (pathSeg | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "?", (query | queryStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "#", (fragment | fragmentStart) >>> 0);
+ b = build(pathSegDot, (path | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), pchar, path);
+ setChars(typed_data.Uint8List._check(b), ".", pathSegDot2);
+ setChars(typed_data.Uint8List._check(b), "/", (pathSeg | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "?", (query | queryStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "#", (fragment | fragmentStart) >>> 0);
+ b = build(pathSegDot2, (path | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), pchar, path);
+ setChars(typed_data.Uint8List._check(b), "/", (pathSeg | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "?", (query | queryStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "#", (fragment | fragmentStart) >>> 0);
+ b = build(path, (path | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), pchar, path);
+ setChars(typed_data.Uint8List._check(b), "/", pathSeg);
+ setChars(typed_data.Uint8List._check(b), "?", (query | queryStart) >>> 0);
+ setChars(typed_data.Uint8List._check(b), "#", (fragment | fragmentStart) >>> 0);
+ b = build(query, (query | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), pchar, query);
+ setChars(typed_data.Uint8List._check(b), "?", query);
+ setChars(typed_data.Uint8List._check(b), "#", (fragment | fragmentStart) >>> 0);
+ b = build(fragment, (fragment | notSimple) >>> 0);
+ setChars(typed_data.Uint8List._check(b), pchar, fragment);
+ setChars(typed_data.Uint8List._check(b), "?", fragment);
+ b = build(scheme0, (scheme | notSimple) >>> 0);
+ setRange(typed_data.Uint8List._check(b), "az", scheme);
+ b = build(scheme, (scheme | notSimple) >>> 0);
+ setRange(typed_data.Uint8List._check(b), "az", scheme);
+ setRange(typed_data.Uint8List._check(b), "09", scheme);
+ setChars(typed_data.Uint8List._check(b), "+-.", scheme);
+ return tables;
+ };
+ dart.lazyFn(core._createTables, () => VoidToListOfUint8List());
+ core._scan = function(uri, start, end, state, indices) {
+ let tables = core._scannerTables;
+ dart.assert(dart.notNull(end) <= dart.notNull(uri[dartx.length]));
+ for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(i) + 1) {
+ let table = tables[dartx._get](state);
+ let char = (dart.notNull(uri[dartx.codeUnitAt](i)) ^ 96) >>> 0;
+ if (char > 95) char = 31;
+ let transition = table[dartx._get](char);
+ state = dart.notNull(transition) & 31;
+ indices[dartx._set](transition[dartx['>>']](5), i);
+ }
+ return state;
+ };
+ dart.fn(core._scan, StringAndintAndint__Toint());
+ const _uri = Symbol('_uri');
+ const _schemeEnd = Symbol('_schemeEnd');
+ const _hostStart = Symbol('_hostStart');
+ const _portStart = Symbol('_portStart');
+ const _pathStart = Symbol('_pathStart');
+ const _queryStart = Symbol('_queryStart');
+ const _fragmentStart = Symbol('_fragmentStart');
+ const _schemeCache = Symbol('_schemeCache');
+ const _isFile = Symbol('_isFile');
+ const _isHttp = Symbol('_isHttp');
+ const _isHttps = Symbol('_isHttps');
+ const _isPackage = Symbol('_isPackage');
+ const _isScheme = Symbol('_isScheme');
+ let const$52;
+ let const$53;
+ let const$54;
+ const _isPort = Symbol('_isPort');
+ const _simpleMerge = Symbol('_simpleMerge');
+ const _toNonSimple = Symbol('_toNonSimple');
+ core._SimpleUri = class _SimpleUri extends core.Object {
+ new(uri, schemeEnd, hostStart, portStart, pathStart, queryStart, fragmentStart, schemeCache) {
+ this[_uri] = uri;
+ this[_schemeEnd] = schemeEnd;
+ this[_hostStart] = hostStart;
+ this[_portStart] = portStart;
+ this[_pathStart] = pathStart;
+ this[_queryStart] = queryStart;
+ this[_fragmentStart] = fragmentStart;
+ this[_schemeCache] = schemeCache;
+ this[_hashCodeCache] = null;
+ }
+ get hasScheme() {
+ return dart.notNull(this[_schemeEnd]) > 0;
+ }
+ get hasAuthority() {
+ return dart.notNull(this[_hostStart]) > 0;
+ }
+ get hasUserInfo() {
+ return dart.notNull(this[_hostStart]) > dart.notNull(this[_schemeEnd]) + 4;
+ }
+ get hasPort() {
+ return dart.notNull(this[_hostStart]) > 0 && dart.notNull(this[_portStart]) + 1 < dart.notNull(this[_pathStart]);
+ }
+ get hasQuery() {
+ return dart.notNull(this[_queryStart]) < dart.notNull(this[_fragmentStart]);
+ }
+ get hasFragment() {
+ return dart.notNull(this[_fragmentStart]) < dart.notNull(this[_uri][dartx.length]);
+ }
+ get [_isFile]() {
+ return this[_schemeEnd] == 4 && dart.test(this[_uri][dartx.startsWith]("file"));
+ }
+ get [_isHttp]() {
+ return this[_schemeEnd] == 4 && dart.test(this[_uri][dartx.startsWith]("http"));
+ }
+ get [_isHttps]() {
+ return this[_schemeEnd] == 5 && dart.test(this[_uri][dartx.startsWith]("https"));
+ }
+ get [_isPackage]() {
+ return this[_schemeEnd] == 7 && dart.test(this[_uri][dartx.startsWith]("package"));
+ }
+ [_isScheme](scheme) {
+ return this[_schemeEnd] == scheme[dartx.length] && dart.test(this[_uri][dartx.startsWith](scheme));
+ }
+ get hasAbsolutePath() {
+ return this[_uri][dartx.startsWith]("/", this[_pathStart]);
+ }
+ get hasEmptyPath() {
+ return this[_pathStart] == this[_queryStart];
+ }
+ get isAbsolute() {
+ return dart.test(this.hasScheme) && !dart.test(this.hasFragment);
+ }
+ isScheme(scheme) {
+ if (scheme == null || dart.test(scheme[dartx.isEmpty])) return dart.notNull(this[_schemeEnd]) < 0;
+ if (scheme[dartx.length] != this[_schemeEnd]) return false;
+ return core._Uri._compareScheme(scheme, this[_uri]);
+ }
+ get scheme() {
+ if (dart.notNull(this[_schemeEnd]) <= 0) return "";
+ if (this[_schemeCache] != null) return this[_schemeCache];
+ if (dart.test(this[_isHttp])) {
+ this[_schemeCache] = "http";
+ } else if (dart.test(this[_isHttps])) {
+ this[_schemeCache] = "https";
+ } else if (dart.test(this[_isFile])) {
+ this[_schemeCache] = "file";
+ } else if (dart.test(this[_isPackage])) {
+ this[_schemeCache] = "package";
+ } else {
+ this[_schemeCache] = this[_uri][dartx.substring](0, this[_schemeEnd]);
+ }
+ return this[_schemeCache];
+ }
+ get authority() {
+ return dart.notNull(this[_hostStart]) > 0 ? this[_uri][dartx.substring](dart.notNull(this[_schemeEnd]) + 3, this[_pathStart]) : "";
+ }
+ get userInfo() {
+ return dart.notNull(this[_hostStart]) > dart.notNull(this[_schemeEnd]) + 3 ? this[_uri][dartx.substring](dart.notNull(this[_schemeEnd]) + 3, dart.notNull(this[_hostStart]) - 1) : "";
+ }
+ get host() {
+ return dart.notNull(this[_hostStart]) > 0 ? this[_uri][dartx.substring](this[_hostStart], this[_portStart]) : "";
+ }
+ get port() {
+ if (dart.test(this.hasPort)) return core.int.parse(this[_uri][dartx.substring](dart.notNull(this[_portStart]) + 1, this[_pathStart]));
+ if (dart.test(this[_isHttp])) return 80;
+ if (dart.test(this[_isHttps])) return 443;
+ return 0;
+ }
+ get path() {
+ return this[_uri][dartx.substring](this[_pathStart], this[_queryStart]);
+ }
+ get query() {
+ return dart.notNull(this[_queryStart]) < dart.notNull(this[_fragmentStart]) ? this[_uri][dartx.substring](dart.notNull(this[_queryStart]) + 1, this[_fragmentStart]) : "";
+ }
+ get fragment() {
+ return dart.notNull(this[_fragmentStart]) < dart.notNull(this[_uri][dartx.length]) ? this[_uri][dartx.substring](dart.notNull(this[_fragmentStart]) + 1) : "";
+ }
+ get origin() {
+ let isHttp = this[_isHttp];
+ if (dart.notNull(this[_schemeEnd]) < 0) {
+ dart.throw(new core.StateError(dart.str`Cannot use origin without a scheme: ${this}`));
+ }
+ if (!dart.test(isHttp) && !dart.test(this[_isHttps])) {
+ dart.throw(new core.StateError(dart.str`Origin is only applicable schemes http and https: ${this}`));
+ }
+ if (this[_hostStart] == this[_portStart]) {
+ dart.throw(new core.StateError(dart.str`A ${this.scheme}: URI should have a non-empty host name: ${this}`));
+ }
+ if (this[_hostStart] == dart.notNull(this[_schemeEnd]) + 3) {
+ return this[_uri][dartx.substring](0, this[_pathStart]);
+ }
+ return dart.notNull(this[_uri][dartx.substring](0, dart.notNull(this[_schemeEnd]) + 3)) + dart.notNull(this[_uri][dartx.substring](this[_hostStart], this[_pathStart]));
+ }
+ get pathSegments() {
+ let start = this[_pathStart];
+ let end = this[_queryStart];
+ if (dart.test(this[_uri][dartx.startsWith]("/", start))) {
+ start = dart.notNull(start) + 1;
+ }
+ if (start == end) return const$52 || (const$52 = dart.constList([], core.String));
+ let parts = JSArrayOfString().of([]);
+ for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull(i) + 1) {
+ let char = this[_uri][dartx.codeUnitAt](i);
+ if (char == core._SLASH) {
+ parts[dartx.add](this[_uri][dartx.substring](start, i));
+ start = dart.notNull(i) + 1;
+ }
+ }
+ parts[dartx.add](this[_uri][dartx.substring](start, end));
+ return ListOfString().unmodifiable(parts);
+ }
+ get queryParameters() {
+ if (!dart.test(this.hasQuery)) return const$53 || (const$53 = dart.const(dart.map({}, core.String, core.String)));
+ return new (UnmodifiableMapViewOfString$String())(core.Uri.splitQueryString(this.query));
+ }
+ get queryParametersAll() {
+ if (!dart.test(this.hasQuery)) return const$54 || (const$54 = dart.const(dart.map({}, core.String, ListOfString())));
+ let queryParameterLists = core._Uri._splitQueryStringAll(this.query);
+ for (let key of queryParameterLists[dartx.keys]) {
+ queryParameterLists[dartx._set](key, ListOfString().unmodifiable(core.Iterable._check(queryParameterLists[dartx._get](key))));
+ }
+ return MapOfString$ListOfString().unmodifiable(queryParameterLists);
+ }
+ [_isPort](port) {
+ let portDigitStart = dart.notNull(this[_portStart]) + 1;
+ return portDigitStart + dart.notNull(port[dartx.length]) == this[_pathStart] && dart.test(this[_uri][dartx.startsWith](port, portDigitStart));
+ }
+ normalizePath() {
+ return this;
+ }
+ removeFragment() {
+ if (!dart.test(this.hasFragment)) return this;
+ return new core._SimpleUri(this[_uri][dartx.substring](0, this[_fragmentStart]), this[_schemeEnd], this[_hostStart], this[_portStart], this[_pathStart], this[_queryStart], this[_fragmentStart], this[_schemeCache]);
+ }
+ replace(opts) {
+ let scheme = opts && 'scheme' in opts ? opts.scheme : null;
+ let userInfo = opts && 'userInfo' in opts ? opts.userInfo : null;
+ let host = opts && 'host' in opts ? opts.host : null;
+ let port = opts && 'port' in opts ? opts.port : null;
+ let path = opts && 'path' in opts ? opts.path : null;
+ let pathSegments = opts && 'pathSegments' in opts ? opts.pathSegments : null;
+ let query = opts && 'query' in opts ? opts.query : null;
+ let queryParameters = opts && 'queryParameters' in opts ? opts.queryParameters : null;
+ let fragment = opts && 'fragment' in opts ? opts.fragment : null;
+ let schemeChanged = false;
+ if (scheme != null) {
+ scheme = core._Uri._makeScheme(scheme, 0, scheme[dartx.length]);
+ schemeChanged = !dart.test(this[_isScheme](scheme));
+ } else {
+ scheme = this.scheme;
+ }
+ let isFile = scheme == "file";
+ if (userInfo != null) {
+ userInfo = core._Uri._makeUserInfo(userInfo, 0, userInfo[dartx.length]);
+ } else if (dart.notNull(this[_hostStart]) > 0) {
+ userInfo = this[_uri][dartx.substring](dart.notNull(this[_schemeEnd]) + 3, this[_hostStart]);
+ } else {
+ userInfo = "";
+ }
+ if (port != null) {
+ port = core._Uri._makePort(port, scheme);
+ } else {
+ port = dart.test(this.hasPort) ? this.port : null;
+ if (schemeChanged) {
+ port = core._Uri._makePort(port, scheme);
+ }
+ }
+ if (host != null) {
+ host = core._Uri._makeHost(host, 0, host[dartx.length], false);
+ } else if (dart.notNull(this[_hostStart]) > 0) {
+ host = this[_uri][dartx.substring](this[_hostStart], this[_portStart]);
+ } else if (dart.test(userInfo[dartx.isNotEmpty]) || port != null || isFile) {
+ host = "";
+ }
+ let hasAuthority = host != null;
+ if (path != null || pathSegments != null) {
+ path = core._Uri._makePath(path, 0, core._stringOrNullLength(path), pathSegments, scheme, hasAuthority);
+ } else {
+ path = this[_uri][dartx.substring](this[_pathStart], this[_queryStart]);
+ if ((isFile || hasAuthority && !dart.test(path[dartx.isEmpty])) && !dart.test(path[dartx.startsWith]('/'))) {
+ path = "/" + dart.notNull(path);
+ }
+ }
+ if (query != null || queryParameters != null) {
+ query = core._Uri._makeQuery(query, 0, core._stringOrNullLength(query), queryParameters);
+ } else if (dart.notNull(this[_queryStart]) < dart.notNull(this[_fragmentStart])) {
+ query = this[_uri][dartx.substring](dart.notNull(this[_queryStart]) + 1, this[_fragmentStart]);
+ }
+ if (fragment != null) {
+ fragment = core._Uri._makeFragment(fragment, 0, fragment[dartx.length]);
+ } else if (dart.notNull(this[_fragmentStart]) < dart.notNull(this[_uri][dartx.length])) {
+ fragment = this[_uri][dartx.substring](dart.notNull(this[_fragmentStart]) + 1);
+ }
+ return new core._Uri._internal(scheme, userInfo, host, port, path, query, fragment);
+ }
+ resolve(reference) {
+ return this.resolveUri(core.Uri.parse(reference));
+ }
+ resolveUri(reference) {
+ if (core._SimpleUri.is(reference)) {
+ return this[_simpleMerge](this, reference);
+ }
+ return this[_toNonSimple]().resolveUri(reference);
+ }
+ [_simpleMerge](base, ref) {
+ if (dart.test(ref.hasScheme)) return ref;
+ if (dart.test(ref.hasAuthority)) {
+ if (!dart.test(base.hasScheme)) return ref;
+ let isSimple = true;
+ if (dart.test(base[_isFile])) {
+ isSimple = !dart.test(ref.hasEmptyPath);
+ } else if (dart.test(base[_isHttp])) {
+ isSimple = !dart.test(ref[_isPort]("80"));
+ } else if (dart.test(base[_isHttps])) {
+ isSimple = !dart.test(ref[_isPort]("443"));
+ }
+ if (isSimple) {
+ let delta = dart.notNull(base[_schemeEnd]) + 1;
+ let newUri = dart.notNull(base[_uri][dartx.substring](0, dart.notNull(base[_schemeEnd]) + 1)) + dart.notNull(ref[_uri][dartx.substring](dart.notNull(ref[_schemeEnd]) + 1));
+ return new core._SimpleUri(newUri, base[_schemeEnd], dart.notNull(ref[_hostStart]) + delta, dart.notNull(ref[_portStart]) + delta, dart.notNull(ref[_pathStart]) + delta, dart.notNull(ref[_queryStart]) + delta, dart.notNull(ref[_fragmentStart]) + delta, base[_schemeCache]);
+ } else {
+ return this[_toNonSimple]().resolveUri(ref);
+ }
+ }
+ if (dart.test(ref.hasEmptyPath)) {
+ if (dart.test(ref.hasQuery)) {
+ let delta = dart.notNull(base[_queryStart]) - dart.notNull(ref[_queryStart]);
+ let newUri = dart.notNull(base[_uri][dartx.substring](0, base[_queryStart])) + dart.notNull(ref[_uri][dartx.substring](ref[_queryStart]));
+ return new core._SimpleUri(newUri, base[_schemeEnd], base[_hostStart], base[_portStart], base[_pathStart], dart.notNull(ref[_queryStart]) + delta, dart.notNull(ref[_fragmentStart]) + delta, base[_schemeCache]);
+ }
+ if (dart.test(ref.hasFragment)) {
+ let delta = dart.notNull(base[_fragmentStart]) - dart.notNull(ref[_fragmentStart]);
+ let newUri = dart.notNull(base[_uri][dartx.substring](0, base[_fragmentStart])) + dart.notNull(ref[_uri][dartx.substring](ref[_fragmentStart]));
+ return new core._SimpleUri(newUri, base[_schemeEnd], base[_hostStart], base[_portStart], base[_pathStart], base[_queryStart], dart.notNull(ref[_fragmentStart]) + delta, base[_schemeCache]);
+ }
+ return base.removeFragment();
+ }
+ if (dart.test(ref.hasAbsolutePath)) {
+ let delta = dart.notNull(base[_pathStart]) - dart.notNull(ref[_pathStart]);
+ let newUri = dart.notNull(base[_uri][dartx.substring](0, base[_pathStart])) + dart.notNull(ref[_uri][dartx.substring](ref[_pathStart]));
+ return new core._SimpleUri(newUri, base[_schemeEnd], base[_hostStart], base[_portStart], base[_pathStart], dart.notNull(ref[_queryStart]) + delta, dart.notNull(ref[_fragmentStart]) + delta, base[_schemeCache]);
+ }
+ if (dart.test(base.hasEmptyPath) && dart.test(base.hasAuthority)) {
+ let refStart = ref[_pathStart];
+ while (dart.test(ref[_uri][dartx.startsWith]("../", refStart))) {
+ refStart = dart.notNull(refStart) + 3;
+ }
+ let delta = dart.notNull(base[_pathStart]) - dart.notNull(refStart) + 1;
+ let newUri = dart.str`${base[_uri][dartx.substring](0, base[_pathStart])}/` + dart.str`${ref[_uri][dartx.substring](refStart)}`;
+ return new core._SimpleUri(newUri, base[_schemeEnd], base[_hostStart], base[_portStart], base[_pathStart], dart.notNull(ref[_queryStart]) + delta, dart.notNull(ref[_fragmentStart]) + delta, base[_schemeCache]);
+ }
+ let baseUri = base[_uri];
+ let refUri = ref[_uri];
+ let baseStart = base[_pathStart];
+ let baseEnd = base[_queryStart];
+ while (dart.test(baseUri[dartx.startsWith]("../", baseStart))) {
+ baseStart = dart.notNull(baseStart) + 3;
+ }
+ let refStart = ref[_pathStart];
+ let refEnd = ref[_queryStart];
+ let backCount = 0;
+ while (dart.notNull(refStart) + 3 <= dart.notNull(refEnd) && dart.test(refUri[dartx.startsWith]("../", refStart))) {
+ refStart = dart.notNull(refStart) + 3;
+ backCount = backCount + 1;
+ }
+ let insert = "";
+ while (dart.notNull(baseEnd) > dart.notNull(baseStart)) {
+ baseEnd = dart.notNull(baseEnd) - 1;
+ let char = baseUri[dartx.codeUnitAt](baseEnd);
+ if (char == core._SLASH) {
+ insert = "/";
+ if (backCount == 0) break;
+ backCount--;
+ }
+ }
+ if (baseEnd == baseStart && !dart.test(base.hasScheme) && !dart.test(base.hasAbsolutePath)) {
+ insert = "";
+ refStart = dart.notNull(refStart) - backCount * 3;
+ }
+ let delta = dart.notNull(baseEnd) - dart.notNull(refStart) + dart.notNull(insert[dartx.length]);
+ let newUri = dart.str`${base[_uri][dartx.substring](0, baseEnd)}${insert}` + dart.str`${ref[_uri][dartx.substring](refStart)}`;
+ return new core._SimpleUri(newUri, base[_schemeEnd], base[_hostStart], base[_portStart], base[_pathStart], dart.notNull(ref[_queryStart]) + delta, dart.notNull(ref[_fragmentStart]) + delta, base[_schemeCache]);
+ }
+ toFilePath(opts) {
+ let windows = opts && 'windows' in opts ? opts.windows : null;
+ if (dart.notNull(this[_schemeEnd]) >= 0 && !dart.test(this[_isFile])) {
+ dart.throw(new core.UnsupportedError(dart.str`Cannot extract a file path from a ${this.scheme} URI`));
+ }
+ if (dart.notNull(this[_queryStart]) < dart.notNull(this[_uri][dartx.length])) {
+ if (dart.notNull(this[_queryStart]) < dart.notNull(this[_fragmentStart])) {
+ dart.throw(new core.UnsupportedError("Cannot extract a file path from a URI with a query component"));
+ }
+ dart.throw(new core.UnsupportedError("Cannot extract a file path from a URI with a fragment component"));
+ }
+ if (windows == null) windows = core._Uri._isWindows;
+ return dart.test(windows) ? core._Uri._toWindowsFilePath(this) : this[_toFilePath]();
+ }
+ [_toFilePath]() {
+ if (dart.notNull(this[_hostStart]) < dart.notNull(this[_portStart])) {
+ dart.throw(new core.UnsupportedError("Cannot extract a non-Windows file path from a file URI " + "with an authority"));
+ }
+ return this.path;
+ }
+ get data() {
+ dart.assert(this.scheme != "data");
+ return null;
+ }
+ get hashCode() {
+ return (() => {
+ let t = this[_hashCodeCache];
+ return t == null ? this[_hashCodeCache] = dart.hashCode(this[_uri]) : t;
+ })();
+ }
+ ['=='](other) {
+ if (core.identical(this, other)) return true;
+ if (core.Uri.is(other)) return this[_uri] == dart.toString(other);
+ return false;
+ }
+ [_toNonSimple]() {
+ return new core._Uri._internal(this.scheme, this.userInfo, dart.test(this.hasAuthority) ? this.host : null, dart.test(this.hasPort) ? this.port : null, this.path, dart.test(this.hasQuery) ? this.query : null, dart.test(this.hasFragment) ? this.fragment : null);
+ }
+ toString() {
+ return this[_uri];
+ }
+ };
+ core._SimpleUri[dart.implements] = () => [core.Uri];
+ dart.setSignature(core._SimpleUri, {
+ fields: () => ({
+ [_uri]: core.String,
+ [_schemeEnd]: core.int,
+ [_hostStart]: core.int,
+ [_portStart]: core.int,
+ [_pathStart]: core.int,
+ [_queryStart]: core.int,
+ [_fragmentStart]: core.int,
+ [_schemeCache]: core.String,
+ [_hashCodeCache]: core.int
+ }),
+ getters: () => ({
+ hasScheme: dart.definiteFunctionType(core.bool, []),
+ hasAuthority: dart.definiteFunctionType(core.bool, []),
+ hasUserInfo: dart.definiteFunctionType(core.bool, []),
+ hasPort: dart.definiteFunctionType(core.bool, []),
+ hasQuery: dart.definiteFunctionType(core.bool, []),
+ hasFragment: dart.definiteFunctionType(core.bool, []),
+ [_isFile]: dart.definiteFunctionType(core.bool, []),
+ [_isHttp]: dart.definiteFunctionType(core.bool, []),
+ [_isHttps]: dart.definiteFunctionType(core.bool, []),
+ [_isPackage]: dart.definiteFunctionType(core.bool, []),
+ hasAbsolutePath: dart.definiteFunctionType(core.bool, []),
+ hasEmptyPath: dart.definiteFunctionType(core.bool, []),
+ isAbsolute: dart.definiteFunctionType(core.bool, []),
+ scheme: dart.definiteFunctionType(core.String, []),
+ authority: dart.definiteFunctionType(core.String, []),
+ userInfo: dart.definiteFunctionType(core.String, []),
+ host: dart.definiteFunctionType(core.String, []),
+ port: dart.definiteFunctionType(core.int, []),
+ path: dart.definiteFunctionType(core.String, []),
+ query: dart.definiteFunctionType(core.String, []),
+ fragment: dart.definiteFunctionType(core.String, []),
+ origin: dart.definiteFunctionType(core.String, []),
+ pathSegments: dart.definiteFunctionType(core.List$(core.String), []),
+ queryParameters: dart.definiteFunctionType(core.Map$(core.String, core.String), []),
+ queryParametersAll: dart.definiteFunctionType(core.Map$(core.String, core.List$(core.String)), []),
+ data: dart.definiteFunctionType(core.UriData, [])
+ }),
+ methods: () => ({
+ [_isScheme]: dart.definiteFunctionType(core.bool, [core.String]),
+ isScheme: dart.definiteFunctionType(core.bool, [core.String]),
+ [_isPort]: dart.definiteFunctionType(core.bool, [core.String]),
+ normalizePath: dart.definiteFunctionType(core.Uri, []),
+ removeFragment: dart.definiteFunctionType(core.Uri, []),
+ replace: dart.definiteFunctionType(core.Uri, [], {scheme: core.String, userInfo: core.String, host: core.String, port: core.int, path: core.String, pathSegments: IterableOfString(), query: core.String, queryParameters: MapOfString$dynamic(), fragment: core.String}),
+ resolve: dart.definiteFunctionType(core.Uri, [core.String]),
+ resolveUri: dart.definiteFunctionType(core.Uri, [core.Uri]),
+ [_simpleMerge]: dart.definiteFunctionType(core.Uri, [core._SimpleUri, core._SimpleUri]),
+ toFilePath: dart.definiteFunctionType(core.String, [], {windows: core.bool}),
+ [_toFilePath]: dart.definiteFunctionType(core.String, []),
+ '==': dart.definiteFunctionType(core.bool, [core.Object]),
+ [_toNonSimple]: dart.definiteFunctionType(core.Uri, [])
+ })
+ });
+ const _data$ = Symbol('_data');
+ core._DataUri = class _DataUri extends core._Uri {
+ new(data, path, query) {
+ this[_data$] = data;
+ super._internal("data", null, null, null, path, query, null);
+ }
+ get data() {
+ return this[_data$];
+ }
+ };
+ dart.setSignature(core._DataUri, {
+ fields: () => ({[_data$]: core.UriData})
+ });
+ core._startsWithData = function(text, start) {
+ let delta = ((dart.notNull(text[dartx.codeUnitAt](dart.notNull(start) + 4)) ^ core._COLON) >>> 0) * 3;
+ delta = (delta | dart.notNull(text[dartx.codeUnitAt](start)) ^ 100) >>> 0;
+ delta = (delta | dart.notNull(text[dartx.codeUnitAt](dart.notNull(start) + 1)) ^ 97) >>> 0;
+ delta = (delta | dart.notNull(text[dartx.codeUnitAt](dart.notNull(start) + 2)) ^ 116) >>> 0;
+ delta = (delta | dart.notNull(text[dartx.codeUnitAt](dart.notNull(start) + 3)) ^ 97) >>> 0;
+ return delta;
+ };
+ dart.fn(core._startsWithData, StringAndintToint());
+ core._stringOrNullLength = function(s) {
+ return s == null ? 0 : s[dartx.length];
+ };
+ dart.fn(core._stringOrNullLength, StringToint$());
developer.debugger = function(opts) {
let when = opts && 'when' in opts ? opts.when : true;
let message = opts && 'message' in opts ? opts.message : null;
@@ -35137,6 +35971,49 @@
}
});
developer._clockValue = 0;
+ developer._FakeUserTag = class _FakeUserTag extends core.Object {
+ real(label) {
+ this.label = label;
+ }
+ static new(label) {
+ let existingTag = developer._FakeUserTag._instances[dartx._get](label);
+ if (existingTag != null) {
+ return developer._FakeUserTag._check(existingTag);
+ }
+ if (developer._FakeUserTag._instances[dartx.length] == developer.UserTag.MAX_USER_TAGS) {
+ dart.throw(new core.UnsupportedError(dart.str`UserTag instance limit (${developer.UserTag.MAX_USER_TAGS}) reached.`));
+ }
+ let instance = new developer._FakeUserTag.real(label);
+ developer._FakeUserTag._instances[dartx._set](label, instance);
+ return instance;
+ }
+ makeCurrent() {
+ let old = developer._currentTag;
+ developer._currentTag = this;
+ return old;
+ }
+ };
+ dart.defineNamedConstructor(developer._FakeUserTag, 'real');
+ developer._FakeUserTag[dart.implements] = () => [developer.UserTag];
+ dart.setSignature(developer._FakeUserTag, {
+ fields: () => ({label: core.String}),
+ methods: () => ({makeCurrent: dart.definiteFunctionType(developer.UserTag, [])})
+ });
+ dart.defineLazy(developer._FakeUserTag, {
+ get _instances() {
+ return dart.map();
+ },
+ set _instances(_) {},
+ get _defaultTag() {
+ return developer._FakeUserTag.new('Default');
+ }
+ });
+ dart.defineLazy(developer, {
+ get _currentTag() {
+ return developer._FakeUserTag._defaultTag;
+ },
+ set _currentTag(_) {}
+ });
const _result = Symbol('_result');
const _errorCode = Symbol('_errorCode');
const _errorDetail = Symbol('_errorDetail');
@@ -35258,7 +36135,7 @@
dart.fn(developer.postEvent, StringAndMapTovoid());
developer._postEvent = function(eventKind, eventData) {
};
- dart.fn(developer._postEvent, StringAndStringTodynamic());
+ dart.fn(developer._postEvent, StringAndStringTovoid$());
developer._lookupExtension = function(method) {
return developer._extensions[dartx._get](method);
};
@@ -35276,49 +36153,6 @@
}
};
developer.UserTag.MAX_USER_TAGS = 64;
- developer._FakeUserTag = class _FakeUserTag extends core.Object {
- real(label) {
- this.label = label;
- }
- static new(label) {
- let existingTag = developer._FakeUserTag._instances[dartx._get](label);
- if (existingTag != null) {
- return developer._FakeUserTag._check(existingTag);
- }
- if (developer._FakeUserTag._instances[dartx.length] == developer.UserTag.MAX_USER_TAGS) {
- dart.throw(new core.UnsupportedError(dart.str`UserTag instance limit (${developer.UserTag.MAX_USER_TAGS}) reached.`));
- }
- let instance = new developer._FakeUserTag.real(label);
- developer._FakeUserTag._instances[dartx._set](label, instance);
- return instance;
- }
- makeCurrent() {
- let old = developer._currentTag;
- developer._currentTag = this;
- return old;
- }
- };
- dart.defineNamedConstructor(developer._FakeUserTag, 'real');
- developer._FakeUserTag[dart.implements] = () => [developer.UserTag];
- dart.setSignature(developer._FakeUserTag, {
- fields: () => ({label: core.String}),
- methods: () => ({makeCurrent: dart.definiteFunctionType(developer.UserTag, [])})
- });
- dart.defineLazy(developer._FakeUserTag, {
- get _instances() {
- return dart.map();
- },
- set _instances(_) {},
- get _defaultTag() {
- return developer._FakeUserTag.new('Default');
- }
- });
- dart.defineLazy(developer, {
- get _currentTag() {
- return developer._FakeUserTag._defaultTag;
- },
- set _currentTag(_) {}
- });
developer.getCurrentTag = function() {
return developer._currentTag;
};
@@ -35751,7 +36585,7 @@
developer.Service = class Service extends core.Object {
static getInfo() {
return dart.async(function*() {
- let receivePort = isolate.RawReceivePort.new();
+ let receivePort = isolate$.RawReceivePort.new();
let uriCompleter = CompleterOfUri().new();
receivePort.handler = dart.fn(uri => uriCompleter.complete(uri), UriTovoid());
developer._getServerInfo(receivePort.sendPort);
@@ -35766,7 +36600,7 @@
if (!(typeof enable == 'boolean')) {
dart.throw(new core.ArgumentError.value(enable, 'enable', 'Must be a bool'));
}
- let receivePort = isolate.RawReceivePort.new();
+ let receivePort = isolate$.RawReceivePort.new();
let uriCompleter = CompleterOfUri().new();
receivePort.handler = dart.fn(uri => uriCompleter.complete(uri), UriTovoid());
developer._webServerControl(receivePort.sendPort, enable);
@@ -35775,20 +36609,27 @@
return new developer.ServiceProtocolInfo(uri);
}, developer.ServiceProtocolInfo, opts);
}
+ static getIsolateID(isolate) {
+ if (!isolate$.Isolate.is(isolate)) {
+ dart.throw(new core.ArgumentError.value(isolate, 'isolate', 'Must be an Isolate'));
+ }
+ return developer._getIsolateIDFromSendPort(isolate.controlPort);
+ }
};
dart.setSignature(developer.Service, {
statics: () => ({
getInfo: dart.definiteFunctionType(async.Future$(developer.ServiceProtocolInfo), []),
- controlWebServer: dart.definiteFunctionType(async.Future$(developer.ServiceProtocolInfo), [], {enable: core.bool})
+ controlWebServer: dart.definiteFunctionType(async.Future$(developer.ServiceProtocolInfo), [], {enable: core.bool}),
+ getIsolateID: dart.definiteFunctionType(core.String, [isolate$.Isolate])
}),
- names: ['getInfo', 'controlWebServer']
+ names: ['getInfo', 'controlWebServer', 'getIsolateID']
});
- developer._getServerInfo = function(sp) {
- sp.send(null);
+ developer._getServerInfo = function(sendPort) {
+ sendPort.send(null);
};
dart.lazyFn(developer._getServerInfo, () => SendPortTovoid());
- developer._webServerControl = function(sp, enable) {
- sp.send(null);
+ developer._webServerControl = function(sendPort, enable) {
+ sendPort.send(null);
};
dart.lazyFn(developer._webServerControl, () => SendPortAndboolTovoid());
developer._getServiceMajorVersion = function() {
@@ -35799,6 +36640,10 @@
return 0;
};
dart.fn(developer._getServiceMinorVersion, VoidToint());
+ developer._getIsolateIDFromSendPort = function(sendPort) {
+ return null;
+ };
+ dart.lazyFn(developer._getIsolateIDFromSendPort, () => SendPortToString());
io.BytesBuilder = class BytesBuilder extends core.Object {
static new(opts) {
let copy = opts && 'copy' in opts ? opts.copy : true;
@@ -35809,27 +36654,21 @@
}
}
};
- const _length$2 = Symbol('_length');
const _buffer$ = Symbol('_buffer');
- const _pow2roundup = Symbol('_pow2roundup');
+ const _length$2 = Symbol('_length');
+ const _grow$ = Symbol('_grow');
io._CopyingBytesBuilder = class _CopyingBytesBuilder extends core.Object {
- new() {
+ new(initialCapacity) {
+ if (initialCapacity === void 0) initialCapacity = 0;
+ this[_buffer$] = dart.notNull(initialCapacity) <= 0 ? io._CopyingBytesBuilder._emptyList : typed_data.Uint8List.new(io._CopyingBytesBuilder._pow2roundup(initialCapacity));
this[_length$2] = 0;
- this[_buffer$] = null;
}
add(bytes) {
let bytesLength = bytes[dartx.length];
if (bytesLength == 0) return;
let required = dart.notNull(this[_length$2]) + dart.notNull(bytesLength);
- if (this[_buffer$] == null) {
- let size = this[_pow2roundup](required);
- size = math.max(core.int)(size, io._CopyingBytesBuilder._INIT_SIZE);
- this[_buffer$] = typed_data.Uint8List.new(size);
- } else if (dart.notNull(this[_buffer$][dartx.length]) < required) {
- let size = dart.notNull(this[_pow2roundup](required)) * 2;
- let newBuffer = typed_data.Uint8List.new(size);
- newBuffer[dartx.setRange](0, this[_buffer$][dartx.length], this[_buffer$]);
- this[_buffer$] = newBuffer;
+ if (dart.notNull(this[_buffer$][dartx.length]) < required) {
+ this[_grow$](required);
}
dart.assert(dart.notNull(this[_buffer$][dartx.length]) >= required);
if (typed_data.Uint8List.is(bytes)) {
@@ -35842,16 +36681,32 @@
this[_length$2] = required;
}
addByte(byte) {
- this.add(JSArrayOfint().of([byte]));
+ if (this[_buffer$][dartx.length] == this[_length$2]) {
+ this[_grow$](this[_length$2]);
+ }
+ dart.assert(dart.notNull(this[_buffer$][dartx.length]) > dart.notNull(this[_length$2]));
+ this[_buffer$][dartx._set](this[_length$2], byte);
+ this[_length$2] = dart.notNull(this[_length$2]) + 1;
+ }
+ [_grow$](required) {
+ let newSize = dart.notNull(required) * 2;
+ if (dart.notNull(newSize) < io._CopyingBytesBuilder._INIT_SIZE) {
+ newSize = io._CopyingBytesBuilder._INIT_SIZE;
+ } else {
+ newSize = io._CopyingBytesBuilder._pow2roundup(newSize);
+ }
+ let newBuffer = typed_data.Uint8List.new(newSize);
+ newBuffer[dartx.setRange](0, this[_buffer$][dartx.length], this[_buffer$]);
+ this[_buffer$] = newBuffer;
}
takeBytes() {
- if (this[_buffer$] == null) return typed_data.Uint8List.new(0);
+ if (this[_length$2] == 0) return io._CopyingBytesBuilder._emptyList;
let buffer = typed_data.Uint8List.view(this[_buffer$][dartx.buffer], 0, this[_length$2]);
this.clear();
return buffer;
}
toBytes() {
- if (this[_buffer$] == null) return typed_data.Uint8List.new(0);
+ if (this[_length$2] == 0) return io._CopyingBytesBuilder._emptyList;
return typed_data.Uint8List.fromList(typed_data.Uint8List.view(this[_buffer$][dartx.buffer], 0, this[_length$2]));
}
get length() {
@@ -35865,9 +36720,10 @@
}
clear() {
this[_length$2] = 0;
- this[_buffer$] = null;
+ this[_buffer$] = io._CopyingBytesBuilder._emptyList;
}
- [_pow2roundup](x) {
+ static _pow2roundup(x) {
+ dart.assert(dart.notNull(x) > 0);
x = dart.notNull(x) - 1;
x = (dart.notNull(x) | x[dartx['>>']](1)) >>> 0;
x = (dart.notNull(x) | x[dartx['>>']](2)) >>> 0;
@@ -35891,33 +36747,48 @@
methods: () => ({
add: dart.definiteFunctionType(dart.void, [ListOfint()]),
addByte: dart.definiteFunctionType(dart.void, [core.int]),
+ [_grow$]: dart.definiteFunctionType(dart.void, [core.int]),
takeBytes: dart.definiteFunctionType(core.List$(core.int), []),
toBytes: dart.definiteFunctionType(core.List$(core.int), []),
- clear: dart.definiteFunctionType(dart.void, []),
- [_pow2roundup]: dart.definiteFunctionType(core.int, [core.int])
- })
+ clear: dart.definiteFunctionType(dart.void, [])
+ }),
+ statics: () => ({_pow2roundup: dart.definiteFunctionType(core.int, [core.int])}),
+ names: ['_pow2roundup']
});
io._CopyingBytesBuilder._INIT_SIZE = 1024;
+ dart.defineLazy(io._CopyingBytesBuilder, {
+ get _emptyList() {
+ return typed_data.Uint8List.new(0);
+ }
+ });
const _chunks = Symbol('_chunks');
io._BytesBuilder = class _BytesBuilder extends core.Object {
new() {
- this[_chunks] = JSArrayOfListOfint().of([]);
+ this[_chunks] = JSArrayOfUint8List().of([]);
this[_length$2] = 0;
}
add(bytes) {
- if (!typed_data.Uint8List.is(bytes)) {
- bytes = typed_data.Uint8List.fromList(bytes);
+ let typedBytes = null;
+ if (typed_data.Uint8List.is(bytes)) {
+ typedBytes = bytes;
+ } else {
+ typedBytes = typed_data.Uint8List.fromList(bytes);
}
- this[_chunks][dartx.add](bytes);
- this[_length$2] = dart.notNull(this[_length$2]) + dart.notNull(bytes[dartx.length]);
+ this[_chunks][dartx.add](typedBytes);
+ this[_length$2] = dart.notNull(this[_length$2]) + dart.notNull(typedBytes[dartx.length]);
}
addByte(byte) {
- this.add(JSArrayOfint().of([byte]));
+ this[_chunks][dartx.add]((() => {
+ let _ = typed_data.Uint8List.new(1);
+ _[dartx._set](0, byte);
+ return _;
+ })());
+ this[_length$2] = dart.notNull(this[_length$2]) + 1;
}
takeBytes() {
- if (this[_chunks][dartx.length] == 0) return typed_data.Uint8List.new(0);
+ if (this[_length$2] == 0) return io._CopyingBytesBuilder._emptyList;
if (this[_chunks][dartx.length] == 1) {
- let buffer = this[_chunks][dartx.single];
+ let buffer = this[_chunks][dartx._get](0);
this.clear();
return buffer;
}
@@ -35931,7 +36802,7 @@
return buffer;
}
toBytes() {
- if (this[_chunks][dartx.length] == 0) return typed_data.Uint8List.new(0);
+ if (this[_length$2] == 0) return io._CopyingBytesBuilder._emptyList;
let buffer = typed_data.Uint8List.new(this[_length$2]);
let offset = 0;
for (let chunk of this[_chunks]) {
@@ -35958,7 +36829,7 @@
dart.setSignature(io._BytesBuilder, {
fields: () => ({
[_length$2]: core.int,
- [_chunks]: ListOfListOfint()
+ [_chunks]: ListOfUint8List()
}),
getters: () => ({
length: dart.definiteFunctionType(core.int, []),
@@ -35989,7 +36860,7 @@
switch (dart.dindex(response, io._ERROR_RESPONSE_ERROR_TYPE)) {
case io._ILLEGAL_ARGUMENT_RESPONSE:
{
- return new core.ArgumentError();
+ return new core.ArgumentError(dart.str`${message}: ${path}`);
}
case io._OSERROR_RESPONSE:
{
@@ -36052,7 +36923,7 @@
};
dart.setSignature(io._BufferAndStart, {
fields: () => ({
- buffer: core.List,
+ buffer: ListOfint(),
start: core.int
})
});
@@ -36064,7 +36935,7 @@
let newBuffer = typed_data.Uint8List.new(length);
let j = start;
for (let i = 0; i < length; i++) {
- let value = core.int._check(buffer[dartx._get](j));
+ let value = buffer[dartx._get](j);
if (!(typeof value == 'number')) {
dart.throw(new core.ArgumentError(dart.str`List element is not an integer at index ${j}`));
}
@@ -36073,7 +36944,7 @@
}
return new io._BufferAndStart(newBuffer, 0);
};
- dart.fn(io._ensureFastAndSerializableByteData, ListAndintAndintTo_BufferAndStart());
+ dart.fn(io._ensureFastAndSerializableByteData, ListOfintAndintAndintTo_BufferAndStart());
io._IOCrypto = class _IOCrypto extends core.Object {
static getRandomBytes(count) {
dart.throw(new core.UnsupportedError("_IOCrypto.getRandomBytes"));
@@ -36239,13 +37110,13 @@
}
close() {
if (dart.test(this[_digestCalled])) {
- return ListOfint()._check(this[_resultAsBytes]());
+ return this[_resultAsBytes]();
}
this[_digestCalled] = true;
this[_finalizeData]();
this[_iterate]();
dart.assert(this[_pendingData][dartx.length] == 0);
- return ListOfint()._check(this[_resultAsBytes]());
+ return this[_resultAsBytes]();
}
get blockSize() {
return dart.notNull(this[_chunkSizeInWords]) * io._BYTES_PER_WORD;
@@ -36261,9 +37132,9 @@
return (val[dartx['<<']](mod_shift) & io._MASK_32 | ((dart.notNull(val) & io._MASK_32) >>> 0)[dartx['>>']](32 - mod_shift)) >>> 0;
}
[_resultAsBytes]() {
- let result = [];
+ let result = JSArrayOfint().of([]);
for (let i = 0; i < dart.notNull(this[_h][dartx.length]); i++) {
- result[dartx.addAll](core.Iterable._check(this[_wordToBytes](this[_h][dartx._get](i))));
+ result[dartx.addAll](this[_wordToBytes](this[_h][dartx._get](i)));
}
return result;
}
@@ -36314,11 +37185,11 @@
let lengthInBits = dart.notNull(this[_lengthInBytes]) * io._BITS_PER_BYTE;
dart.assert(lengthInBits < dart.notNull(math.pow(2, 32)));
if (dart.test(this[_bigEndianWords])) {
- this[_pendingData][dartx.addAll](IterableOfint()._check(this[_wordToBytes](0)));
- this[_pendingData][dartx.addAll](IterableOfint()._check(this[_wordToBytes]((lengthInBits & io._MASK_32) >>> 0)));
+ this[_pendingData][dartx.addAll](this[_wordToBytes](0));
+ this[_pendingData][dartx.addAll](this[_wordToBytes]((lengthInBits & io._MASK_32) >>> 0));
} else {
- this[_pendingData][dartx.addAll](IterableOfint()._check(this[_wordToBytes]((lengthInBits & io._MASK_32) >>> 0)));
- this[_pendingData][dartx.addAll](IterableOfint()._check(this[_wordToBytes](0)));
+ this[_pendingData][dartx.addAll](this[_wordToBytes]((lengthInBits & io._MASK_32) >>> 0));
+ this[_pendingData][dartx.addAll](this[_wordToBytes](0));
}
}
};
@@ -36340,9 +37211,9 @@
[_add32]: dart.definiteFunctionType(dart.dynamic, [dart.dynamic, dart.dynamic]),
[_roundUp]: dart.definiteFunctionType(dart.dynamic, [dart.dynamic, dart.dynamic]),
[_rotl32]: dart.definiteFunctionType(core.int, [core.int, core.int]),
- [_resultAsBytes]: dart.definiteFunctionType(dart.dynamic, []),
+ [_resultAsBytes]: dart.definiteFunctionType(core.List$(core.int), []),
[_bytesToChunk]: dart.definiteFunctionType(dart.dynamic, [ListOfint(), core.int]),
- [_wordToBytes]: dart.definiteFunctionType(dart.dynamic, [core.int]),
+ [_wordToBytes]: dart.definiteFunctionType(core.List$(core.int), [core.int]),
[_iterate]: dart.definiteFunctionType(dart.dynamic, []),
[_finalizeData]: dart.definiteFunctionType(dart.dynamic, [])
})
@@ -36624,6 +37495,7 @@
}
};
dart.addSimpleTypeTests(io.ZLibEncoder);
+ io.ZLibEncoder[dart.implements] = () => [ChunkedConverterOfListOfint$ListOfint$ListOfint$ListOfint()];
dart.setSignature(io.ZLibEncoder, {
fields: () => ({
gzip: core.bool,
@@ -36706,7 +37578,7 @@
const _filter$ = Symbol('_filter');
const _closed = Symbol('_closed');
const _empty = Symbol('_empty');
- let const$52;
+ let const$55;
io._FilterSink = class _FilterSink extends convert.ByteConversionSink {
new(sink, filter) {
this[_sink$0] = sink;
@@ -36725,10 +37597,10 @@
try {
this[_empty] = false;
let bufferAndStart = io._ensureFastAndSerializableByteData(data, start, end);
- this[_filter$].process(ListOfint()._check(bufferAndStart.buffer), bufferAndStart.start, dart.notNull(end) - (dart.notNull(start) - dart.notNull(bufferAndStart.start)));
+ this[_filter$].process(bufferAndStart.buffer, bufferAndStart.start, dart.notNull(end) - (dart.notNull(start) - dart.notNull(bufferAndStart.start)));
let out = null;
while ((out = this[_filter$].processed({flush: false})) != null) {
- this[_sink$0].add(ListOfint()._check(out));
+ this[_sink$0].add(out);
}
} catch (e) {
this[_closed] = true;
@@ -36739,11 +37611,11 @@
}
close() {
if (dart.test(this[_closed])) return;
- if (dart.test(this[_empty])) this[_filter$].process(const$52 || (const$52 = dart.constList([], core.int)), 0, 0);
+ if (dart.test(this[_empty])) this[_filter$].process(const$55 || (const$55 = dart.constList([], core.int)), 0, 0);
try {
let out = null;
while ((out = this[_filter$].processed({end: true})) != null) {
- this[_sink$0].add(ListOfint()._check(out));
+ this[_sink$0].add(out);
}
} catch (e) {
this[_closed] = true;
@@ -36810,9 +37682,9 @@
}
};
dart.fn(io._validateZLibMemLevel, intTovoid());
- let const$53;
+ let const$56;
io._validateZLibStrategy = function(strategy) {
- let strategies = const$53 || (const$53 = dart.constList([io.ZLibOption.STRATEGY_FILTERED, io.ZLibOption.STRATEGY_HUFFMAN_ONLY, io.ZLibOption.STRATEGY_RLE, io.ZLibOption.STRATEGY_FIXED, io.ZLibOption.STRATEGY_DEFAULT], core.int));
+ let strategies = const$56 || (const$56 = dart.constList([io.ZLibOption.STRATEGY_FILTERED, io.ZLibOption.STRATEGY_HUFFMAN_ONLY, io.ZLibOption.STRATEGY_RLE, io.ZLibOption.STRATEGY_FIXED, io.ZLibOption.STRATEGY_DEFAULT], core.int));
if (strategies[dartx.indexOf](strategy) == -1) {
dart.throw(new core.ArgumentError("Unsupported 'strategy'"));
}
@@ -36842,7 +37714,6 @@
const _isErrorResponse = Symbol('_isErrorResponse');
const _exceptionOrErrorFromResponse = Symbol('_exceptionOrErrorFromResponse');
const _absolutePath = Symbol('_absolutePath');
- const _computeExistingIndex = Symbol('_computeExistingIndex');
const _delete = Symbol('_delete');
const _deleteSync = Symbol('_deleteSync');
const _type = Symbol('_type');
@@ -36863,6 +37734,12 @@
io.FileSystemEntity._throwIfError(result, "Cannot resolve symbolic links", this.path);
return core.String._check(result);
}
+ stat() {
+ return io.FileStat.stat(this.path);
+ }
+ statSync() {
+ return io.FileStat.statSync(this.path);
+ }
delete(opts) {
let recursive = opts && 'recursive' in opts ? opts.recursive : false;
return this[_delete]({recursive: recursive});
@@ -37026,6 +37903,8 @@
methods: () => ({
resolveSymbolicLinks: dart.definiteFunctionType(async.Future$(core.String), []),
resolveSymbolicLinksSync: dart.definiteFunctionType(core.String, []),
+ stat: dart.definiteFunctionType(async.Future$(io.FileStat), []),
+ statSync: dart.definiteFunctionType(io.FileStat, []),
delete: dart.definiteFunctionType(async.Future$(io.FileSystemEntity), [], {recursive: core.bool}),
deleteSync: dart.definiteFunctionType(dart.void, [], {recursive: core.bool}),
watch: dart.definiteFunctionType(async.Stream$(io.FileSystemEvent), [], {events: core.int, recursive: core.bool})
@@ -37131,33 +38010,6 @@
get absolute() {
return io.Directory.new(this[_absolutePath]);
}
- stat() {
- return io.FileStat.stat(this.path);
- }
- statSync() {
- return io.FileStat.statSync(this.path);
- }
- [_computeExistingIndex](dirsToCreate) {
- let future = null;
- let notFound = dirsToCreate[dartx.length];
- for (let i = 0; i < dart.notNull(dirsToCreate[dartx.length]); i++) {
- if (future == null) {
- future = dart.dsend(dart.dsend(dirsToCreate[dartx._get](i), 'exists'), 'then', dart.fn(e => dart.test(e) ? i : notFound, dynamicToint()));
- } else {
- future = dart.dsend(future, 'then', dart.fn(index => {
- if (!dart.equals(index, notFound)) {
- return async.Future.value(index);
- }
- return dart.dsend(dart.dsend(dirsToCreate[dartx._get](i), 'exists'), 'then', dart.fn(e => dart.test(e) ? i : notFound, dynamicToint()));
- }, dynamicTodynamic$()));
- }
- }
- if (future == null) {
- return FutureOfint().value(notFound);
- } else {
- return FutureOfint()._check(future);
- }
- }
create(opts) {
let recursive = opts && 'recursive' in opts ? opts.recursive : false;
if (dart.test(recursive)) {
@@ -37268,7 +38120,7 @@
list(opts) {
let recursive = opts && 'recursive' in opts ? opts.recursive : false;
let followLinks = opts && 'followLinks' in opts ? opts.followLinks : true;
- return StreamOfFileSystemEntity()._check(new io._AsyncDirectoryLister(io.FileSystemEntity._ensureTrailingPathSeparators(this.path), recursive, followLinks).stream);
+ return new io._AsyncDirectoryLister(io.FileSystemEntity._ensureTrailingPathSeparators(this.path), recursive, followLinks).stream;
}
listSync(opts) {
let recursive = opts && 'recursive' in opts ? opts.recursive : false;
@@ -37312,9 +38164,6 @@
methods: () => ({
exists: dart.definiteFunctionType(async.Future$(core.bool), []),
existsSync: dart.definiteFunctionType(core.bool, []),
- stat: dart.definiteFunctionType(async.Future$(io.FileStat), []),
- statSync: dart.definiteFunctionType(io.FileStat, []),
- [_computeExistingIndex]: dart.definiteFunctionType(async.Future$(core.int), [core.List]),
create: dart.definiteFunctionType(async.Future$(io.Directory), [], {recursive: core.bool}),
createSync: dart.definiteFunctionType(dart.void, [], {recursive: core.bool}),
createTemp: dart.definiteFunctionType(async.Future$(io.Directory), [], [core.String]),
@@ -37360,7 +38209,7 @@
this.nextRunning = false;
this.closed = false;
this[_ops] = null;
- this.controller = async.StreamController.new({onListen: dart.bind(this, 'onListen'), onResume: dart.bind(this, 'onResume'), onCancel: dart.bind(this, 'onCancel'), sync: true});
+ this.controller = StreamControllerOfFileSystemEntity().new({onListen: dart.bind(this, 'onListen'), onResume: dart.bind(this, 'onResume'), onCancel: dart.bind(this, 'onCancel'), sync: true});
}
[_pointer]() {
return this[_ops] == null ? null : this[_ops].getPointer();
@@ -37487,14 +38336,14 @@
path: core.String,
recursive: core.bool,
followLinks: core.bool,
- controller: async.StreamController,
+ controller: StreamControllerOfFileSystemEntity(),
canceled: core.bool,
nextRunning: core.bool,
closed: core.bool,
[_ops]: io._AsyncDirectoryListerOps,
closeCompleter: async.Completer
}),
- getters: () => ({stream: dart.definiteFunctionType(async.Stream, [])}),
+ getters: () => ({stream: dart.definiteFunctionType(async.Stream$(io.FileSystemEntity), [])}),
methods: () => ({
[_pointer]: dart.definiteFunctionType(core.int, []),
onListen: dart.definiteFunctionType(dart.void, []),
@@ -37521,7 +38370,7 @@
}
};
dart.setSignature(io._EventHandler, {
- statics: () => ({_sendData: dart.definiteFunctionType(dart.void, [core.Object, isolate.SendPort, core.int])}),
+ statics: () => ({_sendData: dart.definiteFunctionType(dart.void, [core.Object, isolate$.SendPort, core.int])}),
names: ['_sendData']
});
const _mode = Symbol('_mode');
@@ -37563,7 +38412,9 @@
toString() {
return {
0: "FileLock.SHARED",
- 1: "FileLock.EXCLUSIVE"
+ 1: "FileLock.EXCLUSIVE",
+ 2: "FileLock.BLOCKING_SHARED",
+ 3: "FileLock.BLOCKING_EXCLUSIVE"
}[this.index];
}
};
@@ -37572,7 +38423,9 @@
});
dart.defineEnumValues(io.FileLock, [
'SHARED',
- 'EXCLUSIVE'
+ 'EXCLUSIVE',
+ 'BLOCKING_SHARED',
+ 'BLOCKING_EXCLUSIVE'
]);
io.File = class File extends core.Object {
static new(path) {
@@ -37625,9 +38478,9 @@
});
io._BLOCK_SIZE = 64 * 1024;
const _closeCompleter = Symbol('_closeCompleter');
- const _path$ = Symbol('_path');
+ const _path = Symbol('_path');
const _position$0 = Symbol('_position');
- const _end$0 = Symbol('_end');
+ const _end$ = Symbol('_end');
const _controller$0 = Symbol('_controller');
const _openedFile = Symbol('_openedFile');
const _unsubscribed = Symbol('_unsubscribed');
@@ -37640,9 +38493,9 @@
io._FileStream = class _FileStream extends async.Stream$(core.List$(core.int)) {
new(path, position, end) {
this[_closeCompleter] = async.Completer.new();
- this[_path$] = path;
+ this[_path] = path;
this[_position$0] = position;
- this[_end$0] = end;
+ this[_end$] = end;
this[_controller$0] = null;
this[_openedFile] = null;
this[_unsubscribed] = false;
@@ -37656,9 +38509,9 @@
this[_closeCompleter] = async.Completer.new();
this[_position$0] = 0;
this[_controller$0] = null;
- this[_path$] = null;
+ this[_path] = null;
this[_openedFile] = null;
- this[_end$0] = null;
+ this[_end$] = null;
this[_unsubscribed] = false;
this[_readInProgress] = true;
this[_closed] = false;
@@ -37699,12 +38552,12 @@
}
this[_readInProgress] = true;
let readBytes = io._BLOCK_SIZE;
- if (this[_end$0] != null) {
- readBytes = math.min(core.int)(readBytes, dart.notNull(this[_end$0]) - dart.notNull(this[_position$0]));
+ if (this[_end$] != null) {
+ readBytes = math.min(core.int)(readBytes, dart.notNull(this[_end$]) - dart.notNull(this[_position$0]));
if (dart.notNull(readBytes) < 0) {
this[_readInProgress] = false;
if (!dart.test(this[_unsubscribed])) {
- this[_controller$0].addError(new core.RangeError(dart.str`Bad end position: ${this[_end$0]}`));
+ this[_controller$0].addError(new core.RangeError(dart.str`Bad end position: ${this[_end$]}`));
this[_closeFile]();
this[_unsubscribed] = true;
}
@@ -37718,7 +38571,7 @@
return;
}
this[_position$0] = dart.notNull(this[_position$0]) + dart.notNull(block[dartx.length]);
- if (dart.notNull(block[dartx.length]) < dart.notNull(readBytes) || this[_end$0] != null && this[_position$0] == this[_end$0]) {
+ if (dart.notNull(block[dartx.length]) < dart.notNull(readBytes) || this[_end$] != null && this[_position$0] == this[_end$]) {
this[_atEnd] = true;
}
if (!dart.test(this[_atEnd]) && !dart.test(this[_controller$0].isPaused)) {
@@ -37767,8 +38620,8 @@
this[_closeCompleter].complete();
}).bind(this);
dart.fn(openFailed, dynamicAnddynamicTovoid$());
- if (this[_path$] != null) {
- io.File.new(this[_path$]).open({mode: io.FileMode.READ}).then(dart.void)(onOpenFile, {onError: openFailed});
+ if (this[_path] != null) {
+ io.File.new(this[_path]).open({mode: io.FileMode.READ}).then(dart.void)(onOpenFile, {onError: openFailed});
} else {
try {
onOpenFile(io._File._openStdioSync(0));
@@ -37785,10 +38638,10 @@
dart.setSignature(io._FileStream, {
fields: () => ({
[_controller$0]: StreamControllerOfListOfint(),
- [_path$]: core.String,
+ [_path]: core.String,
[_openedFile]: io.RandomAccessFile,
[_position$0]: core.int,
- [_end$0]: core.int,
+ [_end$]: core.int,
[_closeCompleter]: async.Completer,
[_unsubscribed]: core.bool,
[_readInProgress]: core.bool,
@@ -37860,8 +38713,8 @@
})
});
const _tryDecode = Symbol('_tryDecode');
- let const$54;
- let const$55;
+ let const$57;
+ let const$58;
io._File = class _File extends io.FileSystemEntity {
new(path) {
this.path = path;
@@ -37888,12 +38741,6 @@
get absolute() {
return io.File.new(this[_absolutePath]);
}
- stat() {
- return io.FileStat.stat(this.path);
- }
- statSync() {
- return io.FileStat.statSync(this.path);
- }
create(opts) {
let recursive = opts && 'recursive' in opts ? opts.recursive : false;
let result = dart.test(recursive) ? this.parent.create({recursive: true}) : async.Future.value(null);
@@ -38010,6 +38857,41 @@
io._File.throwIfError(result, "Cannot retrieve length of file", this.path);
return core.int._check(result);
}
+ lastAccessed() {
+ return io._IOService._dispatch(io._FILE_LAST_ACCESSED, JSArrayOfString().of([this.path])).then(core.DateTime)(dart.fn(response => {
+ if (dart.test(io._isErrorResponse(response))) {
+ dart.throw(io._exceptionFromResponse(response, "Cannot retrieve access time", this.path));
+ }
+ return new core.DateTime.fromMillisecondsSinceEpoch(core.int._check(response));
+ }, dynamicToDateTime()));
+ }
+ static _lastAccessed(path) {
+ dart.throw(new core.UnsupportedError("File._lastAccessed"));
+ }
+ lastAccessedSync() {
+ let ms = io._File._lastAccessed(this.path);
+ io._File.throwIfError(ms, "Cannot retrieve access time", this.path);
+ return new core.DateTime.fromMillisecondsSinceEpoch(core.int._check(ms));
+ }
+ setLastAccessed(time) {
+ let millis = time.millisecondsSinceEpoch;
+ return io._IOService._dispatch(io._FILE_SET_LAST_ACCESSED, JSArrayOfObject().of([this.path, millis])).then(dart.dynamic)(dart.fn(response => {
+ if (dart.test(io._isErrorResponse(response))) {
+ dart.throw(io._exceptionFromResponse(response, "Cannot set access time", this.path));
+ }
+ return null;
+ }, dynamicToNull$()));
+ }
+ static _setLastAccessed(path, millis) {
+ dart.throw(new core.UnsupportedError("File._setLastAccessed"));
+ }
+ setLastAccessedSync(time) {
+ let millis = time.millisecondsSinceEpoch;
+ let result = io._File._setLastAccessed(this.path, millis);
+ if (io.OSError.is(result)) {
+ dart.throw(new io.FileSystemException("Failed to set file access time", this.path, result));
+ }
+ }
lastModified() {
return io._IOService._dispatch(io._FILE_LAST_MODIFIED, JSArrayOfString().of([this.path])).then(core.DateTime)(dart.fn(response => {
if (dart.test(io._isErrorResponse(response))) {
@@ -38026,6 +38908,25 @@
io._File.throwIfError(ms, "Cannot retrieve modification time", this.path);
return new core.DateTime.fromMillisecondsSinceEpoch(core.int._check(ms));
}
+ setLastModified(time) {
+ let millis = time.millisecondsSinceEpoch;
+ return io._IOService._dispatch(io._FILE_SET_LAST_MODIFIED, JSArrayOfObject().of([this.path, millis])).then(dart.dynamic)(dart.fn(response => {
+ if (dart.test(io._isErrorResponse(response))) {
+ dart.throw(io._exceptionFromResponse(response, "Cannot set modification time", this.path));
+ }
+ return null;
+ }, dynamicToNull$()));
+ }
+ static _setLastModified(path, millis) {
+ dart.throw(new core.UnsupportedError("File._setLastModified"));
+ }
+ setLastModifiedSync(time) {
+ let millis = time.millisecondsSinceEpoch;
+ let result = io._File._setLastModified(this.path, millis);
+ if (io.OSError.is(result)) {
+ dart.throw(new io.FileSystemException("Failed to set file modification time", this.path, result));
+ }
+ }
static _open(path, mode) {
dart.throw(new core.UnsupportedError("File._open"));
}
@@ -38065,22 +38966,22 @@
readAsBytes() {
function readDataChunked(file) {
let builder = io.BytesBuilder.new({copy: false});
- let completer = async.Completer.new();
+ let completer = CompleterOfListOfint().new();
function read() {
- dart.dsend(dart.dsend(file, 'read', io._BLOCK_SIZE), 'then', dart.fn(data => {
- if (dart.test(dart.dsend(dart.dload(data, 'length'), '>', 0))) {
- builder.add(ListOfint()._check(data));
+ file.read(io._BLOCK_SIZE).then(dart.dynamic)(dart.fn(data => {
+ if (dart.notNull(data[dartx.length]) > 0) {
+ builder.add(data);
read();
} else {
completer.complete(builder.takeBytes());
}
- }, dynamicToNull$()), {onError: dart.bind(completer, 'completeError')});
+ }, ListOfintToNull()), {onError: dart.bind(completer, 'completeError')});
}
dart.fn(read, VoidTovoid$());
read();
- return FutureOfListOfint()._check(completer.future);
+ return completer.future;
}
- dart.fn(readDataChunked, dynamicToFutureOfListOfint());
+ dart.fn(readDataChunked, RandomAccessFileToFutureOfListOfint());
return this.open().then(ListOfint())(dart.fn(file => file.length().then(ListOfint())(dart.fn(length => {
if (length == 0) {
return readDataChunked(file);
@@ -38097,13 +38998,13 @@
let builder = io.BytesBuilder.new({copy: false});
do {
data = opened.readSync(io._BLOCK_SIZE);
- if (dart.test(dart.dsend(dart.dload(data, 'length'), '>', 0))) builder.add(ListOfint()._check(data));
- } while (dart.test(dart.dsend(dart.dload(data, 'length'), '>', 0)));
+ if (dart.notNull(data[dartx.length]) > 0) builder.add(data);
+ } while (dart.notNull(data[dartx.length]) > 0);
data = builder.takeBytes();
} else {
data = opened.readSync(length);
}
- return ListOfint()._check(data);
+ return data;
} finally {
opened.closeSync();
}
@@ -38126,11 +39027,11 @@
}
readAsLines(opts) {
let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
- return this.readAsString({encoding: encoding}).then(ListOfString())(dart.bind(const$54 || (const$54 = dart.const(new convert.LineSplitter())), 'convert'));
+ return this.readAsString({encoding: encoding}).then(ListOfString())(dart.bind(const$57 || (const$57 = dart.const(new convert.LineSplitter())), 'convert'));
}
readAsLinesSync(opts) {
let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
- return (const$55 || (const$55 = dart.const(new convert.LineSplitter()))).convert(this.readAsStringSync({encoding: encoding}));
+ return (const$58 || (const$58 = dart.const(new convert.LineSplitter()))).convert(this.readAsStringSync({encoding: encoding}));
}
writeAsBytes(bytes, opts) {
let mode = opts && 'mode' in opts ? opts.mode : io.FileMode.WRITE;
@@ -38184,8 +39085,6 @@
methods: () => ({
exists: dart.definiteFunctionType(async.Future$(core.bool), []),
existsSync: dart.definiteFunctionType(core.bool, []),
- stat: dart.definiteFunctionType(async.Future$(io.FileStat), []),
- statSync: dart.definiteFunctionType(io.FileStat, []),
create: dart.definiteFunctionType(async.Future$(io.File), [], {recursive: core.bool}),
createSync: dart.definiteFunctionType(dart.void, [], {recursive: core.bool}),
[_delete]: dart.definiteFunctionType(async.Future$(io.File), [], {recursive: core.bool}),
@@ -38197,8 +39096,14 @@
open: dart.definiteFunctionType(async.Future$(io.RandomAccessFile), [], {mode: io.FileMode}),
length: dart.definiteFunctionType(async.Future$(core.int), []),
lengthSync: dart.definiteFunctionType(core.int, []),
+ lastAccessed: dart.definiteFunctionType(async.Future$(core.DateTime), []),
+ lastAccessedSync: dart.definiteFunctionType(core.DateTime, []),
+ setLastAccessed: dart.definiteFunctionType(async.Future, [core.DateTime]),
+ setLastAccessedSync: dart.definiteFunctionType(dart.void, [core.DateTime]),
lastModified: dart.definiteFunctionType(async.Future$(core.DateTime), []),
lastModifiedSync: dart.definiteFunctionType(core.DateTime, []),
+ setLastModified: dart.definiteFunctionType(async.Future, [core.DateTime]),
+ setLastModifiedSync: dart.definiteFunctionType(dart.void, [core.DateTime]),
openSync: dart.definiteFunctionType(io.RandomAccessFile, [], {mode: io.FileMode}),
openRead: dart.definiteFunctionType(async.Stream$(core.List$(core.int)), [], [core.int, core.int]),
openWrite: dart.definiteFunctionType(io.IOSink, [], {mode: io.FileMode, encoding: convert.Encoding}),
@@ -38225,26 +39130,49 @@
_renameLink: dart.definiteFunctionType(dart.dynamic, [core.String, core.String]),
_copy: dart.definiteFunctionType(dart.dynamic, [core.String, core.String]),
_lengthFromPath: dart.definiteFunctionType(dart.dynamic, [core.String]),
+ _lastAccessed: dart.definiteFunctionType(dart.dynamic, [core.String]),
+ _setLastAccessed: dart.definiteFunctionType(dart.dynamic, [core.String, core.int]),
_lastModified: dart.definiteFunctionType(dart.dynamic, [core.String]),
+ _setLastModified: dart.definiteFunctionType(dart.dynamic, [core.String, core.int]),
_open: dart.definiteFunctionType(dart.dynamic, [core.String, core.int]),
_openStdio: dart.definiteFunctionType(core.int, [core.int]),
_openStdioSync: dart.definiteFunctionType(io.RandomAccessFile, [core.int]),
throwIfError: dart.definiteFunctionType(dart.dynamic, [core.Object, core.String, core.String])
}),
- names: ['_exists', '_create', '_createLink', '_linkTarget', '_deleteNative', '_deleteLinkNative', '_rename', '_renameLink', '_copy', '_lengthFromPath', '_lastModified', '_open', '_openStdio', '_openStdioSync', 'throwIfError']
+ names: ['_exists', '_create', '_createLink', '_linkTarget', '_deleteNative', '_deleteLinkNative', '_rename', '_renameLink', '_copy', '_lengthFromPath', '_lastAccessed', '_setLastAccessed', '_lastModified', '_setLastModified', '_open', '_openStdio', '_openStdioSync', 'throwIfError']
});
io._RandomAccessFileOps = class _RandomAccessFileOps extends core.Object {
static new(pointer) {
dart.throw(new core.UnsupportedError("RandomAccessFile"));
}
};
+ io._FileTranslation = class _FileTranslation extends core.Object {
+ new(index) {
+ this.index = index;
+ }
+ toString() {
+ return {
+ 0: "_FileTranslation.text",
+ 1: "_FileTranslation.binary"
+ }[this.index];
+ }
+ };
+ dart.setSignature(io._FileTranslation, {
+ fields: () => ({index: core.int})
+ });
+ dart.defineEnumValues(io._FileTranslation, [
+ 'text',
+ 'binary'
+ ]);
const _asyncDispatched = Symbol('_asyncDispatched');
const _fileService = Symbol('_fileService');
const _resourceInfo = Symbol('_resourceInfo');
+ const _translation = Symbol('_translation');
const _maybeConnectHandler = Symbol('_maybeConnectHandler');
const _maybePerformCleanup = Symbol('_maybePerformCleanup');
const _dispatch = Symbol('_dispatch');
const _checkAvailable = Symbol('_checkAvailable');
+ const _fileLockValue = Symbol('_fileLockValue');
io._RandomAccessFile = class _RandomAccessFile extends core.Object {
new(pointer, path) {
this.path = path;
@@ -38252,9 +39180,11 @@
this[_fileService] = null;
this[_resourceInfo] = null;
this[_ops] = null;
+ this[_translation] = null;
this.closed = false;
this[_ops] = io._RandomAccessFileOps.new(pointer);
this[_resourceInfo] = new io._FileResourceInfo(this);
+ this[_translation] = io._FileTranslation.binary;
this[_maybeConnectHandler]();
}
[_maybePerformCleanup]() {
@@ -38316,8 +39246,8 @@
dart.throw(io._exceptionFromResponse(response, "read failed", this.path));
}
this[_resourceInfo].addRead(core.int._check(dart.dload(dart.dindex(response, 1), 'length')));
- return FutureOrOfListOfint()._check(dart.dindex(response, 1));
- }, dynamicToFutureOrOfListOfint()));
+ return ListOfint().as(dart.dindex(response, 1));
+ }, dynamicToListOfint()));
}
readSync(bytes) {
this[_checkAvailable]();
@@ -38329,7 +39259,7 @@
dart.throw(new io.FileSystemException("readSync failed", this.path, result));
}
this[_resourceInfo].addRead(core.int._check(dart.dload(result, 'length')));
- return ListOfint()._check(result);
+ return ListOfint().as(result);
}
readInto(buffer, start, end) {
if (start === void 0) start = 0;
@@ -38347,8 +39277,8 @@
dart.throw(io._exceptionFromResponse(response, "readInto failed", this.path));
}
let read = dart.dindex(response, 1);
- let data = dart.dindex(response, 2);
- buffer[dartx.setRange](start, dart.asInt(dart.notNull(start) + dart.notNull(core.num._check(read))), IterableOfint()._check(data));
+ let data = ListOfint().as(dart.dindex(response, 2));
+ buffer[dartx.setRange](start, dart.asInt(dart.notNull(start) + dart.notNull(core.num._check(read))), data);
this[_resourceInfo].addRead(core.int._check(read));
return FutureOrOfint()._check(read);
}, dynamicToFutureOrOfint()));
@@ -38437,7 +39367,7 @@
return;
}
let bufferAndStart = io._ensureFastAndSerializableByteData(buffer, start, end);
- let result = this[_ops].writeFrom(ListOfint()._check(bufferAndStart.buffer), bufferAndStart.start, dart.notNull(end) - (dart.notNull(start) - dart.notNull(bufferAndStart.start)));
+ let result = this[_ops].writeFrom(bufferAndStart.buffer, bufferAndStart.start, dart.notNull(end) - (dart.notNull(start) - dart.notNull(bufferAndStart.start)));
if (io.OSError.is(result)) {
dart.throw(new io.FileSystemException("writeFrom failed", this.path, result));
}
@@ -38536,6 +39466,30 @@
dart.throw(new io.FileSystemException("flush failed", this.path, result));
}
}
+ [_fileLockValue](fl) {
+ switch (fl) {
+ case io.FileLock.SHARED:
+ {
+ return io._RandomAccessFile.LOCK_SHARED;
+ }
+ case io.FileLock.EXCLUSIVE:
+ {
+ return io._RandomAccessFile.LOCK_EXCLUSIVE;
+ }
+ case io.FileLock.BLOCKING_SHARED:
+ {
+ return io._RandomAccessFile.LOCK_BLOCKING_SHARED;
+ }
+ case io.FileLock.BLOCKING_EXCLUSIVE:
+ {
+ return io._RandomAccessFile.LOCK_BLOCKING_EXCLUSIVE;
+ }
+ default:
+ {
+ return -1;
+ }
+ }
+ }
lock(mode, start, end) {
if (mode === void 0) mode = io.FileLock.EXCLUSIVE;
if (start === void 0) start = 0;
@@ -38546,7 +39500,7 @@
if (dart.notNull(start) < 0 || dart.notNull(end) < -1 || end != -1 && dart.notNull(start) >= dart.notNull(end)) {
dart.throw(new core.ArgumentError());
}
- let lock = dart.equals(mode, io.FileLock.EXCLUSIVE) ? io._RandomAccessFile.LOCK_EXCLUSIVE : io._RandomAccessFile.LOCK_SHARED;
+ let lock = this[_fileLockValue](mode);
return this[_dispatch](io._FILE_LOCK, JSArrayOfint().of([null, lock, start, end])).then(io._RandomAccessFile)(dart.fn(response => {
if (dart.test(io._isErrorResponse(response))) {
dart.throw(io._exceptionFromResponse(response, 'lock failed', this.path));
@@ -38581,7 +39535,7 @@
if (dart.notNull(start) < 0 || dart.notNull(end) < -1 || end != -1 && dart.notNull(start) >= dart.notNull(end)) {
dart.throw(new core.ArgumentError());
}
- let lock = dart.equals(mode, io.FileLock.EXCLUSIVE) ? io._RandomAccessFile.LOCK_EXCLUSIVE : io._RandomAccessFile.LOCK_SHARED;
+ let lock = this[_fileLockValue](mode);
let result = this[_ops].lock(lock, start, end);
if (io.OSError.is(result)) {
dart.throw(new io.FileSystemException('lock failed', this.path, result));
@@ -38602,6 +39556,15 @@
dart.throw(new io.FileSystemException('unlock failed', this.path, result));
}
}
+ get translation() {
+ return this[_translation];
+ }
+ set translation(translation) {
+ if (!dart.equals(this[_translation], translation)) {
+ this[_ops].setTranslation(translation.index);
+ this[_translation] = translation;
+ }
+ }
[_pointer]() {
return this[_ops].getPointer();
}
@@ -38637,11 +39600,14 @@
fields: () => ({
path: core.String,
[_asyncDispatched]: core.bool,
- [_fileService]: isolate.SendPort,
+ [_fileService]: isolate$.SendPort,
[_resourceInfo]: io._FileResourceInfo,
[_ops]: io._RandomAccessFileOps,
+ [_translation]: io._FileTranslation,
closed: core.bool
}),
+ getters: () => ({translation: dart.definiteFunctionType(io._FileTranslation, [])}),
+ setters: () => ({translation: dart.definiteFunctionType(dart.void, [io._FileTranslation])}),
methods: () => ({
[_maybePerformCleanup]: dart.definiteFunctionType(dart.void, []),
[_maybeConnectHandler]: dart.definiteFunctionType(dart.dynamic, []),
@@ -38669,6 +39635,7 @@
lengthSync: dart.definiteFunctionType(core.int, []),
flush: dart.definiteFunctionType(async.Future$(io.RandomAccessFile), []),
flushSync: dart.definiteFunctionType(dart.void, []),
+ [_fileLockValue]: dart.definiteFunctionType(core.int, [io.FileLock]),
lock: dart.definiteFunctionType(async.Future$(io.RandomAccessFile), [], [io.FileLock, core.int, core.int]),
unlock: dart.definiteFunctionType(async.Future$(io.RandomAccessFile), [], [core.int, core.int]),
lockSync: dart.definiteFunctionType(dart.void, [], [io.FileLock, core.int, core.int]),
@@ -38682,7 +39649,9 @@
io._RandomAccessFile.LOCK_UNLOCK = 0;
io._RandomAccessFile.LOCK_SHARED = 1;
io._RandomAccessFile.LOCK_EXCLUSIVE = 2;
- let const$56;
+ io._RandomAccessFile.LOCK_BLOCKING_SHARED = 3;
+ io._RandomAccessFile.LOCK_BLOCKING_EXCLUSIVE = 4;
+ let const$59;
io.FileSystemEntityType = class FileSystemEntityType extends core.Object {
_internal(type) {
this[_type] = type;
@@ -38691,7 +39660,7 @@
return io.FileSystemEntityType._typeList[dartx._get](type);
}
toString() {
- return (const$56 || (const$56 = dart.constList(['FILE', 'DIRECTORY', 'LINK', 'NOT_FOUND'], core.String)))[dartx._get](this[_type]);
+ return (const$59 || (const$59 = dart.constList(['FILE', 'DIRECTORY', 'LINK', 'NOT_FOUND'], core.String)))[dartx._get](this[_type]);
}
};
dart.defineNamedConstructor(io.FileSystemEntityType, '_internal');
@@ -38717,7 +39686,7 @@
return dart.constList([io.FileSystemEntityType.FILE, io.FileSystemEntityType.DIRECTORY, io.FileSystemEntityType.LINK, io.FileSystemEntityType.NOT_FOUND], io.FileSystemEntityType);
}
});
- let const$57;
+ let const$60;
io.FileStat = class FileStat extends core.Object {
_internal(changed, modified, accessed, type, mode, size) {
this.changed = changed;
@@ -38763,7 +39732,7 @@
}
modeString() {
let permissions = dart.notNull(this.mode) & 4095;
- let codes = const$57 || (const$57 = dart.constList(['---', '--x', '-w-', '-wx', 'r--', 'r-x', 'rw-', 'rwx'], core.String));
+ let codes = const$60 || (const$60 = dart.constList(['---', '--x', '-w-', '-wx', 'r--', 'r-x', 'rw-', 'rwx'], core.String));
let result = [];
if ((permissions & 2048) != 0) result[dartx.add]("(suid) ");
if ((permissions & 1024) != 0) result[dartx.add]("(guid) ");
@@ -39263,19 +40232,19 @@
}),
getters: () => ({uri: dart.definiteFunctionType(core.Uri, [])})
});
- let const$58;
- let const$59;
- let const$60;
let const$61;
let const$62;
let const$63;
let const$64;
let const$65;
let const$66;
+ let const$67;
+ let const$68;
+ let const$69;
io.HttpDate = class HttpDate extends core.Object {
static format(date) {
- let wkday = const$58 || (const$58 = dart.constList(["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"], core.String));
- let month = const$59 || (const$59 = dart.constList(["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], core.String));
+ let wkday = const$61 || (const$61 = dart.constList(["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"], core.String));
+ let month = const$62 || (const$62 = dart.constList(["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], core.String));
let d = date.toUtc();
let sb = new core.StringBuffer();
sb.write(wkday[dartx._get](dart.notNull(d.weekday) - 1));
@@ -39297,12 +40266,12 @@
}
static parse(date) {
let SP = 32;
- let wkdays = const$60 || (const$60 = dart.constList(["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"], core.String));
- let weekdays = const$61 || (const$61 = dart.constList(["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"], core.String));
- let months = const$62 || (const$62 = dart.constList(["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], core.String));
- let wkdaysLowerCase = const$63 || (const$63 = dart.constList(["mon", "tue", "wed", "thu", "fri", "sat", "sun"], core.String));
- let weekdaysLowerCase = const$64 || (const$64 = dart.constList(["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"], core.String));
- let monthsLowerCase = const$65 || (const$65 = dart.constList(["jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"], core.String));
+ let wkdays = const$63 || (const$63 = dart.constList(["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"], core.String));
+ let weekdays = const$64 || (const$64 = dart.constList(["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"], core.String));
+ let months = const$65 || (const$65 = dart.constList(["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], core.String));
+ let wkdaysLowerCase = const$66 || (const$66 = dart.constList(["mon", "tue", "wed", "thu", "fri", "sat", "sun"], core.String));
+ let weekdaysLowerCase = const$67 || (const$67 = dart.constList(["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"], core.String));
+ let monthsLowerCase = const$68 || (const$68 = dart.constList(["jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"], core.String));
let formatRfc1123 = 0;
let formatRfc850 = 1;
let formatAsctime = 2;
@@ -39418,7 +40387,7 @@
return new core.DateTime.utc(year, dart.notNull(month) + 1, day, hours, minutes, seconds, 0);
}
static _parseCookieDate(date) {
- let monthsLowerCase = const$66 || (const$66 = dart.constList(["jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"], core.String));
+ let monthsLowerCase = const$69 || (const$69 = dart.constList(["jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"], core.String));
let position = 0;
function error() {
dart.throw(new io.HttpException(dart.str`Invalid cookie date ${date}`));
@@ -39552,7 +40521,7 @@
const _addIfModifiedSince = Symbol('_addIfModifiedSince');
const _foldHeader = Symbol('_foldHeader');
const _finalize = Symbol('_finalize');
- const _write = Symbol('_write');
+ const _build = Symbol('_build');
const _parseCookies = Symbol('_parseCookies');
io._HttpHeaders = class _HttpHeaders extends core.Object {
new(protocolVersion, opts) {
@@ -39988,81 +40957,32 @@
[_finalize]() {
this[_mutable] = false;
}
- [_write](buffer, offset) {
- function write(bytes) {
- let len = bytes[dartx.length];
- for (let i = 0; i < dart.notNull(len); i++) {
- buffer[dartx._set](dart.notNull(offset) + i, bytes[dartx._get](i));
- }
- offset = dart.notNull(offset) + dart.notNull(len);
- }
- dart.fn(write, ListOfintTovoid());
+ [_build](builder) {
for (let name of this[_headers][dartx.keys]) {
let values = this[_headers][dartx._get](name);
let fold = core.bool._check(this[_foldHeader](name));
let nameData = name[dartx.codeUnits];
- write(nameData);
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.COLON);
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.SP);
+ builder.add(nameData);
+ builder.addByte(io._CharCode.COLON);
+ builder.addByte(io._CharCode.SP);
for (let i = 0; i < dart.notNull(values[dartx.length]); i++) {
if (i > 0) {
if (dart.test(fold)) {
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.COMMA);
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.SP);
+ builder.addByte(io._CharCode.COMMA);
+ builder.addByte(io._CharCode.SP);
} else {
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.CR);
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.LF);
- write(nameData);
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.COLON);
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.SP);
+ builder.addByte(io._CharCode.CR);
+ builder.addByte(io._CharCode.LF);
+ builder.add(nameData);
+ builder.addByte(io._CharCode.COLON);
+ builder.addByte(io._CharCode.SP);
}
}
- write(values[dartx._get](i)[dartx.codeUnits]);
+ builder.add(values[dartx._get](i)[dartx.codeUnits]);
}
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.CR);
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.LF);
+ builder.addByte(io._CharCode.CR);
+ builder.addByte(io._CharCode.LF);
}
- return offset;
}
toString() {
let sb = new core.StringBuffer();
@@ -40237,7 +41157,7 @@
[_updateHostHeader]: dart.definiteFunctionType(dart.dynamic, []),
[_foldHeader]: dart.definiteFunctionType(dart.dynamic, [core.String]),
[_finalize]: dart.definiteFunctionType(dart.void, []),
- [_write]: dart.definiteFunctionType(core.int, [typed_data.Uint8List, core.int]),
+ [_build]: dart.definiteFunctionType(dart.void, [io.BytesBuilder]),
[_parseCookies]: dart.definiteFunctionType(core.List$(io.Cookie), [])
}),
statics: () => ({
@@ -40386,7 +41306,7 @@
return;
}
let value = parseParameterValue();
- if (name == 'charset' && io._ContentType.is(this)) {
+ if (name == 'charset' && io._ContentType.is(this) && value != null) {
value = value[dartx.toLowerCase]();
}
parameters._set(name, value);
@@ -40497,7 +41417,7 @@
});
const _validate = Symbol('_validate');
const _parseSetCookieValue = Symbol('_parseSetCookieValue');
- let const$67;
+ let const$70;
io._Cookie = class _Cookie extends core.Object {
new(name, value) {
if (name === void 0) name = null;
@@ -40636,7 +41556,7 @@
return sb.toString();
}
[_validate]() {
- let SEPERATORS = const$67 || (const$67 = dart.constList(["(", ")", "<", ">", "@", ",", ";", ":", "\\", '"', "/", "[", "]", "?", "=", "{", "}"], core.String));
+ let SEPERATORS = const$70 || (const$70 = dart.constList(["(", ")", "<", ">", "@", ",", ";", ":", "\\", '"', "/", "[", "]", "?", "=", "{", "}"], core.String));
for (let i = 0; i < dart.notNull(this.name[dartx.length]); i++) {
let codeUnit = this.name[dartx.codeUnits][dartx._get](i);
if (dart.notNull(codeUnit) <= 32 || dart.notNull(codeUnit) >= 127 || dart.notNull(SEPERATORS[dartx.indexOf](this.name[dartx._get](i))) >= 0) {
@@ -40670,6 +41590,7 @@
})
});
io._OUTGOING_BUFFER_SIZE = 8 * 1024;
+ io._BytesConsumer = dart.typedef('_BytesConsumer', () => dart.functionType(dart.void, [ListOfint()]));
const _transferLength = Symbol('_transferLength');
const _dataCompleter = Symbol('_dataCompleter');
const _stream$ = Symbol('_stream');
@@ -40968,7 +41889,7 @@
let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : null;
if (dart.test(this[_incoming].upgraded)) {
this[_httpRequest][_httpClientConnection].destroy();
- return StreamSubscriptionOfListOfint()._check(async.Stream.fromIterable([]).listen(null, {onDone: onDone}));
+ return StreamOfListOfint().empty().listen(null, {onDone: onDone});
}
let stream = this[_incoming];
if (dart.test(this[_httpClient].autoUncompress) && this.headers.value(io.HttpHeaders.CONTENT_ENCODING) == "gzip") {
@@ -41090,7 +42011,7 @@
[_authenticate]: dart.definiteFunctionType(async.Future$(io.HttpClientResponse), [core.bool])
})
});
- const _uri = Symbol('_uri');
+ const _uri$ = Symbol('_uri');
const _outgoing = Symbol('_outgoing');
const _encodingSet = Symbol('_encodingSet');
const _bufferOutput = Symbol('_bufferOutput');
@@ -41318,7 +42239,7 @@
class _HttpOutboundMessage extends io._IOSinkImpl {
new(uri, protocolVersion, outgoing, opts) {
let initialHeaders = opts && 'initialHeaders' in opts ? opts.initialHeaders : null;
- this[_uri] = uri;
+ this[_uri$] = uri;
this.headers = new io._HttpHeaders(protocolVersion, {defaultPortForScheme: uri.scheme == 'https' ? io.HttpClient.DEFAULT_HTTPS_PORT : io.HttpClient.DEFAULT_HTTP_PORT, initialHeaders: initialHeaders});
this[_outgoing] = outgoing;
this[_encodingSet] = false;
@@ -41381,7 +42302,7 @@
fields: () => ({
[_encodingSet]: core.bool,
[_bufferOutput]: core.bool,
- [_uri]: core.Uri,
+ [_uri$]: core.Uri,
[_outgoing]: io._HttpOutgoing,
headers: io._HttpHeaders
}),
@@ -41478,43 +42399,18 @@
}, VoidToNull()));
}
[_writeHeader]() {
- let buffer = typed_data.Uint8List.new(io._OUTGOING_BUFFER_SIZE);
- let offset = 0;
- function write(bytes) {
- let len = bytes[dartx.length];
- for (let i = 0; i < dart.notNull(len); i++) {
- buffer[dartx._set](dart.notNull(offset) + i, bytes[dartx._get](i));
- }
- offset = dart.notNull(offset) + dart.notNull(len);
- }
- dart.fn(write, ListOfintTovoid());
+ let buffer = new io._CopyingBytesBuilder(io._OUTGOING_BUFFER_SIZE);
if (this.headers.protocolVersion == "1.1") {
- write(io._Const.HTTP11);
+ buffer.add(io._Const.HTTP11);
} else {
- write(io._Const.HTTP10);
+ buffer.add(io._Const.HTTP10);
}
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.SP);
- write(dart.toString(this.statusCode)[dartx.codeUnits]);
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.SP);
- write(this.reasonPhrase[dartx.codeUnits]);
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.CR);
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.LF);
+ buffer.addByte(io._CharCode.SP);
+ buffer.add(dart.toString(this.statusCode)[dartx.codeUnits]);
+ buffer.addByte(io._CharCode.SP);
+ buffer.add(this.reasonPhrase[dartx.codeUnits]);
+ buffer.addByte(io._CharCode.CR);
+ buffer.addByte(io._CharCode.LF);
let session = this[_httpRequest][_session];
if (session != null && !dart.test(session[_destroyed])) {
session[_isNew] = false;
@@ -41543,18 +42439,11 @@
}, CookieToNull()));
}
this.headers[_finalize]();
- offset = this.headers[_write](buffer, offset);
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.CR);
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.LF);
- this[_outgoing].setHeader(buffer, offset);
+ this.headers[_build](buffer);
+ buffer.addByte(io._CharCode.CR);
+ buffer.addByte(io._CharCode.LF);
+ let headerBytes = typed_data.Uint8List._check(buffer.takeBytes());
+ this[_outgoing].setHeader(headerBytes, headerBytes[dartx.length]);
}
[_findReasonPhrase](statusCode) {
if (this[_reasonPhrase] != null) {
@@ -41859,39 +42748,14 @@
}
}
[_writeHeader]() {
- let buffer = typed_data.Uint8List.new(io._OUTGOING_BUFFER_SIZE);
- let offset = 0;
- function write(bytes) {
- let len = bytes[dartx.length];
- for (let i = 0; i < dart.notNull(len); i++) {
- buffer[dartx._set](dart.notNull(offset) + i, bytes[dartx._get](i));
- }
- offset = dart.notNull(offset) + dart.notNull(len);
- }
- dart.fn(write, ListOfintTovoid());
- write(this.method[dartx.codeUnits]);
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.SP);
- write(this[_requestUri]()[dartx.codeUnits]);
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.SP);
- write(io._Const.HTTP11);
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.CR);
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.LF);
+ let buffer = new io._CopyingBytesBuilder(io._OUTGOING_BUFFER_SIZE);
+ buffer.add(this.method[dartx.codeUnits]);
+ buffer.addByte(io._CharCode.SP);
+ buffer.add(this[_requestUri]()[dartx.codeUnits]);
+ buffer.addByte(io._CharCode.SP);
+ buffer.add(io._Const.HTTP11);
+ buffer.addByte(io._CharCode.CR);
+ buffer.addByte(io._CharCode.LF);
if (!dart.test(this.cookies[dartx.isEmpty])) {
let sb = new core.StringBuffer();
for (let i = 0; i < dart.notNull(this.cookies[dartx.length]); i++) {
@@ -41903,18 +42767,11 @@
this.headers.add(io.HttpHeaders.COOKIE, sb.toString());
}
this.headers[_finalize]();
- offset = this.headers[_write](buffer, offset);
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.CR);
- buffer[dartx._set]((() => {
- let x = offset;
- offset = dart.notNull(x) + 1;
- return x;
- })(), io._CharCode.LF);
- this[_outgoing].setHeader(buffer, offset);
+ this.headers[_build](buffer);
+ buffer.addByte(io._CharCode.CR);
+ buffer.addByte(io._CharCode.LF);
+ let headerBytes = typed_data.Uint8List._check(buffer.takeBytes());
+ this[_outgoing].setHeader(headerBytes, headerBytes[dartx.length]);
}
};
dart.addSimpleTypeTests(io._HttpClientRequest);
@@ -41958,19 +42815,19 @@
super.new();
}
add(chunk) {
- dart.dcall(this[_consume], chunk);
+ this[_consume](chunk);
}
addSlice(chunk, start, end, isLast) {
if (typed_data.Uint8List.is(chunk)) {
- dart.dcall(this[_consume], typed_data.Uint8List.view(chunk[dartx.buffer], start, dart.notNull(end) - dart.notNull(start)));
+ this[_consume](typed_data.Uint8List.view(chunk[dartx.buffer], start, dart.notNull(end) - dart.notNull(start)));
} else {
- dart.dcall(this[_consume], chunk[dartx.sublist](start, dart.notNull(end) - dart.notNull(start)));
+ this[_consume](chunk[dartx.sublist](start, dart.notNull(end) - dart.notNull(start)));
}
}
close() {}
};
dart.setSignature(io._HttpGZipSink, {
- fields: () => ({[_consume]: core.Function}),
+ fields: () => ({[_consume]: io._BytesConsumer}),
methods: () => ({
add: dart.definiteFunctionType(dart.void, [ListOfint()]),
addSlice: dart.definiteFunctionType(dart.void, [ListOfint(), core.int, core.int, core.bool]),
@@ -41990,10 +42847,10 @@
const _addChunk$ = Symbol('_addChunk');
const _chunkHeader = Symbol('_chunkHeader');
const _ignoreError = Symbol('_ignoreError');
- let const$68;
+ let const$71;
io._HttpOutgoing = class _HttpOutgoing extends core.Object {
new(socket) {
- this[_doneCompleter] = async.Completer.new();
+ this[_doneCompleter] = CompleterOfSocket().new();
this.socket = socket;
this.ignoreBody = false;
this.headersWritten = false;
@@ -42015,16 +42872,6 @@
writeHeaders(opts) {
let drainRequest = opts && 'drainRequest' in opts ? opts.drainRequest : true;
let setOutgoing = opts && 'setOutgoing' in opts ? opts.setOutgoing : true;
- const write = (function() {
- try {
- this.outbound[_writeHeader]();
- } catch (_) {
- return async.Future.error(new io.HttpException(dart.str`Headers size exceeded the of '${io._OUTGOING_BUFFER_SIZE}'` + " bytes"));
- }
-
- return null;
- }).bind(this);
- dart.fn(write, VoidToFuture());
if (dart.test(this.headersWritten)) return null;
this.headersWritten = true;
let drainFuture = null;
@@ -42046,22 +42893,22 @@
} else {
drainRequest = false;
}
- if (dart.test(this.ignoreBody)) {
- return write();
- }
- if (dart.test(setOutgoing)) {
- let contentLength = this.outbound.headers.contentLength;
- if (dart.test(this.outbound.headers.chunkedTransferEncoding)) {
- this.chunked = true;
- if (gzip) this.gzip = true;
- } else if (dart.notNull(contentLength) >= 0) {
- this.contentLength = contentLength;
+ if (!dart.test(this.ignoreBody)) {
+ if (dart.test(setOutgoing)) {
+ let contentLength = this.outbound.headers.contentLength;
+ if (dart.test(this.outbound.headers.chunkedTransferEncoding)) {
+ this.chunked = true;
+ if (gzip) this.gzip = true;
+ } else if (dart.notNull(contentLength) >= 0) {
+ this.contentLength = contentLength;
+ }
+ }
+ if (drainFuture != null) {
+ return drainFuture.then(dart.void)(dart.fn(_ => this.outbound[_writeHeader](), dynamicTovoid$()));
}
}
- if (drainFuture != null) {
- return drainFuture.then(dart.dynamic)(dart.fn(_ => write(), dynamicToFuture()));
- }
- return write();
+ this.outbound[_writeHeader]();
+ return null;
}
addStream(stream) {
if (dart.test(this[_socketError])) {
@@ -42078,10 +42925,10 @@
return this.close();
}
let sub = null;
- let controller = async.StreamController.new({onPause: dart.fn(() => dart.dsend(sub, 'pause'), VoidTovoid$()), onResume: dart.fn(() => dart.dsend(sub, 'resume'), VoidTovoid$()), sync: true});
+ let controller = StreamControllerOfListOfint().new({onPause: dart.fn(() => sub.pause(), VoidTovoid$()), onResume: dart.fn(() => sub.resume(), VoidTovoid$()), sync: true});
const onData = (function(data) {
if (dart.test(this[_socketError])) return;
- if (dart.equals(dart.dload(data, 'length'), 0)) return;
+ if (data[dartx.length] == 0) return;
if (dart.test(this.chunked)) {
if (dart.test(this[_gzip])) {
this[_gzipAdd] = dart.bind(controller, 'add');
@@ -42089,28 +42936,28 @@
this[_gzipAdd] = null;
return;
}
- this[_addChunk$](this[_chunkHeader](core.int._check(dart.dload(data, 'length'))), dart.bind(controller, 'add'));
+ this[_addChunk$](this[_chunkHeader](data[dartx.length]), dart.bind(controller, 'add'));
this[_pendingChunkedFooter] = 2;
} else {
if (this.contentLength != null) {
- this[_bytesWritten] = dart.notNull(this[_bytesWritten]) + dart.notNull(core.num._check(dart.dload(data, 'length')));
+ this[_bytesWritten] = dart.notNull(this[_bytesWritten]) + dart.notNull(data[dartx.length]);
if (dart.notNull(this[_bytesWritten]) > dart.notNull(this.contentLength)) {
- controller.addError(new io.HttpException("Content size exceeds specified contentLength. " + dart.str`${this[_bytesWritten]} bytes written while expected ` + dart.str`${this.contentLength}. ` + dart.str`[${core.String.fromCharCodes(IterableOfint()._check(data))}]`));
+ controller.addError(new io.HttpException("Content size exceeds specified contentLength. " + dart.str`${this[_bytesWritten]} bytes written while expected ` + dart.str`${this.contentLength}. ` + dart.str`[${core.String.fromCharCodes(data)}]`));
return;
}
}
}
this[_addChunk$](data, dart.bind(controller, 'add'));
}).bind(this);
- dart.fn(onData, dynamicTovoid$());
+ dart.fn(onData, ListOfintTovoid());
sub = stream.listen(onData, {onError: dart.bind(controller, 'addError'), onDone: dart.bind(controller, 'close'), cancelOnError: true});
if (!dart.test(this.headersWritten)) {
let future = this.writeHeaders();
if (future != null) {
- dart.dsend(sub, 'pause', future);
+ sub.pause(future);
}
}
- return this.socket.addStream(StreamOfListOfint()._check(controller.stream)).then(io._HttpOutboundMessage)(dart.fn(_ => this.outbound, dynamicTo_HttpOutboundMessage()), {onError: dart.fn((error, stackTrace) => {
+ return this.socket.addStream(controller.stream).then(io._HttpOutboundMessage)(dart.fn(_ => this.outbound, dynamicTo_HttpOutboundMessage()), {onError: dart.fn((error, stackTrace) => {
if (dart.test(this[_gzip])) this[_gzipSink].close();
this[_socketError] = true;
this[_doneCompleter].completeError(error, core.StackTrace._check(stackTrace));
@@ -42130,14 +42977,14 @@
this.outbound.headers.chunkedTransferEncoding = false;
this.outbound.headers.contentLength = 0;
} else if (dart.notNull(this.outbound.headers.contentLength) > 0) {
- let error = new io.HttpException("No content even though contentLength was specified to be " + dart.str`greater than 0: ${this.outbound.headers.contentLength}.`, {uri: this.outbound[_uri]});
+ let error = new io.HttpException("No content even though contentLength was specified to be " + dart.str`greater than 0: ${this.outbound.headers.contentLength}.`, {uri: this.outbound[_uri$]});
this[_doneCompleter].completeError(error);
return this[_closeFuture] = async.Future.error(error);
}
}
if (this.contentLength != null) {
if (dart.notNull(this[_bytesWritten]) < dart.notNull(this.contentLength)) {
- let error = new io.HttpException("Content size below specified contentLength. " + dart.str` ${this[_bytesWritten]} bytes written but expected ` + dart.str`${this.contentLength}.`, {uri: this.outbound[_uri]});
+ let error = new io.HttpException("Content size below specified contentLength. " + dart.str` ${this[_bytesWritten]} bytes written but expected ` + dart.str`${this.contentLength}.`, {uri: this.outbound[_uri$]});
this[_doneCompleter].completeError(error);
return this[_closeFuture] = async.Future.error(error);
}
@@ -42183,7 +43030,6 @@
}
setHeader(data, length) {
dart.assert(this[_length$2] == 0);
- dart.assert(data[dartx.length] == io._OUTGOING_BUFFER_SIZE);
this[_buffer$] = typed_data.Uint8List._check(data);
this[_length$2] = length;
}
@@ -42194,10 +43040,10 @@
dart.assert(this[_gzipSink] == null);
this[_gzipSink] = new io.ZLibEncoder({gzip: true}).startChunkedConversion(new io._HttpGZipSink(dart.fn(data => {
if (this[_gzipAdd] == null) return;
- this[_addChunk$](this[_chunkHeader](core.int._check(dart.dload(data, 'length'))), _ChunkedConversionCallbackOfListOfint()._check(this[_gzipAdd]));
+ this[_addChunk$](this[_chunkHeader](data[dartx.length]), this[_gzipAdd]);
this[_pendingChunkedFooter] = 2;
- this[_addChunk$](data, _ChunkedConversionCallbackOfListOfint()._check(this[_gzipAdd]));
- }, dynamicToNull$())));
+ this[_addChunk$](data, this[_gzipAdd]);
+ }, ListOfintToNull())));
}
}
[_ignoreError](error) {
@@ -42205,19 +43051,19 @@
}
[_addGZipChunk](chunk, add) {
if (!dart.test(this.outbound.bufferOutput)) {
- add(ListOfint()._check(chunk));
+ add(chunk);
return;
}
- if (dart.test(dart.dsend(dart.dload(chunk, 'length'), '>', dart.notNull(this[_gzipBuffer][dartx.length]) - dart.notNull(this[_gzipBufferLength])))) {
+ if (dart.notNull(chunk[dartx.length]) > dart.notNull(this[_gzipBuffer][dartx.length]) - dart.notNull(this[_gzipBufferLength])) {
add(typed_data.Uint8List.view(this[_gzipBuffer][dartx.buffer], 0, this[_gzipBufferLength]));
this[_gzipBuffer] = typed_data.Uint8List.new(io._OUTGOING_BUFFER_SIZE);
this[_gzipBufferLength] = 0;
}
- if (dart.test(dart.dsend(dart.dload(chunk, 'length'), '>', io._OUTGOING_BUFFER_SIZE))) {
- add(ListOfint()._check(chunk));
+ if (dart.notNull(chunk[dartx.length]) > io._OUTGOING_BUFFER_SIZE) {
+ add(chunk);
} else {
- this[_gzipBuffer][dartx.setRange](this[_gzipBufferLength], dart.asInt(dart.notNull(this[_gzipBufferLength]) + dart.notNull(core.num._check(dart.dload(chunk, 'length')))), IterableOfint()._check(chunk));
- this[_gzipBufferLength] = dart.notNull(this[_gzipBufferLength]) + dart.notNull(core.num._check(dart.dload(chunk, 'length')));
+ this[_gzipBuffer][dartx.setRange](this[_gzipBufferLength], dart.notNull(this[_gzipBufferLength]) + dart.notNull(chunk[dartx.length]), chunk);
+ this[_gzipBufferLength] = dart.notNull(this[_gzipBufferLength]) + dart.notNull(chunk[dartx.length]);
}
}
[_addChunk$](chunk, add) {
@@ -42227,23 +43073,23 @@
this[_buffer$] = null;
this[_length$2] = 0;
}
- add(ListOfint()._check(chunk));
+ add(chunk);
return;
}
- if (dart.test(dart.dsend(dart.dload(chunk, 'length'), '>', dart.notNull(this[_buffer$][dartx.length]) - dart.notNull(this[_length$2])))) {
+ if (dart.notNull(chunk[dartx.length]) > dart.notNull(this[_buffer$][dartx.length]) - dart.notNull(this[_length$2])) {
add(typed_data.Uint8List.view(this[_buffer$][dartx.buffer], 0, this[_length$2]));
this[_buffer$] = typed_data.Uint8List.new(io._OUTGOING_BUFFER_SIZE);
this[_length$2] = 0;
}
- if (dart.test(dart.dsend(dart.dload(chunk, 'length'), '>', io._OUTGOING_BUFFER_SIZE))) {
- add(ListOfint()._check(chunk));
+ if (dart.notNull(chunk[dartx.length]) > io._OUTGOING_BUFFER_SIZE) {
+ add(chunk);
} else {
- this[_buffer$][dartx.setRange](this[_length$2], dart.asInt(dart.notNull(this[_length$2]) + dart.notNull(core.num._check(dart.dload(chunk, 'length')))), IterableOfint()._check(chunk));
- this[_length$2] = dart.notNull(this[_length$2]) + dart.notNull(core.num._check(dart.dload(chunk, 'length')));
+ this[_buffer$][dartx.setRange](this[_length$2], dart.notNull(this[_length$2]) + dart.notNull(chunk[dartx.length]), chunk);
+ this[_length$2] = dart.notNull(this[_length$2]) + dart.notNull(chunk[dartx.length]);
}
}
[_chunkHeader](length) {
- let hexDigits = const$68 || (const$68 = dart.constList([48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70], core.int));
+ let hexDigits = const$71 || (const$71 = dart.constList([48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70], core.int));
if (length == 0) {
if (this[_pendingChunkedFooter] == 2) return io._HttpOutgoing._footerAndChunk0Length;
return io._HttpOutgoing._chunk0Length;
@@ -42272,7 +43118,7 @@
io._HttpOutgoing[dart.implements] = () => [StreamConsumerOfListOfint()];
dart.setSignature(io._HttpOutgoing, {
fields: () => ({
- [_doneCompleter]: async.Completer,
+ [_doneCompleter]: CompleterOfSocket(),
socket: io.Socket,
ignoreBody: core.bool,
headersWritten: core.bool,
@@ -42285,13 +43131,13 @@
[_bytesWritten]: core.int,
[_gzip]: core.bool,
[_gzipSink]: convert.ByteConversionSink,
- [_gzipAdd]: core.Function,
+ [_gzipAdd]: io._BytesConsumer,
[_gzipBuffer]: typed_data.Uint8List,
[_gzipBufferLength]: core.int,
[_socketError]: core.bool,
outbound: io._HttpOutboundMessage
}),
- getters: () => ({done: dart.definiteFunctionType(async.Future, [])}),
+ getters: () => ({done: dart.definiteFunctionType(async.Future$(io.Socket), [])}),
setters: () => ({gzip: dart.definiteFunctionType(dart.void, [core.bool])}),
methods: () => ({
writeHeaders: dart.definiteFunctionType(async.Future, [], {drainRequest: core.bool, setOutgoing: core.bool}),
@@ -42299,8 +43145,8 @@
close: dart.definiteFunctionType(async.Future, []),
setHeader: dart.definiteFunctionType(dart.void, [ListOfint(), core.int]),
[_ignoreError]: dart.definiteFunctionType(core.bool, [dart.dynamic]),
- [_addGZipChunk]: dart.definiteFunctionType(dart.void, [dart.dynamic, _ChunkedConversionCallbackOfListOfint()]),
- [_addChunk$]: dart.definiteFunctionType(dart.void, [dart.dynamic, _ChunkedConversionCallbackOfListOfint()]),
+ [_addGZipChunk]: dart.definiteFunctionType(dart.void, [ListOfint(), _ChunkedConversionCallbackOfListOfint()]),
+ [_addChunk$]: dart.definiteFunctionType(dart.void, [ListOfint(), _ChunkedConversionCallbackOfListOfint()]),
[_chunkHeader]: dart.definiteFunctionType(core.List$(core.int), [core.int])
})
});
@@ -42408,7 +43254,7 @@
}
}
this[_httpParser].isHead = method == "HEAD";
- this[_streamFuture] = outgoing.done.then(dart.dynamic)(dart.fn(s => {
+ this[_streamFuture] = outgoing.done.then(io.Socket)(dart.fn(s => {
this[_nextResponseCompleter] = CompleterOf_HttpIncoming().new();
this[_nextResponseCompleter].future.then(dart.dynamic)(dart.fn(incoming => {
this[_currentUri] = null;
@@ -42451,13 +43297,13 @@
}, dynamicAnddynamicToNull()));
this[_subscription$].resume();
return s;
- }, dynamicTodynamic$()), {onError: dart.fn(e => {
+ }, SocketToSocket()), {onError: dart.fn(e => {
this.destroy();
}, dynamicToNull$())});
return request;
}
detachSocket() {
- return this[_streamFuture].then(io._DetachedSocket)(dart.fn(_ => new io._DetachedSocket(this[_socket], this[_httpParser].detachIncoming()), dynamicTo_DetachedSocket()));
+ return this[_streamFuture].then(io._DetachedSocket)(dart.fn(_ => new io._DetachedSocket(this[_socket], this[_httpParser].detachIncoming()), SocketTo_DetachedSocket()));
}
destroy() {
this.closed = true;
@@ -42467,12 +43313,12 @@
close() {
this.closed = true;
this[_httpClient][_connectionClosed](this);
- this[_streamFuture].then(dart.void)(dart.fn(_ => this[_socket].destroy(), dynamicTovoid$()));
+ this[_streamFuture].then(dart.void)(dart.fn(_ => this[_socket].destroy(), SocketTovoid()));
}
createProxyTunnel(host, port, proxy, callback) {
- let request = this.send(core.Uri.new({host: core.String._check(host), port: core.int._check(port)}), core.int._check(port), "CONNECT", io._Proxy._check(proxy));
- if (dart.test(dart.dload(proxy, 'isAuthenticated'))) {
- let auth = io._CryptoUtils.bytesToBase64(convert.UTF8.encode(dart.str`${dart.dload(proxy, 'username')}:${dart.dload(proxy, 'password')}`));
+ let request = this.send(core.Uri.new({host: host, port: port}), port, "CONNECT", proxy);
+ if (dart.test(proxy.isAuthenticated)) {
+ let auth = io._CryptoUtils.bytesToBase64(convert.UTF8.encode(dart.str`${proxy.username}:${proxy.password}`));
request.headers.set(io.HttpHeaders.PROXY_AUTHORIZATION, dart.str`Basic ${auth}`);
}
return request.close().then(io.SecureSocket)(dart.fn(response => {
@@ -42480,9 +43326,9 @@
dart.throw("Proxy failed to establish tunnel " + dart.str`(${response.statusCode} ${response.reasonPhrase})`);
}
let socket = io._HttpClientResponse.as(response)[_httpRequest][_httpClientConnection][_socket];
- return io.SecureSocket.secure(socket, {host: host, context: this[_context], onBadCertificate: X509CertificateTobool()._check(callback)});
+ return io.SecureSocket.secure(socket, {host: host, context: this[_context], onBadCertificate: callback});
}, HttpClientResponseToFutureOfSecureSocket())).then(io._HttpClientConnection)(dart.fn(secureSocket => {
- let key = core.String._check(io._HttpClientConnection.makeKey(true, core.String._check(host), core.int._check(port)));
+ let key = core.String._check(io._HttpClientConnection.makeKey(true, host, port));
return new io._HttpClientConnection(key, secureSocket, request[_httpClient], true);
}, SecureSocketTo_HttpClientConnection()));
}
@@ -42520,7 +43366,7 @@
closed: core.bool,
[_currentUri]: core.Uri,
[_nextResponseCompleter]: CompleterOf_HttpIncoming(),
- [_streamFuture]: async.Future
+ [_streamFuture]: FutureOfSocket()
}),
getters: () => ({connectionInfo: dart.definiteFunctionType(io.HttpConnectionInfo, [])}),
methods: () => ({
@@ -42528,7 +43374,7 @@
detachSocket: dart.definiteFunctionType(async.Future$(io.Socket), []),
destroy: dart.definiteFunctionType(dart.void, []),
close: dart.definiteFunctionType(dart.void, []),
- createProxyTunnel: dart.definiteFunctionType(async.Future$(io._HttpClientConnection), [dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic]),
+ createProxyTunnel: dart.definiteFunctionType(async.Future$(io._HttpClientConnection), [core.String, core.int, io._Proxy, X509CertificateTobool()]),
stopTimer: dart.definiteFunctionType(dart.void, []),
startTimer: dart.definiteFunctionType(dart.void, [])
}),
@@ -42622,11 +43468,11 @@
return FutureOf_ConnectionInfo().value(new io._ConnectionInfo(connection, proxy));
}
if (client.maxConnectionsPerHost != null && dart.notNull(this[_active].length) + dart.notNull(this[_connecting]) >= dart.notNull(client.maxConnectionsPerHost)) {
- let completer = async.Completer.new();
+ let completer = CompleterOf_ConnectionInfo().new();
this[_pending$].add(dart.fn(() => {
- this.connect(uriHost, uriPort, proxy, client).then(dart.void)(dart.bind(completer, 'complete'), {onError: dart.bind(completer, 'completeError')});
+ completer.complete(this.connect(uriHost, uriPort, proxy, client));
}, VoidToNull()));
- return FutureOf_ConnectionInfo()._check(completer.future);
+ return completer.future;
}
let currentBadCertificateCallback = client[_badCertificateCallback];
function callback(certificate) {
@@ -42686,7 +43532,7 @@
});
io.BadCertificateCallback = dart.typedef('BadCertificateCallback', () => dart.functionType(core.bool, [io.X509Certificate, core.String, core.int]));
const _idleTimeout = Symbol('_idleTimeout');
- let const$69;
+ let const$72;
const _connectionTargets = Symbol('_connectionTargets');
const _credentials = Symbol('_credentials');
const _closing = Symbol('_closing');
@@ -42694,7 +43540,7 @@
const _findProxy = Symbol('_findProxy');
const _openUrl = Symbol('_openUrl');
const _closeConnections = Symbol('_closeConnections');
- let const$70;
+ let const$73;
const _getConnection = Symbol('_getConnection');
io._HttpClient = class _HttpClient extends core.Object {
get idleTimeout() {
@@ -42711,7 +43557,7 @@
this[_authenticate] = null;
this[_authenticateProxy] = null;
this[_findProxy] = io.HttpClient.findProxyFromEnvironment;
- this[_idleTimeout] = const$69 || (const$69 = dart.const(new core.Duration({seconds: 15})));
+ this[_idleTimeout] = const$72 || (const$72 = dart.const(new core.Duration({seconds: 15})));
this[_badCertificateCallback] = null;
this.maxConnectionsPerHost = null;
this.autoUncompress = true;
@@ -42829,7 +43675,7 @@
if (port == 0) {
port = isSecure ? io.HttpClient.DEFAULT_HTTPS_PORT : io.HttpClient.DEFAULT_HTTP_PORT;
}
- let proxyConf = const$70 || (const$70 = dart.const(new io._ProxyConfiguration.direct()));
+ let proxyConf = const$73 || (const$73 = dart.const(new io._ProxyConfiguration.direct()));
if (this[_findProxy] != null) {
try {
proxyConf = new io._ProxyConfiguration(core.String._check(dart.dcall(this[_findProxy], uri)));
@@ -43125,7 +43971,7 @@
}
io._HttpConnection._connections[dartx._set](this[_serviceId], this);
- this[_httpParser].listenToStream(StreamOfListOfint()._check(this[_socket]));
+ this[_httpParser].listenToStream(io.Socket.as(this[_socket]));
this[_subscription$] = this[_httpParser].listen(dart.fn(incoming => {
this[_httpServer][_markActive](this);
incoming.dataDone.then(dart.dynamic)(dart.fn(closing => {
@@ -43147,7 +43993,7 @@
} else {
this.destroy();
}
- }, dynamicToNull$()), {onError: dart.fn(_ => {
+ }, SocketToNull()), {onError: dart.fn(_ => {
this.destroy();
}, dynamicToNull$())});
outgoing.ignoreBody = request.method == "HEAD";
@@ -43178,7 +44024,7 @@
let detachedIncoming = this[_httpParser].detachIncoming();
return this[_streamFuture].then(io._DetachedSocket)(dart.fn(_ => {
io._HttpConnection._connections[dartx.remove](this[_serviceId]);
- return new io._DetachedSocket(this[_socket], detachedIncoming);
+ return new io._DetachedSocket(io.Socket._check(this[_socket]), detachedIncoming);
}, dynamicTo_DetachedSocket()));
}
get connectionInfo() {
@@ -43288,8 +44134,8 @@
const _idleConnections = Symbol('_idleConnections');
const _serverSocket = Symbol('_serverSocket');
const _closeServer = Symbol('_closeServer');
- let const$71;
- let const$72;
+ let const$74;
+ let const$75;
io._HttpServer = class _HttpServer extends dart.mixin(async.Stream$(io.HttpRequest), io._ServiceObject) {
static bind(address, port, backlog, v6Only, shared) {
return io.ServerSocket.bind(address, port, {backlog: backlog, v6Only: v6Only, shared: shared}).then(io._HttpServer)(dart.fn(socket => new io._HttpServer._(socket, true), ServerSocketTo_HttpServer()));
@@ -43312,7 +44158,7 @@
this[_controller$0] = null;
super.new();
this[_controller$0] = StreamControllerOfHttpRequest().new({sync: true, onCancel: dart.bind(this, 'close')});
- this.idleTimeout = const$71 || (const$71 = dart.const(new core.Duration({seconds: 120})));
+ this.idleTimeout = const$74 || (const$74 = dart.const(new core.Duration({seconds: 120})));
io._HttpServer._servers[dartx._set](this[_serviceId], this);
dart.dput(this[_serverSocket], _owner, this);
}
@@ -43331,7 +44177,7 @@
this[_controller$0] = null;
super.new();
this[_controller$0] = StreamControllerOfHttpRequest().new({sync: true, onCancel: dart.bind(this, 'close')});
- this.idleTimeout = const$72 || (const$72 = dart.const(new core.Duration({seconds: 120})));
+ this.idleTimeout = const$75 || (const$75 = dart.const(new core.Duration({seconds: 120})));
io._HttpServer._servers[dartx._set](this[_serviceId], this);
try {
dart.dput(this[_serverSocket], _owner, this);
@@ -43575,8 +44421,8 @@
}),
getters: () => ({isAuthenticated: dart.definiteFunctionType(core.bool, [])})
});
- let const$73;
- let const$74;
+ let const$76;
+ let const$77;
io._ProxyConfiguration = class _ProxyConfiguration extends core.Object {
new(configuration) {
this.proxies = ListOf_Proxy().new();
@@ -43631,7 +44477,7 @@
}, StringToNull()));
}
direct() {
- this.proxies = const$74 || (const$74 = dart.constList([const$73 || (const$73 = dart.const(new io._Proxy.direct()))], io._Proxy));
+ this.proxies = const$77 || (const$77 = dart.constList([const$76 || (const$76 = dart.const(new io._Proxy.direct()))], io._Proxy));
}
};
dart.defineNamedConstructor(io._ProxyConfiguration, 'direct');
@@ -43683,61 +44529,61 @@
return this[_incoming].listen(onData, {onError: onError, onDone: onDone, cancelOnError: cancelOnError});
}
get encoding() {
- return convert.Encoding._check(dart.dload(this[_socket], 'encoding'));
+ return this[_socket].encoding;
}
set encoding(value) {
- dart.dput(this[_socket], 'encoding', value);
+ this[_socket].encoding = value;
}
write(obj) {
- dart.dsend(this[_socket], 'write', obj);
+ this[_socket].write(obj);
}
writeln(obj) {
if (obj === void 0) obj = "";
- dart.dsend(this[_socket], 'writeln', obj);
+ this[_socket].writeln(obj);
}
writeCharCode(charCode) {
- dart.dsend(this[_socket], 'writeCharCode', charCode);
+ this[_socket].writeCharCode(charCode);
}
writeAll(objects, separator) {
if (separator === void 0) separator = "";
- dart.dsend(this[_socket], 'writeAll', objects, separator);
+ this[_socket].writeAll(objects, separator);
}
add(bytes) {
- dart.dsend(this[_socket], 'add', bytes);
+ this[_socket].add(bytes);
}
addError(error, stackTrace) {
if (stackTrace === void 0) stackTrace = null;
- return dart.dsend(this[_socket], 'addError', error, stackTrace);
+ return this[_socket].addError(error, stackTrace);
}
addStream(stream) {
- return FutureOfSocket()._check(dart.dsend(this[_socket], 'addStream', stream));
+ return this[_socket].addStream(stream);
}
destroy() {
- dart.dsend(this[_socket], 'destroy');
+ this[_socket].destroy();
}
flush() {
- return async.Future._check(dart.dsend(this[_socket], 'flush'));
+ return this[_socket].flush();
}
close() {
- return async.Future._check(dart.dsend(this[_socket], 'close'));
+ return this[_socket].close();
}
get done() {
- return FutureOfSocket()._check(dart.dload(this[_socket], 'done'));
+ return this[_socket].done;
}
get port() {
- return core.int._check(dart.dload(this[_socket], 'port'));
+ return this[_socket].port;
}
get address() {
- return io.InternetAddress._check(dart.dload(this[_socket], 'address'));
+ return this[_socket].address;
}
get remoteAddress() {
- return io.InternetAddress._check(dart.dload(this[_socket], 'remoteAddress'));
+ return this[_socket].remoteAddress;
}
get remotePort() {
- return core.int._check(dart.dload(this[_socket], 'remotePort'));
+ return this[_socket].remotePort;
}
setOption(option, enabled) {
- return core.bool._check(dart.dsend(this[_socket], 'setOption', option, enabled));
+ return this[_socket].setOption(option, enabled);
}
[_toJSON$](ref) {
return core.Map._check(dart.dsend(this[_socket], _toJSON$, ref));
@@ -43751,7 +44597,7 @@
dart.setSignature(io._DetachedSocket, {
fields: () => ({
[_incoming]: StreamOfListOfint(),
- [_socket]: dart.dynamic
+ [_socket]: io.Socket
}),
getters: () => ({
encoding: dart.definiteFunctionType(convert.Encoding, []),
@@ -43773,10 +44619,10 @@
writeAll: dart.definiteFunctionType(dart.void, [core.Iterable], [core.String]),
add: dart.definiteFunctionType(dart.void, [ListOfint()]),
addError: dart.definiteFunctionType(dart.void, [dart.dynamic], [core.StackTrace]),
- addStream: dart.definiteFunctionType(async.Future$(io.Socket), [StreamOfListOfint()]),
+ addStream: dart.definiteFunctionType(async.Future, [StreamOfListOfint()]),
destroy: dart.definiteFunctionType(dart.void, []),
flush: dart.definiteFunctionType(async.Future, []),
- close: dart.definiteFunctionType(async.Future, []),
+ close: dart.definiteFunctionType(async.Future$(io.Socket), []),
setOption: dart.definiteFunctionType(core.bool, [io.SocketOption, core.bool]),
[_toJSON$]: dart.definiteFunctionType(core.Map, [core.bool])
})
@@ -44217,23 +45063,21 @@
this.subscription.onError(onError);
this.subscription.onDone(onDone);
if (this.bufferedData == null) {
- return StreamSubscriptionOfListOfint()._check(((() => {
- this.subscription.resume();
- return this.subscription;
- })()));
+ this.subscription.resume();
+ return this.subscription;
}
- let _ = new io._HttpDetachedStreamSubscription(StreamSubscriptionOfListOfint()._check(this.subscription), this.bufferedData, onData);
+ let _ = new io._HttpDetachedStreamSubscription(this.subscription, this.bufferedData, onData);
_.resume();
return _;
} else {
- return StreamOfint().fromIterable(this.bufferedData).listen(onData, {onError: onError, onDone: onDone, cancelOnError: cancelOnError});
+ return StreamOfListOfint().fromIterable(JSArrayOfListOfint().of([this.bufferedData])).listen(onData, {onError: onError, onDone: onDone, cancelOnError: cancelOnError});
}
}
};
dart.addSimpleTypeTests(io._HttpDetachedIncoming);
dart.setSignature(io._HttpDetachedIncoming, {
fields: () => ({
- subscription: async.StreamSubscription,
+ subscription: StreamSubscriptionOfListOfint(),
bufferedData: ListOfint()
}),
methods: () => ({listen: dart.definiteFunctionType(async.StreamSubscription$(core.List$(core.int)), [_ChunkedConversionCallbackOfListOfint()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool})})
@@ -44244,7 +45088,7 @@
const _headerValue = Symbol('_headerValue');
const _requestParser = Symbol('_requestParser');
const _parserCalled = Symbol('_parserCalled');
- const _index$2 = Symbol('_index');
+ const _index$1 = Symbol('_index');
const _httpVersionIndex = Symbol('_httpVersionIndex');
const _messageType = Symbol('_messageType');
const _statusCodeLength = Symbol('_statusCodeLength');
@@ -44285,7 +45129,7 @@
this[_requestParser] = requestParser;
this[_parserCalled] = false;
this[_buffer$] = null;
- this[_index$2] = null;
+ this[_index$1] = null;
this[_state$1] = null;
this[_httpVersionIndex] = null;
this[_messageType] = null;
@@ -44397,14 +45241,14 @@
if (this[_state$1] == io._State.FAILURE) {
dart.throw(new io.HttpException("Data on failed connection"));
}
- while (this[_buffer$] != null && dart.notNull(this[_index$2]) < dart.notNull(this[_buffer$][dartx.length]) && this[_state$1] != io._State.FAILURE && this[_state$1] != io._State.UPGRADED) {
+ while (this[_buffer$] != null && dart.notNull(this[_index$1]) < dart.notNull(this[_buffer$][dartx.length]) && this[_state$1] != io._State.FAILURE && this[_state$1] != io._State.UPGRADED) {
if (this[_incoming] != null && dart.test(this[_bodyPaused]) || this[_incoming] == null && dart.test(this[_paused])) {
this[_parserCalled] = false;
return;
}
let byte = this[_buffer$][dartx._get]((() => {
- let x = this[_index$2];
- this[_index$2] = dart.notNull(x) + 1;
+ let x = this[_index$1];
+ this[_index$1] = dart.notNull(x) + 1;
return x;
})());
switch (this[_state$1]) {
@@ -44585,7 +45429,7 @@
this[_state$1] = io._State.HEADER_ENDING;
} else if (byte == io._CharCode.LF) {
this[_state$1] = io._State.HEADER_ENDING;
- this[_index$2] = dart.notNull(this[_index$2]) - 1;
+ this[_index$1] = dart.notNull(this[_index$1]) - 1;
} else {
this[_headerField][dartx.add](io._HttpParser._toLowerCaseByte(byte));
this[_state$1] = io._State.HEADER_FIELD;
@@ -44660,7 +45504,7 @@
this[_state$1] = io._State.HEADER_ENDING;
} else if (byte == io._CharCode.LF) {
this[_state$1] = io._State.HEADER_ENDING;
- this[_index$2] = dart.notNull(this[_index$2]) - 1;
+ this[_index$1] = dart.notNull(this[_index$1]) - 1;
} else {
this[_headerField][dartx.add](io._HttpParser._toLowerCaseByte(byte));
this[_state$1] = io._State.HEADER_FIELD;
@@ -44734,17 +45578,17 @@
}
case io._State.BODY:
{
- this[_index$2] = dart.notNull(this[_index$2]) - 1;
- let dataAvailable = dart.notNull(this[_buffer$][dartx.length]) - dart.notNull(this[_index$2]);
+ this[_index$1] = dart.notNull(this[_index$1]) - 1;
+ let dataAvailable = dart.notNull(this[_buffer$][dartx.length]) - dart.notNull(this[_index$1]);
if (dart.notNull(this[_remainingContent]) >= 0 && dart.notNull(dataAvailable) > dart.notNull(this[_remainingContent])) {
dataAvailable = this[_remainingContent];
}
- let data = typed_data.Uint8List.view(this[_buffer$][dartx.buffer], dart.notNull(this[_buffer$][dartx.offsetInBytes]) + dart.notNull(this[_index$2]), dataAvailable);
+ let data = typed_data.Uint8List.view(this[_buffer$][dartx.buffer], dart.notNull(this[_buffer$][dartx.offsetInBytes]) + dart.notNull(this[_index$1]), dataAvailable);
this[_bodyController].add(data);
if (this[_remainingContent] != -1) {
this[_remainingContent] = dart.notNull(this[_remainingContent]) - dart.notNull(data[dartx.length]);
}
- this[_index$2] = dart.notNull(this[_index$2]) + dart.notNull(data[dartx.length]);
+ this[_index$1] = dart.notNull(this[_index$1]) + dart.notNull(data[dartx.length]);
if (this[_remainingContent] == 0) {
if (!dart.test(this[_chunked])) {
this[_reset]();
@@ -44768,7 +45612,7 @@
}
}
this[_parserCalled] = false;
- if (this[_buffer$] != null && this[_index$2] == this[_buffer$][dartx.length]) {
+ if (this[_buffer$] != null && this[_index$1] == this[_buffer$][dartx.length]) {
this[_releaseBuffer]();
if (this[_state$1] != io._State.UPGRADED && this[_state$1] != io._State.FAILURE) {
this[_socketSubscription].resume();
@@ -44779,7 +45623,7 @@
this[_socketSubscription].pause();
dart.assert(this[_buffer$] == null);
this[_buffer$] = typed_data.Uint8List._check(buffer);
- this[_index$2] = 0;
+ this[_index$1] = 0;
this[_parse]();
}
[_onDone$]() {
@@ -44852,8 +45696,8 @@
}
readUnparsedData() {
if (this[_buffer$] == null) return null;
- if (this[_index$2] == this[_buffer$][dartx.length]) return null;
- let result = this[_buffer$][dartx.sublist](this[_index$2]);
+ if (this[_index$1] == this[_buffer$][dartx.length]) return null;
+ let result = this[_buffer$][dartx.sublist](this[_index$1]);
this[_releaseBuffer]();
return result;
}
@@ -44878,7 +45722,7 @@
}
[_releaseBuffer]() {
this[_buffer$] = null;
- this[_index$2] = null;
+ this[_index$1] = null;
}
static _isTokenChar(byte) {
return dart.notNull(byte) > 31 && dart.notNull(byte) < 128 && !dart.test(io._Const.SEPARATOR_MAP[dartx._get](byte));
@@ -44998,7 +45842,7 @@
fields: () => ({
[_parserCalled]: core.bool,
[_buffer$]: typed_data.Uint8List,
- [_index$2]: core.int,
+ [_index$1]: core.int,
[_requestParser]: core.bool,
[_state$1]: core.int,
[_httpVersionIndex]: core.int,
@@ -45018,7 +45862,7 @@
[_remainingContent]: core.int,
[_headers]: io._HttpHeaders,
[_incoming]: io._HttpIncoming,
- [_socketSubscription]: async.StreamSubscription,
+ [_socketSubscription]: StreamSubscriptionOfListOfint(),
[_paused]: core.bool,
[_bodyPaused]: core.bool,
[_controller$0]: StreamControllerOf_HttpIncoming(),
@@ -45061,7 +45905,7 @@
names: ['_isTokenChar', '_isValueChar', '_tokenizeFieldValue', '_toLowerCaseByte']
});
io._DART_SESSION_ID = "DARTSESSID";
- const _data$ = Symbol('_data');
+ const _data$0 = Symbol('_data');
const _lastSeen = Symbol('_lastSeen');
const _timeoutCallback = Symbol('_timeoutCallback');
const _prev = Symbol('_prev');
@@ -45071,7 +45915,7 @@
const _bumpToEnd = Symbol('_bumpToEnd');
io._HttpSession = class _HttpSession extends core.Object {
new(sessionManager, id) {
- this[_data$] = collection.HashMap.new();
+ this[_data$0] = collection.HashMap.new();
this[_sessionManager] = sessionManager;
this.id = id;
this[_lastSeen] = new core.DateTime.now();
@@ -45100,50 +45944,50 @@
this[_timeoutCallback] = callback;
}
containsValue(value) {
- return this[_data$][dartx.containsValue](value);
+ return this[_data$0][dartx.containsValue](value);
}
containsKey(key) {
- return this[_data$][dartx.containsKey](key);
+ return this[_data$0][dartx.containsKey](key);
}
_get(key) {
- return this[_data$][dartx._get](key);
+ return this[_data$0][dartx._get](key);
}
_set(key, value) {
- this[_data$][dartx._set](key, value);
+ this[_data$0][dartx._set](key, value);
return value;
}
putIfAbsent(key, ifAbsent) {
- return this[_data$][dartx.putIfAbsent](key, ifAbsent);
+ return this[_data$0][dartx.putIfAbsent](key, ifAbsent);
}
addAll(other) {
- return this[_data$][dartx.addAll](other);
+ return this[_data$0][dartx.addAll](other);
}
remove(key) {
- return this[_data$][dartx.remove](key);
+ return this[_data$0][dartx.remove](key);
}
clear() {
- this[_data$][dartx.clear]();
+ this[_data$0][dartx.clear]();
}
forEach(f) {
- this[_data$][dartx.forEach](f);
+ this[_data$0][dartx.forEach](f);
}
get keys() {
- return this[_data$][dartx.keys];
+ return this[_data$0][dartx.keys];
}
get values() {
- return this[_data$][dartx.values];
+ return this[_data$0][dartx.values];
}
get length() {
- return this[_data$][dartx.length];
+ return this[_data$0][dartx.length];
}
get isEmpty() {
- return this[_data$][dartx.isEmpty];
+ return this[_data$0][dartx.isEmpty];
}
get isNotEmpty() {
- return this[_data$][dartx.isNotEmpty];
+ return this[_data$0][dartx.isNotEmpty];
}
toString() {
- return dart.str`HttpSession id:${this.id} ${this[_data$]}`;
+ return dart.str`HttpSession id:${this.id} ${this[_data$0]}`;
}
};
io._HttpSession[dart.implements] = () => [io.HttpSession];
@@ -45157,7 +46001,7 @@
[_prev]: io._HttpSession,
[_next$1]: io._HttpSession,
id: core.String,
- [_data$]: core.Map
+ [_data$0]: core.Map
}),
getters: () => ({
lastSeen: dart.definiteFunctionType(core.DateTime, []),
@@ -45328,7 +46172,7 @@
this.id = io._IOResourceInfo.getNextID();
}
get referenceValueMap() {
- return dart.map({type: dart.str`@${this.type}`, id: this.id, name: this.name}, core.String, core.String);
+ return dart.map({type: dart.str`@${this.type}`, id: this.id, name: this.name}, core.String, core.Object);
}
static getNextID() {
return (() => {
@@ -45343,7 +46187,7 @@
type: core.String,
id: core.int
}),
- getters: () => ({referenceValueMap: dart.definiteFunctionType(core.Map$(core.String, core.String), [])}),
+ getters: () => ({referenceValueMap: dart.definiteFunctionType(core.Map$(core.String, dart.dynamic), [])}),
statics: () => ({getNextID: dart.definiteFunctionType(core.int, [])}),
names: ['getNextID']
});
@@ -45384,7 +46228,7 @@
super.new(type);
}
get fullValueMap() {
- return dart.map({type: this.type, id: this.id, name: this.name, totalRead: this.totalRead, totalWritten: this.totalWritten, readCount: this.readCount, writeCount: this.writeCount, lastRead: this.lastRead, lastWrite: this.lastWrite}, core.String, core.String);
+ return dart.map({type: this.type, id: this.id, name: this.name, totalRead: this.totalRead, totalWritten: this.totalWritten, readCount: this.readCount, writeCount: this.writeCount, lastRead: this.lastRead, lastWrite: this.lastWrite}, core.String, core.Object);
}
};
dart.setSignature(io._ReadWriteResourceInfo, {
@@ -45396,7 +46240,7 @@
lastRead: core.double,
lastWrite: core.double
}),
- getters: () => ({fullValueMap: dart.definiteFunctionType(core.Map$(core.String, core.String), [])}),
+ getters: () => ({fullValueMap: dart.definiteFunctionType(core.Map$(core.String, dart.dynamic), [])}),
methods: () => ({
addRead: dart.definiteFunctionType(dart.void, [core.int]),
didRead: dart.definiteFunctionType(dart.void, []),
@@ -45418,7 +46262,7 @@
io._FileResourceInfo.openFiles[dartx.remove](info.id);
}
static getOpenFilesList() {
- return ListOfMapOfString$String().from(io._FileResourceInfo.openFiles[dartx.values][dartx.map](MapOfString$String())(dart.fn(e => e.referenceValueMap, _FileResourceInfoToMapOfString$String())));
+ return ListOfMapOfString$String().from(io._FileResourceInfo.openFiles[dartx.values][dartx.map](MapOfString$dynamic())(dart.fn(e => e.referenceValueMap, _FileResourceInfoToMapOfString$dynamic())));
}
static getOpenFiles(func, params) {
dart.assert(dart.equals(func, 'ext.dart.io.getOpenFiles'));
@@ -45427,8 +46271,7 @@
return FutureOfServiceExtensionResponse().value(new developer.ServiceExtensionResponse.result(json));
}
getFileInfoMap() {
- let result = this.fullValueMap;
- return result;
+ return this.fullValueMap;
}
static getFileInfoMapByID(func, params) {
dart.assert(dart.dsend(params, 'containsKey', 'id'));
@@ -45444,7 +46287,7 @@
dart.setSignature(io._FileResourceInfo, {
fields: () => ({file: dart.dynamic}),
getters: () => ({name: dart.definiteFunctionType(core.String, [])}),
- methods: () => ({getFileInfoMap: dart.definiteFunctionType(core.Map$(core.String, core.String), [])}),
+ methods: () => ({getFileInfoMap: dart.definiteFunctionType(core.Map$(core.String, dart.dynamic), [])}),
statics: () => ({
FileOpened: dart.definiteFunctionType(dart.dynamic, [io._FileResourceInfo]),
FileClosed: dart.definiteFunctionType(dart.dynamic, [io._FileResourceInfo]),
@@ -45471,13 +46314,13 @@
io._ProcessResourceInfo.ProcessStarted(this);
}
get name() {
- return core.String._check(dart.dload(this.process, _path$));
+ return core.String._check(dart.dload(this.process, _path));
}
stopped() {
io._ProcessResourceInfo.ProcessStopped(this);
}
get fullValueMap() {
- return dart.map({type: this.type, id: this.id, name: this.name, pid: core.String._check(dart.dload(this.process, 'pid')), startedAt: this.startedAt, arguments: core.String._check(dart.dload(this.process, _arguments$0)), workingDirectory: core.String._check(dart.dload(this.process, _workingDirectory) == null ? '.' : dart.dload(this.process, _workingDirectory))}, core.String, core.String);
+ return dart.map({type: this.type, id: this.id, name: this.name, pid: dart.dload(this.process, 'pid'), startedAt: this.startedAt, arguments: dart.dload(this.process, _arguments$0), workingDirectory: dart.dload(this.process, _workingDirectory) == null ? '.' : dart.dload(this.process, _workingDirectory)}, core.String, core.Object);
}
static ProcessStarted(info) {
dart.assert(!dart.test(io._ProcessResourceInfo.startedProcesses[dartx.containsKey](info.id)));
@@ -45488,7 +46331,7 @@
io._ProcessResourceInfo.startedProcesses[dartx.remove](info.id);
}
static getStartedProcessesList() {
- return ListOfMapOfString$String().from(io._ProcessResourceInfo.startedProcesses[dartx.values][dartx.map](MapOfString$String())(dart.fn(e => e.referenceValueMap, _ProcessResourceInfoToMapOfString$String())));
+ return ListOfMapOfString$String().from(io._ProcessResourceInfo.startedProcesses[dartx.values][dartx.map](MapOfString$dynamic())(dart.fn(e => e.referenceValueMap, _ProcessResourceInfoToMapOfString$dynamic())));
}
static getStartedProcesses(func, params) {
dart.assert(func == 'ext.dart.io.getProcesses');
@@ -45510,7 +46353,7 @@
}),
getters: () => ({
name: dart.definiteFunctionType(core.String, []),
- fullValueMap: dart.definiteFunctionType(core.Map$(core.String, core.String), [])
+ fullValueMap: dart.definiteFunctionType(core.Map$(core.String, dart.dynamic), [])
}),
methods: () => ({stopped: dart.definiteFunctionType(dart.void, [])}),
statics: () => ({
@@ -45550,18 +46393,18 @@
return dart.str`${dart.dload(dart.dload(this.socket, 'address'), 'host')}:${dart.dload(this.socket, 'port')}${remote}`;
}
static getOpenSocketsList() {
- return ListOfMapOfString$String().from(io._SocketResourceInfo.openSockets[dartx.values][dartx.map](MapOfString$String())(dart.fn(e => e.referenceValueMap, _SocketResourceInfoToMapOfString$String())));
+ return ListOfMapOfString$String().from(io._SocketResourceInfo.openSockets[dartx.values][dartx.map](MapOfString$dynamic())(dart.fn(e => e.referenceValueMap, _SocketResourceInfoToMapOfString$dynamic())));
}
getSocketInfoMap() {
let result = this.fullValueMap;
result[dartx._set]('socketType', dart.test(dart.dload(this.socket, 'isTcp')) ? io._SocketResourceInfo.TCP_STRING : io._SocketResourceInfo.UDP_STRING);
- result[dartx._set]('listening', core.String._check(dart.dload(this.socket, 'isListening')));
- result[dartx._set]('host', core.String._check(dart.dload(dart.dload(this.socket, 'address'), 'host')));
- result[dartx._set]('port', core.String._check(dart.dload(this.socket, 'port')));
+ result[dartx._set]('listening', dart.dload(this.socket, 'isListening'));
+ result[dartx._set]('host', dart.dload(dart.dload(this.socket, 'address'), 'host'));
+ result[dartx._set]('port', dart.dload(this.socket, 'port'));
if (!dart.test(dart.dload(this.socket, 'isListening'))) {
try {
- result[dartx._set]('remoteHost', core.String._check(dart.dload(dart.dload(this.socket, 'remoteAddress'), 'host')));
- result[dartx._set]('remotePort', core.String._check(dart.dload(this.socket, 'remotePort')));
+ result[dartx._set]('remoteHost', dart.dload(dart.dload(this.socket, 'remoteAddress'), 'host'));
+ result[dartx._set]('remotePort', dart.dload(this.socket, 'remotePort'));
} catch (e) {
result[dartx._set]('remotePort', 'NA');
result[dartx._set]('remoteHost', 'NA');
@@ -45571,7 +46414,7 @@
result[dartx._set]('remotePort', 'NA');
result[dartx._set]('remoteHost', 'NA');
}
- result[dartx._set]('addressType', core.String._check(dart.dload(dart.dload(dart.dload(this.socket, 'address'), 'type'), 'name')));
+ result[dartx._set]('addressType', dart.dload(dart.dload(dart.dload(this.socket, 'address'), 'type'), 'name'));
return result;
}
static getSocketInfoMapByID(func, params) {
@@ -45599,7 +46442,7 @@
dart.setSignature(io._SocketResourceInfo, {
fields: () => ({socket: dart.dynamic}),
getters: () => ({name: dart.definiteFunctionType(core.String, [])}),
- methods: () => ({getSocketInfoMap: dart.definiteFunctionType(core.Map$(core.String, core.String), [])}),
+ methods: () => ({getSocketInfoMap: dart.definiteFunctionType(core.Map$(core.String, dart.dynamic), [])}),
statics: () => ({
getOpenSocketsList: dart.definiteFunctionType(core.Iterable$(core.Map$(core.String, core.String)), []),
getSocketInfoMapByID: dart.definiteFunctionType(async.Future$(developer.ServiceExtensionResponse), [core.String, MapOfString$String()]),
@@ -45641,33 +46484,36 @@
io._FILE_TRUNCATE = 10;
io._FILE_LENGTH = 11;
io._FILE_LENGTH_FROM_PATH = 12;
- io._FILE_LAST_MODIFIED = 13;
- io._FILE_FLUSH = 14;
- io._FILE_READ_BYTE = 15;
- io._FILE_WRITE_BYTE = 16;
- io._FILE_READ = 17;
- io._FILE_READ_INTO = 18;
- io._FILE_WRITE_FROM = 19;
- io._FILE_CREATE_LINK = 20;
- io._FILE_DELETE_LINK = 21;
- io._FILE_RENAME_LINK = 22;
- io._FILE_LINK_TARGET = 23;
- io._FILE_TYPE = 24;
- io._FILE_IDENTICAL = 25;
- io._FILE_STAT = 26;
- io._FILE_LOCK = 27;
- io._SOCKET_LOOKUP = 28;
- io._SOCKET_LIST_INTERFACES = 29;
- io._SOCKET_REVERSE_LOOKUP = 30;
- io._DIRECTORY_CREATE = 31;
- io._DIRECTORY_DELETE = 32;
- io._DIRECTORY_EXISTS = 33;
- io._DIRECTORY_CREATE_TEMP = 34;
- io._DIRECTORY_LIST_START = 35;
- io._DIRECTORY_LIST_NEXT = 36;
- io._DIRECTORY_LIST_STOP = 37;
- io._DIRECTORY_RENAME = 38;
- io._SSL_PROCESS_FILTER = 39;
+ io._FILE_LAST_ACCESSED = 13;
+ io._FILE_SET_LAST_ACCESSED = 14;
+ io._FILE_LAST_MODIFIED = 15;
+ io._FILE_SET_LAST_MODIFIED = 16;
+ io._FILE_FLUSH = 17;
+ io._FILE_READ_BYTE = 18;
+ io._FILE_WRITE_BYTE = 19;
+ io._FILE_READ = 20;
+ io._FILE_READ_INTO = 21;
+ io._FILE_WRITE_FROM = 22;
+ io._FILE_CREATE_LINK = 23;
+ io._FILE_DELETE_LINK = 24;
+ io._FILE_RENAME_LINK = 25;
+ io._FILE_LINK_TARGET = 26;
+ io._FILE_TYPE = 27;
+ io._FILE_IDENTICAL = 28;
+ io._FILE_STAT = 29;
+ io._FILE_LOCK = 30;
+ io._SOCKET_LOOKUP = 31;
+ io._SOCKET_LIST_INTERFACES = 32;
+ io._SOCKET_REVERSE_LOOKUP = 33;
+ io._DIRECTORY_CREATE = 34;
+ io._DIRECTORY_DELETE = 35;
+ io._DIRECTORY_EXISTS = 36;
+ io._DIRECTORY_CREATE_TEMP = 37;
+ io._DIRECTORY_LIST_START = 38;
+ io._DIRECTORY_LIST_NEXT = 39;
+ io._DIRECTORY_LIST_STOP = 40;
+ io._DIRECTORY_RENAME = 41;
+ io._SSL_PROCESS_FILTER = 42;
io._IOService = class _IOService extends core.Object {
static _dispatch(request, data) {
dart.throw(new core.UnsupportedError("_IOService._dispatch"));
@@ -45707,12 +46553,6 @@
get absolute() {
return io.Link.new(this[_absolutePath]);
}
- stat() {
- return io.FileStat.stat(this.path);
- }
- statSync() {
- return io.FileStat.statSync(this.path);
- }
create(target, opts) {
let recursive = opts && 'recursive' in opts ? opts.recursive : false;
if (dart.test(io.Platform.isWindows)) {
@@ -45836,8 +46676,6 @@
methods: () => ({
exists: dart.definiteFunctionType(async.Future$(core.bool), []),
existsSync: dart.definiteFunctionType(core.bool, []),
- stat: dart.definiteFunctionType(async.Future$(io.FileStat), []),
- statSync: dart.definiteFunctionType(io.FileStat, []),
create: dart.definiteFunctionType(async.Future$(io.Link), [core.String], {recursive: core.bool}),
createSync: dart.definiteFunctionType(dart.void, [core.String], {recursive: core.bool}),
[_makeWindowsLinkTarget]: dart.definiteFunctionType(core.String, [core.String]),
@@ -45923,6 +46761,9 @@
},
get isIOS() {
return io.Platform._operatingSystem == "ios";
+ },
+ get isFuchsia() {
+ return io.Platform._operatingSystem == "fuchsia";
}
});
io._Platform = class _Platform extends core.Object {
@@ -45984,14 +46825,17 @@
let env = io._Platform._environment();
if (!io.OSError.is(env)) {
let isWindows = io._Platform.operatingSystem == 'windows';
- let result = isWindows ? new io._CaseInsensitiveStringMap() : core.Map.new();
+ let result = isWindows ? new (_CaseInsensitiveStringMapOfString())() : MapOfString$String().new();
for (let str of core.Iterable._check(env)) {
+ if (str == null) {
+ continue;
+ }
let equalsIndex = dart.dsend(str, 'indexOf', '=');
if (dart.test(dart.dsend(equalsIndex, '>', 0))) {
- result[dartx._set](dart.dsend(str, 'substring', 0, equalsIndex), dart.dsend(str, 'substring', dart.dsend(equalsIndex, '+', 1)));
+ result[dartx._set](core.String._check(dart.dsend(str, 'substring', 0, equalsIndex)), core.String._check(dart.dsend(str, 'substring', dart.dsend(equalsIndex, '+', 1))));
}
}
- io._Platform._environmentCache = new (UnmodifiableMapViewOfString$String())(MapOfString$String()._check(result));
+ io._Platform._environmentCache = new (UnmodifiableMapViewOfString$String())(result);
} else {
io._Platform._environmentCache = env;
}
@@ -45999,7 +46843,7 @@
if (io.OSError.is(io._Platform._environmentCache)) {
dart.throw(io._Platform._environmentCache);
} else {
- return MapOfString$String()._check(io._Platform._environmentCache);
+ return MapOfString$String().as(io._Platform._environmentCache);
}
}
static get version() {
@@ -46047,6 +46891,7 @@
let MapOfString$V = () => (MapOfString$V = dart.constFn(core.Map$(core.String, V)))();
let VoidToV = () => (VoidToV = dart.constFn(dart.functionType(V, [])))();
let StringAndVTovoid = () => (StringAndVTovoid = dart.constFn(dart.functionType(dart.void, [core.String, V])))();
+ let StringAndVToV = () => (StringAndVToV = dart.constFn(dart.definiteFunctionType(V, [core.String, V])))();
class _CaseInsensitiveStringMap extends core.Object {
new() {
this[_map$1] = MapOfString$V().new();
@@ -46070,7 +46915,8 @@
return this[_map$1][dartx.putIfAbsent](key[dartx.toUpperCase](), ifAbsent);
}
addAll(other) {
- other[dartx.forEach](dart.fn((key, value) => this._set(core.String._check(dart.dsend(key, 'toUpperCase')), V._check(value)), dynamicAnddynamicTovoid$()));
+ MapOfString$V()._check(other);
+ other[dartx.forEach](dart.fn((key, value) => this._set(key[dartx.toUpperCase](), value), StringAndVToV()));
}
remove(key) {
return typeof key == 'string' ? this[_map$1][dartx.remove](key[dartx.toUpperCase]()) : null;
@@ -46117,7 +46963,7 @@
_get: dart.definiteFunctionType(V, [core.Object]),
_set: dart.definiteFunctionType(dart.void, [core.String, V]),
putIfAbsent: dart.definiteFunctionType(V, [core.String, VoidToV()]),
- addAll: dart.definiteFunctionType(dart.void, [core.Map]),
+ addAll: dart.definiteFunctionType(dart.void, [MapOfString$V()]),
remove: dart.definiteFunctionType(V, [core.Object]),
clear: dart.definiteFunctionType(dart.void, []),
forEach: dart.definiteFunctionType(dart.void, [StringAndVTovoid()])
@@ -46225,9 +47071,6 @@
'DETACHED_WITH_STDIO'
]);
io.Process = class Process extends core.Object {
- new() {
- this.exitCode = null;
- }
static start(executable, arguments$, opts) {
let workingDirectory = opts && 'workingDirectory' in opts ? opts.workingDirectory : null;
let environment = opts && 'environment' in opts ? opts.environment : null;
@@ -46260,7 +47103,6 @@
}
};
dart.setSignature(io.Process, {
- fields: () => ({exitCode: FutureOfint()}),
statics: () => ({
start: dart.definiteFunctionType(async.Future$(io.Process), [core.String, ListOfString()], {workingDirectory: core.String, environment: MapOfString$String(), includeParentEnvironment: core.bool, runInShell: core.bool, mode: io.ProcessStartMode}),
run: dart.definiteFunctionType(async.Future$(io.ProcessResult), [core.String, ListOfString()], {workingDirectory: core.String, environment: MapOfString$String(), includeParentEnvironment: core.bool, runInShell: core.bool, stdoutEncoding: convert.Encoding, stderrEncoding: convert.Encoding}),
@@ -46456,22 +47298,14 @@
let host = opts && 'host' in opts ? opts.host : null;
let context = opts && 'context' in opts ? opts.context : null;
let onBadCertificate = opts && 'onBadCertificate' in opts ? opts.onBadCertificate : null;
- let completer = async.Completer.new();
- dart.dsend(dart.dsend(dart.dsend(socket, _detachRaw), 'then', dart.fn(detachedRaw => io.RawSecureSocket.secure(io.RawSocket._check(dart.dindex(detachedRaw, 0)), {subscription: async.StreamSubscription._check(dart.dindex(detachedRaw, 1)), host: host, context: context, onBadCertificate: onBadCertificate}), dynamicToFutureOfRawSecureSocket())), 'then', dart.fn(raw => {
- completer.complete(io.SecureSocket._(io.RawSecureSocket._check(raw)));
- }, dynamicToNull$()));
- return FutureOfSecureSocket()._check(completer.future);
+ return async.Future.as(dart.dsend(socket, _detachRaw)).then(io.RawSecureSocket)(dart.fn(detachedRaw => io.RawSecureSocket.secure(io.RawSocket.as(dart.dindex(detachedRaw, 0)), {subscription: StreamSubscriptionOfRawSocketEvent().as(dart.dindex(detachedRaw, 1)), host: host, context: context, onBadCertificate: onBadCertificate}), dynamicToFutureOfRawSecureSocket())).then(io.SecureSocket)(dart.fn(raw => io.SecureSocket._(raw), RawSecureSocketToSecureSocket()));
}
static secureServer(socket, context, opts) {
let bufferedData = opts && 'bufferedData' in opts ? opts.bufferedData : null;
let requestClientCertificate = opts && 'requestClientCertificate' in opts ? opts.requestClientCertificate : false;
let requireClientCertificate = opts && 'requireClientCertificate' in opts ? opts.requireClientCertificate : false;
let supportedProtocols = opts && 'supportedProtocols' in opts ? opts.supportedProtocols : null;
- let completer = async.Completer.new();
- dart.dsend(dart.dsend(dart.dsend(socket, _detachRaw), 'then', dart.fn(detachedRaw => io.RawSecureSocket.secureServer(io.RawSocket._check(dart.dindex(detachedRaw, 0)), context, {subscription: async.StreamSubscription._check(dart.dindex(detachedRaw, 1)), bufferedData: bufferedData, requestClientCertificate: requestClientCertificate, requireClientCertificate: requireClientCertificate, supportedProtocols: supportedProtocols}), dynamicToFutureOfRawSecureSocket())), 'then', dart.fn(raw => {
- completer.complete(io.SecureSocket._(io.RawSecureSocket._check(raw)));
- }, dynamicToNull$()));
- return FutureOfSecureSocket()._check(completer.future);
+ return async.Future.as(dart.dsend(socket, _detachRaw)).then(io.RawSecureSocket)(dart.fn(detachedRaw => io.RawSecureSocket.secureServer(io.RawSocket.as(dart.dindex(detachedRaw, 0)), context, {subscription: StreamSubscriptionOfRawSocketEvent().as(dart.dindex(detachedRaw, 1)), bufferedData: bufferedData, requestClientCertificate: requestClientCertificate, requireClientCertificate: requireClientCertificate, supportedProtocols: supportedProtocols}), dynamicToFutureOfRawSecureSocket())).then(io.SecureSocket)(dart.fn(raw => io.SecureSocket._(raw), RawSecureSocketToSecureSocket()));
}
};
io.SecureSocket[dart.implements] = () => [io.Socket];
@@ -46567,8 +47401,8 @@
dart.setSignature(io.RawSecureSocket, {
statics: () => ({
connect: dart.definiteFunctionType(async.Future$(io.RawSecureSocket), [dart.dynamic, core.int], {context: io.SecurityContext, onBadCertificate: X509CertificateTobool(), supportedProtocols: ListOfString()}),
- secure: dart.definiteFunctionType(async.Future$(io.RawSecureSocket), [io.RawSocket], {subscription: async.StreamSubscription, host: dart.dynamic, context: io.SecurityContext, onBadCertificate: X509CertificateTobool(), supportedProtocols: ListOfString()}),
- secureServer: dart.definiteFunctionType(async.Future$(io.RawSecureSocket), [io.RawSocket, io.SecurityContext], {subscription: async.StreamSubscription, bufferedData: ListOfint(), requestClientCertificate: core.bool, requireClientCertificate: core.bool, supportedProtocols: ListOfString()})
+ secure: dart.definiteFunctionType(async.Future$(io.RawSecureSocket), [io.RawSocket], {subscription: StreamSubscriptionOfRawSocketEvent(), host: dart.dynamic, context: io.SecurityContext, onBadCertificate: X509CertificateTobool(), supportedProtocols: ListOfString()}),
+ secureServer: dart.definiteFunctionType(async.Future$(io.RawSecureSocket), [io.RawSocket, io.SecurityContext], {subscription: StreamSubscriptionOfRawSocketEvent(), bufferedData: ListOfint(), requestClientCertificate: core.bool, requireClientCertificate: core.bool, supportedProtocols: ListOfString()})
}),
names: ['connect', 'secure', 'secureServer']
});
@@ -46739,13 +47573,13 @@
const _pushAllFilterStages = Symbol('_pushAllFilterStages');
const _readSocketOrBufferedData = Symbol('_readSocketOrBufferedData');
const _sendReadEvent = Symbol('_sendReadEvent');
- let const$75;
+ let const$78;
io.RawSocketEvent = class RawSocketEvent extends core.Object {
_(value) {
this[_value$1] = value;
}
toString() {
- return (const$75 || (const$75 = dart.constList(['RawSocketEvent:READ', 'RawSocketEvent:WRITE', 'RawSocketEvent:READ_CLOSED', 'RawSocketEvent:CLOSED'], core.String)))[dartx._get](this[_value$1]);
+ return (const$78 || (const$78 = dart.constList(['RawSocketEvent:READ', 'RawSocketEvent:WRITE', 'RawSocketEvent:READ_CLOSED', 'RawSocketEvent:CLOSED'], core.String)))[dartx._get](this[_value$1]);
}
};
dart.defineNamedConstructor(io.RawSocketEvent, '_');
@@ -46786,12 +47620,12 @@
if (host != null) {
address = io.InternetAddress._cloneWithNewHost(address, core.String._check(host));
}
- return new io._RawSecureSocket(address, requestedPort, is_server, context, socket, StreamSubscriptionOfRawSocketEvent()._check(subscription), bufferedData, requestClientCertificate, requireClientCertificate, onBadCertificate, supportedProtocols)[_handshakeComplete].future;
+ return new io._RawSecureSocket(address, requestedPort, is_server, context, socket, subscription, bufferedData, requestClientCertificate, requireClientCertificate, onBadCertificate, supportedProtocols)[_handshakeComplete].future;
}
new(address, requestedPort, is_server, context, socket, socketSubscription, bufferedData, requestClientCertificate, requireClientCertificate, onBadCertificate, supportedProtocols) {
this[_handshakeComplete] = CompleterOf_RawSecureSocket().new();
this[_status] = io._RawSecureSocket.HANDSHAKE;
- this[_closeCompleter] = async.Completer.new();
+ this[_closeCompleter] = CompleterOfRawSecureSocket().new();
this[_filterStatus] = new io._FilterStatus();
this[_secureFilter] = io._SecureFilter.new();
this.address = address;
@@ -46901,7 +47735,7 @@
}
close() {
this.shutdown(io.SocketDirection.BOTH);
- return FutureOfRawSecureSocket()._check(this[_closeCompleter].future);
+ return this[_closeCompleter].future;
}
[_completeCloseCompleter](dummy) {
if (dummy === void 0) dummy = null;
@@ -47347,7 +48181,7 @@
[_socketClosedWrite]: core.bool,
[_closedRead]: core.bool,
[_closedWrite]: core.bool,
- [_closeCompleter]: async.Completer,
+ [_closeCompleter]: CompleterOfRawSecureSocket(),
[_filterStatus]: io._FilterStatus,
[_connectPending]: core.bool,
[_filterPending]: core.bool,
@@ -47373,7 +48207,7 @@
listen: dart.definiteFunctionType(async.StreamSubscription$(io.RawSocketEvent), [RawSocketEventTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool}),
available: dart.definiteFunctionType(core.int, []),
close: dart.definiteFunctionType(async.Future$(io.RawSecureSocket), []),
- [_completeCloseCompleter]: dart.definiteFunctionType(dart.void, [], [dart.dynamic]),
+ [_completeCloseCompleter]: dart.definiteFunctionType(dart.void, [], [io.RawSocket]),
[_close$0]: dart.definiteFunctionType(dart.void, []),
shutdown: dart.definiteFunctionType(dart.void, [io.SocketDirection]),
read: dart.definiteFunctionType(core.List$(core.int), [], [core.int]),
@@ -47403,7 +48237,7 @@
}),
statics: () => ({
_isBufferEncrypted: dart.definiteFunctionType(core.bool, [core.int]),
- connect: dart.definiteFunctionType(async.Future$(io._RawSecureSocket), [dart.dynamic, core.int], {is_server: core.bool, context: io.SecurityContext, socket: io.RawSocket, subscription: async.StreamSubscription, bufferedData: ListOfint(), requestClientCertificate: core.bool, requireClientCertificate: core.bool, onBadCertificate: X509CertificateTobool(), supportedProtocols: ListOfString()}),
+ connect: dart.definiteFunctionType(async.Future$(io._RawSecureSocket), [dart.dynamic, core.int], {is_server: core.bool, context: io.SecurityContext, socket: io.RawSocket, subscription: StreamSubscriptionOfRawSocketEvent(), bufferedData: ListOfint(), requestClientCertificate: core.bool, requireClientCertificate: core.bool, onBadCertificate: X509CertificateTobool(), supportedProtocols: ListOfString()}),
_verifyFields: dart.definiteFunctionType(dart.void, [dart.dynamic, core.int, core.bool, core.bool, core.bool, core.Function])
}),
names: ['_isBufferEncrypted', 'connect', '_verifyFields']
@@ -47509,7 +48343,7 @@
while (true) {
let toWrite = this.linearLength;
if (toWrite == 0) return false;
- let bytes = socket.write(ListOfint()._check(this.data), this.start, toWrite);
+ let bytes = socket.write(this.data, this.start, toWrite);
this.advanceStart(bytes);
if (dart.notNull(bytes) < dart.notNull(toWrite)) {
return true;
@@ -47519,7 +48353,7 @@
};
dart.setSignature(io._ExternalBuffer, {
fields: () => ({
- data: core.List,
+ data: ListOfint(),
start: core.int,
end: core.int,
size: dart.dynamic
@@ -47983,7 +48817,7 @@
let retainNewlines = opts && 'retainNewlines' in opts ? opts.retainNewlines : false;
let CR = 13;
let LF = 10;
- let line = [];
+ let line = JSArrayOfint().of([]);
let crIsNewline = dart.test(io.Platform.isWindows) && dart.equals(io.stdioType(io.stdin), io.StdioType.TERMINAL) && !dart.test(/* Unimplemented unknown name */lineMode);
if (dart.test(retainNewlines)) {
let byte = null;
@@ -48026,7 +48860,7 @@
line[dartx.add](byte);
}
}
- return encoding.decode(ListOfint()._check(line));
+ return encoding.decode(line);
}
set echoMode(enabled) {
dart.throw(new core.UnsupportedError("Stdin.echoMode"));
@@ -48063,9 +48897,11 @@
const _hasTerminal = Symbol('_hasTerminal');
const _terminalColumns = Symbol('_terminalColumns');
const _terminalLines = Symbol('_terminalLines');
- io._StdSink = class _StdSink extends core.Object {
- new(sink) {
+ const _isTranslatable = Symbol('_isTranslatable');
+ io._StdSinkHelper = class _StdSinkHelper extends core.Object {
+ new(sink, isTranslatable) {
this[_sink$0] = sink;
+ this[_isTranslatable] = isTranslatable;
}
get encoding() {
return this[_sink$0].encoding;
@@ -48073,18 +48909,29 @@
set encoding(encoding) {
this[_sink$0].encoding = encoding;
}
+ set [_translation](t) {
+ if (dart.test(this[_isTranslatable])) {
+ let sink = io._IOSinkImpl._check(this[_sink$0]);
+ let target = io._StdConsumer._check(sink[_target$]);
+ dart.dput(target[_file], 'translation', t);
+ }
+ }
write(object) {
+ this[_translation] = io._FileTranslation.text;
this[_sink$0].write(object);
}
writeln(object) {
if (object === void 0) object = "";
+ this[_translation] = io._FileTranslation.text;
this[_sink$0].writeln(object);
}
writeAll(objects, sep) {
if (sep === void 0) sep = "";
+ this[_translation] = io._FileTranslation.text;
this[_sink$0].writeAll(objects, sep);
}
add(data) {
+ this[_translation] = io._FileTranslation.binary;
this[_sink$0].add(data);
}
addError(error, stackTrace) {
@@ -48092,9 +48939,11 @@
this[_sink$0].addError(error, stackTrace);
}
writeCharCode(charCode) {
+ this[_translation] = io._FileTranslation.text;
this[_sink$0].writeCharCode(charCode);
}
addStream(stream) {
+ this[_translation] = io._FileTranslation.binary;
return this[_sink$0].addStream(stream);
}
flush() {
@@ -48107,14 +48956,20 @@
return this[_sink$0].done;
}
};
- io._StdSink[dart.implements] = () => [io.IOSink];
- dart.setSignature(io._StdSink, {
- fields: () => ({[_sink$0]: io.IOSink}),
+ io._StdSinkHelper[dart.implements] = () => [io.IOSink];
+ dart.setSignature(io._StdSinkHelper, {
+ fields: () => ({
+ [_sink$0]: io.IOSink,
+ [_isTranslatable]: core.bool
+ }),
getters: () => ({
encoding: dart.definiteFunctionType(convert.Encoding, []),
done: dart.definiteFunctionType(async.Future, [])
}),
- setters: () => ({encoding: dart.definiteFunctionType(dart.void, [convert.Encoding])}),
+ setters: () => ({
+ encoding: dart.definiteFunctionType(dart.void, [convert.Encoding]),
+ [_translation]: dart.definiteFunctionType(dart.void, [io._FileTranslation])
+ }),
methods: () => ({
write: dart.definiteFunctionType(dart.void, [core.Object]),
writeln: dart.definiteFunctionType(dart.void, [], [core.Object]),
@@ -48127,7 +48982,12 @@
close: dart.definiteFunctionType(async.Future, [])
})
});
- io.Stdout = class Stdout extends io._StdSink {
+ io._StdFileSink = class _StdFileSink extends io._StdSinkHelper {
+ new(sink) {
+ super.new(sink, true);
+ }
+ };
+ io.Stdout = class Stdout extends io._StdFileSink {
_(sink, fd) {
this[_fd] = fd;
this[_nonBlocking] = null;
@@ -48194,6 +49054,23 @@
osError: io.OSError
})
});
+ io.StdinException = class StdinException extends core.Object {
+ new(message, osError) {
+ if (osError === void 0) osError = null;
+ this.message = message;
+ this.osError = osError;
+ }
+ toString() {
+ return dart.str`StdinException: ${this.message}${this.osError == null ? "" : dart.str`, ${this.osError}`}`;
+ }
+ };
+ io.StdinException[dart.implements] = () => [io.IOException];
+ dart.setSignature(io.StdinException, {
+ fields: () => ({
+ message: core.String,
+ osError: io.OSError
+ })
+ });
io._StdConsumer = class _StdConsumer extends core.Object {
new(fd) {
this[_file] = io._File._openStdioSync(fd);
@@ -48226,6 +49103,11 @@
close: dart.definiteFunctionType(async.Future, [])
})
});
+ io._StdSocketSink = class _StdSocketSink extends io._StdSinkHelper {
+ new(sink) {
+ super.new(sink, false);
+ }
+ };
io.StdioType = class StdioType extends core.Object {
_(name) {
this.name = name;
@@ -48354,10 +49236,10 @@
}),
names: ['_getStdioOutputStream', '_getStdioInputStream', '_socketType', '_getStdioHandleType']
});
- let const$76;
- let const$77;
- let const$78;
let const$79;
+ let const$80;
+ let const$81;
+ let const$82;
io.SystemEncoding = class SystemEncoding extends convert.Encoding {
new() {
super.new();
@@ -48373,16 +49255,16 @@
}
get encoder() {
if (io.Platform.operatingSystem == "windows") {
- return const$76 || (const$76 = dart.const(new io._WindowsCodePageEncoder()));
+ return const$79 || (const$79 = dart.const(new io._WindowsCodePageEncoder()));
} else {
- return const$77 || (const$77 = dart.const(new convert.Utf8Encoder()));
+ return const$80 || (const$80 = dart.const(new convert.Utf8Encoder()));
}
}
get decoder() {
if (io.Platform.operatingSystem == "windows") {
- return const$78 || (const$78 = dart.const(new io._WindowsCodePageDecoder()));
+ return const$81 || (const$81 = dart.const(new io._WindowsCodePageDecoder()));
} else {
- return const$79 || (const$79 = dart.const(new convert.Utf8Decoder()));
+ return const$82 || (const$82 = dart.const(new convert.Utf8Decoder()));
}
}
};
@@ -48413,6 +49295,7 @@
}
};
dart.addSimpleTypeTests(io._WindowsCodePageEncoder);
+ io._WindowsCodePageEncoder[dart.implements] = () => [ChunkedConverterOfString$ListOfint$String$ListOfint()];
dart.setSignature(io._WindowsCodePageEncoder, {
methods: () => ({
convert: dart.definiteFunctionType(core.List$(core.int), [core.String]),
@@ -48465,6 +49348,7 @@
}
};
dart.addSimpleTypeTests(io._WindowsCodePageDecoder);
+ io._WindowsCodePageDecoder[dart.implements] = () => [ChunkedConverterOfListOfint$String$ListOfint$String()];
dart.setSignature(io._WindowsCodePageDecoder, {
methods: () => ({
convert: dart.definiteFunctionType(core.String, [ListOfint()]),
@@ -48693,6 +49577,14 @@
io._WebSocketOpcode.RESERVED_D = 13;
io._WebSocketOpcode.RESERVED_E = 14;
io._WebSocketOpcode.RESERVED_F = 15;
+ io._EncodedString = class _EncodedString extends core.Object {
+ new(bytes) {
+ this.bytes = bytes;
+ }
+ };
+ dart.setSignature(io._EncodedString, {
+ fields: () => ({bytes: ListOfint()})
+ });
io._CompressionMaxWindowBits = class _CompressionMaxWindowBits extends core.Object {
new(headerValue, maxWindowBits) {
if (headerValue === void 0) headerValue = null;
@@ -49032,7 +49924,7 @@
this[_unmaskingIndex] = 0;
}
};
- io._WebSocketProtocolTransformer[dart.implements] = () => [StreamTransformerOfListOfint$dynamic(), EventSinkOfUint8List()];
+ io._WebSocketProtocolTransformer[dart.implements] = () => [EventSinkOfListOfint(), StreamTransformerOfListOfint$dynamic()];
dart.setSignature(io._WebSocketProtocolTransformer, {
fields: () => ({
[_state$1]: core.int,
@@ -49055,7 +49947,7 @@
[_deflate]: io._WebSocketPerMessageDeflate
}),
methods: () => ({
- bind: dart.definiteFunctionType(async.Stream, [async.Stream]),
+ bind: dart.definiteFunctionType(async.Stream, [StreamOfListOfint()]),
addError: dart.definiteFunctionType(dart.void, [core.Object], [core.StackTrace]),
close: dart.definiteFunctionType(dart.void, []),
add: dart.definiteFunctionType(dart.void, [ListOfint()]),
@@ -49099,6 +49991,7 @@
dart.setSignature(io._WebSocketPong, {
fields: () => ({payload: ListOfint()})
});
+ io._ProtocolSelector = dart.typedef('_ProtocolSelector', () => dart.functionType(dart.dynamic, [ListOfString()]));
const _protocolSelector = Symbol('_protocolSelector');
const _compression = Symbol('_compression');
io._WebSocketTransformerImpl = class _WebSocketTransformerImpl extends core.Object {
@@ -49136,24 +50029,24 @@
}
let deflate = io._WebSocketTransformerImpl._negotiateCompression(request, response, compression);
response.headers.contentLength = 0;
- return response.detachSocket().then(io._WebSocketImpl)(dart.fn(socket => new io._WebSocketImpl._fromSocket(socket, protocol, compression, true, deflate), SocketTo_WebSocketImpl()));
+ return response.detachSocket().then(io.WebSocket)(dart.fn(socket => new io._WebSocketImpl._fromSocket(socket, protocol, compression, true, deflate), SocketTo_WebSocketImpl()));
}
- dart.fn(upgrade, StringToFuture());
+ dart.fn(upgrade, StringToFutureOfWebSocket());
let protocols = request.headers._get('Sec-WebSocket-Protocol');
if (protocols != null && _protocolSelector != null) {
protocols = io._HttpParser._tokenizeFieldValue(protocols[dartx.join](', '));
- return async.Future.new(dart.fn(() => dart.dcall(_protocolSelector, protocols), VoidTodynamic$())).then(dart.dynamic)(dart.fn(protocol => {
- if (dart.notNull(protocols[dartx.indexOf](core.String._check(protocol))) < 0) {
+ return FutureOfString().new(dart.fn(() => _protocolSelector(protocols), VoidTodynamic$())).then(core.String)(dart.fn(protocol => {
+ if (dart.notNull(protocols[dartx.indexOf](protocol)) < 0) {
dart.throw(new io.WebSocketException("Selected protocol is not in the list of available protocols"));
}
return protocol;
- }, dynamicTodynamic$())).catchError(dart.fn(error => {
+ }, StringToString$())).catchError(dart.fn(error => {
response.statusCode = io.HttpStatus.INTERNAL_SERVER_ERROR;
response.close();
dart.throw(error);
}, dynamicToNull$())).then(io.WebSocket)(upgrade);
} else {
- return FutureOfWebSocket()._check(upgrade(null));
+ return upgrade(null);
}
}
static _negotiateCompression(request, response, compression) {
@@ -49202,12 +50095,12 @@
dart.setSignature(io._WebSocketTransformerImpl, {
fields: () => ({
[_controller$0]: StreamControllerOfWebSocket(),
- [_protocolSelector]: core.Function,
+ [_protocolSelector]: io._ProtocolSelector,
[_compression]: io.CompressionOptions
}),
methods: () => ({bind: dart.definiteFunctionType(async.Stream$(io.WebSocket), [StreamOfHttpRequest()])}),
statics: () => ({
- _upgrade: dart.definiteFunctionType(async.Future$(io.WebSocket), [io.HttpRequest, dart.dynamic, io.CompressionOptions]),
+ _upgrade: dart.definiteFunctionType(async.Future$(io.WebSocket), [io.HttpRequest, io._ProtocolSelector, io.CompressionOptions]),
_negotiateCompression: dart.definiteFunctionType(io._WebSocketPerMessageDeflate, [io.HttpRequest, io.HttpResponse, io.CompressionOptions]),
_isUpgradeRequest: dart.definiteFunctionType(core.bool, [io.HttpRequest])
}),
@@ -49215,7 +50108,7 @@
});
const _ensureDecoder = Symbol('_ensureDecoder');
const _ensureEncoder = Symbol('_ensureEncoder');
- let const$80;
+ let const$83;
io._WebSocketPerMessageDeflate = class _WebSocketPerMessageDeflate extends core.Object {
new(opts) {
let clientMaxWindowBits = opts && 'clientMaxWindowBits' in opts ? opts.clientMaxWindowBits : io._WebSocketImpl.DEFAULT_WINDOW_BITS;
@@ -49243,25 +50136,24 @@
}
processIncomingMessage(msg) {
this[_ensureDecoder]();
- let data = [];
+ let data = JSArrayOfint().of([]);
data[dartx.addAll](msg);
- data[dartx.addAll](const$80 || (const$80 = dart.constList([0, 0, 255, 255], core.int)));
- this.decoder.process(ListOfint()._check(data), 0, data[dartx.length]);
- let result = [];
+ data[dartx.addAll](const$83 || (const$83 = dart.constList([0, 0, 255, 255], core.int)));
+ this.decoder.process(data, 0, data[dartx.length]);
+ let result = JSArrayOfint().of([]);
let out = null;
while ((out = this.decoder.processed()) != null) {
- result[dartx.addAll](core.Iterable._check(out));
+ result[dartx.addAll](out);
}
if (dart.test(this.serverSide) && dart.test(this.clientNoContextTakeover) || !dart.test(this.serverSide) && dart.test(this.serverNoContextTakeover)) {
this.decoder = null;
}
- return typed_data.Uint8List.fromList(ListOfint()._check(result));
+ return typed_data.Uint8List.fromList(result);
}
processOutgoingMessage(msg) {
this[_ensureEncoder]();
- let result = [];
+ let result = JSArrayOfint().of([]);
let buffer = null;
- let out = null;
if (!typed_data.Uint8List.is(msg)) {
for (let i = 0; i < dart.notNull(msg[dartx.length]); i++) {
if (dart.notNull(msg[dartx._get](i)) < 0 || 255 < dart.notNull(msg[dartx._get](i))) {
@@ -49273,8 +50165,9 @@
buffer = typed_data.Uint8List._check(msg);
}
this.encoder.process(buffer, 0, buffer[dartx.length]);
+ let out = null;
while ((out = this.encoder.processed()) != null) {
- result[dartx.addAll](core.Iterable._check(out));
+ result[dartx.addAll](out);
}
if (!dart.test(this.serverSide) && dart.test(this.clientNoContextTakeover) || dart.test(this.serverSide) && dart.test(this.serverNoContextTakeover)) {
this.encoder = null;
@@ -49282,7 +50175,7 @@
if (dart.notNull(result[dartx.length]) > 4) {
result = result[dartx.sublist](0, dart.notNull(result[dartx.length]) - 4);
}
- return ListOfint()._check(result);
+ return result;
}
};
dart.setSignature(io._WebSocketPerMessageDeflate, {
@@ -49336,13 +50229,14 @@
if (typeof message == 'string') {
opcode = io._WebSocketOpcode.TEXT;
data = convert.UTF8.encode(message);
+ } else if (ListOfint().is(message)) {
+ opcode = io._WebSocketOpcode.BINARY;
+ data = message;
+ } else if (io._EncodedString.is(message)) {
+ opcode = io._WebSocketOpcode.TEXT;
+ data = message.bytes;
} else {
- if (ListOfint().is(message)) {
- data = message;
- opcode = io._WebSocketOpcode.BINARY;
- } else {
- dart.throw(new core.ArgumentError(message));
- }
+ dart.throw(new core.ArgumentError(message));
}
if (this[_deflateHelper] != null) {
data = this[_deflateHelper].processOutgoingMessage(data);
@@ -49372,7 +50266,7 @@
this[_eventSink$].close();
}
addFrame(opcode, data) {
- return io._WebSocketOutgoingTransformer.createFrame(opcode, data, this.webSocket[_serverSide], this[_deflateHelper] != null && (opcode == io._WebSocketOpcode.TEXT || opcode == io._WebSocketOpcode.BINARY))[dartx.forEach](dart.fn(e => {
+ io._WebSocketOutgoingTransformer.createFrame(opcode, data, this.webSocket[_serverSide], this[_deflateHelper] != null && (opcode == io._WebSocketOpcode.TEXT || opcode == io._WebSocketOpcode.BINARY))[dartx.forEach](dart.fn(e => {
this[_eventSink$].add(e);
}, ListOfintToNull()));
}
@@ -49564,7 +50458,7 @@
this[_ensureController]();
const closeSocket = (function() {
return this.socket.close().catchError(dart.fn(_ => {
- }, dynamicToNull$())).then(io._WebSocketImpl)(dart.fn(_ => this.webSocket, dynamicTo_WebSocketImpl()));
+ }, dynamicToNull$())).then(io._WebSocketImpl)(dart.fn(_ => this.webSocket, SocketTo_WebSocketImpl()));
}).bind(this);
dart.fn(closeSocket, VoidToFuture());
this[_controller$0].close();
@@ -49614,7 +50508,7 @@
const _pingTimer = Symbol('_pingTimer');
const _consumer = Symbol('_consumer');
const _closeTimer = Symbol('_closeTimer');
- let const$81;
+ let const$84;
io._WebSocketImpl = class _WebSocketImpl extends dart.mixin(async.Stream, io._ServiceObject) {
static connect(url, protocols, headers, opts) {
let compression = opts && 'compression' in opts ? opts.compression : io.CompressionOptions.DEFAULT;
@@ -49811,6 +50705,12 @@
add(data) {
this[_sink$0].add(data);
}
+ addUtf8Text(bytes) {
+ if (!ListOfint().is(bytes)) {
+ dart.throw(new core.ArgumentError.value(bytes, "bytes", "Is not a list of bytes"));
+ }
+ this[_sink$0].add(new io._EncodedString(bytes));
+ }
addError(error, stackTrace) {
if (stackTrace === void 0) stackTrace = null;
this[_sink$0].addError(error, stackTrace);
@@ -49836,7 +50736,7 @@
this[_controller$0].stream.drain(dart.dynamic)().catchError(dart.fn(_ => dart.map(), dynamicToMap()));
}
if (this[_closeTimer] == null) {
- this[_closeTimer] = async.Timer.new(const$81 || (const$81 = dart.const(new core.Duration({seconds: 5}))), dart.fn(() => {
+ this[_closeTimer] = async.Timer.new(const$84 || (const$84 = dart.const(new core.Duration({seconds: 5}))), dart.fn(() => {
this[_closeCode] = this[_outCloseCode];
this[_closeReason] = this[_outCloseReason];
if (this[_subscription$] != null) this[_subscription$].cancel();
@@ -49920,6 +50820,7 @@
methods: () => ({
listen: dart.definiteFunctionType(async.StreamSubscription, [dynamicTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool}),
add: dart.definiteFunctionType(dart.void, [dart.dynamic]),
+ addUtf8Text: dart.definiteFunctionType(dart.void, [ListOfint()]),
addError: dart.definiteFunctionType(dart.void, [dart.dynamic], [core.StackTrace]),
addStream: dart.definiteFunctionType(async.Future, [async.Stream]),
close: dart.definiteFunctionType(async.Future, [], [core.int, core.String]),
@@ -49944,7 +50845,7 @@
return io.HttpClient.new();
}
});
- isolate.IsolateSpawnException = class IsolateSpawnException extends core.Object {
+ isolate$.IsolateSpawnException = class IsolateSpawnException extends core.Object {
new(message) {
this.message = message;
}
@@ -49952,12 +50853,12 @@
return dart.str`IsolateSpawnException: ${this.message}`;
}
};
- isolate.IsolateSpawnException[dart.implements] = () => [core.Exception];
- dart.setSignature(isolate.IsolateSpawnException, {
+ isolate$.IsolateSpawnException[dart.implements] = () => [core.Exception];
+ dart.setSignature(isolate$.IsolateSpawnException, {
fields: () => ({message: core.String})
});
const _pause = Symbol('_pause');
- isolate.Isolate = class Isolate extends core.Object {
+ isolate$.Isolate = class Isolate extends core.Object {
new(controlPort, opts) {
let pauseCapability = opts && 'pauseCapability' in opts ? opts.pauseCapability : null;
let terminateCapability = opts && 'terminateCapability' in opts ? opts.terminateCapability : null;
@@ -49966,12 +50867,48 @@
this.terminateCapability = terminateCapability;
}
static get current() {
- return isolate.Isolate._currentIsolateCache;
+ return isolate$.Isolate._currentIsolateCache;
+ }
+ static get packageRoot() {
+ dart.throw(new core.UnsupportedError("Isolate.packageRoot"));
+ }
+ static get packageConfig() {
+ dart.throw(new core.UnsupportedError("Isolate.packageConfig"));
+ }
+ static resolvePackageUri(packageUri) {
+ return dart.async(function*(packageUri) {
+ if (packageUri.scheme != 'package') return packageUri;
+ return isolate$.Isolate._packageBase.resolveUri(packageUri.replace({scheme: ''}));
+ }, core.Uri, packageUri);
}
static spawn(entryPoint, message, opts) {
let paused = opts && 'paused' in opts ? opts.paused : false;
+ let errorsAreFatal = opts && 'errorsAreFatal' in opts ? opts.errorsAreFatal : null;
+ let onExit = opts && 'onExit' in opts ? opts.onExit : null;
+ let onError = opts && 'onError' in opts ? opts.onError : null;
+ let forcePause = errorsAreFatal != null || onExit != null || onError != null;
try {
- return _isolate_helper.IsolateNatives.spawnFunction(entryPoint, message, paused).then(isolate.Isolate)(dart.fn(msg => new isolate.Isolate(isolate.SendPort._check(msg[dartx._get](1)), {pauseCapability: isolate.Capability._check(msg[dartx._get](2)), terminateCapability: isolate.Capability._check(msg[dartx._get](3))}), ListToIsolate()));
+ if (!isolate$._UnaryFunction.is(entryPoint)) {
+ dart.throw(new core.ArgumentError(entryPoint));
+ }
+ return _isolate_helper.IsolateNatives.spawnFunction(entryPoint, message, dart.test(paused) || forcePause).then(isolate$.Isolate)(dart.fn(msg => {
+ let isolate = new isolate$.Isolate(isolate$.SendPort._check(msg[dartx._get](1)), {pauseCapability: isolate$.Capability._check(msg[dartx._get](2)), terminateCapability: isolate$.Capability._check(msg[dartx._get](3))});
+ if (forcePause) {
+ if (errorsAreFatal != null) {
+ isolate.setErrorsFatal(errorsAreFatal);
+ }
+ if (onExit != null) {
+ isolate.addOnExitListener(onExit);
+ }
+ if (onError != null) {
+ isolate.addErrorListener(onError);
+ }
+ if (!dart.test(paused)) {
+ isolate.resume(isolate.pauseCapability);
+ }
+ }
+ return isolate;
+ }, ListToIsolate()));
} catch (e) {
let st = dart.stackTrace(e);
return FutureOfIsolate().error(e, st);
@@ -49980,10 +50917,20 @@
}
static spawnUri(uri, args, message, opts) {
let paused = opts && 'paused' in opts ? opts.paused : false;
+ let onExit = opts && 'onExit' in opts ? opts.onExit : null;
+ let onError = opts && 'onError' in opts ? opts.onError : null;
+ let errorsAreFatal = opts && 'errorsAreFatal' in opts ? opts.errorsAreFatal : null;
+ let checked = opts && 'checked' in opts ? opts.checked : null;
+ let environment = opts && 'environment' in opts ? opts.environment : null;
let packageRoot = opts && 'packageRoot' in opts ? opts.packageRoot : null;
+ let packageConfig = opts && 'packageConfig' in opts ? opts.packageConfig : null;
+ let automaticPackageResolution = opts && 'automaticPackageResolution' in opts ? opts.automaticPackageResolution : false;
+ if (environment != null) dart.throw(new core.UnimplementedError("environment"));
if (packageRoot != null) dart.throw(new core.UnimplementedError("packageRoot"));
+ if (packageConfig != null) dart.throw(new core.UnimplementedError("packageConfig"));
+ let forcePause = errorsAreFatal != null || onExit != null || onError != null;
try {
- if (core.List.is(args)) {
+ if (ListOfString().is(args)) {
for (let i = 0; i < dart.notNull(args[dartx.length]); i++) {
if (!(typeof args[dartx._get](i) == 'string')) {
dart.throw(new core.ArgumentError(dart.str`Args must be a list of Strings ${args}`));
@@ -49992,7 +50939,24 @@
} else if (args != null) {
dart.throw(new core.ArgumentError(dart.str`Args must be a list of Strings ${args}`));
}
- return _isolate_helper.IsolateNatives.spawnUri(uri, args, message, paused).then(isolate.Isolate)(dart.fn(msg => new isolate.Isolate(isolate.SendPort._check(msg[dartx._get](1)), {pauseCapability: isolate.Capability._check(msg[dartx._get](2)), terminateCapability: isolate.Capability._check(msg[dartx._get](3))}), ListToIsolate()));
+ return _isolate_helper.IsolateNatives.spawnUri(uri, args, message, dart.test(paused) || forcePause).then(isolate$.Isolate)(dart.fn(msg => {
+ let isolate = new isolate$.Isolate(isolate$.SendPort._check(msg[dartx._get](1)), {pauseCapability: isolate$.Capability._check(msg[dartx._get](2)), terminateCapability: isolate$.Capability._check(msg[dartx._get](3))});
+ if (forcePause) {
+ if (errorsAreFatal != null) {
+ isolate.setErrorsFatal(errorsAreFatal);
+ }
+ if (onExit != null) {
+ isolate.addOnExitListener(onExit);
+ }
+ if (onError != null) {
+ isolate.addErrorListener(onError);
+ }
+ if (!dart.test(paused)) {
+ isolate.resume(isolate.pauseCapability);
+ }
+ }
+ return isolate;
+ }, ListToIsolate()));
} catch (e) {
let st = dart.stackTrace(e);
return FutureOfIsolate().error(e, st);
@@ -50001,7 +50965,8 @@
}
pause(resumeCapability) {
if (resumeCapability === void 0) resumeCapability = null;
- if (resumeCapability == null) resumeCapability = isolate.Capability.new();
+ let t = resumeCapability;
+ t == null ? resumeCapability = isolate$.Capability.new() : t;
this[_pause](resumeCapability);
return resumeCapability;
}
@@ -50018,10 +50983,12 @@
message[dartx._set](1, resumeCapability);
this.controlPort.send(message);
}
- addOnExitListener(responsePort) {
- let message = core.List.new(2);
+ addOnExitListener(responsePort, opts) {
+ let response = opts && 'response' in opts ? opts.response : null;
+ let message = core.List.new(3);
message[dartx._set](0, "add-ondone");
message[dartx._set](1, responsePort);
+ message[dartx._set](2, response);
this.controlPort.send(message);
}
removeOnExitListener(responsePort) {
@@ -50037,16 +51004,18 @@
message[dartx._set](2, errorsAreFatal);
this.controlPort.send(message);
}
- kill(priority) {
- if (priority === void 0) priority = isolate.Isolate.BEFORE_NEXT_EVENT;
+ kill(opts) {
+ let priority = opts && 'priority' in opts ? opts.priority : isolate$.Isolate.BEFORE_NEXT_EVENT;
this.controlPort.send(JSArrayOfObject().of(["kill", this.terminateCapability, priority]));
}
- ping(responsePort, pingType) {
- if (pingType === void 0) pingType = isolate.Isolate.IMMEDIATE;
- let message = core.List.new(3);
+ ping(responsePort, opts) {
+ let response = opts && 'response' in opts ? opts.response : null;
+ let priority = opts && 'priority' in opts ? opts.priority : isolate$.Isolate.IMMEDIATE;
+ let message = core.List.new(4);
message[dartx._set](0, "ping");
message[dartx._set](1, responsePort);
- message[dartx._set](2, pingType);
+ message[dartx._set](2, priority);
+ message[dartx._set](3, response);
this.controlPort.send(message);
}
addErrorListener(port) {
@@ -50067,12 +51036,12 @@
function handleError(message) {
let errorDescription = core.String._check(dart.dindex(message, 0));
let stackDescription = core.String._check(dart.dindex(message, 1));
- let error = new isolate.RemoteError(errorDescription, stackDescription);
+ let error = new isolate$.RemoteError(errorDescription, stackDescription);
controller.addError(error, error.stackTrace);
}
dart.fn(handleError, dynamicTovoid$());
controller = async.StreamController.broadcast({sync: true, onListen: dart.fn(() => {
- port = isolate.RawReceivePort.new(handleError);
+ port = isolate$.RawReceivePort.new(handleError);
this.addErrorListener(port.sendPort);
}, VoidToNull()), onCancel: dart.fn(() => {
this.removeErrorListener(port.sendPort);
@@ -50082,42 +51051,46 @@
return controller.stream;
}
};
- dart.setSignature(isolate.Isolate, {
+ dart.setSignature(isolate$.Isolate, {
fields: () => ({
- controlPort: isolate.SendPort,
- pauseCapability: isolate.Capability,
- terminateCapability: isolate.Capability
+ controlPort: isolate$.SendPort,
+ pauseCapability: isolate$.Capability,
+ terminateCapability: isolate$.Capability
}),
getters: () => ({errors: dart.definiteFunctionType(async.Stream, [])}),
methods: () => ({
- pause: dart.definiteFunctionType(isolate.Capability, [], [isolate.Capability]),
- [_pause]: dart.definiteFunctionType(dart.void, [isolate.Capability]),
- resume: dart.definiteFunctionType(dart.void, [isolate.Capability]),
- addOnExitListener: dart.definiteFunctionType(dart.void, [isolate.SendPort]),
- removeOnExitListener: dart.definiteFunctionType(dart.void, [isolate.SendPort]),
+ pause: dart.definiteFunctionType(isolate$.Capability, [], [isolate$.Capability]),
+ [_pause]: dart.definiteFunctionType(dart.void, [isolate$.Capability]),
+ resume: dart.definiteFunctionType(dart.void, [isolate$.Capability]),
+ addOnExitListener: dart.definiteFunctionType(dart.void, [isolate$.SendPort], {response: core.Object}),
+ removeOnExitListener: dart.definiteFunctionType(dart.void, [isolate$.SendPort]),
setErrorsFatal: dart.definiteFunctionType(dart.void, [core.bool]),
- kill: dart.definiteFunctionType(dart.void, [], [core.int]),
- ping: dart.definiteFunctionType(dart.void, [isolate.SendPort], [core.int]),
- addErrorListener: dart.definiteFunctionType(dart.void, [isolate.SendPort]),
- removeErrorListener: dart.definiteFunctionType(dart.void, [isolate.SendPort])
+ kill: dart.definiteFunctionType(dart.void, [], {priority: core.int}),
+ ping: dart.definiteFunctionType(dart.void, [isolate$.SendPort], {response: core.Object, priority: core.int}),
+ addErrorListener: dart.definiteFunctionType(dart.void, [isolate$.SendPort]),
+ removeErrorListener: dart.definiteFunctionType(dart.void, [isolate$.SendPort])
}),
statics: () => ({
- spawn: dart.definiteFunctionType(async.Future$(isolate.Isolate), [dynamicTovoid(), dart.dynamic], {paused: core.bool}),
- spawnUri: dart.definiteFunctionType(async.Future$(isolate.Isolate), [core.Uri, ListOfString(), dart.dynamic], {paused: core.bool, packageRoot: core.Uri})
+ resolvePackageUri: dart.definiteFunctionType(async.Future$(core.Uri), [core.Uri]),
+ spawn: dart.definiteFunctionType(async.Future$(isolate$.Isolate), [dynamicTovoid(), dart.dynamic], {paused: core.bool, errorsAreFatal: core.bool, onExit: isolate$.SendPort, onError: isolate$.SendPort}),
+ spawnUri: dart.definiteFunctionType(async.Future$(isolate$.Isolate), [core.Uri, ListOfString(), dart.dynamic], {paused: core.bool, onExit: isolate$.SendPort, onError: isolate$.SendPort, errorsAreFatal: core.bool, checked: core.bool, environment: MapOfString$String(), packageRoot: core.Uri, packageConfig: core.Uri, automaticPackageResolution: core.bool})
}),
- names: ['spawn', 'spawnUri']
+ names: ['resolvePackageUri', 'spawn', 'spawnUri']
});
- isolate.Isolate.IMMEDIATE = 0;
- isolate.Isolate.BEFORE_NEXT_EVENT = 1;
- isolate.Isolate.AS_EVENT = 2;
- dart.defineLazy(isolate.Isolate, {
+ isolate$.Isolate.IMMEDIATE = 0;
+ isolate$.Isolate.BEFORE_NEXT_EVENT = 1;
+ dart.defineLazy(isolate$.Isolate, {
get _currentIsolateCache() {
return _isolate_helper.IsolateNatives.currentIsolate;
- }
+ },
+ get _packageBase() {
+ return core.Uri.base.resolve(core.String._check(dart.dload(_isolate_helper.IsolateNatives, 'packagesBase')));
+ },
+ set _packageBase(_) {}
});
- isolate.SendPort = class SendPort extends core.Object {};
- isolate.SendPort[dart.implements] = () => [isolate.Capability];
- isolate.ReceivePort = class ReceivePort extends core.Object {
+ isolate$.SendPort = class SendPort extends core.Object {};
+ isolate$.SendPort[dart.implements] = () => [isolate$.Capability];
+ isolate$.ReceivePort = class ReceivePort extends core.Object {
static new() {
return new _isolate_helper.ReceivePortImpl();
}
@@ -50125,62 +51098,32 @@
return new _isolate_helper.ReceivePortImpl.fromRawReceivePort(rawPort);
}
};
- isolate.ReceivePort[dart.implements] = () => [async.Stream];
- isolate.RawReceivePort = class RawReceivePort extends core.Object {
+ isolate$.ReceivePort[dart.implements] = () => [async.Stream];
+ isolate$.RawReceivePort = class RawReceivePort extends core.Object {
static new(handler) {
if (handler === void 0) handler = null;
return new _isolate_helper.RawReceivePortImpl(handler);
}
};
- isolate._IsolateUnhandledException = class _IsolateUnhandledException extends core.Object {
- new(message, source, stackTrace) {
- this.message = message;
- this.source = source;
- this.stackTrace = stackTrace;
- }
- toString() {
- return 'IsolateUnhandledException: exception while handling message: ' + dart.str`${this.message} \n ` + dart.str`${dart.toString(this.source)[dartx.replaceAll]("\n", "\n ")}\n` + 'original stack trace:\n ' + dart.str`${dart.toString(this.stackTrace)[dartx.replaceAll]("\n", "\n ")}`;
- }
- };
- isolate._IsolateUnhandledException[dart.implements] = () => [core.Exception];
- dart.setSignature(isolate._IsolateUnhandledException, {
- fields: () => ({
- message: dart.dynamic,
- source: dart.dynamic,
- stackTrace: core.StackTrace
- })
- });
const _description = Symbol('_description');
- isolate.RemoteError = class RemoteError extends core.Object {
+ isolate$.RemoteError = class RemoteError extends core.Object {
new(description, stackDescription) {
this[_description] = description;
- this.stackTrace = new isolate._RemoteStackTrace(stackDescription);
+ this.stackTrace = core.StackTrace.fromString(stackDescription);
}
toString() {
return this[_description];
}
};
- isolate.RemoteError[dart.implements] = () => [core.Error];
- dart.setSignature(isolate.RemoteError, {
+ isolate$.RemoteError[dart.implements] = () => [core.Error];
+ dart.setSignature(isolate$.RemoteError, {
fields: () => ({
[_description]: core.String,
stackTrace: core.StackTrace
})
});
- const _trace$ = Symbol('_trace');
- isolate._RemoteStackTrace = class _RemoteStackTrace extends core.Object {
- new(trace) {
- this[_trace$] = trace;
- }
- toString() {
- return this[_trace$];
- }
- };
- isolate._RemoteStackTrace[dart.implements] = () => [core.StackTrace];
- dart.setSignature(isolate._RemoteStackTrace, {
- fields: () => ({[_trace$]: core.String})
- });
- isolate.Capability = class Capability extends core.Object {
+ isolate$._UnaryFunction = dart.typedef('_UnaryFunction', () => dart.functionType(dart.dynamic, [dart.dynamic]));
+ isolate$.Capability = class Capability extends core.Object {
static new() {
return new _isolate_helper.CapabilityImpl();
}
@@ -50697,13 +51640,40 @@
math.SQRT2 = 1.4142135623730951;
math.min = function(T) {
return (a, b) => {
- return Math.min(_js_helper.checkNum(a), _js_helper.checkNum(b));
+ if (!(typeof a == 'number')) dart.throw(new core.ArgumentError(a));
+ if (!(typeof b == 'number')) dart.throw(new core.ArgumentError(b));
+ if (dart.notNull(a) > dart.notNull(b)) return b;
+ if (dart.notNull(a) < dart.notNull(b)) return a;
+ if (typeof b == 'number') {
+ if (typeof a == 'number') {
+ if (a == 0.0) {
+ return (dart.notNull(a) + dart.notNull(b)) * dart.notNull(a) * dart.notNull(b);
+ }
+ }
+ if (a == 0 && dart.test(b[dartx.isNegative]) || dart.test(b[dartx.isNaN])) return b;
+ return a;
+ }
+ return a;
};
};
dart.fn(math.min, TAndTToT());
math.max = function(T) {
return (a, b) => {
- return Math.max(_js_helper.checkNum(a), _js_helper.checkNum(b));
+ if (!(typeof a == 'number')) dart.throw(new core.ArgumentError(a));
+ if (!(typeof b == 'number')) dart.throw(new core.ArgumentError(b));
+ if (dart.notNull(a) > dart.notNull(b)) return a;
+ if (dart.notNull(a) < dart.notNull(b)) return b;
+ if (typeof b == 'number') {
+ if (typeof a == 'number') {
+ if (a == 0.0) {
+ return dart.notNull(a) + dart.notNull(b);
+ }
+ }
+ if (dart.test(b[dartx.isNaN])) return b;
+ return a;
+ }
+ if (b == 0 && dart.test(a[dartx.isNegative])) return b;
+ return a;
};
};
dart.fn(math.max, TAndTToT$());
@@ -51056,11 +52026,11 @@
return Point;
});
math.Point = Point$();
- let const$82;
+ let const$85;
math.Random = class Random extends core.Object {
static new(seed) {
if (seed === void 0) seed = null;
- return seed == null ? const$82 || (const$82 = dart.const(new math._JSRandom())) : new math._Random(seed);
+ return seed == null ? const$85 || (const$85 = dart.const(new math._JSRandom())) : new math._Random(seed);
}
static secure() {
return math.Random._secureRandom;
@@ -51104,8 +52074,7 @@
}
['=='](other) {
if (!RectangleOfnum().is(other)) return false;
- let otherRect = RectangleOfnum().as(other);
- return this[dartx.left] == otherRect[dartx.left] && this[dartx.top] == otherRect[dartx.top] && this[dartx.right] == otherRect[dartx.right] && this[dartx.bottom] == otherRect[dartx.bottom];
+ return dart.equals(this[dartx.left], dart.dload(other, 'left')) && dart.equals(this[dartx.top], dart.dload(other, 'top')) && dart.equals(this[dartx.right], dart.dload(other, 'right')) && dart.equals(this[dartx.bottom], dart.dload(other, 'bottom'));
}
get hashCode() {
return math._JenkinsSmiHash.hash4(dart.hashCode(this[dartx.left]), dart.hashCode(this[dartx.top]), dart.hashCode(this[dartx.right]), dart.hashCode(this[dartx.bottom]));
@@ -52415,7 +53384,7 @@
});
dart.registerExtension(dart.global.IDBKeyRange, indexed_db.KeyRange);
const _add$3 = Symbol('_add');
- const _clear$0 = Symbol('_clear');
+ const _clear$ = Symbol('_clear');
const _put = Symbol('_put');
const _createIndex = Symbol('_createIndex');
const _add_1 = Symbol('_add_1');
@@ -52463,7 +53432,7 @@
}
[dartx.clear]() {
try {
- return indexed_db._completeRequest(dart.dynamic)(this[_clear$0]());
+ return indexed_db._completeRequest(dart.dynamic)(this[_clear$]());
} catch (e) {
let stacktrace = dart.stackTrace(e);
return async.Future.error(e, stacktrace);
@@ -52584,7 +53553,7 @@
[_add_2](...args) {
return this.add.apply(this, args);
}
- [_clear$0](...args) {
+ [_clear$](...args) {
return this.clear.apply(this, args);
}
[_count$0](...args) {
@@ -52683,7 +53652,7 @@
[_add$3]: dart.definiteFunctionType(indexed_db.Request, [dart.dynamic], [dart.dynamic]),
[_add_1]: dart.definiteFunctionType(indexed_db.Request, [dart.dynamic, dart.dynamic]),
[_add_2]: dart.definiteFunctionType(indexed_db.Request, [dart.dynamic]),
- [_clear$0]: dart.definiteFunctionType(indexed_db.Request, []),
+ [_clear$]: dart.definiteFunctionType(indexed_db.Request, []),
[_count$0]: dart.definiteFunctionType(indexed_db.Request, [core.Object]),
[_createIndex]: dart.definiteFunctionType(indexed_db.Index, [core.String, core.Object], [core.Map]),
[_createIndex_1]: dart.definiteFunctionType(indexed_db.Index, [dart.dynamic, dart.dynamic, dart.dynamic]),
@@ -59472,7 +60441,7 @@
const _borderWidth = Symbol('_borderWidth');
const _bottom = Symbol('_bottom');
const _captionSide = Symbol('_captionSide');
- const _clear$1 = Symbol('_clear');
+ const _clear$0 = Symbol('_clear');
const _clip = Symbol('_clip');
const _color = Symbol('_color');
const _content = Symbol('_content');
@@ -64287,15 +65256,15 @@
this.captionSide = value;
}
get [dartx.clear]() {
- return this[_clear$1];
+ return this[_clear$0];
}
set [dartx.clear](value) {
- this[_clear$1] = value == null ? '' : value;
+ this[_clear$0] = value == null ? '' : value;
}
- get [_clear$1]() {
+ get [_clear$0]() {
return this.clear;
}
- set [_clear$1](value) {
+ set [_clear$0](value) {
this.clear = value;
}
get [dartx.clip]() {
@@ -65042,7 +66011,7 @@
[_borderWidth]: core.String,
[_bottom]: core.String,
[_captionSide]: core.String,
- [_clear$1]: core.String,
+ [_clear$0]: core.String,
[_clip]: core.String,
[_color]: core.String,
[_content]: core.String,
@@ -84090,7 +85059,7 @@
return value;
}
[dartx.clear]() {
- return this[_clear$1]();
+ return this[_clear$0]();
}
[dartx.forEach](f) {
for (let i = 0; true; i++) {
@@ -84133,7 +85102,7 @@
[__setter__](...args) {
return this.__setter__.apply(this, args);
}
- [_clear$1](...args) {
+ [_clear$0](...args) {
return this.clear.apply(this, args);
}
[_getItem](...args) {
@@ -84172,7 +85141,7 @@
[__delete__]: dart.definiteFunctionType(core.bool, [dart.dynamic]),
[__getter__]: dart.definiteFunctionType(core.String, [dart.dynamic]),
[__setter__]: dart.definiteFunctionType(dart.void, [dart.dynamic, core.String]),
- [_clear$1]: dart.definiteFunctionType(dart.void, []),
+ [_clear$0]: dart.definiteFunctionType(dart.void, []),
[_getItem]: dart.definiteFunctionType(core.String, [core.String]),
[_key]: dart.definiteFunctionType(core.String, [core.int]),
[_removeItem]: dart.definiteFunctionType(dart.void, [core.String]),
@@ -93182,9 +94151,6 @@
allowsAttribute: dart.definiteFunctionType(core.bool, [html$.Element, core.String, core.String])
})
});
- let const$83;
- let const$84;
- let const$85;
let const$86;
let const$87;
let const$88;
@@ -93192,15 +94158,18 @@
let const$90;
let const$91;
let const$92;
+ let const$93;
+ let const$94;
+ let const$95;
html$._SimpleNodeValidator = class _SimpleNodeValidator extends core.Object {
static allowNavigation(uriPolicy) {
- return new html$._SimpleNodeValidator(uriPolicy, {allowedElements: const$83 || (const$83 = dart.constList(['A', 'FORM'], core.String)), allowedAttributes: const$84 || (const$84 = dart.constList(['A::accesskey', 'A::coords', 'A::hreflang', 'A::name', 'A::shape', 'A::tabindex', 'A::target', 'A::type', 'FORM::accept', 'FORM::autocomplete', 'FORM::enctype', 'FORM::method', 'FORM::name', 'FORM::novalidate', 'FORM::target'], core.String)), allowedUriAttributes: const$85 || (const$85 = dart.constList(['A::href', 'FORM::action'], core.String))});
+ return new html$._SimpleNodeValidator(uriPolicy, {allowedElements: const$86 || (const$86 = dart.constList(['A', 'FORM'], core.String)), allowedAttributes: const$87 || (const$87 = dart.constList(['A::accesskey', 'A::coords', 'A::hreflang', 'A::name', 'A::shape', 'A::tabindex', 'A::target', 'A::type', 'FORM::accept', 'FORM::autocomplete', 'FORM::enctype', 'FORM::method', 'FORM::name', 'FORM::novalidate', 'FORM::target'], core.String)), allowedUriAttributes: const$88 || (const$88 = dart.constList(['A::href', 'FORM::action'], core.String))});
}
static allowImages(uriPolicy) {
- return new html$._SimpleNodeValidator(uriPolicy, {allowedElements: const$86 || (const$86 = dart.constList(['IMG'], core.String)), allowedAttributes: const$87 || (const$87 = dart.constList(['IMG::align', 'IMG::alt', 'IMG::border', 'IMG::height', 'IMG::hspace', 'IMG::ismap', 'IMG::name', 'IMG::usemap', 'IMG::vspace', 'IMG::width'], core.String)), allowedUriAttributes: const$88 || (const$88 = dart.constList(['IMG::src'], core.String))});
+ return new html$._SimpleNodeValidator(uriPolicy, {allowedElements: const$89 || (const$89 = dart.constList(['IMG'], core.String)), allowedAttributes: const$90 || (const$90 = dart.constList(['IMG::align', 'IMG::alt', 'IMG::border', 'IMG::height', 'IMG::hspace', 'IMG::ismap', 'IMG::name', 'IMG::usemap', 'IMG::vspace', 'IMG::width'], core.String)), allowedUriAttributes: const$91 || (const$91 = dart.constList(['IMG::src'], core.String))});
}
static allowTextElements() {
- return new html$._SimpleNodeValidator(null, {allowedElements: const$89 || (const$89 = dart.constList(['B', 'BLOCKQUOTE', 'BR', 'EM', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'HR', 'I', 'LI', 'OL', 'P', 'SPAN', 'UL'], core.String))});
+ return new html$._SimpleNodeValidator(null, {allowedElements: const$92 || (const$92 = dart.constList(['B', 'BLOCKQUOTE', 'BR', 'EM', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'HR', 'I', 'LI', 'OL', 'P', 'SPAN', 'UL'], core.String))});
}
new(uriPolicy, opts) {
let allowedElements = opts && 'allowedElements' in opts ? opts.allowedElements : null;
@@ -93210,9 +94179,9 @@
this.allowedAttributes = SetOfString().new();
this.allowedUriAttributes = SetOfString().new();
this.uriPolicy = uriPolicy;
- this.allowedElements.addAll((allowedElements != null ? allowedElements : const$90 || (const$90 = dart.constList([], core.String))));
- allowedAttributes = allowedAttributes != null ? allowedAttributes : const$91 || (const$91 = dart.constList([], core.String));
- allowedUriAttributes = allowedUriAttributes != null ? allowedUriAttributes : const$92 || (const$92 = dart.constList([], core.String));
+ this.allowedElements.addAll((allowedElements != null ? allowedElements : const$93 || (const$93 = dart.constList([], core.String))));
+ allowedAttributes = allowedAttributes != null ? allowedAttributes : const$94 || (const$94 = dart.constList([], core.String));
+ allowedUriAttributes = allowedUriAttributes != null ? allowedUriAttributes : const$95 || (const$95 = dart.constList([], core.String));
let legalAttributes = allowedAttributes[dartx.where](dart.fn(x => !dart.test(html$._Html5NodeValidator._uriAttributes[dartx.contains](x)), StringTobool$()));
let extraUriAttributes = allowedAttributes[dartx.where](dart.fn(x => html$._Html5NodeValidator._uriAttributes[dartx.contains](x), StringTobool$()));
this.allowedAttributes.addAll(legalAttributes);
@@ -93498,7 +94467,7 @@
names: ['get']
});
const _array = Symbol('_array');
- const _current$4 = Symbol('_current');
+ const _current$2 = Symbol('_current');
html$.FixedSizeListIterator$ = dart.generic(T => {
let IteratorOfT = () => (IteratorOfT = dart.constFn(core.Iterator$(T)))();
let ListOfT = () => (ListOfT = dart.constFn(core.List$(T)))();
@@ -93507,21 +94476,21 @@
this[_array] = array;
this[_position$1] = -1;
this[_length$3] = array[dartx.length];
- this[_current$4] = null;
+ this[_current$2] = null;
}
moveNext() {
let nextPosition = dart.notNull(this[_position$1]) + 1;
if (nextPosition < dart.notNull(this[_length$3])) {
- this[_current$4] = this[_array][dartx._get](nextPosition);
+ this[_current$2] = this[_array][dartx._get](nextPosition);
this[_position$1] = nextPosition;
return true;
}
- this[_current$4] = null;
+ this[_current$2] = null;
this[_position$1] = this[_length$3];
return false;
}
get current() {
- return this[_current$4];
+ return this[_current$2];
}
}
dart.addTypeTests(FixedSizeListIterator);
@@ -93531,7 +94500,7 @@
[_array]: ListOfT(),
[_length$3]: core.int,
[_position$1]: core.int,
- [_current$4]: T
+ [_current$2]: T
}),
getters: () => ({current: dart.definiteFunctionType(T, [])}),
methods: () => ({moveNext: dart.definiteFunctionType(core.bool, [])})
@@ -93546,21 +94515,21 @@
new(array) {
this[_array] = array;
this[_position$1] = -1;
- this[_current$4] = null;
+ this[_current$2] = null;
}
moveNext() {
let nextPosition = dart.notNull(this[_position$1]) + 1;
if (nextPosition < dart.notNull(this[_array][dartx.length])) {
- this[_current$4] = this[_array][dartx._get](nextPosition);
+ this[_current$2] = this[_array][dartx._get](nextPosition);
this[_position$1] = nextPosition;
return true;
}
- this[_current$4] = null;
+ this[_current$2] = null;
this[_position$1] = this[_array][dartx.length];
return false;
}
get current() {
- return this[_current$4];
+ return this[_current$2];
}
}
dart.addTypeTests(_VariableSizeListIterator);
@@ -93569,7 +94538,7 @@
fields: () => ({
[_array]: ListOfT(),
[_position$1]: core.int,
- [_current$4]: T
+ [_current$2]: T
}),
getters: () => ({current: dart.definiteFunctionType(T, [])}),
methods: () => ({moveNext: dart.definiteFunctionType(core.bool, [])})
@@ -104477,6 +105446,7 @@
methods: () => ({[dartx.executeSql]: dart.definiteFunctionType(dart.void, [core.String, ListOfObject()], [web_sql.SqlStatementCallback, web_sql.SqlStatementErrorCallback])})
});
dart.registerExtension(dart.global.SQLTransaction, web_sql.SqlTransaction);
+ dart.trackLibraries("dart_sdk", {"dart:_runtime": dart, "dart:_debugger": _debugger, "dart:_foreign_helper": _foreign_helper, "dart:_interceptors": _interceptors, "dart:_internal": _internal, "dart:_isolate_helper": _isolate_helper, "dart:_js_embedded_names": _js_embedded_names, "dart:_js_helper": _js_helper, "dart:_js_mirrors": _js_mirrors, "dart:_js_primitives": _js_primitives, "dart:_metadata": _metadata, "dart:_native_typed_data": _native_typed_data, "dart:async": async, "dart:collection": collection, "dart:convert": convert, "dart:core": core, "dart:developer": developer, "dart:io": io, "dart:isolate": isolate$, "dart:js": js, "dart:js_util": js_util, "dart:math": math, "dart:mirrors": mirrors, "dart:typed_data": typed_data, "dart:indexed_db": indexed_db, "dart:html": html$, "dart:html_common": html_common, "dart:svg": svg$, "dart:web_audio": web_audio, "dart:web_gl": web_gl, "dart:web_sql": web_sql});
// Exports:
exports.dart = dart;
exports.dartx = dartx;
@@ -104497,7 +105467,7 @@
exports.core = core;
exports.developer = developer;
exports.io = io;
- exports.isolate = isolate;
+ exports.isolate = isolate$;
exports.js = js;
exports.js_util = js_util;
exports.math = math;
diff --git a/pkg/dev_compiler/lib/sdk/ddc_sdk.sum b/pkg/dev_compiler/lib/sdk/ddc_sdk.sum
index 2578829..d9d2b37 100644
--- a/pkg/dev_compiler/lib/sdk/ddc_sdk.sum
+++ b/pkg/dev_compiler/lib/sdk/ddc_sdk.sum
Binary files differ
diff --git a/pkg/dev_compiler/lib/src/compiler/code_generator.dart b/pkg/dev_compiler/lib/src/compiler/code_generator.dart
index 24aac39..ce888fc 100644
--- a/pkg/dev_compiler/lib/src/compiler/code_generator.dart
+++ b/pkg/dev_compiler/lib/src/compiler/code_generator.dart
@@ -127,7 +127,7 @@
final ClassElement objectClass;
final ClassElement stringClass;
final ClassElement functionClass;
- final ClassElement symbolClass;
+ final ClassElement privateSymbolClass;
ConstFieldVisitor _constants;
@@ -174,7 +174,8 @@
objectClass = _getLibrary(c, 'dart:core').getType('Object'),
stringClass = _getLibrary(c, 'dart:core').getType('String'),
functionClass = _getLibrary(c, 'dart:core').getType('Function'),
- symbolClass = _getLibrary(c, 'dart:_internal').getType('Symbol'),
+ privateSymbolClass =
+ _getLibrary(c, 'dart:_internal').getType('PrivateSymbol'),
dartJSLibrary = _getLibrary(c, 'dart:js');
LibraryElement get currentLibrary => _loader.currentElement.library;
@@ -191,7 +192,7 @@
_libraryRoot += separator;
}
- var module = _emitModule(compilationUnits);
+ var module = _emitModule(compilationUnits, unit.name);
var dartApiSummary = _summarizeModule(compilationUnits);
return new JSModuleFile(unit.name, errors, options, module, dartApiSummary);
@@ -237,7 +238,7 @@
return bundle.toBuffer();
}
- JS.Program _emitModule(List<CompilationUnit> compilationUnits) {
+ JS.Program _emitModule(List<CompilationUnit> compilationUnits, String name) {
if (_moduleItems.isNotEmpty) {
throw new StateError('Can only call emitModule once.');
}
@@ -320,6 +321,11 @@
// hoisted definitions.
items.addAll(_typeTable.discharge());
+ // Track the module name for each library in the module.
+ // This data is only required for debugging.
+ _moduleItems.add(js.statement('#.trackLibraries(#, #);',
+ [_runtimeModule, js.string(name), _librariesDebuggerObject()]));
+
// Add the module's code (produced by visiting compilation units, above)
_copyAndFlattenBlocks(items, _moduleItems);
@@ -327,6 +333,17 @@
return new JS.Program(items, name: _buildUnit.name);
}
+ JS.ObjectInitializer _librariesDebuggerObject() {
+ var properties = <JS.Property>[];
+ _libraries.forEach((library, value) {
+ // TODO(jacobr): we could specify a short library name instead of the
+ // full library uri if we wanted to save space.
+ properties.add(new JS.Property(
+ js.string(jsLibraryDebuggerName(_libraryRoot, library)), value));
+ });
+ return new JS.ObjectInitializer(properties);
+ }
+
List<String> _getJSName(Element e) {
if (e.library == null ||
findAnnotation(e.library, isPublicJSAnnotation) == null) {
@@ -457,6 +474,7 @@
imports.add(new JS.NameSpecifier(_runtimeModule));
imports.add(new JS.NameSpecifier(_extensionSymbolsModule));
}
+
items.add(new JS.ImportDeclaration(
namedImports: imports, from: js.string(module, "'")));
});
@@ -2272,8 +2290,8 @@
// Run constructor field initializers such as `: foo = bar.baz`
for (var init in ctor.initializers) {
if (init is ConstructorFieldInitializer) {
- fields[init.fieldName.staticElement as FieldElement] =
- _visit(init.expression);
+ var element = init.fieldName.staticElement as FieldElement;
+ fields[element] = _visit(init.expression);
}
}
}
@@ -5367,8 +5385,11 @@
var name = js.string(node.components.join('.'), "'");
if (last.startsWith('_')) {
var nativeSymbol = _emitPrivateNameSymbol(currentLibrary, last);
- return js.call('new #.es6(#, #)',
- [_emitConstructorAccess(symbolClass.type), name, nativeSymbol]);
+ return js.call('new #(#, #)', [
+ _emitConstructorAccess(privateSymbolClass.type),
+ name,
+ nativeSymbol
+ ]);
} else {
return js
.call('#.new(#)', [_emitConstructorAccess(types.symbolType), name]);
@@ -5853,6 +5874,44 @@
return pathToJSIdentifier(qualifiedPath);
}
+/// Debugger friendly name for a Dart Library.
+String jsLibraryDebuggerName(String libraryRoot, LibraryElement library) {
+ var uri = library.source.uri;
+ // For package: and dart: uris show the entire
+ if (uri.scheme == 'dart' || uri.scheme == 'package') return uri.toString();
+
+ if (!uri.toFilePath().startsWith(libraryRoot)) {
+ throw 'Invalid library root. $libraryRoot does not contain ${uri
+ .toFilePath()}';
+ }
+ // Relative path to the library.
+ return uri.path.substring(libraryRoot.length);
+}
+
+String jsDebuggingLibraryName(String libraryRoot, LibraryElement library) {
+ var uri = library.source.uri;
+ if (uri.scheme == 'dart') {
+ return uri.path;
+ }
+ // TODO(vsm): This is not necessarily unique if '__' appears in a file name.
+ var separator = '__';
+ String qualifiedPath;
+ if (uri.scheme == 'package') {
+ // Strip the package name.
+ // TODO(vsm): This is not unique if an escaped '/'appears in a filename.
+ // E.g., "foo/bar.dart" and "foo$47bar.dart" would collide.
+ qualifiedPath = uri.pathSegments.skip(1).join(separator);
+ } else if (uri.toFilePath().startsWith(libraryRoot)) {
+ qualifiedPath =
+ uri.path.substring(libraryRoot.length).replaceAll('/', separator);
+ } else {
+ // We don't have a unique name.
+ throw 'Invalid library root. $libraryRoot does not contain ${uri
+ .toFilePath()}';
+ }
+ return pathToJSIdentifier(qualifiedPath);
+}
+
/// Shorthand for identifier-like property names.
/// For now, we emit them as strings and the printer restores them to
/// identifiers if it can.
diff --git a/pkg/dev_compiler/package.json b/pkg/dev_compiler/package.json
index 2616c06..a4a9ab2 100644
--- a/pkg/dev_compiler/package.json
+++ b/pkg/dev_compiler/package.json
@@ -19,7 +19,7 @@
"chai": "^2.2.0",
"electron-prebuilt": "^0.36.0",
"is_js": "^0.9.0",
- "karma": "^0.12.31",
+ "karma": "^1.5.0",
"karma-chai": "^0.1.0",
"karma-chrome-launcher": "^0.1.8",
"karma-electron-launcher": "^0.0.5",
diff --git a/pkg/dev_compiler/test/browser/language_tests.js b/pkg/dev_compiler/test/browser/language_tests.js
index f36b2a7..48605ea 100644
--- a/pkg/dev_compiler/test/browser/language_tests.js
+++ b/pkg/dev_compiler/test/browser/language_tests.js
@@ -11,6 +11,10 @@
let mochaOnError = window.onerror;
dart_sdk.dart.trapRuntimeErrors(false);
dart_sdk._isolate_helper.startRootIsolate(function() {}, []);
+ // Make it easier to debug test failures and required for formatter test that
+ // assumes custom formatters are enabled.
+ dart_sdk._debugger.registerDevtoolsFormatter();
+
let html_config = unittest.html_config;
// Test attributes are a list of strings, or a string for a single
// attribute. Valid attributes are:
@@ -184,7 +188,6 @@
'generic_is_check_test': fail,
'getter_closure_execution_order_test': fail,
'gc_test': 'slow',
- 'hash_code_mangling_test': fail,
'identical_closure2_test': fail,
'infinite_switch_label_test': fail,
'infinity_test': fail,
@@ -289,6 +292,7 @@
'const_list_literal_test': fail,
'const_list_remove_range_test': fail,
'const_list_set_range_test': fail,
+ 'data_uri_test': fail,
'double_parse_test_01_multi': fail,
'double_parse_test_02_multi': firefox_fail,
'error_stack_trace1_test': fail,
@@ -339,7 +343,6 @@
'list_insert_test': fail,
'list_removeat_test': fail,
- 'set_test': fail, // runtime strong mode reject
},
'corelib/regexp': {
@@ -571,6 +574,7 @@
'library_uri_package_test': fail,
'list_constructor_test_01_multi': fail,
'list_constructor_test_none_multi': fail,
+ 'load_library_test': fail,
'local_function_is_static_test': fail,
'local_isolate_test': fail,
'metadata_allowed_values_test_none_multi': fail,
diff --git a/pkg/dev_compiler/test/codegen_expected/BenchmarkBase.js b/pkg/dev_compiler/test/codegen_expected/BenchmarkBase.js
index 9aabf8f..0b2cfba 100644
--- a/pkg/dev_compiler/test/codegen_expected/BenchmarkBase.js
+++ b/pkg/dev_compiler/test/codegen_expected/BenchmarkBase.js
@@ -89,6 +89,7 @@
statics: () => ({measureFor: dart.definiteFunctionType(core.double, [core.Function, core.int])}),
names: ['measureFor']
});
+ dart.trackLibraries("BenchmarkBase", {"BenchmarkBase.dart": BenchmarkBase$});
// Exports:
return {
BenchmarkBase: BenchmarkBase$
diff --git a/pkg/dev_compiler/test/codegen_expected/async_helper.js b/pkg/dev_compiler/test/codegen_expected/async_helper.js
index 44cf910..cd86052 100644
--- a/pkg/dev_compiler/test/codegen_expected/async_helper.js
+++ b/pkg/dev_compiler/test/codegen_expected/async_helper.js
@@ -69,6 +69,7 @@
dart.dsend(f(), 'then', async_helper.asyncSuccess);
};
dart.fn(async_helper.asyncTest, FnTovoid());
+ dart.trackLibraries("async_helper", {"async_helper.dart": async_helper});
// Exports:
return {
async_helper: async_helper
diff --git a/pkg/dev_compiler/test/codegen_expected/closure.js b/pkg/dev_compiler/test/codegen_expected/closure.js
index 1da1e9c..535b23d 100644
--- a/pkg/dev_compiler/test/codegen_expected/closure.js
+++ b/pkg/dev_compiler/test/codegen_expected/closure.js
@@ -117,3 +117,4 @@
closure.some_top_level_final = "abc";
/** @type {string} */
closure.some_top_level_var = "abc";
+dart.trackLibraries("closure", {"closure.dart": closure});
diff --git a/pkg/dev_compiler/test/codegen_expected/destructuring.js b/pkg/dev_compiler/test/codegen_expected/destructuring.js
index 46b4899..c07b2ca 100644
--- a/pkg/dev_compiler/test/codegen_expected/destructuring.js
+++ b/pkg/dev_compiler/test/codegen_expected/destructuring.js
@@ -80,6 +80,7 @@
dart.throw(new core.StateError('The spread function cannot be called, ' + 'it should be compiled away.'));
};
dart.fn(src__varargs.spread, dynamicTodynamic());
+ dart.trackLibraries("destructuring", {"destructuring.dart": destructuring, "package:js/src/varargs.dart": src__varargs});
// Exports:
return {
destructuring: destructuring,
diff --git a/pkg/dev_compiler/test/codegen_expected/es6_modules.js b/pkg/dev_compiler/test/codegen_expected/es6_modules.js
index 8f76e89..482ca51 100644
--- a/pkg/dev_compiler/test/codegen_expected/es6_modules.js
+++ b/pkg/dev_compiler/test/codegen_expected/es6_modules.js
@@ -45,3 +45,4 @@
},
set lazyMutable(_) {}
});
+dart.trackLibraries("es6_modules", {"es6_modules.dart": es6_modules});
diff --git a/pkg/dev_compiler/test/codegen_expected/map_keys.js b/pkg/dev_compiler/test/codegen_expected/map_keys.js
index 4f7dcee..cd6b376 100644
--- a/pkg/dev_compiler/test/codegen_expected/map_keys.js
+++ b/pkg/dev_compiler/test/codegen_expected/map_keys.js
@@ -15,6 +15,7 @@
core.print(dart.map(['1', 2, null, 4, '5', 6], core.String, core.int));
};
dart.fn(map_keys.main, VoidTodynamic());
+ dart.trackLibraries("map_keys", {"map_keys.dart": map_keys});
// Exports:
return {
map_keys: map_keys
diff --git a/pkg/dev_compiler/test/codegen_expected/node_modules.js b/pkg/dev_compiler/test/codegen_expected/node_modules.js
index 5a7fa95..8c2eade 100644
--- a/pkg/dev_compiler/test/codegen_expected/node_modules.js
+++ b/pkg/dev_compiler/test/codegen_expected/node_modules.js
@@ -49,5 +49,6 @@
},
set lazyMutable(_) {}
});
+dart.trackLibraries("node_modules", {"node_modules.dart": node_modules});
// Exports:
exports.node_modules = node_modules;
diff --git a/pkg/dev_compiler/test/codegen_expected/script.js b/pkg/dev_compiler/test/codegen_expected/script.js
index c2b69f4..6564c29 100644
--- a/pkg/dev_compiler/test/codegen_expected/script.js
+++ b/pkg/dev_compiler/test/codegen_expected/script.js
@@ -12,6 +12,7 @@
core.print(dart.str`hello ${name}`);
};
dart.fn(script.main, ListOfStringTovoid());
+ dart.trackLibraries("script", {"script.dart": script});
// Exports:
return {
script: script
diff --git a/pkg/dev_compiler/test/codegen_expected/sunflower/sunflower.js b/pkg/dev_compiler/test/codegen_expected/sunflower/sunflower.js
index 220bc7b..06bc7f3 100644
--- a/pkg/dev_compiler/test/codegen_expected/sunflower/sunflower.js
+++ b/pkg/dev_compiler/test/codegen_expected/sunflower/sunflower.js
@@ -123,6 +123,7 @@
return html.CanvasRenderingContext2D.as(painter.canvas[dartx.getContext]('2d'));
}
});
+ dart.trackLibraries("sunflower", {"sunflower.dart": sunflower, "circle.dart": circle, "painter.dart": painter});
// Exports:
return {
sunflower: sunflower,
diff --git a/pkg/dev_compiler/test/codegen_expected/varargs.js b/pkg/dev_compiler/test/codegen_expected/varargs.js
index 0dea1a0..de0fe75 100644
--- a/pkg/dev_compiler/test/codegen_expected/varargs.js
+++ b/pkg/dev_compiler/test/codegen_expected/varargs.js
@@ -26,6 +26,7 @@
dart.throw(new core.StateError('The spread function cannot be called, ' + 'it should be compiled away.'));
};
dart.fn(src__varargs.spread, dynamicTodynamic());
+ dart.trackLibraries("varargs", {"varargs.dart": varargs, "package:js/src/varargs.dart": src__varargs});
// Exports:
return {
varargs: varargs,
diff --git a/pkg/dev_compiler/test/not_yet_strong_tests.dart b/pkg/dev_compiler/test/not_yet_strong_tests.dart
index c73580e..da7cd00 100644
--- a/pkg/dev_compiler/test/not_yet_strong_tests.dart
+++ b/pkg/dev_compiler/test/not_yet_strong_tests.dart
@@ -2048,7 +2048,6 @@
'corelib/int_from_environment3_test_03_multi',
'corelib/int_from_environment3_test_04_multi',
'corelib/int_from_environment3_test_05_multi',
- 'corelib/iterable_contains2_test',
'corelib/iterable_element_at_test',
'corelib/iterable_fold_test',
'corelib/iterable_mapping_test',
@@ -2154,7 +2153,6 @@
'lib/mirrors/library_imports_prefixed_test',
'lib/mirrors/library_imports_shown_test',
'lib/mirrors/library_metadata2_test_01_multi',
- 'lib/mirrors/load_library_test',
'lib/mirrors/metadata_allowed_values_test_01_multi',
'lib/mirrors/metadata_allowed_values_test_02_multi',
'lib/mirrors/metadata_allowed_values_test_03_multi',
@@ -2385,7 +2383,6 @@
'language/unresolved_top_level_method_negative_test',
'language/unresolved_top_level_var_negative_test',
'corelib/file_resource_test',
- 'corelib/queue_test',
'corelib/regexp/global_test',
'corelib/regexp/regexp_test',
'corelib/regexp/regress-regexp-codeflush_test',
diff --git a/pkg/dev_compiler/tool/build_sdk.sh b/pkg/dev_compiler/tool/build_sdk.sh
index bcda0af..23e3cc4 100755
--- a/pkg/dev_compiler/tool/build_sdk.sh
+++ b/pkg/dev_compiler/tool/build_sdk.sh
@@ -4,25 +4,31 @@
cd $( dirname "${BASH_SOURCE[0]}" )/..
echo "*** Patching SDK"
-dart -c tool/patch_sdk.dart tool/input_sdk gen/patched_sdk
+{ # Try
+ dart -c tool/patch_sdk.dart ../.. tool/input_sdk gen/patched_sdk \
+ > tool/sdk_expected_errors.txt
+} || { # Catch
+ # Show errors if the sdk didn't compile.
+ cat tool/sdk_expected_errors.txt
+ exit 1
+}
echo "*** Compiling SDK to JavaScript"
-
-# TODO(jmesserly): break out dart:html & friends.
{ # Try
+ # TODO(jmesserly): break out dart:html & friends into a module.
dart -c tool/build_sdk.dart \
- --dart-sdk gen/patched_sdk \
- --dart-sdk-summary=build \
- --summary-out lib/sdk/ddc_sdk.sum \
- --modules=amd \
- -o lib/js/amd/dart_sdk.js \
- --modules=es6 \
- -o lib/js/es6/dart_sdk.js \
- --modules=common \
- -o lib/js/common/dart_sdk.js \
- --modules=legacy \
- -o lib/js/legacy/dart_sdk.js \
- "$@" > tool/sdk_expected_errors.txt
+ --dart-sdk gen/patched_sdk \
+ --dart-sdk-summary=build \
+ --summary-out lib/sdk/ddc_sdk.sum \
+ --modules=amd \
+ -o lib/js/amd/dart_sdk.js \
+ --modules=es6 \
+ -o lib/js/es6/dart_sdk.js \
+ --modules=common \
+ -o lib/js/common/dart_sdk.js \
+ --modules=legacy \
+ -o lib/js/legacy/dart_sdk.js \
+ "$@" > tool/sdk_expected_errors.txt
} || { # Catch
# Show errors if the sdk didn't compile.
cat tool/sdk_expected_errors.txt
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/_internal/libraries.dart b/pkg/dev_compiler/tool/input_sdk/lib/_internal/libraries.dart
deleted file mode 100644
index 4e56e9f..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/_internal/libraries.dart
+++ /dev/null
@@ -1,316 +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.
-
-library libraries;
-
-/**
- * A bit flag used by [LibraryInfo] indicating that a library is used by dart2js
- */
-const int DART2JS_PLATFORM = 1;
-
-/**
- * A bit flag used by [LibraryInfo] indicating that a library is used by the VM
- */
-const int VM_PLATFORM = 2;
-
-/**
- * Mapping of "dart:" library name (e.g. "core") to information about that library.
- * This information is structured such that Dart Editor can parse this file
- * and extract the necessary information without executing it
- * while other tools can access via execution.
- */
-const Map<String, LibraryInfo> LIBRARIES = const {
-
- "async": const LibraryInfo(
- "async/async.dart",
- maturity: Maturity.STABLE,
- dart2jsPatchPath: "_internal/compiler/js_lib/async_patch.dart"),
-
- "collection": const LibraryInfo(
- "collection/collection.dart",
- maturity: Maturity.STABLE,
- dart2jsPatchPath: "_internal/compiler/js_lib/collection_patch.dart"),
-
- "convert": const LibraryInfo(
- "convert/convert.dart",
- maturity: Maturity.STABLE,
- dart2jsPatchPath: "_internal/compiler/js_lib/convert_patch.dart"),
-
- "core": const LibraryInfo(
- "core/core.dart",
- maturity: Maturity.STABLE,
- dart2jsPatchPath: "_internal/compiler/js_lib/core_patch.dart"),
-
- "developer": const LibraryInfo(
- "developer/developer.dart",
- maturity: Maturity.STABLE,
- dart2jsPatchPath: "_internal/js_runtime/lib/developer_patch.dart"),
-
- "html": const LibraryInfo(
- "html/dart2js/html_dart2js.dart",
- category: "Client",
- maturity: Maturity.WEB_STABLE),
-
- "html_common": const LibraryInfo(
- "html/html_common/html_common_dart2js.dart",
- category: "Client",
- maturity: Maturity.WEB_STABLE,
- documented: false,
- implementation: true),
-
- "indexed_db": const LibraryInfo(
- "indexed_db/dart2js/indexed_db_dart2js.dart",
- category: "Client",
- maturity: Maturity.WEB_STABLE),
-
- "io": const LibraryInfo(
- "io/io.dart",
- category: "Server",
- maturity: Maturity.STABLE,
- dart2jsPatchPath: "_internal/compiler/js_lib/io_patch.dart"),
-
- "isolate": const LibraryInfo(
- "isolate/isolate.dart",
- maturity: Maturity.STABLE,
- dart2jsPatchPath: "_internal/compiler/js_lib/isolate_patch.dart"),
-
- "js": const LibraryInfo(
- "js/dartium/js_dartium.dart",
- category: "Client",
- maturity: Maturity.STABLE,
- dart2jsPath: "js/dart2js/js_dart2js.dart"),
-
- "js_util": const LibraryInfo(
- "js_util/dartium/js_util_dartium.dart",
- categories: "Client",
- maturity: Maturity.STABLE,
- dart2jsPath: "js_util/dart2js/js_util_dart2js.dart"),
-
- "math": const LibraryInfo(
- "math/math.dart",
- maturity: Maturity.STABLE,
- dart2jsPatchPath: "_internal/compiler/js_lib/math_patch.dart"),
-
- "mirrors": const LibraryInfo(
- "mirrors/mirrors.dart",
- maturity: Maturity.UNSTABLE,
- dart2jsPatchPath: "_internal/compiler/js_lib/mirrors_patch.dart"),
-
- "typed_data": const LibraryInfo(
- "typed_data/typed_data.dart",
- maturity: Maturity.STABLE,
- dart2jsPatchPath: "_internal/compiler/js_lib/typed_data_patch.dart"),
-
- "_native_typed_data": const LibraryInfo(
- "_internal/compiler/js_lib/native_typed_data.dart",
- category: "Internal",
- implementation: true,
- documented: false,
- platforms: DART2JS_PLATFORM),
-
- "svg": const LibraryInfo(
- "svg/dart2js/svg_dart2js.dart",
- category: "Client",
- maturity: Maturity.WEB_STABLE),
-
- "web_audio": const LibraryInfo(
- "web_audio/dart2js/web_audio_dart2js.dart",
- category: "Client",
- maturity: Maturity.WEB_STABLE),
-
- "web_gl": const LibraryInfo(
- "web_gl/dart2js/web_gl_dart2js.dart",
- category: "Client",
- maturity: Maturity.WEB_STABLE),
-
- "web_sql": const LibraryInfo(
- "web_sql/dart2js/web_sql_dart2js.dart",
- category: "Client",
- maturity: Maturity.WEB_STABLE),
-
- "_internal": const LibraryInfo(
- "internal/internal.dart",
- category: "Internal",
- documented: false,
- dart2jsPatchPath:
- "_internal/compiler/js_lib/internal_patch.dart"),
-
- "_js_helper": const LibraryInfo(
- "_internal/compiler/js_lib/js_helper.dart",
- category: "Internal",
- documented: false,
- platforms: DART2JS_PLATFORM),
-
- "_interceptors": const LibraryInfo(
- "_internal/compiler/js_lib/interceptors.dart",
- category: "Internal",
- documented: false,
- platforms: DART2JS_PLATFORM),
-
- "_foreign_helper": const LibraryInfo(
- "_internal/compiler/js_lib/foreign_helper.dart",
- category: "Internal",
- documented: false,
- platforms: DART2JS_PLATFORM),
-
- "_isolate_helper": const LibraryInfo(
- "_internal/compiler/js_lib/isolate_helper.dart",
- category: "Internal",
- documented: false,
- platforms: DART2JS_PLATFORM),
-
- "_js_mirrors": const LibraryInfo(
- "_internal/compiler/js_lib/js_mirrors.dart",
- category: "Internal",
- documented: false,
- platforms: DART2JS_PLATFORM),
-
- "_js_primitives": const LibraryInfo(
- "_internal/compiler/js_lib/js_primitives.dart",
- category: "Internal",
- documented: false,
- platforms: DART2JS_PLATFORM),
-
- // TODO(ahe): This library is only for dart2dart, perhaps it should use a
- // different platform.
- "_mirror_helper": const LibraryInfo(
- "_internal/compiler/js_lib/mirror_helper.dart",
- category: "Internal",
- documented: false,
- platforms: DART2JS_PLATFORM),
-
- "_js_embedded_names": const LibraryInfo(
- "_internal/compiler/js_lib/shared/embedded_names.dart",
- category: "Internal",
- documented: false,
- platforms: DART2JS_PLATFORM),
-
- "_metadata": const LibraryInfo(
- "html/html_common/metadata.dart",
- category: "Internal",
- documented: false,
- platforms: DART2JS_PLATFORM),
-
- "_runtime": const LibraryInfo(
- "_internal/compiler/js_lib/ddc_runtime/runtime.dart",
- category: "Internal",
- documented: false,
- platforms: DART2JS_PLATFORM),
-
- "_debugger": const LibraryInfo(
- "_internal/compiler/js_lib/debugger.dart",
- category: "Internal",
- documented: false,
- platforms: DART2JS_PLATFORM),
-};
-
-/**
- * Information about a "dart:" library.
- */
-class LibraryInfo {
-
- /**
- * Path to the library's *.dart file relative to this file.
- */
- final String path;
-
- /**
- * The category in which the library should appear in the editor
- * (e.g. "Shared", "Client", "Server", ...).
- * If a category is not specified it defaults to "Shared".
- */
- final String category;
-
- /**
- * Path to the dart2js library's *.dart file relative to this file
- * or null if dart2js uses the common library path defined above.
- * Access using the [#getDart2JsPath()] method.
- */
- final String dart2jsPath;
-
- /**
- * Path to the dart2js library's patch file relative to this file
- * or null if no dart2js patch file associated with this library.
- * Access using the [#getDart2JsPatchPath()] method.
- */
- final String dart2jsPatchPath;
-
- /**
- * True if this library is documented and should be shown to the user.
- */
- final bool documented;
-
- /**
- * Bit flags indicating which platforms consume this library.
- * See [DART2JS_LIBRARY] and [VM_LIBRARY].
- */
- final int platforms;
-
- /**
- * True if the library contains implementation details for another library.
- * The implication is that these libraries are less commonly used
- * and that tools like Dart Editor should not show these libraries
- * in a list of all libraries unless the user specifically asks the tool to
- * do so.
- */
- final bool implementation;
-
- /**
- * States the current maturity of this library.
- */
- final Maturity maturity;
-
- const LibraryInfo(this.path, {
- this.category: "Shared",
- this.dart2jsPath,
- this.dart2jsPatchPath,
- this.implementation: false,
- this.documented: true,
- this.maturity: Maturity.UNSPECIFIED,
- this.platforms: DART2JS_PLATFORM | VM_PLATFORM});
-
- bool get isDart2jsLibrary => (platforms & DART2JS_PLATFORM) != 0;
- bool get isVmLibrary => (platforms & VM_PLATFORM) != 0;
-}
-
-
-
-/**
- * Abstraction to capture the maturity of a library.
- */
-class Maturity {
- final int level;
- final String name;
- final String description;
-
- const Maturity(this.level, this.name, this.description);
-
- String toString() => "$name: $level\n$description\n";
-
- static const Maturity DEPRECATED = const Maturity(0, "Deprecated",
- "This library will be remove before next major release.");
-
- static const Maturity EXPERIMENTAL = const Maturity(1, "Experimental",
- "This library is experimental and will likely change or be removed\n"
- "in future versions.");
-
- static const Maturity UNSTABLE = const Maturity(2, "Unstable",
- "This library is in still changing and have not yet endured\n"
- "sufficient real-world testing.\n"
- "Backwards-compatibility is NOT guaranteed.");
-
- static const Maturity WEB_STABLE = const Maturity(3, "Web Stable",
- "This library is tracking the DOM evolution as defined by WC3.\n"
- "Backwards-compatibility is NOT guaranteed.");
-
- static const Maturity STABLE = const Maturity(4, "Stable",
- "The library is stable. API backwards-compatibility is guaranteed.\n"
- "However implementation details might change.");
-
- static const Maturity LOCKED = const Maturity(5, "Locked",
- "This library will not change except when serious bugs are encountered.");
-
- static const Maturity UNSPECIFIED = const Maturity(-1, "Unspecified",
- "The maturity for this library has not been specified.");
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/async/async.dart b/pkg/dev_compiler/tool/input_sdk/lib/async/async.dart
deleted file mode 100644
index 5d1e2c7..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/async/async.dart
+++ /dev/null
@@ -1,110 +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.
-
-/**
- * Support for asynchronous programming,
- * with classes such as Future and Stream.
- *
- * Understanding [Future]s and [Stream]s is a prerequisite for
- * writing just about any Dart program.
- *
- * To use this library in your code:
- *
- * import 'dart:async';
- *
- * ## Future
- *
- * A Future object represents a computation whose return value
- * might not yet be available.
- * The Future returns the value of the computation
- * when it completes at some time in the future.
- * Futures are often used for potentially lengthy computations
- * such as I/O and interaction with users.
- *
- * Many methods in the Dart libraries return Futures when
- * performing tasks. For example, when binding an HttpServer
- * to a host and port, the `bind()` method returns a Future.
- *
- * HttpServer.bind('127.0.0.1', 4444)
- * .then((server) => print('${server.isBroadcast}'))
- * .catchError(print);
- *
- * [Future.then] registers a callback function that runs
- * when the Future's operation, in this case the `bind()` method,
- * completes successfully.
- * The value returned by the operation
- * is passed into the callback function.
- * In this example, the `bind()` method returns the HttpServer
- * object. The callback function prints one of its properties.
- * [Future.catchError] registers a callback function that
- * runs if an error occurs within the Future.
- *
- * ## Stream
- *
- * A Stream provides an asynchronous sequence of data.
- * Examples of data sequences include individual events, like mouse clicks,
- * or sequential chunks of larger data, like multiple byte lists with the
- * contents of a file
- * such as mouse clicks, and a stream of byte lists read from a file.
- * The following example opens a file for reading.
- * [Stream.listen] registers a callback function that runs
- * each time more data is available.
- *
- * Stream<List<int>> stream = new File('quotes.txt').openRead();
- * stream.transform(UTF8.decoder).listen(print);
- *
- * The stream emits a sequence of a list of bytes.
- * The program must interpret the bytes or handle the raw byte data.
- * Here, the code uses a UTF8 decoder (provided in the `dart:convert` library)
- * to convert the sequence of bytes into a sequence
- * of Dart strings.
- *
- * Another common use of streams is for user-generated events
- * in a web app: The following code listens for mouse clicks on a button.
- *
- * querySelector('#myButton').onClick.listen((_) => print('Click.'));
- *
- * ## Other resources
- *
- * * The [dart:async section of the library tour][asynchronous-programming]:
- * A brief overview of asynchronous programming.
- *
- * * [Use Future-Based APIs][futures-tutorial]: A closer look at Futures and
- * how to use them to write asynchronous Dart code.
- *
- * * [Futures and Error Handling][futures-error-handling]: Everything you
- * wanted to know about handling errors and exceptions when working with
- * Futures (but were afraid to ask).
- *
- * * [The Event Loop and Dart](https://www.dartlang.org/articles/event-loop/):
- * Learn how Dart handles the event queue and microtask queue, so you can
- * write better asynchronous code with fewer surprises.
- *
- * * [test package: Asynchronous Tests][test-readme]: How to test asynchronous
- * code.
- *
- * [asynchronous-programming]: https://www.dartlang.org/docs/dart-up-and-running/ch03.html#dartasync---asynchronous-programming
- * [futures-tutorial]: https://www.dartlang.org/docs/tutorials/futures/
- * [futures-error-handling]: https://www.dartlang.org/articles/futures-and-error-handling/
- * [test-readme]: https://pub.dartlang.org/packages/test
- */
-library dart.async;
-
-import "dart:collection";
-import "dart:_internal" show printToZone, printToConsole,
- IterableElementError;
-
-part 'async_error.dart';
-part 'broadcast_stream_controller.dart';
-part 'deferred_load.dart';
-part 'future.dart';
-part 'future_impl.dart';
-part 'schedule_microtask.dart';
-part 'stream.dart';
-part 'stream_controller.dart';
-part 'stream_impl.dart';
-part 'stream_pipe.dart';
-part 'stream_transformers.dart';
-part 'timer.dart';
-part 'zone.dart';
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/async/async_error.dart b/pkg/dev_compiler/tool/input_sdk/lib/async/async_error.dart
deleted file mode 100644
index 5378885..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/async/async_error.dart
+++ /dev/null
@@ -1,57 +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.
-
-part of dart.async;
-
-_invokeErrorHandler(Function errorHandler,
- Object error, StackTrace stackTrace) {
- if (errorHandler is ZoneBinaryCallback) {
- return errorHandler(error, stackTrace);
- } else {
- ZoneUnaryCallback unaryErrorHandler = errorHandler;
- return unaryErrorHandler(error);
- }
-}
-
-Function _registerErrorHandler/*<R>*/(Function errorHandler, Zone zone) {
- if (errorHandler is ZoneBinaryCallback) {
- // TODO(leafp): These are commented out, because the async libraries
- // pass a (...) -> void into this function which fails whenever R
- // is something interesting. This needs to be sorted out in the main
- // SDK as to what the intent is here: if this is really supposed to
- // return an R, then the function that gets passed in is wrong. If not,
- // then this code doesn't need to track the return type at all.
- // return zone.registerBinaryCallback/*<R, dynamic, StackTrace>*/(
- // errorHandler as dynamic/*=ZoneBinaryCallback<R, dynamic, StackTrace>*/);
- return zone.registerBinaryCallback/*<dynamic, dynamic, StackTrace>*/(
- errorHandler as dynamic/*=ZoneBinaryCallback<dynamic, dynamic, StackTrace>*/);
- } else {
- // return zone.registerUnaryCallback/*<R, dynamic>*/(
- // errorHandler as dynamic/*=ZoneUnaryCallback<R, dynamic>*/);
- return zone.registerUnaryCallback/*<dynamic, dynamic>*/(
- errorHandler as dynamic/*=ZoneUnaryCallback<dynamic, dynamic>*/);
- }
-}
-
-class _UncaughtAsyncError extends AsyncError {
- _UncaughtAsyncError(error, StackTrace stackTrace)
- : super(error, _getBestStackTrace(error, stackTrace));
-
- static StackTrace _getBestStackTrace(error, StackTrace stackTrace) {
- if (stackTrace != null) return stackTrace;
- if (error is Error) {
- return error.stackTrace;
- }
- return null;
- }
-
- String toString() {
- String result = "Uncaught Error: ${error}";
-
- if (stackTrace != null) {
- result += "\nStack Trace:\n$stackTrace";
- }
- return result;
- }
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/async/broadcast_stream_controller.dart b/pkg/dev_compiler/tool/input_sdk/lib/async/broadcast_stream_controller.dart
deleted file mode 100644
index c34ec9f..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/async/broadcast_stream_controller.dart
+++ /dev/null
@@ -1,544 +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.
-
-part of dart.async;
-
-class _BroadcastStream<T> extends _ControllerStream<T> {
- _BroadcastStream(_StreamControllerLifecycle<T> controller)
- : super(controller);
-
- bool get isBroadcast => true;
-}
-
-class _BroadcastSubscription<T> extends _ControllerSubscription<T> {
- static const int _STATE_EVENT_ID = 1;
- static const int _STATE_FIRING = 2;
- static const int _STATE_REMOVE_AFTER_FIRING = 4;
- // TODO(lrn): Use the _state field on _ControllerSubscription to
- // also store this state. Requires that the subscription implementation
- // does not assume that it's use of the state integer is the only use.
- int _eventState = 0; // Initialized to help dart2js type inference.
-
- _BroadcastSubscription<T> _next;
- _BroadcastSubscription<T> _previous;
-
- _BroadcastSubscription(_StreamControllerLifecycle<T> controller,
- void onData(T data),
- Function onError,
- void onDone(),
- bool cancelOnError)
- : super(controller, onData, onError, onDone, cancelOnError) {
- _next = _previous = this;
- }
-
- bool _expectsEvent(int eventId) =>
- (_eventState & _STATE_EVENT_ID) == eventId;
-
- void _toggleEventId() {
- _eventState ^= _STATE_EVENT_ID;
- }
-
- bool get _isFiring => (_eventState & _STATE_FIRING) != 0;
-
- void _setRemoveAfterFiring() {
- assert(_isFiring);
- _eventState |= _STATE_REMOVE_AFTER_FIRING;
- }
-
- bool get _removeAfterFiring =>
- (_eventState & _STATE_REMOVE_AFTER_FIRING) != 0;
-
- // The controller._recordPause doesn't do anything for a broadcast controller,
- // so we don't bother calling it.
- void _onPause() { }
-
- // The controller._recordResume doesn't do anything for a broadcast
- // controller, so we don't bother calling it.
- void _onResume() { }
-
- // _onCancel is inherited.
-}
-
-abstract class _BroadcastStreamController<T>
- implements StreamController<T>,
- _StreamControllerLifecycle<T>,
- _EventSink<T>,
- _EventDispatch<T> {
- static const int _STATE_INITIAL = 0;
- static const int _STATE_EVENT_ID = 1;
- static const int _STATE_FIRING = 2;
- static const int _STATE_CLOSED = 4;
- static const int _STATE_ADDSTREAM = 8;
-
- ControllerCallback onListen;
- ControllerCancelCallback onCancel;
-
- // State of the controller.
- int _state;
-
- // Double-linked list of active listeners.
- _BroadcastSubscription<T> _firstSubscription;
- _BroadcastSubscription<T> _lastSubscription;
-
- // Extra state used during an [addStream] call.
- _AddStreamState<T> _addStreamState;
-
- /**
- * Future returned by [close] and [done].
- *
- * The future is completed whenever the done event has been sent to all
- * relevant listeners.
- * The relevant listeners are the ones that were listening when [close] was
- * called. When all of these have been canceled (sending the done event makes
- * them cancel, but they can also be canceled before sending the event),
- * this future completes.
- *
- * Any attempt to listen after calling [close] will throw, so there won't
- * be any further listeners.
- */
- _Future _doneFuture;
-
- _BroadcastStreamController(this.onListen, this.onCancel)
- : _state = _STATE_INITIAL;
-
- ControllerCallback get onPause {
- throw new UnsupportedError(
- "Broadcast stream controllers do not support pause callbacks");
- }
-
- void set onPause(void onPauseHandler()) {
- throw new UnsupportedError(
- "Broadcast stream controllers do not support pause callbacks");
- }
-
- ControllerCallback get onResume {
- throw new UnsupportedError(
- "Broadcast stream controllers do not support pause callbacks");
- }
-
- void set onResume(void onResumeHandler()) {
- throw new UnsupportedError(
- "Broadcast stream controllers do not support pause callbacks");
- }
-
- // StreamController interface.
-
- Stream<T> get stream => new _BroadcastStream<T>(this);
-
- StreamSink<T> get sink => new _StreamSinkWrapper<T>(this);
-
- bool get isClosed => (_state & _STATE_CLOSED) != 0;
-
- /**
- * A broadcast controller is never paused.
- *
- * Each receiving stream may be paused individually, and they handle their
- * own buffering.
- */
- bool get isPaused => false;
-
- /** Whether there are currently one or more subscribers. */
- bool get hasListener => !_isEmpty;
-
- /**
- * Test whether the stream has exactly one listener.
- *
- * Assumes that the stream has a listener (not [_isEmpty]).
- */
- bool get _hasOneListener {
- assert(!_isEmpty);
- return identical(_firstSubscription, _lastSubscription);
- }
-
- /** Whether an event is being fired (sent to some, but not all, listeners). */
- bool get _isFiring => (_state & _STATE_FIRING) != 0;
-
- bool get _isAddingStream => (_state & _STATE_ADDSTREAM) != 0;
-
- bool get _mayAddEvent => (_state < _STATE_CLOSED);
-
- _Future _ensureDoneFuture() {
- if (_doneFuture != null) return _doneFuture;
- return _doneFuture = new _Future();
- }
-
- // Linked list helpers
-
- bool get _isEmpty => _firstSubscription == null;
-
- /** Adds subscription to linked list of active listeners. */
- void _addListener(_BroadcastSubscription<T> subscription) {
- assert(identical(subscription._next, subscription));
- subscription._eventState = (_state & _STATE_EVENT_ID);
- // Insert in linked list as last subscription.
- _BroadcastSubscription<T> oldLast = _lastSubscription;
- _lastSubscription = subscription;
- subscription._next = null;
- subscription._previous = oldLast;
- if (oldLast == null) {
- _firstSubscription = subscription;
- } else {
- oldLast._next = subscription;
- }
- }
-
- void _removeListener(_BroadcastSubscription<T> subscription) {
- assert(identical(subscription._controller, this));
- assert(!identical(subscription._next, subscription));
- _BroadcastSubscription<T> previous = subscription._previous;
- _BroadcastSubscription<T> next = subscription._next;
- if (previous == null) {
- // This was the first subscription.
- _firstSubscription = next;
- } else {
- previous._next = next;
- }
- if (next == null) {
- // This was the last subscription.
- _lastSubscription = previous;
- } else {
- next._previous = previous;
- }
-
- subscription._next = subscription._previous = subscription;
- }
-
- // _StreamControllerLifecycle interface.
-
- StreamSubscription<T> _subscribe(
- void onData(T data),
- Function onError,
- void onDone(),
- bool cancelOnError) {
- if (isClosed) {
- if (onDone == null) onDone = _nullDoneHandler;
- return new _DoneStreamSubscription<T>(onDone);
- }
- StreamSubscription<T> subscription =
- new _BroadcastSubscription<T>(this, onData, onError, onDone,
- cancelOnError);
- _addListener(subscription);
- if (identical(_firstSubscription, _lastSubscription)) {
- // Only one listener, so it must be the first listener.
- _runGuarded(onListen);
- }
- return subscription;
- }
-
- Future _recordCancel(StreamSubscription<T> sub) {
- _BroadcastSubscription<T> subscription = sub;
- // If already removed by the stream, don't remove it again.
- if (identical(subscription._next, subscription)) return null;
- if (subscription._isFiring) {
- subscription._setRemoveAfterFiring();
- } else {
- _removeListener(subscription);
- // If we are currently firing an event, the empty-check is performed at
- // the end of the listener loop instead of here.
- if (!_isFiring && _isEmpty) {
- _callOnCancel();
- }
- }
- return null;
- }
-
- void _recordPause(StreamSubscription<T> subscription) {}
- void _recordResume(StreamSubscription<T> subscription) {}
-
- // EventSink interface.
-
- Error _addEventError() {
- if (isClosed) {
- return new StateError("Cannot add new events after calling close");
- }
- assert(_isAddingStream);
- return new StateError("Cannot add new events while doing an addStream");
- }
-
- void add(T data) {
- if (!_mayAddEvent) throw _addEventError();
- _sendData(data);
- }
-
- void addError(Object error, [StackTrace stackTrace]) {
- error = _nonNullError(error);
- if (!_mayAddEvent) throw _addEventError();
- AsyncError replacement = Zone.current.errorCallback(error, stackTrace);
- if (replacement != null) {
- error = _nonNullError(replacement.error);
- stackTrace = replacement.stackTrace;
- }
- _sendError(error, stackTrace);
- }
-
- Future close() {
- if (isClosed) {
- assert(_doneFuture != null);
- return _doneFuture;
- }
- if (!_mayAddEvent) throw _addEventError();
- _state |= _STATE_CLOSED;
- Future doneFuture = _ensureDoneFuture();
- _sendDone();
- return doneFuture;
- }
-
- Future get done => _ensureDoneFuture();
-
- Future addStream(Stream<T> stream, {bool cancelOnError: true}) {
- if (!_mayAddEvent) throw _addEventError();
- _state |= _STATE_ADDSTREAM;
- _addStreamState = new _AddStreamState(this, stream, cancelOnError);
- return _addStreamState.addStreamFuture;
- }
-
- // _EventSink interface, called from AddStreamState.
- void _add(T data) {
- _sendData(data);
- }
-
- void _addError(Object error, StackTrace stackTrace) {
- _sendError(error, stackTrace);
- }
-
- void _close() {
- assert(_isAddingStream);
- _AddStreamState addState = _addStreamState;
- _addStreamState = null;
- _state &= ~_STATE_ADDSTREAM;
- addState.complete();
- }
-
- // Event handling.
- void _forEachListener(
- void action(_BufferingStreamSubscription<T> subscription)) {
- if (_isFiring) {
- throw new StateError(
- "Cannot fire new event. Controller is already firing an event");
- }
- if (_isEmpty) return;
-
- // Get event id of this event.
- int id = (_state & _STATE_EVENT_ID);
- // Start firing (set the _STATE_FIRING bit). We don't do [onCancel]
- // callbacks while firing, and we prevent reentrancy of this function.
- //
- // Set [_state]'s event id to the next event's id.
- // Any listeners added while firing this event will expect the next event,
- // not this one, and won't get notified.
- _state ^= _STATE_EVENT_ID | _STATE_FIRING;
- _BroadcastSubscription<T> subscription = _firstSubscription;
- while (subscription != null) {
- if (subscription._expectsEvent(id)) {
- subscription._eventState |= _BroadcastSubscription._STATE_FIRING;
- action(subscription);
- subscription._toggleEventId();
- _BroadcastSubscription<T> next = subscription._next;
- if (subscription._removeAfterFiring) {
- _removeListener(subscription);
- }
- subscription._eventState &= ~_BroadcastSubscription._STATE_FIRING;
- subscription = next;
- } else {
- subscription = subscription._next;
- }
- }
- _state &= ~_STATE_FIRING;
-
- if (_isEmpty) {
- _callOnCancel();
- }
- }
-
- void _callOnCancel() {
- assert(_isEmpty);
- if (isClosed && _doneFuture._mayComplete) {
- // When closed, _doneFuture is not null.
- _doneFuture._asyncComplete(null);
- }
- _runGuarded(onCancel);
- }
-}
-
-class _SyncBroadcastStreamController<T> extends _BroadcastStreamController<T>
- implements SynchronousStreamController<T> {
- _SyncBroadcastStreamController(void onListen(), void onCancel())
- : super(onListen, onCancel);
-
- // EventDispatch interface.
-
- bool get _mayAddEvent => super._mayAddEvent && !_isFiring;
-
- _addEventError() {
- if (_isFiring) {
- return new StateError(
- "Cannot fire new event. Controller is already firing an event");
- }
- return super._addEventError();
- }
-
- void _sendData(T data) {
- if (_isEmpty) return;
- if (_hasOneListener) {
- _state |= _BroadcastStreamController._STATE_FIRING;
- _BroadcastSubscription<T> subscription = _firstSubscription;
- subscription._add(data);
- _state &= ~_BroadcastStreamController._STATE_FIRING;
- if (_isEmpty) {
- _callOnCancel();
- }
- return;
- }
- _forEachListener((_BufferingStreamSubscription<T> subscription) {
- subscription._add(data);
- });
- }
-
- void _sendError(Object error, StackTrace stackTrace) {
- if (_isEmpty) return;
- _forEachListener((_BufferingStreamSubscription<T> subscription) {
- subscription._addError(error, stackTrace);
- });
- }
-
- void _sendDone() {
- if (!_isEmpty) {
- _forEachListener((_BufferingStreamSubscription<T> subscription) {
- subscription._close();
- });
- } else {
- assert(_doneFuture != null);
- assert(_doneFuture._mayComplete);
- _doneFuture._asyncComplete(null);
- }
- }
-}
-
-class _AsyncBroadcastStreamController<T> extends _BroadcastStreamController<T> {
- _AsyncBroadcastStreamController(void onListen(), void onCancel())
- : super(onListen, onCancel);
-
- // EventDispatch interface.
-
- void _sendData(T data) {
- for (_BroadcastSubscription<T> subscription = _firstSubscription;
- subscription != null;
- subscription = subscription._next) {
- subscription._addPending(new _DelayedData<T>(data));
- }
- }
-
- void _sendError(Object error, StackTrace stackTrace) {
- for (_BroadcastSubscription<T> subscription = _firstSubscription;
- subscription != null;
- subscription = subscription._next) {
- subscription._addPending(new _DelayedError(error, stackTrace));
- }
- }
-
- void _sendDone() {
- if (!_isEmpty) {
- for (_BroadcastSubscription<T> subscription = _firstSubscription;
- subscription != null;
- subscription = subscription._next) {
- subscription._addPending(const _DelayedDone());
- }
- } else {
- assert(_doneFuture != null);
- assert(_doneFuture._mayComplete);
- _doneFuture._asyncComplete(null);
- }
- }
-}
-
-/**
- * Stream controller that is used by [Stream.asBroadcastStream].
- *
- * This stream controller allows incoming events while it is firing
- * other events. This is handled by delaying the events until the
- * current event is done firing, and then fire the pending events.
- *
- * This class extends [_SyncBroadcastStreamController]. Events of
- * an "asBroadcastStream" stream are always initiated by events
- * on another stream, and it is fine to forward them synchronously.
- */
-class _AsBroadcastStreamController<T>
- extends _SyncBroadcastStreamController<T>
- implements _EventDispatch<T> {
- _StreamImplEvents<T> _pending;
-
- _AsBroadcastStreamController(void onListen(), void onCancel())
- : super(onListen, onCancel);
-
- bool get _hasPending => _pending != null && ! _pending.isEmpty;
-
- void _addPendingEvent(_DelayedEvent event) {
- if (_pending == null) {
- _pending = new _StreamImplEvents<T>();
- }
- _pending.add(event);
- }
-
- void add(T data) {
- if (!isClosed && _isFiring) {
- _addPendingEvent(new _DelayedData<T>(data));
- return;
- }
- super.add(data);
- while (_hasPending) {
- _pending.handleNext(this);
- }
- }
-
- void addError(Object error, [StackTrace stackTrace]) {
- if (!isClosed && _isFiring) {
- _addPendingEvent(new _DelayedError(error, stackTrace));
- return;
- }
- if (!_mayAddEvent) throw _addEventError();
- _sendError(error, stackTrace);
- while (_hasPending) {
- _pending.handleNext(this);
- }
- }
-
- Future close() {
- if (!isClosed && _isFiring) {
- _addPendingEvent(const _DelayedDone());
- _state |= _BroadcastStreamController._STATE_CLOSED;
- return super.done;
- }
- Future result = super.close();
- assert(!_hasPending);
- return result;
- }
-
- void _callOnCancel() {
- if (_hasPending) {
- _pending.clear();
- _pending = null;
- }
- super._callOnCancel();
- }
-}
-
-// A subscription that never receives any events.
-// It can simulate pauses, but otherwise does nothing.
-class _DoneSubscription<T> implements StreamSubscription<T> {
- int _pauseCount = 0;
- void onData(void handleData(T data)) {}
- void onError(Function handleError) {}
- void onDone(void handleDone()) {}
- void pause([Future resumeSignal]) {
- if (resumeSignal != null) resumeSignal.then(_resume);
- _pauseCount++;
- }
- void resume() { _resume(null); }
- void _resume(_) {
- if (_pauseCount > 0) _pauseCount--;
- }
- Future cancel() { return new _Future.immediate(null); }
- bool get isPaused => _pauseCount > 0;
- Future/*<E>*/ asFuture/*<E>*/([Object/*=E*/ value]) => new _Future/*<E>*/();
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/async/deferred_load.dart b/pkg/dev_compiler/tool/input_sdk/lib/async/deferred_load.dart
deleted file mode 100644
index 9d5c51f..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/async/deferred_load.dart
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-part of dart.async;
-
-/**
- * Indicates that loading of [libraryName] is deferred.
- *
- * This class is obsolete. Instead use the syntax:
- * import "library.dart" deferred as prefix;
- */
-@Deprecated("Dart sdk v. 1.8")
-class DeferredLibrary {
- final String libraryName;
- final String uri;
-
- const DeferredLibrary(this.libraryName, {this.uri});
-
- /**
- * Ensure that [libraryName] has been loaded.
- *
- * If the library fails to load, the Future will complete with a
- * DeferredLoadException.
- */
- external Future<Null> load();
-}
-
-/**
- * Thrown when a deferred library fails to load.
- */
-class DeferredLoadException implements Exception {
- DeferredLoadException(String this._s);
- String toString() => "DeferredLoadException: '$_s'";
- final String _s;
-}
\ No newline at end of file
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/async/future.dart b/pkg/dev_compiler/tool/input_sdk/lib/async/future.dart
deleted file mode 100644
index 5b570c6..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/async/future.dart
+++ /dev/null
@@ -1,829 +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.
-
-part of dart.async;
-
-/// A type representing values that are either `Future<T>` or `T`.
-///
-/// This class declaration is a public stand-in for an internal
-/// future-or-value generic type. References to this class are resolved to the
-/// internal type.
-///
-/// It is a compile-time error for any class to extend, mix in or implement
-/// `FutureOr`.
-///
-/// Note: the `FutureOr<T>` type is interpreted as `dynamic` in non strong-mode.
-///
-/// # Examples
-/// ``` dart
-/// // The `Future<T>.then` function takes a callback [f] that returns either
-/// // an `S` or a `Future<S>`.
-/// Future<S> then<S>(FutureOr<S> f(T x), ...);
-///
-/// // `Completer<T>.complete` takes either a `T` or `Future<T>`.
-/// void complete(FutureOr<T> value);
-/// ```
-///
-/// # Advanced
-/// The `FutureOr<int>` type is actually the "type union" of the types `int` and
-/// `Future<int>`. This type union is defined in such a way that
-/// `FutureOr<Object>` is both a super- and sub-type of `Object` (sub-type
-/// because `Object` is one of the types of the union, super-type because
-/// `Object` is a super-type of both of the types of the union). Together it
-/// means that `FutureOr<Object>` is equivalent to `Object`.
-///
-/// As a corollary, `FutureOr<Object>` is equivalent to
-/// `FutureOr<FutureOr<Object>>`, `FutureOr<Future<Object>> is equivalent to
-/// `Future<Object>`.
-abstract class FutureOr<T> {
- // Private constructor, so that it is not subclassable, mixable, or
- // instantiable.
- FutureOr._() {
- throw new UnsupportedError("FutureOr can't be instantiated");
- }
-}
-
-/**
- * An object representing a delayed computation.
- *
- * A [Future] is used to represent a potential value, or error,
- * that will be available at some time in the future.
- * Receivers of a [Future] can register callbacks
- * that handle the value or error once it is available.
- * For example:
- *
- * Future<int> future = getFuture();
- * future.then((value) => handleValue(value))
- * .catchError((error) => handleError(error));
- *
- * A [Future] can complete in two ways:
- * with a value ("the future succeeds")
- * or with an error ("the future fails").
- * Users can install callbacks for each case.
- * The result of registering a pair of callbacks is a new Future (the
- * "successor") which in turn is completed with the result of invoking the
- * corresponding callback.
- * The successor is completed with an error if the invoked callback throws.
- * For example:
- *
- * Future<int> successor = future.then((int value) {
- * // Invoked when the future is completed with a value.
- * return 42; // The successor is completed with the value 42.
- * },
- * onError: (e) {
- * // Invoked when the future is completed with an error.
- * if (canHandle(e)) {
- * return 499; // The successor is completed with the value 499.
- * } else {
- * throw e; // The successor is completed with the error e.
- * }
- * });
- *
- * If a future does not have a successor when it completes with an error,
- * it forwards the error message to the global error-handler.
- * This behavior makes sure that no error is silently dropped.
- * However, it also means that error handlers should be installed early,
- * so that they are present as soon as a future is completed with an error.
- * The following example demonstrates this potential bug:
- *
- * var future = getFuture();
- * new Timer(new Duration(milliseconds: 5), () {
- * // The error-handler is not attached until 5 ms after the future has
- * // been received. If the future fails before that, the error is
- * // forwarded to the global error-handler, even though there is code
- * // (just below) to eventually handle the error.
- * future.then((value) { useValue(value); },
- * onError: (e) { handleError(e); });
- * });
- *
- * When registering callbacks, it's often more readable to register the two
- * callbacks separately, by first using [then] with one argument
- * (the value handler) and using a second [catchError] for handling errors.
- * Each of these will forward the result that they don't handle
- * to their successors, and together they handle both value and error result.
- * It also has the additional benefit of the [catchError] handling errors in the
- * [then] value callback too.
- * Using sequential handlers instead of parallel ones often leads to code that
- * is easier to reason about.
- * It also makes asynchronous code very similar to synchronous code:
- *
- * // Synchronous code.
- * try {
- * int value = foo();
- * return bar(value);
- * } catch (e) {
- * return 499;
- * }
- *
- * Equivalent asynchronous code, based on futures:
- *
- * Future<int> future = new Future(foo); // Result of foo() as a future.
- * future.then((int value) => bar(value))
- * .catchError((e) => 499);
- *
- * Similar to the synchronous code, the error handler (registered with
- * [catchError]) is handling any errors thrown by either `foo` or `bar`.
- * If the error-handler had been registered as the `onError` parameter of
- * the `then` call, it would not catch errors from the `bar` call.
- *
- * Futures can have more than one callback-pair registered. Each successor is
- * treated independently and is handled as if it was the only successor.
- *
- * A future may also fail to ever complete. In that case, no callbacks are
- * called.
- */
-abstract class Future<T> {
- // The `_nullFuture` is a completed Future with the value `null`.
- static final _Future _nullFuture = new Future.value(null);
-
- /**
- * Creates a future containing the result of calling [computation]
- * asynchronously with [Timer.run].
- *
- * If the result of executing [computation] throws, the returned future is
- * completed with the error.
- *
- * If the returned value is itself a [Future], completion of
- * the created future will wait until the returned future completes,
- * and will then complete with the same result.
- *
- * If a non-future value is returned, the returned future is completed
- * with that value.
- */
- factory Future(computation()) {
- _Future<T> result = new _Future<T>();
- Timer.run(() {
- try {
- result._complete(computation());
- } catch (e, s) {
- _completeWithErrorCallback(result, e, s);
- }
- });
- return result;
- }
-
- /**
- * Creates a future containing the result of calling [computation]
- * asynchronously with [scheduleMicrotask].
- *
- * If executing [computation] throws,
- * the returned future is completed with the thrown error.
- *
- * If calling [computation] returns a [Future], completion of
- * the created future will wait until the returned future completes,
- * and will then complete with the same result.
- *
- * If calling [computation] returns a non-future value,
- * the returned future is completed with that value.
- */
- factory Future.microtask(computation()) {
- _Future<T> result = new _Future<T>();
- scheduleMicrotask(() {
- try {
- result._complete(computation());
- } catch (e, s) {
- _completeWithErrorCallback(result, e, s);
- }
- });
- return result;
- }
-
- /**
- * Creates a future containing the result of immediately calling
- * [computation].
- *
- * If calling [computation] throws, the returned future is completed with the
- * error.
- *
- * If calling [computation] returns a [Future], completion of
- * the created future will wait until the returned future completes,
- * and will then complete with the same result.
- *
- * If calling [computation] returns a non-future value,
- * the returned future is completed with that value.
- */
- factory Future.sync(computation()) {
- try {
- var result = computation();
- return new Future<T>.value(result);
- } catch (error, stackTrace) {
- return new Future<T>.error(error, stackTrace);
- }
- }
-
- /**
- * A future whose value is available in the next event-loop iteration.
- *
- * If [value] is not a [Future], using this constructor is equivalent
- * to [:new Future<T>.sync(() => value):].
- *
- * Use [Completer] to create a Future and complete it later.
- */
- factory Future.value([value]) {
- return new _Future<T>.immediate(value);
- }
-
- /**
- * A future that completes with an error in the next event-loop iteration.
- *
- * If [error] is `null`, it is replaced by a [NullThrownError].
- *
- * Use [Completer] to create a future and complete it later.
- */
- factory Future.error(Object error, [StackTrace stackTrace]) {
- error = _nonNullError(error);
- if (!identical(Zone.current, _ROOT_ZONE)) {
- AsyncError replacement = Zone.current.errorCallback(error, stackTrace);
- if (replacement != null) {
- error = _nonNullError(replacement.error);
- stackTrace = replacement.stackTrace;
- }
- }
- return new _Future<T>.immediateError(error, stackTrace);
- }
-
- /**
- * Creates a future that runs its computation after a delay.
- *
- * The [computation] will be executed after the given [duration] has passed,
- * and the future is completed with the result.
- * If the duration is 0 or less,
- * it completes no sooner than in the next event-loop iteration.
- *
- * If [computation] is omitted,
- * it will be treated as if [computation] was set to `() => null`,
- * and the future will eventually complete with the `null` value.
- *
- * If calling [computation] throws, the created future will complete with the
- * error.
- *
- * See also [Completer] for a way to create and complete a future at a
- * later time that isn't necessarily after a known fixed duration.
- */
- factory Future.delayed(Duration duration, [computation()]) {
- _Future<T> result = new _Future<T>();
- new Timer(duration, () {
- try {
- result._complete(computation?.call());
- } catch (e, s) {
- _completeWithErrorCallback(result, e, s);
- }
- });
- return result;
- }
-
- /**
- * Wait for all the given futures to complete and collect their values.
- *
- * Returns a future which will complete once all the futures in a list are
- * complete. If any of the futures in the list completes with an error,
- * the resulting future also completes with an error. Otherwise the value
- * of the returned future will be a list of all the values that were
- * produced.
- *
- * If `eagerError` is true, the future completes with an error immediately on
- * the first error from one of the futures. Otherwise all futures must
- * complete before the returned future is completed (still with the first
- * error to occur, the remaining errors are silently dropped).
- *
- * If [cleanUp] is provided, in the case of an error, any non-null result of
- * a successful future is passed to `cleanUp`, which can then release any
- * resources that the successful operation allocated.
- *
- * The call to `cleanUp` should not throw. If it does, the error will be an
- * uncaught asynchronous error.
- */
- static Future<List<T>> wait<T>(Iterable<Future<T>> futures,
- {bool eagerError: false,
- void cleanUp(T successValue)}) {
- final _Future<List<T>> result = new _Future<List<T>>();
- List<T> values; // Collects the values. Set to null on error.
- int remaining = 0; // How many futures are we waiting for.
- var error; // The first error from a future.
- StackTrace stackTrace; // The stackTrace that came with the error.
-
- // Handle an error from any of the futures.
- void handleError(theError, theStackTrace) {
- remaining--;
- if (values != null) {
- if (cleanUp != null) {
- for (var value in values) {
- if (value != null) {
- // Ensure errors from cleanUp are uncaught.
- new Future.sync(() { cleanUp(value); });
- }
- }
- }
- values = null;
- if (remaining == 0 || eagerError) {
- result._completeError(theError, theStackTrace);
- } else {
- error = theError;
- stackTrace = theStackTrace;
- }
- } else if (remaining == 0 && !eagerError) {
- result._completeError(error, stackTrace);
- }
- }
-
- try {
- // As each future completes, put its value into the corresponding
- // position in the list of values.
- for (Future future in futures) {
- int pos = remaining;
- future.then((T value) {
- remaining--;
- if (values != null) {
- values[pos] = value;
- if (remaining == 0) {
- result._completeWithValue(values);
- }
- } else {
- if (cleanUp != null && value != null) {
- // Ensure errors from cleanUp are uncaught.
- new Future.sync(() { cleanUp(value); });
- }
- if (remaining == 0 && !eagerError) {
- result._completeError(error, stackTrace);
- }
- }
- }, onError: handleError);
- // Increment the 'remaining' after the call to 'then'.
- // If that call throws, we don't expect any future callback from
- // the future, and we also don't increment remaining.
- remaining++;
- }
- if (remaining == 0) {
- return new Future.value(const []);
- }
- values = new List<T>(remaining);
- } catch (e, st) {
- // The error must have been thrown while iterating over the futures
- // list, or while installing a callback handler on the future.
- if (remaining == 0 || eagerError) {
- // Throw a new Future.error.
- // Don't just call `result._completeError` since that would propagate
- // the error too eagerly, not giving the callers time to install
- // error handlers.
- // Also, don't use `_asyncCompleteError` since that one doesn't give
- // zones the chance to intercept the error.
- return new Future.error(e, st);
- } else {
- // Don't allocate a list for values, thus indicating that there was an
- // error.
- // Set error to the caught exception.
- error = e;
- stackTrace = st;
- }
- }
- return result;
- }
-
- /**
- * Returns the result of the first future in [futures] to complete.
- *
- * The returned future is completed with the result of the first
- * future in [futures] to report that it is complete.
- * The results of all the other futures are discarded.
- *
- * If [futures] is empty, or if none of its futures complete,
- * the returned future never completes.
- */
- static Future<T> any<T>(Iterable<Future<T>> futures) {
- var completer = new Completer<T>.sync();
- var onValue = (T value) {
- if (!completer.isCompleted) completer.complete(value);
- };
- var onError = (error, stack) {
- if (!completer.isCompleted) completer.completeError(error, stack);
- };
- for (var future in futures) {
- future.then(onValue, onError: onError);
- }
- return completer.future;
- }
-
-
- /**
- * Perform an async operation for each element of the iterable, in turn.
- *
- * Runs [f] for each element in [input] in order, moving to the next element
- * only when the [Future] returned by [f] completes. Returns a [Future] that
- * completes when all elements have been processed.
- *
- * The return values of all [Future]s are discarded. Any errors will cause the
- * iteration to stop and will be piped through the returned [Future].
- *
- * If [f] returns a non-[Future], iteration continues immediately. Otherwise
- * it waits for the returned [Future] to complete.
- */
- static Future forEach<T>(Iterable<T> input, f(T element)) {
- var iterator = input.iterator;
- return doWhile(() {
- if (!iterator.moveNext()) return false;
- return new Future.sync(() => f(iterator.current)).then((_) => true);
- });
- }
-
- /**
- * Performs an async operation repeatedly until it returns `false`.
- *
- * The function [f] is called repeatedly while it returns either the [bool]
- * value `true` or a [Future] which completes with the value `true`.
- *
- * If a call to [f] returns `false` or a [Future] that completes to `false`,
- * iteration ends and the future returned by [doWhile] is completed.
- *
- * If a future returned by [f] completes with an error, iteration ends and
- * the future returned by [doWhile] completes with the same error.
- *
- * The [f] function must return either a `bool` value or a [Future] completing
- * with a `bool` value.
- */
- static Future doWhile(f()) {
- _Future doneSignal = new _Future();
- var nextIteration;
- // Bind this callback explicitly so that each iteration isn't bound in the
- // context of all the previous iterations' callbacks.
- nextIteration = Zone.current.bindUnaryCallback((bool keepGoing) {
- if (keepGoing) {
- new Future.sync(f).then(nextIteration,
- onError: doneSignal._completeError);
- } else {
- doneSignal._complete(null);
- }
- }, runGuarded: true);
- nextIteration(true);
- return doneSignal;
- }
-
- /**
- * Register callbacks to be called when this future completes.
- *
- * When this future completes with a value,
- * the [onValue] callback will be called with that value.
- * If this future is already completed, the callback will not be called
- * immediately, but will be scheduled in a later microtask.
- *
- * If [onError] is provided, and this future completes with an error,
- * the `onError` callback is called with that error and its stack trace.
- * The `onError` callback must accept either one argument or two arguments.
- * If `onError` accepts two arguments,
- * it is called with both the error and the stack trace,
- * otherwise it is called with just the error object.
- *
- * Returns a new [Future]
- * which is completed with the result of the call to `onValue`
- * (if this future completes with a value)
- * or to `onError` (if this future completes with an error).
- *
- * If the invoked callback throws,
- * the returned future is completed with the thrown error
- * and a stack trace for the error.
- * In the case of `onError`,
- * if the exception thrown is `identical` to the error argument to `onError`,
- * the throw is considered a rethrow,
- * and the original stack trace is used instead.
- *
- * If the callback returns a [Future],
- * the future returned by `then` will be completed with
- * the same result as the future returned by the callback.
- *
- * If [onError] is not given, and this future completes with an error,
- * the error is forwarded directly to the returned future.
- *
- * In most cases, it is more readable to use [catchError] separately, possibly
- * with a `test` parameter, instead of handling both value and error in a
- * single [then] call.
- */
- Future<S> then<S>(FutureOr<S> onValue(T value), { Function onError });
-
- /**
- * Handles errors emitted by this [Future].
- *
- * This is the asynchronous equivalent of a "catch" block.
- *
- * Returns a new [Future] that will be completed with either the result of
- * this future or the result of calling the `onError` callback.
- *
- * If this future completes with a value,
- * the returned future completes with the same value.
- *
- * If this future completes with an error,
- * then [test] is first called with the error value.
- *
- * If `test` returns false, the exception is not handled by this `catchError`,
- * and the returned future completes with the same error and stack trace
- * as this future.
- *
- * If `test` returns `true`,
- * [onError] is called with the error and possibly stack trace,
- * and the returned future is completed with the result of this call
- * in exactly the same way as for [then]'s `onError`.
- *
- * If `test` is omitted, it defaults to a function that always returns true.
- * The `test` function should not throw, but if it does, it is handled as
- * if the `onError` function had thrown.
- *
- * Example:
- *
- * foo
- * .catchError(..., test: (e) => e is ArgumentError)
- * .catchError(..., test: (e) => e is NoSuchMethodError)
- * .then((v) { ... });
- *
- * This method is equivalent to:
- *
- * Future catchError(onError(error),
- * {bool test(error)}) {
- * this.then((v) => v, // Forward the value.
- * // But handle errors, if the [test] succeeds.
- * onError: (e, stackTrace) {
- * if (test == null || test(e)) {
- * if (onError is ZoneBinaryCallback) {
- * return onError(e, stackTrace);
- * }
- * return onError(e);
- * }
- * throw e;
- * });
- * }
- *
- */
- // The `Function` below can stand for several types:
- // - (dynamic) -> T
- // - (dynamic, StackTrace) -> T
- // - (dynamic) -> Future<T>
- // - (dynamic, StackTrace) -> Future<T>
- // Given that there is a `test` function that is usually used to do an
- // `isCheck` we should also expect functions that take a specific argument.
- // Note: making `catchError` return a `Future<T>` in non-strong mode could be
- // a breaking change.
- Future<T> catchError(Function onError,
- {bool test(Object error)});
-
- /**
- * Register a function to be called when this future completes.
- *
- * The [action] function is called when this future completes, whether it
- * does so with a value or with an error.
- *
- * This is the asynchronous equivalent of a "finally" block.
- *
- * The future returned by this call, `f`, will complete the same way
- * as this future unless an error occurs in the [action] call, or in
- * a [Future] returned by the [action] call. If the call to [action]
- * does not return a future, its return value is ignored.
- *
- * If the call to [action] throws, then `f` is completed with the
- * thrown error.
- *
- * If the call to [action] returns a [Future], `f2`, then completion of
- * `f` is delayed until `f2` completes. If `f2` completes with
- * an error, that will be the result of `f` too. The value of `f2` is always
- * ignored.
- *
- * This method is equivalent to:
- *
- * Future<T> whenComplete(action()) {
- * return this.then((v) {
- * var f2 = action();
- * if (f2 is Future) return f2.then((_) => v);
- * return v
- * }, onError: (e) {
- * var f2 = action();
- * if (f2 is Future) return f2.then((_) { throw e; });
- * throw e;
- * });
- * }
- */
- Future<T> whenComplete(action());
-
- /**
- * Creates a [Stream] containing the result of this future.
- *
- * The stream will produce single data or error event containing the
- * completion result of this future, and then it will close with a
- * done event.
- *
- * If the future never completes, the stream will not produce any events.
- */
- Stream<T> asStream();
-
- /**
- * Time-out the future computation after [timeLimit] has passed.
- *
- * Returns a new future that completes with the same value as this future,
- * if this future completes in time.
- *
- * If this future does not complete before `timeLimit` has passed,
- * the [onTimeout] action is executed instead, and its result (whether it
- * returns or throws) is used as the result of the returned future.
- * The [onTimeout] function must return a [T] or a `Future<T>`.
- *
- * If `onTimeout` is omitted, a timeout will cause the returned future to
- * complete with a [TimeoutException].
- */
- Future<T> timeout(Duration timeLimit, {onTimeout()});
-}
-
-/**
- * Thrown when a scheduled timeout happens while waiting for an async result.
- */
-class TimeoutException implements Exception {
- /** Description of the cause of the timeout. */
- final String message;
- /** The duration that was exceeded. */
- final Duration duration;
-
- TimeoutException(this.message, [this.duration]);
-
- String toString() {
- String result = "TimeoutException";
- if (duration != null) result = "TimeoutException after $duration";
- if (message != null) result = "$result: $message";
- return result;
- }
-}
-
-/**
- * A way to produce Future objects and to complete them later
- * with a value or error.
- *
- * Most of the time, the simplest way to create a future is to just use
- * one of the [Future] constructors to capture the result of a single
- * asynchronous computation:
- *
- * new Future(() { doSomething(); return result; });
- *
- * or, if the future represents the result of a sequence of asynchronous
- * computations, they can be chained using [Future.then] or similar functions
- * on [Future]:
- *
- * Future doStuff(){
- * return someAsyncOperation().then((result) {
- * return someOtherAsyncOperation(result);
- * });
- * }
- *
- * If you do need to create a Future from scratch — for example,
- * when you're converting a callback-based API into a Future-based
- * one — you can use a Completer as follows:
- *
- * class AsyncOperation {
- * Completer _completer = new Completer();
- *
- * Future<T> doOperation() {
- * _startOperation();
- * return _completer.future; // Send future object back to client.
- * }
- *
- * // Something calls this when the value is ready.
- * void _finishOperation(T result) {
- * _completer.complete(result);
- * }
- *
- * // If something goes wrong, call this.
- * void _errorHappened(error) {
- * _completer.completeError(error);
- * }
- * }
- */
-abstract class Completer<T> {
-
- /**
- * Creates a new completer.
- *
- * The general workflow for creating a new future is to 1) create a
- * new completer, 2) hand out its future, and, at a later point, 3) invoke
- * either [complete] or [completeError].
- *
- * The completer completes the future asynchronously. That means that
- * callbacks registered on the future, are not called immediately when
- * [complete] or [completeError] is called. Instead the callbacks are
- * delayed until a later microtask.
- *
- * Example:
- *
- * var completer = new Completer();
- * handOut(completer.future);
- * later: {
- * completer.complete('completion value');
- * }
- */
- factory Completer() => new _AsyncCompleter<T>();
-
- /**
- * Completes the future synchronously.
- *
- * This constructor should be avoided unless the completion of the future is
- * known to be the final result of another asynchronous operation. If in doubt
- * use the default [Completer] constructor.
- *
- * Using an normal, asynchronous, completer will never give the wrong
- * behavior, but using a synchronous completer incorrectly can cause
- * otherwise correct programs to break.
- *
- * A synchronous completer is only intended for optimizing event
- * propagation when one asynchronous event immediately triggers another.
- * It should not be used unless the calls to [complete] and [completeError]
- * are guaranteed to occur in places where it won't break `Future` invariants.
- *
- * Completing synchronously means that the completer's future will be
- * completed immediately when calling the [complete] or [completeError]
- * method on a synchronous completer, which also calls any callbacks
- * registered on that future.
- *
- * Completing synchronously must not break the rule that when you add a
- * callback on a future, that callback must not be called until the code
- * that added the callback has completed.
- * For that reason, a synchronous completion must only occur at the very end
- * (in "tail position") of another synchronous event,
- * because at that point, completing the future immediately is be equivalent
- * to returning to the event loop and completing the future in the next
- * microtask.
- *
- * Example:
- *
- * var completer = new Completer.sync();
- * // The completion is the result of the asynchronous onDone event.
- * // No other operation is performed after the completion. It is safe
- * // to use the Completer.sync constructor.
- * stream.listen(print, onDone: () { completer.complete("done"); });
- *
- * Bad example. Do not use this code. Only for illustrative purposes:
- *
- * var completer = new Completer.sync();
- * completer.future.then((_) { bar(); });
- * // The completion is the result of the asynchronous onDone event.
- * // However, there is still code executed after the completion. This
- * // operation is *not* safe.
- * stream.listen(print, onDone: () {
- * completer.complete("done");
- * foo(); // In this case, foo() runs after bar().
- * });
- */
- factory Completer.sync() => new _SyncCompleter<T>();
-
- /** The future that will contain the result provided to this completer. */
- Future<T> get future;
-
- /**
- * Completes [future] with the supplied values.
- *
- * The value must be either a value of type [T]
- * or a future of type `Future<T>`.
- *
- * If the value is itself a future, the completer will wait for that future
- * to complete, and complete with the same result, whether it is a success
- * or an error.
- *
- * Calling `complete` or [completeError] must not be done more than once.
- *
- * All listeners on the future are informed about the value.
- */
- void complete([value]);
-
- /**
- * Complete [future] with an error.
- *
- * Calling [complete] or `completeError` must not be done more than once.
- *
- * Completing a future with an error indicates that an exception was thrown
- * while trying to produce a value.
- *
- * If [error] is `null`, it is replaced by a [NullThrownError].
- *
- * If `error` is a `Future`, the future itself is used as the error value.
- * If you want to complete with the result of the future, you can use:
- *
- * thisCompleter.complete(theFuture)
- *
- * or if you only want to handle an error from the future:
- *
- * theFuture.catchError(thisCompleter.completeError);
- *
- */
- void completeError(Object error, [StackTrace stackTrace]);
-
- /**
- * Whether the future has been completed.
- */
- bool get isCompleted;
-}
-
-// Helper function completing a _Future with error, but checking the zone
-// for error replacement first.
-void _completeWithErrorCallback(_Future result, error, stackTrace) {
- AsyncError replacement = Zone.current.errorCallback(error, stackTrace);
- if (replacement != null) {
- error = _nonNullError(replacement.error);
- stackTrace = replacement.stackTrace;
- }
- result._completeError(error, stackTrace);
-}
-
-/** Helper function that converts `null` to a [NullThrownError]. */
-Object _nonNullError(Object error) =>
- (error != null) ? error : new NullThrownError();
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/async/future_impl.dart b/pkg/dev_compiler/tool/input_sdk/lib/async/future_impl.dart
deleted file mode 100644
index 4e6ba42..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/async/future_impl.dart
+++ /dev/null
@@ -1,746 +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.
-
-part of dart.async;
-
-/** The onValue and onError handlers return either a value or a future */
-typedef dynamic/*T|Future<T>*/ _FutureOnValue<S, T>(S value);
-/** Test used by [Future.catchError] to handle skip some errors. */
-typedef bool _FutureErrorTest(var error);
-/** Used by [WhenFuture]. */
-typedef _FutureAction();
-
-abstract class _Completer<T> implements Completer<T> {
- final _Future<T> future = new _Future<T>();
-
- void complete([value]);
-
- void completeError(Object error, [StackTrace stackTrace]) {
- error = _nonNullError(error);
- if (!future._mayComplete) throw new StateError("Future already completed");
- AsyncError replacement = Zone.current.errorCallback(error, stackTrace);
- if (replacement != null) {
- error = _nonNullError(replacement.error);
- stackTrace = replacement.stackTrace;
- }
- _completeError(error, stackTrace);
- }
-
- void _completeError(Object error, StackTrace stackTrace);
-
- // The future's _isComplete doesn't take into account pending completions.
- // We therefore use _mayComplete.
- bool get isCompleted => !future._mayComplete;
-}
-
-class _AsyncCompleter<T> extends _Completer<T> {
-
- void complete([value]) {
- if (!future._mayComplete) throw new StateError("Future already completed");
- future._asyncComplete(value);
- }
-
- void _completeError(Object error, StackTrace stackTrace) {
- future._asyncCompleteError(error, stackTrace);
- }
-}
-
-class _SyncCompleter<T> extends _Completer<T> {
- void complete([value]) {
- if (!future._mayComplete) throw new StateError("Future already completed");
- future._complete(value);
- }
-
- void _completeError(Object error, StackTrace stackTrace) {
- future._completeError(error, stackTrace);
- }
-}
-
-class _FutureListener<S, T> {
- static const int MASK_VALUE = 1;
- static const int MASK_ERROR = 2;
- static const int MASK_TEST_ERROR = 4;
- static const int MASK_WHENCOMPLETE = 8;
- static const int STATE_CHAIN = 0;
- static const int STATE_THEN = MASK_VALUE;
- // TODO(johnmccutchan): Remove the hard coded value. See #26030.
- static const int STATE_THEN_ONERROR = 3; // MASK_VALUE | MASK_ERROR.
- static const int STATE_CATCHERROR = MASK_ERROR;
- // TODO(johnmccutchan): Remove the hard coded value. See #26030.
- static const int STATE_CATCHERROR_TEST = 6; // MASK_ERROR | MASK_TEST_ERROR.
- static const int STATE_WHENCOMPLETE = MASK_WHENCOMPLETE;
- // Listeners on the same future are linked through this link.
- _FutureListener _nextListener = null;
- // The future to complete when this listener is activated.
- final _Future<T> result;
- // Which fields means what.
- final int state;
- // Used for then/whenDone callback and error test
- final Function callback;
- // Used for error callbacks.
- final Function errorCallback;
-
- _FutureListener.then(this.result,
- _FutureOnValue<S, T> onValue, Function errorCallback)
- : callback = onValue,
- errorCallback = errorCallback,
- state = (errorCallback == null) ? STATE_THEN : STATE_THEN_ONERROR;
-
- _FutureListener.catchError(this.result,
- this.errorCallback, _FutureErrorTest test)
- : callback = test,
- state = (test == null) ? STATE_CATCHERROR : STATE_CATCHERROR_TEST;
-
- _FutureListener.whenComplete(this.result, _FutureAction onComplete)
- : callback = onComplete,
- errorCallback = null,
- state = STATE_WHENCOMPLETE;
-
- Zone get _zone => result._zone;
-
- bool get handlesValue => (state & MASK_VALUE != 0);
- bool get handlesError => (state & MASK_ERROR != 0);
- bool get hasErrorTest => (state == STATE_CATCHERROR_TEST);
- bool get handlesComplete => (state == STATE_WHENCOMPLETE);
-
-
- _FutureOnValue<S, T> get _onValue {
- assert(handlesValue);
- return callback as Object /*=_FutureOnValue<S, T>*/;
- }
- Function get _onError => errorCallback;
- _FutureErrorTest get _errorTest {
- assert(hasErrorTest);
- return callback as Object /*=_FutureErrorTest*/;
- }
- _FutureAction get _whenCompleteAction {
- assert(handlesComplete);
- return callback as Object /*=_FutureAction*/;
- }
-
- /// Whether this listener has an error callback.
- ///
- /// This function must only be called if the listener [handlesError].
- bool get hasErrorCallback {
- assert(handlesError);
- return _onError != null;
- }
-
- dynamic/*T|Future<T>*/ handleValue(S sourceResult) {
- return _zone.runUnary<dynamic/*T|Future<T>*/, S>(
- _onValue, sourceResult);
- }
-
- bool matchesErrorTest(AsyncError asyncError) {
- if (!hasErrorTest) return true;
- _FutureErrorTest test = _errorTest;
- return _zone.runUnary<bool, dynamic>(_errorTest, asyncError.error);
- }
-
- dynamic/*T|Future<T>*/ handleError(AsyncError asyncError) {
- assert(handlesError && hasErrorCallback);
- if (errorCallback is ZoneBinaryCallback) {
- var typedErrorCallback = errorCallback as Object
- /*=ZoneBinaryCallback<Object/*T|Future<T>*/, Object, StackTrace>*/;
- return _zone.runBinary(typedErrorCallback,
- asyncError.error,
- asyncError.stackTrace);
- } else {
- return _zone.runUnary<dynamic/*T|Future<T>*/, dynamic>(
- errorCallback, asyncError.error);
- }
- }
-
- dynamic handleWhenComplete() {
- assert(!handlesError);
- return _zone.run(_whenCompleteAction);
- }
-}
-
-class _Future<T> implements Future<T> {
- /// Initial state, waiting for a result. In this state, the
- /// [resultOrListeners] field holds a single-linked list of
- /// [_FutureListener] listeners.
- static const int _INCOMPLETE = 0;
- /// Pending completion. Set when completed using [_asyncComplete] or
- /// [_asyncCompleteError]. It is an error to try to complete it again.
- /// [resultOrListeners] holds listeners.
- static const int _PENDING_COMPLETE = 1;
- /// The future has been chained to another future. The result of that
- /// other future becomes the result of this future as well.
- /// [resultOrListeners] contains the source future.
- static const int _CHAINED = 2;
- /// The future has been completed with a value result.
- static const int _VALUE = 4;
- /// The future has been completed with an error result.
- static const int _ERROR = 8;
-
- /** Whether the future is complete, and as what. */
- int _state = _INCOMPLETE;
-
- /**
- * Zone that the future was completed from.
- * This is the zone that an error result belongs to.
- *
- * Until the future is completed, the field may hold the zone that
- * listener callbacks used to create this future should be run in.
- */
- final Zone _zone = Zone.current;
-
- /**
- * Either the result, a list of listeners or another future.
- *
- * The result of the future is either a value or an error.
- * A result is only stored when the future has completed.
- *
- * The listeners is an internally linked list of [_FutureListener]s.
- * Listeners are only remembered while the future is not yet complete,
- * and it is not chained to another future.
- *
- * The future is another future that his future is chained to. This future
- * is waiting for the other future to complete, and when it does, this future
- * will complete with the same result.
- * All listeners are forwarded to the other future.
- */
- var _resultOrListeners;
-
- // This constructor is used by async/await.
- _Future();
-
- /// Valid types for value: `T` or `Future<T>`.
- _Future.immediate(value) {
- _asyncComplete(value);
- }
-
- _Future.immediateError(var error, [StackTrace stackTrace]) {
- _asyncCompleteError(error, stackTrace);
- }
-
- bool get _mayComplete => _state == _INCOMPLETE;
- bool get _isPendingComplete => _state == _PENDING_COMPLETE;
- bool get _mayAddListener => _state <= _PENDING_COMPLETE;
- bool get _isChained => _state == _CHAINED;
- bool get _isComplete => _state >= _VALUE;
- bool get _hasError => _state == _ERROR;
-
- void _setChained(_Future source) {
- assert(_mayAddListener);
- _state = _CHAINED;
- _resultOrListeners = source;
- }
-
- Future<E> then<E>(
- FutureOr<E> f(T value), { Function onError }) {
- Zone currentZone = Zone.current;
- ZoneUnaryCallback registered;
- if (!identical(currentZone, _ROOT_ZONE)) {
- f = currentZone.registerUnaryCallback<FutureOr<E>, T>(f);
- if (onError != null) {
- onError = _registerErrorHandler<T>(onError, currentZone);
- }
- }
- return _thenNoZoneRegistration<E>(f, onError);
- }
-
- // This method is used by async/await.
- Future<E> _thenNoZoneRegistration<E>(f(T value), Function onError) {
- _Future<E> result = new _Future<E>();
- _addListener(new _FutureListener<T, E>.then(result, f, onError));
- return result;
- }
-
- Future<T> catchError(Function onError, { bool test(error) }) {
- _Future<T> result = new _Future<T>();
- if (!identical(result._zone, _ROOT_ZONE)) {
- onError = _registerErrorHandler<T>(onError, result._zone);
- if (test != null) test = result._zone.registerUnaryCallback(test);
- }
- _addListener(new _FutureListener<T, T>.catchError(
- result, onError, test));
- return result;
- }
-
- Future<T> whenComplete(action()) {
- _Future<T> result = new _Future<T>();
- if (!identical(result._zone, _ROOT_ZONE)) {
- action = result._zone.registerCallback<dynamic>(action);
- }
- _addListener(new _FutureListener<T, T>.whenComplete(result, action));
- return result;
- }
-
- Stream<T> asStream() => new Stream<T>.fromFuture(this);
-
- void _setPendingComplete() {
- assert(_mayComplete);
- _state = _PENDING_COMPLETE;
- }
-
- void _clearPendingComplete() {
- assert(_isPendingComplete);
- _state = _INCOMPLETE;
- }
-
- AsyncError get _error {
- assert(_hasError);
- return _resultOrListeners;
- }
-
- _Future get _chainSource {
- assert(_isChained);
- return _resultOrListeners;
- }
-
- // This method is used by async/await.
- void _setValue(T value) {
- assert(!_isComplete); // But may have a completion pending.
- _state = _VALUE;
- _resultOrListeners = value;
- }
-
- void _setErrorObject(AsyncError error) {
- assert(!_isComplete); // But may have a completion pending.
- _state = _ERROR;
- _resultOrListeners = error;
- }
-
- void _setError(Object error, StackTrace stackTrace) {
- _setErrorObject(new AsyncError(error, stackTrace));
- }
-
- /// Copy the completion result of [source] into this future.
- ///
- /// Used when a chained future notices that its source is completed.
- void _cloneResult(_Future source) {
- assert(!_isComplete);
- assert(source._isComplete);
- _state = source._state;
- _resultOrListeners = source._resultOrListeners;
- }
-
- void _addListener(_FutureListener listener) {
- assert(listener._nextListener == null);
- if (_mayAddListener) {
- listener._nextListener = _resultOrListeners;
- _resultOrListeners = listener;
- } else {
- if (_isChained) {
- // Delegate listeners to chained source future.
- // If the source is complete, instead copy its values and
- // drop the chaining.
- _Future source = _chainSource;
- if (!source._isComplete) {
- source._addListener(listener);
- return;
- }
- _cloneResult(source);
- }
- assert(_isComplete);
- // Handle late listeners asynchronously.
- _zone.scheduleMicrotask(() {
- _propagateToListeners(this, listener);
- });
- }
- }
-
- void _prependListeners(_FutureListener listeners) {
- if (listeners == null) return;
- if (_mayAddListener) {
- _FutureListener existingListeners = _resultOrListeners;
- _resultOrListeners = listeners;
- if (existingListeners != null) {
- _FutureListener cursor = listeners;
- while (cursor._nextListener != null) {
- cursor = cursor._nextListener;
- }
- cursor._nextListener = existingListeners;
- }
- } else {
- if (_isChained) {
- // Delegate listeners to chained source future.
- // If the source is complete, instead copy its values and
- // drop the chaining.
- _Future source = _chainSource;
- if (!source._isComplete) {
- source._prependListeners(listeners);
- return;
- }
- _cloneResult(source);
- }
- assert(_isComplete);
- listeners = _reverseListeners(listeners);
- _zone.scheduleMicrotask(() {
- _propagateToListeners(this, listeners);
- });
- }
- }
-
- _FutureListener _removeListeners() {
- // Reverse listeners before returning them, so the resulting list is in
- // subscription order.
- assert(!_isComplete);
- _FutureListener current = _resultOrListeners;
- _resultOrListeners = null;
- return _reverseListeners(current);
- }
-
- _FutureListener _reverseListeners(_FutureListener listeners) {
- _FutureListener prev = null;
- _FutureListener current = listeners;
- while (current != null) {
- _FutureListener next = current._nextListener;
- current._nextListener = prev;
- prev = current;
- current = next;
- }
- return prev;
- }
-
- // Take the value (when completed) of source and complete target with that
- // value (or error). This function could chain all Futures, but is slower
- // for _Future than _chainCoreFuture, so you must use _chainCoreFuture
- // in that case.
- static void _chainForeignFuture(Future source, _Future target) {
- assert(!target._isComplete);
- assert(source is! _Future);
-
- // Mark the target as chained (and as such half-completed).
- target._setPendingComplete();
- try {
- source.then((value) {
- assert(target._isPendingComplete);
- // The "value" may be another future if the foreign future
- // implementation is mis-behaving,
- // so use _complete instead of _completeWithValue.
- target._clearPendingComplete(); // Clear this first, it's set again.
- target._complete(value);
- },
- // TODO(floitsch): eventually we would like to make this non-optional
- // and dependent on the listeners of the target future. If none of
- // the target future's listeners want to have the stack trace we don't
- // need a trace.
- onError: (error, [stackTrace]) {
- assert(target._isPendingComplete);
- target._completeError(error, stackTrace);
- });
- } catch (e, s) {
- // This only happens if the `then` call threw synchronously when given
- // valid arguments.
- // That requires a non-conforming implementation of the Future interface,
- // which should, hopefully, never happen.
- scheduleMicrotask(() {
- target._completeError(e, s);
- });
- }
- }
-
- // Take the value (when completed) of source and complete target with that
- // value (or error). This function expects that source is a _Future.
- static void _chainCoreFuture(_Future source, _Future target) {
- assert(target._mayAddListener); // Not completed, not already chained.
- while (source._isChained) {
- source = source._chainSource;
- }
- if (source._isComplete) {
- _FutureListener listeners = target._removeListeners();
- target._cloneResult(source);
- _propagateToListeners(target, listeners);
- } else {
- _FutureListener listeners = target._resultOrListeners;
- target._setChained(source);
- source._prependListeners(listeners);
- }
- }
-
- void _complete(value) {
- assert(!_isComplete);
- if (value is Future) {
- if (value is _Future) {
- _chainCoreFuture(value, this);
- } else {
- _chainForeignFuture(value, this);
- }
- } else {
- _FutureListener listeners = _removeListeners();
- _setValue(value as Object /*=T*/);
- _propagateToListeners(this, listeners);
- }
- }
-
- void _completeWithValue(T value) {
- assert(!_isComplete);
- assert(value is! Future);
-
- _FutureListener listeners = _removeListeners();
- _setValue(value);
- _propagateToListeners(this, listeners);
- }
-
- void _completeError(error, [StackTrace stackTrace]) {
- assert(!_isComplete);
-
- _FutureListener listeners = _removeListeners();
- _setError(error, stackTrace);
- _propagateToListeners(this, listeners);
- }
-
- void _asyncComplete(value) {
- assert(!_isComplete);
- // Two corner cases if the value is a future:
- // 1. the future is already completed and an error.
- // 2. the future is not yet completed but might become an error.
- // The first case means that we must not immediately complete the Future,
- // as our code would immediately start propagating the error without
- // giving the time to install error-handlers.
- // However the second case requires us to deal with the value immediately.
- // Otherwise the value could complete with an error and report an
- // unhandled error, even though we know we are already going to listen to
- // it.
-
- if (value is Future) {
- // Assign to typed variables so we get earlier checks in checked mode.
- Future<T> typedFuture = value as Object /*=Future<T>*/;
- if (typedFuture is _Future) {
- _Future<T> coreFuture = typedFuture;
- if (coreFuture._hasError) {
- // Case 1 from above. Delay completion to enable the user to register
- // callbacks.
- _setPendingComplete();
- _zone.scheduleMicrotask(() {
- _chainCoreFuture(coreFuture, this);
- });
- } else {
- _chainCoreFuture(coreFuture, this);
- }
- } else {
- // Case 2 from above. Chain the future immediately.
- // Note that we are still completing asynchronously (through
- // _chainForeignFuture).
- _chainForeignFuture(typedFuture, this);
- }
- return;
- }
- T typedValue = value as Object /*=T*/;
-
- _setPendingComplete();
- _zone.scheduleMicrotask(() {
- _completeWithValue(typedValue);
- });
- }
-
- void _asyncCompleteError(error, StackTrace stackTrace) {
- assert(!_isComplete);
-
- _setPendingComplete();
- _zone.scheduleMicrotask(() {
- _completeError(error, stackTrace);
- });
- }
-
- /**
- * Propagates the value/error of [source] to its [listeners], executing the
- * listeners' callbacks.
- */
- static void _propagateToListeners(_Future source, _FutureListener listeners) {
- while (true) {
- assert(source._isComplete);
- bool hasError = source._hasError;
- if (listeners == null) {
- if (hasError) {
- AsyncError asyncError = source._error;
- source._zone.handleUncaughtError(
- asyncError.error, asyncError.stackTrace);
- }
- return;
- }
- // Usually futures only have one listener. If they have several, we
- // call handle them separately in recursive calls, continuing
- // here only when there is only one listener left.
- while (listeners._nextListener != null) {
- _FutureListener listener = listeners;
- listeners = listener._nextListener;
- listener._nextListener = null;
- _propagateToListeners(source, listener);
- }
- _FutureListener listener = listeners;
- final sourceResult = source._resultOrListeners;
- // Do the actual propagation.
- // Set initial state of listenerHasError and listenerValueOrError. These
- // variables are updated with the outcome of potential callbacks.
- // Non-error results, including futures, are stored in
- // listenerValueOrError and listenerHasError is set to false. Errors
- // are stored in listenerValueOrError as an [AsyncError] and
- // listenerHasError is set to true.
- bool listenerHasError = hasError;
- var listenerValueOrError = sourceResult;
-
- // Only if we either have an error or callbacks, go into this, somewhat
- // expensive, branch. Here we'll enter/leave the zone. Many futures
- // don't have callbacks, so this is a significant optimization.
- if (hasError || listener.handlesValue || listener.handlesComplete) {
- Zone zone = listener._zone;
- if (hasError && !source._zone.inSameErrorZone(zone)) {
- // Don't cross zone boundaries with errors.
- AsyncError asyncError = source._error;
- source._zone.handleUncaughtError(
- asyncError.error, asyncError.stackTrace);
- return;
- }
-
- Zone oldZone;
- if (!identical(Zone.current, zone)) {
- // Change zone if it's not current.
- oldZone = Zone._enter(zone);
- }
-
- // These callbacks are abstracted to isolate the try/catch blocks
- // from the rest of the code to work around a V8 glass jaw.
- void handleWhenCompleteCallback() {
- // The whenComplete-handler is not combined with normal value/error
- // handling. This means at most one handleX method is called per
- // listener.
- assert(!listener.handlesValue);
- assert(!listener.handlesError);
- var completeResult;
- try {
- completeResult = listener.handleWhenComplete();
- } catch (e, s) {
- if (hasError && identical(source._error.error, e)) {
- listenerValueOrError = source._error;
- } else {
- listenerValueOrError = new AsyncError(e, s);
- }
- listenerHasError = true;
- return;
- }
- if (completeResult is Future) {
- if (completeResult is _Future && completeResult._isComplete) {
- if (completeResult._hasError) {
- listenerValueOrError = completeResult._error;
- listenerHasError = true;
- }
- // Otherwise use the existing result of source.
- return;
- }
- // We have to wait for the completeResult future to complete
- // before knowing if it's an error or we should use the result
- // of source.
- var originalSource = source;
- listenerValueOrError = completeResult.then((_) => originalSource);
- listenerHasError = false;
- }
- }
-
- void handleValueCallback() {
- try {
- listenerValueOrError = listener.handleValue(sourceResult);
- } catch (e, s) {
- listenerValueOrError = new AsyncError(e, s);
- listenerHasError = true;
- }
- }
-
- void handleError() {
- try {
- AsyncError asyncError = source._error;
- if (listener.matchesErrorTest(asyncError) &&
- listener.hasErrorCallback) {
- listenerValueOrError = listener.handleError(asyncError);
- listenerHasError = false;
- }
- } catch (e, s) {
- if (identical(source._error.error, e)) {
- listenerValueOrError = source._error;
- } else {
- listenerValueOrError = new AsyncError(e, s);
- }
- listenerHasError = true;
- }
- }
-
-
- if (listener.handlesComplete) {
- handleWhenCompleteCallback();
- } else if (!hasError) {
- if (listener.handlesValue) {
- handleValueCallback();
- }
- } else {
- if (listener.handlesError) {
- handleError();
- }
- }
-
- // If we changed zone, oldZone will not be null.
- if (oldZone != null) Zone._leave(oldZone);
-
- // If the listener's value is a future we need to chain it. Note that
- // this can only happen if there is a callback.
- if (listenerValueOrError is Future) {
- Future chainSource = listenerValueOrError;
- // Shortcut if the chain-source is already completed. Just continue
- // the loop.
- _Future result = listener.result;
- if (chainSource is _Future) {
- if (chainSource._isComplete) {
- listeners = result._removeListeners();
- result._cloneResult(chainSource);
- source = chainSource;
- continue;
- } else {
- _chainCoreFuture(chainSource, result);
- }
- } else {
- _chainForeignFuture(chainSource, result);
- }
- return;
- }
- }
- _Future result = listener.result;
- listeners = result._removeListeners();
- if (!listenerHasError) {
- result._setValue(listenerValueOrError);
- } else {
- AsyncError asyncError = listenerValueOrError;
- result._setErrorObject(asyncError);
- }
- // Prepare for next round.
- source = result;
- }
- }
-
- Future<T> timeout(Duration timeLimit, {onTimeout()}) {
- if (_isComplete) return new _Future.immediate(this);
- _Future<T> result = new _Future<T>();
- Timer timer;
- if (onTimeout == null) {
- timer = new Timer(timeLimit, () {
- result._completeError(new TimeoutException("Future not completed",
- timeLimit));
- });
- } else {
- Zone zone = Zone.current;
- onTimeout = zone.registerCallback(onTimeout);
- timer = new Timer(timeLimit, () {
- try {
- result._complete(zone.run(onTimeout));
- } catch (e, s) {
- result._completeError(e, s);
- }
- });
- }
- this.then((T v) {
- if (timer.isActive) {
- timer.cancel();
- result._completeWithValue(v);
- }
- }, onError: (e, s) {
- if (timer.isActive) {
- timer.cancel();
- result._completeError(e, s);
- }
- });
- return result;
- }
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/async/schedule_microtask.dart b/pkg/dev_compiler/tool/input_sdk/lib/async/schedule_microtask.dart
deleted file mode 100644
index 70fbeba..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/async/schedule_microtask.dart
+++ /dev/null
@@ -1,154 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-part of dart.async;
-
-typedef void _AsyncCallback();
-
-class _AsyncCallbackEntry {
- final _AsyncCallback callback;
- _AsyncCallbackEntry next;
- _AsyncCallbackEntry(this.callback);
-}
-
-/** Head of single linked list of pending callbacks. */
-_AsyncCallbackEntry _nextCallback;
-/** Tail of single linked list of pending callbacks. */
-_AsyncCallbackEntry _lastCallback;
-/**
- * Tail of priority callbacks added by the currently executing callback.
- *
- * Priority callbacks are put at the beginning of the
- * callback queue, so that if one callback schedules more than one
- * priority callback, they are still enqueued in scheduling order.
- */
-_AsyncCallbackEntry _lastPriorityCallback;
-/**
- * Whether we are currently inside the callback loop.
- *
- * If we are inside the loop, we never need to schedule the loop,
- * even if adding a first element.
- */
-bool _isInCallbackLoop = false;
-
-void _microtaskLoop() {
- while (_nextCallback != null) {
- _lastPriorityCallback = null;
- _AsyncCallbackEntry entry = _nextCallback;
- _nextCallback = entry.next;
- if (_nextCallback == null) _lastCallback = null;
- (entry.callback)();
- }
-}
-
-void _startMicrotaskLoop() {
- _isInCallbackLoop = true;
- try {
- // Moved to separate function because try-finally prevents
- // good optimization.
- _microtaskLoop();
- } finally {
- _lastPriorityCallback = null;
- _isInCallbackLoop = false;
- if (_nextCallback != null) {
- _AsyncRun._scheduleImmediate(_startMicrotaskLoop);
- }
- }
-}
-
-/**
- * Schedules a callback to be called as a microtask.
- *
- * The microtask is called after all other currently scheduled
- * microtasks, but as part of the current system event.
- */
-void _scheduleAsyncCallback(_AsyncCallback callback) {
- _AsyncCallbackEntry newEntry = new _AsyncCallbackEntry(callback);
- if (_nextCallback == null) {
- _nextCallback = _lastCallback = newEntry;
- if (!_isInCallbackLoop) {
- _AsyncRun._scheduleImmediate(_startMicrotaskLoop);
- }
- } else {
- _lastCallback.next = newEntry;
- _lastCallback = newEntry;
- }
-}
-
-/**
- * Schedules a callback to be called before all other currently scheduled ones.
- *
- * This callback takes priority over existing scheduled callbacks.
- * It is only used internally to give higher priority to error reporting.
- *
- * Is always run in the root zone.
- */
-void _schedulePriorityAsyncCallback(_AsyncCallback callback) {
- if (_nextCallback == null) {
- _scheduleAsyncCallback(callback);
- _lastPriorityCallback = _lastCallback;
- return;
- }
- _AsyncCallbackEntry entry = new _AsyncCallbackEntry(callback);
- if (_lastPriorityCallback == null) {
- entry.next = _nextCallback;
- _nextCallback = _lastPriorityCallback = entry;
- } else {
- entry.next = _lastPriorityCallback.next;
- _lastPriorityCallback.next = entry;
- _lastPriorityCallback = entry;
- if (entry.next == null) {
- _lastCallback = entry;
- }
- }
-}
-
-/**
- * Runs a function asynchronously.
- *
- * Callbacks registered through this function are always executed in order and
- * are guaranteed to run before other asynchronous events (like [Timer] events,
- * or DOM events).
- *
- * **Warning:** it is possible to starve the DOM by registering asynchronous
- * callbacks through this method. For example the following program runs
- * the callbacks without ever giving the Timer callback a chance to execute:
- *
- * main() {
- * Timer.run(() { print("executed"); }); // Will never be executed.
- * foo() {
- * scheduleMicrotask(foo); // Schedules [foo] in front of other events.
- * }
- * foo();
- * }
- *
- * ## Other resources
- *
- * * [The Event Loop and Dart](https://www.dartlang.org/articles/event-loop/):
- * Learn how Dart handles the event queue and microtask queue, so you can write
- * better asynchronous code with fewer surprises.
- */
-void scheduleMicrotask(void callback()) {
- _Zone currentZone = Zone.current;
- if (identical(_ROOT_ZONE, currentZone)) {
- // No need to bind the callback. We know that the root's scheduleMicrotask
- // will be invoked in the root zone.
- _rootScheduleMicrotask(null, null, _ROOT_ZONE, callback);
- return;
- }
- _ZoneFunction implementation = currentZone._scheduleMicrotask;
- if (identical(_ROOT_ZONE, implementation.zone) &&
- _ROOT_ZONE.inSameErrorZone(currentZone)) {
- _rootScheduleMicrotask(null, null, currentZone,
- currentZone.registerCallback(callback));
- return;
- }
- Zone.current.scheduleMicrotask(
- Zone.current.bindCallback(callback, runGuarded: true));
-}
-
-class _AsyncRun {
- /** Schedule the given callback before any other event in the event-loop. */
- external static void _scheduleImmediate(void callback());
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/async/stream.dart b/pkg/dev_compiler/tool/input_sdk/lib/async/stream.dart
deleted file mode 100644
index d0b0d0b..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/async/stream.dart
+++ /dev/null
@@ -1,1820 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-part of dart.async;
-
-// -------------------------------------------------------------------
-// Core Stream types
-// -------------------------------------------------------------------
-
-typedef void _TimerCallback();
-
-/**
- * A source of asynchronous data events.
- *
- * A Stream provides a way to receive a sequence of events.
- * Each event is either a data event or an error event,
- * representing the result of a single computation.
- * When the events provided by a Stream have all been sent,
- * a single "done" event will mark the end.
- *
- * You can [listen] on a stream to make it start generating events,
- * and to set up listeners that receive the events.
- * When you listen, you receive a [StreamSubscription] object
- * which is the active object providing the events,
- * and which can be used to stop listening again,
- * or to temporarily pause events from the subscription.
- *
- * There are two kinds of streams: "Single-subscription" streams and
- * "broadcast" streams.
- *
- * *A single-subscription stream* allows only a single listener during the whole
- * lifetime of the stream.
- * It doesn't start generating events until it has a listener,
- * and it stops sending events when the listener is unsubscribed,
- * even if the source of events could still provide more.
- *
- * Listening twice on a single-subscription stream is not allowed, even after
- * the first subscription has been canceled.
- *
- * Single-subscription streams are generally used for streaming chunks of
- * larger contiguous data like file I/O.
- *
- * *A broadcast stream* allows any number of listeners, and it fires
- * its events when they are ready, whether there are listeners or not.
- *
- * Broadcast streams are used for independent events/observers.
- *
- * If several listeners want to listen to a single subscription stream,
- * use [asBroadcastStream] to create a broadcast stream on top of the
- * non-broadcast stream.
- *
- * On either kind of stream, stream transformations, such as [where] and
- * [skip], return the same type of stream as the one the method was called on,
- * unless otherwise noted.
- *
- * When an event is fired, the listener(s) at that time will receive the event.
- * If a listener is added to a broadcast stream while an event is being fired,
- * that listener will not receive the event currently being fired.
- * If a listener is canceled, it immediately stops receiving events.
- *
- * When the "done" event is fired, subscribers are unsubscribed before
- * receiving the event. After the event has been sent, the stream has no
- * subscribers. Adding new subscribers to a broadcast stream after this point
- * is allowed, but they will just receive a new "done" event as soon
- * as possible.
- *
- * Stream subscriptions always respect "pause" requests. If necessary they need
- * to buffer their input, but often, and preferably, they can simply request
- * their input to pause too.
- *
- * The default implementation of [isBroadcast] returns false.
- * A broadcast stream inheriting from [Stream] must override [isBroadcast]
- * to return `true`.
- */
-abstract class Stream<T> {
- Stream();
-
- /**
- * Internal use only. We do not want to promise that Stream stays const.
- *
- * If mixins become compatible with const constructors, we may use a
- * stream mixin instead of extending Stream from a const class.
- */
- const Stream._internal();
-
- /**
- * Creates an empty broadcast stream.
- *
- * This is a stream which does nothing except sending a done event
- * when it's listened to.
- */
- const factory Stream.empty() = _EmptyStream<T>;
-
- /**
- * Creates a new single-subscription stream from the future.
- *
- * When the future completes, the stream will fire one event, either
- * data or error, and then close with a done-event.
- */
- factory Stream.fromFuture(Future<T> future) {
- // Use the controller's buffering to fill in the value even before
- // the stream has a listener. For a single value, it's not worth it
- // to wait for a listener before doing the `then` on the future.
- _StreamController<T> controller = new StreamController<T>(sync: true);
- future.then((value) {
- controller._add(value);
- controller._closeUnchecked();
- },
- onError: (error, stackTrace) {
- controller._addError(error, stackTrace);
- controller._closeUnchecked();
- });
- return controller.stream;
- }
-
- /**
- * Create a stream from a group of futures.
- *
- * The stream reports the results of the futures on the stream in the order
- * in which the futures complete.
- *
- * If some futures have completed before calling `Stream.fromFutures`,
- * their result will be output on the created stream in some unspecified
- * order.
- *
- * When all futures have completed, the stream is closed.
- *
- * If no future is passed, the stream closes as soon as possible.
- */
- factory Stream.fromFutures(Iterable<Future<T>> futures) {
- _StreamController<T> controller = new StreamController<T>(sync: true);
- int count = 0;
- var onValue = (T value) {
- if (!controller.isClosed) {
- controller._add(value);
- if (--count == 0) controller._closeUnchecked();
- }
- };
- var onError = (error, stack) {
- if (!controller.isClosed) {
- controller._addError(error, stack);
- if (--count == 0) controller._closeUnchecked();
- }
- };
- // The futures are already running, so start listening to them immediately
- // (instead of waiting for the stream to be listened on).
- // If we wait, we might not catch errors in the futures in time.
- for (var future in futures) {
- count++;
- future.then(onValue, onError: onError);
- }
- // Use schedule microtask since controller is sync.
- if (count == 0) scheduleMicrotask(controller.close);
- return controller.stream;
- }
-
- /**
- * Creates a single-subscription stream that gets its data from [data].
- *
- * The iterable is iterated when the stream receives a listener, and stops
- * iterating if the listener cancels the subscription.
- *
- * If iterating [data] throws an error, the stream ends immediately with
- * that error. No done event will be sent (iteration is not complete), but no
- * further data events will be generated either, since iteration cannot
- * continue.
- */
- factory Stream.fromIterable(Iterable<T> data) {
- return new _GeneratedStreamImpl<T>(
- () => new _IterablePendingEvents<T>(data));
- }
-
- /**
- * Creates a stream that repeatedly emits events at [period] intervals.
- *
- * The event values are computed by invoking [computation]. The argument to
- * this callback is an integer that starts with 0 and is incremented for
- * every event.
- *
- * If [computation] is omitted the event values will all be `null`.
- */
- factory Stream.periodic(Duration period,
- [T computation(int computationCount)]) {
- Timer timer;
- int computationCount = 0;
- StreamController<T> controller;
- // Counts the time that the Stream was running (and not paused).
- Stopwatch watch = new Stopwatch();
-
- void sendEvent() {
- watch.reset();
- T data;
- if (computation != null) {
- try {
- data = computation(computationCount++);
- } catch (e, s) {
- controller.addError(e, s);
- return;
- }
- }
- controller.add(data);
- }
-
- void startPeriodicTimer() {
- assert(timer == null);
- timer = new Timer.periodic(period, (Timer timer) {
- sendEvent();
- });
- }
-
- controller = new StreamController<T>(sync: true,
- onListen: () {
- watch.start();
- startPeriodicTimer();
- },
- onPause: () {
- timer.cancel();
- timer = null;
- watch.stop();
- },
- onResume: () {
- assert(timer == null);
- Duration elapsed = watch.elapsed;
- watch.start();
- timer = new Timer(period - elapsed, () {
- timer = null;
- startPeriodicTimer();
- sendEvent();
- });
- },
- onCancel: () {
- if (timer != null) timer.cancel();
- timer = null;
- });
- return controller.stream;
- }
-
- /**
- * Creates a stream where all events of an existing stream are piped through
- * a sink-transformation.
- *
- * The given [mapSink] closure is invoked when the returned stream is
- * listened to. All events from the [source] are added into the event sink
- * that is returned from the invocation. The transformation puts all
- * transformed events into the sink the [mapSink] closure received during
- * its invocation. Conceptually the [mapSink] creates a transformation pipe
- * with the input sink being the returned [EventSink] and the output sink
- * being the sink it received.
- *
- * This constructor is frequently used to build transformers.
- *
- * Example use for a duplicating transformer:
- *
- * class DuplicationSink implements EventSink<String> {
- * final EventSink<String> _outputSink;
- * DuplicationSink(this._outputSink);
- *
- * void add(String data) {
- * _outputSink.add(data);
- * _outputSink.add(data);
- * }
- *
- * void addError(e, [st]) { _outputSink.addError(e, st); }
- * void close() { _outputSink.close(); }
- * }
- *
- * class DuplicationTransformer implements StreamTransformer<String, String> {
- * // Some generic types ommitted for brevety.
- * Stream bind(Stream stream) => new Stream<String>.eventTransformed(
- * stream,
- * (EventSink sink) => new DuplicationSink(sink));
- * }
- *
- * stringStream.transform(new DuplicationTransformer());
- *
- * The resulting stream is a broadcast stream if [source] is.
- */
- factory Stream.eventTransformed(Stream source,
- EventSink mapSink(EventSink<T> sink)) {
- return new _BoundSinkStream(source, mapSink);
- }
-
- /**
- * Reports whether this stream is a broadcast stream.
- */
- bool get isBroadcast => false;
-
- /**
- * Returns a multi-subscription stream that produces the same events as this.
- *
- * The returned stream will subscribe to this stream when its first
- * subscriber is added, and will stay subscribed until this stream ends,
- * or a callback cancels the subscription.
- *
- * If [onListen] is provided, it is called with a subscription-like object
- * that represents the underlying subscription to this stream. It is
- * possible to pause, resume or cancel the subscription during the call
- * to [onListen]. It is not possible to change the event handlers, including
- * using [StreamSubscription.asFuture].
- *
- * If [onCancel] is provided, it is called in a similar way to [onListen]
- * when the returned stream stops having listener. If it later gets
- * a new listener, the [onListen] function is called again.
- *
- * Use the callbacks, for example, for pausing the underlying subscription
- * while having no subscribers to prevent losing events, or canceling the
- * subscription when there are no listeners.
- */
- Stream<T> asBroadcastStream({
- void onListen(StreamSubscription<T> subscription),
- void onCancel(StreamSubscription<T> subscription) }) {
- return new _AsBroadcastStream<T>(this, onListen, onCancel);
- }
-
- /**
- * Adds a subscription to this stream.
- *
- * On each data event from this stream, the subscriber's [onData] handler
- * is called. If [onData] is null, nothing happens.
- *
- * On errors from this stream, the [onError] handler is given a
- * object describing the error.
- *
- * The [onError] callback must be of type `void onError(error)` or
- * `void onError(error, StackTrace stackTrace)`. If [onError] accepts
- * two arguments it is called with the stack trace (which could be `null` if
- * the stream itself received an error without stack trace).
- * Otherwise it is called with just the error object.
- * If [onError] is omitted, any errors on the stream are considered unhandled,
- * and will be passed to the current [Zone]'s error handler.
- * By default unhandled async errors are treated
- * as if they were uncaught top-level errors.
- *
- * If this stream closes, the [onDone] handler is called.
- *
- * If [cancelOnError] is true, the subscription is ended when
- * the first error is reported. The default is false.
- */
- StreamSubscription<T> listen(void onData(T event),
- { Function onError,
- void onDone(),
- bool cancelOnError});
-
- /**
- * Creates a new stream from this stream that discards some data events.
- *
- * The new stream sends the same error and done events as this stream,
- * but it only sends the data events that satisfy the [test].
- *
- * The returned stream is a broadcast stream if this stream is.
- * If a broadcast stream is listened to more than once, each subscription
- * will individually perform the `test`.
- */
- Stream<T> where(bool test(T event)) {
- return new _WhereStream<T>(this, test);
- }
-
- /**
- * Creates a new stream that converts each element of this stream
- * to a new value using the [convert] function.
- *
- * For each data event, `o`, in this stream, the returned stream
- * provides a data event with the value `convert(o)`.
- * If [convert] throws, the returned stream reports the exception as an error
- * event instead.
- *
- * Error and done events are passed through unchanged to the returned stream.
- *
- * The returned stream is a broadcast stream if this stream is.
- * The [convert] function is called once per data event per listener.
- * If a broadcast stream is listened to more than once, each subscription
- * will individually call [convert] on each data event.
- */
- Stream/*<S>*/ map/*<S>*/(/*=S*/ convert(T event)) {
- return new _MapStream<T, dynamic/*=S*/>(this, convert);
- }
-
- /**
- * Creates a new stream with each data event of this stream asynchronously
- * mapped to a new event.
- *
- * This acts like [map], except that [convert] may return a [Future],
- * and in that case, the stream waits for that future to complete before
- * continuing with its result.
- *
- * The returned stream is a broadcast stream if this stream is.
- */
- Stream/*<E>*/ asyncMap/*<E>*/(convert(T event)) {
- StreamController/*<E>*/ controller;
- StreamSubscription/*<T>*/ subscription;
-
- void onListen() {
- final add = controller.add;
- assert(controller is _StreamController ||
- controller is _BroadcastStreamController);
- final _EventSink/*<E>*/ eventSink =
- controller as Object /*=_EventSink<E>*/;
- final addError = eventSink._addError;
- subscription = this.listen(
- (T event) {
- dynamic newValue;
- try {
- newValue = convert(event);
- } catch (e, s) {
- controller.addError(e, s);
- return;
- }
- if (newValue is Future) {
- subscription.pause();
- newValue.then(add, onError: addError)
- .whenComplete(subscription.resume);
- } else {
- controller.add(newValue as Object/*=E*/);
- }
- },
- onError: addError,
- onDone: controller.close
- );
- }
-
- if (this.isBroadcast) {
- controller = new StreamController/*<E>*/.broadcast(
- onListen: onListen,
- onCancel: () { subscription.cancel(); },
- sync: true
- );
- } else {
- controller = new StreamController/*<E>*/(
- onListen: onListen,
- onPause: () { subscription.pause(); },
- onResume: () { subscription.resume(); },
- onCancel: () { subscription.cancel(); },
- sync: true
- );
- }
- return controller.stream;
- }
-
- /**
- * Creates a new stream with the events of a stream per original event.
- *
- * This acts like [expand], except that [convert] returns a [Stream]
- * instead of an [Iterable].
- * The events of the returned stream becomes the events of the returned
- * stream, in the order they are produced.
- *
- * If [convert] returns `null`, no value is put on the output stream,
- * just as if it returned an empty stream.
- *
- * The returned stream is a broadcast stream if this stream is.
- */
- Stream/*<E>*/ asyncExpand/*<E>*/(Stream/*<E>*/ convert(T event)) {
- StreamController/*<E>*/ controller;
- StreamSubscription<T> subscription;
- void onListen() {
- assert(controller is _StreamController ||
- controller is _BroadcastStreamController);
- final _EventSink/*<E>*/ eventSink =
- controller as Object /*=_EventSink<E>*/;
- subscription = this.listen(
- (T event) {
- Stream/*<E>*/ newStream;
- try {
- newStream = convert(event);
- } catch (e, s) {
- controller.addError(e, s);
- return;
- }
- if (newStream != null) {
- subscription.pause();
- controller.addStream(newStream)
- .whenComplete(subscription.resume);
- }
- },
- onError: eventSink._addError, // Avoid Zone error replacement.
- onDone: controller.close
- );
- }
- if (this.isBroadcast) {
- controller = new StreamController/*<E>*/.broadcast(
- onListen: onListen,
- onCancel: () { subscription.cancel(); },
- sync: true
- );
- } else {
- controller = new StreamController/*<E>*/(
- onListen: onListen,
- onPause: () { subscription.pause(); },
- onResume: () { subscription.resume(); },
- onCancel: () { subscription.cancel(); },
- sync: true
- );
- }
- return controller.stream;
- }
-
- /**
- * Creates a wrapper Stream that intercepts some errors from this stream.
- *
- * If this stream sends an error that matches [test], then it is intercepted
- * by the [handle] function.
- *
- * The [onError] callback must be of type `void onError(error)` or
- * `void onError(error, StackTrace stackTrace)`. Depending on the function
- * type the stream either invokes [onError] with or without a stack
- * trace. The stack trace argument might be `null` if the stream itself
- * received an error without stack trace.
- *
- * An asynchronous error [:e:] is matched by a test function if [:test(e):]
- * returns true. If [test] is omitted, every error is considered matching.
- *
- * If the error is intercepted, the [handle] function can decide what to do
- * with it. It can throw if it wants to raise a new (or the same) error,
- * or simply return to make the stream forget the error.
- *
- * If you need to transform an error into a data event, use the more generic
- * [Stream.transform] to handle the event by writing a data event to
- * the output sink.
- *
- * The returned stream is a broadcast stream if this stream is.
- * If a broadcast stream is listened to more than once, each subscription
- * will individually perform the `test` and handle the error.
- */
- Stream<T> handleError(Function onError, { bool test(error) }) {
- return new _HandleErrorStream<T>(this, onError, test);
- }
-
- /**
- * Creates a new stream from this stream that converts each element
- * into zero or more events.
- *
- * Each incoming event is converted to an [Iterable] of new events,
- * and each of these new events are then sent by the returned stream
- * in order.
- *
- * The returned stream is a broadcast stream if this stream is.
- * If a broadcast stream is listened to more than once, each subscription
- * will individually call `convert` and expand the events.
- */
- Stream/*<S>*/ expand/*<S>*/(Iterable/*<S>*/ convert(T value)) {
- return new _ExpandStream<T, dynamic/*=S*/>(this, convert);
- }
-
- /**
- * Pipe the events of this stream into [streamConsumer].
- *
- * The events of this stream are added to `streamConsumer` using
- * [StreamConsumer.addStream].
- * The `streamConsumer` is closed when this stream has been successfully added
- * to it - when the future returned by `addStream` completes without an error.
- *
- * Returns a future which completes when the stream has been consumed
- * and the consumer has been closed.
- *
- * The returned future completes with the same result as the future returned
- * by [StreamConsumer.close].
- * If the adding of the stream itself fails in some way,
- * then the consumer is expected to be closed, and won't be closed again.
- * In that case the returned future completes with the error from calling
- * `addStream`.
- */
- Future pipe(StreamConsumer<T> streamConsumer) {
- return streamConsumer.addStream(this).then((_) => streamConsumer.close());
- }
-
- /**
- * Chains this stream as the input of the provided [StreamTransformer].
- *
- * Returns the result of [:streamTransformer.bind:] itself.
- *
- * The `streamTransformer` can decide whether it wants to return a
- * broadcast stream or not.
- */
- Stream/*<S>*/ transform/*<S>*/(
- StreamTransformer<T, dynamic/*=S*/ > streamTransformer) {
- return streamTransformer.bind(this);
- }
-
- /**
- * Reduces a sequence of values by repeatedly applying [combine].
- */
- Future<T> reduce(T combine(T previous, T element)) {
- _Future<T> result = new _Future<T>();
- bool seenFirst = false;
- T value;
- StreamSubscription subscription;
- subscription = this.listen(
- (T element) {
- if (seenFirst) {
- _runUserCode(() => combine(value, element),
- (T newValue) { value = newValue; },
- _cancelAndErrorClosure(subscription, result));
- } else {
- value = element;
- seenFirst = true;
- }
- },
- onError: result._completeError,
- onDone: () {
- if (!seenFirst) {
- try {
- throw IterableElementError.noElement();
- } catch (e, s) {
- _completeWithErrorCallback(result, e, s);
- }
- } else {
- result._complete(value);
- }
- },
- cancelOnError: true
- );
- return result;
- }
-
- /** Reduces a sequence of values by repeatedly applying [combine]. */
- Future/*<S>*/ fold/*<S>*/(var/*=S*/ initialValue,
- /*=S*/ combine(var/*=S*/ previous, T element)) {
-
- _Future/*<S>*/ result = new _Future/*<S>*/();
- var/*=S*/ value = initialValue;
- StreamSubscription subscription;
- subscription = this.listen(
- (T element) {
- _runUserCode(
- () => combine(value, element),
- (/*=S*/ newValue) { value = newValue; },
- _cancelAndErrorClosure(subscription, result)
- );
- },
- onError: (e, st) {
- result._completeError(e, st);
- },
- onDone: () {
- result._complete(value);
- },
- cancelOnError: true);
- return result;
- }
-
- /**
- * Collects string of data events' string representations.
- *
- * If [separator] is provided, it is inserted between any two
- * elements.
- *
- * Any error in the stream causes the future to complete with that
- * error. Otherwise it completes with the collected string when
- * the "done" event arrives.
- */
- Future<String> join([String separator = ""]) {
- _Future<String> result = new _Future<String>();
- StringBuffer buffer = new StringBuffer();
- StreamSubscription subscription;
- bool first = true;
- subscription = this.listen(
- (T element) {
- if (!first) {
- buffer.write(separator);
- }
- first = false;
- try {
- buffer.write(element);
- } catch (e, s) {
- _cancelAndErrorWithReplacement(subscription, result, e, s);
- }
- },
- onError: (e) {
- result._completeError(e);
- },
- onDone: () {
- result._complete(buffer.toString());
- },
- cancelOnError: true);
- return result;
- }
-
- /**
- * Checks whether [needle] occurs in the elements provided by this stream.
- *
- * Completes the [Future] when the answer is known.
- * If this stream reports an error, the [Future] will report that error.
- */
- Future<bool> contains(Object needle) {
- _Future<bool> future = new _Future<bool>();
- StreamSubscription subscription;
- subscription = this.listen(
- (T element) {
- _runUserCode(
- () => (element == needle),
- (bool isMatch) {
- if (isMatch) {
- _cancelAndValue(subscription, future, true);
- }
- },
- _cancelAndErrorClosure(subscription, future)
- );
- },
- onError: future._completeError,
- onDone: () {
- future._complete(false);
- },
- cancelOnError: true);
- return future;
- }
-
- /**
- * Executes [action] on each data event of the stream.
- *
- * Completes the returned [Future] when all events of the stream
- * have been processed. Completes the future with an error if the
- * stream has an error event, or if [action] throws.
- */
- Future forEach(void action(T element)) {
- _Future future = new _Future();
- StreamSubscription subscription;
- subscription = this.listen(
- (T element) {
- _runUserCode(
- () => action(element),
- (_) {},
- _cancelAndErrorClosure(subscription, future)
- );
- },
- onError: future._completeError,
- onDone: () {
- future._complete(null);
- },
- cancelOnError: true);
- return future;
- }
-
- /**
- * Checks whether [test] accepts all elements provided by this stream.
- *
- * Completes the [Future] when the answer is known.
- * If this stream reports an error, the [Future] will report that error.
- */
- Future<bool> every(bool test(T element)) {
- _Future<bool> future = new _Future<bool>();
- StreamSubscription subscription;
- subscription = this.listen(
- (T element) {
- _runUserCode(
- () => test(element),
- (bool isMatch) {
- if (!isMatch) {
- _cancelAndValue(subscription, future, false);
- }
- },
- _cancelAndErrorClosure(subscription, future)
- );
- },
- onError: future._completeError,
- onDone: () {
- future._complete(true);
- },
- cancelOnError: true);
- return future;
- }
-
- /**
- * Checks whether [test] accepts any element provided by this stream.
- *
- * Completes the [Future] when the answer is known.
- *
- * If this stream reports an error, the [Future] reports that error.
- *
- * Stops listening to the stream after the first matching element has been
- * found.
- *
- * Internally the method cancels its subscription after this element. This
- * means that single-subscription (non-broadcast) streams are closed and
- * cannot be reused after a call to this method.
- */
- Future<bool> any(bool test(T element)) {
- _Future<bool> future = new _Future<bool>();
- StreamSubscription subscription;
- subscription = this.listen(
- (T element) {
- _runUserCode(
- () => test(element),
- (bool isMatch) {
- if (isMatch) {
- _cancelAndValue(subscription, future, true);
- }
- },
- _cancelAndErrorClosure(subscription, future)
- );
- },
- onError: future._completeError,
- onDone: () {
- future._complete(false);
- },
- cancelOnError: true);
- return future;
- }
-
-
- /** Counts the elements in the stream. */
- Future<int> get length {
- _Future<int> future = new _Future<int>();
- int count = 0;
- this.listen(
- (_) { count++; },
- onError: future._completeError,
- onDone: () {
- future._complete(count);
- },
- cancelOnError: true);
- return future;
- }
-
- /**
- * Reports whether this stream contains any elements.
- *
- * Stops listening to the stream after the first element has been received.
- *
- * Internally the method cancels its subscription after the first element.
- * This means that single-subscription (non-broadcast) streams are closed and
- * cannot be reused after a call to this getter.
- */
- Future<bool> get isEmpty {
- _Future<bool> future = new _Future<bool>();
- StreamSubscription subscription;
- subscription = this.listen(
- (_) {
- _cancelAndValue(subscription, future, false);
- },
- onError: future._completeError,
- onDone: () {
- future._complete(true);
- },
- cancelOnError: true);
- return future;
- }
-
- /** Collects the data of this stream in a [List]. */
- Future<List<T>> toList() {
- List<T> result = <T>[];
- _Future<List<T>> future = new _Future<List<T>>();
- this.listen(
- (T data) {
- result.add(data);
- },
- onError: future._completeError,
- onDone: () {
- future._complete(result);
- },
- cancelOnError: true);
- return future;
- }
-
- /**
- * Collects the data of this stream in a [Set].
- *
- * The returned set is the same type as returned by `new Set<T>()`.
- * If another type of set is needed, either use [forEach] to add each
- * element to the set, or use
- * `toList().then((list) => new SomeOtherSet.from(list))`
- * to create the set.
- */
- Future<Set<T>> toSet() {
- Set<T> result = new Set<T>();
- _Future<Set<T>> future = new _Future<Set<T>>();
- this.listen(
- (T data) {
- result.add(data);
- },
- onError: future._completeError,
- onDone: () {
- future._complete(result);
- },
- cancelOnError: true);
- return future;
- }
-
- /**
- * Discards all data on the stream, but signals when it's done or an error
- * occured.
- *
- * When subscribing using [drain], cancelOnError will be true. This means
- * that the future will complete with the first error on the stream and then
- * cancel the subscription.
- *
- * In case of a `done` event the future completes with the given
- * [futureValue].
- */
- Future/*<E>*/ drain/*<E>*/([/*=E*/ futureValue])
- => listen(null, cancelOnError: true).asFuture/*<E>*/(futureValue);
-
- /**
- * Provides at most the first [n] values of this stream.
- *
- * Forwards the first [n] data events of this stream, and all error
- * events, to the returned stream, and ends with a done event.
- *
- * If this stream produces fewer than [count] values before it's done,
- * so will the returned stream.
- *
- * Stops listening to the stream after the first [n] elements have been
- * received.
- *
- * Internally the method cancels its subscription after these elements. This
- * means that single-subscription (non-broadcast) streams are closed and
- * cannot be reused after a call to this method.
- *
- * The returned stream is a broadcast stream if this stream is.
- * For a broadcast stream, the events are only counted from the time
- * the returned stream is listened to.
- */
- Stream<T> take(int count) {
- return new _TakeStream<T>(this, count);
- }
-
- /**
- * Forwards data events while [test] is successful.
- *
- * The returned stream provides the same events as this stream as long
- * as [test] returns [:true:] for the event data. The stream is done
- * when either this stream is done, or when this stream first provides
- * a value that [test] doesn't accept.
- *
- * Stops listening to the stream after the accepted elements.
- *
- * Internally the method cancels its subscription after these elements. This
- * means that single-subscription (non-broadcast) streams are closed and
- * cannot be reused after a call to this method.
- *
- * The returned stream is a broadcast stream if this stream is.
- * For a broadcast stream, the events are only tested from the time
- * the returned stream is listened to.
- */
- Stream<T> takeWhile(bool test(T element)) {
- return new _TakeWhileStream<T>(this, test);
- }
-
- /**
- * Skips the first [count] data events from this stream.
- *
- * The returned stream is a broadcast stream if this stream is.
- * For a broadcast stream, the events are only counted from the time
- * the returned stream is listened to.
- */
- Stream<T> skip(int count) {
- return new _SkipStream<T>(this, count);
- }
-
- /**
- * Skip data events from this stream while they are matched by [test].
- *
- * Error and done events are provided by the returned stream unmodified.
- *
- * Starting with the first data event where [test] returns false for the
- * event data, the returned stream will have the same events as this stream.
- *
- * The returned stream is a broadcast stream if this stream is.
- * For a broadcast stream, the events are only tested from the time
- * the returned stream is listened to.
- */
- Stream<T> skipWhile(bool test(T element)) {
- return new _SkipWhileStream<T>(this, test);
- }
-
- /**
- * Skips data events if they are equal to the previous data event.
- *
- * The returned stream provides the same events as this stream, except
- * that it never provides two consecutive data events that are equal.
- *
- * Equality is determined by the provided [equals] method. If that is
- * omitted, the '==' operator on the last provided data element is used.
- *
- * The returned stream is a broadcast stream if this stream is.
- * If a broadcast stream is listened to more than once, each subscription
- * will individually perform the `equals` test.
- */
- Stream<T> distinct([bool equals(T previous, T next)]) {
- return new _DistinctStream<T>(this, equals);
- }
-
- /**
- * Returns the first element of the stream.
- *
- * Stops listening to the stream after the first element has been received.
- *
- * Internally the method cancels its subscription after the first element.
- * This means that single-subscription (non-broadcast) streams are closed
- * and cannot be reused after a call to this getter.
- *
- * If an error event occurs before the first data event, the resulting future
- * is completed with that error.
- *
- * If this stream is empty (a done event occurs before the first data event),
- * the resulting future completes with a [StateError].
- *
- * Except for the type of the error, this method is equivalent to
- * [:this.elementAt(0):].
- */
- Future<T> get first {
- _Future<T> future = new _Future<T>();
- StreamSubscription subscription;
- subscription = this.listen(
- (T value) {
- _cancelAndValue(subscription, future, value);
- },
- onError: future._completeError,
- onDone: () {
- try {
- throw IterableElementError.noElement();
- } catch (e, s) {
- _completeWithErrorCallback(future, e, s);
- }
- },
- cancelOnError: true);
- return future;
- }
-
- /**
- * Returns the last element of the stream.
- *
- * If an error event occurs before the first data event, the resulting future
- * is completed with that error.
- *
- * If this stream is empty (a done event occurs before the first data event),
- * the resulting future completes with a [StateError].
- */
- Future<T> get last {
- _Future<T> future = new _Future<T>();
- T result = null;
- bool foundResult = false;
- listen(
- (T value) {
- foundResult = true;
- result = value;
- },
- onError: future._completeError,
- onDone: () {
- if (foundResult) {
- future._complete(result);
- return;
- }
- try {
- throw IterableElementError.noElement();
- } catch (e, s) {
- _completeWithErrorCallback(future, e, s);
- }
- },
- cancelOnError: true);
- return future;
- }
-
- /**
- * Returns the single element.
- *
- * If an error event occurs before or after the first data event, the
- * resulting future is completed with that error.
- *
- * If [this] is empty or has more than one element throws a [StateError].
- */
- Future<T> get single {
- _Future<T> future = new _Future<T>();
- T result = null;
- bool foundResult = false;
- StreamSubscription subscription;
- subscription = this.listen(
- (T value) {
- if (foundResult) {
- // This is the second element we get.
- try {
- throw IterableElementError.tooMany();
- } catch (e, s) {
- _cancelAndErrorWithReplacement(subscription, future, e, s);
- }
- return;
- }
- foundResult = true;
- result = value;
- },
- onError: future._completeError,
- onDone: () {
- if (foundResult) {
- future._complete(result);
- return;
- }
- try {
- throw IterableElementError.noElement();
- } catch (e, s) {
- _completeWithErrorCallback(future, e, s);
- }
- },
- cancelOnError: true);
- return future;
- }
-
- /**
- * Finds the first element of this stream matching [test].
- *
- * Returns a future that is filled with the first element of this stream
- * that [test] returns true for.
- *
- * If no such element is found before this stream is done, and a
- * [defaultValue] function is provided, the result of calling [defaultValue]
- * becomes the value of the future.
- *
- * Stops listening to the stream after the first matching element has been
- * received.
- *
- * Internally the method cancels its subscription after the first element that
- * matches the predicate. This means that single-subscription (non-broadcast)
- * streams are closed and cannot be reused after a call to this method.
- *
- * If an error occurs, or if this stream ends without finding a match and
- * with no [defaultValue] function provided, the future will receive an
- * error.
- */
- Future<dynamic> firstWhere(bool test(T element), {Object defaultValue()}) {
- _Future<dynamic> future = new _Future();
- StreamSubscription subscription;
- subscription = this.listen(
- (T value) {
- _runUserCode(
- () => test(value),
- (bool isMatch) {
- if (isMatch) {
- _cancelAndValue(subscription, future, value);
- }
- },
- _cancelAndErrorClosure(subscription, future)
- );
- },
- onError: future._completeError,
- onDone: () {
- if (defaultValue != null) {
- _runUserCode(defaultValue, future._complete, future._completeError);
- return;
- }
- try {
- throw IterableElementError.noElement();
- } catch (e, s) {
- _completeWithErrorCallback(future, e, s);
- }
- },
- cancelOnError: true);
- return future;
- }
-
- /**
- * Finds the last element in this stream matching [test].
- *
- * As [firstWhere], except that the last matching element is found.
- * That means that the result cannot be provided before this stream
- * is done.
- */
- Future<dynamic> lastWhere(bool test(T element), {Object defaultValue()}) {
- _Future<dynamic> future = new _Future();
- T result = null;
- bool foundResult = false;
- StreamSubscription subscription;
- subscription = this.listen(
- (T value) {
- _runUserCode(
- () => true == test(value),
- (bool isMatch) {
- if (isMatch) {
- foundResult = true;
- result = value;
- }
- },
- _cancelAndErrorClosure(subscription, future)
- );
- },
- onError: future._completeError,
- onDone: () {
- if (foundResult) {
- future._complete(result);
- return;
- }
- if (defaultValue != null) {
- _runUserCode(defaultValue, future._complete, future._completeError);
- return;
- }
- try {
- throw IterableElementError.noElement();
- } catch (e, s) {
- _completeWithErrorCallback(future, e, s);
- }
- },
- cancelOnError: true);
- return future;
- }
-
- /**
- * Finds the single element in this stream matching [test].
- *
- * Like [lastMatch], except that it is an error if more than one
- * matching element occurs in the stream.
- */
- Future<T> singleWhere(bool test(T element)) {
- _Future<T> future = new _Future<T>();
- T result = null;
- bool foundResult = false;
- StreamSubscription subscription;
- subscription = this.listen(
- (T value) {
- _runUserCode(
- () => true == test(value),
- (bool isMatch) {
- if (isMatch) {
- if (foundResult) {
- try {
- throw IterableElementError.tooMany();
- } catch (e, s) {
- _cancelAndErrorWithReplacement(subscription, future, e, s);
- }
- return;
- }
- foundResult = true;
- result = value;
- }
- },
- _cancelAndErrorClosure(subscription, future)
- );
- },
- onError: future._completeError,
- onDone: () {
- if (foundResult) {
- future._complete(result);
- return;
- }
- try {
- throw IterableElementError.noElement();
- } catch (e, s) {
- _completeWithErrorCallback(future, e, s);
- }
- },
- cancelOnError: true);
- return future;
- }
-
- /**
- * Returns the value of the [index]th data event of this stream.
- *
- * Stops listening to the stream after the [index]th data event has been
- * received.
- *
- * Internally the method cancels its subscription after these elements. This
- * means that single-subscription (non-broadcast) streams are closed and
- * cannot be reused after a call to this method.
- *
- * If an error event occurs before the value is found, the future completes
- * with this error.
- *
- * If a done event occurs before the value is found, the future completes
- * with a [RangeError].
- */
- Future<T> elementAt(int index) {
- if (index is! int || index < 0) throw new ArgumentError(index);
- _Future<T> future = new _Future<T>();
- StreamSubscription subscription;
- int elementIndex = 0;
- subscription = this.listen(
- (T value) {
- if (index == elementIndex) {
- _cancelAndValue(subscription, future, value);
- return;
- }
- elementIndex += 1;
- },
- onError: future._completeError,
- onDone: () {
- future._completeError(
- new RangeError.index(index, this, "index", null, elementIndex));
- },
- cancelOnError: true);
- return future;
- }
-
- /**
- * Creates a new stream with the same events as this stream.
- *
- * Whenever more than [timeLimit] passes between two events from this stream,
- * the [onTimeout] function is called.
- *
- * The countdown doesn't start until the returned stream is listened to.
- * The countdown is reset every time an event is forwarded from this stream,
- * or when the stream is paused and resumed.
- *
- * The [onTimeout] function is called with one argument: an
- * [EventSink] that allows putting events into the returned stream.
- * This `EventSink` is only valid during the call to `onTimeout`.
- *
- * If `onTimeout` is omitted, a timeout will just put a [TimeoutException]
- * into the error channel of the returned stream.
- *
- * The returned stream is a broadcast stream if this stream is.
- * If a broadcast stream is listened to more than once, each subscription
- * will have its individually timer that starts counting on listen,
- * and the subscriptions' timers can be paused individually.
- */
- Stream<T> timeout(Duration timeLimit, {void onTimeout(EventSink<T> sink)}) {
- StreamController<T> controller;
- // The following variables are set on listen.
- StreamSubscription<T> subscription;
- Timer timer;
- Zone zone;
- _TimerCallback timeout;
-
- void onData(T event) {
- timer.cancel();
- controller.add(event);
- timer = zone.createTimer(timeLimit, timeout);
- }
- void onError(error, StackTrace stackTrace) {
- timer.cancel();
- assert(controller is _StreamController ||
- controller is _BroadcastStreamController);
- dynamic eventSink = controller;
- eventSink._addError(error, stackTrace); // Avoid Zone error replacement.
- timer = zone.createTimer(timeLimit, timeout);
- }
- void onDone() {
- timer.cancel();
- controller.close();
- }
- void onListen() {
- // This is the onListen callback for of controller.
- // It runs in the same zone that the subscription was created in.
- // Use that zone for creating timers and running the onTimeout
- // callback.
- zone = Zone.current;
- if (onTimeout == null) {
- timeout = () {
- controller.addError(new TimeoutException("No stream event",
- timeLimit), null);
- };
- } else {
- // TODO(floitsch): the return type should be 'void', and the type
- // should be inferred.
- var registeredOnTimeout =
- zone.registerUnaryCallback/*<dynamic, EventSink<T>>*/(onTimeout);
- _ControllerEventSinkWrapper wrapper =
- new _ControllerEventSinkWrapper(null);
- timeout = () {
- wrapper._sink = controller; // Only valid during call.
- zone.runUnaryGuarded(registeredOnTimeout, wrapper);
- wrapper._sink = null;
- };
- }
-
- subscription = this.listen(onData, onError: onError, onDone: onDone);
- timer = zone.createTimer(timeLimit, timeout);
- }
- Future onCancel() {
- timer.cancel();
- Future result = subscription.cancel();
- subscription = null;
- return result;
- }
- controller = isBroadcast
- ? new _SyncBroadcastStreamController<T>(onListen, onCancel)
- : new _SyncStreamController<T>(
- onListen,
- () {
- // Don't null the timer, onCancel may call cancel again.
- timer.cancel();
- subscription.pause();
- },
- () {
- subscription.resume();
- timer = zone.createTimer(timeLimit, timeout);
- },
- onCancel);
- return controller.stream;
- }
-}
-
-/**
- * A subscription on events from a [Stream].
- *
- * When you listen on a [Stream] using [Stream.listen],
- * a [StreamSubscription] object is returned.
- *
- * The subscription provides events to the listener,
- * and holds the callbacks used to handle the events.
- * The subscription can also be used to unsubscribe from the events,
- * or to temporarily pause the events from the stream.
- */
-abstract class StreamSubscription<T> {
- /**
- * Cancels this subscription.
- *
- * After this call, the subscription no longer receives events.
- *
- * The stream may need to shut down the source of events and clean up after
- * the subscription is canceled.
- *
- * Returns a future that is completed once the stream has finished
- * its cleanup. May also return `null` if no cleanup was necessary.
- *
- * Typically, futures are returned when the stream needs to release resources.
- * For example, a stream might need to close an open file (as an asynchronous
- * operation). If the listener wants to delete the file after having
- * canceled the subscription, it must wait for the cleanup future to complete.
- *
- * A returned future completes with a `null` value.
- * If the cleanup throws, which it really shouldn't, the returned future
- * completes with that error.
- */
- Future cancel();
-
- /**
- * Set or override the data event handler of this subscription.
- *
- * This method overrides the handler that has been set at the invocation of
- * [Stream.listen].
- */
- void onData(void handleData(T data));
-
- /**
- * Set or override the error event handler of this subscription.
- *
- * This method overrides the handler that has been set at the invocation of
- * [Stream.listen] or by calling [asFuture].
- */
- void onError(Function handleError);
-
- /**
- * Set or override the done event handler of this subscription.
- *
- * This method overrides the handler that has been set at the invocation of
- * [Stream.listen] or by calling [asFuture].
- */
- void onDone(void handleDone());
-
- /**
- * Request that the stream pauses events until further notice.
- *
- * While paused, the subscription will not fire any events.
- * If it receives events from its source, they will be buffered until
- * the subscription is resumed.
- * The underlying source is usually informed about the pause,
- * so it can stop generating events until the subscription is resumed.
- *
- * To avoid buffering events on a broadcast stream, it is better to
- * cancel this subscription, and start to listen again when events
- * are needed.
- *
- * If [resumeSignal] is provided, the stream will undo the pause
- * when the future completes. If the future completes with an error,
- * the stream will resume, but the error will not be handled!
- *
- * A call to [resume] will also undo a pause.
- *
- * If the subscription is paused more than once, an equal number
- * of resumes must be performed to resume the stream.
- *
- * Currently DOM streams silently drop events when the stream is paused. This
- * is a bug and will be fixed.
- */
- void pause([Future resumeSignal]);
-
- /**
- * Resume after a pause.
- */
- void resume();
-
- /**
- * Returns true if the [StreamSubscription] is paused.
- */
- bool get isPaused;
-
- /**
- * Returns a future that handles the [onDone] and [onError] callbacks.
- *
- * This method *overwrites* the existing [onDone] and [onError] callbacks
- * with new ones that complete the returned future.
- *
- * In case of an error the subscription will automatically cancel (even
- * when it was listening with `cancelOnError` set to `false`).
- *
- * In case of a `done` event the future completes with the given
- * [futureValue].
- */
- Future/*<E>*/ asFuture/*<E>*/([var/*=E*/ futureValue]);
-}
-
-
-/**
- * An interface that abstracts creation or handling of [Stream] events.
- */
-abstract class EventSink<T> implements Sink<T> {
- /** Send a data event to a stream. */
- void add(T event);
-
- /** Send an async error to a stream. */
- void addError(errorEvent, [StackTrace stackTrace]);
-
- /** Close the sink. No further events can be added after closing. */
- void close();
-}
-
-
-/** [Stream] wrapper that only exposes the [Stream] interface. */
-class StreamView<T> extends Stream<T> {
- final Stream<T> _stream;
-
- const StreamView(Stream<T> stream) : _stream = stream, super._internal();
-
- bool get isBroadcast => _stream.isBroadcast;
-
- Stream<T> asBroadcastStream(
- {void onListen(StreamSubscription<T> subscription),
- void onCancel(StreamSubscription<T> subscription)})
- => _stream.asBroadcastStream(onListen: onListen, onCancel: onCancel);
-
- StreamSubscription<T> listen(void onData(T value),
- { Function onError,
- void onDone(),
- bool cancelOnError }) {
- return _stream.listen(onData, onError: onError, onDone: onDone,
- cancelOnError: cancelOnError);
- }
-}
-
-
-/**
- * Abstract interface for a "sink" accepting multiple entire streams.
- *
- * A consumer can accept a number of consecutive streams using [addStream],
- * and when no further data need to be added, the [close] method tells the
- * consumer to complete its work and shut down.
- *
- * This class is not just a [Sink<Stream>] because it is also combined with
- * other [Sink] classes, like it's combined with [EventSink] in the
- * [StreamSink] class.
- *
- * The [Stream.pipe] accepts a `StreamConsumer` and will pass the stream
- * to the consumer's [addStream] method. When that completes, it will
- * call [close] and then complete its own returned future.
- */
-abstract class StreamConsumer<S> {
- /**
- * Consumes the elements of [stream].
- *
- * Listens on [stream] and does something for each event.
- *
- * Returns a future which is completed when the stream is done being added,
- * and the consumer is ready to accept a new stream.
- * No further calls to [addStream] or [close] should happen before the
- * returned future has completed.
- *
- * The consumer may stop listening to the stream after an error,
- * it may consume all the errors and only stop at a done event,
- * or it may be canceled early if the receiver don't want any further events.
- *
- * If the consumer stops listening because of some error preventing it
- * from continuing, it may report this error in the returned future,
- * otherwise it will just complete the future with `null`.
- */
- Future addStream(Stream<S> stream);
-
- /**
- * Tells the consumer that no further streams will be added.
- *
- * This allows the consumer to complete any remaining work and release
- * resources that are no longer needed
- *
- * Returns a future which is completed when the consumer has shut down.
- * If cleaning up can fail, the error may be reported in the returned future,
- * otherwise it completes with `null`.
- */
- Future close();
-}
-
-
-/**
- * A object that accepts stream events both synchronously and asynchronously.
- *
- * A [StreamSink] unifies the asynchronous methods from [StreamConsumer] and
- * the synchronous methods from [EventSink].
- *
- * The [EventSink] methods can't be used while the [addStream] is called.
- * As soon as the [addStream]'s [Future] completes with a value, the
- * [EventSink] methods can be used again.
- *
- * If [addStream] is called after any of the [EventSink] methods, it'll
- * be delayed until the underlying system has consumed the data added by the
- * [EventSink] methods.
- *
- * When [EventSink] methods are used, the [done] [Future] can be used to
- * catch any errors.
- *
- * When [close] is called, it will return the [done] [Future].
- */
-abstract class StreamSink<S> implements EventSink<S>, StreamConsumer<S> {
- /**
- * Tells the stream sink that no further streams will be added.
- *
- * This allows the stream sink to complete any remaining work and release
- * resources that are no longer needed
- *
- * Returns a future which is completed when the stream sink has shut down.
- * If cleaning up can fail, the error may be reported in the returned future,
- * otherwise it completes with `null`.
- *
- * Returns the same future as [done].
- *
- * The stream sink may close before the [close] method is called, either due
- * to an error or because it is itself providing events to someone who has
- * stopped listening. In that case, the [done] future is completed first,
- * and the `close` method will return the `done` future when called.
- *
- * Unifies [StreamConsumer.close] and [EventSink.close] which both mark their
- * object as not expecting any further events.
- */
- Future close();
-
- /**
- * Return a future which is completed when the [StreamSink] is finished.
- *
- * If the `StreamSink` fails with an error,
- * perhaps in response to adding events using [add], [addError] or [close],
- * the [done] future will complete with that error.
- *
- * Otherwise, the returned future will complete when either:
- *
- * * all events have been processed and the sink has been closed, or
- * * the sink has otherwise been stopped from handling more events
- * (for example by cancelling a stream subscription).
- */
- Future get done;
-}
-
-
-/**
- * The target of a [Stream.transform] call.
- *
- * The [Stream.transform] call will pass itself to this object and then return
- * the resulting stream.
- *
- * It is good practice to write transformers that can be used multiple times.
- */
-abstract class StreamTransformer<S, T> {
- /**
- * Creates a [StreamTransformer].
- *
- * The returned instance takes responsibility of implementing ([bind]).
- * When the user invokes `bind` it returns a new "bound" stream. Only when
- * the user starts listening to the bound stream, the `listen` method
- * invokes the given closure [transformer].
- *
- * The [transformer] closure receives the stream, that was bound, as argument
- * and returns a [StreamSubscription]. In almost all cases the closure
- * listens itself to the stream that is given as argument.
- *
- * The result of invoking the [transformer] closure is a [StreamSubscription].
- * The bound stream-transformer (created by the `bind` method above) then sets
- * the handlers it received as part of the `listen` call.
- *
- * Conceptually this can be summarized as follows:
- *
- * 1. `var transformer = new StreamTransformer(transformerClosure);`
- * creates a `StreamTransformer` that supports the `bind` method.
- * 2. `var boundStream = stream.transform(transformer);` binds the `stream`
- * and returns a bound stream that has a pointer to `stream`.
- * 3. `boundStream.listen(f1, onError: f2, onDone: f3, cancelOnError: b)`
- * starts the listening and transformation. This is accomplished
- * in 2 steps: first the `boundStream` invokes the `transformerClosure` with
- * the `stream` it captured: `transformerClosure(stream, b)`.
- * The result `subscription`, a [StreamSubscription], is then
- * updated to receive its handlers: `subscription.onData(f1)`,
- * `subscription.onError(f2)`, `subscription(f3)`. Finally the subscription
- * is returned as result of the `listen` call.
- *
- * There are two common ways to create a StreamSubscription:
- *
- * 1. by creating a new class that implements [StreamSubscription].
- * Note that the subscription should run callbacks in the [Zone] the
- * stream was listened to.
- * 2. by allocating a [StreamController] and to return the result of
- * listening to its stream.
- *
- * Example use of a duplicating transformer:
- *
- * stringStream.transform(new StreamTransformer<String, String>(
- * (Stream<String> input, bool cancelOnError) {
- * StreamController<String> controller;
- * StreamSubscription<String> subscription;
- * controller = new StreamController<String>(
- * onListen: () {
- * subscription = input.listen((data) {
- * // Duplicate the data.
- * controller.add(data);
- * controller.add(data);
- * },
- * onError: controller.addError,
- * onDone: controller.close,
- * cancelOnError: cancelOnError);
- * },
- * onPause: () { subscription.pause(); },
- * onResume: () { subscription.resume(); },
- * onCancel: () { subscription.cancel(); },
- * sync: true);
- * return controller.stream.listen(null);
- * });
- */
- const factory StreamTransformer(
- StreamSubscription<T> transformer(Stream<S> stream, bool cancelOnError))
- = _StreamSubscriptionTransformer<S, T>;
-
- /**
- * Creates a [StreamTransformer] that delegates events to the given functions.
- *
- * Example use of a duplicating transformer:
- *
- * stringStream.transform(new StreamTransformer<String, String>.fromHandlers(
- * handleData: (String value, EventSink<String> sink) {
- * sink.add(value);
- * sink.add(value); // Duplicate the incoming events.
- * }));
- */
- factory StreamTransformer.fromHandlers({
- void handleData(S data, EventSink<T> sink),
- void handleError(Object error, StackTrace stackTrace, EventSink<T> sink),
- void handleDone(EventSink<T> sink)})
- = _StreamHandlerTransformer<S, T>;
-
- /**
- * Transform the incoming [stream]'s events.
- *
- * Creates a new stream.
- * When this stream is listened to, it will start listening on [stream],
- * and generate events on the new stream based on the events from [stream].
- *
- * Subscriptions on the returned stream should propagate pause state
- * to the subscription on [stream].
- */
- Stream<T> bind(Stream<S> stream);
-}
-
-/**
- * An [Iterator] like interface for the values of a [Stream].
- *
- * This wraps a [Stream] and a subscription on the stream. It listens
- * on the stream, and completes the future returned by [moveNext] when the
- * next value becomes available.
- */
-abstract class StreamIterator<T> {
-
- /** Create a [StreamIterator] on [stream]. */
- factory StreamIterator(Stream<T> stream)
- // TODO(lrn): use redirecting factory constructor when type
- // arguments are supported.
- => new _StreamIteratorImpl<T>(stream);
-
- /**
- * Wait for the next stream value to be available.
- *
- * Returns a future which will complete with either `true` or `false`.
- * Completing with `true` means that another event has been received and
- * can be read as [current].
- * Completing with `false` means that the stream itearation is done and
- * no further events will ever be available.
- * The future may complete with an error, if the stream produces an error,
- * which also ends iteration.
- *
- * The function must not be called again until the future returned by a
- * previous call is completed.
- */
- Future<bool> moveNext();
-
- /**
- * The current value of the stream.
- *
- * Is `null` before the first call to [moveNext] and after a call to
- * `moveNext` completes with a `false` result or an error.
- *
- * When a `moveNext` call completes with `true`, the `current` field holds
- * the most recent event of the stream, and it stays like that until the next
- * call to `moveNext`.
- * Between a call to `moveNext` and when its returned future completes,
- * the value is unspecified.
- */
- T get current;
-
- /**
- * Cancels the stream iterator (and the underlying stream subscription) early.
- *
- * The stream iterator is automatically canceled if the [moveNext] future
- * completes with either `false` or an error.
- *
- * If you need to stop listening for values before the stream iterator is
- * automatically closed, you must call [cancel] to ensure that the stream
- * is properly closed.
- *
- * If [moveNext] has been called when the iterator is cancelled,
- * its returned future will complete with `false` as value,
- * as will all further calls to [moveNext].
- *
- * Returns a future if the cancel-operation is not completed synchronously.
- * Otherwise returns `null`.
- */
- Future cancel();
-}
-
-
-/**
- * Wraps an [_EventSink] so it exposes only the [EventSink] interface.
- */
-class _ControllerEventSinkWrapper<T> implements EventSink<T> {
- EventSink _sink;
- _ControllerEventSinkWrapper(this._sink);
-
- void add(T data) { _sink.add(data); }
- void addError(error, [StackTrace stackTrace]) {
- _sink.addError(error, stackTrace);
- }
- void close() { _sink.close(); }
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/async/stream_controller.dart b/pkg/dev_compiler/tool/input_sdk/lib/async/stream_controller.dart
deleted file mode 100644
index 87b64e8..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/async/stream_controller.dart
+++ /dev/null
@@ -1,948 +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.
-
-part of dart.async;
-
-// -------------------------------------------------------------------
-// Controller for creating and adding events to a stream.
-// -------------------------------------------------------------------
-
-/**
- * Type of a stream controller's `onListen`, `onPause` and `onResume` callbacks.
- */
-typedef void ControllerCallback();
-
-/**
- * Type of stream controller `onCancel` callbacks.
- *
- * The callback may return either `void` or a future.
- */
-typedef ControllerCancelCallback();
-
-/**
- * A controller with the stream it controls.
- *
- * This controller allows sending data, error and done events on
- * its [stream].
- * This class can be used to create a simple stream that others
- * can listen on, and to push events to that stream.
- *
- * It's possible to check whether the stream is paused or not, and whether
- * it has subscribers or not, as well as getting a callback when either of
- * these change.
- *
- * If the stream starts or stops having listeners (first listener subscribing,
- * last listener unsubscribing), the `onSubscriptionStateChange` callback
- * is notified as soon as possible. If the subscription stat changes during
- * an event firing or a callback being executed, the change will not be reported
- * until the current event or callback has finished.
- * If the pause state has also changed during an event or callback, only the
- * subscription state callback is notified.
- *
- * If the subscriber state has not changed, but the pause state has, the
- * `onPauseStateChange` callback is notified as soon as possible, after firing
- * a current event or completing another callback. This happens if the stream
- * is not paused, and a listener pauses it, or if the stream has been resumed
- * from pause and has no pending events. If the listeners resume a paused stream
- * while it still has queued events, the controller will still consider the
- * stream paused until all queued events have been dispatched.
- *
- * Whether to invoke a callback depends only on the state before and after
- * a stream action, for example firing an event. If the state changes multiple
- * times during the action, and then ends up in the same state as before, no
- * callback is performed.
- *
- * If listeners are added after the stream has completed (sent a "done" event),
- * the listeners will be sent a "done" event eventually, but they won't affect
- * the stream at all, and won't trigger callbacks. From the controller's point
- * of view, the stream is completely inert when has completed.
- */
-abstract class StreamController<T> implements StreamSink<T> {
- /** The stream that this controller is controlling. */
- Stream<T> get stream;
-
- /**
- * A controller with a [stream] that supports only one single subscriber.
- *
- * If [sync] is true, the returned stream controller is a
- * [SynchronousStreamController], and must be used with the care
- * and attention necessary to not break the [Stream] contract.
- * See [Completer.sync] for some explanations on when a synchronous
- * dispatching can be used.
- * If in doubt, keep the controller non-sync.
- *
- * A Stream should be inert until a subscriber starts listening on it (using
- * the [onListen] callback to start producing events). Streams should not
- * leak resources (like websockets) when no user ever listens on the stream.
- *
- * The controller buffers all incoming events until a subscriber is
- * registered, but this feature should only be used in rare circumstances.
- *
- * The [onPause] function is called when the stream becomes
- * paused. [onResume] is called when the stream resumed.
- *
- * The [onListen] callback is called when the stream
- * receives its listener and [onCancel] when the listener ends
- * its subscription. If [onCancel] needs to perform an asynchronous operation,
- * [onCancel] should return a future that completes when the cancel operation
- * is done.
- *
- * If the stream is canceled before the controller needs new data the
- * [onResume] call might not be executed.
- */
- factory StreamController({void onListen(),
- void onPause(),
- void onResume(),
- onCancel(),
- bool sync: false}) {
- return sync
- ? new _SyncStreamController<T>(onListen, onPause, onResume, onCancel)
- : new _AsyncStreamController<T>(onListen, onPause, onResume, onCancel);
- }
-
- /**
- * A controller where [stream] can be listened to more than once.
- *
- * The [Stream] returned by [stream] is a broadcast stream.
- * It can be listened to more than once.
- *
- * A Stream should be inert until a subscriber starts listening on it (using
- * the [onListen] callback to start producing events). Streams should not
- * leak resources (like websockets) when no user ever listens on the stream.
- *
- * Broadcast streams do not buffer events when there is no listener.
- *
- * The controller distributes any events to all currently subscribed
- * listeners at the time when [add], [addError] or [close] is called.
- * It is not allowed to call `add`, `addError`, or `close` before a previous
- * call has returned. The controller does not have any internal queue of
- * events, and if there are no listeners at the time the event is added,
- * it will just be dropped, or, if it is an error, be reported as uncaught.
- *
- * Each listener subscription is handled independently,
- * and if one pauses, only the pausing listener is affected.
- * A paused listener will buffer events internally until unpaused or canceled.
- *
- * If [sync] is true, events may be fired directly by the stream's
- * subscriptions during an [add], [addError] or [close] call.
- * The returned stream controller is a [SynchronousStreamController],
- * and must be used with the care and attention necessary to not break
- * the [Stream] contract.
- * See [Completer.sync] for some explanations on when a synchronous
- * dispatching can be used.
- * If in doubt, keep the controller non-sync.
- *
- * If [sync] is false, the event will always be fired at a later time,
- * after the code adding the event has completed.
- * In that case, no guarantees are given with regard to when
- * multiple listeners get the events, except that each listener will get
- * all events in the correct order. Each subscription handles the events
- * individually.
- * If two events are sent on an async controller with two listeners,
- * one of the listeners may get both events
- * before the other listener gets any.
- * A listener must be subscribed both when the event is initiated
- * (that is, when [add] is called)
- * and when the event is later delivered,
- * in order to receive the event.
- *
- * The [onListen] callback is called when the first listener is subscribed,
- * and the [onCancel] is called when there are no longer any active listeners.
- * If a listener is added again later, after the [onCancel] was called,
- * the [onListen] will be called again.
- */
- factory StreamController.broadcast({void onListen(),
- void onCancel(),
- bool sync: false}) {
- return sync
- ? new _SyncBroadcastStreamController<T>(onListen, onCancel)
- : new _AsyncBroadcastStreamController<T>(onListen, onCancel);
- }
-
- /**
- * The callback which is called when the stream is listened to.
- *
- * May be set to `null`, in which case no callback will happen.
- */
- ControllerCallback get onListen;
-
- void set onListen(void onListenHandler());
-
- /**
- * The callback which is called when the stream is paused.
- *
- * May be set to `null`, in which case no callback will happen.
- *
- * Pause related callbacks are not supported on broadcast stream controllers.
- */
- ControllerCallback get onPause;
-
- void set onPause(void onPauseHandler());
-
- /**
- * The callback which is called when the stream is resumed.
- *
- * May be set to `null`, in which case no callback will happen.
- *
- * Pause related callbacks are not supported on broadcast stream controllers.
- */
- ControllerCallback get onResume;
-
- void set onResume(void onResumeHandler());
-
- /**
- * The callback which is called when the stream is canceled.
- *
- * May be set to `null`, in which case no callback will happen.
- */
- ControllerCancelCallback get onCancel;
-
- void set onCancel(onCancelHandler());
-
- /**
- * Returns a view of this object that only exposes the [StreamSink] interface.
- */
- StreamSink<T> get sink;
-
- /**
- * Whether the stream controller is closed for adding more events.
- *
- * The controller becomes closed by calling the [close] method.
- * New events cannot be added, by calling [add] or [addError],
- * to a closed controller.
- *
- * If the controller is closed,
- * the "done" event might not have been delivered yet,
- * but it has been scheduled, and it is too late to add more events.
- */
- bool get isClosed;
-
- /**
- * Whether the subscription would need to buffer events.
- *
- * This is the case if the controller's stream has a listener and it is
- * paused, or if it has not received a listener yet. In that case, the
- * controller is considered paused as well.
- *
- * A broadcast stream controller is never considered paused. It always
- * forwards its events to all uncanceled subscriptions, if any,
- * and let the subscriptions handle their own pausing and buffering.
- */
- bool get isPaused;
-
- /** Whether there is a subscriber on the [Stream]. */
- bool get hasListener;
-
- /**
- * Send or enqueue an error event.
- *
- * If [error] is `null`, it is replaced by a [NullThrownError].
- */
- void addError(Object error, [StackTrace stackTrace]);
-
- /**
- * Receives events from [source] and puts them into this controller's stream.
- *
- * Returns a future which completes when the source stream is done.
- *
- * Events must not be added directly to this controller using [add],
- * [addError], [close] or [addStream], until the returned future
- * is complete.
- *
- * Data and error events are forwarded to this controller's stream. A done
- * event on the source will end the `addStream` operation and complete the
- * returned future.
- *
- * If [cancelOnError] is true, only the first error on [source] is
- * forwarded to the controller's stream, and the `addStream` ends
- * after this. If [cancelOnError] is false, all errors are forwarded
- * and only a done event will end the `addStream`.
- */
- Future addStream(Stream<T> source, {bool cancelOnError: true});
-}
-
-
-/**
- * A stream controller that delivers its events synchronously.
- *
- * A synchronous stream controller is intended for cases where
- * an already asynchronous event triggers an event on a stream.
- *
- * Instead of adding the event to the stream in a later microtask,
- * causing extra latency, the event is instead fired immediately by the
- * synchronous stream controller, as if the stream event was
- * the current event or microtask.
- *
- * The synchronous stream controller can be used to break the contract
- * on [Stream], and it must be used carefully to avoid doing so.
- *
- * The only advantage to using a [SynchronousStreamController] over a
- * normal [StreamController] is the improved latency.
- * Only use the synchronous version if the improvement is significant,
- * and if its use is safe. Otherwise just use a normal stream controller,
- * which will always have the correct behavior for a [Stream], and won't
- * accidentally break other code.
- *
- * Adding events to a synchronous controller should only happen as the
- * very last part of a the handling of the original event.
- * At that point, adding an event to the stream is equivalent to
- * returning to the event loop and adding the event in the next microtask.
- *
- * Each listener callback will be run as if it was a top-level event
- * or microtask. This means that if it throws, the error will be reported as
- * uncaught as soon as possible.
- * This is one reason to add the event as the last thing in the original event
- * handler - any action done after adding the event will delay the report of
- * errors in the event listener callbacks.
- *
- * If an event is added in a setting that isn't known to be another event,
- * it may cause the stream's listener to get that event before the listener
- * is ready to handle it. We promise that after calling [Stream.listen],
- * you won't get any events until the code doing the listen has completed.
- * Calling [add] in response to a function call of unknown origin may break
- * that promise.
- *
- * An [onListen] callback from the controller is *not* an asynchronous event,
- * and adding events to the controller in the `onListen` callback is always
- * wrong. The events will be delivered before the listener has even received
- * the subscription yet.
- *
- * The synchronous broadcast stream controller also has a restrictions that a
- * normal stream controller does not:
- * The [add], [addError], [close] and [addStream] methods *must not* be
- * called while an event is being delivered.
- * That is, if a callback on a subscription on the controller's stream causes
- * a call to any of the functions above, the call will fail.
- * A broadcast stream may have more than one listener, and if an
- * event is added synchronously while another is being also in the process
- * of being added, the latter event might reach some listeners before
- * the former. To prevent that, an event cannot be added while a previous
- * event is being fired.
- * This guarantees that an event is fully delivered when the
- * first [add], [addError] or [close] returns,
- * and further events will be delivered in the correct order.
- *
- * This still only guarantees that the event is delivered to the subscription.
- * If the subscription is paused, the actual callback may still happen later,
- * and the event will instead be buffered by the subscription.
- * Barring pausing, and the following buffered events that haven't been
- * delivered yet, callbacks will be called synchronously when an event is added.
- *
- * Adding an event to a synchronous non-broadcast stream controller while
- * another event is in progress may cause the second event to be delayed
- * and not be delivered synchronously, and until that event is delivered,
- * the controller will not act synchronously.
- */
-abstract class SynchronousStreamController<T> implements StreamController<T> {
- /**
- * Adds event to the controller's stream.
- *
- * As [StreamController.add], but must not be called while an event is
- * being added by [add], [addError] or [close].
- */
- void add(T data);
-
- /**
- * Adds error to the controller's stream.
- *
- * As [StreamController.addError], but must not be called while an event is
- * being added by [add], [addError] or [close].
- */
- void addError(Object error, [StackTrace stackTrace]);
-
- /**
- * Closes the controller's stream.
- *
- * As [StreamController.close], but must not be called while an event is
- * being added by [add], [addError] or [close].
- */
- Future close();
-}
-
-abstract class _StreamControllerLifecycle<T> {
- StreamSubscription<T> _subscribe(
- void onData(T data),
- Function onError,
- void onDone(),
- bool cancelOnError);
- void _recordPause(StreamSubscription<T> subscription) {}
- void _recordResume(StreamSubscription<T> subscription) {}
- Future _recordCancel(StreamSubscription<T> subscription) => null;
-}
-
-/**
- * Default implementation of [StreamController].
- *
- * Controls a stream that only supports a single controller.
- */
-abstract class _StreamController<T> implements StreamController<T>,
- _StreamControllerLifecycle<T>,
- _EventSink<T>,
- _EventDispatch<T> {
- // The states are bit-flags. More than one can be set at a time.
- //
- // The "subscription state" goes through the states:
- // initial -> subscribed -> canceled.
- // These are mutually exclusive.
- // The "closed" state records whether the [close] method has been called
- // on the controller. This can be done at any time. If done before
- // subscription, the done event is queued. If done after cancel, the done
- // event is ignored (just as any other event after a cancel).
-
- /** The controller is in its initial state with no subscription. */
- static const int _STATE_INITIAL = 0;
- /** The controller has a subscription, but hasn't been closed or canceled. */
- static const int _STATE_SUBSCRIBED = 1;
- /** The subscription is canceled. */
- static const int _STATE_CANCELED = 2;
- /** Mask for the subscription state. */
- static const int _STATE_SUBSCRIPTION_MASK = 3;
-
- // The following state relate to the controller, not the subscription.
- // If closed, adding more events is not allowed.
- // If executing an [addStream], new events are not allowed either, but will
- // be added by the stream.
-
- /**
- * The controller is closed due to calling [close].
- *
- * When the stream is closed, you can neither add new events nor add new
- * listeners.
- */
- static const int _STATE_CLOSED = 4;
- /**
- * The controller is in the middle of an [addStream] operation.
- *
- * While adding events from a stream, no new events can be added directly
- * on the controller.
- */
- static const int _STATE_ADDSTREAM = 8;
-
- /**
- * Field containing different data depending on the current subscription
- * state.
- *
- * If [_state] is [_STATE_INITIAL], the field may contain a [_PendingEvents]
- * for events added to the controller before a subscription.
- *
- * While [_state] is [_STATE_SUBSCRIBED], the field contains the subscription.
- *
- * When [_state] is [_STATE_CANCELED] the field is currently not used.
- */
- var _varData;
-
- /** Current state of the controller. */
- int _state = _STATE_INITIAL;
-
- /**
- * Future completed when the stream sends its last event.
- *
- * This is also the future returned by [close].
- */
- // TODO(lrn): Could this be stored in the varData field too, if it's not
- // accessed until the call to "close"? Then we need to special case if it's
- // accessed earlier, or if close is called before subscribing.
- _Future _doneFuture;
-
- ControllerCallback onListen;
- ControllerCallback onPause;
- ControllerCallback onResume;
- ControllerCancelCallback onCancel;
-
- _StreamController(this.onListen,
- this.onPause,
- this.onResume,
- this.onCancel);
-
- // Return a new stream every time. The streams are equal, but not identical.
- Stream<T> get stream => new _ControllerStream<T>(this);
-
- /**
- * Returns a view of this object that only exposes the [StreamSink] interface.
- */
- StreamSink<T> get sink => new _StreamSinkWrapper<T>(this);
-
- /**
- * Whether a listener has existed and been canceled.
- *
- * After this, adding more events will be ignored.
- */
- bool get _isCanceled => (_state & _STATE_CANCELED) != 0;
-
- /** Whether there is an active listener. */
- bool get hasListener => (_state & _STATE_SUBSCRIBED) != 0;
-
- /** Whether there has not been a listener yet. */
- bool get _isInitialState =>
- (_state & _STATE_SUBSCRIPTION_MASK) == _STATE_INITIAL;
-
- bool get isClosed => (_state & _STATE_CLOSED) != 0;
-
- bool get isPaused => hasListener ? _subscription._isInputPaused
- : !_isCanceled;
-
- bool get _isAddingStream => (_state & _STATE_ADDSTREAM) != 0;
-
- /** New events may not be added after close, or during addStream. */
- bool get _mayAddEvent => (_state < _STATE_CLOSED);
-
- // Returns the pending events.
- // Pending events are events added before a subscription exists.
- // They are added to the subscription when it is created.
- // Pending events, if any, are kept in the _varData field until the
- // stream is listened to.
- // While adding a stream, pending events are moved into the
- // state object to allow the state object to use the _varData field.
- _PendingEvents<T> get _pendingEvents {
- assert(_isInitialState);
- if (!_isAddingStream) {
- return _varData as Object /*=_PendingEvents<T>*/;
- }
- _StreamControllerAddStreamState<T> state =
- _varData as Object /*=_StreamControllerAddStreamState<T>*/;
- return state.varData as Object /*=_PendingEvents<T>*/;
- }
-
- // Returns the pending events, and creates the object if necessary.
- _StreamImplEvents<T> _ensurePendingEvents() {
- assert(_isInitialState);
- if (!_isAddingStream) {
- if (_varData == null) _varData = new _StreamImplEvents<T>();
- return _varData as Object /*=_StreamImplEvents<T>*/;
- }
- _StreamControllerAddStreamState<T> state =
- _varData as Object /*=_StreamControllerAddStreamState<T>*/;
- if (state.varData == null) state.varData = new _StreamImplEvents<T>();
- return state.varData as Object /*=_StreamImplEvents<T>*/;
- }
-
- // Get the current subscription.
- // If we are adding a stream, the subscription is moved into the state
- // object to allow the state object to use the _varData field.
- _ControllerSubscription<T> get _subscription {
- assert(hasListener);
- if (_isAddingStream) {
- _StreamControllerAddStreamState<T> addState =
- _varData as Object /*=_StreamControllerAddStreamState<T>*/;
- return addState.varData as Object /*=_ControllerSubscription<T>*/;
- }
- return _varData as Object /*=_ControllerSubscription<T>*/;
- }
-
- /**
- * Creates an error describing why an event cannot be added.
- *
- * The reason, and therefore the error message, depends on the current state.
- */
- Error _badEventState() {
- if (isClosed) {
- return new StateError("Cannot add event after closing");
- }
- assert(_isAddingStream);
- return new StateError("Cannot add event while adding a stream");
- }
-
- // StreamSink interface.
- Future addStream(Stream<T> source, {bool cancelOnError: true}) {
- if (!_mayAddEvent) throw _badEventState();
- if (_isCanceled) return new _Future.immediate(null);
- _StreamControllerAddStreamState<T> addState =
- new _StreamControllerAddStreamState<T>(this,
- _varData,
- source,
- cancelOnError);
- _varData = addState;
- _state |= _STATE_ADDSTREAM;
- return addState.addStreamFuture;
- }
-
- /**
- * Returns a future that is completed when the stream is done
- * processing events.
- *
- * This happens either when the done event has been sent, or if the
- * subscriber of a single-subscription stream is cancelled.
- */
- Future get done => _ensureDoneFuture();
-
- Future _ensureDoneFuture() {
- if (_doneFuture == null) {
- _doneFuture = _isCanceled ? Future._nullFuture : new _Future();
- }
- return _doneFuture;
- }
-
- /**
- * Send or enqueue a data event.
- */
- void add(T value) {
- if (!_mayAddEvent) throw _badEventState();
- _add(value);
- }
-
- /**
- * Send or enqueue an error event.
- */
- void addError(Object error, [StackTrace stackTrace]) {
- if (!_mayAddEvent) throw _badEventState();
- error = _nonNullError(error);
- AsyncError replacement = Zone.current.errorCallback(error, stackTrace);
- if (replacement != null) {
- error = _nonNullError(replacement.error);
- stackTrace = replacement.stackTrace;
- }
- _addError(error, stackTrace);
- }
-
- /**
- * Closes this controller and sends a done event on the stream.
- *
- * The first time a controller is closed, a "done" event is added to its
- * stream.
- *
- * You are allowed to close the controller more than once, but only the first
- * call has any effect.
- *
- * After closing, no further events may be added using [add], [addError]
- * or [addStream].
- *
- * The returned future is completed when the done event has been delivered.
- */
- Future close() {
- if (isClosed) {
- return _ensureDoneFuture();
- }
- if (!_mayAddEvent) throw _badEventState();
- _closeUnchecked();
- return _ensureDoneFuture();
- }
-
- void _closeUnchecked() {
- _state |= _STATE_CLOSED;
- if (hasListener) {
- _sendDone();
- } else if (_isInitialState) {
- _ensurePendingEvents().add(const _DelayedDone());
- }
- }
-
- // EventSink interface. Used by the [addStream] events.
-
- // Add data event, used both by the [addStream] events and by [add].
- void _add(T value) {
- if (hasListener) {
- _sendData(value);
- } else if (_isInitialState) {
- _ensurePendingEvents().add(new _DelayedData<T>(value));
- }
- }
-
- void _addError(Object error, StackTrace stackTrace) {
- if (hasListener) {
- _sendError(error, stackTrace);
- } else if (_isInitialState) {
- _ensurePendingEvents().add(new _DelayedError(error, stackTrace));
- }
- }
-
- void _close() {
- // End of addStream stream.
- assert(_isAddingStream);
- _StreamControllerAddStreamState<T> addState =
- _varData as Object /*=_StreamControllerAddStreamState<T>*/;
- _varData = addState.varData;
- _state &= ~_STATE_ADDSTREAM;
- addState.complete();
- }
-
- // _StreamControllerLifeCycle interface
-
- StreamSubscription<T> _subscribe(
- void onData(T data),
- Function onError,
- void onDone(),
- bool cancelOnError) {
- if (!_isInitialState) {
- throw new StateError("Stream has already been listened to.");
- }
- _ControllerSubscription<T> subscription =
- new _ControllerSubscription<T>(this, onData, onError, onDone,
- cancelOnError);
-
- _PendingEvents<T> pendingEvents = _pendingEvents;
- _state |= _STATE_SUBSCRIBED;
- if (_isAddingStream) {
- _StreamControllerAddStreamState<T> addState =
- _varData as Object /*=_StreamControllerAddStreamState<T>*/;
- addState.varData = subscription;
- addState.resume();
- } else {
- _varData = subscription;
- }
- subscription._setPendingEvents(pendingEvents);
- subscription._guardCallback(() {
- _runGuarded(onListen);
- });
-
- return subscription;
- }
-
- Future _recordCancel(StreamSubscription<T> subscription) {
- // When we cancel, we first cancel any stream being added,
- // Then we call `onCancel`, and finally the _doneFuture is completed.
- // If either of addStream's cancel or `onCancel` returns a future,
- // we wait for it before continuing.
- // Any error during this process ends up in the returned future.
- // If more errors happen, we act as if it happens inside nested try/finallys
- // or whenComplete calls, and only the last error ends up in the
- // returned future.
- Future result;
- if (_isAddingStream) {
- _StreamControllerAddStreamState<T> addState =
- _varData as Object /*=_StreamControllerAddStreamState<T>*/;
- result = addState.cancel();
- }
- _varData = null;
- _state =
- (_state & ~(_STATE_SUBSCRIBED | _STATE_ADDSTREAM)) | _STATE_CANCELED;
-
- if (onCancel != null) {
- if (result == null) {
- // Only introduce a future if one is needed.
- // If _onCancel returns null, no future is needed.
- try {
- result = onCancel();
- } catch (e, s) {
- // Return the error in the returned future.
- // Complete it asynchronously, so there is time for a listener
- // to handle the error.
- result = new _Future().._asyncCompleteError(e, s);
- }
- } else {
- // Simpler case when we already know that we will return a future.
- result = result.whenComplete(onCancel);
- }
- }
-
- void complete() {
- if (_doneFuture != null && _doneFuture._mayComplete) {
- _doneFuture._asyncComplete(null);
- }
- }
-
- if (result != null) {
- result = result.whenComplete(complete);
- } else {
- complete();
- }
-
- return result;
- }
-
- void _recordPause(StreamSubscription<T> subscription) {
- if (_isAddingStream) {
- _StreamControllerAddStreamState<T> addState =
- _varData as Object /*=_StreamControllerAddStreamState<T>*/;
- addState.pause();
- }
- _runGuarded(onPause);
- }
-
- void _recordResume(StreamSubscription<T> subscription) {
- if (_isAddingStream) {
- _StreamControllerAddStreamState<T> addState =
- _varData as Object /*=_StreamControllerAddStreamState<T>*/;
- addState.resume();
- }
- _runGuarded(onResume);
- }
-}
-
-abstract class _SyncStreamControllerDispatch<T>
- implements _StreamController<T>, SynchronousStreamController<T> {
- int get _state;
- void set _state(int state);
-
- void _sendData(T data) {
- _subscription._add(data);
- }
-
- void _sendError(Object error, StackTrace stackTrace) {
- _subscription._addError(error, stackTrace);
- }
-
- void _sendDone() {
- _subscription._close();
- }
-}
-
-abstract class _AsyncStreamControllerDispatch<T>
- implements _StreamController<T> {
- void _sendData(T data) {
- _subscription._addPending(new _DelayedData<dynamic /*=T*/>(data));
- }
-
- void _sendError(Object error, StackTrace stackTrace) {
- _subscription._addPending(new _DelayedError(error, stackTrace));
- }
-
- void _sendDone() {
- _subscription._addPending(const _DelayedDone());
- }
-}
-
-// TODO(lrn): Use common superclass for callback-controllers when VM supports
-// constructors in mixin superclasses.
-
-class _AsyncStreamController<T> = _StreamController<T>
- with _AsyncStreamControllerDispatch<T>;
-
-class _SyncStreamController<T> = _StreamController<T>
- with _SyncStreamControllerDispatch<T>;
-
-typedef _NotificationHandler();
-
-Future _runGuarded(_NotificationHandler notificationHandler) {
- if (notificationHandler == null) return null;
- try {
- var result = notificationHandler();
- if (result is Future) return result;
- return null;
- } catch (e, s) {
- Zone.current.handleUncaughtError(e, s);
- }
-}
-
-class _ControllerStream<T> extends _StreamImpl<T> {
- _StreamControllerLifecycle<T> _controller;
-
- _ControllerStream(this._controller);
-
- StreamSubscription<T> _createSubscription(
- void onData(T data),
- Function onError,
- void onDone(),
- bool cancelOnError) =>
- _controller._subscribe(onData, onError, onDone, cancelOnError);
-
- // Override == and hashCode so that new streams returned by the same
- // controller are considered equal. The controller returns a new stream
- // each time it's queried, but doesn't have to cache the result.
-
- int get hashCode => _controller.hashCode ^ 0x35323532;
-
- bool operator==(Object other) {
- if (identical(this, other)) return true;
- if (other is! _ControllerStream) return false;
- _ControllerStream otherStream = other;
- return identical(otherStream._controller, this._controller);
- }
-}
-
-class _ControllerSubscription<T> extends _BufferingStreamSubscription<T> {
- final _StreamControllerLifecycle<T> _controller;
-
- _ControllerSubscription(this._controller, void onData(T data),
- Function onError, void onDone(), bool cancelOnError)
- : super(onData, onError, onDone, cancelOnError);
-
- Future _onCancel() {
- return _controller._recordCancel(this);
- }
-
- void _onPause() {
- _controller._recordPause(this);
- }
-
- void _onResume() {
- _controller._recordResume(this);
- }
-}
-
-
-/** A class that exposes only the [StreamSink] interface of an object. */
-class _StreamSinkWrapper<T> implements StreamSink<T> {
- final StreamController _target;
- _StreamSinkWrapper(this._target);
- void add(T data) { _target.add(data); }
- void addError(Object error, [StackTrace stackTrace]) {
- _target.addError(error, stackTrace);
- }
- Future close() => _target.close();
- Future addStream(Stream<T> source, {bool cancelOnError: true}) =>
- _target.addStream(source, cancelOnError: cancelOnError);
- Future get done => _target.done;
-}
-
-/**
- * Object containing the state used to handle [StreamController.addStream].
- */
-class _AddStreamState<T> {
- // [_Future] returned by call to addStream.
- final _Future addStreamFuture;
-
- // Subscription on stream argument to addStream.
- final StreamSubscription addSubscription;
-
- _AddStreamState(_EventSink<T> controller, Stream source, bool cancelOnError)
- : addStreamFuture = new _Future(),
- addSubscription = source.listen(controller._add,
- onError: cancelOnError
- ? makeErrorHandler(controller)
- : controller._addError,
- onDone: controller._close,
- cancelOnError: cancelOnError);
-
- static makeErrorHandler(_EventSink controller) =>
- (e, StackTrace s) {
- controller._addError(e, s);
- controller._close();
- };
-
- void pause() {
- addSubscription.pause();
- }
-
- void resume() {
- addSubscription.resume();
- }
-
- /**
- * Stop adding the stream.
- *
- * Complete the future returned by `StreamController.addStream` when
- * the cancel is complete.
- *
- * Return a future if the cancel takes time, otherwise return `null`.
- */
- Future cancel() {
- var cancel = addSubscription.cancel();
- if (cancel == null) {
- addStreamFuture._asyncComplete(null);
- return null;
- }
- return cancel.whenComplete(() { addStreamFuture._asyncComplete(null); });
- }
-
- void complete() {
- addStreamFuture._asyncComplete(null);
- }
-}
-
-class _StreamControllerAddStreamState<T> extends _AddStreamState<T> {
- // The subscription or pending data of a _StreamController.
- // Stored here because we reuse the `_varData` field in the _StreamController
- // to store this state object.
- var varData;
-
- _StreamControllerAddStreamState(_StreamController<T> controller,
- this.varData,
- Stream source,
- bool cancelOnError)
- : super(controller, source, cancelOnError) {
- if (controller.isPaused) {
- addSubscription.pause();
- }
- }
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/async/stream_impl.dart b/pkg/dev_compiler/tool/input_sdk/lib/async/stream_impl.dart
deleted file mode 100644
index 7099973..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/async/stream_impl.dart
+++ /dev/null
@@ -1,1096 +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.
-
-part of dart.async;
-
-/** Abstract and private interface for a place to put events. */
-abstract class _EventSink<T> {
- void _add(T data);
- void _addError(Object error, StackTrace stackTrace);
- void _close();
-}
-
-/**
- * Abstract and private interface for a place to send events.
- *
- * Used by event buffering to finally dispatch the pending event, where
- * [_EventSink] is where the event first enters the stream subscription,
- * and may yet be buffered.
- */
-abstract class _EventDispatch<T> {
- void _sendData(T data);
- void _sendError(Object error, StackTrace stackTrace);
- void _sendDone();
-}
-
-/**
- * Default implementation of stream subscription of buffering events.
- *
- * The only public methods are those of [StreamSubscription], so instances of
- * [_BufferingStreamSubscription] can be returned directly as a
- * [StreamSubscription] without exposing internal functionality.
- *
- * The [StreamController] is a public facing version of [Stream] and this class,
- * with some methods made public.
- *
- * The user interface of [_BufferingStreamSubscription] are the following
- * methods:
- *
- * * [_add]: Add a data event to the stream.
- * * [_addError]: Add an error event to the stream.
- * * [_close]: Request to close the stream.
- * * [_onCancel]: Called when the subscription will provide no more events,
- * either due to being actively canceled, or after sending a done event.
- * * [_onPause]: Called when the subscription wants the event source to pause.
- * * [_onResume]: Called when allowing new events after a pause.
- *
- * The user should not add new events when the subscription requests a paused,
- * but if it happens anyway, the subscription will enqueue the events just as
- * when new events arrive while still firing an old event.
- */
-class _BufferingStreamSubscription<T> implements StreamSubscription<T>,
- _EventSink<T>,
- _EventDispatch<T> {
- /** The `cancelOnError` flag from the `listen` call. */
- static const int _STATE_CANCEL_ON_ERROR = 1;
- /**
- * Whether the "done" event has been received.
- * No further events are accepted after this.
- */
- static const int _STATE_CLOSED = 2;
- /**
- * Set if the input has been asked not to send events.
- *
- * This is not the same as being paused, since the input will remain paused
- * after a call to [resume] if there are pending events.
- */
- static const int _STATE_INPUT_PAUSED = 4;
- /**
- * Whether the subscription has been canceled.
- *
- * Set by calling [cancel], or by handling a "done" event, or an "error" event
- * when `cancelOnError` is true.
- */
- static const int _STATE_CANCELED = 8;
- /**
- * Set when either:
- *
- * * an error is sent, and [cancelOnError] is true, or
- * * a done event is sent.
- *
- * If the subscription is canceled while _STATE_WAIT_FOR_CANCEL is set, the
- * state is unset, and no furher events must be delivered.
- */
- static const int _STATE_WAIT_FOR_CANCEL = 16;
- static const int _STATE_IN_CALLBACK = 32;
- static const int _STATE_HAS_PENDING = 64;
- static const int _STATE_PAUSE_COUNT = 128;
- static const int _STATE_PAUSE_COUNT_SHIFT = 7;
-
- /* Event handlers provided in constructor. */
- _DataHandler<T> _onData;
- Function _onError;
- _DoneHandler _onDone;
- final Zone _zone = Zone.current;
-
- /** Bit vector based on state-constants above. */
- int _state;
-
- // TODO(floitsch): reuse another field
- /** The future [_onCancel] may return. */
- Future _cancelFuture;
-
- /**
- * Queue of pending events.
- *
- * Is created when necessary, or set in constructor for preconfigured events.
- */
- _PendingEvents<T> _pending;
-
- _BufferingStreamSubscription(void onData(T data),
- Function onError,
- void onDone(),
- bool cancelOnError)
- : _state = (cancelOnError ? _STATE_CANCEL_ON_ERROR : 0) {
- this.onData(onData);
- this.onError(onError);
- this.onDone(onDone);
- }
-
- /**
- * Sets the subscription's pending events object.
- *
- * This can only be done once. The pending events object is used for the
- * rest of the subscription's life cycle.
- */
- void _setPendingEvents(_PendingEvents<T> pendingEvents) {
- assert(_pending == null);
- if (pendingEvents == null) return;
- _pending = pendingEvents;
- if (!pendingEvents.isEmpty) {
- _state |= _STATE_HAS_PENDING;
- _pending.schedule(this);
- }
- }
-
- // StreamSubscription interface.
-
- void onData(void handleData(T event)) {
- if (handleData == null) handleData = _nullDataHandler;
- // TODO(floitsch): the return type should be 'void', and the type
- // should be inferred.
- _onData = _zone.registerUnaryCallback/*<dynamic, T>*/(handleData);
- }
-
- void onError(Function handleError) {
- if (handleError == null) handleError = _nullErrorHandler;
- _onError = _registerErrorHandler/*<T>*/(handleError, _zone);
- }
-
- void onDone(void handleDone()) {
- if (handleDone == null) handleDone = _nullDoneHandler;
- _onDone = _zone.registerCallback(handleDone);
- }
-
- void pause([Future resumeSignal]) {
- if (_isCanceled) return;
- bool wasPaused = _isPaused;
- bool wasInputPaused = _isInputPaused;
- // Increment pause count and mark input paused (if it isn't already).
- _state = (_state + _STATE_PAUSE_COUNT) | _STATE_INPUT_PAUSED;
- if (resumeSignal != null) resumeSignal.whenComplete(resume);
- if (!wasPaused && _pending != null) _pending.cancelSchedule();
- if (!wasInputPaused && !_inCallback) _guardCallback(_onPause);
- }
-
- void resume() {
- if (_isCanceled) return;
- if (_isPaused) {
- _decrementPauseCount();
- if (!_isPaused) {
- if (_hasPending && !_pending.isEmpty) {
- // Input is still paused.
- _pending.schedule(this);
- } else {
- assert(_mayResumeInput);
- _state &= ~_STATE_INPUT_PAUSED;
- if (!_inCallback) _guardCallback(_onResume);
- }
- }
- }
- }
-
- Future cancel() {
- // The user doesn't want to receive any further events. If there is an
- // error or done event pending (waiting for the cancel to be done) discard
- // that event.
- _state &= ~_STATE_WAIT_FOR_CANCEL;
- if (_isCanceled) return _cancelFuture;
- _cancel();
- return _cancelFuture;
- }
-
- Future/*<E>*/ asFuture/*<E>*/([var/*=E*/ futureValue]) {
- _Future/*<E>*/ result = new _Future/*<E>*/();
-
- // Overwrite the onDone and onError handlers.
- _onDone = () { result._complete(futureValue); };
- _onError = (error, stackTrace) {
- cancel();
- result._completeError(error, stackTrace);
- };
-
- return result;
- }
-
- // State management.
-
- bool get _isInputPaused => (_state & _STATE_INPUT_PAUSED) != 0;
- bool get _isClosed => (_state & _STATE_CLOSED) != 0;
- bool get _isCanceled => (_state & _STATE_CANCELED) != 0;
- bool get _waitsForCancel => (_state & _STATE_WAIT_FOR_CANCEL) != 0;
- bool get _inCallback => (_state & _STATE_IN_CALLBACK) != 0;
- bool get _hasPending => (_state & _STATE_HAS_PENDING) != 0;
- bool get _isPaused => _state >= _STATE_PAUSE_COUNT;
- bool get _canFire => _state < _STATE_IN_CALLBACK;
- bool get _mayResumeInput =>
- !_isPaused && (_pending == null || _pending.isEmpty);
- bool get _cancelOnError => (_state & _STATE_CANCEL_ON_ERROR) != 0;
-
- bool get isPaused => _isPaused;
-
- void _cancel() {
- _state |= _STATE_CANCELED;
- if (_hasPending) {
- _pending.cancelSchedule();
- }
- if (!_inCallback) _pending = null;
- _cancelFuture = _onCancel();
- }
-
- /**
- * Increment the pause count.
- *
- * Also marks input as paused.
- */
- void _incrementPauseCount() {
- _state = (_state + _STATE_PAUSE_COUNT) | _STATE_INPUT_PAUSED;
- }
-
- /**
- * Decrements the pause count.
- *
- * Does not automatically unpause the input (call [_onResume]) when
- * the pause count reaches zero. This is handled elsewhere, and only
- * if there are no pending events buffered.
- */
- void _decrementPauseCount() {
- assert(_isPaused);
- _state -= _STATE_PAUSE_COUNT;
- }
-
- // _EventSink interface.
-
- void _add(T data) {
- assert(!_isClosed);
- if (_isCanceled) return;
- if (_canFire) {
- _sendData(data);
- } else {
- _addPending(new _DelayedData<dynamic /*=T*/>(data));
- }
- }
-
- void _addError(Object error, StackTrace stackTrace) {
- if (_isCanceled) return;
- if (_canFire) {
- _sendError(error, stackTrace); // Reports cancel after sending.
- } else {
- _addPending(new _DelayedError(error, stackTrace));
- }
- }
-
- void _close() {
- assert(!_isClosed);
- if (_isCanceled) return;
- _state |= _STATE_CLOSED;
- if (_canFire) {
- _sendDone();
- } else {
- _addPending(const _DelayedDone());
- }
- }
-
- // Hooks called when the input is paused, unpaused or canceled.
- // These must not throw. If overwritten to call user code, include suitable
- // try/catch wrapping and send any errors to
- // [_Zone.current.handleUncaughtError].
- void _onPause() {
- assert(_isInputPaused);
- }
-
- void _onResume() {
- assert(!_isInputPaused);
- }
-
- Future _onCancel() {
- assert(_isCanceled);
- return null;
- }
-
- // Handle pending events.
-
- /**
- * Add a pending event.
- *
- * If the subscription is not paused, this also schedules a firing
- * of pending events later (if necessary).
- */
- void _addPending(_DelayedEvent event) {
- _StreamImplEvents<T> pending = _pending;
- if (_pending == null) {
- pending = _pending = new _StreamImplEvents<dynamic /*=T*/>();
- }
- pending.add(event);
- if (!_hasPending) {
- _state |= _STATE_HAS_PENDING;
- if (!_isPaused) {
- _pending.schedule(this);
- }
- }
- }
-
- /* _EventDispatch interface. */
-
- void _sendData(T data) {
- assert(!_isCanceled);
- assert(!_isPaused);
- assert(!_inCallback);
- bool wasInputPaused = _isInputPaused;
- _state |= _STATE_IN_CALLBACK;
- _zone.runUnaryGuarded(_onData, data);
- _state &= ~_STATE_IN_CALLBACK;
- _checkState(wasInputPaused);
- }
-
- void _sendError(var error, StackTrace stackTrace) {
- assert(!_isCanceled);
- assert(!_isPaused);
- assert(!_inCallback);
- bool wasInputPaused = _isInputPaused;
-
- void sendError() {
- // If the subscription has been canceled while waiting for the cancel
- // future to finish we must not report the error.
- if (_isCanceled && !_waitsForCancel) return;
- _state |= _STATE_IN_CALLBACK;
- if (_onError is ZoneBinaryCallback<dynamic, Object, StackTrace>) {
- ZoneBinaryCallback<dynamic, Object, StackTrace> errorCallback = _onError
- as Object /*=ZoneBinaryCallback<dynamic, Object, StackTrace>*/;
- _zone.runBinaryGuarded(errorCallback, error, stackTrace);
- } else {
- _zone.runUnaryGuarded/*<dynamic, dynamic>*/(
- _onError as Object /*=ZoneUnaryCallback<dynamic, dynamic>*/, error);
- }
- _state &= ~_STATE_IN_CALLBACK;
- }
-
- if (_cancelOnError) {
- _state |= _STATE_WAIT_FOR_CANCEL;
- _cancel();
- if (_cancelFuture is Future) {
- _cancelFuture.whenComplete(sendError);
- } else {
- sendError();
- }
- } else {
- sendError();
- // Only check state if not cancelOnError.
- _checkState(wasInputPaused);
- }
- }
-
- void _sendDone() {
- assert(!_isCanceled);
- assert(!_isPaused);
- assert(!_inCallback);
-
- void sendDone() {
- // If the subscription has been canceled while waiting for the cancel
- // future to finish we must not report the done event.
- if (!_waitsForCancel) return;
- _state |= (_STATE_CANCELED | _STATE_CLOSED | _STATE_IN_CALLBACK);
- _zone.runGuarded(_onDone);
- _state &= ~_STATE_IN_CALLBACK;
- }
-
- _cancel();
- _state |= _STATE_WAIT_FOR_CANCEL;
- if (_cancelFuture is Future) {
- _cancelFuture.whenComplete(sendDone);
- } else {
- sendDone();
- }
- }
-
- /**
- * Call a hook function.
- *
- * The call is properly wrapped in code to avoid other callbacks
- * during the call, and it checks for state changes after the call
- * that should cause further callbacks.
- */
- void _guardCallback(void callback()) {
- assert(!_inCallback);
- bool wasInputPaused = _isInputPaused;
- _state |= _STATE_IN_CALLBACK;
- callback();
- _state &= ~_STATE_IN_CALLBACK;
- _checkState(wasInputPaused);
- }
-
- /**
- * Check if the input needs to be informed of state changes.
- *
- * State changes are pausing, resuming and canceling.
- *
- * After canceling, no further callbacks will happen.
- *
- * The cancel callback is called after a user cancel, or after
- * the final done event is sent.
- */
- void _checkState(bool wasInputPaused) {
- assert(!_inCallback);
- if (_hasPending && _pending.isEmpty) {
- _state &= ~_STATE_HAS_PENDING;
- if (_isInputPaused && _mayResumeInput) {
- _state &= ~_STATE_INPUT_PAUSED;
- }
- }
- // If the state changes during a callback, we immediately
- // make a new state-change callback. Loop until the state didn't change.
- while (true) {
- if (_isCanceled) {
- _pending = null;
- return;
- }
- bool isInputPaused = _isInputPaused;
- if (wasInputPaused == isInputPaused) break;
- _state ^= _STATE_IN_CALLBACK;
- if (isInputPaused) {
- _onPause();
- } else {
- _onResume();
- }
- _state &= ~_STATE_IN_CALLBACK;
- wasInputPaused = isInputPaused;
- }
- if (_hasPending && !_isPaused) {
- _pending.schedule(this);
- }
- }
-}
-
-// -------------------------------------------------------------------
-// Common base class for single and multi-subscription streams.
-// -------------------------------------------------------------------
-abstract class _StreamImpl<T> extends Stream<T> {
- // ------------------------------------------------------------------
- // Stream interface.
-
- StreamSubscription<T> listen(void onData(T data),
- { Function onError,
- void onDone(),
- bool cancelOnError }) {
- cancelOnError = identical(true, cancelOnError);
- StreamSubscription<T> subscription =
- _createSubscription(onData, onError, onDone, cancelOnError);
- _onListen(subscription);
- return subscription;
- }
-
- // -------------------------------------------------------------------
- /** Create a subscription object. Called by [subcribe]. */
- StreamSubscription<T> _createSubscription(
- void onData(T data),
- Function onError,
- void onDone(),
- bool cancelOnError) {
- return new _BufferingStreamSubscription<T>(onData, onError, onDone,
- cancelOnError);
- }
-
- /** Hook called when the subscription has been created. */
- void _onListen(StreamSubscription subscription) {}
-}
-
-typedef _PendingEvents<T> _EventGenerator<T>();
-
-/** Stream that generates its own events. */
-class _GeneratedStreamImpl<T> extends _StreamImpl<T> {
- final _EventGenerator<T> _pending;
- bool _isUsed = false;
- /**
- * Initializes the stream to have only the events provided by a
- * [_PendingEvents].
- *
- * A new [_PendingEvents] must be generated for each listen.
- */
- _GeneratedStreamImpl(this._pending);
-
- StreamSubscription<T> _createSubscription(
- void onData(T data),
- Function onError,
- void onDone(),
- bool cancelOnError) {
- if (_isUsed) throw new StateError("Stream has already been listened to.");
- _isUsed = true;
- return new _BufferingStreamSubscription<T>(
- onData, onError, onDone, cancelOnError).._setPendingEvents(_pending());
- }
-}
-
-
-/** Pending events object that gets its events from an [Iterable]. */
-class _IterablePendingEvents<T> extends _PendingEvents<T> {
- // The iterator providing data for data events.
- // Set to null when iteration has completed.
- Iterator<T> _iterator;
-
- _IterablePendingEvents(Iterable<T> data) : _iterator = data.iterator;
-
- bool get isEmpty => _iterator == null;
-
- void handleNext(_EventDispatch<T> dispatch) {
- if (_iterator == null) {
- throw new StateError("No events pending.");
- }
- // Send one event per call to moveNext.
- // If moveNext returns true, send the current element as data.
- // If moveNext returns false, send a done event and clear the _iterator.
- // If moveNext throws an error, send an error and clear the _iterator.
- // After an error, no further events will be sent.
- bool isDone;
- try {
- isDone = !_iterator.moveNext();
- } catch (e, s) {
- _iterator = null;
- dispatch._sendError(e, s);
- return;
- }
- if (!isDone) {
- dispatch._sendData(_iterator.current);
- } else {
- _iterator = null;
- dispatch._sendDone();
- }
- }
-
- void clear() {
- if (isScheduled) cancelSchedule();
- _iterator = null;
- }
-}
-
-
-// Internal helpers.
-
-// Types of the different handlers on a stream. Types used to type fields.
-typedef void _DataHandler<T>(T value);
-typedef void _DoneHandler();
-
-
-/** Default data handler, does nothing. */
-void _nullDataHandler(var value) {}
-
-/** Default error handler, reports the error to the current zone's handler. */
-void _nullErrorHandler(error, [StackTrace stackTrace]) {
- Zone.current.handleUncaughtError(error, stackTrace);
-}
-
-/** Default done handler, does nothing. */
-void _nullDoneHandler() {}
-
-
-/** A delayed event on a buffering stream subscription. */
-abstract class _DelayedEvent<T> {
- /** Added as a linked list on the [StreamController]. */
- _DelayedEvent next;
- /** Execute the delayed event on the [StreamController]. */
- void perform(_EventDispatch<T> dispatch);
-}
-
-/** A delayed data event. */
-class _DelayedData<T> extends _DelayedEvent<T> {
- final T value;
- _DelayedData(this.value);
- void perform(_EventDispatch<T> dispatch) {
- dispatch._sendData(value);
- }
-}
-
-/** A delayed error event. */
-class _DelayedError extends _DelayedEvent {
- final error;
- final StackTrace stackTrace;
-
- _DelayedError(this.error, this.stackTrace);
- void perform(_EventDispatch dispatch) {
- dispatch._sendError(error, stackTrace);
- }
-}
-
-/** A delayed done event. */
-class _DelayedDone implements _DelayedEvent {
- const _DelayedDone();
- void perform(_EventDispatch dispatch) {
- dispatch._sendDone();
- }
-
- _DelayedEvent get next => null;
-
- void set next(_DelayedEvent _) {
- throw new StateError("No events after a done.");
- }
-}
-
-/** Superclass for provider of pending events. */
-abstract class _PendingEvents<T> {
- // No async event has been scheduled.
- static const int _STATE_UNSCHEDULED = 0;
- // An async event has been scheduled to run a function.
- static const int _STATE_SCHEDULED = 1;
- // An async event has been scheduled, but it will do nothing when it runs.
- // Async events can't be preempted.
- static const int _STATE_CANCELED = 3;
-
- /**
- * State of being scheduled.
- *
- * Set to [_STATE_SCHEDULED] when pending events are scheduled for
- * async dispatch. Since we can't cancel a [scheduleMicrotask] call, if
- * scheduling is "canceled", the _state is simply set to [_STATE_CANCELED]
- * which will make the async code do nothing except resetting [_state].
- *
- * If events are scheduled while the state is [_STATE_CANCELED], it is
- * merely switched back to [_STATE_SCHEDULED], but no new call to
- * [scheduleMicrotask] is performed.
- */
- int _state = _STATE_UNSCHEDULED;
-
- bool get isEmpty;
-
- bool get isScheduled => _state == _STATE_SCHEDULED;
- bool get _eventScheduled => _state >= _STATE_SCHEDULED;
-
- /**
- * Schedule an event to run later.
- *
- * If called more than once, it should be called with the same dispatch as
- * argument each time. It may reuse an earlier argument in some cases.
- */
- void schedule(_EventDispatch<T> dispatch) {
- if (isScheduled) return;
- assert(!isEmpty);
- if (_eventScheduled) {
- assert(_state == _STATE_CANCELED);
- _state = _STATE_SCHEDULED;
- return;
- }
- scheduleMicrotask(() {
- int oldState = _state;
- _state = _STATE_UNSCHEDULED;
- if (oldState == _STATE_CANCELED) return;
- handleNext(dispatch);
- });
- _state = _STATE_SCHEDULED;
- }
-
- void cancelSchedule() {
- if (isScheduled) _state = _STATE_CANCELED;
- }
-
- void handleNext(_EventDispatch<T> dispatch);
-
- /** Throw away any pending events and cancel scheduled events. */
- void clear();
-}
-
-
-/** Class holding pending events for a [_StreamImpl]. */
-class _StreamImplEvents<T> extends _PendingEvents<T> {
- /// Single linked list of [_DelayedEvent] objects.
- _DelayedEvent firstPendingEvent = null;
- /// Last element in the list of pending events. New events are added after it.
- _DelayedEvent lastPendingEvent = null;
-
- bool get isEmpty => lastPendingEvent == null;
-
- void add(_DelayedEvent event) {
- if (lastPendingEvent == null) {
- firstPendingEvent = lastPendingEvent = event;
- } else {
- lastPendingEvent = lastPendingEvent.next = event;
- }
- }
-
- void handleNext(_EventDispatch<T> dispatch) {
- assert(!isScheduled);
- _DelayedEvent event = firstPendingEvent;
- firstPendingEvent = event.next;
- if (firstPendingEvent == null) {
- lastPendingEvent = null;
- }
- event.perform(dispatch);
- }
-
- void clear() {
- if (isScheduled) cancelSchedule();
- firstPendingEvent = lastPendingEvent = null;
- }
-}
-
-class _BroadcastLinkedList {
- _BroadcastLinkedList _next;
- _BroadcastLinkedList _previous;
-
- void _unlink() {
- _previous._next = _next;
- _next._previous = _previous;
- _next = _previous = this;
- }
-
- void _insertBefore(_BroadcastLinkedList newNext) {
- _BroadcastLinkedList newPrevious = newNext._previous;
- newPrevious._next = this;
- newNext._previous = _previous;
- _previous._next = newNext;
- _previous = newPrevious;
- }
-}
-
-typedef void _BroadcastCallback<T>(StreamSubscription<T> subscription);
-
-/**
- * Done subscription that will send one done event as soon as possible.
- */
-class _DoneStreamSubscription<T> implements StreamSubscription<T> {
- static const int _DONE_SENT = 1;
- static const int _SCHEDULED = 2;
- static const int _PAUSED = 4;
-
- final Zone _zone;
- int _state = 0;
- _DoneHandler _onDone;
-
- _DoneStreamSubscription(this._onDone) : _zone = Zone.current {
- _schedule();
- }
-
- bool get _isSent => (_state & _DONE_SENT) != 0;
- bool get _isScheduled => (_state & _SCHEDULED) != 0;
- bool get isPaused => _state >= _PAUSED;
-
- void _schedule() {
- if (_isScheduled) return;
- _zone.scheduleMicrotask(_sendDone);
- _state |= _SCHEDULED;
- }
-
- void onData(void handleData(T data)) {}
- void onError(Function handleError) {}
- void onDone(void handleDone()) { _onDone = handleDone; }
-
- void pause([Future resumeSignal]) {
- _state += _PAUSED;
- if (resumeSignal != null) resumeSignal.whenComplete(resume);
- }
-
- void resume() {
- if (isPaused) {
- _state -= _PAUSED;
- if (!isPaused && !_isSent) {
- _schedule();
- }
- }
- }
-
- Future cancel() => null;
-
- Future/*<E>*/ asFuture/*<E>*/([var/*=E*/ futureValue]) {
- _Future/*<E>*/ result = new _Future/*<E>*/();
- _onDone = () { result._completeWithValue(null); };
- return result;
- }
-
- void _sendDone() {
- _state &= ~_SCHEDULED;
- if (isPaused) return;
- _state |= _DONE_SENT;
- if (_onDone != null) _zone.runGuarded(_onDone);
- }
-}
-
-class _AsBroadcastStream<T> extends Stream<T> {
- final Stream<T> _source;
- final _BroadcastCallback<T> _onListenHandler;
- final _BroadcastCallback<T> _onCancelHandler;
- final Zone _zone;
-
- _AsBroadcastStreamController<T> _controller;
- StreamSubscription<T> _subscription;
-
- _AsBroadcastStream(this._source,
- void onListenHandler(StreamSubscription<T> subscription),
- void onCancelHandler(StreamSubscription<T> subscription))
- // TODO(floitsch): the return type should be void and should be
- // inferred.
- : _onListenHandler = Zone.current.registerUnaryCallback
- /*<dynamic, StreamSubscription<T>>*/(onListenHandler),
- _onCancelHandler = Zone.current.registerUnaryCallback
- /*<dynamic, StreamSubscription<T>>*/(onCancelHandler),
- _zone = Zone.current {
- _controller = new _AsBroadcastStreamController<T>(_onListen, _onCancel);
- }
-
- bool get isBroadcast => true;
-
- StreamSubscription<T> listen(void onData(T data),
- { Function onError,
- void onDone(),
- bool cancelOnError}) {
- if (_controller == null || _controller.isClosed) {
- // Return a dummy subscription backed by nothing, since
- // it will only ever send one done event.
- return new _DoneStreamSubscription<T>(onDone);
- }
- if (_subscription == null) {
- _subscription = _source.listen(_controller.add,
- onError: _controller.addError,
- onDone: _controller.close);
- }
- cancelOnError = identical(true, cancelOnError);
- return _controller._subscribe(onData, onError, onDone, cancelOnError);
- }
-
- void _onCancel() {
- bool shutdown = (_controller == null) || _controller.isClosed;
- if (_onCancelHandler != null) {
- _zone.runUnary(
- _onCancelHandler, new _BroadcastSubscriptionWrapper<T>(this));
- }
- if (shutdown) {
- if (_subscription != null) {
- _subscription.cancel();
- _subscription = null;
- }
- }
- }
-
- void _onListen() {
- if (_onListenHandler != null) {
- _zone.runUnary(
- _onListenHandler, new _BroadcastSubscriptionWrapper<T>(this));
- }
- }
-
- // Methods called from _BroadcastSubscriptionWrapper.
- void _cancelSubscription() {
- if (_subscription == null) return;
- // Called by [_controller] when it has no subscribers left.
- StreamSubscription subscription = _subscription;
- _subscription = null;
- _controller = null; // Marks the stream as no longer listenable.
- subscription.cancel();
- }
-
- void _pauseSubscription(Future resumeSignal) {
- if (_subscription == null) return;
- _subscription.pause(resumeSignal);
- }
-
- void _resumeSubscription() {
- if (_subscription == null) return;
- _subscription.resume();
- }
-
- bool get _isSubscriptionPaused {
- if (_subscription == null) return false;
- return _subscription.isPaused;
- }
-}
-
-/**
- * Wrapper for subscription that disallows changing handlers.
- */
-class _BroadcastSubscriptionWrapper<T> implements StreamSubscription<T> {
- final _AsBroadcastStream _stream;
-
- _BroadcastSubscriptionWrapper(this._stream);
-
- void onData(void handleData(T data)) {
- throw new UnsupportedError(
- "Cannot change handlers of asBroadcastStream source subscription.");
- }
-
- void onError(Function handleError) {
- throw new UnsupportedError(
- "Cannot change handlers of asBroadcastStream source subscription.");
- }
-
- void onDone(void handleDone()) {
- throw new UnsupportedError(
- "Cannot change handlers of asBroadcastStream source subscription.");
- }
-
- void pause([Future resumeSignal]) {
- _stream._pauseSubscription(resumeSignal);
- }
-
- void resume() {
- _stream._resumeSubscription();
- }
-
- Future cancel() {
- _stream._cancelSubscription();
- return null;
- }
-
- bool get isPaused {
- return _stream._isSubscriptionPaused;
- }
-
- Future/*<E>*/ asFuture/*<E>*/([var/*=E*/ futureValue]) {
- throw new UnsupportedError(
- "Cannot change handlers of asBroadcastStream source subscription.");
- }
-}
-
-
-/**
- * Simple implementation of [StreamIterator].
- */
-class _StreamIteratorImpl<T> implements StreamIterator<T> {
- // Internal state of the stream iterator.
- // At any time, it is in one of these states.
- // The interpretation of the [_futureOrPrefecth] field depends on the state.
- // In _STATE_MOVING, the _data field holds the most recently returned
- // future.
- // When in one of the _STATE_EXTRA_* states, the it may hold the
- // next data/error object, and the subscription is paused.
-
- /// The simple state where [_data] holds the data to return, and [moveNext]
- /// is allowed. The subscription is actively listening.
- static const int _STATE_FOUND = 0;
- /// State set after [moveNext] has returned false or an error,
- /// or after calling [cancel]. The subscription is always canceled.
- static const int _STATE_DONE = 1;
- /// State set after calling [moveNext], but before its returned future has
- /// completed. Calling [moveNext] again is not allowed in this state.
- /// The subscription is actively listening.
- static const int _STATE_MOVING = 2;
- /// States set when another event occurs while in _STATE_FOUND.
- /// This extra overflow event is cached until the next call to [moveNext],
- /// which will complete as if it received the event normally.
- /// The subscription is paused in these states, so we only ever get one
- /// event too many.
- static const int _STATE_EXTRA_DATA = 3;
- static const int _STATE_EXTRA_ERROR = 4;
- static const int _STATE_EXTRA_DONE = 5;
-
- /// Subscription being listened to.
- StreamSubscription _subscription;
-
- /// The current element represented by the most recent call to moveNext.
- ///
- /// Is null between the time moveNext is called and its future completes.
- T _current = null;
-
- /// The future returned by the most recent call to [moveNext].
- ///
- /// Also used to store the next value/error in case the stream provides an
- /// event before [moveNext] is called again. In that case, the stream will
- /// be paused to prevent further events.
- var/*Future<bool> or T*/ _futureOrPrefetch = null;
-
- /// The current state.
- int _state = _STATE_FOUND;
-
- _StreamIteratorImpl(final Stream<T> stream) {
- _subscription = stream.listen(_onData,
- onError: _onError,
- onDone: _onDone,
- cancelOnError: true);
- }
-
- T get current => _current;
-
- Future<bool> moveNext() {
- if (_state == _STATE_DONE) {
- return new _Future<bool>.immediate(false);
- }
- if (_state == _STATE_MOVING) {
- throw new StateError("Already waiting for next.");
- }
- if (_state == _STATE_FOUND) {
- _state = _STATE_MOVING;
- _current = null;
- var result = new _Future<bool>();
- _futureOrPrefetch = result;
- return result;
- } else {
- assert(_state >= _STATE_EXTRA_DATA);
- switch (_state) {
- case _STATE_EXTRA_DATA:
- _state = _STATE_FOUND;
- _current = _futureOrPrefetch as Object /*=T*/;
- _futureOrPrefetch = null;
- _subscription.resume();
- return new _Future<bool>.immediate(true);
- case _STATE_EXTRA_ERROR:
- AsyncError prefetch = _futureOrPrefetch;
- _clear();
- return new _Future<bool>.immediateError(prefetch.error,
- prefetch.stackTrace);
- case _STATE_EXTRA_DONE:
- _clear();
- return new _Future<bool>.immediate(false);
- }
- }
- }
-
- /** Clears up the internal state when the iterator ends. */
- void _clear() {
- _subscription = null;
- _futureOrPrefetch = null;
- _current = null;
- _state = _STATE_DONE;
- }
-
- Future cancel() {
- StreamSubscription subscription = _subscription;
- if (subscription == null) return null;
- if (_state == _STATE_MOVING) {
- _Future<bool> hasNext = _futureOrPrefetch as Object /*=_Future<bool>*/;
- _clear();
- hasNext._complete(false);
- } else {
- _clear();
- }
- return subscription.cancel();
- }
-
- void _onData(T data) {
- if (_state == _STATE_MOVING) {
- _current = data;
- _Future<bool> hasNext = _futureOrPrefetch as Object /*=_Future<bool>*/;
- _futureOrPrefetch = null;
- _state = _STATE_FOUND;
- hasNext._complete(true);
- return;
- }
- _subscription.pause();
- assert(_futureOrPrefetch == null);
- _futureOrPrefetch = data;
- _state = _STATE_EXTRA_DATA;
- }
-
- void _onError(Object error, [StackTrace stackTrace]) {
- if (_state == _STATE_MOVING) {
- _Future<bool> hasNext = _futureOrPrefetch as Object /*=_Future<bool>*/;
- // We have cancelOnError: true, so the subscription is canceled.
- _clear();
- hasNext._completeError(error, stackTrace);
- return;
- }
- _subscription.pause();
- assert(_futureOrPrefetch == null);
- _futureOrPrefetch = new AsyncError(error, stackTrace);
- _state = _STATE_EXTRA_ERROR;
- }
-
- void _onDone() {
- if (_state == _STATE_MOVING) {
- _Future<bool> hasNext = _futureOrPrefetch as Object /*=_Future<bool>*/;
- _clear();
- hasNext._complete(false);
- return;
- }
- _subscription.pause();
- _futureOrPrefetch = null;
- _state = _STATE_EXTRA_DONE;
- }
-}
-
-/** An empty broadcast stream, sending a done event as soon as possible. */
-class _EmptyStream<T> extends Stream<T> {
- const _EmptyStream() : super._internal();
- bool get isBroadcast => true;
- StreamSubscription<T> listen(void onData(T data),
- {Function onError,
- void onDone(),
- bool cancelOnError}) {
- return new _DoneStreamSubscription<T>(onDone);
- }
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/async/stream_pipe.dart b/pkg/dev_compiler/tool/input_sdk/lib/async/stream_pipe.dart
deleted file mode 100644
index 1125620..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/async/stream_pipe.dart
+++ /dev/null
@@ -1,495 +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.
-
-part of dart.async;
-
-/** Runs user code and takes actions depending on success or failure. */
-_runUserCode(userCode(),
- onSuccess(value),
- onError(error, StackTrace stackTrace)) {
- try {
- onSuccess(userCode());
- } catch (e, s) {
- AsyncError replacement = Zone.current.errorCallback(e, s);
- if (replacement == null) {
- onError(e, s);
- } else {
- var error = _nonNullError(replacement.error);
- var stackTrace = replacement.stackTrace;
- onError(error, stackTrace);
- }
- }
-}
-
-/** Helper function to cancel a subscription and wait for the potential future,
- before completing with an error. */
-void _cancelAndError(StreamSubscription subscription,
- _Future future,
- error,
- StackTrace stackTrace) {
- var cancelFuture = subscription.cancel();
- if (cancelFuture is Future) {
- cancelFuture.whenComplete(() => future._completeError(error, stackTrace));
- } else {
- future._completeError(error, stackTrace);
- }
-}
-
-void _cancelAndErrorWithReplacement(StreamSubscription subscription,
- _Future future,
- error, StackTrace stackTrace) {
- AsyncError replacement = Zone.current.errorCallback(error, stackTrace);
- if (replacement != null) {
- error = _nonNullError(replacement.error);
- stackTrace = replacement.stackTrace;
- }
- _cancelAndError(subscription, future, error, stackTrace);
-}
-
-typedef void _ErrorCallback(error, StackTrace stackTrace);
-
-/** Helper function to make an onError argument to [_runUserCode]. */
-_ErrorCallback _cancelAndErrorClosure(
- StreamSubscription subscription, _Future future) {
- return (error, StackTrace stackTrace) {
- _cancelAndError(subscription, future, error, stackTrace);
- };
-}
-
-/** Helper function to cancel a subscription and wait for the potential future,
- before completing with a value. */
-void _cancelAndValue(StreamSubscription subscription, _Future future, value) {
- var cancelFuture = subscription.cancel();
- if (cancelFuture is Future) {
- cancelFuture.whenComplete(() => future._complete(value));
- } else {
- future._complete(value);
- }
-}
-
-
-/**
- * A [Stream] that forwards subscriptions to another stream.
- *
- * This stream implements [Stream], but forwards all subscriptions
- * to an underlying stream, and wraps the returned subscription to
- * modify the events on the way.
- *
- * This class is intended for internal use only.
- */
-abstract class _ForwardingStream<S, T> extends Stream<T> {
- final Stream<S> _source;
-
- _ForwardingStream(this._source);
-
- bool get isBroadcast => _source.isBroadcast;
-
- StreamSubscription<T> listen(void onData(T value),
- { Function onError,
- void onDone(),
- bool cancelOnError }) {
- cancelOnError = identical(true, cancelOnError);
- return _createSubscription(onData, onError, onDone, cancelOnError);
- }
-
- StreamSubscription<T> _createSubscription(
- void onData(T data),
- Function onError,
- void onDone(),
- bool cancelOnError) {
- return new _ForwardingStreamSubscription<S, T>(
- this, onData, onError, onDone, cancelOnError);
- }
-
- // Override the following methods in subclasses to change the behavior.
-
- void _handleData(S data, _EventSink<T> sink) {
- sink._add(data as Object /*=T*/);
- }
-
- void _handleError(error, StackTrace stackTrace, _EventSink<T> sink) {
- sink._addError(error, stackTrace);
- }
-
- void _handleDone(_EventSink<T> sink) {
- sink._close();
- }
-}
-
-/**
- * Abstract superclass for subscriptions that forward to other subscriptions.
- */
-class _ForwardingStreamSubscription<S, T>
- extends _BufferingStreamSubscription<T> {
- final _ForwardingStream<S, T> _stream;
-
- StreamSubscription<S> _subscription;
-
- _ForwardingStreamSubscription(this._stream, void onData(T data),
- Function onError, void onDone(),
- bool cancelOnError)
- : super(onData, onError, onDone, cancelOnError) {
- _subscription = _stream._source.listen(_handleData,
- onError: _handleError,
- onDone: _handleDone);
- }
-
- // _StreamSink interface.
- // Transformers sending more than one event have no way to know if the stream
- // is canceled or closed after the first, so we just ignore remaining events.
-
- void _add(T data) {
- if (_isClosed) return;
- super._add(data);
- }
-
- void _addError(Object error, StackTrace stackTrace) {
- if (_isClosed) return;
- super._addError(error, stackTrace);
- }
-
- // StreamSubscription callbacks.
-
- void _onPause() {
- if (_subscription == null) return;
- _subscription.pause();
- }
-
- void _onResume() {
- if (_subscription == null) return;
- _subscription.resume();
- }
-
- Future _onCancel() {
- if (_subscription != null) {
- StreamSubscription subscription = _subscription;
- _subscription = null;
- return subscription.cancel();
- }
- return null;
- }
-
- // Methods used as listener on source subscription.
-
- void _handleData(S data) {
- _stream._handleData(data, this);
- }
-
- void _handleError(error, StackTrace stackTrace) {
- _stream._handleError(error, stackTrace, this);
- }
-
- void _handleDone() {
- _stream._handleDone(this);
- }
-}
-
-// -------------------------------------------------------------------
-// Stream transformers used by the default Stream implementation.
-// -------------------------------------------------------------------
-
-typedef bool _Predicate<T>(T value);
-
-void _addErrorWithReplacement(_EventSink sink, error, stackTrace) {
- AsyncError replacement = Zone.current.errorCallback(error, stackTrace);
- if (replacement != null) {
- error = _nonNullError(replacement.error);
- stackTrace = replacement.stackTrace;
- }
- sink._addError(error, stackTrace);
-}
-
-
-class _WhereStream<T> extends _ForwardingStream<T, T> {
- final _Predicate<T> _test;
-
- _WhereStream(Stream<T> source, bool test(T value))
- : _test = test, super(source);
-
- void _handleData(T inputEvent, _EventSink<T> sink) {
- bool satisfies;
- try {
- satisfies = _test(inputEvent);
- } catch (e, s) {
- _addErrorWithReplacement(sink, e, s);
- return;
- }
- if (satisfies) {
- sink._add(inputEvent);
- }
- }
-}
-
-
-typedef T _Transformation<S, T>(S value);
-
-/**
- * A stream pipe that converts data events before passing them on.
- */
-class _MapStream<S, T> extends _ForwardingStream<S, T> {
- final _Transformation<S, T> _transform;
-
- _MapStream(Stream<S> source, T transform(S event))
- : this._transform = transform, super(source);
-
- void _handleData(S inputEvent, _EventSink<T> sink) {
- T outputEvent;
- try {
- outputEvent = _transform(inputEvent);
- } catch (e, s) {
- _addErrorWithReplacement(sink, e, s);
- return;
- }
- sink._add(outputEvent);
- }
-}
-
-/**
- * A stream pipe that converts data events before passing them on.
- */
-class _ExpandStream<S, T> extends _ForwardingStream<S, T> {
- final _Transformation<S, Iterable<T>> _expand;
-
- _ExpandStream(Stream<S> source, Iterable<T> expand(S event))
- : this._expand = expand, super(source);
-
- void _handleData(S inputEvent, _EventSink<T> sink) {
- try {
- for (T value in _expand(inputEvent)) {
- sink._add(value);
- }
- } catch (e, s) {
- // If either _expand or iterating the generated iterator throws,
- // we abort the iteration.
- _addErrorWithReplacement(sink, e, s);
- }
- }
-}
-
-
-typedef bool _ErrorTest(error);
-
-/**
- * A stream pipe that converts or disposes error events
- * before passing them on.
- */
-class _HandleErrorStream<T> extends _ForwardingStream<T, T> {
- final Function _transform;
- final _ErrorTest _test;
-
- _HandleErrorStream(Stream<T> source,
- Function onError,
- bool test(error))
- : this._transform = onError, this._test = test, super(source);
-
- void _handleError(Object error, StackTrace stackTrace, _EventSink<T> sink) {
- bool matches = true;
- if (_test != null) {
- try {
- matches = _test(error);
- } catch (e, s) {
- _addErrorWithReplacement(sink, e, s);
- return;
- }
- }
- if (matches) {
- try {
- _invokeErrorHandler(_transform, error, stackTrace);
- } catch (e, s) {
- if (identical(e, error)) {
- sink._addError(error, stackTrace);
- } else {
- _addErrorWithReplacement(sink, e, s);
- }
- return;
- }
- } else {
- sink._addError(error, stackTrace);
- }
- }
-}
-
-
-class _TakeStream<T> extends _ForwardingStream<T, T> {
- final int _count;
-
- _TakeStream(Stream<T> source, int count)
- : this._count = count, super(source) {
- // This test is done early to avoid handling an async error
- // in the _handleData method.
- if (count is! int) throw new ArgumentError(count);
- }
-
- StreamSubscription<T> _createSubscription(
- void onData(T data),
- Function onError,
- void onDone(),
- bool cancelOnError) {
- return new _StateStreamSubscription<T>(
- this, onData, onError, onDone, cancelOnError, _count);
- }
-
- void _handleData(T inputEvent, _EventSink<T> sink) {
- _StateStreamSubscription<T> subscription = sink;
- int count = subscription._count;
- if (count > 0) {
- sink._add(inputEvent);
- count -= 1;
- subscription._count = count;
- if (count == 0) {
- // Closing also unsubscribes all subscribers, which unsubscribes
- // this from source.
- sink._close();
- }
- }
- }
-}
-
-/**
- * A [_ForwardingStreamSubscription] with one extra state field.
- *
- * Use by several different classes, some storing an integer, others a bool.
- */
-class _StateStreamSubscription<T> extends _ForwardingStreamSubscription<T, T> {
- // Raw state field. Typed access provided by getters and setters below.
- var _sharedState;
-
- _StateStreamSubscription(_ForwardingStream<T, T> stream, void onData(T data),
- Function onError, void onDone(),
- bool cancelOnError, this._sharedState)
- : super(stream, onData, onError, onDone, cancelOnError);
-
- bool get _flag => _sharedState;
- void set _flag(bool flag) { _sharedState = flag; }
- int get _count => _sharedState;
- void set _count(int count) { _sharedState = count; }
-}
-
-
-class _TakeWhileStream<T> extends _ForwardingStream<T, T> {
- final _Predicate<T> _test;
-
- _TakeWhileStream(Stream<T> source, bool test(T value))
- : this._test = test, super(source);
-
- void _handleData(T inputEvent, _EventSink<T> sink) {
- bool satisfies;
- try {
- satisfies = _test(inputEvent);
- } catch (e, s) {
- _addErrorWithReplacement(sink, e, s);
- // The test didn't say true. Didn't say false either, but we stop anyway.
- sink._close();
- return;
- }
- if (satisfies) {
- sink._add(inputEvent);
- } else {
- sink._close();
- }
- }
-}
-
-class _SkipStream<T> extends _ForwardingStream<T, T> {
- final int _count;
-
- _SkipStream(Stream<T> source, int count)
- : this._count = count, super(source) {
- // This test is done early to avoid handling an async error
- // in the _handleData method.
- if (count is! int || count < 0) throw new ArgumentError(count);
- }
-
- StreamSubscription<T> _createSubscription(
- void onData(T data),
- Function onError,
- void onDone(),
- bool cancelOnError) {
- return new _StateStreamSubscription<T>(
- this, onData, onError, onDone, cancelOnError, _count);
- }
-
- void _handleData(T inputEvent, _EventSink<T> sink) {
- _StateStreamSubscription<T> subscription = sink;
- int count = subscription._count;
- if (count > 0) {
- subscription._count = count - 1;
- return;
- }
- sink._add(inputEvent);
- }
-}
-
-class _SkipWhileStream<T> extends _ForwardingStream<T, T> {
- final _Predicate<T> _test;
-
- _SkipWhileStream(Stream<T> source, bool test(T value))
- : this._test = test, super(source);
-
- StreamSubscription<T> _createSubscription(
- void onData(T data),
- Function onError,
- void onDone(),
- bool cancelOnError) {
- return new _StateStreamSubscription<T>(
- this, onData, onError, onDone, cancelOnError, false);
- }
-
- void _handleData(T inputEvent, _EventSink<T> sink) {
- _StateStreamSubscription<T> subscription = sink;
- bool hasFailed = subscription._flag;
- if (hasFailed) {
- sink._add(inputEvent);
- return;
- }
- bool satisfies;
- try {
- satisfies = _test(inputEvent);
- } catch (e, s) {
- _addErrorWithReplacement(sink, e, s);
- // A failure to return a boolean is considered "not matching".
- subscription._flag = true;
- return;
- }
- if (!satisfies) {
- subscription._flag = true;
- sink._add(inputEvent);
- }
- }
-}
-
-typedef bool _Equality<T>(T a, T b);
-
-class _DistinctStream<T> extends _ForwardingStream<T, T> {
- static var _SENTINEL = new Object();
-
- _Equality<T> _equals;
- var _previous = _SENTINEL;
-
- _DistinctStream(Stream<T> source, bool equals(T a, T b))
- : _equals = equals, super(source);
-
- void _handleData(T inputEvent, _EventSink<T> sink) {
- if (identical(_previous, _SENTINEL)) {
- _previous = inputEvent;
- return sink._add(inputEvent);
- } else {
- bool isEqual;
- try {
- if (_equals == null) {
- isEqual = (_previous == inputEvent);
- } else {
- isEqual = _equals(_previous as Object /*=T*/, inputEvent);
- }
- } catch (e, s) {
- _addErrorWithReplacement(sink, e, s);
- return null;
- }
- if (!isEqual) {
- sink._add(inputEvent);
- _previous = inputEvent;
- }
- }
- }
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/async/stream_transformers.dart b/pkg/dev_compiler/tool/input_sdk/lib/async/stream_transformers.dart
deleted file mode 100644
index e0982da..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/async/stream_transformers.dart
+++ /dev/null
@@ -1,313 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-part of dart.async;
-
-/**
- * Wraps an [_EventSink] so it exposes only the [EventSink] interface.
- */
-class _EventSinkWrapper<T> implements EventSink<T> {
- _EventSink _sink;
- _EventSinkWrapper(this._sink);
-
- void add(T data) { _sink._add(data); }
- void addError(error, [StackTrace stackTrace]) {
- _sink._addError(error, stackTrace);
- }
- void close() { _sink._close(); }
-}
-
-/**
- * A StreamSubscription that pipes data through a sink.
- *
- * The constructor of this class takes a [_SinkMapper] which maps from
- * [EventSink] to [EventSink]. The input to the mapper is the output of
- * the transformation. The returned sink is the transformation's input.
- */
-class _SinkTransformerStreamSubscription<S, T>
- extends _BufferingStreamSubscription<T> {
- /// The transformer's input sink.
- EventSink<S> _transformerSink;
-
- /// The subscription to the input stream.
- StreamSubscription<S> _subscription;
-
- _SinkTransformerStreamSubscription(Stream<S> source,
- _SinkMapper<S, T> mapper,
- void onData(T data),
- Function onError,
- void onDone(),
- bool cancelOnError)
- // We set the adapter's target only when the user is allowed to send data.
- : super(onData, onError, onDone, cancelOnError) {
- _EventSinkWrapper<T> eventSink = new _EventSinkWrapper<T>(this);
- _transformerSink = mapper(eventSink);
- _subscription = source.listen(_handleData,
- onError: _handleError,
- onDone: _handleDone);
- }
-
- /** Whether this subscription is still subscribed to its source. */
- bool get _isSubscribed => _subscription != null;
-
- // _EventSink interface.
-
- /**
- * Adds an event to this subscriptions.
- *
- * Contrary to normal [_BufferingStreamSubscription]s we may receive
- * events when the stream is already closed. Report them as state
- * error.
- */
- void _add(T data) {
- if (_isClosed) {
- throw new StateError("Stream is already closed");
- }
- super._add(data);
- }
-
- /**
- * Adds an error event to this subscriptions.
- *
- * Contrary to normal [_BufferingStreamSubscription]s we may receive
- * events when the stream is already closed. Report them as state
- * error.
- */
- void _addError(Object error, StackTrace stackTrace) {
- if (_isClosed) {
- throw new StateError("Stream is already closed");
- }
- super._addError(error, stackTrace);
- }
-
- /**
- * Adds a close event to this subscriptions.
- *
- * Contrary to normal [_BufferingStreamSubscription]s we may receive
- * events when the stream is already closed. Report them as state
- * error.
- */
- void _close() {
- if (_isClosed) {
- throw new StateError("Stream is already closed");
- }
- super._close();
- }
-
- // _BufferingStreamSubscription hooks.
-
- void _onPause() {
- if (_isSubscribed) _subscription.pause();
- }
-
- void _onResume() {
- if (_isSubscribed) _subscription.resume();
- }
-
- Future _onCancel() {
- if (_isSubscribed) {
- StreamSubscription subscription = _subscription;
- _subscription = null;
- subscription.cancel();
- }
- return null;
- }
-
- void _handleData(S data) {
- try {
- _transformerSink.add(data);
- } catch (e, s) {
- _addError(e, s);
- }
- }
-
- void _handleError(error, [stackTrace]) {
- try {
- _transformerSink.addError(error, stackTrace);
- } catch (e, s) {
- if (identical(e, error)) {
- _addError(error, stackTrace);
- } else {
- _addError(e, s);
- }
- }
- }
-
- void _handleDone() {
- try {
- _subscription = null;
- _transformerSink.close();
- } catch (e, s) {
- _addError(e, s);
- }
- }
-}
-
-
-typedef EventSink<S> _SinkMapper<S, T>(EventSink<T> output);
-
-/**
- * A StreamTransformer for Sink-mappers.
- *
- * A Sink-mapper takes an [EventSink] (its output) and returns another
- * EventSink (its input).
- *
- * Note that this class can be `const`.
- */
-class _StreamSinkTransformer<S, T> implements StreamTransformer<S, T> {
- final _SinkMapper<S, T> _sinkMapper;
- const _StreamSinkTransformer(this._sinkMapper);
-
- Stream<T> bind(Stream<S> stream)
- => new _BoundSinkStream<S, T>(stream, _sinkMapper);
-}
-
-/**
- * The result of binding a StreamTransformer for Sink-mappers.
- *
- * It contains the bound Stream and the sink-mapper. Only when the user starts
- * listening to this stream is the sink-mapper invoked. The result is used
- * to create a StreamSubscription that transforms events.
- */
-class _BoundSinkStream<S, T> extends Stream<T> {
- final _SinkMapper<S, T> _sinkMapper;
- final Stream<S> _stream;
-
- bool get isBroadcast => _stream.isBroadcast;
-
- _BoundSinkStream(this._stream, this._sinkMapper);
-
- StreamSubscription<T> listen(void onData(T event),
- { Function onError,
- void onDone(),
- bool cancelOnError }) {
- cancelOnError = identical(true, cancelOnError);
- StreamSubscription<T> subscription =
- new _SinkTransformerStreamSubscription<S, T>(
- _stream, _sinkMapper, onData, onError, onDone, cancelOnError);
- return subscription;
- }
-}
-
-/// Data-handler coming from [StreamTransformer.fromHandlers].
-typedef void _TransformDataHandler<S, T>(S data, EventSink<T> sink);
-/// Error-handler coming from [StreamTransformer.fromHandlers].
-typedef void _TransformErrorHandler<T>(
- Object error, StackTrace stackTrace, EventSink<T> sink);
-/// Done-handler coming from [StreamTransformer.fromHandlers].
-typedef void _TransformDoneHandler<T>(EventSink<T> sink);
-
-/**
- * Wraps handlers (from [StreamTransformer.fromHandlers]) into an `EventSink`.
- *
- * This way we can reuse the code from [_StreamSinkTransformer].
- */
-class _HandlerEventSink<S, T> implements EventSink<S> {
- final _TransformDataHandler<S, T> _handleData;
- final _TransformErrorHandler<T> _handleError;
- final _TransformDoneHandler<T> _handleDone;
-
- /// The output sink where the handlers should send their data into.
- final EventSink<T> _sink;
-
- _HandlerEventSink(this._handleData, this._handleError, this._handleDone,
- this._sink);
-
- void add(S data) { _handleData(data, _sink); }
- void addError(Object error, [StackTrace stackTrace]) {
- _handleError(error, stackTrace, _sink);
- }
- void close() { _handleDone(_sink); }
-}
-
-/**
- * A StreamTransformer that transformers events with the given handlers.
- *
- * Note that this transformer can only be used once.
- */
-class _StreamHandlerTransformer<S, T> extends _StreamSinkTransformer<S, T> {
-
- _StreamHandlerTransformer({
- void handleData(S data, EventSink<T> sink),
- void handleError(Object error, StackTrace stackTrace, EventSink<T> sink),
- void handleDone(EventSink<T> sink)})
- : super((EventSink<T> outputSink) {
- if (handleData == null) handleData = _defaultHandleData;
- if (handleError == null) handleError = _defaultHandleError;
- if (handleDone == null) handleDone = _defaultHandleDone;
- return new _HandlerEventSink<S, T>(
- handleData, handleError, handleDone, outputSink);
- });
-
- Stream<T> bind(Stream<S> stream) {
- return super.bind(stream);
- }
-
- /** Default data handler forwards all data. */
- static void _defaultHandleData(var data, EventSink sink) {
- sink.add(data);
- }
-
- /** Default error handler forwards all errors. */
- static void _defaultHandleError(error, StackTrace stackTrace,
- EventSink sink) {
- sink.addError(error, stackTrace);
- }
-
- /** Default done handler forwards done. */
- static void _defaultHandleDone(EventSink sink) {
- sink.close();
- }
-}
-
-/// A closure mapping a stream and cancelOnError to a StreamSubscription.
-typedef StreamSubscription<T> _SubscriptionTransformer<S, T>(
- Stream<S> stream, bool cancelOnError);
-
-/**
- * A [StreamTransformer] that minimizes the number of additional classes.
- *
- * Instead of implementing three classes: a [StreamTransformer], a [Stream]
- * (as the result of a `bind` call) and a [StreamSubscription] (which does the
- * actual work), this class only requires a fincution that is invoked when the
- * last bit (the subscription) of the transformer-workflow is needed.
- *
- * The given transformer function maps from Stream and cancelOnError to a
- * `StreamSubscription`. As such it can also act on `cancel` events, making it
- * fully general.
- */
-class _StreamSubscriptionTransformer<S, T> implements StreamTransformer<S, T> {
- final _SubscriptionTransformer<S, T> _transformer;
-
- const _StreamSubscriptionTransformer(this._transformer);
-
- Stream<T> bind(Stream<S> stream) =>
- new _BoundSubscriptionStream<S, T>(stream, _transformer);
-}
-
-/**
- * A stream transformed by a [_StreamSubscriptionTransformer].
- *
- * When this stream is listened to it invokes the [_transformer] function with
- * the stored [_stream]. Usually the transformer starts listening at this
- * moment.
- */
-class _BoundSubscriptionStream<S, T> extends Stream<T> {
- final _SubscriptionTransformer<S, T> _transformer;
- final Stream<S> _stream;
-
- _BoundSubscriptionStream(this._stream, this._transformer);
-
- StreamSubscription<T> listen(void onData(T event),
- { Function onError,
- void onDone(),
- bool cancelOnError }) {
- cancelOnError = identical(true, cancelOnError);
- StreamSubscription<T> result = _transformer(_stream, cancelOnError);
- result.onData(onData);
- result.onError(onError);
- result.onDone(onDone);
- return result;
- }
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/async/timer.dart b/pkg/dev_compiler/tool/input_sdk/lib/async/timer.dart
deleted file mode 100644
index 1bbb65b..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/async/timer.dart
+++ /dev/null
@@ -1,114 +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.
-
-part of dart.async;
-
-/**
- * A count-down timer that can be configured to fire once or repeatedly.
- *
- * The timer counts down from the specified duration to 0.
- * When the timer reaches 0, the timer invokes the specified callback function.
- * Use a periodic timer to repeatedly count down the same interval.
- *
- * A negative duration is treated the same as a duration of 0.
- * If the duration is statically known to be 0, consider using [run].
- *
- * Frequently the duration is either a constant or computed as in the
- * following example (taking advantage of the multiplication operator of
- * the [Duration] class):
- *
- * const TIMEOUT = const Duration(seconds: 3);
- * const ms = const Duration(milliseconds: 1);
- *
- * startTimeout([int milliseconds]) {
- * var duration = milliseconds == null ? TIMEOUT : ms * milliseconds;
- * return new Timer(duration, handleTimeout);
- * }
- * ...
- * void handleTimeout() { // callback function
- * ...
- * }
- *
- * Note: If Dart code using Timer is compiled to JavaScript, the finest
- * granularity available in the browser is 4 milliseconds.
- *
- * See [Stopwatch] for measuring elapsed time.
- */
-abstract class Timer {
-
- /**
- * Creates a new timer.
- *
- * The [callback] function is invoked after the given [duration].
- *
- */
- factory Timer(Duration duration, void callback()) {
- if (Zone.current == Zone.ROOT) {
- // No need to bind the callback. We know that the root's timer will
- // be invoked in the root zone.
- return Zone.current.createTimer(duration, callback);
- }
- return Zone.current.createTimer(
- duration, Zone.current.bindCallback(callback, runGuarded: true));
- }
-
- /**
- * Creates a new repeating timer.
- *
- * The [callback] is invoked repeatedly with [duration] intervals until
- * canceled with the [cancel] function.
- *
- * The exact timing depends on the underlying timer implementation.
- * No more than `n` callbacks will be made in `duration * n` time,
- * but the time between two consecutive callbacks
- * can be shorter and longer than `duration`.
- *
- * In particular, an implementation may schedule the next callback, e.g.,
- * a `duration` after either when the previous callback ended,
- * when the previous callback started, or when the previous callback was
- * scheduled for - even if the actual callback was delayed.
- */
- factory Timer.periodic(Duration duration,
- void callback(Timer timer)) {
- if (Zone.current == Zone.ROOT) {
- // No need to bind the callback. We know that the root's timer will
- // be invoked in the root zone.
- return Zone.current.createPeriodicTimer(duration, callback);
- }
- // TODO(floitsch): the return type should be 'void', and the type
- // should be inferred.
- var boundCallback = Zone.current.bindUnaryCallback/*<dynamic, Timer>*/(
- callback, runGuarded: true);
- return Zone.current.createPeriodicTimer(duration, boundCallback);
- }
-
- /**
- * Runs the given [callback] asynchronously as soon as possible.
- *
- * This function is equivalent to `new Timer(Duration.ZERO, callback)`.
- */
- static void run(void callback()) {
- new Timer(Duration.ZERO, callback);
- }
-
- /**
- * Cancels the timer.
- */
- void cancel();
-
- /**
- * Returns whether the timer is still active.
- *
- * A non-periodic timer is active if the callback has not been executed,
- * and the timer has not been canceled.
- *
- * A periodic timer is active if it has not been canceled.
- */
- bool get isActive;
-
- external static Timer _createTimer(Duration duration, void callback());
- external static Timer _createPeriodicTimer(Duration duration,
- void callback(Timer timer));
-}
-
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/async/zone.dart b/pkg/dev_compiler/tool/input_sdk/lib/async/zone.dart
deleted file mode 100644
index 6b13e66..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/async/zone.dart
+++ /dev/null
@@ -1,1308 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-part of dart.async;
-
-typedef R ZoneCallback<R>();
-typedef R ZoneUnaryCallback<R, T>(T arg);
-typedef R ZoneBinaryCallback<R, T1, T2>(T1 arg1, T2 arg2);
-
-// TODO(floitsch): we are abusing generic typedefs as typedefs for generic
-// functions.
-/*ABUSE*/
-typedef R HandleUncaughtErrorHandler<R>(
- Zone self, ZoneDelegate parent, Zone zone, error, StackTrace stackTrace);
-/*ABUSE*/
-typedef R RunHandler<R>(Zone self, ZoneDelegate parent, Zone zone, R f());
-/*ABUSE*/
-typedef R RunUnaryHandler<R, T>(
- Zone self, ZoneDelegate parent, Zone zone, R f(T arg), T arg);
-/*ABUSE*/
-typedef R RunBinaryHandler<R, T1, T2>(
- Zone self, ZoneDelegate parent, Zone zone,
- R f(T1 arg1, T2 arg2), T1 arg1, T2 arg2);
-/*ABUSE*/
-typedef ZoneCallback<R> RegisterCallbackHandler<R>(
- Zone self, ZoneDelegate parent, Zone zone, R f());
-/*ABUSE*/
-typedef ZoneUnaryCallback<R, T> RegisterUnaryCallbackHandler<R, T>(
- Zone self, ZoneDelegate parent, Zone zone, R f(T arg));
-/*ABUSE*/
-typedef ZoneBinaryCallback<R, T1, T2> RegisterBinaryCallbackHandler<R, T1, T2>(
- Zone self, ZoneDelegate parent, Zone zone, R f(T1 arg1, T2 arg2));
-typedef AsyncError ErrorCallbackHandler(Zone self, ZoneDelegate parent,
- Zone zone, Object error, StackTrace stackTrace);
-typedef void ScheduleMicrotaskHandler(
- Zone self, ZoneDelegate parent, Zone zone, void f());
-typedef Timer CreateTimerHandler(
- Zone self, ZoneDelegate parent, Zone zone, Duration duration, void f());
-typedef Timer CreatePeriodicTimerHandler(
- Zone self, ZoneDelegate parent, Zone zone,
- Duration period, void f(Timer timer));
-typedef void PrintHandler(
- Zone self, ZoneDelegate parent, Zone zone, String line);
-typedef Zone ForkHandler(Zone self, ZoneDelegate parent, Zone zone,
- ZoneSpecification specification,
- Map zoneValues);
-
-/** Pair of error and stack trace. Returned by [Zone.errorCallback]. */
-class AsyncError implements Error {
- final Object error;
- final StackTrace stackTrace;
-
- AsyncError(this.error, this.stackTrace);
-
- String toString() => '$error';
-}
-
-
-class _ZoneFunction<T extends Function> {
- final _Zone zone;
- final T function;
- const _ZoneFunction(this.zone, this.function);
-}
-
-/**
- * This class provides the specification for a forked zone.
- *
- * When forking a new zone (see [Zone.fork]) one can override the default
- * behavior of the zone by providing callbacks. These callbacks must be
- * given in an instance of this class.
- *
- * Handlers have the same signature as the same-named methods on [Zone] but
- * receive three additional arguments:
- *
- * 1. the zone the handlers are attached to (the "self" zone).
- * 2. a [ZoneDelegate] to the parent zone.
- * 3. the zone that first received the request (before the request was
- * bubbled up).
- *
- * Handlers can either stop propagation the request (by simply not calling the
- * parent handler), or forward to the parent zone, potentially modifying the
- * arguments on the way.
- */
-abstract class ZoneSpecification {
- /**
- * Creates a specification with the provided handlers.
- */
- const factory ZoneSpecification({
- HandleUncaughtErrorHandler handleUncaughtError,
- RunHandler run,
- RunUnaryHandler runUnary,
- RunBinaryHandler runBinary,
- RegisterCallbackHandler registerCallback,
- RegisterUnaryCallbackHandler registerUnaryCallback,
- RegisterBinaryCallbackHandler registerBinaryCallback,
- ErrorCallbackHandler errorCallback,
- ScheduleMicrotaskHandler scheduleMicrotask,
- CreateTimerHandler createTimer,
- CreatePeriodicTimerHandler createPeriodicTimer,
- PrintHandler print,
- ForkHandler fork
- }) = _ZoneSpecification;
-
- /**
- * Creates a specification from [other] with the provided handlers overriding
- * the ones in [other].
- */
- factory ZoneSpecification.from(ZoneSpecification other, {
- HandleUncaughtErrorHandler handleUncaughtError: null,
- RunHandler run: null,
- RunUnaryHandler runUnary: null,
- RunBinaryHandler runBinary: null,
- RegisterCallbackHandler registerCallback: null,
- RegisterUnaryCallbackHandler registerUnaryCallback: null,
- RegisterBinaryCallbackHandler registerBinaryCallback: null,
- ErrorCallbackHandler errorCallback: null,
- ScheduleMicrotaskHandler scheduleMicrotask: null,
- CreateTimerHandler createTimer: null,
- CreatePeriodicTimerHandler createPeriodicTimer: null,
- PrintHandler print: null,
- ForkHandler fork: null
- }) {
- return new ZoneSpecification(
- handleUncaughtError: handleUncaughtError ?? other.handleUncaughtError,
- run: run ?? other.run,
- runUnary: runUnary ?? other.runUnary,
- runBinary: runBinary ?? other.runBinary,
- registerCallback: registerCallback ?? other.registerCallback,
- registerUnaryCallback: registerUnaryCallback ??
- other.registerUnaryCallback,
- registerBinaryCallback: registerBinaryCallback ??
- other.registerBinaryCallback,
- errorCallback: errorCallback ?? other.errorCallback,
- scheduleMicrotask: scheduleMicrotask ?? other.scheduleMicrotask,
- createTimer : createTimer ?? other.createTimer,
- createPeriodicTimer: createPeriodicTimer ?? other.createPeriodicTimer,
- print : print ?? other.print,
- fork: fork ?? other.fork);
- }
-
- HandleUncaughtErrorHandler get handleUncaughtError;
- RunHandler get run;
- RunUnaryHandler get runUnary;
- RunBinaryHandler get runBinary;
- RegisterCallbackHandler get registerCallback;
- RegisterUnaryCallbackHandler get registerUnaryCallback;
- RegisterBinaryCallbackHandler get registerBinaryCallback;
- ErrorCallbackHandler get errorCallback;
- ScheduleMicrotaskHandler get scheduleMicrotask;
- CreateTimerHandler get createTimer;
- CreatePeriodicTimerHandler get createPeriodicTimer;
- PrintHandler get print;
- ForkHandler get fork;
-}
-
-/**
- * Internal [ZoneSpecification] class.
- *
- * The implementation wants to rely on the fact that the getters cannot change
- * dynamically. We thus require users to go through the redirecting
- * [ZoneSpecification] constructor which instantiates this class.
- */
-class _ZoneSpecification implements ZoneSpecification {
- const _ZoneSpecification({
- this.handleUncaughtError: null,
- this.run: null,
- this.runUnary: null,
- this.runBinary: null,
- this.registerCallback: null,
- this.registerUnaryCallback: null,
- this.registerBinaryCallback: null,
- this.errorCallback: null,
- this.scheduleMicrotask: null,
- this.createTimer: null,
- this.createPeriodicTimer: null,
- this.print: null,
- this.fork: null
- });
-
- final HandleUncaughtErrorHandler handleUncaughtError;
- final RunHandler run;
- final RunUnaryHandler runUnary;
- final RunBinaryHandler runBinary;
- final RegisterCallbackHandler registerCallback;
- final RegisterUnaryCallbackHandler registerUnaryCallback;
- final RegisterBinaryCallbackHandler registerBinaryCallback;
- final ErrorCallbackHandler errorCallback;
- final ScheduleMicrotaskHandler scheduleMicrotask;
- final CreateTimerHandler createTimer;
- final CreatePeriodicTimerHandler createPeriodicTimer;
- final PrintHandler print;
- final ForkHandler fork;
-}
-
-/**
- * This class wraps zones for delegation.
- *
- * When forwarding to parent zones one can't just invoke the parent zone's
- * exposed functions (like [Zone.run]), but one needs to provide more
- * information (like the zone the `run` was initiated). Zone callbacks thus
- * receive more information including this [ZoneDelegate] class. When delegating
- * to the parent zone one should go through the given instance instead of
- * directly invoking the parent zone.
- */
-abstract class ZoneDelegate {
- /*=R*/ handleUncaughtError/*<R>*/(
- Zone zone, error, StackTrace stackTrace);
- /*=R*/ run/*<R>*/(Zone zone, /*=R*/ f());
- /*=R*/ runUnary/*<R, T>*/(Zone zone, /*=R*/ f(/*=T*/ arg), /*=T*/ arg);
- /*=R*/ runBinary/*<R, T1, T2>*/(Zone zone,
- /*=R*/ f(/*=T1*/ arg1, /*=T2*/ arg2), /*=T1*/ arg1, /*=T2*/ arg2);
- ZoneCallback/*<R>*/ registerCallback/*<R>*/(Zone zone, /*=R*/ f());
- ZoneUnaryCallback/*<R, T>*/ registerUnaryCallback/*<R, T>*/(
- Zone zone, /*=R*/ f(/*=T*/ arg));
- ZoneBinaryCallback/*<R, T1, T2>*/ registerBinaryCallback/*<R, T1, T2>*/(
- Zone zone, /*=R*/ f(/*=T1*/ arg1, /*=T2*/ arg2));
- AsyncError errorCallback(Zone zone, Object error, StackTrace stackTrace);
- void scheduleMicrotask(Zone zone, void f());
- Timer createTimer(Zone zone, Duration duration, void f());
- Timer createPeriodicTimer(Zone zone, Duration period, void f(Timer timer));
- void print(Zone zone, String line);
- Zone fork(Zone zone, ZoneSpecification specification, Map zoneValues);
-}
-
-/**
- * A Zone represents the asynchronous version of a dynamic extent. Asynchronous
- * callbacks are executed in the zone they have been queued in. For example,
- * the callback of a `future.then` is executed in the same zone as the one where
- * the `then` was invoked.
- */
-abstract class Zone {
- // Private constructor so that it is not possible instantiate a Zone class.
- Zone._();
-
- /** The root zone that is implicitly created. */
- static const Zone ROOT = _ROOT_ZONE;
-
- /** The currently running zone. */
- static Zone _current = _ROOT_ZONE;
-
- static Zone get current => _current;
-
- /*=R*/ handleUncaughtError/*<R>*/(error, StackTrace stackTrace);
-
- /**
- * Returns the parent zone.
- *
- * Returns `null` if `this` is the [ROOT] zone.
- */
- Zone get parent;
-
- /**
- * The error zone is the one that is responsible for dealing with uncaught
- * errors.
- * Errors are not allowed to cross between zones with different error-zones.
- *
- * This is the closest parent or ancestor zone of this zone that has a custom
- * [handleUncaughtError] method.
- */
- Zone get errorZone;
-
- /**
- * Returns true if `this` and [otherZone] are in the same error zone.
- *
- * Two zones are in the same error zone if they inherit their
- * [handleUncaughtError] callback from the same [errorZone].
- */
- bool inSameErrorZone(Zone otherZone);
-
- /**
- * Creates a new zone as a child of `this`.
- *
- * The new zone will have behavior like the current zone, except where
- * overridden by functions in [specification].
- *
- * The new zone will have the same stored values (accessed through
- * `operator []`) as this zone, but updated with the keys and values
- * in [zoneValues]. If a key is in both this zone's values and in
- * `zoneValues`, the new zone will use the value from `zoneValues``.
- */
- Zone fork({ ZoneSpecification specification,
- Map zoneValues });
-
- /**
- * Executes the given function [f] in this zone.
- */
- /*=R*/ run/*<R>*/(/*=R*/ f());
-
- /**
- * Executes the given callback [f] with argument [arg] in this zone.
- */
- /*=R*/ runUnary/*<R, T>*/(/*=R*/ f(/*=T*/ arg), /*=T*/ arg);
-
- /**
- * Executes the given callback [f] with argument [arg1] and [arg2] in this
- * zone.
- */
- /*=R*/ runBinary/*<R, T1, T2>*/(
- /*=R*/ f(/*=T1*/ arg1, /*=T2*/ arg2), /*=T1*/ arg1, /*=T2*/ arg2);
-
- /**
- * Executes the given function [f] in this zone.
- *
- * Same as [run] but catches uncaught errors and gives them to
- * [handleUncaughtError].
- */
- /*=R*/ runGuarded/*<R>*/(/*=R*/ f());
-
- /**
- * Executes the given callback [f] in this zone.
- *
- * Same as [runUnary] but catches uncaught errors and gives them to
- * [handleUncaughtError].
- */
- /*=R*/ runUnaryGuarded/*<R, T>*/(/*=R*/ f(/*=T*/ arg), /*=T*/ arg);
-
- /**
- * Executes the given callback [f] in this zone.
- *
- * Same as [runBinary] but catches uncaught errors and gives them to
- * [handleUncaughtError].
- */
- /*=R*/ runBinaryGuarded/*<R, T1, T2>*/(
- /*=R*/ f(/*=T1*/ arg1, /*=T2*/ arg2), /*=T1*/ arg1, /*=T2*/ arg2);
-
- /**
- * Registers the given callback in this zone.
- *
- * It is good practice to register asynchronous or delayed callbacks before
- * invoking [run]. This gives the zone a chance to wrap the callback and
- * to store information with the callback. For example, a zone may decide
- * to store the stack trace (at the time of the registration) with the
- * callback.
- *
- * Returns a potentially new callback that should be used in place of the
- * given [callback].
- */
- ZoneCallback/*<R>*/ registerCallback/*<R>*/(/*=R*/ callback());
-
- /**
- * Registers the given callback in this zone.
- *
- * Similar to [registerCallback] but with a unary callback.
- */
- ZoneUnaryCallback/*<R, T>*/ registerUnaryCallback/*<R, T>*/(
- /*=R*/ callback(/*=T*/ arg));
-
- /**
- * Registers the given callback in this zone.
- *
- * Similar to [registerCallback] but with a unary callback.
- */
- ZoneBinaryCallback/*<R, T1, T2>*/ registerBinaryCallback/*<R, T1, T2>*/(
- /*=R*/ callback(/*=T1*/ arg1, /*=T2*/ arg2));
-
- /**
- * Equivalent to:
- *
- * ZoneCallback registered = registerCallback(f);
- * if (runGuarded) return () => this.runGuarded(registered);
- * return () => this.run(registered);
- *
- */
- ZoneCallback/*<R>*/ bindCallback/*<R>*/(
- /*=R*/ f(), { bool runGuarded: true });
-
- /**
- * Equivalent to:
- *
- * ZoneCallback registered = registerUnaryCallback(f);
- * if (runGuarded) return (arg) => this.runUnaryGuarded(registered, arg);
- * return (arg) => thin.runUnary(registered, arg);
- */
- ZoneUnaryCallback/*<R, T>*/ bindUnaryCallback/*<R, T>*/(
- /*=R*/ f(/*=T*/ arg), { bool runGuarded: true });
-
- /**
- * Equivalent to:
- *
- * ZoneCallback registered = registerBinaryCallback(f);
- * if (runGuarded) {
- * return (arg1, arg2) => this.runBinaryGuarded(registered, arg);
- * }
- * return (arg1, arg2) => thin.runBinary(registered, arg1, arg2);
- */
- ZoneBinaryCallback/*<R, T1, T2>*/ bindBinaryCallback/*<R, T1, T2>*/(
- /*=R*/ f(/*=T1*/ arg1, /*=T2*/ arg2), { bool runGuarded: true });
-
- /**
- * Intercepts errors when added programmatically to a `Future` or `Stream`.
- *
- * When caling [Completer.completeError], [Stream.addError],
- * or [Future] constructors that take an error or a callback that may throw,
- * the current zone is allowed to intercept and replace the error.
- *
- * When other libraries use intermediate controllers or completers, such
- * calls may contain errors that have already been processed.
- *
- * Return `null` if no replacement is desired.
- * The original error is used unchanged in that case.
- * Otherwise return an instance of [AsyncError] holding
- * the new pair of error and stack trace.
- * If the [AsyncError.error] is `null`, it is replaced by a [NullThrownError].
- */
- AsyncError errorCallback(Object error, StackTrace stackTrace);
-
- /**
- * Runs [f] asynchronously in this zone.
- */
- void scheduleMicrotask(void f());
-
- /**
- * Creates a Timer where the callback is executed in this zone.
- */
- Timer createTimer(Duration duration, void callback());
-
- /**
- * Creates a periodic Timer where the callback is executed in this zone.
- */
- Timer createPeriodicTimer(Duration period, void callback(Timer timer));
-
- /**
- * Prints the given [line].
- */
- void print(String line);
-
- /**
- * Call to enter the Zone.
- *
- * The previous current zone is returned.
- */
- static Zone _enter(Zone zone) {
- assert(zone != null);
- assert(!identical(zone, _current));
- Zone previous = _current;
- _current = zone;
- return previous;
- }
-
- /**
- * Call to leave the Zone.
- *
- * The previous Zone must be provided as `previous`.
- */
- static void _leave(Zone previous) {
- assert(previous != null);
- Zone._current = previous;
- }
-
- /**
- * Retrieves the zone-value associated with [key].
- *
- * If this zone does not contain the value looks up the same key in the
- * parent zone. If the [key] is not found returns `null`.
- *
- * Any object can be used as key, as long as it has compatible `operator ==`
- * and `hashCode` implementations.
- * By controlling access to the key, a zone can grant or deny access to the
- * zone value.
- */
- operator [](Object key);
-}
-
-ZoneDelegate _parentDelegate(_Zone zone) {
- if (zone.parent == null) return null;
- return zone.parent._delegate;
-}
-
-class _ZoneDelegate implements ZoneDelegate {
- final _Zone _delegationTarget;
-
- _ZoneDelegate(this._delegationTarget);
-
- /*=R*/ handleUncaughtError/*<R>*/(
- Zone zone, error, StackTrace stackTrace) {
- var implementation = _delegationTarget._handleUncaughtError;
- _Zone implZone = implementation.zone;
- HandleUncaughtErrorHandler handler = implementation.function;
- // TODO(floitsch): make this a generic method call on '<R>' once it's
- // supported. Remove the unnecessary cast.
- return handler(
- implZone, _parentDelegate(implZone), zone, error, stackTrace)
- as Object/*=R*/;
- }
-
- /*=R*/ run/*<R>*/(Zone zone, /*=R*/ f()) {
- var implementation = _delegationTarget._run;
- _Zone implZone = implementation.zone;
- RunHandler handler = implementation.function;
- // TODO(floitsch): make this a generic method call on '<R>' once it's
- // supported. Remove the unnecessary cast.
- return handler(implZone, _parentDelegate(implZone), zone, f)
- as Object/*=R*/;
- }
-
- /*=R*/ runUnary/*<R, T>*/(Zone zone, /*=R*/ f(/*=T*/ arg), /*=T*/ arg) {
- var implementation = _delegationTarget._runUnary;
- _Zone implZone = implementation.zone;
- RunUnaryHandler handler = implementation.function;
- // TODO(floitsch): make this a generic method call on '<R, T>' once it's
- // supported. Remove the unnecessary cast.
- return handler(
- implZone, _parentDelegate(implZone), zone, f, arg) as Object/*=R*/;
- }
-
- /*=R*/ runBinary/*<R, T1, T2>*/(Zone zone,
- /*=R*/ f(/*=T1*/ arg1, /*=T2*/ arg2), /*=T1*/ arg1, /*=T2*/ arg2) {
- var implementation = _delegationTarget._runBinary;
- _Zone implZone = implementation.zone;
- RunBinaryHandler handler = implementation.function;
- // TODO(floitsch): make this a generic method call on '<R, T1, T2>' once
- // it's supported. Remove the unnecessary cast.
- return handler(
- implZone, _parentDelegate(implZone), zone, f, arg1, arg2)
- as Object/*=R*/;
- }
-
- ZoneCallback/*<R>*/ registerCallback/*<R>*/(Zone zone, /*=R*/ f()) {
- var implementation = _delegationTarget._registerCallback;
- _Zone implZone = implementation.zone;
- RegisterCallbackHandler handler = implementation.function;
- // TODO(floitsch): make this a generic method call on '<R>' once it's
- // supported. Remove the unnecessary cast.
- return handler(implZone, _parentDelegate(implZone), zone, f)
- as Object/*=ZoneCallback<R>*/;
- }
-
- ZoneUnaryCallback/*<R, T>*/ registerUnaryCallback/*<R, T>*/(
- Zone zone, /*=R*/ f(/*=T*/ arg)) {
- var implementation = _delegationTarget._registerUnaryCallback;
- _Zone implZone = implementation.zone;
- RegisterUnaryCallbackHandler handler = implementation.function;
- // TODO(floitsch): make this a generic method call on '<R, T>' once it's
- // supported. Remove the unnecessary cast.
- return handler(implZone, _parentDelegate(implZone), zone, f)
- as Object/*=ZoneUnaryCallback<R, T>*/;
- }
-
- ZoneBinaryCallback/*<R, T1, T2>*/ registerBinaryCallback/*<R, T1, T2>*/(
- Zone zone, /*=R*/ f(/*=T1*/ arg1, /*=T2*/ arg2)) {
- var implementation = _delegationTarget._registerBinaryCallback;
- _Zone implZone = implementation.zone;
- RegisterBinaryCallbackHandler handler = implementation.function;
- // TODO(floitsch): make this a generic method call on '<R, T1, T2>' once
- // it's supported. Remove the unnecessary cast.
- return handler(implZone, _parentDelegate(implZone), zone, f)
- as Object/*=ZoneBinaryCallback<R, T1, T2>*/;
- }
-
- AsyncError errorCallback(Zone zone, Object error, StackTrace stackTrace) {
- var implementation = _delegationTarget._errorCallback;
- _Zone implZone = implementation.zone;
- if (identical(implZone, _ROOT_ZONE)) return null;
- ErrorCallbackHandler handler = implementation.function;
- return handler(implZone, _parentDelegate(implZone), zone,
- error, stackTrace);
- }
-
- void scheduleMicrotask(Zone zone, f()) {
- var implementation = _delegationTarget._scheduleMicrotask;
- _Zone implZone = implementation.zone;
- ScheduleMicrotaskHandler handler = implementation.function;
- handler(implZone, _parentDelegate(implZone), zone, f);
- }
-
- Timer createTimer(Zone zone, Duration duration, void f()) {
- var implementation = _delegationTarget._createTimer;
- _Zone implZone = implementation.zone;
- CreateTimerHandler handler = implementation.function;
- return handler(implZone, _parentDelegate(implZone), zone, duration, f);
- }
-
- Timer createPeriodicTimer(Zone zone, Duration period, void f(Timer timer)) {
- var implementation = _delegationTarget._createPeriodicTimer;
- _Zone implZone = implementation.zone;
- CreatePeriodicTimerHandler handler = implementation.function;
- return handler(implZone, _parentDelegate(implZone), zone, period, f);
- }
-
- void print(Zone zone, String line) {
- var implementation = _delegationTarget._print;
- _Zone implZone = implementation.zone;
- PrintHandler handler = implementation.function;
- handler(implZone, _parentDelegate(implZone), zone, line);
- }
-
- Zone fork(Zone zone, ZoneSpecification specification,
- Map zoneValues) {
- var implementation = _delegationTarget._fork;
- _Zone implZone = implementation.zone;
- ForkHandler handler = implementation.function;
- return handler(
- implZone, _parentDelegate(implZone), zone, specification, zoneValues);
- }
-}
-
-
-/**
- * Base class for Zone implementations.
- */
-abstract class _Zone implements Zone {
- const _Zone();
-
- _ZoneFunction<RunHandler> get _run;
- _ZoneFunction<RunUnaryHandler> get _runUnary;
- _ZoneFunction<RunBinaryHandler> get _runBinary;
- _ZoneFunction<RegisterCallbackHandler> get _registerCallback;
- _ZoneFunction<RegisterUnaryCallbackHandler> get _registerUnaryCallback;
- _ZoneFunction<RegisterBinaryCallbackHandler> get _registerBinaryCallback;
- _ZoneFunction<ErrorCallbackHandler> get _errorCallback;
- _ZoneFunction<ScheduleMicrotaskHandler> get _scheduleMicrotask;
- _ZoneFunction<CreateTimerHandler> get _createTimer;
- _ZoneFunction<CreatePeriodicTimerHandler> get _createPeriodicTimer;
- _ZoneFunction<PrintHandler> get _print;
- _ZoneFunction<ForkHandler> get _fork;
- _ZoneFunction<HandleUncaughtErrorHandler> get _handleUncaughtError;
- _Zone get parent;
- ZoneDelegate get _delegate;
- Map get _map;
-
- bool inSameErrorZone(Zone otherZone) {
- return identical(this, otherZone) ||
- identical(errorZone, otherZone.errorZone);
- }
-}
-
-class _CustomZone extends _Zone {
- // The actual zone and implementation of each of these
- // inheritable zone functions.
- _ZoneFunction<RunHandler> _run;
- _ZoneFunction<RunUnaryHandler> _runUnary;
- _ZoneFunction<RunBinaryHandler> _runBinary;
- _ZoneFunction<RegisterCallbackHandler> _registerCallback;
- _ZoneFunction<RegisterUnaryCallbackHandler> _registerUnaryCallback;
- _ZoneFunction<RegisterBinaryCallbackHandler> _registerBinaryCallback;
- _ZoneFunction<ErrorCallbackHandler> _errorCallback;
- _ZoneFunction<ScheduleMicrotaskHandler> _scheduleMicrotask;
- _ZoneFunction<CreateTimerHandler> _createTimer;
- _ZoneFunction<CreatePeriodicTimerHandler> _createPeriodicTimer;
- _ZoneFunction<PrintHandler> _print;
- _ZoneFunction<ForkHandler> _fork;
- _ZoneFunction<HandleUncaughtErrorHandler> _handleUncaughtError;
-
- // A cached delegate to this zone.
- ZoneDelegate _delegateCache;
-
- /// The parent zone.
- final _Zone parent;
-
- /// The zone's scoped value declaration map.
- ///
- /// This is always a [HashMap].
- final Map _map;
-
- ZoneDelegate get _delegate {
- if (_delegateCache != null) return _delegateCache;
- _delegateCache = new _ZoneDelegate(this);
- return _delegateCache;
- }
-
- _CustomZone(this.parent, ZoneSpecification specification, this._map) {
- // The root zone will have implementations of all parts of the
- // specification, so it will never try to access the (null) parent.
- // All other zones have a non-null parent.
- _run = (specification.run != null)
- ? new _ZoneFunction<RunHandler>(this, specification.run)
- : parent._run;
- _runUnary = (specification.runUnary != null)
- ? new _ZoneFunction<RunUnaryHandler>(this, specification.runUnary)
- : parent._runUnary;
- _runBinary = (specification.runBinary != null)
- ? new _ZoneFunction<RunBinaryHandler>(this, specification.runBinary)
- : parent._runBinary;
- _registerCallback = (specification.registerCallback != null)
- ? new _ZoneFunction<RegisterCallbackHandler>(
- this, specification.registerCallback)
- : parent._registerCallback;
- _registerUnaryCallback = (specification.registerUnaryCallback != null)
- ? new _ZoneFunction<RegisterUnaryCallbackHandler>(
- this, specification.registerUnaryCallback)
- : parent._registerUnaryCallback;
- _registerBinaryCallback = (specification.registerBinaryCallback != null)
- ? new _ZoneFunction<RegisterBinaryCallbackHandler>(
- this, specification.registerBinaryCallback)
- : parent._registerBinaryCallback;
- _errorCallback = (specification.errorCallback != null)
- ? new _ZoneFunction<ErrorCallbackHandler>(
- this, specification.errorCallback)
- : parent._errorCallback;
- _scheduleMicrotask = (specification.scheduleMicrotask != null)
- ? new _ZoneFunction<ScheduleMicrotaskHandler>(
- this, specification.scheduleMicrotask)
- : parent._scheduleMicrotask;
- _createTimer = (specification.createTimer != null)
- ? new _ZoneFunction<CreateTimerHandler>(this, specification.createTimer)
- : parent._createTimer;
- _createPeriodicTimer = (specification.createPeriodicTimer != null)
- ? new _ZoneFunction<CreatePeriodicTimerHandler>(
- this, specification.createPeriodicTimer)
- : parent._createPeriodicTimer;
- _print = (specification.print != null)
- ? new _ZoneFunction<PrintHandler>(this, specification.print)
- : parent._print;
- _fork = (specification.fork != null)
- ? new _ZoneFunction<ForkHandler>(this, specification.fork)
- : parent._fork;
- _handleUncaughtError = (specification.handleUncaughtError != null)
- ? new _ZoneFunction<HandleUncaughtErrorHandler>(
- this, specification.handleUncaughtError)
- : parent._handleUncaughtError;
- }
-
- /**
- * The closest error-handling zone.
- *
- * Returns `this` if `this` has an error-handler. Otherwise returns the
- * parent's error-zone.
- */
- Zone get errorZone => _handleUncaughtError.zone;
-
- /*=R*/ runGuarded/*<R>*/(/*=R*/ f()) {
- try {
- return run(f);
- } catch (e, s) {
- return handleUncaughtError(e, s);
- }
- }
-
- /*=R*/ runUnaryGuarded/*<R, T>*/(/*=R*/ f(/*=T*/ arg), /*=T*/ arg) {
- try {
- return runUnary(f, arg);
- } catch (e, s) {
- return handleUncaughtError(e, s);
- }
- }
-
- /*=R*/ runBinaryGuarded/*<R, T1, T2>*/(
- /*=R*/ f(/*=T1*/ arg1, /*=T2*/ arg2), /*=T1*/ arg1, /*=T2*/ arg2) {
- try {
- return runBinary(f, arg1, arg2);
- } catch (e, s) {
- return handleUncaughtError(e, s);
- }
- }
-
- ZoneCallback/*<R>*/ bindCallback/*<R>*/(
- /*=R*/ f(), { bool runGuarded: true }) {
- var registered = registerCallback(f);
- if (runGuarded) {
- return () => this.runGuarded(registered);
- } else {
- return () => this.run(registered);
- }
- }
-
- ZoneUnaryCallback/*<R, T>*/ bindUnaryCallback/*<R, T>*/(
- /*=R*/ f(/*=T*/ arg), { bool runGuarded: true }) {
- var registered = registerUnaryCallback(f);
- if (runGuarded) {
- return (arg) => this.runUnaryGuarded(registered, arg);
- } else {
- return (arg) => this.runUnary(registered, arg);
- }
- }
-
- ZoneBinaryCallback/*<R, T1, T2>*/ bindBinaryCallback/*<R, T1, T2>*/(
- /*=R*/ f(/*=T1*/ arg1, /*=T2*/ arg2), { bool runGuarded: true }) {
- var registered = registerBinaryCallback(f);
- if (runGuarded) {
- return (arg1, arg2) => this.runBinaryGuarded(registered, arg1, arg2);
- } else {
- return (arg1, arg2) => this.runBinary(registered, arg1, arg2);
- }
- }
-
- operator [](Object key) {
- var result = _map[key];
- if (result != null || _map.containsKey(key)) return result;
- // If we are not the root zone, look up in the parent zone.
- if (parent != null) {
- // We do not optimize for repeatedly looking up a key which isn't
- // there. That would require storing the key and keeping it alive.
- // Copying the key/value from the parent does not keep any new values
- // alive.
- var value = parent[key];
- if (value != null) {
- _map[key] = value;
- }
- return value;
- }
- assert(this == _ROOT_ZONE);
- return null;
- }
-
- // Methods that can be customized by the zone specification.
-
- /*=R*/ handleUncaughtError/*<R>*/(error, StackTrace stackTrace) {
- var implementation = this._handleUncaughtError;
- assert(implementation != null);
- ZoneDelegate parentDelegate = _parentDelegate(implementation.zone);
- HandleUncaughtErrorHandler handler = implementation.function;
- // TODO(floitsch): make this a generic method call on '<R>' once it's
- // supported. Remove the unnecessary cast.
- return handler(
- implementation.zone, parentDelegate, this, error, stackTrace)
- as Object/*=R*/;
- }
-
- Zone fork({ZoneSpecification specification, Map zoneValues}) {
- var implementation = this._fork;
- assert(implementation != null);
- ZoneDelegate parentDelegate = _parentDelegate(implementation.zone);
- ForkHandler handler = implementation.function;
- return handler(implementation.zone, parentDelegate, this,
- specification, zoneValues);
- }
-
- /*=R*/ run/*<R>*/(/*=R*/ f()) {
- var implementation = this._run;
- assert(implementation != null);
- ZoneDelegate parentDelegate = _parentDelegate(implementation.zone);
- RunHandler handler = implementation.function;
- // TODO(floitsch): make this a generic method call on '<R>' once it's
- // supported. Remove the unnecessary cast.
- return handler(implementation.zone, parentDelegate, this, f)
- as Object/*=R*/;
- }
-
- /*=R*/ runUnary/*<R, T>*/(/*=R*/ f(/*=T*/ arg), /*=T*/ arg) {
- var implementation = this._runUnary;
- assert(implementation != null);
- ZoneDelegate parentDelegate = _parentDelegate(implementation.zone);
- RunUnaryHandler handler = implementation.function;
- // TODO(floitsch): make this a generic method call on '<R, T>' once it's
- // supported. Remove the unnecessary cast.
- return handler(implementation.zone, parentDelegate, this, f, arg)
- as Object/*=R*/;
- }
-
- /*=R*/ runBinary/*<R, T1, T2>*/(
- /*=R*/ f(/*=T1*/ arg1, /*=T2*/ arg2), /*=T1*/ arg1, /*=T2*/ arg2) {
- var implementation = this._runBinary;
- assert(implementation != null);
- ZoneDelegate parentDelegate = _parentDelegate(implementation.zone);
- RunBinaryHandler handler = implementation.function;
- // TODO(floitsch): make this a generic method call on '<R, T1, T2>' once
- // it's supported. Remove the unnecessary cast.
- return handler(
- implementation.zone, parentDelegate, this, f, arg1, arg2)
- as Object/*=R*/;
- }
-
- ZoneCallback/*<R>*/ registerCallback/*<R>*/(/*=R*/ callback()) {
- var implementation = this._registerCallback;
- assert(implementation != null);
- ZoneDelegate parentDelegate = _parentDelegate(implementation.zone);
- RegisterCallbackHandler handler = implementation.function;
- // TODO(floitsch): make this a generic method call on '<R>' once it's
- // supported. Remove the unnecessary cast.
- return handler(implementation.zone, parentDelegate, this, callback)
- as Object/*=ZoneCallback<R>*/;
- }
-
- ZoneUnaryCallback/*<R, T>*/ registerUnaryCallback/*<R, T>*/(
- /*=R*/ callback(/*=T*/ arg)) {
- var implementation = this._registerUnaryCallback;
- assert(implementation != null);
- ZoneDelegate parentDelegate = _parentDelegate(implementation.zone);
- RegisterUnaryCallbackHandler handler = implementation.function;
- // TODO(floitsch): make this a generic method call on '<R, T>' once it's
- // supported. Remove the unnecessary cast.
- return handler(implementation.zone, parentDelegate, this, callback)
- as Object/*=ZoneUnaryCallback<R, T>*/;
- }
-
- ZoneBinaryCallback/*<R, T1, T2>*/ registerBinaryCallback/*<R, T1, T2>*/(
- /*=R*/ callback(/*=T1*/ arg1, /*=T2*/ arg2)) {
- var implementation = this._registerBinaryCallback;
- assert(implementation != null);
- ZoneDelegate parentDelegate = _parentDelegate(implementation.zone);
- RegisterBinaryCallbackHandler handler = implementation.function;
- // TODO(floitsch): make this a generic method call on '<R, T1, T2>' once
- // it's supported. Remove the unnecessary cast.
- return handler(implementation.zone, parentDelegate, this, callback)
- as Object/*=ZoneBinaryCallback<R, T1, T2>*/;
- }
-
- AsyncError errorCallback(Object error, StackTrace stackTrace) {
- var implementation = this._errorCallback;
- assert(implementation != null);
- final Zone implementationZone = implementation.zone;
- if (identical(implementationZone, _ROOT_ZONE)) return null;
- final ZoneDelegate parentDelegate = _parentDelegate(implementationZone);
- ErrorCallbackHandler handler = implementation.function;
- return handler(
- implementationZone, parentDelegate, this, error, stackTrace);
- }
-
- void scheduleMicrotask(void f()) {
- var implementation = this._scheduleMicrotask;
- assert(implementation != null);
- ZoneDelegate parentDelegate = _parentDelegate(implementation.zone);
- ScheduleMicrotaskHandler handler = implementation.function;
- return handler(implementation.zone, parentDelegate, this, f);
- }
-
- Timer createTimer(Duration duration, void f()) {
- var implementation = this._createTimer;
- assert(implementation != null);
- ZoneDelegate parentDelegate = _parentDelegate(implementation.zone);
- CreateTimerHandler handler = implementation.function;
- return handler(implementation.zone, parentDelegate, this, duration, f);
- }
-
- Timer createPeriodicTimer(Duration duration, void f(Timer timer)) {
- var implementation = this._createPeriodicTimer;
- assert(implementation != null);
- ZoneDelegate parentDelegate = _parentDelegate(implementation.zone);
- CreatePeriodicTimerHandler handler = implementation.function;
- return handler(
- implementation.zone, parentDelegate, this, duration, f);
- }
-
- void print(String line) {
- var implementation = this._print;
- assert(implementation != null);
- ZoneDelegate parentDelegate = _parentDelegate(implementation.zone);
- PrintHandler handler = implementation.function;
- return handler(implementation.zone, parentDelegate, this, line);
- }
-}
-
-/*=R*/ _rootHandleUncaughtError/*<R>*/(
- Zone self, ZoneDelegate parent, Zone zone, error, StackTrace stackTrace) {
- _schedulePriorityAsyncCallback(() {
- if (error == null) error = new NullThrownError();
- if (stackTrace == null) throw error;
- _rethrow(error, stackTrace);
- });
-}
-
-external void _rethrow(Object error, StackTrace stackTrace);
-
-/*=R*/ _rootRun/*<R>*/(Zone self, ZoneDelegate parent, Zone zone, /*=R*/ f()) {
- if (Zone._current == zone) return f();
-
- Zone old = Zone._enter(zone);
- try {
- return f();
- } finally {
- Zone._leave(old);
- }
-}
-
-/*=R*/ _rootRunUnary/*<R, T>*/(Zone self, ZoneDelegate parent, Zone zone,
- /*=R*/ f(/*=T*/ arg), /*=T*/ arg) {
- if (Zone._current == zone) return f(arg);
-
- Zone old = Zone._enter(zone);
- try {
- return f(arg);
- } finally {
- Zone._leave(old);
- }
-}
-
-/*=R*/ _rootRunBinary/*<R, T1, T2>*/(Zone self, ZoneDelegate parent, Zone zone,
- /*=R*/ f(/*=T1*/ arg1, /*=T2*/ arg2), /*=T1*/ arg1, /*=T2*/ arg2) {
- if (Zone._current == zone) return f(arg1, arg2);
-
- Zone old = Zone._enter(zone);
- try {
- return f(arg1, arg2);
- } finally {
- Zone._leave(old);
- }
-}
-
-ZoneCallback/*<R>*/ _rootRegisterCallback/*<R>*/(
- Zone self, ZoneDelegate parent, Zone zone, /*=R*/ f()) {
- return f;
-}
-
-ZoneUnaryCallback/*<R, T>*/ _rootRegisterUnaryCallback/*<R, T>*/(
- Zone self, ZoneDelegate parent, Zone zone, /*=R*/ f(/*=T*/ arg)) {
- return f;
-}
-
-ZoneBinaryCallback/*<R, T1, T2>*/ _rootRegisterBinaryCallback/*<R, T1, T2>*/(
- Zone self, ZoneDelegate parent, Zone zone,
- /*=R*/ f(/*=T1*/ arg1, /*=T2*/ arg2)) {
- return f;
-}
-
-AsyncError _rootErrorCallback(Zone self, ZoneDelegate parent, Zone zone,
- Object error, StackTrace stackTrace) => null;
-
-void _rootScheduleMicrotask(Zone self, ZoneDelegate parent, Zone zone, f()) {
- if (!identical(_ROOT_ZONE, zone)) {
- bool hasErrorHandler = !_ROOT_ZONE.inSameErrorZone(zone);
- f = zone.bindCallback(f, runGuarded: hasErrorHandler);
- // Use root zone as event zone if the function is already bound.
- zone = _ROOT_ZONE;
- }
- _scheduleAsyncCallback(f);
-}
-
-Timer _rootCreateTimer(Zone self, ZoneDelegate parent, Zone zone,
- Duration duration, void callback()) {
- if (!identical(_ROOT_ZONE, zone)) {
- callback = zone.bindCallback(callback);
- }
- return Timer._createTimer(duration, callback);
-}
-
-Timer _rootCreatePeriodicTimer(
- Zone self, ZoneDelegate parent, Zone zone,
- Duration duration, void callback(Timer timer)) {
- if (!identical(_ROOT_ZONE, zone)) {
- // TODO(floitsch): the return type should be 'void'.
- callback = zone.bindUnaryCallback/*<dynamic, Timer>*/(callback);
- }
- return Timer._createPeriodicTimer(duration, callback);
-}
-
-void _rootPrint(Zone self, ZoneDelegate parent, Zone zone, String line) {
- printToConsole(line);
-}
-
-void _printToZone(String line) {
- Zone.current.print(line);
-}
-
-Zone _rootFork(Zone self, ZoneDelegate parent, Zone zone,
- ZoneSpecification specification,
- Map zoneValues) {
- // TODO(floitsch): it would be nice if we could get rid of this hack.
- // Change the static zoneOrDirectPrint function to go through zones
- // from now on.
- printToZone = _printToZone;
-
- if (specification == null) {
- specification = const ZoneSpecification();
- } else if (specification is! _ZoneSpecification) {
- throw new ArgumentError("ZoneSpecifications must be instantiated"
- " with the provided constructor.");
- }
- Map valueMap;
- if (zoneValues == null) {
- if (zone is _Zone) {
- valueMap = zone._map;
- } else {
- valueMap = new HashMap();
- }
- } else {
- valueMap = new HashMap.from(zoneValues);
- }
- return new _CustomZone(zone, specification, valueMap);
-}
-
-class _RootZone extends _Zone {
- const _RootZone();
-
- _ZoneFunction<RunHandler> get _run =>
- const _ZoneFunction<RunHandler>(_ROOT_ZONE, _rootRun);
- _ZoneFunction<RunUnaryHandler> get _runUnary =>
- const _ZoneFunction<RunUnaryHandler>(_ROOT_ZONE, _rootRunUnary);
- _ZoneFunction<RunBinaryHandler> get _runBinary =>
- const _ZoneFunction<RunBinaryHandler>(_ROOT_ZONE, _rootRunBinary);
- _ZoneFunction<RegisterCallbackHandler> get _registerCallback =>
- const _ZoneFunction<RegisterCallbackHandler>(
- _ROOT_ZONE, _rootRegisterCallback);
- _ZoneFunction<RegisterUnaryCallbackHandler> get _registerUnaryCallback =>
- const _ZoneFunction<RegisterUnaryCallbackHandler>(
- _ROOT_ZONE, _rootRegisterUnaryCallback);
- _ZoneFunction<RegisterBinaryCallbackHandler> get _registerBinaryCallback =>
- const _ZoneFunction<RegisterBinaryCallbackHandler>(
- _ROOT_ZONE, _rootRegisterBinaryCallback);
- _ZoneFunction<ErrorCallbackHandler> get _errorCallback =>
- const _ZoneFunction<ErrorCallbackHandler>(_ROOT_ZONE, _rootErrorCallback);
- _ZoneFunction<ScheduleMicrotaskHandler> get _scheduleMicrotask =>
- const _ZoneFunction<ScheduleMicrotaskHandler>(
- _ROOT_ZONE, _rootScheduleMicrotask);
- _ZoneFunction<CreateTimerHandler> get _createTimer =>
- const _ZoneFunction<CreateTimerHandler>(_ROOT_ZONE, _rootCreateTimer);
- _ZoneFunction<CreatePeriodicTimerHandler> get _createPeriodicTimer =>
- const _ZoneFunction<CreatePeriodicTimerHandler>(_ROOT_ZONE, _rootCreatePeriodicTimer);
- _ZoneFunction<PrintHandler> get _print =>
- const _ZoneFunction<PrintHandler>(_ROOT_ZONE, _rootPrint);
- _ZoneFunction<ForkHandler> get _fork =>
- const _ZoneFunction<ForkHandler>(_ROOT_ZONE, _rootFork);
- _ZoneFunction<HandleUncaughtErrorHandler> get _handleUncaughtError =>
- const _ZoneFunction<HandleUncaughtErrorHandler>(
- _ROOT_ZONE, _rootHandleUncaughtError);
-
- // The parent zone.
- _Zone get parent => null;
-
- /// The zone's scoped value declaration map.
- ///
- /// This is always a [HashMap].
- Map get _map => _rootMap;
-
- static Map _rootMap = new HashMap();
-
- static ZoneDelegate _rootDelegate;
-
- ZoneDelegate get _delegate {
- if (_rootDelegate != null) return _rootDelegate;
- return _rootDelegate = new _ZoneDelegate(this);
- }
-
- /**
- * The closest error-handling zone.
- *
- * Returns `this` if `this` has an error-handler. Otherwise returns the
- * parent's error-zone.
- */
- Zone get errorZone => this;
-
- // Zone interface.
-
- /*=R*/ runGuarded/*<R>*/(/*=R*/ f()) {
- try {
- if (identical(_ROOT_ZONE, Zone._current)) {
- return f();
- }
- return _rootRun/*<R>*/(null, null, this, f);
- } catch (e, s) {
- return handleUncaughtError/*<R>*/(e, s);
- }
- }
-
- /*=R*/ runUnaryGuarded/*<R, T>*/(/*=R*/ f(/*=T*/ arg), /*=T*/ arg) {
- try {
- if (identical(_ROOT_ZONE, Zone._current)) {
- return f(arg);
- }
- return _rootRunUnary/*<R, T>*/(null, null, this, f, arg);
- } catch (e, s) {
- return handleUncaughtError/*<R>*/(e, s);
- }
- }
-
- /*=R*/ runBinaryGuarded/*<R, T1, T2>*/(
- /*=R*/ f(/*=T1*/ arg1, /*=T2*/ arg2), /*=T1*/ arg1, /*=T2*/ arg2) {
- try {
- if (identical(_ROOT_ZONE, Zone._current)) {
- return f(arg1, arg2);
- }
- return _rootRunBinary/*<R, T1, T2>*/(null, null, this, f, arg1, arg2);
- } catch (e, s) {
- return handleUncaughtError/*<R>*/(e, s);
- }
- }
-
- ZoneCallback/*<R>*/ bindCallback/*<R>*/(
- /*=R*/ f(), { bool runGuarded: true }) {
- if (runGuarded) {
- return () => this.runGuarded/*<R>*/(f);
- } else {
- return () => this.run/*<R>*/(f);
- }
- }
-
- ZoneUnaryCallback/*<R, T>*/ bindUnaryCallback/*<R, T>*/(
- /*=R*/ f(/*=T*/ arg), { bool runGuarded: true }) {
- if (runGuarded) {
- return (arg) => this.runUnaryGuarded/*<R, T>*/(f, arg);
- } else {
- return (arg) => this.runUnary/*<R, T>*/(f, arg);
- }
- }
-
- ZoneBinaryCallback/*<R, T1, T2>*/ bindBinaryCallback/*<R, T1, T2>*/(
- /*=R*/ f(/*=T1*/ arg1, /*=T2*/ arg2), { bool runGuarded: true }) {
- if (runGuarded) {
- return (arg1, arg2) =>
- this.runBinaryGuarded/*<R, T1, T2>*/(f, arg1, arg2);
- } else {
- return (arg1, arg2) => this.runBinary/*<R, T1, T2>*/(f, arg1, arg2);
- }
- }
-
- operator [](Object key) => null;
-
- // Methods that can be customized by the zone specification.
-
- /*=R*/ handleUncaughtError/*<R>*/(error, StackTrace stackTrace) {
- return _rootHandleUncaughtError(null, null, this, error, stackTrace);
- }
-
- Zone fork({ZoneSpecification specification, Map zoneValues}) {
- return _rootFork(null, null, this, specification, zoneValues);
- }
-
- /*=R*/ run/*<R>*/(/*=R*/ f()) {
- if (identical(Zone._current, _ROOT_ZONE)) return f();
- return _rootRun(null, null, this, f);
- }
-
- /*=R*/ runUnary/*<R, T>*/(/*=R*/ f(/*=T*/ arg), /*=T*/ arg) {
- if (identical(Zone._current, _ROOT_ZONE)) return f(arg);
- return _rootRunUnary(null, null, this, f, arg);
- }
-
- /*=R*/ runBinary/*<R, T1, T2>*/(
- /*=R*/ f(/*=T1*/ arg1, /*=T2*/ arg2), /*=T1*/ arg1, /*=T2*/ arg2) {
- if (identical(Zone._current, _ROOT_ZONE)) return f(arg1, arg2);
- return _rootRunBinary(null, null, this, f, arg1, arg2);
- }
-
- ZoneCallback/*<R>*/ registerCallback/*<R>*/(/*=R*/ f()) => f;
-
- ZoneUnaryCallback/*<R, T>*/ registerUnaryCallback/*<R, T>*/(
- /*=R*/ f(/*=T*/ arg)) => f;
-
- ZoneBinaryCallback/*<R, T1, T2>*/ registerBinaryCallback/*<R, T1, T2>*/(
- /*=R*/ f(/*=T1*/ arg1, /*=T2*/ arg2)) => f;
-
- AsyncError errorCallback(Object error, StackTrace stackTrace) => null;
-
- void scheduleMicrotask(void f()) {
- _rootScheduleMicrotask(null, null, this, f);
- }
-
- Timer createTimer(Duration duration, void f()) {
- return Timer._createTimer(duration, f);
- }
-
- Timer createPeriodicTimer(Duration duration, void f(Timer timer)) {
- return Timer._createPeriodicTimer(duration, f);
- }
-
- void print(String line) {
- printToConsole(line);
- }
-}
-
-const _ROOT_ZONE = const _RootZone();
-
-/**
- * Runs [body] in its own zone.
- *
- * If [onError] is non-null the zone is considered an error zone. All uncaught
- * errors, synchronous or asynchronous, in the zone are caught and handled
- * by the callback.
- *
- * Errors may never cross error-zone boundaries. This is intuitive for leaving
- * a zone, but it also applies for errors that would enter an error-zone.
- * Errors that try to cross error-zone boundaries are considered uncaught.
- *
- * var future = new Future.value(499);
- * runZoned(() {
- * future = future.then((_) { throw "error in first error-zone"; });
- * runZoned(() {
- * future = future.catchError((e) { print("Never reached!"); });
- * }, onError: (e) { print("unused error handler"); });
- * }, onError: (e) { print("catches error of first error-zone."); });
- *
- * Example:
- *
- * runZoned(() {
- * new Future(() { throw "asynchronous error"; });
- * }, onError: print); // Will print "asynchronous error".
- */
-/*=R*/ runZoned/*<R>*/(/*=R*/ body(),
- { Map zoneValues,
- ZoneSpecification zoneSpecification,
- Function onError }) {
- HandleUncaughtErrorHandler errorHandler;
- if (onError != null) {
- errorHandler = (Zone self, ZoneDelegate parent, Zone zone,
- error, StackTrace stackTrace) {
- try {
- // Change this is check back to
- // onError is ZoneBinaryCallback<dynamic/*=R*/, dynamic, StackTrace>
- // once is checks for that type are handled correctly.
- if (onError is ZoneBinaryCallback<dynamic, dynamic, StackTrace>) {
- return self.parent.runBinary(onError, error, stackTrace) as Object/*=R*/;
- }
- return self.parent.runUnary(onError, error);
- } catch(e, s) {
- if (identical(e, error)) {
- return parent.handleUncaughtError(zone, error, stackTrace);
- } else {
- return parent.handleUncaughtError(zone, e, s);
- }
- }
- };
- }
- if (zoneSpecification == null) {
- zoneSpecification =
- new ZoneSpecification(handleUncaughtError: errorHandler);
- } else if (errorHandler != null) {
- zoneSpecification =
- new ZoneSpecification.from(zoneSpecification,
- handleUncaughtError: errorHandler);
- }
- Zone zone = Zone.current.fork(specification: zoneSpecification,
- zoneValues: zoneValues);
- if (onError != null) {
- return zone.runGuarded(body);
- } else {
- return zone.run(body);
- }
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/collection/collection.dart b/pkg/dev_compiler/tool/input_sdk/lib/collection/collection.dart
deleted file mode 100644
index 5a2a906..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/collection/collection.dart
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-/**
- * Classes and utilities that supplement the collection support in dart:core.
- *
- * To use this library in your code:
- *
- * import 'dart:collection';
- */
-library dart.collection;
-
-import 'dart:_internal';
-import 'dart:math' show Random; // Used by ListMixin.shuffle.
-
-part 'collections.dart';
-part 'hash_map.dart';
-part 'hash_set.dart';
-part 'iterable.dart';
-part 'iterator.dart';
-part 'linked_hash_map.dart';
-part 'linked_hash_set.dart';
-part 'linked_list.dart';
-part 'list.dart';
-part 'maps.dart';
-part 'queue.dart';
-part 'set.dart';
-part 'splay_tree.dart';
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/collection/collections.dart b/pkg/dev_compiler/tool/input_sdk/lib/collection/collections.dart
deleted file mode 100644
index 5756544..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/collection/collections.dart
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-part of dart.collection;
-
-/**
- * An unmodifiable [List] view of another List.
- *
- * The source of the elements may be a [List] or any [Iterable] with
- * efficient [Iterable.length] and [Iterable.elementAt].
- */
-class UnmodifiableListView<E> extends UnmodifiableListBase<E> {
- final Iterable<E> _source;
-
- /**
- * Creates an unmodifiable list backed by [source].
- *
- * The [source] of the elements may be a [List] or any [Iterable] with
- * efficient [Iterable.length] and [Iterable.elementAt].
- */
- UnmodifiableListView(Iterable<E> source) : _source = source;
- int get length => _source.length;
- E operator[](int index) => _source.elementAt(index);
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/collection/hash_map.dart b/pkg/dev_compiler/tool/input_sdk/lib/collection/hash_map.dart
deleted file mode 100644
index c8c31c5..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/collection/hash_map.dart
+++ /dev/null
@@ -1,145 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-part of dart.collection;
-
-/** Default function for equality comparison in customized HashMaps */
-bool _defaultEquals(a, b) => a == b;
-/** Default function for hash-code computation in customized HashMaps */
-int _defaultHashCode(a) => a.hashCode;
-
-/** Type of custom equality function */
-typedef bool _Equality<K>(K a, K b);
-/** Type of custom hash code function. */
-typedef int _Hasher<K>(K object);
-
-/**
- * A hash-table based implementation of [Map].
- *
- * The keys of a `HashMap` must have consistent [Object.operator==]
- * and [Object.hashCode] implementations. This means that the `==` operator
- * must define a stable equivalence relation on the keys (reflexive,
- * symmetric, transitive, and consistent over time), and that `hashCode`
- * must be the same for objects that are considered equal by `==`.
- *
- * The map allows `null` as a key.
- *
- * Iterating the map's keys, values or entries (through [forEach])
- * may happen in any order.
- * The iteration order only changes when the map is modified.
- * Values are iterated in the same order as their associated keys,
- * so iterating the [keys] and [values] in parallel
- * will give matching key and value pairs.
- */
-abstract class HashMap<K, V> implements Map<K, V> {
- /**
- * Creates an unordered hash-table based [Map].
- *
- * The created map is not ordered in any way. When iterating the keys or
- * values, the iteration order is unspecified except that it will stay the
- * same as long as the map isn't changed.
- *
- * If [equals] is provided, it is used to compare the keys in the table with
- * new keys. If [equals] is omitted, the key's own [Object.operator==] is used
- * instead.
- *
- * Similar, if [hashCode] is provided, it is used to produce a hash value
- * for keys in order to place them in the hash table. If it is omitted, the
- * key's own [Object.hashCode] is used.
- *
- * If using methods like [operator[]], [remove] and [containsKey] together
- * with a custom equality and hashcode, an extra `isValidKey` function
- * can be supplied. This function is called before calling [equals] or
- * [hashCode] with an argument that may not be a [K] instance, and if the
- * call returns false, the key is assumed to not be in the set.
- * The [isValidKey] function defaults to just testing if the object is a
- * [K] instance.
- *
- * Example:
- *
- * new HashMap<int,int>(equals: (int a, int b) => (b - a) % 5 == 0,
- * hashCode: (int e) => e % 5)
- *
- * This example map does not need an `isValidKey` function to be passed.
- * The default function accepts only `int` values, which can safely be
- * passed to both the `equals` and `hashCode` functions.
- *
- * If neither `equals`, `hashCode`, nor `isValidKey` is provided,
- * the default `isValidKey` instead accepts all keys.
- * The default equality and hashcode operations are assumed to work on all
- * objects.
- *
- * Likewise, if `equals` is [identical], `hashCode` is [identityHashCode]
- * and `isValidKey` is omitted, the resulting map is identity based,
- * and the `isValidKey` defaults to accepting all keys.
- * Such a map can be created directly using [HashMap.identity].
- *
- * The used `equals` and `hashCode` method should always be consistent,
- * so that if `equals(a, b)` then `hashCode(a) == hashCode(b)`. The hash
- * of an object, or what it compares equal to, should not change while the
- * object is a key in the map. If it does change, the result is unpredictable.
- *
- * If you supply one of [equals] and [hashCode],
- * you should generally also to supply the other.
- */
- external factory HashMap({bool equals(K key1, K key2),
- int hashCode(K key),
- bool isValidKey(potentialKey)});
-
- /**
- * Creates an unordered identity-based map.
- *
- * Effectively a shorthand for:
- *
- * new HashMap(equals: identical,
- * hashCode: identityHashCode)
- */
- external factory HashMap.identity();
-
- /**
- * Creates a [HashMap] that contains all key/value pairs of [other].
- */
- factory HashMap.from(Map other) {
- HashMap<K, V> result = new HashMap<K, V>();
- other.forEach((k, v) { result[k as Object/*=K*/] = v as Object/*=V*/; });
- return result;
- }
-
- /**
- * Creates a [HashMap] where the keys and values are computed from the
- * [iterable].
- *
- * For each element of the [iterable] this constructor computes a key/value
- * pair, by applying [key] and [value] respectively.
- *
- * The keys of the key/value pairs do not need to be unique. The last
- * occurrence of a key will simply overwrite any previous value.
- *
- * If no values are specified for [key] and [value] the default is the
- * identity function.
- */
- factory HashMap.fromIterable(Iterable iterable,
- {K key(element), V value(element)}) {
- HashMap<K, V> map = new HashMap<K, V>();
- Maps._fillMapWithMappedIterable(map, iterable, key, value);
- return map;
- }
-
- /**
- * Creates a [HashMap] associating the given [keys] to [values].
- *
- * This constructor iterates over [keys] and [values] and maps each element of
- * [keys] to the corresponding element of [values].
- *
- * If [keys] contains the same object multiple times, the last occurrence
- * overwrites the previous value.
- *
- * It is an error if the two [Iterable]s don't have the same length.
- */
- factory HashMap.fromIterables(Iterable<K> keys, Iterable<V> values) {
- HashMap<K, V> map = new HashMap<K, V>();
- Maps._fillMapWithIterables(map, keys, values);
- return map;
- }
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/collection/hash_set.dart b/pkg/dev_compiler/tool/input_sdk/lib/collection/hash_set.dart
deleted file mode 100644
index 726037a..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/collection/hash_set.dart
+++ /dev/null
@@ -1,138 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-part of dart.collection;
-
-/** Common parts of [HashSet] and [LinkedHashSet] implementations. */
-abstract class _HashSetBase<E> extends SetBase<E> {
-
- // The following two methods override the ones in SetBase.
- // It's possible to be more efficient if we have a way to create an empty
- // set of the correct type.
-
- Set<E> difference(Set<Object> other) {
- Set<E> result = _newSet();
- for (var element in this) {
- if (!other.contains(element)) result.add(element);
- }
- return result;
- }
-
- Set<E> intersection(Set<Object> other) {
- Set<E> result = _newSet();
- for (var element in this) {
- if (other.contains(element)) result.add(element);
- }
- return result;
- }
-
- Set<E> _newSet();
-
- // Subclasses can optimize this further.
- Set<E> toSet() => _newSet()..addAll(this);
-}
-
-/**
- * An unordered hash-table based [Set] implementation.
- *
- * The elements of a `HashSet` must have consistent equality
- * and hashCode implementations. This means that the equals operation
- * must define a stable equivalence relation on the elements (reflexive,
- * symmetric, transitive, and consistent over time), and that the hashCode
- * must consistent with equality, so that the same for objects that are
- * considered equal.
- *
- * The set allows `null` as an element.
- *
- * Most simple operations on `HashSet` are done in (potentially amorteized)
- * constant time: [add], [contains], [remove], and [length], provided the hash
- * codes of objects are well distributed.
- */
-abstract class HashSet<E> implements Set<E> {
- /**
- * Create a hash set using the provided [equals] as equality.
- *
- * The provided [equals] must define a stable equivalence relation, and
- * [hashCode] must be consistent with [equals]. If the [equals] or [hashCode]
- * methods won't work on all objects, but only on some instances of E, the
- * [isValidKey] predicate can be used to restrict the keys that the functions
- * are applied to.
- * Any key for which [isValidKey] returns false is automatically assumed
- * to not be in the set when asking `contains`.
- *
- * If [equals] or [hashCode] are omitted, the set uses
- * the elements' intrinsic [Object.operator==] and [Object.hashCode].
- *
- * If you supply one of [equals] and [hashCode],
- * you should generally also to supply the other.
- *
- * If the supplied `equals` or `hashCode` functions won't work on all [E]
- * objects, and the map will be used in a setting where a non-`E` object
- * is passed to, e.g., `contains`, then the [isValidKey] function should
- * also be supplied.
- *
- * If [isValidKey] is omitted, it defaults to testing if the object is an
- * [E] instance. That means that:
- *
- * new HashSet<int>(equals: (int e1, int e2) => (e1 - e2) % 5 == 0,
- * hashCode: (int e) => e % 5)
- *
- * does not need an `isValidKey` argument, because it defaults to only
- * accepting `int` values which are accepted by both `equals` and `hashCode`.
- *
- * If neither `equals`, `hashCode`, nor `isValidKey` is provided,
- * the default `isValidKey` instead accepts all values.
- * The default equality and hashcode operations are assumed to work on all
- * objects.
- *
- * Likewise, if `equals` is [identical], `hashCode` is [identityHashCode]
- * and `isValidKey` is omitted, the resulting set is identity based,
- * and the `isValidKey` defaults to accepting all keys.
- * Such a map can be created directly using [HashSet.identity].
- */
- external factory HashSet({bool equals(E e1, E e2),
- int hashCode(E e),
- bool isValidKey(Object potentialKey)});
-
- /**
- * Creates an unordered identity-based set.
- *
- * Effectively a shorthand for:
- *
- * new HashSet<E>(equals: identical,
- * hashCode: identityHashCode)
- */
- external factory HashSet.identity();
-
- /**
- * Create a hash set containing all [elements].
- *
- * Creates a hash set as by `new HashSet<E>()` and adds each element of
- * `elements` to this set in the order they are iterated.
- *
- * All the [elements] should be assignable to [E].
- * The `elements` iterable itself may have any element type, so this
- * constructor can be used to down-cast a `Set`, for example as:
- *
- * Set<SuperType> superSet = ...;
- * Set<SubType> subSet =
- * new HashSet<SubType>.from(superSet.where((e) => e is SubType));
- */
- factory HashSet.from(Iterable elements) {
- HashSet<E> result = new HashSet<E>();
- for (final e in elements) {
- E element = e as Object/*=E*/;
- result.add(element);
- }
- return result;
- }
-
- /**
- * Provides an iterator that iterates over the elements of this set.
- *
- * The order of iteration is unspecified,
- * but consistent between changes to the set.
- */
- Iterator<E> get iterator;
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/collection/iterable.dart b/pkg/dev_compiler/tool/input_sdk/lib/collection/iterable.dart
deleted file mode 100644
index 26ccb5c..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/collection/iterable.dart
+++ /dev/null
@@ -1,400 +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.
-
-part of dart.collection;
-
-/**
- * This [Iterable] mixin implements all [Iterable] members except `iterator`.
- *
- * All other methods are implemented in terms of `iterator`.
- */
-abstract class IterableMixin<E> implements Iterable<E> {
- // This class has methods copied verbatim into:
- // - IterableBase
- // - SetMixin
- // If changing a method here, also change the other copies.
-
- Iterable/*<T>*/ map/*<T>*/(/*=T*/ f(E element)) =>
- new MappedIterable<E, dynamic/*=T*/>(this, f);
-
- Iterable<E> where(bool f(E element)) => new WhereIterable<E>(this, f);
-
- Iterable/*<T>*/ expand/*<T>*/(Iterable/*<T>*/ f(E element)) =>
- new ExpandIterable<E, dynamic/*=T*/>(this, f);
-
- bool contains(Object element) {
- for (E e in this) {
- if (e == element) return true;
- }
- return false;
- }
-
- void forEach(void f(E element)) {
- for (E element in this) f(element);
- }
-
- E reduce(E combine(E value, E element)) {
- Iterator<E> iterator = this.iterator;
- if (!iterator.moveNext()) {
- throw IterableElementError.noElement();
- }
- E value = iterator.current;
- while (iterator.moveNext()) {
- value = combine(value, iterator.current);
- }
- return value;
- }
-
- dynamic/*=T*/ fold/*<T>*/(var/*=T*/ initialValue,
- dynamic/*=T*/ combine(var/*=T*/ previousValue, E element)) {
- var value = initialValue;
- for (E element in this) value = combine(value, element);
- return value;
- }
-
- bool every(bool f(E element)) {
- for (E element in this) {
- if (!f(element)) return false;
- }
- return true;
- }
-
- String join([String separator = ""]) {
- Iterator<E> iterator = this.iterator;
- if (!iterator.moveNext()) return "";
- StringBuffer buffer = new StringBuffer();
- if (separator == null || separator == "") {
- do {
- buffer.write("${iterator.current}");
- } while (iterator.moveNext());
- } else {
- buffer.write("${iterator.current}");
- while (iterator.moveNext()) {
- buffer.write(separator);
- buffer.write("${iterator.current}");
- }
- }
- return buffer.toString();
- }
-
- bool any(bool f(E element)) {
- for (E element in this) {
- if (f(element)) return true;
- }
- return false;
- }
-
- List<E> toList({ bool growable: true }) =>
- new List<E>.from(this, growable: growable);
-
- Set<E> toSet() => new Set<E>.from(this);
-
- int get length {
- assert(this is! EfficientLength);
- int count = 0;
- Iterator it = iterator;
- while (it.moveNext()) {
- count++;
- }
- return count;
- }
-
- bool get isEmpty => !iterator.moveNext();
-
- bool get isNotEmpty => !isEmpty;
-
- Iterable<E> take(int count) {
- return new TakeIterable<E>(this, count);
- }
-
- Iterable<E> takeWhile(bool test(E value)) {
- return new TakeWhileIterable<E>(this, test);
- }
-
- Iterable<E> skip(int count) {
- return new SkipIterable<E>(this, count);
- }
-
- Iterable<E> skipWhile(bool test(E value)) {
- return new SkipWhileIterable<E>(this, test);
- }
-
- E get first {
- Iterator<E> it = iterator;
- if (!it.moveNext()) {
- throw IterableElementError.noElement();
- }
- return it.current;
- }
-
- E get last {
- Iterator<E> it = iterator;
- if (!it.moveNext()) {
- throw IterableElementError.noElement();
- }
- E result;
- do {
- result = it.current;
- } while(it.moveNext());
- return result;
- }
-
- E get single {
- Iterator<E> it = iterator;
- if (!it.moveNext()) throw IterableElementError.noElement();
- E result = it.current;
- if (it.moveNext()) throw IterableElementError.tooMany();
- return result;
- }
-
- E firstWhere(bool test(E value), { E orElse() }) {
- for (E element in this) {
- if (test(element)) return element;
- }
- if (orElse != null) return orElse();
- throw IterableElementError.noElement();
- }
-
- E lastWhere(bool test(E value), { E orElse() }) {
- E result = null;
- bool foundMatching = false;
- for (E element in this) {
- if (test(element)) {
- result = element;
- foundMatching = true;
- }
- }
- if (foundMatching) return result;
- if (orElse != null) return orElse();
- throw IterableElementError.noElement();
- }
-
- E singleWhere(bool test(E value)) {
- E result = null;
- bool foundMatching = false;
- for (E element in this) {
- if (test(element)) {
- if (foundMatching) {
- throw IterableElementError.tooMany();
- }
- result = element;
- foundMatching = true;
- }
- }
- if (foundMatching) return result;
- throw IterableElementError.noElement();
- }
-
- E elementAt(int index) {
- if (index is! int) throw new ArgumentError.notNull("index");
- RangeError.checkNotNegative(index, "index");
- int elementIndex = 0;
- for (E element in this) {
- if (index == elementIndex) return element;
- elementIndex++;
- }
- throw new RangeError.index(index, this, "index", null, elementIndex);
- }
-
-
- String toString() => IterableBase.iterableToShortString(this, '(', ')');
-}
-
-/**
- * Base class for implementing [Iterable].
- *
- * This class implements all methods of [Iterable] except [Iterable.iterator]
- * in terms of `iterator`.
- */
-abstract class IterableBase<E> extends Iterable<E> {
- const IterableBase();
-
- /**
- * Convert an `Iterable` to a string like [IterableBase.toString].
- *
- * Allows using other delimiters than '(' and ')'.
- *
- * Handles circular references where converting one of the elements
- * to a string ends up converting [iterable] to a string again.
- */
- static String iterableToShortString(Iterable iterable,
- [String leftDelimiter = '(',
- String rightDelimiter = ')']) {
- if (_isToStringVisiting(iterable)) {
- if (leftDelimiter == "(" && rightDelimiter == ")") {
- // Avoid creating a new string in the "common" case.
- return "(...)";
- }
- return "$leftDelimiter...$rightDelimiter";
- }
- List parts = [];
- _toStringVisiting.add(iterable);
- try {
- _iterablePartsToStrings(iterable, parts);
- } finally {
- assert(identical(_toStringVisiting.last, iterable));
- _toStringVisiting.removeLast();
- }
- return (new StringBuffer(leftDelimiter)
- ..writeAll(parts, ", ")
- ..write(rightDelimiter)).toString();
- }
-
- /**
- * Converts an `Iterable` to a string.
- *
- * Converts each elements to a string, and separates the results by ", ".
- * Then wraps the result in [leftDelimiter] and [rightDelimiter].
- *
- * Unlike [iterableToShortString], this conversion doesn't omit any
- * elements or puts any limit on the size of the result.
- *
- * Handles circular references where converting one of the elements
- * to a string ends up converting [iterable] to a string again.
- */
- static String iterableToFullString(Iterable iterable,
- [String leftDelimiter = '(',
- String rightDelimiter = ')']) {
- if (_isToStringVisiting(iterable)) {
- return "$leftDelimiter...$rightDelimiter";
- }
- StringBuffer buffer = new StringBuffer(leftDelimiter);
- _toStringVisiting.add(iterable);
- try {
- buffer.writeAll(iterable, ", ");
- } finally {
- assert(identical(_toStringVisiting.last, iterable));
- _toStringVisiting.removeLast();
- }
- buffer.write(rightDelimiter);
- return buffer.toString();
- }
-}
-
-/** A set used to identify cyclic lists during toString() calls. */
-final List _toStringVisiting = [];
-
-/** Check if we are currently visiting `o` in a toString call. */
-bool _isToStringVisiting(Object o) {
- for (int i = 0; i < _toStringVisiting.length; i++) {
- if (identical(o, _toStringVisiting[i])) return true;
- }
- return false;
-}
-
-/**
- * Convert elments of [iterable] to strings and store them in [parts].
- */
-void _iterablePartsToStrings(Iterable iterable, List parts) {
- /*
- * This is the complicated part of [iterableToShortString].
- * It is extracted as a separate function to avoid having too much code
- * inside the try/finally.
- */
- /// Try to stay below this many characters.
- const int LENGTH_LIMIT = 80;
- /// Always at least this many elements at the start.
- const int HEAD_COUNT = 3;
- /// Always at least this many elements at the end.
- const int TAIL_COUNT = 2;
- /// Stop iterating after this many elements. Iterables can be infinite.
- const int MAX_COUNT = 100;
- // Per entry length overhead. It's for ", " for all after the first entry,
- // and for "(" and ")" for the initial entry. By pure luck, that's the same
- // number.
- const int OVERHEAD = 2;
- const int ELLIPSIS_SIZE = 3; // "...".length.
-
- int length = 0;
- int count = 0;
- Iterator it = iterable.iterator;
- // Initial run of elements, at least HEAD_COUNT, and then continue until
- // passing at most LENGTH_LIMIT characters.
- while (length < LENGTH_LIMIT || count < HEAD_COUNT) {
- if (!it.moveNext()) return;
- String next = "${it.current}";
- parts.add(next);
- length += next.length + OVERHEAD;
- count++;
- }
-
- String penultimateString;
- String ultimateString;
-
- // Find last two elements. One or more of them may already be in the
- // parts array. Include their length in `length`.
- var penultimate = null;
- var ultimate = null;
- if (!it.moveNext()) {
- if (count <= HEAD_COUNT + TAIL_COUNT) return;
- ultimateString = parts.removeLast();
- penultimateString = parts.removeLast();
- } else {
- penultimate = it.current;
- count++;
- if (!it.moveNext()) {
- if (count <= HEAD_COUNT + 1) {
- parts.add("$penultimate");
- return;
- }
- ultimateString = "$penultimate";
- penultimateString = parts.removeLast();
- length += ultimateString.length + OVERHEAD;
- } else {
- ultimate = it.current;
- count++;
- // Then keep looping, keeping the last two elements in variables.
- assert(count < MAX_COUNT);
- while (it.moveNext()) {
- penultimate = ultimate;
- ultimate = it.current;
- count++;
- if (count > MAX_COUNT) {
- // If we haven't found the end before MAX_COUNT, give up.
- // This cannot happen in the code above because each entry
- // increases length by at least two, so there is no way to
- // visit more than ~40 elements before this loop.
-
- // Remove any surplus elements until length, including ", ...)",
- // is at most LENGTH_LIMIT.
- while (length > LENGTH_LIMIT - ELLIPSIS_SIZE - OVERHEAD &&
- count > HEAD_COUNT) {
- length -= parts.removeLast().length + OVERHEAD;
- count--;
- }
- parts.add("...");
- return;
- }
- }
- penultimateString = "$penultimate";
- ultimateString = "$ultimate";
- length +=
- ultimateString.length + penultimateString.length + 2 * OVERHEAD;
- }
- }
-
- // If there is a gap between the initial run and the last two,
- // prepare to add an ellipsis.
- String elision = null;
- if (count > parts.length + TAIL_COUNT) {
- elision = "...";
- length += ELLIPSIS_SIZE + OVERHEAD;
- }
-
- // If the last two elements were very long, and we have more than
- // HEAD_COUNT elements in the initial run, drop some to make room for
- // the last two.
- while (length > LENGTH_LIMIT && parts.length > HEAD_COUNT) {
- length -= parts.removeLast().length + OVERHEAD;
- if (elision == null) {
- elision = "...";
- length += ELLIPSIS_SIZE + OVERHEAD;
- }
- }
- if (elision != null) {
- parts.add(elision);
- }
- parts.add(penultimateString);
- parts.add(ultimateString);
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/collection/iterator.dart b/pkg/dev_compiler/tool/input_sdk/lib/collection/iterator.dart
deleted file mode 100644
index f870711..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/collection/iterator.dart
+++ /dev/null
@@ -1,45 +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.
-
-part of dart.collection;
-
-/**
- * The [HasNextIterator] class wraps an [Iterator] and provides methods to
- * iterate over an object using `hasNext` and `next`.
- *
- * An [HasNextIterator] does not implement the [Iterator] interface.
- */
-class HasNextIterator<E> {
- static const int _HAS_NEXT_AND_NEXT_IN_CURRENT = 0;
- static const int _NO_NEXT = 1;
- static const int _NOT_MOVED_YET = 2;
-
- Iterator<E> _iterator;
- int _state = _NOT_MOVED_YET;
-
- HasNextIterator(this._iterator);
-
- bool get hasNext {
- if (_state == _NOT_MOVED_YET) _move();
- return _state == _HAS_NEXT_AND_NEXT_IN_CURRENT;
- }
-
- E next() {
- // Call to hasNext is necessary to make sure we are positioned at the first
- // element when we start iterating.
- if (!hasNext) throw new StateError("No more elements");
- assert(_state == _HAS_NEXT_AND_NEXT_IN_CURRENT);
- E result = _iterator.current;
- _move();
- return result;
- }
-
- void _move() {
- if (_iterator.moveNext()) {
- _state = _HAS_NEXT_AND_NEXT_IN_CURRENT;
- } else {
- _state = _NO_NEXT;
- }
- }
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/collection/linked_hash_map.dart b/pkg/dev_compiler/tool/input_sdk/lib/collection/linked_hash_map.dart
deleted file mode 100644
index 9423a6d..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/collection/linked_hash_map.dart
+++ /dev/null
@@ -1,132 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-part of dart.collection;
-
-/**
- * A hash-table based implementation of [Map].
- *
- * The insertion order of keys is remembered,
- * and keys are iterated in the order they were inserted into the map.
- * Values are iterated in their corresponding key's order.
- * Changing a key's value, when the key is already in the map,
- * does not change the iteration order,
- * but removing the key and adding it again
- * will make it be last in the iteration order.
- *
- * The keys of a `LinkedHashMap` must have consistent [Object.operator==]
- * and [Object.hashCode] implementations. This means that the `==` operator
- * must define a stable equivalence relation on the keys (reflexive,
- * symmetric, transitive, and consistent over time), and that `hashCode`
- * must be the same for objects that are considered equal by `==`.
- *
- * The map allows `null` as a key.
- */
-abstract class LinkedHashMap<K, V> implements HashMap<K, V> {
- /**
- * Creates an insertion-ordered hash-table based [Map].
- *
- * If [equals] is provided, it is used to compare the keys in the table with
- * new keys. If [equals] is omitted, the key's own [Object.operator==] is used
- * instead.
- *
- * Similar, if [hashCode] is provided, it is used to produce a hash value
- * for keys in order to place them in the hash table. If it is omitted, the
- * key's own [Object.hashCode] is used.
- *
- * If using methods like [operator[]], [remove] and [containsKey] together
- * with a custom equality and hashcode, an extra `isValidKey` function
- * can be supplied. This function is called before calling [equals] or
- * [hashCode] with an argument that may not be a [K] instance, and if the
- * call returns false, the key is assumed to not be in the set.
- * The [isValidKey] function defaults to just testing if the object is a
- * [K] instance.
- *
- * Example:
- *
- * new LinkedHashMap<int,int>(equals: (int a, int b) => (b - a) % 5 == 0,
- * hashCode: (int e) => e % 5)
- *
- * This example map does not need an `isValidKey` function to be passed.
- * The default function accepts only `int` values, which can safely be
- * passed to both the `equals` and `hashCode` functions.
- *
- * If neither `equals`, `hashCode`, nor `isValidKey` is provided,
- * the default `isValidKey` instead accepts all keys.
- * The default equality and hashcode operations are assumed to work on all
- * objects.
- *
- * Likewise, if `equals` is [identical], `hashCode` is [identityHashCode]
- * and `isValidKey` is omitted, the resulting map is identity based,
- * and the `isValidKey` defaults to accepting all keys.
- * Such a map can be created directly using [LinkedHashMap.identity].
- *
- * The used `equals` and `hashCode` method should always be consistent,
- * so that if `equals(a, b)` then `hashCode(a) == hashCode(b)`. The hash
- * of an object, or what it compares equal to, should not change while the
- * object is in the table. If it does change, the result is unpredictable.
- *
- * If you supply one of [equals] and [hashCode],
- * you should generally also to supply the other.
- */
- external factory LinkedHashMap({bool equals(K key1, K key2),
- int hashCode(K key),
- bool isValidKey(Object potentialKey)});
-
- /**
- * Creates an insertion-ordered identity-based map.
- *
- * Effectively a shorthand for:
- *
- * new LinkedHashMap(equals: identical,
- * hashCode: identityHashCode)
- */
- external factory LinkedHashMap.identity();
-
- /**
- * Creates a [LinkedHashMap] that contains all key value pairs of [other].
- */
- factory LinkedHashMap.from(Map other) {
- LinkedHashMap<K, V> result = new LinkedHashMap<K, V>();
- other.forEach((k, v) { result[k as Object/*=K*/] = v as Object/*=V*/; });
- return result;
- }
-
- /**
- * Creates a [LinkedHashMap] where the keys and values are computed from the
- * [iterable].
- *
- * For each element of the [iterable] this constructor computes a key/value
- * pair, by applying [key] and [value] respectively.
- *
- * The keys of the key/value pairs do not need to be unique. The last
- * occurrence of a key will simply overwrite any previous value.
- *
- * If no values are specified for [key] and [value] the default is the
- * identity function.
- */
- factory LinkedHashMap.fromIterable(Iterable iterable,
- {K key(element), V value(element)}) {
- LinkedHashMap<K, V> map = new LinkedHashMap<K, V>();
- Maps._fillMapWithMappedIterable(map, iterable, key, value);
- return map;
- }
-
- /**
- * Creates a [LinkedHashMap] associating the given [keys] to [values].
- *
- * This constructor iterates over [keys] and [values] and maps each element of
- * [keys] to the corresponding element of [values].
- *
- * If [keys] contains the same object multiple times, the last occurrence
- * overwrites the previous value.
- *
- * It is an error if the two [Iterable]s don't have the same length.
- */
- factory LinkedHashMap.fromIterables(Iterable<K> keys, Iterable<V> values) {
- LinkedHashMap<K, V> map = new LinkedHashMap<K, V>();
- Maps._fillMapWithIterables(map, keys, values);
- return map;
- }
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/collection/linked_hash_set.dart b/pkg/dev_compiler/tool/input_sdk/lib/collection/linked_hash_set.dart
deleted file mode 100644
index 231ef8e..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/collection/linked_hash_set.dart
+++ /dev/null
@@ -1,125 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-part of dart.collection;
-
-/**
- * A [LinkedHashSet] is a hash-table based [Set] implementation.
- *
- * The `LinkedHashSet` also keep track of the order that elements were inserted
- * in, and iteration happens in first-to-last insertion order.
- *
- * The elements of a `LinkedHashSet` must have consistent [Object.operator==]
- * and [Object.hashCode] implementations. This means that the `==` operator
- * must define a stable equivalence relation on the elements (reflexive,
- * symmetric, transitive, and consistent over time), and that `hashCode`
- * must be the same for objects that are considered equal by `==`.
- *
- * The set allows `null` as an element.
- *
- * Iteration of elements is done in element insertion order.
- * An element that was added after another will occur later in the iteration.
- * Adding an element that is already in the set
- * does not change its position in the iteration order,
- * but removing an element and adding it again,
- * will make it the last element of an iteration.
- *
- * Most simple operations on `HashSet` are done in (potentially amortized)
- * constant time: [add], [contains], [remove], and [length], provided the hash
- * codes of objects are well distributed..
- */
-abstract class LinkedHashSet<E> implements HashSet<E> {
- /**
- * Create an insertion-ordered hash set using the provided
- * [equals] and [hashCode].
- *
- * The provided [equals] must define a stable equivalence relation, and
- * [hashCode] must be consistent with [equals]. If the [equals] or [hashCode]
- * methods won't work on all objects, but only on some instances of E, the
- * [isValidKey] predicate can be used to restrict the keys that the functions
- * are applied to.
- * Any key for which [isValidKey] returns false is automatically assumed
- * to not be in the set when asking `contains`.
- *
- * If [equals] or [hashCode] are omitted, the set uses
- * the elements' intrinsic [Object.operator==] and [Object.hashCode],
- * and [isValidKey] is ignored since these operations are assumed
- * to work on all objects.
- *
- * If you supply one of [equals] and [hashCode],
- * you should generally also to supply the other.
- *
- * If the supplied `equals` or `hashCode` functions won't work on all [E]
- * objects, and the map will be used in a setting where a non-`E` object
- * is passed to, e.g., `contains`, then the [isValidKey] function should
- * also be supplied.
- *
- * If [isValidKey] is omitted, it defaults to testing if the object is an
- * [E] instance. That means that:
- *
- * new LinkedHashSet<int>(equals: (int e1, int e2) => (e1 - e2) % 5 == 0,
- * hashCode: (int e) => e % 5)
- *
- * does not need an `isValidKey` argument, because it defaults to only
- * accepting `int` values which are accepted by both `equals` and `hashCode`.
- *
- * If neither `equals`, `hashCode`, nor `isValidKey` is provided,
- * the default `isValidKey` instead accepts all values.
- * The default equality and hashcode operations are assumed to work on all
- * objects.
- *
- * Likewise, if `equals` is [identical], `hashCode` is [identityHashCode]
- * and `isValidKey` is omitted, the resulting set is identity based,
- * and the `isValidKey` defaults to accepting all keys.
- * Such a map can be created directly using [LinkedHashSet.identity].
- */
- external factory LinkedHashSet({bool equals(E e1, E e2),
- int hashCode(E e),
- bool isValidKey(Object potentialKey)});
-
- /**
- * Creates an insertion-ordered identity-based set.
- *
- * Effectively a shorthand for:
- *
- * new LinkedHashSet(equals: identical,
- * hashCode: identityHashCode)
- */
- external factory LinkedHashSet.identity();
-
- /**
- * Create a linked hash set containing all [elements].
- *
- * Creates a linked hash set as by `new LinkedHashSet<E>()` and adds each
- * element of`elements` to this set in the order they are iterated.
- *
- * All the [elements] should be assignable to [E].
- * The `elements` iterable itself may have any element type,
- * so this constructor can be used to down-cast a `Set`, for example as:
- *
- * Set<SuperType> superSet = ...;
- * Iterable<SuperType> tmp = superSet.where((e) => e is SubType);
- * Set<SubType> subSet = new LinkedHashSet<SubType>.from(tmp);
- */
- factory LinkedHashSet.from(Iterable elements) {
- LinkedHashSet<E> result = new LinkedHashSet<E>();
- for (final element in elements) {
- E e = element as Object/*=E*/;
- result.add(e);
- }
- return result;
- }
-
- /**
- * Executes a function on each element of the set.
- *
- * The elements are iterated in insertion order.
- */
- void forEach(void action(E element));
-
- /**
- * Provides an iterator that iterates over the elements in insertion order.
- */
- Iterator<E> get iterator;
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/collection/linked_list.dart b/pkg/dev_compiler/tool/input_sdk/lib/collection/linked_list.dart
deleted file mode 100644
index 481f04d..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/collection/linked_list.dart
+++ /dev/null
@@ -1,301 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-part of dart.collection;
-
-
-/**
- * A specialized double-linked list of elements that extends [LinkedListEntry].
- *
- * This is not a generic data structure. It only accepts elements that extend
- * the [LinkedListEntry] class. See the [Queue] implementations for
- * generic collections that allow constant time adding and removing at the ends.
- *
- * This is not a [List] implementation. Despite its name, this class does not
- * implement the [List] interface. It does not allow constant time lookup by
- * index.
- *
- * Because the elements themselves contain the links of this linked list,
- * each element can be in only one list at a time. To add an element to another
- * list, it must first be removed from its current list (if any).
- *
- * In return, each element knows its own place in the linked list, as well as
- * which list it is in. This allows constant time [LinkedListEntry.addAfter],
- * [LinkedListEntry.addBefore] and [LinkedListEntry.unlink] operations
- * when all you have is the element.
- *
- * A `LinkedList` also allows constant time adding and removing at either end,
- * and a constant time length getter.
- */
-class LinkedList<E extends LinkedListEntry<E>>
- extends Iterable<E> {
-
- int _modificationCount = 0;
- int _length = 0;
- E _first;
-
- /**
- * Construct a new empty linked list.
- */
- LinkedList();
-
- /**
- * Add [entry] to the beginning of the linked list.
- */
- void addFirst(E entry) {
- _insertBefore(_first, entry, updateFirst: true);
- _first = entry;
- }
-
- /**
- * Add [entry] to the end of the linked list.
- */
- void add(E entry) {
- _insertBefore(_first, entry, updateFirst: false);
- }
-
- /**
- * Add [entries] to the end of the linked list.
- */
- void addAll(Iterable<E> entries) {
- entries.forEach(add);
- }
-
- /**
- * Remove [entry] from the linked list.
- *
- * Returns false and does nothing if [entry] is not in this linked list.
- *
- * This is equivalent to calling `entry.unlink()` if the entry is in this
- * list.
- */
- bool remove(E entry) {
- if (entry._list != this) return false;
- _unlink(entry); // Unlink will decrement length.
- return true;
- }
-
- Iterator<E> get iterator => new _LinkedListIterator<E>(this);
-
- int get length => _length;
-
- /**
- * Remove all elements from this linked list.
- */
- void clear() {
- _modificationCount++;
- if (isEmpty) return;
-
- E next = _first;
- do {
- E entry = next;
- next = entry._next;
- entry._next = entry._previous = entry._list = null;
- } while (!identical(next, _first));
-
- _first = null;
- _length = 0;
- }
-
- E get first {
- if (isEmpty) {
- throw new StateError('No such element');
- }
- return _first;
- }
-
- E get last {
- if (isEmpty) {
- throw new StateError('No such element');
- }
- return _first._previous;
- }
-
- E get single {
- if (isEmpty) {
- throw new StateError('No such element');
- }
- if (_length > 1) {
- throw new StateError('Too many elements');
- }
- return _first;
- }
-
- /**
- * Call [action] with each entry in this linked list.
- *
- * It's an error if [action] modify the linked list.
- */
- void forEach(void action(E entry)) {
- int modificationCount = _modificationCount;
- if (isEmpty) return;
-
- E current = _first;
- do {
- action(current);
- if (modificationCount != _modificationCount) {
- throw new ConcurrentModificationError(this);
- }
- current = current._next;
- } while (!identical(current, _first));
- }
-
- bool get isEmpty => _length == 0;
-
- /// Inserts [newEntry] as last entry of the list.
- ///
- /// If [updateFirst] is true and [entry] is the first entry in the list,
- /// updates the [_first] field to point to the [newEntry] as first entry.
- void _insertBefore(E entry, E newEntry, {bool updateFirst}) {
- if (newEntry.list != null) {
- throw new StateError(
- 'LinkedListEntry is already in a LinkedList');
- }
- _modificationCount++;
-
- newEntry._list = this;
- if (isEmpty) {
- assert(entry == null);
- newEntry._previous = newEntry._next = newEntry;
- _first = newEntry;
- _length++;
- return;
- }
- E predecessor = entry._previous;
- E successor = entry;
- newEntry._previous = predecessor;
- newEntry._next = successor;
- predecessor._next = newEntry;
- successor._previous = newEntry;
- if (updateFirst && identical(entry, _first)) {
- _first = newEntry;
- }
- _length++;
- }
-
- void _unlink(E entry) {
- _modificationCount++;
- entry._next._previous = entry._previous;
- E next = entry._previous._next = entry._next;
- _length--;
- entry._list = entry._next = entry._previous = null;
- if (isEmpty) {
- _first = null;
- } else if (identical(entry, _first)) {
- _first = next;
- }
- }
-}
-
-
-class _LinkedListIterator<E extends LinkedListEntry<E>>
- implements Iterator<E> {
- final LinkedList<E> _list;
- final int _modificationCount;
- E _current;
- LinkedListEntry<E> _next;
- bool _visitedFirst;
-
- _LinkedListIterator(LinkedList<E> list)
- : _list = list,
- _modificationCount = list._modificationCount,
- _next = list._first,
- _visitedFirst = false;
-
- E get current => _current;
-
- bool moveNext() {
- if (_modificationCount != _list._modificationCount) {
- throw new ConcurrentModificationError(this);
- }
- if (_list.isEmpty ||
- (_visitedFirst && identical(_next, _list.first))) {
- _current = null;
- return false;
- }
- _visitedFirst = true;
- _current = _next;
- _next = _next._next;
- return true;
- }
-}
-
-
-/**
- * An object that can be an element in a [LinkedList].
- *
- * All elements of a `LinkedList` must extend this class.
- * The class provides the internal links that link elements together
- * in the `LinkedList`, and a reference to the linked list itself
- * that an element is currently part of.
- *
- * An entry can be in at most one linked list at a time.
- * While an entry is in a linked list, the [list] property points to that
- * linked list, and otherwise the `list` property is `null`.
- *
- * When created, an entry is not in any linked list.
- */
-abstract class LinkedListEntry<E extends LinkedListEntry<E>> {
- LinkedList<E> _list;
- E _next;
- E _previous;
-
- /**
- * Get the linked list containing this element.
- *
- * Returns `null` if this entry is not currently in any list.
- */
- LinkedList<E> get list => _list;
-
- /**
- * Unlink the element from its linked list.
- *
- * The entry must currently be in a linked list when this method is called.
- */
- void unlink() {
- _list._unlink(this);
- }
-
- /**
- * Return the succeessor of this element in its linked list.
- *
- * Returns `null` if there is no successor in the linked list, or if this
- * entry is not currently in any list.
- */
- E get next {
- if (identical(this, _next)) return null;
- return _next;
- }
-
- /**
- * Return the predecessor of this element in its linked list.
- *
- * Returns `null` if there is no predecessor in the linked list, or if this
- * entry is not currently in any list.
- */
- E get previous {
- if (identical(this, _previous)) return null;
- return _previous;
- }
-
- /**
- * Insert an element after this element in this element's linked list.
- *
- * This entry must be in a linked list when this method is called.
- * The [entry] must not be in a linked list.
- */
- void insertAfter(E entry) {
- _list._insertBefore(_next, entry, updateFirst: false);
- }
-
- /**
- * Insert an element before this element in this element's linked list.
- *
- * This entry must be in a linked list when this method is called.
- * The [entry] must not be in a linked list.
- */
- void insertBefore(E entry) {
- _list._insertBefore(this as dynamic/*=E*/, entry, updateFirst: true);
- }
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/collection/list.dart b/pkg/dev_compiler/tool/input_sdk/lib/collection/list.dart
deleted file mode 100644
index f999447..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/collection/list.dart
+++ /dev/null
@@ -1,515 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-part of dart.collection;
-
-/**
- * Abstract implementation of a list.
- *
- * `ListBase` can be used as a base class for implementing the `List` interface.
- *
- * All operations are defined in terms of `length`, `operator[]`,
- * `operator[]=` and `length=`, which need to be implemented.
- *
- * *NOTICE*: Forwarding just these four operations to a normal growable [List]
- * (as created by `new List()`) will give very bad performance for `add` and
- * `addAll` operations of `ListBase`. These operations are implemented by
- * increasing the length of the list by one for each `add` operation, and
- * repeatedly increasing the length of a growable list is not efficient.
- * To avoid this, either override 'add' and 'addAll' to also forward directly
- * to the growable list, or, preferably, use `DelegatingList` from
- * "package:collection/wrappers.dart" instead.
- */
-abstract class ListBase<E> extends Object with ListMixin<E> {
- /**
- * Convert a `List` to a string as `[each, element, as, string]`.
- *
- * Handles circular references where converting one of the elements
- * to a string ends up converting [list] to a string again.
- */
- static String listToString(List list) =>
- IterableBase.iterableToFullString(list, '[', ']');
-}
-
-/**
- * Base implementation of a [List] class.
- *
- * `ListMixin` can be used as a mixin to make a class implement
- * the `List` interface.
- *
- * This implements all read operations using only the `length` and
- * `operator[]` members. It implements write operations using those and
- * `length=` and `operator[]=`
- *
- * *NOTICE*: Forwarding just these four operations to a normal growable [List]
- * (as created by `new List()`) will give very bad performance for `add` and
- * `addAll` operations of `ListBase`. These operations are implemented by
- * increasing the length of the list by one for each `add` operation, and
- * repeatedly increasing the length of a growable list is not efficient.
- * To avoid this, either override 'add' and 'addAll' to also forward directly
- * to the growable list, or, if possible, use `DelegatingList` from
- * "package:collection/wrappers.dart" instead.
- */
-abstract class ListMixin<E> implements List<E> {
- // Iterable interface.
- Iterator<E> get iterator => new ListIterator<E>(this);
-
- E elementAt(int index) => this[index];
-
- void forEach(void action(E element)) {
- int length = this.length;
- for (int i = 0; i < length; i++) {
- action(this[i]);
- if (length != this.length) {
- throw new ConcurrentModificationError(this);
- }
- }
- }
-
- bool get isEmpty => length == 0;
-
- bool get isNotEmpty => !isEmpty;
-
- E get first {
- if (length == 0) throw IterableElementError.noElement();
- return this[0];
- }
-
- E get last {
- if (length == 0) throw IterableElementError.noElement();
- return this[length - 1];
- }
-
- E get single {
- if (length == 0) throw IterableElementError.noElement();
- if (length > 1) throw IterableElementError.tooMany();
- return this[0];
- }
-
- bool contains(Object element) {
- int length = this.length;
- for (int i = 0; i < this.length; i++) {
- if (this[i] == element) return true;
- if (length != this.length) {
- throw new ConcurrentModificationError(this);
- }
- }
- return false;
- }
-
- bool every(bool test(E element)) {
- int length = this.length;
- for (int i = 0; i < length; i++) {
- if (!test(this[i])) return false;
- if (length != this.length) {
- throw new ConcurrentModificationError(this);
- }
- }
- return true;
- }
-
- bool any(bool test(E element)) {
- int length = this.length;
- for (int i = 0; i < length; i++) {
- if (test(this[i])) return true;
- if (length != this.length) {
- throw new ConcurrentModificationError(this);
- }
- }
- return false;
- }
-
- E firstWhere(bool test(E element), { E orElse() }) {
- int length = this.length;
- for (int i = 0; i < length; i++) {
- E element = this[i];
- if (test(element)) return element;
- if (length != this.length) {
- throw new ConcurrentModificationError(this);
- }
- }
- if (orElse != null) return orElse();
- throw IterableElementError.noElement();
- }
-
- E lastWhere(bool test(E element), { E orElse() }) {
- int length = this.length;
- for (int i = length - 1; i >= 0; i--) {
- E element = this[i];
- if (test(element)) return element;
- if (length != this.length) {
- throw new ConcurrentModificationError(this);
- }
- }
- if (orElse != null) return orElse();
- throw IterableElementError.noElement();
- }
-
- E singleWhere(bool test(E element)) {
- int length = this.length;
- E match = null;
- bool matchFound = false;
- for (int i = 0; i < length; i++) {
- E element = this[i];
- if (test(element)) {
- if (matchFound) {
- throw IterableElementError.tooMany();
- }
- matchFound = true;
- match = element;
- }
- if (length != this.length) {
- throw new ConcurrentModificationError(this);
- }
- }
- if (matchFound) return match;
- throw IterableElementError.noElement();
- }
-
- String join([String separator = ""]) {
- if (length == 0) return "";
- StringBuffer buffer = new StringBuffer()..writeAll(this, separator);
- return buffer.toString();
- }
-
- Iterable<E> where(bool test(E element)) => new WhereIterable<E>(this, test);
-
- Iterable/*<T>*/ map/*<T>*/(/*=T*/ f(E element)) =>
- new MappedListIterable/*<E, T>*/(this, f);
-
- Iterable/*<T>*/ expand/*<T>*/(Iterable/*<T>*/ f(E element)) =>
- new ExpandIterable<E, dynamic/*=T*/>(this, f);
-
- E reduce(E combine(E previousValue, E element)) {
- int length = this.length;
- if (length == 0) throw IterableElementError.noElement();
- E value = this[0];
- for (int i = 1; i < length; i++) {
- value = combine(value, this[i]);
- if (length != this.length) {
- throw new ConcurrentModificationError(this);
- }
- }
- return value;
- }
-
- dynamic/*=T*/ fold/*<T>*/(var/*=T*/ initialValue,
- dynamic/*=T*/ combine(var/*=T*/ previousValue, E element)) {
- var value = initialValue;
- int length = this.length;
- for (int i = 0; i < length; i++) {
- value = combine(value, this[i]);
- if (length != this.length) {
- throw new ConcurrentModificationError(this);
- }
- }
- return value;
- }
-
- Iterable<E> skip(int count) => new SubListIterable<E>(this, count, null);
-
- Iterable<E> skipWhile(bool test(E element)) {
- return new SkipWhileIterable<E>(this, test);
- }
-
- Iterable<E> take(int count) => new SubListIterable<E>(this, 0, count);
-
- Iterable<E> takeWhile(bool test(E element)) {
- return new TakeWhileIterable<E>(this, test);
- }
-
- List<E> toList({ bool growable: true }) {
- List<E> result;
- if (growable) {
- result = new List<E>()..length = length;
- } else {
- result = new List<E>(length);
- }
- for (int i = 0; i < length; i++) {
- result[i] = this[i];
- }
- return result;
- }
-
- Set<E> toSet() {
- Set<E> result = new Set<E>();
- for (int i = 0; i < length; i++) {
- result.add(this[i]);
- }
- return result;
- }
-
- // Collection interface.
- void add(E element) {
- this[this.length++] = element;
- }
-
- void addAll(Iterable<E> iterable) {
- int i = this.length;
- for (E element in iterable) {
- assert(this.length == i || (throw new ConcurrentModificationError(this)));
- this.length = i + 1;
- this[i] = element;
- i++;
- }
- }
-
- bool remove(Object element) {
- for (int i = 0; i < this.length; i++) {
- if (this[i] == element) {
- this.setRange(i, this.length - 1, this, i + 1);
- this.length -= 1;
- return true;
- }
- }
- return false;
- }
-
- void removeWhere(bool test(E element)) {
- _filter(test, false);
- }
-
- void retainWhere(bool test(E element)) {
- _filter(test, true);
- }
-
- void _filter(bool test(var element), bool retainMatching) {
- var source = this;
- var retained = <E>[];
- int length = source.length;
- for (int i = 0; i < length; i++) {
- var element = source[i];
- if (test(element) == retainMatching) {
- retained.add(element);
- }
- if (length != source.length) {
- throw new ConcurrentModificationError(source);
- }
- }
- if (retained.length != source.length) {
- source.setRange(0, retained.length, retained);
- source.length = retained.length;
- }
- }
-
- void clear() { this.length = 0; }
-
- // List interface.
-
- E removeLast() {
- if (length == 0) {
- throw IterableElementError.noElement();
- }
- E result = this[length - 1];
- length--;
- return result;
- }
-
- void sort([int compare(E a, E b)]) {
- if (compare == null) {
- Sort.sort(this, (a, b) => Comparable.compare(a, b));
- } else {
- Sort.sort(this, compare);
- }
- }
-
- void shuffle([Random random]) {
- if (random == null) random = new Random();
- int length = this.length;
- while (length > 1) {
- int pos = random.nextInt(length);
- length -= 1;
- var tmp = this[length];
- this[length] = this[pos];
- this[pos] = tmp;
- }
- }
-
- Map<int, E> asMap() {
- return new ListMapView<E>(this);
- }
-
- List<E> sublist(int start, [int end]) {
- int listLength = this.length;
- if (end == null) end = listLength;
- RangeError.checkValidRange(start, end, listLength);
- int length = end - start;
- List<E> result = new List<E>()..length = length;
- for (int i = 0; i < length; i++) {
- result[i] = this[start + i];
- }
- return result;
- }
-
- Iterable<E> getRange(int start, int end) {
- RangeError.checkValidRange(start, end, this.length);
- return new SubListIterable<E>(this, start, end);
- }
-
- void removeRange(int start, int end) {
- RangeError.checkValidRange(start, end, this.length);
- int length = end - start;
- setRange(start, this.length - length, this, end);
- this.length -= length;
- }
-
- void fillRange(int start, int end, [E fill]) {
- RangeError.checkValidRange(start, end, this.length);
- for (int i = start; i < end; i++) {
- this[i] = fill;
- }
- }
-
- void setRange(int start, int end, Iterable<E> iterable, [int skipCount = 0]) {
- RangeError.checkValidRange(start, end, this.length);
- int length = end - start;
- if (length == 0) return;
- RangeError.checkNotNegative(skipCount, "skipCount");
-
- List<E> otherList;
- int otherStart;
- // TODO(floitsch): Make this accept more.
- if (iterable is List/*<E>*/) {
- otherList = iterable;
- otherStart = skipCount;
- } else {
- otherList = iterable.skip(skipCount).toList(growable: false);
- otherStart = 0;
- }
- if (otherStart + length > otherList.length) {
- throw IterableElementError.tooFew();
- }
- if (otherStart < start) {
- // Copy backwards to ensure correct copy if [from] is this.
- for (int i = length - 1; i >= 0; i--) {
- this[start + i] = otherList[otherStart + i];
- }
- } else {
- for (int i = 0; i < length; i++) {
- this[start + i] = otherList[otherStart + i];
- }
- }
- }
-
- void replaceRange(int start, int end, Iterable<E> newContents) {
- RangeError.checkValidRange(start, end, this.length);
- if (newContents is! EfficientLength) {
- newContents = newContents.toList();
- }
- int removeLength = end - start;
- int insertLength = newContents.length;
- if (removeLength >= insertLength) {
- int delta = removeLength - insertLength;
- int insertEnd = start + insertLength;
- int newLength = this.length - delta;
- this.setRange(start, insertEnd, newContents);
- if (delta != 0) {
- this.setRange(insertEnd, newLength, this, end);
- this.length = newLength;
- }
- } else {
- int delta = insertLength - removeLength;
- int newLength = this.length + delta;
- int insertEnd = start + insertLength; // aka. end + delta.
- this.length = newLength;
- this.setRange(insertEnd, newLength, this, end);
- this.setRange(start, insertEnd, newContents);
- }
- }
-
- int indexOf(Object element, [int startIndex = 0]) {
- if (startIndex >= this.length) {
- return -1;
- }
- if (startIndex < 0) {
- startIndex = 0;
- }
- for (int i = startIndex; i < this.length; i++) {
- if (this[i] == element) {
- return i;
- }
- }
- return -1;
- }
-
- /**
- * Returns the last index in the list [a] of the given [element], starting
- * the search at index [startIndex] to 0.
- * Returns -1 if [element] is not found.
- */
- int lastIndexOf(Object element, [int startIndex]) {
- if (startIndex == null) {
- startIndex = this.length - 1;
- } else {
- if (startIndex < 0) {
- return -1;
- }
- if (startIndex >= this.length) {
- startIndex = this.length - 1;
- }
- }
- for (int i = startIndex; i >= 0; i--) {
- if (this[i] == element) {
- return i;
- }
- }
- return -1;
- }
-
- void insert(int index, E element) {
- RangeError.checkValueInInterval(index, 0, length, "index");
- if (index == this.length) {
- add(element);
- return;
- }
- // We are modifying the length just below the is-check. Without the check
- // Array.copy could throw an exception, leaving the list in a bad state
- // (with a length that has been increased, but without a new element).
- if (index is! int) throw new ArgumentError(index);
- this.length++;
- setRange(index + 1, this.length, this, index);
- this[index] = element;
- }
-
- E removeAt(int index) {
- E result = this[index];
- setRange(index, this.length - 1, this, index + 1);
- length--;
- return result;
- }
-
- void insertAll(int index, Iterable<E> iterable) {
- RangeError.checkValueInInterval(index, 0, length, "index");
- if (iterable is! EfficientLength || identical(iterable, this)) {
- iterable = iterable.toList();
- }
- int insertionLength = iterable.length;
- // There might be errors after the length change, in which case the list
- // will end up being modified but the operation not complete. Unless we
- // always go through a "toList" we can't really avoid that.
- this.length += insertionLength;
- if (iterable.length != insertionLength) {
- // If the iterable's length is linked to this list's length somehow,
- // we can't insert one in the other.
- this.length -= insertionLength;
- throw new ConcurrentModificationError(iterable);
- }
- setRange(index + insertionLength, this.length, this, index);
- setAll(index, iterable);
- }
-
- void setAll(int index, Iterable<E> iterable) {
- if (iterable is List) {
- setRange(index, index + iterable.length, iterable);
- } else {
- for (E element in iterable) {
- this[index++] = element;
- }
- }
- }
-
- Iterable<E> get reversed => new ReversedListIterable<E>(this);
-
- String toString() => IterableBase.iterableToFullString(this, '[', ']');
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/collection/maps.dart b/pkg/dev_compiler/tool/input_sdk/lib/collection/maps.dart
deleted file mode 100644
index 7871b87..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/collection/maps.dart
+++ /dev/null
@@ -1,355 +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.
-
-part of dart.collection;
-
-/**
- * Base class for implementing a [Map].
- *
- * This class has a basic implementation of all but five of the members of
- * [Map].
- * A basic `Map` class can be implemented by extending this class and
- * implementing `keys`, `operator[]`, `operator[]=`, `remove` and `clear`.
- * The remaining operations are implemented in terms of these five.
- *
- * The `keys` iterable should have efficient [length] and [contains]
- * operations, and it should catch concurrent modifications of the keys
- * while iterating.
- *
- * A more efficient implementation is usually possible by overriding
- * some of the other members as well.
- */
-abstract class MapBase<K, V> = Object with MapMixin<K, V>;
-
-
-/**
- * Mixin implementing a [Map].
- *
- * This mixin has a basic implementation of all but five of the members of
- * [Map].
- * A basic `Map` class can be implemented by mixin in this class and
- * implementing `keys`, `operator[]`, `operator[]=`, `remove` and `clear`.
- * The remaining operations are implemented in terms of these five.
- *
- * The `keys` iterable should have efficient [length] and [contains]
- * operations, and it should catch concurrent modifications of the keys
- * while iterating.
- *
- * A more efficient implementation is usually possible by overriding
- * some of the other members as well.
- */
-abstract class MapMixin<K, V> implements Map<K, V> {
- Iterable<K> get keys;
- V operator[](Object key);
- operator []=(K key, V value);
- V remove(Object key);
- // The `clear` operation should not be based on `remove`.
- // It should clear the map even if some keys are not equal to themselves.
- void clear();
-
- void forEach(void action(K key, V value)) {
- for (K key in keys) {
- action(key, this[key]);
- }
- }
-
- void addAll(Map<K, V> other) {
- for (K key in other.keys) {
- this[key] = other[key];
- }
- }
-
- bool containsValue(Object value) {
- for (K key in keys) {
- if (this[key] == value) return true;
- }
- return false;
- }
-
- V putIfAbsent(K key, V ifAbsent()) {
- if (containsKey(key)) {
- return this[key];
- }
- return this[key] = ifAbsent();
- }
-
- bool containsKey(Object key) => keys.contains(key);
- int get length => keys.length;
- bool get isEmpty => keys.isEmpty;
- bool get isNotEmpty => keys.isNotEmpty;
- Iterable<V> get values => new _MapBaseValueIterable<K, V>(this);
- String toString() => Maps.mapToString(this);
-}
-
-/**
- * Basic implementation of an unmodifiable [Map].
- *
- * This class has a basic implementation of all but two of the members of
- * an umodifiable [Map].
- * A simple unmodifiable `Map` class can be implemented by extending this
- * class and implementing `keys` and `operator[]`.
- *
- * Modifying operations throw when used.
- * The remaining non-modifying operations are implemented in terms of `keys`
- * and `operator[]`.
- *
- * The `keys` iterable should have efficient [length] and [contains]
- * operations, and it should catch concurrent modifications of the keys
- * while iterating.
- *
- * A more efficient implementation is usually possible by overriding
- * some of the other members as well.
- */
-abstract class UnmodifiableMapBase<K, V> =
- MapBase<K, V> with _UnmodifiableMapMixin<K, V>;
-
-/**
- * Implementation of [Map.values] based on the map and its [Map.keys] iterable.
- *
- * Iterable that iterates over the values of a `Map`.
- * It accesses the values by iterating over the keys of the map, and using the
- * map's `operator[]` to lookup the keys.
- */
-class _MapBaseValueIterable<K, V> extends Iterable<V>
- implements EfficientLength {
- final Map<K, V> _map;
- _MapBaseValueIterable(this._map);
-
- int get length => _map.length;
- bool get isEmpty => _map.isEmpty;
- bool get isNotEmpty => _map.isNotEmpty;
- V get first => _map[_map.keys.first];
- V get single => _map[_map.keys.single];
- V get last => _map[_map.keys.last];
-
- Iterator<V> get iterator => new _MapBaseValueIterator<K, V>(_map);
-}
-
-/**
- * Iterator created by [_MapBaseValueIterable].
- *
- * Iterates over the values of a map by iterating its keys and lookup up the
- * values.
- */
-class _MapBaseValueIterator<K, V> implements Iterator<V> {
- final Iterator<K> _keys;
- final Map<K, V> _map;
- V _current = null;
-
- _MapBaseValueIterator(Map<K, V> map)
- : _map = map,
- _keys = map.keys.iterator;
-
- bool moveNext() {
- if (_keys.moveNext()) {
- _current = _map[_keys.current];
- return true;
- }
- _current = null;
- return false;
- }
-
- V get current => _current;
-}
-
-/**
- * Mixin that overrides mutating map operations with implementations that throw.
- */
-abstract class _UnmodifiableMapMixin<K, V> implements Map<K, V> {
- void operator[]=(K key, V value) {
- throw new UnsupportedError("Cannot modify unmodifiable map");
- }
- void addAll(Map<K, V> other) {
- throw new UnsupportedError("Cannot modify unmodifiable map");
- }
- void clear() {
- throw new UnsupportedError("Cannot modify unmodifiable map");
- }
- V remove(Object key) {
- throw new UnsupportedError("Cannot modify unmodifiable map");
- }
- V putIfAbsent(K key, V ifAbsent()) {
- throw new UnsupportedError("Cannot modify unmodifiable map");
- }
-}
-
-/**
- * Wrapper around a class that implements [Map] that only exposes `Map` members.
- *
- * A simple wrapper that delegates all `Map` members to the map provided in the
- * constructor.
- *
- * Base for delegating map implementations like [UnmodifiableMapView].
- */
-class MapView<K, V> implements Map<K, V> {
- final Map<K, V> _map;
- const MapView(Map<K, V> map) : _map = map;
-
- V operator[](Object key) => _map[key];
- void operator[]=(K key, V value) { _map[key] = value; }
- void addAll(Map<K, V> other) { _map.addAll(other); }
- void clear() { _map.clear(); }
- V putIfAbsent(K key, V ifAbsent()) => _map.putIfAbsent(key, ifAbsent);
- bool containsKey(Object key) => _map.containsKey(key);
- bool containsValue(Object value) => _map.containsValue(value);
- void forEach(void action(K key, V value)) { _map.forEach(action); }
- bool get isEmpty => _map.isEmpty;
- bool get isNotEmpty => _map.isNotEmpty;
- int get length => _map.length;
- Iterable<K> get keys => _map.keys;
- V remove(Object key) => _map.remove(key);
- String toString() => _map.toString();
- Iterable<V> get values => _map.values;
-}
-
-/**
- * View of a [Map] that disallow modifying the map.
- *
- * A wrapper around a `Map` that forwards all members to the map provided in
- * the constructor, except for operations that modify the map.
- * Modifying operations throw instead.
- */
-class UnmodifiableMapView<K, V> =
- MapView<K, V> with _UnmodifiableMapMixin<K, V>;
-
-/**
- * Helper class which implements complex [Map] operations
- * in term of basic ones ([Map.keys], [Map.operator []],
- * [Map.operator []=] and [Map.remove].) Not all methods are
- * necessary to implement each particular operation.
- */
-class Maps {
- static bool containsValue(Map map, Object value) {
- for (final v in map.values) {
- if (v == value) {
- return true;
- }
- }
- return false;
- }
-
- static bool containsKey(Map map, Object key) {
- for (final k in map.keys) {
- if (k == key) {
- return true;
- }
- }
- return false;
- }
-
- static putIfAbsent(Map map, key, ifAbsent()) {
- if (map.containsKey(key)) {
- return map[key];
- }
- final v = ifAbsent();
- map[key] = v;
- return v;
- }
-
- static clear(Map map) {
- for (final k in map.keys.toList()) {
- map.remove(k);
- }
- }
-
- static forEach(Map map, void f(key, value)) {
- for (final k in map.keys) {
- f(k, map[k]);
- }
- }
-
- static Iterable getValues(Map map) {
- return map.keys.map((key) => map[key]);
- }
-
- static int length(Map map) => map.keys.length;
-
- static bool isEmpty(Map map) => map.keys.isEmpty;
-
- static bool isNotEmpty(Map map) => map.keys.isNotEmpty;
-
- /**
- * Returns a string representing the specified map. The returned string
- * looks like this: [:'{key0: value0, key1: value1, ... keyN: valueN}':].
- * The value returned by its [toString] method is used to represent each
- * key or value.
- *
- * If the map collection contains a reference to itself, either
- * directly as a key or value, or indirectly through other collections
- * or maps, the contained reference is rendered as [:'{...}':]. This
- * prevents the infinite regress that would otherwise occur. So, for example,
- * calling this method on a map whose sole entry maps the string key 'me'
- * to a reference to the map would return [:'{me: {...}}':].
- *
- * A typical implementation of a map's [toString] method will
- * simply return the results of this method applied to the collection.
- */
- static String mapToString(Map m) {
- // Reuse the list in IterableBase for detecting toString cycles.
- if (_isToStringVisiting(m)) { return '{...}'; }
-
- var result = new StringBuffer();
- try {
- _toStringVisiting.add(m);
- result.write('{');
- bool first = true;
- m.forEach((k, v) {
- if(!first) {
- result.write(', ');
- }
- first = false;
- result.write(k);
- result.write(': ');
- result.write(v);
- });
- result.write('}');
- } finally {
- assert(identical(_toStringVisiting.last, m));
- _toStringVisiting.removeLast();
- }
-
- return result.toString();
- }
-
- static _id(x) => x;
-
- /**
- * Fills a map with key/value pairs computed from [iterable].
- *
- * This method is used by Map classes in the named constructor fromIterable.
- */
- static void _fillMapWithMappedIterable(Map map, Iterable iterable,
- key(element), value(element)) {
- if (key == null) key = _id;
- if (value == null) value = _id;
-
- for (var element in iterable) {
- map[key(element)] = value(element);
- }
- }
-
- /**
- * Fills a map by associating the [keys] to [values].
- *
- * This method is used by Map classes in the named constructor fromIterables.
- */
- static void _fillMapWithIterables(Map map, Iterable keys,
- Iterable values) {
- Iterator keyIterator = keys.iterator;
- Iterator valueIterator = values.iterator;
-
- bool hasNextKey = keyIterator.moveNext();
- bool hasNextValue = valueIterator.moveNext();
-
- while (hasNextKey && hasNextValue) {
- map[keyIterator.current] = valueIterator.current;
- hasNextKey = keyIterator.moveNext();
- hasNextValue = valueIterator.moveNext();
- }
-
- if (hasNextKey || hasNextValue) {
- throw new ArgumentError("Iterables do not have same length.");
- }
- }
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/collection/queue.dart b/pkg/dev_compiler/tool/input_sdk/lib/collection/queue.dart
deleted file mode 100644
index db7160d..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/collection/queue.dart
+++ /dev/null
@@ -1,842 +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.
-
-part of dart.collection;
-
-/**
- * A [Queue] is a collection that can be manipulated at both ends. One
- * can iterate over the elements of a queue through [forEach] or with
- * an [Iterator].
- *
- * It is generally not allowed to modify the queue (add or remove entries) while
- * an operation on the queue is being performed, for example during a call to
- * [forEach].
- * Modifying the queue while it is being iterated will most likely break the
- * iteration.
- * This goes both for using the [iterator] directly, or for iterating an
- * `Iterable` returned by a method like [map] or [where].
- */
-abstract class Queue<E> implements Iterable<E>, EfficientLength {
-
- /**
- * Creates a queue.
- */
- factory Queue() = ListQueue<E>;
-
- /**
- * Creates a queue containing all [elements].
- *
- * The element order in the queue is as if the elements were added using
- * [addLast] in the order provided by [elements.iterator].
- */
- factory Queue.from(Iterable elements) = ListQueue<E>.from;
-
- /**
- * Removes and returns the first element of this queue.
- *
- * The queue must not be empty when this method is called.
- */
- E removeFirst();
-
- /**
- * Removes and returns the last element of the queue.
- *
- * The queue must not be empty when this method is called.
- */
- E removeLast();
-
- /**
- * Adds [value] at the beginning of the queue.
- */
- void addFirst(E value);
-
- /**
- * Adds [value] at the end of the queue.
- */
- void addLast(E value);
-
- /**
- * Adds [value] at the end of the queue.
- */
- void add(E value);
-
- /**
- * Remove a single instance of [value] from the queue.
- *
- * Returns `true` if a value was removed, or `false` if the queue
- * contained no element equal to [value].
- */
- bool remove(Object value);
-
- /**
- * Adds all elements of [iterable] at the end of the queue. The
- * length of the queue is extended by the length of [iterable].
- */
- void addAll(Iterable<E> iterable);
-
- /**
- * Removes all elements matched by [test] from the queue.
- *
- * The `test` function must not throw or modify the queue.
- */
- void removeWhere(bool test(E element));
-
- /**
- * Removes all elements not matched by [test] from the queue.
- *
- * The `test` function must not throw or modify the queue.
- */
- void retainWhere(bool test(E element));
-
- /**
- * Removes all elements in the queue. The size of the queue becomes zero.
- */
- void clear();
-}
-
-
-class _DoubleLink<E extends _DoubleLink> {
- E _previousLink;
- E _nextLink;
-
- void _link(E previous, E next) {
- _nextLink = next;
- _previousLink = previous;
- if (previous != null) previous._nextLink = this;
- if (next != null) next._previousLink = this;
- }
-
- void _unlink() {
- if (_previousLink != null) _previousLink._nextLink = _nextLink;
- if (_nextLink != null) _nextLink._previousLink = _previousLink;
- _nextLink = null;
- _previousLink = null;
- }
-}
-
-/**
- * An entry in a doubly linked list. It contains a pointer to the next
- * entry, the previous entry, and the boxed element.
- */
-abstract class DoubleLinkedQueueEntry<E> {
- factory DoubleLinkedQueueEntry(E element) = _UserDoubleLinkedQueueEntry<E>;
-
- /// The element in the queue.
- E get element;
-
- /// Appends the given [e] as entry just after this entry.
- void append(E e);
-
- /// Prepends the given [e] as entry just before this entry.
- void prepend(E e);
-
- /// Returns the previous entry or `null` if there is none.
- DoubleLinkedQueueEntry<E> previousEntry();
-
- /// Returns the next entry or `null` if there is none.
- DoubleLinkedQueueEntry<E> nextEntry();
-}
-
-/// Default implementation of a doubly linked queue entry.
-///
-/// This implementation is only used if a user instantiates a
-/// [DoubleLinkedQueueEntry] directly. The internal implementations don't use
-/// this class.
-class _UserDoubleLinkedQueueEntry<E>
- extends _DoubleLink<_UserDoubleLinkedQueueEntry<E>>
- implements DoubleLinkedQueueEntry<E> {
- E element;
-
- _UserDoubleLinkedQueueEntry(this.element);
-
- void append(E e) {
- new _UserDoubleLinkedQueueEntry<E>(e)._link(this, _nextLink);
- }
-
- void prepend(E e) {
- new _UserDoubleLinkedQueueEntry<E>(e)._link(_previousLink, this);
- }
-
- E remove() {
- _unlink();
- return element;
- }
-
- DoubleLinkedQueueEntry<E> previousEntry() => _previousLink;
-
- DoubleLinkedQueueEntry<E> nextEntry() => _nextLink;
-}
-
-/**
- * Interface for the link classes used by [DoubleLinkedQueue].
- *
- * Both the [_DoubleLinkedQueueElement] and [_DoubleLinkedQueueSentinel]
- * implement this interface.
- * The entry contains a link back to the queue, so calling `append`
- * or `prepend` can correctly update the element count.
- */
-abstract class _DoubleLinkedQueueEntry<E>
- extends _DoubleLink<_DoubleLinkedQueueEntry<E>> {
- DoubleLinkedQueue<E> _queue;
- _DoubleLinkedQueueEntry(this._queue);
-
- DoubleLinkedQueueEntry<E> _asNonSentinelEntry();
-
- void _append(E e) {
- new _DoubleLinkedQueueElement<E>(e, _queue)._link(this, _nextLink);
- }
-
- void _prepend(E e) {
- new _DoubleLinkedQueueElement<E>(e, _queue)._link(_previousLink, this);
- }
-
- E _remove();
-
- E get element;
-
- DoubleLinkedQueueEntry<E> nextEntry() {
- return _nextLink._asNonSentinelEntry();
- }
-
- DoubleLinkedQueueEntry<E> previousEntry() {
- return _previousLink._asNonSentinelEntry();
- }
-}
-
-/**
- * The actual entry type used by the [DoubleLinkedQueue].
- *
- * The entry contains a reference to the queue, allowing
- * [append]/[prepend] to update the list length.
- */
-class _DoubleLinkedQueueElement<E> extends _DoubleLinkedQueueEntry<E>
- implements DoubleLinkedQueueEntry<E> {
- E element;
- _DoubleLinkedQueueElement(this.element, DoubleLinkedQueue<E> queue)
- : super(queue);
-
- void append(E e) {
- _append(e);
- if (_queue != null) _queue._elementCount++;
- }
-
- void prepend(E e) {
- _prepend(e);
- if (_queue != null) _queue._elementCount++;
- }
-
- E _remove() {
- _queue = null;
- _unlink();
- return element;
- }
-
- E remove() {
- if (_queue != null) _queue._elementCount--;
- return _remove();
- }
-
- _DoubleLinkedQueueElement<E> _asNonSentinelEntry() {
- return this;
- }
-}
-
-/**
- * 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 _DoubleLinkedQueueSentinel<E> extends _DoubleLinkedQueueEntry<E> {
- _DoubleLinkedQueueSentinel(DoubleLinkedQueue<E> queue) : super(queue) {
- _previousLink = this;
- _nextLink = this;
- }
-
- DoubleLinkedQueueEntry<E> _asNonSentinelEntry() {
- return null;
- }
-
- /** Hit by, e.g., [DoubleLinkedQueue.removeFirst] if the queue is empty. */
- E _remove() {
- throw IterableElementError.noElement();
- }
-
- /** Hit by, e.g., [DoubleLinkedQueue.first] if the queue is empty. */
- E get element {
- throw IterableElementError.noElement();
- }
-}
-
-/**
- * A [Queue] implementation based on a double-linked list.
- *
- * Allows constant time add, remove-at-ends and peek operations.
- */
-class DoubleLinkedQueue<E> extends Iterable<E> implements Queue<E> {
- _DoubleLinkedQueueSentinel<E> _sentinel;
- int _elementCount = 0;
-
- DoubleLinkedQueue() {
- _sentinel = new _DoubleLinkedQueueSentinel<E>(this);
- }
-
- /**
- * Creates a double-linked queue containing all [elements].
- *
- * The element order in the queue is as if the elements were added using
- * [addLast] in the order provided by [elements.iterator].
- */
- factory DoubleLinkedQueue.from(Iterable elements) {
- Queue<E> list = new DoubleLinkedQueue<E>();
- for (final e in elements) {
- E element = e as Object/*=E*/;
- list.addLast(element);
- }
- return list;
- }
-
- int get length => _elementCount;
-
- void addLast(E value) {
- _sentinel._prepend(value);
- _elementCount++;
- }
-
- void addFirst(E value) {
- _sentinel._append(value);
- _elementCount++;
- }
-
- void add(E value) {
- _sentinel._prepend(value);
- _elementCount++;
- }
-
- void addAll(Iterable<E> iterable) {
- for (final E value in iterable) {
- _sentinel._prepend(value);
- _elementCount++;
- }
- }
-
- E removeLast() {
- _DoubleLinkedQueueEntry<E> lastEntry = _sentinel._previousLink;
- E result = lastEntry._remove();
- _elementCount--;
- return result;
- }
-
- E removeFirst() {
- _DoubleLinkedQueueEntry<E> firstEntry = _sentinel._nextLink;
- E result = firstEntry._remove();
- _elementCount--;
- return result;
- }
-
- bool remove(Object o) {
- _DoubleLinkedQueueEntry<E> entry = _sentinel._nextLink;
- while (!identical(entry, _sentinel)) {
- if (entry.element == o) {
- entry._remove();
- _elementCount--;
- return true;
- }
- entry = entry._nextLink;
- }
- return false;
- }
-
- void _filter(bool test(E element), bool removeMatching) {
- _DoubleLinkedQueueEntry<E> entry = _sentinel._nextLink;
- while (!identical(entry, _sentinel)) {
- _DoubleLinkedQueueEntry<E> next = entry._nextLink;
- if (identical(removeMatching, test(entry.element))) {
- entry._remove();
- _elementCount--;
- }
- entry = next;
- }
- }
-
- void removeWhere(bool test(E element)) {
- _filter(test, true);
- }
-
- void retainWhere(bool test(E element)) {
- _filter(test, false);
- }
-
- E get first {
- _DoubleLinkedQueueEntry<E> firstEntry = _sentinel._nextLink;
- return firstEntry.element;
- }
-
- E get last {
- _DoubleLinkedQueueEntry<E> lastEntry = _sentinel._previousLink;
- return lastEntry.element;
- }
-
- E get single {
- // Note that this throws correctly if the queue is empty
- // because reading element on the sentinel throws.
- if (identical(_sentinel._nextLink, _sentinel._previousLink)) {
- _DoubleLinkedQueueEntry<E> entry = _sentinel._nextLink;
- return entry.element;
- }
- throw IterableElementError.tooMany();
- }
-
- DoubleLinkedQueueEntry<E> lastEntry() {
- return _sentinel.previousEntry();
- }
-
- DoubleLinkedQueueEntry<E> firstEntry() {
- return _sentinel.nextEntry();
- }
-
- bool get isEmpty {
- return (identical(_sentinel._nextLink, _sentinel));
- }
-
- void clear() {
- _sentinel._nextLink = _sentinel;
- _sentinel._previousLink = _sentinel;
- _elementCount = 0;
- }
-
- void forEachEntry(void f(DoubleLinkedQueueEntry<E> element)) {
- _DoubleLinkedQueueEntry<E> entry = _sentinel._nextLink;
- while (!identical(entry, _sentinel)) {
- _DoubleLinkedQueueEntry<E> nextEntry = entry._nextLink;
- _DoubleLinkedQueueElement<E> element = entry;
- f(element);
- entry = nextEntry;
- }
- }
-
- _DoubleLinkedQueueIterator<E> get iterator {
- return new _DoubleLinkedQueueIterator<E>(_sentinel);
- }
-
- String toString() => IterableBase.iterableToFullString(this, '{', '}');
-}
-
-class _DoubleLinkedQueueIterator<E> implements Iterator<E> {
- _DoubleLinkedQueueSentinel<E> _sentinel;
- _DoubleLinkedQueueEntry<E> _nextEntry = null;
- E _current;
-
- _DoubleLinkedQueueIterator(_DoubleLinkedQueueSentinel<E> sentinel)
- : _sentinel = sentinel,
- _nextEntry = sentinel._nextLink;
-
- bool moveNext() {
- if (identical(_nextEntry, _sentinel)) {
- _current = null;
- _nextEntry = null;
- _sentinel = null;
- return false;
- }
- _DoubleLinkedQueueElement<E> elementEntry = _nextEntry;
- if (elementEntry._queue == null) {
- throw new ConcurrentModificationError(_sentinel._queue);
- }
- _current = elementEntry.element;
- _nextEntry = elementEntry._nextLink;
- return true;
- }
-
- E get current => _current;
-}
-
-/**
- * List based [Queue].
- *
- * Keeps a cyclic buffer of elements, and grows to a larger buffer when
- * it fills up. This guarantees constant time peek and remove operations, and
- * amortized constant time add operations.
- *
- * The structure is efficient for any queue or stack usage.
- */
-class ListQueue<E> extends Iterable<E> implements Queue<E> {
- static const int _INITIAL_CAPACITY = 8;
- List<E> _table;
- int _head;
- int _tail;
- int _modificationCount = 0;
-
- /**
- * Create an empty queue.
- *
- * If [initialCapacity] is given, prepare the queue for at least that many
- * elements.
- */
- ListQueue([int initialCapacity]) : _head = 0, _tail = 0 {
- if (initialCapacity == null || initialCapacity < _INITIAL_CAPACITY) {
- initialCapacity = _INITIAL_CAPACITY;
- } else if (!_isPowerOf2(initialCapacity)) {
- initialCapacity = _nextPowerOf2(initialCapacity);
- }
- assert(_isPowerOf2(initialCapacity));
- _table = new List<E>(initialCapacity);
- }
-
- /**
- * Create a `ListQueue` containing all [elements].
- *
- * The elements are added to the queue, as by [addLast], in the order given by
- * `elements.iterator`.
- *
- * All `elements` should be assignable to [E].
- */
- factory ListQueue.from(Iterable elements) {
- if (elements is List) {
- int length = elements.length;
- ListQueue<E> queue = new ListQueue(length + 1);
- assert(queue._table.length > length);
- for (int i = 0; i < length; i++) {
- queue._table[i] = elements[i] as Object/*=E*/;
- }
- queue._tail = length;
- return queue;
- } else {
- int capacity = _INITIAL_CAPACITY;
- if (elements is EfficientLength) {
- capacity = elements.length;
- }
- ListQueue<E> result = new ListQueue<E>(capacity);
- for (final element in elements) {
- result.addLast(element as Object/*=E*/);
- }
- return result;
- }
- }
-
- // Iterable interface.
-
- Iterator<E> get iterator => new _ListQueueIterator<E>(this);
-
- void forEach(void action (E element)) {
- int modificationCount = _modificationCount;
- for (int i = _head; i != _tail; i = (i + 1) & (_table.length - 1)) {
- action(_table[i]);
- _checkModification(modificationCount);
- }
- }
-
- bool get isEmpty => _head == _tail;
-
- int get length => (_tail - _head) & (_table.length - 1);
-
- E get first {
- if (_head == _tail) throw IterableElementError.noElement();
- return _table[_head];
- }
-
- E get last {
- if (_head == _tail) throw IterableElementError.noElement();
- return _table[(_tail - 1) & (_table.length - 1)];
- }
-
- E get single {
- if (_head == _tail) throw IterableElementError.noElement();
- if (length > 1) throw IterableElementError.tooMany();
- return _table[_head];
- }
-
- E elementAt(int index) {
- RangeError.checkValidIndex(index, this);
- return _table[(_head + index) & (_table.length - 1)];
- }
-
- List<E> toList({ bool growable: true }) {
- List<E> list;
- if (growable) {
- list = new List<E>()..length = length;
- } else {
- list = new List<E>(length);
- }
- _writeToList(list);
- return list;
- }
-
- // Collection interface.
-
- void add(E value) {
- _add(value);
- }
-
- void addAll(Iterable<E> elements) {
- if (elements is List/*<E>*/) {
- List<E> list = elements;
- int addCount = list.length;
- int length = this.length;
- if (length + addCount >= _table.length) {
- _preGrow(length + addCount);
- // After preGrow, all elements are at the start of the list.
- _table.setRange(length, length + addCount, list, 0);
- _tail += addCount;
- } else {
- // Adding addCount elements won't reach _head.
- int endSpace = _table.length - _tail;
- if (addCount < endSpace) {
- _table.setRange(_tail, _tail + addCount, list, 0);
- _tail += addCount;
- } else {
- int preSpace = addCount - endSpace;
- _table.setRange(_tail, _tail + endSpace, list, 0);
- _table.setRange(0, preSpace, list, endSpace);
- _tail = preSpace;
- }
- }
- _modificationCount++;
- } else {
- for (E element in elements) _add(element);
- }
- }
-
- bool remove(Object value) {
- for (int i = _head; i != _tail; i = (i + 1) & (_table.length - 1)) {
- E element = _table[i];
- if (element == value) {
- _remove(i);
- _modificationCount++;
- return true;
- }
- }
- return false;
- }
-
- void _filterWhere(bool test(E element), bool removeMatching) {
- int modificationCount = _modificationCount;
- int i = _head;
- while (i != _tail) {
- E element = _table[i];
- bool remove = identical(removeMatching, test(element));
- _checkModification(modificationCount);
- if (remove) {
- i = _remove(i);
- modificationCount = ++_modificationCount;
- } else {
- i = (i + 1) & (_table.length - 1);
- }
- }
- }
-
- /**
- * Remove all elements matched by [test].
- *
- * This method is inefficient since it works by repeatedly removing single
- * elements, each of which can take linear time.
- */
- void removeWhere(bool test(E element)) {
- _filterWhere(test, true);
- }
-
- /**
- * Remove all elements not matched by [test].
- *
- * This method is inefficient since it works by repeatedly removing single
- * elements, each of which can take linear time.
- */
- void retainWhere(bool test(E element)) {
- _filterWhere(test, false);
- }
-
- void clear() {
- if (_head != _tail) {
- for (int i = _head; i != _tail; i = (i + 1) & (_table.length - 1)) {
- _table[i] = null;
- }
- _head = _tail = 0;
- _modificationCount++;
- }
- }
-
- String toString() => IterableBase.iterableToFullString(this, "{", "}");
-
- // Queue interface.
-
- void addLast(E value) { _add(value); }
-
- void addFirst(E value) {
- _head = (_head - 1) & (_table.length - 1);
- _table[_head] = value;
- if (_head == _tail) _grow();
- _modificationCount++;
- }
-
- E removeFirst() {
- if (_head == _tail) throw IterableElementError.noElement();
- _modificationCount++;
- E result = _table[_head];
- _table[_head] = null;
- _head = (_head + 1) & (_table.length - 1);
- return result;
- }
-
- E removeLast() {
- if (_head == _tail) throw IterableElementError.noElement();
- _modificationCount++;
- _tail = (_tail - 1) & (_table.length - 1);
- E result = _table[_tail];
- _table[_tail] = null;
- return result;
- }
-
- // Internal helper functions.
-
- /**
- * Whether [number] is a power of two.
- *
- * Only works for positive numbers.
- */
- static bool _isPowerOf2(int number) => (number & (number - 1)) == 0;
-
- /**
- * Rounds [number] up to the nearest power of 2.
- *
- * If [number] is a power of 2 already, it is returned.
- *
- * Only works for positive numbers.
- */
- static int _nextPowerOf2(int number) {
- assert(number > 0);
- number = (number << 1) - 1;
- for(;;) {
- int nextNumber = number & (number - 1);
- if (nextNumber == 0) return number;
- number = nextNumber;
- }
- }
-
- /** Check if the queue has been modified during iteration. */
- void _checkModification(int expectedModificationCount) {
- if (expectedModificationCount != _modificationCount) {
- throw new ConcurrentModificationError(this);
- }
- }
-
- /** Adds element at end of queue. Used by both [add] and [addAll]. */
- void _add(E element) {
- _table[_tail] = element;
- _tail = (_tail + 1) & (_table.length - 1);
- if (_head == _tail) _grow();
- _modificationCount++;
- }
-
- /**
- * Removes the element at [offset] into [_table].
- *
- * Removal is performed by linerarly moving elements either before or after
- * [offset] by one position.
- *
- * Returns the new offset of the following element. This may be the same
- * offset or the following offset depending on how elements are moved
- * to fill the hole.
- */
- int _remove(int offset) {
- int mask = _table.length - 1;
- int startDistance = (offset - _head) & mask;
- int endDistance = (_tail - offset) & mask;
- if (startDistance < endDistance) {
- // Closest to start.
- int i = offset;
- while (i != _head) {
- int prevOffset = (i - 1) & mask;
- _table[i] = _table[prevOffset];
- i = prevOffset;
- }
- _table[_head] = null;
- _head = (_head + 1) & mask;
- return (offset + 1) & mask;
- } else {
- _tail = (_tail - 1) & mask;
- int i = offset;
- while (i != _tail) {
- int nextOffset = (i + 1) & mask;
- _table[i] = _table[nextOffset];
- i = nextOffset;
- }
- _table[_tail] = null;
- return offset;
- }
- }
-
- /**
- * Grow the table when full.
- */
- void _grow() {
- List<E> newTable = new List<E>(_table.length * 2);
- int split = _table.length - _head;
- newTable.setRange(0, split, _table, _head);
- newTable.setRange(split, split + _head, _table, 0);
- _head = 0;
- _tail = _table.length;
- _table = newTable;
- }
-
- int _writeToList(List<E> target) {
- assert(target.length >= length);
- if (_head <= _tail) {
- int length = _tail - _head;
- target.setRange(0, length, _table, _head);
- return length;
- } else {
- int firstPartSize = _table.length - _head;
- target.setRange(0, firstPartSize, _table, _head);
- target.setRange(firstPartSize, firstPartSize + _tail, _table, 0);
- return _tail + firstPartSize;
- }
- }
-
- /** Grows the table even if it is not full. */
- void _preGrow(int newElementCount) {
- assert(newElementCount >= length);
-
- // Add some extra room to ensure that there's room for more elements after
- // expansion.
- newElementCount += newElementCount >> 1;
- int newCapacity = _nextPowerOf2(newElementCount);
- List<E> newTable = new List<E>(newCapacity);
- _tail = _writeToList(newTable);
- _table = newTable;
- _head = 0;
- }
-}
-
-/**
- * Iterator for a [ListQueue].
- *
- * Considers any add or remove operation a concurrent modification.
- */
-class _ListQueueIterator<E> implements Iterator<E> {
- final ListQueue<E> _queue;
- final int _end;
- final int _modificationCount;
- int _position;
- E _current;
-
- _ListQueueIterator(ListQueue<E> queue)
- : _queue = queue,
- _end = queue._tail,
- _modificationCount = queue._modificationCount,
- _position = queue._head;
-
- E get current => _current;
-
- bool moveNext() {
- _queue._checkModification(_modificationCount);
- if (_position == _end) {
- _current = null;
- return false;
- }
- _current = _queue._table[_position];
- _position = (_position + 1) & (_queue._table.length - 1);
- return true;
- }
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/collection/set.dart b/pkg/dev_compiler/tool/input_sdk/lib/collection/set.dart
deleted file mode 100644
index 499225d..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/collection/set.dart
+++ /dev/null
@@ -1,311 +0,0 @@
-// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-/**
- * Base implementations of [Set].
- */
-part of dart.collection;
-
-/**
- * Mixin implementation of [Set].
- *
- * This class provides a base implementation of a `Set` that depends only
- * on the abstract members: [add], [contains], [lookup], [remove],
- * [iterator], [length] and [toSet].
- *
- * Some of the methods assume that `toSet` creates a modifiable set.
- * If using this mixin for an unmodifiable set,
- * where `toSet` should return an unmodifiable set,
- * it's necessary to reimplement
- * [retainAll], [union], [intersection] and [difference].
- *
- * Implementations of `Set` using this mixin should consider also implementing
- * `clear` in constant time. The default implementation works by removing every
- * element.
- */
-abstract class SetMixin<E> implements Set<E> {
- // This class reimplements all of [IterableMixin].
- // If/when Dart mixins get more powerful, we should just create a single
- // Mixin class from IterableMixin and the new methods of thisclass.
-
- bool add(E element);
-
- bool contains(Object element);
-
- E lookup(Object element);
-
- bool remove(Object element);
-
- Iterator<E> get iterator;
-
- Set<E> toSet();
-
- int get length;
-
- bool get isEmpty => length == 0;
-
- bool get isNotEmpty => length != 0;
-
- void clear() {
- removeAll(toList());
- }
-
- void addAll(Iterable<E> elements) {
- for (E element in elements) add(element);
- }
-
- void removeAll(Iterable<Object> elements) {
- for (Object element in elements) remove(element);
- }
-
- void retainAll(Iterable<Object> elements) {
- // Create a copy of the set, remove all of elements from the copy,
- // then remove all remaining elements in copy from this.
- Set<E> toRemove = toSet();
- for (Object o in elements) {
- toRemove.remove(o);
- }
- removeAll(toRemove);
- }
-
- void removeWhere(bool test(E element)) {
- List toRemove = [];
- for (E element in this) {
- if (test(element)) toRemove.add(element);
- }
- removeAll(toRemove);
- }
-
- void retainWhere(bool test(E element)) {
- List toRemove = [];
- for (E element in this) {
- if (!test(element)) toRemove.add(element);
- }
- removeAll(toRemove);
- }
-
- bool containsAll(Iterable<Object> other) {
- for (Object o in other) {
- if (!contains(o)) return false;
- }
- return true;
- }
-
- Set<E> union(Set<E> other) {
- return toSet()..addAll(other);
- }
-
- Set<E> intersection(Set<Object> other) {
- Set<E> result = toSet();
- for (E element in this) {
- if (!other.contains(element)) result.remove(element);
- }
- return result;
- }
-
- Set<E> difference(Set<Object> other) {
- Set<E> result = toSet();
- for (E element in this) {
- if (other.contains(element)) result.remove(element);
- }
- return result;
- }
-
- List<E> toList({bool growable: true}) {
- List<E> result = growable ? (new List<E>()..length = length)
- : new List<E>(length);
- int i = 0;
- for (E element in this) result[i++] = element;
- return result;
- }
-
- Iterable/*<T>*/ map/*<T>*/(/*=T*/f(E element)) =>
- new EfficientLengthMappedIterable<E, dynamic/*=T*/>(this, f);
-
- E get single {
- if (length > 1) throw IterableElementError.tooMany();
- Iterator<E> it = iterator;
- if (!it.moveNext()) throw IterableElementError.noElement();
- E result = it.current;
- return result;
- }
-
- String toString() => IterableBase.iterableToFullString(this, '{', '}');
-
- // Copied from IterableMixin.
- // Should be inherited if we had multi-level mixins.
-
- Iterable<E> where(bool f(E element)) => new WhereIterable<E>(this, f);
-
- Iterable/*<T>*/ expand/*<T>*/(Iterable/*<T>*/ f(E element)) =>
- new ExpandIterable<E, dynamic/*=T*/>(this, f);
-
- void forEach(void f(E element)) {
- for (E element in this) f(element);
- }
-
- E reduce(E combine(E value, E element)) {
- Iterator<E> iterator = this.iterator;
- if (!iterator.moveNext()) {
- throw IterableElementError.noElement();
- }
- E value = iterator.current;
- while (iterator.moveNext()) {
- value = combine(value, iterator.current);
- }
- return value;
- }
-
- dynamic/*=T*/ fold/*<T>*/(var/*=T*/ initialValue,
- dynamic/*=T*/ combine(var/*=T*/ previousValue, E element)) {
- var value = initialValue;
- for (E element in this) value = combine(value, element);
- return value;
- }
-
- bool every(bool f(E element)) {
- for (E element in this) {
- if (!f(element)) return false;
- }
- return true;
- }
-
- String join([String separator = ""]) {
- Iterator<E> iterator = this.iterator;
- if (!iterator.moveNext()) return "";
- StringBuffer buffer = new StringBuffer();
- if (separator == null || separator == "") {
- do {
- buffer.write("${iterator.current}");
- } while (iterator.moveNext());
- } else {
- buffer.write("${iterator.current}");
- while (iterator.moveNext()) {
- buffer.write(separator);
- buffer.write("${iterator.current}");
- }
- }
- return buffer.toString();
- }
-
- bool any(bool test(E element)) {
- for (E element in this) {
- if (test(element)) return true;
- }
- return false;
- }
-
- Iterable<E> take(int n) {
- return new TakeIterable<E>(this, n);
- }
-
- Iterable<E> takeWhile(bool test(E value)) {
- return new TakeWhileIterable<E>(this, test);
- }
-
- Iterable<E> skip(int n) {
- return new SkipIterable<E>(this, n);
- }
-
- Iterable<E> skipWhile(bool test(E value)) {
- return new SkipWhileIterable<E>(this, test);
- }
-
- E get first {
- Iterator<E> it = iterator;
- if (!it.moveNext()) {
- throw IterableElementError.noElement();
- }
- return it.current;
- }
-
- E get last {
- Iterator<E> it = iterator;
- if (!it.moveNext()) {
- throw IterableElementError.noElement();
- }
- E result;
- do {
- result = it.current;
- } while(it.moveNext());
- return result;
- }
-
- E firstWhere(bool test(E value), { E orElse() }) {
- for (E element in this) {
- if (test(element)) return element;
- }
- if (orElse != null) return orElse();
- throw IterableElementError.noElement();
- }
-
- E lastWhere(bool test(E value), { E orElse() }) {
- E result = null;
- bool foundMatching = false;
- for (E element in this) {
- if (test(element)) {
- result = element;
- foundMatching = true;
- }
- }
- if (foundMatching) return result;
- if (orElse != null) return orElse();
- throw IterableElementError.noElement();
- }
-
- E singleWhere(bool test(E value)) {
- E result = null;
- bool foundMatching = false;
- for (E element in this) {
- if (test(element)) {
- if (foundMatching) {
- throw IterableElementError.tooMany();
- }
- result = element;
- foundMatching = true;
- }
- }
- if (foundMatching) return result;
- throw IterableElementError.noElement();
- }
-
- E elementAt(int index) {
- if (index is! int) throw new ArgumentError.notNull("index");
- RangeError.checkNotNegative(index, "index");
- int elementIndex = 0;
- for (E element in this) {
- if (index == elementIndex) return element;
- elementIndex++;
- }
- throw new RangeError.index(index, this, "index", null, elementIndex);
- }
-}
-
-/**
- * Base implementation of [Set].
- *
- * This class provides a base implementation of a `Set` that depends only
- * on the abstract members: [add], [contains], [lookup], [remove],
- * [iterator], [length] and [toSet].
- *
- * Some of the methods assume that `toSet` creates a modifiable set.
- * If using this base class for an unmodifiable set,
- * where `toSet` should return an unmodifiable set,
- * it's necessary to reimplement
- * [retainAll], [union], [intersection] and [difference].
- *
- * Implementations of `Set` using this base should consider also implementing
- * `clear` in constant time. The default implementation works by removing every
- * element.
- */
-abstract class SetBase<E> extends SetMixin<E> {
- /**
- * Convert a `Set` to a string as `{each, element, as, string}`.
- *
- * Handles circular references where converting one of the elements
- * to a string ends up converting [set] to a string again.
- */
- static String setToString(Set set) =>
- IterableBase.iterableToFullString(set, '{', '}');
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/collection/splay_tree.dart b/pkg/dev_compiler/tool/input_sdk/lib/collection/splay_tree.dart
deleted file mode 100644
index 72a2f52..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/collection/splay_tree.dart
+++ /dev/null
@@ -1,858 +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.
-
-part of dart.collection;
-
-typedef bool _Predicate<T>(T value);
-
-/**
- * A node in a splay tree. It holds the sorting key and the left
- * and right children in the tree.
- */
-class _SplayTreeNode<K> {
- final K key;
- _SplayTreeNode<K> left;
- _SplayTreeNode<K> right;
-
- _SplayTreeNode(K this.key);
-}
-
-/**
- * A node in a splay tree based map.
- *
- * A [_SplayTreeNode] that also contains a value
- */
-class _SplayTreeMapNode<K, V> extends _SplayTreeNode<K> {
- V value;
- _SplayTreeMapNode(K key, V this.value) : super(key);
-}
-
-/**
- * A splay tree is a self-balancing binary search tree.
- *
- * It has the additional property that recently accessed elements
- * are quick to access again.
- * It performs basic operations such as insertion, look-up and
- * removal, in O(log(n)) amortized time.
- */
-abstract class _SplayTree<K, Node extends _SplayTreeNode<K>> {
- // The root node of the splay tree. It will contain either the last
- // element inserted or the last element looked up.
- Node get _root;
- set _root(Node newValue);
-
- // The dummy node used when performing a splay on the tree. Reusing it
- // avoids allocating a node each time a splay is performed.
- Node get _dummy;
-
- // Number of elements in the splay tree.
- int _count = 0;
-
- /**
- * Counter incremented whenever the keys in the map changes.
- *
- * Used to detect concurrent modifications.
- */
- int _modificationCount = 0;
-
- /**
- * Counter incremented whenever the tree structure changes.
- *
- * Used to detect that an in-place traversal cannot use
- * cached information that relies on the tree structure.
- */
- int _splayCount = 0;
-
- /** The comparator that is used for this splay tree. */
- Comparator<K> get _comparator;
-
- /** The predicate to determine that a given object is a valid key. */
- _Predicate get _validKey;
-
- /** Comparison used to compare keys. */
- int _compare(K key1, K key2);
-
- /**
- * Perform the splay operation for the given key. Moves the node with
- * the given key to the top of the tree. If no node has the given
- * key, the last node on the search path is moved to the top of the
- * tree. This is the simplified top-down splaying algorithm from:
- * "Self-adjusting Binary Search Trees" by Sleator and Tarjan.
- *
- * Returns the result of comparing the new root of the tree to [key].
- * Returns -1 if the table is empty.
- */
- int _splay(K key) {
- if (_root == null) return -1;
-
- // The right child of the dummy node will hold
- // the L tree of the algorithm. The left child of the dummy node
- // will hold the R tree of the algorithm. Using a dummy node, left
- // and right will always be nodes and we avoid special cases.
- Node left = _dummy;
- Node right = _dummy;
- Node current = _root;
- int comp;
- while (true) {
- comp = _compare(current.key, key);
- if (comp > 0) {
- if (current.left == null) break;
- comp = _compare(current.left.key, key);
- if (comp > 0) {
- // Rotate right.
- _SplayTreeNode<K> tmp = current.left;
- current.left = tmp.right;
- tmp.right = current;
- current = tmp;
- if (current.left == null) break;
- }
- // Link right.
- right.left = current;
- right = current;
- current = current.left;
- } else if (comp < 0) {
- if (current.right == null) break;
- comp = _compare(current.right.key, key);
- if (comp < 0) {
- // Rotate left.
- Node tmp = current.right;
- current.right = tmp.left;
- tmp.left = current;
- current = tmp;
- if (current.right == null) break;
- }
- // Link left.
- left.right = current;
- left = current;
- current = current.right;
- } else {
- break;
- }
- }
- // Assemble.
- left.right = current.left;
- right.left = current.right;
- current.left = _dummy.right;
- current.right = _dummy.left;
- _root = current;
-
- _dummy.right = null;
- _dummy.left = null;
- _splayCount++;
- return comp;
- }
-
- // Emulates splaying with a key that is smaller than any in the subtree
- // anchored at [node].
- // and that node is returned. It should replace the reference to [node]
- // in any parent tree or root pointer.
- Node _splayMin(Node node) {
- Node current = node;
- while (current.left != null) {
- Node left = current.left;
- current.left = left.right;
- left.right = current;
- current = left;
- }
- return current;
- }
-
- // Emulates splaying with a key that is greater than any in the subtree
- // anchored at [node].
- // After this, the largest element in the tree is the root of the subtree,
- // and that node is returned. It should replace the reference to [node]
- // in any parent tree or root pointer.
- Node _splayMax(Node node) {
- Node current = node;
- while (current.right != null) {
- Node right = current.right;
- current.right = right.left;
- right.left = current;
- current = right;
- }
- return current;
- }
-
- Node _remove(K key) {
- if (_root == null) return null;
- int comp = _splay(key);
- if (comp != 0) return null;
- Node result = _root;
- _count--;
- // assert(_count >= 0);
- if (_root.left == null) {
- _root = _root.right;
- } else {
- Node right = _root.right;
- // Splay to make sure that the new root has an empty right child.
- _root = _splayMax(_root.left);
- // Insert the original right child as the right child of the new
- // root.
- _root.right = right;
- }
- _modificationCount++;
- return result;
- }
-
- /**
- * Adds a new root node with the given [key] or [value].
- *
- * The [comp] value is the result of comparing the existing root's key
- * with key.
- */
- void _addNewRoot(Node node, int comp) {
- _count++;
- _modificationCount++;
- if (_root == null) {
- _root = node;
- return;
- }
- // assert(_count >= 0);
- if (comp < 0) {
- node.left = _root;
- node.right = _root.right;
- _root.right = null;
- } else {
- node.right = _root;
- node.left = _root.left;
- _root.left = null;
- }
- _root = node;
- }
-
- Node get _first {
- if (_root == null) return null;
- _root = _splayMin(_root);
- return _root;
- }
-
- Node get _last {
- if (_root == null) return null;
- _root = _splayMax(_root);
- return _root;
- }
-
- void _clear() {
- _root = null;
- _count = 0;
- _modificationCount++;
- }
-}
-
-class _TypeTest<T> {
- bool test(v) => v is T;
-}
-
-/**
- * A [Map] of objects that can be ordered relative to each other.
- *
- * The map is based on a self-balancing binary tree. It allows most operations
- * in amortized logarithmic time.
- *
- * Keys of the map are compared using the `compare` function passed in
- * the constructor, both for ordering and for equality.
- * If the map contains only the key `a`, then `map.containsKey(b)`
- * will return `true` if and only if `compare(a, b) == 0`,
- * and the value of `a == b` is not even checked.
- * If the compare function is omitted, the objects are assumed to be
- * [Comparable], and are compared using their [Comparable.compareTo] method.
- * Non-comparable objects (including `null`) will not work as keys
- * in that case.
- *
- * To allow calling [operator[]], [remove] or [containsKey] with objects
- * that are not supported by the `compare` function, an extra `isValidKey`
- * predicate function can be supplied. This function is tested before
- * using the `compare` function on an argument value that may not be a [K]
- * value. If omitted, the `isValidKey` function defaults to testing if the
- * value is a [K].
- */
-class SplayTreeMap<K, V> extends _SplayTree<K, _SplayTreeMapNode<K, V>>
- implements Map<K, V> {
- _SplayTreeMapNode<K, V> _root;
- final _SplayTreeMapNode<K, V> _dummy =
- new _SplayTreeMapNode<K, V>(null, null);
-
- Comparator<K> _comparator;
- _Predicate _validKey;
-
- SplayTreeMap([int compare(K key1, K key2), bool isValidKey(potentialKey)])
- : _comparator = compare ?? Comparable.compare as Comparator<K>,
- _validKey = isValidKey ?? ((v) => v is K);
-
- /**
- * Creates a [SplayTreeMap] that contains all key/value pairs of [other].
- */
- factory SplayTreeMap.from(Map other,
- [int compare(K key1, K key2),
- bool isValidKey(potentialKey)]) {
- SplayTreeMap<K, V> result = new SplayTreeMap<K, V>(compare, isValidKey);
- other.forEach((k, v) { result[k as Object/*=K*/] = v as Object/*=V*/; });
- return result;
- }
-
- /**
- * Creates a [SplayTreeMap] where the keys and values are computed from the
- * [iterable].
- *
- * For each element of the [iterable] this constructor computes a key/value
- * pair, by applying [key] and [value] respectively.
- *
- * The keys of the key/value pairs do not need to be unique. The last
- * occurrence of a key will simply overwrite any previous value.
- *
- * If no functions are specified for [key] and [value] the default is to
- * use the iterable value itself.
- */
- factory SplayTreeMap.fromIterable(Iterable iterable,
- {K key(element),
- V value(element),
- int compare(K key1, K key2),
- bool isValidKey(potentialKey) }) {
- SplayTreeMap<K, V> map = new SplayTreeMap<K, V>(compare, isValidKey);
- Maps._fillMapWithMappedIterable(map, iterable, key, value);
- return map;
- }
-
- /**
- * Creates a [SplayTreeMap] associating the given [keys] to [values].
- *
- * This constructor iterates over [keys] and [values] and maps each element of
- * [keys] to the corresponding element of [values].
- *
- * If [keys] contains the same object multiple times, the last occurrence
- * overwrites the previous value.
- *
- * It is an error if the two [Iterable]s don't have the same length.
- */
- factory SplayTreeMap.fromIterables(Iterable<K> keys, Iterable<V> values,
- [int compare(K key1, K key2), bool isValidKey(potentialKey)]) {
- SplayTreeMap<K, V> map = new SplayTreeMap<K, V>(compare, isValidKey);
- Maps._fillMapWithIterables(map, keys, values);
- return map;
- }
-
- int _compare(K key1, K key2) => _comparator(key1, key2);
-
- SplayTreeMap._internal();
-
- V operator [](Object key) {
- if (!_validKey(key)) return null;
- if (_root != null) {
- int comp = _splay(key as dynamic/*=K*/);
- if (comp == 0) {
- return _root.value;
- }
- }
- return null;
- }
-
- V remove(Object key) {
- if (!_validKey(key)) return null;
- _SplayTreeMapNode<K, V> mapRoot = _remove(key as dynamic/*=K*/);
- if (mapRoot != null) return mapRoot.value;
- return null;
- }
-
- void operator []=(K key, V value) {
- if (key == null) throw new ArgumentError(key);
- // Splay on the key to move the last node on the search path for
- // the key to the root of the tree.
- int comp = _splay(key);
- if (comp == 0) {
- _root.value = value;
- return;
- }
- _addNewRoot(new _SplayTreeMapNode(key, value), comp);
- }
-
-
- V putIfAbsent(K key, V ifAbsent()) {
- if (key == null) throw new ArgumentError(key);
- int comp = _splay(key);
- if (comp == 0) {
- return _root.value;
- }
- int modificationCount = _modificationCount;
- int splayCount = _splayCount;
- V value = ifAbsent();
- if (modificationCount != _modificationCount) {
- throw new ConcurrentModificationError(this);
- }
- if (splayCount != _splayCount) {
- comp = _splay(key);
- // Key is still not there, otherwise _modificationCount would be changed.
- assert(comp != 0);
- }
- _addNewRoot(new _SplayTreeMapNode(key, value), comp);
- return value;
- }
-
- void addAll(Map<K, V> other) {
- other.forEach((K key, V value) { this[key] = value; });
- }
-
- bool get isEmpty {
- return (_root == null);
- }
-
- bool get isNotEmpty => !isEmpty;
-
- void forEach(void f(K key, V value)) {
- Iterator<_SplayTreeNode<K>> nodes =
- new _SplayTreeNodeIterator<K>(this);
- while (nodes.moveNext()) {
- _SplayTreeMapNode<K, V> node = nodes.current;
- f(node.key, node.value);
- }
- }
-
- int get length {
- return _count;
- }
-
- void clear() {
- _clear();
- }
-
- bool containsKey(Object key) {
- return _validKey(key) && _splay(key as dynamic/*=K*/) == 0;
- }
-
- bool containsValue(Object value) {
- bool found = false;
- int initialSplayCount = _splayCount;
- bool visit(_SplayTreeMapNode node) {
- while (node != null) {
- if (node.value == value) return true;
- if (initialSplayCount != _splayCount) {
- throw new ConcurrentModificationError(this);
- }
- if (node.right != null && visit(node.right)) return true;
- node = node.left;
- }
- return false;
- }
- return visit(_root);
- }
-
- Iterable<K> get keys => new _SplayTreeKeyIterable<K>(this);
-
- Iterable<V> get values => new _SplayTreeValueIterable<K, V>(this);
-
- String toString() {
- return Maps.mapToString(this);
- }
-
- /**
- * Get the first key in the map. Returns [:null:] if the map is empty.
- */
- K firstKey() {
- if (_root == null) return null;
- return _first.key;
- }
-
- /**
- * Get the last key in the map. Returns [:null:] if the map is empty.
- */
- K lastKey() {
- if (_root == null) return null;
- return _last.key;
- }
-
- /**
- * Get the last key in the map that is strictly smaller than [key]. Returns
- * [:null:] if no key was not found.
- */
- K lastKeyBefore(K key) {
- if (key == null) throw new ArgumentError(key);
- if (_root == null) return null;
- int comp = _splay(key);
- if (comp < 0) return _root.key;
- _SplayTreeNode<K> node = _root.left;
- if (node == null) return null;
- while (node.right != null) {
- node = node.right;
- }
- return node.key;
- }
-
- /**
- * Get the first key in the map that is strictly larger than [key]. Returns
- * [:null:] if no key was not found.
- */
- K firstKeyAfter(K key) {
- if (key == null) throw new ArgumentError(key);
- if (_root == null) return null;
- int comp = _splay(key);
- if (comp > 0) return _root.key;
- _SplayTreeNode<K> node = _root.right;
- if (node == null) return null;
- while (node.left != null) {
- node = node.left;
- }
- return node.key;
- }
-}
-
-abstract class _SplayTreeIterator<K, T> implements Iterator<T> {
- final _SplayTree<K, _SplayTreeNode<K>> _tree;
- /**
- * Worklist of nodes to visit.
- *
- * These nodes have been passed over on the way down in a
- * depth-first left-to-right traversal. Visiting each node,
- * and their right subtrees will visit the remainder of
- * the nodes of a full traversal.
- *
- * Only valid as long as the original tree isn't reordered.
- */
- final List<_SplayTreeNode<K>> _workList = <_SplayTreeNode<K>>[];
-
- /**
- * Original modification counter of [_tree].
- *
- * Incremented on [_tree] when a key is added or removed.
- * If it changes, iteration is aborted.
- *
- * Not final because some iterators may modify the tree knowingly,
- * and they update the modification count in that case.
- */
- int _modificationCount;
-
- /**
- * Count of splay operations on [_tree] when [_workList] was built.
- *
- * If the splay count on [_tree] increases, [_workList] becomes invalid.
- */
- int _splayCount;
-
- /** Current node. */
- _SplayTreeNode<K> _currentNode;
-
- _SplayTreeIterator(_SplayTree<K, _SplayTreeNode<K>> tree)
- : _tree = tree,
- _modificationCount = tree._modificationCount,
- _splayCount = tree._splayCount {
- _findLeftMostDescendent(tree._root);
- }
-
- _SplayTreeIterator.startAt(_SplayTree<K, _SplayTreeNode<K>> tree, K startKey)
- : _tree = tree,
- _modificationCount = tree._modificationCount {
- if (tree._root == null) return;
- int compare = tree._splay(startKey);
- _splayCount = tree._splayCount;
- if (compare < 0) {
- // Don't include the root, start at the next element after the root.
- _findLeftMostDescendent(tree._root.right);
- } else {
- _workList.add(tree._root);
- }
- }
-
- T get current {
- if (_currentNode == null) return null;
- return _getValue(_currentNode);
- }
-
- void _findLeftMostDescendent(_SplayTreeNode<K> node) {
- while (node != null) {
- _workList.add(node);
- node = node.left;
- }
- }
-
- /**
- * Called when the tree structure of the tree has changed.
- *
- * This can be caused by a splay operation.
- * If the key-set changes, iteration is aborted before getting
- * here, so we know that the keys are the same as before, it's
- * only the tree that has been reordered.
- */
- void _rebuildWorkList(_SplayTreeNode<K> currentNode) {
- assert(!_workList.isEmpty);
- _workList.clear();
- if (currentNode == null) {
- _findLeftMostDescendent(_tree._root);
- } else {
- _tree._splay(currentNode.key);
- _findLeftMostDescendent(_tree._root.right);
- assert(!_workList.isEmpty);
- }
- }
-
- bool moveNext() {
- if (_modificationCount != _tree._modificationCount) {
- throw new ConcurrentModificationError(_tree);
- }
- // Picks the next element in the worklist as current.
- // Updates the worklist with the left-most path of the current node's
- // right-hand child.
- // If the worklist is no longer valid (after a splay), it is rebuild
- // from scratch.
- if (_workList.isEmpty) {
- _currentNode = null;
- return false;
- }
- if (_tree._splayCount != _splayCount && _currentNode != null) {
- _rebuildWorkList(_currentNode);
- }
- _currentNode = _workList.removeLast();
- _findLeftMostDescendent(_currentNode.right);
- return true;
- }
-
- T _getValue(_SplayTreeNode<K> node);
-}
-
-class _SplayTreeKeyIterable<K> extends Iterable<K>
- implements EfficientLength {
- _SplayTree<K, _SplayTreeNode<K>> _tree;
- _SplayTreeKeyIterable(this._tree);
- int get length => _tree._count;
- bool get isEmpty => _tree._count == 0;
- Iterator<K> get iterator => new _SplayTreeKeyIterator<K>(_tree);
-
- Set<K> toSet() {
- SplayTreeSet<K> set =
- new SplayTreeSet<K>(_tree._comparator, _tree._validKey);
- set._count = _tree._count;
- set._root = set._copyNode(_tree._root);
- return set;
- }
-}
-
-class _SplayTreeValueIterable<K, V> extends Iterable<V>
- implements EfficientLength {
- SplayTreeMap<K, V> _map;
- _SplayTreeValueIterable(this._map);
- int get length => _map._count;
- bool get isEmpty => _map._count == 0;
- Iterator<V> get iterator => new _SplayTreeValueIterator<K, V>(_map);
-}
-
-class _SplayTreeKeyIterator<K> extends _SplayTreeIterator<K, K> {
- _SplayTreeKeyIterator(_SplayTree<K, _SplayTreeNode<K>> map): super(map);
- K _getValue(_SplayTreeNode<K> node) => node.key;
-}
-
-class _SplayTreeValueIterator<K, V> extends _SplayTreeIterator<K, V> {
- _SplayTreeValueIterator(SplayTreeMap<K, V> map): super(map);
- V _getValue(_SplayTreeNode<K> node) {
- _SplayTreeMapNode<K, V> mapNode =
- node as dynamic/*=_SplayTreeMapNode<K, V>*/;
- return mapNode.value;
- }
-}
-
-class _SplayTreeNodeIterator<K>
- extends _SplayTreeIterator<K, _SplayTreeNode<K>> {
- _SplayTreeNodeIterator(_SplayTree<K, _SplayTreeNode<K>> tree): super(tree);
- _SplayTreeNodeIterator.startAt(
- _SplayTree<K, _SplayTreeNode<K>> tree, K startKey)
- : super.startAt(tree, startKey);
- _SplayTreeNode<K> _getValue(_SplayTreeNode<K> node) => node;
-}
-
-
-/**
- * A [Set] of objects that can be ordered relative to each other.
- *
- * The set is based on a self-balancing binary tree. It allows most operations
- * in amortized logarithmic time.
- *
- * Elements of the set are compared using the `compare` function passed in
- * the constructor, both for ordering and for equality.
- * If the set contains only an object `a`, then `set.contains(b)`
- * will return `true` if and only if `compare(a, b) == 0`,
- * and the value of `a == b` is not even checked.
- * If the compare function is omitted, the objects are assumed to be
- * [Comparable], and are compared using their [Comparable.compareTo] method.
- * Non-comparable objects (including `null`) will not work as an element
- * in that case.
- */
-class SplayTreeSet<E> extends _SplayTree<E, _SplayTreeNode<E>>
- with IterableMixin<E>, SetMixin<E> {
- _SplayTreeNode<E> _root;
- final _SplayTreeNode<E> _dummy = new _SplayTreeNode<E>(null);
-
- Comparator<E> _comparator;
- _Predicate _validKey;
-
- /**
- * Create a new [SplayTreeSet] with the given compare function.
- *
- * If the [compare] function is omitted, it defaults to [Comparable.compare],
- * and the elements must be comparable.
- *
- * A provided `compare` function may not work on all objects. It may not even
- * work on all `E` instances.
- *
- * For operations that add elements to the set, the user is supposed to not
- * pass in objects that doesn't work with the compare function.
- *
- * The methods [contains], [remove], [lookup], [removeAll] or [retainAll]
- * are typed to accept any object(s), and the [isValidKey] test can used to
- * filter those objects before handing them to the `compare` function.
- *
- * If [isValidKey] is provided, only values satisfying `isValidKey(other)`
- * are compared using the `compare` method in the methods mentioned above.
- * If the `isValidKey` function returns false for an object, it is assumed to
- * not be in the set.
- *
- * If omitted, the `isValidKey` function defaults to checking against the
- * type parameter: `other is E`.
- */
- SplayTreeSet([int compare(E key1, E key2), bool isValidKey(potentialKey)])
- : _comparator =
- compare ?? Comparable.compare as dynamic/*=Comparator<E>*/,
- _validKey = isValidKey ?? ((v) => v is E);
-
- /**
- * Creates a [SplayTreeSet] that contains all [elements].
- *
- * The set works as if created by `new SplayTreeSet<E>(compare, isValidKey)`.
- *
- * All the [elements] should be valid as arguments to the [compare] function.
- */
- factory SplayTreeSet.from(Iterable elements,
- [int compare(E key1, E key2),
- bool isValidKey(potentialKey)]) {
- SplayTreeSet<E> result = new SplayTreeSet<E>(compare, isValidKey);
- for (final element in elements) {
- E e = element as Object/*=E*/;
- result.add(e);
- }
- return result;
- }
-
- int _compare(E e1, E e2) => _comparator(e1, e2);
-
- // From Iterable.
-
- Iterator<E> get iterator => new _SplayTreeKeyIterator<E>(this);
-
- int get length => _count;
- bool get isEmpty => _root == null;
- bool get isNotEmpty => _root != null;
-
- E get first {
- if (_count == 0) throw IterableElementError.noElement();
- return _first.key;
- }
-
- E get last {
- if (_count == 0) throw IterableElementError.noElement();
- return _last.key;
- }
-
- E get single {
- if (_count == 0) throw IterableElementError.noElement();
- if (_count > 1) throw IterableElementError.tooMany();
- return _root.key;
- }
-
- // From Set.
- bool contains(Object object) {
- return _validKey(object) && _splay(object as dynamic/*=E*/) == 0;
- }
-
- bool add(E element) {
- int compare = _splay(element);
- if (compare == 0) return false;
- _addNewRoot(new _SplayTreeNode(element), compare);
- return true;
- }
-
- bool remove(Object object) {
- if (!_validKey(object)) return false;
- return _remove(object as dynamic/*=E*/) != null;
- }
-
- void addAll(Iterable<E> elements) {
- for (E element in elements) {
- int compare = _splay(element);
- if (compare != 0) {
- _addNewRoot(new _SplayTreeNode(element), compare);
- }
- }
- }
-
- void removeAll(Iterable<Object> elements) {
- for (Object element in elements) {
- if (_validKey(element)) _remove(element as dynamic/*=E*/);
- }
- }
-
- void retainAll(Iterable<Object> elements) {
- // Build a set with the same sense of equality as this set.
- SplayTreeSet<E> retainSet = new SplayTreeSet<E>(_comparator, _validKey);
- int modificationCount = _modificationCount;
- for (Object object in elements) {
- if (modificationCount != _modificationCount) {
- // The iterator should not have side effects.
- throw new ConcurrentModificationError(this);
- }
- // Equivalent to this.contains(object).
- if (_validKey(object) && _splay(object as dynamic/*=E*/) == 0) {
- retainSet.add(_root.key);
- }
- }
- // Take over the elements from the retained set, if it differs.
- if (retainSet._count != _count) {
- _root = retainSet._root;
- _count = retainSet._count;
- _modificationCount++;
- }
- }
-
- E lookup(Object object) {
- if (!_validKey(object)) return null;
- int comp = _splay(object as dynamic/*=E*/);
- if (comp != 0) return null;
- return _root.key;
- }
-
- Set<E> intersection(Set<Object> other) {
- Set<E> result = new SplayTreeSet<E>(_comparator, _validKey);
- for (E element in this) {
- if (other.contains(element)) result.add(element);
- }
- return result;
- }
-
- Set<E> difference(Set<Object> other) {
- Set<E> result = new SplayTreeSet<E>(_comparator, _validKey);
- for (E element in this) {
- if (!other.contains(element)) result.add(element);
- }
- return result;
- }
-
- Set<E> union(Set<E> other) {
- return _clone()..addAll(other);
- }
-
- SplayTreeSet<E> _clone() {
- var set = new SplayTreeSet<E>(_comparator, _validKey);
- set._count = _count;
- set._root = _copyNode(_root);
- return set;
- }
-
- // Copies the structure of a SplayTree into a new similar structure.
- // Works on _SplayTreeMapNode as well, but only copies the keys,
- _SplayTreeNode<E> _copyNode(_SplayTreeNode<E> node) {
- if (node == null) return null;
- return new _SplayTreeNode<E>(node.key)..left = _copyNode(node.left)
- ..right = _copyNode(node.right);
- }
-
- void clear() { _clear(); }
-
- Set<E> toSet() => _clone();
-
- String toString() => IterableBase.iterableToFullString(this, '{', '}');
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/convert/ascii.dart b/pkg/dev_compiler/tool/input_sdk/lib/convert/ascii.dart
deleted file mode 100644
index a076210..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/convert/ascii.dart
+++ /dev/null
@@ -1,310 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-part of dart.convert;
-
-/**
- * An instance of the default implementation of the [AsciiCodec].
- *
- * This instance provides a convenient access to the most common ASCII
- * use cases.
- *
- * Examples:
- *
- * var encoded = ASCII.encode("This is ASCII!");
- * var decoded = ASCII.decode([0x54, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73,
- * 0x20, 0x41, 0x53, 0x43, 0x49, 0x49, 0x21]);
- */
-const AsciiCodec ASCII = const AsciiCodec();
-
-const int _ASCII_MASK = 0x7F;
-
-/**
- * An [AsciiCodec] allows encoding strings as ASCII bytes
- * and decoding ASCII bytes to strings.
- */
-class AsciiCodec extends Encoding {
- final bool _allowInvalid;
- /**
- * Instantiates a new [AsciiCodec].
- *
- * If [allowInvalid] is true, the [decode] method and the converter
- * returned by [decoder] will default to allowing invalid values.
- * If allowing invalid values, the values will be decoded into the Unicode
- * Replacement character (U+FFFD). If not, an exception will be thrown.
- * Calls to the [decode] method can choose to override this default.
- *
- * Encoders will not accept invalid (non Latin-1) characters.
- */
- const AsciiCodec({bool allowInvalid: false}) : _allowInvalid = allowInvalid;
-
- String get name => "us-ascii";
-
- /**
- * Decodes the ASCII [bytes] (a list of unsigned 7-bit integers) to the
- * corresponding string.
- *
- * If [bytes] contains values that are not in the range 0 .. 127, the decoder
- * will eventually throw a [FormatException].
- *
- * If [allowInvalid] is not provided, it defaults to the value used to create
- * this [AsciiCodec].
- */
- String decode(List<int> bytes, { bool allowInvalid }) {
- if (allowInvalid == null) allowInvalid = _allowInvalid;
- if (allowInvalid) {
- return const AsciiDecoder(allowInvalid: true).convert(bytes);
- } else {
- return const AsciiDecoder(allowInvalid: false).convert(bytes);
- }
- }
-
- AsciiEncoder get encoder => const AsciiEncoder();
-
- AsciiDecoder get decoder =>
- _allowInvalid ? const AsciiDecoder(allowInvalid: true)
- : const AsciiDecoder(allowInvalid: false);
-}
-
-// Superclass for [AsciiEncoder] and [Latin1Encoder].
-// Generalizes common operations that only differ by a mask;
-class _UnicodeSubsetEncoder extends Converter<String, List<int>> {
- final int _subsetMask;
-
- const _UnicodeSubsetEncoder(this._subsetMask);
-
- /**
- * Converts the [String] into a list of its code units.
- *
- * If [start] and [end] are provided, only the substring
- * `string.substring(start, end)` is used as input to the conversion.
- */
- List<int> convert(String string, [int start = 0, int end]) {
- int stringLength = string.length;
- RangeError.checkValidRange(start, end, stringLength);
- if (end == null) end = stringLength;
- int length = end - start;
- List<int> result = new Uint8List(length);
- for (int i = 0; i < length; i++) {
- var codeUnit = string.codeUnitAt(start + i);
- if ((codeUnit & ~_subsetMask) != 0) {
- throw new ArgumentError("String contains invalid characters.");
- }
- result[i] = codeUnit;
- }
- return result;
- }
-
- /**
- * Starts a chunked conversion.
- *
- * The converter works more efficiently if the given [sink] is a
- * [ByteConversionSink].
- */
- StringConversionSink startChunkedConversion(Sink<List<int>> sink) {
- if (sink is! ByteConversionSink) {
- sink = new ByteConversionSink.from(sink);
- }
- return new _UnicodeSubsetEncoderSink(_subsetMask, sink);
- }
-
- // Override the base-class' bind, to provide a better type.
- Stream<List<int>> bind(Stream<String> stream) => super.bind(stream);
-}
-
-/**
- * This class converts strings of only ASCII characters to bytes.
- */
-class AsciiEncoder extends _UnicodeSubsetEncoder {
- const AsciiEncoder() : super(_ASCII_MASK);
-}
-
-/**
- * This class encodes chunked strings to bytes (unsigned 8-bit
- * integers).
- */
-class _UnicodeSubsetEncoderSink extends StringConversionSinkBase {
- final ByteConversionSink _sink;
- final int _subsetMask;
-
- _UnicodeSubsetEncoderSink(this._subsetMask, this._sink);
-
- void close() {
- _sink.close();
- }
-
- void addSlice(String source, int start, int end, bool isLast) {
- RangeError.checkValidRange(start, end, source.length);
- for (int i = start; i < end; i++) {
- int codeUnit = source.codeUnitAt(i);
- if ((codeUnit & ~_subsetMask) != 0) {
- throw new ArgumentError(
- "Source contains invalid character with code point: $codeUnit.");
- }
- }
- _sink.add(source.codeUnits.sublist(start, end));
- if (isLast) {
- close();
- }
- }
-}
-
-/**
- * This class converts Latin-1 bytes (lists of unsigned 8-bit integers)
- * to a string.
- */
-abstract class _UnicodeSubsetDecoder extends Converter<List<int>, String> {
- final bool _allowInvalid;
- final int _subsetMask;
-
- /**
- * Instantiates a new decoder.
- *
- * The [_allowInvalid] argument defines how [convert] deals
- * with invalid bytes.
- *
- * The [_subsetMask] argument is a bit mask used to define the subset
- * of Unicode being decoded. Use [_LATIN1_MASK] for Latin-1 (8-bit) or
- * [_ASCII_MASK] for ASCII (7-bit).
- *
- * If [_allowInvalid] is `true`, [convert] replaces invalid bytes with the
- * Unicode Replacement character `U+FFFD` (�).
- * Otherwise it throws a [FormatException].
- */
- const _UnicodeSubsetDecoder(this._allowInvalid, this._subsetMask);
-
- /**
- * Converts the [bytes] (a list of unsigned 7- or 8-bit integers) to the
- * corresponding string.
- *
- * If [start] and [end] are provided, only the sub-list of bytes from
- * `start` to `end` (`end` not inclusive) is used as input to the conversion.
- */
- String convert(List<int> bytes, [int start = 0, int end]) {
- int byteCount = bytes.length;
- RangeError.checkValidRange(start, end, byteCount);
- if (end == null) end = byteCount;
-
- for (int i = start; i < end; i++) {
- int byte = bytes[i];
- if ((byte & ~_subsetMask) != 0) {
- if (!_allowInvalid) {
- throw new FormatException("Invalid value in input: $byte");
- }
- return _convertInvalid(bytes, start, end);
- }
- }
- return new String.fromCharCodes(bytes, start, end);
- }
-
- String _convertInvalid(List<int> bytes, int start, int end) {
- StringBuffer buffer = new StringBuffer();
- for (int i = start; i < end; i++) {
- int value = bytes[i];
- if ((value & ~_subsetMask) != 0) value = 0xFFFD;
- buffer.writeCharCode(value);
- }
- return buffer.toString();
- }
-
- /**
- * Starts a chunked conversion.
- *
- * The converter works more efficiently if the given [sink] is a
- * [StringConversionSink].
- */
- ByteConversionSink startChunkedConversion(Sink<String> sink);
-
- // Override the base-class's bind, to provide a better type.
- Stream<String> bind(Stream<List<int>> stream) => super.bind(stream);
-}
-
-class AsciiDecoder extends _UnicodeSubsetDecoder {
- const AsciiDecoder({bool allowInvalid: false})
- : super(allowInvalid, _ASCII_MASK);
-
- /**
- * Starts a chunked conversion.
- *
- * The converter works more efficiently if the given [sink] is a
- * [StringConversionSink].
- */
- ByteConversionSink startChunkedConversion(Sink<String> sink) {
- StringConversionSink stringSink;
- if (sink is StringConversionSink) {
- stringSink = sink;
- } else {
- stringSink = new StringConversionSink.from(sink);
- }
- // TODO(lrn): Use asUtf16Sink when it becomes available. It
- // works just as well, is likely to have less decoding overhead,
- // and make adding U+FFFD easier.
- // At that time, merge this with _Latin1DecoderSink;
- if (_allowInvalid) {
- return new _ErrorHandlingAsciiDecoderSink(stringSink.asUtf8Sink(false));
- } else {
- return new _SimpleAsciiDecoderSink(stringSink);
- }
- }
-}
-
-class _ErrorHandlingAsciiDecoderSink extends ByteConversionSinkBase {
- ByteConversionSink _utf8Sink;
- _ErrorHandlingAsciiDecoderSink(this._utf8Sink);
-
- void close() {
- _utf8Sink.close();
- }
-
- void add(List<int> source) {
- addSlice(source, 0, source.length, false);
- }
-
- void addSlice(List<int> source, int start, int end, bool isLast) {
- RangeError.checkValidRange(start, end, source.length);
- for (int i = start; i < end; i++) {
- if ((source[i] & ~_ASCII_MASK) != 0) {
- if (i > start) _utf8Sink.addSlice(source, start, i, false);
- // Add UTF-8 encoding of U+FFFD.
- _utf8Sink.add(const<int>[0xEF, 0xBF, 0xBD]);
- start = i + 1;
- }
- }
- if (start < end) {
- _utf8Sink.addSlice(source, start, end, isLast);
- } else if (isLast) {
- close();
- }
- }
-}
-
-class _SimpleAsciiDecoderSink extends ByteConversionSinkBase {
- Sink _sink;
- _SimpleAsciiDecoderSink(this._sink);
-
- void close() {
- _sink.close();
- }
-
- void add(List<int> source) {
- for (int i = 0; i < source.length; i++) {
- if ((source[i] & ~_ASCII_MASK) != 0) {
- throw new FormatException("Source contains non-ASCII bytes.");
- }
- }
- _sink.add(new String.fromCharCodes(source));
- }
-
- void addSlice(List<int> source, int start, int end, bool isLast) {
- final int length = source.length;
- RangeError.checkValidRange(start, end, length);
- if (start < end) {
- if (start != 0 || end != length) {
- source = source.sublist(start, end);
- }
- add(source);
- }
- if (isLast) close();
- }
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/convert/base64.dart b/pkg/dev_compiler/tool/input_sdk/lib/convert/base64.dart
deleted file mode 100644
index 3fe1357..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/convert/base64.dart
+++ /dev/null
@@ -1,750 +0,0 @@
-// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-part of dart.convert;
-
-/**
- * A [base64](https://tools.ietf.org/html/rfc4648) encoder and decoder.
- *
- * It encodes using the default base64 alphabet,
- * decodes using both the base64 and base64url alphabets,
- * does not allow invalid characters and requires padding.
- *
- * Examples:
- *
- * var encoded = BASE64.encode([0x62, 0x6c, 0xc3, 0xa5, 0x62, 0xc3, 0xa6,
- * 0x72, 0x67, 0x72, 0xc3, 0xb8, 0x64]);
- * var decoded = BASE64.decode("YmzDpWLDpnJncsO4ZAo=");
- */
-const Base64Codec BASE64 = const Base64Codec();
-
-/**
- * A [base64url](https://tools.ietf.org/html/rfc4648) encoder and decoder.
- *
- * It encodes and decodes using the base64url alphabet,
- * decodes using both the base64 and base64url alphabets,
- * does not allow invalid characters and requires padding.
- *
- * Examples:
- *
- * var encoded = BASE64URL.encode([0x62, 0x6c, 0xc3, 0xa5, 0x62, 0xc3, 0xa6,
- * 0x72, 0x67, 0x72, 0xc3, 0xb8, 0x64]);
- * var decoded = BASE64URL.decode("YmzDpWLDpnJncsO4ZAo=");
- */
-const Base64Codec BASE64URL = const Base64Codec.urlSafe();
-
-// Constants used in more than one class.
-const int _paddingChar = 0x3d; // '='.
-
-/**
- * A [base64](https://tools.ietf.org/html/rfc4648) encoder and decoder.
- *
- * A [Base64Codec] allows base64 encoding bytes into ASCII strings and
- * decoding valid encodings back to bytes.
- *
- * This implementation only handles the simplest RFC 4648 base64 and base64url
- * encodings.
- * It does not allow invalid characters when decoding and it requires,
- * and generates, padding so that the input is always a multiple of four
- * characters.
- */
-class Base64Codec extends Codec<List<int>, String> {
- final Base64Encoder _encoder;
- const Base64Codec() : _encoder = const Base64Encoder();
- const Base64Codec.urlSafe() : _encoder = const Base64Encoder.urlSafe();
-
- Base64Encoder get encoder => _encoder;
-
- Base64Decoder get decoder => const Base64Decoder();
-}
-
-// ------------------------------------------------------------------------
-// Encoder
-// ------------------------------------------------------------------------
-
-/**
- * Base64 and base64url encoding converter.
- *
- * Encodes lists of bytes using base64 or base64url encoding.
- *
- * The results are ASCII strings using a restricted alphabet.
- */
-class Base64Encoder extends Converter<List<int>, String> {
- final bool _urlSafe;
-
- const Base64Encoder() : _urlSafe = false;
- const Base64Encoder.urlSafe() : _urlSafe = true;
-
- String convert(List<int> input) {
- if (input.isEmpty) return "";
- var encoder = new _Base64Encoder(_urlSafe);
- Uint8List buffer = encoder.encode(input, 0, input.length, true);
- return new String.fromCharCodes(buffer);
- }
-
- ByteConversionSink startChunkedConversion(Sink<String> sink) {
- if (sink is StringConversionSink) {
- return new _Utf8Base64EncoderSink(sink.asUtf8Sink(false), _urlSafe);
- }
- return new _AsciiBase64EncoderSink(sink, _urlSafe);
- }
-}
-
-/**
- * Helper class for encoding bytes to base64.
- */
-class _Base64Encoder {
- /** The RFC 4648 base64 encoding alphabet. */
- static const String _base64Alphabet =
- "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
-
- /** The RFC 4648 base64url encoding alphabet. */
- static const String _base64urlAlphabet =
- "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
-
- /** Shift-count to extract the values stored in [_state]. */
- static const int _valueShift = 2;
-
- /** Mask to extract the count value stored in [_state]. */
- static const int _countMask = 3;
-
- static const int _sixBitMask = 0x3F;
-
- /**
- * Intermediate state between chunks.
- *
- * Encoding handles three bytes at a time.
- * If fewer than three bytes has been seen, this value encodes
- * the number of bytes seen (0, 1 or 2) and their values.
- */
- int _state = 0;
-
- /** Alphabet used for encoding. */
- final String _alphabet;
-
- _Base64Encoder(bool urlSafe)
- : _alphabet = urlSafe ? _base64urlAlphabet : _base64Alphabet;
-
- /** Encode count and bits into a value to be stored in [_state]. */
- static int _encodeState(int count, int bits) {
- assert(count <= _countMask);
- return bits << _valueShift | count;
- }
-
- /** Extract bits from encoded state. */
- static int _stateBits(int state) => state >> _valueShift;
-
- /** Extract count from encoded state. */
- static int _stateCount(int state) => state & _countMask;
-
- /**
- * Create a [Uint8List] with the provided length.
- */
- Uint8List createBuffer(int bufferLength) => new Uint8List(bufferLength);
-
- /**
- * Encode [bytes] from [start] to [end] and the bits in [_state].
- *
- * Returns a [Uint8List] of the ASCII codes of the encoded data.
- *
- * If the input, including left over [_state] from earlier encodings,
- * are not a multiple of three bytes, then the partial state is stored
- * back into [_state].
- * If [isLast] is true, partial state is encoded in the output instead,
- * with the necessary padding.
- *
- * Returns `null` if there is no output.
- */
- Uint8List encode(List<int> bytes, int start, int end, bool isLast) {
- assert(0 <= start);
- assert(start <= end);
- assert(bytes == null || end <= bytes.length);
- int length = end - start;
-
- int count = _stateCount(_state);
- int byteCount = (count + length);
- int fullChunks = byteCount ~/ 3;
- int partialChunkLength = byteCount - fullChunks * 3;
- int bufferLength = fullChunks * 4;
- if (isLast && partialChunkLength > 0) {
- bufferLength += 4; // Room for padding.
- }
- var output = createBuffer(bufferLength);
- _state = encodeChunk(_alphabet, bytes, start, end, isLast,
- output, 0, _state);
- if (bufferLength > 0) return output;
- // If the input plus the data in state is still less than three bytes,
- // there may not be any output.
- return null;
- }
-
- static int encodeChunk(String alphabet,
- List<int> bytes, int start, int end, bool isLast,
- Uint8List output, int outputIndex, int state) {
- int bits = _stateBits(state);
- // Count number of missing bytes in three-byte chunk.
- int expectedChars = 3 - _stateCount(state);
-
- // The input must be a list of bytes (integers in the range 0..255).
- // The value of `byteOr` will be the bitwise or of all the values in
- // `bytes` and a later check will validate that they were all valid bytes.
- int byteOr = 0;
- for (int i = start; i < end; i++) {
- int byte = bytes[i];
- byteOr |= byte;
- bits = ((bits << 8) | byte) & 0xFFFFFF; // Never store more than 24 bits.
- expectedChars--;
- if (expectedChars == 0) {
- output[outputIndex++] =
- alphabet.codeUnitAt((bits >> 18) & _sixBitMask);
- output[outputIndex++] =
- alphabet.codeUnitAt((bits >> 12) & _sixBitMask);
- output[outputIndex++] =
- alphabet.codeUnitAt((bits >> 6) & _sixBitMask);
- output[outputIndex++] =
- alphabet.codeUnitAt(bits & _sixBitMask);
- expectedChars = 3;
- bits = 0;
- }
- }
- if (byteOr >= 0 && byteOr <= 255) {
- if (isLast && expectedChars < 3) {
- writeFinalChunk(alphabet, output, outputIndex, 3 - expectedChars, bits);
- return 0;
- }
- return _encodeState(3 - expectedChars, bits);
- }
-
- // There was an invalid byte value somewhere in the input - find it!
- int i = start;
- while (i < end) {
- int byte = bytes[i];
- if (byte < 0 || byte > 255) break;
- i++;
- }
- throw new ArgumentError.value(bytes,
- "Not a byte value at index $i: 0x${bytes[i].toRadixString(16)}");
- }
-
- /**
- * Writes a final encoded four-character chunk.
- *
- * Only used when the [_state] contains a partial (1 or 2 byte)
- * input.
- */
- static void writeFinalChunk(String alphabet,
- Uint8List output, int outputIndex,
- int count, int bits) {
- assert(count > 0);
- if (count == 1) {
- output[outputIndex++] =
- alphabet.codeUnitAt((bits >> 2) & _sixBitMask);
- output[outputIndex++] =
- alphabet.codeUnitAt((bits << 4) & _sixBitMask);
- output[outputIndex++] = _paddingChar;
- output[outputIndex++] = _paddingChar;
- } else {
- assert(count == 2);
- output[outputIndex++] =
- alphabet.codeUnitAt((bits >> 10) & _sixBitMask);
- output[outputIndex++] =
- alphabet.codeUnitAt((bits >> 4) & _sixBitMask);
- output[outputIndex++] =
- alphabet.codeUnitAt((bits << 2) & _sixBitMask);
- output[outputIndex++] = _paddingChar;
- }
- }
-}
-
-class _BufferCachingBase64Encoder extends _Base64Encoder {
- /**
- * Reused buffer.
- *
- * When the buffer isn't released to the sink, only used to create another
- * value (a string), the buffer can be reused between chunks.
- */
- Uint8List bufferCache;
-
- _BufferCachingBase64Encoder(bool urlSafe) : super(urlSafe);
-
- Uint8List createBuffer(int bufferLength) {
- if (bufferCache == null || bufferCache.length < bufferLength) {
- bufferCache = new Uint8List(bufferLength);
- }
- // Return a view of the buffer, so it has the reuested length.
- return new Uint8List.view(bufferCache.buffer, 0, bufferLength);
- }
-}
-
-abstract class _Base64EncoderSink extends ByteConversionSinkBase {
- void add(List<int> source) {
- _add(source, 0, source.length, false);
- }
-
- void close() {
- _add(null, 0, 0, true);
- }
-
- void addSlice(List<int> source, int start, int end, bool isLast) {
- if (end == null) throw new ArgumentError.notNull("end");
- RangeError.checkValidRange(start, end, source.length);
- _add(source, start, end, isLast);
- }
-
- void _add(List<int> source, int start, int end, bool isLast);
-}
-
-class _AsciiBase64EncoderSink extends _Base64EncoderSink {
- final Sink<String> _sink;
- final _Base64Encoder _encoder;
-
- _AsciiBase64EncoderSink(this._sink, bool urlSafe)
- : _encoder = new _BufferCachingBase64Encoder(urlSafe);
-
- void _add(List<int> source, int start, int end, bool isLast) {
- Uint8List buffer = _encoder.encode(source, start, end, isLast);
- if (buffer != null) {
- String string = new String.fromCharCodes(buffer);
- _sink.add(string);
- }
- if (isLast) {
- _sink.close();
- }
- }
-}
-
-class _Utf8Base64EncoderSink extends _Base64EncoderSink {
- final ByteConversionSink _sink;
- final _Base64Encoder _encoder;
-
- _Utf8Base64EncoderSink(this._sink, bool urlSafe)
- : _encoder = new _Base64Encoder(urlSafe);
-
- void _add(List<int> source, int start, int end, bool isLast) {
- Uint8List buffer = _encoder.encode(source, start, end, isLast);
- if (buffer != null) {
- _sink.addSlice(buffer, 0, buffer.length, isLast);
- }
- }
-}
-
-// ------------------------------------------------------------------------
-// Decoder
-// ------------------------------------------------------------------------
-
-/**
- * Decoder for base64 encoded data.
- *
- * This decoder accepts both base64 and base64url ("url-safe") encodings.
- *
- * The encoding is required to be properly padded.
- */
-class Base64Decoder extends Converter<String, List<int>> {
-
- const Base64Decoder();
-
- List<int> convert(String input, [int start = 0, int end]) {
- end = RangeError.checkValidRange(start, end, input.length);
- if (start == end) return new Uint8List(0);
- var decoder = new _Base64Decoder();
- Uint8List buffer = decoder.decode(input, start, end);
- decoder.close(input, end);
- return buffer;
- }
-
- StringConversionSink startChunkedConversion(Sink<List<int>> sink) {
- return new _Base64DecoderSink(sink);
- }
-}
-
-/**
- * Helper class implementing base64 decoding with intermediate state.
- */
-class _Base64Decoder {
- /** Shift-count to extract the values stored in [_state]. */
- static const int _valueShift = 2;
-
- /** Mask to extract the count value stored in [_state]. */
- static const int _countMask = 3;
-
- /** Invalid character in decoding table. */
- static const int _invalid = -2;
-
- /** Padding character in decoding table. */
- static const int _padding = -1;
-
- // Shorthands to make the table more readable.
- static const int __ = _invalid;
- static const int _p = _padding;
-
- /**
- * Mapping from ASCII characters to their index in the base64 alphabet.
- *
- * Uses [_invalid] for invalid indices and [_padding] for the padding
- * character.
- *
- * Accepts the "URL-safe" alphabet as well (`-` and `_` are the
- * 62nd and 63rd alphabet characters), and considers `%` a padding
- * character, which mush then be followed by `3D`, the percent-escape
- * for `=`.
- */
- static final List<int> _inverseAlphabet = new Int8List.fromList([
- __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __,
- __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __,
- __, __, __, __, __, _p, __, __, __, __, __, 62, __, 62, __, 63,
- 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, __, __, __, _p, __, __,
- __, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
- 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, __, __, __, __, 63,
- __, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
- 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, __, __, __, __, __,
- ]);
-
- // Character constants.
- static const int _char_percent = 0x25; // '%'.
- static const int _char_3 = 0x33; // '3'.
- static const int _char_d = 0x64; // 'd'.
-
- /**
- * Maintains the intermediate state of a partly-decoded input.
- *
- * Base64 is decoded in chunks of four characters. If a chunk does not
- * contain a full block, the decoded bits (six per character) of the
- * available characters are stored in [_state] until the next call to
- * [_decode] or [_close].
- *
- * If no padding has been seen, the value is
- * `numberOfCharactersSeen | (decodedBits << 2)`
- * where `numberOfCharactersSeen` is between 0 and 3 and decoded bits
- * contains six bits per seen character.
- *
- * If padding has been seen the value is negative. It's the bitwise negation
- * of the number of remanining allowed padding characters (always ~0 or ~1).
- *
- * A state of `0` or `~0` are valid places to end decoding, all other values
- * mean that a four-character block has not been completed.
- */
- int _state = 0;
-
- /**
- * Encodes [count] and [bits] as a value to be stored in [_state].
- */
- static int _encodeCharacterState(int count, int bits) {
- assert(count == (count & _countMask));
- return (bits << _valueShift | count);
- }
-
- /**
- * Extracts count from a [_state] value.
- */
- static int _stateCount(int state) {
- assert(state >= 0);
- return state & _countMask;
- }
-
- /**
- * Extracts value bits from a [_state] value.
- */
- static int _stateBits(int state) {
- assert(state >= 0);
- return state >> _valueShift;
- }
-
- /**
- * Encodes a number of expected padding characters to be stored in [_state].
- */
- static int _encodePaddingState(int expectedPadding) {
- assert(expectedPadding >= 0);
- assert(expectedPadding <= 5);
- return -expectedPadding - 1; // ~expectedPadding adapted to dart2js.
- }
-
- /**
- * Extracts expected padding character count from a [_state] value.
- */
- static int _statePadding(int state) {
- assert(state < 0);
- return -state - 1; // ~state adapted to dart2js.
- }
-
- static bool _hasSeenPadding(int state) => state < 0;
-
- /**
- * Decodes [input] from [start] to [end].
- *
- * Returns a [Uint8List] with the decoded bytes.
- * If a previous call had an incomplete four-character block, the bits from
- * those are included in decoding
- */
- Uint8List decode(String input, int start, int end) {
- assert(0 <= start);
- assert(start <= end);
- assert(end <= input.length);
- if (_hasSeenPadding(_state)) {
- _state = _checkPadding(input, start, end, _state);
- return null;
- }
- if (start == end) return new Uint8List(0);
- Uint8List buffer = _allocateBuffer(input, start, end, _state);
- _state = decodeChunk(input, start, end, buffer, 0, _state);
- return buffer;
- }
-
- /** Checks that [_state] represents a valid decoding. */
- void close(String input, int end) {
- if (_state < _encodePaddingState(0)) {
- throw new FormatException("Missing padding character", input, end);
- }
- if (_state > 0) {
- throw new FormatException("Invalid length, must be multiple of four",
- input, end);
- }
- _state = _encodePaddingState(0);
- }
-
- /**
- * Decodes [input] from [start] to [end].
- *
- * Includes the state returned by a previous call in the decoding.
- * Writes the decoding to [output] at [outIndex], and there must
- * be room in the output.
- */
- static int decodeChunk(String input, int start, int end,
- Uint8List output, int outIndex,
- int state) {
- assert(!_hasSeenPadding(state));
- const int asciiMask = 127;
- const int asciiMax = 127;
- const int eightBitMask = 0xFF;
- const int bitsPerCharacter = 6;
-
- int bits = _stateBits(state);
- int count = _stateCount(state);
- // String contents should be all ASCII.
- // Instead of checking for each character, we collect the bitwise-or of
- // all the characters in `charOr` and later validate that all characters
- // were ASCII.
- int charOr = 0;
- for (int i = start; i < end; i++) {
- var char = input.codeUnitAt(i);
- charOr |= char;
- int code = _inverseAlphabet[char & asciiMask];
- if (code >= 0) {
- bits = ((bits << bitsPerCharacter) | code) & 0xFFFFFF;
- count = (count + 1) & 3;
- if (count == 0) {
- assert(outIndex + 3 <= output.length);
- output[outIndex++] = (bits >> 16) & eightBitMask;
- output[outIndex++] = (bits >> 8) & eightBitMask;
- output[outIndex++] = bits & eightBitMask;
- bits = 0;
- }
- continue;
- } else if (code == _padding && count > 1) {
- if (charOr < 0 || charOr > asciiMax) break;
- if (count == 3) {
- if ((bits & 0x03) != 0) {
- throw new FormatException(
- "Invalid encoding before padding", input, i);
- }
- output[outIndex++] = bits >> 10;
- output[outIndex++] = bits >> 2;
- } else {
- if ((bits & 0x0F) != 0) {
- throw new FormatException(
- "Invalid encoding before padding", input, i);
- }
- output[outIndex++] = bits >> 4;
- }
- // Expected padding is the number of expected padding characters,
- // where `=` counts as three and `%3D` counts as one per character.
- //
- // Expect either zero or one padding depending on count (2 or 3),
- // plus two more characters if the code was `%` (a partial padding).
- int expectedPadding = (3 - count) * 3;
- if (char == _char_percent) expectedPadding += 2;
- state = _encodePaddingState(expectedPadding);
- return _checkPadding(input, i + 1, end, state);
- }
- throw new FormatException("Invalid character", input, i);
- }
- if (charOr >= 0 && charOr <= asciiMax) {
- return _encodeCharacterState(count, bits);
- }
- // There is an invalid (non-ASCII) character in the input.
- int i;
- for (i = start; i < end; i++) {
- int char = input.codeUnitAt(i);
- if (char < 0 || char > asciiMax) break;
- }
- throw new FormatException("Invalid character", input, i);
- }
-
- /**
- * Allocates a buffer with room for the decoding of a substring of [input].
- *
- * Includes room for the characters in [state], and handles padding correctly.
- */
- static Uint8List _allocateBuffer(String input, int start, int end,
- int state) {
- assert(state >= 0);
- int paddingStart = _trimPaddingChars(input, start, end);
- int length = _stateCount(state) + (paddingStart - start);
- // Three bytes per full four bytes in the input.
- int bufferLength = (length >> 2) * 3;
- // If padding was seen, then this is the last chunk, and the final partial
- // chunk should be decoded too.
- int remainderLength = length & 3;
- if (remainderLength != 0 && paddingStart < end) {
- bufferLength += remainderLength - 1;
- }
- if (bufferLength > 0) return new Uint8List(bufferLength);
- // If the input plus state is less than four characters, and it's not
- // at the end of input, no buffer is needed.
- return null;
- }
-
- /**
- * Returns the position of the start of padding at the end of the input.
- *
- * Returns the end of input if there is no padding.
- *
- * This is used to ensure that the decoding buffer has the exact size
- * it needs when input is valid, and at least enough bytes to reach the error
- * when input is invalid.
- *
- * Never count more than two padding sequences since any more than that
- * will raise an error anyway, and we only care about being precise for
- * successful conversions.
- */
- static int _trimPaddingChars(String input, int start, int end) {
- // This may count '%=' as two paddings. That's ok, it will err later,
- // but the buffer will be large enough to reach the error.
- int padding = 0;
- int index = end;
- int newEnd = end;
- while (index > start && padding < 2) {
- index--;
- int char = input.codeUnitAt(index);
- if (char == _paddingChar) {
- padding++;
- newEnd = index;
- continue;
- }
- if ((char | 0x20) == _char_d) {
- if (index == start) break;
- index--;
- char = input.codeUnitAt(index);
- }
- if (char == _char_3) {
- if (index == start) break;
- index--;
- char = input.codeUnitAt(index);
- }
- if (char == _char_percent) {
- padding++;
- newEnd = index;
- continue;
- }
- break;
- }
- return newEnd;
- }
-
- /**
- * Check that the remainder of the string is valid padding.
- *
- * Valid padding is a correct number (0, 1 or 2) of `=` characters
- * or `%3D` sequences depending on the number of preceding base64 characters.
- * The [state] parameter encodes which padding continuations are allowed
- * as the number of expected characters. That number is the number of
- * expected padding characters times 3 minus the number of padding characters
- * seen so far, where `=` counts as 3 counts as three characters,
- * and the padding sequence `%3D` counts as one character per character.
- *
- * The number of missing characters is always between 0 and 5 because we
- * only call this function after having seen at least one `=` or `%`
- * character.
- * If the number of missing characters is not 3 or 0, we have seen (at least)
- * a `%` character and expects the rest of the `%3D` sequence, and a `=` is
- * not allowed. When missing 3 characters, either `=` or `%` is allowed.
- *
- * When the value is 0, no more padding (or any other character) is allowed.
- */
- static int _checkPadding(String input, int start, int end, int state) {
- assert(_hasSeenPadding(state));
- if (start == end) return state;
- int expectedPadding = _statePadding(state);
- assert(expectedPadding >= 0);
- assert(expectedPadding < 6);
- while (expectedPadding > 0) {
- int char = input.codeUnitAt(start);
- if (expectedPadding == 3) {
- if (char == _paddingChar) {
- expectedPadding -= 3;
- start++;
- break;
- }
- if (char == _char_percent) {
- expectedPadding--;
- start++;
- if (start == end) break;
- char = input.codeUnitAt(start);
- } else {
- break;
- }
- }
- // Partial padding means we have seen part of a "%3D" escape.
- int expectedPartialPadding = expectedPadding;
- if (expectedPartialPadding > 3) expectedPartialPadding -= 3;
- if (expectedPartialPadding == 2) {
- // Expects '3'
- if (char != _char_3) break;
- start++;
- expectedPadding--;
- if (start == end) break;
- char = input.codeUnitAt(start);
- }
- // Expects 'D' or 'd'.
- if ((char | 0x20) != _char_d) break;
- start++;
- expectedPadding--;
- if (start == end) break;
- }
- if (start != end) {
- throw new FormatException("Invalid padding character",
- input, start);
- }
- return _encodePaddingState(expectedPadding);
- }
-}
-
-class _Base64DecoderSink extends StringConversionSinkBase {
- /** Output sink */
- final Sink<List<int>> _sink;
- final _Base64Decoder _decoder = new _Base64Decoder();
-
- _Base64DecoderSink(this._sink);
-
- void add(String string) {
- if (string.isEmpty) return;
- Uint8List buffer = _decoder.decode(string, 0, string.length);
- if (buffer != null) _sink.add(buffer);
- }
-
- void close() {
- _decoder.close(null, null);
- _sink.close();
- }
-
- void addSlice(String string, int start, int end, bool isLast) {
- end = RangeError.checkValidRange(start, end, string.length);
- if (start == end) return;
- Uint8List buffer = _decoder.decode(string, start, end);
- if (buffer != null) _sink.add(buffer);
- if (isLast) {
- _decoder.close(string, end);
- _sink.close();
- }
- }
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/convert/byte_conversion.dart b/pkg/dev_compiler/tool/input_sdk/lib/convert/byte_conversion.dart
deleted file mode 100644
index 4c1ede4..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/convert/byte_conversion.dart
+++ /dev/null
@@ -1,116 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-part of dart.convert;
-
-/**
- * The [ByteConversionSink] provides an interface for converters to
- * efficiently transmit byte data.
- *
- * Instead of limiting the interface to one non-chunked list of bytes it
- * accepts its input in chunks (themselves being lists of bytes).
- *
- * This abstract class will likely get more methods over time. Implementers are
- * urged to extend or mix in [ByteConversionSinkBase] to ensure that their
- * class covers the newly added methods.
- */
-abstract class ByteConversionSink extends ChunkedConversionSink<List<int>> {
- ByteConversionSink();
- factory ByteConversionSink.withCallback(void callback(List<int> accumulated))
- = _ByteCallbackSink;
- factory ByteConversionSink.from(Sink<List<int>> sink)
- = _ByteAdapterSink;
-
- /**
- * Adds the next [chunk] to `this`.
- *
- * Adds the bytes defined by [start] and [end]-exclusive to `this`.
- *
- * If [isLast] is `true` closes `this`.
- *
- * Contrary to `add` the given [chunk] must not be held onto. Once the method
- * returns, it is safe to overwrite the data in it.
- */
- void addSlice(List<int> chunk, int start, int end, bool isLast);
-
- // TODO(floitsch): add more methods:
- // - iterateBytes.
-}
-
-/**
- * This class provides a base-class for converters that need to accept byte
- * inputs.
- */
-abstract class ByteConversionSinkBase extends ByteConversionSink {
-
- void add(List<int> chunk);
- void close();
-
- void addSlice(List<int> chunk, int start, int end, bool isLast) {
- add(chunk.sublist(start, end));
- if (isLast) close();
- }
-}
-
-/**
- * This class adapts a simple [Sink] to a [ByteConversionSink].
- *
- * All additional methods of the [ByteConversionSink] (compared to the
- * ChunkedConversionSink) are redirected to the `add` method.
- */
-class _ByteAdapterSink extends ByteConversionSinkBase {
- final Sink<List<int>> _sink;
-
- _ByteAdapterSink(this._sink);
-
- void add(List<int> chunk) { _sink.add(chunk); }
- void close() { _sink.close(); }
-}
-
-/**
- * This class accumulates all chunks into one list of bytes
- * and invokes a callback when the sink is closed.
- *
- * This class can be used to terminate a chunked conversion.
- */
-class _ByteCallbackSink extends ByteConversionSinkBase {
- static const _INITIAL_BUFFER_SIZE = 1024;
-
- final _ChunkedConversionCallback<List<int>> _callback;
- List<int> _buffer = new Uint8List(_INITIAL_BUFFER_SIZE);
- int _bufferIndex = 0;
-
- _ByteCallbackSink(void callback(List<int> accumulated))
- : this._callback = callback;
-
- void add(Iterable<int> chunk) {
- int freeCount = _buffer.length - _bufferIndex;
- if (chunk.length > freeCount) {
- // Grow the buffer.
- int oldLength = _buffer.length;
- int newLength = _roundToPowerOf2(chunk.length + oldLength) * 2;
- List<int> grown = new Uint8List(newLength);
- grown.setRange(0, _buffer.length, _buffer);
- _buffer = grown;
- }
- _buffer.setRange(_bufferIndex, _bufferIndex + chunk.length, chunk);
- _bufferIndex += chunk.length;
- }
-
- static int _roundToPowerOf2(int v) {
- assert(v > 0);
- v--;
- v |= v >> 1;
- v |= v >> 2;
- v |= v >> 4;
- v |= v >> 8;
- v |= v >> 16;
- v++;
- return v;
- }
-
- void close() {
- _callback(_buffer.sublist(0, _bufferIndex));
- }
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/convert/chunked_conversion.dart b/pkg/dev_compiler/tool/input_sdk/lib/convert/chunked_conversion.dart
deleted file mode 100644
index ee71f4f..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/convert/chunked_conversion.dart
+++ /dev/null
@@ -1,97 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-part of dart.convert;
-
-typedef void _ChunkedConversionCallback<T>(T accumulated);
-
-/// This class is deprecated. Extend [Converter] directly.
-@deprecated
-abstract class ChunkedConverter<S, T, S2, T2> extends Converter<S, T> {
- const ChunkedConverter(): super();
-
- dynamic bind(dynamic other) => super.bind(other);
- dynamic startChunkedConversion(dynamic sink) =>
- super.startChunkedConversion(sink);
-}
-
-/**
- * A [ChunkedConversionSink] is used to transmit data more efficiently between
- * two converters during chunked conversions.
- *
- * The basic `ChunkedConversionSink` is just a [Sink], and converters should
- * work with a plain `Sink`, but may work more efficiently with certain
- * specialized types of `ChunkedConversionSink`.
- *
- * It is recommended that implementations of `ChunkedConversionSink` extend
- * this class, to inherit any further methods that may be added to the class.
- */
-abstract class ChunkedConversionSink<T> implements Sink<T> {
- ChunkedConversionSink();
- factory ChunkedConversionSink.withCallback(
- void callback(List<T> accumulated)) = _SimpleCallbackSink<T>;
-
- /**
- * Adds chunked data to this sink.
- *
- * This method is also used when converters are used as [StreamTransformer]s.
- */
- void add(T chunk);
-
- /**
- * Closes the sink.
- *
- * This signals the end of the chunked conversion. This method is called
- * when converters are used as [StreamTransformer]'s.
- */
- void close();
-}
-
-/**
- * This class accumulates all chunks and invokes a callback with a list of
- * the chunks when the sink is closed.
- *
- * This class can be used to terminate a chunked conversion.
- */
-class _SimpleCallbackSink<T> extends ChunkedConversionSink<T> {
- final _ChunkedConversionCallback<List<T>> _callback;
- final List<T> _accumulated = <T>[];
-
- _SimpleCallbackSink(this._callback);
-
- void add(T chunk) { _accumulated.add(chunk); }
- void close() { _callback(_accumulated); }
-}
-
-/**
- * This class implements the logic for a chunked conversion as a
- * stream transformer.
- *
- * It is used as strategy in the [EventTransformStream].
- *
- * It also implements the [ChunkedConversionSink] interface so that it
- * can be used as output sink in a chunked conversion.
- */
-class _ConverterStreamEventSink<S, T> implements EventSink<S> {
- /** The output sink for the converter. */
- final EventSink<T> _eventSink;
-
- /**
- * The input sink for new data. All data that is received with
- * [handleData] is added into this sink.
- */
- final Sink<S> _chunkedSink;
-
- _ConverterStreamEventSink(
- Converter/*=Converter<S, T>*/ converter,
- EventSink<T> sink)
- : this._eventSink = sink,
- _chunkedSink = converter.startChunkedConversion(sink);
-
- void add(S o) { _chunkedSink.add(o); }
- void addError(Object error, [StackTrace stackTrace]) {
- _eventSink.addError(error, stackTrace);
- }
- void close() { _chunkedSink.close(); }
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/convert/codec.dart b/pkg/dev_compiler/tool/input_sdk/lib/convert/codec.dart
deleted file mode 100644
index 7f42c86..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/convert/codec.dart
+++ /dev/null
@@ -1,102 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-part of dart.convert;
-
-/**
- * A [Codec] encodes and (if supported) decodes data.
- *
- * Codecs can be fused. For example fusing [JSON] and [UTF8] produces
- * an encoder that can convert Json objects directly to bytes, or can decode
- * bytes directly to json objects.
- *
- * Fused codecs generally attempt to optimize the operations and can be faster
- * than executing each step of an encoding separately.
- *
- * *Codecs are still experimental and are subject to change without notice.*
- */
-abstract class Codec<S, T> {
- const Codec();
-
- T encode(S input) => encoder.convert(input);
- S decode(T encoded) => decoder.convert(encoded);
-
- /**
- * Returns the encoder from [S] to [T].
- *
- * It may be stateful and should not be reused.
- */
- Converter<S, T> get encoder;
- /**
- * Returns the decoder of `this`, converting from [T] to [S].
- *
- * It may be stateful an should not be reused.
- */
- Converter<T, S> get decoder;
-
- /**
- * Fuses `this` with `other`.
- *
- * When encoding, the resulting codec encodes with `this` before
- * encoding with [other].
- *
- * When decoding, the resulting codec decodes with [other] before decoding
- * with `this`.
- *
- * In some cases one needs to use the [inverted] codecs to be able to fuse
- * them correctly. That is, the output type of `this` ([T]) must match the
- * input type of the second codec [other].
- *
- * Examples:
- *
- * final JSON_TO_BYTES = JSON.fuse(UTF8);
- * List<int> bytes = JSON_TO_BYTES.encode(["json-object"]);
- * var decoded = JSON_TO_BYTES.decode(bytes);
- * assert(decoded is List && decoded[0] == "json-object");
- *
- * var inverted = JSON.inverted;
- * var jsonIdentity = JSON.fuse(inverted);
- * var jsonObject = jsonIdentity.encode(["1", 2]);
- * assert(jsonObject is List && jsonObject[0] == "1" && jsonObject[1] == 2);
- */
- // TODO(floitsch): use better example with line-splitter once that one is
- // in this library.
- Codec<S, dynamic/*=R*/> fuse/*<R>*/(Codec<T, dynamic/*=R*/> other) {
- return new _FusedCodec<S, T, dynamic/*=R*/>(this, other);
- }
-
- /**
- * Inverts `this`.
- *
- * The [encoder] and [decoder] of the resulting codec are swapped.
- */
- Codec<T, S> get inverted => new _InvertedCodec<T, S>(this);
-}
-
-/**
- * Fuses the given codecs.
- *
- * In the non-chunked conversion simply invokes the non-chunked conversions in
- * sequence.
- */
-class _FusedCodec<S, M, T> extends Codec<S, T> {
- final Codec<S, M> _first;
- final Codec<M, T> _second;
-
- Converter<S, T> get encoder => _first.encoder.fuse/*<T>*/(_second.encoder);
- Converter<T, S> get decoder => _second.decoder.fuse/*<S>*/(_first.decoder);
-
- _FusedCodec(this._first, this._second);
-}
-
-class _InvertedCodec<T, S> extends Codec<T, S> {
- final Codec<S, T> _codec;
-
- _InvertedCodec(Codec<S, T> codec) : _codec = codec;
-
- Converter<T, S> get encoder => _codec.decoder;
- Converter<S, T> get decoder => _codec.encoder;
-
- Codec<S, T> get inverted => _codec;
-}
\ No newline at end of file
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/convert/convert.dart b/pkg/dev_compiler/tool/input_sdk/lib/convert/convert.dart
deleted file mode 100644
index 83bbfd6..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/convert/convert.dart
+++ /dev/null
@@ -1,71 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-/**
- *
- * Encoders and decoders for converting between different data representations,
- * including JSON and UTF-8.
- *
- * In addition to converters for common data representations, this library
- * provides support for implementing converters in a way which makes them easy to
- * chain and to use with streams.
- *
- * To use this library in your code:
- *
- * import 'dart:convert';
- *
- * Two commonly used converters are the top-level instances of
- * [JsonCodec] and [Utf8Codec], named JSON and UTF8, respectively.
- *
- * JSON is a simple text format for representing
- * structured objects and collections.
- * The JSON encoder/decoder transforms between strings and
- * object structures, such as lists and maps, using the JSON format.
- *
- * UTF-8 is a common variable-width encoding that can represent
- * every character in the Unicode character set.
- * The UTF-8 encoder/decoder transforms between Strings and bytes.
- *
- * Converters are often used with streams
- * to transform the data that comes through the stream
- * as it becomes available.
- * The following code uses two converters.
- * The first is a UTF-8 decoder, which converts the data from bytes to UTF-8
- * as it's read from a file,
- * The second is an instance of [LineSplitter],
- * which splits the data on newline boundaries.
- *
- * int lineNumber = 1;
- * Stream<List<int>> stream = new File('quotes.txt').openRead();
- *
- * stream.transform(UTF8.decoder)
- * .transform(const LineSplitter())
- * .listen((line) {
- * if (showLineNumbers) {
- * stdout.write('${lineNumber++} ');
- * }
- * stdout.writeln(line);
- * });
- *
- * See the documentation for the [Codec] and [Converter] classes
- * for information about creating your own converters.
- */
-library dart.convert;
-
-import 'dart:async';
-import 'dart:typed_data';
-
-part 'ascii.dart';
-part 'base64.dart';
-part 'byte_conversion.dart';
-part 'chunked_conversion.dart';
-part 'codec.dart';
-part 'converter.dart';
-part 'encoding.dart';
-part 'html_escape.dart';
-part 'json.dart';
-part 'latin1.dart';
-part 'line_splitter.dart';
-part 'string_conversion.dart';
-part 'utf.dart';
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/convert/converter.dart b/pkg/dev_compiler/tool/input_sdk/lib/convert/converter.dart
deleted file mode 100644
index dfcfcdf..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/convert/converter.dart
+++ /dev/null
@@ -1,66 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-part of dart.convert;
-
-/**
- * A [Converter] converts data from one representation into another.
- *
- * It is recommended that implementations of `Converter` extend this class,
- * to inherit any further methods that may be added to the class.
- */
-abstract class Converter<S, T> implements StreamTransformer/*<S, T>*/ {
- const Converter();
-
- /**
- * Converts [input] and returns the result of the conversion.
- */
- T convert(S input);
-
- /**
- * Fuses `this` with [other].
- *
- * Encoding with the resulting converter is equivalent to converting with
- * `this` before converting with `other`.
- */
- Converter<S, dynamic/*=TT*/> fuse/*<TT>*/(
- Converter<T, dynamic/*=TT*/> other) {
- return new _FusedConverter<S, T, dynamic/*=TT*/>(this, other);
- }
-
- /**
- * Starts a chunked conversion.
- *
- * The returned sink serves as input for the long-running conversion. The
- * given [sink] serves as output.
- */
- Sink/*<S>*/ startChunkedConversion(Sink/*<T>*/ sink) {
- throw new UnsupportedError(
- "This converter does not support chunked conversions: $this");
- }
-
- Stream/*<T>*/ bind(Stream/*<S>*/ stream) {
- return new Stream/*<T>*/.eventTransformed(
- stream,
- (EventSink sink) => new _ConverterStreamEventSink(this, sink));
- }
-}
-
-/**
- * Fuses two converters.
- *
- * For a non-chunked conversion converts the input in sequence.
- */
-class _FusedConverter<S, M, T> extends Converter<S, T> {
- final Converter<S, M> _first;
- final Converter<M, T> _second;
-
- _FusedConverter(this._first, this._second);
-
- T convert(S input) => _second.convert(_first.convert(input));
-
- Sink/*<S>*/ startChunkedConversion(Sink/*<T>*/ sink) {
- return _first.startChunkedConversion(_second.startChunkedConversion(sink));
- }
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/convert/encoding.dart b/pkg/dev_compiler/tool/input_sdk/lib/convert/encoding.dart
deleted file mode 100644
index 11ae300..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/convert/encoding.dart
+++ /dev/null
@@ -1,79 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-part of dart.convert;
-
-/**
- * Open-ended Encoding enum.
- */
-abstract class Encoding extends Codec<String, List<int>> {
- const Encoding();
-
- Converter<String, List<int>> get encoder;
- Converter<List<int>, String> get decoder;
-
- Future<String> decodeStream(Stream<List<int>> byteStream) {
- return byteStream
- .transform(decoder)
- .fold(new StringBuffer(), (buffer, string) => buffer..write(string))
- .then((buffer) => buffer.toString());
- }
-
- /**
- * Name of the encoding.
- *
- * If the encoding is standardized, this is the lower-case version of one of
- * the IANA official names for the character set (see
- * http://www.iana.org/assignments/character-sets/character-sets.xml)
- */
- String get name;
-
- // All aliases (in lowercase) of supported encoding from
- // http://www.iana.org/assignments/character-sets/character-sets.xml.
- static Map<String, Encoding> _nameToEncoding = <String, Encoding> {
- // ISO_8859-1:1987.
- "iso_8859-1:1987": LATIN1,
- "iso-ir-100": LATIN1,
- "iso_8859-1": LATIN1,
- "iso-8859-1": LATIN1,
- "latin1": LATIN1,
- "l1": LATIN1,
- "ibm819": LATIN1,
- "cp819": LATIN1,
- "csisolatin1": LATIN1,
-
- // US-ASCII.
- "iso-ir-6": ASCII,
- "ansi_x3.4-1968": ASCII,
- "ansi_x3.4-1986": ASCII,
- "iso_646.irv:1991": ASCII,
- "iso646-us": ASCII,
- "us-ascii": ASCII,
- "us": ASCII,
- "ibm367": ASCII,
- "cp367": ASCII,
- "csascii": ASCII,
- "ascii": ASCII, // This is not in the IANA official names.
-
- // UTF-8.
- "csutf8": UTF8,
- "utf-8": UTF8
- };
-
- /**
- * Gets an [Encoding] object from the name of the character set
- * name. The names used are the IANA official names for the
- * character set (see
- * http://www.iana.org/assignments/character-sets/character-sets.xml).
- *
- * The [name] passed is case insensitive.
- *
- * If character set is not supported [:null:] is returned.
- */
- static Encoding getByName(String name) {
- if (name == null) return null;
- name = name.toLowerCase();
- return _nameToEncoding[name];
- }
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/convert/html_escape.dart b/pkg/dev_compiler/tool/input_sdk/lib/convert/html_escape.dart
deleted file mode 100644
index ff74442..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/convert/html_escape.dart
+++ /dev/null
@@ -1,231 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-part of dart.convert;
-
-/**
- * A `String` converter that converts characters to HTML entities.
- *
- * This is intended to sanitice text before inserting the text into an HTML
- * document. Characters that are meaningful in HTML are converted to
- * HTML entities (like `&` for `&`).
- *
- * The general converter escapes all characters that are meaningful in HTML
- * attributes or normal element context. Elements with special content types
- * (like CSS or JavaScript) may need a more specialized escaping that
- * understands that content type.
- *
- * If the context where the text will be inserted is known in more detail,
- * it's possible to omit escaping some characters (like quotes when not
- * inside an attribute value).
- *
- * The escaped text should only be used inside quoted HTML attributes values
- * or as text content of a normal element. Using the escaped text inside a
- * tag, but not inside a quoted attribute value, is still dangerous.
- */
-const HtmlEscape HTML_ESCAPE = const HtmlEscape();
-
-/**
- * HTML escape modes.
- *
- * Allows specifying a mode for HTML escaping that depend on the context
- * where the escaped result is going to be used.
- * The relevant contexts are:
- *
- * * as text content of an HTML element.
- * * as value of a (single- or double-) quoted attribute value.
- *
- * All modes require escaping of `&` (ampersand) characters, and may
- * enable escaping of more characters.
- *
- * Custom escape modes can be created using the [HtmlEscapeMode.HtmlEscapeMode]
- * constructor.
- */
-class HtmlEscapeMode {
- final String _name;
- /** Whether to escape '<' and '>'. */
- final bool escapeLtGt;
- /** Whether to escape '"' (quote). */
- final bool escapeQuot;
- /** Whether to escape "'" (apostrophe). */
- final bool escapeApos;
- /**
- * Whether to escape "/" (forward slash, solidus).
- *
- * Escaping a slash is recommended to avoid cross-site scripting attacks by
- * [the Open Web Application Security Project](https://www.owasp.org/index.php/XSS_(Cross_Site_Scripting)_Prevention_Cheat_Sheet#RULE_.231_-_HTML_Escape_Before_Inserting_Untrusted_Data_into_HTML_Element_Content)
- */
- final bool escapeSlash;
-
- /**
- * Default escaping mode which escape all characters.
- *
- * The result of such an escaping is usable both in element content and
- * in any attribute value.
- *
- * The escaping only works for elements with normal HTML content,
- * and not for, for example, script or style element content,
- * which require escapes matching their particular content syntax.
- */
- static const HtmlEscapeMode UNKNOWN =
- const HtmlEscapeMode._('unknown', true, true, true, true);
-
- /**
- * Escaping mode for text going into double-quoted HTML attribute values.
- *
- * The result should not be used as the content of an unquoted
- * or single-quoted attribute value.
- *
- * Escapes double quotes (`"`) but not single quotes (`'`),
- * and escapes `<` and `>` characters because they are not allowed
- * in strict XHTML attributes
- */
- static const HtmlEscapeMode ATTRIBUTE =
- const HtmlEscapeMode._('attribute', true, true, false, false);
-
- /**
- * Escaping mode for text going into single-quoted HTML attribute values.
- *
- * The result should not be used as the content of an unquoted
- * or double-quoted attribute value.
- *
- * Escapes single quotes (`'`) but not double quotes (`"`),
- * and escapes `<` and `>` characters because they are not allowed
- * in strict XHTML attributes
- */
- static const HtmlEscapeMode SQ_ATTRIBUTE =
- const HtmlEscapeMode._('attribute', true, false, true, false);
-
- /**
- * Escaping mode for text going into HTML element content.
- *
- * The escaping only works for elements with normal HTML content,
- * and not for, for example, script or style element content,
- * which require escapes matching their particular content syntax.
- *
- * Escapes `<` and `>` characters.
- */
- static const HtmlEscapeMode ELEMENT =
- const HtmlEscapeMode._('element', true, false, false, false);
-
- const HtmlEscapeMode._(this._name,
- this.escapeLtGt,
- this.escapeQuot,
- this.escapeApos,
- this.escapeSlash);
-
- /**
- * Create a custom escaping mode.
- *
- * All modes escape `&`.
- * The mode can further be set to escape `<` and `>` ([escapeLtGt]),
- * `"` ([escapeQuot]), `'` ([escapeApos]), and/or `/` ([escapeSlash]).
- */
- const HtmlEscapeMode({String name: "custom",
- this.escapeLtGt: false,
- this.escapeQuot: false,
- this.escapeApos: false,
- this.escapeSlash: false}) : _name = name;
-
- String toString() => _name;
-}
-
-/**
- * Converter which escapes characters with special meaning in HTML.
- *
- * The converter finds characters that are siginificant in HTML source and
- * replaces them with corresponding HTML entities.
- *
- * The characters that need escaping in HTML are:
- *
- * * `&` (ampersand) always need to be escaped.
- * * `<` (less than) and '>' (greater than) when inside an element.
- * * `"` (quote) when inside a double-quoted attribute value.
- * * `'` (apostrophe) when inside a single-quoted attribute value.
- * Apostrophe is escaped as `'` instead of `'` since
- * not all browsers understand `'`.
- * * `/` (slash) is recommended to be escaped because it may be used
- * to terminate an element in some HTML dialects.
- *
- * Escaping `>` (greater than) isn't necessary, but the result is often
- * found to be easier to read if greater-than is also escaped whenever
- * less-than is.
- */
-class HtmlEscape extends Converter<String, String> {
-
- /** The [HtmlEscapeMode] used by the converter. */
- final HtmlEscapeMode mode;
-
- /**
- * Create converter that escapes HTML characters.
- *
- * If [mode] is provided as either [HtmlEscapeMode.ATTRIBUTE] or
- * [HtmlEscapeMode.ELEMENT], only the corresponding subset of HTML
- * characters are escaped.
- * The default is to escape all HTML characters.
- */
- const HtmlEscape([this.mode = HtmlEscapeMode.UNKNOWN]);
-
- String convert(String text) {
- var val = _convert(text, 0, text.length);
- return val == null ? text : val;
- }
-
- /**
- * Converts the substring of text from start to end.
- *
- * Returns `null` if no changes were necessary, otherwise returns
- * the converted string.
- */
- String _convert(String text, int start, int end) {
- StringBuffer result = null;
- for (int i = start; i < end; i++) {
- var ch = text[i];
- String replacement = null;
- switch (ch) {
- case '&': replacement = '&'; break;
- case '"': if (mode.escapeQuot) replacement = '"'; break;
- case "'": if (mode.escapeApos) replacement = '''; break;
- case '<': if (mode.escapeLtGt) replacement = '<'; break;
- case '>': if (mode.escapeLtGt) replacement = '>'; break;
- case '/': if (mode.escapeSlash) replacement = '/'; break;
- }
- if (replacement != null) {
- if (result == null) result = new StringBuffer();
- if (i > start) result.write(text.substring(start, i));
- result.write(replacement);
- start = i + 1;
- }
- }
- if (result == null) return null;
- if (end > start) result.write(text.substring(start, end));
- return result.toString();
- }
-
- StringConversionSink startChunkedConversion(Sink<String> sink) {
- if (sink is! StringConversionSink) {
- sink = new StringConversionSink.from(sink);
- }
- return new _HtmlEscapeSink(this, sink);
- }
-}
-
-class _HtmlEscapeSink extends StringConversionSinkBase {
- final HtmlEscape _escape;
- final StringConversionSink _sink;
-
- _HtmlEscapeSink(this._escape, this._sink);
-
- void addSlice(String chunk, int start, int end, bool isLast) {
- var val = _escape._convert(chunk, start, end);
- if(val == null) {
- _sink.addSlice(chunk, start, end, isLast);
- } else {
- _sink.add(val);
- if (isLast) _sink.close();
- }
- }
-
- void close() { _sink.close(); }
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/convert/json.dart b/pkg/dev_compiler/tool/input_sdk/lib/convert/json.dart
deleted file mode 100644
index 24931df..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/convert/json.dart
+++ /dev/null
@@ -1,1064 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-part of dart.convert;
-
-/**
- * Error thrown by JSON serialization if an object cannot be serialized.
- *
- * The [unsupportedObject] field holds that object that failed to be serialized.
- *
- * If an object isn't directly serializable, the serializer calls the `toJson`
- * method on the object. If that call fails, the error will be stored in the
- * [cause] field. If the call returns an object that isn't directly
- * serializable, the [cause] is null.
- */
-class JsonUnsupportedObjectError extends Error {
- /** The object that could not be serialized. */
- final unsupportedObject;
- /** The exception thrown when trying to convert the object. */
- final cause;
-
- JsonUnsupportedObjectError(this.unsupportedObject, { this.cause });
-
- String toString() {
- if (cause != null) {
- return "Converting object to an encodable object failed.";
- } else {
- return "Converting object did not return an encodable object.";
- }
- }
-}
-
-
-/**
- * Reports that an object could not be stringified due to cyclic references.
- *
- * An object that references itself cannot be serialized by [stringify].
- * When the cycle is detected, a [JsonCyclicError] is thrown.
- */
-class JsonCyclicError extends JsonUnsupportedObjectError {
- /** The first object that was detected as part of a cycle. */
- JsonCyclicError(Object object): super(object);
- String toString() => "Cyclic error in JSON stringify";
-}
-
-
-/**
- * An instance of the default implementation of the [JsonCodec].
- *
- * This instance provides a convenient access to the most common JSON
- * use cases.
- *
- * Examples:
- *
- * var encoded = JSON.encode([1, 2, { "a": null }]);
- * var decoded = JSON.decode('["foo", { "bar": 499 }]');
- */
-const JsonCodec JSON = const JsonCodec();
-
-typedef _Reviver(var key, var value);
-typedef _ToEncodable(var o);
-
-
-/**
- * A [JsonCodec] encodes JSON objects to strings and decodes strings to
- * JSON objects.
- *
- * Examples:
- *
- * var encoded = JSON.encode([1, 2, { "a": null }]);
- * var decoded = JSON.decode('["foo", { "bar": 499 }]');
- */
-class JsonCodec extends Codec<Object, String> {
- final _Reviver _reviver;
- final _ToEncodable _toEncodable;
-
- /**
- * Creates a `JsonCodec` with the given reviver and encoding function.
- *
- * The [reviver] function is called during decoding. It is invoked once for
- * each object or list property that has been parsed.
- * The `key` argument is either the integer list index for a list property,
- * the string map key for object properties, or `null` for the final result.
- *
- * If [reviver] is omitted, it defaults to returning the value argument.
- *
- * The [toEncodable] function is used during encoding. It is invoked for
- * values that are not directly encodable to a string (a value that is not a
- * number, boolean, string, null, list or a map with string keys). The
- * function must return an object that is directly encodable. The elements of
- * a returned list and values of a returned map do not need to be directly
- * encodable, and if they aren't, `toEncodable` will be used on them as well.
- * Please notice that it is possible to cause an infinite recursive regress
- * in this way, by effectively creating an infinite data structure through
- * repeated call to `toEncodable`.
- *
- * If [toEncodable] is omitted, it defaults to a function that returns the
- * result of calling `.toJson()` on the unencodable object.
- */
- const JsonCodec({reviver(var key, var value), toEncodable(var object)})
- : _reviver = reviver,
- _toEncodable = toEncodable;
-
- /**
- * Creates a `JsonCodec` with the given reviver.
- *
- * The [reviver] function is called once for each object or list property
- * that has been parsed during decoding. The `key` argument is either the
- * integer list index for a list property, the string map key for object
- * properties, or `null` for the final result.
- */
- JsonCodec.withReviver(reviver(var key, var value)) : this(reviver: reviver);
-
- /**
- * Parses the string and returns the resulting Json object.
- *
- * The optional [reviver] function is called once for each object or list
- * property that has been parsed during decoding. The `key` argument is either
- * the integer list index for a list property, the string map key for object
- * properties, or `null` for the final result.
- *
- * The default [reviver] (when not provided) is the identity function.
- */
- dynamic decode(String source, {reviver(var key, var value)}) {
- if (reviver == null) reviver = _reviver;
- if (reviver == null) return decoder.convert(source);
- return new JsonDecoder(reviver).convert(source);
- }
-
- /**
- * Converts [value] to a JSON string.
- *
- * If value contains objects that are not directly encodable to a JSON
- * string (a value that is not a number, boolean, string, null, list or a map
- * with string keys), the [toEncodable] function is used to convert it to an
- * object that must be directly encodable.
- *
- * If [toEncodable] is omitted, it defaults to a function that returns the
- * result of calling `.toJson()` on the unencodable object.
- */
- String encode(Object value, {toEncodable(object)}) {
- if (toEncodable == null) toEncodable = _toEncodable;
- if (toEncodable == null) return encoder.convert(value);
- return new JsonEncoder(toEncodable).convert(value);
- }
-
- JsonEncoder get encoder {
- if (_toEncodable == null) return const JsonEncoder();
- return new JsonEncoder(_toEncodable);
- }
-
- JsonDecoder get decoder {
- if (_reviver == null) return const JsonDecoder();
- return new JsonDecoder(_reviver);
- }
-}
-
-/**
- * This class converts JSON objects to strings.
- */
-class JsonEncoder extends Converter<Object, String> {
- /**
- * The string used for indention.
- *
- * When generating multi-line output, this string is inserted once at the
- * beginning of each indented line for each level of indentation.
- *
- * If `null`, the output is encoded as a single line.
- */
- final String indent;
-
- /**
- * Function called on non-encodable objects to return a replacement
- * encodable object that will be encoded in the orignal's place.
- */
- final _ToEncodable _toEncodable;
-
- /**
- * Creates a JSON encoder.
- *
- * The JSON encoder handles numbers, strings, booleans, null, lists and
- * maps directly.
- *
- * Any other object is attempted converted by [toEncodable] to an
- * object that is of one of the convertible types.
- *
- * If [toEncodable] is omitted, it defaults to calling `.toJson()` on
- * the object.
- */
- const JsonEncoder([toEncodable(nonSerializable)])
- : this.indent = null,
- this._toEncodable = toEncodable;
-
- /**
- * Creates a JSON encoder that creates multi-line JSON.
- *
- * The encoding of elements of lists and maps are indented and put on separate
- * lines. The [indent] string is prepended to these elements, once for each
- * level of indentation.
- *
- * If [indent] is `null`, the output is encoded as a single line.
- *
- * The JSON encoder handles numbers, strings, booleans, null, lists and
- * maps directly.
- *
- * Any other object is attempted converted by [toEncodable] to an
- * object that is of one of the convertible types.
- *
- * If [toEncodable] is omitted, it defaults to calling `.toJson()` on
- * the object.
- */
- const JsonEncoder.withIndent(this.indent, [toEncodable(nonSerializable)])
- : this._toEncodable = toEncodable;
-
- /**
- * Converts [object] to a JSON [String].
- *
- * Directly serializable values are [num], [String], [bool], and [Null], as
- * well as some [List] and [Map] values. For [List], the elements must all be
- * serializable. For [Map], the keys must be [String] and the values must be
- * serializable.
- *
- * If a value of any other type is attempted to be serialized, the
- * `toEncodable` function provided in the constructor is called with the value
- * as argument. The result, which must be a directly serializable value, is
- * serialized instead of the original value.
- *
- * If the conversion throws, or returns a value that is not directly
- * serializable, a [JsonUnsupportedObjectError] exception is thrown.
- * If the call throws, the error is caught and stored in the
- * [JsonUnsupportedObjectError]'s [:cause:] field.
- *
- * If a [List] or [Map] contains a reference to itself, directly or through
- * other lists or maps, it cannot be serialized and a [JsonCyclicError] is
- * thrown.
- *
- * [object] should not change during serialization.
- *
- * If an object is serialized more than once, [convert] may cache the text
- * for it. In other words, if the content of an object changes after it is
- * first serialized, the new values may not be reflected in the result.
- */
- String convert(Object object) =>
- _JsonStringStringifier.stringify(object, _toEncodable, indent);
-
- /**
- * Starts a chunked conversion.
- *
- * The converter works more efficiently if the given [sink] is a
- * [StringConversionSink].
- *
- * Returns a chunked-conversion sink that accepts at most one object. It is
- * an error to invoke `add` more than once on the returned sink.
- */
- ChunkedConversionSink<Object> startChunkedConversion(Sink<String> sink) {
- if (sink is! StringConversionSink) {
- sink = new StringConversionSink.from(sink);
- } else if (sink is _Utf8EncoderSink) {
- return new _JsonUtf8EncoderSink(sink._sink, _toEncodable,
- JsonUtf8Encoder._utf8Encode(indent),
- JsonUtf8Encoder.DEFAULT_BUFFER_SIZE);
- }
- return new _JsonEncoderSink(sink, _toEncodable, indent);
- }
-
- // Override the base class's bind, to provide a better type.
- Stream<String> bind(Stream<Object> stream) => super.bind(stream);
-
- Converter<Object, dynamic/*=T*/> fuse/*<T>*/(
- Converter<String, dynamic/*=T*/> other) {
- if (other is Utf8Encoder) {
- return new JsonUtf8Encoder(indent, _toEncodable)
- as dynamic/*=Converter<Object, T>*/;
- }
- return super.fuse/*<T>*/(other);
- }
-}
-
-/**
- * Encoder that encodes a single object as a UTF-8 encoded JSON string.
- *
- * This encoder works equivalently to first converting the object to
- * a JSON string, and then UTF-8 encoding the string, but without
- * creating an intermediate string.
- */
-class JsonUtf8Encoder extends Converter<Object, List<int>> {
- /** Default buffer size used by the JSON-to-UTF-8 encoder. */
- static const int DEFAULT_BUFFER_SIZE = 256;
- /** Indentation used in pretty-print mode, `null` if not pretty. */
- final List<int> _indent;
- /** Function called with each un-encodable object encountered. */
- final _ToEncodable _toEncodable;
- /** UTF-8 buffer size. */
- final int _bufferSize;
-
- /**
- * Create converter.
- *
- * If [indent] is non-`null`, the converter attempts to "pretty-print" the
- * JSON, and uses `indent` as the indentation. Otherwise the result has no
- * whitespace outside of string literals.
- * If `indent` contains characters that are not valid JSON whitespace
- * characters, the result will not be valid JSON. JSON whitespace characters
- * are space (U+0020), tab (U+0009), line feed (U+000a) and carriage return
- * (U+000d) ([ECMA
- * 404](http://www.ecma-international.org/publications/standards/Ecma-404.htm)).
- *
- * The [bufferSize] is the size of the internal buffers used to collect
- * UTF-8 code units.
- * If using [startChunkedConversion], it will be the size of the chunks.
- *
- * The JSON encoder handles numbers, strings, booleans, null, lists and maps
- * directly.
- *
- * Any other object is attempted converted by [toEncodable] to an object that
- * is of one of the convertible types.
- *
- * If [toEncodable] is omitted, it defaults to calling `.toJson()` on the
- * object.
- */
- JsonUtf8Encoder([String indent,
- toEncodable(object),
- int bufferSize = DEFAULT_BUFFER_SIZE])
- : _indent = _utf8Encode(indent),
- _toEncodable = toEncodable,
- _bufferSize = bufferSize;
-
- static List<int> _utf8Encode(String string) {
- if (string == null) return null;
- if (string.isEmpty) return new Uint8List(0);
- checkAscii: {
- for (int i = 0; i < string.length; i++) {
- if (string.codeUnitAt(i) >= 0x80) break checkAscii;
- }
- return string.codeUnits;
- }
- return UTF8.encode(string);
- }
-
- /** Convert [object] into UTF-8 encoded JSON. */
- List<int> convert(Object object) {
- List<List<int>> bytes = [];
- // The `stringify` function always converts into chunks.
- // Collect the chunks into the `bytes` list, then combine them afterwards.
- void addChunk(Uint8List chunk, int start, int end) {
- if (start > 0 || end < chunk.length) {
- int length = end - start;
- chunk = new Uint8List.view(chunk.buffer,
- chunk.offsetInBytes + start,
- length);
- }
- bytes.add(chunk);
- }
- _JsonUtf8Stringifier.stringify(object,
- _indent,
- _toEncodable,
- _bufferSize,
- addChunk);
- if (bytes.length == 1) return bytes[0];
- int length = 0;
- for (int i = 0; i < bytes.length; i++) {
- length += bytes[i].length;
- }
- Uint8List result = new Uint8List(length);
- for (int i = 0, offset = 0; i < bytes.length; i++) {
- var byteList = bytes[i];
- int end = offset + byteList.length;
- result.setRange(offset, end, byteList);
- offset = end;
- }
- return result;
- }
-
- /**
- * Start a chunked conversion.
- *
- * Only one object can be passed into the returned sink.
- *
- * The argument [sink] will receive byte lists in sizes depending on the
- * `bufferSize` passed to the constructor when creating this encoder.
- */
- ChunkedConversionSink<Object> startChunkedConversion(Sink<List<int>> sink) {
- ByteConversionSink byteSink;
- if (sink is ByteConversionSink) {
- byteSink = sink;
- } else {
- byteSink = new ByteConversionSink.from(sink);
- }
- return new _JsonUtf8EncoderSink(byteSink, _toEncodable,
- _indent, _bufferSize);
- }
-
- // Override the base class's bind, to provide a better type.
- Stream<List<int>> bind(Stream<Object> stream) {
- return super.bind(stream);
- }
-}
-
-/**
- * Implements the chunked conversion from object to its JSON representation.
- *
- * The sink only accepts one value, but will produce output in a chunked way.
- */
-class _JsonEncoderSink extends ChunkedConversionSink<Object> {
- final String _indent;
- final _ToEncodable _toEncodable;
- final StringConversionSink _sink;
- bool _isDone = false;
-
- _JsonEncoderSink(this._sink, this._toEncodable, this._indent);
-
- /**
- * Encodes the given object [o].
- *
- * It is an error to invoke this method more than once on any instance. While
- * this makes the input effectly non-chunked the output will be generated in
- * a chunked way.
- */
- void add(Object o) {
- if (_isDone) {
- throw new StateError("Only one call to add allowed");
- }
- _isDone = true;
- ClosableStringSink stringSink = _sink.asStringSink();
- _JsonStringStringifier.printOn(o, stringSink, _toEncodable, _indent);
- stringSink.close();
- }
-
- void close() { /* do nothing */ }
-}
-
-/**
- * Sink returned when starting a chunked conversion from object to bytes.
- */
-class _JsonUtf8EncoderSink extends ChunkedConversionSink<Object> {
- /** The byte sink receiveing the encoded chunks. */
- final ByteConversionSink _sink;
- final List<int> _indent;
- final _ToEncodable _toEncodable;
- final int _bufferSize;
- bool _isDone = false;
- _JsonUtf8EncoderSink(this._sink, this._toEncodable, this._indent,
- this._bufferSize);
-
- /** Callback called for each slice of result bytes. */
- void _addChunk(Uint8List chunk, int start, int end) {
- _sink.addSlice(chunk, start, end, false);
- }
-
- void add(Object object) {
- if (_isDone) {
- throw new StateError("Only one call to add allowed");
- }
- _isDone = true;
- _JsonUtf8Stringifier.stringify(object, _indent, _toEncodable,
- _bufferSize,
- _addChunk);
- _sink.close();
- }
-
- void close() {
- if (!_isDone) {
- _isDone = true;
- _sink.close();
- }
- }
-}
-
-/**
- * This class parses JSON strings and builds the corresponding objects.
- */
-class JsonDecoder extends Converter<String, Object> {
- final _Reviver _reviver;
- /**
- * Constructs a new JsonDecoder.
- *
- * The [reviver] may be `null`.
- */
- const JsonDecoder([reviver(var key, var value)]) : this._reviver = reviver;
-
- /**
- * Converts the given JSON-string [input] to its corresponding object.
- *
- * Parsed JSON values are of the types [num], [String], [bool], [Null],
- * [List]s of parsed JSON values or [Map]s from [String] to parsed JSON
- * values.
- *
- * If `this` was initialized with a reviver, then the parsing operation
- * invokes the reviver on every object or list property that has been parsed.
- * The arguments are the property name ([String]) or list index ([int]), and
- * the value is the parsed value. The return value of the reviver is used as
- * the value of that property instead the parsed value.
- *
- * Throws [FormatException] if the input is not valid JSON text.
- */
- dynamic convert(String input) => _parseJson(input, _reviver);
-
- /**
- * Starts a conversion from a chunked JSON string to its corresponding object.
- *
- * The output [sink] receives exactly one decoded element through `add`.
- */
- external StringConversionSink startChunkedConversion(Sink<Object> sink);
-
- // Override the base class's bind, to provide a better type.
- Stream<Object> bind(Stream<String> stream) => super.bind(stream);
-}
-
-// Internal optimized JSON parsing implementation.
-external _parseJson(String source, reviver(key, value));
-
-
-// Implementation of encoder/stringifier.
-
-dynamic _defaultToEncodable(dynamic object) => object.toJson();
-
-/**
- * JSON encoder that traverses an object structure and writes JSON source.
- *
- * This is an abstract implementation that doesn't decide on the output
- * format, but writes the JSON through abstract methods like [writeString].
- */
-abstract class _JsonStringifier {
- // Character code constants.
- static const int BACKSPACE = 0x08;
- static const int TAB = 0x09;
- static const int NEWLINE = 0x0a;
- static const int CARRIAGE_RETURN = 0x0d;
- static const int FORM_FEED = 0x0c;
- static const int QUOTE = 0x22;
- static const int CHAR_0 = 0x30;
- static const int BACKSLASH = 0x5c;
- static const int CHAR_b = 0x62;
- static const int CHAR_f = 0x66;
- static const int CHAR_n = 0x6e;
- static const int CHAR_r = 0x72;
- static const int CHAR_t = 0x74;
- static const int CHAR_u = 0x75;
-
- /** List of objects currently being traversed. Used to detect cycles. */
- final List _seen = new List();
- /** Function called for each un-encodable object encountered. */
- final _ToEncodable _toEncodable;
-
- _JsonStringifier(toEncodable(o))
- : _toEncodable = toEncodable ?? _defaultToEncodable;
-
- /** Append a string to the JSON output. */
- void writeString(String characters);
- /** Append part of a string to the JSON output. */
- void writeStringSlice(String characters, int start, int end);
- /** Append a single character, given by its code point, to the JSON output. */
- void writeCharCode(int charCode);
- /** Write a number to the JSON output. */
- void writeNumber(num number);
-
- // ('0' + x) or ('a' + x - 10)
- static int hexDigit(int x) => x < 10 ? 48 + x : 87 + x;
-
- /**
- * Write, and suitably escape, a string's content as a JSON string literal.
- */
- void writeStringContent(String s) {
- int offset = 0;
- final int length = s.length;
- for (int i = 0; i < length; i++) {
- int charCode = s.codeUnitAt(i);
- if (charCode > BACKSLASH) continue;
- if (charCode < 32) {
- if (i > offset) writeStringSlice(s, offset, i);
- offset = i + 1;
- writeCharCode(BACKSLASH);
- switch (charCode) {
- case BACKSPACE:
- writeCharCode(CHAR_b);
- break;
- case TAB:
- writeCharCode(CHAR_t);
- break;
- case NEWLINE:
- writeCharCode(CHAR_n);
- break;
- case FORM_FEED:
- writeCharCode(CHAR_f);
- break;
- case CARRIAGE_RETURN:
- writeCharCode(CHAR_r);
- break;
- default:
- writeCharCode(CHAR_u);
- writeCharCode(CHAR_0);
- writeCharCode(CHAR_0);
- writeCharCode(hexDigit((charCode >> 4) & 0xf));
- writeCharCode(hexDigit(charCode & 0xf));
- break;
- }
- } else if (charCode == QUOTE || charCode == BACKSLASH) {
- if (i > offset) writeStringSlice(s, offset, i);
- offset = i + 1;
- writeCharCode(BACKSLASH);
- writeCharCode(charCode);
- }
- }
- if (offset == 0) {
- writeString(s);
- } else if (offset < length) {
- writeStringSlice(s, offset, length);
- }
- }
-
- /**
- * Check if an encountered object is already being traversed.
- *
- * Records the object if it isn't already seen. Should have a matching call to
- * [_removeSeen] when the object is no longer being traversed.
- */
- void _checkCycle(object) {
- for (int i = 0; i < _seen.length; i++) {
- if (identical(object, _seen[i])) {
- throw new JsonCyclicError(object);
- }
- }
- _seen.add(object);
- }
-
- /**
- * Remove [object] from the list of currently traversed objects.
- *
- * Should be called in the opposite order of the matching [_checkCycle]
- * calls.
- */
- void _removeSeen(object) {
- assert(!_seen.isEmpty);
- assert(identical(_seen.last, object));
- _seen.removeLast();
- }
-
- /**
- * Write an object.
- *
- * If [object] isn't directly encodable, the [_toEncodable] function gets one
- * chance to return a replacement which is encodable.
- */
- void writeObject(object) {
- // Tries stringifying object directly. If it's not a simple value, List or
- // Map, call toJson() to get a custom representation and try serializing
- // that.
- if (writeJsonValue(object)) return;
- _checkCycle(object);
- try {
- var customJson = _toEncodable(object);
- if (!writeJsonValue(customJson)) {
- throw new JsonUnsupportedObjectError(object);
- }
- _removeSeen(object);
- } catch (e) {
- throw new JsonUnsupportedObjectError(object, cause: e);
- }
- }
-
- /**
- * Serialize a [num], [String], [bool], [Null], [List] or [Map] value.
- *
- * Returns true if the value is one of these types, and false if not.
- * If a value is both a [List] and a [Map], it's serialized as a [List].
- */
- bool writeJsonValue(object) {
- if (object is num) {
- if (!object.isFinite) return false;
- writeNumber(object);
- return true;
- } else if (identical(object, true)) {
- writeString('true');
- return true;
- } else if (identical(object, false)) {
- writeString('false');
- return true;
- } else if (object == null) {
- writeString('null');
- return true;
- } else if (object is String) {
- writeString('"');
- writeStringContent(object);
- writeString('"');
- return true;
- } else if (object is List) {
- _checkCycle(object);
- writeList(object);
- _removeSeen(object);
- return true;
- } else if (object is Map) {
- _checkCycle(object);
- // writeMap can fail if keys are not all strings.
- var success = writeMap(object);
- _removeSeen(object);
- return success;
- } else {
- return false;
- }
- }
-
- /** Serialize a [List]. */
- void writeList(List list) {
- writeString('[');
- if (list.length > 0) {
- writeObject(list[0]);
- for (int i = 1; i < list.length; i++) {
- writeString(',');
- writeObject(list[i]);
- }
- }
- writeString(']');
- }
-
- /** Serialize a [Map]. */
- bool writeMap(Map map) {
- if (map.isEmpty) {
- writeString("{}");
- return true;
- }
- List keyValueList = new List(map.length * 2);
- int i = 0;
- bool allStringKeys = true;
- map.forEach((key, value) {
- if (key is! String) {
- allStringKeys = false;
- }
- keyValueList[i++] = key;
- keyValueList[i++] = value;
- });
- if (!allStringKeys) return false;
- writeString('{');
- String separator = '"';
- for (int i = 0; i < keyValueList.length; i += 2) {
- writeString(separator);
- separator = ',"';
- writeStringContent(keyValueList[i]);
- writeString('":');
- writeObject(keyValueList[i + 1]);
- }
- writeString('}');
- return true;
- }
-}
-
-/**
- * A modification of [_JsonStringifier] which indents the contents of [List] and
- * [Map] objects using the specified indent value.
- *
- * Subclasses should implement [writeIndentation].
- */
-abstract class _JsonPrettyPrintMixin implements _JsonStringifier {
- int _indentLevel = 0;
-
- /**
- * Add [indentLevel] indentations to the JSON output.
- */
- void writeIndentation(int indentLevel);
-
- void writeList(List list) {
- if (list.isEmpty) {
- writeString('[]');
- } else {
- writeString('[\n');
- _indentLevel++;
- writeIndentation(_indentLevel);
- writeObject(list[0]);
- for (int i = 1; i < list.length; i++) {
- writeString(',\n');
- writeIndentation(_indentLevel);
- writeObject(list[i]);
- }
- writeString('\n');
- _indentLevel--;
- writeIndentation(_indentLevel);
- writeString(']');
- }
- }
-
- bool writeMap(Map map) {
- if (map.isEmpty) {
- writeString("{}");
- return true;
- }
- List keyValueList = new List(map.length * 2);
- int i = 0;
- bool allStringKeys = true;
- map.forEach((key, value) {
- if (key is! String) {
- allStringKeys = false;
- }
- keyValueList[i++] = key;
- keyValueList[i++] = value;
- });
- if (!allStringKeys) return false;
- writeString('{\n');
- _indentLevel++;
- String separator = "";
- for (int i = 0; i < keyValueList.length; i += 2) {
- writeString(separator);
- separator = ",\n";
- writeIndentation(_indentLevel);
- writeString('"');
- writeStringContent(keyValueList[i]);
- writeString('": ');
- writeObject(keyValueList[i + 1]);
- }
- writeString('\n');
- _indentLevel--;
- writeIndentation(_indentLevel);
- writeString('}');
- return true;
- }
-}
-
-/**
- * A specialziation of [_JsonStringifier] that writes its JSON to a string.
- */
-class _JsonStringStringifier extends _JsonStringifier {
- final StringSink _sink;
-
- _JsonStringStringifier(this._sink, _toEncodable) : super(_toEncodable);
-
- /**
- * Convert object to a string.
- *
- * The [toEncodable] function is used to convert non-encodable objects
- * to encodable ones.
- *
- * If [indent] is not `null`, the resulting JSON will be "pretty-printed"
- * with newlines and indentation. The `indent` string is added as indentation
- * for each indentation level. It should only contain valid JSON whitespace
- * characters (space, tab, carriage return or line feed).
- */
- static String stringify(object, toEncodable(o), String indent) {
- StringBuffer output = new StringBuffer();
- printOn(object, output, toEncodable, indent);
- return output.toString();
- }
-
- /**
- * Convert object to a string, and write the result to the [output] sink.
- *
- * The result is written piecemally to the sink.
- */
- static void printOn(
- object, StringSink output, toEncodable(o), String indent) {
- var stringifier;
- if (indent == null) {
- stringifier = new _JsonStringStringifier(output, toEncodable);
- } else {
- stringifier =
- new _JsonStringStringifierPretty(output, toEncodable, indent);
- }
- stringifier.writeObject(object);
- }
-
- void writeNumber(num number) {
- _sink.write(number.toString());
- }
- void writeString(String string) {
- _sink.write(string);
- }
- void writeStringSlice(String string, int start, int end) {
- _sink.write(string.substring(start, end));
- }
- void writeCharCode(int charCode) {
- _sink.writeCharCode(charCode);
- }
-}
-
-class _JsonStringStringifierPretty extends _JsonStringStringifier
- with _JsonPrettyPrintMixin {
- final String _indent;
-
- _JsonStringStringifierPretty(StringSink sink, toEncodable(o), this._indent)
- : super(sink, toEncodable);
-
- void writeIndentation(int count) {
- for (int i = 0; i < count; i++) writeString(_indent);
- }
-}
-
-typedef void _AddChunk(Uint8List list, int start, int end);
-
-/**
- * Specialization of [_JsonStringifier] that writes the JSON as UTF-8.
- *
- * The JSON text is UTF-8 encoded and written to [Uint8List] buffers.
- * The buffers are then passed back to a user provided callback method.
- */
-class _JsonUtf8Stringifier extends _JsonStringifier {
- final int bufferSize;
- final _AddChunk addChunk;
- Uint8List buffer;
- int index = 0;
-
- _JsonUtf8Stringifier(toEncodable(o), int bufferSize, this.addChunk)
- : this.bufferSize = bufferSize,
- buffer = new Uint8List(bufferSize),
- super(toEncodable);
-
- /**
- * Convert [object] to UTF-8 encoded JSON.
- *
- * Calls [addChunk] with slices of UTF-8 code units.
- * These will typically have size [bufferSize], but may be shorter.
- * The buffers are not reused, so the [addChunk] call may keep and reuse the
- * chunks.
- *
- * If [indent] is non-`null`, the result will be "pretty-printed" with extra
- * newlines and indentation, using [indent] as the indentation.
- */
- static void stringify(Object object,
- List<int> indent,
- toEncodable(o),
- int bufferSize,
- void addChunk(Uint8List chunk, int start, int end)) {
- _JsonUtf8Stringifier stringifier;
- if (indent != null) {
- stringifier = new _JsonUtf8StringifierPretty(toEncodable, indent,
- bufferSize, addChunk);
- } else {
- stringifier = new _JsonUtf8Stringifier(toEncodable, bufferSize, addChunk);
- }
- stringifier.writeObject(object);
- stringifier.flush();
- }
-
- /**
- * Must be called at the end to push the last chunk to the [addChunk]
- * callback.
- */
- void flush() {
- if (index > 0) {
- addChunk(buffer, 0, index);
- }
- buffer = null;
- index = 0;
- }
-
- void writeNumber(num number) {
- writeAsciiString(number.toString());
- }
-
- /** Write a string that is known to not have non-ASCII characters. */
- void writeAsciiString(String string) {
- // TODO(lrn): Optimize by copying directly into buffer instead of going
- // through writeCharCode;
- for (int i = 0; i < string.length; i++) {
- int char = string.codeUnitAt(i);
- assert(char <= 0x7f);
- writeByte(char);
- }
- }
-
- void writeString(String string) {
- writeStringSlice(string, 0, string.length);
- }
-
- void writeStringSlice(String string, int start, int end) {
- // TODO(lrn): Optimize by copying directly into buffer instead of going
- // through writeCharCode/writeByte. Assumption is the most characters
- // in starings are plain ASCII.
- for (int i = start; i < end; i++) {
- int char = string.codeUnitAt(i);
- if (char <= 0x7f) {
- writeByte(char);
- } else {
- if ((char & 0xFC00) == 0xD800 && i + 1 < end) {
- // Lead surrogate.
- int nextChar = string.codeUnitAt(i + 1);
- if ((nextChar & 0xFC00) == 0xDC00) {
- // Tail surrogate.
- char = 0x10000 + ((char & 0x3ff) << 10) + (nextChar & 0x3ff);
- writeFourByteCharCode(char);
- i++;
- continue;
- }
- }
- writeMultiByteCharCode(char);
- }
- }
- }
-
- void writeCharCode(int charCode) {
- if (charCode <= 0x7f) {
- writeByte(charCode);
- return;
- }
- writeMultiByteCharCode(charCode);
- }
-
- void writeMultiByteCharCode(int charCode) {
- if (charCode <= 0x7ff) {
- writeByte(0xC0 | (charCode >> 6));
- writeByte(0x80 | (charCode & 0x3f));
- return;
- }
- if (charCode <= 0xffff) {
- writeByte(0xE0 | (charCode >> 12));
- writeByte(0x80 | ((charCode >> 6) & 0x3f));
- writeByte(0x80 | (charCode & 0x3f));
- return;
- }
- writeFourByteCharCode(charCode);
- }
-
- void writeFourByteCharCode(int charCode) {
- assert(charCode <= 0x10ffff);
- writeByte(0xF0 | (charCode >> 18));
- writeByte(0x80 | ((charCode >> 12) & 0x3f));
- writeByte(0x80 | ((charCode >> 6) & 0x3f));
- writeByte(0x80 | (charCode & 0x3f));
- }
-
- void writeByte(int byte) {
- assert(byte <= 0xff);
- if (index == buffer.length) {
- addChunk(buffer, 0, index);
- buffer = new Uint8List(bufferSize);
- index = 0;
- }
- buffer[index++] = byte;
- }
-}
-
-/**
- * Pretty-printing version of [_JsonUtf8Stringifier].
- */
-class _JsonUtf8StringifierPretty extends _JsonUtf8Stringifier
- with _JsonPrettyPrintMixin {
- final List<int> indent;
- _JsonUtf8StringifierPretty(
- toEncodable(o), this.indent,
- bufferSize, void addChunk(Uint8List buffer, int start, int end))
- : super(toEncodable, bufferSize, addChunk);
-
- void writeIndentation(int count) {
- List<int> indent = this.indent;
- int indentLength = indent.length;
- if (indentLength == 1) {
- int char = indent[0];
- while (count > 0) {
- writeByte(char);
- count -= 1;
- }
- return;
- }
- while (count > 0) {
- count--;
- int end = index + indentLength;
- if (end <= buffer.length) {
- buffer.setRange(index, end, indent);
- index = end;
- } else {
- for (int i = 0; i < indentLength; i++) {
- writeByte(indent[i]);
- }
- }
- }
- }
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/convert/latin1.dart b/pkg/dev_compiler/tool/input_sdk/lib/convert/latin1.dart
deleted file mode 100644
index 1d8546d..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/convert/latin1.dart
+++ /dev/null
@@ -1,194 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-part of dart.convert;
-
-/**
- * An instance of the default implementation of the [Latin1Codec].
- *
- * This instance provides a convenient access to the most common ISO Latin 1
- * use cases.
- *
- * Examples:
- *
- * var encoded = LATIN1.encode("blåbærgrød");
- * var decoded = LATIN1.decode([0x62, 0x6c, 0xe5, 0x62, 0xe6,
- * 0x72, 0x67, 0x72, 0xf8, 0x64]);
- */
-const Latin1Codec LATIN1 = const Latin1Codec();
-
-const int _LATIN1_MASK = 0xFF;
-
-/**
- * A [LatinCodec] encodes strings to ISO Latin-1 (aka ISO-8859-1) bytes
- * and decodes Latin-1 bytes to strings.
- */
-class Latin1Codec extends Encoding {
- final bool _allowInvalid;
- /**
- * Instantiates a new [Latin1Codec].
- *
- * If [allowInvalid] is true, the [decode] method and the converter
- * returned by [decoder] will default to allowing invalid values. Invalid
- * values are decoded into the Unicode Replacement character (U+FFFD).
- * Calls to the [decode] method can override this default.
- *
- * Encoders will not accept invalid (non Latin-1) characters.
- */
- const Latin1Codec({bool allowInvalid: false}) : _allowInvalid = allowInvalid;
-
- String get name => "iso-8859-1";
-
- /**
- * Decodes the Latin-1 [bytes] (a list of unsigned 8-bit integers) to the
- * corresponding string.
- *
- * If [bytes] contains values that are not in the range 0 .. 255, the decoder
- * will eventually throw a [FormatException].
- *
- * If [allowInvalid] is not provided, it defaults to the value used to create
- * this [Latin1Codec].
- */
- String decode(List<int> bytes, { bool allowInvalid }) {
- if (allowInvalid == null) allowInvalid = _allowInvalid;
- if (allowInvalid) {
- return const Latin1Decoder(allowInvalid: true).convert(bytes);
- } else {
- return const Latin1Decoder(allowInvalid: false).convert(bytes);
- }
- }
-
- Latin1Encoder get encoder => const Latin1Encoder();
-
- Latin1Decoder get decoder =>
- _allowInvalid ? const Latin1Decoder(allowInvalid: true)
- : const Latin1Decoder(allowInvalid: false);
-}
-
-/**
- * This class converts strings of only ISO Latin-1 characters to bytes.
- */
-class Latin1Encoder extends _UnicodeSubsetEncoder {
- const Latin1Encoder() : super(_LATIN1_MASK);
-}
-
-/**
- * This class converts Latin-1 bytes (lists of unsigned 8-bit integers)
- * to a string.
- */
-class Latin1Decoder extends _UnicodeSubsetDecoder {
- /**
- * Instantiates a new [Latin1Decoder].
- *
- * The optional [allowInvalid] argument defines how [convert] deals
- * with invalid bytes.
- *
- * If it is `true`, [convert] replaces invalid bytes with the Unicode
- * Replacement character `U+FFFD` (�).
- * Otherwise it throws a [FormatException].
- */
- const Latin1Decoder({ bool allowInvalid: false })
- : super(allowInvalid, _LATIN1_MASK);
-
- /**
- * Starts a chunked conversion.
- *
- * The converter works more efficiently if the given [sink] is a
- * [StringConversionSink].
- */
- ByteConversionSink startChunkedConversion(Sink<String> sink) {
- StringConversionSink stringSink;
- if (sink is StringConversionSink) {
- stringSink = sink;
- } else {
- stringSink = new StringConversionSink.from(sink);
- }
- // TODO(lrn): Use stringSink.asUtf16Sink() if it becomes available.
- if (!_allowInvalid) return new _Latin1DecoderSink(stringSink);
- return new _Latin1AllowInvalidDecoderSink(stringSink);
- }
-}
-
-class _Latin1DecoderSink extends ByteConversionSinkBase {
- StringConversionSink _sink;
- _Latin1DecoderSink(this._sink);
-
- void close() {
- _sink.close();
- _sink = null;
- }
-
- void add(List<int> source) {
- addSlice(source, 0, source.length, false);
- }
-
- void _addSliceToSink(List<int> source, int start, int end, bool isLast) {
- // If _sink was a UTF-16 conversion sink, just add the slice directly with
- // _sink.addSlice(source, start, end, isLast).
- // The code below is an moderately stupid workaround until a real
- // solution can be made.
- _sink.add(new String.fromCharCodes(source, start, end));
- if (isLast) close();
- }
-
- void addSlice(List<int> source, int start, int end, bool isLast) {
- end = RangeError.checkValidRange(start, end, source.length);
- if (start == end) return;
- if (source is! Uint8List) {
- // List may contain value outside of the 0..255 range. If so, throw.
- // Technically, we could excuse Uint8ClampedList as well, but it unlikely
- // to be relevant.
- _checkValidLatin1(source, start, end);
- }
- _addSliceToSink(source, start, end, isLast);
- }
-
- static void _checkValidLatin1(List<int> source, int start, int end) {
- int mask = 0;
- for (int i = start; i < end; i++) {
- mask |= source[i];
- }
- if (mask >= 0 && mask <= _LATIN1_MASK) {
- return;
- }
- _reportInvalidLatin1(source, start, end); // Always throws.
- }
-
-
- static void _reportInvalidLatin1(List<int> source, int start, int end) {
- // Find the index of the first non-Latin-1 character code.
- for (int i = start; i < end; i++) {
- int char = source[i];
- if (char < 0 || char > _LATIN1_MASK) {
- throw new FormatException("Source contains non-Latin-1 characters.",
- source, i);
- }
- }
- // Unreachable - we only call the function if the loop above throws.
- assert(false);
- }
-}
-
-class _Latin1AllowInvalidDecoderSink extends _Latin1DecoderSink {
- _Latin1AllowInvalidDecoderSink(StringConversionSink sink): super(sink);
-
- void addSlice(List<int> source, int start, int end, bool isLast) {
- RangeError.checkValidRange(start, end, source.length);
- for (int i = start; i < end; i++) {
- int char = source[i];
- if (char > _LATIN1_MASK || char < 0) {
- if (i > start) _addSliceToSink(source, start, i, false);
- // Add UTF-8 encoding of U+FFFD.
- _addSliceToSink(const[0xFFFD], 0, 1, false);
- start = i + 1;
- }
- }
- if (start < end) {
- _addSliceToSink(source, start, end, isLast);
- }
- if (isLast) {
- close();
- }
- }
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/convert/line_splitter.dart b/pkg/dev_compiler/tool/input_sdk/lib/convert/line_splitter.dart
deleted file mode 100644
index b728d8f..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/convert/line_splitter.dart
+++ /dev/null
@@ -1,179 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-part of dart.convert;
-
-// Character constants.
-const int _LF = 10;
-const int _CR = 13;
-
-/**
- * A [Converter] that splits a [String] into individual lines.
- *
- * A line is terminated by either a CR (U+000D), a LF (U+000A), a
- * CR+LF sequence (DOS line ending),
- * and a final non-empty line can be ended by the end of the string.
- *
- * The returned lines do not contain the line terminators.
- */
-class LineSplitter
- extends Converter<String, List<String>>/*=Object*/
- implements Object/*=StreamTransformer<String, String>*/ {
-
- const LineSplitter();
-
- /// Split [lines] into individual lines.
- ///
- /// If [start] and [end] are provided, only split the contents of
- /// `lines.substring(start, end)`. The [start] and [end] values must
- /// specify a valid sub-range of [lines]
- /// (`0 <= start <= end <= lines.length`).
- static Iterable<String> split(String lines, [int start = 0, int end]) sync* {
- end = RangeError.checkValidRange(start, end, lines.length);
- int sliceStart = start;
- int char = 0;
- for (int i = start; i < end; i++) {
- int previousChar = char;
- char = lines.codeUnitAt(i);
- if (char != _CR) {
- if (char != _LF) continue;
- if (previousChar == _CR) {
- sliceStart = i + 1;
- continue;
- }
- }
- yield lines.substring(sliceStart, i);
- sliceStart = i + 1;
- }
- if (sliceStart < end) {
- yield lines.substring(sliceStart, end);
- }
- }
-
- List<String> convert(String data) {
- List<String> lines = <String>[];
- int end = data.length;
- int sliceStart = 0;
- int char = 0;
- for (int i = 0; i < end; i++) {
- int previousChar = char;
- char = data.codeUnitAt(i);
- if (char != _CR) {
- if (char != _LF) continue;
- if (previousChar == _CR) {
- sliceStart = i + 1;
- continue;
- }
- }
- lines.add(data.substring(sliceStart, i));
- sliceStart = i + 1;
- }
- if (sliceStart < end) {
- lines.add(data.substring(sliceStart, end));
- }
- return lines;
- }
-
- StringConversionSink startChunkedConversion(Sink<String> sink) {
- if (sink is! StringConversionSink) {
- sink = new StringConversionSink.from(sink);
- }
- return new _LineSplitterSink(sink);
- }
-
- Stream/*<String>*/ bind(Stream/*<String>*/ stream) {
- return new Stream<String>.eventTransformed(
- stream,
- (EventSink<String> sink) => new _LineSplitterEventSink(sink));
- }
-}
-
-// TODO(floitsch): deal with utf8.
-class _LineSplitterSink extends StringConversionSinkBase {
- final StringConversionSink _sink;
-
- /// The carry-over from the previous chunk.
- ///
- /// If the previous slice ended in a line without a line terminator,
- /// then the next slice may continue the line.
- String _carry;
-
- /// Whether to skip a leading LF character from the next slice.
- ///
- /// If the previous slice ended on a CR character, a following LF
- /// would be part of the same line termination, and should be ignored.
- ///
- /// Only `true` when [_carry] is `null`.
- bool _skipLeadingLF = false;
-
- _LineSplitterSink(this._sink);
-
- void addSlice(String chunk, int start, int end, bool isLast) {
- end = RangeError.checkValidRange(start, end, chunk.length);
- // If the chunk is empty, it's probably because it's the last one.
- // Handle that here, so we know the range is non-empty below.
- if (start >= end) {
- if (isLast) close();
- return;
- }
- if (_carry != null) {
- assert(!_skipLeadingLF);
- chunk = _carry + chunk.substring(start, end);
- start = 0;
- end = chunk.length;
- _carry = null;
- } else if (_skipLeadingLF) {
- if (chunk.codeUnitAt(start) == _LF) {
- start += 1;
- }
- _skipLeadingLF = false;
- }
- _addLines(chunk, start, end);
- if (isLast) close();
- }
-
- void close() {
- if (_carry != null) {
- _sink.add(_carry);
- _carry = null;
- }
- _sink.close();
- }
-
- void _addLines(String lines, int start, int end) {
- int sliceStart = start;
- int char = 0;
- for (int i = start; i < end; i++) {
- int previousChar = char;
- char = lines.codeUnitAt(i);
- if (char != _CR) {
- if (char != _LF) continue;
- if (previousChar == _CR) {
- sliceStart = i + 1;
- continue;
- }
- }
- _sink.add(lines.substring(sliceStart, i));
- sliceStart = i + 1;
- }
- if (sliceStart < end) {
- _carry = lines.substring(sliceStart, end);
- } else {
- _skipLeadingLF = (char == _CR);
- }
- }
-}
-
-class _LineSplitterEventSink extends _LineSplitterSink
- implements EventSink<String> {
- final EventSink<String> _eventSink;
-
- _LineSplitterEventSink(EventSink<String> eventSink)
- : _eventSink = eventSink,
- super(new StringConversionSink.from(eventSink));
-
- void addError(Object o, [StackTrace stackTrace]) {
- _eventSink.addError(o, stackTrace);
- }
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/convert/string_conversion.dart b/pkg/dev_compiler/tool/input_sdk/lib/convert/string_conversion.dart
deleted file mode 100644
index 6eb27d9..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/convert/string_conversion.dart
+++ /dev/null
@@ -1,342 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-part of dart.convert;
-
-/**
- * This class provides an interface for converters to
- * efficiently transmit String data.
- *
- * Instead of limiting the interface to one non-chunked String it accepts
- * partial strings or can be transformed into a byte sink that
- * accepts UTF-8 code units.
- *
- * This abstract class will likely get more methods over time. Implementers are
- * urged to extend [StringConversionSinkBase] or to mix in
- * [StringConversionSinkMixin], to ensure that their class covers the newly
- * added methods.
- */
-abstract class StringConversionSink extends ChunkedConversionSink<String> {
- StringConversionSink();
- factory StringConversionSink.withCallback(void callback(String accumulated))
- = _StringCallbackSink;
- factory StringConversionSink.from(Sink<String> sink)
- = _StringAdapterSink;
-
- /**
- * Creates a new instance wrapping the given [sink].
- *
- * Every string that is added to the returned instance is forwarded to
- * the [sink]. The instance is allowed to buffer and is not required to
- * forward immediately.
- */
- factory StringConversionSink.fromStringSink(StringSink sink) =
- _StringSinkConversionSink;
-
- /**
- * Adds the next [chunk] to `this`.
- *
- * Adds the substring defined by [start] and [end]-exclusive to `this`.
- *
- * If [isLast] is `true` closes `this`.
- */
- void addSlice(String chunk, int start, int end, bool isLast);
-
- /**
- * Returns `this` as a sink that accepts UTF-8 input.
- *
- * If used, this method must be the first and only call to `this`. It
- * invalidates `this`. All further operations must be performed on the result.
- */
- ByteConversionSink asUtf8Sink(bool allowMalformed);
- // - asRuneSink
- // - asCodeUnitsSink
-
- /**
- * Returns `this` as a [ClosableStringSink].
- *
- * If used, this method must be the first and only call to `this`. It
- * invalidates `this`. All further operations must be performed on the result.
- */
- ClosableStringSink asStringSink();
-}
-
-/**
- * A [ClosableStringSink] extends the [StringSink] interface by adding a
- * `close` method.
- */
-abstract class ClosableStringSink extends StringSink {
- /**
- * Creates a new instance combining a [StringSink] [sink] and a callback
- * [onClose] which is invoked when the returned instance is closed.
- */
- factory ClosableStringSink.fromStringSink(StringSink sink, void onClose())
- = _ClosableStringSink;
-
- /**
- * Closes `this` and flushes any outstanding data.
- */
- void close();
-}
-
-typedef void _StringSinkCloseCallback();
-
-/**
- * This class wraps an existing [StringSink] and invokes a
- * closure when [close] is invoked.
- */
-class _ClosableStringSink implements ClosableStringSink {
- final _StringSinkCloseCallback _callback;
- final StringSink _sink;
-
- _ClosableStringSink(this._sink, this._callback);
-
- void close() { _callback(); }
-
- void writeCharCode(int charCode) { _sink.writeCharCode(charCode); }
- void write(Object o) { _sink.write(o); }
- void writeln([Object o = ""]) { _sink.writeln(o); }
- void writeAll(Iterable objects, [String separator = ""]) {
- _sink.writeAll(objects, separator);
- }
-}
-
-/**
- * This class wraps an existing [StringConversionSink] and exposes a
- * [ClosableStringSink] interface. The wrapped sink only needs to implement
- * `add` and `close`.
- */
-// TODO(floitsch): make this class public?
-class _StringConversionSinkAsStringSinkAdapter implements ClosableStringSink {
- static const _MIN_STRING_SIZE = 16;
-
- StringBuffer _buffer;
- StringConversionSink _chunkedSink;
-
- _StringConversionSinkAsStringSinkAdapter(this._chunkedSink)
- : _buffer = new StringBuffer();
-
- void close() {
- if (_buffer.isNotEmpty) _flush();
- _chunkedSink.close();
- }
-
- void writeCharCode(int charCode) {
- _buffer.writeCharCode(charCode);
- if (_buffer.length > _MIN_STRING_SIZE) _flush();
- }
-
- void write(Object o) {
- if (_buffer.isNotEmpty) _flush();
- _chunkedSink.add(o.toString());
- }
-
- void writeln([Object o = ""]) {
- _buffer.writeln(o);
- if (_buffer.length > _MIN_STRING_SIZE) _flush();
- }
-
- void writeAll(Iterable objects, [String separator = ""]) {
- if (_buffer.isNotEmpty) _flush();
- Iterator iterator = objects.iterator;
- if (!iterator.moveNext()) return;
- if (separator.isEmpty) {
- do {
- _chunkedSink.add(iterator.current.toString());
- } while (iterator.moveNext());
- } else {
- _chunkedSink.add(iterator.current.toString());
- while (iterator.moveNext()) {
- write(separator);
- _chunkedSink.add(iterator.current.toString());
- }
- }
- }
-
- void _flush() {
- String accumulated = _buffer.toString();
- _buffer.clear();
- _chunkedSink.add(accumulated);
- }
-}
-
-/**
- * This class provides a base-class for converters that need to accept String
- * inputs.
- */
-abstract class StringConversionSinkBase extends StringConversionSinkMixin {
-}
-
-/**
- * This class provides a mixin for converters that need to accept String
- * inputs.
- */
-abstract class StringConversionSinkMixin implements StringConversionSink {
-
- void addSlice(String str, int start, int end, bool isLast);
- void close();
-
- void add(String str) { addSlice(str, 0, str.length, false); }
-
- ByteConversionSink asUtf8Sink(bool allowMalformed) {
- return new _Utf8ConversionSink(this, allowMalformed);
- }
-
- ClosableStringSink asStringSink() {
- return new _StringConversionSinkAsStringSinkAdapter(this);
- }
-}
-
-/**
- * This class is a [StringConversionSink] that wraps a [StringSink].
- */
-class _StringSinkConversionSink extends StringConversionSinkBase {
- StringSink _stringSink;
- _StringSinkConversionSink(StringSink this._stringSink);
-
- void close() {}
- void addSlice(String str, int start, int end, bool isLast) {
- if (start != 0 || end != str.length) {
- for (int i = start; i < end; i++) {
- _stringSink.writeCharCode(str.codeUnitAt(i));
- }
- } else {
- _stringSink.write(str);
- }
- if (isLast) close();
- }
-
- void add(String str) { _stringSink.write(str); }
-
- ByteConversionSink asUtf8Sink(bool allowMalformed) {
- return new _Utf8StringSinkAdapter(this, _stringSink, allowMalformed);
- }
-
- ClosableStringSink asStringSink() {
- return new ClosableStringSink.fromStringSink(_stringSink, this.close);
- }
-}
-
-/**
- * This class accumulates all chunks into one string
- * and invokes a callback when the sink is closed.
- *
- * This class can be used to terminate a chunked conversion.
- */
-class _StringCallbackSink extends _StringSinkConversionSink {
- final _ChunkedConversionCallback<String> _callback;
- _StringCallbackSink(this._callback) : super(new StringBuffer());
-
- void close() {
- StringBuffer buffer = _stringSink;
- String accumulated = buffer.toString();
- buffer.clear();
- _callback(accumulated);
- }
-
- ByteConversionSink asUtf8Sink(bool allowMalformed) {
- return new _Utf8StringSinkAdapter(
- this, _stringSink, allowMalformed);
- }
-}
-
-/**
- * This class adapts a simple [ChunkedConversionSink] to a
- * [StringConversionSink].
- *
- * All additional methods of the [StringConversionSink] (compared to the
- * ChunkedConversionSink) are redirected to the `add` method.
- */
-class _StringAdapterSink extends StringConversionSinkBase {
- final Sink<String> _sink;
-
- _StringAdapterSink(this._sink);
-
- void add(String str) { _sink.add(str); }
-
- void addSlice(String str, int start, int end, bool isLast) {
- if (start == 0 && end == str.length) {
- add(str);
- } else {
- add(str.substring(start, end));
- }
- if (isLast) close();
- }
-
- void close() { _sink.close(); }
-}
-
-
-/**
- * Decodes UTF-8 code units and stores them in a [StringSink].
- */
-class _Utf8StringSinkAdapter extends ByteConversionSink {
- final _Utf8Decoder _decoder;
- final Sink _sink;
-
- _Utf8StringSinkAdapter(this._sink,
- StringSink stringSink, bool allowMalformed)
- : _decoder = new _Utf8Decoder(stringSink, allowMalformed);
-
- void close() {
- _decoder.close();
- if(_sink != null) _sink.close();
- }
-
- void add(List<int> chunk) {
- addSlice(chunk, 0, chunk.length, false);
- }
-
- void addSlice(List<int> codeUnits, int startIndex, int endIndex,
- bool isLast) {
- _decoder.convert(codeUnits, startIndex, endIndex);
- if (isLast) close();
- }
-}
-
-/**
- * Decodes UTF-8 code units.
- *
- * Forwards the decoded strings to the given [StringConversionSink].
- */
-// TODO(floitsch): make this class public?
-class _Utf8ConversionSink extends ByteConversionSink {
-
- final _Utf8Decoder _decoder;
- final StringConversionSink _chunkedSink;
- final StringBuffer _buffer;
- _Utf8ConversionSink(StringConversionSink sink, bool allowMalformed)
- : this._(sink, new StringBuffer(), allowMalformed);
-
- _Utf8ConversionSink._(this._chunkedSink, StringBuffer stringBuffer,
- bool allowMalformed)
- : _decoder = new _Utf8Decoder(stringBuffer, allowMalformed),
- _buffer = stringBuffer;
-
- void close() {
- _decoder.close();
- if (_buffer.isNotEmpty) {
- String accumulated = _buffer.toString();
- _buffer.clear();
- _chunkedSink.addSlice(accumulated, 0, accumulated.length, true);
- } else {
- _chunkedSink.close();
- }
- }
-
- void add(List<int> chunk) {
- addSlice(chunk, 0, chunk.length, false);
- }
-
- void addSlice(List<int> chunk, int startIndex, int endIndex, bool isLast) {
- _decoder.convert(chunk, startIndex, endIndex);
- if (_buffer.isNotEmpty) {
- String accumulated = _buffer.toString();
- _chunkedSink.addSlice(accumulated, 0, accumulated.length, isLast);
- _buffer.clear();
- return;
- }
- if (isLast) close();
- }
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/convert/utf.dart b/pkg/dev_compiler/tool/input_sdk/lib/convert/utf.dart
deleted file mode 100644
index 486ab4d..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/convert/utf.dart
+++ /dev/null
@@ -1,572 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-part of dart.convert;
-
-/** The Unicode Replacement character `U+FFFD` (�). */
-const int UNICODE_REPLACEMENT_CHARACTER_RUNE = 0xFFFD;
-
-/** The Unicode Byte Order Marker (BOM) character `U+FEFF`. */
-const int UNICODE_BOM_CHARACTER_RUNE = 0xFEFF;
-
-/**
- * An instance of the default implementation of the [Utf8Codec].
- *
- * This instance provides a convenient access to the most common UTF-8
- * use cases.
- *
- * Examples:
- *
- * var encoded = UTF8.encode("Îñţérñåţîöñåļîžåţîờñ");
- * var decoded = UTF8.decode([0x62, 0x6c, 0xc3, 0xa5, 0x62, 0xc3, 0xa6,
- * 0x72, 0x67, 0x72, 0xc3, 0xb8, 0x64]);
- */
-const Utf8Codec UTF8 = const Utf8Codec();
-
-/**
- * A [Utf8Codec] encodes strings to utf-8 code units (bytes) and decodes
- * UTF-8 code units to strings.
- */
-class Utf8Codec extends Encoding {
- final bool _allowMalformed;
-
- /**
- * Instantiates a new [Utf8Codec].
- *
- * The optional [allowMalformed] argument defines how [decoder] (and [decode])
- * deal with invalid or unterminated character sequences.
- *
- * If it is `true` (and not overridden at the method invocation) [decode] and
- * the [decoder] replace invalid (or unterminated) octet
- * sequences with the Unicode Replacement character `U+FFFD` (�). Otherwise
- * they throw a [FormatException].
- */
- const Utf8Codec({ bool allowMalformed: false })
- : _allowMalformed = allowMalformed;
-
- String get name => "utf-8";
-
- /**
- * Decodes the UTF-8 [codeUnits] (a list of unsigned 8-bit integers) to the
- * corresponding string.
- *
- * If the [codeUnits] start with a leading [UNICODE_BOM_CHARACTER_RUNE] this
- * character is discarded.
- *
- * If [allowMalformed] is `true` the decoder replaces invalid (or
- * unterminated) character sequences with the Unicode Replacement character
- * `U+FFFD` (�). Otherwise it throws a [FormatException].
- *
- * If [allowMalformed] is not given, it defaults to the `allowMalformed` that
- * was used to instantiate `this`.
- */
- String decode(List<int> codeUnits, { bool allowMalformed }) {
- if (allowMalformed == null) allowMalformed = _allowMalformed;
- return new Utf8Decoder(allowMalformed: allowMalformed).convert(codeUnits);
- }
-
- Utf8Encoder get encoder => const Utf8Encoder();
- Utf8Decoder get decoder {
- return new Utf8Decoder(allowMalformed: _allowMalformed);
- }
-}
-
-/**
- * This class converts strings to their UTF-8 code units (a list of
- * unsigned 8-bit integers).
- */
-class Utf8Encoder extends Converter<String, List<int>> {
-
- const Utf8Encoder();
-
- /**
- * Converts [string] to its UTF-8 code units (a list of
- * unsigned 8-bit integers).
- *
- * If [start] and [end] are provided, only the substring
- * `string.substring(start, end)` is converted.
- */
- List<int> convert(String string, [int start = 0, int end]) {
- int stringLength = string.length;
- RangeError.checkValidRange(start, end, stringLength);
- if (end == null) end = stringLength;
- int length = end - start;
- if (length == 0) return new Uint8List(0);
- // Create a new encoder with a length that is guaranteed to be big enough.
- // A single code unit uses at most 3 bytes, a surrogate pair at most 4.
- _Utf8Encoder encoder = new _Utf8Encoder.withBufferSize(length * 3);
- int endPosition = encoder._fillBuffer(string, start, end);
- assert(endPosition >= end - 1);
- if (endPosition != end) {
- // Encoding skipped the last code unit.
- // That can only happen if the last code unit is a leadsurrogate.
- // Force encoding of the lead surrogate by itself.
- int lastCodeUnit = string.codeUnitAt(end - 1);
- assert(_isLeadSurrogate(lastCodeUnit));
- // We use a non-surrogate as `nextUnit` so that _writeSurrogate just
- // writes the lead-surrogate.
- bool wasCombined = encoder._writeSurrogate(lastCodeUnit, 0);
- assert(!wasCombined);
- }
- return encoder._buffer.sublist(0, encoder._bufferIndex);
- }
-
- /**
- * Starts a chunked conversion.
- *
- * The converter works more efficiently if the given [sink] is a
- * [ByteConversionSink].
- */
- StringConversionSink startChunkedConversion(Sink<List<int>> sink) {
- if (sink is! ByteConversionSink) {
- sink = new ByteConversionSink.from(sink);
- }
- return new _Utf8EncoderSink(sink);
- }
-
- // Override the base-classes bind, to provide a better type.
- Stream<List<int>> bind(Stream<String> stream) => super.bind(stream);
-}
-
-/**
- * This class encodes Strings to UTF-8 code units (unsigned 8 bit integers).
- */
-// TODO(floitsch): make this class public.
-class _Utf8Encoder {
- int _carry = 0;
- int _bufferIndex = 0;
- final List<int> _buffer;
-
- static const _DEFAULT_BYTE_BUFFER_SIZE = 1024;
-
- _Utf8Encoder() : this.withBufferSize(_DEFAULT_BYTE_BUFFER_SIZE);
-
- _Utf8Encoder.withBufferSize(int bufferSize)
- : _buffer = _createBuffer(bufferSize);
-
- /**
- * Allow an implementation to pick the most efficient way of storing bytes.
- */
- static List<int> _createBuffer(int size) => new Uint8List(size);
-
- /**
- * Tries to combine the given [leadingSurrogate] with the [nextCodeUnit] and
- * writes it to [_buffer].
- *
- * Returns true if the [nextCodeUnit] was combined with the
- * [leadingSurrogate]. If it wasn't then nextCodeUnit was not a trailing
- * surrogate and has not been written yet.
- *
- * It is safe to pass 0 for [nextCodeUnit] in which case only the leading
- * surrogate is written.
- */
- bool _writeSurrogate(int leadingSurrogate, int nextCodeUnit) {
- if (_isTailSurrogate(nextCodeUnit)) {
- int rune = _combineSurrogatePair(leadingSurrogate, nextCodeUnit);
- // If the rune is encoded with 2 code-units then it must be encoded
- // with 4 bytes in UTF-8.
- assert(rune > _THREE_BYTE_LIMIT);
- assert(rune <= _FOUR_BYTE_LIMIT);
- _buffer[_bufferIndex++] = 0xF0 | (rune >> 18);
- _buffer[_bufferIndex++] = 0x80 | ((rune >> 12) & 0x3f);
- _buffer[_bufferIndex++] = 0x80 | ((rune >> 6) & 0x3f);
- _buffer[_bufferIndex++] = 0x80 | (rune & 0x3f);
- return true;
- } else {
- // TODO(floitsch): allow to throw on malformed strings.
- // Encode the half-surrogate directly into UTF-8. This yields
- // invalid UTF-8, but we started out with invalid UTF-16.
-
- // Surrogates are always encoded in 3 bytes in UTF-8.
- _buffer[_bufferIndex++] = 0xE0 | (leadingSurrogate >> 12);
- _buffer[_bufferIndex++] = 0x80 | ((leadingSurrogate >> 6) & 0x3f);
- _buffer[_bufferIndex++] = 0x80 | (leadingSurrogate & 0x3f);
- return false;
- }
- }
-
- /**
- * Fills the [_buffer] with as many characters as possible.
- *
- * Does not encode any trailing lead-surrogate. This must be done by the
- * caller.
- *
- * Returns the position in the string. The returned index points to the
- * first code unit that hasn't been encoded.
- */
- int _fillBuffer(String str, int start, int end) {
- if (start != end && _isLeadSurrogate(str.codeUnitAt(end - 1))) {
- // Don't handle a trailing lead-surrogate in this loop. The caller has
- // to deal with those.
- end--;
- }
- int stringIndex;
- for (stringIndex = start; stringIndex < end; stringIndex++) {
- int codeUnit = str.codeUnitAt(stringIndex);
- // ASCII has the same representation in UTF-8 and UTF-16.
- if (codeUnit <= _ONE_BYTE_LIMIT) {
- if (_bufferIndex >= _buffer.length) break;
- _buffer[_bufferIndex++] = codeUnit;
- } else if (_isLeadSurrogate(codeUnit)) {
- if (_bufferIndex + 3 >= _buffer.length) break;
- // Note that it is safe to read the next code unit. We decremented
- // [end] above when the last valid code unit was a leading surrogate.
- int nextCodeUnit = str.codeUnitAt(stringIndex + 1);
- bool wasCombined = _writeSurrogate(codeUnit, nextCodeUnit);
- if (wasCombined) stringIndex++;
- } else {
- int rune = codeUnit;
- if (rune <= _TWO_BYTE_LIMIT) {
- if (_bufferIndex + 1 >= _buffer.length) break;
- _buffer[_bufferIndex++] = 0xC0 | (rune >> 6);
- _buffer[_bufferIndex++] = 0x80 | (rune & 0x3f);
- } else {
- assert(rune <= _THREE_BYTE_LIMIT);
- if (_bufferIndex + 2 >= _buffer.length) break;
- _buffer[_bufferIndex++] = 0xE0 | (rune >> 12);
- _buffer[_bufferIndex++] = 0x80 | ((rune >> 6) & 0x3f);
- _buffer[_bufferIndex++] = 0x80 | (rune & 0x3f);
- }
- }
- }
- return stringIndex;
- }
-}
-
-/**
- * This class encodes chunked strings to UTF-8 code units (unsigned 8-bit
- * integers).
- */
-class _Utf8EncoderSink extends _Utf8Encoder with StringConversionSinkMixin {
-
- final ByteConversionSink _sink;
-
- _Utf8EncoderSink(this._sink);
-
- void close() {
- if (_carry != 0) {
- // addSlice will call close again, but then the carry must be equal to 0.
- addSlice("", 0, 0, true);
- return;
- }
- _sink.close();
- }
-
- void addSlice(String str, int start, int end, bool isLast) {
- _bufferIndex = 0;
-
- if (start == end && !isLast) {
- return;
- }
-
- if (_carry != 0) {
- int nextCodeUnit = 0;
- if (start != end) {
- nextCodeUnit = str.codeUnitAt(start);
- } else {
- assert(isLast);
- }
- bool wasCombined = _writeSurrogate(_carry, nextCodeUnit);
- // Either we got a non-empty string, or we must not have been combined.
- assert(!wasCombined || start != end );
- if (wasCombined) start++;
- _carry = 0;
- }
- do {
- start = _fillBuffer(str, start, end);
- bool isLastSlice = isLast && (start == end);
- if (start == end - 1 && _isLeadSurrogate(str.codeUnitAt(start))) {
- if (isLast && _bufferIndex < _buffer.length - 3) {
- // There is still space for the last incomplete surrogate.
- // We use a non-surrogate as second argument. This way the
- // function will just add the surrogate-half to the buffer.
- bool hasBeenCombined = _writeSurrogate(str.codeUnitAt(start), 0);
- assert(!hasBeenCombined);
- } else {
- // Otherwise store it in the carry. If isLast is true, then
- // close will flush the last carry.
- _carry = str.codeUnitAt(start);
- }
- start++;
- }
- _sink.addSlice(_buffer, 0, _bufferIndex, isLastSlice);
- _bufferIndex = 0;
- } while (start < end);
- if (isLast) close();
- }
-
- // TODO(floitsch): implement asUtf8Sink. Sligthly complicated because it
- // needs to deal with malformed input.
-}
-
-/**
- * This class converts UTF-8 code units (lists of unsigned 8-bit integers)
- * to a string.
- */
-class Utf8Decoder extends Converter<List<int>, String> {
- final bool _allowMalformed;
-
- /**
- * Instantiates a new [Utf8Decoder].
- *
- * The optional [allowMalformed] argument defines how [convert] deals
- * with invalid or unterminated character sequences.
- *
- * If it is `true` [convert] replaces invalid (or unterminated) character
- * sequences with the Unicode Replacement character `U+FFFD` (�). Otherwise
- * it throws a [FormatException].
- */
- const Utf8Decoder({ bool allowMalformed: false })
- : this._allowMalformed = allowMalformed;
-
- /**
- * Converts the UTF-8 [codeUnits] (a list of unsigned 8-bit integers) to the
- * corresponding string.
- *
- * Uses the code units from [start] to, but no including, [end].
- * If [end] is omitted, it defaults to `codeUnits.length`.
- *
- * If the [codeUnits] start with a leading [UNICODE_BOM_CHARACTER_RUNE] this
- * character is discarded.
- */
- String convert(List<int> codeUnits, [int start = 0, int end]) {
- // Allow the implementation to intercept and specialize based on the type
- // of codeUnits.
- String result = _convertIntercepted(_allowMalformed, codeUnits, start, end);
- if (result != null) {
- return result;
- }
-
- int length = codeUnits.length;
- RangeError.checkValidRange(start, end, length);
- if (end == null) end = length;
- StringBuffer buffer = new StringBuffer();
- _Utf8Decoder decoder = new _Utf8Decoder(buffer, _allowMalformed);
- decoder.convert(codeUnits, start, end);
- decoder.close();
- return buffer.toString();
- }
-
- /**
- * Starts a chunked conversion.
- *
- * The converter works more efficiently if the given [sink] is a
- * [StringConversionSink].
- */
- ByteConversionSink startChunkedConversion(Sink<String> sink) {
- StringConversionSink stringSink;
- if (sink is StringConversionSink) {
- stringSink = sink;
- } else {
- stringSink = new StringConversionSink.from(sink);
- }
- return stringSink.asUtf8Sink(_allowMalformed);
- }
-
- // Override the base-classes bind, to provide a better type.
- Stream<String> bind(Stream<List<int>> stream) => super.bind(stream);
-
- external Converter<List<int>, dynamic/*=T*/> fuse/*<T>*/(
- Converter<String, dynamic/*=T*/> next);
-
- external static String _convertIntercepted(
- bool allowMalformed, List<int> codeUnits, int start, int end);
-}
-
-// UTF-8 constants.
-const int _ONE_BYTE_LIMIT = 0x7f; // 7 bits
-const int _TWO_BYTE_LIMIT = 0x7ff; // 11 bits
-const int _THREE_BYTE_LIMIT = 0xffff; // 16 bits
-const int _FOUR_BYTE_LIMIT = 0x10ffff; // 21 bits, truncated to Unicode max.
-
-// UTF-16 constants.
-const int _SURROGATE_MASK = 0xF800;
-const int _SURROGATE_TAG_MASK = 0xFC00;
-const int _SURROGATE_VALUE_MASK = 0x3FF;
-const int _LEAD_SURROGATE_MIN = 0xD800;
-const int _TAIL_SURROGATE_MIN = 0xDC00;
-
-bool _isLeadSurrogate(int codeUnit) =>
- (codeUnit & _SURROGATE_TAG_MASK) == _LEAD_SURROGATE_MIN;
-bool _isTailSurrogate(int codeUnit) =>
- (codeUnit & _SURROGATE_TAG_MASK) == _TAIL_SURROGATE_MIN;
-int _combineSurrogatePair(int lead, int tail) =>
- 0x10000 + ((lead & _SURROGATE_VALUE_MASK) << 10)
- | (tail & _SURROGATE_VALUE_MASK);
-
-/**
- * Decodes UTF-8.
- *
- * The decoder handles chunked input.
- */
-// TODO(floitsch): make this class public.
-class _Utf8Decoder {
- final bool _allowMalformed;
- final StringSink _stringSink;
- bool _isFirstCharacter = true;
- int _value = 0;
- int _expectedUnits = 0;
- int _extraUnits = 0;
-
- _Utf8Decoder(this._stringSink, this._allowMalformed);
-
- bool get hasPartialInput => _expectedUnits > 0;
-
- // Limits of one through four byte encodings.
- static const List<int> _LIMITS = const <int>[
- _ONE_BYTE_LIMIT,
- _TWO_BYTE_LIMIT,
- _THREE_BYTE_LIMIT,
- _FOUR_BYTE_LIMIT ];
-
- void close() {
- flush();
- }
-
- /**
- * Flushes this decoder as if closed.
- *
- * This method throws if the input was partial and the decoder was
- * constructed with `allowMalformed` set to `false`.
- */
- void flush() {
- if (hasPartialInput) {
- if (!_allowMalformed) {
- throw new FormatException("Unfinished UTF-8 octet sequence");
- }
- _stringSink.writeCharCode(UNICODE_REPLACEMENT_CHARACTER_RUNE);
- _value = 0;
- _expectedUnits = 0;
- _extraUnits = 0;
- }
- }
-
- void convert(List<int> codeUnits, int startIndex, int endIndex) {
- int value = _value;
- int expectedUnits = _expectedUnits;
- int extraUnits = _extraUnits;
- _value = 0;
- _expectedUnits = 0;
- _extraUnits = 0;
-
- int scanOneByteCharacters(units, int from) {
- final to = endIndex;
- final mask = _ONE_BYTE_LIMIT;
- for (var i = from; i < to; i++) {
- final unit = units[i];
- if ((unit & mask) != unit) return i - from;
- }
- return to - from;
- }
-
- void addSingleBytes(int from, int to) {
- assert(from >= startIndex && from <= endIndex);
- assert(to >= startIndex && to <= endIndex);
- _stringSink.write(new String.fromCharCodes(codeUnits, from, to));
- }
-
- int i = startIndex;
- loop: while (true) {
- multibyte: if (expectedUnits > 0) {
- do {
- if (i == endIndex) {
- break loop;
- }
- int unit = codeUnits[i];
- if ((unit & 0xC0) != 0x80) {
- expectedUnits = 0;
- if (!_allowMalformed) {
- throw new FormatException(
- "Bad UTF-8 encoding 0x${unit.toRadixString(16)}");
- }
- _isFirstCharacter = false;
- _stringSink.writeCharCode(UNICODE_REPLACEMENT_CHARACTER_RUNE);
- break multibyte;
- } else {
- value = (value << 6) | (unit & 0x3f);
- expectedUnits--;
- i++;
- }
- } while (expectedUnits > 0);
- if (value <= _LIMITS[extraUnits - 1]) {
- // Overly long encoding. The value could be encoded with a shorter
- // encoding.
- if (!_allowMalformed) {
- throw new FormatException(
- "Overlong encoding of 0x${value.toRadixString(16)}");
- }
- expectedUnits = extraUnits = 0;
- value = UNICODE_REPLACEMENT_CHARACTER_RUNE;
- }
- if (value > _FOUR_BYTE_LIMIT) {
- if (!_allowMalformed) {
- throw new FormatException("Character outside valid Unicode range: "
- "0x${value.toRadixString(16)}");
- }
- value = UNICODE_REPLACEMENT_CHARACTER_RUNE;
- }
- if (!_isFirstCharacter || value != UNICODE_BOM_CHARACTER_RUNE) {
- _stringSink.writeCharCode(value);
- }
- _isFirstCharacter = false;
- }
-
- while (i < endIndex) {
- int oneBytes = scanOneByteCharacters(codeUnits, i);
- if (oneBytes > 0) {
- _isFirstCharacter = false;
- addSingleBytes(i, i + oneBytes);
- i += oneBytes;
- if (i == endIndex) break;
- }
- int unit = codeUnits[i++];
- // TODO(floitsch): the way we test we could potentially allow
- // units that are too large, if they happen to have the
- // right bit-pattern. (Same is true for the multibyte loop above).
- // TODO(floitsch): optimize this loop. See:
- // https://codereview.chromium.org/22929022/diff/1/sdk/lib/convert/utf.dart?column_width=80
- if (unit < 0) {
- // TODO(floitsch): should this be unit <= 0 ?
- if (!_allowMalformed) {
- throw new FormatException(
- "Negative UTF-8 code unit: -0x${(-unit).toRadixString(16)}");
- }
- _stringSink.writeCharCode(UNICODE_REPLACEMENT_CHARACTER_RUNE);
- } else {
- assert(unit > _ONE_BYTE_LIMIT);
- if ((unit & 0xE0) == 0xC0) {
- value = unit & 0x1F;
- expectedUnits = extraUnits = 1;
- continue loop;
- }
- if ((unit & 0xF0) == 0xE0) {
- value = unit & 0x0F;
- expectedUnits = extraUnits = 2;
- continue loop;
- }
- // 0xF5, 0xF6 ... 0xFF never appear in valid UTF-8 sequences.
- if ((unit & 0xF8) == 0xF0 && unit < 0xF5) {
- value = unit & 0x07;
- expectedUnits = extraUnits = 3;
- continue loop;
- }
- if (!_allowMalformed) {
- throw new FormatException(
- "Bad UTF-8 encoding 0x${unit.toRadixString(16)}");
- }
- value = UNICODE_REPLACEMENT_CHARACTER_RUNE;
- expectedUnits = extraUnits = 0;
- _isFirstCharacter = false;
- _stringSink.writeCharCode(value);
- }
- }
- break loop;
- }
- if (expectedUnits > 0) {
- _value = value;
- _expectedUnits = expectedUnits;
- _extraUnits = extraUnits;
- }
- }
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/core/annotations.dart b/pkg/dev_compiler/tool/input_sdk/lib/core/annotations.dart
deleted file mode 100644
index 77211ab..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/core/annotations.dart
+++ /dev/null
@@ -1,153 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-part of dart.core;
-
-/**
- * The annotation `@Deprecated('expires when')` marks a feature as deprecated.
- *
- * The annotation `@deprecated` is a shorthand for deprecating until
- * an unspecified "next release".
- *
- * The intent of the `@Deprecated` annotation is to inform users of a feature
- * that they should change their code, even if it is currently still working
- * correctly.
- *
- * A deprecated feature is scheduled to be removed at a later time, possibly
- * specified as the "expires" field of the annotation.
- * This means that a deprecated feature should not be used, or code using it
- * will break at some point in the future. If there is code using the feature,
- * that code should be rewritten to not use the deprecated feature.
- *
- * A deprecated feature should document how the same effect can be achieved,
- * so the programmer knows how to rewrite the code.
- *
- * The `@Deprecated` annotation applies to libraries, top-level declarations
- * (variables, getters, setters, functions, classes and typedefs),
- * class-level declarations (variables, getters, setters, methods, operators or
- * constructors, whether static or not), named optional arguments and
- * trailing optional positional parameters.
- *
- * Deprecation is transitive:
- *
- * - If a library is deprecated, so is every member of it.
- * - If a class is deprecated, so is every member of it.
- * - If a variable is deprecated, so are its implicit getter and setter.
- *
- *
- * A tool that processes Dart source code may report when:
- *
- * - the code imports a deprecated library.
- * - the code exports a deprecated library, or any deprecated member of
- * a non-deprecated library.
- * - the code refers statically to a deprecated declaration.
- * - the code dynamically uses a member of an object with a statically known
- * type, where the member is deprecated on the static type of the object.
- * - the code dynamically calls a method with an argument where the
- * corresponding optional parameter is deprecated on the object's static type.
- *
- *
- * If the deprecated use is inside a library, class or method which is itself
- * deprecated, the tool should not bother the user about it.
- * A deprecated feature is expected to use other deprecated features.
- */
-class Deprecated {
- /**
- * A description of when the deprecated feature is expected to be retired.
- */
- final String expires;
-
- /**
- * Create a deprecation annotation which specifies the expiration of the
- * annotated feature.
- *
- * The [expires] argument should be readable by programmers, and should state
- * when an annotated feature is expected to be removed.
- * This can be specified, for example, as a date, as a release number, or
- * as relative to some other change (like "when bug 4418 is fixed").
- */
- const Deprecated(String expires) : this.expires = expires;
-
- String toString() => "Deprecated feature. Will be removed $expires";
-}
-
-class _Override {
- const _Override();
-}
-
-/**
- * Marks a feature as [Deprecated] until the next release.
- */
-const Deprecated deprecated = const Deprecated("next release");
-
-/**
- * The annotation `@override` marks an instance member as overriding a
- * superclass member with the same name.
- *
- * The annotation applies to instance methods, getters and setters, and to
- * instance fields, where it means that the implicit getter and setter of the
- * field is marked as overriding, but the field itself is not.
- *
- * The intent of the `@override` notation is to catch situations where a
- * superclass renames a member, and an independent subclass which used to
- * override the member, could silently continue working using the
- * superclass implementation.
- *
- * The editor, or a similar tool aimed at the programmer, may report if no
- * declaration of an annotated member is inherited by the class from either a
- * superclass or an interface.
- *
- * Use the `@override` annotation judiciously and only for methods where
- * the superclass is not under the programmer's control, the superclass is in a
- * different library or package, and it is not considered stable.
- * In any case, the use of `@override` is optional.
- *
- * For example, the annotation is intentionally not used in the Dart platform
- * libraries, since they only depend on themselves.
- */
-const Object override = const _Override();
-
-class _Proxy {
- const _Proxy();
-}
-
-/**
- * The annotation `@proxy` marks a class as implementing members dynamically
- * through `noSuchMethod`.
- *
- * The annotation applies to any class. It is inherited by subclasses from both
- * superclass and interfaces.
- *
- * If a class is annotated with `@proxy`, or it implements any class that is
- * annotated, then the class is considered to implement any member with regard
- * to static type analysis.
- * As such, it is not a static type warning to access any member of the object
- * which is not implemented by the class, or to call a method with a different
- * number of parameters than it is declared with.
- *
- * The annotation does not change which classes the annotated class implements,
- * and does not prevent static warnings for assigning an object to a variable
- * with a static type not implemented by the object.
- *
- * The suppression of warnings only affect static type warnings about
- * member access.
- * The runtime type of the object is unaffected.
- * It is not considered to implement any special interfaces,
- * so assigning it to a typed variable may fail in checked mode,
- * and testing it with the `is` operator
- * will only return true for types it actually implements or extends.
- * Accessing a member which isn't implemented by the class
- * will cause the `noSuchMethod` method to be called normally,
- * the `@proxy` annotation merely states the intent to handle (some of) those
- * `noSuchMethod` calls gracefully.
- *
- * A class that marked as `@proxy` should override the `noSuchMethod`
- * declared on [Object].
- *
- * The intent of the `@proxy` notation is to create objects that implement a
- * type (or multiple types) that are not known at compile time. If the types
- * are known at compile time, a class can be written that implements these
- * types.
- */
-const Object proxy = const _Proxy();
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/core/bool.dart b/pkg/dev_compiler/tool/input_sdk/lib/core/bool.dart
deleted file mode 100644
index d1f31d7..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/core/bool.dart
+++ /dev/null
@@ -1,51 +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.
-
-part of dart.core;
-
-/**
- * The reserved words [:true:] and [:false:] denote objects that are the only
- * instances of this class.
- *
- * It is a compile-time error for a class to attempt to extend or implement
- * bool.
- */
-class bool {
- /**
- * Returns the boolean value of the environment declaration [name].
- *
- * The boolean value of the declaration is `true` if the declared value is
- * the string `"true"`, and `false` if the value is `"false"`.
- *
- * In all other cases, including when there is no declaration for `name`,
- * the result is the [defaultValue].
- *
- * The result is the same as would be returned by:
- *
- * (const String.fromEnvironment(name) == "true")
- * ? true
- * : (const String.fromEnvironment(name) == "false")
- * ? false
- * : defaultValue
- *
- * Example:
- *
- * const loggingFlag = const bool.fromEnvironment("logging");
- *
- * If you want to use a different truth-string than `"true"`, you can use the
- * [String.fromEnvironment] constructor directly:
- *
- * const isLoggingOn = (const String.fromEnvironment("logging") == "on");
- */
- external const factory bool.fromEnvironment(String name,
- {bool defaultValue: false});
-
- /**
- * Returns [:"true":] if the receiver is [:true:], or [:"false":] if the
- * receiver is [:false:].
- */
- String toString() {
- return this ? "true" : "false";
- }
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/core/comparable.dart b/pkg/dev_compiler/tool/input_sdk/lib/core/comparable.dart
deleted file mode 100644
index 7a22948..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/core/comparable.dart
+++ /dev/null
@@ -1,94 +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.
-
-part of dart.core;
-
-/**
- * The signature of a generic comparison function.
- *
- * A comparison function represents an ordering on a type of objects.
- * A total ordering on a type means that for two values, either they
- * are equal or one is greater than the other (and the latter must then be
- * smaller than the former).
- *
- * A [Comparator] function represents such a total ordering by returning
- *
- * * a negative integer if [a] is smaller than [b],
- * * zero if [a] is equal to [b], and
- * * a positive integer if [a] is greater than [b].
- */
-typedef int Comparator<T>(T a, T b);
-
-/**
- * Interface used by types that have an intrinsic ordering.
- *
- * The [compareTo] operation defines a total ordering of objects,
- * which can be used for ordering and sorting.
- *
- * The [Comparable] interface should be used for the natural ordering of a type.
- * If a type can be ordered in more than one way,
- * and none of them is the obvious natural ordering,
- * then it might be better not to use the [Comparable] interface,
- * and to provide separate [Comparator]s instead.
- *
- * It is recommended that the order of a [Comparable] agrees
- * with its operator [==] equality (`a.compareTo(b) == 0` iff `a == b`),
- * but this is not a requirement.
- * For example, [double] and [DateTime] have `compareTo` methods
- * that do not agree with operator [==].
- * For doubles the [compareTo] method is more precise than the equality,
- * and for [DateTime] it is less precise.
- *
- * Examples:
- *
- * (0.0).compareTo(-0.0); // => 1
- * 0.0 == -0.0; // => true
- * var dt = new DateTime.now();
- * var dt2 = dt.toUtc();
- * dt == dt2; // => false
- * dt.compareTo(dt2); // => 0
- *
- * The [Comparable] interface does not imply the existence
- * of the comparison operators `<`, `<=`, `>` and `>=`.
- * These should only be defined
- * if the ordering is a less-than/greater-than ordering,
- * that is, an ordering where you would naturally
- * use the words "less than" about the order of two elements.
- *
- * If the equality operator and [compareTo] disagree,
- * the comparison operators should follow the equality operator,
- * and will likely also disagree with [compareTo].
- * Otherwise they should match the [compareTo] method,
- * so that `a < b` iff `a.compareTo(b) < 0`.
- *
- * The [double] class defines comparison operators
- * that are compatible with equality.
- * The operators differ from `double.compareTo` on -0.0 and NaN.
- *
- * The [DateTime] class has no comparison operators, instead it has the more
- * precisely named [DateTime.isBefore] and [DateTime.isAfter].
- */
-abstract class Comparable<T> {
- /**
- * Compares this object to another [Comparable]
- *
- * Returns a value like a [Comparator] when comparing `this` to [other].
- * That is, it returns a negative integer if `this` is ordered before [other],
- * a positive integer if `this` is ordered after [other],
- * and zero if `this` and [other] are ordered together.
- *
- * The [other] argument must be a value that is comparable to this object.
- */
- int compareTo(T other);
-
- /**
- * A [Comparator] that compares one comparable to another.
- *
- * It returns the result of `a.compareTo(b)`.
- *
- * This utility function is used as the default comparator
- * for ordering collections, for example in the [List] sort function.
- */
- static int compare(Comparable a, Comparable b) => a.compareTo(b);
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/core/core.dart b/pkg/dev_compiler/tool/input_sdk/lib/core/core.dart
deleted file mode 100644
index deeae3b..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/core/core.dart
+++ /dev/null
@@ -1,197 +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.
-
-/**
- *
- * Built-in types, collections,
- * and other core functionality for every Dart program.
- *
- * This library is automatically imported.
- *
- * Some classes in this library,
- * such as [String] and [num],
- * support Dart's built-in data types.
- * Other classes, such as [List] and [Map], provide data structures
- * for managing collections of objects.
- * And still other classes represent commonly used types of data
- * such as URIs, dates and times, and errors.
- *
- * ## Numbers and booleans
- *
- * [int] and [double] provide support for Dart's built-in numerical data types:
- * integers and double-precision floating point numbers, respectively.
- * An object of type [bool] is either true or false.
- * Variables of these types can be constructed from literals:
- *
- * int meaningOfLife = 42;
- * double valueOfPi = 3.141592;
- * bool visible = true;
- *
- * ## Strings and regular expressions
- *
- * A [String] is immutable and represents a sequence of characters.
- *
- * String shakespeareQuote = "All the world's a stage, ...";
- *
- * [StringBuffer] provides a way to construct strings efficiently.
- *
- * StringBuffer moreShakespeare = new StringBuffer();
- * moreShakespeare.write('And all the men and women ');
- * moreShakespeare.write('merely players; ...');
- *
- * The String and StringBuffer classes implement string concatenation,
- * interpolation, and other string manipulation features.
- *
- * String philosophy = 'Live on ';
- * String get palindrome => philosophy + philosophy.split('').reversed.join();
- *
- * [RegExp] implements Dart regular expressions,
- * which provide a grammar for matching patterns within text.
- * For example, here's a regular expression that matches
- * a string of one or more digits:
- *
- * var numbers = new RegExp(r'\d+');
- *
- * Dart regular expressions have the same syntax and semantics as
- * JavaScript regular expressions. See
- * <http://ecma-international.org/ecma-262/5.1/#sec-15.10>
- * for the specification of JavaScript regular expressions.
- *
- * ## Collections
- *
- * The dart:core library provides basic collections,
- * such as [List], [Map], and [Set].
- *
- * A List is an ordered collection of objects, with a length.
- * Lists are sometimes called arrays.
- * Use a List when you need to access objects by index.
- *
- * List superheroes = [ 'Batman', 'Superman', 'Harry Potter' ];
- *
- * A Set is an unordered collection of unique objects.
- * You cannot get an item by index (position).
- * Adding a duplicate item has no effect.
- *
- * Set villains = new Set();
- * villains.add('Joker');
- * villains.addAll( ['Lex Luther', 'Voldemort'] );
- *
- * A Map is an unordered collection of key-value pairs.
- * Maps are sometimes called associative arrays because
- * maps associate a key to some value for easy retrieval.
- * Keys are unique.
- * Use a Map when you need to access objects
- * by a unique identifier.
- *
- * Map sidekicks = { 'Batman': 'Robin',
- * 'Superman': 'Lois Lane',
- * 'Harry Potter': 'Ron and Hermione' };
- *
- * In addition to these classes,
- * dart:core contains [Iterable],
- * an interface that defines functionality
- * common in collections of objects.
- * Examples include the ability
- * to run a function on each element in the collection,
- * to apply a test to each element,
- * to retrieve an object, and to determine length.
- *
- * Iterable is implemented by List and Set,
- * and used by Map for its keys and values.
- *
- * For other kinds of collections, check out the
- * [dart:collection](#dart-collection) library.
- *
- * ## Date and time
- *
- * Use [DateTime] to represent a point in time
- * and [Duration] to represent a span of time.
- *
- * You can create DateTime objects with constructors
- * or by parsing a correctly formatted string.
- *
- * DateTime now = new DateTime.now();
- * DateTime berlinWallFell = new DateTime(1989, 11, 9);
- * DateTime moonLanding = DateTime.parse("1969-07-20");
- *
- * Create a Duration object specifying the individual time units.
- *
- * Duration timeRemaining = new Duration(hours:56, minutes:14);
- *
- * In addition to DateTime and Duration,
- * dart:core contains the [Stopwatch] class for measuring elapsed time.
- *
- * ## Uri
- *
- * A [Uri] object represents a uniform resource identifier,
- * which identifies a resource on the web.
- *
- * Uri dartlang = Uri.parse('http://dartlang.org/');
- *
- * ## Errors
- *
- * The [Error] class represents the occurrence of an error
- * during runtime.
- * Subclasses of this class represent specific kinds of errors.
- *
- * ## Other documentation
- *
- * For more information about how to use the built-in types, refer to [Built-in
- * Types](http://www.dartlang.org/docs/dart-up-and-running/contents/ch02.html#built-in-types)
- * in Chapter 2 of
- * [Dart: Up and Running](http://www.dartlang.org/docs/dart-up-and-running/).
- *
- * Also, see [dart:core - Numbers, Collections, Strings, and
- * More](https://www.dartlang.org/docs/dart-up-and-running/ch03.html#dartcore---numbers-collections-strings-and-more)
- * for more coverage of classes in this package.
- *
- * The
- * [Dart Language Specification](http://www.dartlang.org/docs/spec/)
- * provides technical details.
- */
-library dart.core;
-
-import "dart:collection";
-import "dart:_internal" hide Symbol;
-import "dart:_internal" as internal show Symbol;
-import 'dart:_js_helper' show NoInline;
-import "dart:convert" show
- Encoding, ASCII, LATIN1, UTF8,
- BASE64, StringConversionSink, ChunkedConversionSink;
-import "dart:math" show Random; // Used by List.shuffle.
-import "dart:typed_data" show Uint8List;
-
-part "annotations.dart";
-part "bool.dart";
-part "comparable.dart";
-part "date_time.dart";
-part "double.dart";
-part "duration.dart";
-part "errors.dart";
-part "exceptions.dart";
-part "expando.dart";
-part "function.dart";
-part "identical.dart";
-part "int.dart";
-part "invocation.dart";
-part "iterable.dart";
-part "iterator.dart";
-part "list.dart";
-part "map.dart";
-part "null.dart";
-part "num.dart";
-part "object.dart";
-part "pattern.dart";
-part "print.dart";
-part "regexp.dart";
-part "set.dart";
-part "sink.dart";
-part "stacktrace.dart";
-part "stopwatch.dart";
-part "string.dart";
-part "string_buffer.dart";
-part "string_sink.dart";
-part "symbol.dart";
-part "type.dart";
-part "uri.dart";
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/core/date_time.dart b/pkg/dev_compiler/tool/input_sdk/lib/core/date_time.dart
deleted file mode 100644
index 35e93e0..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/core/date_time.dart
+++ /dev/null
@@ -1,761 +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.
-
-part of dart.core;
-
-/**
- * An instant in time, such as July 20, 1969, 8:18pm GMT.
- *
- * Create a DateTime object by using one of the constructors
- * or by parsing a correctly formatted string,
- * which complies with a subset of ISO 8601.
- * Note that hours are specified between 0 and 23,
- * as in a 24-hour clock.
- * For example:
- *
- * DateTime now = new DateTime.now();
- * DateTime berlinWallFell = new DateTime(1989, 11, 9);
- * DateTime moonLanding = DateTime.parse("1969-07-20 20:18:00"); // 8:18pm
- *
- * A DateTime object is anchored either in the UTC time zone
- * or in the local time zone of the current computer
- * when the object is created.
- *
- * Once created, neither the value nor the time zone
- * of a DateTime object may be changed.
- *
- * You can use properties to get
- * the individual units of a DateTime object.
- *
- * assert(berlinWallFell.month == 11);
- * assert(moonLanding.hour == 20);
- *
- * For convenience and readability,
- * the DateTime class provides a constant for each day and month
- * name—for example, [AUGUST] and [FRIDAY].
- * You can use these constants to improve code readibility:
- *
- * DateTime berlinWallFell = new DateTime(1989, DateTime.NOVEMBER, 9);
- * assert(berlinWallFell.weekday == DateTime.THURSDAY);
- *
- * Day and month values begin at 1, and the week starts on Monday.
- * That is, the constants [JANUARY] and [MONDAY] are both 1.
- *
- * ## Working with UTC and local time
- *
- * A DateTime object is in the local time zone
- * unless explicitly created in the UTC time zone.
- *
- * DateTime dDay = new DateTime.utc(1944, 6, 6);
- *
- * Use [isUtc] to determine whether a DateTime object is based in UTC.
- * Use the methods [toLocal] and [toUtc]
- * to get the equivalent date/time value specified in the other time zone.
- * Use [timeZoneName] to get an abbreviated name of the time zone
- * for the DateTime object.
- * To find the difference
- * between UTC and the time zone of a DateTime object
- * call [timeZoneOffset].
- *
- * ## Comparing DateTime objects
- *
- * The DateTime class contains several handy methods,
- * such as [isAfter], [isBefore], and [isAtSameMomentAs],
- * for comparing DateTime objects.
- *
- * assert(berlinWallFell.isAfter(moonLanding) == true);
- * assert(berlinWallFell.isBefore(moonLanding) == false);
- *
- * ## Using DateTime with Duration
- *
- * Use the [add] and [subtract] methods with a [Duration] object
- * to create a new DateTime object based on another.
- * For example, to find the date that is sixty days after today, write:
- *
- * DateTime today = new DateTime.now();
- * DateTime sixtyDaysFromNow = today.add(new Duration(days: 60));
- *
- * To find out how much time is between two DateTime objects use
- * [difference], which returns a [Duration] object:
- *
- * Duration difference = berlinWallFell.difference(moonLanding)
- * assert(difference.inDays == 7416);
- *
- * The difference between two dates in different time zones
- * is just the number of nanoseconds between the two points in time.
- * It doesn't take calendar days into account.
- * That means that the difference between two midnights in local time may be
- * less than 24 hours times the number of days between them,
- * if there is a daylight saving change in between.
- * If the difference above is calculated using Australian local time, the
- * difference is 7415 days and 23 hours, which is only 7415 whole days as
- * reported by `inDays`.
- *
- * ## Other resources
- *
- * See [Duration] to represent a span of time.
- * See [Stopwatch] to measure timespans.
- *
- * The DateTime class does not provide internationalization.
- * To internationalize your code, use
- * the [intl](http://pub.dartlang.org/packages/intl) package.
- *
- */
-class DateTime implements Comparable<DateTime> {
- // Weekday constants that are returned by [weekday] method:
- static const int MONDAY = 1;
- static const int TUESDAY = 2;
- static const int WEDNESDAY = 3;
- static const int THURSDAY = 4;
- static const int FRIDAY = 5;
- static const int SATURDAY = 6;
- static const int SUNDAY = 7;
- static const int DAYS_PER_WEEK = 7;
-
- // Month constants that are returned by the [month] getter.
- static const int JANUARY = 1;
- static const int FEBRUARY = 2;
- static const int MARCH = 3;
- static const int APRIL = 4;
- static const int MAY = 5;
- static const int JUNE = 6;
- static const int JULY = 7;
- static const int AUGUST = 8;
- static const int SEPTEMBER = 9;
- static const int OCTOBER = 10;
- static const int NOVEMBER = 11;
- static const int DECEMBER = 12;
- static const int MONTHS_PER_YEAR = 12;
-
- /**
- * The value of this DateTime.
- *
- * The content of this field is implementation dependent. On JavaScript it is
- * equal to [millisecondsSinceEpoch]. On the VM it is equal to
- * [microsecondsSinceEpoch].
- */
- final int _value;
-
- /**
- * True if this [DateTime] is set to UTC time.
- *
- * DateTime dDay = new DateTime.utc(1944, 6, 6);
- * assert(dDay.isUtc);
- *
- */
- final bool isUtc;
-
- /**
- * Constructs a [DateTime] instance specified in the local time zone.
- *
- * For example,
- * to create a new DateTime object representing April 29, 2014, 6:04am:
- *
- * DateTime annularEclipse = new DateTime(2014, DateTime.APRIL, 29, 6, 4);
- */
- DateTime(int year,
- [int month = 1,
- int day = 1,
- int hour = 0,
- int minute = 0,
- int second = 0,
- int millisecond = 0,
- int microsecond = 0])
- : this._internal(
- year, month, day, hour, minute, second, millisecond, microsecond,
- false);
-
- /**
- * Constructs a [DateTime] instance specified in the UTC time zone.
- *
- * DateTime dDay = new DateTime.utc(1944, DateTime.JUNE, 6);
- */
- DateTime.utc(int year,
- [int month = 1,
- int day = 1,
- int hour = 0,
- int minute = 0,
- int second = 0,
- int millisecond = 0,
- int microsecond = 0])
- : this._internal(
- year, month, day, hour, minute, second, millisecond, microsecond,
- true);
-
- /**
- * Constructs a [DateTime] instance with current date and time in the
- * local time zone.
- *
- * DateTime thisInstant = new DateTime.now();
- *
- */
- DateTime.now() : this._now();
-
- /**
- * Constructs a new [DateTime] instance based on [formattedString].
- *
- * Throws a [FormatException] if the input cannot be parsed.
- *
- * The function parses a subset of ISO 8601
- * which includes the subset accepted by RFC 3339.
- *
- * The accepted inputs are currently:
- *
- * * A date: A signed four-to-six digit year, two digit month and
- * two digit day, optionally separated by `-` characters.
- * Examples: "19700101", "-0004-12-24", "81030-04-01".
- * * An optional time part, separated from the date by either `T` or a space.
- * The time part is a two digit hour,
- * then optionally a two digit minutes value,
- * then optionally a two digit seconds value, and
- * then optionally a '.' followed by a one-to-six digit second fraction.
- * The minuts and seconds may be separated from the previous parts by a ':'.
- * Examples: "12", "12:30:24.124", "123010.50".
- * * An optional time-zone offset part,
- * possibly separated from the previous by a space.
- * The time zone is either 'z' or 'Z', or it is a signed two digit hour
- * part and an optional two digit minute part. The sign must be either
- * "+" or "-", and can not be omitted.
- * The minutes may be separted from the hours by a ':'.
- * Examples: "Z", "-10", "01:30", "1130".
- *
- * This includes the output of both [toString] and [toIso8601String], which
- * will be parsed back into a `DateTime` object with the same time as the
- * original.
- *
- * The result is always in either local time or UTC.
- * If a time zone offset other than UTC is specified,
- * the time is converted to the equivalent UTC time.
- *
- * Examples of accepted strings:
- *
- * * `"2012-02-27 13:27:00"`
- * * `"2012-02-27 13:27:00.123456z"`
- * * `"20120227 13:27:00"`
- * * `"20120227T132700"`
- * * `"20120227"`
- * * `"+20120227"`
- * * `"2012-02-27T14Z"`
- * * `"2012-02-27T14+00:00"`
- * * `"-123450101 00:00:00 Z"`: in the year -12345.
- * * `"2002-02-27T14:00:00-0500"`: Same as `"2002-02-27T19:00:00Z"`
- */
- // TODO(lrn): restrict incorrect values like 2003-02-29T50:70:80.
- // Or not, that may be a breaking change.
- static DateTime parse(String formattedString) {
- /*
- * date ::= yeardate time_opt timezone_opt
- * yeardate ::= year colon_opt month colon_opt day
- * year ::= sign_opt digit{4,6}
- * colon_opt :: <empty> | ':'
- * sign ::= '+' | '-'
- * sign_opt ::= <empty> | sign
- * month ::= digit{2}
- * day ::= digit{2}
- * time_opt ::= <empty> | (' ' | 'T') hour minutes_opt
- * minutes_opt ::= <empty> | colon_opt digit{2} seconds_opt
- * seconds_opt ::= <empty> | colon_opt digit{2} millis_opt
- * micros_opt ::= <empty> | '.' digit{1,6}
- * timezone_opt ::= <empty> | space_opt timezone
- * space_opt :: ' ' | <empty>
- * timezone ::= 'z' | 'Z' | sign digit{2} timezonemins_opt
- * timezonemins_opt ::= <empty> | colon_opt digit{2}
- */
- final RegExp re = new RegExp(
- r'^([+-]?\d{4,6})-?(\d\d)-?(\d\d)' // Day part.
- r'(?:[ T](\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d{1,6}))?)?)?' // Time part.
- r'( ?[zZ]| ?([-+])(\d\d)(?::?(\d\d))?)?)?$'); // Timezone part.
-
- Match match = re.firstMatch(formattedString);
- if (match != null) {
- int parseIntOrZero(String matched) {
- if (matched == null) return 0;
- return int.parse(matched);
- }
-
- // Parses fractional second digits of '.(\d{1,6})' into the combined
- // microseconds.
- int parseMilliAndMicroseconds(String matched) {
- if (matched == null) return 0;
- int length = matched.length;
- assert(length >= 1);
- assert(length <= 6);
-
- int result = 0;
- for (int i = 0; i < 6; i++) {
- result *= 10;
- if (i < matched.length) {
- result += matched.codeUnitAt(i) ^ 0x30;
- }
- }
- return result;
- }
-
- int years = int.parse(match[1]);
- int month = int.parse(match[2]);
- int day = int.parse(match[3]);
- int hour = parseIntOrZero(match[4]);
- int minute = parseIntOrZero(match[5]);
- int second = parseIntOrZero(match[6]);
- bool addOneMillisecond = false;
- int milliAndMicroseconds = parseMilliAndMicroseconds(match[7]);
- int millisecond =
- milliAndMicroseconds ~/ Duration.MICROSECONDS_PER_MILLISECOND;
- int microsecond =
- milliAndMicroseconds.remainder(Duration.MICROSECONDS_PER_MILLISECOND);
- bool isUtc = false;
- if (match[8] != null) { // timezone part
- isUtc = true;
- if (match[9] != null) {
- // timezone other than 'Z' and 'z'.
- int sign = (match[9] == '-') ? -1 : 1;
- int hourDifference = int.parse(match[10]);
- int minuteDifference = parseIntOrZero(match[11]);
- minuteDifference += 60 * hourDifference;
- minute -= sign * minuteDifference;
- }
- }
- int value = _brokenDownDateToValue(
- years, month, day, hour, minute, second, millisecond, microsecond,
- isUtc);
- if (value == null) {
- throw new FormatException("Time out of range", formattedString);
- }
- return new DateTime._withValue(value, isUtc: isUtc);
- } else {
- throw new FormatException("Invalid date format", formattedString);
- }
- }
-
- static const int _MAX_MILLISECONDS_SINCE_EPOCH = 8640000000000000;
-
- /**
- * Constructs a new [DateTime] instance
- * with the given [millisecondsSinceEpoch].
- *
- * If [isUtc] is false then the date is in the local time zone.
- *
- * The constructed [DateTime] represents
- * 1970-01-01T00:00:00Z + [millisecondsSinceEpoch] ms in the given
- * time zone (local or UTC).
- */
- external DateTime.fromMillisecondsSinceEpoch(int millisecondsSinceEpoch,
- {bool isUtc: false});
-
- /**
- * Constructs a new [DateTime] instance
- * with the given [microsecondsSinceEpoch].
- *
- * If [isUtc] is false then the date is in the local time zone.
- *
- * The constructed [DateTime] represents
- * 1970-01-01T00:00:00Z + [microsecondsSinceEpoch] us in the given
- * time zone (local or UTC).
- */
- external DateTime.fromMicrosecondsSinceEpoch(int microsecondsSinceEpoch,
- {bool isUtc: false});
-
- /**
- * Constructs a new [DateTime] instance with the given value.
- *
- * If [isUtc] is false then the date is in the local time zone.
- */
- DateTime._withValue(this._value, {this.isUtc}) {
- if (millisecondsSinceEpoch.abs() > _MAX_MILLISECONDS_SINCE_EPOCH ||
- (millisecondsSinceEpoch.abs() == _MAX_MILLISECONDS_SINCE_EPOCH &&
- microsecond != 0)) {
- throw new ArgumentError(millisecondsSinceEpoch);
- }
- if (isUtc == null) throw new ArgumentError(isUtc);
- }
-
- /**
- * Returns true if [other] is a [DateTime] at the same moment and in the
- * same time zone (UTC or local).
- *
- * DateTime dDayUtc = new DateTime.utc(1944, DateTime.JUNE, 6);
- * DateTime dDayLocal = new DateTime(1944, DateTime.JUNE, 6);
- *
- * assert(dDayUtc.isAtSameMomentAs(dDayLocal) == false);
- *
- * See [isAtSameMomentAs] for a comparison that adjusts for time zone.
- */
- bool operator ==(other) {
- if (!(other is DateTime)) return false;
- return (_value == other._value && isUtc == other.isUtc);
- }
-
- /**
- * Returns true if [this] occurs before [other].
- *
- * The comparison is independent
- * of whether the time is in UTC or in the local time zone.
- *
- * DateTime berlinWallFell = new DateTime(1989, 11, 9);
- * DateTime moonLanding = DateTime.parse("1969-07-20 20:18:00");
- *
- * assert(berlinWallFell.isBefore(moonLanding) == false);
- *
- */
- bool isBefore(DateTime other) {
- return _value < other._value;
- }
-
- /**
- * Returns true if [this] occurs after [other].
- *
- * The comparison is independent
- * of whether the time is in UTC or in the local time zone.
- *
- * DateTime berlinWallFell = new DateTime(1989, 11, 9);
- * DateTime moonLanding = DateTime.parse("1969-07-20 20:18:00");
- *
- * assert(berlinWallFell.isAfter(moonLanding) == true);
- *
- */
- bool isAfter(DateTime other) {
- return _value > other._value;
- }
-
- /**
- * Returns true if [this] occurs at the same moment as [other].
- *
- * The comparison is independent of whether the time is in UTC or in the local
- * time zone.
- *
- * DateTime berlinWallFell = new DateTime(1989, 11, 9);
- * DateTime moonLanding = DateTime.parse("1969-07-20 20:18:00");
- *
- * assert(berlinWallFell.isAtSameMomentAs(moonLanding) == false);
- */
- bool isAtSameMomentAs(DateTime other) {
- return _value == other._value;
- }
-
- /**
- * Compares this DateTime object to [other],
- * returning zero if the values are equal.
- *
- * This function returns a negative integer
- * if this DateTime is smaller (earlier) than [other],
- * or a positive integer if it is greater (later).
- */
- int compareTo(DateTime other) => _value.compareTo(other._value);
-
- int get hashCode => (_value ^ (_value >> 30)) & 0x3FFFFFFF;
-
- /**
- * Returns this DateTime value in the local time zone.
- *
- * Returns [this] if it is already in the local time zone.
- * Otherwise this method is equivalent to:
- *
- * new DateTime.fromMicrosecondsSinceEpoch(microsecondsSinceEpoch,
- * isUtc: false)
- */
- DateTime toLocal() {
- if (isUtc) {
- return new DateTime._withValue(_value, isUtc: false);
- }
- return this;
- }
-
- /**
- * Returns this DateTime value in the UTC time zone.
- *
- * Returns [this] if it is already in UTC.
- * Otherwise this method is equivalent to:
- *
- * new DateTime.fromMicrosecondsSinceEpoch(microsecondsSinceEpoch,
- * isUtc: true)
- */
- DateTime toUtc() {
- if (isUtc) return this;
- return new DateTime._withValue(_value, isUtc: true);
- }
-
- static String _fourDigits(int n) {
- int absN = n.abs();
- String sign = n < 0 ? "-" : "";
- if (absN >= 1000) return "$n";
- if (absN >= 100) return "${sign}0$absN";
- if (absN >= 10) return "${sign}00$absN";
- return "${sign}000$absN";
- }
-
- static String _sixDigits(int n) {
- assert(n < -9999 || n > 9999);
- int absN = n.abs();
- String sign = n < 0 ? "-" : "+";
- if (absN >= 100000) return "$sign$absN";
- return "${sign}0$absN";
- }
-
- static String _threeDigits(int n) {
- if (n >= 100) return "${n}";
- if (n >= 10) return "0${n}";
- return "00${n}";
- }
-
- static String _twoDigits(int n) {
- if (n >= 10) return "${n}";
- return "0${n}";
- }
-
- /**
- * Returns a human-readable string for this instance.
- *
- * The returned string is constructed for the time zone of this instance.
- * The `toString()` method provides a simply formatted string.
- * It does not support internationalized strings.
- * Use the [intl](http://pub.dartlang.org/packages/intl) package
- * at the pub shared packages repo.
- *
- * The resulting string can be parsed back using [parse].
- */
- String toString() {
- String y = _fourDigits(year);
- String m = _twoDigits(month);
- String d = _twoDigits(day);
- String h = _twoDigits(hour);
- String min = _twoDigits(minute);
- String sec = _twoDigits(second);
- String ms = _threeDigits(millisecond);
- String us = microsecond == 0 ? "" : _threeDigits(microsecond);
- if (isUtc) {
- return "$y-$m-$d $h:$min:$sec.$ms${us}Z";
- } else {
- return "$y-$m-$d $h:$min:$sec.$ms$us";
- }
- }
-
- /**
- * Returns an ISO-8601 full-precision extended format representation.
- *
- * The format is `yyyy-MM-ddTHH:mm:ss.mmmuuuZ` for UTC time, and
- * `yyyy-MM-ddTHH:mm:ss.mmmuuu` (no trailing "Z") for local/non-UTC time,
- * where:
- *
- * * `yyyy` is a, possibly negative, four digit representation of the year,
- * if the year is in the range -9999 to 9999,
- * otherwise it is a signed six digit representation of the year.
- * * `MM` is the month in the range 01 to 12,
- * * `dd` is the day of the month in the range 01 to 31,
- * * `HH` are hours in the range 00 to 23,
- * * `mm` are minutes in the range 00 to 59,
- * * `ss` are seconds in the range 00 to 59 (no leap seconds),
- * * `mmm` are milliseconds in the range 000 to 999, and
- * * `uuu` are microseconds in the range 001 to 999. If [microsecond] equals
- * 0, then this part is omitted.
- *
- * The resulting string can be parsed back using [parse].
- */
- String toIso8601String() {
- String y = (year >= -9999 && year <= 9999) ? _fourDigits(year)
- : _sixDigits(year);
- String m = _twoDigits(month);
- String d = _twoDigits(day);
- String h = _twoDigits(hour);
- String min = _twoDigits(minute);
- String sec = _twoDigits(second);
- String ms = _threeDigits(millisecond);
- String us = microsecond == 0 ? "" : _threeDigits(microsecond);
- if (isUtc) {
- return "$y-$m-${d}T$h:$min:$sec.$ms${us}Z";
- } else {
- return "$y-$m-${d}T$h:$min:$sec.$ms$us";
- }
- }
-
- /**
- * Returns a new [DateTime] instance with [duration] added to [this].
- *
- * DateTime today = new DateTime.now();
- * DateTime sixtyDaysFromNow = today.add(new Duration(days: 60));
- */
- external DateTime add(Duration duration);
-
- /**
- * Returns a new [DateTime] instance with [duration] subtracted from [this].
- *
- * DateTime today = new DateTime.now();
- * DateTime sixtyDaysAgo = today.subtract(new Duration(days: 30));
- *
- * Notice that duration being subtracted is actually 30 * 24 * 60 * 60 seconds
- * and if that crosses a daylight saving time change, the resulting `DateTime`
- * won't have the same time of day as `today`, and may not actually hit the
- * calendar date 30 days earlier. Be careful when working with dates in local
- * time.
- */
- external DateTime subtract(Duration duration);
-
- /**
- * Returns a [Duration] with the difference between [this] and [other].
- *
- * DateTime berlinWallFell = new DateTime.utc(1989, DateTime.NOVEMBER, 9);
- * DateTime dDay = new DateTime.utc(1944, DateTime.JUNE, 6);
- *
- * Duration difference = berlinWallFell.difference(dDay);
- * assert(difference.inDays == 16592);
- *
- * The difference is measured in seconds and fractions of seconds.
- * The difference above counts the number of fractional seconds between
- * midnight at the beginning of those dates.
- * If the dates above had been in local time, not UTC, then the difference
- * between two midnights may not be a multiple of 24 hours due to daylight
- * saving differences.
- *
- * For example, in Australia, similar code using local time instead of UTC:
- *
- * DateTime berlinWallFell = new DateTime(1989, DateTime.NOVEMBER, 9);
- * DateTime dDay = new DateTime(1944, DateTime.JUNE, 6);
- * Duration difference = berlinWallFell.difference(dDay);
- * assert(difference.inDays == 16592);
- *
- * will fail because the difference is actually 16591 days and 23 hours, and
- * [Duration.inDays] only returns the number of whole days.
- */
- external Duration difference(DateTime other);
-
- external DateTime._internal(int year,
- int month,
- int day,
- int hour,
- int minute,
- int second,
- int millisecond,
- int microsecond,
- bool isUtc);
-
- external DateTime._now();
-
- /// Returns the time as value (millisecond or microsecond since epoch), or
- /// null if the values are out of range.
- external static int _brokenDownDateToValue(
- int year, int month, int day, int hour, int minute, int second,
- int millisecond, int microsecond, bool isUtc);
-
- /**
- * The number of milliseconds since
- * the "Unix epoch" 1970-01-01T00:00:00Z (UTC).
- *
- * This value is independent of the time zone.
- *
- * This value is at most
- * 8,640,000,000,000,000ms (100,000,000 days) from the Unix epoch.
- * In other words: `millisecondsSinceEpoch.abs() <= 8640000000000000`.
- */
- external int get millisecondsSinceEpoch;
-
- /**
- * The number of microseconds since
- * the "Unix epoch" 1970-01-01T00:00:00Z (UTC).
- *
- * This value is independent of the time zone.
- *
- * This value is at most
- * 8,640,000,000,000,000,000us (100,000,000 days) from the Unix epoch.
- * In other words: `microsecondsSinceEpoch.abs() <= 8640000000000000000`.
- *
- * Note that this value does not fit into 53 bits (the size of a IEEE double).
- * A JavaScript number is not able to hold this value.
- */
- external int get microsecondsSinceEpoch;
-
- /**
- * The abbreviated time zone name—for example,
- * [:"CET":] or [:"CEST":].
- */
- external String get timeZoneName;
-
- /**
- * The time zone offset, which
- * is the difference between local time and UTC.
- *
- * The offset is positive for time zones east of UTC.
- *
- * Note, that JavaScript, Python and C return the difference between UTC and
- * local time. Java, C# and Ruby return the difference between local time and
- * UTC.
- */
- external Duration get timeZoneOffset;
-
- /**
- * The year.
- *
- * DateTime moonLanding = DateTime.parse("1969-07-20 20:18:00");
- * assert(moonLanding.year == 1969);
- */
- external int get year;
-
- /**
- * The month [1..12].
- *
- * DateTime moonLanding = DateTime.parse("1969-07-20 20:18:00");
- * assert(moonLanding.month == 7);
- * assert(moonLanding.month == DateTime.JULY);
- */
- external int get month;
-
- /**
- * The day of the month [1..31].
- *
- * DateTime moonLanding = DateTime.parse("1969-07-20 20:18:00");
- * assert(moonLanding.day == 20);
- */
- external int get day;
-
- /**
- * The hour of the day, expressed as in a 24-hour clock [0..23].
- *
- * DateTime moonLanding = DateTime.parse("1969-07-20 20:18:00");
- * assert(moonLanding.hour == 20);
- */
- external int get hour;
-
- /**
- * The minute [0...59].
- *
- * DateTime moonLanding = DateTime.parse("1969-07-20 20:18:00");
- * assert(moonLanding.minute == 18);
- */
- external int get minute;
-
- /**
- * The second [0...59].
- *
- * DateTime moonLanding = DateTime.parse("1969-07-20 20:18:00");
- * assert(moonLanding.second == 0);
- */
- external int get second;
-
- /**
- * The millisecond [0...999].
- *
- * DateTime moonLanding = DateTime.parse("1969-07-20 20:18:00");
- * assert(moonLanding.millisecond == 0);
- */
- external int get millisecond;
-
- /**
- * The microsecond [0...999].
- *
- * DateTime moonLanding = DateTime.parse("1969-07-20 20:18:00");
- * assert(moonLanding.microsecond == 0);
- */
- external int get microsecond;
-
- /**
- * The day of the week [MONDAY]..[SUNDAY].
- *
- * In accordance with ISO 8601
- * a week starts with Monday, which has the value 1.
- *
- * DateTime moonLanding = DateTime.parse("1969-07-20 20:18:00");
- * assert(moonLanding.weekday == 7);
- * assert(moonLanding.weekday == DateTime.SUNDAY);
- *
- */
- external int get weekday;
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/core/double.dart b/pkg/dev_compiler/tool/input_sdk/lib/core/double.dart
deleted file mode 100644
index 87a8b51..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/core/double.dart
+++ /dev/null
@@ -1,206 +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.
-
-part of dart.core;
-
-// TODO: Convert this abstract class into a concrete class double
-// that uses the patch class functionality to account for the
-// different platform implementations.
-
-/**
- * A double-precision floating point number.
- *
- * Representation of Dart doubles containing double specific constants
- * and operations and specializations of operations inherited from
- * [num]. Dart doubles are 64-bit floating-point numbers as specified in the
- * IEEE 754 standard.
- *
- * The [double] type is contagious. Operations on [double]s return
- * [double] results.
- *
- * It is a compile-time error for a class to attempt to extend or implement
- * double.
- */
-abstract class double extends num {
- static const double NAN = 0.0 / 0.0;
- static const double INFINITY = 1.0 / 0.0;
- static const double NEGATIVE_INFINITY = -INFINITY;
- static const double MIN_POSITIVE = 5e-324;
- static const double MAX_FINITE = 1.7976931348623157e+308;
-
- double remainder(num other);
-
- /** Addition operator. */
- double operator +(num other);
-
- /** Subtraction operator. */
- double operator -(num other);
-
- /** Multiplication operator. */
- double operator *(num other);
-
- double operator %(num other);
-
- /** Division operator. */
- double operator /(num other);
-
- /**
- * Truncating division operator.
- *
- * The result of the truncating division `a ~/ b` is equivalent to
- * `(a / b).truncate()`.
- */
- int operator ~/(num other);
-
- /** Negate operator. */
- double operator -();
-
- /** Returns the absolute value of this [double]. */
- double abs();
-
- /**
- * Returns the sign of the double's numerical value.
- *
- * Returns -1.0 if the value is less than zero,
- * +1.0 if the value is greater than zero,
- * and the value itself if it is -0.0, 0.0 or NaN.
- */
- double get sign;
-
- /**
- * Returns the integer closest to `this`.
- *
- * Rounds away from zero when there is no closest integer:
- * `(3.5).round() == 4` and `(-3.5).round() == -4`.
- *
- * If `this` is not finite (`NaN` or infinity), throws an [UnsupportedError].
- */
- int round();
-
- /**
- * Returns the greatest integer no greater than `this`.
- *
- * If `this` is not finite (`NaN` or infinity), throws an [UnsupportedError].
- */
- int floor();
-
- /**
- * Returns the least integer no smaller than `this`.
- *
- * If `this` is not finite (`NaN` or infinity), throws an [UnsupportedError].
- */
- int ceil();
-
- /**
- * Returns the integer obtained by discarding any fractional
- * digits from `this`.
- *
- * If `this` is not finite (`NaN` or infinity), throws an [UnsupportedError].
- */
- int truncate();
-
- /**
- * Returns the integer double value closest to `this`.
- *
- * Rounds away from zero when there is no closest integer:
- * `(3.5).roundToDouble() == 4` and `(-3.5).roundToDouble() == -4`.
- *
- * If this is already an integer valued double, including `-0.0`, or it is not
- * a finite value, the value is returned unmodified.
- *
- * For the purpose of rounding, `-0.0` is considered to be below `0.0`,
- * and `-0.0` is therefore considered closer to negative numbers than `0.0`.
- * This means that for a value, `d` in the range `-0.5 < d < 0.0`,
- * the result is `-0.0`.
- */
- double roundToDouble();
-
- /**
- * Returns the greatest integer double value no greater than `this`.
- *
- * If this is already an integer valued double, including `-0.0`, or it is not
- * a finite value, the value is returned unmodified.
- *
- * For the purpose of rounding, `-0.0` is considered to be below `0.0`.
- * A number `d` in the range `0.0 < d < 1.0` will return `0.0`.
- */
- double floorToDouble();
-
- /**
- * Returns the least integer double value no smaller than `this`.
- *
- * If this is already an integer valued double, including `-0.0`, or it is not
- * a finite value, the value is returned unmodified.
- *
- * For the purpose of rounding, `-0.0` is considered to be below `0.0`.
- * A number `d` in the range `-1.0 < d < 0.0` will return `-0.0`.
- */
- double ceilToDouble();
-
- /**
- * Returns the integer double value obtained by discarding any fractional
- * digits from `this`.
- *
- * If this is already an integer valued double, including `-0.0`, or it is not
- * a finite value, the value is returned unmodified.
- *
- * For the purpose of rounding, `-0.0` is considered to be below `0.0`.
- * A number `d` in the range `-1.0 < d < 0.0` will return `-0.0`, and
- * in the range `0.0 < d < 1.0` it will return 0.0.
- */
- double truncateToDouble();
-
- /**
- * Provide a representation of this [double] value.
- *
- * The representation is a number literal such that the closest double value
- * to the representation's mathematical value is this [double].
- *
- * Returns "NaN" for the Not-a-Number value.
- * Returns "Infinity" and "-Infinity" for positive and negative Infinity.
- * Returns "-0.0" for negative zero.
- *
- * For all doubles, `d`, converting to a string and parsing the string back
- * gives the same value again: `d == double.parse(d.toString())` (except when
- * `d` is NaN).
- */
- String toString();
-
- /**
- * Parse [source] as an double literal and return its value.
- *
- * Accepts an optional sign (`+` or `-`) followed by either the characters
- * "Infinity", the characters "NaN" or a floating-point representation.
- * A floating-point representation is composed of a mantissa and an optional
- * exponent part. The mantissa is either a decimal point (`.`) followed by a
- * sequence of (decimal) digits, or a sequence of digits
- * optionally followed by a decimal point and optionally more digits. The
- * (optional) exponent part consists of the character "e" or "E", an optional
- * sign, and one or more digits.
- *
- * Leading and trailing whitespace is ignored.
- *
- * If the [source] is not a valid double literal, the [onError]
- * is called with the [source] as argument, and its return value is
- * used instead. If no `onError` is provided, a [FormatException]
- * is thrown instead.
- *
- * The [onError] function is only invoked if [source] is a [String] with an
- * invalid format. It is not invoked if the [source] is invalid for some
- * other reason, for example by being `null`.
- *
- * Examples of accepted strings:
- *
- * "3.14"
- * " 3.14 \xA0"
- * "0."
- * ".0"
- * "-1.e3"
- * "1234E+7"
- * "+.12e-9"
- * "-NaN"
- */
- external static double parse(String source,
- [double onError(String source)]);
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/core/duration.dart b/pkg/dev_compiler/tool/input_sdk/lib/core/duration.dart
deleted file mode 100644
index c5b73a2..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/core/duration.dart
+++ /dev/null
@@ -1,289 +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.
-
-part of dart.core;
-
-/**
- * A span of time, such as 27 days, 4 hours, 12 minutes, and 3 seconds.
- *
- * A `Duration` represents a difference from one point in time to another. The
- * duration may be "negative" if the difference is from a later time to an
- * earlier.
- *
- * To create a new Duration object, use this class's single constructor
- * giving the appropriate arguments:
- *
- * Duration fastestMarathon = new Duration(hours:2, minutes:3, seconds:2);
- *
- * The Duration is the sum of all individual parts.
- * This means that individual parts can be larger than the next-bigger unit.
- * For example, [minutes] can be greater than 59.
- *
- * assert(fastestMarathon.inMinutes == 123);
- *
- * All individual parts are allowed to be negative.
- *
- * Use one of the properties, such as [inDays],
- * to retrieve the integer value of the Duration in the specified time unit.
- * Note that the returned value is rounded down.
- * For example,
- *
- * Duration aLongWeekend = new Duration(hours:88);
- * assert(aLongWeekend.inDays == 3);
- *
- * This class provides a collection of arithmetic
- * and comparison operators,
- * plus a set of constants useful for converting time units.
- *
- * See [DateTime] to represent a point in time.
- * See [Stopwatch] to measure time-spans.
- *
- */
-class Duration implements Comparable<Duration> {
- static const int MICROSECONDS_PER_MILLISECOND = 1000;
- static const int MILLISECONDS_PER_SECOND = 1000;
- static const int SECONDS_PER_MINUTE = 60;
- static const int MINUTES_PER_HOUR = 60;
- static const int HOURS_PER_DAY = 24;
-
- static const int MICROSECONDS_PER_SECOND =
- MICROSECONDS_PER_MILLISECOND * MILLISECONDS_PER_SECOND;
- static const int MICROSECONDS_PER_MINUTE =
- MICROSECONDS_PER_SECOND * SECONDS_PER_MINUTE;
- static const int MICROSECONDS_PER_HOUR =
- MICROSECONDS_PER_MINUTE * MINUTES_PER_HOUR;
- static const int MICROSECONDS_PER_DAY =
- MICROSECONDS_PER_HOUR * HOURS_PER_DAY;
-
-
- static const int MILLISECONDS_PER_MINUTE =
- MILLISECONDS_PER_SECOND * SECONDS_PER_MINUTE;
- static const int MILLISECONDS_PER_HOUR =
- MILLISECONDS_PER_MINUTE * MINUTES_PER_HOUR;
- static const int MILLISECONDS_PER_DAY =
- MILLISECONDS_PER_HOUR * HOURS_PER_DAY;
-
- static const int SECONDS_PER_HOUR = SECONDS_PER_MINUTE * MINUTES_PER_HOUR;
- static const int SECONDS_PER_DAY = SECONDS_PER_HOUR * HOURS_PER_DAY;
-
- static const int MINUTES_PER_DAY = MINUTES_PER_HOUR * HOURS_PER_DAY;
-
- static const Duration ZERO = const Duration(seconds: 0);
-
- /*
- * The value of this Duration object in microseconds.
- */
- final int _duration;
-
- /**
- * Creates a new Duration object whose value
- * is the sum of all individual parts.
- *
- * Individual parts can be larger than the next-bigger unit.
- * For example, [hours] can be greater than 23.
- *
- * All individual parts are allowed to be negative.
- * All arguments are 0 by default.
- */
- const Duration({int days: 0,
- int hours: 0,
- int minutes: 0,
- int seconds: 0,
- int milliseconds: 0,
- int microseconds: 0})
- : this._microseconds(
- MICROSECONDS_PER_DAY * days +
- MICROSECONDS_PER_HOUR * hours +
- MICROSECONDS_PER_MINUTE * minutes +
- MICROSECONDS_PER_SECOND * seconds +
- MICROSECONDS_PER_MILLISECOND * milliseconds +
- microseconds);
-
- // Fast path internal direct constructor to avoids the optional arguments and
- // [_microseconds] recomputation.
- const Duration._microseconds(this._duration);
-
- /**
- * Adds this Duration and [other] and
- * returns the sum as a new Duration object.
- */
- Duration operator +(Duration other) {
- return new Duration._microseconds(_duration + other._duration);
- }
-
- /**
- * Subtracts [other] from this Duration and
- * returns the difference as a new Duration object.
- */
- Duration operator -(Duration other) {
- return new Duration._microseconds(_duration - other._duration);
- }
-
- /**
- * Multiplies this Duration by the given [factor] and returns the result
- * as a new Duration object.
- *
- * Note that when [factor] is a double, and the duration is greater than
- * 53 bits, precision is lost because of double-precision arithmetic.
- */
- Duration operator *(num factor) {
- return new Duration._microseconds((_duration * factor).round());
- }
-
- /**
- * Divides this Duration by the given [quotient] and returns the truncated
- * result as a new Duration object.
- *
- * Throws an [IntegerDivisionByZeroException] if [quotient] is `0`.
- */
- Duration operator ~/(int quotient) {
- // By doing the check here instead of relying on "~/" below we get the
- // exception even with dart2js.
- if (quotient == 0) throw new IntegerDivisionByZeroException();
- return new Duration._microseconds(_duration ~/ quotient);
- }
-
- /**
- * Returns `true` if the value of this Duration
- * is less than the value of [other].
- */
- bool operator <(Duration other) => this._duration < other._duration;
-
- /**
- * Returns `true` if the value of this Duration
- * is greater than the value of [other].
- */
- bool operator >(Duration other) => this._duration > other._duration;
-
- /**
- * Returns `true` if the value of this Duration
- * is less than or equal to the value of [other].
- */
- bool operator <=(Duration other) => this._duration <= other._duration;
-
- /**
- * Returns `true` if the value of this Duration
- * is greater than or equal to the value of [other].
- */
- bool operator >=(Duration other) => this._duration >= other._duration;
-
- /**
- * Returns the number of whole days spanned by this Duration.
- */
- int get inDays => _duration ~/ Duration.MICROSECONDS_PER_DAY;
-
- /**
- * Returns the number of whole hours spanned by this Duration.
- *
- * The returned value can be greater than 23.
- */
- int get inHours => _duration ~/ Duration.MICROSECONDS_PER_HOUR;
-
- /**
- * Returns the number of whole minutes spanned by this Duration.
- *
- * The returned value can be greater than 59.
- */
- int get inMinutes => _duration ~/ Duration.MICROSECONDS_PER_MINUTE;
-
- /**
- * Returns the number of whole seconds spanned by this Duration.
- *
- * The returned value can be greater than 59.
- */
- int get inSeconds => _duration ~/ Duration.MICROSECONDS_PER_SECOND;
-
- /**
- * Returns number of whole milliseconds spanned by this Duration.
- *
- * The returned value can be greater than 999.
- */
- int get inMilliseconds => _duration ~/ Duration.MICROSECONDS_PER_MILLISECOND;
-
- /**
- * Returns number of whole microseconds spanned by this Duration.
- */
- int get inMicroseconds => _duration;
-
- /**
- * Returns `true` if this Duration is the same object as [other].
- */
- bool operator ==(other) {
- if (other is !Duration) return false;
- return _duration == other._duration;
- }
-
- int get hashCode => _duration.hashCode;
-
- /**
- * Compares this Duration to [other], returning zero if the values are equal.
- *
- * Returns a negative integer if this `Duration` is shorter than
- * [other], or a positive integer if it is longer.
- *
- * A negative `Duration` is always considered shorter than a positive one.
- *
- * It is always the case that `duration1.compareTo(duration2) < 0` iff
- * `(someDate + duration1).compareTo(someDate + duration2) < 0`.
- */
- int compareTo(Duration other) => _duration.compareTo(other._duration);
-
- /**
- * Returns a string representation of this `Duration`.
- *
- * Returns a string with hours, minutes, seconds, and microseconds, in the
- * following format: `HH:MM:SS.mmmmmm`. For example,
- *
- * var d = new Duration(days:1, hours:1, minutes:33, microseconds: 500);
- * d.toString(); // "25:33:00.000500"
- */
- String toString() {
- String sixDigits(int n) {
- if (n >= 100000) return "$n";
- if (n >= 10000) return "0$n";
- if (n >= 1000) return "00$n";
- if (n >= 100) return "000$n";
- if (n >= 10) return "0000$n";
- return "00000$n";
- }
- String twoDigits(int n) {
- if (n >= 10) return "$n";
- return "0$n";
- }
-
- if (inMicroseconds < 0) {
- return "-${-this}";
- }
- String twoDigitMinutes = twoDigits(inMinutes.remainder(MINUTES_PER_HOUR));
- String twoDigitSeconds = twoDigits(inSeconds.remainder(SECONDS_PER_MINUTE));
- String sixDigitUs =
- sixDigits(inMicroseconds.remainder(MICROSECONDS_PER_SECOND));
- return "$inHours:$twoDigitMinutes:$twoDigitSeconds.$sixDigitUs";
- }
-
- /**
- * Returns whether this `Duration` is negative.
- *
- * A negative `Duration` represents the difference from a later time to an
- * earlier time.
- */
- bool get isNegative => _duration < 0;
-
- /**
- * Returns a new `Duration` representing the absolute value of this
- * `Duration`.
- *
- * The returned `Duration` has the same length as this one, but is always
- * positive.
- */
- Duration abs() => new Duration._microseconds(_duration.abs());
-
- /**
- * Returns a new `Duration` representing this `Duration` negated.
- *
- * The returned `Duration` has the same length as this one, but will have the
- * opposite sign of this one.
- */
- Duration operator -() => new Duration._microseconds(-_duration);
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/core/errors.dart b/pkg/dev_compiler/tool/input_sdk/lib/core/errors.dart
deleted file mode 100644
index c11ea2e..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/core/errors.dart
+++ /dev/null
@@ -1,573 +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.
-
-part of dart.core;
-
-/**
- * Error objects thrown in the case of a program failure.
- *
- * An `Error` object represents a program failure that the programmer
- * should have avoided.
- *
- * Examples include calling a function with invalid arguments,
- * or even with the wrong number of arguments,
- * or calling it at a time when it is not allowed.
- *
- * These are not errors that a caller should expect or catch -
- * if they occur, the program is erroneous,
- * and terminating the program may be the safest response.
- *
- * When deciding that a function throws an error,
- * the conditions where it happens should be clearly described,
- * and they should be detectable and predictable,
- * so the programmer using the function can avoid triggering the error.
- *
- * Such descriptions often uses words like
- * "must" or "must not" to describe the condition,
- * and if you see words like that in a function's documentation,
- * then not satisfying the requirement
- * is very likely to cause an error to be thrown.
- *
- * Example (from [String.contains]):
- *
- * `startIndex` must not be negative or greater than `length`.
- *
- * In this case, an error will be thrown if `startIndex` is negative
- * or too large.
- *
- * If the conditions are not detectable before calling a function,
- * the called function should not throw an `Error`.
- * It may still throw a value,
- * but the caller will have to catch the thrown value,
- * effectively making it an alternative result rather than an error.
- * The thrown object can choose to implement [Exception]
- * to document that it represents an exceptional, but not erroneous, occurrence,
- * but it has no other effect than documentation.
- *
- * All non-`null` values can be thrown in Dart.
- * Objects extending `Error` are handled specially:
- * The first time they are thrown,
- * the stack trace at the throw point is recorded
- * and stored in the error object.
- * It can be retrieved using the [stackTrace] getter.
- * An error object that merely implements `Error`, and doesn't extend it,
- * will not store the stack trace automatically.
- *
- * Error objects are also used for system wide failures
- * like stack overflow or an out-of-memory situation.
- *
- * Since errors are not created to be caught,
- * there is no need for subclasses to distinguish the errors.
- * Instead subclasses have been created in order to make groups
- * of related errors easy to create with consistent error messages.
- * For example, the [String.contains] method will use a [RangeError]
- * if its `startIndex` isn't in the range `0..length`,
- * which is easily created by `new RangeError.range(startIndex, 0, length)`.
- */
-class Error {
- Error(); // Prevent use as mixin.
-
- /**
- * Safely convert a value to a [String] description.
- *
- * The conversion is guaranteed to not throw, so it won't use the object's
- * toString method.
- */
- static String safeToString(Object object) {
- if (object is num || object is bool || null == object) {
- return object.toString();
- }
- if (object is String) {
- return _stringToSafeString(object);
- }
- return _objectToString(object);
- }
-
- /** Convert string to a valid string literal with no control characters. */
- external static String _stringToSafeString(String string);
-
- external static String _objectToString(Object object);
-
- external StackTrace get stackTrace;
-}
-
-/**
- * Error thrown by the runtime system when an assert statement fails.
- */
-class AssertionError extends Error {
- AssertionError();
- String toString() => "Assertion failed";
-}
-
-/**
- * Error thrown by the runtime system when a type assertion fails.
- */
-class TypeError extends AssertionError {
-}
-
-/**
- * Error thrown by the runtime system when a cast operation fails.
- */
-class CastError extends Error {
-}
-
-/**
- * Error thrown when attempting to throw [:null:].
- */
-class NullThrownError extends Error {
- String toString() => "Throw of null.";
-}
-
-/**
- * Error thrown when a function is passed an unacceptable argument.
- */
-class ArgumentError extends Error {
- /** Whether value was provided. */
- final bool _hasValue;
- /** The invalid value. */
- final invalidValue;
- /** Name of the invalid argument, if available. */
- final String name;
- /** Message describing the problem. */
- final message;
-
- /**
- * The [message] describes the erroneous argument.
- *
- * Existing code may be using `message` to hold the invalid value.
- * If the `message` is not a [String], it is assumed to be a value instead
- * of a message.
- */
- ArgumentError([this.message])
- : invalidValue = null,
- _hasValue = false,
- name = null;
-
- /**
- * Creates error containing the invalid [value].
- *
- * A message is built by suffixing the [message] argument with
- * the [name] argument (if provided) and the value. Example
- *
- * "Invalid argument (foo): null"
- *
- * The `name` should match the argument name of the function, but if
- * the function is a method implementing an interface, and its argument
- * names differ from the interface, it might be more useful to use the
- * interface method's argument name (or just rename arguments to match).
- */
- ArgumentError.value(value,
- [String this.name,
- String this.message])
- : invalidValue = value,
- _hasValue = true;
-
- /**
- * Create an argument error for a `null` argument that must not be `null`.
- */
- ArgumentError.notNull([this.name])
- : _hasValue = false,
- message = "Must not be null",
- invalidValue = null;
-
- // Helper functions for toString overridden in subclasses.
- String get _errorName => "Invalid argument${!_hasValue ? "(s)" : ""}";
- String get _errorExplanation => "";
-
- String toString() {
- String nameString = "";
- if (name != null) {
- nameString = " ($name)";
- }
- var message = (this.message == null) ? "" : ": ${this.message}";
- String prefix = "$_errorName$nameString$message";
- if (!_hasValue) return prefix;
- // If we know the invalid value, we can try to describe the problem.
- String explanation = _errorExplanation;
- String errorValue = Error.safeToString(invalidValue);
- return "$prefix$explanation: $errorValue";
- }
-}
-
-/**
- * Error thrown due to an index being outside a valid range.
- */
-class RangeError extends ArgumentError {
- /** The minimum value that [value] is allowed to assume. */
- final num start;
- /** The maximum value that [value] is allowed to assume. */
- final num end;
-
- // 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)
- : start = null, end = null, super(message);
-
- /**
- * Create a new [RangeError] with a message for the given [value].
- *
- * An optional [name] can specify the argument name that has the
- * invalid value, and the [message] can override the default error
- * description.
- */
- RangeError.value(num value, [String name, String message])
- : start = null, end = null,
- super.value(value, name,
- (message != null) ? message : "Value not in range");
-
- /**
- * Create a new [RangeError] with for an invalid value being outside a range.
- *
- * The allowed range is from [minValue] to [maxValue], inclusive.
- * If `minValue` or `maxValue` are `null`, the range is infinite in
- * that direction.
- *
- * For a range from 0 to the length of something, end exclusive, use
- * [RangeError.index].
- *
- * An optional [name] can specify the argument name that has the
- * invalid value, and the [message] can override the default error
- * description.
- */
- RangeError.range(num invalidValue, int minValue, int maxValue,
- [String name, String message])
- : start = minValue,
- end = maxValue,
- super.value(invalidValue, name,
- (message != null) ? message : "Invalid value");
-
- /**
- * Creates a new [RangeError] stating that [index] is not a valid index
- * into [indexable].
- *
- * An optional [name] can specify the argument name that has the
- * invalid value, and the [message] can override the default error
- * description.
- *
- * The [length] is the length of [indexable] at the time of the error.
- * If `length` is omitted, it defaults to `indexable.length`.
- */
- factory RangeError.index(int index, indexable,
- [String name,
- String message,
- int length]) = IndexError;
-
- /**
- * Check that a [value] lies in a specific interval.
- *
- * Throws if [value] is not in the interval.
- * The interval is from [minValue] to [maxValue], both inclusive.
- */
- static void checkValueInInterval(int value, int minValue, int maxValue,
- [String name, String message]) {
- if (value < minValue || value > maxValue) {
- throw new RangeError.range(value, minValue, maxValue, name, message);
- }
- }
-
- /**
- * Check that a value is a valid index into an indexable object.
- *
- * Throws if [index] is not a valid index into [indexable].
- *
- * An indexable object is one that has a `length` and a and index-operator
- * `[]` that accepts an index if `0 <= index < length`.
- *
- * If [length] is provided, it is used as the length of the indexable object,
- * otherwise the length is found as `indexable.length`.
- */
- static void checkValidIndex(int index, var indexable,
- [String name, int length, String message]) {
- if (length == null) length = indexable.length;
- // Comparing with `0` as receiver produces better dart2js type inference.
- if (0 > index || index >= length) {
- if (name == null) name = "index";
- throw new RangeError.index(index, indexable, name, message, length);
- }
- }
-
- /**
- * Check that a range represents a slice of an indexable object.
- *
- * Throws if the range is not valid for an indexable object with
- * the given [length].
- * A range is valid for an indexable object with a given [length]
- *
- * if `0 <= [start] <= [end] <= [length]`.
- * An `end` of `null` is considered equivalent to `length`.
- *
- * The [startName] and [endName] defaults to `"start"` and `"end"`,
- * respectively.
- *
- * Returns the actual `end` value, which is `length` if `end` is `null`,
- * and `end` otherwise.
- */
- static int checkValidRange(int start, int end, int length,
- [String startName, String endName,
- String message]) {
- // Comparing with `0` as receiver produces better dart2js type inference.
- // Ditto `start > end` below.
- if (0 > start || start > length) {
- if (startName == null) startName = "start";
- throw new RangeError.range(start, 0, length, startName, message);
- }
- if (end != null) {
- if (start > end || end > length) {
- if (endName == null) endName = "end";
- throw new RangeError.range(end, start, length, endName, message);
- }
- return end;
- }
- return length;
- }
-
- /**
- * Check that an integer value isn't negative.
- *
- * Throws if the value is negative.
- */
- static void checkNotNegative(int value, [String name, String message]) {
- if (value < 0) throw new RangeError.range(value, 0, null, name, message);
- }
-
- String get _errorName => "RangeError";
- String get _errorExplanation {
- assert(_hasValue);
- String explanation = "";
- if (start == null) {
- if (end != null) {
- explanation = ": Not less than or equal to $end";
- }
- // If both are null, we don't add a description of the limits.
- } else if (end == null) {
- explanation = ": Not greater than or equal to $start";
- } else if (end > start) {
- explanation = ": Not in range $start..$end, inclusive";
- } else if (end < start) {
- explanation = ": Valid value range is empty";
- } else {
- // end == start.
- explanation = ": Only valid value is $start";
- }
- return explanation;
- }
-}
-
-/**
- * A specialized [RangeError] used when an index is not in the range
- * `0..indexable.length-1`.
- *
- * Also contains the indexable object, its length at the time of the error,
- * and the invalid index itself.
- */
-class IndexError extends ArgumentError implements RangeError {
- /** The indexable object that [index] was not a valid index into. */
- final indexable;
- /** The length of [indexable] at the time of the error. */
- final int length;
-
- /**
- * Creates a new [IndexError] stating that [invalidValue] is not a valid index
- * into [indexable].
- *
- * The [length] is the length of [indexable] at the time of the error.
- * If `length` is omitted, it defaults to `indexable.length`.
- *
- * The message is used as part of the string representation of the error.
- */
- IndexError(int invalidValue, indexable,
- [String name, String message, int length])
- : this.indexable = indexable,
- this.length = (length != null) ? length : indexable.length,
- super.value(invalidValue, name,
- (message != null) ? message : "Index out of range");
-
- // Getters inherited from RangeError.
- int get start => 0;
- int get end => length - 1;
-
- String get _errorName => "RangeError";
- String get _errorExplanation {
- assert(_hasValue);
- if (invalidValue < 0) {
- return ": index must not be negative";
- }
- if (length == 0) {
- return ": no indices are valid";
- }
- return ": index should be less than $length";
- }
-}
-
-
-/**
- * Error thrown when control reaches the end of a switch case.
- *
- * The Dart specification requires this error to be thrown when
- * control reaches the end of a switch case (except the last case
- * of a switch) without meeting a break or similar end of the control
- * flow.
- */
-class FallThroughError extends Error {
- FallThroughError();
-}
-
-/**
- * Error thrown when trying to instantiate an abstract class.
- */
-class AbstractClassInstantiationError extends Error {
- final String _className;
- AbstractClassInstantiationError(String this._className);
- String toString() => "Cannot instantiate abstract class: '$_className'";
-}
-
-
-/**
- * Error thrown by the default implementation of [:noSuchMethod:] on [Object].
- */
-class NoSuchMethodError extends Error {
- final Object _receiver;
- final Symbol _memberName;
- final List _arguments;
- final Map<Symbol, dynamic> _namedArguments;
- final List _existingArgumentNames;
-
- /**
- * Create a [NoSuchMethodError] corresponding to a failed method call.
- *
- * The [receiver] is the receiver of the method call.
- * That is, the object on which the method was attempted called.
- * If the receiver is `null`, it is interpreted as a call to a top-level
- * function of a library.
- *
- * The [memberName] is a [Symbol] representing the name of the called method
- * or accessor. It should not be `null`.
- *
- * The [positionalArguments] is a list of the positional arguments that the
- * method was called with. If `null`, it is considered equivalent to the
- * empty list.
- *
- * The [namedArguments] is a map from [Symbol]s to the values of named
- * arguments that the method was called with.
- *
- * The optional [existingArgumentNames] is the expected parameters of a
- * method with the same name on the receiver, if available. This is
- * the signature of the method that would have been called if the parameters
- * had matched.
- */
- NoSuchMethodError(Object receiver,
- Symbol memberName,
- List positionalArguments,
- Map<Symbol ,dynamic> namedArguments,
- [List existingArgumentNames = null])
- : _receiver = receiver,
- _memberName = memberName,
- _arguments = positionalArguments,
- _namedArguments = namedArguments,
- _existingArgumentNames = existingArgumentNames;
-
- external String toString();
-}
-
-
-/**
- * The operation was not allowed by the object.
- *
- * This [Error] is thrown when an instance cannot implement one of the methods
- * in its signature.
- */
-class UnsupportedError extends Error {
- final String message;
- UnsupportedError(this.message);
- String toString() => "Unsupported operation: $message";
-}
-
-
-/**
- * Thrown by operations that have not been implemented yet.
- *
- * This [Error] is thrown by unfinished code that hasn't yet implemented
- * all the features it needs.
- *
- * If a class is not intending to implement the feature, it should throw
- * an [UnsupportedError] instead. This error is only intended for
- * use during development.
- */
-class UnimplementedError extends Error implements UnsupportedError {
- final String message;
- UnimplementedError([String this.message]);
- String toString() => (this.message != null
- ? "UnimplementedError: $message"
- : "UnimplementedError");
-}
-
-
-/**
- * The operation was not allowed by the current state of the object.
- *
- * This is a generic error used for a variety of different erroneous
- * actions. The message should be descriptive.
- */
-class StateError extends Error {
- final String message;
- StateError(this.message);
- String toString() => "Bad state: $message";
-}
-
-
-/**
- * Error occurring when a collection is modified during iteration.
- *
- * Some modifications may be allowed for some collections, so each collection
- * ([Iterable] or similar collection of values) should declare which operations
- * are allowed during an iteration.
- */
-class ConcurrentModificationError extends Error {
- /** The object that was modified in an incompatible way. */
- final Object modifiedObject;
-
- ConcurrentModificationError([this.modifiedObject]);
-
- String toString() {
- if (modifiedObject == null) {
- return "Concurrent modification during iteration.";
- }
- return "Concurrent modification during iteration: "
- "${Error.safeToString(modifiedObject)}.";
- }
-}
-
-
-class OutOfMemoryError implements Error {
- const OutOfMemoryError();
- String toString() => "Out of Memory";
-
- StackTrace get stackTrace => null;
-}
-
-
-class StackOverflowError implements Error {
- const StackOverflowError();
- String toString() => "Stack Overflow";
-
- StackTrace get stackTrace => null;
-}
-
-/**
- * Error thrown when a lazily initialized variable cannot be initialized.
- *
- * A static/library variable with an initializer expression is initialized
- * the first time it is read. If evaluating the initializer expression causes
- * another read of the variable, this error is thrown.
- */
-class CyclicInitializationError extends Error {
- final String variableName;
- CyclicInitializationError([this.variableName]);
- String toString() => variableName == null
- ? "Reading static variable during its initialization"
- : "Reading static variable '$variableName' during its initialization";
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/core/exceptions.dart b/pkg/dev_compiler/tool/input_sdk/lib/core/exceptions.dart
deleted file mode 100644
index 7484ed5..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/core/exceptions.dart
+++ /dev/null
@@ -1,181 +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.
-
-part of dart.core;
-
-// Exceptions are thrown either by the VM or from Dart code.
-
-/**
- * A marker interface implemented by all core library exceptions.
- *
- * An [Exception] is intended to convey information to the user about a failure,
- * so that the error can be addressed programmatically. It is intended to be
- * caught, and it should contain useful data fields.
- *
- * Creating instances of [Exception] directly with [:new Exception("message"):]
- * is discouraged, and only included as a temporary measure during development,
- * until the actual exceptions used by a library are done.
- */
-abstract class Exception {
- factory Exception([var message]) => new _Exception(message);
-}
-
-
-/** Default implementation of [Exception] which carries a message. */
-class _Exception implements Exception {
- final message;
-
- _Exception([this.message]);
-
- String toString() {
- if (message == null) return "Exception";
- return "Exception: $message";
- }
-}
-
-
-/**
- * Exception thrown when a string or some other data does not have an expected
- * format and cannot be parsed or processed.
- */
-class FormatException implements Exception {
- /**
- * A message describing the format error.
- */
- final String message;
-
- /**
- * The actual source input which caused the error.
- *
- * This is usually a [String], but can be other types too.
- * If it is a string, parts of it may be included in the [toString] message.
- *
- * The source is `null` if omitted or unknown.
- */
- final source;
-
- /**
- * The offset in [source] where the error was detected.
- *
- * A zero-based offset into the source that marks the format error causing
- * this exception to be created. If `source` is a string, this should be a
- * string index in the range `0 <= offset <= source.length`.
- *
- * If input is a string, the [toString] method may represent this offset as
- * a line and character position. The offset should be inside the string,
- * or at the end of the string.
- *
- * May be omitted. If present, [source] should also be present if possible.
- */
- final int offset;
-
- /**
- * Creates a new FormatException with an optional error [message].
- *
- * Optionally also supply the actual [source] with the incorrect format,
- * and the [offset] in the format where a problem was detected.
- */
- const FormatException([this.message = "", this.source, this.offset]);
-
- /**
- * Returns a description of the format exception.
- *
- * The description always contains the [message].
- *
- * If [source] is present and is a string, the description will contain
- * (at least a part of) the source.
- * If [offset] is also provided, the part of the source included will
- * contain that offset, and the offset will be marked.
- *
- * If the source is a string and it contains a line break before offset,
- * only the line containing offset will be included, and its line number
- * will also be part of the description. Line and character offsets are
- * 1-based.
- */
- String toString() {
- String report = "FormatException";
- if (message != null && "" != message) {
- report = "$report: $message";
- }
- int offset = this.offset;
- if (source is! String) {
- if (offset != null) {
- report += " (at offset $offset)";
- }
- return report;
- }
- if (offset != null && (offset < 0 || offset > source.length)) {
- offset = null;
- }
- // Source is string and offset is null or valid.
- if (offset == null) {
- String source = this.source;
- if (source.length > 78) {
- source = source.substring(0, 75) + "...";
- }
- return "$report\n$source";
- }
- int lineNum = 1;
- int lineStart = 0;
- bool lastWasCR;
- for (int i = 0; i < offset; i++) {
- int char = source.codeUnitAt(i);
- if (char == 0x0a) {
- if (lineStart != i || !lastWasCR) {
- lineNum++;
- }
- lineStart = i + 1;
- lastWasCR = false;
- } else if (char == 0x0d) {
- lineNum++;
- lineStart = i + 1;
- lastWasCR = true;
- }
- }
- if (lineNum > 1) {
- report += " (at line $lineNum, character ${offset - lineStart + 1})\n";
- } else {
- report += " (at character ${offset + 1})\n";
- }
- int lineEnd = source.length;
- for (int i = offset; i < source.length; i++) {
- int char = source.codeUnitAt(i);
- if (char == 0x0a || char == 0x0d) {
- lineEnd = i;
- break;
- }
- }
- int length = lineEnd - lineStart;
- int start = lineStart;
- int end = lineEnd;
- String prefix = "";
- String postfix = "";
- if (length > 78) {
- // Can't show entire line. Try to anchor at the nearest end, if
- // one is within reach.
- int index = offset - lineStart;
- if (index < 75) {
- end = start + 75;
- postfix = "...";
- } else if (end - offset < 75) {
- start = end - 75;
- prefix = "...";
- } else {
- // Neither end is near, just pick an area around the offset.
- start = offset - 36;
- end = offset + 36;
- prefix = postfix = "...";
- }
- }
- String slice = source.substring(start, end);
- int markOffset = offset - start + prefix.length;
- return "$report$prefix$slice$postfix\n${" " * markOffset}^\n";
- }
-}
-
-// Exception thrown when doing integer division with a zero divisor.
-class IntegerDivisionByZeroException implements Exception {
- const IntegerDivisionByZeroException();
- String toString() => "IntegerDivisionByZeroException";
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/core/expando.dart b/pkg/dev_compiler/tool/input_sdk/lib/core/expando.dart
deleted file mode 100644
index 2ecd2dc..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/core/expando.dart
+++ /dev/null
@@ -1,64 +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.
-
-part of dart.core;
-
-/**
- * An [Expando] allows adding new properties to objects.
- *
- * Does not work on numbers, strings, booleans or null.
- *
- * An `Expando` does not hold on to the added property value after an object
- * becomes inacessible.
- *
- * Since you can always create a new number that is identical to an existing
- * number, it means that an expando property on a number could never be
- * released. To avoid this, expando properties cannot be added to numbers.
- * The same argument applies to strings, booleans and null, which also have
- * literals that evaluate to identical values when they occur more than once.
- *
- * There is no restriction on other classes, even for compile time constant
- * objects. Be careful if adding expando properties to compile time constants,
- * since they will stay alive forever.
- */
-class Expando<T> {
-
- /**
- * The name of the this [Expando] as passed to the constructor. If
- * no name was passed to the constructor, the name is [:null:].
- */
- final String name;
-
- /**
- * Creates a new [Expando]. The optional name is only used for
- * debugging purposes and creating two different [Expando]s with the
- * same name yields two [Expando]s that work on different properties
- * of the objects they are used on.
- */
- external Expando([String name]);
-
- /**
- * Expando toString method override.
- */
- String toString() => "Expando:$name";
-
- /**
- * Gets the value of this [Expando]'s property on the given
- * object. If the object hasn't been expanded, the method returns
- * [:null:].
- *
- * The object must not be a number, a string, a boolean or null.
- */
- external T operator [](Object object);
-
- /**
- * Sets the value of this [Expando]'s property on the given
- * object. Properties can effectively be removed again by setting
- * their value to null.
- *
- * The object must not be a number, a string, a boolean or null.
- */
- external void operator []=(Object object, T value);
-
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/core/function.dart b/pkg/dev_compiler/tool/input_sdk/lib/core/function.dart
deleted file mode 100644
index a349c36..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/core/function.dart
+++ /dev/null
@@ -1,67 +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.
-
-part of dart.core;
-
-/**
- * The base class for all function types.
- *
- * A function value, or an instance of a class with a "call" method, is a
- * subtype of a function type, and as such, a subtype of [Function].
- */
-abstract class Function {
- /**
- * Dynamically call [function] with the specified arguments.
- *
- * Acts the same as calling function with positional arguments
- * corresponding to the elements of [positionalArguments] and
- * named arguments corresponding to the elements of [namedArguments].
- *
- * This includes giving the same errors if [function] isn't callable or
- * if it expects different parameters.
- *
- * Example:
- * Map<Symbol, dynamic> namedArguments = new Map<Symbol, dynamic>();
- * namedArguments[const Symbol("f")] = 4;
- * namedArguments[const Symbol("g")] = 5;
- * Function.apply(foo, [1,2,3], namedArguments);
- *
- * gives exactly the same result as
- * foo(1, 2, 3, f: 4, g: 5).
- *
- * If [positionalArguments] is null, it's considered an empty list.
- * If [namedArguments] is omitted or null, it is considered an empty map.
- */
- external static apply(Function function,
- List positionalArguments,
- [Map<Symbol, dynamic> namedArguments]);
-
- /**
- * Returns a hash code value that is compatible with `operator==`.
- */
- int get hashCode;
-
- /**
- * Test whether another object is equal to this function.
- *
- * System-created function objects are only equal to other functions.
- *
- * Two function objects are known to represent the same function if
- *
- * - It is the same object. Static and top-level functions are compile time
- * constants when used as values, so referring to the same function twice
- * always give the same object,
- * - or if they refer to the same member method extracted from the same object.
- * Extracting a member method as a function value twice gives equal, but
- * not necessarily identical, function values.
- *
- * Function expressions never give rise to equal function objects. Each time
- * a function expression is evaluated, it creates a new closure value that
- * is not known to be equal to other closures created by the same expression.
- *
- * Classes implementing `Function` by having a `call` method should have their
- * own `operator==` and `hashCode` depending on the object.
- */
- bool operator==(Object other);
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/core/identical.dart b/pkg/dev_compiler/tool/input_sdk/lib/core/identical.dart
deleted file mode 100644
index cc00c30..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/core/identical.dart
+++ /dev/null
@@ -1,21 +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.
-
-part of dart.core;
-
-/**
- * Check whether two references are to the same object.
- */
-external bool identical(Object a, Object b);
-
-/**
- * Returns the identity hash code of `object`.
- *
- * Returns the same value as `object.hashCode` if [object] has not overridden
- * [Object.hashCode]. Returns the value that [Object.hashCode] would return
- * on this object, even if `hashCode` has been overridden.
- *
- * This hash code is compatible with [identical].
- */
-external int identityHashCode(Object object);
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/core/int.dart b/pkg/dev_compiler/tool/input_sdk/lib/core/int.dart
deleted file mode 100644
index 0884d8f..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/core/int.dart
+++ /dev/null
@@ -1,320 +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.
-
-part of dart.core;
-
-/**
- * An arbitrarily large integer.
- *
- * **Note:** When compiling to JavaScript, integers are
- * implemented as JavaScript numbers. When compiling to JavaScript,
- * integers are therefore restricted to 53 significant bits because
- * all JavaScript numbers are double-precision floating point
- * values. The behavior of the operators and methods in the [int]
- * class therefore sometimes differs between the Dart VM and Dart code
- * compiled to JavaScript.
- *
- * It is a compile-time error for a class to attempt to extend or implement int.
- */
-abstract class int extends num {
- /**
- * Returns the integer value of the given environment declaration [name].
- *
- * The result is the same as would be returned by:
- *
- * int.parse(const String.fromEnvironment(name, defaultValue: ""),
- * (_) => defaultValue)
- *
- * Example:
- *
- * const int.fromEnvironment("defaultPort", defaultValue: 80)
- */
- external const factory int.fromEnvironment(String name, {int defaultValue});
-
- /**
- * Bit-wise and operator.
- *
- * Treating both `this` and [other] as sufficiently large two's component
- * integers, the result is a number with only the bits set that are set in
- * both `this` and [other]
- *
- * Of both operands are negative, the result is negative, otherwise
- * the result is non-negative.
- */
- int operator &(int other);
-
- /**
- * Bit-wise or operator.
- *
- * Treating both `this` and [other] as sufficiently large two's component
- * integers, the result is a number with the bits set that are set in either
- * of `this` and [other]
- *
- * If both operands are non-negative, the result is non-negative,
- * otherwise the result us negative.
- */
- int operator |(int other);
-
- /**
- * Bit-wise exclusive-or operator.
- *
- * Treating both `this` and [other] as sufficiently large two's component
- * integers, the result is a number with the bits set that are set in one,
- * but not both, of `this` and [other]
- *
- * If the operands have the same sign, the result is non-negative,
- * otherwise the result is negative.
- */
- int operator ^(int other);
-
- /**
- * The bit-wise negate operator.
- *
- * Treating `this` as a sufficiently large two's component integer,
- * the result is a number with the opposite bits set.
- *
- * This maps any integer `x` to `-x - 1`.
- */
- int operator ~();
-
- /**
- * Shift the bits of this integer to the left by [shiftAmount].
- *
- * Shifting to the left makes the number larger, effectively multiplying
- * the number by `pow(2, shiftIndex)`.
- *
- * There is no limit on the size of the result. It may be relevant to
- * limit intermediate values by using the "and" operator with a suitable
- * mask.
- *
- * It is an error if [shiftAmount] is negative.
- */
- int operator <<(int shiftAmount);
-
- /**
- * Shift the bits of this integer to the right by [shiftAmount].
- *
- * Shifting to the right makes the number smaller and drops the least
- * significant bits, effectively doing an integer division by
- *`pow(2, shiftIndex)`.
- *
- * It is an error if [shiftAmount] is negative.
- */
- int operator >>(int shiftAmount);
-
- /**
- * Returns this integer to the power of [exponent] modulo [modulus].
- *
- * The [exponent] must be non-negative and [modulus] must be
- * positive.
- */
- int modPow(int exponent, int modulus);
-
- /**
- * Returns the modular multiplicative inverse of this integer
- * modulo [modulus].
- *
- * The [modulus] must be positive.
- *
- * It is an error if no modular inverse exists.
- */
- int modInverse(int modulus);
-
- /**
- * Returns the greatest common divisor of this integer and [other].
- *
- * If either number is non-zero, the result is the numerically greatest
- * integer dividing both `this` and `other`.
- *
- * The greatest common divisor is independent of the order,
- * so `x.gcd(y)` is always the same as `y.gcd(x)`.
- *
- * For any integer `x`, `x.gcd(x)` is `x.abs()`.
- *
- * If both `this` and `other` is zero, the result is also zero.
- */
- int gcd(int other);
-
- /** Returns true if and only if this integer is even. */
- bool get isEven;
-
- /** Returns true if and only if this integer is odd. */
- bool get isOdd;
-
- /**
- * Returns the minimum number of bits required to store this integer.
- *
- * The number of bits excludes the sign bit, which gives the natural length
- * for non-negative (unsigned) values. Negative values are complemented to
- * return the bit position of the first bit that differs from the sign bit.
- *
- * To find the number of bits needed to store the value as a signed value,
- * add one, i.e. use `x.bitLength + 1`.
- *
- * x.bitLength == (-x-1).bitLength
- *
- * 3.bitLength == 2; // 00000011
- * 2.bitLength == 2; // 00000010
- * 1.bitLength == 1; // 00000001
- * 0.bitLength == 0; // 00000000
- * (-1).bitLength == 0; // 11111111
- * (-2).bitLength == 1; // 11111110
- * (-3).bitLength == 2; // 11111101
- * (-4).bitLength == 2; // 11111100
- */
- int get bitLength;
-
- /**
- * Returns the least significant [width] bits of this integer as a
- * non-negative number (i.e. unsigned representation). The returned value has
- * zeros in all bit positions higher than [width].
- *
- * (-1).toUnsigned(5) == 31 // 11111111 -> 00011111
- *
- * This operation can be used to simulate arithmetic from low level languages.
- * For example, to increment an 8 bit quantity:
- *
- * q = (q + 1).toUnsigned(8);
- *
- * `q` will count from `0` up to `255` and then wrap around to `0`.
- *
- * If the input fits in [width] bits without truncation, the result is the
- * same as the input. The minimum width needed to avoid truncation of `x` is
- * given by `x.bitLength`, i.e.
- *
- * x == x.toUnsigned(x.bitLength);
- */
- int toUnsigned(int width);
-
- /**
- * Returns the least significant [width] bits of this integer, extending the
- * highest retained bit to the sign. This is the same as truncating the value
- * to fit in [width] bits using an signed 2-s complement representation. The
- * returned value has the same bit value in all positions higher than [width].
- *
- * V--sign bit-V
- * 16.toSigned(5) == -16 // 00010000 -> 11110000
- * 239.toSigned(5) == 15 // 11101111 -> 00001111
- * ^ ^
- *
- * This operation can be used to simulate arithmetic from low level languages.
- * For example, to increment an 8 bit signed quantity:
- *
- * q = (q + 1).toSigned(8);
- *
- * `q` will count from `0` up to `127`, wrap to `-128` and count back up to
- * `127`.
- *
- * If the input value fits in [width] bits without truncation, the result is
- * the same as the input. The minimum width needed to avoid truncation of `x`
- * is `x.bitLength + 1`, i.e.
- *
- * x == x.toSigned(x.bitLength + 1);
- */
- int toSigned(int width);
-
- /**
- * Return the negative value of this integer.
- *
- * The result of negating an integer always has the opposite sign, except
- * for zero, which is its own negation.
- */
- int operator -();
-
- /**
- * Returns the absolute value of this integer.
- *
- * For any integer `x`, the result is the same as `x < 0 ? -x : x`.
- */
- int abs();
-
- /**
- * Returns the sign of this integer.
- *
- * Returns 0 for zero, -1 for values less than zero and
- * +1 for values greater than zero.
- */
- int get sign;
-
- /** Returns `this`. */
- int round();
-
- /** Returns `this`. */
- int floor();
-
- /** Returns `this`. */
- int ceil();
-
- /** Returns `this`. */
- int truncate();
-
- /** Returns `this.toDouble()`. */
- double roundToDouble();
-
- /** Returns `this.toDouble()`. */
- double floorToDouble();
-
- /** Returns `this.toDouble()`. */
- double ceilToDouble();
-
- /** Returns `this.toDouble()`. */
- double truncateToDouble();
-
- /**
- * Returns a String-representation of this integer.
- *
- * The returned string is parsable by [parse].
- * For any `int` [:i:], it is guaranteed that
- * [:i == int.parse(i.toString()):].
- */
- String toString();
-
- /**
- * Converts [this] to a string representation in the given [radix].
- *
- * In the string representation, lower-case letters are used for digits above
- * '9', with 'a' being 10 an 'z' being 35.
- *
- * The [radix] argument must be an integer in the range 2 to 36.
- */
- String toRadixString(int radix);
-
- /**
- * Parse [source] as a, possibly signed, integer literal and return its value.
- *
- * The [source] must be a non-empty sequence of base-[radix] digits,
- * optionally prefixed with a minus or plus sign ('-' or '+').
- *
- * The [radix] must be in the range 2..36. The digits used are
- * first the decimal digits 0..9, and then the letters 'a'..'z' with
- * values 10 through 35. Also accepts upper-case letters with the same
- * values as the lower-case ones.
- *
- * If no [radix] is given then it defaults to 10. In this case, the [source]
- * digits may also start with `0x`, in which case the number is interpreted
- * as a hexadecimal literal, which effectively means that the `0x` is ignored
- * and the radix is instead set to 16.
- *
- * For any int [:n:] and radix [:r:], it is guaranteed that
- * [:n == int.parse(n.toRadixString(r), radix: r):].
- *
- * If the [source] is not a valid integer literal, optionally prefixed by a
- * sign, the [onError] is called with the [source] as argument, and its return
- * value is used instead. If no [onError] is provided, a [FormatException]
- * is thrown.
- *
- * The [onError] handler can be chosen to return `null`. This is preferable
- * to to throwing and then immediately catching the [FormatException].
- * Example:
- *
- * var value = int.parse(text, onError: (source) => null);
- * if (value == null) ... handle the problem
- *
- * The [onError] function is only invoked if [source] is a [String]. It is
- * not invoked if the [source] is, for example, `null`.
- */
- external static int parse(String source,
- { int radix,
- int onError(String source) });
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/core/invocation.dart b/pkg/dev_compiler/tool/input_sdk/lib/core/invocation.dart
deleted file mode 100644
index 7deaeec..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/core/invocation.dart
+++ /dev/null
@@ -1,52 +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.
-
-part of dart.core;
-
-/**
- * Representation of the invocation of a member on an object.
- *
- * This is the type of objects passed to [Object.noSuchMethod] when
- * an object doesn't support the member invocation that was attempted
- * on it.
- */
-abstract class Invocation {
- /** The name of the invoked member. */
- Symbol get memberName;
-
- /**
- * An unmodifiable view of the positional arguments of the call.
- *
- * If the member is a getter, the positional arguments is empty.
- */
- List get positionalArguments;
-
- /**
- * An unmodifiable view of the named arguments of the call.
- *
- * If the member is a getter, setter or operator, the named arguments
- * is empty.
- */
- Map<Symbol, dynamic> get namedArguments;
-
- /** Whether the invocation was a method call. */
- bool get isMethod;
-
- /**
- * Whether the invocation was a getter call.
- * If so, both types of arguments is empty.
- */
- bool get isGetter;
-
- /**
- * Whether the invocation was a setter call.
- *
- * If so, [arguments] has exactly one positonal argument,
- * and [namedArguments] is empty.
- */
- bool get isSetter;
-
- /** Whether the invocation was a getter or a setter call. */
- bool get isAccessor => isGetter || isSetter;
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/core/iterable.dart b/pkg/dev_compiler/tool/input_sdk/lib/core/iterable.dart
deleted file mode 100644
index cf05cde..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/core/iterable.dart
+++ /dev/null
@@ -1,683 +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.
-
-part of dart.core;
-
-/**
- * A collection of values, or "elements", that can be accessed sequentially.
- *
- * The elements of the iterable are accessed by getting an [Iterator]
- * using the [iterator] getter, and using it to step through the values.
- * Stepping with the iterator is done by calling [Iterator.moveNext],
- * and if the call returns `true`,
- * the iterator has now moved to the next element,
- * which is then available as [Iterator.current].
- * If the call returns `false`, there are no more elements,
- * and `iterator.currrent` returns `null`.
- *
- * You can create more than one iterator from the same `Iterable`.
- * Each time `iterator` is read, it returns a new iterator,
- * and different iterators can be stepped through independently,
- * each giving access to all the elements of the iterable.
- * The iterators of the same iterable *should* provide the same values
- * in the same order (unless the underlying collection is modified between
- * the iterations, which some collections allow).
- *
- * You can also iterate over the elements of an `Iterable`
- * using the for-in loop construct, which uses the `iterator` getter behind the
- * scenes.
- * For example, you can iterate over all of the keys of a [Map],
- * because `Map` keys are iterable.
- *
- * Map kidsBooks = {'Matilda': 'Roald Dahl',
- * 'Green Eggs and Ham': 'Dr Seuss',
- * 'Where the Wild Things Are': 'Maurice Sendak'};
- * for (var book in kidsBooks.keys) {
- * print('$book was written by ${kidsBooks[book]}');
- * }
- *
- * The [List] and [Set] classes are both `Iterable`,
- * as are most classes in the [dart:collection](#dart-collection) library.
- *
- * Some [Iterable] collections can be modified.
- * Adding an element to a `List` or `Set` will change which elements it
- * contains, and adding a new key to a `Map` changes the elements of [Map.keys].
- * Iterators created after the change will provide the new elements, and may
- * or may not preserve the order of existing elements
- * (for example, a [HashSet] may completely change its order when a single
- * element is added).
- *
- * Changing a collection *while* it is being iterated
- * is generally *not* allowed.
- * Doing so will break the iteration, which is typically signalled
- * by throwing a [ConcurrentModificationError]
- * the next time [Iterator.moveNext] is called.
- * The current value of [Iterator.current] getter
- * should not be affected by the change in the collection,
- * the `current` value was set by the previous call to [Iterator.moveNext].
- *
- * Some iterables compute their elements dynamically every time they are
- * iterated, like the one returned by [Iterable.generate] or the iterable
- * returned by a `sync*` generator function. If the computation doesn't depend
- * on other objects that may change, then the generated sequence should be
- * the same one every time it's iterated.
- *
- * The members of `Iterable`, other than `iterator` itself,
- * work by looking at the elements of the iterable.
- * This can be implemented by running through the [iterator], but some classes
- * may have more efficient ways of finding the result
- * (like [last] or [length] on a [List], or [contains] on a [Set]).
- *
- * The methods that return another `Iterable` (like [map] and [where])
- * are all *lazy* - they will iterate the original (as necessary)
- * every time the returned iterable is iterated, and not before.
- *
- * Since an iterable may be iterated more than once, it's not recommended to
- * have detectable side-effects in the iterator.
- * For methods like [map] and [while], the returned iterable will execute the
- * argument function on every iteration, so those functions should also not
- * have side effects.
- */
-abstract class Iterable<E> {
- const Iterable();
-
- /**
- * Creates an `Iterable` that generates its elements dynamically.
- *
- * An `Iterator` created by [iterator] will count from
- * zero to [:count - 1:], and call [generator]
- * with each index in turn to create the next value.
- *
- * If [generator] is omitted, it defaults to an identity function
- * on integers `(int x) => x`, so it should only be omitted if the type
- * parameter allows integer values.
- *
- * As an `Iterable`, `new Iterable.generate(n, generator))` is equivalent to
- * `const [0, ..., n - 1].map(generator)`.
- */
- factory Iterable.generate(int count, [E generator(int index)]) {
- if (count <= 0) return new EmptyIterable<E>();
- return new _GeneratorIterable<E>(count, generator);
- }
-
- /**
- * Creates an empty iterable.
- *
- * The empty iterable has no elements, and iterating it always stops
- * immediately.
- */
- const factory Iterable.empty() = EmptyIterable<E>;
-
- /**
- * Returns a new `Iterator` that allows iterating the elements of this
- * `Iterable`.
- *
- * Iterable classes may specify the iteration order of their elements
- * (for example [List] always iterate in index order),
- * or they may leave it unspecified (for example a hash-based [Set]
- * may iterate in any order).
- *
- * Each time `iterator` is read, it returns a new iterator,
- * which can be used to iterate through all the elements again.
- * The iterators of the same iterable can be stepped through independently,
- * but should return the same elements in the same order,
- * as long as the underlying collection isn't changed.
- *
- * Modifying the collection may cause new iterators to produce
- * different elements, and may change the order of existing elements.
- * A [List] specifies its iteration order precisely,
- * so modifying the list changes the iteration order predictably.
- * A hash-based [Set] may change its iteration order completely
- * when adding a new element to the set.
- *
- * Modifying the underlying collection after creating the new iterator
- * may cause an error the next time [Iterator.moveNext] is called
- * on that iterator.
- * Any *modifiable* iterable class should specify which operations will
- * break iteration.
- */
- Iterator<E> get iterator;
-
- /**
- * Returns a new lazy [Iterable] with elements that are created by
- * calling `f` on each element of this `Iterable` in iteration order.
- *
- * This method returns a view of the mapped elements. As long as the
- * returned [Iterable] is not iterated over, the supplied function [f] will
- * not be invoked. The transformed elements will not be cached. Iterating
- * multiple times over the returned [Iterable] will invoke the supplied
- * function [f] multiple times on the same element.
- *
- * Methods on the returned iterable are allowed to omit calling `f`
- * on any element where the result isn't needed.
- * For example, [elementAt] may call `f` only once.
- */
- Iterable/*<T>*/ map/*<T>*/(/*=T*/ f(E e)) =>
- new MappedIterable<E, dynamic/*=T*/>(this, f);
-
- /**
- * Returns a new lazy [Iterable] with all elements that satisfy the
- * predicate [test].
- *
- * The matching elements have the same order in the returned iterable
- * as they have in [iterator].
- *
- * This method returns a view of the mapped elements. As long as the
- * returned [Iterable] is not iterated over, the supplied function [test] will
- * not be invoked. Iterating will not cache results, and thus iterating
- * multiple times over the returned [Iterable] will invoke the supplied
- * function [test] multiple times on the same element.
- */
- Iterable<E> where(bool test(E element)) =>
- new WhereIterable<E>(this, test);
-
- /**
- * Expands each element of this [Iterable] into zero or more elements.
- *
- * The resulting Iterable runs through the elements returned
- * by [f] for each element of this, in iteration order.
- *
- * The returned [Iterable] is lazy, and calls [f] for each element
- * of this every time it's iterated.
- */
- Iterable/*<T>*/ expand/*<T>*/(Iterable/*<T>*/ f(E element)) =>
- new ExpandIterable<E, dynamic/*=T*/>(this, f);
-
- /**
- * Returns true if the collection contains an element equal to [element].
- *
- * This operation will check each element in order for being equal to
- * [element], unless it has a more efficient way to find an element
- * equal to [element].
- *
- * The equality used to determine whether [element] is equal to an element of
- * the iterable defaults to the [Object.operator==] of the element.
- *
- * Some types of iterable may have a different equality used for its elements.
- * For example, a [Set] may have a custom equality
- * (see [Set.identical]) that its `contains` uses.
- * Likewise the `Iterable` returned by a [Map.keys] call
- * should use the same equality that the `Map` uses for keys.
- */
- bool contains(Object element) {
- for (E e in this) {
- if (e == element) return true;
- }
- return false;
- }
-
-
- /**
- * Applies the function [f] to each element of this collection in iteration
- * order.
- */
- void forEach(void f(E element)) {
- for (E element in this) f(element);
- }
-
- /**
- * Reduces a collection to a single value by iteratively combining elements
- * of the collection using the provided function.
- *
- * The iterable must have at least one element.
- * If it has only one element, that element is returned.
- *
- * Otherwise this method starts with the first element from the iterator,
- * and then combines it with the remaining elements in iteration order,
- * as if by:
- *
- * E value = iterable.first;
- * iterable.skip(1).forEach((element) {
- * value = combine(value, element);
- * });
- * return value;
- *
- * Example of calculating the sum of an iterable:
- *
- * iterable.reduce((value, element) => value + element);
- *
- */
- E reduce(E combine(E value, E element)) {
- Iterator<E> iterator = this.iterator;
- if (!iterator.moveNext()) {
- throw IterableElementError.noElement();
- }
- E value = iterator.current;
- while (iterator.moveNext()) {
- value = combine(value, iterator.current);
- }
- return value;
- }
-
- /**
- * Reduces a collection to a single value by iteratively combining each
- * element of the collection with an existing value
- *
- * Uses [initialValue] as the initial value,
- * then iterates through the elements and updates the value with
- * each element using the [combine] function, as if by:
- *
- * var value = initialValue;
- * for (E element in this) {
- * value = combine(value, element);
- * }
- * return value;
- *
- * Example of calculating the sum of an iterable:
- *
- * iterable.fold(0, (prev, element) => prev + element);
- *
- */
- dynamic/*=T*/ fold/*<T>*/(var/*=T*/ initialValue,
- dynamic/*=T*/ combine(var/*=T*/ previousValue, E element)) {
- var value = initialValue;
- for (E element in this) value = combine(value, element);
- return value;
- }
-
- /**
- * Checks whether every element of this iterable satisfies [test].
- *
- * Checks every element in iteration order, and returns `false` if
- * any of them make [test] return `false`, otherwise returns `true`.
- */
- bool every(bool f(E element)) {
- for (E element in this) {
- if (!f(element)) return false;
- }
- return true;
- }
-
- /**
- * Converts each element to a [String] and concatenates the strings.
- *
- * Iterates through elements of this iterable,
- * converts each one to a [String] by calling [Object.toString],
- * and then concatenates the strings, with the
- * [separator] string interleaved between the elements.
- */
- String join([String separator = ""]) {
- Iterator<E> iterator = this.iterator;
- if (!iterator.moveNext()) return "";
- StringBuffer buffer = new StringBuffer();
- if (separator == null || separator == "") {
- do {
- buffer.write("${iterator.current}");
- } while (iterator.moveNext());
- } else {
- buffer.write("${iterator.current}");
- while (iterator.moveNext()) {
- buffer.write(separator);
- buffer.write("${iterator.current}");
- }
- }
- return buffer.toString();
- }
-
-
- /**
- * Checks whether any element of this iterable satisfies [test].
- *
- * Checks every element in iteration order, and returns `true` if
- * any of them make [test] return `true`, otherwise returns false.
- */
- bool any(bool f(E element)) {
- for (E element in this) {
- if (f(element)) return true;
- }
- return false;
- }
-
- /**
- * Creates a [List] containing the elements of this [Iterable].
- *
- * The elements are in iteration order.
- * The list is fixed-length if [growable] is false.
- */
- List<E> toList({ bool growable: true }) =>
- new List<E>.from(this, growable: growable);
-
- /**
- * Creates a [Set] containing the same elements as this iterable.
- *
- * The set may contain fewer elements than the iterable,
- * if the iterable contains an element more than once,
- * or it contains one or more elements that are equal.
- * The order of the elements in the set is not guaranteed to be the same
- * as for the iterable.
- */
- Set<E> toSet() => new Set<E>.from(this);
-
- /**
- * Returns the number of elements in [this].
- *
- * Counting all elements may involve iterating through all elements and can
- * therefore be slow.
- * Some iterables have a more efficient way to find the number of elements.
- */
- int get length {
- assert(this is! EfficientLength);
- int count = 0;
- Iterator it = iterator;
- while (it.moveNext()) {
- count++;
- }
- return count;
- }
-
- /**
- * Returns `true` if there are no elements in this collection.
- *
- * May be computed by checking if `iterator.moveNext()` returns `false`.
- */
- bool get isEmpty => !iterator.moveNext();
-
- /**
- * Returns true if there is at least one element in this collection.
- *
- * May be computed by checking if `iterator.moveNext()` returns `true`.
- */
- bool get isNotEmpty => !isEmpty;
-
- /**
- * Returns a lazy iterable of the [count] first elements of this iterable.
- *
- * The returned `Iterable` may contain fewer than `count` elements, if `this`
- * contains fewer than `count` elements.
- *
- * The elements can be computed by stepping through [iterator] until [count]
- * elements have been seen.
- *
- * The `count` must not be negative.
- */
- Iterable<E> take(int count) {
- return new TakeIterable<E>(this, count);
- }
-
- /**
- * Returns a lazy iterable of the leading elements satisfying [test].
- *
- * The filtering happens lazily. Every new iterator of the returned
- * iterable starts iterating over the elements of `this`.
- *
- * The elements can be computed by stepping through [iterator] until an
- * element is found where `test(element)` is false. At that point,
- * the returned iterable stops (its `moveNext()` returns false).
- */
- Iterable<E> takeWhile(bool test(E value)) {
- return new TakeWhileIterable<E>(this, test);
- }
-
- /**
- * Returns an Iterable that provides all but the first [count] elements.
- *
- * When the returned iterable is iterated, it starts iterating over `this`,
- * first skipping past the initial [count] elements.
- * If `this` has fewer than `count` elements, then the resulting Iterable is
- * empty.
- * After that, the remaining elements are iterated in the same order as
- * in this iterable.
- *
- * The `count` must not be negative.
- */
- Iterable<E> skip(int count) {
- return new SkipIterable<E>(this, count);
- }
-
- /**
- * Returns an Iterable that skips leading elements while [test] is satisfied.
- *
- * The filtering happens lazily. Every new Iterator of the returned
- * Iterable iterates over all elements of `this`.
- *
- * The returned iterable provides elements by iterating this iterable,
- * but skipping over all initial elements where `test(element)` returns
- * true. If all elements satisfy `test` the resulting iterable is empty,
- * otherwise it iterates the remaining elements in their original order,
- * starting with the first element for which `test(element)` returns false.
- */
- Iterable<E> skipWhile(bool test(E value)) {
- return new SkipWhileIterable<E>(this, test);
- }
-
- /**
- * Returns the first element.
- *
- * Throws a [StateError] if `this` is empty.
- * Otherwise returns the first element in the iteration order,
- * equivalent to `this.elementAt(0)`.
- */
- E get first {
- Iterator<E> it = iterator;
- if (!it.moveNext()) {
- throw IterableElementError.noElement();
- }
- return it.current;
- }
-
- /**
- * Returns the last element.
- *
- * Throws a [StateError] if `this` is empty.
- * Otherwise may iterate through the elements and returns the last one
- * seen.
- * Some iterables may have more efficient ways to find the last element
- * (for example a list can directly access the last element,
- * without iterating through the previous ones).
- */
- E get last {
- Iterator<E> it = iterator;
- if (!it.moveNext()) {
- throw IterableElementError.noElement();
- }
- E result;
- do {
- result = it.current;
- } while(it.moveNext());
- return result;
- }
-
- /**
- * Checks that this iterable has only one element, and returns that element.
- *
- * Throws a [StateError] if `this` is empty or has more than one element.
- */
- E get single {
- Iterator<E> it = iterator;
- if (!it.moveNext()) throw IterableElementError.noElement();
- E result = it.current;
- if (it.moveNext()) throw IterableElementError.tooMany();
- return result;
- }
-
- /**
- * Returns the first element that satisfies the given predicate [test].
- *
- * Iterates through elements and returns the first to satsify [test].
- *
- * If no element satisfies [test], the result of invoking the [orElse]
- * function is returned.
- * If [orElse] is omitted, it defaults to throwing a [StateError].
- */
- E firstWhere(bool test(E element), { E orElse() }) {
- for (E element in this) {
- if (test(element)) return element;
- }
- if (orElse != null) return orElse();
- throw IterableElementError.noElement();
- }
-
- /**
- * Returns the last element that satisfies the given predicate [test].
- *
- * An iterable that can access its elements directly may check its
- * elements in any order (for example a list starts by checking the
- * last element and then moves towards the start of the list).
- * The default implementation iterates elements in iteration order,
- * checks `test(element)` for each,
- * and finally returns that last one that matched.
- *
- * If no element satsfies [test], the result of invoking the [orElse]
- * function is returned.
- * If [orElse] is omitted, it defaults to throwing a [StateError].
- */
- E lastWhere(bool test(E element), {E orElse()}) {
- E result = null;
- bool foundMatching = false;
- for (E element in this) {
- if (test(element)) {
- result = element;
- foundMatching = true;
- }
- }
- if (foundMatching) return result;
- if (orElse != null) return orElse();
- throw IterableElementError.noElement();
- }
-
- /**
- * Returns the single element that satisfies [test].
- *
- * Checks all elements to see if `test(element)` returns true.
- * If exactly one element satisfies [test], that element is returned.
- * Otherwise, if there are no matching elements, or if there is more than
- * one matching element, a [StateError] is thrown.
- */
- E singleWhere(bool test(E element)) {
- E result = null;
- bool foundMatching = false;
- for (E element in this) {
- if (test(element)) {
- if (foundMatching) {
- throw IterableElementError.tooMany();
- }
- result = element;
- foundMatching = true;
- }
- }
- if (foundMatching) return result;
- throw IterableElementError.noElement();
- }
-
- /**
- * Returns the [index]th element.
- *
- * The [index] must be non-negative and less than [length].
- * Index zero represents the first element (so `iterable.elementAt(0)` is
- * equivalent to `iterable.first`).
- *
- * May iterate through the elements in iteration order, skipping the
- * first `index` elements and returning the next.
- * Some iterable may have more efficient ways to find the element.
- */
- E elementAt(int index) {
- if (index is! int) throw new ArgumentError.notNull("index");
- RangeError.checkNotNegative(index, "index");
- int elementIndex = 0;
- for (E element in this) {
- if (index == elementIndex) return element;
- elementIndex++;
- }
- throw new RangeError.index(index, this, "index", null, elementIndex);
- }
-
- /**
- * Returns a string representation of (some of) the elements of `this`.
- *
- * Elements are represented by their own `toString` results.
- *
- * The default representation always contains the first three elements.
- * If there are less than a hundred elements in the iterable, it also
- * contains the last two elements.
- *
- * If the resulting string isn't above 80 characters, more elements are
- * included from the start of the iterable.
- *
- * The conversion may omit calling `toString` on some elements if they
- * are known to not occur in the output, and it may stop iterating after
- * a hundred elements.
- */
- String toString() => IterableBase.iterableToShortString(this, '(', ')');
-}
-
-typedef E _Generator<E>(int index);
-
-class _GeneratorIterable<E> extends Iterable<E>
- implements EfficientLength {
- final int _start;
- final int _end;
- final _Generator<E> _generator;
-
- /// Creates an iterable that builds the elements from a generator function.
- ///
- /// The [generator] may be null, in which case the default generator
- /// enumerating the integer positions is used. This means that [int] must
- /// be assignable to [E] when no generator is provided. In practice this means
- /// that the generator can only be emitted when [E] is equal to `dynamic`,
- /// `int`, or `num`. The constructor will check that the types match.
- _GeneratorIterable(this._end, E generator(int n))
- : _start = 0,
- // The `as` below is used as check to make sure that `int` is assignable
- // to [E].
- _generator = (generator != null) ? generator : _id as _Generator<E>;
-
- _GeneratorIterable.slice(this._start, this._end, this._generator);
-
- Iterator<E> get iterator =>
- new _GeneratorIterator<E>(_start, _end, _generator);
- int get length => _end - _start;
-
- Iterable<E> skip(int count) {
- RangeError.checkNotNegative(count, "count");
- if (count == 0) return this;
- int newStart = _start + count;
- if (newStart >= _end) return new EmptyIterable<E>();
- return new _GeneratorIterable<E>.slice(newStart, _end, _generator);
- }
-
- Iterable<E> take(int count) {
- RangeError.checkNotNegative(count, "count");
- if (count == 0) return new EmptyIterable<E>();
- int newEnd = _start + count;
- if (newEnd >= _end) return this;
- return new _GeneratorIterable<E>.slice(_start, newEnd, _generator);
- }
-
- static int _id(int n) => n;
-}
-
-class _GeneratorIterator<E> implements Iterator<E> {
- final int _end;
- final _Generator<E> _generator;
- int _index;
- E _current;
-
- _GeneratorIterator(this._index, this._end, this._generator);
-
- bool moveNext() {
- if (_index < _end) {
- _current = _generator(_index);
- _index++;
- return true;
- } else {
- _current = null;
- return false;
- }
- }
-
- E get current => _current;
-}
-
-/**
- * An Iterator that allows moving backwards as well as forwards.
- */
-abstract class BidirectionalIterator<E> implements Iterator<E> {
- /**
- * Move back to the previous element.
- *
- * Returns true and updates [current] if successful. Returns false
- * and sets [current] to null if there is no previous element.
- */
- bool movePrevious();
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/core/iterator.dart b/pkg/dev_compiler/tool/input_sdk/lib/core/iterator.dart
deleted file mode 100644
index cd0ad32..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/core/iterator.dart
+++ /dev/null
@@ -1,62 +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.
-
-part of dart.core;
-
-/**
- * An interface for getting items, one at a time, from an object.
- *
- * The for-in construct transparently uses `Iterator` to test for the end
- * of the iteration, and to get each item (or _element_).
- *
- * If the object iterated over is changed during the iteration, the
- * behavior is unspecified.
- *
- * The `Iterator` is initially positioned before the first element.
- * Before accessing the first element the iterator must thus be advanced using
- * [moveNext] to point to the first element.
- * If no element is left, then [moveNext] returns false, [current]
- * returns `null`, and all further calls to [moveNext] will also return false.
- *
- * A typical usage of an Iterator looks as follows:
- *
- * var it = obj.iterator;
- * while (it.moveNext()) {
- * use(it.current);
- * }
- *
- * **See also:**
- * [Iteration](http://www.dartlang.org/docs/dart-up-and-running/contents/ch03.html#iteration)
- * in the [library tour](http://www.dartlang.org/docs/dart-up-and-running/contents/ch03.html)
- */
-abstract class Iterator<E> {
- /**
- * Moves to the next element.
- *
- * Returns true if [current] contains the next element.
- * Returns false if no elements are left.
- *
- * It is safe to invoke [moveNext] even when the iterator is already
- * positioned after the last element.
- * In this case [moveNext] returns false again and has no effect.
- *
- * A call to `moveNext` may throw if iteration has been broken by
- * changing the underlying collection.
- */
- bool moveNext();
-
- /**
- * Returns the current element.
- *
- * Returns `null` if the iterator has not yet been moved to the first
- * element, or if the iterator has been moved past the last element of the
- * [Iterable].
- *
- * The `current` getter should keep its value until the next call to
- * [moveNext], even if an underlying collection changes.
- * After a successful call to `moveNext`, the user doesn't need to cache
- * the current value, but can keep reading it from the iterator.
- */
- E get current;
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/core/list.dart b/pkg/dev_compiler/tool/input_sdk/lib/core/list.dart
deleted file mode 100644
index d4e69cf..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/core/list.dart
+++ /dev/null
@@ -1,489 +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.
-
-part of dart.core;
-
-/**
- * An indexable collection of objects with a length.
- *
- * Subclasses of this class implement different kinds of lists.
- * The most common kinds of lists are:
- *
- * * Fixed-length list.
- * An error occurs when attempting to use operations
- * that can change the length of the list.
- *
- * * Growable list. Full implementation of the API defined in this class.
- *
- * The default growable list, as returned by `new List()` or `[]`, keeps
- * an internal buffer, and grows that buffer when necessary. This guarantees
- * that a sequence of [add] operations will each execute in amortized constant
- * time. Setting the length directly may take time proportional to the new
- * length, and may change the internal capacity so that a following add
- * operation will need to immediately increase the buffer capacity.
- * Other list implementations may have different performance behavior.
- *
- * The following code illustrates that some List implementations support
- * only a subset of the API.
- *
- * List<int> fixedLengthList = new List(5);
- * fixedLengthList.length = 0; // Error
- * fixedLengthList.add(499); // Error
- * fixedLengthList[0] = 87;
- * List<int> growableList = [1, 2];
- * growableList.length = 0;
- * growableList.add(499);
- * growableList[0] = 87;
- *
- * Lists are [Iterable]. Iteration occurs over values in index order. Changing
- * the values does not affect iteration, but changing the valid
- * indices—that is, changing the list's length—between iteration
- * steps causes a [ConcurrentModificationError]. This means that only growable
- * lists can throw ConcurrentModificationError. If the length changes
- * temporarily and is restored before continuing the iteration, the iterator
- * does not detect it.
- *
- * It is generally not allowed to modify the list's length (adding or removing
- * elements) while an operation on the list is being performed,
- * for example during a call to [forEach] or [sort].
- * Changing the list's length while it is being iterated, either by iterating it
- * directly or through iterating an [Iterable] that is backed by the list, will
- * break the iteration.
- */
-abstract class List<E> implements Iterable<E>, EfficientLength {
- /**
- * Creates a list of the given length.
- *
- * The created list is fixed-length if [length] is provided.
- *
- * List fixedLengthList = new List(3);
- * fixedLengthList.length; // 3
- * fixedLengthList.length = 1; // Error
- *
- * The list has length 0 and is growable if [length] is omitted.
- *
- * List growableList = new List();
- * growableList.length; // 0;
- * growableList.length = 3;
- *
- * To create a growable list with a given length, just assign the length
- * right after creation:
- *
- * List growableList = new List()..length = 500;
- *
- * The [length] must not be negative or null, if it is provided.
- */
- external factory List([int length]);
-
- /**
- * Creates a fixed-length list of the given length, and initializes the
- * value at each position with [fill]:
- *
- * new List<int>.filled(3, 0); // [0, 0, 0]
- *
- * The [length] must be a non-negative integer.
- *
- * If the list is growable, changing its length will not initialize new
- * entries with [fill]. After being created and filled, the list is
- * no different from any other growable or fixed-length list
- * created using [List].
- */
- external factory List.filled(int length, E fill, {bool growable: false});
-
- /**
- * Creates a list containing all [elements].
- *
- * The [Iterator] of [elements] provides the order of the elements.
- *
- * This constructor returns a growable list when [growable] is true;
- * otherwise, it returns a fixed-length list.
- */
- external factory List.from(Iterable elements, { bool growable: true });
-
- /**
- * Generates a list of values.
- *
- * Creates a list with [length] positions and fills it with values created by
- * calling [generator] for each index in the range `0` .. `length - 1`
- * in increasing order.
- *
- * new List<int>.generate(3, (int index) => index * index); // [0, 1, 4]
- *
- * The created list is fixed-length unless [growable] is true.
- */
- factory List.generate(int length, E generator(int index),
- { bool growable: true }) {
- List<E> result;
- if (growable) {
- result = <E>[]..length = length;
- } else {
- result = new List<E>(length);
- }
- for (int i = 0; i < length; i++) {
- result[i] = generator(i);
- }
- return result;
- }
-
- /**
- * Creates an unmodifiable list containing all [elements].
- *
- * The [Iterator] of [elements] provides the order of the elements.
- *
- * An unmodifiable list cannot have its length or elements changed.
- * If the elements are themselves immutable, then the resulting list
- * is also immutable.
- */
- external factory List.unmodifiable(Iterable elements);
-
- /**
- * Returns the object at the given [index] in the list
- * or throws a [RangeError] if [index] is out of bounds.
- */
- E operator [](int index);
-
- /**
- * Sets the value at the given [index] in the list to [value]
- * or throws a [RangeError] if [index] is out of bounds.
- */
- void operator []=(int index, E value);
-
- /**
- * Returns the number of objects in this list.
- *
- * The valid indices for a list are `0` through `length - 1`.
- */
- int get length;
-
- /**
- * Changes the length of this list.
- *
- * If [newLength] is greater than
- * the current length, entries are initialized to [:null:].
- *
- * Throws an [UnsupportedError] if the list is fixed-length.
- */
- void set length(int newLength);
-
- /**
- * Adds [value] to the end of this list,
- * extending the length by one.
- *
- * Throws an [UnsupportedError] if the list is fixed-length.
- */
- void add(E value);
-
- /**
- * Appends all objects of [iterable] to the end of this list.
- *
- * Extends the length of the list by the number of objects in [iterable].
- * Throws an [UnsupportedError] if this list is fixed-length.
- */
- void addAll(Iterable<E> iterable);
-
- /**
- * Returns an [Iterable] of the objects in this list in reverse order.
- */
- Iterable<E> get reversed;
-
- /**
- * Sorts this list according to the order specified by the [compare] function.
- *
- * The [compare] function must act as a [Comparator].
- *
- * List<String> numbers = ['two', 'three', 'four'];
- * // Sort from shortest to longest.
- * numbers.sort((a, b) => a.length.compareTo(b.length));
- * print(numbers); // [two, four, three]
- *
- * The default List implementations use [Comparable.compare] if
- * [compare] is omitted.
- *
- * List<int> nums = [13, 2, -11];
- * nums.sort();
- * print(nums); // [-11, 2, 13]
- *
- * A [Comparator] may compare objects as equal (return zero), even if they
- * are distinct objects.
- * The sort function is not guaranteed to be stable, so distinct objects
- * that compare as equal may occur in any order in the result:
- *
- * List<String> numbers = ['one', 'two', 'three', 'four'];
- * numbers.sort((a, b) => a.length.compareTo(b.length));
- * print(numbers); // [one, two, four, three] OR [two, one, four, three]
- */
- void sort([int compare(E a, E b)]);
-
- /**
- * Shuffles the elements of this list randomly.
- */
- void shuffle([Random random]);
-
- /**
- * Returns the first index of [element] in this list.
- *
- * Searches the list from index [start] to the end of the list.
- * The first time an object [:o:] is encountered so that [:o == element:],
- * the index of [:o:] is returned.
- *
- * List<String> notes = ['do', 're', 'mi', 're'];
- * notes.indexOf('re'); // 1
- * notes.indexOf('re', 2); // 3
- *
- * Returns -1 if [element] is not found.
- *
- * notes.indexOf('fa'); // -1
- */
- int indexOf(E element, [int start = 0]);
-
- /**
- * Returns the last index of [element] in this list.
- *
- * Searches the list backwards from index [start] to 0.
- *
- * The first time an object [:o:] is encountered so that [:o == element:],
- * the index of [:o:] is returned.
- *
- * List<String> notes = ['do', 're', 'mi', 're'];
- * notes.lastIndexOf('re', 2); // 1
- *
- * If [start] is not provided, this method searches from the end of the
- * list./Returns
- *
- * notes.lastIndexOf('re'); // 3
- *
- * Returns -1 if [element] is not found.
- *
- * notes.lastIndexOf('fa'); // -1
- */
- int lastIndexOf(E element, [int start]);
-
- /**
- * Removes all objects from this list;
- * the length of the list becomes zero.
- *
- * Throws an [UnsupportedError], and retains all objects, if this
- * is a fixed-length list.
- */
- void clear();
-
- /**
- * Inserts the object at position [index] in this list.
- *
- * This increases the length of the list by one and shifts all objects
- * at or after the index towards the end of the list.
- *
- * An error occurs if the [index] is less than 0 or greater than length.
- * An [UnsupportedError] occurs if the list is fixed-length.
- */
- void insert(int index, E element);
-
- /**
- * Inserts all objects of [iterable] at position [index] in this list.
- *
- * This increases the length of the list by the length of [iterable] and
- * shifts all later objects towards the end of the list.
- *
- * An error occurs if the [index] is less than 0 or greater than length.
- * An [UnsupportedError] occurs if the list is fixed-length.
- */
- void insertAll(int index, Iterable<E> iterable);
-
- /**
- * Overwrites objects of `this` with the objects of [iterable], starting
- * at position [index] in this list.
- *
- * List<String> list = ['a', 'b', 'c'];
- * list.setAll(1, ['bee', 'sea']);
- * list.join(', '); // 'a, bee, sea'
- *
- * This operation does not increase the length of `this`.
- *
- * The [index] must be non-negative and no greater than [length].
- *
- * The [iterable] must not have more elements than what can fit from [index]
- * to [length].
- *
- * If `iterable` is based on this list, its values may change /during/ the
- * `setAll` operation.
- */
- void setAll(int index, Iterable<E> iterable);
-
- /**
- * Removes the first occurence of [value] from this list.
- *
- * Returns true if [value] was in the list, false otherwise.
- *
- * List<String> parts = ['head', 'shoulders', 'knees', 'toes'];
- * parts.remove('head'); // true
- * parts.join(', '); // 'shoulders, knees, toes'
- *
- * The method has no effect if [value] was not in the list.
- *
- * // Note: 'head' has already been removed.
- * parts.remove('head'); // false
- * parts.join(', '); // 'shoulders, knees, toes'
- *
- * An [UnsupportedError] occurs if the list is fixed-length.
- */
- bool remove(Object value);
-
- /**
- * Removes the object at position [index] from this list.
- *
- * This method reduces the length of `this` by one and moves all later objects
- * down by one position.
- *
- * Returns the removed object.
- *
- * The [index] must be in the range `0 ≤ index < length`.
- *
- * Throws an [UnsupportedError] if this is a fixed-length list. In that case
- * the list is not modified.
- */
- E removeAt(int index);
-
- /**
- * Pops and returns the last object in this list.
- *
- * Throws an [UnsupportedError] if this is a fixed-length list.
- */
- E removeLast();
-
- /**
- * Removes all objects from this list that satisfy [test].
- *
- * An object [:o:] satisfies [test] if [:test(o):] is true.
- *
- * List<String> numbers = ['one', 'two', 'three', 'four'];
- * numbers.removeWhere((item) => item.length == 3);
- * numbers.join(', '); // 'three, four'
- *
- * Throws an [UnsupportedError] if this is a fixed-length list.
- */
- void removeWhere(bool test(E element));
-
- /**
- * Removes all objects from this list that fail to satisfy [test].
- *
- * An object [:o:] satisfies [test] if [:test(o):] is true.
- *
- * List<String> numbers = ['one', 'two', 'three', 'four'];
- * numbers.retainWhere((item) => item.length == 3);
- * numbers.join(', '); // 'one, two'
- *
- * Throws an [UnsupportedError] if this is a fixed-length list.
- */
- void retainWhere(bool test(E element));
-
- /**
- * Returns a new list containing the objects from [start] inclusive to [end]
- * exclusive.
- *
- * List<String> colors = ['red', 'green', 'blue', 'orange', 'pink'];
- * colors.sublist(1, 3); // ['green', 'blue']
- *
- * If [end] is omitted, the [length] of `this` is used.
- *
- * colors.sublist(1); // ['green', 'blue', 'orange', 'pink']
- *
- * An error occurs if [start] is outside the range `0` .. `length` or if
- * [end] is outside the range `start` .. `length`.
- */
- List<E> sublist(int start, [int end]);
-
- /**
- * Returns an [Iterable] that iterates over the objects in the range
- * [start] inclusive to [end] exclusive.
- *
- * An error occurs if [end] is before [start].
- *
- * An error occurs if the [start] and [end] are not valid ranges at the time
- * of the call to this method. The returned [Iterable] behaves like
- * `skip(start).take(end - start)`. That is, it does not throw exceptions
- * if `this` changes size.
- *
- * List<String> colors = ['red', 'green', 'blue', 'orange', 'pink'];
- * Iterable<String> range = colors.getRange(1, 4);
- * range.join(', '); // 'green, blue, orange'
- * colors.length = 3;
- * range.join(', '); // 'green, blue'
- */
- Iterable<E> getRange(int start, int end);
-
- /**
- * Copies the objects of [iterable], skipping [skipCount] objects first,
- * into the range [start], inclusive, to [end], exclusive, of the list.
- *
- * List<int> list1 = [1, 2, 3, 4];
- * List<int> list2 = [5, 6, 7, 8, 9];
- * // Copies the 4th and 5th items in list2 as the 2nd and 3rd items
- * // of list1.
- * list1.setRange(1, 3, list2, 3);
- * list1.join(', '); // '1, 8, 9, 4'
- *
- * The [start] and [end] indices must satisfy `0 ≤ start ≤ end ≤ length`.
- * If [start] equals [end], this method has no effect.
- *
- * The [iterable] must have enough objects to fill the range from `start`
- * to `end` after skipping [skipCount] objects.
- *
- * If `iterable` is this list, the operation will copy the elements originally
- * in the range from `skipCount` to `skipCount + (end - start)` to the
- * range `start` to `end`, even if the two ranges overlap.
- *
- * If `iterable` depends on this list in some other way, no guarantees are
- * made.
- */
- void setRange(int start, int end, Iterable<E> iterable, [int skipCount = 0]);
-
- /**
- * Removes the objects in the range [start] inclusive to [end] exclusive.
- *
- * The [start] and [end] indices must be in the range
- * `0 ≤ index ≤ length`, and `start ≤ end`.
- *
- * Throws an [UnsupportedError] if this is a fixed-length list. In that case
- * the list is not modified.
- */
- void removeRange(int start, int end);
-
- /**
- * Sets the objects in the range [start] inclusive to [end] exclusive
- * to the given [fillValue].
- *
- * An error occurs if [start]..[end] is not a valid range for `this`.
- */
- void fillRange(int start, int end, [E fillValue]);
-
- /**
- * Removes the objects in the range [start] inclusive to [end] exclusive
- * and inserts the contents of [replacement] in its place.
- *
- * List<int> list = [1, 2, 3, 4, 5];
- * list.replaceRange(1, 4, [6, 7]);
- * list.join(', '); // '1, 6, 7, 5'
- *
- * An error occurs if [start]..[end] is not a valid range for `this`.
- *
- * This method does not work on fixed-length lists, even when [replacement]
- * has the same number of elements as the replaced range. In that case use
- * [setRange] instead.
- */
- void replaceRange(int start, int end, Iterable<E> replacement);
-
- /**
- * Returns an unmodifiable [Map] view of `this`.
- *
- * The map uses the indices of this list as keys and the corresponding objects
- * as values. The `Map.keys` [Iterable] iterates the indices of this list
- * in numerical order.
- *
- * List<String> words = ['fee', 'fi', 'fo', 'fum'];
- * Map<int, String> map = words.asMap();
- * map[0] + map[1]; // 'feefi';
- * map.keys.toList(); // [0, 1, 2, 3]
- */
- Map<int, E> asMap();
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/core/map.dart b/pkg/dev_compiler/tool/input_sdk/lib/core/map.dart
deleted file mode 100644
index ac4581f..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/core/map.dart
+++ /dev/null
@@ -1,270 +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.
-
-part of dart.core;
-
-/**
- * An collection of key-value pairs, from which you retrieve a value
- * using its associated key.
- *
- * There is a finite number of keys in the map,
- * and each key has exactly one value associated with it.
- *
- * Maps, and their keys and values, can be iterated.
- * The order of iteration is defined by the individual type of map.
- * Examples:
- *
- * * The plain [HashMap] is unordered (no order is guaranteed),
- * * the [LinkedHashMap] iterates in key insertion order,
- * * and a sorted map like [SplayTreeMap] iterates the keys in sorted order.
- *
- * It is generally not allowed to modify the map (add or remove keys) while
- * an operation is being performed on the map, for example in functions called
- * during a [forEach] or [putIfAbsent] call.
- * Modifying the map while iterating the keys or values
- * may also break the iteration.
- */
-abstract class Map<K, V> {
- /**
- * Creates a Map instance with the default implementation, [LinkedHashMap].
- *
- * This constructor is equivalent to the non-const map literal `<K,V>{}`.
- *
- * A `LinkedHashMap` requires the keys to implement compatible
- * `operator==` and `hashCode`, and it allows null as a key.
- * It iterates in key insertion order.
- */
- external factory Map();
-
- /**
- * Creates a [LinkedHashMap] instance that contains all key-value pairs of
- * [other].
- *
- * The keys must all be assignable to [K] and the values to [V].
- * The [other] map itself can have any type.
- *
- * A `LinkedHashMap` requires the keys to implement compatible
- * `operator==` and `hashCode`, and it allows `null` as a key.
- * It iterates in key insertion order.
- */
- factory Map.from(Map other) = LinkedHashMap<K, V>.from;
-
- /**
- * Creates an unmodifiable hash based map containing the entries of [other].
- *
- * The keys must all be assignable to [K] and the values to [V].
- * The [other] map itself can have any type.
- *
- * The map requires the keys to implement compatible
- * `operator==` and `hashCode`, and it allows `null` as a key.
- * The created map iterates keys in a fixed order,
- * preserving the order provided by [other].
- *
- * The resulting map behaves like the result of [Map.from],
- * except that the map returned by this constructor is not modifiable.
- */
- external factory Map.unmodifiable(Map other);
-
- /**
- * Creates an identity map with the default implementation, [LinkedHashMap].
- *
- * The returned map allows `null` as a key.
- * It iterates in key insertion order.
- */
- factory Map.identity() = LinkedHashMap<K, V>.identity;
-
- /**
- * Creates a Map instance in which the keys and values are computed from the
- * [iterable].
- *
- * The created map is a [LinkedHashMap].
- * A `LinkedHashMap` requires the keys to implement compatible
- * `operator==` and `hashCode`, and it allows null as a key.
- * It iterates in key insertion order.
- *
- * For each element of the [iterable] this constructor computes a key-value
- * pair, by applying [key] and [value] respectively.
- *
- * The example below creates a new Map from a List. The keys of `map` are
- * `list` values converted to strings, and the values of the `map` are the
- * squares of the `list` values:
- *
- * List<int> list = [1, 2, 3];
- * Map<String, int> map = new Map.fromIterable(list,
- * key: (item) => item.toString(),
- * value: (item) => item * item));
- *
- * map['1'] + map['2']; // 1 + 4
- * map['3'] - map['2']; // 9 - 4
- *
- * If no values are specified for [key] and [value] the default is the
- * identity function.
- *
- * In the following example, the keys and corresponding values of `map`
- * are `list` values:
- *
- * map = new Map.fromIterable(list);
- * map[1] + map[2]; // 1 + 2
- * map[3] - map[2]; // 3 - 2
- *
- * The keys computed by the source [iterable] do not need to be unique. The
- * last occurrence of a key will simply overwrite any previous value.
- */
- factory Map.fromIterable(Iterable iterable,
- {K key(element), V value(element)}) = LinkedHashMap<K, V>.fromIterable;
-
- /**
- * Creates a Map instance associating the given [keys] to [values].
- *
- * The created map is a [LinkedHashMap].
- * A `LinkedHashMap` requires the keys to implement compatible
- * `operator==` and `hashCode`, and it allows null as a key.
- * It iterates in key insertion order.
- *
- * This constructor iterates over [keys] and [values] and maps each element of
- * [keys] to the corresponding element of [values].
- *
- * List<String> letters = ['b', 'c'];
- * List<String> words = ['bad', 'cat'];
- * Map<String, String> map = new Map.fromIterables(letters, words);
- * map['b'] + map['c']; // badcat
- *
- * If [keys] contains the same object multiple times, the last occurrence
- * overwrites the previous value.
- *
- * The two [Iterable]s must have the same length.
- */
- factory Map.fromIterables(Iterable<K> keys, Iterable<V> values)
- = LinkedHashMap<K, V>.fromIterables;
-
- /**
- * Returns true if this map contains the given [value].
- *
- * Returns true if any of the values in the map are equal to `value`
- * according to the `==` operator.
- */
- bool containsValue(Object value);
-
- /**
- * Returns true if this map contains the given [key].
- *
- * Returns true if any of the keys in the map are equal to `key`
- * according to the equality used by the map.
- */
- bool containsKey(Object key);
-
- /**
- * Returns the value for the given [key] or null if [key] is not in the map.
- *
- * Some maps allows keys to have `null` as a value,
- * For those maps, a lookup using this operator does cannot be used to
- * distinguish between a key not being in the map, and the key having a null
- * value.
- * Methods like [containsKey] or [putIfAbsent] can be use if the distinction
- * is important.
- */
- V operator [](Object key);
-
- /**
- * Associates the [key] with the given [value].
- *
- * If the key was already in the map, its associated value is changed.
- * Otherwise the key-value pair is added to the map.
- */
- void operator []=(K key, V value);
-
- /**
- * Look up the value of [key], or add a new value if it isn't there.
- *
- * Returns the value associated to [key], if there is one.
- * Otherwise calls [ifAbsent] to get a new value, associates [key] to
- * that value, and then returns the new value.
- *
- * Map<String, int> scores = {'Bob': 36};
- * for (var key in ['Bob', 'Rohan', 'Sophena']) {
- * scores.putIfAbsent(key, () => key.length);
- * }
- * scores['Bob']; // 36
- * scores['Rohan']; // 5
- * scores['Sophena']; // 7
- *
- * Calling [ifAbsent] must not add or remove keys from the map.
- */
- V putIfAbsent(K key, V ifAbsent());
-
- /**
- * Adds all key-value pairs of [other] to this map.
- *
- * If a key of [other] is already in this map, its value is overwritten.
- *
- * The operation is equivalent to doing `this[key] = value` for each key
- * and associated value in other. It iterates over [other], which must
- * therefore not change during the iteration.
- */
- void addAll(Map<K, V> other);
-
- /**
- * Removes [key] and its associated value, if present, from the map.
- *
- * Returns the value associated with `key` before it was removed.
- * Returns `null` if `key` was not in the map.
- *
- * Note that values can be `null` and a returned `null` value doesn't
- * always mean that the key was absent.
- */
- V remove(Object key);
-
- /**
- * Removes all pairs from the map.
- *
- * After this, the map is empty.
- */
- void clear();
-
- /**
- * Applies [f] to each key-value pair of the map.
- *
- * Calling `f` must not add or remove keys from the map.
- */
- void forEach(void f(K key, V value));
-
- /**
- * The keys of [this].
- *
- * The returned iterable has efficient `length` and `contains` operations,
- * based on [length] and [containsKey] of the map.
- *
- * The order of iteration is defined by the individual `Map` implementation,
- * but must be consistent between changes to the map.
- */
- Iterable<K> get keys;
-
- /**
- * The values of [this].
- *
- * The values are iterated in the order of their corresponding keys.
- * This means that iterating [keys] and [values] in parallel will
- * provided matching pairs of keys and values.
- *
- * The returned iterable has an efficient `length` method based on the
- * [length] of the map. Its [Iterable.contains] method is based on
- * `==` comparison.
- */
- Iterable<V> get values;
-
- /**
- * The number of key-value pairs in the map.
- */
- int get length;
-
- /**
- * Returns true if there is no key-value pair in the map.
- */
- bool get isEmpty;
-
- /**
- * Returns true if there is at least one key-value pair in the map.
- */
- bool get isNotEmpty;
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/core/null.dart b/pkg/dev_compiler/tool/input_sdk/lib/core/null.dart
deleted file mode 100644
index dd914a3..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/core/null.dart
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-part of dart.core;
-
-/**
- * The reserved word [:null:] denotes an object that is the sole instance of
- * this class.
- *
- * It is a compile-time error for a class to attempt to extend or implement
- * Null.
- */
-class Null {
- factory Null._uninstantiable() {
- throw new UnsupportedError('class Null cannot be instantiated');
- }
-
- /** Returns the string `"null"`. */
- String toString() => "null";
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/core/num.dart b/pkg/dev_compiler/tool/input_sdk/lib/core/num.dart
deleted file mode 100644
index 21f23ee..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/core/num.dart
+++ /dev/null
@@ -1,453 +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.
-
-part of dart.core;
-
-/**
- * An integer or floating-point number.
- *
- * It is a compile-time error for any type other than [int] or [double]
- * to attempt to extend or implement num.
- */
-abstract class num implements Comparable<num> {
- /**
- * Test whether this value is numerically equal to `other`.
- *
- * If both operands are doubles, they are equal if they have the same
- * representation, except that:
- *
- * * zero and minus zero (0.0 and -0.0) are considered equal. They
- * both have the numerical value zero.
- * * NaN is not equal to anything, including NaN. If either operand is
- * NaN, the result is always false.
- *
- * If one operand is a double and the other is an int, they are equal if
- * the double has an integer value (finite with no fractional part) and
- * `identical(doubleValue.toInt(), intValue)` is true.
- *
- * If both operands are integers, they are equal if they have the same value.
- *
- * Returns false if `other` is not a [num].
- *
- * Notice that the behavior for NaN is non-reflexive. This means that
- * equality of double values is not a proper equality relation, as is
- * otherwise required of `operator==`. Using NaN in, e.g., a [HashSet]
- * will fail to work. The behavior is the standard IEEE-754 equality of
- * doubles.
- *
- * If you can avoid NaN values, the remaining doubles do have a proper eqality
- * relation, and can be used safely.
- *
- * Use [compareTo] for a comparison that distinguishes zero and minus zero,
- * and that considers NaN values as equal.
- */
- bool operator==(Object other);
-
- /**
- * Returns a hash code for a numerical value.
- *
- * The hash code is compatible with equality. It returns the same value
- * for an [int] and a [double] with the same numerical value, and therefore
- * the same value for the doubles zero and minus zero.
- *
- * No guarantees are made about the hash code of NaN.
- */
- int get hashCode;
-
- /**
- * Compares this to `other`.
- *
- * Returns a negative number if `this` is less than `other`, zero if they are
- * equal, and a positive number if `this` is greater than `other`.
- *
- * The orderding represented by this method is a total ordering of [num]
- * values. All distinct doubles are non-equal, as are all distinct integers,
- * but integers are equal to doubles if they have the same numerical
- * value.
- *
- * For ordering, the double NaN value is considered equal to itself, and
- * greater than any numeric value (unlike its behavior in `operator==`).
- *
- * The double value -0.0 is considered less than 0.0 (and the integer 0), but
- * greater than any non-zero negative value.
- *
- * Positive infinity is greater than any finite value (any value apart from
- * itself and NaN), and negative infinity is less than any other value.
- *
- * All other values are compared using their numeric value.
- */
- int compareTo(num other);
-
- /** Addition operator. */
- num operator +(num other);
-
- /** Subtraction operator. */
- num operator -(num other);
-
- /** Multiplication operator. */
- num operator *(num other);
-
- /**
- * Euclidean modulo operator.
- *
- * Returns the remainder of the euclidean division. The euclidean division of
- * two integers `a` and `b` yields two integers `q` and `r` such that
- * `a == b * q + r` and `0 <= r < b.abs()`.
- *
- * The euclidean division is only defined for integers, but can be easily
- * extended to work with doubles. In that case `r` may have a non-integer
- * value, but it still verifies `0 <= r < |b|`.
- *
- * The sign of the returned value `r` is always positive.
- *
- * See [remainder] for the remainder of the truncating division.
- */
- num operator %(num other);
-
- /** Division operator. */
- double operator /(num other);
-
- /**
- * Truncating division operator.
- *
- * If either operand is a [double] then the result of the truncating division
- * `a ~/ b` is equivalent to `(a / b).truncate().toInt()`.
- *
- * If both operands are [int]s then `a ~/ b` performs the truncating
- * integer division.
- */
- int operator ~/(num other);
-
- /** Negate operator. */
- num operator -();
-
- /**
- * Returns the remainder of the truncating division of `this` by [other].
- *
- * The result `r` of this operation satisfies:
- * `this == (this ~/ other) * other + r`.
- * As a consequence the remainder `r` has the same sign as the divider `this`.
- */
- num remainder(num other);
-
- /** Relational less than operator. */
- bool operator <(num other);
-
- /** Relational less than or equal operator. */
- bool operator <=(num other);
-
- /** Relational greater than operator. */
- bool operator >(num other);
-
- /** Relational greater than or equal operator. */
- bool operator >=(num other);
-
- /** True if the number is the double Not-a-Number value; otherwise, false. */
- bool get isNaN;
-
- /**
- * True if the number is negative; otherwise, false.
- *
- * Negative numbers are those less than zero, and the double `-0.0`.
- */
- bool get isNegative;
-
- /**
- * True if the number is positive infinity or negative infinity; otherwise,
- * false.
- */
- bool get isInfinite;
-
- /**
- * True if the number is finite; otherwise, false.
- *
- * The only non-finite numbers are NaN, positive infinitity and
- * negative infinity.
- */
- bool get isFinite;
-
- /** Returns the absolute value of this [num]. */
- num abs();
-
- /**
- * Returns minus one, zero or plus one depending on the sign and
- * numerical value of the number.
- *
- * Returns minus one if the number is less than zero,
- * plus one if the number is greater than zero,
- * and zero if the number is equal to zero.
- *
- * Returns NaN if the number is the double NaN value.
- *
- * Returns a number of the same type as this number.
- * For doubles, `-0.0.sign == -0.0`.
-
- * The result satisfies:
- *
- * n == n.sign * n.abs()
- *
- * for all numbers `n` (except NaN, because NaN isn't `==` to itself).
- */
- num get sign;
-
- /**
- * Returns the integer closest to `this`.
- *
- * Rounds away from zero when there is no closest integer:
- * `(3.5).round() == 4` and `(-3.5).round() == -4`.
- *
- * If `this` is not finite (`NaN` or infinity), throws an [UnsupportedError].
- */
- int round();
-
- /**
- * Returns the greatest integer no greater than `this`.
- *
- * If `this` is not finite (`NaN` or infinity), throws an [UnsupportedError].
- */
- int floor();
-
- /**
- * Returns the least integer no smaller than `this`.
- *
- * If `this` is not finite (`NaN` or infinity), throws an [UnsupportedError].
- */
- int ceil();
-
- /**
- * Returns the integer obtained by discarding any fractional
- * digits from `this`.
- *
- * If `this` is not finite (`NaN` or infinity), throws an [UnsupportedError].
- */
- int truncate();
-
- /**
- * Returns the double integer value closest to `this`.
- *
- * Rounds away from zero when there is no closest integer:
- * `(3.5).roundToDouble() == 4` and `(-3.5).roundToDouble() == -4`.
- *
- * If this is already an integer valued double, including `-0.0`, or it is a
- * non-finite double value, the value is returned unmodified.
- *
- * For the purpose of rounding, `-0.0` is considered to be below `0.0`,
- * and `-0.0` is therefore considered closer to negative numbers than `0.0`.
- * This means that for a value, `d` in the range `-0.5 < d < 0.0`,
- * the result is `-0.0`.
- *
- * The result is always a double.
- * If this is a numerically large integer, the result may be an infinite
- * double.
- */
- double roundToDouble();
-
- /**
- * Returns the greatest double integer value no greater than `this`.
- *
- * If this is already an integer valued double, including `-0.0`, or it is a
- * non-finite double value, the value is returned unmodified.
- *
- * For the purpose of rounding, `-0.0` is considered to be below `0.0`.
- * A number `d` in the range `0.0 < d < 1.0` will return `0.0`.
- *
- * The result is always a double.
- * If this is a numerically large integer, the result may be an infinite
- * double.
- */
- double floorToDouble();
-
- /**
- * Returns the least double integer value no smaller than `this`.
- *
- * If this is already an integer valued double, including `-0.0`, or it is a
- * non-finite double value, the value is returned unmodified.
- *
- * For the purpose of rounding, `-0.0` is considered to be below `0.0`.
- * A number `d` in the range `-1.0 < d < 0.0` will return `-0.0`.
- *
- * The result is always a double.
- * If this is a numerically large integer, the result may be an infinite
- * double.
- */
- double ceilToDouble();
-
- /**
- * Returns the double integer value obtained by discarding any fractional
- * digits from the double value of `this`.
- *
- * If this is already an integer valued double, including `-0.0`, or it is a
- * non-finite double value, the value is returned unmodified.
- *
- * For the purpose of rounding, `-0.0` is considered to be below `0.0`.
- * A number `d` in the range `-1.0 < d < 0.0` will return `-0.0`, and
- * in the range `0.0 < d < 1.0` it will return 0.0.
- *
- * The result is always a double.
- * If this is a numerically large integer, the result may be an infinite
- * double.
- */
- double truncateToDouble();
-
- /**
- * Returns this [num] clamped to be in the range [lowerLimit]-[upperLimit].
- *
- * The comparison is done using [compareTo] and therefore takes `-0.0` into
- * account. This also implies that [double.NAN] is treated as the maximal
- * double value.
- */
- num clamp(num lowerLimit, num upperLimit);
-
- /** Truncates this [num] to an integer and returns the result as an [int]. */
- int toInt();
-
- /**
- * Return this [num] as a [double].
- *
- * If the number is not representable as a [double], an
- * approximation is returned. For numerically large integers, the
- * approximation may be infinite.
- */
- double toDouble();
-
- /**
- * Returns a decimal-point string-representation of `this`.
- *
- * Converts `this` to a [double] before computing the string representation.
- *
- * If the absolute value of `this` is greater or equal to `10^21` then this
- * methods returns an exponential representation computed by
- * `this.toStringAsExponential()`. Otherwise the result
- * is the closest string representation with exactly [fractionDigits] digits
- * after the decimal point. If [fractionDigits] equals 0 then the decimal
- * point is omitted.
- *
- * The parameter [fractionDigits] must be an integer satisfying:
- * `0 <= fractionDigits <= 20`.
- *
- * Examples:
- *
- * 1.toStringAsFixed(3); // 1.000
- * (4321.12345678).toStringAsFixed(3); // 4321.123
- * (4321.12345678).toStringAsFixed(5); // 4321.12346
- * 123456789012345678901.toStringAsFixed(3); // 123456789012345683968.000
- * 1000000000000000000000.toStringAsFixed(3); // 1e+21
- * 5.25.toStringAsFixed(0); // 5
- */
- String toStringAsFixed(int fractionDigits);
-
- /**
- * Returns an exponential string-representation of `this`.
- *
- * Converts `this` to a [double] before computing the string representation.
- *
- * If [fractionDigits] is given then it must be an integer satisfying:
- * `0 <= fractionDigits <= 20`. In this case the string contains exactly
- * [fractionDigits] after the decimal point. Otherwise, without the parameter,
- * the returned string uses the shortest number of digits that accurately
- * represent [this].
- *
- * If [fractionDigits] equals 0 then the decimal point is omitted.
- * Examples:
- *
- * 1.toStringAsExponential(); // 1e+0
- * 1.toStringAsExponential(3); // 1.000e+0
- * 123456.toStringAsExponential(); // 1.23456e+5
- * 123456.toStringAsExponential(3); // 1.235e+5
- * 123.toStringAsExponential(0); // 1e+2
- */
- String toStringAsExponential([int fractionDigits]);
-
- /**
- * Converts `this` to a double and returns a string representation with
- * exactly [precision] significant digits.
- *
- * The parameter [precision] must be an integer satisfying:
- * `1 <= precision <= 21`.
- *
- * Examples:
- *
- * 1.toStringAsPrecision(2); // 1.0
- * 1e15.toStringAsPrecision(3); // 1.00+15
- * 1234567.toStringAsPrecision(3); // 1.23e+6
- * 1234567.toStringAsPrecision(9); // 1234567.00
- * 12345678901234567890.toStringAsPrecision(20); // 12345678901234567168
- * 12345678901234567890.toStringAsPrecision(14); // 1.2345678901235e+19
- * 0.00000012345.toStringAsPrecision(15); // 1.23450000000000e-7
- * 0.0000012345.toStringAsPrecision(15); // 0.00000123450000000000
- */
- String toStringAsPrecision(int precision);
-
- /**
- * Returns the shortest string that correctly represent the input number.
- *
- * All [double]s in the range `10^-6` (inclusive) to `10^21` (exclusive)
- * are converted to their decimal representation with at least one digit
- * after the decimal point. For all other doubles,
- * except for special values like `NaN` or `Infinity`, this method returns an
- * exponential representation (see [toStringAsExponential]).
- *
- * Returns `"NaN"` for [double.NAN], `"Infinity"` for [double.INFINITY], and
- * `"-Infinity"` for [double.MINUS_INFINITY].
- *
- * An [int] is converted to a decimal representation with no decimal point.
- *
- * Examples:
- *
- * (0.000001).toString(); // "0.000001"
- * (0.0000001).toString(); // "1e-7"
- * (111111111111111111111.0).toString(); // "111111111111111110000.0"
- * (100000000000000000000.0).toString(); // "100000000000000000000.0"
- * (1000000000000000000000.0).toString(); // "1e+21"
- * (1111111111111111111111.0).toString(); // "1.1111111111111111e+21"
- * 1.toString(); // "1"
- * 111111111111111111111.toString(); // "111111111111111110000"
- * 100000000000000000000.toString(); // "100000000000000000000"
- * 1000000000000000000000.toString(); // "1000000000000000000000"
- * 1111111111111111111111.toString(); // "1111111111111111111111"
- * 1.234e5.toString(); // 123400
- * 1234.5e6.toString(); // 1234500000
- * 12.345e67.toString(); // 1.2345e+68
- *
- * Note: the conversion may round the output if the returned string
- * is accurate enough to uniquely identify the input-number.
- * For example the most precise representation of the [double] `9e59` equals
- * `"899999999999999918767229449717619953810131273674690656206848"`, but
- * this method returns the shorter (but still uniquely identifying) `"9e59"`.
- *
- */
- String toString();
-
- /**
- * Parses a string containing a number literal into a number.
- *
- * The method first tries to read the [input] as integer (similar to
- * [int.parse] without a radix).
- * If that fails, it tries to parse the [input] as a double (similar to
- * [double.parse]).
- * If that fails, too, it invokes [onError] with [input], and the result
- * of that invocation becomes the result of calling `parse`.
- *
- * If no [onError] is supplied, it defaults to a function that throws a
- * [FormatException].
- *
- * For any number `n`, this function satisfies
- * `identical(n, num.parse(n.toString()))` (except when `n` is a NaN `double`
- * with a payload).
- */
- static num parse(String input, [num onError(String input)]) {
- String source = input.trim();
- // TODO(lrn): Optimize to detect format and result type in one check.
- num result = int.parse(source, onError: _returnIntNull);
- if (result != null) return result;
- result = double.parse(source, _returnDoubleNull);
- if (result != null) return result;
- if (onError == null) throw new FormatException(input);
- return onError(input);
- }
-
- /** Helper functions for [parse]. */
- static int _returnIntNull(String _) => null;
- static double _returnDoubleNull(String _) => null;
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/core/object.dart b/pkg/dev_compiler/tool/input_sdk/lib/core/object.dart
deleted file mode 100644
index ae0431e..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/core/object.dart
+++ /dev/null
@@ -1,95 +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.
-
-part of dart.core;
-
-/**
- * The base class for all Dart objects.
- *
- * Because Object is the root of the Dart class hierarchy,
- * every other Dart class is a subclass of Object.
- *
- * When you define a class, you should override [toString]
- * to return a string describing an instance of that class.
- * You might also need to define [hashCode] and [==], as described in the
- * [Implementing map
- * keys](https://www.dartlang.org/docs/dart-up-and-running/ch03.html#implementing-map-keys)
- * section of the [library
- * tour](http://www.dartlang.org/docs/dart-up-and-running/contents/ch03.html).
- */
-class Object {
- /**
- * Creates a new [Object] instance.
- *
- * [Object] instances have no meaningful state, and are only useful
- * through their identity. An [Object] instance is equal to itself
- * only.
- */
- const Object();
-
- /**
- * The equality operator.
- *
- * The default behavior for all [Object]s is to return true if and
- * only if [:this:] and [other] are the same object.
- *
- * Override this method to specify a different equality relation on
- * a class. The overriding method must still be an equivalence relation.
- * That is, it must be:
- *
- * * Total: It must return a boolean for all arguments. It should never throw
- * or return `null`.
- *
- * * Reflexive: For all objects `o`, `o == o` must be true.
- *
- * * Symmetric: For all objects `o1` and `o2`, `o1 == o2` and `o2 == o1` must
- * either both be true, or both be false.
- *
- * * Transitive: For all objects `o1`, `o2`, and `o3`, if `o1 == o2` and
- * `o2 == o3` are true, then `o1 == o3` must be true.
- *
- * The method should also be consistent over time, so equality of two objects
- * should not change over time, or at least only change if one of the objects
- * was modified.
- *
- * If a subclass overrides the equality operator it should override
- * the [hashCode] method as well to maintain consistency.
- */
- bool operator ==(other) => identical(this, other);
-
- /**
- * Get a hash code for this object.
- *
- * All objects have hash codes. Hash codes are guaranteed to be the
- * same for objects that are equal when compared using the equality
- * operator [:==:]. Other than that there are no guarantees about
- * the hash codes. They will not be consistent between runs and
- * there are no distribution guarantees.
- *
- * If a subclass overrides [hashCode] it should override the
- * equality operator as well to maintain consistency.
- */
- external int get hashCode;
-
- /**
- * Returns a string representation of this object.
- */
- external String toString();
-
- /**
- * Invoked when a non-existent method or property is accessed.
- *
- * Classes can override [noSuchMethod] to provide custom behavior.
- *
- * If a value is returned, it becomes the result of the original invocation.
- *
- * The default behavior is to throw a [NoSuchMethodError].
- */
- external dynamic noSuchMethod(Invocation invocation);
-
- /**
- * A representation of the runtime type of the object.
- */
- external Type get runtimeType;
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/core/pattern.dart b/pkg/dev_compiler/tool/input_sdk/lib/core/pattern.dart
deleted file mode 100644
index 7f32c72..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/core/pattern.dart
+++ /dev/null
@@ -1,131 +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.
-
-part of dart.core;
-
-/**
- * An interface for basic searches within strings.
- */
-abstract class Pattern {
- // NOTE: When using "start" index from the language library, call
- // without an argument if start is zero. This allows backwards compatiblity
- // with implementations of the older interface that didn't have the start
- // index argument.
- /**
- * Match this pattern against the string repeatedly.
- *
- * If [start] is provided, matching will start at that index.
- *
- * The returned iterable lazily computes all the non-overlapping matches
- * of the pattern on the string, ordered by start index.
- * If a user only requests the first
- * match, this function should not compute all possible matches.
- *
- * The matches are found by repeatedly finding the first match
- * of the pattern on the string, starting from the end of the previous
- * match, and initially starting from index zero.
- *
- * If the pattern matches the empty string at some point, the next
- * match is found by starting at the previous match's end plus one.
- */
- Iterable<Match> allMatches(String string, [int start = 0]);
-
- /**
- * Match this pattern against the start of `string`.
- *
- * If [start] is provided, it must be an integer in the range `0` ..
- * `string.length`. In that case, this patten is tested against the
- * string at the [start] position. That is, a [Match] is returned if the
- * pattern can match a part of the string starting from position [start].
- * Returns `null` if the pattern doesn't match.
- */
- Match matchAsPrefix(String string, [int start = 0]);
-}
-
-/**
- * A result from searching within a string.
- *
- * A Match or an [Iterable] of Match objects is returned from [Pattern]
- * matching methods.
- *
- * The following example finds all matches of a [RegExp] in a [String]
- * and iterates through the returned iterable of Match objects.
- *
- * RegExp exp = new RegExp(r"(\w+)");
- * String str = "Parse my string";
- * Iterable<Match> matches = exp.allMatches(str);
- * for (Match m in matches) {
- * String match = m.group(0);
- * print(match);
- * }
- *
- * The output of the example is:
- *
- * Parse
- * my
- * string
- *
- * Some patterns, regular expressions in particular, may record subtrings
- * that were part of the matching. These are called _groups_ in the Match
- * object. Some patterns may never have any groups, and their matches always
- * have zero [groupCount].
- */
-abstract class Match {
- /**
- * Returns the index in the string where the match starts.
- */
- int get start;
-
- /**
- * Returns the index in the string after the last character of the
- * match.
- */
- int get end;
-
- /**
- * Returns the string matched by the given [group].
- *
- * If [group] is 0, returns the match of the pattern.
- *
- * The result may be `null` if the pattern didn't assign a value to it
- * as part of this match.
- */
- String group(int group);
-
- /**
- * Returns the string matched by the given [group].
- *
- * If [group] is 0, returns the match of the pattern.
- *
- * Short alias for [Match.group].
- */
- String operator [](int group);
-
- /**
- * Returns a list of the groups with the given indices.
- *
- * The list contains the strings returned by [group] for each index in
- * [groupIndices].
- */
- List<String> groups(List<int> groupIndices);
-
- /**
- * Returns the number of captured groups in the match.
- *
- * Some patterns may capture parts of the input that was used to
- * compute the full match. This is the number of captured groups,
- * which is also the maximal allowed argument to the [group] method.
- */
- int get groupCount;
-
- /**
- * The string on which this match was computed.
- */
- String get input;
-
- /**
- * The pattern used to search in [input].
- */
- Pattern get pattern;
-}
\ No newline at end of file
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/core/print.dart b/pkg/dev_compiler/tool/input_sdk/lib/core/print.dart
deleted file mode 100644
index 42c7d1c..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/core/print.dart
+++ /dev/null
@@ -1,15 +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.
-
-part of dart.core;
-
-/// Prints a string representation of the object to the console.
-void print(Object object) {
- String line = "$object";
- if (printToZone == null) {
- printToConsole(line);
- } else {
- printToZone(line);
- }
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/core/regexp.dart b/pkg/dev_compiler/tool/input_sdk/lib/core/regexp.dart
deleted file mode 100644
index 09874c4..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/core/regexp.dart
+++ /dev/null
@@ -1,91 +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.
-
-part of dart.core;
-
-/**
- * A regular expression pattern.
- *
- * Regular expressions are [Pattern]s, and can as such be used to match strings
- * or parts of strings.
- *
- * Dart regular expressions have the same syntax and semantics as
- * JavaScript regular expressions. See
- * <http://ecma-international.org/ecma-262/5.1/#sec-15.10>
- * for the specification of JavaScript regular expressions.
- *
- * [firstMatch] is the main implementation method that applies a regular
- * expression to a string and returns the first [Match]. All
- * other methods in [RegExp] can build on it.
- *
- * Use [allMatches] to look for all matches of a regular expression in
- * a string.
- *
- * The following example finds all matches of a regular expression in
- * a string.
- *
- * RegExp exp = new RegExp(r"(\w+)");
- * String str = "Parse my string";
- * Iterable<Match> matches = exp.allMatches(str);
- *
- * Note the use of a _raw string_ (a string prefixed with `r`)
- * in the example above. Use a raw string to treat each character in a string
- * as a literal character.
- */
-abstract class RegExp implements Pattern {
- /**
- * Constructs a regular expression.
- *
- * Throws a [FormatException] if [source] is not valid regular
- * expression syntax.
- */
- external factory RegExp(String source, {bool multiLine: false,
- bool caseSensitive: true});
-
- /**
- * Searches for the first match of the regular expression
- * in the string [input]. Returns `null` if there is no match.
- */
- Match firstMatch(String input);
-
- /**
- * Returns an iterable of the matches of the regular expression on [input].
- *
- * If [start] is provided, only start looking for matches at `start`.
- */
- Iterable<Match> allMatches(String input, [int start = 0]);
-
- /**
- * Returns whether the regular expression has a match in the string [input].
- */
- bool hasMatch(String input);
-
- /**
- * Returns the first substring match of this regular expression in [input].
- */
- String stringMatch(String input);
-
- /**
- * The source regular expression string used to create this `RegExp`.
- */
- String get pattern;
-
- /**
- * Whether this regular expression matches multiple lines.
- *
- * If the regexp does match multiple lines, the "^" and "$" characters
- * match the beginning and end of lines. If not, the character match the
- * beginning and end of the input.
- */
- bool get isMultiLine;
-
- /**
- * Whether this regular expression is case sensitive.
- *
- * If the regular expression is not case sensitive, it will match an input
- * letter with a pattern letter even if the two letters are different case
- * versions of the same letter.
- */
- bool get isCaseSensitive;
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/core/set.dart b/pkg/dev_compiler/tool/input_sdk/lib/core/set.dart
deleted file mode 100644
index 55ad971..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/core/set.dart
+++ /dev/null
@@ -1,204 +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.
-
-part of dart.core;
-
-/**
- * A collection of objects in which each object can occur only once.
- *
- * That is, for each object of the element type, the object is either considered
- * to be in the set, or to _not_ be in the set.
- *
- * Set implementations may consider some elements indistinguishable. These
- * elements are treated as being the same for any operation on the set.
- *
- * The default [Set] implementation, [LinkedHashSet], considers objects
- * indistinguishable if they are equal with regard to
- * operator [Object.==].
- *
- * Iterating over elements of a set may be either unordered
- * or ordered in some way. Examples:
- *
- * * A [HashSet] is unordered, which means that its iteration order is
- * uspecified,
- * * [LinkedHashSet] iterates in the insertion order of its elements, and
- * * a sorted set like [SplayTreeSet] iterates the elements in sorted order.
- *
- * It is generally not allowed to modify the set (add or remove elements) while
- * an operation on the set is being performed, for example during a call to
- * [forEach] or [containsAll]. Nor is it allowed to modify the set while
- * iterating either the set itself or any [Iterable] that is backed by the set,
- * such as the ones returned by methods like [where] and [map].
- */
-abstract class Set<E> extends Iterable<E> implements EfficientLength {
- /**
- * Creates an empty [Set].
- *
- * The created [Set] is a plain [LinkedHashSet].
- * As such, it considers elements that are equal (using [==]) to be
- * indistinguishable, and requires them to have a compatible
- * [Object.hashCode] implementation.
- *
- * The set is equivalent to one created by `new LinkedHashSet<E>()`.
- */
- factory Set() = LinkedHashSet<E>;
-
- /**
- * Creates an empty identity [Set].
- *
- * The created [Set] is a [LinkedHashSet] that uses identity as equality
- * relation.
- *
- * The set is equivalent to one created by `new LinkedHashSet<E>.identity()`.
- */
- factory Set.identity() = LinkedHashSet<E>.identity;
-
- /**
- * Creates a [Set] that contains all [elements].
- *
- * All the [elements] should be assignable to [E].
- * The `elements` iterable itself can have any type,
- * so this constructor can be used to down-cast a `Set`, for example as:
- *
- * Set<SuperType> superSet = ...;
- * Set<SubType> subSet =
- * new Set<SubType>.from(superSet.where((e) => e is SubType));
- *
- * The created [Set] is a [LinkedHashSet]. As such, it considers elements that
- * are equal (using [==]) to be indistinguishable, and requires them to
- * have a compatible [Object.hashCode] implementation.
- *
- * The set is equivalent to one created by
- * `new LinkedHashSet<E>.from(elements)`.
- */
- factory Set.from(Iterable<E> elements) = LinkedHashSet<E>.from;
-
- /**
- * Provides an iterator that iterates over the elements of this set.
- *
- * The order of iteration is defined by the individual `Set` implementation,
- * but must be consistent between changes to the set.
- */
- Iterator<E> get iterator;
-
- /**
- * Returns true if [value] is in the set.
- */
- bool contains(Object value);
-
- /**
- * Adds [value] to the set.
- *
- * Returns `true` if [value] (or an equal value) was not yet in the set.
- * Otherwise returns `false` and the set is not changed.
- *
- * Example:
- *
- * var set = new Set();
- * var time1 = new DateTime.fromMillisecondsSinceEpoch(0);
- * var time2 = new DateTime.fromMillisecondsSinceEpoch(0);
- * // time1 and time2 are equal, but not identical.
- * Expect.isTrue(time1 == time2);
- * Expect.isFalse(identical(time1, time2));
- * set.add(time1); // => true.
- * // A value equal to time2 exists already in the set, and the call to
- * // add doesn't change the set.
- * set.add(time2); // => false.
- * Expect.isTrue(set.length == 1);
- * Expect.isTrue(identical(time1, set.first));
- */
- bool add(E value);
-
- /**
- * Adds all [elements] to this Set.
- *
- * Equivalent to adding each element in [elements] using [add],
- * but some collections may be able to optimize it.
- */
- void addAll(Iterable<E> elements);
-
- /**
- * Removes [value] from the set. Returns true if [value] was
- * in the set. Returns false otherwise. The method has no effect
- * if [value] value was not in the set.
- */
- bool remove(Object value);
-
- /**
- * If an object equal to [object] is in the set, return it.
- *
- * Checks if there is an object in the set that is equal to [object].
- * If so, that object is returned, otherwise returns null.
- */
- E lookup(Object object);
-
- /**
- * Removes each element of [elements] from this set.
- */
- void removeAll(Iterable<Object> elements);
-
- /**
- * Removes all elements of this set that are not elements in [elements].
- *
- * Checks for each element of [elements] whether there is an element in this
- * set that is equal to it (according to `this.contains`), and if so, the
- * equal element in this set is retained, and elements that are not equal
- * to any element in `elements` are removed.
- */
- void retainAll(Iterable<Object> elements);
-
- /**
- * Removes all elements of this set that satisfy [test].
- */
- void removeWhere(bool test(E element));
-
- /**
- * Removes all elements of this set that fail to satisfy [test].
- */
- void retainWhere(bool test(E element));
-
- /**
- * Returns whether this Set contains all the elements of [other].
- */
- bool containsAll(Iterable<Object> other);
-
- /**
- * Returns a new set which is the intersection between this set and [other].
- *
- * That is, the returned set contains all the elements of this [Set] that
- * are also elements of [other] according to `other.contains`.
- */
- Set<E> intersection(Set<Object> other);
-
- /**
- * Returns a new set which contains all the elements of this set and [other].
- *
- * That is, the returned set contains all the elements of this [Set] and
- * all the elements of [other].
- */
- Set<E> union(Set<E> other);
-
- /**
- * Returns a new set with the elements of this that are not in [other].
- *
- * That is, the returned set contains all the elements of this [Set] that
- * are not elements of [other] according to `other.contains`.
- */
- Set<E> difference(Set<Object> other);
-
- /**
- * Removes all elements in the set.
- */
- void clear();
-
- /* Creates a [Set] with the same elements and behavior as this `Set`.
- *
- * The returned set behaves the same as this set
- * with regard to adding and removing elements.
- * It initially contains the same elements.
- * If this set specifies an ordering of the elements,
- * the returned set will have the same order.
- */
- Set<E> toSet();
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/core/sink.dart b/pkg/dev_compiler/tool/input_sdk/lib/core/sink.dart
deleted file mode 100644
index 0d8f2ef..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/core/sink.dart
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-part of dart.core;
-
-/**
- * A generic destination for data.
- *
- * Multiple data values can be put into a sink, and when no more data is
- * available, the sink should be closed.
- *
- * This is a generic interface that other data receivers can implement.
- */
-abstract class Sink<T> {
- /**
- * Put the data into the sink.
- *
- * Must not be called after a call to [close].
- */
- void add(T data);
-
- /**
- * Tell the sink that no further data will be added.
- *
- * Calling this method more than once is allowed, but does nothing.
- *
- * The [add] method must not be called after this method.
- */
- void close();
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/core/stacktrace.dart b/pkg/dev_compiler/tool/input_sdk/lib/core/stacktrace.dart
deleted file mode 100644
index 17abd38..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/core/stacktrace.dart
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-part of dart.core;
-
-/**
- * An interface implemented by all stack trace objects.
- *
- * A [StackTrace] is intended to convey information to the user about the call
- * sequence that triggered an exception.
- *
- * These objects are created by the runtime, it is not possible to create
- * them programmatically.
- */
-abstract class StackTrace {
- StackTrace(); // In case existing classes extend StackTrace.
-
- /**
- * Create a `StackTrace` object from [stackTraceString].
- *
- * The created stack trace will have a `toString` method returning
- * `stackTraceString`.
- *
- * The `stackTraceString` can be a string returned by some other
- * stack trace, or it can be any string at all.
- * If the string doesn't look like a stack trace, code that interprets
- * stack traces is likely to fail, so fake stack traces should be used
- * with care.
- */
- factory StackTrace.fromString(String stackTraceString) = _StringStackTrace;
-
- /**
- * Returns a representation of the current stack trace.
- *
- * This is similar to what can be achieved by doing:
- *
- * try { throw 0; } catch (_, stack) { return stack; }
- *
- * The getter achieves this without throwing, except on platforms that
- * have no other way to get a stack trace.
- */
- external static StackTrace get current;
-
- /**
- * Returns a [String] representation of the stack trace.
- *
- * The string represents the full stack trace starting from
- * the point where a throw ocurred to the top of the current call sequence.
- *
- * The exact format of the string representation is not final.
- */
- String toString();
-}
-
-class _StringStackTrace implements StackTrace {
- final String _stackTrace;
- _StringStackTrace(this._stackTrace);
- String toString() => _stackTrace;
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/core/stopwatch.dart b/pkg/dev_compiler/tool/input_sdk/lib/core/stopwatch.dart
deleted file mode 100644
index e923083..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/core/stopwatch.dart
+++ /dev/null
@@ -1,143 +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.
-
-part of dart.core;
-
-/**
- * A simple stopwatch interface to measure elapsed time.
- */
-class Stopwatch {
- /**
- * Frequency of the elapsed counter in Hz.
- */
- int get frequency => _frequency;
-
- // 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;
-
- /**
- * Creates a [Stopwatch] in stopped state with a zero elapsed count.
- *
- * The following example shows how to start a [Stopwatch]
- * immediately after allocation.
- *
- * Stopwatch stopwatch = new Stopwatch()..start();
- */
- Stopwatch() {
- _initTicker();
- }
-
- /**
- * Starts the [Stopwatch].
- *
- * The [elapsed] count is increasing monotonically. If the [Stopwatch] has
- * been stopped, then calling start again restarts it without resetting the
- * [elapsed] count.
- *
- * If the [Stopwatch] is currently running, then calling start does nothing.
- */
- void start() {
- if (isRunning) return;
- if (_start == null) {
- // This stopwatch has never been started.
- _start = _now();
- } else {
- // Restart this stopwatch. Prepend the elapsed time to the current
- // start time.
- _start = _now() - (_stop - _start);
- _stop = null;
- }
- }
-
- /**
- * Stops the [Stopwatch].
- *
- * The [elapsedTicks] count stops increasing after this call. If the
- * [Stopwatch] is currently not running, then calling this method has no
- * effect.
- */
- void stop() {
- if (!isRunning) return;
- _stop = _now();
- }
-
- /**
- * Resets the [elapsed] count to zero.
- *
- * This method does not stop or start the [Stopwatch].
- */
- 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;
- }
- }
-
- /**
- * Returns the elapsed number of clock ticks since calling [start] while the
- * [Stopwatch] is running.
- *
- * Returns the elapsed number of clock ticks between calling [start] and
- * calling [stop].
- *
- * Returns 0 if the [Stopwatch] has never been started.
- *
- * The elapsed number of clock ticks increases by [frequency] every second.
- */
- int get elapsedTicks {
- if (_start == null) {
- return 0;
- }
- return (_stop == null) ? (_now() - _start) : (_stop - _start);
- }
-
- /**
- * Returns the [elapsedTicks] counter converted to a [Duration].
- */
- Duration get elapsed {
- return new Duration(microseconds: elapsedMicroseconds);
- }
-
- /**
- * Returns the [elapsedTicks] counter converted to microseconds.
- */
- int get elapsedMicroseconds {
- return (elapsedTicks * 1000000) ~/ frequency;
- }
-
- /**
- * Returns the [elapsedTicks] counter converted to milliseconds.
- */
- int get elapsedMilliseconds {
- return (elapsedTicks * 1000) ~/ frequency;
- }
-
-
- /**
- * Returns wether the [StopWatch] is currently running.
- */
- bool get isRunning => _start != null && _stop == null;
-
- /**
- * Cached frequency of the system. Must be initialized in [_initTicker];
- */
- static int _frequency;
-
- /**
- * Initializes the time-measuring system. *Must* initialize the [_frequency]
- * variable.
- */
- external static void _initTicker();
- external static int _now();
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/core/string.dart b/pkg/dev_compiler/tool/input_sdk/lib/core/string.dart
deleted file mode 100644
index 39641df..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/core/string.dart
+++ /dev/null
@@ -1,792 +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.
-
-part of dart.core;
-
-/**
- * A sequence of characters.
- *
- * A string can be either single or multiline. Single line strings are
- * written using matching single or double quotes, and multiline strings are
- * written using triple quotes. The following are all valid Dart strings:
- *
- * 'Single quotes';
- * "Double quotes";
- * 'Double quotes in "single" quotes';
- * "Single quotes in 'double' quotes";
- *
- * '''A
- * multiline
- * string''';
- *
- * """
- * Another
- * multiline
- * string""";
- *
- * Strings are immutable. Although you cannot change a string, you can perform
- * an operation on a string and assign the result to a new string:
- *
- * var string = 'Dart is fun';
- * var newString = string.substring(0, 5);
- *
- * You can use the plus (`+`) operator to concatenate strings:
- *
- * 'Dart ' + 'is ' + 'fun!'; // 'Dart is fun!'
- *
- * You can also use adjacent string literals for concatenation:
- *
- * 'Dart ' 'is ' 'fun!'; // 'Dart is fun!'
- *
- * You can use `${}` to interpolate the value of Dart expressions
- * within strings. The curly braces can be omitted when evaluating identifiers:
- *
- * string = 'dartlang';
- * '$string has ${string.length} letters'; // 'dartlang has 8 letters'
- *
- * A string is represented by a sequence of Unicode UTF-16 code units
- * accessible through the [codeUnitAt] or the [codeUnits] members:
- *
- * string = 'Dart';
- * string.codeUnitAt(0); // 68
- * string.codeUnits; // [68, 97, 114, 116]
- *
- * The string representation of code units is accessible through the index
- * operator:
- *
- * string[0]; // 'D'
- *
- * The characters of a string are encoded in UTF-16. Decoding UTF-16, which
- * combines surrogate pairs, yields Unicode code points. Following a similar
- * terminology to Go, we use the name 'rune' for an integer representing a
- * Unicode code point. Use the [runes] property to get the runes of a string:
- *
- * string.runes.toList(); // [68, 97, 114, 116]
- *
- * For a character outside the Basic Multilingual Plane (plane 0) that is
- * composed of a surrogate pair, [runes] combines the pair and returns a
- * single integer. For example, the Unicode character for a
- * musical G-clef ('𝄞') with rune value 0x1D11E consists of a UTF-16 surrogate
- * pair: `0xD834` and `0xDD1E`. Using [codeUnits] returns the surrogate pair,
- * and using `runes` returns their combined value:
- *
- * var clef = '\u{1D11E}';
- * clef.codeUnits; // [0xD834, 0xDD1E]
- * clef.runes.toList(); // [0x1D11E]
- *
- * The String class can not be extended or implemented. Attempting to do so
- * yields a compile-time error.
- *
- * ## Other resources
- *
- * See [StringBuffer] to efficiently build a string incrementally. See
- * [RegExp] to work with regular expressions.
- *
- * Also see:
-
- * * [Dart Cookbook](https://www.dartlang.org/docs/cookbook/#strings)
- * for String examples and recipes.
- * * [Dart Up and Running](https://www.dartlang.org/docs/dart-up-and-running/ch03.html#strings-and-regular-expressions)
- */
-abstract class String implements Comparable<String>, Pattern {
- /**
- * Allocates a new String for the specified [charCodes].
- *
- * The [charCodes] can be UTF-16 code units or runes. If a char-code value is
- * 16-bit, it is copied verbatim:
- *
- * new String.fromCharCodes([68]); // 'D'
- *
- * If a char-code value is greater than 16-bits, it is decomposed into a
- * surrogate pair:
- *
- * var clef = new String.fromCharCodes([0x1D11E]);
- * clef.codeUnitAt(0); // 0xD834
- * clef.codeUnitAt(1); // 0xDD1E
- *
- * If [start] and [end] is provided, only the values of [charCodes]
- * at positions from `start` to, but not including, `end`, are used.
- * The `start` and `end` values must satisfy
- * `0 <= start <= end <= charCodes.length`.
- */
- external factory String.fromCharCodes(Iterable<int> charCodes,
- [int start = 0, int end]);
-
- /**
- * Allocates a new String for the specified [charCode].
- *
- * If the [charCode] can be represented by a single UTF-16 code unit, the new
- * string contains a single code unit. Otherwise, the [length] is 2 and
- * the code units form a surrogate pair. See documentation for
- * [fromCharCodes].
- *
- * Creating a String with half of a surrogate pair is allowed.
- */
- external factory String.fromCharCode(int charCode);
-
- /**
- * Returns the string value of the environment declaration [name].
- *
- * Environment declarations are provided by the surrounding system compiling
- * or running the Dart program. Declarations map a string key to a string
- * value.
- *
- * If [name] is not declared in the environment, the result is instead
- * [defaultValue].
- *
- * Example of getting a value:
- *
- * const String.fromEnvironment("defaultFloo", defaultValue: "no floo")
- *
- * Example of checking whether a declaration is there at all:
- *
- * var isDeclared = const String.fromEnvironment("maybeDeclared") != null;
- */
- external const factory String.fromEnvironment(String name,
- {String defaultValue});
-
- /**
- * Gets the character (as a single-code-unit [String]) at the given [index].
- *
- * The returned string represents exactly one UTF-16 code unit, which may be
- * half of a surrogate pair. A single member of a surrogate pair is an
- * invalid UTF-16 string:
- *
- * var clef = '\u{1D11E}';
- * // These represent invalid UTF-16 strings.
- * clef[0].codeUnits; // [0xD834]
- * clef[1].codeUnits; // [0xDD1E]
- *
- * This method is equivalent to
- * `new String.fromCharCode(this.codeUnitAt(index))`.
- */
- String operator [](int index);
-
- /**
- * Returns the 16-bit UTF-16 code unit at the given [index].
- */
- int codeUnitAt(int index);
-
- /**
- * The length of the string.
- *
- * Returns the number of UTF-16 code units in this string. The number
- * of [runes] might be fewer, if the string contains characters outside
- * the Basic Multilingual Plane (plane 0):
- *
- * 'Dart'.length; // 4
- * 'Dart'.runes.length; // 4
- *
- * var clef = '\u{1D11E}';
- * clef.length; // 2
- * clef.runes.length; // 1
- */
- int get length;
-
- /**
- * Returns a hash code derived from the code units of the string.
- *
- * This is compatible with [operator==]. Strings with the same sequence
- * of code units have the same hash code.
- */
- int get hashCode;
-
- /**
- * Returns true if other is a `String` with the same sequence of code units.
- *
- * This method compares each individual code unit of the strings.
- * It does not check for Unicode equivalence.
- * For example, both the following strings represent the string 'Amélie',
- * but due to their different encoding, are not equal:
- *
- * 'Am\xe9lie' == 'Ame\u{301}lie'; // false
- *
- * The first string encodes 'é' as a single unicode code unit (also
- * a single rune), whereas the second string encodes it as 'e' with the
- * combining accent character '◌́'.
- */
- bool operator ==(Object other);
-
- /**
- * Returns true if this string ends with [other]. For example:
- *
- * 'Dart'.endsWith('t'); // true
- */
- bool endsWith(String other);
-
- /**
- * Returns true if this string starts with a match of [pattern].
- *
- * var string = 'Dart';
- * string.startsWith('D'); // true
- * string.startsWith(new RegExp(r'[A-Z][a-z]')); // true
- *
- * If [index] is provided, this method checks if the substring starting
- * at that index starts with a match of [pattern]:
- *
- * string.startsWith('art', 1); // true
- * string.startsWith(new RegExp(r'\w{3}')); // true
- *
- * [index] must not be negative or greater than [length].
- *
- * A [RegExp] containing '^' does not match if the [index] is greater than
- * zero. The pattern works on the string as a whole, and does not extract
- * a substring starting at [index] first:
- *
- * string.startsWith(new RegExp(r'^art'), 1); // false
- * string.startsWith(new RegExp(r'art'), 1); // true
- */
- bool startsWith(Pattern pattern, [int index = 0]);
-
- /**
- * Returns the position of the first match of [pattern] in this string,
- * starting at [start], inclusive:
- *
- * var string = 'Dartisans';
- * string.indexOf('art'); // 1
- * string.indexOf(new RegExp(r'[A-Z][a-z]')); // 0
- *
- * Returns -1 if no match is found:
- *
- * string.indexOf(new RegExp(r'dart')); // -1
- *
- * [start] must not be negative or greater than [length].
- */
- int indexOf(Pattern pattern, [int start]);
-
- /**
- * Returns the position of the last match [pattern] in this string, searching
- * backward starting at [start], inclusive:
- *
- * var string = 'Dartisans';
- * string.lastIndexOf('a'); // 6
- * string.lastIndexOf(new RegExp(r'a(r|n)')); // 6
- *
- * Returns -1 if [other] could not be found.
- *
- * string.lastIndexOf(new RegExp(r'DART')); // -1
- *
- * [start] must not be negative or greater than [length].
- */
- int lastIndexOf(Pattern pattern, [int start]);
-
- /**
- * Returns true if this string is empty.
- */
- bool get isEmpty;
-
- /**
- * Returns true if this string is not empty.
- */
- bool get isNotEmpty;
-
- /**
- * Creates a new string by concatenating this string with [other].
- *
- * 'dart' + 'lang'; // 'dartlang'
- */
- String operator +(String other);
-
- /**
- * Returns the substring of this string that extends from [startIndex],
- * inclusive, to [endIndex], exclusive.
- *
- * var string = 'dartlang';
- * string.substring(1); // 'artlang'
- * string.substring(1, 4); // 'art'
- */
- String substring(int startIndex, [int endIndex]);
-
- /**
- * Returns the string without any leading and trailing whitespace.
- *
- * If the string contains leading or trailing whitespace, a new string with no
- * leading and no trailing whitespace is returned:
- *
- * '\tDart is fun\n'.trim(); // 'Dart is fun'
- *
- * Otherwise, the original string itself is returned:
- *
- * var str1 = 'Dart';
- * var str2 = str1.trim();
- * identical(str1, str2); // true
- *
- * Whitespace is defined by the Unicode White_Space property (as defined in
- * version 6.2 or later) and the BOM character, 0xFEFF.
- *
- * Here is the list of trimmed characters (following version 6.2):
- *
- * 0009..000D ; White_Space # Cc <control-0009>..<control-000D>
- * 0020 ; White_Space # Zs SPACE
- * 0085 ; White_Space # Cc <control-0085>
- * 00A0 ; White_Space # Zs NO-BREAK SPACE
- * 1680 ; White_Space # Zs OGHAM SPACE MARK
- * 180E ; White_Space # Zs MONGOLIAN VOWEL SEPARATOR
- * 2000..200A ; White_Space # Zs EN QUAD..HAIR SPACE
- * 2028 ; White_Space # Zl LINE SEPARATOR
- * 2029 ; White_Space # Zp PARAGRAPH SEPARATOR
- * 202F ; White_Space # Zs NARROW NO-BREAK SPACE
- * 205F ; White_Space # Zs MEDIUM MATHEMATICAL SPACE
- * 3000 ; White_Space # Zs IDEOGRAPHIC SPACE
- *
- * FEFF ; BOM ZERO WIDTH NO_BREAK SPACE
- */
- String trim();
-
- /**
- * Returns the string without any leading whitespace.
- *
- * As [trim], but only removes leading whitespace.
- */
- String trimLeft();
-
- /**
- * Returns the string without any trailing whitespace.
- *
- * As [trim], but only removes trailing whitespace.
- */
- String trimRight();
-
- /**
- * Creates a new string by concatenating this string with itself a number
- * of times.
- *
- * The result of `str * n` is equivalent to
- * `str + str + ...`(n times)`... + str`.
- *
- * Returns an empty string if [times] is zero or negative.
- */
- String operator *(int times);
-
- /**
- * Pads this string on the left if it is shorther than [width].
- *
- * Return a new string that prepends [padding] onto this string
- * one time for each position the length is less than [width].
- *
- * If [width] is already smaller than or equal to `this.length`,
- * no padding is added. A negative `width` is treated as zero.
- *
- * If [padding] has length different from 1, the result will not
- * have length `width`. This may be useful for cases where the
- * padding is a longer string representing a single character, like
- * `" "` or `"\u{10002}`".
- * In that case, the user should make sure that `this.length` is
- * the correct measure of the strings length.
- */
- String padLeft(int width, [String padding = ' ']);
-
- /**
- * Pads this string on the right if it is shorther than [width].
- *
- * Return a new string that appends [padding] after this string
- * one time for each position the length is less than [width].
- *
- * If [width] is already smaller than or equal to `this.length`,
- * no padding is added. A negative `width` is treated as zero.
- *
- * If [padding] has length different from 1, the result will not
- * have length `width`. This may be useful for cases where the
- * padding is a longer string representing a single character, like
- * `" "` or `"\u{10002}`".
- * In that case, the user should make sure that `this.length` is
- * the correct measure of the strings length.
- */
- String padRight(int width, [String padding = ' ']);
-
- /**
- * Returns true if this string contains a match of [other]:
- *
- * var string = 'Dart strings';
- * string.contains('D'); // true
- * string.contains(new RegExp(r'[A-Z]')); // true
- *
- * If [startIndex] is provided, this method matches only at or after that
- * index:
- *
- * string.contains('X', 1); // false
- * string.contains(new RegExp(r'[A-Z]'), 1); // false
- *
- * [startIndex] must not be negative or greater than [length].
- */
- bool contains(Pattern other, [int startIndex = 0]);
-
- /**
- * Returns a new string in which the first occurence of [from] in this string
- * is replaced with [to], starting from [startIndex]:
- *
- * '0.0001'.replaceFirst(new RegExp(r'0'), ''); // '.0001'
- * '0.0001'.replaceFirst(new RegExp(r'0'), '7', 1); // '0.7001'
- */
- String replaceFirst(Pattern from, String to, [int startIndex = 0]);
-
- /**
- * Replace the first occurence of [from] in this string.
- *
- * Returns a new string, which is this string
- * except that the first match of [pattern], starting from [startIndex],
- * is replaced by the result of calling [replace] with the match object.
- *
- * If the value returned by calling `replace` is not a [String], it
- * is converted to a `String` using its `toString` method, which must
- * then return a string.
- */
- String replaceFirstMapped(Pattern from, String replace(Match match),
- [int startIndex = 0]);
-
- /**
- * Replaces all substrings that match [from] with [replace].
- *
- * Returns a new string in which the non-overlapping substrings matching
- * [from] (the ones iterated by `from.allMatches(thisString)`) are replaced
- * by the literal string [replace].
- *
- * 'resume'.replaceAll(new RegExp(r'e'), 'é'); // 'résumé'
- *
- * Notice that the [replace] string is not interpreted. If the replacement
- * depends on the match (for example on a [RegExp]'s capture groups), use
- * the [replaceAllMapped] method instead.
- */
- String replaceAll(Pattern from, String replace);
-
- /**
- * Replace all substrings that match [from] by a string computed from the
- * match.
- *
- * Returns a new string in which the non-overlapping substrings that match
- * [from] (the ones iterated by `from.allMatches(thisString)`) are replaced
- * by the result of calling [replace] on the corresponding [Match] object.
- *
- * This can be used to replace matches with new content that depends on the
- * match, unlike [replaceAll] where the replacement string is always the same.
- *
- * The [replace] function is called with the [Match] generated
- * by the pattern, and its result is used as replacement.
- *
- * The function defined below converts each word in a string to simplified
- * 'pig latin' using [replaceAllMapped]:
- *
- * pigLatin(String words) => words.replaceAllMapped(
- * new RegExp(r'\b(\w*?)([aeiou]\w*)', caseSensitive: false),
- * (Match m) => "${m[2]}${m[1]}${m[1].isEmpty ? 'way' : 'ay'}");
- *
- * pigLatin('I have a secret now!'); // 'Iway avehay away ecretsay ownay!'
- */
- String replaceAllMapped(Pattern from, String replace(Match match));
-
- /**
- * Replaces the substring from [start] to [end] with [replacement].
- *
- * Returns a new string equivalent to:
- *
- * this.substring(0, start) + replacement + this.substring(end)
- *
- * The [start] and [end] indices must specify a valid range of this string.
- * That is `0 <= start <= end <= this.length`.
- * If [end] is `null`, it defaults to [length].
- */
- String replaceRange(int start, int end, String replacement);
-
- /**
- * Splits the string at matches of [pattern] and returns a list of substrings.
- *
- * Finds all the matches of `pattern` in this string,
- * and returns the list of the substrings between the matches.
- *
- * var string = "Hello world!";
- * string.split(" "); // ['Hello', 'world!'];
- *
- * Empty matches at the beginning and end of the strings are ignored,
- * and so are empty matches right after another match.
- *
- * var string = "abba";
- * string.split(new RegExp(r"b*")); // ['a', 'a']
- * // not ['', 'a', 'a', '']
- *
- * If this string is empty, the result is an empty list if `pattern` matches
- * the empty string, and it is `[""]` if the pattern doesn't match.
- *
- * var string = '';
- * string.split(''); // []
- * string.split("a"); // ['']
- *
- * Splitting with an empty pattern splits the string into single-code unit
- * strings.
- *
- * var string = 'Pub';
- * string.split(''); // ['P', 'u', 'b']
- *
- * string.codeUnits.map((unit) {
- * return new String.fromCharCode(unit);
- * }).toList(); // ['P', 'u', 'b']
- *
- * Splitting happens at UTF-16 code unit boundaries,
- * and not at rune boundaries:
- *
- * // String made up of two code units, but one rune.
- * string = '\u{1D11E}';
- * string.split('').length; // 2 surrogate values
- *
- * To get a list of strings containing the individual runes of a string,
- * you should not use split. You can instead map each rune to a string
- * as follows:
- *
- * string.runes.map((rune) => new String.fromCharCode(rune)).toList();
- */
- List<String> split(Pattern pattern);
-
- /**
- * Splits the string, converts its parts, and combines them into a new
- * string.
- *
- * [pattern] is used to split the string into parts and separating matches.
- *
- * Each match is converted to a string by calling [onMatch]. If [onMatch]
- * is omitted, the matched string is used.
- *
- * Each non-matched part is converted by a call to [onNonMatch]. If
- * [onNonMatch] is omitted, the non-matching part is used.
- *
- * Then all the converted parts are combined into the resulting string.
- *
- * 'Eats shoots leaves'.splitMapJoin((new RegExp(r'shoots')),
- * onMatch: (m) => '${m.group(0)}',
- * onNonMatch: (n) => '*'); // *shoots*
- */
- String splitMapJoin(Pattern pattern,
- {String onMatch(Match match),
- String onNonMatch(String nonMatch)});
-
- /**
- * Returns an unmodifiable list of the UTF-16 code units of this string.
- */
- List<int> get codeUnits;
-
- /**
- * Returns an [Iterable] of Unicode code-points of this string.
- *
- * If the string contains surrogate pairs, they are combined and returned
- * as one integer by this iterator. Unmatched surrogate halves are treated
- * like valid 16-bit code-units.
- */
- Runes get runes;
-
- /**
- * Converts all characters in this string to lower case.
- * If the string is already in all lower case, this method returns [:this:].
- *
- * 'ALPHABET'.toLowerCase(); // 'alphabet'
- * 'abc'.toLowerCase(); // 'abc'
- *
- * This function uses the language independent Unicode mapping and thus only
- * works in some languages.
- */
- // TODO(floitsch): document better. (See EcmaScript for description).
- String toLowerCase();
-
- /**
- * Converts all characters in this string to upper case.
- * If the string is already in all upper case, this method returns [:this:].
- *
- * 'alphabet'.toUpperCase(); // 'ALPHABET'
- * 'ABC'.toUpperCase(); // 'ABC'
- *
- * This function uses the language independent Unicode mapping and thus only
- * works in some languages.
- */
- // TODO(floitsch): document better. (See EcmaScript for description).
- String toUpperCase();
-}
-
-/**
- * The runes (integer Unicode code points) of a [String].
- */
-class Runes extends Iterable<int> {
- final String string;
- Runes(this.string);
-
- RuneIterator get iterator => new RuneIterator(string);
-
- int get last {
- if (string.length == 0) {
- throw new StateError('No elements.');
- }
- int length = string.length;
- int code = string.codeUnitAt(length - 1);
- if (_isTrailSurrogate(code) && string.length > 1) {
- int previousCode = string.codeUnitAt(length - 2);
- if (_isLeadSurrogate(previousCode)) {
- return _combineSurrogatePair(previousCode, code);
- }
- }
- return code;
- }
-
-}
-
-// Is then code (a 16-bit unsigned integer) a UTF-16 lead surrogate.
-bool _isLeadSurrogate(int code) => (code & 0xFC00) == 0xD800;
-
-// Is then code (a 16-bit unsigned integer) a UTF-16 trail surrogate.
-bool _isTrailSurrogate(int code) => (code & 0xFC00) == 0xDC00;
-
-// Combine a lead and a trail surrogate value into a single code point.
-int _combineSurrogatePair(int start, int end) {
- return 0x10000 + ((start & 0x3FF) << 10) + (end & 0x3FF);
-}
-
-/** [Iterator] for reading runes (integer Unicode code points) out of a Dart
- * string.
- */
-class RuneIterator implements BidirectionalIterator<int> {
- /** String being iterated. */
- final String string;
- /** Position before the current code point. */
- int _position;
- /** Position after the current code point. */
- int _nextPosition;
- /**
- * Current code point.
- *
- * If the iterator has hit either end, the [_currentCodePoint] is null
- * and [: _position == _nextPosition :].
- */
- int _currentCodePoint;
-
- /** Create an iterator positioned at the beginning of the string. */
- RuneIterator(String string)
- : this.string = string, _position = 0, _nextPosition = 0;
-
- /**
- * Create an iterator positioned before the [index]th code unit of the string.
- *
- * When created, there is no [current] value.
- * A [moveNext] will use the rune starting at [index] the current value,
- * and a [movePrevious] will use the rune ending just before [index] as the
- * the current value.
- *
- * The [index] position must not be in the middle of a surrogate pair.
- */
- RuneIterator.at(String string, int index)
- : string = string, _position = index, _nextPosition = index {
- RangeError.checkValueInInterval(index, 0, string.length);
- _checkSplitSurrogate(index);
- }
-
- /** Throw an error if the index is in the middle of a surrogate pair. */
- void _checkSplitSurrogate(int index) {
- if (index > 0 && index < string.length &&
- _isLeadSurrogate(string.codeUnitAt(index - 1)) &&
- _isTrailSurrogate(string.codeUnitAt(index))) {
- throw new ArgumentError('Index inside surrogate pair: $index');
- }
- }
-
- /**
- * Returns the starting position of the current rune in the string.
- *
- * Returns null if the [current] rune is null.
- */
- int get rawIndex => (_position != _nextPosition) ? _position : null;
-
- /**
- * Resets the iterator to the rune at the specified index of the string.
- *
- * Setting a negative [rawIndex], or one greater than or equal to
- * [:string.length:],
- * is an error. So is setting it in the middle of a surrogate pair.
- *
- * Setting the position to the end of then string will set [current] to null.
- */
- void set rawIndex(int rawIndex) {
- RangeError.checkValidIndex(rawIndex, string, "rawIndex");
- reset(rawIndex);
- moveNext();
- }
-
- /**
- * Resets the iterator to the given index into the string.
- *
- * After this the [current] value is unset.
- * You must call [moveNext] make the rune at the position current,
- * or [movePrevious] for the last rune before the position.
- *
- * Setting a negative [rawIndex], or one greater than [:string.length:],
- * is an error. So is setting it in the middle of a surrogate pair.
- */
- void reset([int rawIndex = 0]) {
- RangeError.checkValueInInterval(rawIndex, 0, string.length, "rawIndex");
- _checkSplitSurrogate(rawIndex);
- _position = _nextPosition = rawIndex;
- _currentCodePoint = null;
- }
-
- /** The rune (integer Unicode code point) starting at the current position in
- * the string.
- */
- int get current => _currentCodePoint;
-
- /**
- * The number of code units comprising the current rune.
- *
- * Returns zero if there is no current rune ([current] is null).
- */
- int get currentSize => _nextPosition - _position;
-
- /**
- * A string containing the current rune.
- *
- * For runes outside the basic multilingual plane, this will be
- * a String of length 2, containing two code units.
- *
- * Returns null if [current] is null.
- */
- String get currentAsString {
- if (_position == _nextPosition) return null;
- if (_position + 1 == _nextPosition) return string[_position];
- return string.substring(_position, _nextPosition);
- }
-
- bool moveNext() {
- _position = _nextPosition;
- if (_position == string.length) {
- _currentCodePoint = null;
- return false;
- }
- int codeUnit = string.codeUnitAt(_position);
- int nextPosition = _position + 1;
- if (_isLeadSurrogate(codeUnit) && nextPosition < string.length) {
- int nextCodeUnit = string.codeUnitAt(nextPosition);
- if (_isTrailSurrogate(nextCodeUnit)) {
- _nextPosition = nextPosition + 1;
- _currentCodePoint = _combineSurrogatePair(codeUnit, nextCodeUnit);
- return true;
- }
- }
- _nextPosition = nextPosition;
- _currentCodePoint = codeUnit;
- return true;
- }
-
- bool movePrevious() {
- _nextPosition = _position;
- if (_position == 0) {
- _currentCodePoint = null;
- return false;
- }
- int position = _position - 1;
- int codeUnit = string.codeUnitAt(position);
- if (_isTrailSurrogate(codeUnit) && position > 0) {
- int prevCodeUnit = string.codeUnitAt(position - 1);
- if (_isLeadSurrogate(prevCodeUnit)) {
- _position = position - 1;
- _currentCodePoint = _combineSurrogatePair(prevCodeUnit, codeUnit);
- return true;
- }
- }
- _position = position;
- _currentCodePoint = codeUnit;
- return true;
- }
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/core/string_buffer.dart b/pkg/dev_compiler/tool/input_sdk/lib/core/string_buffer.dart
deleted file mode 100644
index 31b8780..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/core/string_buffer.dart
+++ /dev/null
@@ -1,51 +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.
-
-part of dart.core;
-
-/**
- * A class for concatenating strings efficiently.
- *
- * Allows for the incremental building of a string using write*() methods.
- * The strings are concatenated to a single string only when [toString] is
- * called.
- */
-class StringBuffer implements StringSink {
-
- /** Creates the string buffer with an initial content. */
- external StringBuffer([Object content = ""]);
-
- /**
- * Returns the length of the content that has been accumulated so far.
- * This is a constant-time operation.
- */
- external int get length;
-
- /** Returns whether the buffer is empty. This is a constant-time operation. */
- bool get isEmpty => length == 0;
-
- /**
- * Returns whether the buffer is not empty. This is a constant-time
- * operation.
- */
- bool get isNotEmpty => !isEmpty;
-
- /// Adds the contents of [obj], converted to a string, to the buffer.
- external void write(Object obj);
-
- /// Adds the string representation of [charCode] to the buffer.
- external void writeCharCode(int charCode);
-
- external void writeAll(Iterable objects, [String separator = ""]);
-
- external void writeln([Object obj = ""]);
-
- /**
- * Clears the string buffer.
- */
- external void clear();
-
- /// Returns the contents of buffer as a concatenated string.
- external String toString();
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/core/string_sink.dart b/pkg/dev_compiler/tool/input_sdk/lib/core/string_sink.dart
deleted file mode 100644
index 5fdd0f2..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/core/string_sink.dart
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-part of dart.core;
-
-abstract class StringSink {
-
- /**
- * Converts [obj] to a String by invoking [Object.toString] and
- * adds the result to `this`.
- */
- void write(Object obj);
-
- /**
- * Iterates over the given [objects] and [write]s them in sequence.
- */
- void writeAll(Iterable objects, [String separator = ""]);
-
- /**
- * Converts [obj] to a String by invoking [Object.toString] and
- * adds the result to `this`, followed by a newline.
- */
- void writeln([Object obj = ""]);
-
- /**
- * Writes the [charCode] to `this`.
- *
- * This method is equivalent to `write(new String.fromCharCode(charCode))`.
- */
- void writeCharCode(int charCode);
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/core/symbol.dart b/pkg/dev_compiler/tool/input_sdk/lib/core/symbol.dart
deleted file mode 100644
index f60cdd1..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/core/symbol.dart
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-part of dart.core;
-
-/// Opaque name used by mirrors, invocations and [Function.apply].
-abstract class Symbol {
- /**
- * Constructs a new Symbol.
- *
- * The name must be a valid public Dart member name,
- * public constructor name, or library name, optionally qualified.
- *
- * A qualified name is a valid name preceded by a public identifier name
- * and a '`.`', e.g., `foo.bar.baz=` is a qualified version of `baz=`.
- * That means that the content of the [name] String must be either
- *
- * * a valid public Dart identifier
- * (that is, an identifier not starting with "`_`"),
- * * such an identifier followed by "=" (a setter name),
- * * the name of a declarable operator
- * (one of "`+`", "`-`", "`*`", "`/`", "`%`", "`~/`", "`&`", "`|`",
- * "`^`", "`~`", "`<<`", "`>>`", "`<`", "`<=`", "`>`", "`>=`", "`==`",
- * "`[]`", "`[]=`", or "`unary-`"),
- * * any of the above preceeded by any number of qualifiers,
- * where a qualifier is a non-private identifier followed by '`.`',
- * * or the empty string (the default name of a library with no library
- * name declaration).
- *
- * The following text is non-normative:
- *
- * Creating non-const Symbol instances may result in larger output. If
- * possible, use [MirrorsUsed] in "dart:mirrors" to specify which names might
- * be passed to this constructor.
- */
- const factory Symbol(String name) = internal.Symbol;
-
- /**
- * Returns a hash code compatible with [operator==].
- *
- * Equal symbols have the same hash code.
- */
- int get hashCode;
-
- /**
- * Symbols are equal to other symbols that correspond to the same member name.
- *
- * Qualified member names, like `#foo.bar` are equal only if they have the
- * same identifiers before the same final member name.
- */
- bool operator ==(Object other);
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/core/type.dart b/pkg/dev_compiler/tool/input_sdk/lib/core/type.dart
deleted file mode 100644
index d2e107b..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/core/type.dart
+++ /dev/null
@@ -1,10 +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.
-
-part of dart.core;
-
-/**
- * Runtime representation of a type.
- */
-abstract class Type {}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/core/uri.dart b/pkg/dev_compiler/tool/input_sdk/lib/core/uri.dart
deleted file mode 100644
index 1d35106..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/core/uri.dart
+++ /dev/null
@@ -1,3354 +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.
-
-part of dart.core;
-
-/**
- * A parsed URI, such as a URL.
- *
- * **See also:**
- *
- * * [URIs][uris] in the [library tour][libtour]
- * * [RFC-3986](http://tools.ietf.org/html/rfc3986)
- *
- * [uris]: https://www.dartlang.org/docs/dart-up-and-running/ch03.html#uris
- * [libtour]: https://www.dartlang.org/docs/dart-up-and-running/contents/ch03.html
- */
-class Uri {
- /**
- * The scheme component of the URI.
- *
- * Returns the empty string if there is no scheme component.
- *
- * A URI scheme is case insensitive.
- * The returned scheme is canonicalized to lowercase letters.
- */
- // We represent the missing scheme as an empty string.
- // A valid scheme cannot be empty.
- final String scheme;
-
- /**
- * The user-info part of the authority.
- *
- * Does not distinguish between an empty user-info and an absent one.
- * The value is always non-null.
- * Is considered absent if [_host] is `null`.
- */
- final String _userInfo;
-
- /**
- * The host name of the URI.
- *
- * Set to `null` if there is no authority in the URI.
- * The host name is the only mandatory part of an authority, so we use
- * it to mark whether an authority part was present or not.
- */
- final String _host;
-
- /**
- * The port number part of the authority.
- *
- * The port. Set to null if there is no port. Normalized to null if
- * the port is the default port for the scheme.
- */
- int _port;
-
- /**
- * The path of the URI.
- *
- * Always non-null.
- */
- String _path;
-
- // The query content, or null if there is no query.
- final String _query;
-
- // The fragment content, or null if there is no fragment.
- final String _fragment;
-
- /**
- * Cache the computed return value of [pathSegements].
- */
- List<String> _pathSegments;
-
- /**
- * Cache the computed return value of [queryParameters].
- */
- Map<String, String> _queryParameters;
- Map<String, List<String>> _queryParameterLists;
-
- /// Internal non-verifying constructor. Only call with validated arguments.
- Uri._internal(this.scheme,
- this._userInfo,
- this._host,
- this._port,
- this._path,
- this._query,
- this._fragment);
-
- /**
- * Creates a new URI from its components.
- *
- * Each component is set through a named argument. Any number of
- * components can be provided. The [path] and [query] components can be set
- * using either of two different named arguments.
- *
- * The scheme component is set through [scheme]. The scheme is
- * normalized to all lowercase letters. If the scheme is omitted or empty,
- * the URI will not have a scheme part.
- *
- * The user info part of the authority component is set through
- * [userInfo]. It defaults to the empty string, which will be omitted
- * from the string representation of the URI.
- *
- * The host part of the authority component is set through
- * [host]. The host can either be a hostname, an IPv4 address or an
- * IPv6 address, contained in '[' and ']'. If the host contains a
- * ':' character, the '[' and ']' are added if not already provided.
- * The host is normalized to all lowercase letters.
- *
- * The port part of the authority component is set through
- * [port].
- * If [port] is omitted or `null`, it implies the default port for
- * the URI's scheme, and is equivalent to passing that port explicitly.
- * The recognized schemes, and their default ports, are "http" (80) and
- * "https" (443). All other schemes are considered as having zero as the
- * default port.
- *
- * If any of `userInfo`, `host` or `port` are provided,
- * the URI has an autority according to [hasAuthority].
- *
- * The path component is set through either [path] or
- * [pathSegments].
- * When [path] is used, it should be a valid URI path,
- * but invalid characters, except the general delimiters ':/@[]?#',
- * will be escaped if necessary.
- * When [pathSegments] is used, each of the provided segments
- * is first percent-encoded and then joined using the forward slash
- * separator.
- *
- * The percent-encoding of the path segments encodes all
- * characters except for the unreserved characters and the following
- * list of characters: `!$&'()*+,;=:@`. If the other components
- * necessitate an absolute path, a leading slash `/` is prepended if
- * not already there.
- *
- * The query component is set through either [query] or [queryParameters].
- * When [query] is used, the provided string should be a valid URI query,
- * but invalid characters, other than general delimiters,
- * will be escaped if necessary.
- * When [queryParameters] is used the query is built from the
- * provided map. Each key and value in the map is percent-encoded
- * and joined using equal and ampersand characters.
- * A value in the map must be either a string, or an [Iterable] of strings,
- * where the latter corresponds to multiple values for the same key.
- *
- * The percent-encoding of the keys and values encodes all characters
- * except for the unreserved characters, and replaces spaces with `+`.
- * If `query` is the empty string, it is equivalent to omitting it.
- * To have an actual empty query part,
- * use an empty map for `queryParameters`.
- *
- * If both `query` and `queryParameters` are omitted or `null`,
- * the URI has no query part.
- *
- * The fragment component is set through [fragment].
- * It should be a valid URI fragment, but invalid characters other than
- * general delimiters, are escaped if necessary.
- * If `fragment` is omitted or `null`, the URI has no fragment part.
- */
- factory Uri({String scheme : "",
- String userInfo : "",
- String host,
- int port,
- String path,
- Iterable<String> pathSegments,
- String query,
- Map<String, dynamic/*String|Iterable<String>*/> queryParameters,
- String fragment}) {
- scheme = _makeScheme(scheme, 0, _stringOrNullLength(scheme));
- userInfo = _makeUserInfo(userInfo, 0, _stringOrNullLength(userInfo));
- host = _makeHost(host, 0, _stringOrNullLength(host), false);
- // Special case this constructor for backwards compatibility.
- if (query == "") query = null;
- query = _makeQuery(query, 0, _stringOrNullLength(query), queryParameters);
- fragment = _makeFragment(fragment, 0, _stringOrNullLength(fragment));
- port = _makePort(port, scheme);
- bool isFile = (scheme == "file");
- if (host == null &&
- (userInfo.isNotEmpty || port != null || isFile)) {
- host = "";
- }
- bool hasAuthority = (host != null);
- path = _makePath(path, 0, _stringOrNullLength(path), pathSegments,
- scheme, hasAuthority);
- if (scheme.isEmpty && host == null && !path.startsWith('/')) {
- path = _normalizeRelativePath(path);
- } else {
- path = _removeDotSegments(path);
- }
- return new Uri._internal(scheme, userInfo, host, port,
- path, query, fragment);
- }
-
- /**
- * Creates a new `http` URI from authority, path and query.
- *
- * Examples:
- *
- * ```
- * // http://example.org/path?q=dart.
- * new Uri.http("google.com", "/search", { "q" : "dart" });
- *
- * // http://user:pass@localhost:8080
- * new Uri.http("user:pass@localhost:8080", "");
- *
- * // http://example.org/a%20b
- * new Uri.http("example.org", "a b");
- *
- * // http://example.org/a%252F
- * new Uri.http("example.org", "/a%2F");
- * ```
- *
- * The `scheme` is always set to `http`.
- *
- * The `userInfo`, `host` and `port` components are set from the
- * [authority] argument. If `authority` is `null` or empty,
- * the created `Uri` has no authority, and isn't directly usable
- * as an HTTP URL, which must have a non-empty host.
- *
- * The `path` component is set from the [unencodedPath]
- * argument. The path passed must not be encoded as this constructor
- * encodes the path.
- *
- * The `query` component is set from the optional [queryParameters]
- * argument.
- */
- factory Uri.http(String authority,
- String unencodedPath,
- [Map<String, String> queryParameters]) {
- return _makeHttpUri("http", authority, unencodedPath, queryParameters);
- }
-
- /**
- * Creates a new `https` URI from authority, path and query.
- *
- * This constructor is the same as [Uri.http] except for the scheme
- * which is set to `https`.
- */
- factory Uri.https(String authority,
- String unencodedPath,
- [Map<String, String> queryParameters]) {
- return _makeHttpUri("https", authority, unencodedPath, queryParameters);
- }
-
- /**
- * Returns the authority component.
- *
- * The authority is formatted from the [userInfo], [host] and [port]
- * parts.
- *
- * Returns the empty string if there is no authority component.
- */
- String get authority {
- if (!hasAuthority) return "";
- var sb = new StringBuffer();
- _writeAuthority(sb);
- return sb.toString();
- }
-
- /**
- * Returns the user info part of the authority component.
- *
- * Returns the empty string if there is no user info in the
- * authority component.
- */
- String get userInfo => _userInfo;
-
- /**
- * Returns the host part of the authority component.
- *
- * Returns the empty string if there is no authority component and
- * hence no host.
- *
- * If the host is an IP version 6 address, the surrounding `[` and `]` is
- * removed.
- *
- * The host string is case-insensitive.
- * The returned host name is canonicalized to lower-case
- * with upper-case percent-escapes.
- */
- String get host {
- if (_host == null) return "";
- if (_host.startsWith('[')) {
- return _host.substring(1, _host.length - 1);
- }
- return _host;
- }
-
- /**
- * Returns the port part of the authority component.
- *
- * Returns the defualt port if there is no port number in the authority
- * component. That's 80 for http, 443 for https, and 0 for everything else.
- */
- int get port {
- if (_port == null) return _defaultPort(scheme);
- return _port;
- }
-
- // The default port for the scheme of this Uri..
- static int _defaultPort(String scheme) {
- if (scheme == "http") return 80;
- if (scheme == "https") return 443;
- return 0;
- }
-
- /**
- * Returns the path component.
- *
- * The returned path is encoded. To get direct access to the decoded
- * path use [pathSegments].
- *
- * Returns the empty string if there is no path component.
- */
- String get path => _path;
-
- /**
- * Returns the query component. The returned query is encoded. To get
- * direct access to the decoded query use [queryParameters].
- *
- * Returns the empty string if there is no query component.
- */
- String get query => (_query == null) ? "" : _query;
-
- /**
- * Returns the fragment identifier component.
- *
- * Returns the empty string if there is no fragment identifier
- * component.
- */
- String get fragment => (_fragment == null) ? "" : _fragment;
-
- /**
- * Creates a new `Uri` object by parsing a URI string.
- *
- * If [start] and [end] are provided, only the substring from `start`
- * to `end` is parsed as a URI.
- *
- * If the string is not valid as a URI or URI reference,
- * a [FormatException] is thrown.
- */
- static Uri parse(String uri, [int start = 0, int end]) {
- // This parsing will not validate percent-encoding, IPv6, etc.
- // When done splitting into parts, it will call, e.g., [_makeFragment]
- // to do the final parsing.
- //
- // Important parts of the RFC 3986 used here:
- // URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
- //
- // hier-part = "//" authority path-abempty
- // / path-absolute
- // / path-rootless
- // / path-empty
- //
- // URI-reference = URI / relative-ref
- //
- // absolute-URI = scheme ":" hier-part [ "?" query ]
- //
- // relative-ref = relative-part [ "?" query ] [ "#" fragment ]
- //
- // relative-part = "//" authority path-abempty
- // / path-absolute
- // / path-noscheme
- // / path-empty
- //
- // scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
- //
- // authority = [ userinfo "@" ] host [ ":" port ]
- // userinfo = *( unreserved / pct-encoded / sub-delims / ":" )
- // host = IP-literal / IPv4address / reg-name
- // port = *DIGIT
- // reg-name = *( unreserved / pct-encoded / sub-delims )
- //
- // path = path-abempty ; begins with "/" or is empty
- // / path-absolute ; begins with "/" but not "//"
- // / path-noscheme ; begins with a non-colon segment
- // / path-rootless ; begins with a segment
- // / path-empty ; zero characters
- //
- // path-abempty = *( "/" segment )
- // path-absolute = "/" [ segment-nz *( "/" segment ) ]
- // path-noscheme = segment-nz-nc *( "/" segment )
- // path-rootless = segment-nz *( "/" segment )
- // path-empty = 0<pchar>
- //
- // segment = *pchar
- // segment-nz = 1*pchar
- // segment-nz-nc = 1*( unreserved / pct-encoded / sub-delims / "@" )
- // ; non-zero-length segment without any colon ":"
- //
- // pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
- //
- // query = *( pchar / "/" / "?" )
- //
- // fragment = *( pchar / "/" / "?" )
- const int EOI = -1;
-
- String scheme = "";
- String userinfo = "";
- String host = null;
- int port = null;
- String path = null;
- String query = null;
- String fragment = null;
- if (end == null) end = uri.length;
-
- int index = start;
- int pathStart = start;
- // End of input-marker.
- int char = EOI;
-
- void parseAuth() {
- if (index == end) {
- char = EOI;
- return;
- }
- int authStart = index;
- int lastColon = -1;
- int lastAt = -1;
- char = uri.codeUnitAt(index);
- while (index < end) {
- char = uri.codeUnitAt(index);
- if (char == _SLASH || char == _QUESTION || char == _NUMBER_SIGN) {
- break;
- }
- if (char == _AT_SIGN) {
- lastAt = index;
- lastColon = -1;
- } else if (char == _COLON) {
- lastColon = index;
- } else if (char == _LEFT_BRACKET) {
- lastColon = -1;
- int endBracket = uri.indexOf(']', index + 1);
- if (endBracket == -1) {
- index = end;
- char = EOI;
- break;
- } else {
- index = endBracket;
- }
- }
- index++;
- char = EOI;
- }
- int hostStart = authStart;
- int hostEnd = index;
- if (lastAt >= 0) {
- userinfo = _makeUserInfo(uri, authStart, lastAt);
- hostStart = lastAt + 1;
- }
- if (lastColon >= 0) {
- int portNumber;
- if (lastColon + 1 < index) {
- portNumber = 0;
- for (int i = lastColon + 1; i < index; i++) {
- int digit = uri.codeUnitAt(i);
- if (_ZERO > digit || _NINE < digit) {
- _fail(uri, i, "Invalid port number");
- }
- portNumber = portNumber * 10 + (digit - _ZERO);
- }
- }
- port = _makePort(portNumber, scheme);
- hostEnd = lastColon;
- }
- host = _makeHost(uri, hostStart, hostEnd, true);
- if (index < end) {
- char = uri.codeUnitAt(index);
- }
- }
-
- // When reaching path parsing, the current character is known to not
- // be part of the path.
- const int NOT_IN_PATH = 0;
- // When reaching path parsing, the current character is part
- // of the a non-empty path.
- const int IN_PATH = 1;
- // When reaching authority parsing, authority is possible.
- // This is only true at start or right after scheme.
- const int ALLOW_AUTH = 2;
-
- // Current state.
- // Initialized to the default value that is used when exiting the
- // scheme loop by reaching the end of input.
- // All other breaks set their own state.
- int state = NOT_IN_PATH;
- int i = index; // Temporary alias for index to avoid bug 19550 in dart2js.
- while (i < end) {
- char = uri.codeUnitAt(i);
- if (char == _QUESTION || char == _NUMBER_SIGN) {
- state = NOT_IN_PATH;
- break;
- }
- if (char == _SLASH) {
- state = (i == start) ? ALLOW_AUTH : IN_PATH;
- break;
- }
- if (char == _COLON) {
- if (i == start) _fail(uri, start, "Invalid empty scheme");
- scheme = _makeScheme(uri, start, i);
- i++;
- pathStart = i;
- if (i == end) {
- char = EOI;
- state = NOT_IN_PATH;
- } else {
- char = uri.codeUnitAt(i);
- if (char == _QUESTION || char == _NUMBER_SIGN) {
- state = NOT_IN_PATH;
- } else if (char == _SLASH) {
- state = ALLOW_AUTH;
- } else {
- state = IN_PATH;
- }
- }
- break;
- }
- i++;
- char = EOI;
- }
- index = i; // Remove alias when bug is fixed.
-
- if (state == ALLOW_AUTH) {
- assert(char == _SLASH);
- // Have seen one slash either at start or right after scheme.
- // If two slashes, it's an authority, otherwise it's just the path.
- index++;
- if (index == end) {
- char = EOI;
- state = NOT_IN_PATH;
- } else {
- char = uri.codeUnitAt(index);
- if (char == _SLASH) {
- index++;
- parseAuth();
- pathStart = index;
- }
- if (char == _QUESTION || char == _NUMBER_SIGN || char == EOI) {
- state = NOT_IN_PATH;
- } else {
- state = IN_PATH;
- }
- }
- }
-
- assert(state == IN_PATH || state == NOT_IN_PATH);
- if (state == IN_PATH) {
- // Characters from pathStart to index (inclusive) are known
- // to be part of the path.
- while (++index < end) {
- char = uri.codeUnitAt(index);
- if (char == _QUESTION || char == _NUMBER_SIGN) {
- break;
- }
- char = EOI;
- }
- state = NOT_IN_PATH;
- }
-
- assert(state == NOT_IN_PATH);
- bool hasAuthority = (host != null);
- path = _makePath(uri, pathStart, index, null, scheme, hasAuthority);
-
- if (char == _QUESTION) {
- int numberSignIndex = -1;
- for (int i = index + 1; i < end; i++) {
- if (uri.codeUnitAt(i) == _NUMBER_SIGN) {
- numberSignIndex = i;
- break;
- }
- }
- if (numberSignIndex < 0) {
- query = _makeQuery(uri, index + 1, end, null);
- } else {
- query = _makeQuery(uri, index + 1, numberSignIndex, null);
- fragment = _makeFragment(uri, numberSignIndex + 1, end);
- }
- } else if (char == _NUMBER_SIGN) {
- fragment = _makeFragment(uri, index + 1, end);
- }
- return new Uri._internal(scheme,
- userinfo,
- host,
- port,
- path,
- query,
- fragment);
- }
-
- // Report a parse failure.
- static void _fail(String uri, int index, String message) {
- throw new FormatException(message, uri, index);
- }
-
- static Uri _makeHttpUri(String scheme,
- String authority,
- String unencodedPath,
- Map<String, String> queryParameters) {
- var userInfo = "";
- var host = null;
- var port = null;
-
- if (authority != null && authority.isNotEmpty) {
- var hostStart = 0;
- // Split off the user info.
- bool hasUserInfo = false;
- for (int i = 0; i < authority.length; i++) {
- if (authority.codeUnitAt(i) == _AT_SIGN) {
- hasUserInfo = true;
- userInfo = authority.substring(0, i);
- hostStart = i + 1;
- break;
- }
- }
- var hostEnd = hostStart;
- if (hostStart < authority.length &&
- authority.codeUnitAt(hostStart) == _LEFT_BRACKET) {
- // IPv6 host.
- for (; hostEnd < authority.length; hostEnd++) {
- if (authority.codeUnitAt(hostEnd) == _RIGHT_BRACKET) break;
- }
- if (hostEnd == authority.length) {
- throw new FormatException("Invalid IPv6 host entry.",
- authority, hostStart);
- }
- parseIPv6Address(authority, hostStart + 1, hostEnd);
- hostEnd++; // Skip the closing bracket.
- if (hostEnd != authority.length &&
- authority.codeUnitAt(hostEnd) != _COLON) {
- throw new FormatException("Invalid end of authority",
- authority, hostEnd);
- }
- }
- // Split host and port.
- bool hasPort = false;
- for (; hostEnd < authority.length; hostEnd++) {
- if (authority.codeUnitAt(hostEnd) == _COLON) {
- var portString = authority.substring(hostEnd + 1);
- // We allow the empty port - falling back to initial value.
- if (portString.isNotEmpty) port = int.parse(portString);
- break;
- }
- }
- host = authority.substring(hostStart, hostEnd);
- }
- return new Uri(scheme: scheme,
- userInfo: userInfo,
- host: host,
- port: port,
- pathSegments: unencodedPath.split("/"),
- queryParameters: queryParameters);
- }
-
- /**
- * Creates a new file URI from an absolute or relative file path.
- *
- * The file path is passed in [path].
- *
- * This path is interpreted using either Windows or non-Windows
- * semantics.
- *
- * With non-Windows semantics the slash ("/") is used to separate
- * path segments.
- *
- * With Windows semantics, backslash ("\") and forward-slash ("/")
- * are used to separate path segments, except if the path starts
- * with "\\?\" in which case, only backslash ("\") separates path
- * segments.
- *
- * If the path starts with a path separator an absolute URI is
- * created. Otherwise a relative URI is created. One exception from
- * this rule is that when Windows semantics is used and the path
- * starts with a drive letter followed by a colon (":") and a
- * path separator then an absolute URI is created.
- *
- * The default for whether to use Windows or non-Windows semantics
- * determined from the platform Dart is running on. When running in
- * the standalone VM this is detected by the VM based on the
- * operating system. When running in a browser non-Windows semantics
- * is always used.
- *
- * To override the automatic detection of which semantics to use pass
- * a value for [windows]. Passing `true` will use Windows
- * semantics and passing `false` will use non-Windows semantics.
- *
- * Examples using non-Windows semantics:
- *
- * ```
- * // xxx/yyy
- * new Uri.file("xxx/yyy", windows: false);
- *
- * // xxx/yyy/
- * new Uri.file("xxx/yyy/", windows: false);
- *
- * // file:///xxx/yyy
- * new Uri.file("/xxx/yyy", windows: false);
- *
- * // file:///xxx/yyy/
- * new Uri.file("/xxx/yyy/", windows: false);
- *
- * // C:
- * new Uri.file("C:", windows: false);
- * ```
- *
- * Examples using Windows semantics:
- *
- * ```
- * // xxx/yyy
- * new Uri.file(r"xxx\yyy", windows: true);
- *
- * // xxx/yyy/
- * new Uri.file(r"xxx\yyy\", windows: true);
- *
- * file:///xxx/yyy
- * new Uri.file(r"\xxx\yyy", windows: true);
- *
- * file:///xxx/yyy/
- * new Uri.file(r"\xxx\yyy/", windows: true);
- *
- * // file:///C:/xxx/yyy
- * new Uri.file(r"C:\xxx\yyy", windows: true);
- *
- * // This throws an error. A path with a drive letter is not absolute.
- * new Uri.file(r"C:", windows: true);
- *
- * // This throws an error. A path with a drive letter is not absolute.
- * new Uri.file(r"C:xxx\yyy", windows: true);
- *
- * // file://server/share/file
- * new Uri.file(r"\\server\share\file", windows: true);
- * ```
- *
- * If the path passed is not a legal file path [ArgumentError] is thrown.
- */
- factory Uri.file(String path, {bool windows}) {
- windows = (windows == null) ? Uri._isWindows : windows;
- return windows ? _makeWindowsFileUrl(path, false)
- : _makeFileUri(path, false);
- }
-
- /**
- * Like [Uri.file] except that a non-empty URI path ends in a slash.
- *
- * If [path] is not empty, and it doesn't end in a directory separator,
- * then a slash is added to the returned URI's path.
- * In all other cases, the result is the same as returned by `Uri.file`.
- */
- factory Uri.directory(String path, {bool windows}) {
- windows = (windows == null) ? Uri._isWindows : windows;
- return windows ? _makeWindowsFileUrl(path, true)
- : _makeFileUri(path, true);
- }
-
- /**
- * Creates a `data:` URI containing the [content] string.
- *
- * Converts the content to a bytes using [encoding] or the charset specified
- * in [parameters] (defaulting to US-ASCII if not specified or unrecognized),
- * then encodes the bytes into the resulting data URI.
- *
- * Defaults to encoding using percent-encoding (any non-ASCII or non-URI-valid
- * bytes is replaced by a percent encoding). If [base64] is true, the bytes
- * are instead encoded using [BASE64].
- *
- * If [encoding] is not provided and [parameters] has a `charset` entry,
- * that name is looked up using [Encoding.getByName],
- * and if the lookup returns an encoding, that encoding is used to convert
- * [content] to bytes.
- * If providing both an [encoding] and a charset [parameter], they should
- * agree, otherwise decoding won't be able to use the charset parameter
- * to determine the encoding.
- *
- * If [mimeType] and/or [parameters] are supplied, they are added to the
- * created URI. If any of these contain characters that are not allowed
- * in the data URI, the character is percent-escaped. If the character is
- * non-ASCII, it is first UTF-8 encoded and then the bytes are percent
- * encoded. An omitted [mimeType] in a data URI means `text/plain`, just
- * as an omitted `charset` parameter defaults to meaning `US-ASCII`.
- *
- * To read the content back, use [UriData.contentAsString].
- */
- factory Uri.dataFromString(String content,
- {String mimeType,
- Encoding encoding,
- Map<String, String> parameters,
- bool base64: false}) {
- UriData data = new UriData.fromString(content,
- mimeType: mimeType,
- encoding: encoding,
- parameters: parameters,
- base64: base64);
- return data.uri;
- }
-
- /**
- * Creates a `data:` URI containing an encoding of [bytes].
- *
- * Defaults to Base64 encoding the bytes, but if [percentEncoded]
- * is `true`, the bytes will instead be percent encoded (any non-ASCII
- * or non-valid-ASCII-character byte is replaced by a percent encoding).
- *
- * To read the bytes back, use [UriData.contentAsBytes].
- *
- * It defaults to having the mime-type `application/octet-stream`.
- * The [mimeType] and [parameters] are added to the created URI.
- * If any of these contain characters that are not allowed
- * in the data URI, the character is percent-escaped. If the character is
- * non-ASCII, it is first UTF-8 encoded and then the bytes are percent
- * encoded.
- */
- factory Uri.dataFromBytes(List<int> bytes,
- {mimeType: "application/octet-stream",
- Map<String, String> parameters,
- percentEncoded: false}) {
- UriData data = new UriData.fromBytes(bytes,
- mimeType: mimeType,
- parameters: parameters,
- percentEncoded: percentEncoded);
- return data.uri;
- }
-
- /**
- * Returns the natural base URI for the current platform.
- *
- * When running in a browser this is the current URL (from
- * `window.location.href`).
- *
- * When not running in a browser this is the file URI referencing
- * the current working directory.
- */
- external static Uri get base;
-
- external static bool get _isWindows;
-
- static _checkNonWindowsPathReservedCharacters(List<String> segments,
- bool argumentError) {
- segments.forEach((segment) {
- if (segment.contains("/")) {
- if (argumentError) {
- throw new ArgumentError("Illegal path character $segment");
- } else {
- throw new UnsupportedError("Illegal path character $segment");
- }
- }
- });
- }
-
- static _checkWindowsPathReservedCharacters(List<String> segments,
- bool argumentError,
- [int firstSegment = 0]) {
- for (var segment in segments.skip(firstSegment)) {
- if (segment.contains(new RegExp(r'["*/:<>?\\|]'))) {
- if (argumentError) {
- throw new ArgumentError("Illegal character in path");
- } else {
- throw new UnsupportedError("Illegal character in path");
- }
- }
- }
- }
-
- static _checkWindowsDriveLetter(int charCode, bool argumentError) {
- if ((_UPPER_CASE_A <= charCode && charCode <= _UPPER_CASE_Z) ||
- (_LOWER_CASE_A <= charCode && charCode <= _LOWER_CASE_Z)) {
- return;
- }
- if (argumentError) {
- throw new ArgumentError("Illegal drive letter " +
- new String.fromCharCode(charCode));
- } else {
- throw new UnsupportedError("Illegal drive letter " +
- new String.fromCharCode(charCode));
- }
- }
-
- static _makeFileUri(String path, bool slashTerminated) {
- const String sep = "/";
- var segments = path.split(sep);
- if (slashTerminated &&
- segments.isNotEmpty &&
- segments.last.isNotEmpty) {
- segments.add(""); // Extra separator at end.
- }
- if (path.startsWith(sep)) {
- // Absolute file:// URI.
- return new Uri(scheme: "file", pathSegments: segments);
- } else {
- // Relative URI.
- return new Uri(pathSegments: segments);
- }
- }
-
- static _makeWindowsFileUrl(String path, bool slashTerminated) {
- if (path.startsWith(r"\\?\")) {
- if (path.startsWith(r"UNC\", 4)) {
- path = path.replaceRange(0, 7, r'\');
- } else {
- path = path.substring(4);
- if (path.length < 3 ||
- path.codeUnitAt(1) != _COLON ||
- path.codeUnitAt(2) != _BACKSLASH) {
- throw new ArgumentError(
- r"Windows paths with \\?\ prefix must be absolute");
- }
- }
- } else {
- path = path.replaceAll("/", r'\');
- }
- const String sep = r'\';
- if (path.length > 1 && path.codeUnitAt(1) == _COLON) {
- _checkWindowsDriveLetter(path.codeUnitAt(0), true);
- if (path.length == 2 || path.codeUnitAt(2) != _BACKSLASH) {
- throw new ArgumentError(
- "Windows paths with drive letter must be absolute");
- }
- // Absolute file://C:/ URI.
- var pathSegments = path.split(sep);
- if (slashTerminated &&
- pathSegments.last.isNotEmpty) {
- pathSegments.add(""); // Extra separator at end.
- }
- _checkWindowsPathReservedCharacters(pathSegments, true, 1);
- return new Uri(scheme: "file", pathSegments: pathSegments);
- }
-
- if (path.startsWith(sep)) {
- if (path.startsWith(sep, 1)) {
- // Absolute file:// URI with host.
- int pathStart = path.indexOf(r'\', 2);
- String hostPart =
- (pathStart < 0) ? path.substring(2) : path.substring(2, pathStart);
- String pathPart =
- (pathStart < 0) ? "" : path.substring(pathStart + 1);
- var pathSegments = pathPart.split(sep);
- _checkWindowsPathReservedCharacters(pathSegments, true);
- if (slashTerminated &&
- pathSegments.last.isNotEmpty) {
- pathSegments.add(""); // Extra separator at end.
- }
- return new Uri(
- scheme: "file", host: hostPart, pathSegments: pathSegments);
- } else {
- // Absolute file:// URI.
- var pathSegments = path.split(sep);
- if (slashTerminated &&
- pathSegments.last.isNotEmpty) {
- pathSegments.add(""); // Extra separator at end.
- }
- _checkWindowsPathReservedCharacters(pathSegments, true);
- return new Uri(scheme: "file", pathSegments: pathSegments);
- }
- } else {
- // Relative URI.
- var pathSegments = path.split(sep);
- _checkWindowsPathReservedCharacters(pathSegments, true);
- if (slashTerminated &&
- pathSegments.isNotEmpty &&
- pathSegments.last.isNotEmpty) {
- pathSegments.add(""); // Extra separator at end.
- }
- return new Uri(pathSegments: pathSegments);
- }
- }
-
- /**
- * Returns a new `Uri` based on this one, but with some parts replaced.
- *
- * This method takes the same parameters as the [new Uri] constructor,
- * and they have the same meaning.
- *
- * At most one of [path] and [pathSegments] must be provided.
- * Likewise, at most one of [query] and [queryParameters] must be provided.
- *
- * Each part that is not provided will default to the corresponding
- * value from this `Uri` instead.
- *
- * This method is different from [Uri.resolve] which overrides in a
- * hierarchial manner,
- * and can instead replace each part of a `Uri` individually.
- *
- * Example:
- *
- * Uri uri1 = Uri.parse("a://b@c:4/d/e?f#g");
- * Uri uri2 = uri1.replace(scheme: "A", path: "D/E/E", fragment: "G");
- * print(uri2); // prints "A://b@c:4/D/E/E/?f#G"
- *
- * This method acts similarly to using the `new Uri` constructor with
- * some of the arguments taken from this `Uri` . Example:
- *
- * Uri uri3 = new Uri(
- * scheme: "A",
- * userInfo: uri1.userInfo,
- * host: uri1.host,
- * port: uri1.port,
- * path: "D/E/E",
- * query: uri1.query,
- * fragment: "G");
- * print(uri3); // prints "A://b@c:4/D/E/E/?f#G"
- * print(uri2 == uri3); // prints true.
- *
- * Using this method can be seen as a shorthand for the `Uri` constructor
- * call above, but may also be slightly faster because the parts taken
- * from this `Uri` need not be checked for validity again.
- */
- Uri replace({String scheme,
- String userInfo,
- String host,
- int port,
- String path,
- Iterable<String> pathSegments,
- String query,
- Map<String, dynamic/*String|Iterable<String>*/> queryParameters,
- String fragment}) {
- // Set to true if the scheme has (potentially) changed.
- // In that case, the default port may also have changed and we need
- // to check even the existing port.
- bool schemeChanged = false;
- if (scheme != null) {
- scheme = _makeScheme(scheme, 0, scheme.length);
- schemeChanged = true;
- } else {
- scheme = this.scheme;
- }
- bool isFile = (scheme == "file");
- if (userInfo != null) {
- userInfo = _makeUserInfo(userInfo, 0, userInfo.length);
- } else {
- userInfo = this._userInfo;
- }
- if (port != null) {
- port = _makePort(port, scheme);
- } else {
- port = this._port;
- if (schemeChanged) {
- // The default port might have changed.
- port = _makePort(port, scheme);
- }
- }
- if (host != null) {
- host = _makeHost(host, 0, host.length, false);
- } else if (this.hasAuthority) {
- host = this._host;
- } else if (userInfo.isNotEmpty || port != null || isFile) {
- host = "";
- }
-
- bool hasAuthority = host != null;
- if (path != null || pathSegments != null) {
- path = _makePath(path, 0, _stringOrNullLength(path), pathSegments,
- scheme, hasAuthority);
- } else {
- path = this._path;
- if ((isFile || (hasAuthority && !path.isEmpty)) &&
- !path.startsWith('/')) {
- path = "/" + path;
- }
- }
-
- if (query != null || queryParameters != null) {
- query = _makeQuery(query, 0, _stringOrNullLength(query), queryParameters);
- } else {
- query = this._query;
- }
-
- if (fragment != null) {
- fragment = _makeFragment(fragment, 0, fragment.length);
- } else {
- fragment = this._fragment;
- }
-
- return new Uri._internal(
- scheme, userInfo, host, port, path, query, fragment);
- }
-
- /**
- * Returns a `Uri` that differs from this only in not having a fragment.
- *
- * If this `Uri` does not have a fragment, it is itself returned.
- */
- Uri removeFragment() {
- if (!this.hasFragment) return this;
- return new Uri._internal(scheme, _userInfo, _host, _port,
- _path, _query, null);
- }
-
- /**
- * Returns the URI path split into its segments. Each of the segments in the
- * returned list have been decoded. If the path is empty the empty list will
- * be returned. A leading slash `/` does not affect the segments returned.
- *
- * The returned list is unmodifiable and will throw [UnsupportedError] on any
- * calls that would mutate it.
- */
- List<String> get pathSegments {
- var result = _pathSegments;
- if (result != null) return result;
-
- var pathToSplit = path;
- if (pathToSplit.isNotEmpty && pathToSplit.codeUnitAt(0) == _SLASH) {
- pathToSplit = pathToSplit.substring(1);
- }
- result = (pathToSplit == "")
- ? const<String>[]
- : new List<String>.unmodifiable(
- pathToSplit.split("/").map(Uri.decodeComponent));
- _pathSegments = result;
- return result;
- }
-
- /**
- * Returns the URI query split into a map according to the rules
- * specified for FORM post in the [HTML 4.01 specification section
- * 17.13.4](http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.13.4 "HTML 4.01 section 17.13.4").
- * Each key and value in the returned map has been decoded.
- * If there is no query the empty map is returned.
- *
- * Keys in the query string that have no value are mapped to the
- * empty string.
- * If a key occurs more than once in the query string, it is mapped to
- * an arbitrary choice of possible value.
- * The [queryParametersAll] getter can provide a map
- * that maps keys to all of their values.
- *
- * The returned map is unmodifiable.
- */
- Map<String, String> get queryParameters {
- if (_queryParameters == null) {
- _queryParameters =
- new UnmodifiableMapView<String, String>(splitQueryString(query));
- }
- return _queryParameters;
- }
-
- /**
- * Returns the URI query split into a map according to the rules
- * specified for FORM post in the [HTML 4.01 specification section
- * 17.13.4](http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.13.4 "HTML 4.01 section 17.13.4").
- * Each key and value in the returned map has been decoded. If there is no
- * query the empty map is returned.
- *
- * Keys are mapped to lists of their values. If a key occurs only once,
- * its value is a singleton list. If a key occurs with no value, the
- * empty string is used as the value for that occurrence.
- *
- * The returned map and the lists it contains are unmodifiable.
- */
- Map<String, List<String>> get queryParametersAll {
- if (_queryParameterLists == null) {
- Map queryParameterLists = _splitQueryStringAll(query);
- for (var key in queryParameterLists.keys) {
- queryParameterLists[key] =
- new List<String>.unmodifiable(queryParameterLists[key]);
- }
- _queryParameterLists =
- new Map<String, List<String>>.unmodifiable(queryParameterLists);
- }
- return _queryParameterLists;
- }
-
- /**
- * Returns a URI where the path has been normalized.
- *
- * A normalized path does not contain `.` segments or non-leading `..`
- * segments.
- * Only a relative path with no scheme or authority may contain
- * leading `..` segments,
- * a path that starts with `/` will also drop any leading `..` segments.
- *
- * This uses the same normalization strategy as `new Uri().resolve(this)`.
- *
- * Does not change any part of the URI except the path.
- *
- * The default implementation of `Uri` always normalizes paths, so calling
- * this function has no effect.
- */
- Uri normalizePath() {
- String path = _normalizePath(_path, scheme, hasAuthority);
- if (identical(path, _path)) return this;
- return this.replace(path: path);
- }
-
- static int _makePort(int port, String scheme) {
- // Perform scheme specific normalization.
- if (port != null && port == _defaultPort(scheme)) return null;
- return port;
- }
-
- /**
- * Check and normalize a host name.
- *
- * If the host name starts and ends with '[' and ']', it is considered an
- * IPv6 address. If [strictIPv6] is false, the address is also considered
- * an IPv6 address if it contains any ':' character.
- *
- * If it is not an IPv6 address, it is case- and escape-normalized.
- * This escapes all characters not valid in a reg-name,
- * and converts all non-escape upper-case letters to lower-case.
- */
- static String _makeHost(String host, int start, int end, bool strictIPv6) {
- // TODO(lrn): Should we normalize IPv6 addresses according to RFC 5952?
- if (host == null) return null;
- if (start == end) return "";
- // Host is an IPv6 address if it starts with '[' or contains a colon.
- if (host.codeUnitAt(start) == _LEFT_BRACKET) {
- if (host.codeUnitAt(end - 1) != _RIGHT_BRACKET) {
- _fail(host, start, 'Missing end `]` to match `[` in host');
- }
- parseIPv6Address(host, start + 1, end - 1);
- // RFC 5952 requires hex digits to be lower case.
- return host.substring(start, end).toLowerCase();
- }
- if (!strictIPv6) {
- // TODO(lrn): skip if too short to be a valid IPv6 address?
- for (int i = start; i < end; i++) {
- if (host.codeUnitAt(i) == _COLON) {
- parseIPv6Address(host, start, end);
- return '[$host]';
- }
- }
- }
- return _normalizeRegName(host, start, end);
- }
-
- static bool _isRegNameChar(int char) {
- return char < 127 && (_regNameTable[char >> 4] & (1 << (char & 0xf))) != 0;
- }
-
- /**
- * Validates and does case- and percent-encoding normalization.
- *
- * The [host] must be an RFC3986 "reg-name". It is converted
- * to lower case, and percent escapes are converted to either
- * lower case unreserved characters or upper case escapes.
- */
- static String _normalizeRegName(String host, int start, int end) {
- StringBuffer buffer;
- int sectionStart = start;
- int index = start;
- // Whether all characters between sectionStart and index are normalized,
- bool isNormalized = true;
-
- while (index < end) {
- int char = host.codeUnitAt(index);
- if (char == _PERCENT) {
- // The _regNameTable contains "%", so we check that first.
- String replacement = _normalizeEscape(host, index, true);
- if (replacement == null && isNormalized) {
- index += 3;
- continue;
- }
- if (buffer == null) buffer = new StringBuffer();
- String slice = host.substring(sectionStart, index);
- if (!isNormalized) slice = slice.toLowerCase();
- buffer.write(slice);
- int sourceLength = 3;
- if (replacement == null) {
- replacement = host.substring(index, index + 3);
- } else if (replacement == "%") {
- replacement = "%25";
- sourceLength = 1;
- }
- buffer.write(replacement);
- index += sourceLength;
- sectionStart = index;
- isNormalized = true;
- } else if (_isRegNameChar(char)) {
- if (isNormalized && _UPPER_CASE_A <= char && _UPPER_CASE_Z >= char) {
- // Put initial slice in buffer and continue in non-normalized mode
- if (buffer == null) buffer = new StringBuffer();
- if (sectionStart < index) {
- buffer.write(host.substring(sectionStart, index));
- sectionStart = index;
- }
- isNormalized = false;
- }
- index++;
- } else if (_isGeneralDelimiter(char)) {
- _fail(host, index, "Invalid character");
- } else {
- int sourceLength = 1;
- if ((char & 0xFC00) == 0xD800 && (index + 1) < end) {
- int tail = host.codeUnitAt(index + 1);
- if ((tail & 0xFC00) == 0xDC00) {
- char = 0x10000 | ((char & 0x3ff) << 10) | (tail & 0x3ff);
- sourceLength = 2;
- }
- }
- if (buffer == null) buffer = new StringBuffer();
- String slice = host.substring(sectionStart, index);
- if (!isNormalized) slice = slice.toLowerCase();
- buffer.write(slice);
- buffer.write(_escapeChar(char));
- index += sourceLength;
- sectionStart = index;
- }
- }
- if (buffer == null) return host.substring(start, end);
- if (sectionStart < end) {
- String slice = host.substring(sectionStart, end);
- if (!isNormalized) slice = slice.toLowerCase();
- buffer.write(slice);
- }
- return buffer.toString();
- }
-
- /**
- * Validates scheme characters and does case-normalization.
- *
- * Schemes are converted to lower case. They cannot contain escapes.
- */
- static String _makeScheme(String scheme, int start, int end) {
- if (start == end) return "";
- final int firstCodeUnit = scheme.codeUnitAt(start);
- if (!_isAlphabeticCharacter(firstCodeUnit)) {
- _fail(scheme, start, "Scheme not starting with alphabetic character");
- }
- bool containsUpperCase = false;
- for (int i = start; i < end; i++) {
- final int codeUnit = scheme.codeUnitAt(i);
- if (!_isSchemeCharacter(codeUnit)) {
- _fail(scheme, i, "Illegal scheme character");
- }
- if (_UPPER_CASE_A <= codeUnit && codeUnit <= _UPPER_CASE_Z) {
- containsUpperCase = true;
- }
- }
- scheme = scheme.substring(start, end);
- if (containsUpperCase) scheme = scheme.toLowerCase();
- return scheme;
- }
-
- static String _makeUserInfo(String userInfo, int start, int end) {
- if (userInfo == null) return "";
- return _normalize(userInfo, start, end, _userinfoTable);
- }
-
- static String _makePath(String path, int start, int end,
- Iterable<String> pathSegments,
- String scheme,
- bool hasAuthority) {
- bool isFile = (scheme == "file");
- bool ensureLeadingSlash = isFile || hasAuthority;
- if (path == null && pathSegments == null) return isFile ? "/" : "";
- if (path != null && pathSegments != null) {
- throw new ArgumentError('Both path and pathSegments specified');
- }
- var result;
- if (path != null) {
- result = _normalize(path, start, end, _pathCharOrSlashTable);
- } else {
- result = pathSegments.map((s) =>
- _uriEncode(_pathCharTable, s, UTF8, false)).join("/");
- }
- if (result.isEmpty) {
- if (isFile) return "/";
- } else if (ensureLeadingSlash && !result.startsWith('/')) {
- result = "/" + result;
- }
- result = _normalizePath(result, scheme, hasAuthority);
- return result;
- }
-
- /// Performs path normalization (remove dot segments) on a path.
- ///
- /// If the URI has neither scheme nor authority, it's considered a
- /// "pure path" and normalization won't remove leading ".." segments.
- /// Otherwise it follows the RFC 3986 "remove dot segments" algorithm.
- static String _normalizePath(String path, String scheme, bool hasAuthority) {
- if (scheme.isEmpty && !hasAuthority && !path.startsWith('/')) {
- return _normalizeRelativePath(path);
- }
- return _removeDotSegments(path);
- }
-
- static String _makeQuery(
- String query, int start, int end,
- Map<String, dynamic/*String|Iterable<String>*/> queryParameters) {
- if (query == null && queryParameters == null) return null;
- if (query != null && queryParameters != null) {
- throw new ArgumentError('Both query and queryParameters specified');
- }
- if (query != null) return _normalize(query, start, end, _queryCharTable);
-
- var result = new StringBuffer();
- var separator = "";
-
- void writeParameter(String key, String value) {
- result.write(separator);
- separator = "&";
- result.write(Uri.encodeQueryComponent(key));
- if (value != null && value.isNotEmpty) {
- result.write("=");
- result.write(Uri.encodeQueryComponent(value));
- }
- }
-
- queryParameters.forEach((key, value) {
- if (value == null || value is String) {
- writeParameter(key, value);
- } else {
- Iterable values = value;
- for (String value in values) {
- writeParameter(key, value);
- }
- }
- });
- return result.toString();
- }
-
- static String _makeFragment(String fragment, int start, int end) {
- if (fragment == null) return null;
- return _normalize(fragment, start, end, _queryCharTable);
- }
-
- static int _stringOrNullLength(String s) => (s == null) ? 0 : s.length;
-
- /**
- * Performs RFC 3986 Percent-Encoding Normalization.
- *
- * Returns a replacement string that should be replace the original escape.
- * Returns null if no replacement is necessary because the escape is
- * not for an unreserved character and is already non-lower-case.
- *
- * Returns "%" if the escape is invalid (not two valid hex digits following
- * the percent sign). The calling code should replace the percent
- * sign with "%25", but leave the following two characters unmodified.
- *
- * If [lowerCase] is true, a single character returned is always lower case,
- */
- static String _normalizeEscape(String source, int index, bool lowerCase) {
- assert(source.codeUnitAt(index) == _PERCENT);
- if (index + 2 >= source.length) {
- return "%"; // Marks the escape as invalid.
- }
- int firstDigit = source.codeUnitAt(index + 1);
- int secondDigit = source.codeUnitAt(index + 2);
- int firstDigitValue = _parseHexDigit(firstDigit);
- int secondDigitValue = _parseHexDigit(secondDigit);
- if (firstDigitValue < 0 || secondDigitValue < 0) {
- return "%"; // Marks the escape as invalid.
- }
- int value = firstDigitValue * 16 + secondDigitValue;
- if (_isUnreservedChar(value)) {
- if (lowerCase && _UPPER_CASE_A <= value && _UPPER_CASE_Z >= value) {
- value |= 0x20;
- }
- return new String.fromCharCode(value);
- }
- if (firstDigit >= _LOWER_CASE_A || secondDigit >= _LOWER_CASE_A) {
- // Either digit is lower case.
- return source.substring(index, index + 3).toUpperCase();
- }
- // Escape is retained, and is already non-lower case, so return null to
- // represent "no replacement necessary".
- return null;
- }
-
- // Converts a UTF-16 code-unit to its value as a hex digit.
- // Returns -1 for non-hex digits.
- static int _parseHexDigit(int char) {
- int digit = char ^ Uri._ZERO;
- if (digit <= 9) return digit;
- int lowerCase = char | 0x20;
- if (Uri._LOWER_CASE_A <= lowerCase && lowerCase <= _LOWER_CASE_F) {
- return lowerCase - (_LOWER_CASE_A - 10);
- }
- return -1;
- }
-
- static String _escapeChar(int char) {
- assert(char <= 0x10ffff); // It's a valid unicode code point.
- List<int> codeUnits;
- if (char < 0x80) {
- // ASCII, a single percent encoded sequence.
- codeUnits = new List(3);
- codeUnits[0] = _PERCENT;
- codeUnits[1] = _hexDigits.codeUnitAt(char >> 4);
- codeUnits[2] = _hexDigits.codeUnitAt(char & 0xf);
- } else {
- // Do UTF-8 encoding of character, then percent encode bytes.
- int flag = 0xc0; // The high-bit markers on the first byte of UTF-8.
- int encodedBytes = 2;
- if (char > 0x7ff) {
- flag = 0xe0;
- encodedBytes = 3;
- if (char > 0xffff) {
- encodedBytes = 4;
- flag = 0xf0;
- }
- }
- codeUnits = new List(3 * encodedBytes);
- int index = 0;
- while (--encodedBytes >= 0) {
- int byte = ((char >> (6 * encodedBytes)) & 0x3f) | flag;
- codeUnits[index] = _PERCENT;
- codeUnits[index + 1] = _hexDigits.codeUnitAt(byte >> 4);
- codeUnits[index + 2] = _hexDigits.codeUnitAt(byte & 0xf);
- index += 3;
- flag = 0x80; // Following bytes have only high bit set.
- }
- }
- return new String.fromCharCodes(codeUnits);
- }
-
- /**
- * Runs through component checking that each character is valid and
- * normalize percent escapes.
- *
- * Uses [charTable] to check if a non-`%` character is allowed.
- * Each `%` character must be followed by two hex digits.
- * If the hex-digits are lower case letters, they are converted to
- * upper case.
- */
- static String _normalize(String component, int start, int end,
- List<int> charTable) {
- StringBuffer buffer;
- int sectionStart = start;
- int index = start;
- // Loop while characters are valid and escapes correct and upper-case.
- while (index < end) {
- int char = component.codeUnitAt(index);
- if (char < 127 && (charTable[char >> 4] & (1 << (char & 0x0f))) != 0) {
- index++;
- } else {
- String replacement;
- int sourceLength;
- if (char == _PERCENT) {
- replacement = _normalizeEscape(component, index, false);
- // Returns null if we should keep the existing escape.
- if (replacement == null) {
- index += 3;
- continue;
- }
- // Returns "%" if we should escape the existing percent.
- if ("%" == replacement) {
- replacement = "%25";
- sourceLength = 1;
- } else {
- sourceLength = 3;
- }
- } else if (_isGeneralDelimiter(char)) {
- _fail(component, index, "Invalid character");
- } else {
- sourceLength = 1;
- if ((char & 0xFC00) == 0xD800) {
- // Possible lead surrogate.
- if (index + 1 < end) {
- int tail = component.codeUnitAt(index + 1);
- if ((tail & 0xFC00) == 0xDC00) {
- // Tail surrogat.
- sourceLength = 2;
- char = 0x10000 | ((char & 0x3ff) << 10) | (tail & 0x3ff);
- }
- }
- }
- replacement = _escapeChar(char);
- }
- if (buffer == null) buffer = new StringBuffer();
- buffer.write(component.substring(sectionStart, index));
- buffer.write(replacement);
- index += sourceLength;
- sectionStart = index;
- }
- }
- if (buffer == null) {
- // Makes no copy if start == 0 and end == component.length.
- return component.substring(start, end);
- }
- if (sectionStart < end) {
- buffer.write(component.substring(sectionStart, end));
- }
- return buffer.toString();
- }
-
- static bool _isSchemeCharacter(int ch) {
- return ch < 128 && ((_schemeTable[ch >> 4] & (1 << (ch & 0x0f))) != 0);
- }
-
- static bool _isGeneralDelimiter(int ch) {
- return ch <= _RIGHT_BRACKET &&
- ((_genDelimitersTable[ch >> 4] & (1 << (ch & 0x0f))) != 0);
- }
-
- /**
- * Returns whether the URI is absolute.
- */
- bool get isAbsolute => scheme != "" && fragment == "";
-
- String _mergePaths(String base, String reference) {
- // Optimize for the case: absolute base, reference beginning with "../".
- int backCount = 0;
- int refStart = 0;
- // Count number of "../" at beginning of reference.
- while (reference.startsWith("../", refStart)) {
- refStart += 3;
- backCount++;
- }
-
- // Drop last segment - everything after last '/' of base.
- int baseEnd = base.lastIndexOf('/');
- // Drop extra segments for each leading "../" of reference.
- while (baseEnd > 0 && backCount > 0) {
- int newEnd = base.lastIndexOf('/', baseEnd - 1);
- if (newEnd < 0) {
- break;
- }
- int delta = baseEnd - newEnd;
- // If we see a "." or ".." segment in base, stop here and let
- // _removeDotSegments handle it.
- if ((delta == 2 || delta == 3) &&
- base.codeUnitAt(newEnd + 1) == _DOT &&
- (delta == 2 || base.codeUnitAt(newEnd + 2) == _DOT)) {
- break;
- }
- baseEnd = newEnd;
- backCount--;
- }
- return base.replaceRange(baseEnd + 1, null,
- reference.substring(refStart - 3 * backCount));
- }
-
- /// Make a guess at whether a path contains a `..` or `.` segment.
- ///
- /// This is a primitive test that can cause false positives.
- /// It's only used to avoid a more expensive operation in the case where
- /// it's not necessary.
- static bool _mayContainDotSegments(String path) {
- if (path.startsWith('.')) return true;
- int index = path.indexOf("/.");
- return index != -1;
- }
-
- /// Removes '.' and '..' segments from a path.
- ///
- /// Follows the RFC 2986 "remove dot segments" algorithm.
- /// This algorithm is only used on paths of URIs with a scheme,
- /// and it treats the path as if it is absolute (leading '..' are removed).
- static String _removeDotSegments(String path) {
- if (!_mayContainDotSegments(path)) return path;
- assert(path.isNotEmpty); // An empty path would not have dot segments.
- List<String> output = [];
- bool appendSlash = false;
- for (String segment in path.split("/")) {
- appendSlash = false;
- if (segment == "..") {
- if (output.isNotEmpty) {
- output.removeLast();
- if (output.isEmpty) {
- output.add("");
- }
- }
- appendSlash = true;
- } else if ("." == segment) {
- appendSlash = true;
- } else {
- output.add(segment);
- }
- }
- if (appendSlash) output.add("");
- return output.join("/");
- }
-
- /// Removes all `.` segments and any non-leading `..` segments.
- ///
- /// Removing the ".." from a "bar/foo/.." sequence results in "bar/"
- /// (trailing "/"). If the entire path is removed (because it contains as
- /// many ".." segments as real segments), the result is "./".
- /// This is different from an empty string, which represents "no path",
- /// when you resolve it against a base URI with a path with a non-empty
- /// final segment.
- static String _normalizeRelativePath(String path) {
- assert(!path.startsWith('/')); // Only get called for relative paths.
- if (!_mayContainDotSegments(path)) return path;
- assert(path.isNotEmpty); // An empty path would not have dot segments.
- List<String> output = [];
- bool appendSlash = false;
- for (String segment in path.split("/")) {
- appendSlash = false;
- if (".." == segment) {
- if (!output.isEmpty && output.last != "..") {
- output.removeLast();
- appendSlash = true;
- } else {
- output.add("..");
- }
- } else if ("." == segment) {
- appendSlash = true;
- } else {
- output.add(segment);
- }
- }
- if (output.isEmpty || (output.length == 1 && output[0].isEmpty)) {
- return "./";
- }
- if (appendSlash || output.last == '..') output.add("");
- return output.join("/");
- }
-
- /**
- * Resolve [reference] as an URI relative to `this`.
- *
- * First turn [reference] into a URI using [Uri.parse]. Then resolve the
- * resulting URI relative to `this`.
- *
- * Returns the resolved URI.
- *
- * See [resolveUri] for details.
- */
- Uri resolve(String reference) {
- return resolveUri(Uri.parse(reference));
- }
-
- /**
- * Resolve [reference] as an URI relative to `this`.
- *
- * Returns the resolved URI.
- *
- * The algorithm "Transform Reference" for resolving a reference is described
- * in [RFC-3986 Section 5](http://tools.ietf.org/html/rfc3986#section-5 "RFC-1123").
- *
- * Updated to handle the case where the base URI is just a relative path -
- * that is: when it has no scheme or authority and the path does not start
- * with a slash.
- * In that case, the paths are combined without removing leading "..", and
- * an empty path is not converted to "/".
- */
- Uri resolveUri(Uri reference) {
- // From RFC 3986.
- String targetScheme;
- String targetUserInfo = "";
- String targetHost;
- int targetPort;
- String targetPath;
- String targetQuery;
- if (reference.scheme.isNotEmpty) {
- targetScheme = reference.scheme;
- if (reference.hasAuthority) {
- targetUserInfo = reference.userInfo;
- targetHost = reference.host;
- targetPort = reference.hasPort ? reference.port : null;
- }
- targetPath = _removeDotSegments(reference.path);
- if (reference.hasQuery) {
- targetQuery = reference.query;
- }
- } else {
- targetScheme = this.scheme;
- if (reference.hasAuthority) {
- targetUserInfo = reference.userInfo;
- targetHost = reference.host;
- targetPort = _makePort(reference.hasPort ? reference.port : null,
- targetScheme);
- targetPath = _removeDotSegments(reference.path);
- if (reference.hasQuery) targetQuery = reference.query;
- } else {
- targetUserInfo = this._userInfo;
- targetHost = this._host;
- targetPort = this._port;
- if (reference.path == "") {
- targetPath = this._path;
- if (reference.hasQuery) {
- targetQuery = reference.query;
- } else {
- targetQuery = this._query;
- }
- } else {
- if (reference.hasAbsolutePath) {
- targetPath = _removeDotSegments(reference.path);
- } else {
- // This is the RFC 3986 behavior for merging.
- if (this.hasEmptyPath) {
- if (!this.hasScheme && !this.hasAuthority) {
- // Keep the path relative if no scheme or authority.
- targetPath = reference.path;
- } else {
- // Add path normalization on top of RFC algorithm.
- targetPath = _removeDotSegments("/" + reference.path);
- }
- } else {
- var mergedPath = _mergePaths(this._path, reference.path);
- if (this.hasScheme || this.hasAuthority || this.hasAbsolutePath) {
- targetPath = _removeDotSegments(mergedPath);
- } else {
- // Non-RFC 3986 beavior. If both base and reference are relative
- // path, allow the merged path to start with "..".
- // The RFC only specifies the case where the base has a scheme.
- targetPath = _normalizeRelativePath(mergedPath);
- }
- }
- }
- if (reference.hasQuery) targetQuery = reference.query;
- }
- }
- }
- String fragment = reference.hasFragment ? reference.fragment : null;
- return new Uri._internal(targetScheme,
- targetUserInfo,
- targetHost,
- targetPort,
- targetPath,
- targetQuery,
- fragment);
- }
-
- /**
- * Returns whether the URI has a [scheme] component.
- */
- bool get hasScheme => scheme.isNotEmpty;
-
- /**
- * Returns whether the URI has an [authority] component.
- */
- bool get hasAuthority => _host != null;
-
- /**
- * Returns whether the URI has an explicit port.
- *
- * If the port number is the default port number
- * (zero for unrecognized schemes, with http (80) and https (443) being
- * recognized),
- * then the port is made implicit and omitted from the URI.
- */
- bool get hasPort => _port != null;
-
- /**
- * Returns whether the URI has a query part.
- */
- bool get hasQuery => _query != null;
-
- /**
- * Returns whether the URI has a fragment part.
- */
- bool get hasFragment => _fragment != null;
-
- /**
- * Returns whether the URI has an empty path.
- */
- bool get hasEmptyPath => _path.isEmpty;
-
- /**
- * Returns whether the URI has an absolute path (starting with '/').
- */
- bool get hasAbsolutePath => _path.startsWith('/');
-
- /**
- * Returns the origin of the URI in the form scheme://host:port for the
- * schemes http and https.
- *
- * It is an error if the scheme is not "http" or "https".
- *
- * See: http://www.w3.org/TR/2011/WD-html5-20110405/origin-0.html#origin
- */
- String get origin {
- if (scheme == "" || _host == null || _host == "") {
- throw new StateError("Cannot use origin without a scheme: $this");
- }
- if (scheme != "http" && scheme != "https") {
- throw new StateError(
- "Origin is only applicable schemes http and https: $this");
- }
- if (_port == null) return "$scheme://$_host";
- return "$scheme://$_host:$_port";
- }
-
- /**
- * Returns the file path from a file URI.
- *
- * The returned path has either Windows or non-Windows
- * semantics.
- *
- * For non-Windows semantics the slash ("/") is used to separate
- * path segments.
- *
- * For Windows semantics the backslash ("\") separator is used to
- * separate path segments.
- *
- * If the URI is absolute the path starts with a path separator
- * unless Windows semantics is used and the first path segment is a
- * drive letter. When Windows semantics is used a host component in
- * the uri in interpreted as a file server and a UNC path is
- * returned.
- *
- * The default for whether to use Windows or non-Windows semantics
- * determined from the platform Dart is running on. When running in
- * the standalone VM this is detected by the VM based on the
- * operating system. When running in a browser non-Windows semantics
- * is always used.
- *
- * To override the automatic detection of which semantics to use pass
- * a value for [windows]. Passing `true` will use Windows
- * semantics and passing `false` will use non-Windows semantics.
- *
- * If the URI ends with a slash (i.e. the last path component is
- * empty) the returned file path will also end with a slash.
- *
- * With Windows semantics URIs starting with a drive letter cannot
- * be relative to the current drive on the designated drive. That is
- * for the URI `file:///c:abc` calling `toFilePath` will throw as a
- * path segment cannot contain colon on Windows.
- *
- * Examples using non-Windows semantics (resulting of calling
- * toFilePath in comment):
- *
- * Uri.parse("xxx/yyy"); // xxx/yyy
- * Uri.parse("xxx/yyy/"); // xxx/yyy/
- * Uri.parse("file:///xxx/yyy"); // /xxx/yyy
- * Uri.parse("file:///xxx/yyy/"); // /xxx/yyy/
- * Uri.parse("file:///C:"); // /C:
- * Uri.parse("file:///C:a"); // /C:a
- *
- * Examples using Windows semantics (resulting URI in comment):
- *
- * Uri.parse("xxx/yyy"); // xxx\yyy
- * Uri.parse("xxx/yyy/"); // xxx\yyy\
- * Uri.parse("file:///xxx/yyy"); // \xxx\yyy
- * Uri.parse("file:///xxx/yyy/"); // \xxx\yyy/
- * Uri.parse("file:///C:/xxx/yyy"); // C:\xxx\yyy
- * Uri.parse("file:C:xxx/yyy"); // Throws as a path segment
- * // cannot contain colon on Windows.
- * Uri.parse("file://server/share/file"); // \\server\share\file
- *
- * If the URI is not a file URI calling this throws
- * [UnsupportedError].
- *
- * If the URI cannot be converted to a file path calling this throws
- * [UnsupportedError].
- */
- String toFilePath({bool windows}) {
- if (scheme != "" && scheme != "file") {
- throw new UnsupportedError(
- "Cannot extract a file path from a $scheme URI");
- }
- if (query != "") {
- throw new UnsupportedError(
- "Cannot extract a file path from a URI with a query component");
- }
- if (fragment != "") {
- throw new UnsupportedError(
- "Cannot extract a file path from a URI with a fragment component");
- }
- if (windows == null) windows = _isWindows;
- return windows ? _toWindowsFilePath() : _toFilePath();
- }
-
- String _toFilePath() {
- if (host != "") {
- throw new UnsupportedError(
- "Cannot extract a non-Windows file path from a file URI "
- "with an authority");
- }
- _checkNonWindowsPathReservedCharacters(pathSegments, false);
- var result = new StringBuffer();
- if (_isPathAbsolute) result.write("/");
- result.writeAll(pathSegments, "/");
- return result.toString();
- }
-
- String _toWindowsFilePath() {
- bool hasDriveLetter = false;
- var segments = pathSegments;
- if (segments.length > 0 &&
- segments[0].length == 2 &&
- segments[0].codeUnitAt(1) == _COLON) {
- _checkWindowsDriveLetter(segments[0].codeUnitAt(0), false);
- _checkWindowsPathReservedCharacters(segments, false, 1);
- hasDriveLetter = true;
- } else {
- _checkWindowsPathReservedCharacters(segments, false);
- }
- var result = new StringBuffer();
- if (_isPathAbsolute && !hasDriveLetter) result.write("\\");
- if (host != "") {
- result.write("\\");
- result.write(host);
- result.write("\\");
- }
- result.writeAll(segments, "\\");
- if (hasDriveLetter && segments.length == 1) result.write("\\");
- return result.toString();
- }
-
- bool get _isPathAbsolute {
- if (path == null || path.isEmpty) return false;
- return path.startsWith('/');
- }
-
- void _writeAuthority(StringSink ss) {
- if (_userInfo.isNotEmpty) {
- ss.write(_userInfo);
- ss.write("@");
- }
- if (_host != null) ss.write(_host);
- if (_port != null) {
- ss.write(":");
- ss.write(_port);
- }
- }
-
- /**
- * Access the structure of a `data:` URI.
- *
- * Returns a [UriData] object for `data:` URIs and `null` for all other
- * URIs.
- * The [UriData] object can be used to access the media type and data
- * of a `data:` URI.
- */
- UriData get data => (scheme == "data") ? new UriData.fromUri(this) : null;
-
- String toString() {
- StringBuffer sb = new StringBuffer();
- _addIfNonEmpty(sb, scheme, scheme, ':');
- if (hasAuthority || path.startsWith("//") || (scheme == "file")) {
- // File URIS always have the authority, even if it is empty.
- // The empty URI means "localhost".
- sb.write("//");
- _writeAuthority(sb);
- }
- sb.write(path);
- if (_query != null) { sb..write("?")..write(_query); }
- if (_fragment != null) { sb..write("#")..write(_fragment); }
- return sb.toString();
- }
-
- bool operator==(other) {
- if (other is! Uri) return false;
- Uri uri = other;
- return scheme == uri.scheme &&
- hasAuthority == uri.hasAuthority &&
- userInfo == uri.userInfo &&
- host == uri.host &&
- port == uri.port &&
- path == uri.path &&
- hasQuery == uri.hasQuery &&
- query == uri.query &&
- hasFragment == uri.hasFragment &&
- fragment == uri.fragment;
- }
-
- int get hashCode {
- int combine(part, current) {
- // The sum is truncated to 30 bits to make sure it fits into a Smi.
- return (current * 31 + part.hashCode) & 0x3FFFFFFF;
- }
- return combine(scheme, combine(userInfo, combine(host, combine(port,
- combine(path, combine(query, combine(fragment, 1)))))));
- }
-
- static void _addIfNonEmpty(StringBuffer sb, String test,
- String first, String second) {
- if ("" != test) {
- sb.write(first);
- sb.write(second);
- }
- }
-
- /**
- * Encode the string [component] using percent-encoding to make it
- * safe for literal use as a URI component.
- *
- * All characters except uppercase and lowercase letters, digits and
- * the characters `-_.!~*'()` are percent-encoded. This is the
- * set of characters specified in RFC 2396 and the which is
- * specified for the encodeUriComponent in ECMA-262 version 5.1.
- *
- * When manually encoding path segments or query components remember
- * to encode each part separately before building the path or query
- * string.
- *
- * For encoding the query part consider using
- * [encodeQueryComponent].
- *
- * To avoid the need for explicitly encoding use the [pathSegments]
- * and [queryParameters] optional named arguments when constructing
- * a [Uri].
- */
- static String encodeComponent(String component) {
- return _uriEncode(_unreserved2396Table, component, UTF8, false);
- }
-
- /**
- * Encode the string [component] according to the HTML 4.01 rules
- * for encoding the posting of a HTML form as a query string
- * component.
- *
- * Encode the string [component] according to the HTML 4.01 rules
- * for encoding the posting of a HTML form as a query string
- * component.
-
- * The component is first encoded to bytes using [encoding].
- * The default is to use [UTF8] encoding, which preserves all
- * the characters that don't need encoding.
-
- * Then the resulting bytes are "percent-encoded". This transforms
- * spaces (U+0020) to a plus sign ('+') and all bytes that are not
- * the ASCII decimal digits, letters or one of '-._~' are written as
- * a percent sign '%' followed by the two-digit hexadecimal
- * representation of the byte.
-
- * Note that the set of characters which are percent-encoded is a
- * superset of what HTML 4.01 requires, since it refers to RFC 1738
- * for reserved characters.
- *
- * When manually encoding query components remember to encode each
- * part separately before building the query string.
- *
- * To avoid the need for explicitly encoding the query use the
- * [queryParameters] optional named arguments when constructing a
- * [Uri].
- *
- * See http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.2 for more
- * details.
- */
- static String encodeQueryComponent(String component,
- {Encoding encoding: UTF8}) {
- return _uriEncode(_unreservedTable, component, encoding, true);
- }
-
- /**
- * Decodes the percent-encoding in [encodedComponent].
- *
- * Note that decoding a URI component might change its meaning as
- * some of the decoded characters could be characters with are
- * delimiters for a given URI componene type. Always split a URI
- * component using the delimiters for the component before decoding
- * the individual parts.
- *
- * For handling the [path] and [query] components consider using
- * [pathSegments] and [queryParameters] to get the separated and
- * decoded component.
- */
- static String decodeComponent(String encodedComponent) {
- return _uriDecode(encodedComponent, 0, encodedComponent.length,
- UTF8, false);
- }
-
- /**
- * Decodes the percent-encoding in [encodedComponent], converting
- * pluses to spaces.
- *
- * It will create a byte-list of the decoded characters, and then use
- * [encoding] to decode the byte-list to a String. The default encoding is
- * UTF-8.
- */
- static String decodeQueryComponent(
- String encodedComponent,
- {Encoding encoding: UTF8}) {
- return _uriDecode(encodedComponent, 0, encodedComponent.length,
- encoding, true);
- }
-
- /**
- * Encode the string [uri] using percent-encoding to make it
- * safe for literal use as a full URI.
- *
- * All characters except uppercase and lowercase letters, digits and
- * the characters `!#$&'()*+,-./:;=?@_~` are percent-encoded. This
- * is the set of characters specified in in ECMA-262 version 5.1 for
- * the encodeURI function .
- */
- static String encodeFull(String uri) {
- return _uriEncode(_encodeFullTable, uri, UTF8, false);
- }
-
- /**
- * Decodes the percent-encoding in [uri].
- *
- * Note that decoding a full URI might change its meaning as some of
- * the decoded characters could be reserved characters. In most
- * cases an encoded URI should be parsed into components using
- * [Uri.parse] before decoding the separate components.
- */
- static String decodeFull(String uri) {
- return _uriDecode(uri, 0, uri.length, UTF8, false);
- }
-
- /**
- * Returns the [query] split into a map according to the rules
- * specified for FORM post in the [HTML 4.01 specification section
- * 17.13.4](http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.13.4 "HTML 4.01 section 17.13.4").
- * Each key and value in the returned map has been decoded. If the [query]
- * is the empty string an empty map is returned.
- *
- * Keys in the query string that have no value are mapped to the
- * empty string.
- *
- * Each query component will be decoded using [encoding]. The default encoding
- * is UTF-8.
- */
- static Map<String, String> splitQueryString(String query,
- {Encoding encoding: UTF8}) {
- return query.split("&").fold({}, (map, element) {
- int index = element.indexOf("=");
- if (index == -1) {
- if (element != "") {
- map[decodeQueryComponent(element, encoding: encoding)] = "";
- }
- } else if (index != 0) {
- var key = element.substring(0, index);
- var value = element.substring(index + 1);
- map[Uri.decodeQueryComponent(key, encoding: encoding)] =
- decodeQueryComponent(value, encoding: encoding);
- }
- return map;
- });
- }
-
- static List _createList() => [];
-
- static Map _splitQueryStringAll(
- String query, {Encoding encoding: UTF8}) {
- Map result = {};
- int i = 0;
- int start = 0;
- int equalsIndex = -1;
-
- void parsePair(int start, int equalsIndex, int end) {
- String key;
- String value;
- if (start == end) return;
- if (equalsIndex < 0) {
- key = _uriDecode(query, start, end, encoding, true);
- value = "";
- } else {
- key = _uriDecode(query, start, equalsIndex, encoding, true);
- value = _uriDecode(query, equalsIndex + 1, end, encoding, true);
- }
- result.putIfAbsent(key, _createList).add(value);
- }
-
- const int _equals = 0x3d;
- const int _ampersand = 0x26;
- while (i < query.length) {
- int char = query.codeUnitAt(i);
- if (char == _equals) {
- if (equalsIndex < 0) equalsIndex = i;
- } else if (char == _ampersand) {
- parsePair(start, equalsIndex, i);
- start = i + 1;
- equalsIndex = -1;
- }
- i++;
- }
- parsePair(start, equalsIndex, i);
- return result;
- }
-
- /**
- * Parse the [host] as an IP version 4 (IPv4) address, returning the address
- * as a list of 4 bytes in network byte order (big endian).
- *
- * Throws a [FormatException] if [host] is not a valid IPv4 address
- * representation.
- */
- static List<int> parseIPv4Address(String host) {
- void error(String msg) {
- throw new FormatException('Illegal IPv4 address, $msg');
- }
- var bytes = host.split('.');
- if (bytes.length != 4) {
- error('IPv4 address should contain exactly 4 parts');
- }
- // TODO(ajohnsen): Consider using Uint8List.
- return bytes
- .map((byteString) {
- int byte = int.parse(byteString);
- if (byte < 0 || byte > 255) {
- error('each part must be in the range of `0..255`');
- }
- return byte;
- })
- .toList();
- }
-
- /**
- * Parse the [host] as an IP version 6 (IPv6) address, returning the address
- * as a list of 16 bytes in network byte order (big endian).
- *
- * Throws a [FormatException] if [host] is not a valid IPv6 address
- * representation.
- *
- * Acts on the substring from [start] to [end]. If [end] is omitted, it
- * defaults ot the end of the string.
- *
- * Some examples of IPv6 addresses:
- * * ::1
- * * FEDC:BA98:7654:3210:FEDC:BA98:7654:3210
- * * 3ffe:2a00:100:7031::1
- * * ::FFFF:129.144.52.38
- * * 2010:836B:4179::836B:4179
- */
- static List<int> parseIPv6Address(String host, [int start = 0, int end]) {
- if (end == null) end = host.length;
- // An IPv6 address consists of exactly 8 parts of 1-4 hex digits, seperated
- // by `:`'s, with the following exceptions:
- //
- // - One (and only one) wildcard (`::`) may be present, representing a fill
- // of 0's. The IPv6 `::` is thus 16 bytes of `0`.
- // - The last two parts may be replaced by an IPv4 address.
- void error(String msg, [position]) {
- throw new FormatException('Illegal IPv6 address, $msg', host, position);
- }
- int parseHex(int start, int end) {
- if (end - start > 4) {
- error('an IPv6 part can only contain a maximum of 4 hex digits', start);
- }
- int value = int.parse(host.substring(start, end), radix: 16);
- if (value < 0 || value > (1 << 16) - 1) {
- error('each part must be in the range of `0x0..0xFFFF`', start);
- }
- return value;
- }
- if (host.length < 2) error('address is too short');
- List<int> parts = [];
- bool wildcardSeen = false;
- int partStart = start;
- // Parse all parts, except a potential last one.
- for (int i = start; i < end; i++) {
- if (host.codeUnitAt(i) == _COLON) {
- if (i == start) {
- // If we see a `:` in the beginning, expect wildcard.
- i++;
- if (host.codeUnitAt(i) != _COLON) {
- error('invalid start colon.', i);
- }
- partStart = i;
- }
- if (i == partStart) {
- // Wildcard. We only allow one.
- if (wildcardSeen) {
- error('only one wildcard `::` is allowed', i);
- }
- wildcardSeen = true;
- parts.add(-1);
- } else {
- // Found a single colon. Parse [partStart..i] as a hex entry.
- parts.add(parseHex(partStart, i));
- }
- partStart = i + 1;
- }
- }
- if (parts.length == 0) error('too few parts');
- bool atEnd = (partStart == end);
- bool isLastWildcard = (parts.last == -1);
- if (atEnd && !isLastWildcard) {
- error('expected a part after last `:`', end);
- }
- if (!atEnd) {
- try {
- parts.add(parseHex(partStart, end));
- } catch (e) {
- // Failed to parse the last chunk as hex. Try IPv4.
- try {
- List<int> last = parseIPv4Address(host.substring(partStart, end));
- parts.add(last[0] << 8 | last[1]);
- parts.add(last[2] << 8 | last[3]);
- } catch (e) {
- error('invalid end of IPv6 address.', partStart);
- }
- }
- }
- if (wildcardSeen) {
- if (parts.length > 7) {
- error('an address with a wildcard must have less than 7 parts');
- }
- } else if (parts.length != 8) {
- error('an address without a wildcard must contain exactly 8 parts');
- }
- List<int> bytes = new Uint8List(16);
- for (int i = 0, index = 0; i < parts.length; i++) {
- int value = parts[i];
- if (value == -1) {
- int wildCardLength = 9 - parts.length;
- for (int j = 0; j < wildCardLength; j++) {
- bytes[index] = 0;
- bytes[index + 1] = 0;
- index += 2;
- }
- } else {
- bytes[index] = value >> 8;
- bytes[index + 1] = value & 0xff;
- index += 2;
- }
- }
- return bytes;
- }
-
- // Frequently used character codes.
- static const int _SPACE = 0x20;
- static const int _DOUBLE_QUOTE = 0x22;
- static const int _NUMBER_SIGN = 0x23;
- static const int _PERCENT = 0x25;
- static const int _ASTERISK = 0x2A;
- static const int _PLUS = 0x2B;
- static const int _DOT = 0x2E;
- static const int _SLASH = 0x2F;
- static const int _ZERO = 0x30;
- static const int _NINE = 0x39;
- static const int _COLON = 0x3A;
- static const int _LESS = 0x3C;
- static const int _GREATER = 0x3E;
- static const int _QUESTION = 0x3F;
- static const int _AT_SIGN = 0x40;
- static const int _UPPER_CASE_A = 0x41;
- static const int _UPPER_CASE_F = 0x46;
- static const int _UPPER_CASE_Z = 0x5A;
- static const int _LEFT_BRACKET = 0x5B;
- static const int _BACKSLASH = 0x5C;
- static const int _RIGHT_BRACKET = 0x5D;
- static const int _LOWER_CASE_A = 0x61;
- static const int _LOWER_CASE_F = 0x66;
- static const int _LOWER_CASE_Z = 0x7A;
- static const int _BAR = 0x7C;
-
- static const String _hexDigits = "0123456789ABCDEF";
-
- external static String _uriEncode(List<int> canonicalTable,
- String text,
- Encoding encoding,
- bool spaceToPlus);
-
- /**
- * Convert a byte (2 character hex sequence) in string [s] starting
- * at position [pos] to its ordinal value
- */
- static int _hexCharPairToByte(String s, int pos) {
- int byte = 0;
- for (int i = 0; i < 2; i++) {
- var charCode = s.codeUnitAt(pos + i);
- if (0x30 <= charCode && charCode <= 0x39) {
- byte = byte * 16 + charCode - 0x30;
- } else {
- // Check ranges A-F (0x41-0x46) and a-f (0x61-0x66).
- charCode |= 0x20;
- if (0x61 <= charCode && charCode <= 0x66) {
- byte = byte * 16 + charCode - 0x57;
- } else {
- throw new ArgumentError("Invalid URL encoding");
- }
- }
- }
- return byte;
- }
-
- /**
- * Uri-decode a percent-encoded string.
- *
- * It unescapes the string [text] and returns the unescaped string.
- *
- * This function is similar to the JavaScript-function `decodeURI`.
- *
- * If [plusToSpace] is `true`, plus characters will be converted to spaces.
- *
- * The decoder will create a byte-list of the percent-encoded parts, and then
- * decode the byte-list using [encoding]. The default encodingis UTF-8.
- */
- static String _uriDecode(String text,
- int start,
- int end,
- Encoding encoding,
- bool plusToSpace) {
- assert(0 <= start);
- assert(start <= end);
- assert(end <= text.length);
- assert(encoding != null);
- // First check whether there is any characters which need special handling.
- bool simple = true;
- for (int i = start; i < end; i++) {
- var codeUnit = text.codeUnitAt(i);
- if (codeUnit > 127 ||
- codeUnit == _PERCENT ||
- (plusToSpace && codeUnit == _PLUS)) {
- simple = false;
- break;
- }
- }
- List<int> bytes;
- if (simple) {
- if (UTF8 == encoding || LATIN1 == encoding || ASCII == encoding) {
- return text.substring(start, end);
- } else {
- bytes = text.substring(start, end).codeUnits;
- }
- } else {
- bytes = new List();
- for (int i = start; i < end; i++) {
- var codeUnit = text.codeUnitAt(i);
- if (codeUnit > 127) {
- throw new ArgumentError("Illegal percent encoding in URI");
- }
- if (codeUnit == _PERCENT) {
- if (i + 3 > text.length) {
- throw new ArgumentError('Truncated URI');
- }
- bytes.add(_hexCharPairToByte(text, i + 1));
- i += 2;
- } else if (plusToSpace && codeUnit == _PLUS) {
- bytes.add(_SPACE);
- } else {
- bytes.add(codeUnit);
- }
- }
- }
- return encoding.decode(bytes);
- }
-
- static bool _isAlphabeticCharacter(int codeUnit) {
- var lowerCase = codeUnit | 0x20;
- return (_LOWER_CASE_A <= lowerCase && lowerCase <= _LOWER_CASE_Z);
- }
-
- static bool _isUnreservedChar(int char) {
- return char < 127 &&
- ((_unreservedTable[char >> 4] & (1 << (char & 0x0f))) != 0);
- }
-
- // Tables of char-codes organized as a bit vector of 128 bits where
- // each bit indicate whether a character code on the 0-127 needs to
- // be escaped or not.
-
- // The unreserved characters of RFC 3986.
- static const _unreservedTable = const [
- // LSB MSB
- // | |
- 0x0000, // 0x00 - 0x0f 0000000000000000
- 0x0000, // 0x10 - 0x1f 0000000000000000
- // -.
- 0x6000, // 0x20 - 0x2f 0000000000000110
- // 0123456789
- 0x03ff, // 0x30 - 0x3f 1111111111000000
- // ABCDEFGHIJKLMNO
- 0xfffe, // 0x40 - 0x4f 0111111111111111
- // PQRSTUVWXYZ _
- 0x87ff, // 0x50 - 0x5f 1111111111100001
- // abcdefghijklmno
- 0xfffe, // 0x60 - 0x6f 0111111111111111
- // pqrstuvwxyz ~
- 0x47ff]; // 0x70 - 0x7f 1111111111100010
-
- // The unreserved characters of RFC 2396.
- static const _unreserved2396Table = const [
- // LSB MSB
- // | |
- 0x0000, // 0x00 - 0x0f 0000000000000000
- 0x0000, // 0x10 - 0x1f 0000000000000000
- // ! '()* -.
- 0x6782, // 0x20 - 0x2f 0100000111100110
- // 0123456789
- 0x03ff, // 0x30 - 0x3f 1111111111000000
- // ABCDEFGHIJKLMNO
- 0xfffe, // 0x40 - 0x4f 0111111111111111
- // PQRSTUVWXYZ _
- 0x87ff, // 0x50 - 0x5f 1111111111100001
- // abcdefghijklmno
- 0xfffe, // 0x60 - 0x6f 0111111111111111
- // pqrstuvwxyz ~
- 0x47ff]; // 0x70 - 0x7f 1111111111100010
-
- // Table of reserved characters specified by ECMAScript 5.
- static const _encodeFullTable = const [
- // LSB MSB
- // | |
- 0x0000, // 0x00 - 0x0f 0000000000000000
- 0x0000, // 0x10 - 0x1f 0000000000000000
- // ! #$ &'()*+,-./
- 0xffda, // 0x20 - 0x2f 0101101111111111
- // 0123456789:; = ?
- 0xafff, // 0x30 - 0x3f 1111111111110101
- // @ABCDEFGHIJKLMNO
- 0xffff, // 0x40 - 0x4f 1111111111111111
- // PQRSTUVWXYZ _
- 0x87ff, // 0x50 - 0x5f 1111111111100001
- // abcdefghijklmno
- 0xfffe, // 0x60 - 0x6f 0111111111111111
- // pqrstuvwxyz ~
- 0x47ff]; // 0x70 - 0x7f 1111111111100010
-
- // Characters allowed in the scheme.
- static const _schemeTable = const [
- // LSB MSB
- // | |
- 0x0000, // 0x00 - 0x0f 0000000000000000
- 0x0000, // 0x10 - 0x1f 0000000000000000
- // + -.
- 0x6800, // 0x20 - 0x2f 0000000000010110
- // 0123456789
- 0x03ff, // 0x30 - 0x3f 1111111111000000
- // ABCDEFGHIJKLMNO
- 0xfffe, // 0x40 - 0x4f 0111111111111111
- // PQRSTUVWXYZ
- 0x07ff, // 0x50 - 0x5f 1111111111100001
- // abcdefghijklmno
- 0xfffe, // 0x60 - 0x6f 0111111111111111
- // pqrstuvwxyz
- 0x07ff]; // 0x70 - 0x7f 1111111111100010
-
- // Characters allowed in scheme except for upper case letters.
- static const _schemeLowerTable = const [
- // LSB MSB
- // | |
- 0x0000, // 0x00 - 0x0f 0000000000000000
- 0x0000, // 0x10 - 0x1f 0000000000000000
- // + -.
- 0x6800, // 0x20 - 0x2f 0000000000010110
- // 0123456789
- 0x03ff, // 0x30 - 0x3f 1111111111000000
- //
- 0x0000, // 0x40 - 0x4f 0111111111111111
- //
- 0x0000, // 0x50 - 0x5f 1111111111100001
- // abcdefghijklmno
- 0xfffe, // 0x60 - 0x6f 0111111111111111
- // pqrstuvwxyz
- 0x07ff]; // 0x70 - 0x7f 1111111111100010
-
- // Sub delimiter characters combined with unreserved as of 3986.
- // sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
- // / "*" / "+" / "," / ";" / "="
- // RFC 3986 section 2.3.
- // unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
- static const _subDelimitersTable = const [
- // LSB MSB
- // | |
- 0x0000, // 0x00 - 0x0f 0000000000000000
- 0x0000, // 0x10 - 0x1f 0000000000000000
- // ! $ &'()*+,-.
- 0x7fd2, // 0x20 - 0x2f 0100101111111110
- // 0123456789 ; =
- 0x2bff, // 0x30 - 0x3f 1111111111010100
- // ABCDEFGHIJKLMNO
- 0xfffe, // 0x40 - 0x4f 0111111111111111
- // PQRSTUVWXYZ _
- 0x87ff, // 0x50 - 0x5f 1111111111100001
- // abcdefghijklmno
- 0xfffe, // 0x60 - 0x6f 0111111111111111
- // pqrstuvwxyz ~
- 0x47ff]; // 0x70 - 0x7f 1111111111100010
-
- // General delimiter characters, RFC 3986 section 2.2.
- // gen-delims = ":" / "/" / "?" / "#" / "[" / "]" / "@"
- //
- static const _genDelimitersTable = const [
- // LSB MSB
- // | |
- 0x0000, // 0x00 - 0x0f 0000000000000000
- 0x0000, // 0x10 - 0x1f 0000000000000000
- // # /
- 0x8008, // 0x20 - 0x2f 0001000000000001
- // : ?
- 0x8400, // 0x30 - 0x3f 0000000000100001
- // @
- 0x0001, // 0x40 - 0x4f 1000000000000000
- // [ ]
- 0x2800, // 0x50 - 0x5f 0000000000010100
- //
- 0x0000, // 0x60 - 0x6f 0000000000000000
- //
- 0x0000]; // 0x70 - 0x7f 0000000000000000
-
- // Characters allowed in the userinfo as of RFC 3986.
- // RFC 3986 Apendix A
- // userinfo = *( unreserved / pct-encoded / sub-delims / ':')
- static const _userinfoTable = const [
- // LSB MSB
- // | |
- 0x0000, // 0x00 - 0x0f 0000000000000000
- 0x0000, // 0x10 - 0x1f 0000000000000000
- // ! $ &'()*+,-.
- 0x7fd2, // 0x20 - 0x2f 0100101111111110
- // 0123456789:; =
- 0x2fff, // 0x30 - 0x3f 1111111111110100
- // ABCDEFGHIJKLMNO
- 0xfffe, // 0x40 - 0x4f 0111111111111111
- // PQRSTUVWXYZ _
- 0x87ff, // 0x50 - 0x5f 1111111111100001
- // abcdefghijklmno
- 0xfffe, // 0x60 - 0x6f 0111111111111111
- // pqrstuvwxyz ~
- 0x47ff]; // 0x70 - 0x7f 1111111111100010
-
- // Characters allowed in the reg-name as of RFC 3986.
- // RFC 3986 Apendix A
- // reg-name = *( unreserved / pct-encoded / sub-delims )
- static const _regNameTable = const [
- // LSB MSB
- // | |
- 0x0000, // 0x00 - 0x0f 0000000000000000
- 0x0000, // 0x10 - 0x1f 0000000000000000
- // ! $%&'()*+,-.
- 0x7ff2, // 0x20 - 0x2f 0100111111111110
- // 0123456789 ; =
- 0x2bff, // 0x30 - 0x3f 1111111111010100
- // ABCDEFGHIJKLMNO
- 0xfffe, // 0x40 - 0x4f 0111111111111111
- // PQRSTUVWXYZ _
- 0x87ff, // 0x50 - 0x5f 1111111111100001
- // abcdefghijklmno
- 0xfffe, // 0x60 - 0x6f 0111111111111111
- // pqrstuvwxyz ~
- 0x47ff]; // 0x70 - 0x7f 1111111111100010
-
- // Characters allowed in the path as of RFC 3986.
- // RFC 3986 section 3.3.
- // pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
- static const _pathCharTable = const [
- // LSB MSB
- // | |
- 0x0000, // 0x00 - 0x0f 0000000000000000
- 0x0000, // 0x10 - 0x1f 0000000000000000
- // ! $ &'()*+,-.
- 0x7fd2, // 0x20 - 0x2f 0100101111111110
- // 0123456789:; =
- 0x2fff, // 0x30 - 0x3f 1111111111110100
- // @ABCDEFGHIJKLMNO
- 0xffff, // 0x40 - 0x4f 1111111111111111
- // PQRSTUVWXYZ _
- 0x87ff, // 0x50 - 0x5f 1111111111100001
- // abcdefghijklmno
- 0xfffe, // 0x60 - 0x6f 0111111111111111
- // pqrstuvwxyz ~
- 0x47ff]; // 0x70 - 0x7f 1111111111100010
-
- // Characters allowed in the path as of RFC 3986.
- // RFC 3986 section 3.3 *and* slash.
- static const _pathCharOrSlashTable = const [
- // LSB MSB
- // | |
- 0x0000, // 0x00 - 0x0f 0000000000000000
- 0x0000, // 0x10 - 0x1f 0000000000000000
- // ! $ &'()*+,-./
- 0xffd2, // 0x20 - 0x2f 0100101111111111
- // 0123456789:; =
- 0x2fff, // 0x30 - 0x3f 1111111111110100
- // @ABCDEFGHIJKLMNO
- 0xffff, // 0x40 - 0x4f 1111111111111111
-
- // PQRSTUVWXYZ _
- 0x87ff, // 0x50 - 0x5f 1111111111100001
- // abcdefghijklmno
- 0xfffe, // 0x60 - 0x6f 0111111111111111
- // pqrstuvwxyz ~
- 0x47ff]; // 0x70 - 0x7f 1111111111100010
-
- // Characters allowed in the query as of RFC 3986.
- // RFC 3986 section 3.4.
- // query = *( pchar / "/" / "?" )
- static const _queryCharTable = const [
- // LSB MSB
- // | |
- 0x0000, // 0x00 - 0x0f 0000000000000000
- 0x0000, // 0x10 - 0x1f 0000000000000000
- // ! $ &'()*+,-./
- 0xffd2, // 0x20 - 0x2f 0100101111111111
- // 0123456789:; = ?
- 0xafff, // 0x30 - 0x3f 1111111111110101
- // @ABCDEFGHIJKLMNO
- 0xffff, // 0x40 - 0x4f 1111111111111111
- // PQRSTUVWXYZ _
- 0x87ff, // 0x50 - 0x5f 1111111111100001
- // abcdefghijklmno
- 0xfffe, // 0x60 - 0x6f 0111111111111111
- // pqrstuvwxyz ~
- 0x47ff]; // 0x70 - 0x7f 1111111111100010
-
-}
-
-// --------------------------------------------------------------------
-// Data URI
-// --------------------------------------------------------------------
-
-/**
- * A way to access the structure of a `data:` URI.
- *
- * Data URIs are non-hierarchical URIs that can contain any binary data.
- * They are defined by [RFC 2397](https://tools.ietf.org/html/rfc2397).
- *
- * This class allows parsing the URI text and extracting individual parts of the
- * URI, as well as building the URI text from structured parts.
- */
-class UriData {
- static const int _noScheme = -1;
- /**
- * Contains the text content of a `data:` URI, with or without a
- * leading `data:`.
- *
- * If [_separatorIndices] starts with `4` (the index of the `:`), then
- * there is a leading `data:`, otherwise [_separatorIndices] starts with
- * `-1`.
- */
- final String _text;
-
- /**
- * List of the separators (';', '=' and ',') in the text.
- *
- * Starts with the index of the `:` in `data:` of the mimeType.
- * That is always either -1 or 4, depending on whether `_text` includes the
- * `data:` scheme or not.
- *
- * The first speparator ends the mime type. We don't bother with finding
- * the '/' inside the mime type.
- *
- * Each two separators after that marks a parameter key and value.
- *
- * If there is a single separator left, it ends the "base64" marker.
- *
- * So the following separators are found for a text:
- *
- * data:text/plain;foo=bar;base64,ARGLEBARGLE=
- * ^ ^ ^ ^ ^
- *
- */
- final List<int> _separatorIndices;
-
- /**
- * Cache of the result returned by [uri].
- */
- Uri _uriCache;
-
- UriData._(this._text, this._separatorIndices, this._uriCache);
-
- /**
- * Creates a `data:` URI containing the [content] string.
- *
- * Equivalent to `new Uri.dataFromString(...).data`, but may
- * be more efficient if the [uri] itself isn't used.
- */
- factory UriData.fromString(String content,
- {String mimeType,
- Encoding encoding,
- Map<String, String> parameters,
- bool base64: false}) {
- StringBuffer buffer = new StringBuffer();
- List<int> indices = [_noScheme];
- String charsetName;
- String encodingName;
- if (parameters != null) charsetName = parameters["charset"];
- if (encoding == null) {
- if (charsetName != null) {
- encoding = Encoding.getByName(charsetName);
- }
- } else if (charsetName == null) {
- // Non-null only if parameters does not contain "charset".
- encodingName = encoding.name;
- }
- encoding ??= ASCII;
- _writeUri(mimeType, encodingName, parameters, buffer, indices);
- indices.add(buffer.length);
- if (base64) {
- buffer.write(';base64,');
- indices.add(buffer.length - 1);
- buffer.write(encoding.fuse(BASE64).encode(content));
- } else {
- buffer.write(',');
- _uriEncodeBytes(_uricTable, encoding.encode(content), buffer);
- }
- return new UriData._(buffer.toString(), indices, null);
- }
-
- /**
- * Creates a `data:` URI containing an encoding of [bytes].
- *
- * Equivalent to `new Uri.dataFromBytes(...).data`, but may
- * be more efficient if the [uri] itself isn't used.
- */
- factory UriData.fromBytes(List<int> bytes,
- {mimeType: "application/octet-stream",
- Map<String, String> parameters,
- percentEncoded: false}) {
- StringBuffer buffer = new StringBuffer();
- List<int> indices = [_noScheme];
- _writeUri(mimeType, null, parameters, buffer, indices);
- indices.add(buffer.length);
- if (percentEncoded) {
- buffer.write(',');
- _uriEncodeBytes(_uricTable, bytes, buffer);
- } else {
- buffer.write(';base64,');
- indices.add(buffer.length - 1);
- BASE64.encoder
- .startChunkedConversion(
- new StringConversionSink.fromStringSink(buffer))
- .addSlice(bytes, 0, bytes.length, true);
- }
-
- return new UriData._(buffer.toString(), indices, null);
- }
-
- /**
- * Creates a `DataUri` from a [Uri] which must have `data` as [Uri.scheme].
- *
- * The [uri] must have scheme `data` and no authority or fragment,
- * and the path (concatenated with the query, if there is one) must be valid
- * as data URI content with the same rules as [parse].
- */
- factory UriData.fromUri(Uri uri) {
- if (uri.scheme != "data") {
- throw new ArgumentError.value(uri, "uri",
- "Scheme must be 'data'");
- }
- if (uri.hasAuthority) {
- throw new ArgumentError.value(uri, "uri",
- "Data uri must not have authority");
- }
- if (uri.hasFragment) {
- throw new ArgumentError.value(uri, "uri",
- "Data uri must not have a fragment part");
- }
- if (!uri.hasQuery) {
- return _parse(uri.path, 0, uri);
- }
- // Includes path and query (and leading "data:").
- return _parse("$uri", 5, uri);
- }
-
- /**
- * Writes the initial part of a `data:` uri, from after the "data:"
- * until just before the ',' before the data, or before a `;base64,`
- * marker.
- *
- * Of an [indices] list is passed, separator indices are stored in that
- * list.
- */
- static void _writeUri(String mimeType,
- String charsetName,
- Map<String, String> parameters,
- StringBuffer buffer, List indices) {
- if (mimeType == null || mimeType == "text/plain") {
- mimeType = "";
- }
- if (mimeType.isEmpty || identical(mimeType, "application/octet-stream")) {
- buffer.write(mimeType); // Common cases need no escaping.
- } else {
- int slashIndex = _validateMimeType(mimeType);
- if (slashIndex < 0) {
- throw new ArgumentError.value(mimeType, "mimeType",
- "Invalid MIME type");
- }
- buffer.write(Uri._uriEncode(_tokenCharTable,
- mimeType.substring(0, slashIndex),
- UTF8, false));
- buffer.write("/");
- buffer.write(Uri._uriEncode(_tokenCharTable,
- mimeType.substring(slashIndex + 1),
- UTF8, false));
- }
- if (charsetName != null) {
- if (indices != null) {
- indices..add(buffer.length)
- ..add(buffer.length + 8);
- }
- buffer.write(";charset=");
- buffer.write(Uri._uriEncode(_tokenCharTable, charsetName, UTF8, false));
- }
- parameters?.forEach((var key, var value) {
- if (key.isEmpty) {
- throw new ArgumentError.value("", "Parameter names must not be empty");
- }
- if (value.isEmpty) {
- throw new ArgumentError.value("", "Parameter values must not be empty",
- 'parameters["$key"]');
- }
- if (indices != null) indices.add(buffer.length);
- buffer.write(';');
- // Encode any non-RFC2045-token character and both '%' and '#'.
- buffer.write(Uri._uriEncode(_tokenCharTable, key, UTF8, false));
- if (indices != null) indices.add(buffer.length);
- buffer.write('=');
- buffer.write(Uri._uriEncode(_tokenCharTable, value, UTF8, false));
- });
- }
-
- /**
- * Checks mimeType is valid-ish (`token '/' token`).
- *
- * Returns the index of the slash, or -1 if the mime type is not
- * considered valid.
- *
- * Currently only looks for slashes, all other characters will be
- * percent-encoded as UTF-8 if necessary.
- */
- static int _validateMimeType(String mimeType) {
- int slashIndex = -1;
- for (int i = 0; i < mimeType.length; i++) {
- var char = mimeType.codeUnitAt(i);
- if (char != Uri._SLASH) continue;
- if (slashIndex < 0) {
- slashIndex = i;
- continue;
- }
- return -1;
- }
- return slashIndex;
- }
-
- /**
- * Parses a string as a `data` URI.
- *
- * The string must have the format:
- *
- * ```
- * 'data:' (type '/' subtype)? (';' attribute '=' value)* (';base64')? ',' data
- * ````
- *
- * where `type`, `subtype`, `attribute` and `value` are specified in RFC-2045,
- * and `data` is a sequnce of URI-characters (RFC-2396 `uric`).
- *
- * This means that all the characters must be ASCII, but the URI may contain
- * percent-escapes for non-ASCII byte values that need an interpretation
- * to be converted to the corresponding string.
- *
- * Parsing doesn't check the validity of any part, it just checks that the
- * input has the correct structure with the correct sequence of `/`, `;`, `=`
- * and `,` delimiters.
- *
- * Accessing the individual parts may fail later if they turn out to have
- * content that can't be decoded sucessfully as a string.
- */
- static UriData parse(String uri) {
- if (!uri.startsWith("data:")) {
- throw new FormatException("Does not start with 'data:'", uri, 0);
- }
- return _parse(uri, 5, null);
- }
-
- /**
- * The [Uri] that this `UriData` is giving access to.
- *
- * Returns a `Uri` with scheme `data` and the remainder of the data URI
- * as path.
- */
- Uri get uri {
- if (_uriCache != null) return _uriCache;
- String path = _text;
- String query = null;
- int colonIndex = _separatorIndices[0];
- int queryIndex = _text.indexOf('?', colonIndex + 1);
- int end = null;
- if (queryIndex >= 0) {
- query = _text.substring(queryIndex + 1);
- end = queryIndex;
- }
- path = _text.substring(colonIndex + 1, end);
- // TODO(lrn): This is probably too simple. We should ensure URI
- // normalization before passing in the raw strings, maybe using
- // Uri._makePath, Uri._makeQuery.
- _uriCache = new Uri._internal("data", "", null, null, path, query, null);
- return _uriCache;
- }
-
- /**
- * The MIME type of the data URI.
- *
- * A data URI consists of a "media type" followed by data.
- * The media type starts with a MIME type and can be followed by
- * extra parameters.
- *
- * Example:
- *
- * data:text/plain;charset=utf-8,Hello%20World!
- *
- * This data URI has the media type `text/plain;charset=utf-8`, which is the
- * MIME type `text/plain` with the parameter `charset` with value `utf-8`.
- * See [RFC 2045](https://tools.ietf.org/html/rfc2045) for more detail.
- *
- * If the first part of the data URI is empty, it defaults to `text/plain`.
- */
- String get mimeType {
- int start = _separatorIndices[0] + 1;
- int end = _separatorIndices[1];
- if (start == end) return "text/plain";
- return Uri._uriDecode(_text, start, end, UTF8, false);
- }
-
- /**
- * The charset parameter of the media type.
- *
- * If the parameters of the media type contains a `charset` parameter
- * then this returns its value, otherwise it returns `US-ASCII`,
- * which is the default charset for data URIs.
- */
- String get charset {
- int parameterStart = 1;
- int parameterEnd = _separatorIndices.length - 1; // The ',' before data.
- if (isBase64) {
- // There is a ";base64" separator, so subtract one for that as well.
- parameterEnd -= 1;
- }
- for (int i = parameterStart; i < parameterEnd; i += 2) {
- var keyStart = _separatorIndices[i] + 1;
- var keyEnd = _separatorIndices[i + 1];
- if (keyEnd == keyStart + 7 && _text.startsWith("charset", keyStart)) {
- return Uri._uriDecode(_text, keyEnd + 1, _separatorIndices[i + 2],
- UTF8, false);
- }
- }
- return "US-ASCII";
- }
-
- /**
- * Whether the data is Base64 encoded or not.
- */
- bool get isBase64 => _separatorIndices.length.isOdd;
-
- /**
- * The content part of the data URI, as its actual representation.
- *
- * This string may contain percent escapes.
- */
- String get contentText => _text.substring(_separatorIndices.last + 1);
-
- /**
- * The content part of the data URI as bytes.
- *
- * If the data is Base64 encoded, it will be decoded to bytes.
- *
- * If the data is not Base64 encoded, it will be decoded by unescaping
- * percent-escaped characters and returning byte values of each unescaped
- * character. The bytes will not be, e.g., UTF-8 decoded.
- */
- List<int> contentAsBytes() {
- String text = _text;
- int start = _separatorIndices.last + 1;
- if (isBase64) {
- return BASE64.decoder.convert(text, start);
- }
-
- // Not base64, do percent-decoding and return the remaining bytes.
- // Compute result size.
- const int percent = 0x25;
- int length = text.length - start;
- for (int i = start; i < text.length; i++) {
- var codeUnit = text.codeUnitAt(i);
- if (codeUnit == percent) {
- i += 2;
- length -= 2;
- }
- }
- // Fill result array.
- Uint8List result = new Uint8List(length);
- if (length == text.length) {
- result.setRange(0, length, text.codeUnits, start);
- return result;
- }
- int index = 0;
- for (int i = start; i < text.length; i++) {
- var codeUnit = text.codeUnitAt(i);
- if (codeUnit != percent) {
- result[index++] = codeUnit;
- } else {
- if (i + 2 < text.length) {
- var digit1 = Uri._parseHexDigit(text.codeUnitAt(i + 1));
- var digit2 = Uri._parseHexDigit(text.codeUnitAt(i + 2));
- if (digit1 >= 0 && digit2 >= 0) {
- int byte = digit1 * 16 + digit2;
- result[index++] = byte;
- i += 2;
- continue;
- }
- }
- throw new FormatException("Invalid percent escape", text, i);
- }
- }
- assert(index == result.length);
- return result;
- }
-
- /**
- * Returns a string created from the content of the data URI.
- *
- * If the content is Base64 encoded, it will be decoded to bytes and then
- * decoded to a string using [encoding].
- * If encoding is omitted, the value of a `charset` parameter is used
- * if it is recongized by [Encoding.getByName], otherwise it defaults to
- * the [ASCII] encoding, which is the default encoding for data URIs
- * that do not specify an encoding.
- *
- * If the content is not Base64 encoded, it will first have percent-escapes
- * converted to bytes and then the character codes and byte values are
- * decoded using [encoding].
- */
- String contentAsString({Encoding encoding}) {
- if (encoding == null) {
- var charset = this.charset; // Returns "US-ASCII" if not present.
- encoding = Encoding.getByName(charset);
- if (encoding == null) {
- throw new UnsupportedError("Unknown charset: $charset");
- }
- }
- String text = _text;
- int start = _separatorIndices.last + 1;
- if (isBase64) {
- var converter = BASE64.decoder.fuse(encoding.decoder);
- return converter.convert(text.substring(start));
- }
- return Uri._uriDecode(text, start, text.length, encoding, false);
- }
-
- /**
- * A map representing the parameters of the media type.
- *
- * A data URI may contain parameters between the MIME type and the
- * data. This converts these parameters to a map from parameter name
- * to parameter value.
- * The map only contains parameters that actually occur in the URI.
- * The `charset` parameter has a default value even if it doesn't occur
- * in the URI, which is reflected by the [charset] getter. This means that
- * [charset] may return a value even if `parameters["charset"]` is `null`.
- *
- * If the values contain non-ASCII values or percent escapes, they default
- * to being decoded as UTF-8.
- */
- Map<String, String> get parameters {
- var result = <String, String>{};
- for (int i = 3; i < _separatorIndices.length; i += 2) {
- var start = _separatorIndices[i - 2] + 1;
- var equals = _separatorIndices[i - 1];
- var end = _separatorIndices[i];
- String key = Uri._uriDecode(_text, start, equals, UTF8, false);
- String value = Uri._uriDecode(_text,equals + 1, end, UTF8, false);
- result[key] = value;
- }
- return result;
- }
-
- static UriData _parse(String text, int start, Uri sourceUri) {
- assert(start == 0 || start == 5);
- assert((start == 5) == text.startsWith("data:"));
-
- /// Character codes.
- const int comma = 0x2c;
- const int slash = 0x2f;
- const int semicolon = 0x3b;
- const int equals = 0x3d;
- List<int> indices = [start - 1];
- int slashIndex = -1;
- var char;
- int i = start;
- for (; i < text.length; i++) {
- char = text.codeUnitAt(i);
- if (char == comma || char == semicolon) break;
- if (char == slash) {
- if (slashIndex < 0) {
- slashIndex = i;
- continue;
- }
- throw new FormatException("Invalid MIME type", text, i);
- }
- }
- if (slashIndex < 0 && i > start) {
- // An empty MIME type is allowed, but if non-empty it must contain
- // exactly one slash.
- throw new FormatException("Invalid MIME type", text, i);
- }
- while (char != comma) {
- // Parse parameters and/or "base64".
- indices.add(i);
- i++;
- int equalsIndex = -1;
- for (; i < text.length; i++) {
- char = text.codeUnitAt(i);
- if (char == equals) {
- if (equalsIndex < 0) equalsIndex = i;
- } else if (char == semicolon || char == comma) {
- break;
- }
- }
- if (equalsIndex >= 0) {
- indices.add(equalsIndex);
- } else {
- // Have to be final "base64".
- var lastSeparator = indices.last;
- if (char != comma ||
- i != lastSeparator + 7 /* "base64,".length */ ||
- !text.startsWith("base64", lastSeparator + 1)) {
- throw new FormatException("Expecting '='", text, i);
- }
- break;
- }
- }
- indices.add(i);
- return new UriData._(text, indices, sourceUri);
- }
-
- /**
- * Like [Uri._uriEncode] but takes the input as bytes, not a string.
- *
- * Encodes into [buffer] instead of creating its own buffer.
- */
- static void _uriEncodeBytes(List<int> canonicalTable,
- List<int> bytes,
- StringSink buffer) {
- // Encode the string into bytes then generate an ASCII only string
- // by percent encoding selected bytes.
- int byteOr = 0;
- for (int i = 0; i < bytes.length; i++) {
- int byte = bytes[i];
- byteOr |= byte;
- if (byte < 128 &&
- ((canonicalTable[byte >> 4] & (1 << (byte & 0x0f))) != 0)) {
- buffer.writeCharCode(byte);
- } else {
- buffer.writeCharCode(Uri._PERCENT);
- buffer.writeCharCode(Uri._hexDigits.codeUnitAt(byte >> 4));
- buffer.writeCharCode(Uri._hexDigits.codeUnitAt(byte & 0x0f));
- }
- }
- if ((byteOr & ~0xFF) != 0) {
- for (int i = 0; i < bytes.length; i++) {
- var byte = bytes[i];
- if (byte < 0 || byte > 255) {
- throw new ArgumentError.value(byte, "non-byte value");
- }
- }
- }
- }
-
- String toString() =>
- (_separatorIndices[0] == _noScheme) ? "data:$_text" : _text;
-
- // Table of the `token` characters of RFC 2045 in a URI.
- //
- // A token is any US-ASCII character except SPACE, control characters and
- // `tspecial` characters. The `tspecial` category is:
- // '(', ')', '<', '>', '@', ',', ';', ':', '\', '"', '/', '[, ']', '?', '='.
- //
- // In a data URI, we also need to escape '%' and '#' characters.
- static const _tokenCharTable = const [
- // LSB MSB
- // | |
- 0x0000, // 0x00 - 0x0f 00000000 00000000
- 0x0000, // 0x10 - 0x1f 00000000 00000000
- // ! $ &' *+ -.
- 0x6cd2, // 0x20 - 0x2f 01001011 00110110
- // 01234567 89
- 0x03ff, // 0x30 - 0x3f 11111111 11000000
- // ABCDEFG HIJKLMNO
- 0xfffe, // 0x40 - 0x4f 01111111 11111111
- // PQRSTUVW XYZ ^_
- 0xc7ff, // 0x50 - 0x5f 11111111 11100011
- // `abcdefg hijklmno
- 0xffff, // 0x60 - 0x6f 11111111 11111111
- // pqrstuvw xyz{|}~
- 0x7fff]; // 0x70 - 0x7f 11111111 11111110
-
- // All non-escape RFC-2396 uric characters.
- //
- // uric = reserved | unreserved | escaped
- // reserved = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" | "$" | ","
- // unreserved = alphanum | mark
- // mark = "-" | "_" | "." | "!" | "~" | "*" | "'" | "(" | ")"
- //
- // This is the same characters as in a URI query (which is URI pchar plus '?')
- static const _uricTable = Uri._queryCharTable;
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/developer/developer.dart b/pkg/dev_compiler/tool/input_sdk/lib/developer/developer.dart
deleted file mode 100644
index 47ea5ba..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/developer/developer.dart
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-/// Interact with developer tools such as the debugger and inspector.
-///
-/// The dart:developer library is _unstable_ and its API might change slightly
-/// as a result of developer feedback. This library is platform dependent and
-/// therefore it has implementations for both dart2js and the Dart VM. Both are
-/// under development and may not support all operations yet.
-///
-/// To use this library in your code:
-///
-/// import 'dart:developer';
-///
-library dart.developer;
-
-import 'dart:async';
-import 'dart:convert';
-import 'dart:isolate' show RawReceivePort, SendPort;
-
-part 'extension.dart';
-part 'profiler.dart';
-part 'timeline.dart';
-part 'service.dart';
-
-/// If [when] is true, stop the program as if a breakpoint were hit at the
-/// following statement.
-///
-/// Returns the value of [when]. Some debuggers may display [message].
-///
-/// NOTE: When invoked, the isolate will not return until a debugger
-/// continues execution. When running in the Dart VM the behaviour is the same
-/// regardless of whether or not a debugger is connected. When compiled to
-/// JavaScript, this uses the "debugger" statement, and behaves exactly as
-/// that does.
-external bool debugger({bool when: true, String message});
-
-/// Send a reference to [object] to any attached debuggers.
-///
-/// Debuggers may open an inspector on the object. Returns the argument.
-external Object inspect(Object object);
-
-/// Emit a log event.
-/// [message] is the log message.
-/// [time] (optional) is the timestamp.
-/// [sequenceNumber] (optional) is a monotonically increasing sequence number.
-/// [level] (optional) is the severity level (value between 0 and 2000).
-/// [name] (optional) is the name of the source of the log message.
-/// [zone] (optional) the zone where the log was emitted
-/// [error] (optional) an error object associated with this log event.
-/// [stackTrace] (optional) a stack trace associated with this log event.
-external void log(String message,
- {DateTime time,
- int sequenceNumber,
- int level: 0,
- String name: '',
- Zone zone,
- Object error,
- StackTrace stackTrace});
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/developer/extension.dart b/pkg/dev_compiler/tool/input_sdk/lib/developer/extension.dart
deleted file mode 100644
index 5883fb5..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/developer/extension.dart
+++ /dev/null
@@ -1,177 +0,0 @@
-// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-part of dart.developer;
-
-/// A response to a service protocol extension RPC.
-///
-/// If the RPC was successful, use [ServiceExtensionResponse.result], otherwise
-/// use [ServiceExtensionResponse.error].
-class ServiceExtensionResponse {
- final String _result;
- final int _errorCode;
- final String _errorDetail;
-
- /// Creates a successful response to a service protocol extension RPC.
- ///
- /// Requires [result] to be a JSON object encoded as a string. When forming
- /// the JSON-RPC message [result] will be inlined directly.
- ServiceExtensionResponse.result(String result)
- : _result = result,
- _errorCode = null,
- _errorDetail = null {
- if (_result is! String) {
- throw new ArgumentError.value(_result, "result", "Must be a String");
- }
- }
-
- /// Creates an error response to a service protocol extension RPC.
- ///
- /// Requires [errorCode] to be [invalidParams] or between [extensionErrorMin]
- /// and [extensionErrorMax]. Requires [errorDetail] to be a JSON object
- /// encoded as a string. When forming the JSON-RPC message [errorDetail] will
- /// be inlined directly.
- ServiceExtensionResponse.error(int errorCode, String errorDetail)
- : _result = null,
- _errorCode = errorCode,
- _errorDetail = errorDetail {
- _validateErrorCode(_errorCode);
- if (_errorDetail is! String) {
- throw new ArgumentError.value(_errorDetail,
- "errorDetail",
- "Must be a String");
- }
- }
-
- /// Invalid method parameter(s) error code.
- @deprecated static const kInvalidParams = invalidParams;
- /// Generic extension error code.
- @deprecated static const kExtensionError = extensionError;
- /// Maximum extension provided error code.
- @deprecated static const kExtensionErrorMax = extensionErrorMax;
- /// Minimum extension provided error code.
- @deprecated static const kExtensionErrorMin = extensionErrorMin;
-
- /// Invalid method parameter(s) error code.
- static const invalidParams = -32602;
- /// Generic extension error code.
- static const extensionError = -32000;
- /// Maximum extension provided error code.
- static const extensionErrorMax = -32000;
- /// Minimum extension provided error code.
- static const extensionErrorMin = -32016;
-
-
- static String _errorCodeMessage(int errorCode) {
- _validateErrorCode(errorCode);
- if (errorCode == kInvalidParams) {
- return "Invalid params";
- }
- return "Server error";
- }
-
- static _validateErrorCode(int errorCode) {
- if (errorCode is! int) {
- throw new ArgumentError.value(errorCode, "errorCode", "Must be an int");
- }
- if (errorCode == invalidParams) {
- return;
- }
- if ((errorCode >= extensionErrorMin) &&
- (errorCode <= extensionErrorMax)) {
- return;
- }
- throw new ArgumentError.value(errorCode, "errorCode", "Out of range");
- }
-
- bool _isError() => (_errorCode != null) && (_errorDetail != null);
-
- String _toString() {
- if (_result != null) {
- return _result;
- } else {
- assert(_errorCode != null);
- assert(_errorDetail != null);
- return JSON.encode({
- 'code': _errorCode,
- 'message': _errorCodeMessage(_errorCode),
- 'data': {
- 'details': _errorDetail
- }
- });
- }
- }
-}
-
-/// A service protocol extension handler. Registered with [registerExtension].
-///
-/// Must complete to a [ServiceExtensionResponse].
-///
-/// [method] - the method name of the service protocol request.
-/// [parameters] - A map holding the parameters to the service protocol request.
-///
-/// *NOTE*: All parameter names and values are **encoded as strings**.
-typedef Future<ServiceExtensionResponse>
- ServiceExtensionHandler(String method, Map<String, String> parameters);
-
-/// Register a [ServiceExtensionHandler] that will be invoked in this isolate
-/// for [method]. *NOTE*: Service protocol extensions must be registered
-/// in each isolate.
-///
-/// *NOTE*: [method] must begin with 'ext.' and you should use the following
-/// structure to avoid conflicts with other packages: 'ext.package.command'.
-/// That is, immediately following the 'ext.' prefix, should be the registering
-/// package name followed by another period ('.') and then the command name.
-/// For example: 'ext.dart.io.getOpenFiles'.
-///
-/// Because service extensions are isolate specific, clients using extensions
-/// must always include an 'isolateId' parameter with each RPC.
-void registerExtension(String method, ServiceExtensionHandler handler) {
- if (method is! String) {
- throw new ArgumentError.value(method,
- 'method',
- 'Must be a String');
- }
- if (!method.startsWith('ext.')) {
- throw new ArgumentError.value(method,
- 'method',
- 'Must begin with ext.');
- }
- if (_lookupExtension(method) != null) {
- throw new ArgumentError('Extension already registered: $method');
- }
- if (handler is! ServiceExtensionHandler) {
- throw new ArgumentError.value(handler,
- 'handler',
- 'Must be a ServiceExtensionHandler');
- }
- _registerExtension(method, handler);
-}
-
-/// Post an event of [eventKind] with payload of [eventData] to the `Extension`
-/// event stream.
-void postEvent(String eventKind, Map eventData) {
- if (eventKind is! String) {
- throw new ArgumentError.value(eventKind,
- 'eventKind',
- 'Must be a String');
- }
- if (eventData is! Map) {
- throw new ArgumentError.value(eventData,
- 'eventData',
- 'Must be a Map');
- }
- String eventDataAsString = JSON.encode(eventData);
- _postEvent(eventKind, eventDataAsString);
-}
-
-external _postEvent(String eventKind, String eventData);
-
-// Both of these functions are written inside C++ to avoid updating the data
-// structures in Dart, getting an OOB, and observing stale state. Do not move
-// these into Dart code unless you can ensure that the operations will can be
-// done atomically. Native code lives in vm/isolate.cc-
-// LookupServiceExtensionHandler and RegisterServiceExtensionHandler.
-external ServiceExtensionHandler _lookupExtension(String method);
-external _registerExtension(String method, ServiceExtensionHandler handler);
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/developer/profiler.dart b/pkg/dev_compiler/tool/input_sdk/lib/developer/profiler.dart
deleted file mode 100644
index 566d015..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/developer/profiler.dart
+++ /dev/null
@@ -1,197 +0,0 @@
-// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-part of dart.developer;
-
-/// A UserTag can be used to group samples in the Observatory profiler.
-abstract class UserTag {
- /// The maximum number of UserTag instances that can be created by a program.
- static const MAX_USER_TAGS = 64;
-
- factory UserTag(String label) => new _FakeUserTag(label);
-
- /// Label of [this].
- String get label;
-
- /// Make [this] the current tag for the isolate. Returns the current tag
- /// before setting.
- UserTag makeCurrent();
-
- /// The default [UserTag] with label 'Default'.
- static UserTag get defaultTag => _FakeUserTag._defaultTag;
-}
-
-// This is a fake implementation of UserTag so that code can compile and run
-// in dart2js.
-class _FakeUserTag implements UserTag {
- static Map _instances = {};
-
- _FakeUserTag.real(this.label);
-
- factory _FakeUserTag(String label) {
- // Canonicalize by name.
- var existingTag = _instances[label];
- if (existingTag != null) {
- return existingTag;
- }
- // Throw an exception if we've reached the maximum number of user tags.
- if (_instances.length == UserTag.MAX_USER_TAGS) {
- throw new UnsupportedError(
- 'UserTag instance limit (${UserTag.MAX_USER_TAGS}) reached.');
- }
- // Create a new instance and add it to the instance map.
- var instance = new _FakeUserTag.real(label);
- _instances[label] = instance;
- return instance;
- }
-
- final String label;
-
- UserTag makeCurrent() {
- var old = _currentTag;
- _currentTag = this;
- return old;
- }
-
- static final UserTag _defaultTag = new _FakeUserTag('Default');
-}
-
-var _currentTag = _FakeUserTag._defaultTag;
-
-/// Returns the current [UserTag] for the isolate.
-UserTag getCurrentTag() {
- return _currentTag;
-}
-
-/// Abstract [Metric] class. Metric names must be unique, are hierarchical,
-/// and use periods as separators. For example, 'a.b.c'. Uniqueness is only
-/// enforced when a Metric is registered. The name of a metric cannot contain
-/// the slash ('/') character.
-abstract class Metric {
- /// [name] of this metric.
- final String name;
- /// [description] of this metric.
- final String description;
-
- Metric(this.name, this.description) {
- if ((name == 'vm') || name.contains('/')) {
- throw new ArgumentError('Invalid Metric name.');
- }
-
- }
-
- Map _toJSON();
-}
-
-/// A measured value with a min and max. Initial value is min. Value will
-/// be clamped to the interval [min, max].
-class Gauge extends Metric {
- final double min;
- final double max;
-
- double _value;
- double get value => _value;
- set value(double v) {
- if (v < min) {
- v = min;
- } else if (v > max) {
- v = max;
- }
- _value = v;
- }
-
- Gauge(String name, String description, this.min, this.max)
- : super(name, description) {
- if (min is! double) {
- throw new ArgumentError('min must be a double');
- }
- if (max is! double) {
- throw new ArgumentError('max must be a double');
- }
- if (!(min < max)) {
- throw new ArgumentError('min must be less than max');
- }
- _value = min;
- }
-
- Map _toJSON() {
- var map = {
- 'type': 'Gauge',
- 'id': 'metrics/$name',
- 'name': name,
- 'description': description,
- 'value': value,
- 'min': min,
- 'max': max,
- };
- return map;
- }
-}
-
-
-/// A changing value. Initial value is 0.0.
-class Counter extends Metric {
- Counter(String name, String description)
- : super(name, description);
-
- double _value = 0.0;
- double get value => _value;
- set value(double v) {
- _value = v;
- }
-
- Map _toJSON() {
- var map = {
- 'type': 'Counter',
- 'id': 'metrics/$name',
- 'name': name,
- 'description': description,
- 'value': value,
- };
- return map;
- }
-}
-
-class Metrics {
- static final Map<String, Metric> _metrics = new Map<String, Metric>();
-
- /// Register [Metric]s to make them visible to Observatory.
- static void register(Metric metric) {
- if (metric is! Metric) {
- throw new ArgumentError('metric must be a Metric');
- }
- if (_metrics[metric.name] != null) {
- throw new ArgumentError('Registered metrics have unique names');
- }
- _metrics[metric.name] = metric;
- }
-
- /// Deregister [Metric]s to make them not visible to Observatory.
- static void deregister(Metric metric) {
- if (metric is! Metric) {
- throw new ArgumentError('metric must be a Metric');
- }
- _metrics.remove(metric.name);
- }
-
- static String _printMetric(String id) {
- var metric = _metrics[id];
- if (metric == null) {
- return null;
- }
- return JSON.encode(metric._toJSON());
- }
-
- static String _printMetrics() {
- var metrics = [];
- for (var metric in _metrics.values) {
- metrics.add(metric._toJSON());
- }
- var map = {
- 'type': 'MetricList',
- 'metrics': metrics,
- };
- return JSON.encode(map);
- }
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/developer/service.dart b/pkg/dev_compiler/tool/input_sdk/lib/developer/service.dart
deleted file mode 100644
index 9ccf0dc..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/developer/service.dart
+++ /dev/null
@@ -1,89 +0,0 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-part of dart.developer;
-
-/// Service protocol is the protocol that a client like the observatory
-/// could use to access the services provided by the Dart VM for
-/// debugging and inspecting Dart programs. This class encapsulates the
-/// version number and Uri for accessing this service.
-class ServiceProtocolInfo {
- /// The major version of the protocol. If the running Dart environment does
- /// not support the service protocol, this is 0.
- final int majorVersion = _getServiceMajorVersion();
- /// The minor version of the protocol. If the running Dart environment does
- /// not support the service protocol, this is 0.
- final int minorVersion = _getServiceMinorVersion();
- /// The Uri to access the service. If the web server is not running, this
- /// will be null.
- final Uri serverUri;
-
- ServiceProtocolInfo(this.serverUri);
-
- String toString() {
- if (serverUri != null) {
- return 'Dart VM Service Protocol v$majorVersion.$minorVersion '
- 'listening on $serverUri';
- } else {
- return 'Dart VM Service Protocol v$majorVersion.$minorVersion';
- }
- }
-}
-
-/// Access information about the service protocol and control the web server
-/// that provides access to the services provided by the Dart VM for
-/// debugging and inspecting Dart programs.
-class Service {
- /// Get information about the service protocol (version number and
- /// Uri to access the service).
- static Future<ServiceProtocolInfo> getInfo() async {
- // Port to receive response from service isolate.
- final RawReceivePort receivePort = new RawReceivePort();
- final Completer<Uri> uriCompleter = new Completer<Uri>();
- receivePort.handler = (Uri uri) => uriCompleter.complete(uri);
- // Request the information from the service isolate.
- _getServerInfo(receivePort.sendPort);
- // Await the response from the service isolate.
- Uri uri = await uriCompleter.future;
- // Close the port.
- receivePort.close();
- return new ServiceProtocolInfo(uri);
- }
-
- /// Control the web server that the service protocol is accessed through.
- /// The [enable] argument must be a boolean and is used as a toggle to
- /// enable(true) or disable(false) the web server servicing requests.
- static Future<ServiceProtocolInfo> controlWebServer(
- {bool enable: false}) async {
- if (enable is! bool) {
- throw new ArgumentError.value(enable,
- 'enable',
- 'Must be a bool');
- }
- // Port to receive response from service isolate.
- final RawReceivePort receivePort = new RawReceivePort();
- final Completer<Uri> uriCompleter = new Completer<Uri>();
- receivePort.handler = (Uri uri) => uriCompleter.complete(uri);
- // Request the information from the service isolate.
- _webServerControl(receivePort.sendPort, enable);
- // Await the response from the service isolate.
- Uri uri = await uriCompleter.future;
- // Close the port.
- receivePort.close();
- return new ServiceProtocolInfo(uri);
- }
-}
-
-/// [sp] will receive a Uri or null.
-external void _getServerInfo(SendPort sp);
-
-/// [sp] will receive a Uri or null.
-external void _webServerControl(SendPort sp, bool enable);
-
-/// Returns the major version of the service protocol.
-external int _getServiceMajorVersion();
-
-/// Returns the minor version of the service protocol.
-external int _getServiceMinorVersion();
-
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/developer/timeline.dart b/pkg/dev_compiler/tool/input_sdk/lib/developer/timeline.dart
deleted file mode 100644
index b6118af..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/developer/timeline.dart
+++ /dev/null
@@ -1,328 +0,0 @@
-// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-part of dart.developer;
-
-const bool _isProduct = const bool.fromEnvironment("dart.vm.product");
-
-typedef dynamic TimelineSyncFunction();
-typedef Future TimelineAsyncFunction();
-
-/// Add to the timeline.
-class Timeline {
- /// Start a synchronous operation labeled [name]. Optionally takes
- /// a [Map] of [arguments]. This operation must be finished before
- /// returning to the event queue.
- static void startSync(String name, {Map arguments}) {
- if (_isProduct) {
- return;
- }
- if (name is! String) {
- throw new ArgumentError.value(name,
- 'name',
- 'Must be a String');
- }
- if (!_isDartStreamEnabled()) {
- // Push a null onto the stack and return.
- _stack.add(null);
- return;
- }
- var block = new _SyncBlock._(name, _getTraceClock(), _getThreadCpuClock());
- if (arguments is Map) {
- block._appendArguments(arguments);
- }
- _stack.add(block);
- }
-
- /// Finish the last synchronous operation that was started.
- static void finishSync() {
- if (_isProduct) {
- return;
- }
- if (_stack.length == 0) {
- throw new StateError(
- 'Uneven calls to startSync and finishSync');
- }
- // Pop top item off of stack.
- var block = _stack.removeLast();
- if (block == null) {
- // Dart stream was disabled when startSync was called.
- return;
- }
- // Finish it.
- block.finish();
- }
-
- /// Emit an instant event.
- static void instantSync(String name, {Map arguments}) {
- if (_isProduct) {
- return;
- }
- if (name is! String) {
- throw new ArgumentError.value(name,
- 'name',
- 'Must be a String');
- }
- if (!_isDartStreamEnabled()) {
- // Stream is disabled.
- return;
- }
- Map instantArguments;
- if (arguments is Map) {
- instantArguments = new Map.from(arguments);
- }
- _reportInstantEvent(_getTraceClock(),
- 'Dart',
- name,
- _argumentsAsJson(instantArguments));
- }
-
-
- /// A utility method to time a synchronous [function]. Internally calls
- /// [function] bracketed by calls to [startSync] and [finishSync].
- static dynamic timeSync(String name,
- TimelineSyncFunction function,
- {Map arguments}) {
- startSync(name, arguments: arguments);
- try {
- return function();
- } finally {
- finishSync();
- }
- }
-
- /// The current time stamp from the clock used by the timeline. Units are
- /// microseconds.
- static int get now => _getTraceClock();
- static final List<_SyncBlock> _stack = new List<_SyncBlock>();
- static final int _isolateId = _getIsolateNum();
- static final String _isolateIdString = _isolateId.toString();
-}
-
-/// An asynchronous task on the timeline. An asynchronous task can have many
-/// (nested) synchronous operations. Synchronous operations can live longer than
-/// the current isolate event. To pass a [TimelineTask] to another isolate,
-/// you must first call [pass] to get the task id and then construct a new
-/// [TimelineTask] in the other isolate.
-class TimelineTask {
- /// Create a task. [taskId] will be set by the system.
- TimelineTask()
- : _taskId = _getNextAsyncId() {
- }
-
- /// Create a task with an explicit [taskId]. This is useful if you are
- /// passing a task from one isolate to another.
- TimelineTask.withTaskId(int taskId)
- : _taskId = taskId {
- if (taskId is! int) {
- throw new ArgumentError.value(taskId,
- 'taskId',
- 'Must be an int');
- }
- }
-
- /// Start a synchronous operation within this task named [name].
- /// Optionally takes a [Map] of [arguments].
- void start(String name, {Map arguments}) {
- if (_isProduct) {
- return;
- }
- if (name is! String) {
- throw new ArgumentError.value(name,
- 'name',
- 'Must be a String');
- }
- var block = new _AsyncBlock._(name, _taskId);
- if (arguments is Map) {
- block._appendArguments(arguments);
- }
- _stack.add(block);
- block._start();
- }
-
- /// Emit an instant event for this task.
- void instant(String name, {Map arguments}) {
- if (_isProduct) {
- return;
- }
- if (name is! String) {
- throw new ArgumentError.value(name,
- 'name',
- 'Must be a String');
- }
- Map instantArguments;
- if (arguments is Map) {
- instantArguments = new Map.from(arguments);
- }
- _reportTaskEvent(_getTraceClock(),
- _taskId,
- 'n',
- 'Dart',
- name,
- _argumentsAsJson(instantArguments));
- }
-
- /// Finish the last synchronous operation that was started.
- void finish() {
- if (_isProduct) {
- return;
- }
- if (_stack.length == 0) {
- throw new StateError(
- 'Uneven calls to start and finish');
- }
- // Pop top item off of stack.
- var block = _stack.removeLast();
- block._finish();
- }
-
- /// Retrieve the [TimelineTask]'s task id. Will throw an exception if the
- /// stack is not empty.
- int pass() {
- if (_stack.length > 0) {
- throw new StateError(
- 'You cannot pass a TimelineTask without finishing all started '
- 'operations');
- }
- int r = _taskId;
- return r;
- }
-
- final int _taskId;
- final List<_AsyncBlock> _stack = [];
-}
-
-/// An asynchronous block of time on the timeline. This block can be kept
-/// open across isolate messages.
-class _AsyncBlock {
- /// The category this block belongs to.
- final String category = 'Dart';
- /// The name of this block.
- final String name;
- /// The asynchronous task id.
- final int _taskId;
- /// An (optional) set of arguments which will be serialized to JSON and
- /// associated with this block.
- Map _arguments;
-
- _AsyncBlock._(this.name, this._taskId);
-
- // Emit the start event.
- void _start() {
- _reportTaskEvent(_getTraceClock(),
- _taskId,
- 'b',
- category,
- name,
- _argumentsAsJson(_arguments));
- }
-
- // Emit the finish event.
- void _finish() {
- _reportTaskEvent(_getTraceClock(),
- _taskId,
- 'e',
- category,
- name,
- _argumentsAsJson(null));
- }
-
- void _appendArguments(Map arguments) {
- if (_arguments == null) {
- _arguments = {};
- }
- _arguments.addAll(arguments);
- }
-}
-
-/// A synchronous block of time on the timeline. This block should not be
-/// kept open across isolate messages.
-class _SyncBlock {
- /// The category this block belongs to.
- final String category = 'Dart';
- /// The name of this block.
- final String name;
- /// An (optional) set of arguments which will be serialized to JSON and
- /// associated with this block.
- Map _arguments;
- // The start time stamp.
- final int _start;
- // The start time stamp of the thread cpu clock.
- final int _startCpu;
-
- _SyncBlock._(this.name,
- this._start,
- this._startCpu);
-
- /// Finish this block of time. At this point, this block can no longer be
- /// used.
- void finish() {
- // Report event to runtime.
- _reportCompleteEvent(_start,
- _startCpu,
- category,
- name,
- _argumentsAsJson(_arguments));
- }
-
- void _appendArguments(Map arguments) {
- if (arguments == null) {
- return;
- }
- if (_arguments == null) {
- _arguments = {};
- }
- _arguments.addAll(arguments);
- }
-}
-
-String _fastPathArguments;
-String _argumentsAsJson(Map arguments) {
- if ((arguments == null) || (arguments.length == 0)) {
- // Fast path no arguments. Avoid calling JSON.encode.
- if (_fastPathArguments == null) {
- _fastPathArguments = '{"isolateNumber":"${Timeline._isolateId}"}';
- }
- return _fastPathArguments;
- }
- // Add isolateNumber to arguments map.
- arguments['isolateNumber'] = Timeline._isolateIdString;
- return JSON.encode(arguments);
-}
-
-/// Returns true if the Dart Timeline stream is enabled.
-external bool _isDartStreamEnabled();
-
-/// Returns the next async task id.
-external int _getNextAsyncId();
-
-/// Returns the current value from the trace clock.
-external int _getTraceClock();
-
-/// Returns the current value from the thread CPU usage clock.
-external int _getThreadCpuClock();
-
-/// Returns the isolate's main port number.
-external int _getIsolateNum();
-
-/// Reports an event for a task.
-external void _reportTaskEvent(int start,
- int taskId,
- String phase,
- String category,
- String name,
- String argumentsAsJson);
-
-/// Reports a complete synchronous event.
-external void _reportCompleteEvent(int start,
- int startCpu,
- String category,
- String name,
- String argumentsAsJson);
-
-/// Reports an instant event.
-external void _reportInstantEvent(int start,
- String category,
- String name,
- String argumentsAsJson);
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/internal/internal.dart b/pkg/dev_compiler/tool/input_sdk/lib/internal/internal.dart
deleted file mode 100644
index 3eda7ca..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/internal/internal.dart
+++ /dev/null
@@ -1,62 +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.
-
-library dart._internal;
-
-import 'dart:collection';
-
-import 'dart:core' hide Symbol;
-import 'dart:core' as core;
-import 'dart:math' show Random;
-
-part 'iterable.dart';
-part 'list.dart';
-part 'lists.dart';
-part 'print.dart';
-part 'sort.dart';
-part 'symbol.dart';
-
-// Powers of 10 up to 10^22 are representable as doubles.
-// Powers of 10 above that are only approximate due to lack of precission.
-// Used by double-parsing.
-const POWERS_OF_TEN = const [
- 1.0, /* 0 */
- 10.0,
- 100.0,
- 1000.0,
- 10000.0,
- 100000.0, /* 5 */
- 1000000.0,
- 10000000.0,
- 100000000.0,
- 1000000000.0,
- 10000000000.0, /* 10 */
- 100000000000.0,
- 1000000000000.0,
- 10000000000000.0,
- 100000000000000.0,
- 1000000000000000.0, /* 15 */
- 10000000000000000.0,
- 100000000000000000.0,
- 1000000000000000000.0,
- 10000000000000000000.0,
- 100000000000000000000.0, /* 20 */
- 1000000000000000000000.0,
- 10000000000000000000000.0,
-];
-
-/**
- * An [Iterable] of the UTF-16 code units of a [String] in index order.
- */
-class CodeUnits extends UnmodifiableListBase<int> {
- /** The string that this is the code units of. */
- final String _string;
-
- CodeUnits(this._string);
-
- int get length => _string.length;
- int operator[](int i) => _string.codeUnitAt(i);
-
- static String stringOf(CodeUnits u) => u._string;
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/internal/iterable.dart b/pkg/dev_compiler/tool/input_sdk/lib/internal/iterable.dart
deleted file mode 100644
index 4d404eb..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/internal/iterable.dart
+++ /dev/null
@@ -1,766 +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.
-
-part of dart._internal;
-
-/**
- * Marker interface for [Iterable] subclasses that have an efficient
- * [length] implementation.
- */
-abstract class EfficientLength {
- /**
- * Returns the number of elements in the iterable.
- *
- * This is an efficient operation that doesn't require iterating through
- * the elements.
- */
- int get length;
-}
-
-/**
- * An [Iterable] for classes that have efficient [length] and [elementAt].
- *
- * All other methods are implemented in terms of [length] and [elementAt],
- * including [iterator].
- */
-abstract class ListIterable<E> extends Iterable<E>
- implements EfficientLength {
- int get length;
- E elementAt(int i);
-
- const ListIterable();
-
- Iterator<E> get iterator => new ListIterator<E>(this);
-
- void forEach(void action(E element)) {
- int length = this.length;
- for (int i = 0; i < length; i++) {
- action(elementAt(i));
- if (length != this.length) {
- throw new ConcurrentModificationError(this);
- }
- }
- }
-
- bool get isEmpty => length == 0;
-
- E get first {
- if (length == 0) throw IterableElementError.noElement();
- return elementAt(0);
- }
-
- E get last {
- if (length == 0) throw IterableElementError.noElement();
- return elementAt(length - 1);
- }
-
- E get single {
- if (length == 0) throw IterableElementError.noElement();
- if (length > 1) throw IterableElementError.tooMany();
- return elementAt(0);
- }
-
- bool contains(Object element) {
- int length = this.length;
- for (int i = 0; i < length; i++) {
- if (elementAt(i) == element) return true;
- if (length != this.length) {
- throw new ConcurrentModificationError(this);
- }
- }
- return false;
- }
-
- bool every(bool test(E element)) {
- int length = this.length;
- for (int i = 0; i < length; i++) {
- if (!test(elementAt(i))) return false;
- if (length != this.length) {
- throw new ConcurrentModificationError(this);
- }
- }
- return true;
- }
-
- bool any(bool test(E element)) {
- int length = this.length;
- for (int i = 0; i < length; i++) {
- if (test(elementAt(i))) return true;
- if (length != this.length) {
- throw new ConcurrentModificationError(this);
- }
- }
- return false;
- }
-
- E firstWhere(bool test(E element), { E orElse() }) {
- int length = this.length;
- for (int i = 0; i < length; i++) {
- E element = elementAt(i);
- if (test(element)) return element;
- if (length != this.length) {
- throw new ConcurrentModificationError(this);
- }
- }
- if (orElse != null) return orElse();
- throw IterableElementError.noElement();
- }
-
- E lastWhere(bool test(E element), { E orElse() }) {
- int length = this.length;
- for (int i = length - 1; i >= 0; i--) {
- E element = elementAt(i);
- if (test(element)) return element;
- if (length != this.length) {
- throw new ConcurrentModificationError(this);
- }
- }
- if (orElse != null) return orElse();
- throw IterableElementError.noElement();
- }
-
- E singleWhere(bool test(E element)) {
- int length = this.length;
- E match = null;
- bool matchFound = false;
- for (int i = 0; i < length; i++) {
- E element = elementAt(i);
- if (test(element)) {
- if (matchFound) {
- throw IterableElementError.tooMany();
- }
- matchFound = true;
- match = element;
- }
- if (length != this.length) {
- throw new ConcurrentModificationError(this);
- }
- }
- if (matchFound) return match;
- throw IterableElementError.noElement();
- }
-
- String join([String separator = ""]) {
- int length = this.length;
- if (!separator.isEmpty) {
- if (length == 0) return "";
- String first = "${elementAt(0)}";
- if (length != this.length) {
- throw new ConcurrentModificationError(this);
- }
- StringBuffer buffer = new StringBuffer(first);
- for (int i = 1; i < length; i++) {
- buffer.write(separator);
- buffer.write(elementAt(i));
- if (length != this.length) {
- throw new ConcurrentModificationError(this);
- }
- }
- return buffer.toString();
- } else {
- StringBuffer buffer = new StringBuffer();
- for (int i = 0; i < length; i++) {
- buffer.write(elementAt(i));
- if (length != this.length) {
- throw new ConcurrentModificationError(this);
- }
- }
- return buffer.toString();
- }
- }
-
- Iterable<E> where(bool test(E element)) => super.where(test);
-
- Iterable/*<T>*/ map/*<T>*/(/*=T*/ f(E element)) =>
- new MappedListIterable<E, dynamic/*=T*/ >(this, f);
-
- E reduce(E combine(var value, E element)) {
- int length = this.length;
- if (length == 0) throw IterableElementError.noElement();
- E value = elementAt(0);
- for (int i = 1; i < length; i++) {
- value = combine(value, elementAt(i));
- if (length != this.length) {
- throw new ConcurrentModificationError(this);
- }
- }
- return value;
- }
-
- /*=T*/ fold/*<T>*/(
- var/*=T*/ initialValue, /*=T*/ combine(
- var/*=T*/ previousValue, E element)) {
- var value = initialValue;
- int length = this.length;
- for (int i = 0; i < length; i++) {
- value = combine(value, elementAt(i));
- if (length != this.length) {
- throw new ConcurrentModificationError(this);
- }
- }
- return value;
- }
-
- Iterable<E> skip(int count) => new SubListIterable<E>(this, count, null);
-
- Iterable<E> skipWhile(bool test(E element)) => super.skipWhile(test);
-
- Iterable<E> take(int count) => new SubListIterable<E>(this, 0, count);
-
- Iterable<E> takeWhile(bool test(E element)) => super.takeWhile(test);
-
- List<E> toList({bool growable: true}) {
- List<E> result;
- if (growable) {
- result = new List<E>()..length = length;
- } else {
- result = new List<E>(length);
- }
- for (int i = 0; i < length; i++) {
- result[i] = elementAt(i);
- }
- return result;
- }
-
- Set<E> toSet() {
- Set<E> result = new Set<E>();
- for (int i = 0; i < length; i++) {
- result.add(elementAt(i));
- }
- return result;
- }
-}
-
-class SubListIterable<E> extends ListIterable<E> {
- final Iterable<E> _iterable; // Has efficient length and elementAt.
- final int _start;
- /** If null, represents the length of the iterable. */
- final int _endOrLength;
-
- SubListIterable(this._iterable, this._start, this._endOrLength) {
- RangeError.checkNotNegative(_start, "start");
- if (_endOrLength != null) {
- RangeError.checkNotNegative(_endOrLength, "end");
- if (_start > _endOrLength) {
- throw new RangeError.range(_start, 0, _endOrLength, "start");
- }
- }
- }
-
- int get _endIndex {
- int length = _iterable.length;
- if (_endOrLength == null || _endOrLength > length) return length;
- return _endOrLength;
- }
-
- int get _startIndex {
- int length = _iterable.length;
- if (_start > length) return length;
- return _start;
- }
-
- int get length {
- int length = _iterable.length;
- if (_start >= length) return 0;
- if (_endOrLength == null || _endOrLength >= length) {
- return length - _start;
- }
- return _endOrLength - _start;
- }
-
- E elementAt(int index) {
- int realIndex = _startIndex + index;
- if (index < 0 || realIndex >= _endIndex) {
- throw new RangeError.index(index, this, "index");
- }
- return _iterable.elementAt(realIndex);
- }
-
- Iterable<E> skip(int count) {
- RangeError.checkNotNegative(count, "count");
- int newStart = _start + count;
- if (_endOrLength != null && newStart >= _endOrLength) {
- return new EmptyIterable<E>();
- }
- return new SubListIterable<E>(_iterable, newStart, _endOrLength);
- }
-
- Iterable<E> take(int count) {
- RangeError.checkNotNegative(count, "count");
- if (_endOrLength == null) {
- return new SubListIterable<E>(_iterable, _start, _start + count);
- } else {
- int newEnd = _start + count;
- if (_endOrLength < newEnd) return this;
- return new SubListIterable<E>(_iterable, _start, newEnd);
- }
- }
-
- List<E> toList({bool growable: true}) {
- int start = _start;
- int end = _iterable.length;
- if (_endOrLength != null && _endOrLength < end) end = _endOrLength;
- int length = end - start;
- if (length < 0) length = 0;
- List<E> result = growable ? (new List<E>()..length = length)
- : new List<E>(length);
- for (int i = 0; i < length; i++) {
- result[i] = _iterable.elementAt(start + i);
- if (_iterable.length < end) throw new ConcurrentModificationError(this);
- }
- return result;
- }
-}
-
-/**
- * An [Iterator] that iterates a list-like [Iterable].
- *
- * All iterations is done in terms of [Iterable.length] and
- * [Iterable.elementAt]. These operations are fast for list-like
- * iterables.
- */
-class ListIterator<E> implements Iterator<E> {
- final Iterable<E> _iterable;
- final int _length;
- int _index;
- E _current;
-
- ListIterator(Iterable<E> iterable)
- : _iterable = iterable, _length = iterable.length, _index = 0;
-
- E get current => _current;
-
- bool moveNext() {
- int length = _iterable.length;
- if (_length != length) {
- throw new ConcurrentModificationError(_iterable);
- }
- if (_index >= length) {
- _current = null;
- return false;
- }
- _current = _iterable.elementAt(_index);
- _index++;
- return true;
- }
-}
-
-typedef T _Transformation<S, T>(S value);
-
-class MappedIterable<S, T> extends Iterable<T> {
- final Iterable<S> _iterable;
- final _Transformation<S, T> _f;
-
- factory MappedIterable(Iterable<S> iterable, T function(S value)) {
- if (iterable is EfficientLength) {
- return new EfficientLengthMappedIterable<S, T>(iterable, function);
- }
- return new MappedIterable<S, T>._(iterable, function);
- }
-
- MappedIterable._(this._iterable, T this._f(S element));
-
- Iterator<T> get iterator => new MappedIterator<S, T>(_iterable.iterator, _f);
-
- // Length related functions are independent of the mapping.
- int get length => _iterable.length;
- bool get isEmpty => _iterable.isEmpty;
-
- // Index based lookup can be done before transforming.
- T get first => _f(_iterable.first);
- T get last => _f(_iterable.last);
- T get single => _f(_iterable.single);
- T elementAt(int index) => _f(_iterable.elementAt(index));
-}
-
-class EfficientLengthMappedIterable<S, T> extends MappedIterable<S, T>
- implements EfficientLength {
- EfficientLengthMappedIterable(Iterable<S> iterable, T function(S value))
- : super._(iterable, function);
-}
-
-class MappedIterator<S, T> extends Iterator<T> {
- T _current;
- final Iterator<S> _iterator;
- final _Transformation<S, T> _f;
-
- MappedIterator(this._iterator, T this._f(S element));
-
- bool moveNext() {
- if (_iterator.moveNext()) {
- _current = _f(_iterator.current);
- return true;
- }
- _current = null;
- return false;
- }
-
- T get current => _current;
-}
-
-/**
- * Specialized alternative to [MappedIterable] for mapped [List]s.
- *
- * Expects efficient `length` and `elementAt` on the source iterable.
- */
-class MappedListIterable<S, T> extends ListIterable<T>
- implements EfficientLength {
- final Iterable<S> _source;
- final _Transformation<S, T> _f;
-
- MappedListIterable(this._source, T this._f(S value));
-
- int get length => _source.length;
- T elementAt(int index) => _f(_source.elementAt(index));
-}
-
-
-typedef bool _ElementPredicate<E>(E element);
-
-class WhereIterable<E> extends Iterable<E> {
- final Iterable<E> _iterable;
- final _ElementPredicate<E> _f;
-
- WhereIterable(this._iterable, bool this._f(E element));
-
- Iterator<E> get iterator => new WhereIterator<E>(_iterable.iterator, _f);
-}
-
-class WhereIterator<E> extends Iterator<E> {
- final Iterator<E> _iterator;
- final _ElementPredicate<E> _f;
-
- WhereIterator(this._iterator, bool this._f(E element));
-
- bool moveNext() {
- while (_iterator.moveNext()) {
- if (_f(_iterator.current)) {
- return true;
- }
- }
- return false;
- }
-
- E get current => _iterator.current;
-}
-
-typedef Iterable<T> _ExpandFunction<S, T>(S sourceElement);
-
-class ExpandIterable<S, T> extends Iterable<T> {
- final Iterable<S> _iterable;
- final _ExpandFunction<S, T> _f;
-
- ExpandIterable(this._iterable, Iterable<T> this._f(S element));
-
- Iterator<T> get iterator => new ExpandIterator<S, T>(_iterable.iterator, _f);
-}
-
-class ExpandIterator<S, T> implements Iterator<T> {
- final Iterator<S> _iterator;
- final _ExpandFunction<S, T> _f;
- // Initialize _currentExpansion to an empty iterable. A null value
- // marks the end of iteration, and we don't want to call _f before
- // the first moveNext call.
- Iterator<T> _currentExpansion = const EmptyIterator();
- T _current;
-
- ExpandIterator(this._iterator, Iterable<T> this._f(S element));
-
- T get current => _current;
-
- bool moveNext() {
- if (_currentExpansion == null) return false;
- while (!_currentExpansion.moveNext()) {
- _current = null;
- if (_iterator.moveNext()) {
- // If _f throws, this ends iteration. Otherwise _currentExpansion and
- // _current will be set again below.
- _currentExpansion = null;
- _currentExpansion = _f(_iterator.current).iterator;
- } else {
- return false;
- }
- }
- _current = _currentExpansion.current;
- return true;
- }
-}
-
-class TakeIterable<E> extends Iterable<E> {
- final Iterable<E> _iterable;
- final int _takeCount;
-
- factory TakeIterable(Iterable<E> iterable, int takeCount) {
- if (takeCount is! int || takeCount < 0) {
- throw new ArgumentError(takeCount);
- }
- if (iterable is EfficientLength) {
- return new EfficientLengthTakeIterable<E>(iterable, takeCount);
- }
- return new TakeIterable<E>._(iterable, takeCount);
- }
-
- TakeIterable._(this._iterable, this._takeCount);
-
- Iterator<E> get iterator {
- return new TakeIterator<E>(_iterable.iterator, _takeCount);
- }
-}
-
-class EfficientLengthTakeIterable<E> extends TakeIterable<E>
- implements EfficientLength {
- EfficientLengthTakeIterable(Iterable<E> iterable, int takeCount)
- : super._(iterable, takeCount);
-
- int get length {
- int iterableLength = _iterable.length;
- if (iterableLength > _takeCount) return _takeCount;
- return iterableLength;
- }
-}
-
-
-class TakeIterator<E> extends Iterator<E> {
- final Iterator<E> _iterator;
- int _remaining;
-
- TakeIterator(this._iterator, this._remaining) {
- assert(_remaining is int && _remaining >= 0);
- }
-
- bool moveNext() {
- _remaining--;
- if (_remaining >= 0) {
- return _iterator.moveNext();
- }
- _remaining = -1;
- return false;
- }
-
- E get current {
- if (_remaining < 0) return null;
- return _iterator.current;
- }
-}
-
-class TakeWhileIterable<E> extends Iterable<E> {
- final Iterable<E> _iterable;
- final _ElementPredicate<E> _f;
-
- TakeWhileIterable(this._iterable, bool this._f(E element));
-
- Iterator<E> get iterator {
- return new TakeWhileIterator<E>(_iterable.iterator, _f);
- }
-}
-
-class TakeWhileIterator<E> extends Iterator<E> {
- final Iterator<E> _iterator;
- final _ElementPredicate<E> _f;
- bool _isFinished = false;
-
- TakeWhileIterator(this._iterator, bool this._f(E element));
-
- bool moveNext() {
- if (_isFinished) return false;
- if (!_iterator.moveNext() || !_f(_iterator.current)) {
- _isFinished = true;
- return false;
- }
- return true;
- }
-
- E get current {
- if (_isFinished) return null;
- return _iterator.current;
- }
-}
-
-class SkipIterable<E> extends Iterable<E> {
- final Iterable<E> _iterable;
- final int _skipCount;
-
- factory SkipIterable(Iterable<E> iterable, int count) {
- if (iterable is EfficientLength) {
- return new EfficientLengthSkipIterable<E>(iterable, count);
- }
- return new SkipIterable<E>._(iterable, count);
- }
-
- SkipIterable._(this._iterable, this._skipCount) {
- if (_skipCount is! int) {
- throw new ArgumentError.value(_skipCount, "count is not an integer");
- }
- RangeError.checkNotNegative(_skipCount, "count");
- }
-
- Iterable<E> skip(int count) {
- if (_skipCount is! int) {
- throw new ArgumentError.value(_skipCount, "count is not an integer");
- }
- RangeError.checkNotNegative(_skipCount, "count");
- return new SkipIterable<E>._(_iterable, _skipCount + count);
- }
-
- Iterator<E> get iterator {
- return new SkipIterator<E>(_iterable.iterator, _skipCount);
- }
-}
-
-class EfficientLengthSkipIterable<E> extends SkipIterable<E>
- implements EfficientLength {
- EfficientLengthSkipIterable(Iterable<E> iterable, int skipCount)
- : super._(iterable, skipCount);
-
- int get length {
- int length = _iterable.length - _skipCount;
- if (length >= 0) return length;
- return 0;
- }
-}
-
-class SkipIterator<E> extends Iterator<E> {
- final Iterator<E> _iterator;
- int _skipCount;
-
- SkipIterator(this._iterator, this._skipCount) {
- assert(_skipCount is int && _skipCount >= 0);
- }
-
- bool moveNext() {
- for (int i = 0; i < _skipCount; i++) _iterator.moveNext();
- _skipCount = 0;
- return _iterator.moveNext();
- }
-
- E get current => _iterator.current;
-}
-
-class SkipWhileIterable<E> extends Iterable<E> {
- final Iterable<E> _iterable;
- final _ElementPredicate<E> _f;
-
- SkipWhileIterable(this._iterable, bool this._f(E element));
-
- Iterator<E> get iterator {
- return new SkipWhileIterator<E>(_iterable.iterator, _f);
- }
-}
-
-class SkipWhileIterator<E> extends Iterator<E> {
- final Iterator<E> _iterator;
- final _ElementPredicate<E> _f;
- bool _hasSkipped = false;
-
- SkipWhileIterator(this._iterator, bool this._f(E element));
-
- bool moveNext() {
- if (!_hasSkipped) {
- _hasSkipped = true;
- while (_iterator.moveNext()) {
- if (!_f(_iterator.current)) return true;
- }
- }
- return _iterator.moveNext();
- }
-
- E get current => _iterator.current;
-}
-
-/**
- * The always empty [Iterable].
- */
-class EmptyIterable<E> extends Iterable<E> implements EfficientLength {
- const EmptyIterable();
-
- Iterator<E> get iterator => const EmptyIterator();
-
- void forEach(void action(E element)) {}
-
- bool get isEmpty => true;
-
- int get length => 0;
-
- E get first { throw IterableElementError.noElement(); }
-
- E get last { throw IterableElementError.noElement(); }
-
- E get single { throw IterableElementError.noElement(); }
-
- E elementAt(int index) { throw new RangeError.range(index, 0, 0, "index"); }
-
- bool contains(Object element) => false;
-
- bool every(bool test(E element)) => true;
-
- bool any(bool test(E element)) => false;
-
- E firstWhere(bool test(E element), {E orElse()}) {
- if (orElse != null) return orElse();
- throw IterableElementError.noElement();
- }
-
- E lastWhere(bool test(E element), {E orElse()}) {
- if (orElse != null) return orElse();
- throw IterableElementError.noElement();
- }
-
- E singleWhere(bool test(E element), {E orElse()}) {
- if (orElse != null) return orElse();
- throw IterableElementError.noElement();
- }
-
- String join([String separator = ""]) => "";
-
- Iterable<E> where(bool test(E element)) => this;
-
- Iterable/*<T>*/ map/*<T>*/(/*=T*/ f(E element)) => const EmptyIterable();
-
- E reduce(E combine(E value, E element)) {
- throw IterableElementError.noElement();
- }
-
- /*=T*/ fold/*<T>*/(
- var/*=T*/ initialValue, /*=T*/ combine(
- var/*=T*/ previousValue, E element)) {
- return initialValue;
- }
-
- Iterable<E> skip(int count) {
- RangeError.checkNotNegative(count, "count");
- return this;
- }
-
- Iterable<E> skipWhile(bool test(E element)) => this;
-
- Iterable<E> take(int count) {
- RangeError.checkNotNegative(count, "count");
- return this;
- }
-
- Iterable<E> takeWhile(bool test(E element)) => this;
-
- List<E> toList({bool growable: true}) => growable ? <E>[] : new List<E>(0);
-
- Set<E> toSet() => new Set<E>();
-}
-
-/** The always empty iterator. */
-class EmptyIterator<E> implements Iterator<E> {
- const EmptyIterator();
- bool moveNext() => false;
- E get current => null;
-}
-
-/**
- * Creates errors throw by [Iterable] when the element count is wrong.
- */
-abstract class IterableElementError {
- /** Error thrown thrown by, e.g., [Iterable.first] when there is no result. */
- static StateError noElement() => new StateError("No element");
- /** Error thrown by, e.g., [Iterable.single] if there are too many results. */
- static StateError tooMany() => new StateError("Too many elements");
- /** Error thrown by, e.g., [List.setRange] if there are too few elements. */
- static StateError tooFew() => new StateError("Too few elements");
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/internal/list.dart b/pkg/dev_compiler/tool/input_sdk/lib/internal/list.dart
deleted file mode 100644
index 6e975e0..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/internal/list.dart
+++ /dev/null
@@ -1,393 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-part of dart._internal;
-
-/**
- * Mixin that throws on the length changing operations of [List].
- *
- * Intended to mix-in on top of [ListMixin] for fixed-length lists.
- */
-abstract class FixedLengthListMixin<E> {
- /** This operation is not supported by a fixed length list. */
- void set length(int newLength) {
- throw new UnsupportedError(
- "Cannot change the length of a fixed-length list");
- }
-
- /** This operation is not supported by a fixed length list. */
- void add(E value) {
- throw new UnsupportedError(
- "Cannot add to a fixed-length list");
- }
-
- /** This operation is not supported by a fixed length list. */
- void insert(int index, E value) {
- throw new UnsupportedError(
- "Cannot add to a fixed-length list");
- }
-
- /** This operation is not supported by a fixed length list. */
- void insertAll(int at, Iterable<E> iterable) {
- throw new UnsupportedError(
- "Cannot add to a fixed-length list");
- }
-
- /** This operation is not supported by a fixed length list. */
- void addAll(Iterable<E> iterable) {
- throw new UnsupportedError(
- "Cannot add to a fixed-length list");
- }
-
- /** This operation is not supported by a fixed length list. */
- bool remove(Object element) {
- throw new UnsupportedError(
- "Cannot remove from a fixed-length list");
- }
-
- /** This operation is not supported by a fixed length list. */
- void removeWhere(bool test(E element)) {
- throw new UnsupportedError(
- "Cannot remove from a fixed-length list");
- }
-
- /** This operation is not supported by a fixed length list. */
- void retainWhere(bool test(E element)) {
- throw new UnsupportedError(
- "Cannot remove from a fixed-length list");
- }
-
- /** This operation is not supported by a fixed length list. */
- void clear() {
- throw new UnsupportedError(
- "Cannot clear a fixed-length list");
- }
-
- /** This operation is not supported by a fixed length list. */
- E removeAt(int index) {
- throw new UnsupportedError(
- "Cannot remove from a fixed-length list");
- }
-
- /** This operation is not supported by a fixed length list. */
- E removeLast() {
- throw new UnsupportedError(
- "Cannot remove from a fixed-length list");
- }
-
- /** This operation is not supported by a fixed length list. */
- void removeRange(int start, int end) {
- throw new UnsupportedError(
- "Cannot remove from a fixed-length list");
- }
-
- /** This operation is not supported by a fixed length list. */
- void replaceRange(int start, int end, Iterable<E> iterable) {
- throw new UnsupportedError(
- "Cannot remove from a fixed-length list");
- }
-}
-
-/**
- * Mixin for an unmodifiable [List] class.
- *
- * This overrides all mutating methods with methods that throw.
- * This mixin is intended to be mixed in on top of [ListMixin] on
- * unmodifiable lists.
- */
-abstract class UnmodifiableListMixin<E> implements List<E> {
-
- /** This operation is not supported by an unmodifiable list. */
- void operator []=(int index, E value) {
- throw new UnsupportedError(
- "Cannot modify an unmodifiable list");
- }
-
- /** This operation is not supported by an unmodifiable list. */
- void set length(int newLength) {
- throw new UnsupportedError(
- "Cannot change the length of an unmodifiable list");
- }
-
- /** This operation is not supported by an unmodifiable list. */
- void setAll(int at, Iterable<E> iterable) {
- throw new UnsupportedError(
- "Cannot modify an unmodifiable list");
- }
-
- /** This operation is not supported by an unmodifiable list. */
- void add(E value) {
- throw new UnsupportedError(
- "Cannot add to an unmodifiable list");
- }
-
- /** This operation is not supported by an unmodifiable list. */
- void insert(int index, E element) {
- throw new UnsupportedError(
- "Cannot add to an unmodifiable list");
- }
-
- /** This operation is not supported by an unmodifiable list. */
- void insertAll(int at, Iterable<E> iterable) {
- throw new UnsupportedError(
- "Cannot add to an unmodifiable list");
- }
-
- /** This operation is not supported by an unmodifiable list. */
- void addAll(Iterable<E> iterable) {
- throw new UnsupportedError(
- "Cannot add to an unmodifiable list");
- }
-
- /** This operation is not supported by an unmodifiable list. */
- bool remove(Object element) {
- throw new UnsupportedError(
- "Cannot remove from an unmodifiable list");
- }
-
- /** This operation is not supported by an unmodifiable list. */
- void removeWhere(bool test(E element)) {
- throw new UnsupportedError(
- "Cannot remove from an unmodifiable list");
- }
-
- /** This operation is not supported by an unmodifiable list. */
- void retainWhere(bool test(E element)) {
- throw new UnsupportedError(
- "Cannot remove from an unmodifiable list");
- }
-
- /** This operation is not supported by an unmodifiable list. */
- void sort([Comparator<E> compare]) {
- throw new UnsupportedError(
- "Cannot modify an unmodifiable list");
- }
-
- /** This operation is not supported by an unmodifiable list. */
- void shuffle([Random random]) {
- throw new UnsupportedError(
- "Cannot modify an unmodifiable list");
- }
-
- /** This operation is not supported by an unmodifiable list. */
- void clear() {
- throw new UnsupportedError(
- "Cannot clear an unmodifiable list");
- }
-
- /** This operation is not supported by an unmodifiable list. */
- E removeAt(int index) {
- throw new UnsupportedError(
- "Cannot remove from an unmodifiable list");
- }
-
- /** This operation is not supported by an unmodifiable list. */
- E removeLast() {
- throw new UnsupportedError(
- "Cannot remove from an unmodifiable list");
- }
-
- /** This operation is not supported by an unmodifiable list. */
- void setRange(int start, int end, Iterable<E> iterable, [int skipCount = 0]) {
- throw new UnsupportedError(
- "Cannot modify an unmodifiable list");
- }
-
- /** This operation is not supported by an unmodifiable list. */
- void removeRange(int start, int end) {
- throw new UnsupportedError(
- "Cannot remove from an unmodifiable list");
- }
-
- /** This operation is not supported by an unmodifiable list. */
- void replaceRange(int start, int end, Iterable<E> iterable) {
- throw new UnsupportedError(
- "Cannot remove from an unmodifiable list");
- }
-
- /** This operation is not supported by an unmodifiable list. */
- void fillRange(int start, int end, [E fillValue]) {
- throw new UnsupportedError(
- "Cannot modify an unmodifiable list");
- }
-}
-
-/**
- * Abstract implementation of a fixed-length list.
- *
- * All operations are defined in terms of `length`, `operator[]` and
- * `operator[]=`, which need to be implemented.
- */
-abstract class FixedLengthListBase<E> =
- ListBase<E> with FixedLengthListMixin<E>;
-
-/**
- * Abstract implementation of an unmodifiable list.
- *
- * All operations are defined in terms of `length` and `operator[]`,
- * which need to be implemented.
- */
-abstract class UnmodifiableListBase<E> =
- ListBase<E> with UnmodifiableListMixin<E>;
-
-class _ListIndicesIterable extends ListIterable<int> {
- List _backedList;
-
- _ListIndicesIterable(this._backedList);
-
- int get length => _backedList.length;
- int elementAt(int index) {
- RangeError.checkValidIndex(index, this);
- return index;
- }
-}
-
-class ListMapView<E> implements Map<int, E> {
- List<E> _values;
-
- ListMapView(this._values);
-
- E operator[] (Object key) => containsKey(key) ? _values[key] : null;
- int get length => _values.length;
-
- Iterable<E> get values => new SubListIterable<E>(_values, 0, null);
- Iterable<int> get keys => new _ListIndicesIterable(_values);
-
- bool get isEmpty => _values.isEmpty;
- bool get isNotEmpty => _values.isNotEmpty;
- bool containsValue(Object value) => _values.contains(value);
- bool containsKey(Object key) => key is int && key >= 0 && key < length;
-
- void forEach(void f(int key, E value)) {
- int length = _values.length;
- for (int i = 0; i < length; i++) {
- f(i, _values[i]);
- if (length != _values.length) {
- throw new ConcurrentModificationError(_values);
- }
- }
- }
-
- /** This operation is not supported by an unmodifiable map. */
- void operator[]= (int key, E value) {
- throw new UnsupportedError("Cannot modify an unmodifiable map");
- }
-
- /** This operation is not supported by an unmodifiable map. */
- E putIfAbsent(int key, E ifAbsent()) {
- throw new UnsupportedError("Cannot modify an unmodifiable map");
- }
-
- /** This operation is not supported by an unmodifiable map. */
- E remove(Object key) {
- throw new UnsupportedError("Cannot modify an unmodifiable map");
- }
-
- /** This operation is not supported by an unmodifiable map. */
- void clear() {
- throw new UnsupportedError("Cannot modify an unmodifiable map");
- }
-
- /** This operation is not supported by an unmodifiable map. */
- void addAll(Map<int, E> other) {
- throw new UnsupportedError("Cannot modify an unmodifiable map");
- }
-
- String toString() => Maps.mapToString(this);
-}
-
-class ReversedListIterable<E> extends ListIterable<E> {
- Iterable<E> _source;
- ReversedListIterable(this._source);
-
- int get length => _source.length;
-
- E elementAt(int index) => _source.elementAt(_source.length - 1 - index);
-}
-
-/**
- * Creates errors thrown by unmodifiable lists when they are attempted modified.
- *
- * This class creates [UnsupportedError]s with specialized messages.
- */
-abstract class UnmodifiableListError {
- /** Error thrown when trying to add elements to an unmodifiable list. */
- static UnsupportedError add()
- => new UnsupportedError("Cannot add to unmodifiable List");
-
- /** Error thrown when trying to add elements to an unmodifiable list. */
- static UnsupportedError change()
- => new UnsupportedError(
- "Cannot change the content of an unmodifiable List");
-
- /** Error thrown when trying to change the length of an unmodifiable list. */
- static UnsupportedError length()
- => new UnsupportedError("Cannot change length of unmodifiable List");
-
- /** Error thrown when trying to remove elements from an unmodifiable list. */
- static UnsupportedError remove()
- => new UnsupportedError("Cannot remove from unmodifiable List");
-}
-
-/**
- * Creates errors thrown by non-growable lists when they are attempted modified.
- *
- * This class creates [UnsupportedError]s with specialized messages.
- */
-abstract class NonGrowableListError {
- /** Error thrown when trying to add elements to an non-growable list. */
- static UnsupportedError add()
- => new UnsupportedError("Cannot add to non-growable List");
-
- /** Error thrown when trying to change the length of an non-growable list. */
- static UnsupportedError length()
- => new UnsupportedError("Cannot change length of non-growable List");
-
- /** Error thrown when trying to remove elements from an non-growable list. */
- static UnsupportedError remove()
- => new UnsupportedError("Cannot remove from non-growable List");
-}
-
-/**
- * Converts a growable list to a fixed length list with the same elements.
- *
- * For internal use only.
- * Only works on growable lists as created by `[]` or `new List()`.
- * May throw on any other list.
- *
- * The operation is efficient. It doesn't copy the elements, but converts
- * the existing list directly to a fixed length list.
- * That means that it is a destructive conversion.
- * The original list should not be used afterwards.
- *
- * The returned list may be the same list as the original,
- * or it may be a different list (according to [identical]).
- * The original list may have changed type to be a fixed list,
- * or become empty or been otherwise modified.
- * It will still be a valid object, so references to it will not, e.g., crash
- * the runtime if accessed, but no promises are made wrt. its contents.
- *
- * This unspecified behavior is the reason the function is not exposed to
- * users. We allow the underlying implementation to make the most efficient
- * conversion, at the cost of leaving the original list in an unspecified
- * state.
- */
-external List/*<E>*/ makeListFixedLength/*<E>*/(List/*<E>*/ growableList);
-
-/**
- * Converts a fixed-length list to an unmodifiable list.
- *
- * For internal use only.
- * Only works for core fixed-length lists as created by `new List(length)`,
- * or as returned by [makeListFixedLength].
- *
- * The operation is efficient. It doesn't copy the elements, but converts
- * the existing list directly to a fixed length list.
- * That means that it is a destructive conversion.
- * The original list should not be used afterwards.
- *
- * The unmodifiable list type is similar to the one used by const lists.
- */
-external List/*<E>*/ makeFixedListUnmodifiable/*<E>*/(
- List/*<E>*/ fixedLengthList);
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/internal/lists.dart b/pkg/dev_compiler/tool/input_sdk/lib/internal/lists.dart
deleted file mode 100644
index 0f5d8e7..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/internal/lists.dart
+++ /dev/null
@@ -1,90 +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.
-
-part of dart._internal;
-
-class Lists {
- static void copy(List src, int srcStart,
- List dst, int dstStart, int count) {
- if (srcStart < dstStart) {
- for (int i = srcStart + count - 1, j = dstStart + count - 1;
- i >= srcStart; i--, j--) {
- dst[j] = src[i];
- }
- } else {
- for (int i = srcStart, j = dstStart; i < srcStart + count; i++, j++) {
- dst[j] = src[i];
- }
- }
- }
-
- static bool areEqual(List a, var b) {
- if (identical(a, b)) return true;
- if (!(b is List)) return false;
- int length = a.length;
- if (length != b.length) return false;
-
- for (int i = 0; i < length; i++) {
- if (!identical(a[i], b[i])) return false;
- }
- return true;
- }
-
- /**
- * Returns the index in the list [a] of the given [element], starting
- * the search at index [startIndex] to [endIndex] (exclusive).
- * Returns -1 if [element] is not found.
- */
- static int indexOf(List a,
- Object element,
- int startIndex,
- int endIndex) {
- if (startIndex >= a.length) {
- return -1;
- }
- if (startIndex < 0) {
- startIndex = 0;
- }
- for (int i = startIndex; i < endIndex; i++) {
- if (a[i] == element) {
- return i;
- }
- }
- return -1;
- }
-
- /**
- * Returns the last index in the list [a] of the given [element], starting
- * the search at index [startIndex] to 0.
- * Returns -1 if [element] is not found.
- */
- static int lastIndexOf(List a, Object element, int startIndex) {
- if (startIndex < 0) {
- return -1;
- }
- if (startIndex >= a.length) {
- startIndex = a.length - 1;
- }
- for (int i = startIndex; i >= 0; i--) {
- if (a[i] == element) {
- return i;
- }
- }
- return -1;
- }
-
- static void indicesCheck(List a, int start, int end) {
- RangeError.checkValidRange(start, end, a.length);
- }
-
- static void rangeCheck(List a, int start, int length) {
- RangeError.checkNotNegative(length);
- RangeError.checkNotNegative(start);
- if (start + length > a.length) {
- String message = "$start + $length must be in the range [0..${a.length}]";
- throw new RangeError.range(length, 0, a.length - start,
- "length", message);
- }
- }
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/internal/print.dart b/pkg/dev_compiler/tool/input_sdk/lib/internal/print.dart
deleted file mode 100644
index c3e23b8..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/internal/print.dart
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-part of dart._internal;
-
-/**
- * This function is set by the first allocation of a Zone.
- *
- * Once the function is set the core `print` function calls this closure instead
- * of [printToConsole].
- *
- * This decouples the core library from the async library.
- */
-Function printToZone = null;
-
-external void printToConsole(String line);
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/internal/sort.dart b/pkg/dev_compiler/tool/input_sdk/lib/internal/sort.dart
deleted file mode 100644
index 63037ea..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/internal/sort.dart
+++ /dev/null
@@ -1,344 +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.
-
-part of dart._internal;
-
-/**
- * Dual-Pivot Quicksort algorithm.
- *
- * This class implements the dual-pivot quicksort algorithm as presented in
- * Vladimir Yaroslavskiy's paper.
- *
- * Some improvements have been copied from Android's implementation.
- */
-class Sort {
- // When a list has less then [:_INSERTION_SORT_THRESHOLD:] elements it will
- // be sorted by an insertion sort.
- static const int _INSERTION_SORT_THRESHOLD = 32;
-
- /**
- * Sorts all elements of the given list [:a:] according to the given
- * [:compare:] function.
- *
- * The [:compare:] function takes two arguments [:x:] and [:y:] and returns
- * -1 if [:x < y:],
- * 0 if [:x == y:], and
- * 1 if [:x > y:].
- *
- * The function's behavior must be consistent. It must not return different
- * results for the same values.
- */
- static void sort/*<E>*/(List/*<E>*/ a, int compare(dynamic /*=E*/ a, dynamic /*=E*/ b)) {
- _doSort(a, 0, a.length - 1, compare);
- }
-
- /**
- * Sorts all elements in the range [:from:] (inclusive) to [:to:] (exclusive)
- * of the given list [:a:].
- *
- * If the given range is invalid an "OutOfRange" error is raised.
- * TODO(floitsch): do we want an error?
- *
- * See [:sort:] for requirements of the [:compare:] function.
- */
- static void sortRange/*<E>*/(List/*<E>*/ a, int from, int to, int compare(dynamic /*=E*/ a, dynamic /*=E*/ b)) {
- if ((from < 0) || (to > a.length) || (to < from)) {
- throw "OutOfRange";
- }
- _doSort(a, from, to - 1, compare);
- }
-
- /**
- * Sorts the list in the interval [:left:] to [:right:] (both inclusive).
- */
- static void _doSort/*<E>*/(List/*<E>*/ a, int left, int right, int compare(dynamic /*=E*/ a, dynamic /*=E*/ b)) {
- if ((right - left) <= _INSERTION_SORT_THRESHOLD) {
- _insertionSort(a, left, right, compare);
- } else {
- _dualPivotQuicksort(a, left, right, compare);
- }
- }
-
- static void _insertionSort/*<E>*/(List/*<E>*/ a, int left, int right, int compare(dynamic /*=E*/ a, dynamic /*=E*/ b)) {
- for (int i = left + 1; i <= right; i++) {
- var el = a[i];
- int j = i;
- while ((j > left) && (compare(a[j - 1], el) > 0)) {
- a[j] = a[j - 1];
- j--;
- }
- a[j] = el;
- }
- }
-
- static void _dualPivotQuicksort/*<E>*/(List/*<E>*/ a,
- int left, int right,
- int compare(dynamic /*=E*/ a, dynamic /*=E*/ b)) {
- assert(right - left > _INSERTION_SORT_THRESHOLD);
-
- // Compute the two pivots by looking at 5 elements.
- int sixth = (right - left + 1) ~/ 6;
- int index1 = left + sixth;
- int index5 = right - sixth;
- int index3 = (left + right) ~/ 2; // The midpoint.
- int index2 = index3 - sixth;
- int index4 = index3 + sixth;
-
- var el1 = a[index1];
- var el2 = a[index2];
- var el3 = a[index3];
- var el4 = a[index4];
- var el5 = a[index5];
-
- // Sort the selected 5 elements using a sorting network.
- if (compare(el1, el2) > 0) { var t = el1; el1 = el2; el2 = t; }
- if (compare(el4, el5) > 0) { var t = el4; el4 = el5; el5 = t; }
- if (compare(el1, el3) > 0) { var t = el1; el1 = el3; el3 = t; }
- if (compare(el2, el3) > 0) { var t = el2; el2 = el3; el3 = t; }
- if (compare(el1, el4) > 0) { var t = el1; el1 = el4; el4 = t; }
- if (compare(el3, el4) > 0) { var t = el3; el3 = el4; el4 = t; }
- if (compare(el2, el5) > 0) { var t = el2; el2 = el5; el5 = t; }
- if (compare(el2, el3) > 0) { var t = el2; el2 = el3; el3 = t; }
- if (compare(el4, el5) > 0) { var t = el4; el4 = el5; el5 = t; }
-
- var pivot1 = el2;
- var pivot2 = el4;
-
- // el2 and el4 have been saved in the pivot variables. They will be written
- // back, once the partioning is finished.
- a[index1] = el1;
- a[index3] = el3;
- a[index5] = el5;
-
- a[index2] = a[left];
- a[index4] = a[right];
-
- int less = left + 1; // First element in the middle partition.
- int great = right - 1; // Last element in the middle partition.
-
- bool pivots_are_equal = (compare(pivot1, pivot2) == 0);
- if (pivots_are_equal) {
- var pivot = pivot1;
- // Degenerated case where the partioning becomes a dutch national flag
- // problem.
- //
- // [ | < pivot | == pivot | unpartitioned | > pivot | ]
- // ^ ^ ^ ^ ^
- // left less k great right
- //
- // a[left] and a[right] are undefined and are filled after the
- // partitioning.
- //
- // Invariants:
- // 1) for x in ]left, less[ : x < pivot.
- // 2) for x in [less, k[ : x == pivot.
- // 3) for x in ]great, right[ : x > pivot.
- for (int k = less; k <= great; k++) {
- var ak = a[k];
- int comp = compare(ak, pivot);
- if (comp == 0) continue;
- if (comp < 0) {
- if (k != less) {
- a[k] = a[less];
- a[less] = ak;
- }
- less++;
- } else {
- // comp > 0.
- //
- // Find the first element <= pivot in the range [k - 1, great] and
- // put [:ak:] there. We know that such an element must exist:
- // When k == less, then el3 (which is equal to pivot) lies in the
- // interval. Otherwise a[k - 1] == pivot and the search stops at k-1.
- // Note that in the latter case invariant 2 will be violated for a
- // short amount of time. The invariant will be restored when the
- // pivots are put into their final positions.
- while (true) {
- comp = compare(a[great], pivot);
- if (comp > 0) {
- great--;
- // This is the only location in the while-loop where a new
- // iteration is started.
- continue;
- } else if (comp < 0) {
- // Triple exchange.
- a[k] = a[less];
- a[less++] = a[great];
- a[great--] = ak;
- break;
- } else {
- // comp == 0;
- a[k] = a[great];
- a[great--] = ak;
- // Note: if great < k then we will exit the outer loop and fix
- // invariant 2 (which we just violated).
- break;
- }
- }
- }
- }
- } else {
- // We partition the list into three parts:
- // 1. < pivot1
- // 2. >= pivot1 && <= pivot2
- // 3. > pivot2
- //
- // During the loop we have:
- // [ | < pivot1 | >= pivot1 && <= pivot2 | unpartitioned | > pivot2 | ]
- // ^ ^ ^ ^ ^
- // left less k great right
- //
- // a[left] and a[right] are undefined and are filled after the
- // partitioning.
- //
- // Invariants:
- // 1. for x in ]left, less[ : x < pivot1
- // 2. for x in [less, k[ : pivot1 <= x && x <= pivot2
- // 3. for x in ]great, right[ : x > pivot2
- for (int k = less; k <= great; k++) {
- var ak = a[k];
- int comp_pivot1 = compare(ak, pivot1);
- if (comp_pivot1 < 0) {
- if (k != less) {
- a[k] = a[less];
- a[less] = ak;
- }
- less++;
- } else {
- int comp_pivot2 = compare(ak, pivot2);
- if (comp_pivot2 > 0) {
- while (true) {
- int comp = compare(a[great], pivot2);
- if (comp > 0) {
- great--;
- if (great < k) break;
- // This is the only location inside the loop where a new
- // iteration is started.
- continue;
- } else {
- // a[great] <= pivot2.
- comp = compare(a[great], pivot1);
- if (comp < 0) {
- // Triple exchange.
- a[k] = a[less];
- a[less++] = a[great];
- a[great--] = ak;
- } else {
- // a[great] >= pivot1.
- a[k] = a[great];
- a[great--] = ak;
- }
- break;
- }
- }
- }
- }
- }
- }
-
- // Move pivots into their final positions.
- // We shrunk the list from both sides (a[left] and a[right] have
- // meaningless values in them) and now we move elements from the first
- // and third partition into these locations so that we can store the
- // pivots.
- a[left] = a[less - 1];
- a[less - 1] = pivot1;
- a[right] = a[great + 1];
- a[great + 1] = pivot2;
-
- // The list is now partitioned into three partitions:
- // [ < pivot1 | >= pivot1 && <= pivot2 | > pivot2 ]
- // ^ ^ ^ ^
- // left less great right
-
- // Recursive descent. (Don't include the pivot values.)
- _doSort(a, left, less - 2, compare);
- _doSort(a, great + 2, right, compare);
-
- if (pivots_are_equal) {
- // All elements in the second partition are equal to the pivot. No
- // need to sort them.
- return;
- }
-
- // In theory it should be enough to call _doSort recursively on the second
- // partition.
- // The Android source however removes the pivot elements from the recursive
- // call if the second partition is too large (more than 2/3 of the list).
- if (less < index1 && great > index5) {
- while (compare(a[less], pivot1) == 0) { less++; }
- while (compare(a[great], pivot2) == 0) { great--; }
-
- // Copy paste of the previous 3-way partitioning with adaptions.
- //
- // We partition the list into three parts:
- // 1. == pivot1
- // 2. > pivot1 && < pivot2
- // 3. == pivot2
- //
- // During the loop we have:
- // [ == pivot1 | > pivot1 && < pivot2 | unpartitioned | == pivot2 ]
- // ^ ^ ^
- // less k great
- //
- // Invariants:
- // 1. for x in [ *, less[ : x == pivot1
- // 2. for x in [less, k[ : pivot1 < x && x < pivot2
- // 3. for x in ]great, * ] : x == pivot2
- for (int k = less; k <= great; k++) {
- var ak = a[k];
- int comp_pivot1 = compare(ak, pivot1);
- if (comp_pivot1 == 0) {
- if (k != less) {
- a[k] = a[less];
- a[less] = ak;
- }
- less++;
- } else {
- int comp_pivot2 = compare(ak, pivot2);
- if (comp_pivot2 == 0) {
- while (true) {
- int comp = compare(a[great], pivot2);
- if (comp == 0) {
- great--;
- if (great < k) break;
- // This is the only location inside the loop where a new
- // iteration is started.
- continue;
- } else {
- // a[great] < pivot2.
- comp = compare(a[great], pivot1);
- if (comp < 0) {
- // Triple exchange.
- a[k] = a[less];
- a[less++] = a[great];
- a[great--] = ak;
- } else {
- // a[great] == pivot1.
- a[k] = a[great];
- a[great--] = ak;
- }
- break;
- }
- }
- }
- }
- }
- // The second partition has now been cleared of pivot elements and looks
- // as follows:
- // [ * | > pivot1 && < pivot2 | * ]
- // ^ ^
- // less great
- // Sort the second partition using recursive descent.
- _doSort(a, less, great, compare);
- } else {
- // The second partition looks as follows:
- // [ * | >= pivot1 && <= pivot2 | * ]
- // ^ ^
- // less great
- // Simply sort it by recursive descent.
- _doSort(a, less, great, compare);
- }
- }
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/internal/symbol.dart b/pkg/dev_compiler/tool/input_sdk/lib/internal/symbol.dart
deleted file mode 100644
index b1aa855..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/internal/symbol.dart
+++ /dev/null
@@ -1,152 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-part of dart._internal;
-
-/**
- * Implementation of [core.Symbol]. This class uses the same name as
- * a core class so a user can't tell the difference.
- *
- * The purpose of this class is to hide [_name] from user code, but
- * make it accessible to Dart platform code via the static method
- * [getName].
- */
-class Symbol implements core.Symbol {
- final String _name;
-
- // Used internally by DDC to map ES6 symbols to Dart.
- final dynamic _nativeSymbol;
-
- /**
- * Source of RegExp matching Dart reserved words.
- *
- * Reserved words are not allowed as identifiers.
- */
- static const String reservedWordRE =
- r'(?:assert|break|c(?:a(?:se|tch)|lass|on(?:st|tinue))|d(?:efault|o)|'
- r'e(?:lse|num|xtends)|f(?:alse|inal(?:ly)?|or)|i[fns]|n(?:ew|ull)|'
- r'ret(?:hrow|urn)|s(?:uper|witch)|t(?:h(?:is|row)|r(?:ue|y))|'
- r'v(?:ar|oid)|w(?:hile|ith))';
- /**
- * Source of RegExp matching any public identifier.
- *
- * A public identifier is a valid identifier (not a reserved word)
- * that doesn't start with '_'.
- */
- static const String publicIdentifierRE =
- r'(?!' '$reservedWordRE' r'\b(?!\$))[a-zA-Z$][\w$]*';
- /**
- * Source of RegExp matching any identifier.
- *
- * It matches identifiers but not reserved words. The identifiers
- * may start with '_'.
- */
- static const String identifierRE =
- r'(?!' '$reservedWordRE' r'\b(?!\$))[a-zA-Z$_][\w$]*';
- /**
- * Source of RegExp matching a declarable operator names.
- *
- * The operators that can be declared using `operator` declarations are
- * also the only ones allowed as symbols. The name of the oeprators is
- * the same as the operator itself except for unary minus, where the name
- * is "unary-".
- */
- static const String operatorRE =
- r'(?:[\-+*/%&|^]|\[\]=?|==|~/?|<[<=]?|>[>=]?|unary-)';
-
- // Grammar if symbols:
- // symbol ::= qualifiedName | <empty>
- // qualifiedName ::= publicIdentifier '.' qualifiedName | name
- // name ::= publicIdentifier
- // | publicIdentifier '='
- // | operator
- // where publicIdentifier is any valid identifier (not a reserved word)
- // that isn't private (doesn't start with '_').
- //
- // Railroad diagram of the accepted grammar:
- //
- // /----------------\
- // | |
- // | /-[.]-/ /-[=]-\
- // \ / / \
- // -------[id]------------------------->
- // \ /
- // \------[operator]---/
- // \ /
- // \------------/
- //
-
- /**
- * RegExp that validates a non-empty non-private symbol.
- *
- * The empty symbol is handled before this regexp is used, and is not
- * accepted.
- */
- static final RegExp publicSymbolPattern = new RegExp(
- '^(?:$operatorRE\$|$publicIdentifierRE(?:=?\$|[.](?!\$)))+?\$');
-
- // The grammar of symbols that may be private is the same as for public
- // symbols, except that "publicIdentifier" is replaced by "identifier",
- // which matches any identifier.
-
- /**
- * RegExp that validates a non-empty symbol.
- *
- * Private symbols are accepted.
- *
- * The empty symbol is handled before this regexp is used, and is not
- * accepted.
- */
- static final RegExp symbolPattern =
- new RegExp('^(?:$operatorRE\$|$identifierRE(?:=?\$|[.](?!\$)))+?\$');
-
- external const Symbol(String name);
-
- external const Symbol.es6(String name, nativeSymbol);
-
- /**
- * Platform-private method used by the mirror system to create
- * otherwise invalid names.
- */
- const Symbol.unvalidated(this._name) : this._nativeSymbol = null;
-
- // This is called by dart2js.
- Symbol.validated(String name)
- : this._name = validatePublicSymbol(name),
- this._nativeSymbol = null;
-
- bool operator ==(Object other) =>
- other is Symbol &&
- _name == other._name &&
- _nativeSymbol == other._nativeSymbol;
-
- external int get hashCode;
-
- toString() => 'Symbol("$_name")';
-
- /// Platform-private accessor which cannot be called from user libraries.
- static String getName(Symbol symbol) => symbol._name;
-
- static dynamic getNativeSymbol(Symbol symbol) => symbol._nativeSymbol;
-
- static String validatePublicSymbol(String name) {
- if (name.isEmpty || publicSymbolPattern.hasMatch(name)) return name;
- if (name.startsWith('_')) {
- // There may be other private parts in a qualified name than the first
- // one, but this is a common case that deserves a specific error
- // message.
- throw new ArgumentError('"$name" is a private identifier');
- }
- throw new ArgumentError('"$name" is not a valid (qualified) symbol name');
- }
-
- /**
- * Checks whether name is a valid symbol name.
- *
- * This test allows both private and non-private symbols.
- */
- static bool isValidSymbol(String name) {
- return (name.isEmpty || symbolPattern.hasMatch(name));
- }
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/io/bytes_builder.dart b/pkg/dev_compiler/tool/input_sdk/lib/io/bytes_builder.dart
deleted file mode 100644
index 979e657..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/io/bytes_builder.dart
+++ /dev/null
@@ -1,206 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-part of dart.io;
-
-/**
- * Builds a list of bytes, allowing bytes and lists of bytes to be added at the
- * end.
- *
- * Used to efficiently collect bytes and lists of bytes.
- */
-abstract class BytesBuilder {
- /**
- * Construct a new empty [BytesBuilder].
- *
- * If [copy] is true, the data is always copied when added to the list. If
- * it [copy] is false, the data is only copied if needed. That means that if
- * the lists are changed after added to the [BytesBuilder], it may effect the
- * output. Default is `true`.
- */
- factory BytesBuilder({bool copy: true}) {
- if (copy) {
- return new _CopyingBytesBuilder();
- } else {
- return new _BytesBuilder();
- }
- }
-
- /**
- * Appends [bytes] to the current contents of the builder.
- *
- * Each value of [bytes] will be bit-representation truncated to the range
- * 0 .. 255.
- */
- void add(List<int> bytes);
-
- /**
- * Append [byte] to the current contents of the builder.
- *
- * The [byte] will be bit-representation truncated to the range 0 .. 255.
- */
- void addByte(int byte);
-
- /**
- * Returns the contents of `this` and clears `this`.
- *
- * The list returned is a view of the internal buffer, limited to the
- * [length].
- */
- List<int> takeBytes();
-
- /**
- * Returns a copy of the current contents of the builder.
- *
- * Leaves the contents of the builder intact.
- */
- List<int> toBytes();
-
- /**
- * The number of bytes in the builder.
- */
- int get length;
-
- /**
- * Returns `true` if the buffer is empty.
- */
- bool get isEmpty;
-
- /**
- * Returns `true` if the buffer is not empty.
- */
- bool get isNotEmpty;
-
- /**
- * Clear the contents of the builder.
- */
- void clear();
-}
-
-
-class _CopyingBytesBuilder implements BytesBuilder {
- // Start with 1024 bytes.
- static const int _INIT_SIZE = 1024;
-
- int _length = 0;
- Uint8List _buffer;
-
- void add(List<int> bytes) {
- int bytesLength = bytes.length;
- if (bytesLength == 0) return;
- int required = _length + bytesLength;
- if (_buffer == null) {
- int size = _pow2roundup(required);
- size = max(size, _INIT_SIZE);
- _buffer = new Uint8List(size);
- } else if (_buffer.length < required) {
- // We will create a list in the range of 2-4 times larger than
- // required.
- int size = _pow2roundup(required) * 2;
- var newBuffer = new Uint8List(size);
- newBuffer.setRange(0, _buffer.length, _buffer);
- _buffer = newBuffer;
- }
- assert(_buffer.length >= required);
- if (bytes is Uint8List) {
- _buffer.setRange(_length, required, bytes);
- } else {
- for (int i = 0; i < bytesLength; i++) {
- _buffer[_length + i] = bytes[i];
- }
- }
- _length = required;
- }
-
- void addByte(int byte) { add([byte]); }
-
- List<int> takeBytes() {
- if (_buffer == null) return new Uint8List(0);
- var buffer = new Uint8List.view(_buffer.buffer, 0, _length);
- clear();
- return buffer;
- }
-
- List<int> toBytes() {
- if (_buffer == null) return new Uint8List(0);
- return new Uint8List.fromList(
- new Uint8List.view(_buffer.buffer, 0, _length));
- }
-
- int get length => _length;
-
- bool get isEmpty => _length == 0;
-
- bool get isNotEmpty => _length != 0;
-
- void clear() {
- _length = 0;
- _buffer = null;
- }
-
- int _pow2roundup(int x) {
- --x;
- x |= x >> 1;
- x |= x >> 2;
- x |= x >> 4;
- x |= x >> 8;
- x |= x >> 16;
- return x + 1;
- }
-}
-
-
-class _BytesBuilder implements BytesBuilder {
- int _length = 0;
- final _chunks = <List<int>>[];
-
- void add(List<int> bytes) {
- if (bytes is! Uint8List) {
- bytes = new Uint8List.fromList(bytes);
- }
- _chunks.add(bytes);
- _length += bytes.length;
- }
-
- void addByte(int byte) { add([byte]); }
-
- List<int> takeBytes() {
- if (_chunks.length == 0) return new Uint8List(0);
- if (_chunks.length == 1) {
- var buffer = _chunks.single;
- clear();
- return buffer;
- }
- var buffer = new Uint8List(_length);
- int offset = 0;
- for (var chunk in _chunks) {
- buffer.setRange(offset, offset + chunk.length, chunk);
- offset += chunk.length;
- }
- clear();
- return buffer;
- }
-
- List<int> toBytes() {
- if (_chunks.length == 0) return new Uint8List(0);
- var buffer = new Uint8List(_length);
- int offset = 0;
- for (var chunk in _chunks) {
- buffer.setRange(offset, offset + chunk.length, chunk);
- offset += chunk.length;
- }
- return buffer;
- }
-
- int get length => _length;
-
- bool get isEmpty => _length == 0;
-
- bool get isNotEmpty => _length != 0;
-
- void clear() {
- _length = 0;
- _chunks.clear();
- }
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/io/common.dart b/pkg/dev_compiler/tool/input_sdk/lib/io/common.dart
deleted file mode 100644
index ea35580..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/io/common.dart
+++ /dev/null
@@ -1,124 +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.
-
-part of dart.io;
-
-// Constants used when working with native ports.
-// These must match the constants in runtime/bin/dartutils.h class CObject.
-const int _SUCCESS_RESPONSE = 0;
-const int _ILLEGAL_ARGUMENT_RESPONSE = 1;
-const int _OSERROR_RESPONSE = 2;
-const int _FILE_CLOSED_RESPONSE = 3;
-
-const int _ERROR_RESPONSE_ERROR_TYPE = 0;
-const int _OSERROR_RESPONSE_ERROR_CODE = 1;
-const int _OSERROR_RESPONSE_MESSAGE = 2;
-
-// Functions used to receive exceptions from native ports.
-bool _isErrorResponse(response) =>
- response is List && response[0] != _SUCCESS_RESPONSE;
-
-/**
- * Returns an Exception or an Error
- */
-_exceptionFromResponse(response, String message, String path) {
- assert(_isErrorResponse(response));
- switch (response[_ERROR_RESPONSE_ERROR_TYPE]) {
- case _ILLEGAL_ARGUMENT_RESPONSE:
- return new ArgumentError();
- case _OSERROR_RESPONSE:
- var err = new OSError(response[_OSERROR_RESPONSE_MESSAGE],
- response[_OSERROR_RESPONSE_ERROR_CODE]);
- return new FileSystemException(message, path, err);
- case _FILE_CLOSED_RESPONSE:
- return new FileSystemException("File closed", path);
- default:
- return new Exception("Unknown error");
- }
-}
-
-/**
- * Base class for all IO related exceptions.
- */
-abstract class IOException implements Exception {
- String toString() => "IOException";
-}
-
-/**
- * An [OSError] object holds information about an error from the
- * operating system.
- */
-class OSError {
- /** Constant used to indicate that no OS error code is available. */
- static const int noErrorCode = -1;
-
- /**
- * 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;
-
- /** Creates an OSError object from a message and an errorCode. */
- const OSError([this.message = "", this.errorCode = noErrorCode]);
-
- /** Converts an OSError object to a string representation. */
- String toString() {
- StringBuffer sb = new StringBuffer();
- sb.write("OS Error");
- if (!message.isEmpty) {
- sb..write(": ")
- ..write(message);
- if (errorCode != noErrorCode) {
- sb..write(", errno = ")
- ..write(errorCode.toString());
- }
- } else if (errorCode != noErrorCode) {
- sb..write(": errno = ")
- ..write(errorCode.toString());
- }
- return sb.toString();
- }
-}
-
-
-// Object for holding a buffer and an offset.
-class _BufferAndStart {
- List buffer;
- int start;
- _BufferAndStart(this.buffer, this.start);
-}
-
-// Ensure that the input List can be serialized through a native port.
-// Only Int8List and Uint8List Lists are serialized directly.
-// All other lists are first copied into a Uint8List. This has the added
-// benefit that it is faster to access from the C code as well.
-_BufferAndStart _ensureFastAndSerializableByteData(
- List buffer, int start, int end) {
- if (buffer is Uint8List || buffer is Int8List) {
- return new _BufferAndStart(buffer, start);
- }
- int length = end - start;
- var newBuffer = new Uint8List(length);
- int j = start;
- for (int i = 0; i < length; i++) {
- int value = buffer[j];
- if (value is! int) {
- throw new ArgumentError("List element is not an integer at index $j");
- }
- newBuffer[i] = value;
- j++;
- }
- return new _BufferAndStart(newBuffer, 0);
-}
-
-
-class _IOCrypto {
- external static Uint8List getRandomBytes(int count);
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/io/crypto.dart b/pkg/dev_compiler/tool/input_sdk/lib/io/crypto.dart
deleted file mode 100644
index 82cff5e..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/io/crypto.dart
+++ /dev/null
@@ -1,448 +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.
-
-part of dart.io;
-
-class _CryptoUtils {
- static const int PAD = 61; // '='
- static const int CR = 13; // '\r'
- static const int LF = 10; // '\n'
- static const int LINE_LENGTH = 76;
-
- static const String _encodeTable =
- "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
-
- static const String _encodeTableUrlSafe =
- "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
-
- // Lookup table used for finding Base 64 alphabet index of a given byte.
- // -2 : Outside Base 64 alphabet.
- // -1 : '\r' or '\n'
- // 0 : = (Padding character).
- // >0 : Base 64 alphabet index of given byte.
- static const List<int> _decodeTable =
- const [ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -1, -2, -2, -1, -2, -2,
- -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
- -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, 62, -2, 62, -2, 63,
- 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -2, -2, -2, 0, -2, -2,
- -2, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
- 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -2, -2, -2, -2, 63,
- -2, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
- 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -2, -2, -2, -2, -2,
- -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
- -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
- -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
- -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
- -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
- -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
- -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
- -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2 ];
-
- static String bytesToHex(List<int> bytes) {
- var result = new StringBuffer();
- for (var part in bytes) {
- result.write('${part < 16 ? '0' : ''}${part.toRadixString(16)}');
- }
- return result.toString();
- }
-
- static String bytesToBase64(List<int> bytes,
- [bool urlSafe = false,
- bool addLineSeparator = false]) {
- int len = bytes.length;
- if (len == 0) {
- return "";
- }
- final String lookup = urlSafe ? _encodeTableUrlSafe : _encodeTable;
- // Size of 24 bit chunks.
- final int remainderLength = len.remainder(3);
- final int chunkLength = len - remainderLength;
- // Size of base output.
- int outputLen = ((len ~/ 3) * 4) + ((remainderLength > 0) ? 4 : 0);
- // Add extra for line separators.
- if (addLineSeparator) {
- outputLen += ((outputLen - 1) ~/ LINE_LENGTH) << 1;
- }
- List<int> out = new List<int>(outputLen);
-
- // Encode 24 bit chunks.
- int j = 0, i = 0, c = 0;
- while (i < chunkLength) {
- int x = ((bytes[i++] << 16) & 0xFFFFFF) |
- ((bytes[i++] << 8) & 0xFFFFFF) |
- bytes[i++];
- out[j++] = lookup.codeUnitAt(x >> 18);
- out[j++] = lookup.codeUnitAt((x >> 12) & 0x3F);
- out[j++] = lookup.codeUnitAt((x >> 6) & 0x3F);
- out[j++] = lookup.codeUnitAt(x & 0x3f);
- // Add optional line separator for each 76 char output.
- if (addLineSeparator && ++c == 19 && j < outputLen - 2) {
- out[j++] = CR;
- out[j++] = LF;
- c = 0;
- }
- }
-
- // If input length if not a multiple of 3, encode remaining bytes and
- // add padding.
- if (remainderLength == 1) {
- int x = bytes[i];
- out[j++] = lookup.codeUnitAt(x >> 2);
- out[j++] = lookup.codeUnitAt((x << 4) & 0x3F);
- out[j++] = PAD;
- out[j++] = PAD;
- } else if (remainderLength == 2) {
- int x = bytes[i];
- int y = bytes[i + 1];
- out[j++] = lookup.codeUnitAt(x >> 2);
- out[j++] = lookup.codeUnitAt(((x << 4) | (y >> 4)) & 0x3F);
- out[j++] = lookup.codeUnitAt((y << 2) & 0x3F);
- out[j++] = PAD;
- }
-
- return new String.fromCharCodes(out);
- }
-
- static List<int> base64StringToBytes(String input,
- [bool ignoreInvalidCharacters = true]) {
- int len = input.length;
- if (len == 0) {
- return new List<int>(0);
- }
-
- // Count '\r', '\n' and illegal characters, For illegal characters,
- // if [ignoreInvalidCharacters] is false, throw an exception.
- int extrasLen = 0;
- for (int i = 0; i < len; i++) {
- int c = _decodeTable[input.codeUnitAt(i)];
- if (c < 0) {
- extrasLen++;
- if(c == -2 && !ignoreInvalidCharacters) {
- throw new FormatException('Invalid character: ${input[i]}');
- }
- }
- }
-
- if ((len - extrasLen) % 4 != 0) {
- throw new FormatException('''Size of Base 64 characters in Input
- must be a multiple of 4. Input: $input''');
- }
-
- // Count pad characters, ignore illegal characters at the end.
- int padLength = 0;
- for (int i = len - 1; i >= 0; i--) {
- int currentCodeUnit = input.codeUnitAt(i);
- if (_decodeTable[currentCodeUnit] > 0) break;
- if (currentCodeUnit == PAD) padLength++;
- }
- int outputLen = (((len - extrasLen) * 6) >> 3) - padLength;
- List<int> out = new List<int>(outputLen);
-
- for (int i = 0, o = 0; o < outputLen;) {
- // Accumulate 4 valid 6 bit Base 64 characters into an int.
- int x = 0;
- for (int j = 4; j > 0;) {
- int c = _decodeTable[input.codeUnitAt(i++)];
- if (c >= 0) {
- x = ((x << 6) & 0xFFFFFF) | c;
- j--;
- }
- }
- out[o++] = x >> 16;
- if (o < outputLen) {
- out[o++] = (x >> 8) & 0xFF;
- if (o < outputLen) out[o++] = x & 0xFF;
- }
- }
- return out;
- }
-
-}
-
-// Constants.
-const _MASK_8 = 0xff;
-const _MASK_32 = 0xffffffff;
-const _BITS_PER_BYTE = 8;
-const _BYTES_PER_WORD = 4;
-
-// Base class encapsulating common behavior for cryptographic hash
-// functions.
-abstract class _HashBase {
- // Hasher state.
- final int _chunkSizeInWords;
- final int _digestSizeInWords;
- final bool _bigEndianWords;
- int _lengthInBytes = 0;
- List<int> _pendingData;
- List<int> _currentChunk;
- List<int> _h;
- bool _digestCalled = false;
-
- _HashBase(this._chunkSizeInWords,
- this._digestSizeInWords,
- this._bigEndianWords)
- : _pendingData = [] {
- _currentChunk = new List(_chunkSizeInWords);
- _h = new List(_digestSizeInWords);
- }
-
- // Update the hasher with more data.
- add(List<int> data) {
- if (_digestCalled) {
- throw new StateError(
- 'Hash update method called after digest was retrieved');
- }
- _lengthInBytes += data.length;
- _pendingData.addAll(data);
- _iterate();
- }
-
- // Finish the hash computation and return the digest string.
- List<int> close() {
- if (_digestCalled) {
- return _resultAsBytes();
- }
- _digestCalled = true;
- _finalizeData();
- _iterate();
- assert(_pendingData.length == 0);
- return _resultAsBytes();
- }
-
- // Returns the block size of the hash in bytes.
- int get blockSize {
- return _chunkSizeInWords * _BYTES_PER_WORD;
- }
-
- // Create a fresh instance of this Hash.
- newInstance();
-
- // One round of the hash computation.
- _updateHash(List<int> m);
-
- // Helper methods.
- _add32(x, y) => (x + y) & _MASK_32;
- _roundUp(val, n) => (val + n - 1) & -n;
-
- // Rotate left limiting to unsigned 32-bit values.
- int _rotl32(int val, int shift) {
- var mod_shift = shift & 31;
- return ((val << mod_shift) & _MASK_32) |
- ((val & _MASK_32) >> (32 - mod_shift));
- }
-
-
- // Compute the final result as a list of bytes from the hash words.
- _resultAsBytes() {
- var result = [];
- for (var i = 0; i < _h.length; i++) {
- result.addAll(_wordToBytes(_h[i]));
- }
- return result;
- }
-
- // Converts a list of bytes to a chunk of 32-bit words.
- _bytesToChunk(List<int> data, int dataIndex) {
- assert((data.length - dataIndex) >= (_chunkSizeInWords * _BYTES_PER_WORD));
-
- for (var wordIndex = 0; wordIndex < _chunkSizeInWords; wordIndex++) {
- var w3 = _bigEndianWords ? data[dataIndex] : data[dataIndex + 3];
- var w2 = _bigEndianWords ? data[dataIndex + 1] : data[dataIndex + 2];
- var w1 = _bigEndianWords ? data[dataIndex + 2] : data[dataIndex + 1];
- var w0 = _bigEndianWords ? data[dataIndex + 3] : data[dataIndex];
- dataIndex += 4;
- var word = (w3 & 0xff) << 24;
- word |= (w2 & _MASK_8) << 16;
- word |= (w1 & _MASK_8) << 8;
- word |= (w0 & _MASK_8);
- _currentChunk[wordIndex] = word;
- }
- }
-
- // Convert a 32-bit word to four bytes.
- _wordToBytes(int word) {
- List<int> bytes = new List(_BYTES_PER_WORD);
- bytes[0] = (word >> (_bigEndianWords ? 24 : 0)) & _MASK_8;
- bytes[1] = (word >> (_bigEndianWords ? 16 : 8)) & _MASK_8;
- bytes[2] = (word >> (_bigEndianWords ? 8 : 16)) & _MASK_8;
- bytes[3] = (word >> (_bigEndianWords ? 0 : 24)) & _MASK_8;
- return bytes;
- }
-
- // Iterate through data updating the hash computation for each
- // chunk.
- _iterate() {
- var len = _pendingData.length;
- var chunkSizeInBytes = _chunkSizeInWords * _BYTES_PER_WORD;
- if (len >= chunkSizeInBytes) {
- var index = 0;
- for (; (len - index) >= chunkSizeInBytes; index += chunkSizeInBytes) {
- _bytesToChunk(_pendingData, index);
- _updateHash(_currentChunk);
- }
- _pendingData = _pendingData.sublist(index, len);
- }
- }
-
- // Finalize the data. Add a 1 bit to the end of the message. Expand with
- // 0 bits and add the length of the message.
- _finalizeData() {
- _pendingData.add(0x80);
- var contentsLength = _lengthInBytes + 9;
- var chunkSizeInBytes = _chunkSizeInWords * _BYTES_PER_WORD;
- var finalizedLength = _roundUp(contentsLength, chunkSizeInBytes);
- var zeroPadding = finalizedLength - contentsLength;
- for (var i = 0; i < zeroPadding; i++) {
- _pendingData.add(0);
- }
- var lengthInBits = _lengthInBytes * _BITS_PER_BYTE;
- assert(lengthInBits < pow(2, 32));
- if (_bigEndianWords) {
- _pendingData.addAll(_wordToBytes(0));
- _pendingData.addAll(_wordToBytes(lengthInBits & _MASK_32));
- } else {
- _pendingData.addAll(_wordToBytes(lengthInBits & _MASK_32));
- _pendingData.addAll(_wordToBytes(0));
- }
- }
-}
-
-// The MD5 hasher is used to compute an MD5 message digest.
-class _MD5 extends _HashBase {
- _MD5() : super(16, 4, false) {
- _h[0] = 0x67452301;
- _h[1] = 0xefcdab89;
- _h[2] = 0x98badcfe;
- _h[3] = 0x10325476;
- }
-
- // Returns a new instance of this Hash.
- _MD5 newInstance() {
- return new _MD5();
- }
-
- static const _k = const [
- 0xd76aa478, 0xe8c7b756, 0x242070db, 0xc1bdceee, 0xf57c0faf, 0x4787c62a,
- 0xa8304613, 0xfd469501, 0x698098d8, 0x8b44f7af, 0xffff5bb1, 0x895cd7be,
- 0x6b901122, 0xfd987193, 0xa679438e, 0x49b40821, 0xf61e2562, 0xc040b340,
- 0x265e5a51, 0xe9b6c7aa, 0xd62f105d, 0x02441453, 0xd8a1e681, 0xe7d3fbc8,
- 0x21e1cde6, 0xc33707d6, 0xf4d50d87, 0x455a14ed, 0xa9e3e905, 0xfcefa3f8,
- 0x676f02d9, 0x8d2a4c8a, 0xfffa3942, 0x8771f681, 0x6d9d6122, 0xfde5380c,
- 0xa4beea44, 0x4bdecfa9, 0xf6bb4b60, 0xbebfbc70, 0x289b7ec6, 0xeaa127fa,
- 0xd4ef3085, 0x04881d05, 0xd9d4d039, 0xe6db99e5, 0x1fa27cf8, 0xc4ac5665,
- 0xf4292244, 0x432aff97, 0xab9423a7, 0xfc93a039, 0x655b59c3, 0x8f0ccc92,
- 0xffeff47d, 0x85845dd1, 0x6fa87e4f, 0xfe2ce6e0, 0xa3014314, 0x4e0811a1,
- 0xf7537e82, 0xbd3af235, 0x2ad7d2bb, 0xeb86d391 ];
-
- static const _r = const [
- 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 5, 9, 14,
- 20, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 4, 11, 16, 23, 4, 11,
- 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 6, 10, 15, 21, 6, 10, 15, 21, 6,
- 10, 15, 21, 6, 10, 15, 21 ];
-
- // Compute one iteration of the MD5 algorithm with a chunk of
- // 16 32-bit pieces.
- void _updateHash(List<int> m) {
- assert(m.length == 16);
-
- var a = _h[0];
- var b = _h[1];
- var c = _h[2];
- var d = _h[3];
-
- var t0;
- var t1;
-
- for (var i = 0; i < 64; i++) {
- if (i < 16) {
- t0 = (b & c) | ((~b & _MASK_32) & d);
- t1 = i;
- } else if (i < 32) {
- t0 = (d & b) | ((~d & _MASK_32) & c);
- t1 = ((5 * i) + 1) % 16;
- } else if (i < 48) {
- t0 = b ^ c ^ d;
- t1 = ((3 * i) + 5) % 16;
- } else {
- t0 = c ^ (b | (~d & _MASK_32));
- t1 = (7 * i) % 16;
- }
-
- var temp = d;
- d = c;
- c = b;
- b = _add32(b, _rotl32(_add32(_add32(a, t0),
- _add32(_k[i], m[t1])),
- _r[i]));
- a = temp;
- }
-
- _h[0] = _add32(a, _h[0]);
- _h[1] = _add32(b, _h[1]);
- _h[2] = _add32(c, _h[2]);
- _h[3] = _add32(d, _h[3]);
- }
-}
-
-// The SHA1 hasher is used to compute an SHA1 message digest.
-class _SHA1 extends _HashBase {
- // Construct a SHA1 hasher object.
- _SHA1() : _w = new List(80), super(16, 5, true) {
- _h[0] = 0x67452301;
- _h[1] = 0xEFCDAB89;
- _h[2] = 0x98BADCFE;
- _h[3] = 0x10325476;
- _h[4] = 0xC3D2E1F0;
- }
-
- // Returns a new instance of this Hash.
- _SHA1 newInstance() {
- return new _SHA1();
- }
-
- // Compute one iteration of the SHA1 algorithm with a chunk of
- // 16 32-bit pieces.
- void _updateHash(List<int> m) {
- assert(m.length == 16);
-
- var a = _h[0];
- var b = _h[1];
- var c = _h[2];
- var d = _h[3];
- var e = _h[4];
-
- for (var i = 0; i < 80; i++) {
- if (i < 16) {
- _w[i] = m[i];
- } else {
- var n = _w[i - 3] ^ _w[i - 8] ^ _w[i - 14] ^ _w[i - 16];
- _w[i] = _rotl32(n, 1);
- }
- var t = _add32(_add32(_rotl32(a, 5), e), _w[i]);
- if (i < 20) {
- t = _add32(_add32(t, (b & c) | (~b & d)), 0x5A827999);
- } else if (i < 40) {
- t = _add32(_add32(t, (b ^ c ^ d)), 0x6ED9EBA1);
- } else if (i < 60) {
- t = _add32(_add32(t, (b & c) | (b & d) | (c & d)), 0x8F1BBCDC);
- } else {
- t = _add32(_add32(t, b ^ c ^ d), 0xCA62C1D6);
- }
-
- e = d;
- d = c;
- c = _rotl32(b, 30);
- b = a;
- a = t & _MASK_32;
- }
-
- _h[0] = _add32(a, _h[0]);
- _h[1] = _add32(b, _h[1]);
- _h[2] = _add32(c, _h[2]);
- _h[3] = _add32(d, _h[3]);
- _h[4] = _add32(e, _h[4]);
- }
-
- List<int> _w;
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/io/data_transformer.dart b/pkg/dev_compiler/tool/input_sdk/lib/io/data_transformer.dart
deleted file mode 100644
index 968fd20..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/io/data_transformer.dart
+++ /dev/null
@@ -1,587 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-part of dart.io;
-
-/**
- * Exposes ZLib options for input parameters.
- *
- * See http://www.zlib.net/manual.html for more documentation.
- */
-abstract class ZLibOption {
- /// Minimal value for [ZLibCodec.windowBits], [ZLibEncoder.windowBits]
- /// and [ZLibDecoder.windowBits].
- static const int MIN_WINDOW_BITS = 8;
- /// Maximal value for [ZLibCodec.windowBits], [ZLibEncoder.windowBits]
- /// and [ZLibDecoder.windowBits].
- static const int MAX_WINDOW_BITS = 15;
- /// Default value for [ZLibCodec.windowBits], [ZLibEncoder.windowBits]
- /// and [ZLibDecoder.windowBits].
- static const int DEFAULT_WINDOW_BITS = 15;
-
- /// Minimal value for [ZLibCodec.level], [ZLibEncoder.level]
- /// and [ZLibDecoder.level].
- static const int MIN_LEVEL = -1;
- /// Maximal value for [ZLibCodec.level], [ZLibEncoder.level]
- /// and [ZLibDecoder.level].
- static const int MAX_LEVEL = 9;
- /// Default value for [ZLibCodec.level], [ZLibEncoder.level]
- /// and [ZLibDecoder.level].
- static const int DEFAULT_LEVEL = 6;
-
- /// Minimal value for [ZLibCodec.memLevel], [ZLibEncoder.memLevel]
- /// and [ZLibDecoder.memLevel].
- static const int MIN_MEM_LEVEL = 1;
- /// Maximal value for [ZLibCodec.memLevel], [ZLibEncoder.memLevel]
- /// and [ZLibDecoder.memLevel].
- static const int MAX_MEM_LEVEL = 9;
- /// Default value for [ZLibCodec.memLevel], [ZLibEncoder.memLevel]
- /// and [ZLibDecoder.memLevel].
- static const int DEFAULT_MEM_LEVEL = 8;
-
-
- /// Recommended strategy for data produced by a filter (or predictor)
- static const int STRATEGY_FILTERED = 1;
- /// Use this strategy to force Huffman encoding only (no string match)
- static const int STRATEGY_HUFFMAN_ONLY = 2;
- /// Use this strategy to limit match distances to one (run-length encoding)
- static const int STRATEGY_RLE = 3;
- /// This strategy prevents the use of dynamic Huffman codes, allowing for a
- /// simpler decoder
- static const int STRATEGY_FIXED = 4;
- /// Recommended strategy for normal data
- static const int STRATEGY_DEFAULT = 0;
-}
-
-/**
- * An instance of the default implementation of the [ZLibCodec].
- */
-const ZLibCodec ZLIB = const ZLibCodec._default();
-
-/**
- * The [ZLibCodec] encodes raw bytes to ZLib compressed bytes and decodes ZLib
- * compressed bytes to raw bytes.
- */
-class ZLibCodec extends Codec<List<int>, List<int>> {
- /**
- * When true, `GZip` frames will be added to the compressed data.
- */
- final bool gzip;
-
- /**
- * The compression-[level] can be set in the range of `-1..9`, with `6` being
- * the default compression level. Levels above `6` will have higher
- * compression rates at the cost of more CPU and memory usage. Levels below
- * `6` will use less CPU and memory at the cost of lower compression rates.
- */
- final int level;
-
- /**
- * Specifies how much memory should be allocated for the internal compression
- * state. `1` uses minimum memory but is slow and reduces compression ratio;
- * `9` uses maximum memory for optimal speed. The default value is `8`.
- *
- * The memory requirements for deflate are (in bytes):
- *
- * (1 << (windowBits + 2)) + (1 << (memLevel + 9))
- * that is: 128K for windowBits = 15 + 128K for memLevel = 8 (default values)
- */
- final int memLevel;
-
- /**
- * Tunes the compression algorithm. Use the value STRATEGY_DEFAULT for normal
- * data, STRATEGY_FILTERED for data produced by a filter (or predictor),
- * STRATEGY_HUFFMAN_ONLY to force Huffman encoding only (no string match), or
- * STRATEGY_RLE to limit match distances to one (run-length encoding).
- */
- final int strategy;
-
- /**
- * Base two logarithm of the window size (the size of the history buffer). It
- * should be in the range 8..15. Larger values result in better compression at
- * the expense of memory usage. The default value is 15
- */
- final int windowBits;
-
- /**
- * When true, deflate generates raw data with no zlib header or trailer, and
- * will not compute an adler32 check value
- */
- final bool raw;
-
- /**
- * Initial compression dictionary.
- *
- * It should consist of strings (byte sequences) that are likely to be
- * encountered later in the data to be compressed, with the most commonly used
- * strings preferably put towards the end of the dictionary. Using a
- * dictionary is most useful when the data to be compressed is short and can
- * be predicted with good accuracy; the data can then be compressed better
- * than with the default empty dictionary.
- */
- final List<int> dictionary;
-
- ZLibCodec({this.level: ZLibOption.DEFAULT_LEVEL,
- this.windowBits: ZLibOption.DEFAULT_WINDOW_BITS,
- this.memLevel: ZLibOption.DEFAULT_MEM_LEVEL,
- this.strategy: ZLibOption.STRATEGY_DEFAULT,
- this.dictionary: null,
- this.raw: false,
- this.gzip: false}) {
- _validateZLibeLevel(level);
- _validateZLibMemLevel(memLevel);
- _validateZLibStrategy(strategy);
- _validateZLibWindowBits(windowBits);
- }
-
- const ZLibCodec._default()
- : level = ZLibOption.DEFAULT_LEVEL,
- windowBits = ZLibOption.DEFAULT_WINDOW_BITS,
- memLevel = ZLibOption.DEFAULT_MEM_LEVEL,
- strategy = ZLibOption.STRATEGY_DEFAULT,
- raw = false,
- gzip = false,
- dictionary = null;
-
- /**
- * Get a [ZLibEncoder] for encoding to `ZLib` compressed data.
- */
- ZLibEncoder get encoder =>
- new ZLibEncoder(gzip: false, level: level, windowBits: windowBits,
- memLevel: memLevel, strategy: strategy,
- dictionary: dictionary, raw: raw);
-
- /**
- * Get a [ZLibDecoder] for decoding `ZLib` compressed data.
- */
- ZLibDecoder get decoder =>
- new ZLibDecoder(windowBits: windowBits, dictionary: dictionary, raw: raw);
-}
-
-
-/**
- * An instance of the default implementation of the [GZipCodec].
- */
-const GZipCodec GZIP = const GZipCodec._default();
-
-
-/**
- * The [GZipCodec] encodes raw bytes to GZip compressed bytes and decodes GZip
- * compressed bytes to raw bytes.
- *
- * The difference between [ZLibCodec] and [GZipCodec] is that the [GZipCodec]
- * wraps the `ZLib` compressed bytes in `GZip` frames.
- */
-class GZipCodec extends Codec<List<int>, List<int>> {
- /**
- * When true, `GZip` frames will be added to the compressed data.
- */
- final bool gzip;
-
- /**
- * The compression-[level] can be set in the range of `-1..9`, with `6` being
- * the default compression level. Levels above `6` will have higher
- * compression rates at the cost of more CPU and memory usage. Levels below
- * `6` will use less CPU and memory at the cost of lower compression rates.
- */
- final int level;
-
- /**
- * Specifies how much memory should be allocated for the internal compression
- * state. `1` uses minimum memory but is slow and reduces compression ratio;
- * `9` uses maximum memory for optimal speed. The default value is `8`.
- *
- * The memory requirements for deflate are (in bytes):
- *
- * (1 << (windowBits + 2)) + (1 << (memLevel + 9))
- * that is: 128K for windowBits = 15 + 128K for memLevel = 8 (default values)
- */
- final int memLevel;
-
- /**
- * Tunes the compression algorithm. Use the value
- * [ZLibOption.STRATEGY_DEFAULT] for normal data,
- * [ZLibOption.STRATEGY_FILTERED] for data produced by a filter
- * (or predictor), [ZLibOption.STRATEGY_HUFFMAN_ONLY] to force Huffman
- * encoding only (no string match), or [ZLibOption.STRATEGY_RLE] to limit
- * match distances to one (run-length encoding).
- */
- final int strategy;
-
- /**
- * Base two logarithm of the window size (the size of the history buffer). It
- * should be in the range `8..15`. Larger values result in better compression
- * at the expense of memory usage. The default value is `15`
- */
- final int windowBits;
-
- /**
- * Initial compression dictionary.
- *
- * It should consist of strings (byte sequences) that are likely to be
- * encountered later in the data to be compressed, with the most commonly used
- * strings preferably put towards the end of the dictionary. Using a
- * dictionary is most useful when the data to be compressed is short and can
- * be predicted with good accuracy; the data can then be compressed better
- * than with the default empty dictionary.
- */
- final List<int> dictionary;
-
- /**
- * When true, deflate generates raw data with no zlib header or trailer, and
- * will not compute an adler32 check value
- */
- final bool raw;
-
- GZipCodec({this.level: ZLibOption.DEFAULT_LEVEL,
- this.windowBits: ZLibOption.DEFAULT_WINDOW_BITS,
- this.memLevel: ZLibOption.DEFAULT_MEM_LEVEL,
- this.strategy: ZLibOption.STRATEGY_DEFAULT,
- this.dictionary: null,
- this.raw: false,
- this.gzip: true}) {
- _validateZLibeLevel(level);
- _validateZLibMemLevel(memLevel);
- _validateZLibStrategy(strategy);
- _validateZLibWindowBits(windowBits);
- }
-
- const GZipCodec._default()
- : level = ZLibOption.DEFAULT_LEVEL,
- windowBits = ZLibOption.DEFAULT_WINDOW_BITS,
- memLevel = ZLibOption.DEFAULT_MEM_LEVEL,
- strategy = ZLibOption.STRATEGY_DEFAULT,
- raw = false,
- gzip = true,
- dictionary = null;
-
- /**
- * Get a [ZLibEncoder] for encoding to `GZip` compressed data.
- */
- ZLibEncoder get encoder =>
- new ZLibEncoder(gzip: true, level: level, windowBits: windowBits,
- memLevel: memLevel, strategy: strategy,
- dictionary: dictionary, raw: raw);
-
- /**
- * Get a [ZLibDecoder] for decoding `GZip` compressed data.
- */
- ZLibDecoder get decoder =>
- new ZLibDecoder(windowBits: windowBits, dictionary: dictionary, raw: raw);
-}
-
-/**
- * The [ZLibEncoder] encoder is used by [ZLibCodec] and [GZipCodec] to compress
- * data.
- */
-class ZLibEncoder extends Converter<List<int>, List<int>> {
- /**
- * When true, `GZip` frames will be added to the compressed data.
- */
- final bool gzip;
-
- /**
- * The compression-[level] can be set in the range of `-1..9`, with `6` being
- * the default compression level. Levels above `6` will have higher
- * compression rates at the cost of more CPU and memory usage. Levels below
- * `6` will use less CPU and memory at the cost of lower compression rates.
- */
- final int level;
-
- /**
- * Specifies how much memory should be allocated for the internal compression
- * state. `1` uses minimum memory but is slow and reduces compression ratio;
- * `9` uses maximum memory for optimal speed. The default value is `8`.
- *
- * The memory requirements for deflate are (in bytes):
- *
- * (1 << (windowBits + 2)) + (1 << (memLevel + 9))
- * that is: 128K for windowBits = 15 + 128K for memLevel = 8 (default values)
- */
- final int memLevel;
-
- /**
- * Tunes the compression algorithm. Use the value
- * [ZLibOption.STRATEGY_DEFAULT] for normal data,
- * [ZLibOption.STRATEGY_FILTERED] for data produced by a filter
- * (or predictor), [ZLibOption.STRATEGY_HUFFMAN_ONLY] to force Huffman
- * encoding only (no string match), or [ZLibOption.STRATEGY_RLE] to limit
- * match distances to one (run-length encoding).
- */
- final int strategy;
-
- /**
- * Base two logarithm of the window size (the size of the history buffer). It
- * should be in the range `8..15`. Larger values result in better compression
- * at the expense of memory usage. The default value is `15`
- */
- final int windowBits;
-
- /**
- * Initial compression dictionary.
- *
- * It should consist of strings (byte sequences) that are likely to be
- * encountered later in the data to be compressed, with the most commonly used
- * strings preferably put towards the end of the dictionary. Using a
- * dictionary is most useful when the data to be compressed is short and can
- * be predicted with good accuracy; the data can then be compressed better
- * than with the default empty dictionary.
- */
- final List<int> dictionary;
-
-
- /**
- * When true, deflate generates raw data with no zlib header or trailer, and
- * will not compute an adler32 check value
- */
- final bool raw;
-
- ZLibEncoder({this.gzip: false,
- this.level: ZLibOption.DEFAULT_LEVEL,
- this.windowBits: ZLibOption.DEFAULT_WINDOW_BITS,
- this.memLevel: ZLibOption.DEFAULT_MEM_LEVEL,
- this.strategy: ZLibOption.STRATEGY_DEFAULT,
- this.dictionary: null,
- this.raw: false}) {
- _validateZLibeLevel(level);
- _validateZLibMemLevel(memLevel);
- _validateZLibStrategy(strategy);
- _validateZLibWindowBits(windowBits);
- }
-
- /**
- * Convert a list of bytes using the options given to the ZLibEncoder
- * constructor.
- */
- List<int> convert(List<int> bytes) {
- _BufferSink sink = new _BufferSink();
- startChunkedConversion(sink)..add(bytes)..close();
- return sink.builder.takeBytes();
- }
-
- /**
- * Start a chunked conversion using the options given to the [ZLibEncoder]
- * constructor. While it accepts any [Sink] taking [List<int>]'s,
- * the optimal sink to be passed as [sink] is a [ByteConversionSink].
- */
- ByteConversionSink startChunkedConversion(Sink<List<int>> sink) {
- if (sink is! ByteConversionSink) {
- sink = new ByteConversionSink.from(sink);
- }
- return new _ZLibEncoderSink(sink, gzip, level, windowBits, memLevel,
- strategy, dictionary, raw);
- }
-}
-
-
-/**
- * The [ZLibDecoder] is used by [ZLibCodec] and [GZipCodec] to decompress data.
- */
-class ZLibDecoder extends Converter<List<int>, List<int>> {
- /**
- * Base two logarithm of the window size (the size of the history buffer). It
- * should be in the range `8..15`. Larger values result in better compression
- * at the expense of memory usage. The default value is `15`.
- */
- final int windowBits;
-
- /**
- * Initial compression dictionary.
- *
- * It should consist of strings (byte sequences) that are likely to be
- * encountered later in the data to be compressed, with the most commonly used
- * strings preferably put towards the end of the dictionary. Using a
- * dictionary is most useful when the data to be compressed is short and can
- * be predicted with good accuracy; the data can then be compressed better
- * than with the default empty dictionary.
- */
- final List<int> dictionary;
-
- /**
- * When true, deflate generates raw data with no zlib header or trailer, and
- * will not compute an adler32 check value
- */
- final bool raw;
-
- ZLibDecoder({this.windowBits: ZLibOption.DEFAULT_WINDOW_BITS,
- this.dictionary: null, this.raw: false}) {
- _validateZLibWindowBits(windowBits);
- }
-
- /**
- * Convert a list of bytes using the options given to the [ZLibDecoder]
- * constructor.
- */
- List<int> convert(List<int> bytes) {
- _BufferSink sink = new _BufferSink();
- startChunkedConversion(sink)..add(bytes)..close();
- return sink.builder.takeBytes();
- }
-
- /**
- * Start a chunked conversion. While it accepts any [Sink]
- * taking [List<int>]'s, the optimal sink to be passed as [sink] is a
- * [ByteConversionSink].
- */
- ByteConversionSink startChunkedConversion(Sink<List<int>> sink) {
- if (sink is! ByteConversionSink) {
- sink = new ByteConversionSink.from(sink);
- }
- return new _ZLibDecoderSink(sink, windowBits, dictionary, raw);
- }
-}
-
-
-class _BufferSink extends ByteConversionSink {
- final BytesBuilder builder = new BytesBuilder(copy: false);
-
- void add(List<int> chunk) {
- builder.add(chunk);
- }
-
- void addSlice(List<int> chunk, int start, int end, bool isLast) {
- if (chunk is Uint8List) {
- Uint8List list = chunk;
- builder.add(new Uint8List.view(list.buffer, start, end - start));
- } else {
- builder.add(chunk.sublist(start, end));
- }
- }
-
- void close() {}
-}
-
-
-class _ZLibEncoderSink extends _FilterSink {
- _ZLibEncoderSink(ByteConversionSink sink, bool gzip, int level,
- int windowBits, int memLevel, int strategy,
- List<int> dictionary, bool raw)
- : super(sink, _Filter._newZLibDeflateFilter(gzip, level, windowBits,
- memLevel, strategy,
- dictionary, raw));
-}
-
-class _ZLibDecoderSink extends _FilterSink {
- _ZLibDecoderSink(ByteConversionSink sink, int windowBits,
- List<int> dictionary, bool raw)
- : super(sink, _Filter._newZLibInflateFilter(windowBits, dictionary, raw));
-}
-
-
-class _FilterSink extends ByteConversionSink {
- final _Filter _filter;
- final ByteConversionSink _sink;
- bool _closed = false;
- bool _empty = true;
-
- _FilterSink(this._sink, this._filter);
-
- void add(List<int> data) {
- addSlice(data, 0, data.length, false);
- }
-
- void addSlice(List<int> data, int start, int end, bool isLast) {
- if (_closed) return;
- if (end == null) throw new ArgumentError.notNull("end");
- RangeError.checkValidRange(start, end, data.length);
- try {
- _empty = false;
- _BufferAndStart bufferAndStart =
- _ensureFastAndSerializableByteData(data, start, end);
- _filter.process(bufferAndStart.buffer,
- bufferAndStart.start,
- end - (start - bufferAndStart.start));
- var out;
- while ((out = _filter.processed(flush: false)) != null) {
- _sink.add(out);
- }
- } catch (e) {
- _closed = true;
- rethrow;
- }
-
- if (isLast) close();
- }
-
- void close() {
- if (_closed) return;
- // Be sure to send process an empty chunk of data. Without this, the empty
- // message would not have a GZip frame (if compressed with GZip).
- if (_empty) _filter.process(const [], 0, 0);
- try {
- var out;
- while ((out = _filter.processed(end: true)) != null) {
- _sink.add(out);
- }
- } catch (e) {
- _closed = true;
- throw e;
- }
- _closed = true;
- _sink.close();
- }
-}
-
-
-/**
- * Private helper-class to handle native filters.
- */
-abstract class _Filter {
- /**
- * Call to process a chunk of data. A call to [process] should only be made
- * when [processed] returns [:null:].
- */
- void process(List<int> data, int start, int end);
-
- /**
- * Get a chunk of processed data. When there are no more data available,
- * [processed] will return [:null:]. Set [flush] to [:false:] for non-final
- * calls to improve performance of some filters.
- *
- * The last call to [processed] should have [end] set to [:true:]. This will
- * make sure an 'end' packet is written on the stream.
- */
- List<int> processed({bool flush: true, bool end: false});
-
- external static _Filter _newZLibDeflateFilter(bool gzip, int level,
- int windowBits, int memLevel,
- int strategy,
- List<int> dictionary, bool raw);
-
- external static _Filter _newZLibInflateFilter(int windowBits,
- List<int> dictionary, bool raw);
-}
-
-void _validateZLibWindowBits(int windowBits) {
- if (ZLibOption.MIN_WINDOW_BITS > windowBits ||
- ZLibOption.MAX_WINDOW_BITS < windowBits) {
- throw new RangeError.range(windowBits, ZLibOption.MIN_WINDOW_BITS,
- ZLibOption.MAX_WINDOW_BITS);
- }
-}
-
-void _validateZLibeLevel(int level) {
- if (ZLibOption.MIN_LEVEL > level ||
- ZLibOption.MAX_LEVEL < level) {
- throw new RangeError.range(level, ZLibOption.MIN_LEVEL,
- ZLibOption.MAX_LEVEL);
- }
-}
-
-void _validateZLibMemLevel(int memLevel) {
- if (ZLibOption.MIN_MEM_LEVEL > memLevel ||
- ZLibOption.MAX_MEM_LEVEL < memLevel) {
- throw new RangeError.range(memLevel, ZLibOption.MIN_MEM_LEVEL,
- ZLibOption.MAX_MEM_LEVEL);
- }
-}
-
-void _validateZLibStrategy(int strategy) {
- const strategies = const <int>[ZLibOption.STRATEGY_FILTERED,
- ZLibOption.STRATEGY_HUFFMAN_ONLY, ZLibOption.STRATEGY_RLE,
- ZLibOption.STRATEGY_FIXED, ZLibOption.STRATEGY_DEFAULT];
- if (strategies.indexOf(strategy) == -1) {
- throw new ArgumentError("Unsupported 'strategy'");
- }
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/io/directory.dart b/pkg/dev_compiler/tool/input_sdk/lib/io/directory.dart
deleted file mode 100644
index e890fcf..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/io/directory.dart
+++ /dev/null
@@ -1,313 +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.
-
-part of dart.io;
-
-/**
- * A reference to a directory (or _folder_) on the file system.
- *
- * A Directory instance is an object holding a [path] on which operations can
- * be performed. The path to the directory can be [absolute] or [relative].
- * You can get the parent directory using the getter [parent],
- * a property inherited from [FileSystemEntity].
- *
- * In addition to being used as an instance to access the file system,
- * Directory has a number of static properties, such as [systemTemp],
- * which gets the system's temporary directory, and the getter and setter
- * [current], which you can use to access or change the current directory.
- *
- * Create a new Directory object with a pathname to access the specified
- * directory on the file system from your program.
- *
- * var myDir = new Directory('myDir');
- *
- * Most methods in this class occur in synchronous and asynchronous pairs,
- * for example, [create] and [createSync].
- * Unless you have a specific reason for using the synchronous version
- * of a method, prefer the asynchronous version to avoid blocking your program.
- *
- * ## Create a directory
- *
- * The following code sample creates a directory using the [create] method.
- * By setting the `recursive` parameter to true, you can create the
- * named directory and all its necessary parent directories,
- * if they do not already exist.
- *
- * import 'dart:io';
- *
- * void main() {
- * // Creates dir/ and dir/subdir/.
- * new Directory('dir/subdir').create(recursive: true)
- * // The created directory is returned as a Future.
- * .then((Directory directory) {
- * print(directory.path);
- * });
- * }
- *
- * ## List a directory
- *
- * Use the [list] or [listSync] methods to get the files and directories
- * contained by a directory.
- * Set `recursive` to true to recursively list all subdirectories.
- * Set `followLinks` to true to follow symbolic links.
- * The list method returns a [Stream] that provides FileSystemEntity
- * objects. Use the listen callback function to process each object
- * as it become available.
- *
- * import 'dart:io';
- *
- * void main() {
- * // Get the system temp directory.
- * var systemTempDir = Directory.systemTemp;
- *
- * // List directory contents, recursing into sub-directories,
- * // but not following symbolic links.
- * systemTempDir.list(recursive: true, followLinks: false)
- * .listen((FileSystemEntity entity) {
- * print(entity.path);
- * });
- * }
- *
- * ## The use of Futures
- *
- * I/O operations can block a program for some period of time while it waits for
- * the operation to complete. To avoid this, all
- * methods involving I/O have an asynchronous variant which returns a [Future].
- * This future completes when the I/O operation finishes. While the I/O
- * operation is in progress, the Dart program is not blocked,
- * and can perform other operations.
- *
- * For example,
- * the [exists] method, which determines whether the directory exists,
- * returns a boolean value using a Future.
- * Use `then` to register a callback function, which is called when
- * the value is ready.
- *
- * import 'dart:io';
- *
- * main() {
- * final myDir = new Directory('dir');
- * myDir.exists().then((isThere) {
- * isThere ? print('exists') : print('non-existent');
- * });
- * }
- *
- *
- * In addition to exists, the [stat], [rename], and
- * other methods, return Futures.
- *
- * ## Other resources
- *
- * * [Dart by Example](https://www.dartlang.org/dart-by-example/#files-directories-and-symlinks)
- * provides additional task-oriented code samples that show how to use
- * various API from the Directory class and the related [File] class.
- *
- * * [I/O for Command-Line
- * Apps](https://www.dartlang.org/docs/dart-up-and-running/ch03.html#dartio---io-for-command-line-apps)
- * a section from _A Tour of the Dart Libraries_ covers files and directories.
- *
- * * [Write Command-Line Apps](https://www.dartlang.org/docs/tutorials/cmdline/),
- * a tutorial about writing command-line apps, includes information about
- * files and directories.
- */
-abstract class Directory implements FileSystemEntity {
- /**
- * Gets the path of this directory.
- */
- final String path;
-
- /**
- * Creates a [Directory] object.
- *
- * If [path] is a relative path, it will be interpreted relative to the
- * current working directory (see [Directory.current]), when used.
- *
- * If [path] is an absolute path, it will be immune to changes to the
- * current working directory.
- */
- factory Directory(String path) => new _Directory(path);
-
- /**
- * Create a Directory object from a URI.
- *
- * If [uri] cannot reference a directory this throws [UnsupportedError].
- */
- factory Directory.fromUri(Uri uri) => new Directory(uri.toFilePath());
-
- /**
- * Creates a directory object pointing to the current working
- * directory.
- */
- static Directory get current => _Directory.current;
-
- /**
- * Returns a [Uri] representing the directory's location.
- *
- * The returned URI's scheme is always "file" if the entity's [path] is
- * absolute, otherwise the scheme will be empty.
- * The returned URI's path always ends in a slash ('/').
- */
- Uri get uri;
-
- /**
- * Sets the current working directory of the Dart process including
- * all running isolates. The new value set can be either a [Directory]
- * or a [String].
- *
- * The new value is passed to the OS's system call unchanged, so a
- * relative path passed as the new working directory will be
- * resolved by the OS.
- *
- * Note that setting the current working directory is a synchronous
- * operation and that it changes the working directory of *all*
- * isolates.
- *
- * Use this with care - especially when working with asynchronous
- * operations and multiple isolates. Changing the working directory,
- * while asynchronous operations are pending or when other isolates
- * are working with the file system, can lead to unexpected results.
- */
- static void set current(path) {
- _Directory.current = path;
- }
-
- /**
- * Creates the directory with this name.
- *
- * If [recursive] is false, only the last directory in the path is
- * created. If [recursive] is true, all non-existing path components
- * are created. If the directory already exists nothing is done.
- *
- * Returns a [:Future<Directory>:] that completes with this
- * directory once it has been created. If the directory cannot be
- * created the future completes with an exception.
- */
- Future<Directory> create({bool recursive: false});
-
- /**
- * Synchronously creates the directory with this name.
- *
- * If [recursive] is false, only the last directory in the path is
- * created. If [recursive] is true, all non-existing path components
- * are created. If the directory already exists nothing is done.
- *
- * If the directory cannot be created an exception is thrown.
- */
- void createSync({bool recursive: false});
-
- /**
- * Gets the system temp directory.
- *
- * Gets the directory provided by the operating system for creating
- * temporary files and directories in.
- * The location of the system temp directory is platform-dependent,
- * and may be set by an environment variable.
- */
- static Directory get systemTemp => _Directory.systemTemp;
-
- /**
- * Creates a temporary directory in this directory. Additional random
- * characters are appended to [prefix] to produce a unique directory
- * name. If [prefix] is missing or null, the empty string is used
- * for [prefix].
- *
- * Returns a [:Future<Directory>:] that completes with the newly
- * created temporary directory.
- */
- Future<Directory> createTemp([String prefix]);
-
- /**
- * Synchronously creates a temporary directory in this directory.
- * Additional random characters are appended to [prefix] to produce
- * a unique directory name. If [prefix] is missing or null, the empty
- * string is used for [prefix].
- *
- * Returns the newly created temporary directory.
- */
- Directory createTempSync([String prefix]);
-
- Future<String> resolveSymbolicLinks();
-
- String resolveSymbolicLinksSync();
-
- /**
- * Renames this directory. Returns a [:Future<Directory>:] that completes
- * with a [Directory] instance for the renamed directory.
- *
- * If newPath identifies an existing directory, that directory is
- * replaced. If newPath identifies an existing file, the operation
- * fails and the future completes with an exception.
- */
- Future<Directory> rename(String newPath);
-
- /**
- * Synchronously renames this directory. Returns a [Directory]
- * instance for the renamed directory.
- *
- * If newPath identifies an existing directory, that directory is
- * replaced. If newPath identifies an existing file the operation
- * fails and an exception is thrown.
- */
- Directory renameSync(String newPath);
-
- /**
- * Returns a [Directory] instance whose path is the absolute path to [this].
- *
- * The absolute path is computed by prefixing
- * a relative path with the current working directory, and returning
- * an absolute path unchanged.
- */
- Directory get absolute;
-
- /**
- * Lists the sub-directories and files of this [Directory].
- * Optionally recurses into sub-directories.
- *
- * If [followLinks] is false, then any symbolic links found
- * are reported as [Link] objects, rather than as directories or files,
- * and are not recursed into.
- *
- * If [followLinks] is true, then working links are reported as
- * directories or files, depending on
- * their type, and links to directories are recursed into.
- * Broken links are reported as [Link] objects.
- * If a symbolic link makes a loop in the file system, then a recursive
- * listing will not follow a link twice in the
- * same recursive descent, but will report it as a [Link]
- * the second time it is seen.
- *
- * The result is a stream of [FileSystemEntity] objects
- * for the directories, files, and links.
- */
- Stream<FileSystemEntity> list({bool recursive: false,
- bool followLinks: true});
-
- /**
- * Lists the sub-directories and files of this [Directory].
- * Optionally recurses into sub-directories.
- *
- * If [followLinks] is false, then any symbolic links found
- * are reported as [Link] objects, rather than as directories or files,
- * and are not recursed into.
- *
- * If [followLinks] is true, then working links are reported as
- * directories or files, depending on
- * their type, and links to directories are recursed into.
- * Broken links are reported as [Link] objects.
- * If a link makes a loop in the file system, then a recursive
- * listing will not follow a link twice in the
- * same recursive descent, but will report it as a [Link]
- * the second time it is seen.
- *
- * Returns a [List] containing [FileSystemEntity] objects for the
- * directories, files, and links.
- */
- List<FileSystemEntity> listSync({bool recursive: false,
- bool followLinks: true});
-
- /**
- * Returns a human readable string for this Directory instance.
- */
- String toString();
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/io/directory_impl.dart b/pkg/dev_compiler/tool/input_sdk/lib/io/directory_impl.dart
deleted file mode 100644
index 52cf548..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/io/directory_impl.dart
+++ /dev/null
@@ -1,428 +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.
-
-part of dart.io;
-
-class _Directory extends FileSystemEntity implements Directory {
- final String path;
-
- _Directory(this.path) {
- if (path is! String) {
- throw new ArgumentError('${Error.safeToString(path)} '
- 'is not a String');
- }
- }
-
- external static _current();
- external static _setCurrent(path);
- external static _createTemp(String path);
- external static String _systemTemp();
- external static _exists(String path);
- external static _create(String path);
- external static _deleteNative(String path, bool recursive);
- external static _rename(String path, String newPath);
- external static void _fillWithDirectoryListing(
- List<FileSystemEntity> list, String path, bool recursive,
- bool followLinks);
-
- static Directory get current {
- var result = _current();
- if (result is OSError) {
- throw new FileSystemException(
- "Getting current working directory failed", "", result);
- }
- return new _Directory(result);
- }
-
- static void set current(path) {
- if (path is Directory) path = path.path;
- var result = _setCurrent(path);
- if (result is ArgumentError) throw result;
- if (result is OSError) {
- throw new FileSystemException(
- "Setting current working directory failed", path, result);
- }
- }
-
- Uri get uri {
- return new Uri.directory(path);
- }
-
- Future<bool> exists() {
- return _IOService._dispatch(_DIRECTORY_EXISTS, [path]).then((response) {
- if (_isErrorResponse(response)) {
- throw _exceptionOrErrorFromResponse(response, "Exists failed");
- }
- return response == 1;
- });
- }
-
- bool existsSync() {
- var result = _exists(path);
- if (result is OSError) {
- throw new FileSystemException("Exists failed", path, result);
- }
- return (result == 1);
- }
-
- Directory get absolute => new Directory(_absolutePath);
-
- Future<FileStat> stat() => FileStat.stat(path);
-
- FileStat statSync() => FileStat.statSync(path);
-
- // Compute the index of the first directory in the list that exists. If
- // none of the directories exist dirsToCreate.length is returned.
- Future<int> _computeExistingIndex(List dirsToCreate) {
- var future;
- var notFound = dirsToCreate.length;
- for (var i = 0; i < dirsToCreate.length; i++) {
- if (future == null) {
- future = dirsToCreate[i].exists().then((e) => e ? i : notFound);
- } else {
- future = future.then((index) {
- if (index != notFound) {
- return new Future.value(index);
- }
- return dirsToCreate[i].exists().then((e) => e ? i : notFound);
- });
- }
- }
- if (future == null) {
- return new Future.value(notFound);
- } else {
- return future;
- }
- }
-
- Future<Directory> create({bool recursive: false}) {
- if (recursive) {
- return exists().then((exists) {
- if (exists) return this;
- if (path != parent.path) {
- return parent.create(recursive: true).then((_) {
- return create();
- });
- } else {
- return create();
- }
- });
- } else {
- return _IOService._dispatch(_DIRECTORY_CREATE, [path]).then((response) {
- if (_isErrorResponse(response)) {
- throw _exceptionOrErrorFromResponse(response, "Creation failed");
- }
- return this;
- });
- }
- }
-
- void createSync({bool recursive: false}) {
- if (recursive) {
- if (existsSync()) return;
- if (path != parent.path) {
- parent.createSync(recursive: true);
- }
- }
- var result = _create(path);
- if (result is OSError) {
- throw new FileSystemException("Creation failed", path, result);
- }
- }
-
- static Directory get systemTemp => new Directory(_systemTemp());
-
- Future<Directory> createTemp([String prefix]) {
- if (prefix == null) prefix = '';
- if (path == '') {
- throw new ArgumentError(
- "Directory.createTemp called with an empty path. "
- "To use the system temp directory, use Directory.systemTemp");
- }
- String fullPrefix;
- if (path.endsWith('/') || (Platform.isWindows && path.endsWith('\\'))) {
- fullPrefix = "$path$prefix";
- } else {
- fullPrefix = "$path${Platform.pathSeparator}$prefix";
- }
- return _IOService._dispatch(_DIRECTORY_CREATE_TEMP, [fullPrefix])
- .then((response) {
- if (_isErrorResponse(response)) {
- throw _exceptionOrErrorFromResponse(
- response, "Creation of temporary directory failed");
- }
- return new Directory(response);
- });
- }
-
- Directory createTempSync([String prefix]) {
- if (prefix == null) prefix = '';
- if (path == '') {
- throw new ArgumentError(
- "Directory.createTemp called with an empty path. "
- "To use the system temp directory, use Directory.systemTemp");
- }
- String fullPrefix;
- if (path.endsWith('/') || (Platform.isWindows && path.endsWith('\\'))) {
- fullPrefix = "$path$prefix";
- } else {
- fullPrefix = "$path${Platform.pathSeparator}$prefix";
- }
- var result = _createTemp(fullPrefix);
- if (result is OSError) {
- throw new FileSystemException("Creation of temporary directory failed",
- fullPrefix,
- result);
- }
- return new Directory(result);
- }
-
- Future<Directory> _delete({bool recursive: false}) {
- return _IOService._dispatch(_DIRECTORY_DELETE, [path, recursive])
- .then((response) {
- if (_isErrorResponse(response)) {
- throw _exceptionOrErrorFromResponse(response, "Deletion failed");
- }
- return this;
- });
- }
-
- void _deleteSync({bool recursive: false}) {
- var result = _deleteNative(path, recursive);
- if (result is OSError) {
- throw new FileSystemException("Deletion failed", path, result);
- }
- }
-
- Future<Directory> rename(String newPath) {
- return _IOService._dispatch(_DIRECTORY_RENAME, [path, newPath])
- .then((response) {
- if (_isErrorResponse(response)) {
- throw _exceptionOrErrorFromResponse(response, "Rename failed");
- }
- return new Directory(newPath);
- });
- }
-
- Directory renameSync(String newPath) {
- if (newPath is !String) {
- throw new ArgumentError();
- }
- var result = _rename(path, newPath);
- if (result is OSError) {
- throw new FileSystemException("Rename failed", path, result);
- }
- return new Directory(newPath);
- }
-
- Stream<FileSystemEntity> list({bool recursive: false,
- bool followLinks: true}) {
- return new _AsyncDirectoryLister(
- FileSystemEntity._ensureTrailingPathSeparators(path),
- recursive,
- followLinks).stream;
- }
-
- List<FileSystemEntity> listSync(
- {bool recursive: false, bool followLinks: true}) {
- if (recursive is! bool || followLinks is! bool) {
- throw new ArgumentError();
- }
- var result = <FileSystemEntity>[];
- _fillWithDirectoryListing(
- result,
- FileSystemEntity._ensureTrailingPathSeparators(path),
- recursive,
- followLinks);
- return result;
- }
-
- String toString() => "Directory: '$path'";
-
- bool _isErrorResponse(response) =>
- response is List && response[0] != _SUCCESS_RESPONSE;
-
- _exceptionOrErrorFromResponse(response, String message) {
- assert(_isErrorResponse(response));
- switch (response[_ERROR_RESPONSE_ERROR_TYPE]) {
- case _ILLEGAL_ARGUMENT_RESPONSE:
- return new ArgumentError();
- case _OSERROR_RESPONSE:
- var err = new OSError(response[_OSERROR_RESPONSE_MESSAGE],
- response[_OSERROR_RESPONSE_ERROR_CODE]);
- return new FileSystemException(message, path, err);
- default:
- return new Exception("Unknown error");
- }
- }
-}
-
-abstract class _AsyncDirectoryListerOps {
- external factory _AsyncDirectoryListerOps(int pointer);
-
- int getPointer();
-}
-
-class _AsyncDirectoryLister {
- static const int LIST_FILE = 0;
- static const int LIST_DIRECTORY = 1;
- static const int LIST_LINK = 2;
- static const int LIST_ERROR = 3;
- static const int LIST_DONE = 4;
-
- static const int RESPONSE_TYPE = 0;
- static const int RESPONSE_PATH = 1;
- static const int RESPONSE_COMPLETE = 1;
- static const int RESPONSE_ERROR = 2;
-
- final String path;
- final bool recursive;
- final bool followLinks;
-
- StreamController controller;
- bool canceled = false;
- bool nextRunning = false;
- bool closed = false;
- _AsyncDirectoryListerOps _ops;
- Completer closeCompleter = new Completer();
-
- _AsyncDirectoryLister(this.path, this.recursive, this.followLinks) {
- controller = new StreamController(onListen: onListen,
- onResume: onResume,
- onCancel: onCancel,
- sync: true);
- }
-
- // Calling this function will increase the reference count on the native
- // object that implements the async directory lister operations. It should
- // only be called to pass the pointer to the IO Service, which will decrement
- // the reference count when it is finished with it.
- int _pointer() {
- return (_ops == null) ? null : _ops.getPointer();
- }
-
- Stream get stream => controller.stream;
-
- void onListen() {
- _IOService._dispatch(_DIRECTORY_LIST_START, [path, recursive, followLinks])
- .then((response) {
- if (response is int) {
- _ops = new _AsyncDirectoryListerOps(response);
- next();
- } else if (response is Error) {
- controller.addError(response, response.stackTrace);
- close();
- } else {
- error(response);
- close();
- }
- });
- }
-
- void onResume() {
- if (!nextRunning) {
- next();
- }
- }
-
- Future onCancel() {
- canceled = true;
- // If we are active, but not requesting, close.
- if (!nextRunning) {
- close();
- }
-
- return closeCompleter.future;
- }
-
- void next() {
- if (canceled) {
- close();
- return;
- }
- if (controller.isPaused || nextRunning) {
- return;
- }
- var pointer = _pointer();
- if (pointer == null) {
- return;
- }
- nextRunning = true;
- _IOService._dispatch(_DIRECTORY_LIST_NEXT, [pointer]).then((result) {
- nextRunning = false;
- if (result is List) {
- next();
- assert(result.length % 2 == 0);
- for (int i = 0; i < result.length; i++) {
- assert(i % 2 == 0);
- switch (result[i++]) {
- case LIST_FILE:
- controller.add(new File(result[i]));
- break;
- case LIST_DIRECTORY:
- controller.add(new Directory(result[i]));
- break;
- case LIST_LINK:
- controller.add(new Link(result[i]));
- break;
- case LIST_ERROR:
- error(result[i]);
- break;
- case LIST_DONE:
- canceled = true;
- return;
- }
- }
- } else {
- controller.addError(new FileSystemException("Internal error"));
- }
- });
- }
-
- void _cleanup() {
- controller.close();
- closeCompleter.complete();
- _ops = null;
- }
-
- void close() {
- if (closed) {
- return;
- }
- if (nextRunning) {
- return;
- }
- closed = true;
-
- var pointer = _pointer();
- if (pointer == null) {
- _cleanup();
- } else {
- _IOService._dispatch(_DIRECTORY_LIST_STOP, [pointer])
- .whenComplete(_cleanup);
- }
- }
-
- void error(message) {
- var errorType =
- message[RESPONSE_ERROR][_ERROR_RESPONSE_ERROR_TYPE];
- if (errorType == _ILLEGAL_ARGUMENT_RESPONSE) {
- controller.addError(new ArgumentError());
- } else if (errorType == _OSERROR_RESPONSE) {
- var responseError = message[RESPONSE_ERROR];
- var err = new OSError(
- responseError[_OSERROR_RESPONSE_MESSAGE],
- responseError[_OSERROR_RESPONSE_ERROR_CODE]);
- var errorPath = message[RESPONSE_PATH];
- if (errorPath == null) errorPath = path;
- controller.addError(
- new FileSystemException("Directory listing failed",
- errorPath,
- err));
- } else {
- controller.addError(
- new FileSystemException("Internal error"));
- }
- }
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/io/eventhandler.dart b/pkg/dev_compiler/tool/input_sdk/lib/io/eventhandler.dart
deleted file mode 100644
index 883c2e1..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/io/eventhandler.dart
+++ /dev/null
@@ -1,11 +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.
-
-part of dart.io;
-
-class _EventHandler {
- external static void _sendData(Object sender,
- SendPort sendPort,
- int data);
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/io/file.dart b/pkg/dev_compiler/tool/input_sdk/lib/io/file.dart
deleted file mode 100644
index de526ed..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/io/file.dart
+++ /dev/null
@@ -1,885 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-part of dart.io;
-
-/**
- * The modes in which a File can be opened.
- */
-class FileMode {
- /// The mode for opening a file only for reading.
- static const READ = const FileMode._internal(0);
- /// Mode for opening a file for reading and writing. The file is
- /// overwritten if it already exists. The file is created if it does not
- /// already exist.
- static const WRITE = const FileMode._internal(1);
- /// Mode for opening a file for reading and writing to the
- /// end of it. The file is created if it does not already exist.
- static const APPEND = const FileMode._internal(2);
- /// Mode for opening a file for writing *only*. The file is
- /// overwritten if it already exists. The file is created if it does not
- /// already exist.
- static const WRITE_ONLY = const FileMode._internal(3);
- /// Mode for opening a file for writing *only* to the
- /// end of it. The file is created if it does not already exist.
- static const WRITE_ONLY_APPEND = const FileMode._internal(4);
- final int _mode;
-
- const FileMode._internal(this._mode);
-}
-
-/// The mode for opening a file only for reading.
-const READ = FileMode.READ;
-/// The mode for opening a file for reading and writing. The file is
-/// overwritten if it already exists. The file is created if it does not
-/// already exist.
-const WRITE = FileMode.WRITE;
-/// The mode for opening a file for reading and writing to the
-/// end of it. The file is created if it does not already exist.
-const APPEND = FileMode.APPEND;
-/// Mode for opening a file for writing *only*. The file is
-/// overwritten if it already exists. The file is created if it does not
-/// already exist.
-const WRITE_ONLY = FileMode.WRITE_ONLY;
-/// Mode for opening a file for writing *only* to the
-/// end of it. The file is created if it does not already exist.
-const WRITE_ONLY_APPEND = FileMode.WRITE_ONLY_APPEND;
-
-
-/// Type of lock when requesting a lock on a file.
-enum FileLock {
- /// Shared file lock.
- SHARED,
- /// Exclusive file lock.
- EXCLUSIVE
-}
-
-/**
- * A reference to a file on the file system.
- *
- * A File instance is an object that holds a [path] on which operations can
- * be performed.
- * You can get the parent directory of the file using the getter [parent],
- * a property inherited from [FileSystemEntity].
- *
- * Create a new File object with a pathname to access the specified file on the
- * file system from your program.
- *
- * var myFile = new File('file.txt');
- *
- * The File class contains methods for manipulating files and their contents.
- * Using methods in this class, you can open and close files, read to and write
- * from them, create and delete them, and check for their existence.
- *
- * When reading or writing a file, you can use streams (with [openRead]),
- * random access operations (with [open]),
- * or convenience methods such as [readAsString],
- *
- * Most methods in this class occur in synchronous and asynchronous pairs,
- * for example, [readAsString] and [readAsStringSync].
- * Unless you have a specific reason for using the synchronous version
- * of a method, prefer the asynchronous version to avoid blocking your program.
- *
- * ## If path is a link
- *
- * If [path] is a symbolic link, rather than a file,
- * then the methods of File operate on the ultimate target of the
- * link, except for [delete] and [deleteSync], which operate on
- * the link.
- *
- * ## Read from a file
- *
- * The following code sample reads the entire contents from a file as a string
- * using the asynchronous [readAsString] method:
- *
- * import 'dart:async';
- * import 'dart:io';
- *
- * void main() {
- * new File('file.txt').readAsString().then((String contents) {
- * print(contents);
- * });
- * }
- *
- * A more flexible and useful way to read a file is with a [Stream].
- * Open the file with [openRead], which returns a stream that
- * provides the data in the file as chunks of bytes.
- * Listen to the stream for data and process as needed.
- * You can use various transformers in succession to manipulate the
- * data into the required format or to prepare it for output.
- *
- * You might want to use a stream to read large files,
- * to manipulate the data with tranformers,
- * or for compatibility with another API, such as [WebSocket]s.
- *
- * import 'dart:io';
- * import 'dart:convert';
- * import 'dart:async';
- *
- * main() {
- * final file = new File('file.txt');
- * Stream<List<int>> inputStream = file.openRead();
- *
- * inputStream
- * .transform(UTF8.decoder) // Decode bytes to UTF8.
- * .transform(new LineSplitter()) // Convert stream to individual lines.
- * .listen((String line) { // Process results.
- * print('$line: ${line.length} bytes');
- * },
- * onDone: () { print('File is now closed.'); },
- * onError: (e) { print(e.toString()); });
- * }
- *
- * ## Write to a file
- *
- * To write a string to a file, use the [writeAsString] method:
- *
- * import 'dart:io';
- *
- * void main() {
- * final filename = 'file.txt';
- * new File(filename).writeAsString('some content')
- * .then((File file) {
- * // Do something with the file.
- * });
- * }
- *
- * You can also write to a file using a [Stream]. Open the file with
- * [openWrite], which returns a stream to which you can write data.
- * Be sure to close the file with the [close] method.
- *
- * import 'dart:io';
- *
- * void main() {
- * var file = new File('file.txt');
- * var sink = file.openWrite();
- * sink.write('FILE ACCESSED ${new DateTime.now()}\n');
- *
- * // Close the IOSink to free system resources.
- * sink.close();
- * }
- *
- * ## The use of Futures
- *
- * To avoid unintentional blocking of the program,
- * several methods use a [Future] to return a value. For example,
- * the [length] method, which gets the length of a file, returns a Future.
- * Use `then` to register a callback function, which is called when
- * the value is ready.
- *
- * import 'dart:io';
- *
- * main() {
- * final file = new File('file.txt');
- *
- * file.length().then((len) {
- * print(len);
- * });
- * }
- *
- * In addition to length, the [exists], [lastModified], [stat], and
- * other methods, return Futures.
- *
- * ## Other resources
- *
- * * [Dart by Example](https://www.dartlang.org/dart-by-example/#files-directories-and-symlinks)
- * provides additional task-oriented code samples that show how to use
- * various API from the Directory class and the related [File] class.
- *
- * * [I/O for Command-Line
- * Apps](https://www.dartlang.org/docs/dart-up-and-running/ch03.html#dartio---io-for-command-line-apps)
- * a section from _A Tour of the Dart Libraries_ covers files and directories.
- *
- * * [Write Command-Line Apps](https://www.dartlang.org/docs/tutorials/cmdline/),
- * a tutorial about writing command-line apps, includes information about
- * files and directories.
- */
-abstract class File implements FileSystemEntity {
- /**
- * Creates a [File] object.
- *
- * If [path] is a relative path, it will be interpreted relative to the
- * current working directory (see [Directory.current]), when used.
- *
- * If [path] is an absolute path, it will be immune to changes to the
- * current working directory.
- */
- factory File(String path) => new _File(path);
-
- /**
- * Create a File object from a URI.
- *
- * If [uri] cannot reference a file this throws [UnsupportedError].
- */
- factory File.fromUri(Uri uri) => new File(uri.toFilePath());
-
- /**
- * Create the file. Returns a [:Future<File>:] that completes with
- * the file when it has been created.
- *
- * If [recursive] is false, the default, the file is created only if
- * all directories in the path exist. If [recursive] is true, all
- * non-existing path components are created.
- *
- * Existing files are left untouched by [create]. Calling [create] on an
- * existing file might fail if there are restrictive permissions on
- * the file.
- *
- * Completes the future with a [FileSystemException] if the operation fails.
- */
- Future<File> create({bool recursive: false});
-
- /**
- * Synchronously create the file. Existing files are left untouched
- * by [createSync]. Calling [createSync] on an existing file might fail
- * if there are restrictive permissions on the file.
- *
- * If [recursive] is false, the default, the file is created
- * only if all directories in the path exist.
- * If [recursive] is true, all non-existing path components are created.
- *
- * Throws a [FileSystemException] if the operation fails.
- */
- void createSync({bool recursive: false});
-
- /**
- * Renames this file. Returns a `Future<File>` that completes
- * with a [File] instance for the renamed file.
- *
- * If [newPath] identifies an existing file, that file is
- * replaced. If [newPath] identifies an existing directory, the
- * operation fails and the future completes with an exception.
- */
- Future<File> rename(String newPath);
-
- /**
- * Synchronously renames this file. Returns a [File]
- * instance for the renamed file.
- *
- * If [newPath] identifies an existing file, that file is
- * replaced. If [newPath] identifies an existing directory the
- * operation fails and an exception is thrown.
- */
- File renameSync(String newPath);
-
- /**
- * Copy this file. Returns a `Future<File>` that completes
- * with a [File] instance for the copied file.
- *
- * If [newPath] identifies an existing file, that file is
- * replaced. If [newPath] identifies an existing directory, the
- * operation fails and the future completes with an exception.
- */
- Future<File> copy(String newPath);
-
- /**
- * Synchronously copy this file. Returns a [File]
- * instance for the copied file.
- *
- * If [newPath] identifies an existing file, that file is
- * replaced. If [newPath] identifies an existing directory the
- * operation fails and an exception is thrown.
- */
- File copySync(String newPath);
-
- /**
- * Get the length of the file. Returns a [:Future<int>:] that
- * completes with the length in bytes.
- */
- Future<int> length();
-
- /**
- * Synchronously get the length of the file.
- *
- * Throws a [FileSystemException] if the operation fails.
- */
- int lengthSync();
-
- /**
- * Returns a [File] instance whose path is the absolute path to [this].
- *
- * The absolute path is computed by prefixing
- * a relative path with the current working directory, and returning
- * an absolute path unchanged.
- */
- File get absolute;
-
- /**
- * Get the last-modified time of the file. Returns a
- * [:Future<DateTime>:] that completes with a [DateTime] object for the
- * modification date.
- */
- Future<DateTime> lastModified();
-
- /**
- * Get the last-modified time of the file. Throws an exception
- * if the file does not exist.
- *
- * Throws a [FileSystemException] if the operation fails.
- */
- DateTime lastModifiedSync();
-
- /**
- * Open the file for random access operations. Returns a
- * [:Future<RandomAccessFile>:] that completes with the opened
- * random access file. [RandomAccessFile]s must be closed using the
- * [RandomAccessFile.close] method.
- *
- * Files can be opened in three modes:
- *
- * [FileMode.READ]: open the file for reading.
- *
- * [FileMode.WRITE]: open the file for both reading and writing and
- * truncate the file to length zero. If the file does not exist the
- * file is created.
- *
- * [FileMode.APPEND]: same as [FileMode.WRITE] except that the file is
- * not truncated.
- */
- Future<RandomAccessFile> open({FileMode mode: FileMode.READ});
-
- /**
- * Synchronously open the file for random access operations. The
- * result is a [RandomAccessFile] on which random access operations
- * can be performed. Opened [RandomAccessFile]s must be closed using
- * the [RandomAccessFile.close] method.
- *
- * See [open] for information on the [mode] argument.
- *
- * Throws a [FileSystemException] if the operation fails.
- */
- RandomAccessFile openSync({FileMode mode: FileMode.READ});
-
- /**
- * Create a new independent [Stream] for the contents of this file.
- *
- * If [start] is present, the file will be read from byte-offset [start].
- * Otherwise from the beginning (index 0).
- *
- * If [end] is present, only up to byte-index [end] will be read. Otherwise,
- * until end of file.
- *
- * In order to make sure that system resources are freed, the stream
- * must be read to completion or the subscription on the stream must
- * be cancelled.
- */
- Stream<List<int>> openRead([int start, int end]);
-
- /**
- * Creates a new independent [IOSink] for the file. The
- * [IOSink] must be closed when no longer used, to free
- * system resources.
- *
- * An [IOSink] for a file can be opened in two modes:
- *
- * * [FileMode.WRITE]: truncates the file to length zero.
- * * [FileMode.APPEND]: sets the initial write position to the end
- * of the file.
- *
- * When writing strings through the returned [IOSink] the encoding
- * specified using [encoding] will be used. The returned [IOSink]
- * has an [:encoding:] property which can be changed after the
- * [IOSink] has been created.
- */
- IOSink openWrite({FileMode mode: FileMode.WRITE,
- Encoding encoding: UTF8});
-
- /**
- * Read the entire file contents as a list of bytes. Returns a
- * [:Future<List<int>>:] that completes with the list of bytes that
- * is the contents of the file.
- */
- Future<List<int>> readAsBytes();
-
- /**
- * Synchronously read the entire file contents as a list of bytes.
- *
- * Throws a [FileSystemException] if the operation fails.
- */
- List<int> readAsBytesSync();
-
- /**
- * Read the entire file contents as a string using the given
- * [Encoding].
- *
- * Returns a [:Future<String>:] that completes with the string once
- * the file contents has been read.
- */
- Future<String> readAsString({Encoding encoding: UTF8});
-
- /**
- * Synchronously read the entire file contents as a string using the
- * given [Encoding].
- *
- * Throws a [FileSystemException] if the operation fails.
- */
- String readAsStringSync({Encoding encoding: UTF8});
-
- /**
- * Read the entire file contents as lines of text using the given
- * [Encoding].
- *
- * Returns a [:Future<List<String>>:] that completes with the lines
- * once the file contents has been read.
- */
- Future<List<String>> readAsLines({Encoding encoding: UTF8});
-
- /**
- * Synchronously read the entire file contents as lines of text
- * using the given [Encoding].
- *
- * Throws a [FileSystemException] if the operation fails.
- */
- List<String> readAsLinesSync({Encoding encoding: UTF8});
-
- /**
- * Write a list of bytes to a file.
- *
- * Opens the file, writes the list of bytes to it, and closes the file.
- * Returns a [:Future<File>:] that completes with this [File] object once
- * the entire operation has completed.
- *
- * By default [writeAsBytes] creates the file for writing and truncates the
- * file if it already exists. In order to append the bytes to an existing
- * file, pass [FileMode.APPEND] as the optional mode parameter.
- *
- * If the argument [flush] is set to `true`, the data written will be
- * flushed to the file system before the returned future completes.
- */
- Future<File> writeAsBytes(List<int> bytes,
- {FileMode mode: FileMode.WRITE,
- bool flush: false});
-
- /**
- * Synchronously write a list of bytes to a file.
- *
- * Opens the file, writes the list of bytes to it and closes the file.
- *
- * By default [writeAsBytesSync] creates the file for writing and truncates
- * the file if it already exists. In order to append the bytes to an existing
- * file, pass [FileMode.APPEND] as the optional mode parameter.
- *
- * If the [flush] argument is set to `true` data written will be
- * flushed to the file system before returning.
- *
- * Throws a [FileSystemException] if the operation fails.
- */
- void writeAsBytesSync(List<int> bytes,
- {FileMode mode: FileMode.WRITE,
- bool flush: false});
-
- /**
- * Write a string to a file.
- *
- * Opens the file, writes the string in the given encoding, and closes the
- * file. Returns a [:Future<File>:] that completes with this [File] object
- * once the entire operation has completed.
- *
- * By default [writeAsString] creates the file for writing and truncates the
- * file if it already exists. In order to append the bytes to an existing
- * file, pass [FileMode.APPEND] as the optional mode parameter.
- *
- * If the argument [flush] is set to `true`, the data written will be
- * flushed to the file system before the returned future completes.
- *
- */
- Future<File> writeAsString(String contents,
- {FileMode mode: FileMode.WRITE,
- Encoding encoding: UTF8,
- bool flush: false});
-
- /**
- * Synchronously write a string to a file.
- *
- * Opens the file, writes the string in the given encoding, and closes the
- * file.
- *
- * By default [writeAsStringSync] creates the file for writing and
- * truncates the file if it already exists. In order to append the bytes
- * to an existing file, pass [FileMode.APPEND] as the optional mode
- * parameter.
- *
- * If the [flush] argument is set to `true` data written will be
- * flushed to the file system before returning.
- *
- * Throws a [FileSystemException] if the operation fails.
- */
- void writeAsStringSync(String contents,
- {FileMode mode: FileMode.WRITE,
- Encoding encoding: UTF8,
- bool flush: false});
-
- /**
- * Get the path of the file.
- */
- String get path;
-}
-
-
-/**
- * `RandomAccessFile` provides random access to the data in a
- * file.
- *
- * `RandomAccessFile` objects are obtained by calling the
- * [:open:] method on a [File] object.
- *
- * A `RandomAccessFile` have both asynchronous and synchronous
- * methods. The asynchronous methods all return a `Future`
- * whereas the synchronous methods will return the result directly,
- * and block the current isolate until the result is ready.
- *
- * At most one asynchronous method can be pending on a given `RandomAccessFile`
- * instance at the time. If an asynchronous method is called when one is
- * already in progress a [FileSystemException] is thrown.
- *
- * If an asynchronous method is pending it is also not possible to call any
- * synchronous methods. This will also throw a [FileSystemException].
- */
-abstract class RandomAccessFile {
- /**
- * Closes the file. Returns a [:Future<RandomAccessFile>:] that
- * completes with this RandomAccessFile when it has been closed.
- */
- Future<RandomAccessFile> close();
-
- /**
- * Synchronously closes the file.
- *
- * Throws a [FileSystemException] if the operation fails.
- */
- void closeSync();
-
- /**
- * Reads a byte from the file. Returns a [:Future<int>:] that
- * completes with the byte, or with -1 if end-of-file has been reached.
- */
- Future<int> readByte();
-
- /**
- * Synchronously reads a single byte from the file. If end-of-file
- * has been reached -1 is returned.
- *
- * Throws a [FileSystemException] if the operation fails.
- */
- int readByteSync();
-
- /**
- * Reads [bytes] bytes from a file and returns the result as a list of bytes.
- */
- Future<List<int>> read(int bytes);
-
- /**
- * Synchronously reads a maximum of [bytes] bytes from a file and
- * returns the result in a list of bytes.
- *
- * Throws a [FileSystemException] if the operation fails.
- */
- List<int> readSync(int bytes);
-
- /**
- * Reads into an existing List<int> from the file. If [start] is present, the
- * bytes will be filled into [buffer] from at index [start], otherwise index
- * 0. If [end] is present, the [end] - [start] bytes will be read into
- * [buffer], otherwise up to [buffer.length]. If [end] == [start] nothing
- * happens.
- *
- * Returns a [:Future<int>:] that completes with the number of bytes read.
- */
- Future<int> readInto(List<int> buffer, [int start = 0, int end]);
-
- /**
- * Synchronously reads into an existing List<int> from the file. If [start] is
- * present, the bytes will be filled into [buffer] from at index [start],
- * otherwise index 0. If [end] is present, the [end] - [start] bytes will be
- * read into [buffer], otherwise up to [buffer.length]. If [end] == [start]
- * nothing happens.
- *
- * Throws a [FileSystemException] if the operation fails.
- */
- int readIntoSync(List<int> buffer, [int start = 0, int end]);
-
- /**
- * Writes a single byte to the file. Returns a
- * [:Future<RandomAccessFile>:] that completes with this
- * RandomAccessFile when the write completes.
- */
- Future<RandomAccessFile> writeByte(int value);
-
- /**
- * Synchronously writes a single byte to the file. Returns the
- * number of bytes successfully written.
- *
- * Throws a [FileSystemException] if the operation fails.
- */
- int writeByteSync(int value);
-
- /**
- * Writes from a [List<int>] to the file. It will read the buffer from index
- * [start] to index [end]. If [start] is omitted, it'll start from index 0.
- * If [end] is omitted, it will write to end of [buffer].
- *
- * Returns a [:Future<RandomAccessFile>:] that completes with this
- * [RandomAccessFile] when the write completes.
- */
- Future<RandomAccessFile> writeFrom(
- List<int> buffer, [int start = 0, int end]);
-
- /**
- * Synchronously writes from a [List<int>] to the file. It will read the
- * buffer from index [start] to index [end]. If [start] is omitted, it'll
- * start from index 0. If [end] is omitted, it will write to the end of
- * [buffer].
- *
- * Throws a [FileSystemException] if the operation fails.
- */
- void writeFromSync(List<int> buffer, [int start = 0, int end]);
-
- /**
- * Writes a string to the file using the given [Encoding]. Returns a
- * [:Future<RandomAccessFile>:] that completes with this
- * RandomAccessFile when the write completes.
- */
- Future<RandomAccessFile> writeString(String string,
- {Encoding encoding: UTF8});
-
- /**
- * Synchronously writes a single string to the file using the given
- * [Encoding].
- *
- * Throws a [FileSystemException] if the operation fails.
- */
- void writeStringSync(String string,
- {Encoding encoding: UTF8});
-
- /**
- * Gets the current byte position in the file. Returns a
- * [:Future<int>:] that completes with the position.
- */
- Future<int> position();
-
- /**
- * Synchronously gets the current byte position in the file.
- *
- * Throws a [FileSystemException] if the operation fails.
- */
- int positionSync();
-
- /**
- * Sets the byte position in the file. Returns a
- * [:Future<RandomAccessFile>:] that completes with this
- * RandomAccessFile when the position has been set.
- */
- Future<RandomAccessFile> setPosition(int position);
-
- /**
- * Synchronously sets the byte position in the file.
- *
- * Throws a [FileSystemException] if the operation fails.
- */
- void setPositionSync(int position);
-
- /**
- * Truncates (or extends) the file to [length] bytes. Returns a
- * [:Future<RandomAccessFile>:] that completes with this
- * RandomAccessFile when the truncation has been performed.
- */
- Future<RandomAccessFile> truncate(int length);
-
- /**
- * Synchronously truncates (or extends) the file to [length] bytes.
- *
- * Throws a [FileSystemException] if the operation fails.
- */
- void truncateSync(int length);
-
- /**
- * Gets the length of the file. Returns a [:Future<int>:] that
- * completes with the length in bytes.
- */
- Future<int> length();
-
- /**
- * Synchronously gets the length of the file.
- *
- * Throws a [FileSystemException] if the operation fails.
- */
- int lengthSync();
-
- /**
- * Flushes the contents of the file to disk. Returns a
- * [:Future<RandomAccessFile>:] that completes with this
- * RandomAccessFile when the flush operation completes.
- */
- Future<RandomAccessFile> flush();
-
- /**
- * Synchronously flushes the contents of the file to disk.
- *
- * Throws a [FileSystemException] if the operation fails.
- */
- void flushSync();
-
- /**
- * Locks the file or part of the file.
- *
- * By default an exclusive lock will be obtained, but that can be overridden
- * by the [mode] argument.
- *
- * Locks the byte range from [start] to [end] of the file, with the
- * byte at position `end` not included. If no arguments are
- * specified, the full file is locked, If only `start` is specified
- * the file is locked from byte position `start` to the end of the
- * file, no matter how large it grows. It is possible to specify an
- * explicit value of `end` which is past the current length of the file.
- *
- * To obtain an exclusive lock on a file it must be opened for writing.
- *
- * *NOTE* file locking does have slight differences in behavior across
- * platforms:
- *
- * On Linux and OS X this uses advisory locks, which have the
- * surprising semantics that all locks associated with a given file
- * are removed when *any* file descriptor for that file is closed by
- * the process. Note that this does not actually lock the file for
- * access. Also note that advisory locks are on a process
- * level. This means that several isolates in the same process can
- * obtain an exclusive lock on the same file.
- *
- * On Windows the regions used for lock and unlock needs to match. If that
- * is not the case unlocking will result in the OS error "The segment is
- * already unlocked".
- */
- Future<RandomAccessFile> lock(
- [FileLock mode = FileLock.EXCLUSIVE, int start = 0, int end = -1]);
-
- /**
- * Synchronously locks the file or part of the file.
- *
- * By default an exclusive lock will be obtained, but that can be overridden
- * by the [mode] argument.
- *
- * Locks the byte range from [start] to [end] of the file ,with the
- * byte at position `end` not included. If no arguments are
- * specified, the full file is locked, If only `start` is specified
- * the file is locked from byte position `start` to the end of the
- * file, no matter how large it grows. It is possible to specify an
- * explicit value of `end` which is past the current length of the file.
- *
- * To obtain an exclusive lock on a file it must be opened for writing.
- *
- * *NOTE* file locking does have slight differences in behavior across
- * platforms:
- *
- * On Linux and OS X this uses advisory locks, which have the
- * surprising semantics that all locks associated with a given file
- * are removed when *any* file descriptor for that file is closed by
- * the process. Note that this does not actually lock the file for
- * access. Also note that advisory locks are on a process
- * level. This means that several isolates in the same process can
- * obtain an exclusive lock on the same file.
- *
- * On Windows the regions used for lock and unlock needs to match. If that
- * is not the case unlocking will result in the OS error "The segment is
- * already unlocked".
- *
- */
- void lockSync(
- [FileLock mode = FileLock.EXCLUSIVE, int start = 0, int end = -1]);
-
- /**
- * Unlocks the file or part of the file.
- *
- * Unlocks the byte range from [start] to [end] of the file, with
- * the byte at position `end` not included. If no arguments are
- * specified, the full file is unlocked, If only `start` is
- * specified the file is unlocked from byte position `start` to the
- * end of the file.
- *
- * *NOTE* file locking does have slight differences in behavior across
- * platforms:
- *
- * See [lock] for more details.
- */
- Future<RandomAccessFile> unlock([int start = 0, int end = -1]);
-
- /**
- * Synchronously unlocks the file or part of the file.
- *
- * Unlocks the byte range from [start] to [end] of the file, with
- * the byte at position `end` not included. If no arguments are
- * specified, the full file is unlocked, If only `start` is
- * specified the file is unlocked from byte position `start` to the
- * end of the file.
- *
- * *NOTE* file locking does have slight differences in behavior across
- * platforms:
- *
- * See [lockSync] for more details.
- */
- void unlockSync([int start = 0, int end = -1]);
-
- /**
- * Returns a human-readable string for this RandomAccessFile instance.
- */
- String toString();
-
- /**
- * Gets the path of the file underlying this RandomAccessFile.
- */
- String get path;
-}
-
-
-/**
- * Exception thrown when a file operation fails.
- */
-class FileSystemException implements IOException {
- /**
- * Message describing the error. This does not include any detailed
- * information form the underlying OS error. Check [osError] for
- * that information.
- */
- final String message;
-
- /**
- * The file system path on which the error occurred. Can be `null`
- * if the exception does not relate directly to a file system path.
- */
- final String path;
-
- /**
- * The underlying OS error. Can be `null` if the exception is not
- * raised due to an OS error.
- */
- final OSError osError;
-
- /**
- * Creates a new FileSystemException with an optional error message
- * [message], optional file system path [path] and optional OS error
- * [osError].
- */
- const FileSystemException([this.message = "", this.path = "", this.osError]);
-
- String toString() {
- StringBuffer sb = new StringBuffer();
- sb.write("FileSystemException");
- if (!message.isEmpty) {
- sb.write(": $message");
- if (path != null) {
- sb.write(", path = '$path'");
- }
- if (osError != null) {
- sb.write(" ($osError)");
- }
- } else if (osError != null) {
- sb.write(": $osError");
- if (path != null) {
- sb.write(", path = '$path'");
- }
- } else if (path != null) {
- sb.write(": $path");
- }
- return sb.toString();
- }
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/io/file_impl.dart b/pkg/dev_compiler/tool/input_sdk/lib/io/file_impl.dart
deleted file mode 100644
index a6fdde8..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/io/file_impl.dart
+++ /dev/null
@@ -1,1025 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-part of dart.io;
-
-// Read the file in blocks of size 64k.
-const int _BLOCK_SIZE = 64 * 1024;
-
-
-class _FileStream extends Stream<List<int>> {
- // Stream controller.
- StreamController<List<int>> _controller;
-
- // Information about the underlying file.
- String _path;
- RandomAccessFile _openedFile;
- int _position;
- int _end;
- final Completer _closeCompleter = new Completer();
-
- // Has the stream been paused or unsubscribed?
- bool _unsubscribed = false;
-
- // Is there a read currently in progress?
- bool _readInProgress = true;
- bool _closed = false;
-
- bool _atEnd = false;
-
- _FileStream(this._path, this._position, this._end) {
- if (_position == null) _position = 0;
- }
-
- _FileStream.forStdin() : _position = 0;
-
- StreamSubscription<List<int>> listen(void onData(List<int> event),
- {Function onError,
- void onDone(),
- bool cancelOnError}) {
- _setupController();
- return _controller.stream.listen(onData,
- onError: onError,
- onDone: onDone,
- cancelOnError: cancelOnError);
- }
-
- void _setupController() {
- _controller = new StreamController<List<int>>(sync: true,
- onListen: _start,
- onResume: _readBlock,
- onCancel: () {
- _unsubscribed = true;
- return _closeFile();
- });
- }
-
- Future _closeFile() {
- if (_readInProgress || _closed) {
- return _closeCompleter.future;
- }
- _closed = true;
-
- void done() {
- _closeCompleter.complete();
- _controller.close();
- }
-
- _openedFile.close()
- .catchError(_controller.addError)
- .whenComplete(done);
- return _closeCompleter.future;
- }
-
- void _readBlock() {
- // Don't start a new read if one is already in progress.
- if (_readInProgress) return;
- if (_atEnd) {
- _closeFile();
- return;
- }
- _readInProgress = true;
- int readBytes = _BLOCK_SIZE;
- if (_end != null) {
- readBytes = min(readBytes, _end - _position);
- if (readBytes < 0) {
- _readInProgress = false;
- if (!_unsubscribed) {
- _controller.addError(new RangeError("Bad end position: $_end"));
- _closeFile();
- _unsubscribed = true;
- }
- return;
- }
- }
- _openedFile.read(readBytes)
- .then((block) {
- _readInProgress = false;
- if (_unsubscribed) {
- _closeFile();
- return;
- }
- _position += block.length;
- if (block.length < readBytes ||
- (_end != null && _position == _end)) {
- _atEnd = true;
- }
- if (!_atEnd && !_controller.isPaused) {
- _readBlock();
- }
- _controller.add(block);
- if (_atEnd) {
- _closeFile();
- }
- })
- .catchError((e, s) {
- if (!_unsubscribed) {
- _controller.addError(e, s);
- _closeFile();
- _unsubscribed = true;
- }
- });
- }
-
- void _start() {
- if (_position < 0) {
- _controller.addError(new RangeError("Bad start position: $_position"));
- _controller.close();
- _closeCompleter.complete();
- return;
- }
-
- void onReady(RandomAccessFile file) {
- _openedFile = file;
- _readInProgress = false;
- _readBlock();
- }
-
- void onOpenFile(RandomAccessFile file) {
- if (_position > 0) {
- file.setPosition(_position)
- .then(onReady, onError: (e, s) {
- _controller.addError(e, s);
- _readInProgress = false;
- _closeFile();
- });
- } else {
- onReady(file);
- }
- }
-
- void openFailed(error, stackTrace) {
- _controller.addError(error, stackTrace);
- _controller.close();
- _closeCompleter.complete();
- }
-
- if (_path != null) {
- new File(_path).open(mode: FileMode.READ)
- .then(onOpenFile, onError: openFailed);
- } else {
- try {
- onOpenFile(_File._openStdioSync(0));
- } catch (e, s) {
- openFailed(e, s);
- }
- }
- }
-}
-
-class _FileStreamConsumer extends StreamConsumer<List<int>> {
- File _file;
- Future<RandomAccessFile> _openFuture;
-
- _FileStreamConsumer(File this._file, FileMode mode) {
- _openFuture = _file.open(mode: mode);
- }
-
- _FileStreamConsumer.fromStdio(int fd) {
- assert(1 <= fd && fd <= 2);
- _openFuture = new Future.value(_File._openStdioSync(fd));
- }
-
- Future<File> addStream(Stream<List<int>> stream) {
- Completer<File> completer = new Completer<File>.sync();
- _openFuture
- .then((openedFile) {
- var _subscription;
- void error(e, [StackTrace stackTrace]) {
- _subscription.cancel();
- openedFile.close();
- completer.completeError(e, stackTrace);
- }
- _subscription = stream.listen(
- (d) {
- _subscription.pause();
- try {
- openedFile.writeFrom(d, 0, d.length)
- .then((_) => _subscription.resume(),
- onError: error);
- } catch (e, stackTrace) {
- error(e, stackTrace);
- }
- },
- onDone: () {
- completer.complete(_file);
- },
- onError: error,
- cancelOnError: true);
- })
- .catchError(completer.completeError);
- return completer.future;
- }
-
- Future<File> close() =>
- _openFuture.then((openedFile) => openedFile.close());
-}
-
-
-// Class for encapsulating the native implementation of files.
-class _File extends FileSystemEntity implements File {
- final String path;
-
- // Constructor for file.
- _File(this.path) {
- if (path is! String) {
- throw new ArgumentError('${Error.safeToString(path)} '
- 'is not a String');
- }
- }
-
- Future<bool> exists() {
- return _IOService._dispatch(_FILE_EXISTS, [path]).then((response) {
- if (_isErrorResponse(response)) {
- throw _exceptionFromResponse(response, "Cannot check existence", path);
- }
- return response;
- });
- }
-
- external static _exists(String path);
-
- bool existsSync() {
- var result = _exists(path);
- throwIfError(result, "Cannot check existence of file", path);
- return result;
- }
-
- File get absolute => new File(_absolutePath);
-
- Future<FileStat> stat() => FileStat.stat(path);
-
- FileStat statSync() => FileStat.statSync(path);
-
- Future<File> create({bool recursive: false}) {
- var result = recursive ? parent.create(recursive: true)
- : new Future.value(null);
- return result
- .then((_) => _IOService._dispatch(_FILE_CREATE, [path]))
- .then((response) {
- if (_isErrorResponse(response)) {
- throw _exceptionFromResponse(response, "Cannot create file", path);
- }
- return this;
- });
- }
-
- external static _create(String path);
-
- external static _createLink(String path, String target);
-
- external static _linkTarget(String path);
-
- void createSync({bool recursive: false}) {
- if (recursive) {
- parent.createSync(recursive: true);
- }
- var result = _create(path);
- throwIfError(result, "Cannot create file", path);
- }
-
- Future<File> _delete({bool recursive: false}) {
- if (recursive) {
- return new Directory(path).delete(recursive: true).then((_) => this);
- }
- return _IOService._dispatch(_FILE_DELETE, [path]).then((response) {
- if (_isErrorResponse(response)) {
- throw _exceptionFromResponse(response, "Cannot delete file", path);
- }
- return this;
- });
- }
-
- external static _deleteNative(String path);
-
- external static _deleteLinkNative(String path);
-
- void _deleteSync({bool recursive: false}) {
- if (recursive) {
- return new Directory(path).deleteSync(recursive: true);
- }
- var result = _deleteNative(path);
- throwIfError(result, "Cannot delete file", path);
- }
-
- Future<File> rename(String newPath) {
- return _IOService._dispatch(_FILE_RENAME, [path, newPath]).then((response) {
- if (_isErrorResponse(response)) {
- throw _exceptionFromResponse(
- response, "Cannot rename file to '$newPath'", path);
- }
- return new File(newPath);
- });
- }
-
- external static _rename(String oldPath, String newPath);
-
- external static _renameLink(String oldPath, String newPath);
-
- File renameSync(String newPath) {
- var result = _rename(path, newPath);
- throwIfError(result, "Cannot rename file to '$newPath'", path);
- return new File(newPath);
- }
-
- Future<File> copy(String newPath) {
- return _IOService._dispatch(_FILE_COPY, [path, newPath]).then((response) {
- if (_isErrorResponse(response)) {
- throw _exceptionFromResponse(
- response, "Cannot copy file to '$newPath'", path);
- }
- return new File(newPath);
- });
- }
-
- external static _copy(String oldPath, String newPath);
-
- File copySync(String newPath) {
- var result = _copy(path, newPath);
- throwIfError(result, "Cannot copy file to '$newPath'", path);
- return new File(newPath);
- }
-
- Future<RandomAccessFile> open({FileMode mode: FileMode.READ}) {
- if (mode != FileMode.READ &&
- mode != FileMode.WRITE &&
- mode != FileMode.APPEND &&
- mode != FileMode.WRITE_ONLY &&
- mode != FileMode.WRITE_ONLY_APPEND) {
- return new Future.error(
- new ArgumentError('Invalid file mode for this operation'));
- }
- return _IOService._dispatch(_FILE_OPEN, [path, mode._mode])
- .then((response) {
- if (_isErrorResponse(response)) {
- throw _exceptionFromResponse(response, "Cannot open file", path);
- }
- return new _RandomAccessFile(response, path);
- });
- }
-
- Future<int> length() {
- return _IOService._dispatch(_FILE_LENGTH_FROM_PATH, [path])
- .then((response) {
- if (_isErrorResponse(response)) {
- throw _exceptionFromResponse(response,
- "Cannot retrieve length of file",
- path);
- }
- return response;
- });
- }
-
-
- external static _lengthFromPath(String path);
-
- int lengthSync() {
- var result = _lengthFromPath(path);
- throwIfError(result, "Cannot retrieve length of file", path);
- return result;
- }
-
- Future<DateTime> lastModified() {
- return _IOService._dispatch(_FILE_LAST_MODIFIED, [path]).then((response) {
- if (_isErrorResponse(response)) {
- throw _exceptionFromResponse(response,
- "Cannot retrieve modification time",
- path);
- }
- return new DateTime.fromMillisecondsSinceEpoch(response);
- });
- }
-
- external static _lastModified(String path);
-
- DateTime lastModifiedSync() {
- var ms = _lastModified(path);
- throwIfError(ms, "Cannot retrieve modification time", path);
- return new DateTime.fromMillisecondsSinceEpoch(ms);
- }
-
- external static _open(String path, int mode);
-
- RandomAccessFile openSync({FileMode mode: FileMode.READ}) {
- if (mode != FileMode.READ &&
- mode != FileMode.WRITE &&
- mode != FileMode.APPEND &&
- mode != FileMode.WRITE_ONLY &&
- mode != FileMode.WRITE_ONLY_APPEND) {
- throw new ArgumentError('Invalid file mode for this operation');
- }
- var id = _open(path, mode._mode);
- throwIfError(id, "Cannot open file", path);
- return new _RandomAccessFile(id, path);
- }
-
- external static int _openStdio(int fd);
-
- static RandomAccessFile _openStdioSync(int fd) {
- var id = _openStdio(fd);
- if (id == 0) {
- throw new FileSystemException("Cannot open stdio file for: $fd");
- }
- return new _RandomAccessFile(id, "");
- }
-
- Stream<List<int>> openRead([int start, int end]) {
- return new _FileStream(path, start, end);
- }
-
- IOSink openWrite({FileMode mode: FileMode.WRITE,
- Encoding encoding: UTF8}) {
- if (mode != FileMode.WRITE &&
- mode != FileMode.APPEND &&
- mode != FileMode.WRITE_ONLY &&
- mode != FileMode.WRITE_ONLY_APPEND) {
- throw new ArgumentError('Invalid file mode for this operation');
- }
- var consumer = new _FileStreamConsumer(this, mode);
- return new IOSink(consumer, encoding: encoding);
- }
-
- Future<List<int>> readAsBytes() {
- Future<List<int>> readDataChunked(file) {
- var builder = new BytesBuilder(copy: false);
- var completer = new Completer();
- void read() {
- file.read(_BLOCK_SIZE).then((data) {
- if (data.length > 0) {
- builder.add(data);
- read();
- } else {
- completer.complete(builder.takeBytes());
- }
- }, onError: completer.completeError);
- }
- read();
- return completer.future;
- }
-
- return open().then((file) {
- return file.length().then((length) {
- if (length == 0) {
- // May be character device, try to read it in chunks.
- return readDataChunked(file);
- }
- return file.read(length);
- }).whenComplete(file.close);
- });
- }
-
- List<int> readAsBytesSync() {
- var opened = openSync();
- try {
- var data;
- var length = opened.lengthSync();
- if (length == 0) {
- // May be character device, try to read it in chunks.
- var builder = new BytesBuilder(copy: false);
- do {
- data = opened.readSync(_BLOCK_SIZE);
- if (data.length > 0) builder.add(data);
- } while (data.length > 0);
- data = builder.takeBytes();
- } else {
- data = opened.readSync(length);
- }
- return data;
- } finally {
- opened.closeSync();
- }
- }
-
- String _tryDecode(List<int> bytes, Encoding encoding) {
- try {
- return encoding.decode(bytes);
- } catch (_) {
- throw new FileSystemException(
- "Failed to decode data using encoding '${encoding.name}'", path);
- }
- }
-
- Future<String> readAsString({Encoding encoding: UTF8}) =>
- readAsBytes().then((bytes) => _tryDecode(bytes, encoding));
-
- String readAsStringSync({Encoding encoding: UTF8}) =>
- _tryDecode(readAsBytesSync(), encoding);
-
- Future<List<String>> readAsLines({Encoding encoding: UTF8}) =>
- readAsString(encoding: encoding).then(const LineSplitter().convert);
-
- List<String> readAsLinesSync({Encoding encoding: UTF8}) =>
- const LineSplitter().convert(readAsStringSync(encoding: encoding));
-
- Future<File> writeAsBytes(List<int> bytes,
- {FileMode mode: FileMode.WRITE,
- bool flush: false}) {
- return open(mode: mode).then((file) {
- return file.writeFrom(bytes, 0, bytes.length)
- .then((_) {
- if (flush) return file.flush().then((_) => this);
- return this;
- })
- .whenComplete(file.close);
- });
- }
-
- void writeAsBytesSync(List<int> bytes,
- {FileMode mode: FileMode.WRITE,
- bool flush: false}) {
- RandomAccessFile opened = openSync(mode: mode);
- try {
- opened.writeFromSync(bytes, 0, bytes.length);
- if (flush) opened.flushSync();
- } finally {
- opened.closeSync();
- }
- }
-
- Future<File> writeAsString(String contents,
- {FileMode mode: FileMode.WRITE,
- Encoding encoding: UTF8,
- bool flush: false}) {
- try {
- return writeAsBytes(encoding.encode(contents), mode: mode, flush: flush);
- } catch (e) {
- return new Future.error(e);
- }
- }
-
- void writeAsStringSync(String contents,
- {FileMode mode: FileMode.WRITE,
- Encoding encoding: UTF8,
- bool flush: false}) {
- writeAsBytesSync(encoding.encode(contents), mode: mode, flush: flush);
- }
-
- String toString() => "File: '$path'";
-
- static throwIfError(Object result, String msg, String path) {
- if (result is OSError) {
- throw new FileSystemException(msg, path, result);
- }
- }
-}
-
-abstract class _RandomAccessFileOps {
- external factory _RandomAccessFileOps(int pointer);
-
- int getPointer();
- int close();
- readByte();
- read(int bytes);
- readInto(List<int> buffer, int start, int end);
- writeByte(int value);
- writeFrom(List<int> buffer, int start, int end);
- position();
- setPosition(int position);
- truncate(int length);
- length();
- flush();
- lock(int lock, int start, int end);
-}
-
-class _RandomAccessFile implements RandomAccessFile {
- static bool _connectedResourceHandler = false;
-
- final String path;
-
- bool _asyncDispatched = false;
- SendPort _fileService;
-
- _FileResourceInfo _resourceInfo;
- _RandomAccessFileOps _ops;
-
- _RandomAccessFile(int pointer, this.path) {
- _ops = new _RandomAccessFileOps(pointer);
- _resourceInfo = new _FileResourceInfo(this);
- _maybeConnectHandler();
- }
-
- void _maybePerformCleanup() {
- if (closed) {
- _FileResourceInfo.FileClosed(_resourceInfo);
- }
- }
-
- _maybeConnectHandler() {
- if (!_connectedResourceHandler) {
- // TODO(ricow): We probably need to set these in some initialization code.
- // We need to make sure that these are always available from the
- // observatory even if no files (or sockets for the socket ones) are
- // open.
- registerExtension('ext.dart.io.getOpenFiles',
- _FileResourceInfo.getOpenFiles);
- registerExtension('ext.dart.io.getFileByID',
- _FileResourceInfo.getFileInfoMapByID);
- _connectedResourceHandler = true;
- }
- }
-
- Future<RandomAccessFile> close() {
- return _dispatch(_FILE_CLOSE, [null], markClosed: true).then((result) {
- if (result != -1) {
- closed = closed || (result == 0);
- _maybePerformCleanup();
- return this;
- } else {
- throw new FileSystemException("Cannot close file", path);
- }
- });
- }
-
- void closeSync() {
- _checkAvailable();
- var id = _ops.close();
- if (id == -1) {
- throw new FileSystemException("Cannot close file", path);
- }
- closed = closed || (id == 0);
- _maybePerformCleanup();
- }
-
- Future<int> readByte() {
- return _dispatch(_FILE_READ_BYTE, [null]).then((response) {
- if (_isErrorResponse(response)) {
- throw _exceptionFromResponse(response, "readByte failed", path);
- }
- _resourceInfo.addRead(1);
- return response;
- });
- }
-
- int readByteSync() {
- _checkAvailable();
- var result = _ops.readByte();
- if (result is OSError) {
- throw new FileSystemException("readByte failed", path, result);
- }
- _resourceInfo.addRead(1);
- return result;
- }
-
- Future<List<int>> read(int bytes) {
- if (bytes is !int) {
- throw new ArgumentError(bytes);
- }
- return _dispatch(_FILE_READ, [null, bytes]).then((response) {
- if (_isErrorResponse(response)) {
- throw _exceptionFromResponse(response, "read failed", path);
- }
- _resourceInfo.addRead(response[1].length);
- return response[1];
- });
- }
-
- List<int> readSync(int bytes) {
- _checkAvailable();
- if (bytes is !int) {
- throw new ArgumentError(bytes);
- }
- var result = _ops.read(bytes);
- if (result is OSError) {
- throw new FileSystemException("readSync failed", path, result);
- }
- _resourceInfo.addRead(result.length);
- return result;
- }
-
- Future<int> readInto(List<int> buffer, [int start = 0, int end]) {
- if ((buffer is !List) ||
- ((start != null) && (start is !int)) ||
- ((end != null) && (end is !int))) {
- throw new ArgumentError();
- }
- end = RangeError.checkValidRange(start, end, buffer.length);
- if (end == start) {
- return new Future.value(0);
- }
- int length = end - start;
- return _dispatch(_FILE_READ_INTO, [null, length]).then((response) {
- if (_isErrorResponse(response)) {
- throw _exceptionFromResponse(response, "readInto failed", path);
- }
- var read = response[1];
- var data = response[2];
- buffer.setRange(start, start + read, data);
- _resourceInfo.addRead(read);
- return read;
- });
- }
-
- int readIntoSync(List<int> buffer, [int start = 0, int end]) {
- _checkAvailable();
- if ((buffer is !List) ||
- ((start != null) && (start is !int)) ||
- ((end != null) && (end is !int))) {
- throw new ArgumentError();
- }
- end = RangeError.checkValidRange(start, end, buffer.length);
- if (end == start) {
- return 0;
- }
- var result = _ops.readInto(buffer, start, end);
- if (result is OSError) {
- throw new FileSystemException("readInto failed", path, result);
- }
- _resourceInfo.addRead(result);
- return result;
- }
-
- Future<RandomAccessFile> writeByte(int value) {
- if (value is !int) {
- throw new ArgumentError(value);
- }
- return _dispatch(_FILE_WRITE_BYTE, [null, value]).then((response) {
- if (_isErrorResponse(response)) {
- throw _exceptionFromResponse(response, "writeByte failed", path);
- }
- _resourceInfo.addWrite(1);
- return this;
- });
- }
-
- int writeByteSync(int value) {
- _checkAvailable();
- if (value is !int) {
- throw new ArgumentError(value);
- }
- var result = _ops.writeByte(value);
- if (result is OSError) {
- throw new FileSystemException("writeByte failed", path, result);
- }
- _resourceInfo.addWrite(1);
- return result;
- }
-
- Future<RandomAccessFile> writeFrom(
- List<int> buffer, [int start = 0, int end]) {
- if ((buffer is !List) ||
- ((start != null) && (start is !int)) ||
- ((end != null) && (end is !int))) {
- throw new ArgumentError("Invalid arguments to writeFrom");
- }
- end = RangeError.checkValidRange(start, end, buffer.length);
- if (end == start) {
- return new Future.value(this);
- }
- _BufferAndStart result;
- try {
- result = _ensureFastAndSerializableByteData(buffer, start, end);
- } catch (e) {
- return new Future.error(e);
- }
-
- List request = new List(4);
- request[0] = null;
- request[1] = result.buffer;
- request[2] = result.start;
- request[3] = end - (start - result.start);
- return _dispatch(_FILE_WRITE_FROM, request).then((response) {
- if (_isErrorResponse(response)) {
- throw _exceptionFromResponse(response, "writeFrom failed", path);
- }
- _resourceInfo.addWrite(end - (start - result.start));
- return this;
- });
- }
-
- void writeFromSync(List<int> buffer, [int start = 0, int end]) {
- _checkAvailable();
- if ((buffer is !List) ||
- ((start != null) && (start is !int)) ||
- ((end != null) && (end is !int))) {
- throw new ArgumentError("Invalid arguments to writeFromSync");
- }
- end = RangeError.checkValidRange(start, end, buffer.length);
- if (end == start) {
- return;
- }
- _BufferAndStart bufferAndStart =
- _ensureFastAndSerializableByteData(buffer, start, end);
- var result = _ops.writeFrom(bufferAndStart.buffer,
- bufferAndStart.start,
- end - (start - bufferAndStart.start));
- if (result is OSError) {
- throw new FileSystemException("writeFrom failed", path, result);
- }
- _resourceInfo.addWrite(end - (start - bufferAndStart.start));
- }
-
- Future<RandomAccessFile> writeString(String string,
- {Encoding encoding: UTF8}) {
- if (encoding is! Encoding) {
- throw new ArgumentError(encoding);
- }
- var data = encoding.encode(string);
- return writeFrom(data, 0, data.length);
- }
-
- void writeStringSync(String string, {Encoding encoding: UTF8}) {
- if (encoding is! Encoding) {
- throw new ArgumentError(encoding);
- }
- var data = encoding.encode(string);
- writeFromSync(data, 0, data.length);
- }
-
- Future<int> position() {
- return _dispatch(_FILE_POSITION, [null]).then((response) {
- if (_isErrorResponse(response)) {
- throw _exceptionFromResponse(response, "position failed", path);
- }
- return response;
- });
- }
-
- int positionSync() {
- _checkAvailable();
- var result = _ops.position();
- if (result is OSError) {
- throw new FileSystemException("position failed", path, result);
- }
- return result;
- }
-
- Future<RandomAccessFile> setPosition(int position) {
- return _dispatch(_FILE_SET_POSITION, [null, position])
- .then((response) {
- if (_isErrorResponse(response)) {
- throw _exceptionFromResponse(response, "setPosition failed", path);
- }
- return this;
- });
- }
-
- void setPositionSync(int position) {
- _checkAvailable();
- var result = _ops.setPosition(position);
- if (result is OSError) {
- throw new FileSystemException("setPosition failed", path, result);
- }
- }
-
- Future<RandomAccessFile> truncate(int length) {
- return _dispatch(_FILE_TRUNCATE, [null, length]).then((response) {
- if (_isErrorResponse(response)) {
- throw _exceptionFromResponse(response, "truncate failed", path);
- }
- return this;
- });
- }
-
- void truncateSync(int length) {
- _checkAvailable();
- var result = _ops.truncate(length);
- if (result is OSError) {
- throw new FileSystemException("truncate failed", path, result);
- }
- }
-
- Future<int> length() {
- return _dispatch(_FILE_LENGTH, [null]).then((response) {
- if (_isErrorResponse(response)) {
- throw _exceptionFromResponse(response, "length failed", path);
- }
- return response;
- });
- }
-
- int lengthSync() {
- _checkAvailable();
- var result = _ops.length();
- if (result is OSError) {
- throw new FileSystemException("length failed", path, result);
- }
- return result;
- }
-
- Future<RandomAccessFile> flush() {
- return _dispatch(_FILE_FLUSH, [null]).then((response) {
- if (_isErrorResponse(response)) {
- throw _exceptionFromResponse(response,
- "flush failed",
- path);
- }
- return this;
- });
- }
-
- void flushSync() {
- _checkAvailable();
- var result = _ops.flush();
- if (result is OSError) {
- throw new FileSystemException("flush failed", path, result);
- }
- }
-
- static final int LOCK_UNLOCK = 0;
- static final int LOCK_SHARED = 1;
- static final int LOCK_EXCLUSIVE = 2;
-
- Future<RandomAccessFile> lock(
- [FileLock mode = FileLock.EXCLUSIVE, int start = 0, int end = -1]) {
- if ((mode is !FileLock) || (start is !int) || (end is !int)) {
- throw new ArgumentError();
- }
- if ((start < 0) || (end < -1) || ((end != -1) && (start >= end))) {
- throw new ArgumentError();
- }
- int lock = (mode == FileLock.EXCLUSIVE) ? LOCK_EXCLUSIVE : LOCK_SHARED;
- return _dispatch(_FILE_LOCK, [null, lock, start, end])
- .then((response) {
- if (_isErrorResponse(response)) {
- throw _exceptionFromResponse(response, 'lock failed', path);
- }
- return this;
- });
- }
-
- Future<RandomAccessFile> unlock([int start = 0, int end = -1]) {
- if ((start is !int) || (end is !int)) {
- throw new ArgumentError();
- }
- if (start == end) {
- throw new ArgumentError();
- }
- return _dispatch(_FILE_LOCK, [null, LOCK_UNLOCK, start, end])
- .then((response) {
- if (_isErrorResponse(response)) {
- throw _exceptionFromResponse(response, 'unlock failed', path);
- }
- return this;
- });
- }
-
- void lockSync(
- [FileLock mode = FileLock.EXCLUSIVE, int start = 0, int end = -1]) {
- _checkAvailable();
- if ((mode is !FileLock) || (start is !int) || (end is !int)) {
- throw new ArgumentError();
- }
- if ((start < 0) || (end < -1) || ((end != -1) && (start >= end))) {
- throw new ArgumentError();
- }
- int lock = (mode == FileLock.EXCLUSIVE) ? LOCK_EXCLUSIVE : LOCK_SHARED;
- var result = _ops.lock(lock, start, end);
- if (result is OSError) {
- throw new FileSystemException('lock failed', path, result);
- }
- }
-
- void unlockSync([int start = 0, int end = -1]) {
- _checkAvailable();
- if ((start is !int) || (end is !int)) {
- throw new ArgumentError();
- }
- if (start == end) {
- throw new ArgumentError();
- }
- var result = _ops.lock(LOCK_UNLOCK, start, end);
- if (result is OSError) {
- throw new FileSystemException('unlock failed', path, result);
- }
- }
-
- bool closed = false;
-
- // Calling this function will increase the reference count on the native
- // object that implements the file operations. It should only be called to
- // pass the pointer to the IO Service, which will decrement the reference
- // count when it is finished with it.
- int _pointer() => _ops.getPointer();
-
- Future _dispatch(int request, List data, { bool markClosed: false }) {
- if (closed) {
- return new Future.error(new FileSystemException("File closed", path));
- }
- if (_asyncDispatched) {
- var msg = "An async operation is currently pending";
- return new Future.error(new FileSystemException(msg, path));
- }
- if (markClosed) {
- // Set closed to true to ensure that no more async requests can be issued
- // for this file.
- closed = true;
- }
- _asyncDispatched = true;
- data[0] = _pointer();
- return _IOService._dispatch(request, data)
- .whenComplete(() {
- _asyncDispatched = false;
- });
- }
-
- void _checkAvailable() {
- if (_asyncDispatched) {
- throw new FileSystemException("An async operation is currently pending",
- path);
- }
- if (closed) {
- throw new FileSystemException("File closed", path);
- }
- }
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/io/file_system_entity.dart b/pkg/dev_compiler/tool/input_sdk/lib/io/file_system_entity.dart
deleted file mode 100644
index d197949..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/io/file_system_entity.dart
+++ /dev/null
@@ -1,841 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-part of dart.io;
-
-/**
- * The type of an entity on the file system, such as a file, directory, or link.
- *
- * These constants are used by the [FileSystemEntity] class
- * to indicate the object's type.
- *
- */
-
-class FileSystemEntityType {
- static const FILE = const FileSystemEntityType._internal(0);
- static const DIRECTORY = const FileSystemEntityType._internal(1);
- static const LINK = const FileSystemEntityType._internal(2);
- static const NOT_FOUND = const FileSystemEntityType._internal(3);
- static const _typeList = const [FileSystemEntityType.FILE,
- FileSystemEntityType.DIRECTORY,
- FileSystemEntityType.LINK,
- FileSystemEntityType.NOT_FOUND];
- final int _type;
-
- const FileSystemEntityType._internal(this._type);
-
- static FileSystemEntityType _lookup(int type) => _typeList[type];
- String toString() => const ['FILE', 'DIRECTORY', 'LINK', 'NOT_FOUND'][_type];
-}
-
-/**
- * A FileStat object represents the result of calling the POSIX stat() function
- * on a file system object. It is an immutable object, representing the
- * snapshotted values returned by the stat() call.
- */
-class FileStat {
- // These must agree with enum FileStat in file.h.
- static const _TYPE = 0;
- static const _CHANGED_TIME = 1;
- static const _MODIFIED_TIME = 2;
- static const _ACCESSED_TIME = 3;
- static const _MODE = 4;
- static const _SIZE = 5;
-
- static const _notFound = const FileStat._internalNotFound();
-
- /**
- * The time of the last change to the data or metadata of the file system
- * object. On Windows platforms, this is instead the file creation time.
- */
- final DateTime changed;
- /**
- * The time of the last change to the data of the file system
- * object.
- */
- final DateTime modified;
- /**
- * The time of the last access to the data of the file system
- * object. On Windows platforms, this may have 1 day granularity, and be
- * out of date by an hour.
- */
- final DateTime accessed;
- /**
- * The type of the object (file, directory, or link). If the call to
- * stat() fails, the type of the returned object is NOT_FOUND.
- */
- final FileSystemEntityType type;
- /**
- * The mode of the file system object. Permissions are encoded in the lower
- * 16 bits of this number, and can be decoded using the [modeString] getter.
- */
- final int mode;
- /**
- * The size of the file system object.
- */
- final int size;
-
- FileStat._internal(this.changed,
- this.modified,
- this.accessed,
- this.type,
- this.mode,
- this.size);
-
- const FileStat._internalNotFound() :
- changed = null, modified = null, accessed = null,
- type = FileSystemEntityType.NOT_FOUND, mode = 0, size = -1;
-
- external static _statSync(String path);
-
-
- /**
- * Calls the operating system's stat() function on [path].
- * Returns a [FileStat] object containing the data returned by stat().
- * If the call fails, returns a [FileStat] object with .type set to
- * FileSystemEntityType.NOT_FOUND and the other fields invalid.
- */
- static FileStat statSync(String path) {
- // Trailing path is not supported on Windows.
- if (Platform.isWindows) {
- path = FileSystemEntity._trimTrailingPathSeparators(path);
- }
- var data = _statSync(path);
- if (data is OSError) return FileStat._notFound;
- return new FileStat._internal(
- new DateTime.fromMillisecondsSinceEpoch(data[_CHANGED_TIME]),
- new DateTime.fromMillisecondsSinceEpoch(data[_MODIFIED_TIME]),
- new DateTime.fromMillisecondsSinceEpoch(data[_ACCESSED_TIME]),
- FileSystemEntityType._lookup(data[_TYPE]),
- data[_MODE],
- data[_SIZE]);
- }
-
- /**
- * Asynchronously calls the operating system's stat() function on [path].
- * Returns a Future which completes with a [FileStat] object containing
- * the data returned by stat().
- * If the call fails, completes the future with a [FileStat] object with
- * .type set to FileSystemEntityType.NOT_FOUND and the other fields invalid.
- */
- static Future<FileStat> stat(String path) {
- // Trailing path is not supported on Windows.
- if (Platform.isWindows) {
- path = FileSystemEntity._trimTrailingPathSeparators(path);
- }
- return _IOService._dispatch(_FILE_STAT, [path]).then((response) {
- if (_isErrorResponse(response)) {
- return FileStat._notFound;
- }
- // Unwrap the real list from the "I'm not an error" wrapper.
- List data = response[1];
- return new FileStat._internal(
- new DateTime.fromMillisecondsSinceEpoch(data[_CHANGED_TIME]),
- new DateTime.fromMillisecondsSinceEpoch(data[_MODIFIED_TIME]),
- new DateTime.fromMillisecondsSinceEpoch(data[_ACCESSED_TIME]),
- FileSystemEntityType._lookup(data[_TYPE]),
- data[_MODE],
- data[_SIZE]);
- });
- }
-
- String toString() => """
-FileStat: type $type
- changed $changed
- modified $modified
- accessed $accessed
- mode ${modeString()}
- size $size""";
-
- /**
- * Returns the mode value as a human-readable string, in the format
- * "rwxrwxrwx", reflecting the user, group, and world permissions to
- * read, write, and execute the file system object, with "-" replacing the
- * letter for missing permissions. Extra permission bits may be represented
- * by prepending "(suid)", "(guid)", and/or "(sticky)" to the mode string.
- */
- String modeString() {
- var permissions = mode & 0xFFF;
- var codes = const ['---', '--x', '-w-', '-wx', 'r--', 'r-x', 'rw-', 'rwx'];
- var result = [];
- if ((permissions & 0x800) != 0) result.add("(suid) ");
- if ((permissions & 0x400) != 0) result.add("(guid) ");
- if ((permissions & 0x200) != 0) result.add("(sticky) ");
- result
- ..add(codes[(permissions >> 6) & 0x7])
- ..add(codes[(permissions >> 3) & 0x7])
- ..add(codes[permissions & 0x7]);
- return result.join();
- }
-}
-
-
-/**
- * The common super class for [File], [Directory], and [Link] objects.
- *
- * [FileSystemEntity] objects are returned from directory listing
- * operations. To determine if a FileSystemEntity is a [File], a
- * [Directory], or a [Link] perform a type check:
- *
- * if (entity is File) (entity as File).readAsStringSync();
- *
- * You can also use the [type] or [typeSync] methods to determine
- * the type of a file system object.
- *
- * Most methods in this class occur in synchronous and asynchronous pairs,
- * for example, [exists] and [existsSync].
- * Unless you have a specific reason for using the synchronous version
- * of a method, prefer the asynchronous version to avoid blocking your program.
- *
- * Here's the exists method in action:
- *
- * entity.exists().then((isThere) {
- * isThere ? print('exists') : print('non-existent');
- * });
- *
- *
- * ## Other resources
- *
- * * [Dart by
- * Example](https://www.dartlang.org/dart-by-example/#files-directories-and-symlinks)
- * provides additional task-oriented code samples that show how to use various
- * API from the [Directory] class and the [File] class, both subclasses of
- * FileSystemEntity.
- *
- * * [I/O for Command-Line
- * Apps](https://www.dartlang.org/docs/dart-up-and-running/ch03.html#dartio---io-for-command-line-apps),
- * a section from _A Tour of the Dart Libraries_ covers files and directories.
- *
- * * [Write Command-Line Apps](https://www.dartlang.org/docs/tutorials/cmdline/),
- * a tutorial about writing command-line apps, includes information about
- * files and directories.
- */
-abstract class FileSystemEntity {
- String get path;
-
- /**
- * Returns a [Uri] representing the file system entity's location.
- *
- * The returned URI's scheme is always "file" if the entity's [path] is
- * absolute, otherwise the scheme will be empty.
- */
- Uri get uri => new Uri.file(path);
-
- /**
- * Checks whether the file system entity with this path exists. Returns
- * a [:Future<bool>:] that completes with the result.
- *
- * Since FileSystemEntity is abstract, every FileSystemEntity object
- * is actually an instance of one of the subclasses [File],
- * [Directory], and [Link]. Calling [exists] on an instance of one
- * of these subclasses checks whether the object exists in the file
- * system object exists and is of the correct type (file, directory,
- * or link). To check whether a path points to an object on the
- * file system, regardless of the object's type, use the [type]
- * static method.
- *
- */
- Future<bool> exists();
-
- /**
- * Synchronously checks whether the file system entity with this path
- * exists.
- *
- * Since FileSystemEntity is abstract, every FileSystemEntity object
- * is actually an instance of one of the subclasses [File],
- * [Directory], and [Link]. Calling [existsSync] on an instance of
- * one of these subclasses checks whether the object exists in the
- * file system object exists and is of the correct type (file,
- * directory, or link). To check whether a path points to an object
- * on the file system, regardless of the object's type, use the
- * [typeSync] static method.
- */
- bool existsSync();
-
- /**
- * Renames this file system entity. Returns a `Future<FileSystemEntity>`
- * that completes with a [FileSystemEntity] instance for the renamed
- * file system entity.
- *
- * If [newPath] identifies an existing entity of the same type, that entity
- * is replaced. If [newPath] identifies an existing entity of a different
- * type, the operation fails and the future completes with an exception.
- */
- Future<FileSystemEntity> rename(String newPath);
-
- /**
- * Synchronously renames this file system entity. Returns a [FileSystemEntity]
- * instance for the renamed entity.
- *
- * If [newPath] identifies an existing entity of the same type, that entity
- * is replaced. If [newPath] identifies an existing entity of a different
- * type, the operation fails and an exception is thrown.
- */
- FileSystemEntity renameSync(String newPath);
-
- /**
- * Resolves the path of a file system object relative to the
- * current working directory, resolving all symbolic links on
- * the path and resolving all `..` and `.` path segments.
- *
- * [resolveSymbolicLinks] uses the operating system's native
- * file system API to resolve the path, using the `realpath` function
- * on linux and OS X, and the `GetFinalPathNameByHandle` function on
- * Windows. If the path does not point to an existing file system object,
- * `resolveSymbolicLinks` throws a `FileSystemException`.
- *
- * On Windows the `..` segments are resolved _before_ resolving the symbolic
- * link, and on other platforms the symbolic links are _resolved to their
- * target_ before applying a `..` that follows.
- *
- * To ensure the same behavior on all platforms resolve `..` segments before
- * calling `resolveSymbolicLinks`. One way of doing this is with the `Uri`
- * class:
- *
- * var path = Uri.parse('.').resolveUri(new Uri.file(input)).toFilePath();
- * if (path == '') path = '.';
- * new File(path).resolveSymbolicLinks().then((resolved) {
- * print(resolved);
- * });
- *
- * since `Uri.resolve` removes `..` segments. This will result in the Windows
- * behavior.
- */
- Future<String> resolveSymbolicLinks() {
- return _IOService._dispatch(_FILE_RESOLVE_SYMBOLIC_LINKS, [path])
- .then((response) {
- if (_isErrorResponse(response)) {
- throw _exceptionFromResponse(response,
- "Cannot resolve symbolic links",
- path);
- }
- return response;
- });
- }
-
- /**
- * Resolves the path of a file system object relative to the
- * current working directory, resolving all symbolic links on
- * the path and resolving all `..` and `.` path segments.
- *
- * [resolveSymbolicLinksSync] uses the operating system's native
- * file system API to resolve the path, using the `realpath` function
- * on linux and OS X, and the `GetFinalPathNameByHandle` function on
- * Windows. If the path does not point to an existing file system object,
- * `resolveSymbolicLinksSync` throws a `FileSystemException`.
- *
- * On Windows the `..` segments are resolved _before_ resolving the symbolic
- * link, and on other platforms the symbolic links are _resolved to their
- * target_ before applying a `..` that follows.
- *
- * To ensure the same behavior on all platforms resolve `..` segments before
- * calling `resolveSymbolicLinksSync`. One way of doing this is with the `Uri`
- * class:
- *
- * var path = Uri.parse('.').resolveUri(new Uri.file(input)).toFilePath();
- * if (path == '') path = '.';
- * var resolved = new File(path).resolveSymbolicLinksSync();
- * print(resolved);
- *
- * since `Uri.resolve` removes `..` segments. This will result in the Windows
- * behavior.
- */
- String resolveSymbolicLinksSync() {
- var result = _resolveSymbolicLinks(path);
- _throwIfError(result, "Cannot resolve symbolic links", path);
- return result;
- }
-
-
- /**
- * Calls the operating system's stat() function on the [path] of this
- * [FileSystemEntity]. Identical to [:FileStat.stat(this.path):].
- *
- * Returns a [:Future<FileStat>:] object containing the data returned by
- * stat().
- *
- * If the call fails, completes the future with a [FileStat] object
- * with .type set to
- * FileSystemEntityType.NOT_FOUND and the other fields invalid.
- */
- Future<FileStat> stat();
-
- /**
- * Synchronously calls the operating system's stat() function on the
- * [path] of this [FileSystemEntity].
- * Identical to [:FileStat.statSync(this.path):].
- *
- * Returns a [FileStat] object containing the data returned by stat().
- *
- * If the call fails, returns a [FileStat] object with .type set to
- * FileSystemEntityType.NOT_FOUND and the other fields invalid.
- */
- FileStat statSync();
-
- /**
- * Deletes this [FileSystemEntity].
- *
- * If the [FileSystemEntity] is a directory, and if [recursive] is false,
- * the directory must be empty. Otherwise, if [recursive] is true, the
- * directory and all sub-directories and files in the directories are
- * deleted. Links are not followed when deleting recursively. Only the link
- * is deleted, not its target.
- *
- * If [recursive] is true, the [FileSystemEntity] is deleted even if the type
- * of the [FileSystemEntity] doesn't match the content of the file system.
- * This behavior allows [delete] to be used to unconditionally delete any file
- * system object.
- *
- * Returns a [:Future<FileSystemEntity>:] that completes with this
- * [FileSystemEntity] when the deletion is done. If the [FileSystemEntity]
- * cannot be deleted, the future completes with an exception.
- */
- Future<FileSystemEntity> delete({bool recursive: false})
- => _delete(recursive: recursive);
-
- /**
- * Synchronously deletes this [FileSystemEntity].
- *
- * If the [FileSystemEntity] is a directory, and if [recursive] is false,
- * the directory must be empty. Otherwise, if [recursive] is true, the
- * directory and all sub-directories and files in the directories are
- * deleted. Links are not followed when deleting recursively. Only the link
- * is deleted, not its target.
- *
- * If [recursive] is true, the [FileSystemEntity] is deleted even if the type
- * of the [FileSystemEntity] doesn't match the content of the file system.
- * This behavior allows [deleteSync] to be used to unconditionally delete any
- * file system object.
- *
- * Throws an exception if the [FileSystemEntity] cannot be deleted.
- */
- void deleteSync({bool recursive: false})
- => _deleteSync(recursive: recursive);
-
-
- /**
- * Start watching the [FileSystemEntity] for changes.
- *
- * The implementation uses platform-dependent event-based APIs for receiving
- * file-system notifications, thus behavior depends on the platform.
- *
- * * `Windows`: Uses `ReadDirectoryChangesW`. The implementation only
- * supports watching directories. Recursive watching is supported.
- * * `Linux`: Uses `inotify`. The implementation supports watching both
- * files and directories. Recursive watching is not supported.
- * Note: When watching files directly, delete events might not happen
- * as expected.
- * * `OS X`: Uses `FSEvents`. The implementation supports watching both
- * files and directories. Recursive watching is supported.
- *
- * The system will start listening for events once the returned [Stream] is
- * being listened to, not when the call to [watch] is issued.
- *
- * The returned value is an endless broadcast [Stream], that only stops when
- * one of the following happens:
- *
- * * The [Stream] is canceled, e.g. by calling `cancel` on the
- * [StreamSubscription].
- * * The [FileSystemEntity] being watches, is deleted.
- *
- * Use `events` to specify what events to listen for. The constants in
- * [FileSystemEvent] can be or'ed together to mix events. Default is
- * [FileSystemEvent.ALL].
- *
- * A move event may be reported as seperate delete and create events.
- */
- Stream<FileSystemEvent> watch({int events: FileSystemEvent.ALL,
- bool recursive: false})
- => _FileSystemWatcher._watch(_trimTrailingPathSeparators(path),
- events,
- recursive);
-
- Future<FileSystemEntity> _delete({bool recursive: false});
- void _deleteSync({bool recursive: false});
-
- /**
- * Checks whether two paths refer to the same object in the
- * file system. Returns a [:Future<bool>:] that completes with the result.
- *
- * Comparing a link to its target returns false, as does comparing two links
- * that point to the same target. To check the target of a link, use
- * Link.target explicitly to fetch it. Directory links appearing
- * inside a path are followed, though, to find the file system object.
- *
- * Completes the returned Future with an error if one of the paths points
- * to an object that does not exist.
- */
- static Future<bool> identical(String path1, String path2) {
- return _IOService._dispatch(_FILE_IDENTICAL, [path1, path2]).then((response) {
- if (_isErrorResponse(response)) {
- throw _exceptionFromResponse(response,
- "Error in FileSystemEntity.identical($path1, $path2)", "");
- }
- return response;
- });
- }
-
- static final RegExp _absoluteWindowsPathPattern =
- new RegExp(r'^(\\\\|[a-zA-Z]:[/\\])');
-
- /**
- * Returns a [bool] indicating whether this object's path is absolute.
- *
- * On Windows, a path is absolute if it starts with \\ or a drive letter
- * between a and z (upper or lower case) followed by :\ or :/.
- * On non-Windows, a path is absolute if it starts with /.
- */
- bool get isAbsolute {
- if (Platform.isWindows) {
- return path.startsWith(_absoluteWindowsPathPattern);
- } else {
- return path.startsWith('/');
- }
- }
-
- /**
- * Returns a [FileSystemEntity] whose path is the absolute path to [this].
- * The type of the returned instance is the type of [this].
- *
- * The absolute path is computed by prefixing
- * a relative path with the current working directory, and returning
- * an absolute path unchanged.
- */
- FileSystemEntity get absolute;
-
- String get _absolutePath {
- if (isAbsolute) return path;
- String current = Directory.current.path;
- if (current.endsWith('/') ||
- (Platform.isWindows && current.endsWith('\\'))) {
- return '$current$path';
- } else {
- return '$current${Platform.pathSeparator}$path';
- }
- }
-
-
- /**
- * Synchronously checks whether two paths refer to the same object in the
- * file system.
- *
- * Comparing a link to its target returns false, as does comparing two links
- * that point to the same target. To check the target of a link, use
- * Link.target explicitly to fetch it. Directory links appearing
- * inside a path are followed, though, to find the file system object.
- *
- * Throws an error if one of the paths points to an object that does not
- * exist.
- */
- static bool identicalSync(String path1, String path2) {
- var result = _identical(path1, path2);
- _throwIfError(result, 'Error in FileSystemEntity.identicalSync');
- return result;
- }
-
- /**
- * Test if [watch] is supported on the current system.
- *
- * OS X 10.6 and below is not supported.
- */
- static bool get isWatchSupported => _FileSystemWatcher.isSupported;
-
- /**
- * Finds the type of file system object that a path points to. Returns
- * a [:Future<FileSystemEntityType>:] that completes with the result.
- *
- * [FileSystemEntityType] has the constant instances FILE, DIRECTORY,
- * LINK, and NOT_FOUND. [type] will return LINK only if the optional
- * named argument [followLinks] is false, and [path] points to a link.
- * If the path does not point to a file system object, or any other error
- * occurs in looking up the path, NOT_FOUND is returned. The only
- * error or exception that may be put on the returned future is ArgumentError,
- * caused by passing the wrong type of arguments to the function.
- */
- static Future<FileSystemEntityType> type(String path,
- {bool followLinks: true})
- => _getTypeAsync(path, followLinks).then(FileSystemEntityType._lookup);
-
- /**
- * Synchronously finds the type of file system object that a path points to.
- * Returns a [FileSystemEntityType].
- *
- * [FileSystemEntityType] has the constant instances FILE, DIRECTORY,
- * LINK, and NOT_FOUND. [type] will return LINK only if the optional
- * named argument [followLinks] is false, and [path] points to a link.
- * If the path does not point to a file system object, or any other error
- * occurs in looking up the path, NOT_FOUND is returned. The only
- * error or exception that may be thrown is ArgumentError,
- * caused by passing the wrong type of arguments to the function.
- */
- static FileSystemEntityType typeSync(String path, {bool followLinks: true})
- => FileSystemEntityType._lookup(_getTypeSync(path, followLinks));
-
- /**
- * Checks if type(path, followLinks: false) returns
- * FileSystemEntityType.LINK.
- */
- static Future<bool> isLink(String path) => _getTypeAsync(path, false)
- .then((type) => (type == FileSystemEntityType.LINK._type));
-
- /**
- * Checks if type(path) returns FileSystemEntityType.FILE.
- */
- static Future<bool> isFile(String path) => _getTypeAsync(path, true)
- .then((type) => (type == FileSystemEntityType.FILE._type));
-
- /**
- * Checks if type(path) returns FileSystemEntityType.DIRECTORY.
- */
- static Future<bool> isDirectory(String path) => _getTypeAsync(path, true)
- .then((type) => (type == FileSystemEntityType.DIRECTORY._type));
-
- /**
- * Synchronously checks if typeSync(path, followLinks: false) returns
- * FileSystemEntityType.LINK.
- */
- static bool isLinkSync(String path) =>
- (_getTypeSync(path, false) == FileSystemEntityType.LINK._type);
-
- /**
- * Synchronously checks if typeSync(path) returns
- * FileSystemEntityType.FILE.
- */
- static bool isFileSync(String path) =>
- (_getTypeSync(path, true) == FileSystemEntityType.FILE._type);
-
- /**
- * Synchronously checks if typeSync(path) returns
- * FileSystemEntityType.DIRECTORY.
- */
- static bool isDirectorySync(String path) =>
- (_getTypeSync(path, true) == FileSystemEntityType.DIRECTORY._type);
-
- external static _getType(String path, bool followLinks);
- external static _identical(String path1, String path2);
- external static _resolveSymbolicLinks(String path);
-
- // Finds the next-to-last component when dividing at path separators.
- static final RegExp _parentRegExp = Platform.isWindows ?
- new RegExp(r'[^/\\][/\\]+[^/\\]') :
- new RegExp(r'[^/]/+[^/]');
-
- /**
- * Removes the final path component of a path, using the platform's
- * path separator to split the path. Will not remove the root component
- * of a Windows path, like "C:\" or "\\server_name\".
- * Ignores trailing path separators, and leaves no trailing path separators.
- */
- static String parentOf(String path) {
- int rootEnd = -1;
- if (Platform.isWindows) {
- if (path.startsWith(_absoluteWindowsPathPattern)) {
- // Root ends at first / or \ after the first two characters.
- rootEnd = path.indexOf(new RegExp(r'[/\\]'), 2);
- if (rootEnd == -1) return path;
- } else if (path.startsWith('\\') || path.startsWith('/')) {
- rootEnd = 0;
- }
- } else if (path.startsWith('/')) {
- rootEnd = 0;
- }
- // Ignore trailing slashes.
- // All non-trivial cases have separators between two non-separators.
- int pos = path.lastIndexOf(_parentRegExp);
- if (pos > rootEnd) {
- return path.substring(0, pos + 1);
- } else if (rootEnd > -1) {
- return path.substring(0, rootEnd + 1);
- } else {
- return '.';
- }
- }
-
- /**
- * The directory containing [this]. If [this] is a root
- * directory, returns [this].
- */
- Directory get parent => new Directory(parentOf(path));
-
- static int _getTypeSync(String path, bool followLinks) {
- var result = _getType(path, followLinks);
- _throwIfError(result, 'Error getting type of FileSystemEntity');
- return result;
- }
-
- static Future<int> _getTypeAsync(String path, bool followLinks) {
- return _IOService._dispatch(_FILE_TYPE, [path, followLinks])
- .then((response) {
- if (_isErrorResponse(response)) {
- throw _exceptionFromResponse(response, "Error getting type", path);
- }
- return response;
- });
- }
-
- static _throwIfError(Object result, String msg, [String path]) {
- if (result is OSError) {
- throw new FileSystemException(msg, path, result);
- } else if (result is ArgumentError) {
- throw result;
- }
- }
-
- static String _trimTrailingPathSeparators(String path) {
- // Don't handle argument errors here.
- if (path is! String) return path;
- if (Platform.isWindows) {
- while (path.length > 1 &&
- (path.endsWith(Platform.pathSeparator) ||
- path.endsWith('/'))) {
- path = path.substring(0, path.length - 1);
- }
- } else {
- while (path.length > 1 && path.endsWith(Platform.pathSeparator)) {
- path = path.substring(0, path.length - 1);
- }
- }
- return path;
- }
-
- static String _ensureTrailingPathSeparators(String path) {
- // Don't handle argument errors here.
- if (path is! String) return path;
- if (path.isEmpty) path = '.';
- if (Platform.isWindows) {
- while (!path.endsWith(Platform.pathSeparator) && !path.endsWith('/')) {
- path = "$path${Platform.pathSeparator}";
- }
- } else {
- while (!path.endsWith(Platform.pathSeparator)) {
- path = "$path${Platform.pathSeparator}";
- }
- }
- return path;
- }
-}
-
-
-/**
- * Base event class emitted by [FileSystemEntity.watch].
- */
-class FileSystemEvent {
- /**
- * Bitfield for [FileSystemEntity.watch], to enable [FileSystemCreateEvent]s.
- */
- static const int CREATE = 1 << 0;
-
- /**
- * Bitfield for [FileSystemEntity.watch], to enable [FileSystemModifyEvent]s.
- */
- static const int MODIFY = 1 << 1;
-
- /**
- * Bitfield for [FileSystemEntity.watch], to enable [FileSystemDeleteEvent]s.
- */
- static const int DELETE = 1 << 2;
-
- /**
- * Bitfield for [FileSystemEntity.watch], to enable [FileSystemMoveEvent]s.
- */
- static const int MOVE = 1 << 3;
-
- /**
- * Bitfield for [FileSystemEntity.watch], for enabling all of [CREATE],
- * [MODIFY], [DELETE] and [MOVE].
- */
- static const int ALL = CREATE | MODIFY | DELETE | MOVE;
-
- static const int _MODIFY_ATTRIBUTES = 1 << 4;
- static const int _DELETE_SELF = 1 << 5;
- static const int _IS_DIR = 1 << 6;
-
- /**
- * The type of event. See [FileSystemEvent] for a list of events.
- */
- final int type;
-
- /**
- * The path that triggered the event. Depending on the platform and the
- * FileSystemEntity, the path may be relative.
- */
- final String path;
-
- /**
- * Is `true` if the event target was a directory.
- */
- final bool isDirectory;
-
- FileSystemEvent._(this.type, this.path, this.isDirectory);
-}
-
-
-/**
- * File system event for newly created file system objects.
- */
-class FileSystemCreateEvent extends FileSystemEvent {
- FileSystemCreateEvent._(path, isDirectory)
- : super._(FileSystemEvent.CREATE, path, isDirectory);
-
- String toString() => "FileSystemCreateEvent('$path')";
-}
-
-
-/**
- * File system event for modifications of file system objects.
- */
-class FileSystemModifyEvent extends FileSystemEvent {
- /**
- * If the content was changed and not only the attributes, [contentChanged]
- * is `true`.
- */
- final bool contentChanged;
-
- FileSystemModifyEvent._(path, isDirectory, this.contentChanged)
- : super._(FileSystemEvent.MODIFY, path, isDirectory);
-
- String toString() =>
- "FileSystemModifyEvent('$path', contentChanged=$contentChanged)";
-}
-
-
-/**
- * File system event for deletion of file system objects.
- */
-class FileSystemDeleteEvent extends FileSystemEvent {
- FileSystemDeleteEvent._(path, isDirectory)
- : super._(FileSystemEvent.DELETE, path, isDirectory);
-
- String toString() => "FileSystemDeleteEvent('$path')";
-}
-
-
-/**
- * File system event for moving of file system objects.
- */
-class FileSystemMoveEvent extends FileSystemEvent {
- /**
- * If the underlaying implementation is able to identify the destination of
- * the moved file, [destination] will be set. Otherwise, it will be `null`.
- */
- final String destination;
-
- FileSystemMoveEvent._(path, isDirectory, this.destination)
- : super._(FileSystemEvent.MOVE, path, isDirectory);
-
- String toString() {
- var buffer = new StringBuffer();
- buffer.write("FileSystemMoveEvent('$path'");
- if (destination != null) buffer.write(", '$destination'");
- buffer.write(')');
- return buffer.toString();
- }
-}
-
-
-class _FileSystemWatcher {
- external static Stream<FileSystemEvent> _watch(
- String path, int events, bool recursive);
- external static bool get isSupported;
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/io/http.dart b/pkg/dev_compiler/tool/input_sdk/lib/io/http.dart
deleted file mode 100644
index 07257ea..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/io/http.dart
+++ /dev/null
@@ -1,2033 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-part of dart.io;
-
-/**
- * HTTP status codes.
- */
-abstract class HttpStatus {
- static const int CONTINUE = 100;
- static const int SWITCHING_PROTOCOLS = 101;
- static const int OK = 200;
- static const int CREATED = 201;
- static const int ACCEPTED = 202;
- static const int NON_AUTHORITATIVE_INFORMATION = 203;
- static const int NO_CONTENT = 204;
- static const int RESET_CONTENT = 205;
- static const int PARTIAL_CONTENT = 206;
- static const int MULTIPLE_CHOICES = 300;
- static const int MOVED_PERMANENTLY = 301;
- static const int FOUND = 302;
- static const int MOVED_TEMPORARILY = 302; // Common alias for FOUND.
- static const int SEE_OTHER = 303;
- static const int NOT_MODIFIED = 304;
- static const int USE_PROXY = 305;
- static const int TEMPORARY_REDIRECT = 307;
- static const int BAD_REQUEST = 400;
- static const int UNAUTHORIZED = 401;
- static const int PAYMENT_REQUIRED = 402;
- static const int FORBIDDEN = 403;
- static const int NOT_FOUND = 404;
- static const int METHOD_NOT_ALLOWED = 405;
- static const int NOT_ACCEPTABLE = 406;
- static const int PROXY_AUTHENTICATION_REQUIRED = 407;
- static const int REQUEST_TIMEOUT = 408;
- static const int CONFLICT = 409;
- static const int GONE = 410;
- static const int LENGTH_REQUIRED = 411;
- static const int PRECONDITION_FAILED = 412;
- static const int REQUEST_ENTITY_TOO_LARGE = 413;
- static const int REQUEST_URI_TOO_LONG = 414;
- static const int UNSUPPORTED_MEDIA_TYPE = 415;
- static const int REQUESTED_RANGE_NOT_SATISFIABLE = 416;
- static const int EXPECTATION_FAILED = 417;
- static const int INTERNAL_SERVER_ERROR = 500;
- static const int NOT_IMPLEMENTED = 501;
- static const int BAD_GATEWAY = 502;
- static const int SERVICE_UNAVAILABLE = 503;
- static const int GATEWAY_TIMEOUT = 504;
- static const int HTTP_VERSION_NOT_SUPPORTED = 505;
- // Client generated status code.
- static const int NETWORK_CONNECT_TIMEOUT_ERROR = 599;
-}
-
-
-/**
- * A server that delivers content, such as web pages, using the HTTP protocol.
- *
- * The HttpServer is a [Stream] that provides [HttpRequest] objects. Each
- * HttpRequest has an associated [HttpResponse] object.
- * The server responds to a request by writing to that HttpResponse object.
- * The following example shows how to bind an HttpServer to an IPv6
- * [InternetAddress] on port 80 (the standard port for HTTP servers)
- * and how to listen for requests.
- * Port 80 is the default HTTP port. However, on most systems accessing
- * this requires super-user privileges. For local testing consider
- * using a non-reserved port (1024 and above).
- *
- * import 'dart:io';
- *
- * main() {
- * HttpServer
- * .bind(InternetAddress.ANY_IP_V6, 80)
- * .then((server) {
- * server.listen((HttpRequest request) {
- * request.response.write('Hello, world!');
- * request.response.close();
- * });
- * });
- * }
- *
- * Incomplete requests, in which all or part of the header is missing, are
- * ignored, and no exceptions or HttpRequest objects are generated for them.
- * Likewise, when writing to an HttpResponse, any [Socket] exceptions are
- * ignored and any future writes are ignored.
- *
- * The HttpRequest exposes the request headers and provides the request body,
- * if it exists, as a Stream of data. If the body is unread, it is drained
- * when the server writes to the HttpResponse or closes it.
- *
- * ## Bind with a secure HTTPS connection
- *
- * Use [bindSecure] to create an HTTPS server.
- *
- * The server presents a certificate to the client. The certificate
- * chain and the private key are set in the [SecurityContext]
- * object that is passed to [bindSecure].
- *
- * import 'dart:io';
- * import "dart:isolate";
- *
- * main() {
- * SecurityContext context = new SecurityContext();
- * var chain =
- * Platform.script.resolve('certificates/server_chain.pem')
- * .toFilePath();
- * var key =
- * Platform.script.resolve('certificates/server_key.pem')
- * .toFilePath();
- * context.useCertificateChain(chain);
- * context.usePrivateKey(key, password: 'dartdart');
- *
- * HttpServer
- * .bindSecure(InternetAddress.ANY_IP_V6,
- * 443,
- * context)
- * .then((server) {
- * server.listen((HttpRequest request) {
- * request.response.write('Hello, world!');
- * request.response.close();
- * });
- * });
- * }
- *
- * The certificates and keys are PEM files, which can be created and
- * managed with the tools in OpenSSL.
- *
- * ## Connect to a server socket
- *
- * You can use the [listenOn] constructor to attach an HTTP server to
- * a [ServerSocket].
- *
- * import 'dart:io';
- *
- * main() {
- * ServerSocket.bind(InternetAddress.ANY_IP_V6, 80)
- * .then((serverSocket) {
- * HttpServer httpserver = new HttpServer.listenOn(serverSocket);
- * serverSocket.listen((Socket socket) {
- * socket.write('Hello, client.');
- * });
- * });
- * }
- *
- * ## Other resources
- *
- * * HttpServer is a Stream. Refer to the [Stream] class for information
- * about the streaming qualities of an HttpServer.
- * Pausing the subscription of the stream, pauses at the OS level.
- *
- * * The [http_server](https://pub.dartlang.org/packages/http_server)
- * package on pub.dartlang.org contains a set of high-level classes that,
- * together with this class, makes it easy to provide content through HTTP
- * servers.
- */
-abstract class HttpServer implements Stream<HttpRequest> {
- /**
- * Get and set the default value of the `Server` header for all responses
- * generated by this [HttpServer].
- *
- * If [serverHeader] is `null`, no `Server` header will be added to each
- * response.
- *
- * The default value is `null`.
- */
- String serverHeader;
-
- /**
- * Default set of headers added to all response objects.
- *
- * By default the following headers are in this set:
- *
- * Content-Type: text/plain; charset=utf-8
- * X-Frame-Options: SAMEORIGIN
- * X-Content-Type-Options: nosniff
- * X-XSS-Protection: 1; mode=block
- *
- * If the `Server` header is added here and the `serverHeader` is set as
- * well then the value of `serverHeader` takes precedence.
- */
- HttpHeaders get defaultResponseHeaders;
-
- /**
- * Whether the [HttpServer] should compress the content, if possible.
- *
- * The content can only be compressed when the response is using
- * chunked Transfer-Encoding and the incoming request has `gzip`
- * as an accepted encoding in the Accept-Encoding header.
- *
- * The default value is `false` (compression disabled).
- * To enable, set `autoCompress` to `true`.
- */
- bool autoCompress;
-
- /**
- * Get or set the timeout used for idle keep-alive connections. If no further
- * request is seen within [idleTimeout] after the previous request was
- * completed, the connection is dropped.
- *
- * Default is 120 seconds.
- *
- * Note that it may take up to `2 * idleTimeout` before a idle connection is
- * aborted.
- *
- * To disable, set [idleTimeout] to `null`.
- */
- Duration idleTimeout;
-
-
- /**
- * Starts listening for HTTP requests on the specified [address] and
- * [port].
- *
- * The [address] can either be a [String] or an
- * [InternetAddress]. If [address] is a [String], [bind] will
- * perform a [InternetAddress.lookup] and use the first value in the
- * list. To listen on the loopback adapter, which will allow only
- * incoming connections from the local host, use the value
- * [InternetAddress.LOOPBACK_IP_V4] or
- * [InternetAddress.LOOPBACK_IP_V6]. To allow for incoming
- * connection from the network use either one of the values
- * [InternetAddress.ANY_IP_V4] or [InternetAddress.ANY_IP_V6] to
- * bind to all interfaces or the IP address of a specific interface.
- *
- * If an IP version 6 (IPv6) address is used, both IP version 6
- * (IPv6) and version 4 (IPv4) connections will be accepted. To
- * restrict this to version 6 (IPv6) only, use [v6Only] to set
- * version 6 only.
- *
- * If [port] has the value [:0:] an ephemeral port will be chosen by
- * the system. The actual port used can be retrieved using the
- * [port] getter.
- *
- * The optional argument [backlog] can be used to specify the listen
- * backlog for the underlying OS listen setup. If [backlog] has the
- * value of [:0:] (the default) a reasonable value will be chosen by
- * the system.
- *
- * The optional argument [shared] specifies whether additional HttpServer
- * objects can bind to the same combination of `address`, `port` and `v6Only`.
- * If `shared` is `true` and more `HttpServer`s from this isolate or other
- * isolates are bound to the port, then the incoming connections will be
- * distributed among all the bound `HttpServer`s. Connections can be
- * distributed over multiple isolates this way.
- */
- static Future<HttpServer> bind(address,
- int port,
- {int backlog: 0,
- bool v6Only: false,
- bool shared: false})
- => _HttpServer.bind(address, port, backlog, v6Only, shared);
-
- /**
- * The [address] can either be a [String] or an
- * [InternetAddress]. If [address] is a [String], [bind] will
- * perform a [InternetAddress.lookup] and use the first value in the
- * list. To listen on the loopback adapter, which will allow only
- * incoming connections from the local host, use the value
- * [InternetAddress.LOOPBACK_IP_V4] or
- * [InternetAddress.LOOPBACK_IP_V6]. To allow for incoming
- * connection from the network use either one of the values
- * [InternetAddress.ANY_IP_V4] or [InternetAddress.ANY_IP_V6] to
- * bind to all interfaces or the IP address of a specific interface.
- *
- * If an IP version 6 (IPv6) address is used, both IP version 6
- * (IPv6) and version 4 (IPv4) connections will be accepted. To
- * restrict this to version 6 (IPv6) only, use [v6Only] to set
- * version 6 only.
- *
- * If [port] has the value [:0:] an ephemeral port will be chosen by
- * the system. The actual port used can be retrieved using the
- * [port] getter.
- *
- * The optional argument [backlog] can be used to specify the listen
- * backlog for the underlying OS listen setup. If [backlog] has the
- * value of [:0:] (the default) a reasonable value will be chosen by
- * the system.
- *
- * If [requestClientCertificate] is true, the server will
- * request clients to authenticate with a client certificate.
- * The server will advertise the names of trusted issuers of client
- * certificates, getting them from [context], where they have been
- * set using [SecurityContext.setClientAuthorities].
- *
- * The optional argument [shared] specifies whether additional HttpServer
- * objects can bind to the same combination of `address`, `port` and `v6Only`.
- * If `shared` is `true` and more `HttpServer`s from this isolate or other
- * isolates are bound to the port, then the incoming connections will be
- * distributed among all the bound `HttpServer`s. Connections can be
- * distributed over multiple isolates this way.
- */
-
- static Future<HttpServer> bindSecure(address,
- int port,
- SecurityContext context,
- {int backlog: 0,
- bool v6Only: false,
- bool requestClientCertificate: false,
- bool shared: false})
- => _HttpServer.bindSecure(address,
- port,
- context,
- backlog,
- v6Only,
- requestClientCertificate,
- shared);
-
- /**
- * Attaches the HTTP server to an existing [ServerSocket]. When the
- * [HttpServer] is closed, the [HttpServer] will just detach itself,
- * closing current connections but not closing [serverSocket].
- */
- factory HttpServer.listenOn(ServerSocket serverSocket)
- => new _HttpServer.listenOn(serverSocket);
-
- /**
- * Permanently stops this [HttpServer] from listening for new
- * connections. This closes the [Stream] of [HttpRequest]s with a
- * done event. The returned future completes when the server is
- * stopped. For a server started using [bind] or [bindSecure] this
- * means that the port listened on no longer in use.
- *
- * If [force] is `true`, active connections will be closed immediately.
- */
- Future close({bool force: false});
-
- /**
- * Returns the port that the server is listening on. This can be
- * used to get the actual port used when a value of 0 for [:port:] is
- * specified in the [bind] or [bindSecure] call.
- */
- int get port;
-
- /**
- * Returns the address that the server is listening on. This can be
- * used to get the actual address used, when the address is fetched by
- * a lookup from a hostname.
- */
- InternetAddress get address;
-
- /**
- * Sets the timeout, in seconds, for sessions of this [HttpServer].
- * The default timeout is 20 minutes.
- */
- set sessionTimeout(int timeout);
-
- /**
- * Returns an [HttpConnectionsInfo] object summarizing the number of
- * current connections handled by the server.
- */
- HttpConnectionsInfo connectionsInfo();
-}
-
-
-/**
- * Summary statistics about an [HttpServer]s current socket connections.
- */
-class HttpConnectionsInfo {
- /**
- * Total number of socket connections.
- */
- int total = 0;
-
- /**
- * Number of active connections where actual request/response
- * processing is active.
- */
- int active = 0;
-
- /**
- * Number of idle connections held by clients as persistent connections.
- */
- int idle = 0;
-
- /**
- * Number of connections which are preparing to close. Note: These
- * connections are also part of the [:active:] count as they might
- * still be sending data to the client before finally closing.
- */
- int closing = 0;
-}
-
-
-/**
- * Headers for HTTP requests and responses.
- *
- * In some situations, headers are immutable:
- *
- * * HttpRequest and HttpClientResponse always have immutable headers.
- *
- * * HttpResponse and HttpClientRequest have immutable headers
- * from the moment the body is written to.
- *
- * In these situations, the mutating methods throw exceptions.
- *
- * For all operations on HTTP headers the header name is
- * case-insensitive.
- *
- * To set the value of a header use the `set()` method:
- *
- * request.headers.set(HttpHeaders.CACHE_CONTROL,
- 'max-age=3600, must-revalidate');
- *
- * To retrieve the value of a header use the `value()` method:
- *
- * print(request.headers.value(HttpHeaders.USER_AGENT));
- *
- * An HttpHeaders object holds a list of values for each name
- * as the standard allows. In most cases a name holds only a single value,
- * The most common mode of operation is to use `set()` for setting a value,
- * and `value()` for retrieving a value.
- */
-abstract class HttpHeaders {
- static const ACCEPT = "accept";
- static const ACCEPT_CHARSET = "accept-charset";
- static const ACCEPT_ENCODING = "accept-encoding";
- static const ACCEPT_LANGUAGE = "accept-language";
- static const ACCEPT_RANGES = "accept-ranges";
- static const AGE = "age";
- static const ALLOW = "allow";
- static const AUTHORIZATION = "authorization";
- static const CACHE_CONTROL = "cache-control";
- static const CONNECTION = "connection";
- static const CONTENT_ENCODING = "content-encoding";
- static const CONTENT_LANGUAGE = "content-language";
- static const CONTENT_LENGTH = "content-length";
- static const CONTENT_LOCATION = "content-location";
- static const CONTENT_MD5 = "content-md5";
- static const CONTENT_RANGE = "content-range";
- static const CONTENT_TYPE = "content-type";
- static const DATE = "date";
- static const ETAG = "etag";
- static const EXPECT = "expect";
- static const EXPIRES = "expires";
- static const FROM = "from";
- static const HOST = "host";
- static const IF_MATCH = "if-match";
- static const IF_MODIFIED_SINCE = "if-modified-since";
- static const IF_NONE_MATCH = "if-none-match";
- static const IF_RANGE = "if-range";
- static const IF_UNMODIFIED_SINCE = "if-unmodified-since";
- static const LAST_MODIFIED = "last-modified";
- static const LOCATION = "location";
- static const MAX_FORWARDS = "max-forwards";
- static const PRAGMA = "pragma";
- static const PROXY_AUTHENTICATE = "proxy-authenticate";
- static const PROXY_AUTHORIZATION = "proxy-authorization";
- static const RANGE = "range";
- static const REFERER = "referer";
- static const RETRY_AFTER = "retry-after";
- static const SERVER = "server";
- static const TE = "te";
- static const TRAILER = "trailer";
- static const TRANSFER_ENCODING = "transfer-encoding";
- static const UPGRADE = "upgrade";
- static const USER_AGENT = "user-agent";
- static const VARY = "vary";
- static const VIA = "via";
- static const WARNING = "warning";
- static const WWW_AUTHENTICATE = "www-authenticate";
-
- // Cookie headers from RFC 6265.
- static const COOKIE = "cookie";
- static const SET_COOKIE = "set-cookie";
-
- static const GENERAL_HEADERS = const [CACHE_CONTROL,
- CONNECTION,
- DATE,
- PRAGMA,
- TRAILER,
- TRANSFER_ENCODING,
- UPGRADE,
- VIA,
- WARNING];
-
- static const ENTITY_HEADERS = const [ALLOW,
- CONTENT_ENCODING,
- CONTENT_LANGUAGE,
- CONTENT_LENGTH,
- CONTENT_LOCATION,
- CONTENT_MD5,
- CONTENT_RANGE,
- CONTENT_TYPE,
- EXPIRES,
- LAST_MODIFIED];
-
-
- static const RESPONSE_HEADERS = const [ACCEPT_RANGES,
- AGE,
- ETAG,
- LOCATION,
- PROXY_AUTHENTICATE,
- RETRY_AFTER,
- SERVER,
- VARY,
- WWW_AUTHENTICATE];
-
- static const REQUEST_HEADERS = const [ACCEPT,
- ACCEPT_CHARSET,
- ACCEPT_ENCODING,
- ACCEPT_LANGUAGE,
- AUTHORIZATION,
- EXPECT,
- FROM,
- HOST,
- IF_MATCH,
- IF_MODIFIED_SINCE,
- IF_NONE_MATCH,
- IF_RANGE,
- IF_UNMODIFIED_SINCE,
- MAX_FORWARDS,
- PROXY_AUTHORIZATION,
- RANGE,
- REFERER,
- TE,
- USER_AGENT];
-
- /**
- * Gets and sets the date. The value of this property will
- * reflect the 'date' header.
- */
- DateTime date;
-
- /**
- * Gets and sets the expiry date. The value of this property will
- * reflect the 'expires' header.
- */
- DateTime expires;
-
- /**
- * Gets and sets the "if-modified-since" date. The value of this property will
- * reflect the "if-modified-since" header.
- */
- DateTime ifModifiedSince;
-
- /**
- * Gets and sets the host part of the 'host' header for the
- * connection.
- */
- String host;
-
- /**
- * Gets and sets the port part of the 'host' header for the
- * connection.
- */
- int port;
-
- /**
- * Gets and sets the content type. Note that the content type in the
- * header will only be updated if this field is set
- * directly. Mutating the returned current value will have no
- * effect.
- */
- ContentType contentType;
-
- /**
- * Gets and sets the content length header value.
- */
- int contentLength;
-
- /**
- * Gets and sets the persistent connection header value.
- */
- bool persistentConnection;
-
- /**
- * Gets and sets the chunked transfer encoding header value.
- */
- bool chunkedTransferEncoding;
-
- /**
- * Returns the list of values for the header named [name]. If there
- * is no header with the provided name, [:null:] will be returned.
- */
- List<String> operator[](String name);
-
- /**
- * Convenience method for the value for a single valued header. If
- * there is no header with the provided name, [:null:] will be
- * returned. If the header has more than one value an exception is
- * thrown.
- */
- String value(String name);
-
- /**
- * Adds a header value. The header named [name] will have the value
- * [value] added to its list of values. Some headers are single
- * valued, and for these adding a value will replace the previous
- * value. If the value is of type DateTime a HTTP date format will be
- * applied. If the value is a [:List:] each element of the list will
- * be added separately. For all other types the default [:toString:]
- * method will be used.
- */
- void add(String name, Object value);
-
- /**
- * Sets a header. The header named [name] will have all its values
- * cleared before the value [value] is added as its value.
- */
- void set(String name, Object value);
-
- /**
- * Removes a specific value for a header name. Some headers have
- * system supplied values and for these the system supplied values
- * will still be added to the collection of values for the header.
- */
- void remove(String name, Object value);
-
- /**
- * Removes all values for the specified header name. Some headers
- * have system supplied values and for these the system supplied
- * values will still be added to the collection of values for the
- * header.
- */
- void removeAll(String name);
-
- /**
- * Enumerates the headers, applying the function [f] to each
- * header. The header name passed in [:name:] will be all lower
- * case.
- */
- void forEach(void f(String name, List<String> values));
-
- /**
- * Disables folding for the header named [name] when sending the HTTP
- * header. By default, multiple header values are folded into a
- * single header line by separating the values with commas. The
- * 'set-cookie' header has folding disabled by default.
- */
- void noFolding(String name);
-
- /**
- * Remove all headers. Some headers have system supplied values and
- * for these the system supplied values will still be added to the
- * collection of values for the header.
- */
- void clear();
-}
-
-
-/**
- * Representation of a header value in the form:
- *
- * [:value; parameter1=value1; parameter2=value2:]
- *
- * [HeaderValue] can be used to conveniently build and parse header
- * values on this form.
- *
- * To build an [:accepts:] header with the value
- *
- * text/plain; q=0.3, text/html
- *
- * use code like this:
- *
- * HttpClientRequest request = ...;
- * var v = new HeaderValue("text/plain", {"q": "0.3"});
- * request.headers.add(HttpHeaders.ACCEPT, v);
- * request.headers.add(HttpHeaders.ACCEPT, "text/html");
- *
- * To parse the header values use the [:parse:] static method.
- *
- * HttpRequest request = ...;
- * List<String> values = request.headers[HttpHeaders.ACCEPT];
- * values.forEach((value) {
- * HeaderValue v = HeaderValue.parse(value);
- * // Use v.value and v.parameters
- * });
- *
- * An instance of [HeaderValue] is immutable.
- */
-abstract class HeaderValue {
- /**
- * Creates a new header value object setting the value and parameters.
- */
- factory HeaderValue([String value = "", Map<String, String> parameters]) {
- return new _HeaderValue(value, parameters);
- }
-
- /**
- * Creates a new header value object from parsing a header value
- * string with both value and optional parameters.
- */
- static HeaderValue parse(String value,
- {String parameterSeparator: ";",
- String valueSeparator: null,
- bool preserveBackslash: false}) {
- return _HeaderValue.parse(value,
- parameterSeparator: parameterSeparator,
- valueSeparator: valueSeparator,
- preserveBackslash: preserveBackslash);
- }
-
- /**
- * Gets the header value.
- */
- String get value;
-
- /**
- * Gets the map of parameters.
- *
- * This map cannot be modified. invoking any operation which would
- * modify the map will throw [UnsupportedError].
- */
- Map<String, String> get parameters;
-
- /**
- * Returns the formatted string representation in the form:
- *
- * value; parameter1=value1; parameter2=value2
- */
- String toString();
-}
-
-abstract class HttpSession implements Map {
- /**
- * Gets the id for the current session.
- */
- String get id;
-
- /**
- * Destroys the session. This will terminate the session and any further
- * connections with this id will be given a new id and session.
- */
- void destroy();
-
- /**
- * Sets a callback that will be called when the session is timed out.
- */
- void set onTimeout(void callback());
-
- /**
- * Is true if the session has not been sent to the client yet.
- */
- bool get isNew;
-}
-
-
-/**
- * Representation of a content type. An instance of [ContentType] is
- * immutable.
- */
-abstract class ContentType implements HeaderValue {
- /**
- * Content type for plain text using UTF-8 encoding.
- *
- * text/plain; charset=utf-8
- */
- static final TEXT = new ContentType("text", "plain", charset: "utf-8");
-
- /**
- * Content type for HTML using UTF-8 encoding.
- *
- * text/html; charset=utf-8
- */
- static final HTML = new ContentType("text", "html", charset: "utf-8");
-
- /**
- * Content type for JSON using UTF-8 encoding.
- *
- * application/json; charset=utf-8
- */
- static final JSON = new ContentType("application", "json", charset: "utf-8");
-
- /**
- * Content type for binary data.
- *
- * application/octet-stream
- */
- static final BINARY = new ContentType("application", "octet-stream");
-
- /**
- * Creates a new content type object setting the primary type and
- * sub type. The charset and additional parameters can also be set
- * using [charset] and [parameters]. If charset is passed and
- * [parameters] contains charset as well the passed [charset] will
- * override the value in parameters. Keys passed in parameters will be
- * converted to lower case. The `charset` entry, whether passed as `charset`
- * or in `parameters`, will have its value converted to lower-case.
- */
- factory ContentType(String primaryType,
- String subType,
- {String charset, Map<String, String> parameters}) {
- return new _ContentType(primaryType, subType, charset, parameters);
- }
-
- /**
- * Creates a new content type object from parsing a Content-Type
- * header value. As primary type, sub type and parameter names and
- * values are not case sensitive all these values will be converted
- * to lower case. Parsing this string
- *
- * text/html; charset=utf-8
- *
- * will create a content type object with primary type [:text:], sub
- * type [:html:] and parameter [:charset:] with value [:utf-8:].
- */
- static ContentType parse(String value) {
- return _ContentType.parse(value);
- }
-
- /**
- * Gets the mime-type, without any parameters.
- */
- String get mimeType;
-
- /**
- * Gets the primary type.
- */
- String get primaryType;
-
- /**
- * Gets the sub type.
- */
- String get subType;
-
- /**
- * Gets the character set.
- */
- String get charset;
-}
-
-
-/**
- * Representation of a cookie. For cookies received by the server as
- * Cookie header values only [:name:] and [:value:] fields will be
- * set. When building a cookie for the 'set-cookie' header in the server
- * and when receiving cookies in the client as 'set-cookie' headers all
- * fields can be used.
- */
-abstract class Cookie {
- /**
- * Gets and sets the name.
- */
- String name;
-
- /**
- * Gets and sets the value.
- */
- String value;
-
- /**
- * Gets and sets the expiry date.
- */
- DateTime expires;
-
- /**
- * Gets and sets the max age. A value of [:0:] means delete cookie
- * now.
- */
- int maxAge;
-
- /**
- * Gets and sets the domain.
- */
- String domain;
-
- /**
- * Gets and sets the path.
- */
- String path;
-
- /**
- * Gets and sets whether this cookie is secure.
- */
- bool secure;
-
- /**
- * Gets and sets whether this cookie is HTTP only.
- */
- bool httpOnly;
-
- /**
- * Creates a new cookie optionally setting the name and value.
- *
- * By default the value of `httpOnly` will be set to `true`.
- */
- factory Cookie([String name, String value]) => new _Cookie(name, value);
-
- /**
- * Creates a new cookie by parsing a header value from a 'set-cookie'
- * header.
- */
- factory Cookie.fromSetCookieValue(String value) {
- return new _Cookie.fromSetCookieValue(value);
- }
-
- /**
- * Returns the formatted string representation of the cookie. The
- * string representation can be used for for setting the Cookie or
- * 'set-cookie' headers
- */
- String toString();
-}
-
-
-/**
- * A server-side object
- * that contains the content of and information about an HTTP request.
- *
- * __Note__: Check out the
- * [http_server](http://pub.dartlang.org/packages/http_server)
- * package, which makes working with the low-level
- * dart:io HTTP server subsystem easier.
- *
- * `HttpRequest` objects are generated by an [HttpServer],
- * which listens for HTTP requests on a specific host and port.
- * For each request received, the HttpServer, which is a [Stream],
- * generates an `HttpRequest` object and adds it to the stream.
- *
- * An `HttpRequest` object delivers the body content of the request
- * as a stream of byte lists.
- * The object also contains information about the request,
- * such as the method, URI, and headers.
- *
- * In the following code, an HttpServer listens
- * for HTTP requests. When the server receives a request,
- * it uses the HttpRequest object's `method` property to dispatch requests.
- *
- * final HOST = InternetAddress.LOOPBACK_IP_V4;
- * final PORT = 80;
- *
- * HttpServer.bind(HOST, PORT).then((_server) {
- * _server.listen((HttpRequest request) {
- * switch (request.method) {
- * case 'GET':
- * handleGetRequest(request);
- * break;
- * case 'POST':
- * ...
- * }
- * },
- * onError: handleError); // listen() failed.
- * }).catchError(handleError);
- *
- * An HttpRequest object provides access to the associated [HttpResponse]
- * object through the response property.
- * The server writes its response to the body of the HttpResponse object.
- * For example, here's a function that responds to a request:
- *
- * void handleGetRequest(HttpRequest req) {
- * HttpResponse res = req.response;
- * res.write('Received request ${req.method}: ${req.uri.path}');
- * res.close();
- * }
- */
-abstract class HttpRequest implements Stream<List<int>> {
- /**
- * The content length of the request body.
- *
- * If the size of the request body is not known in advance,
- * this value is -1.
- */
- int get contentLength;
-
- /**
- * The method, such as 'GET' or 'POST', for the request.
- */
- String get method;
-
- /**
- * The URI for the request.
- *
- * This provides access to the
- * path and query string for the request.
- */
- Uri get uri;
-
- /**
- * The requested URI for the request.
- *
- * The returend URI is reconstructed by using http-header fields, to access
- * otherwise lost information, e.g. host and scheme.
- *
- * To reconstruct the scheme, first 'X-Forwarded-Proto' is checked, and then
- * falling back to server type.
- *
- * To reconstruct the host, fisrt 'X-Forwarded-Host' is checked, then 'Host'
- * and finally calling back to server.
- */
- Uri get requestedUri;
-
- /**
- * The request headers.
- *
- * The returned [HttpHeaders] are immutable.
- */
- HttpHeaders get headers;
-
- /**
- * The cookies in the request, from the Cookie headers.
- */
- List<Cookie> get cookies;
-
- /**
- * The persistent connection state signaled by the client.
- */
- bool get persistentConnection;
-
- /**
- * The client certificate of the client making the request.
- *
- * This value is null if the connection is not a secure TLS or SSL connection,
- * or if the server does not request a client certificate, or if the client
- * does not provide one.
- */
- X509Certificate get certificate;
-
- /**
- * The session for the given request.
- *
- * If the session is
- * being initialized by this call, [:isNew:] is true for the returned
- * session.
- * See [HttpServer.sessionTimeout] on how to change default timeout.
- */
- HttpSession get session;
-
- /**
- * The HTTP protocol version used in the request,
- * either "1.0" or "1.1".
- */
- String get protocolVersion;
-
- /**
- * Information about the client connection.
- *
- * Returns [:null:] if the socket is not available.
- */
- HttpConnectionInfo get connectionInfo;
-
- /**
- * The [HttpResponse] object, used for sending back the response to the
- * client.
- *
- * If the [contentLength] of the body isn't 0, and the body isn't being read,
- * any write calls on the [HttpResponse] automatically drain the request
- * body.
- */
- HttpResponse get response;
-}
-
-
-/**
- * An HTTP response, which returns the headers and data
- * from the server to the client in response to an HTTP request.
- *
- * Every HttpRequest object provides access to the associated [HttpResponse]
- * object through the `response` property.
- * The server sends its response to the client by writing to the
- * HttpResponse object.
- *
- * ## Writing the response
- *
- * This class implements [IOSink].
- * After the header has been set up, the methods
- * from IOSink, such as `writeln()`, can be used to write
- * the body of the HTTP response.
- * Use the `close()` method to close the response and send it to the client.
- *
- * server.listen((HttpRequest request) {
- * request.response.write('Hello, world!');
- * request.response.close();
- * });
- *
- * When one of the IOSink methods is used for the
- * first time, the request header is sent. Calling any methods that
- * change the header after it is sent throws an exception.
- *
- * ## Setting the headers
- *
- * The HttpResponse object has a number of properties for setting up
- * the HTTP headers of the response.
- * When writing string data through the IOSink, the encoding used
- * is determined from the "charset" parameter of the
- * "Content-Type" header.
- *
- * HttpResponse response = ...
- * response.headers.contentType
- * = new ContentType("application", "json", charset: "utf-8");
- * response.write(...); // Strings written will be UTF-8 encoded.
- *
- * If no charset is provided the default of ISO-8859-1 (Latin 1) will
- * be used.
- *
- * HttpResponse response = ...
- * response.headers.add(HttpHeaders.CONTENT_TYPE, "text/plain");
- * response.write(...); // Strings written will be ISO-8859-1 encoded.
- *
- * An exception is thrown if you use the `write()` method
- * while an unsupported content-type is set.
- */
-abstract class HttpResponse implements IOSink {
- // TODO(ajohnsen): Add documentation of how to pipe a file to the response.
- /**
- * Gets and sets the content length of the response. If the size of
- * the response is not known in advance set the content length to
- * -1 - which is also the default if not set.
- */
- int contentLength;
-
- /**
- * Gets and sets the status code. Any integer value is accepted. For
- * the official HTTP status codes use the fields from
- * [HttpStatus]. If no status code is explicitly set the default
- * value [HttpStatus.OK] is used.
- *
- * The status code must be set before the body is written
- * to. Setting the status code after writing to the response body or
- * closing the response will throw a `StateError`.
- */
- int statusCode;
-
- /**
- * Gets and sets the reason phrase. If no reason phrase is explicitly
- * set a default reason phrase is provided.
- *
- * The reason phrase must be set before the body is written
- * to. Setting the reason phrase after writing to the response body
- * or closing the response will throw a `StateError`.
- */
- String reasonPhrase;
-
- /**
- * Gets and sets the persistent connection state. The initial value
- * of this property is the persistent connection state from the
- * request.
- */
- bool persistentConnection;
-
- /**
- * Set and get the [deadline] for the response. The deadline is timed from the
- * time it's set. Setting a new deadline will override any previous deadline.
- * When a deadline is exceeded, the response will be closed and any further
- * data ignored.
- *
- * To disable a deadline, set the [deadline] to `null`.
- *
- * The [deadline] is `null` by default.
- */
- Duration deadline;
-
- /**
- * Get or set if the [HttpResponse] should buffer output.
- *
- * Default value is `true`.
- *
- * __Note__: Disabling buffering of the output can result in very poor
- * performance, when writing many small chunks.
- */
- bool bufferOutput;
-
- /**
- * Returns the response headers.
- *
- * The response headers can be modified until the response body is
- * written to or closed. After that they become immutable.
- */
- HttpHeaders get headers;
-
- /**
- * Cookies to set in the client (in the 'set-cookie' header).
- */
- List<Cookie> get cookies;
-
- /**
- * Respond with a redirect to [location].
- *
- * The URI in [location] should be absolute, but there are no checks
- * to enforce that.
- *
- * By default the HTTP status code `HttpStatus.MOVED_TEMPORARILY`
- * (`302`) is used for the redirect, but an alternative one can be
- * specified using the [status] argument.
- *
- * This method will also call `close`, and the returned future is
- * the furure returned by `close`.
- */
- Future redirect(Uri location, {int status: HttpStatus.MOVED_TEMPORARILY});
-
- /**
- * Detaches the underlying socket from the HTTP server. When the
- * socket is detached the HTTP server will no longer perform any
- * operations on it.
- *
- * This is normally used when a HTTP upgrade request is received
- * and the communication should continue with a different protocol.
- *
- * If [writeHeaders] is `true`, the status line and [headers] will be written
- * to the socket before it's detached. If `false`, the socket is detached
- * immediately, without any data written to the socket. Default is `true`.
- */
- Future<Socket> detachSocket({bool writeHeaders: true});
-
- /**
- * Gets information about the client connection. Returns [:null:] if the
- * socket is not available.
- */
- HttpConnectionInfo get connectionInfo;
-}
-
-
-/**
- * A client that receives content, such as web pages, from
- * a server using the HTTP protocol.
- *
- * HttpClient contains a number of methods to send an [HttpClientRequest]
- * to an Http server and receive an [HttpClientResponse] back.
- * For example, you can use the [get], [getUrl], [post], and [postUrl] methods
- * for GET and POST requests, respectively.
- *
- * ## Making a simple GET request: an example
- *
- * A `getUrl` request is a two-step process, triggered by two [Future]s.
- * When the first future completes with a [HttpClientRequest], the underlying
- * network connection has been established, but no data has been sent.
- * In the callback function for the first future, the HTTP headers and body
- * can be set on the request. Either the first write to the request object
- * or a call to [close] sends the request to the server.
- *
- * When the HTTP response is received from the server,
- * the second future, which is returned by close,
- * completes with an [HttpClientResponse] object.
- * This object provides access to the headers and body of the response.
- * The body is available as a stream implemented by HttpClientResponse.
- * If a body is present, it must be read. Otherwise, it leads to resource
- * leaks. Consider using [HttpClientResponse.drain] if the body is unused.
- *
- * HttpClient client = new HttpClient();
- * client.getUrl(Uri.parse("http://www.example.com/"))
- * .then((HttpClientRequest request) {
- * // Optionally set up headers...
- * // Optionally write to the request object...
- * // Then call close.
- * ...
- * return request.close();
- * })
- * .then((HttpClientResponse response) {
- * // Process the response.
- * ...
- * });
- *
- * The future for [HttpClientRequest] is created by methods such as
- * [getUrl] and [open].
- *
- * ## HTTPS connections
- *
- * An HttpClient can make HTTPS requests, connecting to a server using
- * the TLS (SSL) secure networking protocol. Calling [getUrl] with an
- * https: scheme will work automatically, if the server's certificate is
- * signed by a root CA (certificate authority) on the default list of
- * well-known trusted CAs, compiled by Mozilla.
- *
- * To add a custom trusted certificate authority, or to send a client
- * certificate to servers that request one, pass a [SecurityContext] object
- * as the optional [context] argument to the `HttpClient` constructor.
- * The desired security options can be set on the [SecurityContext] object.
- *
- * ## Headers
- *
- * All HttpClient requests set the following header by default:
- *
- * Accept-Encoding: gzip
- *
- * This allows the HTTP server to use gzip compression for the body if
- * possible. If this behavior is not desired set the
- * `Accept-Encoding` header to something else.
- * To turn off gzip compression of the response, clear this header:
- *
- * request.headers.removeAll(HttpHeaders.ACCEPT_ENCODING)
- *
- * ## Closing the HttpClient
- *
- * The HttpClient supports persistent connections and caches network
- * connections to reuse them for multiple requests whenever
- * possible. This means that network connections can be kept open for
- * some time after a request has completed. Use HttpClient.close
- * to force the HttpClient object to shut down and to close the idle
- * network connections.
- *
- * ## Turning proxies on and off
- *
- * By default the HttpClient uses the proxy configuration available
- * from the environment, see [findProxyFromEnvironment]. To turn off
- * the use of proxies set the [findProxy] property to
- * [:null:].
- *
- * HttpClient client = new HttpClient();
- * client.findProxy = null;
- */
-abstract class HttpClient {
- static const int DEFAULT_HTTP_PORT = 80;
- static const int DEFAULT_HTTPS_PORT = 443;
-
- /**
- * Get and set the idle timeout of non-active persistent (keep-alive)
- * connections. The default value is 15 seconds.
- */
- Duration idleTimeout;
-
- /**
- * Get and set the maximum number of live connections, to a single host.
- *
- * Increasing this number may lower performance and take up unwanted
- * system resources.
- *
- * To disable, set to `null`.
- *
- * Default is `null`.
- */
- int maxConnectionsPerHost;
-
- /**
- * Get and set whether the body of a response will be automatically
- * uncompressed.
- *
- * The body of an HTTP response can be compressed. In most
- * situations providing the un-compressed body is most
- * convenient. Therefore the default behavior is to un-compress the
- * body. However in some situations (e.g. implementing a transparent
- * proxy) keeping the uncompressed stream is required.
- *
- * NOTE: Headers in from the response is never modified. This means
- * that when automatic un-compression is turned on the value of the
- * header `Content-Length` will reflect the length of the original
- * compressed body. Likewise the header `Content-Encoding` will also
- * have the original value indicating compression.
- *
- * NOTE: Automatic un-compression is only performed if the
- * `Content-Encoding` header value is `gzip`.
- *
- * This value affects all responses produced by this client after the
- * value is changed.
- *
- * To disable, set to `false`.
- *
- * Default is `true`.
- */
- bool autoUncompress;
-
- /**
- * Set and get the default value of the `User-Agent` header for all requests
- * generated by this [HttpClient]. The default value is
- * `Dart/<version> (dart:io)`.
- *
- * If the userAgent is set to `null`, no default `User-Agent` header will be
- * added to each request.
- */
- String userAgent;
-
- factory HttpClient({SecurityContext context}) => new _HttpClient(context);
-
- /**
- * Opens a HTTP connection.
- *
- * The HTTP method to use is specified in [method], the server is
- * specified using [host] and [port], and the path (including
- * a possible query) is specified using [path].
- * The path may also contain a URI fragment, which will be ignored.
- *
- * The `Host` header for the request will be set to the value
- * [host]:[port]. This can be overridden through the
- * [HttpClientRequest] interface before the request is sent. NOTE
- * if [host] is an IP address this will still be set in the `Host`
- * header.
- *
- * For additional information on the sequence of events during an
- * HTTP transaction, and the objects returned by the futures, see
- * the overall documentation for the class [HttpClient].
- */
- Future<HttpClientRequest> open(String method,
- String host,
- int port,
- String path);
-
- /**
- * Opens a HTTP connection.
- *
- * The HTTP method is specified in [method] and the URL to use in
- * [url].
- *
- * The `Host` header for the request will be set to the value
- * [host]:[port]. This can be overridden through the
- * [HttpClientRequest] interface before the request is sent. NOTE
- * if [host] is an IP address this will still be set in the `Host`
- * header.
- *
- * For additional information on the sequence of events during an
- * HTTP transaction, and the objects returned by the futures, see
- * the overall documentation for the class [HttpClient].
- */
- Future<HttpClientRequest> openUrl(String method, Uri url);
-
- /**
- * Opens a HTTP connection using the GET method.
- *
- * The server is specified using [host] and [port], and the path
- * (including a possible query) is specified using
- * [path].
- *
- * See [open] for details.
- */
- Future<HttpClientRequest> get(String host, int port, String path);
-
- /**
- * Opens a HTTP connection using the GET method.
- *
- * The URL to use is specified in [url].
- *
- * See [openUrl] for details.
- */
- Future<HttpClientRequest> getUrl(Uri url);
-
- /**
- * Opens a HTTP connection using the POST method.
- *
- * The server is specified using [host] and [port], and the path
- * (including a possible query) is specified using
- * [path].
- *
- * See [open] for details.
- */
- Future<HttpClientRequest> post(String host, int port, String path);
-
- /**
- * Opens a HTTP connection using the POST method.
- *
- * The URL to use is specified in [url].
- *
- * See [openUrl] for details.
- */
- Future<HttpClientRequest> postUrl(Uri url);
-
- /**
- * Opens a HTTP connection using the PUT method.
- *
- * The server is specified using [host] and [port], and the path
- * (including a possible query) is specified using [path].
- *
- * See [open] for details.
- */
- Future<HttpClientRequest> put(String host, int port, String path);
-
- /**
- * Opens a HTTP connection using the PUT method.
- *
- * The URL to use is specified in [url].
- *
- * See [openUrl] for details.
- */
- Future<HttpClientRequest> putUrl(Uri url);
-
- /**
- * Opens a HTTP connection using the DELETE method.
- *
- * The server is specified using [host] and [port], and the path
- * (including s possible query) is specified using [path].
- *
- * See [open] for details.
- */
- Future<HttpClientRequest> delete(String host, int port, String path);
-
- /**
- * Opens a HTTP connection using the DELETE method.
- *
- * The URL to use is specified in [url].
- *
- * See [openUrl] for details.
- */
- Future<HttpClientRequest> deleteUrl(Uri url);
-
- /**
- * Opens a HTTP connection using the PATCH method.
- *
- * The server is specified using [host] and [port], and the path
- * (including a possible query) is specified using [path].
- *
- * See [open] for details.
- */
- Future<HttpClientRequest> patch(String host, int port, String path);
-
- /**
- * Opens a HTTP connection using the PATCH method.
- *
- * The URL to use is specified in [url].
- *
- * See [openUrl] for details.
- */
- Future<HttpClientRequest> patchUrl(Uri url);
-
- /**
- * Opens a HTTP connection using the HEAD method.
- *
- * The server is specified using [host] and [port], and the path
- * (including a possible query) is specified using [path].
- *
- * See [open] for details.
- */
- Future<HttpClientRequest> head(String host, int port, String path);
-
- /**
- * Opens a HTTP connection using the HEAD method.
- *
- * The URL to use is specified in [url].
- *
- * See [openUrl] for details.
- */
- Future<HttpClientRequest> headUrl(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.
- *
- * The string returned by [f] must be in the format used by browser
- * PAC (proxy auto-config) scripts. That is either
- *
- * "DIRECT"
- *
- * for using a direct connection or
- *
- * "PROXY host:port"
- *
- * for using the proxy server [:host:] on port [:port:].
- *
- * A configuration can contain several configuration elements
- * separated by semicolons, e.g.
- *
- * "PROXY host:port; PROXY host2:port2; DIRECT"
- *
- * The static function [findProxyFromEnvironment] on this class can
- * be used to implement proxy server resolving based on environment
- * variables.
- */
- set findProxy(String f(Uri url));
-
- /**
- * Function for resolving the proxy server to be used for a HTTP
- * connection from the proxy configuration specified through
- * environment variables.
- *
- * The following environment variables are taken into account:
- *
- * http_proxy
- * https_proxy
- * no_proxy
- * HTTP_PROXY
- * HTTPS_PROXY
- * NO_PROXY
- *
- * [:http_proxy:] and [:HTTP_PROXY:] specify the proxy server to use for
- * http:// urls. Use the format [:hostname:port:]. If no port is used a
- * default of 1080 will be used. If both are set the lower case one takes
- * precedence.
- *
- * [:https_proxy:] and [:HTTPS_PROXY:] specify the proxy server to use for
- * https:// urls. Use the format [:hostname:port:]. If no port is used a
- * default of 1080 will be used. If both are set the lower case one takes
- * precedence.
- *
- * [:no_proxy:] and [:NO_PROXY:] specify a comma separated list of
- * postfixes of hostnames for which not to use the proxy
- * server. E.g. the value "localhost,127.0.0.1" will make requests
- * to both "localhost" and "127.0.0.1" not use a proxy. If both are set
- * the lower case one takes precedence.
- *
- * To activate this way of resolving proxies assign this function to
- * the [findProxy] property on the [HttpClient].
- *
- * HttpClient client = new HttpClient();
- * client.findProxy = HttpClient.findProxyFromEnvironment;
- *
- * If you don't want to use the system environment you can use a
- * different one by wrapping the function.
- *
- * HttpClient client = new HttpClient();
- * client.findProxy = (url) {
- * return HttpClient.findProxyFromEnvironment(
- * url, {"http_proxy": ..., "no_proxy": ...});
- * }
- *
- * If a proxy requires authentication it is possible to configure
- * the username and password as well. Use the format
- * [:username:password@hostname:port:] to include the username and
- * password. Alternatively the API [addProxyCredentials] can be used
- * to set credentials for proxies which require authentication.
- */
- static String findProxyFromEnvironment(Uri url,
- {Map<String, String> environment}) {
- return _HttpClient._findProxyFromEnvironment(url, environment);
- }
-
- /**
- * Sets the function to be called when a proxy is requesting
- * authentication. Information on the proxy in use and the security
- * realm for the authentication are passed in the arguments [host],
- * [port] 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
- * [addProxyCredentials] 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 authenticateProxy(
- Future<bool> f(String host, int port, String scheme, String realm));
-
- /**
- * Add credentials to be used for authorizing HTTP proxies.
- */
- void addProxyCredentials(String host,
- int port,
- String realm,
- HttpClientCredentials credentials);
-
- /**
- * Sets a callback that will decide whether to accept a secure connection
- * with a server certificate that cannot be authenticated by any of our
- * trusted root certificates.
- *
- * When an secure HTTP request if made, using this HttpClient, and the
- * server returns a server certificate that cannot be authenticated, the
- * callback is called asynchronously with the [X509Certificate] object and
- * the server's hostname and port. If the value of [badCertificateCallback]
- * is [:null:], the bad certificate is rejected, as if the callback
- * returned [:false:]
- *
- * If the callback returns true, the secure connection is accepted and the
- * [:Future<HttpClientRequest>:] that was returned from the call making the
- * request completes with a valid HttpRequest object. If the callback returns
- * false, the [:Future<HttpClientRequest>:] completes with an exception.
- *
- * If a bad certificate is received on a connection attempt, the library calls
- * the function that was the value of badCertificateCallback at the time
- * the request is made, even if the value of badCertificateCallback
- * has changed since then.
- */
- set badCertificateCallback(bool callback(X509Certificate cert,
- String host,
- int port));
-
- /**
- * Shutdown the HTTP client. If [force] is [:false:] (the default)
- * the [:HttpClient:] will be kept alive until all active
- * connections are done. If [force] is [:true:] any active
- * connections will be closed to immediately release all
- * resources. These closed connections will receive an [:onError:]
- * callback to indicate that the client was shutdown. In both cases
- * trying to establish a new connection after calling [shutdown]
- * will throw an exception.
- */
- void close({bool force: false});
-}
-
-
-/**
- * HTTP request for a client connection.
- *
- * To set up a request, set the headers using the headers property
- * provided in this class and write the data to the body of the request.
- * HttpClientRequest is an [IOSink]. Use the methods from IOSink,
- * such as writeCharCode(), to write the body of the HTTP
- * request. When one of the IOSink methods is used for the first
- * time, the request header is sent. Calling any methods that
- * change the header after it is sent throws an exception.
- *
- * When writing string data through the [IOSink] the
- * encoding used is determined from the "charset" parameter of
- * the "Content-Type" header.
- *
- * HttpClientRequest request = ...
- * request.headers.contentType
- * = new ContentType("application", "json", charset: "utf-8");
- * request.write(...); // Strings written will be UTF-8 encoded.
- *
- * If no charset is provided the default of ISO-8859-1 (Latin 1) is
- * be used.
- *
- * HttpClientRequest request = ...
- * request.headers.add(HttpHeaders.CONTENT_TYPE, "text/plain");
- * request.write(...); // Strings written will be ISO-8859-1 encoded.
- *
- * An exception is thrown if you use an unsupported encoding and the
- * `write()` method being used takes a string parameter.
- */
-abstract class HttpClientRequest implements IOSink {
- /**
- * Gets and sets the requested persistent connection state.
- *
- * The default value is [:true:].
- */
- bool persistentConnection;
-
- /**
- * Set this property to [:true:] if this request should
- * automatically follow redirects. The default is [:true:].
- *
- * Automatic redirect will only happen for "GET" and "HEAD" requests
- * and only for the status codes [:HttpHeaders.MOVED_PERMANENTLY:]
- * (301), [:HttpStatus.FOUND:] (302),
- * [:HttpStatus.MOVED_TEMPORARILY:] (302, alias for
- * [:HttpStatus.FOUND:]), [:HttpStatus.SEE_OTHER:] (303) and
- * [:HttpStatus.TEMPORARY_REDIRECT:] (307). For
- * [:HttpStatus.SEE_OTHER:] (303) autmatic redirect will also happen
- * for "POST" requests with the method changed to "GET" when
- * following the redirect.
- *
- * All headers added to the request will be added to the redirection
- * request(s). However, any body send with the request will not be
- * part of the redirection request(s).
- */
- bool followRedirects;
-
- /**
- * Set this property to the maximum number of redirects to follow
- * when [followRedirects] is [:true:]. If this number is exceeded the
- * [onError] callback will be called with a [RedirectException].
- *
- * The default value is 5.
- */
- int maxRedirects;
-
- /**
- * The method of the request.
- */
- String get method;
-
- /**
- * The uri of the request.
- */
- Uri get uri;
-
- /**
- * Gets and sets the content length of the request. If the size of
- * the request is not known in advance set content length to -1,
- * which is also the default.
- */
- int contentLength;
-
- /**
- * Get or set if the [HttpClientRequest] should buffer output.
- *
- * Default value is `true`.
- *
- * __Note__: Disabling buffering of the output can result in very poor
- * performance, when writing many small chunks.
- */
- bool bufferOutput;
-
- /**
- * Returns the client request headers.
- *
- * The client request headers can be modified until the client
- * request body is written to or closed. After that they become
- * immutable.
- */
- HttpHeaders get headers;
-
- /**
- * Cookies to present to the server (in the 'cookie' header).
- */
- List<Cookie> get cookies;
-
- /**
- * A [HttpClientResponse] future that will complete once the response is
- * available. If an error occurs before the response is available, this
- * future will complete with an error.
- */
- Future<HttpClientResponse> get done;
-
- /**
- * Close the request for input. Returns the value of [done].
- */
- Future<HttpClientResponse> close();
-
- /**
- * Get information about the client connection. Returns [:null:] if the socket
- * is not available.
- */
- HttpConnectionInfo get connectionInfo;
-}
-
-
-/**
- * HTTP response for a client connection.
- *
- * The body of a [HttpClientResponse] object is a
- * [Stream] of data from the server. Listen to the body to handle
- * the data and be notified when the entire body is received.
- *
- * new HttpClient().get('localhost', 80, '/file.txt')
- * .then((HttpClientRequest request) => request.close())
- * .then((HttpClientResponse response) {
- * response.transform(UTF8.decoder).listen((contents) {
- * // handle data
- * });
- * });
- */
-abstract class HttpClientResponse implements Stream<List<int>> {
- /**
- * Returns the status code.
- *
- * The status code must be set before the body is written
- * to. Setting the status code after writing to the body will throw
- * a `StateError`.
- */
- int get statusCode;
-
- /**
- * Returns the reason phrase associated with the status code.
- *
- * The reason phrase must be set before the body is written
- * to. Setting the reason phrase after writing to the body will throw
- * a `StateError`.
- */
- String get reasonPhrase;
-
- /**
- * Returns the content length of the response body. Returns -1 if the size of
- * the response body is not known in advance.
- *
- * If the content length needs to be set, it must be set before the
- * body is written to. Setting the reason phrase after writing to
- * the body will throw a `StateError`.
- */
- int get contentLength;
-
- /**
- * Gets the persistent connection state returned by the server.
- *
- * if the persistent connection state needs to be set, it must be
- * set before the body is written to. Setting the reason phrase
- * after writing to the body will throw a `StateError`.
- */
- bool get persistentConnection;
-
- /**
- * Returns whether the status code is one of the normal redirect
- * codes [HttpStatus.MOVED_PERMANENTLY], [HttpStatus.FOUND],
- * [HttpStatus.MOVED_TEMPORARILY], [HttpStatus.SEE_OTHER] and
- * [HttpStatus.TEMPORARY_REDIRECT].
- */
- bool get isRedirect;
-
- /**
- * Returns the series of redirects this connection has been through. The
- * list will be empty if no redirects were followed. [redirects] will be
- * updated both in the case of an automatic and a manual redirect.
- */
- List<RedirectInfo> get redirects;
-
- /**
- * Redirects this connection to a new URL. The default value for
- * [method] is the method for the current request. The default value
- * for [url] is the value of the [HttpHeaders.LOCATION] header of
- * the current response. All body data must have been read from the
- * current response before calling [redirect].
- *
- * All headers added to the request will be added to the redirection
- * request. However, any body sent with the request will not be
- * part of the redirection request.
- *
- * If [followLoops] is set to [:true:], redirect will follow the redirect,
- * even if the URL was already visited. The default value is [:false:].
- *
- * [redirect] will ignore [maxRedirects] and will always perform the redirect.
- */
- Future<HttpClientResponse> redirect([String method,
- Uri url,
- bool followLoops]);
-
-
- /**
- * Returns the client response headers.
- *
- * The client response headers are immutable.
- */
- HttpHeaders get headers;
-
- /**
- * Detach the underlying socket from the HTTP client. When the
- * socket is detached the HTTP client will no longer perform any
- * operations on it.
- *
- * This is normally used when a HTTP upgrade is negotiated and the
- * communication should continue with a different protocol.
- */
- Future<Socket> detachSocket();
-
- /**
- * Cookies set by the server (from the 'set-cookie' header).
- */
- List<Cookie> get cookies;
-
- /**
- * Returns the certificate of the HTTPS server providing the response.
- * Returns null if the connection is not a secure TLS or SSL connection.
- */
- X509Certificate get certificate;
-
- /**
- * Gets information about the client connection. Returns [:null:] if the socket
- * is not available.
- */
- HttpConnectionInfo get connectionInfo;
-}
-
-
-abstract class HttpClientCredentials { }
-
-
-/**
- * Represents credentials for basic authentication.
- */
-abstract class HttpClientBasicCredentials extends HttpClientCredentials {
- factory HttpClientBasicCredentials(String username, String password) =>
- new _HttpClientBasicCredentials(username, password);
-}
-
-
-/**
- * Represents credentials for digest authentication. Digest
- * authentication is only supported for servers using the MD5
- * algorithm and quality of protection (qop) of either "none" or
- * "auth".
- */
-abstract class HttpClientDigestCredentials extends HttpClientCredentials {
- factory HttpClientDigestCredentials(String username, String password) =>
- new _HttpClientDigestCredentials(username, password);
-}
-
-
-/**
- * Information about an [HttpRequest], [HttpResponse], [HttpClientRequest], or
- * [HttpClientResponse] connection.
- */
-abstract class HttpConnectionInfo {
- InternetAddress get remoteAddress;
- int get remotePort;
- int get localPort;
-}
-
-
-/**
- * Redirect information.
- */
-abstract class RedirectInfo {
- /**
- * Returns the status code used for the redirect.
- */
- int get statusCode;
-
- /**
- * Returns the method used for the redirect.
- */
- String get method;
-
- /**
- * Returns the location for the redirect.
- */
- Uri get location;
-}
-
-
-/**
- * When detaching a socket from either the [:HttpServer:] or the
- * [:HttpClient:] due to a HTTP connection upgrade there might be
- * unparsed data already read from the socket. This unparsed data
- * together with the detached socket is returned in an instance of
- * this class.
- */
-abstract class DetachedSocket {
- Socket get socket;
- List<int> get unparsedData;
-}
-
-
-class HttpException implements IOException {
- final String message;
- final Uri uri;
-
- const HttpException(String this.message, {Uri this.uri});
-
- String toString() {
- var b = new StringBuffer()
- ..write('HttpException: ')
- ..write(message);
- if (uri != null) {
- b.write(', uri = $uri');
- }
- return b.toString();
- }
-}
-
-
-class RedirectException implements HttpException {
- final String message;
- final List<RedirectInfo> redirects;
-
- const RedirectException(this.message, this.redirects);
-
- String toString() => "RedirectException: $message";
-
- Uri get uri => redirects.last.location;
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/io/http_date.dart b/pkg/dev_compiler/tool/input_sdk/lib/io/http_date.dart
deleted file mode 100644
index 7f69613..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/io/http_date.dart
+++ /dev/null
@@ -1,315 +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.
-
-part of dart.io;
-
-/**
- * Utility functions for working with dates with HTTP specific date
- * formats.
- */
-class HttpDate {
- // From RFC-2616 section "3.3.1 Full Date",
- // http://tools.ietf.org/html/rfc2616#section-3.3.1
- //
- // HTTP-date = rfc1123-date | rfc850-date | asctime-date
- // rfc1123-date = wkday "," SP date1 SP time SP "GMT"
- // rfc850-date = weekday "," SP date2 SP time SP "GMT"
- // asctime-date = wkday SP date3 SP time SP 4DIGIT
- // date1 = 2DIGIT SP month SP 4DIGIT
- // ; day month year (e.g., 02 Jun 1982)
- // date2 = 2DIGIT "-" month "-" 2DIGIT
- // ; day-month-year (e.g., 02-Jun-82)
- // date3 = month SP ( 2DIGIT | ( SP 1DIGIT ))
- // ; month day (e.g., Jun 2)
- // time = 2DIGIT ":" 2DIGIT ":" 2DIGIT
- // ; 00:00:00 - 23:59:59
- // wkday = "Mon" | "Tue" | "Wed"
- // | "Thu" | "Fri" | "Sat" | "Sun"
- // weekday = "Monday" | "Tuesday" | "Wednesday"
- // | "Thursday" | "Friday" | "Saturday" | "Sunday"
- // month = "Jan" | "Feb" | "Mar" | "Apr"
- // | "May" | "Jun" | "Jul" | "Aug"
- // | "Sep" | "Oct" | "Nov" | "Dec"
-
- /**
- * Format a date according to
- * [RFC-1123](http://tools.ietf.org/html/rfc1123 "RFC-1123"),
- * e.g. `Thu, 1 Jan 1970 00:00:00 GMT`.
- */
- static String format(DateTime date) {
- const List wkday = const ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
- const List month = const ["Jan", "Feb", "Mar", "Apr", "May", "Jun",
- "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
-
- DateTime d = date.toUtc();
- StringBuffer sb = new StringBuffer()
- ..write(wkday[d.weekday - 1])
- ..write(", ")
- ..write(d.day <= 9 ? "0" : "")
- ..write(d.day.toString())
- ..write(" ")
- ..write(month[d.month - 1])
- ..write(" ")
- ..write(d.year.toString())
- ..write(d.hour <= 9 ? " 0" : " ")
- ..write(d.hour.toString())
- ..write(d.minute <= 9 ? ":0" : ":")
- ..write(d.minute.toString())
- ..write(d.second <= 9 ? ":0" : ":")
- ..write(d.second.toString())
- ..write(" GMT");
- return sb.toString();
- }
-
- /**
- * Parse a date string in either of the formats
- * [RFC-1123](http://tools.ietf.org/html/rfc1123 "RFC-1123"),
- * [RFC-850](http://tools.ietf.org/html/rfc850 "RFC-850") or
- * ANSI C's asctime() format. These formats are listed here.
- *
- * Thu, 1 Jan 1970 00:00:00 GMT
- * Thursday, 1-Jan-1970 00:00:00 GMT
- * Thu Jan 1 00:00:00 1970
- *
- * For more information see [RFC-2616 section
- * 3.1.1](http://tools.ietf.org/html/rfc2616#section-3.3.1
- * "RFC-2616 section 3.1.1").
- */
- static DateTime parse(String date) {
- final int SP = 32;
- const List wkdays = const ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
- const List weekdays = const ["Monday", "Tuesday", "Wednesday", "Thursday",
- "Friday", "Saturday", "Sunday"];
- const List months = const ["Jan", "Feb", "Mar", "Apr", "May", "Jun",
- "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
- const List wkdaysLowerCase =
- const ["mon", "tue", "wed", "thu", "fri", "sat", "sun"];
- const List weekdaysLowerCase = const ["monday", "tuesday", "wednesday",
- "thursday", "friday", "saturday",
- "sunday"];
- const List monthsLowerCase = const ["jan", "feb", "mar", "apr", "may",
- "jun", "jul", "aug", "sep", "oct",
- "nov", "dec"];
-
- final int formatRfc1123 = 0;
- final int formatRfc850 = 1;
- final int formatAsctime = 2;
-
- int index = 0;
- String tmp;
- int format;
-
- void expect(String s) {
- if (date.length - index < s.length) {
- throw new HttpException("Invalid HTTP date $date");
- }
- String tmp = date.substring(index, index + s.length);
- if (tmp != s) {
- throw new HttpException("Invalid HTTP date $date");
- }
- index += s.length;
- }
-
- int expectWeekday() {
- int weekday;
- // The formatting of the weekday signals the format of the date string.
- int pos = date.indexOf(",", index);
- if (pos == -1) {
- int pos = date.indexOf(" ", index);
- if (pos == -1) throw new HttpException("Invalid HTTP date $date");
- tmp = date.substring(index, pos);
- index = pos + 1;
- weekday = wkdays.indexOf(tmp);
- if (weekday != -1) {
- format = formatAsctime;
- return weekday;
- }
- } else {
- tmp = date.substring(index, pos);
- index = pos + 1;
- weekday = wkdays.indexOf(tmp);
- if (weekday != -1) {
- format = formatRfc1123;
- return weekday;
- }
- weekday = weekdays.indexOf(tmp);
- if (weekday != -1) {
- format = formatRfc850;
- return weekday;
- }
- }
- throw new HttpException("Invalid HTTP date $date");
- }
-
- int expectMonth(String separator) {
- int pos = date.indexOf(separator, index);
- if (pos - index != 3) throw new HttpException("Invalid HTTP date $date");
- tmp = date.substring(index, pos);
- index = pos + 1;
- int month = months.indexOf(tmp);
- if (month != -1) return month;
- throw new HttpException("Invalid HTTP date $date");
- }
-
- int expectNum(String separator) {
- int pos;
- if (separator.length > 0) {
- pos = date.indexOf(separator, index);
- } else {
- pos = date.length;
- }
- String tmp = date.substring(index, pos);
- index = pos + separator.length;
- try {
- int value = int.parse(tmp);
- return value;
- } on FormatException catch (e) {
- throw new HttpException("Invalid HTTP date $date");
- }
- }
-
- void expectEnd() {
- if (index != date.length) {
- throw new HttpException("Invalid HTTP date $date");
- }
- }
-
- int weekday = expectWeekday();
- int day;
- int month;
- int year;
- int hours;
- int minutes;
- int seconds;
- if (format == formatAsctime) {
- month = expectMonth(" ");
- if (date.codeUnitAt(index) == SP) index++;
- day = expectNum(" ");
- hours = expectNum(":");
- minutes = expectNum(":");
- seconds = expectNum(" ");
- year = expectNum("");
- } else {
- expect(" ");
- day = expectNum(format == formatRfc1123 ? " " : "-");
- month = expectMonth(format == formatRfc1123 ? " " : "-");
- year = expectNum(" ");
- hours = expectNum(":");
- minutes = expectNum(":");
- seconds = expectNum(" ");
- expect("GMT");
- }
- expectEnd();
- return new DateTime.utc(year, month + 1, day, hours, minutes, seconds, 0);
- }
-
- // Parse a cookie date string.
- static DateTime _parseCookieDate(String date) {
- const List monthsLowerCase = const ["jan", "feb", "mar", "apr", "may",
- "jun", "jul", "aug", "sep", "oct",
- "nov", "dec"];
-
- int position = 0;
-
- void error() {
- throw new HttpException("Invalid cookie date $date");
- }
-
- bool isEnd() => position == date.length;
-
- bool isDelimiter(String s) {
- int char = s.codeUnitAt(0);
- if (char == 0x09) return true;
- if (char >= 0x20 && char <= 0x2F) return true;
- if (char >= 0x3B && char <= 0x40) return true;
- if (char >= 0x5B && char <= 0x60) return true;
- if (char >= 0x7B && char <= 0x7E) return true;
- return false;
- }
-
- bool isNonDelimiter(String s) {
- int char = s.codeUnitAt(0);
- if (char >= 0x00 && char <= 0x08) return true;
- if (char >= 0x0A && char <= 0x1F) return true;
- if (char >= 0x30 && char <= 0x39) return true; // Digit
- if (char == 0x3A) return true; // ':'
- if (char >= 0x41 && char <= 0x5A) return true; // Alpha
- if (char >= 0x61 && char <= 0x7A) return true; // Alpha
- if (char >= 0x7F && char <= 0xFF) return true; // Alpha
- return false;
- }
-
- bool isDigit(String s) {
- int char = s.codeUnitAt(0);
- if (char > 0x2F && char < 0x3A) return true;
- return false;
- }
-
- int getMonth(String month) {
- if (month.length < 3) return -1;
- return monthsLowerCase.indexOf(month.substring(0, 3));
- }
-
- int toInt(String s) {
- int index = 0;
- for (; index < s.length && isDigit(s[index]); index++);
- return int.parse(s.substring(0, index));
- }
-
- var tokens = [];
- while (!isEnd()) {
- while (!isEnd() && isDelimiter(date[position])) position++;
- int start = position;
- while (!isEnd() && isNonDelimiter(date[position])) position++;
- tokens.add(date.substring(start, position).toLowerCase());
- while (!isEnd() && isDelimiter(date[position])) position++;
- }
-
- String timeStr;
- String dayOfMonthStr;
- String monthStr;
- String yearStr;
-
- for (var token in tokens) {
- if (token.length < 1) continue;
- if (timeStr == null && token.length >= 5 && isDigit(token[0]) &&
- (token[1] == ":" || (isDigit(token[1]) && token[2] == ":"))) {
- timeStr = token;
- } else if (dayOfMonthStr == null && isDigit(token[0])) {
- dayOfMonthStr = token;
- } else if (monthStr == null && getMonth(token) >= 0) {
- monthStr = token;
- } else if (yearStr == null && token.length >= 2 &&
- isDigit(token[0]) && isDigit(token[1])) {
- yearStr = token;
- }
- }
-
- if (timeStr == null || dayOfMonthStr == null ||
- monthStr == null || yearStr == null) {
- error();
- }
-
- int year = toInt(yearStr);
- if (year >= 70 && year <= 99) year += 1900;
- else if (year >= 0 && year <= 69) year += 2000;
- if (year < 1601) error();
-
- int dayOfMonth = toInt(dayOfMonthStr);
- if (dayOfMonth < 1 || dayOfMonth > 31) error();
-
- int month = getMonth(monthStr) + 1;
-
- var timeList = timeStr.split(":");
- if (timeList.length != 3) error();
- int hour = toInt(timeList[0]);
- int minute = toInt(timeList[1]);
- int second = toInt(timeList[2]);
- if (hour > 23) error();
- if (minute > 59) error();
- if (second > 59) error();
-
- return new DateTime.utc(year, month, dayOfMonth, hour, minute, second, 0);
- }
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/io/http_headers.dart b/pkg/dev_compiler/tool/input_sdk/lib/io/http_headers.dart
deleted file mode 100644
index 6b14ae2..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/io/http_headers.dart
+++ /dev/null
@@ -1,999 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-part of dart.io;
-
-class _HttpHeaders implements HttpHeaders {
- final Map<String, List<String>> _headers;
- final String protocolVersion;
-
- bool _mutable = true; // Are the headers currently mutable?
- List<String> _noFoldingHeaders;
-
- int _contentLength = -1;
- bool _persistentConnection = true;
- bool _chunkedTransferEncoding = false;
- String _host;
- int _port;
-
- final int _defaultPortForScheme;
-
- _HttpHeaders(this.protocolVersion,
- {int defaultPortForScheme: HttpClient.DEFAULT_HTTP_PORT,
- _HttpHeaders initialHeaders})
- : _headers = new HashMap<String, List<String>>(),
- _defaultPortForScheme = defaultPortForScheme {
- if (initialHeaders != null) {
- initialHeaders._headers.forEach((name, value) => _headers[name] = value);
- _contentLength = initialHeaders._contentLength;
- _persistentConnection = initialHeaders._persistentConnection;
- _chunkedTransferEncoding = initialHeaders._chunkedTransferEncoding;
- _host = initialHeaders._host;
- _port = initialHeaders._port;
- }
- if (protocolVersion == "1.0") {
- _persistentConnection = false;
- _chunkedTransferEncoding = false;
- }
- }
-
- List<String> operator[](String name) => _headers[name.toLowerCase()];
-
- String value(String name) {
- name = name.toLowerCase();
- List<String> values = _headers[name];
- if (values == null) return null;
- if (values.length > 1) {
- throw new HttpException("More than one value for header $name");
- }
- return values[0];
- }
-
- void add(String name, value) {
- _checkMutable();
- _addAll(_validateField(name), value);
- }
-
- void _addAll(String name, value) {
- assert(name == _validateField(name));
- if (value is Iterable) {
- for (var v in value) {
- _add(name, _validateValue(v));
- }
- } else {
- _add(name, _validateValue(value));
- }
- }
-
- void set(String name, Object value) {
- _checkMutable();
- name = _validateField(name);
- _headers.remove(name);
- if (name == HttpHeaders.TRANSFER_ENCODING) {
- _chunkedTransferEncoding = false;
- }
- _addAll(name, value);
- }
-
- void remove(String name, Object value) {
- _checkMutable();
- name = _validateField(name);
- value = _validateValue(value);
- List<String> values = _headers[name];
- if (values != null) {
- int index = values.indexOf(value);
- if (index != -1) {
- values.removeRange(index, index + 1);
- }
- if (values.length == 0) _headers.remove(name);
- }
- if (name == HttpHeaders.TRANSFER_ENCODING && value == "chunked") {
- _chunkedTransferEncoding = false;
- }
- }
-
- void removeAll(String name) {
- _checkMutable();
- name = _validateField(name);
- _headers.remove(name);
- }
-
- void forEach(void f(String name, List<String> values)) {
- _headers.forEach(f);
- }
-
- void noFolding(String name) {
- if (_noFoldingHeaders == null) _noFoldingHeaders = new List<String>();
- _noFoldingHeaders.add(name);
- }
-
- bool get persistentConnection => _persistentConnection;
-
- void set persistentConnection(bool persistentConnection) {
- _checkMutable();
- if (persistentConnection == _persistentConnection) return;
- if (persistentConnection) {
- if (protocolVersion == "1.1") {
- remove(HttpHeaders.CONNECTION, "close");
- } else {
- if (_contentLength == -1) {
- throw new HttpException(
- "Trying to set 'Connection: Keep-Alive' on HTTP 1.0 headers with "
- "no ContentLength");
- }
- add(HttpHeaders.CONNECTION, "keep-alive");
- }
- } else {
- if (protocolVersion == "1.1") {
- add(HttpHeaders.CONNECTION, "close");
- } else {
- remove(HttpHeaders.CONNECTION, "keep-alive");
- }
- }
- _persistentConnection = persistentConnection;
- }
-
- int get contentLength => _contentLength;
-
- void set contentLength(int contentLength) {
- _checkMutable();
- if (protocolVersion == "1.0" &&
- persistentConnection &&
- contentLength == -1) {
- throw new HttpException(
- "Trying to clear ContentLength on HTTP 1.0 headers with "
- "'Connection: Keep-Alive' set");
- }
- if (_contentLength == contentLength) return;
- _contentLength = contentLength;
- if (_contentLength >= 0) {
- if (chunkedTransferEncoding) chunkedTransferEncoding = false;
- _set(HttpHeaders.CONTENT_LENGTH, contentLength.toString());
- } else {
- removeAll(HttpHeaders.CONTENT_LENGTH);
- if (protocolVersion == "1.1") {
- chunkedTransferEncoding = true;
- }
- }
- }
-
- bool get chunkedTransferEncoding => _chunkedTransferEncoding;
-
- void set chunkedTransferEncoding(bool chunkedTransferEncoding) {
- _checkMutable();
- if (chunkedTransferEncoding && protocolVersion == "1.0") {
- throw new HttpException(
- "Trying to set 'Transfer-Encoding: Chunked' on HTTP 1.0 headers");
- }
- if (chunkedTransferEncoding == _chunkedTransferEncoding) return;
- if (chunkedTransferEncoding) {
- List<String> values = _headers[HttpHeaders.TRANSFER_ENCODING];
- if ((values == null || values.last != "chunked")) {
- // Headers does not specify chunked encoding - add it if set.
- _addValue(HttpHeaders.TRANSFER_ENCODING, "chunked");
- }
- contentLength = -1;
- } else {
- // Headers does specify chunked encoding - remove it if not set.
- remove(HttpHeaders.TRANSFER_ENCODING, "chunked");
- }
- _chunkedTransferEncoding = chunkedTransferEncoding;
- }
-
- String get host => _host;
-
- void set host(String host) {
- _checkMutable();
- _host = host;
- _updateHostHeader();
- }
-
- int get port => _port;
-
- void set port(int port) {
- _checkMutable();
- _port = port;
- _updateHostHeader();
- }
-
- DateTime get ifModifiedSince {
- List<String> values = _headers[HttpHeaders.IF_MODIFIED_SINCE];
- if (values != null) {
- try {
- return HttpDate.parse(values[0]);
- } on Exception catch (e) {
- return null;
- }
- }
- return null;
- }
-
- void set ifModifiedSince(DateTime ifModifiedSince) {
- _checkMutable();
- // Format "ifModifiedSince" header with date in Greenwich Mean Time (GMT).
- String formatted = HttpDate.format(ifModifiedSince.toUtc());
- _set(HttpHeaders.IF_MODIFIED_SINCE, formatted);
- }
-
- DateTime get date {
- List<String> values = _headers[HttpHeaders.DATE];
- if (values != null) {
- try {
- return HttpDate.parse(values[0]);
- } on Exception catch (e) {
- return null;
- }
- }
- return null;
- }
-
- void set date(DateTime date) {
- _checkMutable();
- // Format "DateTime" header with date in Greenwich Mean Time (GMT).
- String formatted = HttpDate.format(date.toUtc());
- _set("date", formatted);
- }
-
- DateTime get expires {
- List<String> values = _headers[HttpHeaders.EXPIRES];
- if (values != null) {
- try {
- return HttpDate.parse(values[0]);
- } on Exception catch (e) {
- return null;
- }
- }
- return null;
- }
-
- void set expires(DateTime expires) {
- _checkMutable();
- // Format "Expires" header with date in Greenwich Mean Time (GMT).
- String formatted = HttpDate.format(expires.toUtc());
- _set(HttpHeaders.EXPIRES, formatted);
- }
-
- ContentType get contentType {
- var values = _headers["content-type"];
- if (values != null) {
- return ContentType.parse(values[0]);
- } else {
- return null;
- }
- }
-
- void set contentType(ContentType contentType) {
- _checkMutable();
- _set(HttpHeaders.CONTENT_TYPE, contentType.toString());
- }
-
- void clear() {
- _checkMutable();
- _headers.clear();
- _contentLength = -1;
- _persistentConnection = true;
- _chunkedTransferEncoding = false;
- _host = null;
- _port = null;
- }
-
- // [name] must be a lower-case version of the name.
- void _add(String name, value) {
- assert(name == _validateField(name));
- // Use the length as index on what method to call. This is notable
- // faster than computing hash and looking up in a hash-map.
- switch (name.length) {
- case 4:
- if (HttpHeaders.DATE == name) {
- _addDate(name, value);
- return;
- }
- if (HttpHeaders.HOST == name) {
- _addHost(name, value);
- return;
- }
- break;
- case 7:
- if (HttpHeaders.EXPIRES == name) {
- _addExpires(name, value);
- return;
- }
- break;
- case 10:
- if (HttpHeaders.CONNECTION == name) {
- _addConnection(name, value);
- return;
- }
- break;
- case 12:
- if (HttpHeaders.CONTENT_TYPE == name) {
- _addContentType(name, value);
- return;
- }
- break;
- case 14:
- if (HttpHeaders.CONTENT_LENGTH == name) {
- _addContentLength(name, value);
- return;
- }
- break;
- case 17:
- if (HttpHeaders.TRANSFER_ENCODING == name) {
- _addTransferEncoding(name, value);
- return;
- }
- if (HttpHeaders.IF_MODIFIED_SINCE == name) {
- _addIfModifiedSince(name, value);
- return;
- }
- }
- _addValue(name, value);
- }
-
- void _addContentLength(String name, value) {
- if (value is int) {
- contentLength = value;
- } else if (value is String) {
- contentLength = int.parse(value);
- } else {
- throw new HttpException("Unexpected type for header named $name");
- }
- }
-
- void _addTransferEncoding(String name, value) {
- if (value == "chunked") {
- chunkedTransferEncoding = true;
- } else {
- _addValue(HttpHeaders.TRANSFER_ENCODING, value);
- }
- }
-
- void _addDate(String name, value) {
- if (value is DateTime) {
- date = value;
- } else if (value is String) {
- _set(HttpHeaders.DATE, value);
- } else {
- throw new HttpException("Unexpected type for header named $name");
- }
- }
-
- void _addExpires(String name, value) {
- if (value is DateTime) {
- expires = value;
- } else if (value is String) {
- _set(HttpHeaders.EXPIRES, value);
- } else {
- throw new HttpException("Unexpected type for header named $name");
- }
- }
-
- void _addIfModifiedSince(String name, value) {
- if (value is DateTime) {
- ifModifiedSince = value;
- } else if (value is String) {
- _set(HttpHeaders.IF_MODIFIED_SINCE, value);
- } else {
- throw new HttpException("Unexpected type for header named $name");
- }
- }
-
- void _addHost(String name, value) {
- if (value is String) {
- int pos = value.indexOf(":");
- if (pos == -1) {
- _host = value;
- _port = HttpClient.DEFAULT_HTTP_PORT;
- } else {
- if (pos > 0) {
- _host = value.substring(0, pos);
- } else {
- _host = null;
- }
- if (pos + 1 == value.length) {
- _port = HttpClient.DEFAULT_HTTP_PORT;
- } else {
- try {
- _port = int.parse(value.substring(pos + 1));
- } on FormatException catch (e) {
- _port = null;
- }
- }
- }
- _set(HttpHeaders.HOST, value);
- } else {
- throw new HttpException("Unexpected type for header named $name");
- }
- }
-
- void _addConnection(String name, value) {
- var lowerCaseValue = value.toLowerCase();
- if (lowerCaseValue == 'close') {
- _persistentConnection = false;
- } else if (lowerCaseValue == 'keep-alive') {
- _persistentConnection = true;
- }
- _addValue(name, value);
- }
-
- void _addContentType(String name, value) {
- _set(HttpHeaders.CONTENT_TYPE, value);
- }
-
- void _addValue(String name, Object value) {
- List<String> values = _headers[name];
- if (values == null) {
- values = new List<String>();
- _headers[name] = values;
- }
- if (value is DateTime) {
- values.add(HttpDate.format(value));
- } else if (value is String) {
- values.add(value);
- } else {
- values.add(_validateValue(value.toString()));
- }
- }
-
- void _set(String name, String value) {
- assert(name == _validateField(name));
- List<String> values = new List<String>();
- _headers[name] = values;
- values.add(value);
- }
-
- _checkMutable() {
- if (!_mutable) throw new HttpException("HTTP headers are not mutable");
- }
-
- _updateHostHeader() {
- bool defaultPort = _port == null || _port == _defaultPortForScheme;
- _set("host", defaultPort ? host : "$host:$_port");
- }
-
- _foldHeader(String name) {
- if (name == HttpHeaders.SET_COOKIE ||
- (_noFoldingHeaders != null &&
- _noFoldingHeaders.indexOf(name) != -1)) {
- return false;
- }
- return true;
- }
-
- void _finalize() {
- _mutable = false;
- }
-
- int _write(Uint8List buffer, int offset) {
- void write(List<int> bytes) {
- int len = bytes.length;
- for (int i = 0; i < len; i++) {
- buffer[offset + i] = bytes[i];
- }
- offset += len;
- }
-
- // Format headers.
- for (String name in _headers.keys) {
- List<String> values = _headers[name];
- bool fold = _foldHeader(name);
- var nameData = name.codeUnits;
- write(nameData);
- buffer[offset++] = _CharCode.COLON;
- buffer[offset++] = _CharCode.SP;
- for (int i = 0; i < values.length; i++) {
- if (i > 0) {
- if (fold) {
- buffer[offset++] = _CharCode.COMMA;
- buffer[offset++] = _CharCode.SP;
- } else {
- buffer[offset++] = _CharCode.CR;
- buffer[offset++] = _CharCode.LF;
- write(nameData);
- buffer[offset++] = _CharCode.COLON;
- buffer[offset++] = _CharCode.SP;
- }
- }
- write(values[i].codeUnits);
- }
- buffer[offset++] = _CharCode.CR;
- buffer[offset++] = _CharCode.LF;
- }
- return offset;
- }
-
- String toString() {
- StringBuffer sb = new StringBuffer();
- _headers.forEach((String name, List<String> values) {
- sb..write(name)..write(": ");
- bool fold = _foldHeader(name);
- for (int i = 0; i < values.length; i++) {
- if (i > 0) {
- if (fold) {
- sb.write(", ");
- } else {
- sb..write("\n")..write(name)..write(": ");
- }
- }
- sb.write(values[i]);
- }
- sb.write("\n");
- });
- return sb.toString();
- }
-
- List<Cookie> _parseCookies() {
- // Parse a Cookie header value according to the rules in RFC 6265.
- var cookies = new List<Cookie>();
- void parseCookieString(String s) {
- int index = 0;
-
- bool done() => index == -1 || index == s.length;
-
- void skipWS() {
- while (!done()) {
- if (s[index] != " " && s[index] != "\t") return;
- index++;
- }
- }
-
- String parseName() {
- int start = index;
- while (!done()) {
- if (s[index] == " " || s[index] == "\t" || s[index] == "=") break;
- index++;
- }
- return s.substring(start, index);
- }
-
- String parseValue() {
- int start = index;
- while (!done()) {
- if (s[index] == " " || s[index] == "\t" || s[index] == ";") break;
- index++;
- }
- return s.substring(start, index);
- }
-
- bool expect(String expected) {
- if (done()) return false;
- if (s[index] != expected) return false;
- index++;
- return true;
- }
-
- while (!done()) {
- skipWS();
- if (done()) return;
- String name = parseName();
- skipWS();
- if (!expect("=")) {
- index = s.indexOf(';', index);
- continue;
- }
- skipWS();
- String value = parseValue();
- try {
- cookies.add(new _Cookie(name, value));
- } catch (_) {
- // Skip it, invalid cookie data.
- }
- skipWS();
- if (done()) return;
- if (!expect(";")) {
- index = s.indexOf(';', index);
- continue;
- }
- }
- }
- List<String> values = _headers[HttpHeaders.COOKIE];
- if (values != null) {
- values.forEach((headerValue) => parseCookieString(headerValue));
- }
- return cookies;
- }
-
- static String _validateField(String field) {
- for (var i = 0; i < field.length; i++) {
- if (!_HttpParser._isTokenChar(field.codeUnitAt(i))) {
- throw new FormatException(
- "Invalid HTTP header field name: ${JSON.encode(field)}");
- }
- }
- return field.toLowerCase();
- }
-
- static _validateValue(value) {
- if (value is! String) return value;
- for (var i = 0; i < value.length; i++) {
- if (!_HttpParser._isValueChar(value.codeUnitAt(i))) {
- throw new FormatException(
- "Invalid HTTP header field value: ${JSON.encode(value)}");
- }
- }
- return value;
- }
-}
-
-
-class _HeaderValue implements HeaderValue {
- String _value;
- Map<String, String> _parameters;
- Map<String, String> _unmodifiableParameters;
-
- _HeaderValue([String this._value = "", Map<String, String> parameters]) {
- if (parameters != null) {
- _parameters = new HashMap<String, String>.from(parameters);
- }
- }
-
- static _HeaderValue parse(String value,
- {parameterSeparator: ";",
- valueSeparator: null,
- preserveBackslash: false}) {
- // Parse the string.
- var result = new _HeaderValue();
- result._parse(value, parameterSeparator, valueSeparator, preserveBackslash);
- return result;
- }
-
- String get value => _value;
-
- void _ensureParameters() {
- if (_parameters == null) {
- _parameters = new HashMap<String, String>();
- }
- }
-
- Map<String, String> get parameters {
- _ensureParameters();
- if (_unmodifiableParameters == null) {
- _unmodifiableParameters = new UnmodifiableMapView(_parameters);
- }
- return _unmodifiableParameters;
- }
-
- String toString() {
- StringBuffer sb = new StringBuffer();
- sb.write(_value);
- if (parameters != null && parameters.length > 0) {
- _parameters.forEach((String name, String value) {
- sb..write("; ")..write(name)..write("=")..write(value);
- });
- }
- return sb.toString();
- }
-
- void _parse(String s,
- String parameterSeparator,
- String valueSeparator,
- bool preserveBackslash) {
- int index = 0;
-
- bool done() => index == s.length;
-
- void skipWS() {
- while (!done()) {
- if (s[index] != " " && s[index] != "\t") return;
- index++;
- }
- }
-
- String parseValue() {
- int start = index;
- while (!done()) {
- if (s[index] == " " ||
- s[index] == "\t" ||
- s[index] == valueSeparator ||
- s[index] == parameterSeparator) break;
- index++;
- }
- return s.substring(start, index);
- }
-
- void expect(String expected) {
- 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() {
- var parameters = new HashMap<String, String>();
- _parameters = new UnmodifiableMapView(parameters);
-
- String parseParameterName() {
- int start = index;
- while (!done()) {
- if (s[index] == " " ||
- s[index] == "\t" ||
- s[index] == "=" ||
- s[index] == parameterSeparator ||
- s[index] == valueSeparator) break;
- index++;
- }
- return s.substring(start, index).toLowerCase();
- }
-
- String parseParameterValue() {
- if (!done() && s[index] == "\"") {
- // Parse quoted value.
- StringBuffer sb = new StringBuffer();
- index++;
- while (!done()) {
- if (s[index] == "\\") {
- if (index + 1 == s.length) {
- throw new HttpException("Failed to parse header value");
- }
- if (preserveBackslash && s[index + 1] != "\"") {
- sb.write(s[index]);
- }
- index++;
- } else if (s[index] == "\"") {
- index++;
- break;
- }
- sb.write(s[index]);
- index++;
- }
- return sb.toString();
- } else {
- // Parse non-quoted value.
- var val = parseValue();
- return val == "" ? null : val;
- }
- }
-
- while (!done()) {
- skipWS();
- if (done()) return;
- String name = parseParameterName();
- skipWS();
- if (done()) {
- parameters[name] = null;
- return;
- }
- maybeExpect("=");
- skipWS();
- if(done()) {
- parameters[name] = null;
- return;
- }
- String value = parseParameterValue();
- if (name == 'charset' && this is _ContentType) {
- // Charset parameter of ContentTypes are always lower-case.
- value = value.toLowerCase();
- }
- parameters[name] = value;
- skipWS();
- if (done()) return;
- // TODO: Implement support for multi-valued parameters.
- if(s[index] == valueSeparator) return;
- expect(parameterSeparator);
- }
- }
-
- skipWS();
- _value = parseValue();
- skipWS();
- if (done()) return;
- maybeExpect(parameterSeparator);
- parseParameters();
- }
-}
-
-
-class _ContentType extends _HeaderValue implements ContentType {
- String _primaryType = "";
- String _subType = "";
-
- _ContentType(String primaryType,
- String subType,
- String charset,
- Map<String, String> parameters)
- : _primaryType = primaryType, _subType = subType, super("") {
- if (_primaryType == null) _primaryType = "";
- if (_subType == null) _subType = "";
- _value = "$_primaryType/$_subType";
- if (parameters != null) {
- _ensureParameters();
- parameters.forEach((String key, String value) {
- String lowerCaseKey = key.toLowerCase();
- if (lowerCaseKey == "charset") {
- value = value.toLowerCase();
- }
- this._parameters[lowerCaseKey] = value;
- });
- }
- if (charset != null) {
- _ensureParameters();
- this._parameters["charset"] = charset.toLowerCase();
- }
- }
-
- _ContentType._();
-
- static _ContentType parse(String value) {
- var result = new _ContentType._();
- result._parse(value, ";", null, false);
- int index = result._value.indexOf("/");
- if (index == -1 || index == (result._value.length - 1)) {
- result._primaryType = result._value.trim().toLowerCase();
- result._subType = "";
- } else {
- result._primaryType =
- result._value.substring(0, index).trim().toLowerCase();
- result._subType = result._value.substring(index + 1).trim().toLowerCase();
- }
- return result;
- }
-
- String get mimeType => '$primaryType/$subType';
-
- String get primaryType => _primaryType;
-
- String get subType => _subType;
-
- String get charset => parameters["charset"];
-}
-
-
-class _Cookie implements Cookie {
- String name;
- String value;
- DateTime expires;
- int maxAge;
- String domain;
- String path;
- bool httpOnly = false;
- bool secure = false;
-
- _Cookie([this.name, this.value]) {
- // Default value of httponly is true.
- httpOnly = true;
- _validate();
- }
-
- _Cookie.fromSetCookieValue(String value) {
- // Parse the 'set-cookie' header value.
- _parseSetCookieValue(value);
- }
-
- // Parse a 'set-cookie' header value according to the rules in RFC 6265.
- void _parseSetCookieValue(String s) {
- int index = 0;
-
- bool done() => index == s.length;
-
- String parseName() {
- int start = index;
- while (!done()) {
- if (s[index] == "=") break;
- index++;
- }
- return s.substring(start, index).trim();
- }
-
- String parseValue() {
- int start = index;
- while (!done()) {
- if (s[index] == ";") break;
- index++;
- }
- return s.substring(start, index).trim();
- }
-
- 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]");
- }
- index++;
- }
-
- void parseAttributes() {
- String parseAttributeName() {
- int start = index;
- while (!done()) {
- if (s[index] == "=" || s[index] == ";") break;
- index++;
- }
- return s.substring(start, index).trim().toLowerCase();
- }
-
- String parseAttributeValue() {
- int start = index;
- while (!done()) {
- if (s[index] == ";") break;
- index++;
- }
- return s.substring(start, index).trim().toLowerCase();
- }
-
- while (!done()) {
- String name = parseAttributeName();
- String value = "";
- if (!done() && s[index] == "=") {
- index++; // Skip the = character.
- value = parseAttributeValue();
- }
- if (name == "expires") {
- expires = HttpDate._parseCookieDate(value);
- } else if (name == "max-age") {
- maxAge = int.parse(value);
- } else if (name == "domain") {
- domain = value;
- } else if (name == "path") {
- path = value;
- } else if (name == "httponly") {
- httpOnly = true;
- } else if (name == "secure") {
- secure = true;
- }
- if (!done()) index++; // Skip the ; character
- }
- }
-
- name = parseName();
- if (done() || name.length == 0) {
- throw new HttpException("Failed to parse header value [$s]");
- }
- index++; // Skip the = character.
- value = parseValue();
- _validate();
- if (done()) return;
- index++; // Skip the ; character.
- parseAttributes();
- }
-
- String toString() {
- StringBuffer sb = new StringBuffer();
- sb..write(name)..write("=")..write(value);
- if (expires != null) {
- sb..write("; Expires=")..write(HttpDate.format(expires));
- }
- if (maxAge != null) {
- sb..write("; Max-Age=")..write(maxAge);
- }
- if (domain != null) {
- sb..write("; Domain=")..write(domain);
- }
- if (path != null) {
- sb..write("; Path=")..write(path);
- }
- if (secure) sb.write("; Secure");
- if (httpOnly) sb.write("; HttpOnly");
- return sb.toString();
- }
-
- void _validate() {
- const SEPERATORS = const [
- "(", ")", "<", ">", "@", ",", ";", ":", "\\",
- '"', "/", "[", "]", "?", "=", "{", "}"];
- for (int i = 0; i < name.length; i++) {
- int codeUnit = name.codeUnits[i];
- if (codeUnit <= 32 ||
- codeUnit >= 127 ||
- SEPERATORS.indexOf(name[i]) >= 0) {
- throw new FormatException(
- "Invalid character in cookie name, code unit: '$codeUnit'");
- }
- }
- for (int i = 0; i < value.length; i++) {
- int codeUnit = value.codeUnits[i];
- if (!(codeUnit == 0x21 ||
- (codeUnit >= 0x23 && codeUnit <= 0x2B) ||
- (codeUnit >= 0x2D && codeUnit <= 0x3A) ||
- (codeUnit >= 0x3C && codeUnit <= 0x5B) ||
- (codeUnit >= 0x5D && codeUnit <= 0x7E))) {
- throw new FormatException(
- "Invalid character in cookie value, code unit: '$codeUnit'");
- }
- }
- }
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/io/http_impl.dart b/pkg/dev_compiler/tool/input_sdk/lib/io/http_impl.dart
deleted file mode 100644
index dff98f0..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/io/http_impl.dart
+++ /dev/null
@@ -1,2890 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-part of dart.io;
-
-const int _OUTGOING_BUFFER_SIZE = 8 * 1024;
-
-class _HttpIncoming extends Stream<List<int>> {
- final int _transferLength;
- final Completer _dataCompleter = new Completer();
- Stream<List<int>> _stream;
-
- bool fullBodyRead = false;
-
- // Common properties.
- final _HttpHeaders headers;
- bool upgraded = false;
-
- // ClientResponse properties.
- int statusCode;
- String reasonPhrase;
-
- // Request properties.
- String method;
- Uri uri;
-
- bool hasSubscriber = false;
-
- // The transfer length if the length of the message body as it
- // appears in the message (RFC 2616 section 4.4). This can be -1 if
- // the length of the massage body is not known due to transfer
- // codings.
- int get transferLength => _transferLength;
-
- _HttpIncoming(this.headers, this._transferLength, this._stream);
-
- StreamSubscription<List<int>> listen(void onData(List<int> event),
- {Function onError,
- void onDone(),
- bool cancelOnError}) {
- hasSubscriber = true;
- return _stream
- .handleError((error) {
- throw new HttpException(error.message, uri: uri);
- })
- .listen(onData,
- onError: onError,
- onDone: onDone,
- cancelOnError: cancelOnError);
- }
-
- // Is completed once all data have been received.
- Future get dataDone => _dataCompleter.future;
-
- void close(bool closing) {
- fullBodyRead = true;
- hasSubscriber = true;
- _dataCompleter.complete(closing);
- }
-}
-
-abstract class _HttpInboundMessage extends Stream<List<int>> {
- final _HttpIncoming _incoming;
- List<Cookie> _cookies;
-
- _HttpInboundMessage(this._incoming);
-
- List<Cookie> get cookies {
- if (_cookies != null) return _cookies;
- return _cookies = headers._parseCookies();
- }
-
- _HttpHeaders get headers => _incoming.headers;
- String get protocolVersion => headers.protocolVersion;
- int get contentLength => headers.contentLength;
- bool get persistentConnection => headers.persistentConnection;
-}
-
-
-class _HttpRequest extends _HttpInboundMessage implements HttpRequest {
- final HttpResponse response;
-
- final _HttpServer _httpServer;
-
- final _HttpConnection _httpConnection;
-
- _HttpSession _session;
-
- Uri _requestedUri;
-
- _HttpRequest(this.response, _HttpIncoming _incoming, this._httpServer,
- this._httpConnection) : super(_incoming) {
- if (headers.protocolVersion == "1.1") {
- response.headers
- ..chunkedTransferEncoding = true
- ..persistentConnection = headers.persistentConnection;
- }
-
- if (_httpServer._sessionManagerInstance != null) {
- // Map to session if exists.
- var sessionIds = cookies
- .where((cookie) => cookie.name.toUpperCase() == _DART_SESSION_ID)
- .map((cookie) => cookie.value);
- for (var sessionId in sessionIds) {
- _session = _httpServer._sessionManager.getSession(sessionId);
- if (_session != null) {
- _session._markSeen();
- break;
- }
- }
- }
- }
-
- StreamSubscription<List<int>> listen(void onData(List<int> event),
- {Function onError,
- void onDone(),
- bool cancelOnError}) {
- return _incoming.listen(onData,
- onError: onError,
- onDone: onDone,
- cancelOnError: cancelOnError);
- }
-
- Uri get uri => _incoming.uri;
-
- Uri get requestedUri {
- if (_requestedUri == null) {
- var proto = headers['x-forwarded-proto'];
- var scheme = proto != null ? proto.first :
- _httpConnection._socket is SecureSocket ? "https" : "http";
- var hostList = headers['x-forwarded-host'];
- String host;
- if (hostList != null) {
- host = hostList.first;
- } else {
- hostList = headers['host'];
- if (hostList != null) {
- host = hostList.first;
- } else {
- host = "${_httpServer.address.host}:${_httpServer.port}";
- }
- }
- _requestedUri = Uri.parse("$scheme://$host$uri");
- }
- return _requestedUri;
- }
-
- String get method => _incoming.method;
-
- HttpSession get session {
- if (_session != null) {
- if (_session._destroyed) {
- // It's destroyed, clear it.
- _session = null;
- // Create new session object by calling recursive.
- return session;
- }
- // It's already mapped, use it.
- return _session;
- }
- // Create session, store it in connection, and return.
- return _session = _httpServer._sessionManager.createSession();
- }
-
- HttpConnectionInfo get connectionInfo => _httpConnection.connectionInfo;
-
- X509Certificate get certificate {
- var socket = _httpConnection._socket;
- if (socket is SecureSocket) return socket.peerCertificate;
- return null;
- }
-}
-
-
-class _HttpClientResponse
- extends _HttpInboundMessage implements HttpClientResponse {
- List<RedirectInfo> get redirects => _httpRequest._responseRedirects;
-
- // The HttpClient this response belongs to.
- final _HttpClient _httpClient;
-
- // The HttpClientRequest of this response.
- final _HttpClientRequest _httpRequest;
-
- _HttpClientResponse(_HttpIncoming _incoming, this._httpRequest,
- this._httpClient) : super(_incoming) {
- // Set uri for potential exceptions.
- _incoming.uri = _httpRequest.uri;
- }
-
- int get statusCode => _incoming.statusCode;
- String get reasonPhrase => _incoming.reasonPhrase;
-
- X509Certificate get certificate {
- var socket = _httpRequest._httpClientConnection._socket;
- if (socket is SecureSocket) return socket.peerCertificate;
- throw new UnsupportedError("Socket is not a SecureSocket");
- }
-
- List<Cookie> get cookies {
- if (_cookies != null) return _cookies;
- _cookies = new List<Cookie>();
- List<String> values = headers[HttpHeaders.SET_COOKIE];
- if (values != null) {
- values.forEach((value) {
- _cookies.add(new Cookie.fromSetCookieValue(value));
- });
- }
- return _cookies;
- }
-
- bool get isRedirect {
- if (_httpRequest.method == "GET" || _httpRequest.method == "HEAD") {
- return statusCode == HttpStatus.MOVED_PERMANENTLY ||
- statusCode == HttpStatus.FOUND ||
- statusCode == HttpStatus.SEE_OTHER ||
- statusCode == HttpStatus.TEMPORARY_REDIRECT;
- } else if (_httpRequest.method == "POST") {
- return statusCode == HttpStatus.SEE_OTHER;
- }
- return false;
- }
-
- Future<HttpClientResponse> redirect([String method,
- Uri url,
- bool followLoops]) {
- if (method == null) {
- // Set method as defined by RFC 2616 section 10.3.4.
- if (statusCode == HttpStatus.SEE_OTHER && _httpRequest.method == "POST") {
- method = "GET";
- } else {
- method = _httpRequest.method;
- }
- }
- if (url == null) {
- String location = headers.value(HttpHeaders.LOCATION);
- if (location == null) {
- throw new StateError("Response has no Location header for redirect");
- }
- url = Uri.parse(location);
- }
- if (followLoops != true) {
- for (var redirect in redirects) {
- if (redirect.location == url) {
- return new Future.error(
- new RedirectException("Redirect loop detected", redirects));
- }
- }
- }
- return _httpClient._openUrlFromRequest(method, url, _httpRequest)
- .then((request) {
- request._responseRedirects
- ..addAll(this.redirects)
- ..add(new _RedirectInfo(statusCode, method, url));
- return request.close();
- });
- }
-
- StreamSubscription<List<int>> listen(void onData(List<int> event),
- {Function onError,
- void onDone(),
- bool cancelOnError}) {
- if (_incoming.upgraded) {
- // If upgraded, the connection is already 'removed' form the client.
- // Since listening to upgraded data is 'bogus', simply close and
- // return empty stream subscription.
- _httpRequest._httpClientConnection.destroy();
- return new Stream.fromIterable([]).listen(null, onDone: onDone);
- }
- var stream = _incoming;
- if (_httpClient.autoUncompress &&
- headers.value(HttpHeaders.CONTENT_ENCODING) == "gzip") {
- stream = stream.transform(GZIP.decoder);
- }
- return stream.listen(onData,
- onError: onError,
- onDone: onDone,
- cancelOnError: cancelOnError);
- }
-
- Future<Socket> detachSocket() {
- _httpClient._connectionClosed(_httpRequest._httpClientConnection);
- return _httpRequest._httpClientConnection.detachSocket();
- }
-
- HttpConnectionInfo get connectionInfo => _httpRequest.connectionInfo;
-
- bool get _shouldAuthenticateProxy {
- // Only try to authenticate if there is a challenge in the response.
- List<String> challenge = headers[HttpHeaders.PROXY_AUTHENTICATE];
- return statusCode == HttpStatus.PROXY_AUTHENTICATION_REQUIRED &&
- challenge != null && challenge.length == 1;
- }
-
- bool get _shouldAuthenticate {
- // Only try to authenticate if there is a challenge in the response.
- List<String> challenge = headers[HttpHeaders.WWW_AUTHENTICATE];
- return statusCode == HttpStatus.UNAUTHORIZED &&
- challenge != null && challenge.length == 1;
- }
-
- Future<HttpClientResponse> _authenticate(bool proxyAuth) {
- Future<HttpClientResponse> retry() {
- // Drain body and retry.
- return drain().then((_) {
- return _httpClient._openUrlFromRequest(_httpRequest.method,
- _httpRequest.uri,
- _httpRequest)
- .then((request) => request.close());
- });
- }
-
- List<String> authChallenge() {
- return proxyAuth ? headers[HttpHeaders.PROXY_AUTHENTICATE]
- : headers[HttpHeaders.WWW_AUTHENTICATE];
- }
-
- _Credentials findCredentials(_AuthenticationScheme scheme) {
- return proxyAuth ? _httpClient._findProxyCredentials(_httpRequest._proxy,
- scheme)
- : _httpClient._findCredentials(_httpRequest.uri, scheme);
- }
-
- void removeCredentials(_Credentials cr) {
- if (proxyAuth) {
- _httpClient._removeProxyCredentials(cr);
- } else {
- _httpClient._removeCredentials(cr);
- }
- }
-
- Future requestAuthentication(_AuthenticationScheme scheme, String realm) {
- if (proxyAuth) {
- if (_httpClient._authenticateProxy == null) {
- return new Future.value(false);
- }
- var proxy = _httpRequest._proxy;
- return _httpClient._authenticateProxy(proxy.host,
- proxy.port,
- scheme.toString(),
- realm);
- } else {
- if (_httpClient._authenticate == null) {
- return new Future.value(false);
- }
- return _httpClient._authenticate(_httpRequest.uri,
- scheme.toString(),
- realm);
- }
- }
-
- List<String> challenge = authChallenge();
- assert(challenge != null || challenge.length == 1);
- _HeaderValue header =
- _HeaderValue.parse(challenge[0], parameterSeparator: ",");
- _AuthenticationScheme scheme =
- new _AuthenticationScheme.fromString(header.value);
- String realm = header.parameters["realm"];
-
- // See if any matching credentials are available.
- _Credentials cr = findCredentials(scheme);
- if (cr != null) {
- // For basic authentication don't retry already used credentials
- // as they must have already been added to the request causing
- // this authenticate response.
- if (cr.scheme == _AuthenticationScheme.BASIC && !cr.used) {
- // Credentials where found, prepare for retrying the request.
- return retry();
- }
-
- // Digest authentication only supports the MD5 algorithm.
- if (cr.scheme == _AuthenticationScheme.DIGEST &&
- (header.parameters["algorithm"] == null ||
- header.parameters["algorithm"].toLowerCase() == "md5")) {
- if (cr.nonce == null || cr.nonce == header.parameters["nonce"]) {
- // If the nonce is not set then this is the first authenticate
- // response for these credentials. Set up authentication state.
- if (cr.nonce == null) {
- cr..nonce = header.parameters["nonce"]
- ..algorithm = "MD5"
- ..qop = header.parameters["qop"]
- ..nonceCount = 0;
- }
- // Credentials where found, prepare for retrying the request.
- return retry();
- } else if (header.parameters["stale"] != null &&
- header.parameters["stale"].toLowerCase() == "true") {
- // If stale is true retry with new nonce.
- cr.nonce = header.parameters["nonce"];
- // Credentials where found, prepare for retrying the request.
- return retry();
- }
- }
- }
-
- // 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) {
- removeCredentials(cr);
- cr = null;
- }
- return requestAuthentication(scheme, realm).then((credsAvailable) {
- if (credsAvailable) {
- cr = _httpClient._findCredentials(_httpRequest.uri, scheme);
- return retry();
- } else {
- // No credentials available, complete with original response.
- return this;
- }
- });
- }
-}
-
-
-abstract class _HttpOutboundMessage<T> extends _IOSinkImpl {
- // Used to mark when the body should be written. This is used for HEAD
- // requests and in error handling.
- bool _encodingSet = false;
-
- bool _bufferOutput = true;
-
- final Uri _uri;
- final _HttpOutgoing _outgoing;
-
- final _HttpHeaders headers;
-
- _HttpOutboundMessage(Uri uri,
- String protocolVersion,
- _HttpOutgoing outgoing,
- {_HttpHeaders initialHeaders})
- : _uri = uri,
- headers = new _HttpHeaders(
- protocolVersion,
- defaultPortForScheme: uri.scheme == 'https' ?
- HttpClient.DEFAULT_HTTPS_PORT :
- HttpClient.DEFAULT_HTTP_PORT,
- initialHeaders: initialHeaders),
- _outgoing = outgoing,
- super(outgoing, null) {
- _outgoing.outbound = this;
- _encodingMutable = false;
- }
-
- int get contentLength => headers.contentLength;
- void set contentLength(int contentLength) {
- headers.contentLength = contentLength;
- }
-
- bool get persistentConnection => headers.persistentConnection;
- void set persistentConnection(bool p) {
- headers.persistentConnection = p;
- }
-
- bool get bufferOutput => _bufferOutput;
- void set bufferOutput(bool bufferOutput) {
- if (_outgoing.headersWritten) throw new StateError("Header already sent");
- _bufferOutput = bufferOutput;
- }
-
-
- Encoding get encoding {
- if (_encodingSet && _outgoing.headersWritten) {
- return _encoding;
- }
- var charset;
- if (headers.contentType != null && headers.contentType.charset != null) {
- charset = headers.contentType.charset;
- } else {
- charset = "iso-8859-1";
- }
- return Encoding.getByName(charset);
- }
-
- void add(List<int> data) {
- if (data.length == 0) return;
- super.add(data);
- }
-
- void write(Object obj) {
- if (!_encodingSet) {
- _encoding = encoding;
- _encodingSet = true;
- }
- super.write(obj);
- }
-
- void _writeHeader();
-
- bool get _isConnectionClosed => false;
-}
-
-
-class _HttpResponse extends _HttpOutboundMessage<HttpResponse>
- implements HttpResponse {
- int _statusCode = 200;
- String _reasonPhrase;
- List<Cookie> _cookies;
- _HttpRequest _httpRequest;
- Duration _deadline;
- Timer _deadlineTimer;
-
- _HttpResponse(Uri uri,
- String protocolVersion,
- _HttpOutgoing outgoing,
- HttpHeaders defaultHeaders,
- String serverHeader)
- : super(uri, protocolVersion, outgoing, initialHeaders: defaultHeaders) {
- if (serverHeader != null) headers.set('server', serverHeader);
- }
-
- bool get _isConnectionClosed => _httpRequest._httpConnection._isClosing;
-
- List<Cookie> get cookies {
- if (_cookies == null) _cookies = new List<Cookie>();
- return _cookies;
- }
-
- int get statusCode => _statusCode;
- void set statusCode(int statusCode) {
- if (_outgoing.headersWritten) throw new StateError("Header already sent");
- _statusCode = statusCode;
- }
-
- String get reasonPhrase => _findReasonPhrase(statusCode);
- void set reasonPhrase(String reasonPhrase) {
- if (_outgoing.headersWritten) throw new StateError("Header already sent");
- _reasonPhrase = reasonPhrase;
- }
-
- Future redirect(Uri location, {int status: HttpStatus.MOVED_TEMPORARILY}) {
- if (_outgoing.headersWritten) throw new StateError("Header already sent");
- statusCode = status;
- headers.set("location", location.toString());
- return close();
- }
-
- Future<Socket> detachSocket({bool writeHeaders: true}) {
- if (_outgoing.headersWritten) throw new StateError("Headers already sent");
- deadline = null; // Be sure to stop any deadline.
- var future = _httpRequest._httpConnection.detachSocket();
- if (writeHeaders) {
- var headersFuture = _outgoing.writeHeaders(drainRequest: false,
- setOutgoing: false);
- assert(headersFuture == null);
- } else {
- // Imitate having written the headers.
- _outgoing.headersWritten = true;
- }
- // Close connection so the socket is 'free'.
- close();
- done.catchError((_) {
- // Catch any error on done, as they automatically will be
- // propagated to the websocket.
- });
- return future;
- }
-
- HttpConnectionInfo get connectionInfo => _httpRequest.connectionInfo;
-
- Duration get deadline => _deadline;
-
- void set deadline(Duration d) {
- if (_deadlineTimer != null) _deadlineTimer.cancel();
- _deadline = d;
-
- if (_deadline == null) return;
- _deadlineTimer = new Timer(_deadline, () {
- _httpRequest._httpConnection.destroy();
- });
- }
-
- void _writeHeader() {
- Uint8List buffer = new Uint8List(_OUTGOING_BUFFER_SIZE);
- int offset = 0;
-
- void write(List<int> bytes) {
- int len = bytes.length;
- for (int i = 0; i < len; i++) {
- buffer[offset + i] = bytes[i];
- }
- offset += len;
- }
-
- // Write status line.
- if (headers.protocolVersion == "1.1") {
- write(_Const.HTTP11);
- } else {
- write(_Const.HTTP10);
- }
- buffer[offset++] = _CharCode.SP;
- write(statusCode.toString().codeUnits);
- buffer[offset++] = _CharCode.SP;
- write(reasonPhrase.codeUnits);
- buffer[offset++] = _CharCode.CR;
- buffer[offset++] = _CharCode.LF;
-
- var session = _httpRequest._session;
- if (session != null && !session._destroyed) {
- // Mark as not new.
- session._isNew = false;
- // Make sure we only send the current session id.
- bool found = false;
- for (int i = 0; i < cookies.length; i++) {
- if (cookies[i].name.toUpperCase() == _DART_SESSION_ID) {
- cookies[i]
- ..value = session.id
- ..httpOnly = true
- ..path = "/";
- found = true;
- }
- }
- if (!found) {
- var cookie = new Cookie(_DART_SESSION_ID, session.id);
- cookies.add(cookie
- ..httpOnly = true
- ..path = "/");
- }
- }
- // Add all the cookies set to the headers.
- if (_cookies != null) {
- _cookies.forEach((cookie) {
- headers.add(HttpHeaders.SET_COOKIE, cookie);
- });
- }
-
- headers._finalize();
-
- // Write headers.
- offset = headers._write(buffer, offset);
- buffer[offset++] = _CharCode.CR;
- buffer[offset++] = _CharCode.LF;
- _outgoing.setHeader(buffer, offset);
- }
-
- String _findReasonPhrase(int statusCode) {
- if (_reasonPhrase != null) {
- return _reasonPhrase;
- }
-
- switch (statusCode) {
- case HttpStatus.CONTINUE: return "Continue";
- case HttpStatus.SWITCHING_PROTOCOLS: return "Switching Protocols";
- case HttpStatus.OK: return "OK";
- case HttpStatus.CREATED: return "Created";
- case HttpStatus.ACCEPTED: return "Accepted";
- case HttpStatus.NON_AUTHORITATIVE_INFORMATION:
- return "Non-Authoritative Information";
- case HttpStatus.NO_CONTENT: return "No Content";
- case HttpStatus.RESET_CONTENT: return "Reset Content";
- case HttpStatus.PARTIAL_CONTENT: return "Partial Content";
- case HttpStatus.MULTIPLE_CHOICES: return "Multiple Choices";
- case HttpStatus.MOVED_PERMANENTLY: return "Moved Permanently";
- case HttpStatus.FOUND: return "Found";
- case HttpStatus.SEE_OTHER: return "See Other";
- case HttpStatus.NOT_MODIFIED: return "Not Modified";
- case HttpStatus.USE_PROXY: return "Use Proxy";
- case HttpStatus.TEMPORARY_REDIRECT: return "Temporary Redirect";
- case HttpStatus.BAD_REQUEST: return "Bad Request";
- case HttpStatus.UNAUTHORIZED: return "Unauthorized";
- case HttpStatus.PAYMENT_REQUIRED: return "Payment Required";
- case HttpStatus.FORBIDDEN: return "Forbidden";
- case HttpStatus.NOT_FOUND: return "Not Found";
- case HttpStatus.METHOD_NOT_ALLOWED: return "Method Not Allowed";
- case HttpStatus.NOT_ACCEPTABLE: return "Not Acceptable";
- case HttpStatus.PROXY_AUTHENTICATION_REQUIRED:
- return "Proxy Authentication Required";
- case HttpStatus.REQUEST_TIMEOUT: return "Request Time-out";
- case HttpStatus.CONFLICT: return "Conflict";
- case HttpStatus.GONE: return "Gone";
- case HttpStatus.LENGTH_REQUIRED: return "Length Required";
- case HttpStatus.PRECONDITION_FAILED: return "Precondition Failed";
- case HttpStatus.REQUEST_ENTITY_TOO_LARGE:
- return "Request Entity Too Large";
- case HttpStatus.REQUEST_URI_TOO_LONG: return "Request-URI Too Large";
- case HttpStatus.UNSUPPORTED_MEDIA_TYPE: return "Unsupported Media Type";
- case HttpStatus.REQUESTED_RANGE_NOT_SATISFIABLE:
- return "Requested range not satisfiable";
- case HttpStatus.EXPECTATION_FAILED: return "Expectation Failed";
- case HttpStatus.INTERNAL_SERVER_ERROR: return "Internal Server Error";
- case HttpStatus.NOT_IMPLEMENTED: return "Not Implemented";
- case HttpStatus.BAD_GATEWAY: return "Bad Gateway";
- case HttpStatus.SERVICE_UNAVAILABLE: return "Service Unavailable";
- case HttpStatus.GATEWAY_TIMEOUT: return "Gateway Time-out";
- case HttpStatus.HTTP_VERSION_NOT_SUPPORTED:
- return "Http Version not supported";
- default: return "Status $statusCode";
- }
- }
-}
-
-
-class _HttpClientRequest extends _HttpOutboundMessage<HttpClientResponse>
- implements HttpClientRequest {
- final String method;
- final Uri uri;
- final List<Cookie> cookies = new List<Cookie>();
-
- // The HttpClient this request belongs to.
- final _HttpClient _httpClient;
- final _HttpClientConnection _httpClientConnection;
-
- final Completer<HttpClientResponse> _responseCompleter
- = new Completer<HttpClientResponse>();
-
- final _Proxy _proxy;
-
- Future<HttpClientResponse> _response;
-
- // TODO(ajohnsen): Get default value from client?
- bool _followRedirects = true;
-
- int _maxRedirects = 5;
-
- List<RedirectInfo> _responseRedirects = [];
-
- _HttpClientRequest(_HttpOutgoing outgoing, Uri uri, this.method, this._proxy,
- this._httpClient, this._httpClientConnection)
- : uri = uri,
- super(uri, "1.1", outgoing) {
- // GET and HEAD have 'content-length: 0' by default.
- if (method == "GET" || method == "HEAD") {
- contentLength = 0;
- } else {
- headers.chunkedTransferEncoding = true;
- }
- }
-
- Future<HttpClientResponse> get done {
- if (_response == null) {
- _response = Future.wait([_responseCompleter.future, super.done],
- eagerError: true)
- .then((list) => list[0]);
- }
- return _response;
- }
-
- Future<HttpClientResponse> close() {
- super.close();
- return done;
- }
-
- int get maxRedirects => _maxRedirects;
- void set maxRedirects(int maxRedirects) {
- if (_outgoing.headersWritten) throw new StateError("Request already sent");
- _maxRedirects = maxRedirects;
- }
-
- bool get followRedirects => _followRedirects;
- void set followRedirects(bool followRedirects) {
- if (_outgoing.headersWritten) throw new StateError("Request already sent");
- _followRedirects = followRedirects;
- }
-
- HttpConnectionInfo get connectionInfo => _httpClientConnection.connectionInfo;
-
- void _onIncoming(_HttpIncoming incoming) {
- var response = new _HttpClientResponse(incoming, this, _httpClient);
- Future<HttpClientResponse> future;
- if (followRedirects && response.isRedirect) {
- if (response.redirects.length < maxRedirects) {
- // Redirect and drain response.
- future = response.drain().then((_) => response.redirect());
- } else {
- // End with exception, too many redirects.
- future = response.drain()
- .then((_) => new Future.error(
- new RedirectException("Redirect limit exceeded",
- response.redirects)));
- }
- } else if (response._shouldAuthenticateProxy) {
- future = response._authenticate(true);
- } else if (response._shouldAuthenticate) {
- future = response._authenticate(false);
- } else {
- future = new Future<HttpClientResponse>.value(response);
- }
- future.then(
- (v) => _responseCompleter.complete(v),
- onError: _responseCompleter.completeError);
- }
-
- void _onError(error, StackTrace stackTrace) {
- _responseCompleter.completeError(error, stackTrace);
- }
-
- // Generate the request URI based on the method and proxy.
- String _requestUri() {
- // Generate the request URI starting from the path component.
- String uriStartingFromPath() {
- String result = uri.path;
- if (result.isEmpty) result = "/";
- if (uri.hasQuery) {
- result = "${result}?${uri.query}";
- }
- return result;
- }
-
- if (_proxy.isDirect) {
- return uriStartingFromPath();
- } else {
- if (method == "CONNECT") {
- // For the connect method the request URI is the host:port of
- // the requested destination of the tunnel (see RFC 2817
- // section 5.2)
- return "${uri.host}:${uri.port}";
- } else {
- if (_httpClientConnection._proxyTunnel) {
- return uriStartingFromPath();
- } else {
- return uri.removeFragment().toString();
- }
- }
- }
- }
-
- void _writeHeader() {
- Uint8List buffer = new Uint8List(_OUTGOING_BUFFER_SIZE);
- int offset = 0;
-
- void write(List<int> bytes) {
- int len = bytes.length;
- for (int i = 0; i < len; i++) {
- buffer[offset + i] = bytes[i];
- }
- offset += len;
- }
-
- // Write the request method.
- write(method.codeUnits);
- buffer[offset++] = _CharCode.SP;
- // Write the request URI.
- write(_requestUri().codeUnits);
- buffer[offset++] = _CharCode.SP;
- // Write HTTP/1.1.
- write(_Const.HTTP11);
- buffer[offset++] = _CharCode.CR;
- buffer[offset++] = _CharCode.LF;
-
- // Add the cookies to the headers.
- if (!cookies.isEmpty) {
- StringBuffer sb = new StringBuffer();
- for (int i = 0; i < cookies.length; i++) {
- if (i > 0) sb.write("; ");
- sb..write(cookies[i].name)..write("=")..write(cookies[i].value);
- }
- headers.add(HttpHeaders.COOKIE, sb.toString());
- }
-
- headers._finalize();
-
- // Write headers.
- offset = headers._write(buffer, offset);
- buffer[offset++] = _CharCode.CR;
- buffer[offset++] = _CharCode.LF;
- _outgoing.setHeader(buffer, offset);
- }
-}
-
-// Used by _HttpOutgoing as a target of a chunked converter for gzip
-// compression.
-class _HttpGZipSink extends ByteConversionSink {
- final Function _consume;
- _HttpGZipSink(this._consume);
-
- void add(List<int> chunk) {
- _consume(chunk);
- }
-
- void addSlice(List<int> chunk, int start, int end, bool isLast) {
- if (chunk is Uint8List) {
- _consume(new Uint8List.view(chunk.buffer, start, end - start));
- } else {
- _consume(chunk.sublist(start, end - start));
- }
- }
-
- void close() {}
-}
-
-
-// The _HttpOutgoing handles all of the following:
-// - Buffering
-// - GZip compressionm
-// - Content-Length validation.
-// - Errors.
-//
-// Most notable is the GZip compression, that uses a double-buffering system,
-// one before gzip (_gzipBuffer) and one after (_buffer).
-class _HttpOutgoing implements StreamConsumer<List<int>> {
- static const List<int> _footerAndChunk0Length =
- const [_CharCode.CR, _CharCode.LF, 0x30, _CharCode.CR, _CharCode.LF,
- _CharCode.CR, _CharCode.LF];
-
- static const List<int> _chunk0Length =
- const [0x30, _CharCode.CR, _CharCode.LF, _CharCode.CR, _CharCode.LF];
-
- final Completer _doneCompleter = new Completer();
- final Socket socket;
-
- bool ignoreBody = false;
- bool headersWritten = false;
-
- Uint8List _buffer;
- int _length = 0;
-
- Future _closeFuture;
-
- bool chunked = false;
- int _pendingChunkedFooter = 0;
-
- int contentLength;
- int _bytesWritten = 0;
-
- bool _gzip = false;
- ByteConversionSink _gzipSink;
- // _gzipAdd is set iff the sink is being added to. It's used to specify where
- // gzipped data should be taken (sometimes a controller, sometimes a socket).
- Function _gzipAdd;
- Uint8List _gzipBuffer;
- int _gzipBufferLength = 0;
-
- bool _socketError = false;
-
- _HttpOutboundMessage outbound;
-
- _HttpOutgoing(this.socket);
-
- // Returns either a future or 'null', if it was able to write headers
- // immediately.
- Future writeHeaders({bool drainRequest: true, bool setOutgoing: true}) {
- Future write() {
- try {
- outbound._writeHeader();
- } catch (_) {
- // Headers too large.
- return new Future.error(new HttpException(
- "Headers size exceeded the of '$_OUTGOING_BUFFER_SIZE'"
- " bytes"));
- }
- return null;
- }
-
- if (headersWritten) return null;
- headersWritten = true;
- Future drainFuture;
- bool gzip = false;
- if (outbound is _HttpResponse) {
- // Server side.
- _HttpResponse response = outbound;
- if (response._httpRequest._httpServer.autoCompress &&
- outbound.bufferOutput &&
- outbound.headers.chunkedTransferEncoding) {
- List acceptEncodings =
- response._httpRequest.headers[HttpHeaders.ACCEPT_ENCODING];
- List contentEncoding = outbound.headers[HttpHeaders.CONTENT_ENCODING];
- if (acceptEncodings != null &&
- acceptEncodings
- .expand((list) => list.split(","))
- .any((encoding) => encoding.trim().toLowerCase() == "gzip") &&
- contentEncoding == null) {
- outbound.headers.set(HttpHeaders.CONTENT_ENCODING, "gzip");
- gzip = true;
- }
- }
- if (drainRequest && !response._httpRequest._incoming.hasSubscriber) {
- drainFuture = response._httpRequest.drain().catchError((_) {});
- }
- } else {
- drainRequest = false;
- }
- if (ignoreBody) {
- return write();
- }
- if (setOutgoing) {
- int contentLength = outbound.headers.contentLength;
- if (outbound.headers.chunkedTransferEncoding) {
- chunked = true;
- if (gzip) this.gzip = true;
- } else if (contentLength >= 0) {
- this.contentLength = contentLength;
- }
- }
- if (drainFuture != null) {
- return drainFuture.then((_) => write());
- }
- return write();
- }
-
-
- Future addStream(Stream<List<int>> stream) {
- if (_socketError) {
- stream.listen(null).cancel();
- return new Future.value(outbound);
- }
- if (ignoreBody) {
- stream.drain().catchError((_) {});
- var future = writeHeaders();
- if (future != null) {
- return future.then((_) => close());
- }
- return close();
- }
- var sub;
- // Use new stream so we are able to pause (see below listen). The
- // alternative is to use stream.extand, but that won't give us a way of
- // pausing.
- var controller = new StreamController(
- onPause: () => sub.pause(),
- onResume: () => sub.resume(),
- sync: true);
-
- void onData(data) {
- if (_socketError) return;
- if (data.length == 0) return;
- if (chunked) {
- if (_gzip) {
- _gzipAdd = controller.add;
- _addGZipChunk(data, _gzipSink.add);
- _gzipAdd = null;
- return;
- }
- _addChunk(_chunkHeader(data.length), controller.add);
- _pendingChunkedFooter = 2;
- } else {
- if (contentLength != null) {
- _bytesWritten += data.length;
- if (_bytesWritten > contentLength) {
- controller.addError(new HttpException(
- "Content size exceeds specified contentLength. "
- "$_bytesWritten bytes written while expected "
- "$contentLength. "
- "[${new String.fromCharCodes(data)}]"));
- return;
- }
- }
- }
- _addChunk(data, controller.add);
- }
-
- sub = stream.listen(
- onData,
- onError: controller.addError,
- onDone: controller.close,
- cancelOnError: true);
- // Write headers now that we are listening to the stream.
- if (!headersWritten) {
- var future = writeHeaders();
- if (future != null) {
- // While incoming is being drained, the pauseFuture is non-null. Pause
- // output until it's drained.
- sub.pause(future);
- }
- }
- return socket.addStream(controller.stream)
- .then((_) {
- return outbound;
- }, onError: (error, stackTrace) {
- // Be sure to close it in case of an error.
- if (_gzip) _gzipSink.close();
- _socketError = true;
- _doneCompleter.completeError(error, stackTrace);
- if (_ignoreError(error)) {
- return outbound;
- } else {
- throw error;
- }
- });
- }
-
- Future close() {
- // If we are already closed, return that future.
- if (_closeFuture != null) return _closeFuture;
- // If we earlier saw an error, return immediate. The notification to
- // _Http*Connection is already done.
- if (_socketError) return new Future.value(outbound);
- if (outbound._isConnectionClosed) return new Future.value(outbound);
- if (!headersWritten && !ignoreBody) {
- if (outbound.headers.contentLength == -1) {
- // If no body was written, ignoreBody is false (it's not a HEAD
- // request) and the content-length is unspecified, set contentLength to
- // 0.
- outbound.headers.chunkedTransferEncoding = false;
- outbound.headers.contentLength = 0;
- } else if (outbound.headers.contentLength > 0) {
- var error = new HttpException(
- "No content even though contentLength was specified to be "
- "greater than 0: ${outbound.headers.contentLength}.",
- uri: outbound._uri);
- _doneCompleter.completeError(error);
- return _closeFuture = new Future.error(error);
- }
- }
- // If contentLength was specified, validate it.
- if (contentLength != null) {
- if (_bytesWritten < contentLength) {
- var error = new HttpException(
- "Content size below specified contentLength. "
- " $_bytesWritten bytes written but expected "
- "$contentLength.",
- uri: outbound._uri);
- _doneCompleter.completeError(error);
- return _closeFuture = new Future.error(error);
- }
- }
-
- Future finalize() {
- // In case of chunked encoding (and gzip), handle remaining gzip data and
- // append the 'footer' for chunked encoding.
- if (chunked) {
- if (_gzip) {
- _gzipAdd = socket.add;
- if (_gzipBufferLength > 0) {
- _gzipSink.add(new Uint8List.view(
- _gzipBuffer.buffer, 0, _gzipBufferLength));
- }
- _gzipBuffer = null;
- _gzipSink.close();
- _gzipAdd = null;
- }
- _addChunk(_chunkHeader(0), socket.add);
- }
- // Add any remaining data in the buffer.
- if (_length > 0) {
- socket.add(new Uint8List.view(_buffer.buffer, 0, _length));
- }
- // Clear references, for better GC.
- _buffer = null;
- // And finally flush it. As we support keep-alive, never close it from
- // here. Once the socket is flushed, we'll be able to reuse it (signaled
- // by the 'done' future).
- return socket.flush()
- .then((_) {
- _doneCompleter.complete(socket);
- return outbound;
- }, onError: (error, stackTrace) {
- _doneCompleter.completeError(error, stackTrace);
- if (_ignoreError(error)) {
- return outbound;
- } else {
- throw error;
- }
- });
- }
-
- var future = writeHeaders();
- if (future != null) {
- return _closeFuture = future.whenComplete(finalize);
- }
- return _closeFuture = finalize();
- }
-
- Future get done => _doneCompleter.future;
-
- void setHeader(List<int> data, int length) {
- assert(_length == 0);
- assert(data.length == _OUTGOING_BUFFER_SIZE);
- _buffer = data;
- _length = length;
- }
-
- void set gzip(bool value) {
- _gzip = value;
- if (_gzip) {
- _gzipBuffer = new Uint8List(_OUTGOING_BUFFER_SIZE);
- assert(_gzipSink == null);
- _gzipSink = new ZLibEncoder(gzip: true)
- .startChunkedConversion(
- new _HttpGZipSink((data) {
- // We are closing down prematurely, due to an error. Discard.
- if (_gzipAdd == null) return;
- _addChunk(_chunkHeader(data.length), _gzipAdd);
- _pendingChunkedFooter = 2;
- _addChunk(data, _gzipAdd);
- }));
- }
- }
-
- bool _ignoreError(error)
- => (error is SocketException || error is TlsException) &&
- outbound is HttpResponse;
-
- void _addGZipChunk(chunk, void add(List<int> data)) {
- if (!outbound.bufferOutput) {
- add(chunk);
- return;
- }
- if (chunk.length > _gzipBuffer.length - _gzipBufferLength) {
- add(new Uint8List.view(
- _gzipBuffer.buffer, 0, _gzipBufferLength));
- _gzipBuffer = new Uint8List(_OUTGOING_BUFFER_SIZE);
- _gzipBufferLength = 0;
- }
- if (chunk.length > _OUTGOING_BUFFER_SIZE) {
- add(chunk);
- } else {
- _gzipBuffer.setRange(_gzipBufferLength,
- _gzipBufferLength + chunk.length,
- chunk);
- _gzipBufferLength += chunk.length;
- }
- }
-
- void _addChunk(chunk, void add(List<int> data)) {
- if (!outbound.bufferOutput) {
- if (_buffer != null) {
- // If _buffer is not null, we have not written the header yet. Write
- // it now.
- add(new Uint8List.view(_buffer.buffer, 0, _length));
- _buffer = null;
- _length = 0;
- }
- add(chunk);
- return;
- }
- if (chunk.length > _buffer.length - _length) {
- add(new Uint8List.view(_buffer.buffer, 0, _length));
- _buffer = new Uint8List(_OUTGOING_BUFFER_SIZE);
- _length = 0;
- }
- if (chunk.length > _OUTGOING_BUFFER_SIZE) {
- add(chunk);
- } else {
- _buffer.setRange(_length, _length + chunk.length, chunk);
- _length += chunk.length;
- }
- }
-
- List<int> _chunkHeader(int length) {
- const hexDigits = const [0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
- 0x38, 0x39, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46];
- if (length == 0) {
- if (_pendingChunkedFooter == 2) return _footerAndChunk0Length;
- return _chunk0Length;
- }
- int size = _pendingChunkedFooter;
- int len = length;
- // Compute a fast integer version of (log(length + 1) / log(16)).ceil().
- while (len > 0) {
- size++;
- len >>= 4;
- }
- var footerAndHeader = new Uint8List(size + 2);
- if (_pendingChunkedFooter == 2) {
- footerAndHeader[0] = _CharCode.CR;
- footerAndHeader[1] = _CharCode.LF;
- }
- int index = size;
- while (index > _pendingChunkedFooter) {
- footerAndHeader[--index] = hexDigits[length & 15];
- length = length >> 4;
- }
- footerAndHeader[size + 0] = _CharCode.CR;
- footerAndHeader[size + 1] = _CharCode.LF;
- return footerAndHeader;
- }
-}
-
-class _HttpClientConnection {
- final String key;
- final Socket _socket;
- final bool _proxyTunnel;
- final SecurityContext _context;
- final _HttpParser _httpParser;
- StreamSubscription _subscription;
- final _HttpClient _httpClient;
- bool _dispose = false;
- Timer _idleTimer;
- bool closed = false;
- Uri _currentUri;
-
- Completer<_HttpIncoming> _nextResponseCompleter;
- Future _streamFuture;
-
- _HttpClientConnection(this.key, this._socket, this._httpClient,
- [this._proxyTunnel = false, this._context])
- : _httpParser = new _HttpParser.responseParser() {
- _httpParser.listenToStream(_socket);
-
- // Set up handlers on the parser here, so we are sure to get 'onDone' from
- // the parser.
- _subscription = _httpParser.listen(
- (incoming) {
- // Only handle one incoming response at the time. Keep the
- // stream paused until the response have been processed.
- _subscription.pause();
- // We assume the response is not here, until we have send the request.
- if (_nextResponseCompleter == null) {
- throw new HttpException(
- "Unexpected response (unsolicited response without request).",
- uri: _currentUri);
- }
-
- // Check for status code '100 Continue'. In that case just
- // consume that response as the final response will follow
- // it. There is currently no API for the client to wait for
- // the '100 Continue' response.
- if (incoming.statusCode == 100) {
- incoming.drain().then((_) {
- _subscription.resume();
- }).catchError((error, [StackTrace stackTrace]) {
- _nextResponseCompleter.completeError(
- new HttpException(error.message, uri: _currentUri),
- stackTrace);
- _nextResponseCompleter = null;
- });
- } else {
- _nextResponseCompleter.complete(incoming);
- _nextResponseCompleter = null;
- }
- },
- onError: (error, [StackTrace stackTrace]) {
- if (_nextResponseCompleter != null) {
- _nextResponseCompleter.completeError(
- new HttpException(error.message, uri: _currentUri),
- stackTrace);
- _nextResponseCompleter = null;
- }
- },
- onDone: () {
- if (_nextResponseCompleter != null) {
- _nextResponseCompleter.completeError(new HttpException(
- "Connection closed before response was received",
- uri: _currentUri));
- _nextResponseCompleter = null;
- }
- close();
- });
- }
-
- _HttpClientRequest send(Uri uri, int port, String method, _Proxy proxy) {
- if (closed) {
- throw new HttpException(
- "Socket closed before request was sent", uri: uri);
- }
- _currentUri = uri;
- // Start with pausing the parser.
- _subscription.pause();
- _ProxyCredentials proxyCreds; // Credentials used to authorize proxy.
- _SiteCredentials creds; // Credentials used to authorize this request.
- var outgoing = new _HttpOutgoing(_socket);
- // Create new request object, wrapping the outgoing connection.
- var request = new _HttpClientRequest(outgoing,
- uri,
- method,
- proxy,
- _httpClient,
- this);
- // For the Host header an IPv6 address must be enclosed in []'s.
- var host = uri.host;
- if (host.contains(':')) host = "[$host]";
- request.headers
- ..host = host
- ..port = port
- .._add(HttpHeaders.ACCEPT_ENCODING, "gzip");
- if (_httpClient.userAgent != null) {
- request.headers._add('user-agent', _httpClient.userAgent);
- }
- if (proxy.isAuthenticated) {
- // If the proxy configuration contains user information use that
- // for proxy basic authorization.
- String auth = _CryptoUtils.bytesToBase64(
- UTF8.encode("${proxy.username}:${proxy.password}"));
- request.headers.set(HttpHeaders.PROXY_AUTHORIZATION, "Basic $auth");
- } else if (!proxy.isDirect && _httpClient._proxyCredentials.length > 0) {
- proxyCreds = _httpClient._findProxyCredentials(proxy);
- if (proxyCreds != null) {
- proxyCreds.authorize(request);
- }
- }
- if (uri.userInfo != null && !uri.userInfo.isEmpty) {
- // If the URL contains user information use that for basic
- // authorization.
- String auth =
- _CryptoUtils.bytesToBase64(UTF8.encode(uri.userInfo));
- request.headers.set(HttpHeaders.AUTHORIZATION, "Basic $auth");
- } else {
- // Look for credentials.
- creds = _httpClient._findCredentials(uri);
- if (creds != null) {
- creds.authorize(request);
- }
- }
- // Start sending the request (lazy, delayed until the user provides
- // data).
- _httpParser.isHead = method == "HEAD";
- _streamFuture = outgoing.done
- .then((s) {
- // Request sent, set up response completer.
- _nextResponseCompleter = new Completer();
-
- // Listen for response.
- _nextResponseCompleter.future
- .then((incoming) {
- _currentUri = null;
- incoming.dataDone.then((closing) {
- if (incoming.upgraded) {
- _httpClient._connectionClosed(this);
- startTimer();
- return;
- }
- if (closed) return;
- if (!closing &&
- !_dispose &&
- incoming.headers.persistentConnection &&
- request.persistentConnection) {
- // Return connection, now we are done.
- _httpClient._returnConnection(this);
- _subscription.resume();
- } else {
- destroy();
- }
- });
- // For digest authentication if proxy check if the proxy
- // requests the client to start using a new nonce for proxy
- // authentication.
- if (proxyCreds != null &&
- proxyCreds.scheme == _AuthenticationScheme.DIGEST) {
- var authInfo = incoming.headers["proxy-authentication-info"];
- if (authInfo != null && authInfo.length == 1) {
- var header =
- _HeaderValue.parse(
- authInfo[0], parameterSeparator: ',');
- var nextnonce = header.parameters["nextnonce"];
- if (nextnonce != null) proxyCreds.nonce = nextnonce;
- }
- }
- // For digest authentication check if the server requests the
- // client to start using a new nonce.
- if (creds != null &&
- creds.scheme == _AuthenticationScheme.DIGEST) {
- var authInfo = incoming.headers["authentication-info"];
- if (authInfo != null && authInfo.length == 1) {
- var header =
- _HeaderValue.parse(
- authInfo[0], parameterSeparator: ',');
- var nextnonce = header.parameters["nextnonce"];
- if (nextnonce != null) creds.nonce = nextnonce;
- }
- }
- request._onIncoming(incoming);
- })
- // If we see a state error, we failed to get the 'first'
- // element.
- .catchError((error) {
- throw new HttpException(
- "Connection closed before data was received", uri: uri);
- }, test: (error) => error is StateError)
- .catchError((error, stackTrace) {
- // We are done with the socket.
- destroy();
- request._onError(error, stackTrace);
- });
-
- // Resume the parser now we have a handler.
- _subscription.resume();
- return s;
- }, onError: (e) {
- destroy();
- });
- return request;
- }
-
- Future<Socket> detachSocket() {
- return _streamFuture.then(
- (_) => new _DetachedSocket(_socket, _httpParser.detachIncoming()));
- }
-
- void destroy() {
- closed = true;
- _httpClient._connectionClosed(this);
- _socket.destroy();
- }
-
- void close() {
- closed = true;
- _httpClient._connectionClosed(this);
- _streamFuture
- // TODO(ajohnsen): Add timeout.
- .then((_) => _socket.destroy());
- }
-
- Future<_HttpClientConnection> createProxyTunnel(host, port, proxy, callback) {
- _HttpClientRequest request =
- send(new Uri(host: host, port: port),
- port,
- "CONNECT",
- proxy);
- if (proxy.isAuthenticated) {
- // If the proxy configuration contains user information use that
- // for proxy basic authorization.
- String auth = _CryptoUtils.bytesToBase64(
- UTF8.encode("${proxy.username}:${proxy.password}"));
- request.headers.set(HttpHeaders.PROXY_AUTHORIZATION, "Basic $auth");
- }
- return request.close()
- .then((response) {
- if (response.statusCode != HttpStatus.OK) {
- throw "Proxy failed to establish tunnel "
- "(${response.statusCode} ${response.reasonPhrase})";
- }
- var socket = (response as _HttpClientResponse)._httpRequest
- ._httpClientConnection._socket;
- return SecureSocket.secure(
- socket,
- host: host,
- context: _context,
- onBadCertificate: callback);
- })
- .then((secureSocket) {
- String key = _HttpClientConnection.makeKey(true, host, port);
- return new _HttpClientConnection(
- key, secureSocket, request._httpClient, true);
- });
- }
-
- HttpConnectionInfo get connectionInfo => _HttpConnectionInfo.create(_socket);
-
- static makeKey(bool isSecure, String host, int port) {
- return isSecure ? "ssh:$host:$port" : "$host:$port";
- }
-
- void stopTimer() {
- if (_idleTimer != null) {
- _idleTimer.cancel();
- _idleTimer = null;
- }
- }
-
- void startTimer() {
- assert(_idleTimer == null);
- _idleTimer = new Timer(
- _httpClient.idleTimeout,
- () {
- _idleTimer = null;
- close();
- });
- }
-}
-
-class _ConnectionInfo {
- final _HttpClientConnection connection;
- final _Proxy proxy;
-
- _ConnectionInfo(this.connection, this.proxy);
-}
-
-
-class _ConnectionTarget {
- // Unique key for this connection target.
- final String key;
- final String host;
- final int port;
- final bool isSecure;
- final SecurityContext context;
- final Set<_HttpClientConnection> _idle = new HashSet();
- final Set<_HttpClientConnection> _active = new HashSet();
- final Queue _pending = new ListQueue();
- int _connecting = 0;
-
- _ConnectionTarget(this.key,
- this.host,
- this.port,
- this.isSecure,
- this.context);
-
- bool get isEmpty => _idle.isEmpty && _active.isEmpty && _connecting == 0;
-
- bool get hasIdle => _idle.isNotEmpty;
-
- bool get hasActive => _active.isNotEmpty || _connecting > 0;
-
- _HttpClientConnection takeIdle() {
- assert(hasIdle);
- _HttpClientConnection connection = _idle.first;
- _idle.remove(connection);
- connection.stopTimer();
- _active.add(connection);
- return connection;
- }
-
- _checkPending() {
- if (_pending.isNotEmpty) {
- _pending.removeFirst()();
- }
- }
-
- void addNewActive(_HttpClientConnection connection) {
- _active.add(connection);
- }
-
- void returnConnection(_HttpClientConnection connection) {
- assert(_active.contains(connection));
- _active.remove(connection);
- _idle.add(connection);
- connection.startTimer();
- _checkPending();
- }
-
- void connectionClosed(_HttpClientConnection connection) {
- assert(!_active.contains(connection) || !_idle.contains(connection));
- _active.remove(connection);
- _idle.remove(connection);
- _checkPending();
- }
-
- void close(bool force) {
- for (var c in _idle.toList()) {
- c.close();
- }
- if (force) {
- for (var c in _active.toList()) {
- c.destroy();
- }
- }
- }
-
- Future<_ConnectionInfo> connect(String uriHost,
- int uriPort,
- _Proxy proxy,
- _HttpClient client) {
- if (hasIdle) {
- var connection = takeIdle();
- client._connectionsChanged();
- return new Future.value(new _ConnectionInfo(connection, proxy));
- }
- if (client.maxConnectionsPerHost != null &&
- _active.length + _connecting >= client.maxConnectionsPerHost) {
- var completer = new Completer();
- _pending.add(() {
- connect(uriHost, uriPort, proxy, client)
- .then(completer.complete, onError: completer.completeError);
- });
- return completer.future;
- }
- var currentBadCertificateCallback = client._badCertificateCallback;
-
- bool callback(X509Certificate certificate) {
- if (currentBadCertificateCallback == null) return false;
- return currentBadCertificateCallback(certificate, uriHost, uriPort);
- }
-
- Future socketFuture = (isSecure && proxy.isDirect
- ? SecureSocket.connect(host,
- port,
- context: context,
- onBadCertificate: callback)
- : Socket.connect(host, port));
- _connecting++;
- return socketFuture.then((socket) {
- _connecting--;
- socket.setOption(SocketOption.TCP_NODELAY, true);
- var connection =
- new _HttpClientConnection(key, socket, client, false, context);
- if (isSecure && !proxy.isDirect) {
- connection._dispose = true;
- return connection.createProxyTunnel(uriHost, uriPort, proxy, callback)
- .then((tunnel) {
- client._getConnectionTarget(uriHost, uriPort, true)
- .addNewActive(tunnel);
- return new _ConnectionInfo(tunnel, proxy);
- });
- } else {
- addNewActive(connection);
- return new _ConnectionInfo(connection, proxy);
- }
- }, onError: (error) {
- _connecting--;
- _checkPending();
- throw error;
- });
- }
-}
-
-typedef bool BadCertificateCallback(X509Certificate cr, String host, int port);
-
-class _HttpClient implements HttpClient {
- bool _closing = false;
- bool _closingForcefully = false;
- final Map<String, _ConnectionTarget> _connectionTargets
- = new HashMap<String, _ConnectionTarget>();
- final List<_Credentials> _credentials = [];
- final List<_ProxyCredentials> _proxyCredentials = [];
- final SecurityContext _context;
- Function _authenticate;
- Function _authenticateProxy;
- Function _findProxy = HttpClient.findProxyFromEnvironment;
- Duration _idleTimeout = const Duration(seconds: 15);
- BadCertificateCallback _badCertificateCallback;
-
- Duration get idleTimeout => _idleTimeout;
-
- int maxConnectionsPerHost;
-
- bool autoUncompress = true;
-
- String userAgent = _getHttpVersion();
-
- _HttpClient(SecurityContext this._context);
-
- void set idleTimeout(Duration timeout) {
- _idleTimeout = timeout;
- for (var c in _connectionTargets.values) {
- for (var idle in c._idle) {
- // Reset timer. This is fine, as it's not happening often.
- idle.stopTimer();
- idle.startTimer();
- }
- }
- }
-
- set badCertificateCallback(bool callback(X509Certificate cert,
- String host,
- int port)) {
- _badCertificateCallback = callback;
- }
-
-
- Future<HttpClientRequest> open(String method,
- String host,
- int port,
- String path) {
- const int hashMark = 0x23;
- const int questionMark = 0x3f;
- int fragmentStart = path.length;
- int queryStart = path.length;
- for (int i = path.length - 1; i >= 0; i--) {
- var char = path.codeUnitAt(i);
- if (char == hashMark) {
- fragmentStart = i;
- queryStart = i;
- } else if (char == questionMark) {
- queryStart = i;
- }
- }
- String query = null;
- if (queryStart < fragmentStart) {
- query = path.substring(queryStart + 1, fragmentStart);
- path = path.substring(0, queryStart);
- }
- Uri uri = new Uri(scheme: "http", host: host, port: port,
- path: path, query: query);
- return _openUrl(method, uri);
- }
-
- Future<HttpClientRequest> openUrl(String method, Uri url)
- => _openUrl(method, url);
-
- Future<HttpClientRequest> get(String host, int port, String path)
- => open("get", host, port, path);
-
- Future<HttpClientRequest> getUrl(Uri url) => _openUrl("get", url);
-
- Future<HttpClientRequest> post(String host, int port, String path)
- => open("post", host, port, path);
-
- Future<HttpClientRequest> postUrl(Uri url) => _openUrl("post", url);
-
- Future<HttpClientRequest> put(String host, int port, String path)
- => open("put", host, port, path);
-
- Future<HttpClientRequest> putUrl(Uri url) => _openUrl("put", url);
-
- Future<HttpClientRequest> delete(String host, int port, String path)
- => open("delete", host, port, path);
-
- Future<HttpClientRequest> deleteUrl(Uri url) => _openUrl("delete", url);
-
- Future<HttpClientRequest> head(String host, int port, String path)
- => open("head", host, port, path);
-
- Future<HttpClientRequest> headUrl(Uri url) => _openUrl("head", url);
-
- Future<HttpClientRequest> patch(String host, int port, String path)
- => open("patch", host, port, path);
-
- Future<HttpClientRequest> patchUrl(Uri url) => _openUrl("patch", url);
-
- void close({bool force: false}) {
- _closing = true;
- _closingForcefully = force;
- _closeConnections(_closingForcefully);
- assert(!_connectionTargets.values.any((s) => s.hasIdle));
- assert(!force ||
- !_connectionTargets.values.any((s) => s._active.isNotEmpty));
- }
-
- set authenticate(Future<bool> f(Uri url, String scheme, String realm)) {
- _authenticate = f;
- }
-
- void addCredentials(Uri url, String realm, HttpClientCredentials cr) {
- _credentials.add(new _SiteCredentials(url, realm, cr));
- }
-
- set authenticateProxy(
- Future<bool> f(String host, int port, String scheme, String realm)) {
- _authenticateProxy = f;
- }
-
- void addProxyCredentials(String host,
- int port,
- String realm,
- HttpClientCredentials cr) {
- _proxyCredentials.add(new _ProxyCredentials(host, port, realm, cr));
- }
-
- set findProxy(String f(Uri uri)) => _findProxy = f;
-
- Future<_HttpClientRequest> _openUrl(String method, Uri uri) {
- // Ignore any fragments on the request URI.
- uri = uri.removeFragment();
-
- if (method == null) {
- throw new ArgumentError(method);
- }
- if (method != "CONNECT") {
- if (uri.host.isEmpty) {
- throw new ArgumentError("No host specified in URI $uri");
- } else if (uri.scheme != "http" && uri.scheme != "https") {
- throw new ArgumentError(
- "Unsupported scheme '${uri.scheme}' in URI $uri");
- }
- }
-
- bool isSecure = (uri.scheme == "https");
- int port = uri.port;
- if (port == 0) {
- port = isSecure ?
- HttpClient.DEFAULT_HTTPS_PORT :
- HttpClient.DEFAULT_HTTP_PORT;
- }
- // Check to see if a proxy server should be used for this connection.
- var proxyConf = const _ProxyConfiguration.direct();
- if (_findProxy != null) {
- // TODO(sgjesse): Keep a map of these as normally only a few
- // configuration strings will be used.
- try {
- proxyConf = new _ProxyConfiguration(_findProxy(uri));
- } catch (error, stackTrace) {
- return new Future.error(error, stackTrace);
- }
- }
- return _getConnection(uri.host, port, proxyConf, isSecure)
- .then((_ConnectionInfo info) {
-
- _HttpClientRequest send(_ConnectionInfo info) {
- return info.connection.send(uri,
- port,
- method.toUpperCase(),
- info.proxy);
- }
-
- // If the connection was closed before the request was sent, create
- // and use another connection.
- if (info.connection.closed) {
- return _getConnection(uri.host, port, proxyConf, isSecure)
- .then(send);
- }
- return send(info);
- });
- }
-
- Future<_HttpClientRequest> _openUrlFromRequest(String method,
- Uri uri,
- _HttpClientRequest previous) {
- // If the new URI is relative (to either '/' or some sub-path),
- // construct a full URI from the previous one.
- Uri resolved = previous.uri.resolveUri(uri);
- return _openUrl(method, resolved).then((_HttpClientRequest request) {
-
- request
- // Only follow redirects if initial request did.
- ..followRedirects = previous.followRedirects
- // Allow same number of redirects.
- ..maxRedirects = previous.maxRedirects;
- // Copy headers.
- for (var header in previous.headers._headers.keys) {
- if (request.headers[header] == null) {
- request.headers.set(header, previous.headers[header]);
- }
- }
- return request
- ..headers.chunkedTransferEncoding = false
- ..contentLength = 0;
- });
- }
-
- // Return a live connection to the idle pool.
- void _returnConnection(_HttpClientConnection connection) {
- _connectionTargets[connection.key].returnConnection(connection);
- _connectionsChanged();
- }
-
- // Remove a closed connnection from the active set.
- void _connectionClosed(_HttpClientConnection connection) {
- connection.stopTimer();
- var connectionTarget = _connectionTargets[connection.key];
- if (connectionTarget != null) {
- connectionTarget.connectionClosed(connection);
- if (connectionTarget.isEmpty) {
- _connectionTargets.remove(connection.key);
- }
- _connectionsChanged();
- }
- }
-
- void _connectionsChanged() {
- if (_closing) {
- _closeConnections(_closingForcefully);
- }
- }
-
- void _closeConnections(bool force) {
- for (var connectionTarget in _connectionTargets.values.toList()) {
- connectionTarget.close(force);
- }
- }
-
- _ConnectionTarget _getConnectionTarget(String host, int port, bool isSecure) {
- String key = _HttpClientConnection.makeKey(isSecure, host, port);
- return _connectionTargets.putIfAbsent(key, () {
- return new _ConnectionTarget(key, host, port, isSecure, _context);
- });
- }
-
- // Get a new _HttpClientConnection, from the matching _ConnectionTarget.
- Future<_ConnectionInfo> _getConnection(String uriHost,
- int uriPort,
- _ProxyConfiguration proxyConf,
- bool isSecure) {
- Iterator<_Proxy> proxies = proxyConf.proxies.iterator;
-
- Future<_ConnectionInfo> connect(error) {
- if (!proxies.moveNext()) return new Future.error(error);
- _Proxy proxy = proxies.current;
- String host = proxy.isDirect ? uriHost: proxy.host;
- int port = proxy.isDirect ? uriPort: proxy.port;
- return _getConnectionTarget(host, port, isSecure)
- .connect(uriHost, uriPort, proxy, this)
- // On error, continue with next proxy.
- .catchError(connect);
- }
- // Make sure we go through the event loop before taking a
- // connection from the pool. For long-running synchronous code the
- // server might have closed the connection, so this lowers the
- // probability of getting a connection that was already closed.
- return new Future(() => connect(new HttpException("No proxies given")));
- }
-
- _SiteCredentials _findCredentials(Uri url, [_AuthenticationScheme scheme]) {
- // Look for credentials.
- _SiteCredentials cr =
- _credentials.fold(null, (_SiteCredentials prev, value) {
- var siteCredentials = value as _SiteCredentials;
- if (siteCredentials.applies(url, scheme)) {
- if (prev == null) return value;
- return siteCredentials.uri.path.length > prev.uri.path.length
- ? siteCredentials
- : prev;
- } else {
- return prev;
- }
- });
- return cr;
- }
-
- _ProxyCredentials _findProxyCredentials(_Proxy proxy,
- [_AuthenticationScheme scheme]) {
- // Look for credentials.
- var it = _proxyCredentials.iterator;
- while (it.moveNext()) {
- if (it.current.applies(proxy, scheme)) {
- return it.current;
- }
- }
- return null;
- }
-
- void _removeCredentials(_Credentials cr) {
- int index = _credentials.indexOf(cr);
- if (index != -1) {
- _credentials.removeAt(index);
- }
- }
-
- void _removeProxyCredentials(_Credentials cr) {
- int index = _proxyCredentials.indexOf(cr);
- if (index != -1) {
- _proxyCredentials.removeAt(index);
- }
- }
-
- static String _findProxyFromEnvironment(Uri url,
- Map<String, String> environment) {
- checkNoProxy(String option) {
- if (option == null) return null;
- Iterator<String> names = option.split(",").map((s) => s.trim()).iterator;
- while (names.moveNext()) {
- var name = names.current;
- if ((name.startsWith("[") &&
- name.endsWith("]") &&
- "[${url.host}]" == name) ||
- (name.isNotEmpty &&
- url.host.endsWith(name))) {
- return "DIRECT";
- }
- }
- return null;
- }
-
- checkProxy(String option) {
- if (option == null) return null;
- option = option.trim();
- if (option.isEmpty) return null;
- int pos = option.indexOf("://");
- if (pos >= 0) {
- option = option.substring(pos + 3);
- }
- pos = option.indexOf("/");
- if (pos >= 0) {
- option = option.substring(0, pos);
- }
- // Add default port if no port configured.
- if (option.indexOf("[") == 0) {
- var pos = option.lastIndexOf(":");
- if (option.indexOf("]") > pos) option = "$option:1080";
- } else {
- if (option.indexOf(":") == -1) option = "$option:1080";
- }
- return "PROXY $option";
- }
-
- // Default to using the process current environment.
- if (environment == null) environment = _platformEnvironmentCache;
-
- String proxyCfg;
-
- String noProxy = environment["no_proxy"];
- if (noProxy == null) noProxy = environment["NO_PROXY"];
- if ((proxyCfg = checkNoProxy(noProxy)) != null) {
- return proxyCfg;
- }
-
- if (url.scheme == "http") {
- String proxy = environment["http_proxy"];
- if (proxy == null) proxy = environment["HTTP_PROXY"];
- if ((proxyCfg = checkProxy(proxy)) != null) {
- return proxyCfg;
- }
- } else if (url.scheme == "https") {
- String proxy = environment["https_proxy"];
- if (proxy == null) proxy = environment["HTTPS_PROXY"];
- if ((proxyCfg = checkProxy(proxy)) != null) {
- return proxyCfg;
- }
- }
- return "DIRECT";
- }
-
- static Map<String, String> _platformEnvironmentCache = Platform.environment;
-}
-
-
-class _HttpConnection
- extends LinkedListEntry<_HttpConnection> with _ServiceObject {
- static const _ACTIVE = 0;
- static const _IDLE = 1;
- static const _CLOSING = 2;
- static const _DETACHED = 3;
-
- // Use HashMap, as we don't need to keep order.
- static Map<int, _HttpConnection> _connections =
- new HashMap<int, _HttpConnection>();
-
- final _socket;
- final _HttpServer _httpServer;
- final _HttpParser _httpParser;
- int _state = _IDLE;
- StreamSubscription _subscription;
- bool _idleMark = false;
- Future _streamFuture;
-
- _HttpConnection(this._socket, this._httpServer)
- : _httpParser = new _HttpParser.requestParser() {
- try { _socket._owner = this; } catch (_) { print(_); }
- _connections[_serviceId] = this;
- _httpParser.listenToStream(_socket);
- _subscription = _httpParser.listen(
- (incoming) {
- _httpServer._markActive(this);
- // If the incoming was closed, close the connection.
- incoming.dataDone.then((closing) {
- if (closing) destroy();
- });
- // Only handle one incoming request at the time. Keep the
- // stream paused until the request has been send.
- _subscription.pause();
- _state = _ACTIVE;
- var outgoing = new _HttpOutgoing(_socket);
- var response = new _HttpResponse(incoming.uri,
- incoming.headers.protocolVersion,
- outgoing,
- _httpServer.defaultResponseHeaders,
- _httpServer.serverHeader);
- var request = new _HttpRequest(response, incoming, _httpServer, this);
- _streamFuture = outgoing.done
- .then((_) {
- response.deadline = null;
- if (_state == _DETACHED) return;
- if (response.persistentConnection &&
- request.persistentConnection &&
- incoming.fullBodyRead &&
- !_httpParser.upgrade &&
- !_httpServer.closed) {
- _state = _IDLE;
- _idleMark = false;
- _httpServer._markIdle(this);
- // Resume the subscription for incoming requests as the
- // request is now processed.
- _subscription.resume();
- } else {
- // Close socket, keep-alive not used or body sent before
- // received data was handled.
- destroy();
- }
- }, onError: (_) {
- destroy();
- });
- outgoing.ignoreBody = request.method == "HEAD";
- response._httpRequest = request;
- _httpServer._handleRequest(request);
- },
- onDone: () {
- destroy();
- },
- onError: (error) {
- // Ignore failed requests that was closed before headers was received.
- destroy();
- });
- }
-
- void markIdle() {
- _idleMark = true;
- }
-
- bool get isMarkedIdle => _idleMark;
-
- void destroy() {
- if (_state == _CLOSING || _state == _DETACHED) return;
- _state = _CLOSING;
- _socket.destroy();
- _httpServer._connectionClosed(this);
- _connections.remove(_serviceId);
- }
-
- Future<Socket> detachSocket() {
- _state = _DETACHED;
- // Remove connection from server.
- _httpServer._connectionClosed(this);
-
- _HttpDetachedIncoming detachedIncoming = _httpParser.detachIncoming();
-
- return _streamFuture.then((_) {
- _connections.remove(_serviceId);
- return new _DetachedSocket(_socket, detachedIncoming);
- });
- }
-
- HttpConnectionInfo get connectionInfo => _HttpConnectionInfo.create(_socket);
-
- bool get _isActive => _state == _ACTIVE;
- bool get _isIdle => _state == _IDLE;
- bool get _isClosing => _state == _CLOSING;
- bool get _isDetached => _state == _DETACHED;
-
- String get _serviceTypePath => 'io/http/serverconnections';
- String get _serviceTypeName => 'HttpServerConnection';
-
- Map _toJSON(bool ref) {
- var name = "${_socket.address.host}:${_socket.port} <-> "
- "${_socket.remoteAddress.host}:${_socket.remotePort}";
- var r = <String, dynamic>{
- 'id': _servicePath,
- 'type': _serviceType(ref),
- 'name': name,
- 'user_name': name,
- };
- if (ref) {
- return r;
- }
- r['server'] = _httpServer._toJSON(true);
- try {
- r['socket'] = _socket._toJSON(true);
- } catch (_) {
- r['socket'] = {
- 'id': _servicePath,
- 'type': '@Socket',
- 'name': 'UserSocket',
- 'user_name': 'UserSocket',
- };
- }
- switch (_state) {
- case _ACTIVE: r['state'] = "Active"; break;
- case _IDLE: r['state'] = "Idle"; break;
- case _CLOSING: r['state'] = "Closing"; break;
- case _DETACHED: r['state'] = "Detached"; break;
- default: r['state'] = 'Unknown'; break;
- }
- return r;
- }
-}
-
-
-// HTTP server waiting for socket connections.
-class _HttpServer
- extends Stream<HttpRequest> with _ServiceObject
- implements HttpServer {
- // Use default Map so we keep order.
- static Map<int, _HttpServer> _servers = new Map<int, _HttpServer>();
-
- String serverHeader;
- final HttpHeaders defaultResponseHeaders = _initDefaultResponseHeaders();
- bool autoCompress = false;
-
- Duration _idleTimeout;
- Timer _idleTimer;
-
- static Future<HttpServer> bind(
- address, int port, int backlog, bool v6Only, bool shared) {
- return ServerSocket.bind(
- address, port, backlog: backlog, v6Only: v6Only, shared: shared)
- .then((socket) {
- return new _HttpServer._(socket, true);
- });
- }
-
- static Future<HttpServer> bindSecure(address,
- int port,
- SecurityContext context,
- int backlog,
- bool v6Only,
- bool requestClientCertificate,
- bool shared) {
- return SecureServerSocket.bind(
- address,
- port,
- context,
- backlog: backlog,
- v6Only: v6Only,
- requestClientCertificate: requestClientCertificate,
- shared: shared)
- .then((socket) {
- return new _HttpServer._(socket, true);
- });
- }
-
- _HttpServer._(this._serverSocket, this._closeServer) {
- _controller = new StreamController<HttpRequest>(sync: true,
- onCancel: close);
- idleTimeout = const Duration(seconds: 120);
- _servers[_serviceId] = this;
- _serverSocket._owner = this;
- }
-
- _HttpServer.listenOn(this._serverSocket) : _closeServer = false {
- _controller = new StreamController<HttpRequest>(sync: true,
- onCancel: close);
- idleTimeout = const Duration(seconds: 120);
- _servers[_serviceId] = this;
- try { _serverSocket._owner = this; } catch (_) {}
- }
-
- static HttpHeaders _initDefaultResponseHeaders() {
- var defaultResponseHeaders = new _HttpHeaders('1.1');
- defaultResponseHeaders.contentType = ContentType.TEXT;
- defaultResponseHeaders.set('X-Frame-Options', 'SAMEORIGIN');
- defaultResponseHeaders.set('X-Content-Type-Options', 'nosniff');
- defaultResponseHeaders.set('X-XSS-Protection', '1; mode=block');
- return defaultResponseHeaders;
- }
-
- Duration get idleTimeout => _idleTimeout;
-
- void set idleTimeout(Duration duration) {
- if (_idleTimer != null) {
- _idleTimer.cancel();
- _idleTimer = null;
- }
- _idleTimeout = duration;
- if (_idleTimeout != null) {
- _idleTimer = new Timer.periodic(_idleTimeout, (_) {
- for (var idle in _idleConnections.toList()) {
- if (idle.isMarkedIdle) {
- idle.destroy();
- } else {
- idle.markIdle();
- }
- }
- });
- }
- }
-
- StreamSubscription<HttpRequest> listen(void onData(HttpRequest event),
- {Function onError,
- void onDone(),
- bool cancelOnError}) {
- _serverSocket.listen(
- (Socket socket) {
- socket.setOption(SocketOption.TCP_NODELAY, true);
- // Accept the client connection.
- _HttpConnection connection = new _HttpConnection(socket, this);
- _idleConnections.add(connection);
- },
- onError: (error, stackTrace) {
- // Ignore HandshakeExceptions as they are bound to a single request,
- // and are not fatal for the server.
- if (error is! HandshakeException) {
- _controller.addError(error, stackTrace);
- }
- },
- onDone: _controller.close);
- return _controller.stream.listen(onData,
- onError: onError,
- onDone: onDone,
- cancelOnError: cancelOnError);
- }
-
- Future close({bool force: false}) {
- closed = true;
- Future result;
- if (_serverSocket != null && _closeServer) {
- result = _serverSocket.close();
- } else {
- result = new Future.value();
- }
- idleTimeout = null;
- if (force) {
- for (var c in _activeConnections.toList()) {
- c.destroy();
- }
- assert(_activeConnections.isEmpty);
- }
- for (var c in _idleConnections.toList()) {
- c.destroy();
- }
- _maybePerformCleanup();
- return result;
- }
-
- void _maybePerformCleanup() {
- if (closed &&
- _idleConnections.isEmpty &&
- _activeConnections.isEmpty &&
- _sessionManagerInstance != null) {
- _sessionManagerInstance.close();
- _sessionManagerInstance = null;
- _servers.remove(_serviceId);
- }
- }
-
- int get port {
- if (closed) throw new HttpException("HttpServer is not bound to a socket");
- return _serverSocket.port;
- }
-
- InternetAddress get address {
- if (closed) throw new HttpException("HttpServer is not bound to a socket");
- return _serverSocket.address;
- }
-
- set sessionTimeout(int timeout) {
- _sessionManager.sessionTimeout = timeout;
- }
-
- void _handleRequest(_HttpRequest request) {
- if (!closed) {
- _controller.add(request);
- } else {
- request._httpConnection.destroy();
- }
- }
-
- void _connectionClosed(_HttpConnection connection) {
- // Remove itself from either idle or active connections.
- connection.unlink();
- _maybePerformCleanup();
- }
-
- void _markIdle(_HttpConnection connection) {
- _activeConnections.remove(connection);
- _idleConnections.add(connection);
- }
-
- void _markActive(_HttpConnection connection) {
- _idleConnections.remove(connection);
- _activeConnections.add(connection);
- }
-
- _HttpSessionManager get _sessionManager {
- // Lazy init.
- if (_sessionManagerInstance == null) {
- _sessionManagerInstance = new _HttpSessionManager();
- }
- return _sessionManagerInstance;
- }
-
- HttpConnectionsInfo connectionsInfo() {
- HttpConnectionsInfo result = new HttpConnectionsInfo();
- result.total = _activeConnections.length + _idleConnections.length;
- _activeConnections.forEach((_HttpConnection conn) {
- if (conn._isActive) {
- result.active++;
- } else {
- assert(conn._isClosing);
- result.closing++;
- }
- });
- _idleConnections.forEach((_HttpConnection conn) {
- result.idle++;
- assert(conn._isIdle);
- });
- return result;
- }
-
- String get _serviceTypePath => 'io/http/servers';
- String get _serviceTypeName => 'HttpServer';
-
- Map<String, dynamic> _toJSON(bool ref) {
- var r = <String, dynamic>{
- 'id': _servicePath,
- 'type': _serviceType(ref),
- 'name': '${address.host}:$port',
- 'user_name': '${address.host}:$port',
- };
- if (ref) {
- return r;
- }
- try {
- r['socket'] = _serverSocket._toJSON(true);
- } catch (_) {
- r['socket'] = {
- 'id': _servicePath,
- 'type': '@Socket',
- 'name': 'UserSocket',
- 'user_name': 'UserSocket',
- };
- }
- r['port'] = port;
- r['address'] = address.host;
- r['active'] = _activeConnections.map((c) => c._toJSON(true)).toList();
- r['idle'] = _idleConnections.map((c) => c._toJSON(true)).toList();
- r['closed'] = closed;
- return r;
- }
-
- _HttpSessionManager _sessionManagerInstance;
-
- // Indicated if the http server has been closed.
- bool closed = false;
-
- // The server listen socket. Untyped as it can be both ServerSocket and
- // SecureServerSocket.
- final _serverSocket;
- final bool _closeServer;
-
- // Set of currently connected clients.
- final LinkedList<_HttpConnection> _activeConnections
- = new LinkedList<_HttpConnection>();
- final LinkedList<_HttpConnection> _idleConnections
- = new LinkedList<_HttpConnection>();
- StreamController<HttpRequest> _controller;
-}
-
-
-class _ProxyConfiguration {
- static const String PROXY_PREFIX = "PROXY ";
- static const String DIRECT_PREFIX = "DIRECT";
-
- _ProxyConfiguration(String configuration) : proxies = new List<_Proxy>() {
- if (configuration == null) {
- throw new HttpException("Invalid proxy configuration $configuration");
- }
- List<String> list = configuration.split(";");
- list.forEach((String proxy) {
- proxy = proxy.trim();
- if (!proxy.isEmpty) {
- if (proxy.startsWith(PROXY_PREFIX)) {
- String username;
- String password;
- // Skip the "PROXY " prefix.
- proxy = proxy.substring(PROXY_PREFIX.length).trim();
- // Look for proxy authentication.
- int at = proxy.indexOf("@");
- if (at != -1) {
- String userinfo = proxy.substring(0, at).trim();
- proxy = proxy.substring(at + 1).trim();
- int colon = userinfo.indexOf(":");
- if (colon == -1 || colon == 0 || colon == proxy.length - 1) {
- throw new HttpException(
- "Invalid proxy configuration $configuration");
- }
- username = userinfo.substring(0, colon).trim();
- password = userinfo.substring(colon + 1).trim();
- }
- // Look for proxy host and port.
- int colon = proxy.lastIndexOf(":");
- if (colon == -1 || colon == 0 || colon == proxy.length - 1) {
- throw new HttpException(
- "Invalid proxy configuration $configuration");
- }
- String host = proxy.substring(0, colon).trim();
- if (host.startsWith("[") && host.endsWith("]")) {
- host = host.substring(1, host.length - 1);
- }
- String portString = proxy.substring(colon + 1).trim();
- int port;
- try {
- port = int.parse(portString);
- } on FormatException catch (e) {
- throw new HttpException(
- "Invalid proxy configuration $configuration, "
- "invalid port '$portString'");
- }
- proxies.add(new _Proxy(host, port, username, password));
- } else if (proxy.trim() == DIRECT_PREFIX) {
- proxies.add(new _Proxy.direct());
- } else {
- throw new HttpException("Invalid proxy configuration $configuration");
- }
- }
- });
- }
-
- const _ProxyConfiguration.direct()
- : proxies = const [const _Proxy.direct()];
-
- final List<_Proxy> proxies;
-}
-
-
-class _Proxy {
- final String host;
- final int port;
- final String username;
- final String password;
- final bool isDirect;
-
- const _Proxy(this.host, this.port, this.username, this.password)
- : isDirect = false;
- const _Proxy.direct() : host = null, port = null,
- username = null, password = null, isDirect = true;
-
- bool get isAuthenticated => username != null;
-}
-
-
-class _HttpConnectionInfo implements HttpConnectionInfo {
- InternetAddress remoteAddress;
- int remotePort;
- int localPort;
-
- static _HttpConnectionInfo create(Socket socket) {
- if (socket == null) return null;
- try {
- _HttpConnectionInfo info = new _HttpConnectionInfo();
- return info
- ..remoteAddress = socket.remoteAddress
- ..remotePort = socket.remotePort
- ..localPort = socket.port;
- } catch (e) { }
- return null;
- }
-}
-
-
-class _DetachedSocket extends Stream<List<int>> implements Socket {
- final Stream<List<int>> _incoming;
- final _socket;
-
- _DetachedSocket(this._socket, this._incoming);
-
- StreamSubscription<List<int>> listen(void onData(List<int> event),
- {Function onError,
- void onDone(),
- bool cancelOnError}) {
- return _incoming.listen(onData,
- onError: onError,
- onDone: onDone,
- cancelOnError: cancelOnError);
- }
-
- Encoding get encoding => _socket.encoding;
-
- void set encoding(Encoding value) {
- _socket.encoding = value;
- }
-
- void write(Object obj) { _socket.write(obj); }
-
- void writeln([Object obj = ""]) { _socket.writeln(obj); }
-
- void writeCharCode(int charCode) { _socket.writeCharCode(charCode); }
-
- void writeAll(Iterable objects, [String separator = ""]) {
- _socket.writeAll(objects, separator);
- }
-
- void add(List<int> bytes) { _socket.add(bytes); }
-
- void addError(error, [StackTrace stackTrace]) =>
- _socket.addError(error, stackTrace);
-
- Future<Socket> addStream(Stream<List<int>> stream) {
- return _socket.addStream(stream);
- }
-
- void destroy() { _socket.destroy(); }
-
- Future flush() => _socket.flush();
-
- Future close() => _socket.close();
-
- Future<Socket> get done => _socket.done;
-
- int get port => _socket.port;
-
- InternetAddress get address => _socket.address;
-
- InternetAddress get remoteAddress => _socket.remoteAddress;
-
- int get remotePort => _socket.remotePort;
-
- bool setOption(SocketOption option, bool enabled) {
- return _socket.setOption(option, enabled);
- }
-
- Map _toJSON(bool ref) => _socket._toJSON(ref);
- void set _owner(owner) { _socket._owner = owner; }
-}
-
-
-class _AuthenticationScheme {
- final int _scheme;
-
- 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";
- }
-}
-
-
-abstract class _Credentials {
- _HttpClientCredentials credentials;
- String realm;
- bool used = false;
-
- // Digest specific fields.
- String ha1;
- String nonce;
- String algorithm;
- String qop;
- int nonceCount;
-
- _Credentials(this.credentials, this.realm) {
- if (credentials.scheme == _AuthenticationScheme.DIGEST) {
- // Calculate the H(A1) value once. 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.
- _HttpClientDigestCredentials creds = credentials;
- var hasher = new _MD5()
- ..add(UTF8.encode(creds.username))
- ..add([_CharCode.COLON])
- ..add(realm.codeUnits)
- ..add([_CharCode.COLON])
- ..add(UTF8.encode(creds.password));
- ha1 = _CryptoUtils.bytesToHex(hasher.close());
- }
- }
-
- _AuthenticationScheme get scheme => credentials.scheme;
-
- void authorize(HttpClientRequest request);
-}
-
-class _SiteCredentials extends _Credentials {
- Uri uri;
-
- _SiteCredentials(this.uri, realm, _HttpClientCredentials creds)
- : super(creds, realm);
-
- bool applies(Uri uri, _AuthenticationScheme scheme) {
- if (scheme != null && credentials.scheme != scheme) return false;
- if (uri.host != this.uri.host) 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) {
- // Digest credentials cannot be used without a nonce from the
- // server.
- if (credentials.scheme == _AuthenticationScheme.DIGEST &&
- nonce == null) {
- return;
- }
- credentials.authorize(this, request);
- used = true;
- }
-}
-
-
-class _ProxyCredentials extends _Credentials {
- String host;
- int port;
-
- _ProxyCredentials(this.host,
- this.port,
- realm,
- _HttpClientCredentials creds)
- : super(creds, realm);
-
- bool applies(_Proxy proxy, _AuthenticationScheme scheme) {
- if (scheme != null && credentials.scheme != scheme) return false;
- return proxy.host == host && proxy.port == port;
- }
-
- void authorize(HttpClientRequest request) {
- // Digest credentials cannot be used without a nonce from the
- // server.
- if (credentials.scheme == _AuthenticationScheme.DIGEST &&
- nonce == null) {
- return;
- }
- credentials.authorizeProxy(this, request);
- }
-}
-
-
-abstract class _HttpClientCredentials implements HttpClientCredentials {
- _AuthenticationScheme get scheme;
- void authorize(_Credentials credentials, HttpClientRequest request);
- void authorizeProxy(_ProxyCredentials credentials, HttpClientRequest request);
-}
-
-
-class _HttpClientBasicCredentials
- extends _HttpClientCredentials
- implements HttpClientBasicCredentials {
- String username;
- String password;
-
- _HttpClientBasicCredentials(this.username, this.password);
-
- _AuthenticationScheme get scheme => _AuthenticationScheme.BASIC;
-
- String authorization() {
- // 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.
- String auth =
- _CryptoUtils.bytesToBase64(UTF8.encode("$username:$password"));
- return "Basic $auth";
- }
-
- void authorize(_Credentials _, HttpClientRequest request) {
- request.headers.set(HttpHeaders.AUTHORIZATION, authorization());
- }
-
- void authorizeProxy(_ProxyCredentials _, HttpClientRequest request) {
- request.headers.set(HttpHeaders.PROXY_AUTHORIZATION, authorization());
- }
-}
-
-
-class _HttpClientDigestCredentials
- extends _HttpClientCredentials
- implements HttpClientDigestCredentials {
- String username;
- String password;
-
- _HttpClientDigestCredentials(this.username, this.password);
-
- _AuthenticationScheme get scheme => _AuthenticationScheme.DIGEST;
-
- String authorization(_Credentials credentials, _HttpClientRequest request) {
- String requestUri = request._requestUri();
- _MD5 hasher = new _MD5()
- ..add(request.method.codeUnits)
- ..add([_CharCode.COLON])
- ..add(requestUri.codeUnits);
- var ha2 = _CryptoUtils.bytesToHex(hasher.close());
-
- String qop;
- String cnonce;
- String nc;
- var x;
- hasher = new _MD5()
- ..add(credentials.ha1.codeUnits)
- ..add([_CharCode.COLON]);
- if (credentials.qop == "auth") {
- qop = credentials.qop;
- cnonce = _CryptoUtils.bytesToHex(_IOCrypto.getRandomBytes(4));
- ++credentials.nonceCount;
- nc = credentials.nonceCount.toRadixString(16);
- nc = "00000000".substring(0, 8 - nc.length + 1) + nc;
- hasher
- ..add(credentials.nonce.codeUnits)
- ..add([_CharCode.COLON])
- ..add(nc.codeUnits)
- ..add([_CharCode.COLON])
- ..add(cnonce.codeUnits)
- ..add([_CharCode.COLON])
- ..add(credentials.qop.codeUnits)
- ..add([_CharCode.COLON])
- ..add(ha2.codeUnits);
- } else {
- hasher
- ..add(credentials.nonce.codeUnits)
- ..add([_CharCode.COLON])
- ..add(ha2.codeUnits);
- }
- var response = _CryptoUtils.bytesToHex(hasher.close());
-
- StringBuffer buffer = new StringBuffer()
- ..write('Digest ')
- ..write('username="$username"')
- ..write(', realm="${credentials.realm}"')
- ..write(', nonce="${credentials.nonce}"')
- ..write(', uri="$requestUri"')
- ..write(', algorithm="${credentials.algorithm}"');
- if (qop == "auth") {
- buffer
- ..write(', qop="$qop"')
- ..write(', cnonce="$cnonce"')
- ..write(', nc="$nc"');
- }
- buffer.write(', response="$response"');
- return buffer.toString();
- }
-
- void authorize(_Credentials credentials, HttpClientRequest request) {
- request.headers.set(HttpHeaders.AUTHORIZATION,
- authorization(credentials, request));
- }
-
- void authorizeProxy(_ProxyCredentials credentials,
- HttpClientRequest request) {
- request.headers.set(HttpHeaders.PROXY_AUTHORIZATION,
- authorization(credentials, request));
- }
-}
-
-
-class _RedirectInfo implements RedirectInfo {
- final int statusCode;
- final String method;
- final Uri location;
- const _RedirectInfo(this.statusCode, this.method, this.location);
-}
-
-String _getHttpVersion() {
- var version = Platform.version;
- // Only include major and minor version numbers.
- int index = version.indexOf('.', version.indexOf('.') + 1);
- version = version.substring(0, index);
- return 'Dart/$version (dart:io)';
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/io/http_parser.dart b/pkg/dev_compiler/tool/input_sdk/lib/io/http_parser.dart
deleted file mode 100644
index adef61f..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/io/http_parser.dart
+++ /dev/null
@@ -1,1072 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-part of dart.io;
-
-// Global constants.
-class _Const {
- // Bytes for "HTTP".
- static const HTTP = const [72, 84, 84, 80];
- // Bytes for "HTTP/1.".
- static const HTTP1DOT = const [72, 84, 84, 80, 47, 49, 46];
- // Bytes for "HTTP/1.0".
- static const HTTP10 = const [72, 84, 84, 80, 47, 49, 46, 48];
- // Bytes for "HTTP/1.1".
- static const HTTP11 = const [72, 84, 84, 80, 47, 49, 46, 49];
-
- static const bool T = true;
- static const bool F = false;
- // Loopup-map for the following characters: '()<>@,;:\\"/[]?={} \t'.
- static const SEPARATOR_MAP = const [
- F,F,F,F,F,F,F,F,F,T,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,T,F,T,F,F,
- F,F,F,T,T,F,F,T,F,F,T,F,F,F,F,F,F,F,F,F,F,T,T,T,T,T,T,T,F,F,F,F,F,F,F,F,F,
- F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,T,T,T,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,
- F,F,F,F,F,F,F,F,F,F,F,F,T,F,T,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,
- F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,
- F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,
- F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F,F];
-}
-
-
-// Frequently used character codes.
-class _CharCode {
- static const int HT = 9;
- static const int LF = 10;
- static const int CR = 13;
- static const int SP = 32;
- static const int AMPERSAND = 38;
- static const int COMMA = 44;
- static const int DASH = 45;
- static const int SLASH = 47;
- static const int ZERO = 48;
- static const int ONE = 49;
- static const int COLON = 58;
- static const int SEMI_COLON = 59;
- static const int EQUAL = 61;
-}
-
-
-// States of the HTTP parser state machine.
-class _State {
- static const int START = 0;
- static const int METHOD_OR_RESPONSE_HTTP_VERSION = 1;
- static const int RESPONSE_HTTP_VERSION = 2;
- static const int REQUEST_LINE_METHOD = 3;
- static const int REQUEST_LINE_URI = 4;
- static const int REQUEST_LINE_HTTP_VERSION = 5;
- static const int REQUEST_LINE_ENDING = 6;
- static const int RESPONSE_LINE_STATUS_CODE = 7;
- static const int RESPONSE_LINE_REASON_PHRASE = 8;
- static const int RESPONSE_LINE_ENDING = 9;
- static const int HEADER_START = 10;
- static const int HEADER_FIELD = 11;
- static const int HEADER_VALUE_START = 12;
- static const int HEADER_VALUE = 13;
- static const int HEADER_VALUE_FOLDING_OR_ENDING = 14;
- static const int HEADER_VALUE_FOLD_OR_END = 15;
- static const int HEADER_ENDING = 16;
-
- static const int CHUNK_SIZE_STARTING_CR = 17;
- static const int CHUNK_SIZE_STARTING_LF = 18;
- static const int CHUNK_SIZE = 19;
- static const int CHUNK_SIZE_EXTENSION = 20;
- static const int CHUNK_SIZE_ENDING = 21;
- static const int CHUNKED_BODY_DONE_CR = 22;
- static const int CHUNKED_BODY_DONE_LF = 23;
- static const int BODY = 24;
- static const int CLOSED = 25;
- static const int UPGRADED = 26;
- static const int FAILURE = 27;
-
- static const int FIRST_BODY_STATE = CHUNK_SIZE_STARTING_CR;
-}
-
-// HTTP version of the request or response being parsed.
-class _HttpVersion {
- static const int UNDETERMINED = 0;
- static const int HTTP10 = 1;
- static const int HTTP11 = 2;
-}
-
-// States of the HTTP parser state machine.
-class _MessageType {
- static const int UNDETERMINED = 0;
- static const int REQUEST = 1;
- static const int RESPONSE = 0;
-}
-
-
-/**
- * The _HttpDetachedStreamSubscription takes a subscription and some extra data,
- * and makes it possible to "inject" the data in from of other data events
- * from the subscription.
- *
- * It does so by overriding pause/resume, so that once the
- * _HttpDetachedStreamSubscription is resumed, it'll deliver the data before
- * resuming the underlaying subscription.
- */
-class _HttpDetachedStreamSubscription implements StreamSubscription<List<int>> {
- StreamSubscription<List<int>> _subscription;
- List<int> _injectData;
- bool _isCanceled = false;
- int _pauseCount = 1;
- Function _userOnData;
- bool _scheduled = false;
-
- _HttpDetachedStreamSubscription(this._subscription,
- this._injectData,
- this._userOnData);
-
- bool get isPaused => _subscription.isPaused;
-
- Future/*<T>*/ asFuture/*<T>*/([/*=T*/ futureValue]) =>
- _subscription.asFuture/*<T>*/(futureValue);
-
- Future cancel() {
- _isCanceled = true;
- _injectData = null;
- return _subscription.cancel();
- }
-
- void onData(void handleData(List<int> data)) {
- _userOnData = handleData;
- _subscription.onData(handleData);
- }
-
- void onDone(void handleDone()) {
- _subscription.onDone(handleDone);
- }
-
- void onError(Function handleError) {
- _subscription.onError(handleError);
- }
-
- void pause([Future resumeSignal]) {
- if (_injectData == null) {
- _subscription.pause(resumeSignal);
- } else {
- _pauseCount++;
- if (resumeSignal != null) {
- resumeSignal.whenComplete(resume);
- }
- }
- }
-
- void resume() {
- if (_injectData == null) {
- _subscription.resume();
- } else {
- _pauseCount--;
- _maybeScheduleData();
- }
- }
-
- void _maybeScheduleData() {
- if (_scheduled) return;
- if (_pauseCount != 0) return;
- _scheduled = true;
- scheduleMicrotask(() {
- _scheduled = false;
- if (_pauseCount > 0 || _isCanceled) return;
- var data = _injectData;
- _injectData = null;
- // To ensure that 'subscription.isPaused' is false, we resume the
- // subscription here. This is fine as potential events are delayed.
- _subscription.resume();
- if (_userOnData != null) {
- _userOnData(data);
- }
- });
- }
-}
-
-
-class _HttpDetachedIncoming extends Stream<List<int>> {
- final StreamSubscription subscription;
- final List<int> bufferedData;
-
- _HttpDetachedIncoming(this.subscription, this.bufferedData);
-
- StreamSubscription<List<int>> listen(void onData(List<int> event),
- {Function onError,
- void onDone(),
- bool cancelOnError}) {
- if (subscription != null) {
- subscription
- ..onData(onData)
- ..onError(onError)
- ..onDone(onDone);
- if (bufferedData == null) {
- return subscription..resume();
- }
- return new _HttpDetachedStreamSubscription(subscription,
- bufferedData,
- onData)
- ..resume();
- } else {
- return new Stream.fromIterable(bufferedData)
- .listen(onData,
- onError: onError,
- onDone: onDone,
- cancelOnError: cancelOnError);
- }
- }
-}
-
-
-/**
- * HTTP parser which parses the data stream given to [consume].
- *
- * If an HTTP parser error occours, the parser will signal an error to either
- * the current _HttpIncoming or the _parser itself.
- *
- * The connection upgrades (e.g. switching from HTTP/1.1 to the
- * WebSocket protocol) is handled in a special way. If connection
- * upgrade is specified in the headers, then on the callback to
- * [:responseStart:] the [:upgrade:] property on the [:HttpParser:]
- * object will be [:true:] indicating that from now on the protocol is
- * not HTTP anymore and no more callbacks will happen, that is
- * [:dataReceived:] and [:dataEnd:] are not called in this case as
- * there is no more HTTP data. After the upgrade the method
- * [:readUnparsedData:] can be used to read any remaining bytes in the
- * HTTP parser which are part of the protocol the connection is
- * upgrading to. These bytes cannot be processed by the HTTP parser
- * and should be handled according to whatever protocol is being
- * upgraded to.
- */
-class _HttpParser extends Stream<_HttpIncoming> {
- // State.
- bool _parserCalled = false;
-
- // The data that is currently being parsed.
- Uint8List _buffer;
- int _index;
-
- final bool _requestParser;
- int _state;
- int _httpVersionIndex;
- int _messageType;
- int _statusCode = 0;
- int _statusCodeLength = 0;
- final List<int> _method = [];
- final List<int> _uri_or_reason_phrase = [];
- final List<int> _headerField = [];
- final List<int> _headerValue = [];
-
- int _httpVersion;
- int _transferLength = -1;
- bool _persistentConnection;
- bool _connectionUpgrade;
- bool _chunked;
-
- bool _noMessageBody = false;
- int _remainingContent = -1;
-
- _HttpHeaders _headers;
-
- // The current incoming connection.
- _HttpIncoming _incoming;
- StreamSubscription _socketSubscription;
- bool _paused = true;
- bool _bodyPaused = false;
- StreamController<_HttpIncoming> _controller;
- StreamController<List<int>> _bodyController;
-
- factory _HttpParser.requestParser() {
- return new _HttpParser._(true);
- }
-
- factory _HttpParser.responseParser() {
- return new _HttpParser._(false);
- }
-
- _HttpParser._(this._requestParser) {
- _controller = new StreamController<_HttpIncoming>(
- sync: true,
- onListen: () {
- _paused = false;
- },
- onPause: () {
- _paused = true;
- _pauseStateChanged();
- },
- onResume: () {
- _paused = false;
- _pauseStateChanged();
- },
- onCancel: () {
- if (_socketSubscription != null) {
- _socketSubscription.cancel();
- }
- });
- _reset();
- }
-
-
- StreamSubscription<_HttpIncoming> listen(void onData(_HttpIncoming event),
- {Function onError,
- void onDone(),
- bool cancelOnError}) {
- return _controller.stream.listen(onData,
- onError: onError,
- onDone: onDone,
- cancelOnError: cancelOnError);
- }
-
- void listenToStream(Stream<List<int>> stream) {
- // Listen to the stream and handle data accordingly. When a
- // _HttpIncoming is created, _dataPause, _dataResume, _dataDone is
- // given to provide a way of controlling the parser.
- // TODO(ajohnsen): Remove _dataPause, _dataResume and _dataDone and clean up
- // how the _HttpIncoming signals the parser.
- _socketSubscription = stream.listen(
- _onData,
- onError: _controller.addError,
- onDone: _onDone);
- }
-
- void _parse() {
- try {
- _doParse();
- } catch (e, s) {
- _state = _State.FAILURE;
- _reportError(e, s);
- }
- }
-
- // Process end of headers. Returns true if the parser should stop
- // parsing and return. This will be in case of either an upgrade
- // request or a request or response with an empty body.
- bool _headersEnd() {
- _headers._mutable = false;
-
- _transferLength = _headers.contentLength;
- // Ignore the Content-Length header if Transfer-Encoding
- // is chunked (RFC 2616 section 4.4)
- if (_chunked) _transferLength = -1;
-
- // 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 &&
- _transferLength < 0 &&
- _chunked == false) {
- _transferLength = 0;
- }
- if (_connectionUpgrade) {
- _state = _State.UPGRADED;
- _transferLength = 0;
- }
- _createIncoming(_transferLength);
- if (_requestParser) {
- _incoming.method =
- new String.fromCharCodes(_method);
- _incoming.uri =
- Uri.parse(
- new String.fromCharCodes(_uri_or_reason_phrase));
- } else {
- _incoming.statusCode = _statusCode;
- _incoming.reasonPhrase =
- new String.fromCharCodes(_uri_or_reason_phrase);
- }
- _method.clear();
- _uri_or_reason_phrase.clear();
- if (_connectionUpgrade) {
- _incoming.upgraded = true;
- _parserCalled = false;
- var tmp = _incoming;
- _closeIncoming();
- _controller.add(tmp);
- return true;
- }
- if (_transferLength == 0 ||
- (_messageType == _MessageType.RESPONSE && _noMessageBody)) {
- _reset();
- var tmp = _incoming;
- _closeIncoming();
- _controller.add(tmp);
- return false;
- } else if (_chunked) {
- _state = _State.CHUNK_SIZE;
- _remainingContent = 0;
- } else if (_transferLength > 0) {
- _remainingContent = _transferLength;
- _state = _State.BODY;
- } else {
- // Neither chunked nor content length. End of body
- // indicated by close.
- _state = _State.BODY;
- }
- _parserCalled = false;
- _controller.add(_incoming);
- return true;
- }
-
- // From RFC 2616.
- // generic-message = start-line
- // *(message-header CRLF)
- // CRLF
- // [ message-body ]
- // start-line = Request-Line | Status-Line
- // Request-Line = Method SP Request-URI SP HTTP-Version CRLF
- // Status-Line = HTTP-Version SP Status-Code SP Reason-Phrase CRLF
- // message-header = field-name ":" [ field-value ]
- void _doParse() {
- assert(!_parserCalled);
- _parserCalled = true;
- if (_state == _State.CLOSED) {
- throw new HttpException("Data on closed connection");
- }
- if (_state == _State.FAILURE) {
- throw new HttpException("Data on failed connection");
- }
- while (_buffer != null &&
- _index < _buffer.length &&
- _state != _State.FAILURE &&
- _state != _State.UPGRADED) {
- // Depending on _incoming, we either break on _bodyPaused or _paused.
- if ((_incoming != null && _bodyPaused) ||
- (_incoming == null && _paused)) {
- _parserCalled = false;
- return;
- }
- int byte = _buffer[_index++];
- switch (_state) {
- case _State.START:
- if (byte == _Const.HTTP[0]) {
- // Start parsing method or HTTP version.
- _httpVersionIndex = 1;
- _state = _State.METHOD_OR_RESPONSE_HTTP_VERSION;
- } else {
- // Start parsing method.
- if (!_isTokenChar(byte)) {
- throw new HttpException("Invalid request method");
- }
- _method.add(byte);
- if (!_requestParser) {
- throw new HttpException("Invalid response line");
- }
- _state = _State.REQUEST_LINE_METHOD;
- }
- break;
-
- case _State.METHOD_OR_RESPONSE_HTTP_VERSION:
- if (_httpVersionIndex < _Const.HTTP.length &&
- byte == _Const.HTTP[_httpVersionIndex]) {
- // Continue parsing HTTP version.
- _httpVersionIndex++;
- } else if (_httpVersionIndex == _Const.HTTP.length &&
- byte == _CharCode.SLASH) {
- // HTTP/ parsed. As method is a token this cannot be a
- // method anymore.
- _httpVersionIndex++;
- if (_requestParser) {
- throw new HttpException("Invalid request line");
- }
- _state = _State.RESPONSE_HTTP_VERSION;
- } else {
- // Did not parse HTTP version. Expect method instead.
- for (int i = 0; i < _httpVersionIndex; i++) {
- _method.add(_Const.HTTP[i]);
- }
- if (byte == _CharCode.SP) {
- _state = _State.REQUEST_LINE_URI;
- } else {
- _method.add(byte);
- _httpVersion = _HttpVersion.UNDETERMINED;
- if (!_requestParser) {
- throw new HttpException("Invalid response line");
- }
- _state = _State.REQUEST_LINE_METHOD;
- }
- }
- break;
-
- case _State.RESPONSE_HTTP_VERSION:
- if (_httpVersionIndex < _Const.HTTP1DOT.length) {
- // Continue parsing HTTP version.
- _expect(byte, _Const.HTTP1DOT[_httpVersionIndex]);
- _httpVersionIndex++;
- } else if (_httpVersionIndex == _Const.HTTP1DOT.length &&
- byte == _CharCode.ONE) {
- // HTTP/1.1 parsed.
- _httpVersion = _HttpVersion.HTTP11;
- _persistentConnection = true;
- _httpVersionIndex++;
- } else if (_httpVersionIndex == _Const.HTTP1DOT.length &&
- byte == _CharCode.ZERO) {
- // HTTP/1.0 parsed.
- _httpVersion = _HttpVersion.HTTP10;
- _persistentConnection = false;
- _httpVersionIndex++;
- } else if (_httpVersionIndex == _Const.HTTP1DOT.length + 1) {
- _expect(byte, _CharCode.SP);
- // HTTP version parsed.
- _state = _State.RESPONSE_LINE_STATUS_CODE;
- } else {
- throw new HttpException("Invalid response line");
- }
- break;
-
- case _State.REQUEST_LINE_METHOD:
- if (byte == _CharCode.SP) {
- _state = _State.REQUEST_LINE_URI;
- } else {
- if (_Const.SEPARATOR_MAP[byte] ||
- byte == _CharCode.CR ||
- byte == _CharCode.LF) {
- throw new HttpException("Invalid request method");
- }
- _method.add(byte);
- }
- break;
-
- case _State.REQUEST_LINE_URI:
- if (byte == _CharCode.SP) {
- if (_uri_or_reason_phrase.length == 0) {
- throw new HttpException("Invalid request URI");
- }
- _state = _State.REQUEST_LINE_HTTP_VERSION;
- _httpVersionIndex = 0;
- } else {
- if (byte == _CharCode.CR || byte == _CharCode.LF) {
- throw new HttpException("Invalid request URI");
- }
- _uri_or_reason_phrase.add(byte);
- }
- break;
-
- case _State.REQUEST_LINE_HTTP_VERSION:
- if (_httpVersionIndex < _Const.HTTP1DOT.length) {
- _expect(byte, _Const.HTTP11[_httpVersionIndex]);
- _httpVersionIndex++;
- } else if (_httpVersionIndex == _Const.HTTP1DOT.length) {
- if (byte == _CharCode.ONE) {
- // HTTP/1.1 parsed.
- _httpVersion = _HttpVersion.HTTP11;
- _persistentConnection = true;
- _httpVersionIndex++;
- } else if (byte == _CharCode.ZERO) {
- // HTTP/1.0 parsed.
- _httpVersion = _HttpVersion.HTTP10;
- _persistentConnection = false;
- _httpVersionIndex++;
- } else {
- throw new HttpException("Invalid response line");
- }
- } else {
- if (byte == _CharCode.CR) {
- _state = _State.REQUEST_LINE_ENDING;
- } else {
- _expect(byte, _CharCode.LF);
- _messageType = _MessageType.REQUEST;
- _state = _State.HEADER_START;
- }
- }
- break;
-
- case _State.REQUEST_LINE_ENDING:
- _expect(byte, _CharCode.LF);
- _messageType = _MessageType.REQUEST;
- _state = _State.HEADER_START;
- break;
-
- case _State.RESPONSE_LINE_STATUS_CODE:
- if (byte == _CharCode.SP) {
- _state = _State.RESPONSE_LINE_REASON_PHRASE;
- } else if (byte == _CharCode.CR) {
- // Some HTTP servers does not follow the spec. and send
- // \r\n right after the status code.
- _state = _State.RESPONSE_LINE_ENDING;
- } else {
- _statusCodeLength++;
- if ((byte < 0x30 && 0x39 < byte) || _statusCodeLength > 3) {
- throw new HttpException("Invalid response status code");
- } else {
- _statusCode = _statusCode * 10 + byte - 0x30;
- }
- }
- break;
-
- case _State.RESPONSE_LINE_REASON_PHRASE:
- if (byte == _CharCode.CR) {
- _state = _State.RESPONSE_LINE_ENDING;
- } else {
- if (byte == _CharCode.CR || byte == _CharCode.LF) {
- throw new HttpException("Invalid response reason phrase");
- }
- _uri_or_reason_phrase.add(byte);
- }
- break;
-
- case _State.RESPONSE_LINE_ENDING:
- _expect(byte, _CharCode.LF);
- _messageType == _MessageType.RESPONSE;
- if (_statusCode < 100 || _statusCode > 599) {
- throw new HttpException("Invalid response status code");
- } else {
- // Check whether this response will never have a body.
- if (_statusCode <= 199 || _statusCode == 204 ||
- _statusCode == 304) {
- _noMessageBody = true;
- }
- }
- _state = _State.HEADER_START;
- break;
-
- case _State.HEADER_START:
- _headers = new _HttpHeaders(version);
- if (byte == _CharCode.CR) {
- _state = _State.HEADER_ENDING;
- } else if (byte == _CharCode.LF) {
- _state = _State.HEADER_ENDING;
- _index--; // Make the new state see the LF again.
- } else {
- // Start of new header field.
- _headerField.add(_toLowerCaseByte(byte));
- _state = _State.HEADER_FIELD;
- }
- break;
-
- case _State.HEADER_FIELD:
- if (byte == _CharCode.COLON) {
- _state = _State.HEADER_VALUE_START;
- } else {
- if (!_isTokenChar(byte)) {
- throw new HttpException("Invalid header field name");
- }
- _headerField.add(_toLowerCaseByte(byte));
- }
- break;
-
- case _State.HEADER_VALUE_START:
- if (byte == _CharCode.CR) {
- _state = _State.HEADER_VALUE_FOLDING_OR_ENDING;
- } else if (byte == _CharCode.LF) {
- _state = _State.HEADER_VALUE_FOLD_OR_END;
- } else if (byte != _CharCode.SP && byte != _CharCode.HT) {
- // Start of new header value.
- _headerValue.add(byte);
- _state = _State.HEADER_VALUE;
- }
- break;
-
- case _State.HEADER_VALUE:
- if (byte == _CharCode.CR) {
- _state = _State.HEADER_VALUE_FOLDING_OR_ENDING;
- } else if (byte == _CharCode.LF) {
- _state = _State.HEADER_VALUE_FOLD_OR_END;
- } else {
- _headerValue.add(byte);
- }
- break;
-
- case _State.HEADER_VALUE_FOLDING_OR_ENDING:
- _expect(byte, _CharCode.LF);
- _state = _State.HEADER_VALUE_FOLD_OR_END;
- break;
-
- case _State.HEADER_VALUE_FOLD_OR_END:
- if (byte == _CharCode.SP || byte == _CharCode.HT) {
- _state = _State.HEADER_VALUE_START;
- } else {
- String headerField = new String.fromCharCodes(_headerField);
- String headerValue = new String.fromCharCodes(_headerValue);
- if (headerField == "transfer-encoding" &&
- _caseInsensitiveCompare("chunked".codeUnits, _headerValue)) {
- _chunked = true;
- }
- if (headerField == "connection") {
- List<String> tokens = _tokenizeFieldValue(headerValue);
- for (int i = 0; i < tokens.length; i++) {
- if (_caseInsensitiveCompare("upgrade".codeUnits,
- tokens[i].codeUnits)) {
- _connectionUpgrade = true;
- }
- _headers._add(headerField, tokens[i]);
- }
- } else {
- _headers._add(headerField, headerValue);
- }
- _headerField.clear();
- _headerValue.clear();
-
- if (byte == _CharCode.CR) {
- _state = _State.HEADER_ENDING;
- } else if (byte == _CharCode.LF) {
- _state = _State.HEADER_ENDING;
- _index--; // Make the new state see the LF again.
- } else {
- // Start of new header field.
- _headerField.add(_toLowerCaseByte(byte));
- _state = _State.HEADER_FIELD;
- }
- }
- break;
-
- case _State.HEADER_ENDING:
- _expect(byte, _CharCode.LF);
- if (_headersEnd()) {
- return;
- } else {
- break;
- }
- return;
-
- case _State.CHUNK_SIZE_STARTING_CR:
- _expect(byte, _CharCode.CR);
- _state = _State.CHUNK_SIZE_STARTING_LF;
- break;
-
- case _State.CHUNK_SIZE_STARTING_LF:
- _expect(byte, _CharCode.LF);
- _state = _State.CHUNK_SIZE;
- break;
-
- case _State.CHUNK_SIZE:
- if (byte == _CharCode.CR) {
- _state = _State.CHUNK_SIZE_ENDING;
- } else if (byte == _CharCode.SEMI_COLON) {
- _state = _State.CHUNK_SIZE_EXTENSION;
- } else {
- int value = _expectHexDigit(byte);
- _remainingContent = _remainingContent * 16 + value;
- }
- break;
-
- case _State.CHUNK_SIZE_EXTENSION:
- if (byte == _CharCode.CR) {
- _state = _State.CHUNK_SIZE_ENDING;
- }
- break;
-
- case _State.CHUNK_SIZE_ENDING:
- _expect(byte, _CharCode.LF);
- if (_remainingContent > 0) {
- _state = _State.BODY;
- } else {
- _state = _State.CHUNKED_BODY_DONE_CR;
- }
- break;
-
- case _State.CHUNKED_BODY_DONE_CR:
- _expect(byte, _CharCode.CR);
- _state = _State.CHUNKED_BODY_DONE_LF;
- break;
-
- case _State.CHUNKED_BODY_DONE_LF:
- _expect(byte, _CharCode.LF);
- _reset();
- _closeIncoming();
- break;
-
- case _State.BODY:
- // The body is not handled one byte at a time but in blocks.
- _index--;
- int dataAvailable = _buffer.length - _index;
- if (_remainingContent >= 0 && dataAvailable > _remainingContent) {
- dataAvailable = _remainingContent;
- }
- // Always present the data as a view. This way we can handle all
- // cases like this, and the user will not experince different data
- // typed (which could lead to polymorphic user code).
- List<int> data = new Uint8List.view(_buffer.buffer,
- _buffer.offsetInBytes + _index,
- dataAvailable);
- _bodyController.add(data);
- if (_remainingContent != -1) {
- _remainingContent -= data.length;
- }
- _index += data.length;
- if (_remainingContent == 0) {
- if (!_chunked) {
- _reset();
- _closeIncoming();
- } else {
- _state = _State.CHUNK_SIZE_STARTING_CR;
- }
- }
- break;
-
- case _State.FAILURE:
- // Should be unreachable.
- assert(false);
- break;
-
- default:
- // Should be unreachable.
- assert(false);
- break;
- }
- }
-
- _parserCalled = false;
- if (_buffer != null && _index == _buffer.length) {
- // If all data is parsed release the buffer and resume receiving
- // data.
- _releaseBuffer();
- if (_state != _State.UPGRADED && _state != _State.FAILURE) {
- _socketSubscription.resume();
- }
- }
- }
-
- void _onData(List<int> buffer) {
- _socketSubscription.pause();
- assert(_buffer == null);
- _buffer = buffer;
- _index = 0;
- _parse();
- }
-
- void _onDone() {
- // onDone cancles the subscription.
- _socketSubscription = null;
- if (_state == _State.CLOSED || _state == _State.FAILURE) return;
-
- if (_incoming != null) {
- if (_state != _State.UPGRADED &&
- !(_state == _State.START && !_requestParser) &&
- !(_state == _State.BODY && !_chunked && _transferLength == -1)) {
- _bodyController.addError(
- new HttpException("Connection closed while receiving data"));
- }
- _closeIncoming(true);
- _controller.close();
- return;
- }
- // If the connection is idle the HTTP stream is closed.
- if (_state == _State.START) {
- if (!_requestParser) {
- _reportError(new HttpException(
- "Connection closed before full header was received"));
- }
- _controller.close();
- return;
- }
-
- if (_state == _State.UPGRADED) {
- _controller.close();
- return;
- }
-
- if (_state < _State.FIRST_BODY_STATE) {
- _state = _State.FAILURE;
- // Report the error through the error callback if any. Otherwise
- // throw the error.
- _reportError(new HttpException(
- "Connection closed before full header was received"));
- _controller.close();
- return;
- }
-
- if (!_chunked && _transferLength == -1) {
- _state = _State.CLOSED;
- } else {
- _state = _State.FAILURE;
- // Report the error through the error callback if any. Otherwise
- // throw the error.
- _reportError(new HttpException(
- "Connection closed before full body was received"));
- }
- _controller.close();
- }
-
- String get version {
- switch (_httpVersion) {
- case _HttpVersion.HTTP10:
- return "1.0";
- case _HttpVersion.HTTP11:
- return "1.1";
- }
- return null;
- }
-
- int get messageType => _messageType;
- int get transferLength => _transferLength;
- bool get upgrade => _connectionUpgrade && _state == _State.UPGRADED;
- bool get persistentConnection => _persistentConnection;
-
- void set isHead(bool value) {
- if (value) _noMessageBody = true;
- }
-
- _HttpDetachedIncoming detachIncoming() {
- // Simulate detached by marking as upgraded.
- _state = _State.UPGRADED;
- return new _HttpDetachedIncoming(_socketSubscription,
- readUnparsedData());
- }
-
- List<int> readUnparsedData() {
- if (_buffer == null) return null;
- if (_index == _buffer.length) return null;
- var result = _buffer.sublist(_index);
- _releaseBuffer();
- return result;
- }
-
- void _reset() {
- if (_state == _State.UPGRADED) return;
- _state = _State.START;
- _messageType = _MessageType.UNDETERMINED;
- _headerField.clear();
- _headerValue.clear();
- _method.clear();
- _uri_or_reason_phrase.clear();
-
- _statusCode = 0;
- _statusCodeLength = 0;
-
- _httpVersion = _HttpVersion.UNDETERMINED;
- _transferLength = -1;
- _persistentConnection = false;
- _connectionUpgrade = false;
- _chunked = false;
-
- _noMessageBody = false;
- _remainingContent = -1;
-
- _headers = null;
- }
-
- void _releaseBuffer() {
- _buffer = null;
- _index = null;
- }
-
- static bool _isTokenChar(int byte) {
- return byte > 31 && byte < 128 && !_Const.SEPARATOR_MAP[byte];
- }
-
- static bool _isValueChar(int byte) {
- return (byte > 31 && byte < 128) || (byte == _CharCode.SP) ||
- (byte == _CharCode.HT);
- }
-
- static List<String> _tokenizeFieldValue(String headerValue) {
- List<String> tokens = new List<String>();
- int start = 0;
- int index = 0;
- while (index < headerValue.length) {
- if (headerValue[index] == ",") {
- tokens.add(headerValue.substring(start, index));
- start = index + 1;
- } else if (headerValue[index] == " " || headerValue[index] == "\t") {
- start++;
- }
- index++;
- }
- tokens.add(headerValue.substring(start, index));
- return tokens;
- }
-
- static int _toLowerCaseByte(int x) {
- // Optimized version:
- // - 0x41 is 'A'
- // - 0x7f is ASCII mask
- // - 26 is the number of alpha characters.
- // - 0x20 is the delta between lower and upper chars.
- return (((x - 0x41) & 0x7f) < 26) ? (x | 0x20) : x;
- }
-
- // expected should already be lowercase.
- bool _caseInsensitiveCompare(List<int> expected, List<int> value) {
- if (expected.length != value.length) return false;
- for (int i = 0; i < expected.length; i++) {
- if (expected[i] != _toLowerCaseByte(value[i])) return false;
- }
- return true;
- }
-
- int _expect(int val1, int val2) {
- if (val1 != val2) {
- throw new HttpException("Failed to parse HTTP");
- }
- }
-
- int _expectHexDigit(int byte) {
- if (0x30 <= byte && byte <= 0x39) {
- return byte - 0x30; // 0 - 9
- } else if (0x41 <= byte && byte <= 0x46) {
- return byte - 0x41 + 10; // A - F
- } else if (0x61 <= byte && byte <= 0x66) {
- return byte - 0x61 + 10; // a - f
- } else {
- throw new HttpException("Failed to parse HTTP");
- }
- }
-
- void _createIncoming(int transferLength) {
- assert(_incoming == null);
- assert(_bodyController == null);
- assert(!_bodyPaused);
- var incoming;
- _bodyController = new StreamController<List<int>>(
- sync: true,
- onListen: () {
- if (incoming != _incoming) return;
- assert(_bodyPaused);
- _bodyPaused = false;
- _pauseStateChanged();
- },
- onPause: () {
- if (incoming != _incoming) return;
- assert(!_bodyPaused);
- _bodyPaused = true;
- _pauseStateChanged();
- },
- onResume: () {
- if (incoming != _incoming) return;
- assert(_bodyPaused);
- _bodyPaused = false;
- _pauseStateChanged();
- },
- onCancel: () {
- if (incoming != _incoming) return;
- if (_socketSubscription != null) {
- _socketSubscription.cancel();
- }
- _closeIncoming(true);
- _controller.close();
- });
- incoming = _incoming = new _HttpIncoming(
- _headers, transferLength, _bodyController.stream);
- _bodyPaused = true;
- _pauseStateChanged();
- }
-
- void _closeIncoming([bool closing = false]) {
- // Ignore multiple close (can happen in re-entrance).
- if (_incoming == null) return;
- var tmp = _incoming;
- tmp.close(closing);
- _incoming = null;
- if (_bodyController != null) {
- _bodyController.close();
- _bodyController = null;
- }
- _bodyPaused = false;
- _pauseStateChanged();
- }
-
- void _pauseStateChanged() {
- if (_incoming != null) {
- if (!_bodyPaused && !_parserCalled) {
- _parse();
- }
- } else {
- if (!_paused && !_parserCalled) {
- _parse();
- }
- }
- }
-
- void _reportError(error, [stackTrace]) {
- if (_socketSubscription != null) _socketSubscription.cancel();
- _state = _State.FAILURE;
- _controller.addError(error, stackTrace);
- _controller.close();
- }
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/io/http_session.dart b/pkg/dev_compiler/tool/input_sdk/lib/io/http_session.dart
deleted file mode 100644
index 90075a5..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/io/http_session.dart
+++ /dev/null
@@ -1,174 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-part of dart.io;
-
-const String _DART_SESSION_ID = "DARTSESSID";
-
-// A _HttpSession is a node in a double-linked list, with _next and _prev being
-// the previous and next pointers.
-class _HttpSession implements HttpSession {
- // Destroyed marked. Used by the http connection to see if a session is valid.
- bool _destroyed = false;
- bool _isNew = true;
- DateTime _lastSeen;
- Function _timeoutCallback;
- _HttpSessionManager _sessionManager;
- // Pointers in timeout queue.
- _HttpSession _prev;
- _HttpSession _next;
- final String id;
-
- final Map _data = new HashMap();
-
- _HttpSession(this._sessionManager, this.id) : _lastSeen = new DateTime.now();
-
- void destroy() {
- _destroyed = true;
- _sessionManager._removeFromTimeoutQueue(this);
- _sessionManager._sessions.remove(id);
- }
-
- // Mark the session as seen. This will reset the timeout and move the node to
- // the end of the timeout queue.
- void _markSeen() {
- _lastSeen = new DateTime.now();
- _sessionManager._bumpToEnd(this);
- }
-
- DateTime get lastSeen => _lastSeen;
-
- bool get isNew => _isNew;
-
- void set onTimeout(void callback()) {
- _timeoutCallback = callback;
- }
-
- // Map implementation:
- bool containsValue(value) => _data.containsValue(value);
- bool containsKey(key) => _data.containsKey(key);
- operator [](key) => _data[key];
- void operator []=(key, value) { _data[key] = value; }
- putIfAbsent(key, ifAbsent) => _data.putIfAbsent(key, ifAbsent);
- addAll(Map other) => _data.addAll(other);
- remove(key) => _data.remove(key);
- void clear() { _data.clear(); }
- void forEach(void f(key, value)) { _data.forEach(f); }
- Iterable get keys => _data.keys;
- Iterable get values => _data.values;
- int get length => _data.length;
- bool get isEmpty => _data.isEmpty;
- bool get isNotEmpty => _data.isNotEmpty;
-
- String toString() => 'HttpSession id:$id $_data';
-}
-
-// Private class used to manage all the active sessions. The sessions are stored
-// in two ways:
-//
-// * In a map, mapping from ID to HttpSession.
-// * In a linked list, used as a timeout queue.
-class _HttpSessionManager {
- Map<String, _HttpSession> _sessions;
- int _sessionTimeout = 20 * 60; // 20 mins.
- _HttpSession _head;
- _HttpSession _tail;
- Timer _timer;
-
- _HttpSessionManager() : _sessions = {};
-
- String createSessionId() {
- const int _KEY_LENGTH = 16; // 128 bits.
- var data = _IOCrypto.getRandomBytes(_KEY_LENGTH);
- return _CryptoUtils.bytesToHex(data);
- }
-
- _HttpSession getSession(String id) => _sessions[id];
-
- _HttpSession createSession() {
- var id = createSessionId();
- // TODO(ajohnsen): Consider adding a limit and throwing an exception.
- // Should be very unlikely however.
- while (_sessions.containsKey(id)) {
- id = createSessionId();
- }
- var session = _sessions[id] = new _HttpSession(this, id);
- _addToTimeoutQueue(session);
- return session;
- }
-
- void set sessionTimeout(int timeout) {
- _sessionTimeout = timeout;
- _stopTimer();
- _startTimer();
- }
-
- void close() { _stopTimer(); }
-
- void _bumpToEnd(_HttpSession session) {
- _removeFromTimeoutQueue(session);
- _addToTimeoutQueue(session);
- }
-
- void _addToTimeoutQueue(_HttpSession session) {
- if (_head == null) {
- assert(_tail == null);
- _tail = _head = session;
- _startTimer();
- } else {
- assert(_timer != null);
- assert(_tail != null);
- // Add to end.
- _tail._next = session;
- session._prev = _tail;
- _tail = session;
- }
- }
-
- void _removeFromTimeoutQueue(_HttpSession session) {
- if (session._next != null) {
- session._next._prev = session._prev;
- }
- if (session._prev != null) {
- session._prev._next = session._next;
- }
- if (_head == session) {
- // We removed the head element, start new timer.
- _head = session._next;
- _stopTimer();
- _startTimer();
- }
- if (_tail == session) {
- _tail = session._prev;
- }
- session._next = session._prev = null;
- }
-
- void _timerTimeout() {
- _stopTimer(); // Clear timer.
- assert(_head != null);
- var session = _head;
- session.destroy(); // Will remove the session from timeout queue and map.
- if (session._timeoutCallback != null) {
- session._timeoutCallback();
- }
- }
-
- void _startTimer() {
- assert(_timer == null);
- if (_head != null) {
- int seconds = new DateTime.now().difference(_head.lastSeen).inSeconds;
- _timer = new Timer(new Duration(seconds: _sessionTimeout - seconds),
- _timerTimeout);
- }
- }
-
- void _stopTimer() {
- if (_timer != null) {
- _timer.cancel();
- _timer = null;
- }
- }
-}
-
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/io/io.dart b/pkg/dev_compiler/tool/input_sdk/lib/io/io.dart
deleted file mode 100644
index 66250ee..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/io/io.dart
+++ /dev/null
@@ -1,243 +0,0 @@
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-/**
- * File, socket, HTTP, and other I/O support for server applications.
- *
- * The I/O 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.
- *
- * To use this library in your code:
- *
- * import 'dart:io';
- *
- * *Note:* Many operations related to input and output are asynchronous
- * and are handled using [Future]s or [Stream]s, both of which
- * are defined in the `dart:async` library.
- *
- * ## File, Directory, and Link
- *
- * An instance of [File], [Directory], or [Link] represents a file,
- * directory, or link, respectively, in the native file system.
- *
- * You can manipulate the file system through objects of these types.
- * For example, you can rename a file or directory:
- *
- * File myFile = new File('myFile.txt');
- * myFile.rename('yourFile.txt').then((_) => print('file renamed'));
- *
- * Many methods provided by the File, Directory, and Link classes
- * run asynchronously and return a Future.
- *
- * ## FileSystemEntity
- *
- * File, Directory, and Link all extend [FileSystemEntity].
- * In addition to being the superclass for these classes,
- * FileSystemEntity has a number of static methods for working with paths.
- *
- * To get information about a path,
- * you can use the FileSystemEntity static methods
- * such as 'isDirectory', 'isFile', and 'exists'.
- * Because file system access involves I/O, these methods
- * are asynchronous and return a Future.
- *
- * FileSystemEntity.isDirectory(myPath).then((isDir) {
- * if (isDir) {
- * print('$myPath is a directory');
- * } else {
- * print('$myPath is not a directory');
- * }
- * });
- *
- * ## HttpServer and HttpClient
- *
- * The classes [HttpServer] and [HttpClient]
- * provide HTTP server and HTTP client functionality.
- *
- * The [HttpServer] class provides the basic functionality for
- * implementing an HTTP server.
- * For some higher-level building-blocks, we recommend that you try
- * the [http_server](https://pub.dartlang.org/packages/http_server)
- * pub package, which contains
- * a set of high-level classes that, together with the [HttpServer] class
- * in this library, make it easier to implement HTTP servers.
- *
- * ## Process
- *
- * The [Process] class provides a way to run a process on
- * the native machine.
- * For example, the following code spawns a process that recursively lists
- * the files under `web`.
- *
- * Process.start('ls', ['-R', 'web']).then((process) {
- * stdout.addStream(process.stdout);
- * stderr.addStream(process.stderr);
- * process.exitCode.then(print);
- * });
- *
- * Using `start()` returns a Future, which completes with a [Process] object
- * when the process has started. This [Process] object allows you to interact
- * with the process while it is running. Using `run()` returns a Future, which
- * completes with a [ProcessResult] object when the spawned process has
- * terminated. This [ProcessResult] object collects the output and exit code
- * from the process.
- *
- * When using `start()`,
- * you need to read all data coming on the stdout and stderr streams otherwise
- * the system resources will not be freed.
- *
- * ## WebSocket
- *
- * The [WebSocket] class provides support for the web socket protocol. This
- * allows full-duplex communications between client and server applications.
- * Use the WebSocket class in the `dart:html` library for web clients.
- *
- * A web socket server uses a normal HTTP server for accepting web socket
- * connections. The initial handshake is a HTTP request which is then upgraded to a
- * web socket connection.
- * The server upgrades the request using [WebSocketTransformer]
- * and listens for the data on the returned web socket.
- * For example, here's a mini server that listens for 'ws' data
- * on a WebSocket:
- *
- * runZoned(() {
- * HttpServer.bind('127.0.0.1', 4040).then((server) {
- * server.listen((HttpRequest req) {
- * if (req.uri.path == '/ws') {
- * WebSocketTransformer.upgrade(req).then((socket) {
- * socket.listen(handleMsg);
- * });
- * }
- * });
- * });
- * },
- * onError: (e) => print("An error occurred."));
- *
- * The client connects to the WebSocket using the `connect()` method
- * and a URI that uses the Web Socket protocol.
- * The client can write to the WebSocket with the `add()` method.
- * For example,
- *
- * WebSocket.connect('ws://127.0.0.1:4040/ws').then((socket) {
- * socket.add('Hello, World!');
- * });
- *
- * Check out the
- * [dartiverse_search](https://github.com/dart-lang/sample-dartiverse-search)
- * sample for a client/server pair that uses
- * WebSockets to communicate.
- *
- * ## Socket and ServerSocket
- *
- * Clients and servers use [Socket]s to communicate using the TCP protocol.
- * Use [ServerSocket] on the server side and [Socket] on the client.
- * The server creates a listening socket using the `bind()` method and
- * then listens for incoming connections on the socket. For example:
- *
- * ServerSocket.bind('127.0.0.1', 4041)
- * .then((serverSocket) {
- * serverSocket.listen((socket) {
- * socket.transform(UTF8.decoder).listen(print);
- * });
- * });
- *
- * A client connects a Socket using the `connect()` method,
- * which returns a Future.
- * Using `write()`, `writeln()`, or `writeAll()` are the easiest ways to
- * send data over the socket.
- * For example:
- *
- * Socket.connect('127.0.0.1', 4041).then((socket) {
- * socket.write('Hello, World!');
- * });
- *
- * Besides [Socket] and [ServerSocket], the [RawSocket] and
- * [RawServerSocket] classes are available for lower-level access
- * to async socket IO.
- *
- * ## Standard output, error, and input streams
- *
- * This library provides the standard output, error, and input
- * streams, named 'stdout', 'stderr', and 'stdin', respectively.
- *
- * The stdout and stderr streams are both [IOSink]s and have the same set
- * of methods and properties.
- *
- * To write a string to 'stdout':
- *
- * stdout.writeln('Hello, World!');
- *
- * To write a list of objects to 'stderr':
- *
- * stderr.writeAll([ 'That ', 'is ', 'an ', 'error.', '\n']);
- *
- * The standard input stream is a true [Stream], so it inherits
- * properties and methods from the Stream class.
- *
- * To read text synchronously from the command line
- * (the program blocks waiting for user to type information):
- *
- * String inputText = stdin.readLineSync();
- *
- * ## Other resources
- *
- * For an introduction to I/O in Dart, see the [dart:io section of the library
- * tour](https://www.dartlang.org/docs/dart-up-and-running/ch03.html#dartio---io-for-command-line-apps).
- *
- * To learn more about I/O in Dart, refer to the [tutorial about writing
- * command-line apps](https://www.dartlang.org/docs/tutorials/cmdline/).
- */
-library dart.io;
-
-import 'dart:async';
-import 'dart:_internal';
-import 'dart:collection' show HashMap,
- HashSet,
- Queue,
- ListQueue,
- LinkedList,
- LinkedListEntry,
- UnmodifiableMapView;
-import 'dart:convert';
-import 'dart:developer';
-import 'dart:isolate';
-import 'dart:math';
-import 'dart:typed_data';
-
-part 'bytes_builder.dart';
-part 'common.dart';
-part 'crypto.dart';
-part 'data_transformer.dart';
-part 'directory.dart';
-part 'directory_impl.dart';
-part 'eventhandler.dart';
-part 'file.dart';
-part 'file_impl.dart';
-part 'file_system_entity.dart';
-part 'http.dart';
-part 'http_date.dart';
-part 'http_headers.dart';
-part 'http_impl.dart';
-part 'http_parser.dart';
-part 'http_session.dart';
-part 'io_resource_info.dart';
-part 'io_sink.dart';
-part 'io_service.dart';
-part 'link.dart';
-part 'platform.dart';
-part 'platform_impl.dart';
-part 'process.dart';
-part 'secure_server_socket.dart';
-part 'secure_socket.dart';
-part 'security_context.dart';
-part 'service_object.dart';
-part 'socket.dart';
-part 'stdio.dart';
-part 'string_transformer.dart';
-part 'websocket.dart';
-part 'websocket_impl.dart';
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/io/io_resource_info.dart b/pkg/dev_compiler/tool/input_sdk/lib/io/io_resource_info.dart
deleted file mode 100644
index 7cea231..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/io/io_resource_info.dart
+++ /dev/null
@@ -1,283 +0,0 @@
-// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-part of dart.io;
-
-abstract class _IOResourceInfo {
- final String type;
- final int id;
- String get name;
- static int _count = 0;
-
- static final Stopwatch _sw = new Stopwatch()..start();
- static final _startTime = new DateTime.now().millisecondsSinceEpoch;
-
- static double get timestamp => _startTime + _sw.elapsedMicroseconds/1000;
-
- _IOResourceInfo(this.type) : id = _IOResourceInfo.getNextID();
-
- /// Get the full set of values for a specific implementation. This is normally
- /// looked up based on an id from a referenceValueMap.
- Map<String, String> get fullValueMap;
-
- /// The reference map, used to return a list of values, e.g., getting
- /// all open sockets. The structure of this is shared among all subclasses.
- Map<String, String> get referenceValueMap =>
- {
- // The type for a reference object is prefixed with @ in observatory.
- 'type': '@$type',
- 'id': id,
- 'name': name,
- };
-
- static int getNextID() => _count++;
-}
-
-abstract class _ReadWriteResourceInfo extends _IOResourceInfo {
- int totalRead;
- int totalWritten;
- int readCount;
- int writeCount;
- double lastRead;
- double lastWrite;
-
- // Not all call sites use this. In some cases, e.g., a socket, a read does
- // not always mean that we actually read some bytes (we may do a read to see
- // if there are some bytes available).
- void addRead(int bytes) {
- totalRead += bytes;
- readCount++;
- lastRead = _IOResourceInfo.timestamp;
- }
-
- // In cases where we read but did not neccesarily get any bytes, use this to
- // update the readCount and timestamp. Manually update totalRead if any bytes
- // where acutally read.
- void didRead() { addRead(0); }
-
- void addWrite(int bytes) {
- totalWritten += bytes;
- writeCount++;
- lastWrite = _IOResourceInfo.timestamp;
- }
-
- _ReadWriteResourceInfo(String type) :
- totalRead = 0,
- totalWritten = 0,
- readCount = 0,
- writeCount = 0,
- lastRead = 0.0,
- lastWrite = 0.0,
- super(type);
-
- Map<String, String> get fullValueMap =>
- {
- 'type': type,
- 'id': id,
- 'name': name,
- 'totalRead': totalRead,
- 'totalWritten': totalWritten,
- 'readCount': readCount,
- 'writeCount': writeCount,
- 'lastRead': lastRead,
- 'lastWrite': lastWrite
- };
-}
-
-class _FileResourceInfo extends _ReadWriteResourceInfo {
- static const String TYPE = '_file';
-
- final file;
-
- static Map<int, _FileResourceInfo> openFiles =
- new Map<int, _FileResourceInfo>();
-
- _FileResourceInfo(this.file) : super(TYPE) {
- FileOpened(this);
- }
-
- static FileOpened(_FileResourceInfo info) {
- assert(!openFiles.containsKey(info.id));
- openFiles[info.id] = info;
- }
-
- static FileClosed(_FileResourceInfo info) {
- assert(openFiles.containsKey(info.id));
- openFiles.remove(info.id);
- }
-
- static Iterable<Map<String, String>> getOpenFilesList() {
- return new List.from(openFiles.values.map((e) => e.referenceValueMap));
- }
-
- static Future<ServiceExtensionResponse> getOpenFiles(function, params) {
- assert(function == 'ext.dart.io.getOpenFiles');
- var data = {'type': '_openfiles', 'data': getOpenFilesList()};
- var json = JSON.encode(data);
- return new Future.value(new ServiceExtensionResponse.result(json));
- }
-
- Map<String, String> getFileInfoMap() {
- var result = fullValueMap;
- return result;
- }
-
- static Future<ServiceExtensionResponse> getFileInfoMapByID(function, params) {
- assert(params.containsKey('id'));
- var id = int.parse(params['id']);
- var result =
- openFiles.containsKey(id) ? openFiles[id].getFileInfoMap() : {};
- var json = JSON.encode(result);
- return new Future.value(new ServiceExtensionResponse.result(json));
- }
-
- String get name {
- return '${file.path}';
- }
-}
-
-class _ProcessResourceInfo extends _IOResourceInfo{
- static const String TYPE = '_process';
- final process;
- final double startedAt;
-
- static Map<int, _ProcessResourceInfo> startedProcesses =
- new Map<int, _ProcessResourceInfo>();
-
- _ProcessResourceInfo(this.process) :
- startedAt = _IOResourceInfo.timestamp,
- super(TYPE) {
- ProcessStarted(this);
- }
-
- String get name => process._path;
-
- void stopped() { ProcessStopped(this); }
-
- Map<String, String> get fullValueMap =>
- {
- 'type': type,
- 'id': id,
- 'name': name,
- 'pid': process.pid,
- 'startedAt': startedAt,
- 'arguments': process._arguments,
- 'workingDirectory':
- process._workingDirectory == null ? '.' : process._workingDirectory,
- };
-
- static ProcessStarted(_ProcessResourceInfo info) {
- assert(!startedProcesses.containsKey(info.id));
- startedProcesses[info.id] = info;
- }
-
- static ProcessStopped(_ProcessResourceInfo info) {
- assert(startedProcesses.containsKey(info.id));
- startedProcesses.remove(info.id);
- }
-
- static Iterable<Map<String, String>> getStartedProcessesList() =>
- new List.from(startedProcesses.values.map((e) => e.referenceValueMap));
-
- static Future<ServiceExtensionResponse> getStartedProcesses(
- String function, Map<String, String> params) {
- assert(function == 'ext.dart.io.getProcesses');
- var data = {'type': '_startedprocesses', 'data': getStartedProcessesList()};
- var json = JSON.encode(data);
- return new Future.value(new ServiceExtensionResponse.result(json));
- }
-
- static Future<ServiceExtensionResponse> getProcessInfoMapById(
- String function, Map<String, String> params) {
- var id = int.parse(params['id']);
- var result = startedProcesses.containsKey(id)
- ? startedProcesses[id].fullValueMap
- : {};
- var json = JSON.encode(result);
- return new Future.value(new ServiceExtensionResponse.result(json));
- }
-}
-
-class _SocketResourceInfo extends _ReadWriteResourceInfo {
- static const String TCP_STRING = 'TCP';
- static const String UDP_STRING = 'UDP';
- static const String TYPE = '_socket';
-
- final socket;
-
- static Map<int, _SocketResourceInfo> openSockets =
- new Map<int, _SocketResourceInfo>();
-
- _SocketResourceInfo(this.socket) : super(TYPE) {
- SocketOpened(this);
- }
-
- String get name {
- if (socket.isListening) {
- return 'listening:${socket.address.host}:${socket.port}';
- }
- var remote = '';
- try {
- var remoteHost = socket.remoteAddress.host;
- var remotePort = socket.remotePort;
- remote = ' -> $remoteHost:$remotePort';
- } catch (e) { } // ignored if we can't get the information
- return '${socket.address.host}:${socket.port}$remote';
- }
-
- static Iterable<Map<String, String>> getOpenSocketsList() {
- return new List.from(openSockets.values.map((e) => e.referenceValueMap));
- }
-
- Map<String, String> getSocketInfoMap() {
- var result = fullValueMap;
- result['socketType'] = socket.isTcp ? TCP_STRING : UDP_STRING;
- result['listening'] = socket.isListening;
- result['host'] = socket.address.host;
- result['port'] = socket.port;
- if (!socket.isListening) {
- try {
- result['remoteHost'] = socket.remoteAddress.host;
- result['remotePort'] = socket.remotePort;
- } catch (e) {
- // UDP.
- result['remotePort'] = 'NA';
- result['remoteHost'] = 'NA';
- }
- } else {
- result['remotePort'] = 'NA';
- result['remoteHost'] = 'NA';
- }
- result['addressType'] = socket.address.type.name;
- return result;
- }
-
- static Future<ServiceExtensionResponse> getSocketInfoMapByID(
- String function, Map<String, String> params) {
- assert(params.containsKey('id'));
- var id = int.parse(params['id']);
- var result =
- openSockets.containsKey(id) ? openSockets[id].getSocketInfoMap() : {};
- var json = JSON.encode(result);
- return new Future.value(new ServiceExtensionResponse.result(json));
- }
-
- static Future<ServiceExtensionResponse> getOpenSockets(function, params) {
- assert(function == 'ext.dart.io.getOpenSockets');
- var data = {'type': '_opensockets', 'data': getOpenSocketsList()};
- var json = JSON.encode(data);
- return new Future.value(new ServiceExtensionResponse.result(json));
- }
-
- static SocketOpened(_SocketResourceInfo info) {
- assert(!openSockets.containsKey(info.id));
- openSockets[info.id] = info;
- }
-
- static SocketClosed(_SocketResourceInfo info) {
- assert(openSockets.containsKey(info.id));
- openSockets.remove(info.id);
- }
-
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/io/io_service.dart b/pkg/dev_compiler/tool/input_sdk/lib/io/io_service.dart
deleted file mode 100644
index cabba54..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/io/io_service.dart
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-part of dart.io;
-
-// This list must be kept in sync with the list in runtime/bin/io_service.h
-const int _FILE_EXISTS = 0;
-const int _FILE_CREATE = 1;
-const int _FILE_DELETE = 2;
-const int _FILE_RENAME = 3;
-const int _FILE_COPY = 4;
-const int _FILE_OPEN = 5;
-const int _FILE_RESOLVE_SYMBOLIC_LINKS = 6;
-const int _FILE_CLOSE = 7;
-const int _FILE_POSITION = 8;
-const int _FILE_SET_POSITION = 9;
-const int _FILE_TRUNCATE = 10;
-const int _FILE_LENGTH = 11;
-const int _FILE_LENGTH_FROM_PATH = 12;
-const int _FILE_LAST_MODIFIED = 13;
-const int _FILE_FLUSH = 14;
-const int _FILE_READ_BYTE = 15;
-const int _FILE_WRITE_BYTE = 16;
-const int _FILE_READ = 17;
-const int _FILE_READ_INTO = 18;
-const int _FILE_WRITE_FROM = 19;
-const int _FILE_CREATE_LINK = 20;
-const int _FILE_DELETE_LINK = 21;
-const int _FILE_RENAME_LINK = 22;
-const int _FILE_LINK_TARGET = 23;
-const int _FILE_TYPE = 24;
-const int _FILE_IDENTICAL = 25;
-const int _FILE_STAT = 26;
-const int _FILE_LOCK = 27;
-const int _SOCKET_LOOKUP = 28;
-const int _SOCKET_LIST_INTERFACES = 29;
-const int _SOCKET_REVERSE_LOOKUP = 30;
-const int _DIRECTORY_CREATE = 31;
-const int _DIRECTORY_DELETE = 32;
-const int _DIRECTORY_EXISTS = 33;
-const int _DIRECTORY_CREATE_TEMP = 34;
-const int _DIRECTORY_LIST_START = 35;
-const int _DIRECTORY_LIST_NEXT = 36;
-const int _DIRECTORY_LIST_STOP = 37;
-const int _DIRECTORY_RENAME = 38;
-const int _SSL_PROCESS_FILTER = 39;
-
-class _IOService {
- external static Future _dispatch(int request, List data);
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/io/io_sink.dart b/pkg/dev_compiler/tool/input_sdk/lib/io/io_sink.dart
deleted file mode 100644
index b1c05a0..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/io/io_sink.dart
+++ /dev/null
@@ -1,309 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-part of dart.io;
-
-/**
- * A combined byte and text output.
- *
- * An [IOSink] combines a [StreamSink] of bytes with a [StringSink],
- * and allows easy output of both bytes and text.
- *
- * Writing text ([write]) and adding bytes ([add]) may be interleaved freely.
- *
- * While a stream is being added using [addStream], any further attempts
- * to add or write to the [IOSink] will fail until the [addStream] completes.
- *
- * If data is added to the [IOSink] after the sink is closed, the data will be
- * ignored. Use the [done] future to be notified when the [IOSink] is closed.
- */
-abstract class IOSink implements StreamSink<List<int>>, StringSink {
-
- /**
- * Create an [IOSink] that outputs to a [target] [StreamConsumer] of bytes.
- *
- * Text written to [StreamSink] methods is encoded to bytes using [encoding]
- * before being output on [target].
- */
- factory IOSink(StreamConsumer<List<int>> target,
- {Encoding encoding: UTF8})
- => new _IOSinkImpl(target, encoding);
-
- /**
- * The [Encoding] used when writing strings. Depending on the
- * underlying consumer this property might be mutable.
- */
- Encoding encoding;
-
- /**
- * Adds byte [data] to the target consumer, ignoring [encoding].
- *
- * The [encoding] does not apply to this method, and the `data` list is passed
- * directly to the target consumer as a stream event.
- *
- * This function must not be called when a stream is currently being added
- * using [addStream].
- *
- * This operation is non-blocking. See [flush] or [done] for how to get any
- * errors generated by this call.
- *
- * The data list should not be modified after it has been passed to `add`.
- */
- void add(List<int> data);
-
- /**
- * Converts [obj] to a String by invoking [Object.toString] and
- * [add]s the encoding of the result to the target consumer.
- *
- * This operation is non-blocking. See [flush] or [done] for how to get any
- * errors generated by this call.
- */
- void write(Object obj);
-
- /**
- * Iterates over the given [objects] and [write]s them in sequence.
- *
- * If [separator] is provided, a `write` with the `separator` is performed
- * between any two elements of objects`.
- *
- * This operation is non-blocking. See [flush] or [done] for how to get any
- * errors generated by this call.
- */
- void writeAll(Iterable objects, [String separator = ""]);
-
- /**
- * Converts [obj] to a String by invoking [Object.toString] and
- * writes the result to `this`, followed by a newline.
- *
- * This operation is non-blocking. See [flush] or [done] for how to get any
- * errors generated by this call.
- */
- void writeln([Object obj = ""]);
-
- /**
- * Writes the character of [charCode].
- *
- * This method is equivalent to `write(new String.fromCharCode(charCode))`.
- *
- * This operation is non-blocking. See [flush] or [done] for how to get any
- * errors generated by this call.
- */
- void writeCharCode(int charCode);
-
- /**
- * Passes the error to the target consumer as an error event.
- *
- * This function must not be called when a stream is currently being added
- * using [addStream].
- *
- * This operation is non-blocking. See [flush] or [done] for how to get any
- * errors generated by this call.
- */
- void addError(error, [StackTrace stackTrace]);
-
- /**
- * Adds all elements of the given [stream] to `this`.
- *
- * Returns a [Future] that completes when
- * all elements of the given [stream] are added to `this`.
- */
- Future addStream(Stream<List<int>> stream);
-
- /**
- * Returns a [Future] that completes once all buffered data is accepted by the
- * to underlying [StreamConsumer].
- *
- * This method must not be called while an [addStream] is incomplete.
- *
- * NOTE: This is not necessarily the same as the data being flushed by the
- * operating system.
- */
- Future flush();
-
- /**
- * Close the target consumer.
- */
- Future close();
-
- /**
- * Get a future that will complete when the consumer closes, or when an
- * error occurs. This future is identical to the future returned by
- * [close].
- */
- Future get done;
-}
-
-class _StreamSinkImpl<T> implements StreamSink<T> {
- final StreamConsumer<T> _target;
- final Completer _doneCompleter = new Completer();
- StreamController<T> _controllerInstance;
- Completer _controllerCompleter;
- bool _isClosed = false;
- bool _isBound = false;
- bool _hasError = false;
-
- _StreamSinkImpl(this._target);
-
- void add(T data) {
- if (_isClosed) return;
- _controller.add(data);
- }
-
- void addError(error, [StackTrace stackTrace]) {
- _controller.addError(error, stackTrace);
- }
-
- Future addStream(Stream<T> stream) {
- if (_isBound) {
- throw new StateError("StreamSink is already bound to a stream");
- }
- _isBound = true;
- if (_hasError) return done;
- // Wait for any sync operations to complete.
- Future targetAddStream() {
- return _target.addStream(stream)
- .whenComplete(() {
- _isBound = false;
- });
- }
- if (_controllerInstance == null) return targetAddStream();
- var future = _controllerCompleter.future;
- _controllerInstance.close();
- return future.then((_) => targetAddStream());
- }
-
- Future flush() {
- if (_isBound) {
- throw new StateError("StreamSink is bound to a stream");
- }
- if (_controllerInstance == null) return new Future.value(this);
- // Adding an empty stream-controller will return a future that will complete
- // when all data is done.
- _isBound = true;
- var future = _controllerCompleter.future;
- _controllerInstance.close();
- return future.whenComplete(() {
- _isBound = false;
- });
- }
-
- Future close() {
- if (_isBound) {
- throw new StateError("StreamSink is bound to a stream");
- }
- if (!_isClosed) {
- _isClosed = true;
- if (_controllerInstance != null) {
- _controllerInstance.close();
- } else {
- _closeTarget();
- }
- }
- return done;
- }
-
- void _closeTarget() {
- _target.close().then(_completeDoneValue, onError: _completeDoneError);
- }
-
- Future get done => _doneCompleter.future;
-
- void _completeDoneValue(value) {
- if (!_doneCompleter.isCompleted) {
- _doneCompleter.complete(value);
- }
- }
-
- void _completeDoneError(error, StackTrace stackTrace) {
- if (!_doneCompleter.isCompleted) {
- _hasError = true;
- _doneCompleter.completeError(error, stackTrace);
- }
- }
-
- StreamController<T> get _controller {
- if (_isBound) {
- throw new StateError("StreamSink is bound to a stream");
- }
- if (_isClosed) {
- throw new StateError("StreamSink is closed");
- }
- if (_controllerInstance == null) {
- _controllerInstance = new StreamController<T>(sync: true);
- _controllerCompleter = new Completer();
- _target.addStream(_controller.stream).then((_) {
- if (_isBound) {
- // A new stream takes over - forward values to that stream.
- _controllerCompleter.complete(this);
- _controllerCompleter = null;
- _controllerInstance = null;
- } else {
- // No new stream, .close was called. Close _target.
- _closeTarget();
- }
- }, onError: (error, stackTrace) {
- if (_isBound) {
- // A new stream takes over - forward errors to that stream.
- _controllerCompleter.completeError(error, stackTrace);
- _controllerCompleter = null;
- _controllerInstance = null;
- } else {
- // No new stream. No need to close target, as it has already
- // failed.
- _completeDoneError(error, stackTrace);
- }
- });
- }
- return _controllerInstance;
- }
-}
-
-
-class _IOSinkImpl extends _StreamSinkImpl<List<int>> implements IOSink {
- Encoding _encoding;
- bool _encodingMutable = true;
-
- _IOSinkImpl(StreamConsumer<List<int>> target, this._encoding)
- : super(target);
-
- Encoding get encoding => _encoding;
-
- void set encoding(Encoding value) {
- if (!_encodingMutable) {
- throw new StateError("IOSink encoding is not mutable");
- }
- _encoding = value;
- }
-
- void write(Object obj) {
- String string = '$obj';
- if (string.isEmpty) return;
- add(_encoding.encode(string));
- }
-
- void writeAll(Iterable objects, [String separator = ""]) {
- Iterator iterator = objects.iterator;
- if (!iterator.moveNext()) return;
- if (separator.isEmpty) {
- do {
- write(iterator.current);
- } while (iterator.moveNext());
- } else {
- write(iterator.current);
- while (iterator.moveNext()) {
- write(separator);
- write(iterator.current);
- }
- }
- }
-
- void writeln([Object object = ""]) {
- write(object);
- write("\n");
- }
-
- void writeCharCode(int charCode) {
- write(new String.fromCharCode(charCode));
- }
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/io/io_sources.gypi b/pkg/dev_compiler/tool/input_sdk/lib/io/io_sources.gypi
deleted file mode 100644
index 10a6bf4..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/io/io_sources.gypi
+++ /dev/null
@@ -1,42 +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.
-
-{
- 'sources': [
- 'io.dart',
- # The above file needs to be first if additional parts are added to the lib.
- 'bytes_builder.dart',
- 'common.dart',
- 'crypto.dart',
- 'data_transformer.dart',
- 'directory.dart',
- 'directory_impl.dart',
- 'eventhandler.dart',
- 'file.dart',
- 'file_impl.dart',
- 'file_system_entity.dart',
- 'http.dart',
- 'http_date.dart',
- 'http_headers.dart',
- 'http_impl.dart',
- 'http_parser.dart',
- 'http_session.dart',
- 'io_resource_info.dart',
- 'io_sink.dart',
- 'io_service.dart',
- 'link.dart',
- 'platform.dart',
- 'platform_impl.dart',
- 'process.dart',
- 'service_object.dart',
- 'secure_server_socket.dart',
- 'secure_socket.dart',
- 'security_context.dart',
- 'socket.dart',
- 'stdio.dart',
- 'string_transformer.dart',
- 'websocket.dart',
- 'websocket_impl.dart',
- ],
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/io/link.dart b/pkg/dev_compiler/tool/input_sdk/lib/io/link.dart
deleted file mode 100644
index 25be38c..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/io/link.dart
+++ /dev/null
@@ -1,305 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-part of dart.io;
-
-/**
- * [Link] objects are references to filesystem links.
- *
- */
-abstract class Link implements FileSystemEntity {
- /**
- * Creates a Link object.
- */
- factory Link(String path) => new _Link(path);
-
- /**
- * Creates a [Link] object.
- *
- * If [path] is a relative path, it will be interpreted relative to the
- * current working directory (see [Directory.current]), when used.
- *
- * If [path] is an absolute path, it will be immune to changes to the
- * current working directory.
- */
- factory Link.fromUri(Uri uri) => new Link(uri.toFilePath());
-
- /**
- * Creates a symbolic link. Returns a [:Future<Link>:] that completes with
- * the link when it has been created. If the link exists,
- * the future will complete with an error.
- *
- * If [recursive] is false, the default, the link is created
- * only if all directories in its path exist.
- * If [recursive] is true, all non-existing path
- * components are created. The directories in the path of [target] are
- * not affected, unless they are also in [path].
- *
- * On the Windows platform, this will only work with directories, and the
- * target directory must exist. The link will be created as a Junction.
- * Only absolute links will be created, and relative paths to the target
- * will be converted to absolute paths by joining them with the path of the
- * directory the link is contained in.
- *
- * On other platforms, the posix symlink() call is used to make a symbolic
- * link containing the string [target]. If [target] is a relative path,
- * it will be interpreted relative to the directory containing the link.
- */
- Future<Link> create(String target, {bool recursive: false});
-
- /**
- * Synchronously create the link. Calling [createSync] on an existing link
- * will throw an exception.
- *
- * If [recursive] is false, the default, the link is created only if all
- * directories in its path exist. If [recursive] is true, all
- * non-existing path components are created. The directories in
- * the path of [target] are not affected, unless they are also in [path].
- *
- * On the Windows platform, this will only work with directories, and the
- * target directory must exist. The link will be created as a Junction.
- * Only absolute links will be created, and relative paths to the target
- * will be converted to absolute paths.
- *
- * On other platforms, the posix symlink() call is used to make a symbolic
- * link containing the string [target]. If [target] is a relative path,
- * it will be interpreted relative to the directory containing the link.
- */
- void createSync(String target, {bool recursive: false});
-
- /**
- * Synchronously updates the link. Calling [updateSync] on a non-existing link
- * will throw an exception.
- *
- * On the Windows platform, this will only work with directories, and the
- * target directory must exist.
- */
- void updateSync(String target);
-
- /**
- * Updates the link. Returns a [:Future<Link>:] that completes with the
- * link when it has been updated. Calling [update] on a non-existing link
- * will complete its returned future with an exception.
- *
- * On the Windows platform, this will only work with directories, and the
- * target directory must exist.
- */
- Future<Link> update(String target);
-
- Future<String> resolveSymbolicLinks();
-
- String resolveSymbolicLinksSync();
-
- /**
- * Renames this link. Returns a `Future<Link>` that completes
- * with a [Link] instance for the renamed link.
- *
- * If [newPath] identifies an existing link, that link is
- * replaced. If [newPath] identifies an existing file or directory,
- * the operation fails and the future completes with an exception.
- */
- Future<Link> rename(String newPath);
-
- /**
- * Synchronously renames this link. Returns a [Link]
- * instance for the renamed link.
- *
- * If [newPath] identifies an existing link, that link is
- * replaced. If [newPath] identifies an existing file or directory
- * the operation fails and an exception is thrown.
- */
- Link renameSync(String newPath);
-
- /**
- * Returns a [Link] instance whose path is the absolute path to [this].
- *
- * The absolute path is computed by prefixing
- * a relative path with the current working directory, and returning
- * an absolute path unchanged.
- */
- Link get absolute;
-
- /**
- * Gets the target of the link. Returns a future that completes with
- * the path to the target.
- *
- * If the returned target is a relative path, it is relative to the
- * directory containing the link.
- *
- * If the link does not exist, or is not a link, the future completes with
- * a FileSystemException.
- */
- Future<String> target();
-
- /**
- * Synchronously gets the target of the link. Returns the path to the target.
- *
- * If the returned target is a relative path, it is relative to the
- * directory containing the link.
- *
- * If the link does not exist, or is not a link, throws a FileSystemException.
- */
- String targetSync();
-}
-
-
-class _Link extends FileSystemEntity implements Link {
- final String path;
-
- _Link(this.path) {
- if (path is! String) {
- throw new ArgumentError('${Error.safeToString(path)} '
- 'is not a String');
- }
- }
-
- String toString() => "Link: '$path'";
-
- Future<bool> exists() => FileSystemEntity.isLink(path);
-
- bool existsSync() => FileSystemEntity.isLinkSync(path);
-
- Link get absolute => new Link(_absolutePath);
-
- Future<FileStat> stat() => FileStat.stat(path);
-
- FileStat statSync() => FileStat.statSync(path);
-
- Future<Link> create(String target, {bool recursive: false}) {
- if (Platform.isWindows) {
- target = _makeWindowsLinkTarget(target);
- }
- var result = recursive ? parent.create(recursive: true)
- : new Future.value(null);
- return result
- .then((_) => _IOService._dispatch(_FILE_CREATE_LINK, [path, target]))
- .then((response) {
- if (_isErrorResponse(response)) {
- throw _exceptionFromResponse(
- response, "Cannot create link to target '$target'", path);
- }
- return this;
- });
- }
-
- void createSync(String target, {bool recursive: false}) {
- if (recursive) {
- parent.createSync(recursive: true);
- }
- if (Platform.isWindows) {
- target = _makeWindowsLinkTarget(target);
- }
- var result = _File._createLink(path, target);
- throwIfError(result, "Cannot create link", path);
- }
-
- // Put target into the form "\??\C:\my\target\dir".
- String _makeWindowsLinkTarget(String target) {
- Uri base = new Uri.file('${Directory.current.path}\\');
- Uri link = new Uri.file(path);
- Uri destination = new Uri.file(target);
- String result = base.resolveUri(link).resolveUri(destination).toFilePath();
- if (result.length > 3 && result[1] == ':' && result[2] == '\\') {
- return '\\??\\$result';
- } else {
- throw new FileSystemException(
- 'Target $result of Link.create on Windows cannot be converted' +
- ' to start with a drive letter. Unexpected error.');
- }
- }
-
- void updateSync(String target) {
- // TODO(12414): Replace with atomic update, where supported by platform.
- // Atomically changing a link can be done by creating the new link, with
- // a different name, and using the rename() posix call to move it to
- // the old name atomically.
- deleteSync();
- createSync(target);
- }
-
- Future<Link> update(String target) {
- // TODO(12414): Replace with atomic update, where supported by platform.
- // Atomically changing a link can be done by creating the new link, with
- // a different name, and using the rename() posix call to move it to
- // the old name atomically.
- return delete().then((_) => create(target));
- }
-
- Future<Link> _delete({bool recursive: false}) {
- if (recursive) {
- return new Directory(path).delete(recursive: true).then((_) => this);
- }
- return _IOService._dispatch(_FILE_DELETE_LINK, [path]).then((response) {
- if (_isErrorResponse(response)) {
- throw _exceptionFromResponse(response, "Cannot delete link", path);
- }
- return this;
- });
- }
-
- void _deleteSync({bool recursive: false}) {
- if (recursive) {
- return new Directory(path).deleteSync(recursive: true);
- }
- var result = _File._deleteLinkNative(path);
- throwIfError(result, "Cannot delete link", path);
- }
-
- Future<Link> rename(String newPath) {
- return _IOService._dispatch(_FILE_RENAME_LINK, [path, newPath])
- .then((response) {
- if (_isErrorResponse(response)) {
- throw _exceptionFromResponse(
- response, "Cannot rename link to '$newPath'", path);
- }
- return new Link(newPath);
- });
- }
-
- Link renameSync(String newPath) {
- var result = _File._renameLink(path, newPath);
- throwIfError(result, "Cannot rename link '$path' to '$newPath'");
- return new Link(newPath);
- }
-
- Future<String> target() {
- return _IOService._dispatch(_FILE_LINK_TARGET, [path]).then((response) {
- if (_isErrorResponse(response)) {
- throw _exceptionFromResponse(
- response, "Cannot get target of link", path);
- }
- return response;
- });
- }
-
- String targetSync() {
- var result = _File._linkTarget(path);
- throwIfError(result, "Cannot read link", path);
- return result;
- }
-
- static throwIfError(Object result, String msg, [String path = ""]) {
- if (result is OSError) {
- throw new FileSystemException(msg, path, result);
- }
- }
-
- bool _isErrorResponse(response) {
- return response is List && response[0] != _SUCCESS_RESPONSE;
- }
-
- _exceptionFromResponse(response, String message, String path) {
- assert(_isErrorResponse(response));
- switch (response[_ERROR_RESPONSE_ERROR_TYPE]) {
- case _ILLEGAL_ARGUMENT_RESPONSE:
- return new ArgumentError();
- case _OSERROR_RESPONSE:
- var err = new OSError(response[_OSERROR_RESPONSE_MESSAGE],
- response[_OSERROR_RESPONSE_ERROR_CODE]);
- return new FileSystemException(message, path, err);
- default:
- return new Exception("Unknown error");
- }
- }
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/io/platform.dart b/pkg/dev_compiler/tool/input_sdk/lib/io/platform.dart
deleted file mode 100644
index d881ce5..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/io/platform.dart
+++ /dev/null
@@ -1,210 +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.
-
-part of dart.io;
-
-/**
- * Information about the environment in which the current program is running.
- *
- * Platform provides information such as the operating system,
- * the hostname of the computer, the value of environment variables,
- * the path to the running program,
- * and so on.
- *
- * ## Get the URI to the current Dart script
- *
- * Use the [script] getter to get the URI to the currently running
- * Dart script.
- *
- * import 'dart:io' show Platform;
- *
- * void main() {
- * // Get the URI of the script being run.
- * var uri = Platform.script;
- * // Convert the URI to a path.
- * var path = uri.toFilePath();
- * }
- *
- * ## Get the value of an environment variable
- *
- * The [environment] getter returns a the names and values of environment
- * variables in a [Map] that contains key-value pairs of strings. The Map is
- * unmodifiable. This sample shows how to get the value of the `PATH`
- * environment variable.
- *
- * import 'dart:io' show Platform;
- *
- * void main() {
- * Map<String, String> envVars = Platform.environment;
- * print(envVars['PATH']);
- * }
- *
- * ## Determine the OS
- *
- * You can get the name of the operating system as a string with the
- * [operatingSystem] getter. You can also use one of the static boolean
- * getters: [isMacOS], [isLinux], and [isWindows].
- *
- * import 'dart:io' show Platform, stdout;
- *
- * void main() {
- * // Get the operating system as a string.
- * String os = Platform.operatingSystem;
- * // Or, use a predicate getter.
- * if (Platform.isMacOS) {
- * print('is a Mac');
- * } else {
- * print('is not a Mac');
- * }
- * }
- *
- * ## Other resources
- *
- * [Dart by Example](https://www.dartlang.org/dart-by-example/#dart-io-and-command-line-apps)
- * provides additional task-oriented code samples that show how to use
- * various API from the [dart:io] library.
- */
-class Platform {
- static final _numberOfProcessors = _Platform.numberOfProcessors;
- static final _pathSeparator = _Platform.pathSeparator;
- static final _operatingSystem = _Platform.operatingSystem;
- static final _localHostname = _Platform.localHostname;
- static final _version = _Platform.version;
-
- /**
- * Get the number of processors of the machine.
- */
- static int get numberOfProcessors => _numberOfProcessors;
-
- /**
- * Get the path separator used by the operating system to separate
- * components in file paths.
- */
- static String get pathSeparator => _pathSeparator;
-
- /**
- * Get a string (`linux`, `macos`, `windows`, `android`, or `ios`)
- * representing the operating system.
- */
- static String get operatingSystem => _operatingSystem;
-
- /**
- * Get the local hostname for the system.
- */
- static String get localHostname => _localHostname;
-
- /**
- * Returns true if the operating system is Linux.
- */
- static final bool isLinux = (_operatingSystem == "linux");
-
- /**
- * Returns true if the operating system is OS X.
- */
- static final bool isMacOS = (_operatingSystem == "macos");
-
- /**
- * Returns true if the operating system is Windows.
- */
- static final bool isWindows = (_operatingSystem == "windows");
-
- /**
- * Returns true if the operating system is Android.
- */
- static final bool isAndroid = (_operatingSystem == "android");
-
- /**
- * Returns true if the operating system is iOS.
- */
- static final bool isIOS = (_operatingSystem == "ios");
-
- /**
- * Get the environment for this process.
- *
- * The returned environment is an unmodifiable map which content is
- * retrieved from the operating system on its first use.
- *
- * Environment variables on Windows are case-insensitive. The map
- * returned on Windows is therefore case-insensitive and will convert
- * all keys to upper case. On other platforms the returned map is
- * a standard case-sensitive map.
- */
- static Map<String, String> get environment => _Platform.environment;
-
- /**
- * Returns the path of the executable used to run the script in this
- * isolate.
- *
- * The path returned is the literal path used to run the script. This
- * path might be relative or just be a name from which the executable
- * was found by searching the `PATH`.
- *
- * To get the absolute path to the resolved executable use
- * [resolvedExecutable].
- */
- static String get executable => _Platform.executable;
-
- /**
- * Returns the path of the executable used to run the script in this
- * isolate after it has been resolved by the OS.
- *
- * This is the absolute path, with all symlinks resolved, to the
- * executable used to run the script.
- */
- static String get resolvedExecutable => _Platform.resolvedExecutable;
-
- /**
- * Returns the absolute URI of the script being run in this
- * isolate.
- *
- * If the script argument on the command line is relative,
- * it is resolved to an absolute URI before fetching the script, and
- * this absolute URI is returned.
- *
- * URI resolution only does string manipulation on the script path, and this
- * may be different from the file system's path resolution behavior. For
- * example, a symbolic link immediately followed by '..' will not be
- * looked up.
- *
- * If the executable environment does not support [script] an empty
- * [Uri] is returned.
- */
- static Uri get script => _Platform.script;
-
- /**
- * Returns the flags passed to the executable used to run the script in this
- * isolate. These are the command-line flags between the executable name
- * and the script name. Each fetch of executableArguments returns a new
- * List, containing the flags passed to the executable.
- */
- static List<String> get executableArguments => _Platform.executableArguments;
-
- /**
- * Returns the value of the `--package-root` flag passed to the executable
- * used to run the script in this isolate. This is the directory in which
- * Dart packages are looked up.
- *
- * If there is no `--package-root` flag, `null` is returned.
- */
- static String get packageRoot => _Platform.packageRoot;
-
-/**
- * Returns the value of the `--packages` flag passed to the executable
- * used to run the script in this isolate. This is the configuration which
- * specifies how Dart packages are looked up.
- *
- * If there is no `--packages` flag, `null` is returned.
- */
- static String get packageConfig => _Platform.packageConfig;
-
- /**
- * Returns the version of the current Dart runtime.
- *
- * The returned `String` is formatted as the
- * [semver](http://semver.org) version string of the current dart
- * runtime, possibly followed by whitespace and other version and
- * build details.
- */
- static String get version => _version;
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/io/platform_impl.dart b/pkg/dev_compiler/tool/input_sdk/lib/io/platform_impl.dart
deleted file mode 100644
index 4ce43ea..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/io/platform_impl.dart
+++ /dev/null
@@ -1,121 +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.
-
-part of dart.io;
-
-class _Platform {
- external static int _numberOfProcessors();
- external static String _pathSeparator();
- external static String _operatingSystem();
- external static _localHostname();
- external static _executable();
- external static _resolvedExecutable();
- /**
- * Retrieve the entries of the process environment.
- *
- * The result is an [Iterable] of strings, where each string represents
- * an environment entry.
- *
- * Environment entries should be strings containing
- * a non-empty name and a value separated by a '=' character.
- * The name does not contain a '=' character,
- * so the name is everything up to the first '=' character.
- * Values are everything after the first '=' charcacter.
- * A value may contain further '=' characters, and it may be empty.
- *
- * Returns an [OSError] if retrieving the environment fails.
- */
- external static _environment();
- external static List<String> _executableArguments();
- external static String _packageRoot();
- external static String _packageConfig();
- external static String _version();
-
- static String executable = _executable();
- static String resolvedExecutable = _resolvedExecutable();
- static String packageRoot = _packageRoot();
- static String packageConfig = _packageConfig();
-
- // Cache the OS environemnt. This can be an OSError instance if
- // retrieving the environment failed.
- static var _environmentCache;
-
- static int get numberOfProcessors => _numberOfProcessors();
- static String get pathSeparator => _pathSeparator();
- static String get operatingSystem => _operatingSystem();
- static Uri script;
-
- static String get localHostname {
- var result = _localHostname();
- if (result is OSError) {
- throw result;
- } else {
- return result;
- }
- }
-
- static List<String> get executableArguments => _executableArguments();
-
- static Map<String, String> get environment {
- if (_environmentCache == null) {
- var env = _environment();
- if (env is !OSError) {
- var isWindows = operatingSystem == 'windows';
- var result = isWindows ? new _CaseInsensitiveStringMap() : new Map();
- for (var str in env) {
- // The Strings returned by [_environment()] are expected to be
- // valid environment entries, but exceptions have been seen
- // (e.g., an entry of just '=' has been seen on OS/X).
- // Invalid entries (lines without a '=' or with an empty name)
- // are discarded.
- var equalsIndex = str.indexOf('=');
- if (equalsIndex > 0) {
- result[str.substring(0, equalsIndex)] =
- str.substring(equalsIndex + 1);
- }
- }
- _environmentCache = new UnmodifiableMapView<String, String>(result);
- } else {
- _environmentCache = env;
- }
- }
-
- if (_environmentCache is OSError) {
- throw _environmentCache;
- } else {
- return _environmentCache;
- }
- }
-
- static String get version => _version();
-}
-
-// Environment variables are case-insensitive on Windows. In order
-// to reflect that we use a case-insensitive string map on Windows.
-class _CaseInsensitiveStringMap<V> implements Map<String, V> {
- final Map<String, V> _map = new Map<String, V>();
-
- bool containsKey(Object key) =>
- key is String && _map.containsKey(key.toUpperCase());
- bool containsValue(Object value) => _map.containsValue(value);
- V operator [](Object key) => key is String ? _map[key.toUpperCase()] : null;
- void operator []=(String key, V value) {
- _map[key.toUpperCase()] = value;
- }
- V putIfAbsent(String key, V ifAbsent()) {
- return _map.putIfAbsent(key.toUpperCase(), ifAbsent);
- }
- void addAll(Map other) {
- other.forEach((key, value) => this[key.toUpperCase()] = value);
- }
- V remove(Object key) => key is String ? _map.remove(key.toUpperCase()) : null;
- void clear() { _map.clear(); }
- void forEach(void f(String key, V value)) { _map.forEach(f); }
- Iterable<String> get keys => _map.keys;
- Iterable<V> get values => _map.values;
- int get length => _map.length;
- bool get isEmpty => _map.isEmpty;
- bool get isNotEmpty => _map.isNotEmpty;
- String toString() => _map.toString();
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/io/process.dart b/pkg/dev_compiler/tool/input_sdk/lib/io/process.dart
deleted file mode 100644
index 93aa63e..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/io/process.dart
+++ /dev/null
@@ -1,581 +0,0 @@
-// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-part of dart.io;
-
-// TODO(ager): The only reason for this class is that we
-// cannot patch a top-level at this point.
-class _ProcessUtils {
- external static void _exit(int status);
- external static void _setExitCode(int status);
- external static int _getExitCode();
- external static void _sleep(int millis);
- external static int _pid(Process process);
- external static Stream<ProcessSignal> _watchSignal(ProcessSignal signal);
-}
-
-/**
- * Exit the Dart VM process immediately with the given exit code.
- *
- * This does not wait for any asynchronous operations to terminate. Using
- * [exit] is therefore very likely to lose data.
- *
- * The handling of exit codes is platform specific.
- *
- * On Linux and OS X an exit code for normal termination will always
- * be in the range [0..255]. If an exit code outside this range is
- * set the actual exit code will be the lower 8 bits masked off and
- * treated as an unsigned value. E.g. using an exit code of -1 will
- * result in an actual exit code of 255 being reported.
- *
- * On Windows the exit code can be set to any 32-bit value. However
- * some of these values are reserved for reporting system errors like
- * crashes.
- *
- * Besides this the Dart executable itself uses an exit code of `254`
- * for reporting compile time errors and an exit code of `255` for
- * reporting runtime error (unhandled exception).
- *
- * Due to these facts it is recommended to only use exit codes in the
- * range [0..127] for communicating the result of running a Dart
- * program to the surrounding environment. This will avoid any
- * cross-platform issues.
- */
-void exit(int code) {
- if (code is !int) {
- throw new ArgumentError("Integer value for exit code expected");
- }
- _ProcessUtils._exit(code);
-}
-
-/**
- * Set the global exit code for the Dart VM.
- *
- * The exit code is global for the Dart VM and the last assignment to
- * exitCode from any isolate determines the exit code of the Dart VM
- * on normal termination.
- *
- * Default value is `0`.
- *
- * See [exit] for more information on how to chose a value for the
- * exit code.
- */
-void set exitCode(int code) {
- if (code is !int) {
- throw new ArgumentError("Integer value for exit code expected");
- }
- _ProcessUtils._setExitCode(code);
-}
-
-/**
- * Get the global exit code for the Dart VM.
- *
- * The exit code is global for the Dart VM and the last assignment to
- * exitCode from any isolate determines the exit code of the Dart VM
- * on normal termination.
- *
- * See [exit] for more information on how to chose a value for the
- * exit code.
- */
-int get exitCode => _ProcessUtils._getExitCode();
-
-/**
- * Sleep for the duration specified in [duration].
- *
- * Use this with care, as no asynchronous operations can be processed
- * in a isolate while it is blocked in a [sleep] call.
- */
-void sleep(Duration duration) {
- int milliseconds = duration.inMilliseconds;
- if (milliseconds < 0) {
- throw new ArgumentError("sleep: duration cannot be negative");
- }
- _ProcessUtils._sleep(milliseconds);
-}
-
-/**
- * Returns the PID of the current process.
- */
-int get pid => _ProcessUtils._pid(null);
-
-/**
- * Modes for running a new process.
- */
-enum ProcessStartMode {
- /// Normal child process.
- NORMAL,
- /// Detached child process with no open communication channel.
- DETACHED,
- /// Detached child process with stdin, stdout and stderr still open
- /// for communication with the child.
- DETACHED_WITH_STDIO
-}
-
-/**
- * The means to execute a program.
- *
- * Use the static [start] and [run] methods to start a new process.
- * The run method executes the process non-interactively to completion.
- * In contrast, the start method allows your code to interact with the
- * running process.
- *
- * ## Start a process with the run method
- *
- * The following code sample uses the run method to create a process
- * that runs the UNIX command `ls`, which lists the contents of a directory.
- * The run method completes with a [ProcessResult] object when the process
- * terminates. This provides access to the output and exit code from the
- * process. The run method does not return a Process object; this prevents your
- * code from interacting with the running process.
- *
- * import 'dart:io';
- *
- * main() {
- * // List all files in the current directory in UNIX-like systems.
- * Process.run('ls', ['-l']).then((ProcessResult results) {
- * print(results.stdout);
- * });
- * }
- *
- * ## Start a process with the start method
- *
- * The following example uses start to create the process.
- * The start method returns a [Future] for a Process object.
- * When the future completes the process is started and
- * your code can interact with the
- * Process: writing to stdin, listening to stdout, and so on.
- *
- * The following sample starts the UNIX `cat` utility, which when given no
- * command-line arguments, echos its input.
- * The program writes to the process's standard input stream
- * and prints data from its standard output stream.
- *
- * import 'dart:io';
- * import 'dart:convert';
- *
- * main() {
- * Process.start('cat', []).then((Process process) {
- * process.stdout
- * .transform(UTF8.decoder)
- * .listen((data) { print(data); });
- * process.stdin.writeln('Hello, world!');
- * process.stdin.writeln('Hello, galaxy!');
- * process.stdin.writeln('Hello, universe!');
- * });
- * }
- *
- * ## Standard I/O streams
- *
- * As seen in the previous code sample, you can interact with the Process's
- * standard output stream through the getter [stdout],
- * and you can interact with the Process's standard input stream through
- * the getter [stdin].
- * In addition, Process provides a getter [stderr] for using the Process's
- * standard error stream.
- *
- * A Process's streams are distinct from the top-level streams
- * for the current program.
- *
- * ## Exit codes
- *
- * Call the [exitCode] method to get the exit code of the process.
- * The exit code indicates whether the program terminated successfully
- * (usually indicated with an exit code of 0) or with an error.
- *
- * If the start method is used, the exitCode is available through a future
- * on the Process object (as shown in the example below).
- * If the run method is used, the exitCode is available
- * through a getter on the ProcessResult instance.
- *
- * import 'dart:io';
- *
- * main() {
- * Process.start('ls', ['-l']).then((process) {
- * // Get the exit code from the new process.
- * process.exitCode.then((exitCode) {
- * print('exit code: $exitCode');
- * });
- * });
- * }
- *
- * ## Other resources
- *
- * [Dart by Example](https://www.dartlang.org/dart-by-example/#dart-io-and-command-line-apps)
- * provides additional task-oriented code samples that show how to use
- * various API from the [dart:io] library.
- */
-abstract class Process {
- /**
- * Returns a [:Future:] which completes with the exit code of the process
- * when the process completes.
- *
- * The handling of exit codes is platform specific.
- *
- * On Linux and OS X a normal exit code will be a positive value in
- * the range [0..255]. If the process was terminated due to a signal
- * the exit code will be a negative value in the range [-255..-1],
- * where the absolute value of the exit code is the signal
- * number. For example, if a process crashes due to a segmentation
- * violation the exit code will be -11, as the signal SIGSEGV has the
- * number 11.
- *
- * On Windows a process can report any 32-bit value as an exit
- * code. When returning the exit code this exit code is turned into
- * a signed value. Some special values are used to report
- * termination due to some system event. E.g. if a process crashes
- * due to an access violation the 32-bit exit code is `0xc0000005`,
- * which will be returned as the negative number `-1073741819`. To
- * get the original 32-bit value use `(0x100000000 + exitCode) &
- * 0xffffffff`.
- */
- Future<int> exitCode;
-
- /**
- * Starts a process running the [executable] with the specified
- * [arguments]. Returns a [:Future<Process>:] that completes with a
- * Process instance when the process has been successfully
- * started. That [Process] object can be used to interact with the
- * process. If the process cannot be started the returned [Future]
- * completes with an exception.
- *
- * Use [workingDirectory] to set the working directory for the process. Note
- * that the change of directory occurs before executing the process on some
- * platforms, which may have impact when using relative paths for the
- * executable and the arguments.
- *
- * Use [environment] to set the environment variables for the process. If not
- * set the environment of the parent process is inherited. Currently, only
- * US-ASCII environment variables are supported and errors are likely to occur
- * if an environment variable with code-points outside the US-ASCII range is
- * passed in.
- *
- * If [includeParentEnvironment] is `true`, the process's environment will
- * include the parent process's environment, with [environment] taking
- * precedence. Default is `true`.
- *
- * If [runInShell] is `true`, the process will be spawned through a system
- * shell. On Linux and OS X, [:/bin/sh:] is used, while
- * [:%WINDIR%\system32\cmd.exe:] is used on Windows.
- *
- * 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 released since there is still pending data.
- *
- * The following code uses `Process.start` to grep for `main` in the
- * file `test.dart` on Linux.
- *
- * Process.start('grep', ['-i', 'main', 'test.dart']).then((process) {
- * stdout.addStream(process.stdout);
- * stderr.addStream(process.stderr);
- * });
- *
- * If [mode] is [ProcessStartMode.NORMAL] (the default) a child
- * process will be started with `stdin`, `stdout` and `stderr`
- * connected.
- *
- * If `mode` is [ProcessStartMode.DETACHED] a detached process will
- * be created. A detached process has no connection to its parent,
- * and can keep running on its own when the parent dies. The only
- * information available from a detached process is its `pid`. There
- * is no connection to its `stdin`, `stdout` or `stderr`, nor will
- * the process' exit code become available when it terminates.
- *
- * If `mode` is [ProcessStartMode.DETACHED_WITH_STDIO] a detached
- * process will be created where the `stdin`, `stdout` and `stderr`
- * are connected. The creator can communicate with the child through
- * these. The detached process will keep running even if these
- * communication channels are closed. The process' exit code will
- * not become available when it terminated.
- *
- * The default value for `mode` is `ProcessStartMode.NORMAL`.
- */
- external static Future<Process> start(
- String executable,
- List<String> arguments,
- {String workingDirectory,
- Map<String, String> environment,
- bool includeParentEnvironment: true,
- bool runInShell: false,
- ProcessStartMode mode: ProcessStartMode.NORMAL});
-
- /**
- * Starts a process and runs it non-interactively to completion. The
- * process run is [executable] with the specified [arguments].
- *
- * Use [workingDirectory] to set the working directory for the process. Note
- * that the change of directory occurs before executing the process on some
- * platforms, which may have impact when using relative paths for the
- * executable and the arguments.
- *
- * Use [environment] to set the environment variables for the process. If not
- * set the environment of the parent process is inherited. Currently, only
- * US-ASCII environment variables are supported and errors are likely to occur
- * if an environment variable with code-points outside the US-ASCII range is
- * passed in.
- *
- * If [includeParentEnvironment] is `true`, the process's environment will
- * include the parent process's environment, with [environment] taking
- * precedence. Default is `true`.
- *
- * If [runInShell] is true, the process will be spawned through a system
- * shell. On Linux and OS X, `/bin/sh` is used, while
- * `%WINDIR%\system32\cmd.exe` is used on Windows.
- *
- * The encoding used for decoding `stdout` and `stderr` into text is
- * controlled through [stdoutEncoding] and [stderrEncoding]. The
- * default encoding is [SYSTEM_ENCODING]. If `null` is used no
- * decoding will happen and the [ProcessResult] will hold binary
- * data.
- *
- * Returns a `Future<ProcessResult>` that completes with the
- * result of running the process, i.e., exit code, standard out and
- * standard in.
- *
- * The following code uses `Process.run` to grep for `main` in the
- * file `test.dart` on Linux.
- *
- * Process.run('grep', ['-i', 'main', 'test.dart']).then((result) {
- * stdout.write(result.stdout);
- * stderr.write(result.stderr);
- * });
- */
- external static Future<ProcessResult> run(
- String executable,
- List<String> arguments,
- {String workingDirectory,
- Map<String, String> environment,
- bool includeParentEnvironment: true,
- bool runInShell: false,
- Encoding stdoutEncoding: SYSTEM_ENCODING,
- Encoding stderrEncoding: SYSTEM_ENCODING});
-
-
- /**
- * Starts a process and runs it to completion. This is a synchronous
- * call and will block until the child process terminates.
- *
- * The arguments are the same as for `Process.run`.
- *
- * Returns a `ProcessResult` with the result of running the process,
- * i.e., exit code, standard out and standard in.
- */
- external static ProcessResult runSync(
- String executable,
- List<String> arguments,
- {String workingDirectory,
- Map<String, String> environment,
- bool includeParentEnvironment: true,
- bool runInShell: false,
- Encoding stdoutEncoding: SYSTEM_ENCODING,
- Encoding stderrEncoding: SYSTEM_ENCODING});
-
- /**
- * Kills the process with id [pid].
- *
- * Where possible, sends the [signal] to the process with id
- * `pid`. This includes Linux and OS X. The default signal is
- * [ProcessSignal.SIGTERM] which will normally terminate the
- * process.
- *
- * On platforms without signal support, including Windows, the call
- * just terminates the process with id `pid` in a platform specific
- * way, and the `signal` parameter is ignored.
- *
- * Returns `true` if the signal is successfully delivered to the
- * process. Otherwise the signal could not be sent, usually meaning
- * that the process is already dead.
- */
- external static bool killPid(
- int pid, [ProcessSignal signal = ProcessSignal.SIGTERM]);
-
- /**
- * Returns the standard output stream of the process as a [:Stream:].
- */
- Stream<List<int>> get stdout;
-
- /**
- * Returns the standard error stream of the process as a [:Stream:].
- */
- Stream<List<int>> get stderr;
-
- /**
- * Returns the standard input stream of the process as an [IOSink].
- */
- IOSink get stdin;
-
- /**
- * Returns the process id of the process.
- */
- int get pid;
-
- /**
- * Kills the process.
- *
- * Where possible, sends the [signal] to the process. This includes
- * Linux and OS X. The default signal is [ProcessSignal.SIGTERM]
- * which will normally terminate the process.
- *
- * On platforms without signal support, including Windows, the call
- * just terminates the process in a platform specific way, and the
- * `signal` parameter is ignored.
- *
- * Returns `true` if the signal is successfully delivered to the
- * process. Otherwise the signal could not be sent, usually meaning
- * that the process is already dead.
- */
- bool kill([ProcessSignal signal = ProcessSignal.SIGTERM]);
-}
-
-
-/**
- * [ProcessResult] represents the result of running a non-interactive
- * process started with [Process.run] or [Process.runSync].
- */
-class ProcessResult {
- /**
- * Exit code for the process.
- *
- * See [Process.exitCode] for more information in the exit code
- * value.
- */
- final int exitCode;
-
- /**
- * Standard output from the process. The value used for the
- * `stdoutEncoding` argument to `Process.run` determines the type. If
- * `null` was used this value is of type `List<int> otherwise it is
- * of type `String`.
- */
- final stdout;
-
- /**
- * Standard error from the process. The value used for the
- * `stderrEncoding` argument to `Process.run` determines the type. If
- * `null` was used this value is of type `List<int>
- * otherwise it is of type `String`.
- */
- final stderr;
-
- /**
- * Process id of the process.
- */
- final int pid;
-
- ProcessResult(this.pid, this.exitCode, this.stdout, this.stderr);
-}
-
-
-/**
- * On Posix systems, [ProcessSignal] is used to send a specific signal
- * to a child process, see [:Process.kill:].
- *
- * Some [ProcessSignal]s can also be watched, as a way to intercept the default
- * signal handler and implement another. See [ProcessSignal.watch] for more
- * information.
- */
-class ProcessSignal {
- static const ProcessSignal SIGHUP = const ProcessSignal._(1, "SIGHUP");
- static const ProcessSignal SIGINT = const ProcessSignal._(2, "SIGINT");
- static const ProcessSignal SIGQUIT = const ProcessSignal._(3, "SIGQUIT");
- static const ProcessSignal SIGILL = const ProcessSignal._(4, "SIGILL");
- static const ProcessSignal SIGTRAP = const ProcessSignal._(5, "SIGTRAP");
- static const ProcessSignal SIGABRT = const ProcessSignal._(6, "SIGABRT");
- static const ProcessSignal SIGBUS = const ProcessSignal._(7, "SIGBUS");
- static const ProcessSignal SIGFPE = const ProcessSignal._(8, "SIGFPE");
- static const ProcessSignal SIGKILL = const ProcessSignal._(9, "SIGKILL");
- static const ProcessSignal SIGUSR1 = const ProcessSignal._(10, "SIGUSR1");
- static const ProcessSignal SIGSEGV = const ProcessSignal._(11, "SIGSEGV");
- static const ProcessSignal SIGUSR2 = const ProcessSignal._(12, "SIGUSR2");
- static const ProcessSignal SIGPIPE = const ProcessSignal._(13, "SIGPIPE");
- static const ProcessSignal SIGALRM = const ProcessSignal._(14, "SIGALRM");
- static const ProcessSignal SIGTERM = const ProcessSignal._(15, "SIGTERM");
- static const ProcessSignal SIGCHLD = const ProcessSignal._(17, "SIGCHLD");
- static const ProcessSignal SIGCONT = const ProcessSignal._(18, "SIGCONT");
- static const ProcessSignal SIGSTOP = const ProcessSignal._(19, "SIGSTOP");
- static const ProcessSignal SIGTSTP = const ProcessSignal._(20, "SIGTSTP");
- static const ProcessSignal SIGTTIN = const ProcessSignal._(21, "SIGTTIN");
- static const ProcessSignal SIGTTOU = const ProcessSignal._(22, "SIGTTOU");
- static const ProcessSignal SIGURG = const ProcessSignal._(23, "SIGURG");
- static const ProcessSignal SIGXCPU = const ProcessSignal._(24, "SIGXCPU");
- static const ProcessSignal SIGXFSZ = const ProcessSignal._(25, "SIGXFSZ");
- static const ProcessSignal SIGVTALRM = const ProcessSignal._(26, "SIGVTALRM");
- static const ProcessSignal SIGPROF = const ProcessSignal._(27, "SIGPROF");
- static const ProcessSignal SIGWINCH = const ProcessSignal._(28, "SIGWINCH");
- static const ProcessSignal SIGPOLL = const ProcessSignal._(29, "SIGPOLL");
- static const ProcessSignal SIGSYS = const ProcessSignal._(31, "SIGSYS");
-
- final int _signalNumber;
- final String _name;
-
- const ProcessSignal._(this._signalNumber, this._name);
-
- String toString() => _name;
-
- /**
- * Watch for process signals.
- *
- * The following [ProcessSignal]s can be listened to:
- *
- * * [ProcessSignal.SIGHUP].
- * * [ProcessSignal.SIGINT]. Signal sent by e.g. CTRL-C.
- * * [ProcessSignal.SIGTERM]. Not available on Windows.
- * * [ProcessSignal.SIGUSR1]. Not available on Windows.
- * * [ProcessSignal.SIGUSR2]. Not available on Windows.
- * * [ProcessSignal.SIGWINCH]. Not available on Windows.
- *
- * Other signals are disallowed, as they may be used by the VM.
- *
- * A signal can be watched multiple times, from multiple isolates, where all
- * callbacks are invoked when signaled, in no specific order.
- */
- Stream<ProcessSignal> watch() => _ProcessUtils._watchSignal(this);
-}
-
-
-class SignalException implements IOException {
- final String message;
- final osError;
-
- const SignalException(this.message, [this.osError = null]);
-
- String toString() {
- var msg = "";
- if (osError != null) {
- msg = ", osError: $osError";
- }
- return "SignalException: $message$msg";
- }
-}
-
-
-class ProcessException implements IOException {
- /**
- * Contains the executable provided for the process.
- */
- final String executable;
-
- /**
- * Contains the arguments provided for the process.
- */
- final List<String> arguments;
-
- /**
- * Contains the system message for the process exception if any.
- */
- final String message;
-
- /**
- * Contains the OS error code for the process exception if any.
- */
- final int errorCode;
-
- const ProcessException(this.executable, this.arguments, [this.message = "",
- this.errorCode = 0]);
- String toString() {
- var msg = (message == null) ? 'OS error code: $errorCode' : message;
- var args = arguments.join(' ');
- return "ProcessException: $msg\n Command: $executable $args";
- }
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/io/secure_server_socket.dart b/pkg/dev_compiler/tool/input_sdk/lib/io/secure_server_socket.dart
deleted file mode 100644
index 2fbc5b1..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/io/secure_server_socket.dart
+++ /dev/null
@@ -1,295 +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.
-
-part of dart.io;
-
-/**
- * The [SecureServerSocket] is a server socket, providing a stream of high-level
- * [Socket]s.
- *
- * See [SecureSocket] for more info.
- */
-class SecureServerSocket extends Stream<SecureSocket> {
- final RawSecureServerSocket _socket;
-
- SecureServerSocket._(this._socket);
-
- /**
- * Returns a future for a [SecureServerSocket]. When the future
- * completes the server socket is bound to the given [address] and
- * [port] and has started listening on it.
- *
- * The [address] can either be a [String] or an
- * [InternetAddress]. If [address] is a [String], [bind] will
- * perform a [InternetAddress.lookup] and use the first value in the
- * list. To listen on the loopback adapter, which will allow only
- * incoming connections from the local host, use the value
- * [InternetAddress.LOOPBACK_IP_V4] or
- * [InternetAddress.LOOPBACK_IP_V6]. To allow for incoming
- * connection from the network use either one of the values
- * [InternetAddress.ANY_IP_V4] or [InternetAddress.ANY_IP_V6] to
- * bind to all interfaces or the IP address of a specific interface.
- *
- * If [port] has the value [:0:] an ephemeral port will be chosen by
- * the system. The actual port used can be retrieved using the
- * [port] getter.
- *
- * The optional argument [backlog] can be used to specify the listen
- * backlog for the underlying OS listen setup. If [backlog] has the
- * value of [:0:] (the default) a reasonable value will be chosen by
- * the system.
- *
- * Incoming client connections are promoted to secure connections, using
- * the server certificate and key set in [context].
- *
- * [address] must be given as a numeric address, not a host name.
- *
- * To request or require that clients authenticate by providing an SSL (TLS)
- * client certificate, set the optional parameter [requestClientCertificate]
- * or [requireClientCertificate] to true. Requiring a certificate implies
- * requesting a certificate, so setting both is redundant.
- * To check whether a client certificate was received, check
- * SecureSocket.peerCertificate after connecting. If no certificate
- * was received, the result will be null.
- *
- * The optional argument [shared] specifies whether additional
- * SecureServerSocket objects can bind to the same combination of `address`,
- * `port` and `v6Only`. If `shared` is `true` and more `SecureServerSocket`s
- * from this isolate or other isolates are bound to the port, then the
- * incoming connections will be distributed among all the bound
- * `SecureServerSocket`s. Connections can be distributed over multiple
- * isolates this way.
- */
- static Future<SecureServerSocket> bind(
- address,
- int port,
- SecurityContext context,
- {int backlog: 0,
- bool v6Only: false,
- bool requestClientCertificate: false,
- bool requireClientCertificate: false,
- List<String> supportedProtocols,
- bool shared: false}) {
- return RawSecureServerSocket.bind(
- address,
- port,
- context,
- backlog: backlog,
- v6Only: v6Only,
- requestClientCertificate: requestClientCertificate,
- requireClientCertificate: requireClientCertificate,
- supportedProtocols: supportedProtocols,
- shared: shared).then(
- (serverSocket) => new SecureServerSocket._(serverSocket));
- }
-
- StreamSubscription<SecureSocket> listen(void onData(SecureSocket socket),
- {Function onError,
- void onDone(),
- bool cancelOnError}) {
- return _socket.map((rawSocket) => new SecureSocket._(rawSocket))
- .listen(onData,
- onError: onError,
- onDone: onDone,
- cancelOnError: cancelOnError);
- }
-
- /**
- * Returns the port used by this socket.
- */
- int get port => _socket.port;
-
- /**
- * Returns the address used by this socket.
- */
- InternetAddress get address => _socket.address;
-
- /**
- * Closes the socket. The returned future completes when the socket
- * is fully closed and is no longer bound.
- */
- Future<SecureServerSocket> close() => _socket.close().then((_) => this);
-
- void set _owner(owner) { _socket._owner = owner; }
-}
-
-
-/**
- * The RawSecureServerSocket is a server socket, providing a stream of low-level
- * [RawSecureSocket]s.
- *
- * See [RawSecureSocket] for more info.
- */
-class RawSecureServerSocket extends Stream<RawSecureSocket> {
- final RawServerSocket _socket;
- StreamController<RawSecureSocket> _controller;
- StreamSubscription<RawSocket> _subscription;
- final SecurityContext _context;
- final bool requestClientCertificate;
- final bool requireClientCertificate;
- final List<String> supportedProtocols;
- bool _closed = false;
-
- RawSecureServerSocket._(this._socket,
- this._context,
- this.requestClientCertificate,
- this.requireClientCertificate,
- this.supportedProtocols) {
- _controller = new StreamController<RawSecureSocket>(
- sync: true,
- onListen: _onSubscriptionStateChange,
- onPause: _onPauseStateChange,
- onResume: _onPauseStateChange,
- onCancel: _onSubscriptionStateChange);
- }
-
- /**
- * Returns a future for a [RawSecureServerSocket]. When the future
- * completes the server socket is bound to the given [address] and
- * [port] and has started listening on it.
- *
- * The [address] can either be a [String] or an
- * [InternetAddress]. If [address] is a [String], [bind] will
- * perform a [InternetAddress.lookup] and use the first value in the
- * list. To listen on the loopback adapter, which will allow only
- * incoming connections from the local host, use the value
- * [InternetAddress.LOOPBACK_IP_V4] or
- * [InternetAddress.LOOPBACK_IP_V6]. To allow for incoming
- * connection from the network use either one of the values
- * [InternetAddress.ANY_IP_V4] or [InternetAddress.ANY_IP_V6] to
- * bind to all interfaces or the IP address of a specific interface.
- *
- * If [port] has the value [:0:] an ephemeral port will be chosen by
- * the system. The actual port used can be retrieved using the
- * [port] getter.
- *
- * The optional argument [backlog] can be used to specify the listen
- * backlog for the underlying OS listen setup. If [backlog] has the
- * value of [:0:] (the default) a reasonable value will be chosen by
- * the system.
- *
- * Incoming client connections are promoted to secure connections,
- * using the server certificate and key set in [context].
- *
- * [address] must be given as a numeric address, not a host name.
- *
- * To request or require that clients authenticate by providing an SSL (TLS)
- * client certificate, set the optional parameters requestClientCertificate or
- * requireClientCertificate to true. Require implies request, so one doesn't
- * need to specify both. To check whether a client certificate was received,
- * check SecureSocket.peerCertificate after connecting. If no certificate
- * was received, the result will be null.
- *
- * The optional argument [shared] specifies whether additional
- * RawSecureServerSocket objects can bind to the same combination of
- * `address`, `port` and `v6Only`. If `shared` is `true` and more
- * `RawSecureServerSocket`s from this isolate or other isolates are bound to
- * the port, then the incoming connections will be distributed among all the
- * bound `RawSecureServerSocket`s. Connections can be distributed over
- * multiple isolates this way.
- */
- static Future<RawSecureServerSocket> bind(
- address,
- int port,
- SecurityContext context,
- {int backlog: 0,
- bool v6Only: false,
- bool requestClientCertificate: false,
- bool requireClientCertificate: false,
- List<String> supportedProtocols,
- bool shared: false}) {
- return RawServerSocket.bind(
- address, port, backlog: backlog, v6Only: v6Only, shared: shared)
- .then((serverSocket) => new RawSecureServerSocket._(
- serverSocket,
- context,
- requestClientCertificate,
- requireClientCertificate,
- supportedProtocols));
- }
-
- StreamSubscription<RawSecureSocket> listen(void onData(RawSecureSocket s),
- {Function onError,
- void onDone(),
- bool cancelOnError}) {
- return _controller.stream.listen(onData,
- onError: onError,
- onDone: onDone,
- cancelOnError: cancelOnError);
- }
-
- /**
- * Returns the port used by this socket.
- */
- int get port => _socket.port;
-
- /**
- * Returns the address used by this socket.
- */
- InternetAddress get address => _socket.address;
-
- /**
- * Closes the socket. The returned future completes when the socket
- * is fully closed and is no longer bound.
- */
- Future<RawSecureServerSocket> close() {
- _closed = true;
- return _socket.close().then((_) => this);
- }
-
- void _onData(RawSocket connection) {
- var remotePort;
- try {
- remotePort = connection.remotePort;
- } catch (e) {
- // If connection is already closed, remotePort throws an exception.
- // Do nothing - connection is closed.
- return;
- }
- _RawSecureSocket.connect(
- connection.address,
- remotePort,
- context: _context,
- is_server: true,
- socket: connection,
- requestClientCertificate: requestClientCertificate,
- requireClientCertificate: requireClientCertificate,
- supportedProtocols: supportedProtocols)
- .then((RawSecureSocket secureConnection) {
- if (_closed) {
- secureConnection.close();
- } else {
- _controller.add(secureConnection);
- }
- }).catchError((e, s) {
- if (!_closed) {
- _controller.addError(e, s);
- }
- });
- }
-
- void _onPauseStateChange() {
- if (_controller.isPaused) {
- _subscription.pause();
- } else {
- _subscription.resume();
- }
- }
-
- void _onSubscriptionStateChange() {
- if (_controller.hasListener) {
- _subscription = _socket.listen(_onData,
- onError: _controller.addError,
- onDone: _controller.close);
- } else {
- close();
- }
- }
-
- void set _owner(owner) {
- (_socket as dynamic)._owner = owner;
- }
-}
-
-
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/io/secure_socket.dart b/pkg/dev_compiler/tool/input_sdk/lib/io/secure_socket.dart
deleted file mode 100644
index 380a8c4..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/io/secure_socket.dart
+++ /dev/null
@@ -1,1263 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-part of dart.io;
-
-/**
- * A high-level class for communicating securely over a TCP socket, using
- * TLS and SSL. The [SecureSocket] exposes both a [Stream] and an
- * [IOSink] interface, making it ideal for using together with
- * other [Stream]s.
- */
-abstract class SecureSocket implements Socket {
- external factory SecureSocket._(RawSecureSocket rawSocket);
-
- /**
- * Constructs a new secure client socket and connects it to the given
- * [host] on port [port]. The returned Future will complete with a
- * [SecureSocket] that is connected and ready for subscription.
- *
- * The certificate provided by the server is checked
- * using the trusted certificates set in the SecurityContext object.
- * The default SecurityContext object contains a built-in set of trusted
- * root certificates for well-known certificate authorities.
- *
- * [onBadCertificate] is an optional handler for unverifiable certificates.
- * The handler receives the [X509Certificate], and can inspect it and
- * decide (or let the user decide) whether to accept
- * the connection or not. The handler should return true
- * to continue the [SecureSocket] connection.
- */
- static Future<SecureSocket> connect(
- host,
- int port,
- {SecurityContext context,
- bool onBadCertificate(X509Certificate certificate),
- List<String> supportedProtocols}) {
- return RawSecureSocket.connect(host,
- port,
- context: context,
- onBadCertificate: onBadCertificate,
- supportedProtocols: supportedProtocols)
- .then((rawSocket) => new SecureSocket._(rawSocket));
- }
-
- /**
- * Takes an already connected [socket] and starts client side TLS
- * handshake to make the communication secure. When the returned
- * future completes the [SecureSocket] has completed the TLS
- * handshake. Using this function requires that the other end of the
- * connection is prepared for TLS handshake.
- *
- * If the [socket] already has a subscription, this subscription
- * will no longer receive and events. In most cases calling
- * `pause` on this subscription before starting TLS handshake is
- * the right thing to do.
- *
- * If the [host] argument is passed it will be used as the host name
- * for the TLS handshake. If [host] is not passed the host name from
- * the [socket] will be used. The [host] can be either a [String] or
- * an [InternetAddress].
- *
- * Calling this function will _not_ cause a DNS host lookup. If the
- * [host] passed is a [String] the [InternetAddress] for the
- * resulting [SecureSocket] will have the passed in [host] as its
- * host value and the internet address of the already connected
- * socket as its address value.
- *
- * See [connect] for more information on the arguments.
- *
- */
- static Future<SecureSocket> secure(
- Socket socket,
- {host,
- SecurityContext context,
- bool onBadCertificate(X509Certificate certificate)}) {
- var completer = new Completer();
- (socket as dynamic)._detachRaw()
- .then((detachedRaw) {
- return RawSecureSocket.secure(
- detachedRaw[0],
- subscription: detachedRaw[1],
- host: host,
- context: context,
- onBadCertificate: onBadCertificate);
- })
- .then((raw) {
- completer.complete(new SecureSocket._(raw));
- });
- return completer.future;
- }
-
- /**
- * Takes an already connected [socket] and starts server side TLS
- * handshake to make the communication secure. When the returned
- * future completes the [SecureSocket] has completed the TLS
- * handshake. Using this function requires that the other end of the
- * connection is going to start the TLS handshake.
- *
- * If the [socket] already has a subscription, this subscription
- * will no longer receive and events. In most cases calling
- * [:pause:] on this subscription before starting TLS handshake is
- * the right thing to do.
- *
- * If some of the data of the TLS handshake has already been read
- * from the socket this data can be passed in the [bufferedData]
- * parameter. This data will be processed before any other data
- * available on the socket.
- *
- * See [SecureServerSocket.bind] for more information on the
- * arguments.
- *
- */
- static Future<SecureSocket> secureServer(
- Socket socket,
- SecurityContext context,
- {List<int> bufferedData,
- bool requestClientCertificate: false,
- bool requireClientCertificate: false,
- List<String> supportedProtocols}) {
- var completer = new Completer();
- (socket as dynamic)._detachRaw()
- .then((detachedRaw) {
- return RawSecureSocket.secureServer(
- detachedRaw[0],
- context,
- subscription: detachedRaw[1],
- bufferedData: bufferedData,
- requestClientCertificate: requestClientCertificate,
- requireClientCertificate: requireClientCertificate,
- supportedProtocols: supportedProtocols);
- })
- .then((raw) {
- completer.complete(new SecureSocket._(raw));
- });
- return completer.future;
- }
-
- /**
- * Get the peer certificate for a connected SecureSocket. If this
- * SecureSocket is the server end of a secure socket connection,
- * [peerCertificate] will return the client certificate, or null, if no
- * client certificate was received. If it is the client end,
- * [peerCertificate] will return the server's certificate.
- */
- X509Certificate get peerCertificate;
-
- /**
- * Get the protocol which was selected during protocol negotiation.
- */
- String get selectedProtocol;
-
- /**
- * Renegotiate an existing secure connection, renewing the session keys
- * and possibly changing the connection properties.
- *
- * This repeats the SSL or TLS handshake, with options that allow clearing
- * the session cache and requesting a client certificate.
- */
- void renegotiate({bool useSessionCache: true,
- bool requestClientCertificate: false,
- bool requireClientCertificate: false});
-}
-
-
-/**
- * RawSecureSocket provides a secure (SSL or TLS) network connection.
- * Client connections to a server are provided by calling
- * RawSecureSocket.connect. A secure server, created with
- * [RawSecureServerSocket], also returns RawSecureSocket objects representing
- * the server end of a secure connection.
- * The certificate provided by the server is checked
- * using the trusted certificates set in the SecurityContext object.
- * The default [SecurityContext] object contains a built-in set of trusted
- * root certificates for well-known certificate authorities.
- */
-abstract class RawSecureSocket implements RawSocket {
- /**
- * Constructs a new secure client socket and connect it to the given
- * host on the given port. The returned [Future] is completed with the
- * RawSecureSocket when it is connected and ready for subscription.
- *
- * The certificate provided by the server is checked using the trusted
- * certificates set in the SecurityContext object If a certificate and key are
- * set on the client, using [SecurityContext.useCertificateChain] and
- * [SecurityContext.usePrivateKey], and the server asks for a client
- * certificate, then that client certificate is sent to the server.
- *
- * [onBadCertificate] is an optional handler for unverifiable certificates.
- * The handler receives the [X509Certificate], and can inspect it and
- * decide (or let the user decide) whether to accept
- * the connection or not. The handler should return true
- * to continue the [RawSecureSocket] connection.
- */
- static Future<RawSecureSocket> connect(
- host,
- int port,
- {SecurityContext context,
- bool onBadCertificate(X509Certificate certificate),
- List<String> supportedProtocols}) {
- _RawSecureSocket._verifyFields(
- host,
- port,
- false,
- false,
- false,
- onBadCertificate);
- return RawSocket.connect(host, port)
- .then((socket) {
- return secure(socket,
- context: context,
- onBadCertificate: onBadCertificate,
- supportedProtocols: supportedProtocols);
- });
- }
-
- /**
- * Takes an already connected [socket] and starts client side TLS
- * handshake to make the communication secure. When the returned
- * future completes the [RawSecureSocket] has completed the TLS
- * handshake. Using this function requires that the other end of the
- * connection is prepared for TLS handshake.
- *
- * If the [socket] already has a subscription, pass the existing
- * subscription in the [subscription] parameter. The [secure]
- * operation will take over the subscription by replacing the
- * handlers with it own secure processing. The caller must not touch
- * this subscription anymore. Passing a paused subscription is an
- * error.
- *
- * If the [host] argument is passed it will be used as the host name
- * for the TLS handshake. If [host] is not passed the host name from
- * the [socket] will be used. The [host] can be either a [String] or
- * an [InternetAddress].
- *
- * Calling this function will _not_ cause a DNS host lookup. If the
- * [host] passed is a [String] the [InternetAddress] for the
- * resulting [SecureSocket] will have this passed in [host] as its
- * host value and the internet address of the already connected
- * socket as its address value.
- *
- * See [connect] for more information on the arguments.
- *
- */
- static Future<RawSecureSocket> secure(
- RawSocket socket,
- {StreamSubscription subscription,
- host,
- SecurityContext context,
- bool onBadCertificate(X509Certificate certificate),
- List<String> supportedProtocols}) {
- socket.readEventsEnabled = false;
- socket.writeEventsEnabled = false;
- return _RawSecureSocket.connect(
- host != null ? host : socket.address.host,
- socket.port,
- is_server: false,
- socket: socket,
- subscription: subscription,
- context: context,
- onBadCertificate: onBadCertificate,
- supportedProtocols: supportedProtocols);
- }
-
- /**
- * Takes an already connected [socket] and starts server side TLS
- * handshake to make the communication secure. When the returned
- * future completes the [RawSecureSocket] has completed the TLS
- * handshake. Using this function requires that the other end of the
- * connection is going to start the TLS handshake.
- *
- * If the [socket] already has a subscription, pass the existing
- * subscription in the [subscription] parameter. The [secureServer]
- * operation will take over the subscription by replacing the
- * handlers with it own secure processing. The caller must not touch
- * this subscription anymore. Passing a paused subscription is an
- * error.
- *
- * If some of the data of the TLS handshake has already been read
- * from the socket this data can be passed in the [bufferedData]
- * parameter. This data will be processed before any other data
- * available on the socket.
- *
- * See [RawSecureServerSocket.bind] for more information on the
- * arguments.
- *
- */
- static Future<RawSecureSocket> secureServer(
- RawSocket socket,
- SecurityContext context,
- {StreamSubscription subscription,
- List<int> bufferedData,
- bool requestClientCertificate: false,
- bool requireClientCertificate: false,
- List<String> supportedProtocols}) {
- socket.readEventsEnabled = false;
- socket.writeEventsEnabled = false;
- return _RawSecureSocket.connect(
- socket.address,
- socket.remotePort,
- context: context,
- is_server: true,
- socket: socket,
- subscription: subscription,
- bufferedData: bufferedData,
- requestClientCertificate: requestClientCertificate,
- requireClientCertificate: requireClientCertificate,
- supportedProtocols: supportedProtocols);
- }
-
- /**
- * Renegotiate an existing secure connection, renewing the session keys
- * and possibly changing the connection properties.
- *
- * This repeats the SSL or TLS handshake, with options that allow clearing
- * the session cache and requesting a client certificate.
- */
- void renegotiate({bool useSessionCache: true,
- bool requestClientCertificate: false,
- bool requireClientCertificate: false});
-
- /**
- * Get the peer certificate for a connected RawSecureSocket. If this
- * RawSecureSocket is the server end of a secure socket connection,
- * [peerCertificate] will return the client certificate, or null, if no
- * client certificate was received. If it is the client end,
- * [peerCertificate] will return the server's certificate.
- */
- X509Certificate get peerCertificate;
-
- /**
- * Get the protocol which was selected during protocol negotiation.
- */
- String get selectedProtocol;
-}
-
-
-/**
- * X509Certificate represents an SSL certificate, with accessors to
- * get the fields of the certificate.
- */
-abstract class X509Certificate {
- external factory X509Certificate._();
-
- String get subject;
- String get issuer;
- DateTime get startValidity;
- DateTime get endValidity;
-}
-
-
-class _FilterStatus {
- bool progress = false; // The filter read or wrote data to the buffers.
- bool readEmpty = true; // The read buffers and decryption filter are empty.
- bool writeEmpty = true; // The write buffers and encryption filter are empty.
- // These are set if a buffer changes state from empty or full.
- bool readPlaintextNoLongerEmpty = false;
- bool writePlaintextNoLongerFull = false;
- bool readEncryptedNoLongerFull = false;
- bool writeEncryptedNoLongerEmpty = false;
-
- _FilterStatus();
-}
-
-
-class _RawSecureSocket extends Stream<RawSocketEvent>
- implements RawSecureSocket {
- // Status states
- static final int HANDSHAKE = 201;
- static final int CONNECTED = 202;
- static final int CLOSED = 203;
-
- // Buffer identifiers.
- // These must agree with those in the native C++ implementation.
- static final int READ_PLAINTEXT = 0;
- static final int WRITE_PLAINTEXT = 1;
- static final int READ_ENCRYPTED = 2;
- static final int WRITE_ENCRYPTED = 3;
- static final int NUM_BUFFERS = 4;
-
- // Is a buffer identifier for an encrypted buffer?
- static bool _isBufferEncrypted(int identifier) => identifier >= READ_ENCRYPTED;
-
- RawSocket _socket;
- final Completer<_RawSecureSocket> _handshakeComplete =
- new Completer<_RawSecureSocket>();
- StreamController<RawSocketEvent> _controller;
- Stream<RawSocketEvent> _stream;
- StreamSubscription<RawSocketEvent> _socketSubscription;
- List<int> _bufferedData;
- int _bufferedDataIndex = 0;
- final InternetAddress address;
- final bool is_server;
- SecurityContext context;
- final bool requestClientCertificate;
- final bool requireClientCertificate;
- final Function onBadCertificate;
-
- var _status = HANDSHAKE;
- bool _writeEventsEnabled = true;
- bool _readEventsEnabled = true;
- int _pauseCount = 0;
- bool _pendingReadEvent = false;
- bool _socketClosedRead = false; // The network socket is closed for reading.
- bool _socketClosedWrite = false; // The network socket is closed for writing.
- bool _closedRead = false; // The secure socket has fired an onClosed event.
- bool _closedWrite = false; // The secure socket has been closed for writing.
- Completer _closeCompleter = new Completer(); // The network socket is gone.
- _FilterStatus _filterStatus = new _FilterStatus();
- bool _connectPending = true;
- bool _filterPending = false;
- bool _filterActive = false;
-
- _SecureFilter _secureFilter = new _SecureFilter();
- String _selectedProtocol;
-
- static Future<_RawSecureSocket> connect(
- dynamic/*String|InternetAddress*/ host,
- int requestedPort,
- {bool is_server,
- SecurityContext context,
- RawSocket socket,
- StreamSubscription subscription,
- List<int> bufferedData,
- bool requestClientCertificate: false,
- bool requireClientCertificate: false,
- bool onBadCertificate(X509Certificate certificate),
- List<String> supportedProtocols}) {
- _verifyFields(host, requestedPort, is_server,
- requestClientCertificate, requireClientCertificate,
- onBadCertificate);
- if (host is InternetAddress) host = host.host;
- InternetAddress address = socket.address;
- if (host != null) {
- address = InternetAddress._cloneWithNewHost(address, host);
- }
- return new _RawSecureSocket(address,
- requestedPort,
- is_server,
- context,
- socket,
- subscription,
- bufferedData,
- requestClientCertificate,
- requireClientCertificate,
- onBadCertificate,
- supportedProtocols)
- ._handshakeComplete.future;
- }
-
- _RawSecureSocket(
- this.address,
- int requestedPort,
- this.is_server,
- this.context,
- RawSocket this._socket,
- this._socketSubscription,
- this._bufferedData,
- this.requestClientCertificate,
- this.requireClientCertificate,
- this.onBadCertificate(X509Certificate certificate),
- List<String> supportedProtocols) {
- if (context == null) {
- context = SecurityContext.defaultContext;
- }
- _controller = new StreamController<RawSocketEvent>(
- sync: true,
- onListen: _onSubscriptionStateChange,
- onPause: _onPauseStateChange,
- onResume: _onPauseStateChange,
- onCancel: _onSubscriptionStateChange);
- _stream = _controller.stream;
- // Throw an ArgumentError if any field is invalid. After this, all
- // errors will be reported through the future or the stream.
- _secureFilter.init();
- _secureFilter.registerHandshakeCompleteCallback(
- _secureHandshakeCompleteHandler);
- if (onBadCertificate != null) {
- _secureFilter.registerBadCertificateCallback(_onBadCertificateWrapper);
- }
- _socket.readEventsEnabled = true;
- _socket.writeEventsEnabled = false;
- if (_socketSubscription == null) {
- // If a current subscription is provided use this otherwise
- // create a new one.
- _socketSubscription = _socket.listen(_eventDispatcher,
- onError: _reportError,
- onDone: _doneHandler);
- } else {
- if (_socketSubscription.isPaused) {
- _socket.close();
- throw new ArgumentError(
- "Subscription passed to TLS upgrade is paused");
- }
- // If we are upgrading a socket that is already closed for read,
- // report an error as if we received READ_CLOSED during the handshake.
- dynamic s = _socket; // Cast to dynamic to avoid warning.
- if (s._socket.closedReadEventSent) {
- _eventDispatcher(RawSocketEvent.READ_CLOSED);
- }
- _socketSubscription
- ..onData(_eventDispatcher)
- ..onError(_reportError)
- ..onDone(_doneHandler);
- }
- try {
- var encodedProtocols =
- SecurityContext._protocolsToLengthEncoding(supportedProtocols);
- _secureFilter.connect(address.host,
- context,
- is_server,
- requestClientCertificate ||
- requireClientCertificate,
- requireClientCertificate,
- encodedProtocols);
- _secureHandshake();
- } catch (e, s) {
- _reportError(e, s);
- }
- }
-
- StreamSubscription<RawSocketEvent> listen(void onData(RawSocketEvent data),
- {Function onError,
- void onDone(),
- bool cancelOnError}) {
- _sendWriteEvent();
- return _stream.listen(onData,
- onError: onError,
- onDone: onDone,
- cancelOnError: cancelOnError);
- }
-
- static void _verifyFields(host,
- int requestedPort,
- bool is_server,
- bool requestClientCertificate,
- bool requireClientCertificate,
- Function onBadCertificate) {
- if (host is! String && host is! InternetAddress) {
- throw new ArgumentError("host is not a String or an InternetAddress");
- }
- if (requestedPort is! int) {
- throw new ArgumentError("requestedPort is not an int");
- }
- if (requestedPort < 0 || requestedPort > 65535) {
- throw new ArgumentError("requestedPort is not in the range 0..65535");
- }
- if (requestClientCertificate is! bool) {
- throw new ArgumentError("requestClientCertificate is not a bool");
- }
- if (requireClientCertificate is! bool) {
- throw new ArgumentError("requireClientCertificate is not a bool");
- }
- if (onBadCertificate != null && onBadCertificate is! Function) {
- throw new ArgumentError("onBadCertificate is not null or a Function");
- }
- }
-
- int get port => _socket.port;
-
- InternetAddress get remoteAddress => _socket.remoteAddress;
-
- int get remotePort => _socket.remotePort;
-
- void set _owner(owner) {
- (_socket as dynamic)._owner = owner;
- }
-
- int available() {
- return _status != CONNECTED ? 0
- : _secureFilter.buffers[READ_PLAINTEXT].length;
- }
-
- Future<RawSecureSocket> close() {
- shutdown(SocketDirection.BOTH);
- return _closeCompleter.future;
- }
-
- void _completeCloseCompleter([dummy]) {
- if (!_closeCompleter.isCompleted) _closeCompleter.complete(this);
- }
-
- void _close() {
- _closedWrite = true;
- _closedRead = true;
- if (_socket != null) {
- _socket.close().then(_completeCloseCompleter);
- } else {
- _completeCloseCompleter();
- }
- _socketClosedWrite = true;
- _socketClosedRead = true;
- if (!_filterActive && _secureFilter != null) {
- _secureFilter.destroy();
- _secureFilter = null;
- }
- if (_socketSubscription != null) {
- _socketSubscription.cancel();
- }
- _controller.close();
- _status = CLOSED;
- }
-
- void shutdown(SocketDirection direction) {
- if (direction == SocketDirection.SEND ||
- direction == SocketDirection.BOTH) {
- _closedWrite = true;
- if (_filterStatus.writeEmpty) {
- _socket.shutdown(SocketDirection.SEND);
- _socketClosedWrite = true;
- if (_closedRead) {
- _close();
- }
- }
- }
- if (direction == SocketDirection.RECEIVE ||
- direction == SocketDirection.BOTH) {
- _closedRead = true;
- _socketClosedRead = true;
- _socket.shutdown(SocketDirection.RECEIVE);
- if (_socketClosedWrite) {
- _close();
- }
- }
- }
-
- bool get writeEventsEnabled => _writeEventsEnabled;
-
- void set writeEventsEnabled(bool value) {
- _writeEventsEnabled = value;
- if (value) {
- Timer.run(() => _sendWriteEvent());
- }
- }
-
- bool get readEventsEnabled => _readEventsEnabled;
-
- void set readEventsEnabled(bool value) {
- _readEventsEnabled = value;
- _scheduleReadEvent();
- }
-
- List<int> read([int length]) {
- if (length != null && (length is! int || length < 0)) {
- throw new ArgumentError(
- "Invalid length parameter in SecureSocket.read (length: $length)");
- }
- if (_closedRead) {
- throw new SocketException("Reading from a closed socket");
- }
- if (_status != CONNECTED) {
- return null;
- }
- var result = _secureFilter.buffers[READ_PLAINTEXT].read(length);
- _scheduleFilter();
- return result;
- }
-
- // Write the data to the socket, and schedule the filter to encrypt it.
- int write(List<int> data, [int offset, int bytes]) {
- if (bytes != null && (bytes is! int || bytes < 0)) {
- throw new ArgumentError(
- "Invalid bytes parameter in SecureSocket.read (bytes: $bytes)");
- }
- if (offset != null && (offset is! int || offset < 0)) {
- throw new ArgumentError(
- "Invalid offset parameter in SecureSocket.read (offset: $offset)");
- }
- if (_closedWrite) {
- _controller.addError(new SocketException("Writing to a closed socket"));
- return 0;
- }
- if (_status != CONNECTED) return 0;
- if (offset == null) offset = 0;
- if (bytes == null) bytes = data.length - offset;
-
- int written =
- _secureFilter.buffers[WRITE_PLAINTEXT].write(data, offset, bytes);
- if (written > 0) {
- _filterStatus.writeEmpty = false;
- }
- _scheduleFilter();
- return written;
- }
-
- X509Certificate get peerCertificate => _secureFilter.peerCertificate;
-
- String get selectedProtocol => _selectedProtocol;
-
- bool _onBadCertificateWrapper(X509Certificate certificate) {
- if (onBadCertificate == null) return false;
- var result = onBadCertificate(certificate);
- if (result is bool) return result;
- throw new HandshakeException(
- "onBadCertificate callback returned non-boolean $result");
- }
-
- bool setOption(SocketOption option, bool enabled) {
- if (_socket == null) return false;
- return _socket.setOption(option, enabled);
- }
-
- void _eventDispatcher(RawSocketEvent event) {
- try {
- if (event == RawSocketEvent.READ) {
- _readHandler();
- } else if (event == RawSocketEvent.WRITE) {
- _writeHandler();
- } else if (event == RawSocketEvent.READ_CLOSED) {
- _closeHandler();
- }
- } catch (e, stackTrace) {
- _reportError(e, stackTrace);
- }
- }
-
- void _readHandler() {
- _readSocket();
- _scheduleFilter();
- }
-
- void _writeHandler() {
- _writeSocket();
- _scheduleFilter();
- }
-
- void _doneHandler() {
- if (_filterStatus.readEmpty) {
- _close();
- }
- }
-
- void _reportError(e, [StackTrace stackTrace]) {
- if (_status == CLOSED) {
- return;
- } else if (_connectPending) {
- // _connectPending is true until the handshake has completed, and the
- // _handshakeComplete future returned from SecureSocket.connect has
- // completed. Before this point, we must complete it with an error.
- _handshakeComplete.completeError(e, stackTrace);
- } else {
- _controller.addError(e, stackTrace);
- }
- _close();
- }
-
- void _closeHandler() {
- if (_status == CONNECTED) {
- if (_closedRead) return;
- _socketClosedRead = true;
- if (_filterStatus.readEmpty) {
- _closedRead = true;
- _controller.add(RawSocketEvent.READ_CLOSED);
- if (_socketClosedWrite) {
- _close();
- }
- } else {
- _scheduleFilter();
- }
- } else if (_status == HANDSHAKE) {
- _socketClosedRead = true;
- if (_filterStatus.readEmpty) {
- _reportError(
- new HandshakeException('Connection terminated during handshake'),
- null);
- } else {
- _secureHandshake();
- }
- }
- }
-
- void _secureHandshake() {
- try {
- _secureFilter.handshake();
- _filterStatus.writeEmpty = false;
- _readSocket();
- _writeSocket();
- _scheduleFilter();
- } catch (e, stackTrace) {
- _reportError(e, stackTrace);
- }
- }
-
- void renegotiate({bool useSessionCache: true,
- bool requestClientCertificate: false,
- bool requireClientCertificate: false}) {
- if (_status != CONNECTED) {
- throw new HandshakeException(
- "Called renegotiate on a non-connected socket");
- }
- _secureFilter.renegotiate(useSessionCache,
- requestClientCertificate,
- requireClientCertificate);
- _status = HANDSHAKE;
- _filterStatus.writeEmpty = false;
- _scheduleFilter();
- }
-
- void _secureHandshakeCompleteHandler() {
- _status = CONNECTED;
- if (_connectPending) {
- _connectPending = false;
- try {
- _selectedProtocol = _secureFilter.selectedProtocol();
- // We don't want user code to run synchronously in this callback.
- Timer.run(() => _handshakeComplete.complete(this));
- } catch (error, stack) {
- _handshakeComplete.completeError(error, stack);
- }
- }
- }
-
- void _onPauseStateChange() {
- if (_controller.isPaused) {
- _pauseCount++;
- } else {
- _pauseCount--;
- if (_pauseCount == 0) {
- _scheduleReadEvent();
- _sendWriteEvent(); // Can send event synchronously.
- }
- }
-
- if (!_socketClosedRead || !_socketClosedWrite) {
- if (_controller.isPaused) {
- _socketSubscription.pause();
- } else {
- _socketSubscription.resume();
- }
- }
- }
-
- void _onSubscriptionStateChange() {
- if (_controller.hasListener) {
- // TODO(ajohnsen): Do something here?
- }
- }
-
- void _scheduleFilter() {
- _filterPending = true;
- _tryFilter();
- }
-
- void _tryFilter() {
- if (_status == CLOSED) {
- return;
- }
- if (_filterPending && !_filterActive) {
- _filterActive = true;
- _filterPending = false;
- _pushAllFilterStages().then((status) {
- _filterStatus = status;
- _filterActive = false;
- if (_status == CLOSED) {
- _secureFilter.destroy();
- _secureFilter = null;
- return;
- }
- _socket.readEventsEnabled = true;
- if (_filterStatus.writeEmpty && _closedWrite && !_socketClosedWrite) {
- // Checks for and handles all cases of partially closed sockets.
- shutdown(SocketDirection.SEND);
- if (_status == CLOSED) {
- return;
- }
- }
- if (_filterStatus.readEmpty && _socketClosedRead && !_closedRead) {
- if (_status == HANDSHAKE) {
- _secureFilter.handshake();
- if (_status == HANDSHAKE) {
- throw new HandshakeException(
- 'Connection terminated during handshake');
- }
- }
- _closeHandler();
- }
- if (_status == CLOSED) {
- return;
- }
- if (_filterStatus.progress) {
- _filterPending = true;
- if (_filterStatus.writeEncryptedNoLongerEmpty) {
- _writeSocket();
- }
- if (_filterStatus.writePlaintextNoLongerFull) {
- _sendWriteEvent();
- }
- if (_filterStatus.readEncryptedNoLongerFull) {
- _readSocket();
- }
- if (_filterStatus.readPlaintextNoLongerEmpty) {
- _scheduleReadEvent();
- }
- if (_status == HANDSHAKE) {
- _secureHandshake();
- }
- }
- _tryFilter();
- }).catchError(_reportError);
- }
- }
-
- List<int> _readSocketOrBufferedData(int bytes) {
- if (_bufferedData != null) {
- if (bytes > _bufferedData.length - _bufferedDataIndex) {
- bytes = _bufferedData.length - _bufferedDataIndex;
- }
- var result = _bufferedData.sublist(_bufferedDataIndex,
- _bufferedDataIndex + bytes);
- _bufferedDataIndex += bytes;
- if (_bufferedData.length == _bufferedDataIndex) {
- _bufferedData = null;
- }
- return result;
- } else if (!_socketClosedRead) {
- return _socket.read(bytes);
- } else {
- return null;
- }
- }
-
- void _readSocket() {
- if (_status == CLOSED) return;
- var buffer = _secureFilter.buffers[READ_ENCRYPTED];
- if (buffer.writeFromSource(_readSocketOrBufferedData) > 0) {
- _filterStatus.readEmpty = false;
- } else {
- _socket.readEventsEnabled = false;
- }
- }
-
- void _writeSocket() {
- if (_socketClosedWrite) return;
- var buffer = _secureFilter.buffers[WRITE_ENCRYPTED];
- if (buffer.readToSocket(_socket)) { // Returns true if blocked
- _socket.writeEventsEnabled = true;
- }
- }
-
- // If a read event should be sent, add it to the controller.
- _scheduleReadEvent() {
- if (!_pendingReadEvent &&
- _readEventsEnabled &&
- _pauseCount == 0 &&
- _secureFilter != null &&
- !_secureFilter.buffers[READ_PLAINTEXT].isEmpty) {
- _pendingReadEvent = true;
- Timer.run(_sendReadEvent);
- }
- }
-
- _sendReadEvent() {
- _pendingReadEvent = false;
- if (_status != CLOSED &&
- _readEventsEnabled &&
- _pauseCount == 0 &&
- _secureFilter != null &&
- !_secureFilter.buffers[READ_PLAINTEXT].isEmpty) {
- _controller.add(RawSocketEvent.READ);
- _scheduleReadEvent();
- }
- }
-
- // If a write event should be sent, add it to the controller.
- _sendWriteEvent() {
- if (!_closedWrite &&
- _writeEventsEnabled &&
- _pauseCount == 0 &&
- _secureFilter != null &&
- _secureFilter.buffers[WRITE_PLAINTEXT].free > 0) {
- _writeEventsEnabled = false;
- _controller.add(RawSocketEvent.WRITE);
- }
- }
-
- Future<_FilterStatus> _pushAllFilterStages() {
- bool wasInHandshake = _status != CONNECTED;
- List args = new List(2 + NUM_BUFFERS * 2);
- args[0] = _secureFilter._pointer();
- args[1] = wasInHandshake;
- var bufs = _secureFilter.buffers;
- for (var i = 0; i < NUM_BUFFERS; ++i) {
- args[2 * i + 2] = bufs[i].start;
- args[2 * i + 3] = bufs[i].end;
- }
-
- return _IOService._dispatch(_SSL_PROCESS_FILTER, args).then((response) {
- if (response.length == 2) {
- if (wasInHandshake) {
- // If we're in handshake, throw a handshake error.
- _reportError(
- new HandshakeException('${response[1]} error ${response[0]}'),
- null);
- } else {
- // If we're connected, throw a TLS error.
- _reportError(new TlsException('${response[1]} error ${response[0]}'),
- null);
- }
- }
- int start(int index) => response[2 * index];
- int end(int index) => response[2 * index + 1];
-
- _FilterStatus status = new _FilterStatus();
- // Compute writeEmpty as "write plaintext buffer and write encrypted
- // buffer were empty when we started and are empty now".
- status.writeEmpty = bufs[WRITE_PLAINTEXT].isEmpty &&
- start(WRITE_ENCRYPTED) == end(WRITE_ENCRYPTED);
- // If we were in handshake when this started, _writeEmpty may be false
- // because the handshake wrote data after we checked.
- if (wasInHandshake) status.writeEmpty = false;
-
- // Compute readEmpty as "both read buffers were empty when we started
- // and are empty now".
- status.readEmpty = bufs[READ_ENCRYPTED].isEmpty &&
- start(READ_PLAINTEXT) == end(READ_PLAINTEXT);
-
- _ExternalBuffer buffer = bufs[WRITE_PLAINTEXT];
- int new_start = start(WRITE_PLAINTEXT);
- if (new_start != buffer.start) {
- status.progress = true;
- if (buffer.free == 0) {
- status.writePlaintextNoLongerFull = true;
- }
- buffer.start = new_start;
- }
- buffer = bufs[READ_ENCRYPTED];
- new_start = start(READ_ENCRYPTED);
- if (new_start != buffer.start) {
- status.progress = true;
- if (buffer.free == 0) {
- status.readEncryptedNoLongerFull = true;
- }
- buffer.start = new_start;
- }
- buffer = bufs[WRITE_ENCRYPTED];
- int new_end = end(WRITE_ENCRYPTED);
- if (new_end != buffer.end) {
- status.progress = true;
- if (buffer.length == 0) {
- status.writeEncryptedNoLongerEmpty = true;
- }
- buffer.end = new_end;
- }
- buffer = bufs[READ_PLAINTEXT];
- new_end = end(READ_PLAINTEXT);
- if (new_end != buffer.end) {
- status.progress = true;
- if (buffer.length == 0) {
- status.readPlaintextNoLongerEmpty = true;
- }
- buffer.end = new_end;
- }
- return status;
- });
- }
-}
-
-
-/**
- * A circular buffer backed by an external byte array. Accessed from
- * both C++ and Dart code in an unsynchronized way, with one reading
- * and one writing. All updates to start and end are done by Dart code.
- */
-class _ExternalBuffer {
- List data; // This will be a ExternalByteArray, backed by C allocated data.
- int start;
- int end;
- final size;
-
- _ExternalBuffer(this.size) {
- start = end = size ~/ 2;
- }
-
- void advanceStart(int bytes) {
- assert(start > end || start + bytes <= end);
- start += bytes;
- if (start >= size) {
- start -= size;
- assert(start <= end);
- assert(start < size);
- }
- }
-
- void advanceEnd(int bytes) {
- assert(start <= end || start > end + bytes);
- end += bytes;
- if (end >= size) {
- end -= size;
- assert(end < start);
- assert(end < size);
- }
- }
-
- bool get isEmpty => end == start;
-
- int get length =>
- start > end ? size + end - start : end - start;
-
- int get linearLength =>
- start > end ? size - start : end - start;
-
- int get free =>
- start > end ? start - end - 1 : size + start - end - 1;
-
- int get linearFree {
- if (start > end) return start - end - 1;
- if (start == 0) return size - end - 1;
- return size - end;
- }
-
- List<int> read(int bytes) {
- if (bytes == null) {
- bytes = length;
- } else {
- bytes = min(bytes, length);
- }
- if (bytes == 0) return null;
- List<int> result = new Uint8List(bytes);
- int bytesRead = 0;
- // Loop over zero, one, or two linear data ranges.
- while (bytesRead < bytes) {
- int toRead = min(bytes - bytesRead, linearLength);
- result.setRange(bytesRead,
- bytesRead + toRead,
- data,
- start);
- advanceStart(toRead);
- bytesRead += toRead;
- }
- return result;
- }
-
- int write(List<int> inputData, int offset, int bytes) {
- if (bytes > free) {
- bytes = free;
- }
- int written = 0;
- int toWrite = min(bytes, linearFree);
- // Loop over zero, one, or two linear data ranges.
- while (toWrite > 0) {
- data.setRange(end, end + toWrite, inputData, offset);
- advanceEnd(toWrite);
- offset += toWrite;
- written += toWrite;
- toWrite = min(bytes - written, linearFree);
- }
- return written;
- }
-
- int writeFromSource(List<int> getData(int requested)) {
- int written = 0;
- int toWrite = linearFree;
- // Loop over zero, one, or two linear data ranges.
- while (toWrite > 0) {
- // Source returns at most toWrite bytes, and it returns null when empty.
- var inputData = getData(toWrite);
- if (inputData == null || inputData.length == 0) break;
- var len = inputData.length;
- data.setRange(end, end + len, inputData);
- advanceEnd(len);
- written += len;
- toWrite = linearFree;
- }
- return written;
- }
-
- bool readToSocket(RawSocket socket) {
- // Loop over zero, one, or two linear data ranges.
- while (true) {
- var toWrite = linearLength;
- if (toWrite == 0) return false;
- int bytes = socket.write(data, start, toWrite);
- advanceStart(bytes);
- if (bytes < toWrite) {
- // The socket has blocked while we have data to write.
- return true;
- }
- }
- }
-}
-
-
-abstract class _SecureFilter {
- external factory _SecureFilter();
-
- void connect(String hostName,
- SecurityContext context,
- bool is_server,
- bool requestClientCertificate,
- bool requireClientCertificate,
- Uint8List protocols);
- void destroy();
- void handshake();
- String selectedProtocol();
- void rehandshake();
- void renegotiate(bool useSessionCache,
- bool requestClientCertificate,
- bool requireClientCertificate);
- void init();
- X509Certificate get peerCertificate;
- int processBuffer(int bufferIndex);
- void registerBadCertificateCallback(Function callback);
- void registerHandshakeCompleteCallback(Function handshakeCompleteHandler);
-
- // This call may cause a reference counted pointer in the native
- // implementation to be retained. It should only be called when the resulting
- // value is passed to the IO service through a call to dispatch().
- int _pointer();
-
- List<_ExternalBuffer> get buffers;
-}
-
-/** A secure networking exception caused by a failure in the
- * TLS/SSL protocol.
- */
-class TlsException implements IOException {
- final String type;
- final String message;
- final OSError osError;
-
- const TlsException([String message = "",
- OSError osError = null])
- : this._("TlsException", message, osError);
-
- const TlsException._(this.type, this.message, this.osError);
-
- String toString() {
- StringBuffer sb = new StringBuffer();
- sb.write(type);
- if (!message.isEmpty) {
- sb.write(": $message");
- if (osError != null) {
- sb.write(" ($osError)");
- }
- } else if (osError != null) {
- sb.write(": $osError");
- }
- return sb.toString();
- }
-}
-
-
-/**
- * An exception that happens in the handshake phase of establishing
- * a secure network connection.
- */
-class HandshakeException extends TlsException {
- const HandshakeException([String message = "",
- OSError osError = null])
- : super._("HandshakeException", message, osError);
-}
-
-
-/**
- * An exception that happens in the handshake phase of establishing
- * a secure network connection, when looking up or verifying a
- * certificate.
- */
-class CertificateException extends TlsException {
- const CertificateException([String message = "",
- OSError osError = null])
- : super._("CertificateException", message, osError);
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/io/security_context.dart b/pkg/dev_compiler/tool/input_sdk/lib/io/security_context.dart
deleted file mode 100644
index d99b05b..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/io/security_context.dart
+++ /dev/null
@@ -1,267 +0,0 @@
-// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-part of dart.io;
-
-/**
- * The object containing the certificates to trust when making
- * a secure client connection, and the certificate chain and
- * private key to serve from a secure server.
- *
- * The [SecureSocket] and [SecureServer] classes take a SecurityContext
- * as an argument to their connect and bind methods.
- *
- * Certificates and keys can be added to a SecurityContext from either PEM
- * or PKCS12 containers.
- *
- * iOS note: Some methods to add, remove, and inspect certificates are not yet
- * implemented. However, the platform's built-in trusted certificates can
- * be used, by way of [SecurityContext.defaultContext].
- */
-abstract class SecurityContext {
- external factory SecurityContext();
-
- /**
- * Secure networking classes with an optional `context` parameter
- * use the [defaultContext] object if the parameter is omitted.
- * This object can also be accessed, and modified, directly.
- * Each isolate has a different [defaultContext] object.
- * The [defaultContext] object uses a list of well-known trusted
- * certificate authorities as its trusted roots. On Linux and Windows, this
- * list is taken from Mozilla, who maintains it as part of Firefox. On,
- * MacOS, iOS, and Android, this list comes from the trusted certificates
- * stores built in to the platforms.
- */
- external static SecurityContext get defaultContext;
-
- /**
- * Sets the private key for a server certificate or client certificate.
- *
- * A secure connection using this SecurityContext will use this key with
- * the server or client certificate to sign and decrypt messages.
- * [file] is the path to a PEM or PKCS12 file containing an encrypted
- * private key, encrypted with [password]. Assuming it is well-formatted, all
- * other contents of [file] are ignored. An unencrypted file can be used,
- * but this is not usual.
- *
- * NB: This function calls [ReadFileAsBytesSync], and will block on file IO.
- * Prefer using [usePrivateKeyBytes].
- *
- * iOS note: Only PKCS12 data is supported. It should contain both the private
- * key and the certificate chain. On iOS one call to [usePrivateKey] with this
- * data is used instead of two calls to [useCertificateChain] and
- * [usePrivateKey].
- */
- void usePrivateKey(String file, {String password});
-
- /**
- * Sets the private key for a server certificate or client certificate.
- *
- * Like [usePrivateKey], but takes the contents of the file as a list
- * of bytes.
- */
- void usePrivateKeyBytes(List<int> keyBytes, {String password});
-
- /**
- * Sets the set of trusted X509 certificates used by [SecureSocket]
- * client connections, when connecting to a secure server.
- *
- * [file] is the path to a PEM or PKCS12 file containing X509 certificates,
- * usually root certificates from certificate authorities. For PKCS12 files,
- * [password] is the password for the file. For PEM files, [password] is
- * ignored. Assuming it is well-formatted, all other contents of [file] are
- * ignored.
- *
- * NB: This function calls [ReadFileAsBytesSync], and will block on file IO.
- * Prefer using [setTrustedCertificatesBytes].
- *
- * iOS note: On iOS, this call takes only the bytes for a single DER
- * encoded X509 certificate. It may be called multiple times to add
- * multiple trusted certificates to the context. A DER encoded certificate
- * can be obtained from a PEM encoded certificate by using the openssl tool:
- *
- * $ openssl x509 -outform der -in cert.pem -out cert.der
- */
- void setTrustedCertificates(String file, {String password});
-
- /**
- * Sets the set of trusted X509 certificates used by [SecureSocket]
- * client connections, when connecting to a secure server.
- *
- * Like [setTrustedCertificates] but takes the contents of the file.
- */
- void setTrustedCertificatesBytes(List<int> certBytes, {String password});
-
- /**
- * Sets the chain of X509 certificates served by [SecureServer]
- * when making secure connections, including the server certificate.
- *
- * [file] is a PEM or PKCS12 file containing X509 certificates, starting with
- * the root authority and intermediate authorities forming the signed
- * chain to the server certificate, and ending with the server certificate.
- * The private key for the server certificate is set by [usePrivateKey]. For
- * PKCS12 files, [password] is the password for the file. For PEM files,
- * [password] is ignored. Assuming it is well-formatted, all
- * other contents of [file] are ignored.
- *
- * NB: This function calls [ReadFileAsBytesSync], and will block on file IO.
- * Prefer using [useCertificateChainBytes].
- *
- * iOS note: As noted above, [usePrivateKey] does the job of both
- * that call and this one. On iOS, this call is a no-op.
- */
- void useCertificateChain(String file, {String password});
-
- /**
- * Sets the chain of X509 certificates served by [SecureServer]
- * when making secure connections, including the server certificate.
- *
- * Like [useCertificateChain] but takes the contents of the file.
- */
- void useCertificateChainBytes(List<int> chainBytes, {String password});
-
- /**
- * Sets the list of authority names that a [SecureServer] will advertise
- * as accepted when requesting a client certificate from a connecting
- * client.
- *
- * [file] is a PEM or PKCS12 file containing the accepted signing
- * authority certificates - the authority names are extracted from the
- * certificates. For PKCS12 files, [password] is the password for the file.
- * For PEM files, [password] is ignored. Assuming it is well-formatted, all
- * other contents of [file] are ignored.
- *
- * NB: This function calls [ReadFileAsBytesSync], and will block on file IO.
- * Prefer using [setClientAuthoritiesBytes].
- *
- * iOS note: This call is not supported.
- */
- void setClientAuthorities(String file, {String password});
-
- /**
- * Sets the list of authority names that a [SecureServer] will advertise
- * as accepted, when requesting a client certificate from a connecting
- * client.
- *
- * Like [setClientAuthority] but takes the contents of the file.
- */
- void setClientAuthoritiesBytes(List<int> authCertBytes, {String password});
-
- /**
- * Whether the platform supports ALPN.
- */
- external static bool get alpnSupported;
-
- /**
- * Sets the list of application-level protocols supported by a client
- * connection or server connection. The ALPN (application level protocol
- * negotiation) extension to TLS allows a client to send a list of
- * protocols in the TLS client hello message, and the server to pick
- * one and send the selected one back in its server hello message.
- *
- * Separate lists of protocols can be sent for client connections and
- * for server connections, using the same SecurityContext. The [isServer]
- * boolean argument specifies whether to set the list for server connections
- * or client connections.
- */
- void setAlpnProtocols(List<String> protocols, bool isServer);
-
- /// Encodes a set of supported protocols for ALPN/NPN usage.
- ///
- /// The `protocols` list is expected to contain protocols in descending order
- /// of preference.
- ///
- /// See RFC 7301 (https://tools.ietf.org/html/rfc7301) for the encoding of
- /// `List<String> protocols`:
- /// opaque ProtocolName<1..2^8-1>;
- ///
- /// struct {
- /// ProtocolName protocol_name_list<2..2^16-1>
- /// } ProtocolNameList;
- ///
- /// The encoding of the opaque `ProtocolName<lower..upper>` vector is
- /// described in RFC 2246: 4.3 Vectors.
- ///
- /// Note: Even though this encoding scheme would allow a total
- /// `ProtocolNameList` length of 65535, this limit cannot be reached. Testing
- /// showed that more than ~ 2^14 bytes will fail to negotiate a protocol.
- /// We will be conservative and support only messages up to (1<<13)-1 bytes.
- static Uint8List _protocolsToLengthEncoding(List<String> protocols) {
- if (protocols == null || protocols.length == 0) {
- return new Uint8List(0);
- }
- int protocolsLength = protocols.length;
-
- // Calculate the number of bytes we will need if it is ASCII.
- int expectedLength = protocolsLength;
- for (int i = 0; i < protocolsLength; i++) {
- int length = protocols[i].length;
- if (length > 0 && length <= 255) {
- expectedLength += length;
- } else {
- throw new ArgumentError(
- 'Length of protocol must be between 1 and 255 (was: $length).');
- }
- }
-
- if (expectedLength >= (1 << 13)) {
- throw new ArgumentError(
- 'The maximum message length supported is 2^13-1.');
- }
-
- // Try encoding the `List<String> protocols` array using fast ASCII path.
- var bytes = new Uint8List(expectedLength);
- int bytesOffset = 0;
- for (int i = 0; i < protocolsLength; i++) {
- String proto = protocols[i];
-
- // Add length byte.
- bytes[bytesOffset++] = proto.length;
- int bits = 0;
-
- // Add protocol bytes.
- for (int j = 0; j < proto.length; j++) {
- var char = proto.codeUnitAt(j);
- bits |= char;
- bytes[bytesOffset++] = char & 0xff;
- }
-
- // Go slow case if we have encountered anything non-ascii.
- if (bits > 0x7f) {
- return _protocolsToLengthEncodingNonAsciiBailout(protocols);
- }
- }
- return bytes;
- }
-
- static Uint8List _protocolsToLengthEncodingNonAsciiBailout(
- List<String> protocols) {
- void addProtocol(List<int> outBytes, String protocol) {
- var protocolBytes = UTF8.encode(protocol);
- var len = protocolBytes.length;
-
- if (len > 255) {
- throw new ArgumentError(
- 'Length of protocol must be between 1 and 255 (was: $len)');
- }
- // Add length byte.
- outBytes.add(len);
-
- // Add protocol bytes.
- outBytes.addAll(protocolBytes);
- }
-
- List<int> bytes = [];
- for (var i = 0; i < protocols.length; i++) {
- addProtocol(bytes, protocols[i]);
- }
-
- if (bytes.length >= (1 << 13)) {
- throw new ArgumentError(
- 'The maximum message length supported is 2^13-1.');
- }
-
- return new Uint8List.fromList(bytes);
- }
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/io/service_object.dart b/pkg/dev_compiler/tool/input_sdk/lib/io/service_object.dart
deleted file mode 100644
index 43bd651..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/io/service_object.dart
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-part of dart.io;
-
-int _nextServiceId = 1;
-
-// TODO(ajohnsen): Use other way of getting a uniq id.
-abstract class _ServiceObject {
- int __serviceId = 0;
- int get _serviceId {
- if (__serviceId == 0) __serviceId = _nextServiceId++;
- return __serviceId;
- }
-
- Map _toJSON(bool ref);
-
- String get _servicePath => "$_serviceTypePath/$_serviceId";
-
- String get _serviceTypePath;
-
- String get _serviceTypeName;
-
- String _serviceType(bool ref) {
- if (ref) return "@$_serviceTypeName";
- return _serviceTypeName;
- }
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/io/socket.dart b/pkg/dev_compiler/tool/input_sdk/lib/io/socket.dart
deleted file mode 100644
index f85a5bd..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/io/socket.dart
+++ /dev/null
@@ -1,738 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-part of dart.io;
-
-
-/**
- * [InternetAddressType] is the type an [InternetAddress]. Currently,
- * IP version 4 (IPv4) and IP version 6 (IPv6) are supported.
- */
-class InternetAddressType {
- static const InternetAddressType IP_V4 = const InternetAddressType._(0);
- static const InternetAddressType IP_V6 = const InternetAddressType._(1);
- static const InternetAddressType ANY = const InternetAddressType._(-1);
-
- final int _value;
-
- const InternetAddressType._(this._value);
-
- factory InternetAddressType._from(int value) {
- if (value == 0) return IP_V4;
- if (value == 1) return IP_V6;
- throw new ArgumentError("Invalid type: $value");
- }
-
- /**
- * Get the name of the type, e.g. "IP_V4" or "IP_V6".
- */
- String get name {
- switch (_value) {
- case -1: return "ANY";
- case 0: return "IP_V4";
- case 1: return "IP_V6";
- default: throw new ArgumentError("Invalid InternetAddress");
- }
- }
-
- String toString() => "InternetAddressType: $name";
-}
-
-
-/**
- * An internet address.
- *
- * This object holds an internet address. If this internet address
- * is the result of a DNS lookup, the address also holds the hostname
- * used to make the lookup.
- * An Internet address combined with a port number represents an
- * endpoint to which a socket can connect or a listening socket can
- * bind.
- */
-abstract class InternetAddress {
- /**
- * IP version 4 loopback address. Use this address when listening on
- * or connecting to the loopback adapter using IP version 4 (IPv4).
- */
- external static InternetAddress get LOOPBACK_IP_V4;
-
- /**
- * IP version 6 loopback address. Use this address when listening on
- * or connecting to the loopback adapter using IP version 6 (IPv6).
- */
- external static InternetAddress get LOOPBACK_IP_V6;
-
- /**
- * IP version 4 any address. Use this address when listening on
- * all adapters IP addresses using IP version 4 (IPv4).
- */
- external static InternetAddress get ANY_IP_V4;
-
- /**
- * IP version 6 any address. Use this address when listening on
- * all adapters IP addresses using IP version 6 (IPv6).
- */
- external static InternetAddress get ANY_IP_V6;
-
- /**
- * The [type] of the [InternetAddress] specified what IP protocol.
- */
- InternetAddressType type;
-
- /**
- * The numeric address of the host. For IPv4 addresses this is using
- * the dotted-decimal notation. For IPv6 it is using the
- * hexadecimal representation.
- */
- String get address;
-
- /**
- * The host used to lookup the address. If there is no host
- * associated with the address this returns the numeric address.
- */
- String get host;
-
- /**
- * Get the raw address of this [InternetAddress]. The result is either a
- * 4 or 16 byte long list. The returned list is a copy, making it possible
- * to change the list without modifying the [InternetAddress].
- */
- List<int> get rawAddress;
-
- /**
- * Returns true if the [InternetAddress] is a loopback address.
- */
- bool get isLoopback;
-
- /**
- * Returns true if the [InternetAddress]s scope is a link-local.
- */
- bool get isLinkLocal;
-
- /**
- * Returns true if the [InternetAddress]s scope is multicast.
- */
- bool get isMulticast;
-
- /**
- * Creates a new [InternetAddress] from a numeric address.
- *
- * If the address in [address] is not a numeric IPv4
- * (dotted-decimal notation) or IPv6 (hexadecimal representation).
- * address [ArgumentError] is thrown.
- */
- external factory InternetAddress(String address);
-
- /**
- * Perform a reverse dns lookup on the [address], creating a new
- * [InternetAddress] where the host field set to the result.
- */
- Future<InternetAddress> reverse();
-
- /**
- * Lookup a host, returning a Future of a list of
- * [InternetAddress]s. If [type] is [InternetAddressType.ANY], it
- * will lookup both IP version 4 (IPv4) and IP version 6 (IPv6)
- * addresses. If [type] is either [InternetAddressType.IP_V4] or
- * [InternetAddressType.IP_V6] it will only lookup addresses of the
- * specified type. The order of the list can, and most likely will,
- * change over time.
- */
- external static Future<List<InternetAddress>> lookup(
- String host, {InternetAddressType type: InternetAddressType.ANY});
-
- /**
- * Clones the given [address] with the new [host].
- *
- * The [address] must be an [InternetAddress] that was created with one
- * of the static methods of this class.
- */
- external static InternetAddress _cloneWithNewHost(
- InternetAddress address, String host);
-}
-
-
-/**
- * A [NetworkInterface] represents an active network interface on the current
- * system. It contains a list of [InternetAddress]es that are bound to the
- * interface.
- */
-abstract class NetworkInterface {
- /**
- * Get the name of the [NetworkInterface].
- */
- String get name;
-
- /**
- * Get the index of the [NetworkInterface].
- */
- String get index;
-
- /**
- * Get a list of [InternetAddress]es currently bound to this
- * [NetworkInterface].
- */
- List<InternetAddress> get addresses;
-
- /**
- * Whether [list] is supported.
- *
- * [list] is currently unsupported on Android.
- */
- external static bool get listSupported;
-
- /**
- * Query the system for [NetworkInterface]s.
- *
- * If [includeLoopback] is `true`, the returned list will include the
- * loopback device. Default is `false`.
- *
- * If [includeLinkLocal] is `true`, the list of addresses of the returned
- * [NetworkInterface]s, may include link local addresses. Default is `false`.
- *
- * If [type] is either [InternetAddressType.IP_V4] or
- * [InternetAddressType.IP_V6] it will only lookup addresses of the
- * specified type. Default is [InternetAddressType.ANY].
- */
- external static Future<List<NetworkInterface>> list({
- bool includeLoopback: false,
- bool includeLinkLocal: false,
- InternetAddressType type: InternetAddressType.ANY});
-}
-
-
-/**
- * A [RawServerSocket] represents a listening socket, and provides a
- * stream of low-level [RawSocket] objects, one for each connection
- * made to the listening socket.
- *
- * See [RawSocket] for more info.
- */
-abstract class RawServerSocket implements Stream<RawSocket> {
- /**
- * Returns a future for a [:RawServerSocket:]. When the future
- * completes the server socket is bound to the given [address] and
- * [port] and has started listening on it.
- *
- * The [address] can either be a [String] or an
- * [InternetAddress]. If [address] is a [String], [bind] will
- * perform a [InternetAddress.lookup] and use the first value in the
- * list. To listen on the loopback adapter, which will allow only
- * incoming connections from the local host, use the value
- * [InternetAddress.LOOPBACK_IP_V4] or
- * [InternetAddress.LOOPBACK_IP_V6]. To allow for incoming
- * connection from the network use either one of the values
- * [InternetAddress.ANY_IP_V4] or [InternetAddress.ANY_IP_V6] to
- * bind to all interfaces or the IP address of a specific interface.
- *
- * If an IP version 6 (IPv6) address is used, both IP version 6
- * (IPv6) and version 4 (IPv4) connections will be accepted. To
- * restrict this to version 6 (IPv6) only, use [v6Only] to set
- * version 6 only.
- *
- * If [port] has the value [:0:] an ephemeral port will
- * be chosen by the system. The actual port used can be retrieved
- * using the [:port:] getter.
- *
- * The optional argument [backlog] can be used to specify the listen
- * backlog for the underlying OS listen setup. If [backlog] has the
- * value of [:0:] (the default) a reasonable value will be chosen by
- * the system.
- *
- * The optional argument [shared] specifies whether additional RawServerSocket
- * objects can bind to the same combination of `address`, `port` and `v6Only`.
- * If `shared` is `true` and more `RawServerSocket`s from this isolate or
- * other isolates are bound to the port, then the incoming connections will be
- * distributed among all the bound `RawServerSocket`s. Connections can be
- * distributed over multiple isolates this way.
- */
- external static Future<RawServerSocket> bind(address,
- int port,
- {int backlog: 0,
- bool v6Only: false,
- bool shared: false});
-
- /**
- * Returns the port used by this socket.
- */
- int get port;
-
- /**
- * Returns the address used by this socket.
- */
- InternetAddress get address;
-
- /**
- * Closes the socket. The returned future completes when the socket
- * is fully closed and is no longer bound.
- */
- Future<RawServerSocket> close();
-}
-
-
-/**
- * A [ServerSocket] represents a listening socket, and provides a
- * stream of [Socket] objects, one for each connection made to the
- * listening socket.
- *
- * See [Socket] for more info.
- */
-abstract class ServerSocket implements Stream<Socket> {
- /**
- * Returns a future for a [:ServerSocket:]. When the future
- * completes the server socket is bound to the given [address] and
- * [port] and has started listening on it.
- *
- * The [address] can either be a [String] or an
- * [InternetAddress]. If [address] is a [String], [bind] will
- * perform a [InternetAddress.lookup] and use the first value in the
- * list. To listen on the loopback adapter, which will allow only
- * incoming connections from the local host, use the value
- * [InternetAddress.LOOPBACK_IP_V4] or
- * [InternetAddress.LOOPBACK_IP_V6]. To allow for incoming
- * connection from the network use either one of the values
- * [InternetAddress.ANY_IP_V4] or [InternetAddress.ANY_IP_V6] to
- * bind to all interfaces or the IP address of a specific interface.
- *
- * If an IP version 6 (IPv6) address is used, both IP version 6
- * (IPv6) and version 4 (IPv4) connections will be accepted. To
- * restrict this to version 6 (IPv6) only, use [v6Only] to set
- * version 6 only.
- *
- * If [port] has the value [:0:] an ephemeral port will be chosen by
- * the system. The actual port used can be retrieved using the
- * [port] getter.
- *
- * The optional argument [backlog] can be used to specify the listen
- * backlog for the underlying OS listen setup. If [backlog] has the
- * value of [:0:] (the default) a reasonable value will be chosen by
- * the system.
- *
- * The optional argument [shared] specifies whether additional ServerSocket
- * objects can bind to the same combination of `address`, `port` and `v6Only`.
- * If `shared` is `true` and more `ServerSocket`s from this isolate or other
- * isolates are bound to the port, then the incoming connections will be
- * distributed among all the bound `ServerSocket`s. Connections can be
- * distributed over multiple isolates this way.
- */
- external static Future<ServerSocket> bind(address,
- int port,
- {int backlog: 0,
- bool v6Only: false,
- bool shared: false});
-
- /**
- * Returns the port used by this socket.
- */
- int get port;
-
- /**
- * Returns the address used by this socket.
- */
- InternetAddress get address;
-
- /**
- * Closes the socket. The returned future completes when the socket
- * is fully closed and is no longer bound.
- */
- Future<ServerSocket> close();
-}
-
-
-/**
- * The [SocketDirection] is used as a parameter to [Socket.close] and
- * [RawSocket.close] to close a socket in the specified direction(s).
- */
-class SocketDirection {
- static const SocketDirection RECEIVE = const SocketDirection._(0);
- static const SocketDirection SEND = const SocketDirection._(1);
- static const SocketDirection BOTH = const SocketDirection._(2);
- final _value;
-
- const SocketDirection._(this._value);
-}
-
-/**
- * The [SocketOption] is used as a parameter to [Socket.setOption] and
- * [RawSocket.setOption] to set customize the behaviour of the underlying
- * socket.
- */
-class SocketOption {
- /**
- * Enable or disable no-delay on the socket. If TCP_NODELAY is enabled, the
- * socket will not buffer data internally, but instead write each data chunk
- * as an invidual TCP packet.
- *
- * TCP_NODELAY is disabled by default.
- */
- static const SocketOption TCP_NODELAY = const SocketOption._(0);
-
- static const SocketOption _IP_MULTICAST_LOOP = const SocketOption._(1);
- static const SocketOption _IP_MULTICAST_HOPS = const SocketOption._(2);
- static const SocketOption _IP_MULTICAST_IF = const SocketOption._(3);
- static const SocketOption _IP_BROADCAST = const SocketOption._(4);
- final _value;
-
- const SocketOption._(this._value);
-}
-
-/**
- * Events for the [RawSocket].
- */
-class RawSocketEvent {
- static const RawSocketEvent READ = const RawSocketEvent._(0);
- static const RawSocketEvent WRITE = const RawSocketEvent._(1);
- static const RawSocketEvent READ_CLOSED = const RawSocketEvent._(2);
- static const RawSocketEvent CLOSED = const RawSocketEvent._(3);
- final int _value;
-
- const RawSocketEvent._(this._value);
- String toString() {
- return const ['RawSocketEvent:READ',
- 'RawSocketEvent:WRITE',
- 'RawSocketEvent:READ_CLOSED',
- 'RawSocketEvent:CLOSED'][_value];
- }
-}
-
-/**
- * The [RawSocket] is a low-level interface to a socket, exposing the raw
- * events signaled by the system. It's a [Stream] of [RawSocketEvent]s.
- */
-abstract class RawSocket implements Stream<RawSocketEvent> {
- /**
- * Set or get, if the [RawSocket] should listen for [RawSocketEvent.READ]
- * events. Default is [:true:].
- */
- bool readEventsEnabled;
-
- /**
- * Set or get, if the [RawSocket] should listen for [RawSocketEvent.WRITE]
- * events. Default is [:true:].
- * This is a one-shot listener, and writeEventsEnabled must be set
- * to true again to receive another write event.
- */
- bool writeEventsEnabled;
-
- /**
- * Creates a new socket connection to the host and port and returns a [Future]
- * that will complete with either a [RawSocket] once connected or an error
- * if the host-lookup or connection failed.
- *
- * [host] can either be a [String] or an [InternetAddress]. If [host] is a
- * [String], [connect] will perform a [InternetAddress.lookup] and try
- * all returned [InternetAddress]es, until connected. Unless a
- * connection was established, the error from the first failing connection is
- * returned.
- *
- * The argument [sourceAddress] can be used to specify the local
- * address to bind when making the connection. `sourceAddress` can either
- * be a `String` or an `InternetAddress`. If a `String` is passed it must
- * hold a numeric IP address.
- */
- external static Future<RawSocket> connect(host, int port, {sourceAddress});
-
- /**
- * Returns the number of received and non-read bytes in the socket that
- * can be read.
- */
- 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]);
-
- /**
- * Writes up to [count] bytes of the buffer from [offset] buffer offset to
- * the socket. The number of successfully written bytes is returned. This
- * function is non-blocking and will only write data if buffer space is
- * available in the socket.
- *
- * The default value for [offset] is 0, and the default value for [count] is
- * [:buffer.length - offset:].
- */
- int write(List<int> buffer, [int offset, int count]);
-
- /**
- * Returns the port used by this socket.
- */
- int get port;
-
- /**
- * Returns the remote port connected to by this socket.
- */
- int get remotePort;
-
- /**
- * Returns the [InternetAddress] used to connect this socket.
- */
- InternetAddress get address;
-
- /**
- * Returns the remote [InternetAddress] connected to by this socket.
- */
- InternetAddress get remoteAddress;
-
- /**
- * Closes the socket. Returns a Future that completes with [this] when the
- * underlying connection is completely destroyed.
- *
- * Calling [close] will never throw an exception
- * and calling it several times is supported. Calling [close] can result in
- * a [RawSocketEvent.READ_CLOSED] event.
- */
- Future<RawSocket> close();
-
- /**
- * Shutdown the socket in the [direction]. Calling [shutdown] will never
- * throw an exception and calling it several times is supported. Calling
- * shutdown with either [SocketDirection.BOTH] or [SocketDirection.RECEIVE]
- * can result in a [RawSocketEvent.READ_CLOSED] event.
- */
- void shutdown(SocketDirection direction);
-
- /**
- * Use [setOption] to customize the [RawSocket]. See [SocketOption] for
- * available options.
- *
- * Returns [:true:] if the option was set successfully, false otherwise.
- */
- bool setOption(SocketOption option, bool enabled);
-}
-
-/**
- * A high-level class for communicating over a TCP socket.
- *
- * The [Socket] exposes both a [Stream] and a [IOSink] interface, making it
- * ideal for using together with other [Stream]s.
- */
-abstract class Socket implements Stream<List<int>>, IOSink {
- /**
- * Creates a new socket connection to the host and port and returns a [Future]
- * that will complete with either a [Socket] once connected or an error
- * if the host-lookup or connection failed.
- *
- * [host] can either be a [String] or an [InternetAddress]. If [host] is a
- * [String], [connect] will perform a [InternetAddress.lookup] and try
- * all returned [InternetAddress]es, until connected. Unless a
- * connection was established, the error from the first failing connection is
- * returned.
- *
- * The argument [sourceAddress] can be used to specify the local
- * address to bind when making the connection. `sourceAddress` can either
- * be a `String` or an `InternetAddress`. If a `String` is passed it must
- * hold a numeric IP address.
- */
- external static Future<Socket> connect(host, int port, {sourceAddress});
-
- /**
- * Destroy the socket in both directions. Calling [destroy] will make the
- * send a close event on the stream and will no longer react on data being
- * piped to it.
- *
- * Call [close](inherited from [IOSink]) to only close the [Socket]
- * for sending data.
- */
- void destroy();
-
- /**
- * Use [setOption] to customize the [RawSocket]. See [SocketOption] for
- * available options.
- *
- * Returns [:true:] if the option was set successfully, false otherwise.
- */
- bool setOption(SocketOption option, bool enabled);
-
- /**
- * Returns the port used by this socket.
- */
- int get port;
-
- /**
- * Returns the remote port connected to by this socket.
- */
- int get remotePort;
-
- /**
- * Returns the [InternetAddress] used to connect this socket.
- */
- InternetAddress get address;
-
- /**
- * Returns the remote [InternetAddress] connected to by this socket.
- */
- InternetAddress get remoteAddress;
-}
-
-
-/**
- * Datagram package. Data send to and received from datagram sockets
- * contains the internet address and port of the destination or source
- * togeter with the data.
- */
-class Datagram {
- List<int> data;
- InternetAddress address;
- int port;
-
- Datagram(this.data, this.address, this.port);
-}
-
-
-/**
- * The [RawDatagramSocket] is a low-level interface to an UDP socket,
- * exposing the raw events signaled by the system. It's a [Stream] of
- * [RawSocketEvent]s.
- *
- * Note that the event [RawSocketEvent.READ_CLOSED] will never be
- * received as an UDP socket cannot be closed by a remote peer.
- */
-abstract class RawDatagramSocket extends Stream<RawSocketEvent> {
- /**
- * Set or get, if the [RawDatagramSocket] should listen for
- * [RawSocketEvent.READ] events. Default is [:true:].
- */
- bool readEventsEnabled;
-
- /**
- * Set or get, if the [RawDatagramSocket] should listen for
- * [RawSocketEvent.WRITE] events. Default is [:true:]. This is a
- * one-shot listener, and writeEventsEnabled must be set to true
- * again to receive another write event.
- */
- bool writeEventsEnabled;
-
- /**
- * Set or get, whether multicast traffic is looped back to the host.
- *
- * By default multicast loopback is enabled.
- */
- bool multicastLoopback;
-
- /**
- * Set or get, the maximum network hops for multicast packages
- * originating from this socket.
- *
- * For IPv4 this is referred to as TTL (time to live).
- *
- * By default this value is 1 causing multicast traffic to stay on
- * the local network.
- */
- int multicastHops;
-
- /**
- * Set or get, the network interface used for outgoing multicast packages.
- *
- * A value of `null`indicate that the system chooses the network
- * interface to use.
- *
- * By default this value is `null`
- */
- NetworkInterface multicastInterface;
-
- /**
- * Set or get, whether IPv4 broadcast is enabled.
- *
- * IPv4 broadcast needs to be enabled by the sender for sending IPv4
- * broadcast packages. By default IPv4 broadcast is disabled.
- *
- * For IPv6 there is no general broadcast mechanism. Use multicast
- * instead.
- */
- bool broadcastEnabled;
-
- /**
- * Creates a new raw datagram socket binding it to an address and
- * port.
- */
- external static Future<RawDatagramSocket> bind(
- host, int port, {bool reuseAddress: true});
-
- /**
- * Returns the port used by this socket.
- */
- int get port;
-
- /**
- * Returns the address used by this socket.
- */
- InternetAddress get address;
-
- /**
- * Close the datagram socket.
- */
- void close();
-
- /**
- * Send a datagram.
- *
- * Returns the number of bytes written. This will always be either
- * the size of [buffer] or `0`.
- */
- int send(List<int> buffer, InternetAddress address, int port);
-
- /**
- * Receive a datagram. If there are no datagrams available `null` is
- * returned.
- *
- * The maximum length of the datagram that can be received is 65503 bytes.
- */
- Datagram receive();
-
- /**
- * Join a multicast group.
- *
- * If an error occur when trying to join the multicast group an
- * exception is thrown.
- */
- void joinMulticast(InternetAddress group, {NetworkInterface interface});
-
- /**
- * Leave a multicast group.
- *
- * If an error occur when trying to join the multicase group an
- * exception is thrown.
- */
- void leaveMulticast(InternetAddress group, {NetworkInterface interface});
-}
-
-
-class SocketException implements IOException {
- final String message;
- final OSError osError;
- final InternetAddress address;
- final int port;
-
- const SocketException(this.message, {this.osError, this.address, this.port});
- const SocketException.closed()
- : message = 'Socket has been closed',
- osError = null,
- address = null,
- port = null;
-
- String toString() {
- StringBuffer sb = new StringBuffer();
- sb.write("SocketException");
- if (!message.isEmpty) {
- sb.write(": $message");
- if (osError != null) {
- sb.write(" ($osError)");
- }
- } else if (osError != null) {
- sb.write(": $osError");
- }
- if (address != null) {
- sb.write(", address = ${address.host}");
- }
- if (port != null) {
- sb.write(", port = $port");
- }
- return sb.toString();
- }
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/io/stdio.dart b/pkg/dev_compiler/tool/input_sdk/lib/io/stdio.dart
deleted file mode 100644
index 03721e9..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/io/stdio.dart
+++ /dev/null
@@ -1,361 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-part of dart.io;
-
-const int _STDIO_HANDLE_TYPE_TERMINAL = 0;
-const int _STDIO_HANDLE_TYPE_PIPE = 1;
-const int _STDIO_HANDLE_TYPE_FILE = 2;
-const int _STDIO_HANDLE_TYPE_SOCKET = 3;
-const int _STDIO_HANDLE_TYPE_OTHER = 4;
-
-
-class _StdStream extends Stream<List<int>> {
- final Stream<List<int>> _stream;
-
- _StdStream(this._stream);
-
- StreamSubscription<List<int>> listen(void onData(List<int> event),
- {Function onError,
- void onDone(),
- bool cancelOnError}) {
- return _stream.listen(
- onData,
- onError: onError,
- onDone: onDone,
- cancelOnError: cancelOnError);
- }
-}
-
-
-/**
- * [Stdin] allows both synchronous and asynchronous reads from the standard
- * input stream.
- *
- * Mixing synchronous and asynchronous reads is undefined.
- */
-class Stdin extends _StdStream implements Stream<List<int>> {
- Stdin._(Stream<List<int>> stream) : super(stream);
-
- /**
- * Synchronously read a line from stdin. This call will block until a full
- * line is available.
- *
- * The argument [encoding] can be used to changed how the input should be
- * decoded. Default is [SYSTEM_ENCODING].
- *
- * If [retainNewlines] is `false`, the returned String will not contain the
- * final newline. If `true`, the returned String will contain the line
- * terminator. Default is `false`.
- *
- * If end-of-file is reached after any bytes have been read from stdin,
- * that data is returned.
- * Returns `null` if no bytes preceeded the end of input.
- */
- String readLineSync({Encoding encoding: SYSTEM_ENCODING,
- bool retainNewlines: false}) {
- const CR = 13;
- const LF = 10;
- final List line = [];
- // On Windows, if lineMode is disabled, only CR is received.
- bool crIsNewline = Platform.isWindows &&
- (stdioType(stdin) == StdioType.TERMINAL) &&
- !lineMode;
- if (retainNewlines) {
- int byte;
- do {
- byte = readByteSync();
- if (byte < 0) {
- break;
- }
- line.add(byte);
- } while (byte != LF && !(byte == CR && crIsNewline));
- if (line.isEmpty) {
- return null;
- }
- } else if (crIsNewline) {
- // CR and LF are both line terminators, neither is retained.
- while (true) {
- int byte = readByteSync();
- if (byte < 0) {
- if (line.isEmpty) return null;
- break;
- }
- if (byte == LF || byte == CR) break;
- line.add(byte);
- }
- } else {
- // Case having to hande CR LF as a single unretained line terminator.
- outer: while (true) {
- int byte = readByteSync();
- if (byte == LF) break;
- if (byte == CR) {
- do {
- byte = readByteSync();
- if (byte == LF) break outer;
-
- line.add(CR);
- } while (byte == CR);
- // Fall through and handle non-CR character.
- }
- if (byte < 0) {
- if (line.isEmpty) return null;
- break;
- }
- line.add(byte);
- }
- }
- return encoding.decode(line);
- }
-
- /**
- * Check if echo mode is enabled on [stdin].
- */
- external bool get echoMode;
-
- /**
- * Enable or disable echo mode on [stdin].
- *
- * If disabled, input from to console will not be echoed.
- *
- * Default depends on the parent process, but usually enabled.
- */
- external void set echoMode(bool enabled);
-
- /**
- * Check if line mode is enabled on [stdin].
- */
- external bool get lineMode;
-
- /**
- * Enable or disable line mode on [stdin].
- *
- * If enabled, characters are delayed until a new-line character is entered.
- * If disabled, characters will be available as typed.
- *
- * Default depends on the parent process, but usually enabled.
- */
- external void set lineMode(bool enabled);
-
- /**
- * Synchronously read a byte from stdin. This call will block until a byte is
- * available.
- *
- * If at end of file, -1 is returned.
- */
- external int readByteSync();
-}
-
-
-/**
- * [Stdout] represents the [IOSink] for either `stdout` or `stderr`.
- *
- * It provides a *blocking* `IOSink`, so using this to write will block until
- * the output is written.
- *
- * In some situations this blocking behavior is undesirable as it does not
- * provide the same non-blocking behavior as dart:io in general exposes.
- * Use the property [nonBlocking] to get an `IOSink` which has the non-blocking
- * behavior.
- *
- * This class can also be used to check whether `stdout` or `stderr` is
- * connected to a terminal and query some terminal properties.
- */
-class Stdout extends _StdSink implements IOSink {
- final int _fd;
- IOSink _nonBlocking;
-
- Stdout._(IOSink sink, this._fd) : super(sink);
-
- /**
- * Returns true if there is a terminal attached to stdout.
- */
- bool get hasTerminal => _hasTerminal(_fd);
-
- /**
- * Get the number of columns of the terminal.
- *
- * If no terminal is attached to stdout, a [StdoutException] is thrown. See
- * [hasTerminal] for more info.
- */
- int get terminalColumns => _terminalColumns(_fd);
-
- /**
- * Get the number of lines of the terminal.
- *
- * If no terminal is attached to stdout, a [StdoutException] is thrown. See
- * [hasTerminal] for more info.
- */
- int get terminalLines => _terminalLines(_fd);
-
- external bool _hasTerminal(int fd);
- external int _terminalColumns(int fd);
- external int _terminalLines(int fd);
-
- /**
- * Get a non-blocking `IOSink`.
- */
- IOSink get nonBlocking {
- if (_nonBlocking == null) {
- _nonBlocking = new IOSink(new _FileStreamConsumer.fromStdio(_fd));
- }
- return _nonBlocking;
- }
-}
-
-
-class StdoutException implements IOException {
- final String message;
- final OSError osError;
-
- const StdoutException(this.message, [this.osError]);
-
- String toString() {
- return "StdoutException: $message${osError == null ? "" : ", $osError"}";
- }
-}
-
-class _StdConsumer implements StreamConsumer<List<int>> {
- final _file;
-
- _StdConsumer(int fd) : _file = _File._openStdioSync(fd);
-
- Future addStream(Stream<List<int>> stream) {
- var completer = new Completer();
- var sub;
- sub = stream.listen(
- (data) {
- try {
- _file.writeFromSync(data);
- } catch (e, s) {
- sub.cancel();
- completer.completeError(e, s);
- }
- },
- onError: completer.completeError,
- onDone: completer.complete,
- cancelOnError: true);
- return completer.future;
- }
-
- Future close() {
- _file.closeSync();
- return new Future.value();
- }
-}
-
-class _StdSink implements IOSink {
- final IOSink _sink;
-
- _StdSink(this._sink);
-
- Encoding get encoding => _sink.encoding;
- void set encoding(Encoding encoding) {
- _sink.encoding = encoding;
- }
- void write(object) { _sink.write(object); }
- void writeln([object = "" ]) { _sink.writeln(object); }
- void writeAll(objects, [sep = ""]) { _sink.writeAll(objects, sep); }
- void add(List<int> data) { _sink.add(data); }
- void addError(error, [StackTrace stackTrace]) {
- _sink.addError(error, stackTrace);
- }
- void writeCharCode(int charCode) { _sink.writeCharCode(charCode); }
- Future addStream(Stream<List<int>> stream) => _sink.addStream(stream);
- Future flush() => _sink.flush();
- Future close() => _sink.close();
- Future get done => _sink.done;
-}
-
-/// The type of object a standard IO stream is attached to.
-class StdioType {
- static const StdioType TERMINAL = const StdioType._("terminal");
- static const StdioType PIPE = const StdioType._("pipe");
- static const StdioType FILE = const StdioType._("file");
- static const StdioType OTHER = const StdioType._("other");
- final String name;
- const StdioType._(this.name);
- String toString() => "StdioType: $name";
-}
-
-
-Stdin _stdin;
-Stdout _stdout;
-Stdout _stderr;
-
-
-/// The standard input stream of data read by this program.
-Stdin get stdin {
- if (_stdin == null) {
- _stdin = _StdIOUtils._getStdioInputStream();
- }
- return _stdin;
-}
-
-
-/// The standard output stream of data written by this program.
-Stdout get stdout {
- if (_stdout == null) {
- _stdout = _StdIOUtils._getStdioOutputStream(1);
- }
- return _stdout;
-}
-
-
-/// The standard output stream of errors written by this program.
-Stdout get stderr {
- if (_stderr == null) {
- _stderr = _StdIOUtils._getStdioOutputStream(2);
- }
- return _stderr;
-}
-
-
-/// For a stream, returns whether it is attached to a file, pipe, terminal, or
-/// something else.
-StdioType stdioType(object) {
- if (object is _StdStream) {
- object = object._stream;
- } else if (object == stdout || object == stderr) {
- switch (_StdIOUtils._getStdioHandleType(object == stdout ? 1 : 2)) {
- case _STDIO_HANDLE_TYPE_TERMINAL: return StdioType.TERMINAL;
- case _STDIO_HANDLE_TYPE_PIPE: return StdioType.PIPE;
- case _STDIO_HANDLE_TYPE_FILE: return StdioType.FILE;
- }
- }
- if (object is _FileStream) {
- return StdioType.FILE;
- }
- if (object is Socket) {
- int socketType = _StdIOUtils._socketType(object);
- if (socketType == null) return StdioType.OTHER;
- switch (socketType) {
- case _STDIO_HANDLE_TYPE_TERMINAL:
- return StdioType.TERMINAL;
- case _STDIO_HANDLE_TYPE_PIPE:
- return StdioType.PIPE;
- case _STDIO_HANDLE_TYPE_FILE:
- return StdioType.FILE;
- }
- }
- if (object is _IOSinkImpl) {
- try {
- if (object._target is _FileStreamConsumer) {
- return StdioType.FILE;
- }
- } catch (e) {
- // Only the interface implemented, _sink not available.
- }
- }
- return StdioType.OTHER;
-}
-
-
-class _StdIOUtils {
- external static _getStdioOutputStream(int fd);
- external static Stdin _getStdioInputStream();
- /// Returns the socket type or `null` if [socket] is not a builtin socket.
- external static int _socketType(Socket socket);
- external static _getStdioHandleType(int fd);
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/io/string_transformer.dart b/pkg/dev_compiler/tool/input_sdk/lib/io/string_transformer.dart
deleted file mode 100644
index ab17eaf..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/io/string_transformer.dart
+++ /dev/null
@@ -1,130 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-part of dart.io;
-
-/// The current system encoding.
-///
-/// This us used for converting from bytes to/from String when
-/// communicating on stdin, stdout and stderr.
-///
-/// On Windows this will use the currently active code page for the
-/// conversion. On all other systems it will always use UTF-8.
-const SystemEncoding SYSTEM_ENCODING = const SystemEncoding();
-
-/**
- * The system encoding is the current code page on Windows and UTF-8 on
- * Linux and Mac.
- */
-class SystemEncoding extends Encoding {
- const SystemEncoding();
-
- String get name => 'system';
-
- List<int> encode(String input) => encoder.convert(input);
- String decode(List<int> encoded) => decoder.convert(encoded);
-
- Converter<String, List<int>> get encoder {
- if (Platform.operatingSystem == "windows") {
- return const _WindowsCodePageEncoder();
- } else {
- return const Utf8Encoder();
- }
- }
-
- Converter<List<int>, String> get decoder {
- if (Platform.operatingSystem == "windows") {
- return const _WindowsCodePageDecoder();
- } else {
- return const Utf8Decoder();
- }
- }
-}
-
-class _WindowsCodePageEncoder extends Converter<String, List<int>> {
-
- const _WindowsCodePageEncoder();
-
- List<int> convert(String input) {
- List<int> encoded = _encodeString(input);
- if (encoded == null) {
- throw new FormatException("Invalid character for encoding");
- }
- return encoded;
- }
-
- /**
- * Starts a chunked conversion.
- */
- StringConversionSink startChunkedConversion(Sink<List<int>> sink) {
- return new _WindowsCodePageEncoderSink(sink);
- }
-
- external static List<int> _encodeString(String string);
-}
-
-class _WindowsCodePageEncoderSink extends StringConversionSinkBase {
- // TODO(floitsch): provide more efficient conversions when the input is
- // not a String.
-
- final Sink<List<int>> _sink;
-
- _WindowsCodePageEncoderSink(this._sink);
-
- void close() {
- _sink.close();
- }
-
- void add(String string) {
- List<int> encoded = _WindowsCodePageEncoder._encodeString(string);
- if (encoded == null) {
- throw new FormatException("Invalid character for encoding");
- }
- _sink.add(encoded);
- }
-
- void addSlice(String source, int start, int end, bool isLast) {
- if (start != 0 || end != source.length) {
- source = source.substring(start, end);
- }
- add(source);
- if (isLast) close();
- }
-}
-
-
-class _WindowsCodePageDecoder extends Converter<List<int>, String> {
-
- const _WindowsCodePageDecoder();
-
- String convert(List<int> input) {
- return _decodeBytes(input);
- }
-
- /**
- * Starts a chunked conversion.
- */
- ByteConversionSink startChunkedConversion(Sink<String> sink) {
- return new _WindowsCodePageDecoderSink(sink);
- }
-
- external static String _decodeBytes(List<int> bytes);
-}
-
-class _WindowsCodePageDecoderSink extends ByteConversionSinkBase {
- // TODO(floitsch): provide more efficient conversions when the input is
- // a slice.
-
- final Sink<String> _sink;
-
- _WindowsCodePageDecoderSink(this._sink);
-
- void close() {
- _sink.close();
- }
-
- void add(List<int> bytes) {
- _sink.add(_WindowsCodePageDecoder._decodeBytes(bytes));
- }
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/io/websocket.dart b/pkg/dev_compiler/tool/input_sdk/lib/io/websocket.dart
deleted file mode 100644
index 183714f..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/io/websocket.dart
+++ /dev/null
@@ -1,410 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-part of dart.io;
-
-/**
- * WebSocket status codes used when closing a WebSocket connection.
- */
-abstract class WebSocketStatus {
- static const int NORMAL_CLOSURE = 1000;
- static const int GOING_AWAY = 1001;
- static const int PROTOCOL_ERROR = 1002;
- static const int UNSUPPORTED_DATA = 1003;
- static const int RESERVED_1004 = 1004;
- static const int NO_STATUS_RECEIVED = 1005;
- static const int ABNORMAL_CLOSURE = 1006;
- static const int INVALID_FRAME_PAYLOAD_DATA = 1007;
- static const int POLICY_VIOLATION = 1008;
- static const int MESSAGE_TOO_BIG = 1009;
- static const int MISSING_MANDATORY_EXTENSION = 1010;
- static const int INTERNAL_SERVER_ERROR = 1011;
- static const int RESERVED_1015 = 1015;
-}
-
-/**
- * The [CompressionOptions] class allows you to control
- * the options of WebSocket compression.
- */
-class CompressionOptions {
- /**
- * Default WebSocket Compression options.
- * Compression will be enabled with the following options:
- * clientNoContextTakeover: false
- * serverNoContextTakeover: false
- * clientMaxWindowBits: 15
- * serverMaxWindowBits: 15
- */
- static const CompressionOptions DEFAULT = const CompressionOptions();
-
- /**
- * Disables WebSocket Compression.
- */
- static const CompressionOptions OFF =
- const CompressionOptions(enabled: false);
-
- /**
- * Control whether the client will reuse it's compression instances.
- */
- final bool clientNoContextTakeover;
-
- /**
- * Control whether the server will reuse it's compression instances.
- */
- final bool serverNoContextTakeover;
-
- /**
- * Sets the Max Window Bits for the Client.
- */
- final int clientMaxWindowBits;
-
- /**
- * Sets the Max Window Bits for the Server.
- */
- final int serverMaxWindowBits;
-
- /**
- * Enables or disables WebSocket compression.
- */
- final bool enabled;
-
- const CompressionOptions(
- {this.clientNoContextTakeover: false,
- this.serverNoContextTakeover: false,
- this.clientMaxWindowBits,
- this.serverMaxWindowBits,
- this.enabled: true});
-
- /// Parses list of requested server headers to return server compression
- /// response headers. Uses [serverMaxWindowBits] value if set, otherwise will
- /// attempt to use value from headers. Defaults to
- /// [WebSocket.DEFAULT_WINDOW_BITS]. Returns a [_CompressionMaxWindowBits]
- /// object which contains the response headers and negotiated max window bits.
- _CompressionMaxWindowBits _createServerResponseHeader(HeaderValue requested) {
- var info = new _CompressionMaxWindowBits();
-
- int mwb;
- String part;
- if (requested?.parameters != null) {
- part = requested.parameters[_serverMaxWindowBits];
- }
- if (part != null) {
- if (part.length >= 2 && part.startsWith('0')) {
- throw new ArgumentError("Illegal 0 padding on value.");
- } else {
- mwb = serverMaxWindowBits == null
- ? int.parse(part,
- onError: (source) => _WebSocketImpl.DEFAULT_WINDOW_BITS)
- : serverMaxWindowBits;
- info.headerValue = "; server_max_window_bits=${mwb}";
- info.maxWindowBits = mwb;
- }
- } else {
- info.headerValue = "";
- info.maxWindowBits = _WebSocketImpl.DEFAULT_WINDOW_BITS;
- }
- return info;
- }
-
- /// Returns default values for client compression request headers.
- String _createClientRequestHeader(HeaderValue requested, int size) {
- var info = "";
-
- // If responding to a valid request, specify size
- if (requested != null) {
- info = "; client_max_window_bits=$size";
- } else {
- // Client request. Specify default
- if (clientMaxWindowBits == null) {
- info = "; client_max_window_bits";
- } else {
- info = "; client_max_window_bits=$clientMaxWindowBits";
- }
- if (serverMaxWindowBits != null) {
- info += "; server_max_window_bits=$serverMaxWindowBits";
- }
- }
-
- return info;
- }
-
- /// Create a Compression Header. If [requested] is null or contains
- /// client request headers, returns Client compression request headers with
- /// default settings for `client_max_window_bits` header value.
- /// If [requested] contains server response headers this method returns
- /// a Server compression response header negotiating the max window bits
- /// for both client and server as requested server_max_window_bits value.
- /// This method returns a [_CompressionMaxWindowBits] object with the
- /// response headers and negotiated maxWindowBits value.
- _CompressionMaxWindowBits _createHeader([HeaderValue requested]) {
- var info = new _CompressionMaxWindowBits("", 0);
- if (!enabled) {
- return info;
- }
-
- info.headerValue = _WebSocketImpl.PER_MESSAGE_DEFLATE;
-
- if (clientNoContextTakeover &&
- (requested == null || (requested != null &&
- requested.parameters.containsKey(_clientNoContextTakeover)))) {
- info.headerValue += "; client_no_context_takeover";
- }
-
- if (serverNoContextTakeover &&
- (requested == null || (requested != null &&
- requested.parameters.containsKey(_serverNoContextTakeover)))) {
- info.headerValue += "; server_no_context_takeover";
- }
-
- var headerList = _createServerResponseHeader(requested);
- info.headerValue += headerList.headerValue;
- info.maxWindowBits = headerList.maxWindowBits;
-
- info.headerValue +=
- _createClientRequestHeader(requested, info.maxWindowBits);
-
- return info;
- }
-}
-
-/**
- * The [WebSocketTransformer] provides the ability to upgrade a
- * [HttpRequest] to a [WebSocket] connection. It supports both
- * upgrading a single [HttpRequest] and upgrading a stream of
- * [HttpRequest]s.
- *
- * To upgrade a single [HttpRequest] use the static [upgrade] method.
- *
- * HttpServer server;
- * server.listen((request) {
- * if (...) {
- * WebSocketTransformer.upgrade(request).then((websocket) {
- * ...
- * });
- * } else {
- * // Do normal HTTP request processing.
- * }
- * });
- *
- * To transform a stream of [HttpRequest] events as it implements a
- * stream transformer that transforms a stream of HttpRequest into a
- * stream of WebSockets by upgrading each HttpRequest from the HTTP or
- * HTTPS server, to the WebSocket protocol.
- *
- * server.transform(new WebSocketTransformer()).listen((webSocket) => ...);
- *
- * This transformer strives to implement WebSockets as specified by RFC6455.
- */
-abstract class WebSocketTransformer
- implements StreamTransformer<HttpRequest, WebSocket> {
- /**
- * Create a new [WebSocketTransformer].
- *
- * If [protocolSelector] is provided, [protocolSelector] will be called to
- * select what protocol to use, if any were provided by the client.
- * [protocolSelector] is should return either a [String] or a [Future]
- * completing with a [String]. The [String] must exist in the list of
- * protocols.
- *
- * If [compression] is provided, the [WebSocket] created will be configured
- * to negotiate with the specified [CompressionOptions]. If none is specified
- * then the [WebSocket] will be created with the default [CompressionOptions].
- */
- factory WebSocketTransformer(
- {protocolSelector(List<String> protocols),
- CompressionOptions compression: CompressionOptions.DEFAULT}) =>
- new _WebSocketTransformerImpl(protocolSelector, compression);
-
- /**
- * Upgrades a [HttpRequest] to a [WebSocket] connection. If the
- * request is not a valid WebSocket upgrade request an HTTP response
- * with status code 500 will be returned. Otherwise the returned
- * future will complete with the [WebSocket] when the upgrade pocess
- * is complete.
- *
- * If [protocolSelector] is provided, [protocolSelector] will be called to
- * select what protocol to use, if any were provided by the client.
- * [protocolSelector] is should return either a [String] or a [Future]
- * completing with a [String]. The [String] must exist in the list of
- * protocols.
- *
- * If [compression] is provided, the [WebSocket] created will be configured
- * to negotiate with the specified [CompressionOptions]. If none is specified
- * then the [WebSocket] will be created with the default [CompressionOptions].
- */
- static Future<WebSocket> upgrade(HttpRequest request,
- {protocolSelector(List<String> protocols),
- CompressionOptions compression: CompressionOptions.DEFAULT}) {
- return _WebSocketTransformerImpl._upgrade(
- request, protocolSelector, compression);
- }
-
- /**
- * Checks whether the request is a valid WebSocket upgrade request.
- */
- static bool isUpgradeRequest(HttpRequest request) {
- return _WebSocketTransformerImpl._isUpgradeRequest(request);
- }
-}
-
-/**
- * A two-way HTTP communication object for client or server applications.
- *
- * The stream exposes the messages received. A text message will be of type
- * [:String:] and a binary message will be of type [:List<int>:].
- */
-abstract class WebSocket implements Stream, StreamSink {
- /**
- * Possible states of the connection.
- */
- static const int CONNECTING = 0;
- static const int OPEN = 1;
- static const int CLOSING = 2;
- static const int CLOSED = 3;
-
- /**
- * Set and get the interval for sending ping signals. If a ping message is not
- * answered by a pong message from the peer, the `WebSocket` is assumed
- * disconnected and the connection is closed with a
- * [WebSocketStatus.GOING_AWAY] close code. When a ping signal is sent, the
- * pong message must be received within [pingInterval].
- *
- * There are never two outstanding pings at any given time, and the next ping
- * timer starts when the pong is received.
- *
- * Set the [pingInterval] to `null` to disable sending ping messages.
- *
- * The default value is `null`.
- */
- Duration pingInterval;
-
- /**
- * Create a new WebSocket connection. The URL supplied in [url]
- * must use the scheme `ws` or `wss`.
- *
- * The [protocols] argument is specifying the subprotocols the
- * client is willing to speak.
- *
- * The [headers] argument is specifying additional HTTP headers for
- * setting up the connection. This would typically be the `Origin`
- * header and potentially cookies. The keys of the map are the header
- * fields and the values are either String or List<String>.
- *
- * If [headers] is provided, there are a number of headers
- * which are controlled by the WebSocket connection process. These
- * headers are:
- *
- * - `connection`
- * - `sec-websocket-key`
- * - `sec-websocket-protocol`
- * - `sec-websocket-version`
- * - `upgrade`
- *
- * If any of these are passed in the `headers` map they will be ignored.
- *
- * If the `url` contains user information this will be passed as basic
- * authentication when setting up the connection.
- */
- static Future<WebSocket> connect(String url,
- {Iterable<String> protocols,
- Map<String, dynamic> headers,
- CompressionOptions compression: CompressionOptions.DEFAULT}) =>
- _WebSocketImpl.connect(url, protocols, headers, compression: compression);
-
- @Deprecated('This constructor will be removed in Dart 2.0. Use `implements`'
- ' instead of `extends` if implementing this abstract class.')
- WebSocket();
-
- /**
- * Creates a WebSocket from an already-upgraded socket.
- *
- * The initial WebSocket handshake must have occurred prior to this call. A
- * WebSocket client can automatically perform the handshake using
- * [WebSocket.connect], while a server can do so using
- * [WebSocketTransformer.upgrade]. To manually upgrade an [HttpRequest],
- * [HttpRequest.detachSocket] may be called.
- *
- * [protocol] should be the protocol negotiated by this handshake, if any.
- *
- * [serverSide] must be passed explicitly. If it's `false`, the WebSocket will
- * act as the client and mask the messages it sends. If it's `true`, it will
- * act as the server and will not mask its messages.
- *
- * If [compression] is provided, the [WebSocket] created will be configured
- * to negotiate with the specified [CompressionOptions]. If none is specified
- * then the [WebSocket] will be created with the default [CompressionOptions].
- */
- factory WebSocket.fromUpgradedSocket(Socket socket,
- {String protocol,
- bool serverSide,
- CompressionOptions compression: CompressionOptions.DEFAULT}) {
- if (serverSide == null) {
- throw new ArgumentError("The serverSide argument must be passed "
- "explicitly to WebSocket.fromUpgradedSocket.");
- }
- return new _WebSocketImpl._fromSocket(
- socket, protocol, compression, serverSide);
- }
-
- /**
- * Returns the current state of the connection.
- */
- int get readyState;
-
- /**
- * The extensions property is initially the empty string. After the
- * WebSocket connection is established this string reflects the
- * extensions used by the server.
- */
- String get extensions;
-
- /**
- * The protocol property is initially the empty string. After the
- * WebSocket connection is established the value is the subprotocol
- * selected by the server. If no subprotocol is negotiated the
- * value will remain [:null:].
- */
- String get protocol;
-
- /**
- * The close code set when the WebSocket connection is closed. If
- * there is no close code available this property will be [:null:]
- */
- int get closeCode;
-
- /**
- * The close reason set when the WebSocket connection is closed. If
- * there is no close reason available this property will be [:null:]
- */
- String get closeReason;
-
- /**
- * Closes the WebSocket connection. Set the optional [code] and [reason]
- * arguments to send close information to the remote peer. If they are
- * omitted, the peer will see [WebSocketStatus.NO_STATUS_RECEIVED] code
- * with no reason.
- */
- Future close([int code, String reason]);
-
- /**
- * Sends data on the WebSocket connection. The data in [data] must
- * be either a [:String:], or a [:List<int>:] holding bytes.
- */
- void add(data);
-
- /**
- * Sends data from a stream on WebSocket connection. Each data event from
- * [stream] will be send as a single WebSocket frame. The data from [stream]
- * must be either [:String:]s, or [:List<int>:]s holding bytes.
- */
- Future addStream(Stream stream);
-}
-
-class WebSocketException implements IOException {
- final String message;
-
- const WebSocketException([this.message = ""]);
-
- String toString() => "WebSocketException: $message";
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/io/websocket_impl.dart b/pkg/dev_compiler/tool/input_sdk/lib/io/websocket_impl.dart
deleted file mode 100644
index 18d1cf2..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/io/websocket_impl.dart
+++ /dev/null
@@ -1,1258 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-part of dart.io;
-
-const String _webSocketGUID = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11";
-const String _clientNoContextTakeover = "client_no_context_takeover";
-const String _serverNoContextTakeover = "server_no_context_takeover";
-const String _clientMaxWindowBits = "client_max_window_bits";
-const String _serverMaxWindowBits = "server_max_window_bits";
-
-// Matches _WebSocketOpcode.
-class _WebSocketMessageType {
- static const int NONE = 0;
- static const int TEXT = 1;
- static const int BINARY = 2;
-}
-
-class _WebSocketOpcode {
- static const int CONTINUATION = 0;
- static const int TEXT = 1;
- static const int BINARY = 2;
- static const int RESERVED_3 = 3;
- static const int RESERVED_4 = 4;
- static const int RESERVED_5 = 5;
- static const int RESERVED_6 = 6;
- static const int RESERVED_7 = 7;
- static const int CLOSE = 8;
- static const int PING = 9;
- static const int PONG = 10;
- static const int RESERVED_B = 11;
- static const int RESERVED_C = 12;
- static const int RESERVED_D = 13;
- static const int RESERVED_E = 14;
- static const int RESERVED_F = 15;
-}
-
-/**
- * Stores the header and integer value derived from negotiation of
- * client_max_window_bits and server_max_window_bits. headerValue will be
- * set in the Websocket response headers.
- */
-class _CompressionMaxWindowBits {
- String headerValue;
- int maxWindowBits;
- _CompressionMaxWindowBits([this.headerValue, this.maxWindowBits]);
- String toString() => headerValue;
-}
-
-/**
- * The web socket protocol transformer handles the protocol byte stream
- * which is supplied through the [:handleData:]. As the protocol is processed,
- * it'll output frame data as either a List<int> or String.
- *
- * Important information about usage: Be sure you use cancelOnError, so the
- * socket will be closed when the processor encounter an error. Not using it
- * will lead to undefined behaviour.
- */
-// TODO(ajohnsen): make this transformer reusable?
-class _WebSocketProtocolTransformer
- implements StreamTransformer<List<int>, dynamic>, EventSink<Uint8List> {
- static const int START = 0;
- static const int LEN_FIRST = 1;
- static const int LEN_REST = 2;
- static const int MASK = 3;
- static const int PAYLOAD = 4;
- static const int CLOSED = 5;
- static const int FAILURE = 6;
- static const int FIN = 0x80;
- static const int RSV1 = 0x40;
- static const int RSV2 = 0x20;
- static const int RSV3 = 0x10;
- static const int OPCODE = 0xF;
-
- int _state = START;
- bool _fin = false;
- bool _compressed = false;
- int _opcode = -1;
- int _len = -1;
- bool _masked = false;
- int _remainingLenBytes = -1;
- int _remainingMaskingKeyBytes = 4;
- int _remainingPayloadBytes = -1;
- int _unmaskingIndex = 0;
- int _currentMessageType = _WebSocketMessageType.NONE;
- int closeCode = WebSocketStatus.NO_STATUS_RECEIVED;
- String closeReason = "";
-
- EventSink _eventSink;
-
- final bool _serverSide;
- final List _maskingBytes = new List(4);
- final BytesBuilder _payload = new BytesBuilder(copy: false);
-
- _WebSocketPerMessageDeflate _deflate;
- _WebSocketProtocolTransformer([this._serverSide = false, this._deflate]);
-
- Stream bind(Stream stream) {
- return new Stream.eventTransformed(stream, (EventSink eventSink) {
- if (_eventSink != null) {
- throw new StateError("WebSocket transformer already used.");
- }
- _eventSink = eventSink;
- return this;
- });
- }
-
- void addError(Object error, [StackTrace stackTrace]) {
- _eventSink.addError(error, stackTrace);
- }
-
- void close() { _eventSink.close(); }
-
- /**
- * Process data received from the underlying communication channel.
- */
- void add(List<int> bytes) {
- var buffer = bytes is Uint8List ? bytes : new Uint8List.fromList(bytes);
- int index = 0;
- int lastIndex = buffer.length;
- if (_state == CLOSED) {
- throw new WebSocketException("Data on closed connection");
- }
- if (_state == FAILURE) {
- throw new WebSocketException("Data on failed connection");
- }
- while ((index < lastIndex) && _state != CLOSED && _state != FAILURE) {
- int byte = buffer[index];
- if (_state <= LEN_REST) {
- if (_state == START) {
- _fin = (byte & FIN) != 0;
-
- if((byte & (RSV2 | RSV3)) != 0) {
- // The RSV2, RSV3 bits must both be zero.
- throw new WebSocketException("Protocol error");
- }
-
- _opcode = (byte & OPCODE);
-
- if (_opcode != _WebSocketOpcode.CONTINUATION) {
- if ((byte & RSV1) != 0) {
- _compressed = true;
- } else {
- _compressed = false;
- }
- }
-
- if (_opcode <= _WebSocketOpcode.BINARY) {
- if (_opcode == _WebSocketOpcode.CONTINUATION) {
- if (_currentMessageType == _WebSocketMessageType.NONE) {
- throw new WebSocketException("Protocol error");
- }
- } else {
- assert(_opcode == _WebSocketOpcode.TEXT ||
- _opcode == _WebSocketOpcode.BINARY);
- if (_currentMessageType != _WebSocketMessageType.NONE) {
- throw new WebSocketException("Protocol error");
- }
- _currentMessageType = _opcode;
- }
- } else if (_opcode >= _WebSocketOpcode.CLOSE &&
- _opcode <= _WebSocketOpcode.PONG) {
- // Control frames cannot be fragmented.
- if (!_fin) throw new WebSocketException("Protocol error");
- } else {
- throw new WebSocketException("Protocol error");
- }
- _state = LEN_FIRST;
- } else if (_state == LEN_FIRST) {
- _masked = (byte & 0x80) != 0;
- _len = byte & 0x7F;
- if (_isControlFrame() && _len > 125) {
- throw new WebSocketException("Protocol error");
- }
- if (_len == 126) {
- _len = 0;
- _remainingLenBytes = 2;
- _state = LEN_REST;
- } else if (_len == 127) {
- _len = 0;
- _remainingLenBytes = 8;
- _state = LEN_REST;
- } else {
- assert(_len < 126);
- _lengthDone();
- }
- } else {
- assert(_state == LEN_REST);
- _len = _len << 8 | byte;
- _remainingLenBytes--;
- if (_remainingLenBytes == 0) {
- _lengthDone();
- }
- }
- } else {
- if (_state == MASK) {
- _maskingBytes[4 - _remainingMaskingKeyBytes--] = byte;
- if (_remainingMaskingKeyBytes == 0) {
- _maskDone();
- }
- } else {
- assert(_state == PAYLOAD);
- // The payload is not handled one byte at a time but in blocks.
- int payloadLength = min(lastIndex - index, _remainingPayloadBytes);
- _remainingPayloadBytes -= payloadLength;
- // Unmask payload if masked.
- if (_masked) {
- _unmask(index, payloadLength, buffer);
- }
- // Control frame and data frame share _payloads.
- _payload.add(new Uint8List.view(buffer.buffer, index, payloadLength));
- index += payloadLength;
- if (_isControlFrame()) {
- if (_remainingPayloadBytes == 0) _controlFrameEnd();
- } else {
- if (_currentMessageType != _WebSocketMessageType.TEXT &&
- _currentMessageType != _WebSocketMessageType.BINARY) {
- throw new WebSocketException("Protocol error");
- }
- if (_remainingPayloadBytes == 0) _messageFrameEnd();
- }
-
- // Hack - as we always do index++ below.
- index--;
- }
- }
-
- // Move to the next byte.
- index++;
- }
- }
-
- void _unmask(int index, int length, Uint8List buffer) {
- const int BLOCK_SIZE = 16;
- // Skip Int32x4-version if message is small.
- if (length >= BLOCK_SIZE) {
- // Start by aligning to 16 bytes.
- final int startOffset = BLOCK_SIZE - (index & 15);
- final int end = index + startOffset;
- for (int i = index; i < end; i++) {
- buffer[i] ^= _maskingBytes[_unmaskingIndex++ & 3];
- }
- index += startOffset;
- length -= startOffset;
- final int blockCount = length ~/ BLOCK_SIZE;
- if (blockCount > 0) {
- // Create mask block.
- int mask = 0;
- for (int i = 3; i >= 0; i--) {
- mask = (mask << 8) | _maskingBytes[(_unmaskingIndex + i) & 3];
- }
- Int32x4 blockMask = new Int32x4(mask, mask, mask, mask);
- Int32x4List blockBuffer =
- new Int32x4List.view(buffer.buffer, index, blockCount);
- for (int i = 0; i < blockBuffer.length; i++) {
- blockBuffer[i] ^= blockMask;
- }
- final int bytes = blockCount * BLOCK_SIZE;
- index += bytes;
- length -= bytes;
- }
- }
- // Handle end.
- final int end = index + length;
- for (int i = index; i < end; i++) {
- buffer[i] ^= _maskingBytes[_unmaskingIndex++ & 3];
- }
- }
-
- void _lengthDone() {
- if (_masked) {
- if (!_serverSide) {
- throw new WebSocketException("Received masked frame from server");
- }
- _state = MASK;
- } else {
- if (_serverSide) {
- throw new WebSocketException("Received unmasked frame from client");
- }
- _remainingPayloadBytes = _len;
- _startPayload();
- }
- }
-
- void _maskDone() {
- _remainingPayloadBytes = _len;
- _startPayload();
- }
-
- void _startPayload() {
- // If there is no actual payload perform perform callbacks without
- // going through the PAYLOAD state.
- if (_remainingPayloadBytes == 0) {
- if (_isControlFrame()) {
- switch (_opcode) {
- case _WebSocketOpcode.CLOSE:
- _state = CLOSED;
- _eventSink.close();
- break;
- case _WebSocketOpcode.PING:
- _eventSink.add(new _WebSocketPing());
- break;
- case _WebSocketOpcode.PONG:
- _eventSink.add(new _WebSocketPong());
- break;
- }
- _prepareForNextFrame();
- } else {
- _messageFrameEnd();
- }
- } else {
- _state = PAYLOAD;
- }
- }
-
- void _messageFrameEnd() {
- if (_fin) {
- var bytes = _payload.takeBytes();
- if (_deflate != null && _compressed) {
- bytes = _deflate.processIncomingMessage(bytes);
- }
-
- switch (_currentMessageType) {
- case _WebSocketMessageType.TEXT:
- _eventSink.add(UTF8.decode(bytes));
- break;
- case _WebSocketMessageType.BINARY:
- _eventSink.add(bytes);
- break;
- }
- _currentMessageType = _WebSocketMessageType.NONE;
- }
- _prepareForNextFrame();
- }
-
- void _controlFrameEnd() {
- switch (_opcode) {
- case _WebSocketOpcode.CLOSE:
- closeCode = WebSocketStatus.NO_STATUS_RECEIVED;
- var payload = _payload.takeBytes();
- if (payload.length > 0) {
- if (payload.length == 1) {
- throw new WebSocketException("Protocol error");
- }
- closeCode = payload[0] << 8 | payload[1];
- if (closeCode == WebSocketStatus.NO_STATUS_RECEIVED) {
- throw new WebSocketException("Protocol error");
- }
- if (payload.length > 2) {
- closeReason = UTF8.decode(payload.sublist(2));
- }
- }
- _state = CLOSED;
- _eventSink.close();
- break;
-
- case _WebSocketOpcode.PING:
- _eventSink.add(new _WebSocketPing(_payload.takeBytes()));
- break;
-
- case _WebSocketOpcode.PONG:
- _eventSink.add(new _WebSocketPong(_payload.takeBytes()));
- break;
- }
- _prepareForNextFrame();
- }
-
- bool _isControlFrame() {
- return _opcode == _WebSocketOpcode.CLOSE ||
- _opcode == _WebSocketOpcode.PING ||
- _opcode == _WebSocketOpcode.PONG;
- }
-
- void _prepareForNextFrame() {
- if (_state != CLOSED && _state != FAILURE) _state = START;
- _fin = false;
- _opcode = -1;
- _len = -1;
- _remainingLenBytes = -1;
- _remainingMaskingKeyBytes = 4;
- _remainingPayloadBytes = -1;
- _unmaskingIndex = 0;
- }
-}
-
-class _WebSocketPing {
- final List<int> payload;
- _WebSocketPing([this.payload = null]);
-}
-
-class _WebSocketPong {
- final List<int> payload;
- _WebSocketPong([this.payload = null]);
-}
-
-class _WebSocketTransformerImpl implements WebSocketTransformer {
- final StreamController<WebSocket> _controller =
- new StreamController<WebSocket>(sync: true);
- final Function _protocolSelector;
- final CompressionOptions _compression;
-
- _WebSocketTransformerImpl(this._protocolSelector, this._compression);
-
- Stream<WebSocket> bind(Stream<HttpRequest> stream) {
- stream.listen((request) {
- _upgrade(request, _protocolSelector, _compression)
- .then((WebSocket webSocket) => _controller.add(webSocket))
- .catchError(_controller.addError);
- }, onDone: () {
- _controller.close();
- });
-
- return _controller.stream;
- }
-
- static Future<WebSocket> _upgrade(
- HttpRequest request, _protocolSelector, CompressionOptions compression) {
- var response = request.response;
- if (!_isUpgradeRequest(request)) {
- // Send error response.
- response
- ..statusCode = HttpStatus.BAD_REQUEST
- ..close();
- return new Future.error(
- new WebSocketException("Invalid WebSocket upgrade request"));
- }
-
- Future upgrade(String protocol) {
- // Send the upgrade response.
- response
- ..statusCode = HttpStatus.SWITCHING_PROTOCOLS
- ..headers.add(HttpHeaders.CONNECTION, "Upgrade")
- ..headers.add(HttpHeaders.UPGRADE, "websocket");
- String key = request.headers.value("Sec-WebSocket-Key");
- _SHA1 sha1 = new _SHA1();
- sha1.add("$key$_webSocketGUID".codeUnits);
- String accept = _CryptoUtils.bytesToBase64(sha1.close());
- response.headers.add("Sec-WebSocket-Accept", accept);
- if (protocol != null) {
- response.headers.add("Sec-WebSocket-Protocol", protocol);
- }
-
- var deflate = _negotiateCompression(request, response, compression);
-
- response.headers.contentLength = 0;
- return response.detachSocket().then((socket) =>
- new _WebSocketImpl._fromSocket(
- socket, protocol, compression, true, deflate));
- }
-
- var protocols = request.headers['Sec-WebSocket-Protocol'];
- if (protocols != null && _protocolSelector != null) {
- // The suggested protocols can be spread over multiple lines, each
- // consisting of multiple protocols. To unify all of them, first join
- // the lists with ', ' and then tokenize.
- protocols = _HttpParser._tokenizeFieldValue(protocols.join(', '));
- return new Future(() => _protocolSelector(protocols)).then((protocol) {
- if (protocols.indexOf(protocol) < 0) {
- throw new WebSocketException(
- "Selected protocol is not in the list of available protocols");
- }
- return protocol;
- }).catchError((error) {
- response
- ..statusCode = HttpStatus.INTERNAL_SERVER_ERROR
- ..close();
- throw error;
- }).then(upgrade);
- } else {
- return upgrade(null);
- }
- }
-
- static _WebSocketPerMessageDeflate _negotiateCompression(HttpRequest request,
- HttpResponse response, CompressionOptions compression) {
- var extensionHeader = request.headers.value("Sec-WebSocket-Extensions");
-
- extensionHeader ??= "";
-
- var hv = HeaderValue.parse(extensionHeader, valueSeparator: ',');
- if (compression.enabled && hv.value == _WebSocketImpl.PER_MESSAGE_DEFLATE) {
- var info = compression._createHeader(hv);
-
- response.headers.add("Sec-WebSocket-Extensions", info.headerValue);
- var serverNoContextTakeover =
- (hv.parameters.containsKey(_serverNoContextTakeover) &&
- compression.serverNoContextTakeover);
- var clientNoContextTakeover =
- (hv.parameters.containsKey(_clientNoContextTakeover) &&
- compression.clientNoContextTakeover);
- var deflate = new _WebSocketPerMessageDeflate(
- serverNoContextTakeover: serverNoContextTakeover,
- clientNoContextTakeover: clientNoContextTakeover,
- serverMaxWindowBits: info.maxWindowBits,
- clientMaxWindowBits: info.maxWindowBits,
- serverSide: true);
-
- return deflate;
- }
-
- return null;
- }
-
- static bool _isUpgradeRequest(HttpRequest request) {
- if (request.method != "GET") {
- return false;
- }
- if (request.headers[HttpHeaders.CONNECTION] == null) {
- return false;
- }
- bool isUpgrade = false;
- request.headers[HttpHeaders.CONNECTION].forEach((String value) {
- if (value.toLowerCase() == "upgrade") isUpgrade = true;
- });
- if (!isUpgrade) return false;
- String upgrade = request.headers.value(HttpHeaders.UPGRADE);
- if (upgrade == null || upgrade.toLowerCase() != "websocket") {
- return false;
- }
- String version = request.headers.value("Sec-WebSocket-Version");
- if (version == null || version != "13") {
- return false;
- }
- String key = request.headers.value("Sec-WebSocket-Key");
- if (key == null) {
- return false;
- }
- return true;
- }
-}
-
-class _WebSocketPerMessageDeflate {
- bool serverNoContextTakeover;
- bool clientNoContextTakeover;
- int clientMaxWindowBits;
- int serverMaxWindowBits;
- bool serverSide;
-
- _Filter decoder;
- _Filter encoder;
-
- _WebSocketPerMessageDeflate(
- {this.clientMaxWindowBits: _WebSocketImpl.DEFAULT_WINDOW_BITS,
- this.serverMaxWindowBits: _WebSocketImpl.DEFAULT_WINDOW_BITS,
- this.serverNoContextTakeover: false,
- this.clientNoContextTakeover: false,
- this.serverSide: false});
-
- void _ensureDecoder() {
- if (decoder == null) {
- decoder = _Filter._newZLibInflateFilter(
- serverSide ? clientMaxWindowBits : serverMaxWindowBits, null, true);
- }
- }
-
- void _ensureEncoder() {
- if (encoder == null) {
- encoder = _Filter._newZLibDeflateFilter(
- false,
- ZLibOption.DEFAULT_LEVEL,
- serverSide ? serverMaxWindowBits : clientMaxWindowBits,
- ZLibOption.DEFAULT_MEM_LEVEL,
- ZLibOption.STRATEGY_DEFAULT,
- null,
- true);
- }
- }
-
- Uint8List processIncomingMessage(List<int> msg) {
- _ensureDecoder();
-
- var data = [];
- data.addAll(msg);
- data.addAll(const [0x00, 0x00, 0xff, 0xff]);
-
- decoder.process(data, 0, data.length);
- var result = [];
- var out;
-
- while ((out = decoder.processed()) != null) {
- result.addAll(out);
- }
-
- if ((serverSide && clientNoContextTakeover) ||
- (!serverSide && serverNoContextTakeover)) {
- decoder = null;
- }
-
- return new Uint8List.fromList(result);
- }
-
- List<int> processOutgoingMessage(List<int> msg) {
- _ensureEncoder();
- var result = [];
- Uint8List buffer;
- var out;
-
- if (msg is! Uint8List) {
- for (var i = 0; i < msg.length; i++) {
- if (msg[i] < 0 || 255 < msg[i]) {
- throw new ArgumentError("List element is not a byte value "
- "(value ${msg[i]} at index $i)");
- }
- }
- buffer = new Uint8List.fromList(msg);
- } else {
- buffer = msg;
- }
-
- encoder.process(buffer, 0, buffer.length);
-
- while ((out = encoder.processed()) != null) {
- result.addAll(out);
- }
-
- if ((!serverSide && clientNoContextTakeover) ||
- (serverSide && serverNoContextTakeover)) {
- encoder = null;
- }
-
- if (result.length > 4) {
- result = result.sublist(0, result.length - 4);
- }
-
- return result;
- }
-}
-
-// TODO(ajohnsen): Make this transformer reusable.
-class _WebSocketOutgoingTransformer
- implements StreamTransformer<dynamic, List<int>>, EventSink {
- final _WebSocketImpl webSocket;
- EventSink<List<int>> _eventSink;
-
- _WebSocketPerMessageDeflate _deflateHelper;
-
- _WebSocketOutgoingTransformer(this.webSocket) {
- _deflateHelper = webSocket._deflate;
- }
-
- Stream<List<int>> bind(Stream stream) {
- return new Stream.eventTransformed(stream, (eventSink) {
- if (_eventSink != null) {
- throw new StateError("WebSocket transformer already used");
- }
- _eventSink = eventSink;
- return this;
- });
- }
-
- void add(message) {
- if (message is _WebSocketPong) {
- addFrame(_WebSocketOpcode.PONG, message.payload);
- return;
- }
- if (message is _WebSocketPing) {
- addFrame(_WebSocketOpcode.PING, message.payload);
- return;
- }
- List<int> data;
- int opcode;
- if (message != null) {
- if (message is String) {
- opcode = _WebSocketOpcode.TEXT;
- data = UTF8.encode(message);
- } else {
- if (message is List<int>) {
- data = message;
- opcode = _WebSocketOpcode.BINARY;
- } else {
- throw new ArgumentError(message);
- }
- }
-
- if (_deflateHelper != null) {
- data = _deflateHelper.processOutgoingMessage(data);
- }
- } else {
- opcode = _WebSocketOpcode.TEXT;
- }
- addFrame(opcode, data);
- }
-
- void addError(Object error, [StackTrace stackTrace]) {
- _eventSink.addError(error, stackTrace);
- }
-
- void close() {
- int code = webSocket._outCloseCode;
- String reason = webSocket._outCloseReason;
- List<int> data;
- if (code != null) {
- data = new List<int>();
- data.add((code >> 8) & 0xFF);
- data.add(code & 0xFF);
- if (reason != null) {
- data.addAll(UTF8.encode(reason));
- }
- }
- addFrame(_WebSocketOpcode.CLOSE, data);
- _eventSink.close();
- }
-
- void addFrame(int opcode, List<int> data) => createFrame(
- opcode,
- data,
- webSocket._serverSide,
- _deflateHelper != null &&
- (opcode == _WebSocketOpcode.TEXT ||
- opcode == _WebSocketOpcode.BINARY)).forEach((e) {
- _eventSink.add(e);
- });
-
- static Iterable<List<int>> createFrame(
- int opcode, List<int> data, bool serverSide, bool compressed) {
- bool mask = !serverSide; // Masking not implemented for server.
- int dataLength = data == null ? 0 : data.length;
- // Determine the header size.
- int headerSize = (mask) ? 6 : 2;
- if (dataLength > 65535) {
- headerSize += 8;
- } else if (dataLength > 125) {
- headerSize += 2;
- }
- Uint8List header = new Uint8List(headerSize);
- int index = 0;
-
- // Set FIN and opcode.
- var hoc = _WebSocketProtocolTransformer.FIN
- | (compressed ? _WebSocketProtocolTransformer.RSV1 : 0)
- | (opcode & _WebSocketProtocolTransformer.OPCODE);
-
- header[index++] = hoc;
- // Determine size and position of length field.
- int lengthBytes = 1;
- if (dataLength > 65535) {
- header[index++] = 127;
- lengthBytes = 8;
- } else if (dataLength > 125) {
- header[index++] = 126;
- lengthBytes = 2;
- }
- // Write the length in network byte order into the header.
- for (int i = 0; i < lengthBytes; i++) {
- header[index++] = dataLength >> (((lengthBytes - 1) - i) * 8) & 0xFF;
- }
- if (mask) {
- header[1] |= 1 << 7;
- var maskBytes = _IOCrypto.getRandomBytes(4);
- header.setRange(index, index + 4, maskBytes);
- index += 4;
- if (data != null) {
- Uint8List list;
- // If this is a text message just do the masking inside the
- // encoded data.
- if (opcode == _WebSocketOpcode.TEXT && data is Uint8List) {
- list = data;
- } else {
- if (data is Uint8List) {
- list = new Uint8List.fromList(data);
- } else {
- list = new Uint8List(data.length);
- for (int i = 0; i < data.length; i++) {
- if (data[i] < 0 || 255 < data[i]) {
- throw new ArgumentError("List element is not a byte value "
- "(value ${data[i]} at index $i)");
- }
- list[i] = data[i];
- }
- }
- }
- const int BLOCK_SIZE = 16;
- int blockCount = list.length ~/ BLOCK_SIZE;
- if (blockCount > 0) {
- // Create mask block.
- int mask = 0;
- for (int i = 3; i >= 0; i--) {
- mask = (mask << 8) | maskBytes[i];
- }
- Int32x4 blockMask = new Int32x4(mask, mask, mask, mask);
- Int32x4List blockBuffer =
- new Int32x4List.view(list.buffer, 0, blockCount);
- for (int i = 0; i < blockBuffer.length; i++) {
- blockBuffer[i] ^= blockMask;
- }
- }
- // Handle end.
- for (int i = blockCount * BLOCK_SIZE; i < list.length; i++) {
- list[i] ^= maskBytes[i & 3];
- }
- data = list;
- }
- }
- assert(index == headerSize);
- if (data == null) {
- return [header];
- } else {
- return [header, data];
- }
- }
-}
-
-class _WebSocketConsumer implements StreamConsumer {
- final _WebSocketImpl webSocket;
- final Socket socket;
- StreamController _controller;
- StreamSubscription _subscription;
- bool _issuedPause = false;
- bool _closed = false;
- Completer _closeCompleter = new Completer();
- Completer _completer;
-
- _WebSocketConsumer(this.webSocket, this.socket);
-
- void _onListen() {
- if (_subscription != null) {
- _subscription.cancel();
- }
- }
-
- void _onPause() {
- if (_subscription != null) {
- _subscription.pause();
- } else {
- _issuedPause = true;
- }
- }
-
- void _onResume() {
- if (_subscription != null) {
- _subscription.resume();
- } else {
- _issuedPause = false;
- }
- }
-
- void _cancel() {
- if (_subscription != null) {
- var subscription = _subscription;
- _subscription = null;
- subscription.cancel();
- }
- }
-
- _ensureController() {
- if (_controller != null) return;
- _controller = new StreamController(
- sync: true,
- onPause: _onPause,
- onResume: _onResume,
- onCancel: _onListen);
- var stream = _controller.stream
- .transform(new _WebSocketOutgoingTransformer(webSocket));
- socket.addStream(stream).then((_) {
- _done();
- _closeCompleter.complete(webSocket);
- }, onError: (error, StackTrace stackTrace) {
- _closed = true;
- _cancel();
- if (error is ArgumentError) {
- if (!_done(error, stackTrace)) {
- _closeCompleter.completeError(error, stackTrace);
- }
- } else {
- _done();
- _closeCompleter.complete(webSocket);
- }
- });
- }
-
- bool _done([error, StackTrace stackTrace]) {
- if (_completer == null) return false;
- if (error != null) {
- _completer.completeError(error, stackTrace);
- } else {
- _completer.complete(webSocket);
- }
- _completer = null;
- return true;
- }
-
- Future addStream(var stream) {
- if (_closed) {
- stream.listen(null).cancel();
- return new Future.value(webSocket);
- }
- _ensureController();
- _completer = new Completer();
- _subscription = stream.listen((data) {
- _controller.add(data);
- }, onDone: _done, onError: _done, cancelOnError: true);
- if (_issuedPause) {
- _subscription.pause();
- _issuedPause = false;
- }
- return _completer.future;
- }
-
- Future close() {
- _ensureController();
- Future closeSocket() {
- return socket.close().catchError((_) {}).then((_) => webSocket);
- }
- _controller.close();
- return _closeCompleter.future.then((_) => closeSocket());
- }
-
- void add(data) {
- if (_closed) return;
- _ensureController();
- _controller.add(data);
- }
-
- void closeSocket() {
- _closed = true;
- _cancel();
- close();
- }
-}
-
-class _WebSocketImpl extends Stream with _ServiceObject implements WebSocket {
- // Use default Map so we keep order.
- static Map<int, _WebSocketImpl> _webSockets = new Map<int, _WebSocketImpl>();
- static const int DEFAULT_WINDOW_BITS = 15;
- static const String PER_MESSAGE_DEFLATE = "permessage-deflate";
-
- final String protocol;
-
- StreamController _controller;
- StreamSubscription _subscription;
- StreamSink _sink;
-
- final _socket;
- final bool _serverSide;
- int _readyState = WebSocket.CONNECTING;
- bool _writeClosed = false;
- int _closeCode;
- String _closeReason;
- Duration _pingInterval;
- Timer _pingTimer;
- _WebSocketConsumer _consumer;
-
- int _outCloseCode;
- String _outCloseReason;
- Timer _closeTimer;
- _WebSocketPerMessageDeflate _deflate;
-
- static final HttpClient _httpClient = new HttpClient();
-
- static Future<WebSocket> connect(
- String url, Iterable<String> protocols, Map<String, dynamic> headers,
- {CompressionOptions compression: CompressionOptions.DEFAULT}) {
- Uri uri = Uri.parse(url);
- if (uri.scheme != "ws" && uri.scheme != "wss") {
- throw new WebSocketException("Unsupported URL scheme '${uri.scheme}'");
- }
-
- Random random = new Random();
- // Generate 16 random bytes.
- Uint8List nonceData = new Uint8List(16);
- for (int i = 0; i < 16; i++) {
- nonceData[i] = random.nextInt(256);
- }
- String nonce = _CryptoUtils.bytesToBase64(nonceData);
-
- uri = new Uri(
- scheme: uri.scheme == "wss" ? "https" : "http",
- userInfo: uri.userInfo,
- host: uri.host,
- port: uri.port,
- path: uri.path,
- query: uri.query,
- fragment: uri.fragment);
- return _httpClient.openUrl("GET", uri).then((request) {
- if (uri.userInfo != null && !uri.userInfo.isEmpty) {
- // If the URL contains user information use that for basic
- // authorization.
- String auth = _CryptoUtils.bytesToBase64(UTF8.encode(uri.userInfo));
- request.headers.set(HttpHeaders.AUTHORIZATION, "Basic $auth");
- }
- if (headers != null) {
- headers.forEach((field, value) => request.headers.add(field, value));
- }
- // Setup the initial handshake.
- request.headers
- ..set(HttpHeaders.CONNECTION, "Upgrade")
- ..set(HttpHeaders.UPGRADE, "websocket")
- ..set("Sec-WebSocket-Key", nonce)
- ..set("Cache-Control", "no-cache")
- ..set("Sec-WebSocket-Version", "13");
- if (protocols != null) {
- request.headers.add("Sec-WebSocket-Protocol", protocols.toList());
- }
-
- if (compression.enabled) {
- request.headers
- .add("Sec-WebSocket-Extensions", compression._createHeader());
- }
-
- return request.close();
- }).then((response) {
-
- void error(String message) {
- // Flush data.
- response.detachSocket().then((socket) {
- socket.destroy();
- });
- throw new WebSocketException(message);
- }
-
- if (response.statusCode != HttpStatus.SWITCHING_PROTOCOLS ||
- response.headers[HttpHeaders.CONNECTION] == null ||
- !response.headers[HttpHeaders.CONNECTION]
- .any((value) => value.toLowerCase() == "upgrade") ||
- response.headers.value(HttpHeaders.UPGRADE).toLowerCase() !=
- "websocket") {
- error("Connection to '$uri' was not upgraded to websocket");
- }
- String accept = response.headers.value("Sec-WebSocket-Accept");
- if (accept == null) {
- error("Response did not contain a 'Sec-WebSocket-Accept' header");
- }
- _SHA1 sha1 = new _SHA1();
- sha1.add("$nonce$_webSocketGUID".codeUnits);
- List<int> expectedAccept = sha1.close();
- List<int> receivedAccept = _CryptoUtils.base64StringToBytes(accept);
- if (expectedAccept.length != receivedAccept.length) {
- error("Reasponse header 'Sec-WebSocket-Accept' is the wrong length");
- }
- for (int i = 0; i < expectedAccept.length; i++) {
- if (expectedAccept[i] != receivedAccept[i]) {
- error("Bad response 'Sec-WebSocket-Accept' header");
- }
- }
- var protocol = response.headers.value('Sec-WebSocket-Protocol');
-
- _WebSocketPerMessageDeflate deflate =
- negotiateClientCompression(response, compression);
-
- return response.detachSocket().then/*<WebSocket>*/((socket) =>
- new _WebSocketImpl._fromSocket(
- socket, protocol, compression, false, deflate));
- });
- }
-
- static _WebSocketPerMessageDeflate negotiateClientCompression(
- HttpClientResponse response, CompressionOptions compression) {
- String extensionHeader = response.headers.value('Sec-WebSocket-Extensions');
-
- if (extensionHeader == null) {
- extensionHeader = "";
- }
-
- var hv = HeaderValue.parse(extensionHeader, valueSeparator: ',');
-
- if (compression.enabled && hv.value == PER_MESSAGE_DEFLATE) {
- var serverNoContextTakeover =
- hv.parameters.containsKey(_serverNoContextTakeover);
- var clientNoContextTakeover =
- hv.parameters.containsKey(_clientNoContextTakeover);
-
- int getWindowBits(String type) {
- var o = hv.parameters[type];
- if (o == null) {
- return DEFAULT_WINDOW_BITS;
- }
-
- return int.parse(o, onError: (s) => DEFAULT_WINDOW_BITS);
- }
-
- return new _WebSocketPerMessageDeflate(
- clientMaxWindowBits: getWindowBits(_clientMaxWindowBits),
- serverMaxWindowBits: getWindowBits(_serverMaxWindowBits),
- clientNoContextTakeover: clientNoContextTakeover,
- serverNoContextTakeover: serverNoContextTakeover);
- }
-
- return null;
- }
-
- _WebSocketImpl._fromSocket(
- this._socket, this.protocol, CompressionOptions compression,
- [this._serverSide = false, _WebSocketPerMessageDeflate deflate]) {
- _consumer = new _WebSocketConsumer(this, _socket);
- _sink = new _StreamSinkImpl(_consumer);
- _readyState = WebSocket.OPEN;
- _deflate = deflate;
-
- var transformer = new _WebSocketProtocolTransformer(_serverSide, _deflate);
- _subscription = _socket.transform(transformer).listen((data) {
- if (data is _WebSocketPing) {
- if (!_writeClosed) _consumer.add(new _WebSocketPong(data.payload));
- } else if (data is _WebSocketPong) {
- // Simply set pingInterval, as it'll cancel any timers.
- pingInterval = _pingInterval;
- } else {
- _controller.add(data);
- }
- }, onError: (error, stackTrace) {
- if (_closeTimer != null) _closeTimer.cancel();
- if (error is FormatException) {
- _close(WebSocketStatus.INVALID_FRAME_PAYLOAD_DATA);
- } else {
- _close(WebSocketStatus.PROTOCOL_ERROR);
- }
- // An error happened, set the close code set above.
- _closeCode = _outCloseCode;
- _closeReason = _outCloseReason;
- _controller.close();
- }, onDone: () {
- if (_closeTimer != null) _closeTimer.cancel();
- if (_readyState == WebSocket.OPEN) {
- _readyState = WebSocket.CLOSING;
- if (!_isReservedStatusCode(transformer.closeCode)) {
- _close(transformer.closeCode, transformer.closeReason);
- } else {
- _close();
- }
- _readyState = WebSocket.CLOSED;
- }
- // Protocol close, use close code from transformer.
- _closeCode = transformer.closeCode;
- _closeReason = transformer.closeReason;
- _controller.close();
- }, cancelOnError: true);
- _subscription.pause();
- _controller = new StreamController(
- sync: true, onListen: _subscription.resume, onCancel: () {
- _subscription.cancel();
- _subscription = null;
- }, onPause: _subscription.pause, onResume: _subscription.resume);
-
- _webSockets[_serviceId] = this;
- try {
- _socket._owner = this;
- } catch (_) {}
- }
-
- StreamSubscription listen(void onData(message),
- {Function onError, void onDone(), bool cancelOnError}) {
- return _controller.stream.listen(onData,
- onError: onError, onDone: onDone, cancelOnError: cancelOnError);
- }
-
- Duration get pingInterval => _pingInterval;
-
- void set pingInterval(Duration interval) {
- if (_writeClosed) return;
- if (_pingTimer != null) _pingTimer.cancel();
- _pingInterval = interval;
-
- if (_pingInterval == null) return;
-
- _pingTimer = new Timer(_pingInterval, () {
- if (_writeClosed) return;
- _consumer.add(new _WebSocketPing());
- _pingTimer = new Timer(_pingInterval, () {
- // No pong received.
- _close(WebSocketStatus.GOING_AWAY);
- });
- });
- }
-
- int get readyState => _readyState;
-
- String get extensions => null;
- int get closeCode => _closeCode;
- String get closeReason => _closeReason;
-
- void add(data) { _sink.add(data); }
- void addError(error, [StackTrace stackTrace]) {
- _sink.addError(error, stackTrace);
- }
- Future addStream(Stream stream) => _sink.addStream(stream);
- Future get done => _sink.done;
-
- Future close([int code, String reason]) {
- if (_isReservedStatusCode(code)) {
- throw new WebSocketException("Reserved status code $code");
- }
- if (_outCloseCode == null) {
- _outCloseCode = code;
- _outCloseReason = reason;
- }
- if (!_controller.isClosed) {
- // If a close has not yet been received from the other end then
- // 1) make sure to listen on the stream so the close frame will be
- // processed if received.
- // 2) set a timer terminate the connection if a close frame is
- // not received.
- if (!_controller.hasListener && _subscription != null) {
- _controller.stream.drain().catchError((_) => {});
- }
- if (_closeTimer == null) {
- // When closing the web-socket, we no longer accept data.
- _closeTimer = new Timer(const Duration(seconds: 5), () {
- // Reuse code and reason from the local close.
- _closeCode = _outCloseCode;
- _closeReason = _outCloseReason;
- if (_subscription != null) _subscription.cancel();
- _controller.close();
- _webSockets.remove(_serviceId);
- });
- }
- }
- return _sink.close();
- }
-
- void _close([int code, String reason]) {
- if (_writeClosed) return;
- if (_outCloseCode == null) {
- _outCloseCode = code;
- _outCloseReason = reason;
- }
- _writeClosed = true;
- _consumer.closeSocket();
- _webSockets.remove(_serviceId);
- }
-
- String get _serviceTypePath => 'io/websockets';
- String get _serviceTypeName => 'WebSocket';
-
- Map<String, dynamic> _toJSON(bool ref) {
- var name = '${_socket.address.host}:${_socket.port}';
- var r = <String, dynamic>{
- 'id': _servicePath,
- 'type': _serviceType(ref),
- 'name': name,
- 'user_name': name,
- };
- if (ref) {
- return r;
- }
- try {
- r['socket'] = _socket._toJSON(true);
- } catch (_) {
- r['socket'] = {
- 'id': _servicePath,
- 'type': '@Socket',
- 'name': 'UserSocket',
- 'user_name': 'UserSocket',
- };
- }
- return r;
- }
-
- static bool _isReservedStatusCode(int code) {
- return code != null &&
- (code < WebSocketStatus.NORMAL_CLOSURE ||
- code == WebSocketStatus.RESERVED_1004 ||
- code == WebSocketStatus.NO_STATUS_RECEIVED ||
- code == WebSocketStatus.ABNORMAL_CLOSURE ||
- (code > WebSocketStatus.INTERNAL_SERVER_ERROR &&
- code < WebSocketStatus.RESERVED_1015) ||
- (code >= WebSocketStatus.RESERVED_1015 && code < 3000));
- }
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/isolate/capability.dart b/pkg/dev_compiler/tool/input_sdk/lib/isolate/capability.dart
deleted file mode 100644
index a51eec2..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/isolate/capability.dart
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-part of dart.isolate;
-
-/**
- * An unforgeable object that comes back as equal when passed through other
- * isolates.
- *
- * Sending a capability object to another isolate, and getting it back,
- * will produce an object that is equal to the original.
- * There is no other way to create objects equal to a capability object.
- *
- * Capabilities can be used as access guards: A remote isolate can send
- * a request for an operation, but it is only allowed if the request contains
- * the correct capability object.
- *
- * This allows exposing the same interface to multiple clients,
- * but restricting some operations to only those clients
- * that have also been given the corresponding capability.
- *
- * Capabilities can be used inside a single isolate,
- * but they have no advantage over
- * just using `new Object` to create a unique object,
- * and it offers no real security against other code
- * running in the same isolate.
- */
-class Capability {
- /**
- * Create a new unforgeable capability object.
- */
- external factory Capability();
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/isolate/isolate.dart b/pkg/dev_compiler/tool/input_sdk/lib/isolate/isolate.dart
deleted file mode 100644
index f0fd886..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/isolate/isolate.dart
+++ /dev/null
@@ -1,618 +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.
-
-/**
- * Concurrent programming using _isolates_:
- * independent workers that are similar to threads
- * but don't share memory,
- * communicating only via messages.
- */
-library dart.isolate;
-
-import "dart:async";
-
-part "capability.dart";
-
-/**
- * Thrown when an isolate cannot be created.
- */
-class IsolateSpawnException implements Exception {
- /** Error message reported by the spawn operation. */
- final String message;
- IsolateSpawnException(this.message);
- String toString() => "IsolateSpawnException: $message";
-}
-
-/**
- * An isolated Dart execution context.
- *
- * All Dart code runs in an isolate, and code can access classes and values
- * only from the same isolate. Different isolates can communicate by sending
- * values through ports (see [ReceivePort], [SendPort]).
- *
- * An `Isolate` object is a reference to an isolate, usually different from
- * the current isolate.
- * It represents, and can be used control, the other isolate.
- *
- * When spawning a new isolate, the spawning isolate receives an `Isolate`
- * object representing the new isolate when the spawn operation succeeds.
- *
- * Isolates run code in its own event loop, and each event may run smaller tasks
- * in a nested microtask queue.
- *
- * An `Isolate` object allows other isolates to control the event loop
- * of the isolate that it represents, and to inspect the isolate,
- * for example by pausing the isolate or by getting events when the isolate
- * has an uncaught error.
- *
- * The [controlPort] gives access to controlling the isolate, and the
- * [pauseCapability] and [terminateCapability] guard access to some control
- * operations.
- * The `Isolate` object provided by a spawn operation will have the
- * control port and capabilities needed to control the isolate.
- * New isolates objects can be created without some of these capabilities
- * if necessary.
- *
- * An `Isolate` object cannot be sent over a `SendPort`, but the control port
- * and capabilities can be sent, and can be used to create a new functioning
- * `Isolate` object in the receiving port's isolate.
- */
-class Isolate {
- /** Argument to `ping` and `kill`: Ask for immediate action. */
- static const int IMMEDIATE = 0;
- /** Argument to `ping` and `kill`: Ask for action before the next event. */
- static const int BEFORE_NEXT_EVENT = 1;
- /** Argument to `ping` and `kill`: Ask for action after normal events. */
- static const int AS_EVENT = 2;
-
- /**
- * Control port used to send control messages to the isolate.
- *
- * This class provides helper functions that sends control messages
- * to the control port.
- *
- * The control port identifies the isolate.
- */
- final SendPort controlPort;
-
- /**
- * Capability granting the ability to pause the isolate.
- *
- * This capability is used by [pause].
- * If the capability is not the correct pause capability of the isolate,
- * including if the capability is `null`, then calls to `pause` will have no
- * effect.
- *
- * If the isolate is started in a paused state, use this capability as
- * argument to [resume] to resume the isolate.
- */
- final Capability pauseCapability;
-
- /**
- * Capability granting the ability to terminate the isolate.
- *
- * This capability is used by [kill] and [setErrorsFatal].
- * If the capability is not the correct termination capability of the isolate,
- * including if the capability is `null`, then calls to those methods will
- * have no effect.
- */
- final Capability terminateCapability;
-
- /**
- * Create a new [Isolate] object with a restricted set of capabilities.
- *
- * The port should be a control port for an isolate, as taken from
- * another `Isolate` object.
- *
- * The capabilities should be the subset of the capabilities that are
- * available to the original isolate.
- * Capabilities of an isolate are locked to that isolate, and have no effect
- * anywhere else, so the capabilities should come from the same isolate as
- * the control port.
- *
- * If all the available capabilities are included,
- * there is no reason to create a new object,
- * since the behavior is defined entirely
- * by the control port and capabilities.
- */
- Isolate(this.controlPort, {this.pauseCapability,
- this.terminateCapability});
-
- /**
- * Return the current [Isolate].
- *
- * The isolate gives access to the capabilities needed to inspect,
- * pause or kill the isolate, and allows granting these capabilities
- * to others.
- */
- external static Isolate get current;
-
- /**
- * Creates and spawns an isolate that shares the same code as the current
- * isolate.
- *
- * The argument [entryPoint] specifies the entry point of the spawned
- * isolate. It must be a top-level function or a static method that
- * takes one argument - that is, one-parameter functions that can be
- * compile-time constant function values.
- * It is not allowed to pass the value of function expressions or an instance
- * method extracted from an object.
- *
- * The entry-point function is invoked with the initial [message].
- * Usually the initial [message] contains a [SendPort] so
- * that the spawner and spawnee can communicate with each other.
- *
- * If the [paused] parameter is set to `true`,
- * the isolate will start up in a paused state,
- * as if by an initial call of `isolate.pause(isolate.pauseCapability)`.
- * This allows setting up error or exit listeners on the isolate
- * before it starts running.
- * To resume the isolate, call `isolate.resume(isolate.pauseCapability)`.
- *
- * WARNING: The `pause` parameter is not implemented on all platforms yet.
- *
- * Returns a future that will complete with an [Isolate] instance if the
- * spawning succeeded. It will complete with an error otherwise.
- */
- external static Future<Isolate> spawn(void entryPoint(message), var message,
- { bool paused: false });
-
- /**
- * Creates and spawns an isolate that runs the code from the library with
- * the specified URI.
- *
- * The isolate starts executing the top-level `main` function of the library
- * with the given URI.
- *
- * The target `main` must be a subtype of one of these three signatures:
- *
- * * `main()`
- * * `main(args)`
- * * `main(args, message)`
- *
- * When present, the parameter `args` is set to the provided [args] list.
- * When present, the parameter `message` is set to the initial [message].
- *
- * If the [packageRoot] parameter is provided, it is used to find the location
- * of packages imports in the spawned isolate.
- * The `packageRoot` URI must be a "file" or "http"/"https" URI that specifies
- * a directory. If it doesn't end in a slash, one will be added before
- * using the URI, and any query or fragment parts are ignored.
- * Package imports (like "package:foo/bar.dart") in the new isolate are
- * resolved against this location, as by
- * `packageRoot.resolve("foo/bar.dart")`.
- * This includes the main entry [uri] if it happens to be a package-URL.
- * If [packageRoot] is omitted, it defaults to the same URI that
- * the current isolate is using.
- *
- * WARNING: The [packageRoot] parameter is not implemented on all
- * platforms yet.
- *
- * If the [paused] parameter is set to `true`,
- * the isolate will start up in a paused state,
- * as if by an initial call of `isolate.pause(isolate.pauseCapability)`.
- * This allows setting up error or exit listeners on the isolate
- * before it starts running.
- * To resume the isolate, call `isolate.resume(isolate.pauseCapability)`.
- *
- * WARNING: The `pause` parameter is not implemented on all platforms yet.
- *
- * Returns a future that will complete with an [Isolate] instance if the
- * spawning succeeded. It will complete with an error otherwise.
- */
- external static Future<Isolate> spawnUri(
- Uri uri,
- List<String> args,
- var message,
- {bool paused: false,
- Uri packageRoot});
-
- /**
- * Requests the isolate to pause.
- *
- * WARNING: This method is experimental and not handled on every platform yet.
- *
- * The isolate should stop handling events by pausing its event queue.
- * The request will eventually make the isolate stop doing anything.
- * It will be handled before any other messages that are later sent to the
- * isolate from the current isolate, but no other guarantees are provided.
- *
- * The event loop may be paused before previously sent, but not yet exeuted,
- * messages have been reached.
- *
- * If [resumeCapability] is provided, it is used to identity the pause,
- * and must be used again to end the pause using [resume].
- * Otherwise a new resume capability is created and returned.
- *
- * If an isolate is paused more than once using the same capability,
- * only one resume with that capability is needed to end the pause.
- *
- * If an isolate is paused using more than one capability,
- * they must all be individully ended before the isolate resumes.
- *
- * Returns the capability that must be used to resume end the pause.
- */
- Capability pause([Capability resumeCapability]) {
- if (resumeCapability == null) resumeCapability = new Capability();
- _pause(resumeCapability);
- return resumeCapability;
- }
-
- /** Internal implementation of [pause]. */
- external void _pause(Capability resumeCapability);
-
- /**
- * Resumes a paused isolate.
- *
- * WARNING: This method is experimental and not handled on every platform yet.
- *
- * Sends a message to an isolate requesting that it ends a pause
- * that was requested using the [resumeCapability].
- *
- * When all active pause requests have been cancelled, the isolate
- * will continue handling normal messages.
- *
- * The capability must be one returned by a call to [pause] on this
- * isolate, otherwise the resume call does nothing.
- */
- external void resume(Capability resumeCapability);
-
- /**
- * Asks the isolate to send a message on [responsePort] when it terminates.
- *
- * WARNING: This method is experimental and not handled on every platform yet.
- *
- * The isolate will send a `null` message on [responsePort] as the last
- * thing before it terminates. It will run no further code after the message
- * has been sent.
- *
- * If the isolate is already dead, no message will be sent.
- */
- /* TODO(lrn): Can we do better? Can the system recognize this message and
- * send a reply if the receiving isolate is dead?
- */
- external void addOnExitListener(SendPort responsePort);
-
- /**
- * Stop listening on exit messages from the isolate.
- *
- * WARNING: This method is experimental and not handled on every platform yet.
- *
- * If a call has previously been made to [addOnExitListener] with the same
- * send-port, this will unregister the port, and it will no longer receive
- * a message when the isolate terminates.
- * A response may still be sent until this operation is fully processed by
- * the isolate.
- */
- external void removeOnExitListener(SendPort responsePort);
-
- /**
- * Set whether uncaught errors will terminate the isolate.
- *
- * WARNING: This method is experimental and not handled on every platform yet.
- *
- * If errors are fatal, any uncaught error will terminate the isolate
- * event loop and shut down the isolate.
- *
- * This call requires the [terminateCapability] for the isolate.
- * If the capability is not correct, no change is made.
- */
- external void setErrorsFatal(bool errorsAreFatal);
-
- /**
- * Requests the isolate to shut down.
- *
- * WARNING: This method is experimental and not handled on every platform yet.
- *
- * The isolate is requested to terminate itself.
- * The [priority] argument specifies when this must happen.
- *
- * The [priority] must be one of [IMMEDIATE], [BEFORE_NEXT_EVENT] or
- * [AS_EVENT].
- * The shutdown is performed at different times depending on the priority:
- *
- * * `IMMEDIATE`: The isolate shuts down as soon as possible.
- * Control messages are handled in order, so all previously sent control
- * events from this isolate will all have been processed.
- * The shutdown should happen no later than if sent with
- * `BEFORE_NEXT_EVENT`.
- * It may happen earlier if the system has a way to shut down cleanly
- * at an earlier time, even during the execution of another event.
- * * `BEFORE_NEXT_EVENT`: The shutdown is scheduled for the next time
- * control returns to the event loop of the receiving isolate,
- * after the current event, and any already scheduled control events,
- * are completed.
- * * `AS_EVENT`: The shutdown does not happen until all prevously sent
- * non-control messages from the current isolate to the receiving isolate
- * have been processed.
- * The kill operation effectively puts the shutdown into the normal event
- * queue after previously sent messages, and it is affected by any control
- * messages that affect normal events, including `pause`.
- * This can be used to wait for a another event to be processed.
- */
- external void kill([int priority = BEFORE_NEXT_EVENT]);
-
- /**
- * Request that the isolate send a response on the [responsePort].
- *
- * WARNING: This method is experimental and not handled on every platform yet.
- *
- * If the isolate is alive, it will eventually send a `null` response on
- * the response port.
- *
- * The [pingType] must be one of [IMMEDIATE], [BEFORE_NEXT_EVENT] or
- * [AS_EVENT].
- * The response is sent at different times depending on the ping type:
- *
- * * `IMMEDIATE`: The isolate responds as soon as it receives the
- * control message. This is after any previous control message
- * from the same isolate has been received.
- * * `BEFORE_NEXT_EVENT`: The response is scheduled for the next time
- * control returns to the event loop of the receiving isolate,
- * after the current event, and any already scheduled control events,
- * are completed.
- * * `AS_EVENT`: The response is not sent until all prevously sent
- * non-control messages from the current isolate to the receiving isolate
- * have been processed.
- * The ping effectively puts the response into the normal event queue
- * after previously sent messages, and it is affected by any control
- * messages that affect normal events, including `pause`.
- * This can be used to wait for a another event to be processed.
- */
- external void ping(SendPort responsePort, [int pingType = IMMEDIATE]);
-
- /**
- * Requests that uncaught errors of the isolate are sent back to [port].
- *
- * WARNING: This method is experimental and not handled on every platform yet.
- *
- * The errors are sent back as two elements lists.
- * The first element is a `String` representation of the error, usually
- * created by calling `toString` on the error.
- * The second element is a `String` representation of an accompanying
- * stack trace, or `null` if no stack trace was provided.
- *
- * Listening using the same port more than once does nothing. It will only
- * get each error once.
- */
- external void addErrorListener(SendPort port);
-
- /**
- * Stop listening for uncaught errors through [port].
- *
- * WARNING: This method is experimental and not handled on every platform yet.
- *
- * The `port` should be a port that is listening for errors through
- * [addErrorListener]. This call requests that the isolate stops sending
- * errors on the port.
- *
- * If the same port has been passed via `addErrorListener` more than once,
- * only one call to `removeErrorListener` is needed to stop it from receiving
- * errors.
- *
- * Closing the receive port at the end of the send port will not stop the
- * isolate from sending errors, they are just going to be lost.
- */
- external void removeErrorListener(SendPort port);
-
- /**
- * Returns a broadcast stream of uncaught errors from the isolate.
- *
- * Each error is provided as an error event on the stream.
- *
- * The actual error object and stackTraces will not necessarily
- * be the same object types as in the actual isolate, but they will
- * always have the same [Object.toString] result.
- *
- * This stream is based on [addErrorListener] and [removeErrorListener].
- */
- Stream get errors {
- StreamController controller;
- RawReceivePort port;
- void handleError(message) {
- String errorDescription = message[0];
- String stackDescription = message[1];
- var error = new RemoteError(errorDescription, stackDescription);
- controller.addError(error, error.stackTrace);
- }
- controller = new StreamController.broadcast(
- sync: true,
- onListen: () {
- port = new RawReceivePort(handleError);
- this.addErrorListener(port.sendPort);
- },
- onCancel: () {
- this.removeErrorListener(port.sendPort);
- port.close();
- port = null;
- });
- return controller.stream;
- }
-}
-
-/**
- * Sends messages to its [ReceivePort]s.
- *
- * [SendPort]s are created from [ReceivePort]s. Any message sent through
- * a [SendPort] is delivered to its corresponding [ReceivePort]. There might be
- * many [SendPort]s for the same [ReceivePort].
- *
- * [SendPort]s can be transmitted to other isolates, and they preserve equality
- * when sent.
- */
-abstract class SendPort implements Capability {
-
- /**
- * Sends an asynchronous [message] through this send port, to its
- * corresponding `ReceivePort`.
- *
- * The content of [message] can be: primitive values (null, num, bool, double,
- * String), instances of [SendPort], and lists and maps whose elements are any
- * of these. List and maps are also allowed to be cyclic.
- *
- * In the special circumstances when two isolates share the same code and are
- * running in the same process (e.g. isolates created via [Isolate.spawn]), it
- * is also possible to send object instances (which would be copied in the
- * process). This is currently only supported by the dartvm. For now, the
- * dart2js compiler only supports the restricted messages described above.
- */
- void send(var message);
-
- /**
- * Tests whether [other] is a [SendPort] pointing to the same
- * [ReceivePort] as this one.
- */
- bool operator==(var other);
-
- /**
- * Returns an immutable hash code for this send port that is
- * consistent with the == operator.
- */
- int get hashCode;
-}
-
-/**
- * Together with [SendPort], the only means of communication between isolates.
- *
- * [ReceivePort]s have a `sendPort` getter which returns a [SendPort].
- * Any message that is sent through this [SendPort]
- * is delivered to the [ReceivePort] it has been created from. There, the
- * message is dispatched to the `ReceivePort`'s listener.
- *
- * A [ReceivePort] is a non-broadcast stream. This means that it buffers
- * incoming messages until a listener is registered. Only one listener can
- * receive messages. See [Stream.asBroadcastStream] for transforming the port
- * to a broadcast stream.
- *
- * A [ReceivePort] may have many [SendPort]s.
- */
-abstract class ReceivePort implements Stream {
-
- /**
- * Opens a long-lived port for receiving messages.
- *
- * A [ReceivePort] is a non-broadcast stream. This means that it buffers
- * incoming messages until a listener is registered. Only one listener can
- * receive messages. See [Stream.asBroadcastStream] for transforming the port
- * to a broadcast stream.
- *
- * A receive port is closed by canceling its subscription.
- */
- external factory ReceivePort();
-
- /**
- * Creates a [ReceivePort] from a [RawReceivePort].
- *
- * The handler of the given [rawPort] is overwritten during the construction
- * of the result.
- */
- external factory ReceivePort.fromRawReceivePort(RawReceivePort rawPort);
-
- /**
- * Inherited from [Stream].
- *
- * Note that [onError] and [cancelOnError] are ignored since a ReceivePort
- * will never receive an error.
- *
- * The [onDone] handler will be called when the stream closes.
- * The stream closes when [close] is called.
- */
- StreamSubscription listen(void onData(var message),
- { Function onError,
- void onDone(),
- bool cancelOnError });
-
- /**
- * Closes `this`.
- *
- * If the stream has not been canceled yet, adds a close-event to the event
- * queue and discards any further incoming messages.
- *
- * If the stream has already been canceled this method has no effect.
- */
- void close();
-
- /**
- * Returns a [SendPort] that sends to this receive port.
- */
- SendPort get sendPort;
-}
-
-abstract class RawReceivePort {
- /**
- * Opens a long-lived port for receiving messages.
- *
- * A [RawReceivePort] is low level and does not work with [Zone]s. It
- * can not be paused. The data-handler must be set before the first
- * event is received.
- */
- external factory RawReceivePort([void handler(event)]);
-
- /**
- * Sets the handler that is invoked for every incoming message.
- *
- * The handler is invoked in the root-zone ([Zone.ROOT]).
- */
- void set handler(Function newHandler);
-
- /**
- * Closes the port.
- *
- * After a call to this method any incoming message is silently dropped.
- */
- void close();
-
- /**
- * Returns a [SendPort] that sends to this raw receive port.
- */
- SendPort get sendPort;
-}
-
-/**
- * Wraps unhandled exceptions thrown during isolate execution. It is
- * used to show both the error message and the stack trace for unhandled
- * exceptions.
- */
-// TODO(floitsch): probably going to remove and replace with something else.
-class _IsolateUnhandledException implements Exception {
- /** Message being handled when exception occurred. */
- final message;
-
- /** Wrapped exception. */
- final source;
-
- /** Trace for the wrapped exception. */
- final StackTrace stackTrace;
-
- const _IsolateUnhandledException(this.message, this.source, this.stackTrace);
-
- String toString() {
- return 'IsolateUnhandledException: exception while handling message: '
- '${message} \n '
- '${source.toString().replaceAll("\n", "\n ")}\n'
- 'original stack trace:\n '
- '${stackTrace.toString().replaceAll("\n","\n ")}';
- }
-}
-
-/**
- * Description of an error from another isolate.
- *
- * This error has the same `toString()` and `stackTrace.toString()` behavior
- * as the original error, but has no other features of the original error.
- */
-class RemoteError implements Error {
- final String _description;
- final StackTrace stackTrace;
- RemoteError(String description, String stackDescription)
- : _description = description,
- stackTrace = new _RemoteStackTrace(stackDescription);
- String toString() => _description;
-}
-
-class _RemoteStackTrace implements StackTrace {
- String _trace;
- _RemoteStackTrace(this._trace);
- String toString() => _trace;
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/math/jenkins_smi_hash.dart b/pkg/dev_compiler/tool/input_sdk/lib/math/jenkins_smi_hash.dart
deleted file mode 100644
index 8a0056e..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/math/jenkins_smi_hash.dart
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-part of dart.math;
-
-/**
- * This is the [Jenkins hash function][1] but using masking to keep
- * values in SMI range.
- *
- * [1]: http://en.wikipedia.org/wiki/Jenkins_hash_function
- *
- * Use:
- * Hash each value with the hash of the previous value, then get the final
- * hash by calling finish.
- *
- * var hash = 0;
- * for (var value in values) {
- * hash = JenkinsSmiHash.combine(hash, value.hashCode);
- * }
- * hash = JenkinsSmiHash.finish(hash);
- */
-class _JenkinsSmiHash {
- // TODO(11617): This class should be optimized and standardized elsewhere.
-
- static int combine(int hash, int value) {
- hash = 0x1fffffff & (hash + value);
- hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10));
- return hash ^ (hash >> 6);
- }
-
- static int finish(int hash) {
- hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3));
- hash = hash ^ (hash >> 11);
- return 0x1fffffff & (hash + ((0x00003fff & hash) << 15));
- }
-
- static int hash2(a, b) => finish(combine(combine(0, a), b));
-
- static int hash4(a, b, c, d) =>
- finish(combine(combine(combine(combine(0, a), b), c), d));
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/math/math.dart b/pkg/dev_compiler/tool/input_sdk/lib/math/math.dart
deleted file mode 100644
index 0f651b7..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/math/math.dart
+++ /dev/null
@@ -1,209 +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.
-
-/**
- * Mathematical constants and functions, plus a random number generator.
- *
- * To use this library in your code:
- *
- * import 'dart:math';
- */
-library dart.math;
-
-part "jenkins_smi_hash.dart";
-part "point.dart";
-part "random.dart";
-part "rectangle.dart";
-
-/**
- * Base of the natural logarithms.
- *
- * Typically written as "e".
- */
-const double E = 2.718281828459045;
-
-/**
- * Natural logarithm of 10.
- */
-const double LN10 = 2.302585092994046;
-
-/**
- * Natural logarithm of 2.
- */
-const double LN2 = 0.6931471805599453;
-
-/**
- * Base-2 logarithm of [E].
- */
-const double LOG2E = 1.4426950408889634;
-
-/**
- * Base-10 logarithm of [E].
- */
-const double LOG10E = 0.4342944819032518;
-
-/**
- * The PI constant.
- */
-const double PI = 3.1415926535897932;
-
-/**
- * Square root of 1/2.
- */
-const double SQRT1_2 = 0.7071067811865476;
-
-/**
- * Square root of 2.
- */
-const double SQRT2 = 1.4142135623730951;
-
-/**
- * Returns the lesser of two numbers.
- *
- * Returns NaN if either argument is NaN.
- * The lesser of `-0.0` and `0.0` is `-0.0`.
- * If the arguments are otherwise equal (including int and doubles with the
- * same mathematical value) then it is unspecified which of the two arguments
- * is returned.
- */
-external num/*=T*/ min/*<T extends num>*/(num/*=T*/ a, num/*=T*/ b);
-
-/**
- * Returns the larger of two numbers.
- *
- * Returns NaN if either argument is NaN.
- * The larger of `-0.0` and `0.0` is `0.0`. If the arguments are
- * otherwise equal (including int and doubles with the same mathematical value)
- * then it is unspecified which of the two arguments is returned.
- */
-external num/*=T*/ max/*<T extends num>*/(num/*=T*/ a, num/*=T*/ b);
-
-/**
- * A variant of [atan].
- *
- * Converts both arguments to doubles.
- *
- * Returns the angle between the positive x-axis and the vector ([b],[a]).
- * The result, in radians, is in the range -PI..PI.
- *
- * If [b] is positive, this is the same as `atan(b/a)`.
- *
- * The result is negative when [a] is negative (including when [a] is the
- * double -0.0).
- *
- * If [a] is equal to zero, the vector ([b],[a]) is considered parallel to
- * the x-axis, even if [b] is also equal to zero. The sign of [b] determines
- * the direction of the vector along the x-axis.
- *
- * Returns NaN if either argument is NaN.
- */
-external double atan2(num a, num b);
-
-/**
- * Returns [x] to the power of [exponent].
- *
- * If [x] is an [int] and [exponent] is a non-negative [int], the result is
- * an [int], otherwise both arguments are converted to doubles first, and the
- * result is a [double].
- *
- * For integers, the power is always equal to the mathematical result of `x` to
- * the power `exponent`, only limited by the available memory.
- *
- * For doubles, `pow(x, y)` handles edge cases as follows:
- *
- * - if `y` is zero (0.0 or -0.0), the result is always 1.0.
- * - if `x` is 1.0, the result is always 1.0.
- * - otherwise, if either `x` or `y` is NaN then the result is NaN.
- * - if `x` is negative (but not -0.0) and `y` is a finite non-integer, the
- * result is NaN.
- * - if `x` is Infinity and `y` is negative, the result is 0.0.
- * - if `x` is Infinity and `y` is positive, the result is Infinity.
- * - if `x` is 0.0 and `y` is negative, the result is Infinity.
- * - if `x` is 0.0 and `y` is positive, the result is 0.0.
- * - if `x` is -Infinity or -0.0 and `y` is an odd integer, then the result is
- * `-pow(-x ,y)`.
- * - if `x` is -Infinity or -0.0 and `y` is not an odd integer, then the result
- * is the same as `pow(-x , y)`.
- * - if `y` is Infinity and the absolute value of `x` is less than 1, the
- * result is 0.0.
- * - if `y` is Infinity and `x` is -1, the result is 1.0.
- * - if `y` is Infinity and the absolute value of `x` is greater than 1,
- * the result is Infinity.
- * - if `y` is -Infinity, the result is `1/pow(x, Infinity)`.
- *
- * This corresponds to the `pow` function defined in the IEEE Standard 754-2008.
- *
- * Notice that an [int] result cannot overflow, but a [double] result might
- * be [double.INFINITY].
- */
-external num pow(num x, num exponent);
-
-/**
- * Converts [x] to a double and returns the sine of the value.
- *
- * If [x] is not a finite number, the result is NaN.
- */
-external double sin(num x);
-
-/**
- * Converts [x] to a double and returns the cosine of the value.
- *
- * If [x] is not a finite number, the result is NaN.
- */
-external double cos(num x);
-
-/**
- * Converts [x] to a double and returns the tangent of the value.
- *
- * The tangent function is equivalent to `sin(x)/cos(x)` and may be
- * infinite (positive or negative) when `cos(x)` is equal to zero.
- * If [x] is not a finite number, the result is NaN.
- */
-external double tan(num x);
-
-/**
- * Converts [x] to a double and returns the arc cosine of the value.
- *
- * Returns a value in the range 0..PI, or NaN if [x] is outside
- * the range -1..1.
- */
-external double acos(num x);
-
-/**
- * Converts [x] to a double and returns the arc sine of the value.
- *
- * Returns a value in the range -PI/2..PI/2, or NaN if [x] is outside
- * the range -1..1.
- */
-external double asin(num x);
-
-/**
- * Converts [x] to a double and returns the arc tangent of the value.
- *
- * Returns a value in the range -PI/2..PI/2, or NaN if [x] is NaN.
- */
-external double atan(num x);
-
-/**
- * Converts [x] to a double and returns the positive square root of the value.
- *
- * Returns -0.0 if [x] is -0.0, and NaN if [x] is otherwise negative or NaN.
- */
-external double sqrt(num x);
-
-/**
- * Converts [x] to a double and returns the natural exponent, [E],
- * to the power [x].
- *
- * Returns NaN if [x] is NaN.
- */
-external double exp(num x);
-
-/**
- * Converts [x] to a double and returns the natural logarithm of the value.
- *
- * Returns negative infinity if [x] is equal to zero.
- * Returns NaN if [x] is NaN or less than zero.
- */
-external double log(num x);
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/math/point.dart b/pkg/dev_compiler/tool/input_sdk/lib/math/point.dart
deleted file mode 100644
index 01ce93c..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/math/point.dart
+++ /dev/null
@@ -1,89 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-part of dart.math;
-
-/**
- * A utility class for representing two-dimensional positions.
- */
-class Point<T extends num> {
- final T x;
- final T y;
-
- const Point(T x, T y): this.x = x, this.y = y;
-
- String toString() => 'Point($x, $y)';
-
- /**
- * A `Point` is only equal to another `Point` with the same coordinates.
- *
- * This point is equal to `other` if, and only if,
- * `other` is a `Point` with
- * [x] equal to `other.x` and [y] equal to `other.y`.
- */
- bool operator ==(other) {
- if (other is !Point) return false;
- return x == other.x && y == other.y;
- }
-
- int get hashCode => _JenkinsSmiHash.hash2(x.hashCode, y.hashCode);
-
- /**
- * Add [other] to `this`, as if both points were vectors.
- *
- * Returns the resulting "vector" as a Point.
- */
- Point<T> operator +(Point<T> other) {
- return new Point<T>(x + other.x, y + other.y);
- }
-
- /**
- * Subtract [other] from `this`, as if both points were vectors.
- *
- * Returns the resulting "vector" as a Point.
- */
- Point<T> operator -(Point<T> other) {
- return new Point<T>(x - other.x, y - other.y);
- }
-
- /**
- * Scale this point by [factor] as if it were a vector.
- *
- * *Important* *Note*: This function accepts a `num` as its argument only so
- * that you can scale Point<double> objects by an `int` factor. Because the
- * star operator always returns the same type of Point that originally called
- * it, passing in a double [factor] on a `Point<int>` _causes_ _a_
- * _runtime_ _error_ in checked mode.
- */
- Point<T> operator *(num/*T|int*/ factor) {
- return new Point<T>(
- (x * factor) as dynamic/*=T*/, (y * factor) as dynamic/*=T*/);
- }
-
- /**
- * Get the straight line (Euclidean) distance between the origin (0, 0) and
- * this point.
- */
- double get magnitude => sqrt(x * x + y * y);
-
- /**
- * Returns the distance between `this` and [other].
- */
- double distanceTo(Point<T> other) {
- var dx = x - other.x;
- var dy = y - other.y;
- return sqrt(dx * dx + dy * dy);
- }
-
- /**
- * Returns the squared distance between `this` and [other].
- *
- * Squared distances can be used for comparisons when the actual value is not
- * required.
- */
- T squaredDistanceTo(Point<T> other) {
- var dx = x - other.x;
- var dy = y - other.y;
- return dx * dx + dy * dy;
- }
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/math/random.dart b/pkg/dev_compiler/tool/input_sdk/lib/math/random.dart
deleted file mode 100644
index 47c5582..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/math/random.dart
+++ /dev/null
@@ -1,53 +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.
-
-part of dart.math;
-
-/**
- * A generator of random bool, int, or double values.
- *
- * The default implementation supplies a stream of
- * pseudo-random bits that are not suitable for cryptographic purposes.
- *
- * Use the Random.secure() constructor for cryptographic
- * purposes.
- */
-abstract class Random {
- /**
- * Creates a random number generator.
- *
- * The optional parameter [seed] is used to initialize the
- * internal state of the generator. The implementation of the
- * random stream can change between releases of the library.
- */
- external factory Random([int seed]);
-
- /**
- * Creates a cryptographically secure random number generator.
- *
- * If the program cannot provide a cryptographically secure
- * source of random numbers, it throws an [UnsupportedError].
- */
- external factory Random.secure();
-
- /**
- * Generates a non-negative random integer uniformly distributed in the range
- * from 0, inclusive, to [max], exclusive.
- *
- * Implementation note: The default implementation supports [max] values
- * between 1 and (1<<32) inclusive.
- */
- int nextInt(int max);
-
- /**
- * Generates a non-negative random floating point value uniformly distributed
- * in the range from 0.0, inclusive, to 1.0, exclusive.
- */
- double nextDouble();
-
- /**
- * Generates a random boolean value.
- */
- bool nextBool();
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/math/rectangle.dart b/pkg/dev_compiler/tool/input_sdk/lib/math/rectangle.dart
deleted file mode 100644
index bae6602..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/math/rectangle.dart
+++ /dev/null
@@ -1,283 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-part of dart.math;
-
-/**
- * A base class for representing two-dimensional axis-aligned rectangles.
- *
- * This rectangle uses a left-handed Cartesian coordinate system, with x
- * directed to the right and y directed down, as per the convention in 2D
- * computer graphics.
- *
- * See also:
- * [W3C Coordinate Systems Specification](http://www.w3.org/TR/SVG/coords.html#InitialCoordinateSystem).
- *
- * The rectangle is the set of points with representable coordinates greater
- * than or equal to left/top, and with distance to left/top no greater than
- * width/height (to the limit of the precission of the coordinates).
- */
-abstract class _RectangleBase<T extends num> {
- const _RectangleBase();
-
- /** The x-coordinate of the left edge. */
- T get left;
- /** The y-coordinate of the top edge. */
- T get top;
- /** The width of the rectangle. */
- T get width;
- /** The height of the rectangle. */
- T get height;
-
- /** The x-coordinate of the right edge. */
- T get right => left + width;
- /** The y-coordinate of the bottom edge. */
- T get bottom => top + height;
-
- String toString() {
- return 'Rectangle ($left, $top) $width x $height';
- }
-
- bool operator ==(other) {
- if (other is !Rectangle) return false;
- // TODO(rnystrom): Type promotion doesn't currently promote the [other]
- // to Rectangle from the above line, so do it explicitly here to avoid a
- // dynamic send and work around:
- // https://github.com/dart-lang/sdk/issues/27551
- var otherRect = other as Rectangle;
- return left == otherRect.left &&
- top == otherRect.top &&
- right == otherRect.right &&
- bottom == otherRect.bottom;
- }
-
- int get hashCode => _JenkinsSmiHash.hash4(left.hashCode, top.hashCode,
- right.hashCode, bottom.hashCode);
-
- /**
- * Computes the intersection of `this` and [other].
- *
- * The intersection of two axis-aligned rectangles, if any, is always another
- * axis-aligned rectangle.
- *
- * Returns the intersection of this and `other`, or `null` if they don't
- * intersect.
- */
- Rectangle<T> intersection(Rectangle<T> other) {
- var x0 = max(left, other.left);
- var x1 = min(left + width, other.left + other.width);
-
- if (x0 <= x1) {
- var y0 = max(top, other.top);
- var y1 = min(top + height, other.top + other.height);
-
- if (y0 <= y1) {
- return new Rectangle<T>(x0, y0, x1 - x0, y1 - y0);
- }
- }
- return null;
- }
-
-
- /**
- * Returns true if `this` intersects [other].
- */
- bool intersects(Rectangle<num> other) {
- return (left <= other.left + other.width &&
- other.left <= left + width &&
- top <= other.top + other.height &&
- other.top <= top + height);
- }
-
- /**
- * Returns a new rectangle which completely contains `this` and [other].
- */
- Rectangle<T> boundingBox(Rectangle<T> other) {
- var right = max(this.left + this.width, other.left + other.width);
- var bottom = max(this.top + this.height, other.top + other.height);
-
- var left = min(this.left, other.left);
- var top = min(this.top, other.top);
-
- return new Rectangle<T>(left, top, right - left, bottom - top);
- }
-
- /**
- * Tests whether `this` entirely contains [another].
- */
- bool containsRectangle(Rectangle<num> another) {
- return left <= another.left &&
- left + width >= another.left + another.width &&
- top <= another.top &&
- top + height >= another.top + another.height;
- }
-
- /**
- * Tests whether [another] is inside or along the edges of `this`.
- */
- bool containsPoint(Point<num> another) {
- return another.x >= left &&
- another.x <= left + width &&
- another.y >= top &&
- another.y <= top + height;
- }
-
- Point<T> get topLeft => new Point<T>(this.left, this.top);
- Point<T> get topRight => new Point<T>(this.left + this.width, this.top);
- Point<T> get bottomRight => new Point<T>(this.left + this.width,
- this.top + this.height);
- Point<T> get bottomLeft => new Point<T>(this.left,
- this.top + this.height);
-}
-
-
-/**
- * A class for representing two-dimensional rectangles whose properties are
- * immutable.
- */
-class Rectangle<T extends num> extends _RectangleBase<T> {
- final T left;
- final T top;
- final T width;
- final T height;
-
- /**
- * Create a rectangle spanned by `(left, top)` and `(left+width, top+height)`.
- *
- * The rectangle contains the points
- * with x-coordinate between `left` and `left + width`, and
- * with y-coordinate between `top` and `top + height`, both inclusive.
- *
- * The `width` and `height` should be non-negative.
- * If `width` or `height` are negative, they are clamped to zero.
- *
- * If `width` and `height` are zero, the "rectangle" comprises only the single
- * point `(left, top)`.
- */
- const Rectangle(this.left, this.top, T width, T height)
- : this.width = (width < 0) ? -width * 0 : width, // Inline _clampToZero.
- this.height = (height < 0) ? -height * 0 : height;
-
- /**
- * Create a rectangle spanned by the points [a] and [b];
- *
- * The rectangle contains the points
- * with x-coordinate between `a.x` and `b.x`, and
- * with y-coordinate between `a.y` and `b.y`, both inclusive.
- *
- * If the distance between `a.x` and `b.x` is not representable
- * (which can happen if one or both is a double),
- * the actual right edge might be slightly off from `max(a.x, b.x)`.
- * Similar for the y-coordinates and the bottom edge.
- */
- factory Rectangle.fromPoints(Point<T> a, Point<T> b) {
- T left = min(a.x, b.x);
- T width = max(a.x, b.x) - left;
- T top = min(a.y, b.y);
- T height = max(a.y, b.y) - top;
- return new Rectangle<T>(left, top, width, height);
- }
-}
-
-/**
- * A class for representing two-dimensional axis-aligned rectangles with mutable
- * properties.
- */
-class MutableRectangle<T extends num> extends _RectangleBase<T>
- implements Rectangle<T> {
-
- /**
- * The x-coordinate of the left edge.
- *
- * Setting the value will move the rectangle without changing its width.
- */
- T left;
- /**
- * The y-coordinate of the left edge.
- *
- * Setting the value will move the rectangle without changing its height.
- */
- T top;
- T _width;
- T _height;
-
- /**
- * Create a mutable rectangle spanned by `(left, top)` and
- * `(left+width, top+height)`.
- *
- * The rectangle contains the points
- * with x-coordinate between `left` and `left + width`, and
- * with y-coordinate between `top` and `top + height`, both inclusive.
- *
- * The `width` and `height` should be non-negative.
- * If `width` or `height` are negative, they are clamped to zero.
- *
- * If `width` and `height` are zero, the "rectangle" comprises only the single
- * point `(left, top)`.
- */
- MutableRectangle(this.left, this.top, T width, T height)
- : this._width = (width < 0) ? _clampToZero/*<T>*/(width) : width,
- this._height = (height < 0) ? _clampToZero/*<T>*/(height) : height;
-
- /**
- * Create a mutable rectangle spanned by the points [a] and [b];
- *
- * The rectangle contains the points
- * with x-coordinate between `a.x` and `b.x`, and
- * with y-coordinate between `a.y` and `b.y`, both inclusive.
- *
- * If the distance between `a.x` and `b.x` is not representable
- * (which can happen if one or both is a double),
- * the actual right edge might be slightly off from `max(a.x, b.x)`.
- * Similar for the y-coordinates and the bottom edge.
- */
- factory MutableRectangle.fromPoints(Point<T> a, Point<T> b) {
- T left = min(a.x, b.x);
- T width = max(a.x, b.x) - left;
- T top = min(a.y, b.y);
- T height = max(a.y, b.y) - top;
- return new MutableRectangle<T>(left, top, width, height);
- }
-
- T get width => _width;
-
- /**
- * Sets the width of the rectangle.
- *
- * The width must be non-negative.
- * If a negative width is supplied, it is clamped to zero.
- *
- * Setting the value will change the right edge of the rectangle,
- * but will not change [left].
- */
- void set width(T width) {
- if (width < 0) width = _clampToZero/*<T>*/(width);
- _width = width;
- }
-
- T get height => _height;
-
- /**
- * Sets the height of the rectangle.
- *
- * The height must be non-negative.
- * If a negative height is supplied, it is clamped to zero.
- *
- * Setting the value will change the bottom edge of the rectangle,
- * but will not change [top].
- */
- void set height(T height) {
- if (height < 0) height = _clampToZero/*<T>*/(height);
- _height = height;
- }
-}
-
-/**
- * Converts a negative [int] or [double] to a zero-value of the same type.
- *
- * Returns `0` if value is int, `0.0` if value is double.
- */
-num/*=T*/ _clampToZero/*<T extends num>*/(num/*=T*/ value) {
- assert(value < 0);
- return -value * 0;
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/mirrors/mirrors.dart b/pkg/dev_compiler/tool/input_sdk/lib/mirrors/mirrors.dart
deleted file mode 100644
index 25cab26..0000000
--- a/pkg/dev_compiler/tool/input_sdk/lib/mirrors/mirrors.dart
+++ /dev/null
@@ -1,1426 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-// For the purposes of the mirrors library, we adopt a naming
-// convention with respect to getters and setters. Specifically, for
-// some variable or field...
-//
-// var myField;
-//
-// ...the getter is named 'myField' and the setter is named
-// 'myField='. This allows us to assign unique names to getters and
-// setters for the purposes of member lookup.
-
-/**
- * Basic reflection in Dart,
- * with support for introspection and dynamic invocation.
- *
- * *Introspection* is that subset of reflection by which a running
- * program can examine its own structure. For example, a function
- * that prints out the names of all the members of an arbitrary object.
- *
- * *Dynamic invocation* refers the ability to evaluate code that
- * has not been literally specified at compile time, such as calling a method
- * whose name is provided as an argument (because it is looked up
- * in a database, or provided interactively by the user).
- *
- * ## How to interpret this library's documentation
- *
- * As a rule, the names of Dart declarations are represented using
- * instances of class [Symbol]. Whenever the doc speaks of an object *s*
- * of class [Symbol] denoting a name, it means the string that
- * was used to construct *s*.
- *
- * The documentation frequently abuses notation with
- * Dart pseudo-code such as [:o.x(a):], where
- * o and a are defined to be objects; what is actually meant in these
- * cases is [:o'.x(a'):] where *o'* and *a'* are Dart variables
- * bound to *o* and *a* respectively. Furthermore, *o'* and *a'*
- * are assumed to be fresh variables (meaning that they are
- * distinct from any other variables in the program).
- *
- * Sometimes the documentation refers to *serializable* objects.
- * An object is serializable across isolates if and only if it is an instance of
- * num, bool, String, a list of objects that are serializable
- * across isolates, or a map with keys and values that are all serializable across
- * isolates.
- *
- * ## Status: Unstable
- *
- * The dart:mirrors library is unstable and its API might change slightly as a
- * result of user feedback. This library is platform dependent and therefore it
- * has implementations for both dart2js and the Dart VM. Both are under
- * development and may not support all operations yet.
- */
-library dart.mirrors;
-
-/**
- * A [MirrorSystem] is the main interface used to reflect on a set of
- * associated libraries.
- *
- * At runtime each running isolate has a distinct [MirrorSystem].
- *
- * It is also possible to have a [MirrorSystem] which represents a set
- * of libraries which are not running -- perhaps at compile-time. In
- * this case, all available reflective functionality would be
- * supported, but runtime functionality (such as invoking a function
- * or inspecting the contents of a variable) would fail dynamically.
- */
-abstract class MirrorSystem {
- /**
- * All libraries known to the mirror system, indexed by their URI.
- *
- * Returns an unmodifiable map of the libraries with [LibraryMirror.uri] as
- * keys.
- *
- * For a runtime mirror system, only libraries which are currently loaded
- * are included, and repeated calls of this method may return different maps
- * as libraries are loaded.
- */
- Map<Uri, LibraryMirror> get libraries;
-
- /**
- * Returns the unique library named [libraryName] if it exists.
- *
- * If no unique library exists, an error is thrown.
- */
- LibraryMirror findLibrary(Symbol libraryName) {
- return libraries.values.singleWhere(
- (library) => library.simpleName == libraryName);
- }
-
- /**
- * A mirror on the isolate associated with this [MirrorSystem].
- *
- * This may be null if this mirror system is not running.
- */
- IsolateMirror get isolate;
-
- /**
- * A mirror on the [:dynamic:] type.
- */
- TypeMirror get dynamicType;
-
- /**
- * A mirror on the [:void:] type.
- */
- TypeMirror get voidType;
-
- /**
- * Returns the name of [symbol].
- *
- * The following text is non-normative:
- *
- * Using this method may result in larger output. If possible, use
- * [MirrorsUsed] to specify which symbols must be retained in clear text.
- */
- external static String getName(Symbol symbol);
-
- /**
- * Returns a symbol for [name].
- *
- * If [library] is not a [LibraryMirror] or if [name] is a private identifier
- * and [library] is `null`, throws an [ArgumentError]. If [name] is a private
- * identifier, the symbol returned is with respect to [library].
- *
- * The following text is non-normative:
- *
- * Using this method may result in larger output. If possible, use
- * the const constructor of [Symbol] or symbol literals.
- */
- external static Symbol getSymbol(String name, [LibraryMirror library]);
-}
-
-/**
- * Returns a [MirrorSystem] for the current isolate.
- */
-external MirrorSystem currentMirrorSystem();
-
-/**
- * Reflects an instance.
- *
- * Returns an [InstanceMirror] reflecting [reflectee]. If [reflectee] is a
- * function or an instance of a class that has a [:call:] method, the returned
- * instance mirror will be a [ClosureMirror].
- *
- * Note that since one cannot obtain an object from another isolate, this
- * function can only be used to obtain mirrors on objects of the current
- * isolate.
- */
-external InstanceMirror reflect(Object reflectee);
-
-/**
- * Reflects a class declaration.
- *
- * Let *C* be the original class declaration of the class represented by [key].
- * This function returns a [ClassMirror] reflecting *C*.
- *
- * If [key] is not an instance of [Type], then this function throws an
- * [ArgumentError]. If [key] is the Type for dynamic or a function typedef,
- * throws an [ArgumentError].
- *
- * Note that since one cannot obtain a [Type] object from another isolate, this
- * function can only be used to obtain class mirrors on classes of the current
- * isolate.
- */
-external ClassMirror reflectClass(Type key);
-
-/**
- * Reflects the type represented by [key].
- *
- * If [key] is not an instance of [Type], then this function throws an
- * [ArgumentError].
- *
- * Note that since one cannot obtain a [Type] object from another isolate, this
- * function can only be used to obtain type mirrors on types of the current
- * isolate.
- */
-external TypeMirror reflectType(Type key);
-
-/**
- * A [Mirror] reflects some Dart language entity.
- *
- * Every [Mirror] originates from some [MirrorSystem].
- */
-abstract class Mirror {}
-
-/**
- * An [IsolateMirror] reflects an isolate.
- */
-abstract class IsolateMirror implements Mirror {
- /**
- * A unique name used to refer to the isolate in debugging messages.
- */
- String get debugName;
-
- /**
- * Whether this mirror reflects the currently running isolate.
- */
- bool get isCurrent;
-
- /**
- * The root library for the reflected isolate.
- */
- LibraryMirror get rootLibrary;
-
- /**
- * Whether [other] is an [IsolateMirror] on the same isolate as this mirror.
- *
- * The equality holds if and only if
- *
- * 1. [other] is a mirror of the same kind, and
- * 2. the isolate being reflected by this mirror is the same isolate being
- * reflected by [other].
- */
- bool operator == (other);
-}
-
-/**
- * A [DeclarationMirror] reflects some entity declared in a Dart program.
- */
-abstract class DeclarationMirror implements Mirror {
- /**
- * The simple name for this Dart language entity.
- *
- * The simple name is in most cases the identifier name of the entity,
- * such as 'myMethod' for a method, [:void myMethod() {...}:] or 'mylibrary'
- * for a [:library 'mylibrary';:] declaration.
- */
- Symbol get simpleName;
-
- /**
- * The fully-qualified name for this Dart language entity.
- *
- * This name is qualified by the name of the owner. For instance,
- * the qualified name of a method 'method' in class 'Class' in
- * library 'library' is 'library.Class.method'.
- *
- * Returns a [Symbol] constructed from a string representing the
- * fully qualified name of the reflectee.
- * Let *o* be the [owner] of this mirror, let *r* be the reflectee of
- * this mirror, let *p* be the fully qualified
- * name of the reflectee of *o*, and let *s* be the simple name of *r*
- * computed by [simpleName].
- * The fully qualified name of *r* is the
- * concatenation of *p*, '.', and *s*.
- *
- * Because an isolate can contain more than one library with the same name (at
- * different URIs), a fully-qualified name does not uniquely identify any
- * language entity.
- */
- Symbol get qualifiedName;
-
- /**
- * A mirror on the owner of this Dart language entity.
- *
- * The owner is the declaration immediately surrounding the reflectee:
- *
- * * For a library, the owner is [:null:].
- * * For a class declaration, typedef or top level function or variable, the
- * owner is the enclosing library.
- * * For a mixin application `S with M`, the owner is the owner of `M`.
- * * For a constructor, the owner is the immediately enclosing class.
- * * For a method, instance variable or a static variable, the owner is the
- * immediately enclosing class, unless the class is a mixin application
- * `S with M`, in which case the owner is `M`. Note that `M` may be an
- * invocation of a generic.
- * * For a parameter, local variable or local function the owner is the
- * immediately enclosing function.
- */
- DeclarationMirror get owner;
-
- /**
- * Whether this declaration is library private.
- *
- * Always returns `false` for a library declaration,
- * otherwise returns `true` if the declaration's name starts with an
- * underscore character (`_`), and `false` if it doesn't.
- */
- bool get isPrivate;
-
- /**
- * Whether this declaration is top-level.
- *
- * A declaration is considered top-level if its [owner] is a [LibraryMirror].
- */
- bool get isTopLevel;
-
- /**
- * The source location of this Dart language entity, or [:null:] if the
- * entity is synthetic.
- *
- * If the reflectee is a variable, the returned location gives the position
- * of the variable name at its point of declaration.
- *
- * If the reflectee is a library, class, typedef, function or type variable
- * with associated metadata, the returned location gives the position of the
- * first metadata declaration associated with the reflectee.
- *
- * Otherwise:
- *
- * If the reflectee is a library, the returned location gives the position of
- * the keyword 'library' at the reflectee's point of declaration, if the
- * reflectee is a named library, or the first character of the first line in
- * the compilation unit defining the reflectee if the reflectee is anonymous.
- *
- * If the reflectee is an abstract class, the returned location gives the
- * position of the keyword 'abstract' at the reflectee's point of declaration.
- * Otherwise, if the reflectee is a class, the returned location gives the
- * position of the keyword 'class' at the reflectee's point of declaration.
- *
- * If the reflectee is a typedef the returned location gives the position of
- * the of the keyword 'typedef' at the reflectee's point of declaration.
- *
- * If the reflectee is a function with a declared return type, the returned
- * location gives the position of the function's return type at the
- * reflectee's point of declaration. Otherwise. the returned location gives
- * the position of the function's name at the reflectee's point of
- * declaration.
- *
- * This operation is optional and may throw an [UnsupportedError].
- */
- SourceLocation get location;
-
- /**
- * A list of the metadata associated with this declaration.
- *
- * Let *D* be the declaration this mirror reflects.
- * If *D* is decorated with annotations *A1, ..., An*
- * where *n > 0*, then for each annotation *Ai* associated
- * with *D, 1 <= i <= n*, let *ci* be the constant object
- * specified by *Ai*. Then this method returns a list whose
- * members are instance mirrors on *c1, ..., cn*.
- * If no annotations are associated with *D*, then
- * an empty list is returned.
- *
- * If evaluating any of *c1, ..., cn* would cause a
- * compilation error
- * the effect is the same as if a non-reflective compilation error
- * had been encountered.
- */
- List<InstanceMirror> get metadata;
-}
-
-/**
- * An [ObjectMirror] is a common superinterface of [InstanceMirror],
- * [ClassMirror], and [LibraryMirror] that represents their shared
- * functionality.
- *
- * For the purposes of the mirrors library, these types are all
- * object-like, in that they support method invocation and field
- * access. Real Dart objects are represented by the [InstanceMirror]
- * type.
- *
- * See [InstanceMirror], [ClassMirror], and [LibraryMirror].
- */
-abstract class ObjectMirror implements Mirror {
-
- /**
- * Invokes the named function and returns a mirror on the result.
- *
- * Let *o* be the object reflected by this mirror, let *f* be the simple name
- * of the member denoted by [memberName], let *a1, ..., an* be the elements
- * of [positionalArguments], let *k1, ..., km* be the identifiers denoted by
- * the elements of [namedArguments.keys], and let *v1, ..., vm* be the
- * elements of [namedArguments.values]. Then this method will perform the
- * method invocation *o.f(a1, ..., an, k1: v1, ..., km: vm)* in a scope that
- * has access to the private members of *o* (if *o* is a class or library) or
- * the private members of the class of *o* (otherwise).
- *
- * If the invocation returns a result *r*, this method returns the result of
- * calling [reflect]\(*r*\).
- *
- * If the invocation causes a compilation error the effect is the same as if
- * a non-reflective compilation error had been encountered.
- *
- * If the invocation throws an exception *e* (that it does not catch), this
- * method throws *e*.
- */
- /*
- * TODO(turnidge): Handle ambiguous names.
- * TODO(turnidge): Handle optional & named arguments.
- */
- InstanceMirror invoke(Symbol memberName,
- List positionalArguments,
- [Map<Symbol,dynamic> namedArguments]);
-
- /**
- * Invokes a getter and returns a mirror on the result.
- *
- * The getter can be the implicit getter for a field or a user-defined getter
- * method.
- *
- * Let *o* be the object reflected by this mirror,
- * let *f* be the simple name of the getter denoted by [fieldName].
- *
- * Then this method will perform the getter invocation *o.f* in a scope that
- * has access to the private members of *o* (if *o* is a class or library) or
- * the private members of the class of *o* (otherwise).
- *
- * If this mirror is an [InstanceMirror], and [fieldName] denotes an instance
- * method on its reflectee, the result of the invocation is an instance
- * mirror on a closure corresponding to that method.
- *
- * If this mirror is a [LibraryMirror], and [fieldName] denotes a top-level
- * method in the corresponding library, the result of the invocation is an
- * instance mirror on a closure corresponding to that method.
- *
- * If this mirror is a [ClassMirror], and [fieldName] denotes a static method
- * in the corresponding class, the result of the invocation is an instance
- * mirror on a closure corresponding to that method.
- *
- * If the invocation returns a result *r*, this method returns the result of
- * calling [reflect]\(*r*\).
- *
- * If the invocation causes a compilation error, the effect is the same as if
- * a non-reflective compilation error had been encountered.
- *
- * If the invocation throws an exception *e* (that it does not catch), this
- * method throws *e*.
- */
- // TODO(ahe): Remove stuff about scope and private members. [fieldName] is a
- // capability giving access to private members.
- InstanceMirror getField(Symbol fieldName);
-
- /**
- * Invokes a setter and returns a mirror on the result.
- *
- * The setter may be either the implicit setter for a non-final field or a
- * user-defined setter method.
- *
- * Let *o* be the object reflected by this mirror,
- * let *f* be the simple name of the getter denoted by [fieldName],
- * and let *a* be the object bound to [value].
- *
- * Then this method will perform the setter invocation *o.f = a* in a scope
- * that has access to the private members of *o* (if *o* is a class or
- * library) or the private members of the class of *o* (otherwise).
- *
- * If the invocation returns a result *r*, this method returns the result of
- * calling [reflect]\([value]\).
- *
- * If the invocation causes a compilation error, the effect is the same as if
- * a non-reflective compilation error had been encountered.
- *
- * If the invocation throws an exception *e* (that it does not catch) this
- * method throws *e*.
- */
- /* TODO(turnidge): Handle ambiguous names.*/
- InstanceMirror setField(Symbol fieldName, Object value);
-}
-
-/**
- * An [InstanceMirror] reflects an instance of a Dart language object.
- */
-abstract class InstanceMirror implements ObjectMirror {
- /**
- * A mirror on the type of the reflectee.
- *
- * Returns a mirror on the actual class of the reflectee.
- * The class of the reflectee may differ from
- * the object returned by invoking [runtimeType] on
- * the reflectee.
- */
- ClassMirror get type;
-
- /**
- * Whether [reflectee] will return the instance reflected by this mirror.
- *
- * This will always be true in the local case (reflecting instances in the
- * same isolate), but only true in the remote case if this mirror reflects a
- * simple value.
- *
- * A value is simple if one of the following holds:
- *
- * * the value is [:null:]
- * * the value is of type [num]
- * * the value is of type [bool]
- * * the value is of type [String]
- */
- bool get hasReflectee;
-
- /**
- * If the [InstanceMirror] reflects an instance it is meaningful to
- * have a local reference to, we provide access to the actual
- * instance here.
- *
- * If you access [reflectee] when [hasReflectee] is false, an
- * exception is thrown.
- */
- get reflectee;
-
- /**
- * Whether this mirror is equal to [other].
- *
- * The equality holds if and only if
- *
- * 1. [other] is a mirror of the same kind, and
- * 2. either
- *
- * a. [hasReflectee] is true and so is
- * [:identical(reflectee, other.reflectee):], or
- *
- * b. the remote objects reflected by this mirror and by [other] are
- * identical.
- */
- bool operator == (other);
-
- /**
- * Perform [invocation] on [reflectee].
- * Equivalent to
- *
- * this.invoke(invocation.memberName,
- * invocation.positionalArguments,
- * invocation.namedArguments);
- */
- delegate(Invocation invocation);
-}
-
-/**
- * A [ClosureMirror] reflects a closure.
- *
- * A [ClosureMirror] provides the ability to execute its reflectee and
- * introspect its function.
- */
-abstract class ClosureMirror implements InstanceMirror {
- /**
- * A mirror on the function associated with this closure.
- *
- * The function associated with an implicit closure of a function is that
- * function.
- *
- * The function associated with an instance of a class that has a [:call:]
- * method is that [:call:] method.
- *
- * A Dart implementation might choose to create a class for each closure
- * expression, in which case [:function:] would be the same as
- * [:type.declarations[#call]:]. But the Dart language model does not require
- * this. A more typical implementation involves a single closure class for
- * each type signature, where the call method dispatches to a function held
- * in the closure rather the call method
- * directly implementing the closure body. So one cannot rely on closures from
- * distinct closure expressions having distinct classes ([:type:]), but one
- * can rely on them having distinct functions ([:function:]).
- */
- MethodMirror get function;
-
- /**
- * Executes the closure and returns a mirror on the result.
- *
- * Let *f* be the closure reflected by this mirror,
- * let *a1, ..., an* be the elements of [positionalArguments],
- * let *k1, ..., km* be the identifiers denoted by the elements of
- * [namedArguments.keys],
- * and let *v1, ..., vm* be the elements of [namedArguments.values].
- *
- * Then this method will perform the method invocation
- * *f(a1, ..., an, k1: v1, ..., km: vm)*.
- *
- * If the invocation returns a result *r*, this method returns the result of
- * calling [reflect]\(*r*\).
- *
- * If the invocation causes a compilation error, the effect is the same as if
- * a non-reflective compilation error had been encountered.
- *
- * If the invocation throws an exception *e* (that it does not catch), this
- * method throws *e*.
- */
- InstanceMirror apply(List positionalArguments,
- [Map<Symbol, dynamic> namedArguments]);
-}
-
-/**
- * A [LibraryMirror] reflects a Dart language library, providing
- * access to the variables, functions, and classes of the
- * library.
- */
-abstract class LibraryMirror implements DeclarationMirror, ObjectMirror {
- /**
- * The absolute uri of the library.
- */
- Uri get uri;
-
- /**
- * Returns an immutable map of the declarations actually given in the library.
- *
- * This map includes all regular methods, getters, setters, fields, classes
- * and typedefs actually declared in the library. The map is keyed by the
- * simple names of the declarations.
- */
- Map<Symbol, DeclarationMirror> get declarations;
-
- /**
- * Whether this mirror is equal to [other].
- *
- * The equality holds if and only if
- *
- * 1. [other] is a mirror of the same kind, and
- * 2. The library being reflected by this mirror and the library being
- * reflected by [other] are the same library in the same isolate.
- */
- bool operator ==(other);
-
- /**
- * Returns a list of the imports and exports in this library;
- */
- List<LibraryDependencyMirror> get libraryDependencies;
-}
-
-/// A mirror on an import or export declaration.
-abstract class LibraryDependencyMirror implements Mirror {
- /// Is `true` if this dependency is an import.
- bool get isImport;
-
- /// Is `true` if this dependency is an export.
- bool get isExport;
-
- /// Returns the library mirror of the library that imports or exports the
- /// [targetLibrary].
- LibraryMirror get sourceLibrary;
-
- /// Returns the library mirror of the library that is imported or exported,
- /// or null if the library is not loaded.
- LibraryMirror get targetLibrary;
-
- /// Returns the prefix if this is a prefixed import and `null` otherwise.
- Symbol get prefix;
-
- /// Returns the list of show/hide combinators on the import/export
- /// declaration.
- List<CombinatorMirror> get combinators;
-
- /// Returns the source location for this import/export declaration.
- SourceLocation get location;
-
- List<InstanceMirror> get metadata;
-}
-
-/// A mirror on a show/hide combinator declared on a library dependency.
-abstract class CombinatorMirror implements Mirror {
- /// The list of identifiers on the combinator.
- List<Symbol> get identifiers;
-
- /// Is `true` if this is a 'show' combinator.
- bool get isShow;
-
- /// Is `true` if this is a 'hide' combinator.
- bool get isHide;
-}
-
-/**
- * A [TypeMirror] reflects a Dart language class, typedef,
- * function type or type variable.
- */
-abstract class TypeMirror implements DeclarationMirror {
- /**
- * Returns true if this mirror reflects dynamic, a non-generic class or
- * typedef, or an instantiated generic class or typedef in the current
- * isolate. Otherwise, returns false.
- */
- bool get hasReflectedType;
-
- /**
- * If [:hasReflectedType:] returns true, returns the corresponding [Type].
- * Otherwise, an [UnsupportedError] is thrown.
- */
- Type get reflectedType;
-
- /**
- * An immutable list with mirrors for all type variables for this type.
- *
- * If this type is a generic declaration or an invocation of a generic
- * declaration, the returned list contains mirrors on the type variables
- * declared in the original declaration.
- * Otherwise, the returned list is empty.
- *
- * This list preserves the order of declaration of the type variables.
- */
- List<TypeVariableMirror> get typeVariables;
-
- /**
- * An immutable list with mirrors for all type arguments for
- * this type.
- *
- * If the reflectee is an invocation of a generic class,
- * the type arguments are the bindings of its type parameters.
- * If the reflectee is the original declaration of a generic,
- * it has no type arguments and this method returns an empty list.
- * If the reflectee is not generic, then
- * it has no type arguments and this method returns an empty list.
- *
- * This list preserves the order of declaration of the type variables.
- */
- List<TypeMirror> get typeArguments;
-
- /**
- * 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 isOriginalDeclaration;
-
- /**
- * 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.
- */
- TypeMirror get originalDeclaration;
-
-
- /**
- * Checks the subtype relationship, denoted by `<:` in the language
- * specification.
- *
- * This is the type relationship used in `is` test checks.
- */
- bool isSubtypeOf(TypeMirror other);
-
- /**
- * Checks the assignability relationship, denoted by `<=>` in the language
- * specification.
- *
- * This is the type relationship tested on assignment in checked mode.
- */
- bool isAssignableTo(TypeMirror other);
-}
-
-/**
- * A [ClassMirror] reflects a Dart language class.
- */
-abstract class ClassMirror implements TypeMirror, ObjectMirror {
- /**
- * A mirror on the superclass on the reflectee.
- *
- * If this type is [:Object:], the superclass will be null.
- */
- ClassMirror get superclass;
-
- /**
- * A list of mirrors on the superinterfaces of the reflectee.
- */
- List<ClassMirror> get superinterfaces;
-
- /**
- * Is the reflectee abstract?
- */
- bool get isAbstract;
-
- /**
- * Returns an immutable map of the declarations actually given in the class
- * declaration.
- *
- * This map includes all regular methods, getters, setters, fields,
- * constructors and type variables actually declared in the class. Both
- * static and instance members are included, but no inherited members are
- * included. The map is keyed by the simple names of the declarations.
- *
- * This does not include inherited members.
- */
- Map<Symbol, DeclarationMirror> get declarations;
-
- /**
- * Returns a map of the methods, getters and setters of an instance of the
- * class.
- *
- * The intent is to capture those members that constitute the API of an
- * instance. Hence fields are not included, but the getters and setters
- * implicitly introduced by fields are included. The map includes methods,
- * getters and setters that are inherited as well as those introduced by the
- * class itself.
- *
- * The map is keyed by the simple names of the members.
- */
- Map<Symbol, MethodMirror> get instanceMembers;
-
- /**
- * Returns a map of the static methods, getters and setters of the class.
- *
- * The intent is to capture those members that constitute the API of a class.
- * Hence fields are not included, but the getters and setters implicitly
- * introduced by fields are included.
- *
- * The map is keyed by the simple names of the members.
- */
- Map<Symbol, MethodMirror> get staticMembers;
-
-
- /**
- * The mixin of this class.
- *
- * If this class is the result of a mixin application of the form S with M,
- * returns a class mirror on M. Otherwise returns a class mirror on
- * [reflectee].
- */
- ClassMirror get mixin;
-
- // TODO(ahe): What about:
- // /// Finds the instance member named [name] declared or inherited in the
- // /// reflected class.
- // DeclarationMirror instanceLookup(Symbol name);
-
- /**
- * Invokes the named constructor and returns a mirror on the result.
- *
- * Let *c* be the class reflected by this mirror,
- * let *a1, ..., an* be the elements of [positionalArguments],
- * let *k1, ..., km* be the identifiers denoted by the elements of
- * [namedArguments.keys],
- * and let *v1, ..., vm* be the elements of [namedArguments.values].
- *
- * If [constructorName] was created from the empty string, then this method
- * will execute the instance creation expression
- * *new c(a1, ..., an, k1: v1, ..., km: vm)* in a scope that has access to
- * the private members of *c*.
- *
- * Otherwise, let *f* be the simple name of the constructor denoted by
- * [constructorName]. Then this method will execute the instance creation
- * expression *new c.f(a1, ..., an, k1: v1, ..., km: vm)* in a scope that has
- * access to the private members of *c*.
- *
- * In either case:
- *
- * * If the expression evaluates to a result *r*, this method returns the
- * result of calling [reflect]\(*r*\).
- * * If evaluating the expression causes a compilation error, the effect is
- * the same as if a non-reflective compilation error had been encountered.
- * * If evaluating the expression throws an exception *e* (that it does not
- * catch), this method throws *e*.
- */
- InstanceMirror newInstance(Symbol constructorName,
- List positionalArguments,
- [Map<Symbol,dynamic> namedArguments]);
-
- /**
- * Whether this mirror is equal to [other].
- *
- * The equality holds if and only if
- *
- * 1. [other] is a mirror of the same kind, and
- * 2. This mirror and [other] reflect the same class.
- *
- * Note that if the reflected class is an invocation of a generic class, 2.
- * implies that the reflected class and [other] have equal type arguments.
- */
- bool operator == (other);
-
- /**
- * Returns whether the class denoted by the receiver is a subclass of the
- * class denoted by the argument.
- *
- * Note that the subclass relationship is reflexive.
- */
- bool isSubclassOf(ClassMirror other);
-}
-
-/**
- * A [FunctionTypeMirror] represents the type of a function in the
- * Dart language.
- */
-abstract class FunctionTypeMirror implements ClassMirror {
- /**
- * Returns the return type of the reflectee.
- */
- TypeMirror get returnType;
-
- /**
- * Returns a list of the parameter types of the reflectee.
- */
- List<ParameterMirror> get parameters;
-
- /**
- * A mirror on the [:call:] method for the reflectee.
- */
- // This is only here because in the past the VM did not implement a call
- // method on closures.
- MethodMirror get callMethod;
-}
-
-/**
- * A [TypeVariableMirror] represents a type parameter of a generic type.
- */
-abstract class TypeVariableMirror extends TypeMirror {
- /**
- * A mirror on the type that is the upper bound of this type variable.
- */
- TypeMirror get upperBound;
-
- /**
- * Is the reflectee static?
- *
- * For the purposes of the mirrors library, type variables are considered
- * non-static.
- */
- bool get isStatic;
-
- /**
- * Whether [other] is a [TypeVariableMirror] on the same type variable as this
- * mirror.
- *
- * The equality holds if and only if
- *
- * 1. [other] is a mirror of the same kind, and
- * 2. [:simpleName == other.simpleName:] and [:owner == other.owner:].
- */
- bool operator == (other);
-}
-
-/**
- * A [TypedefMirror] represents a typedef in a Dart language program.
- */
-abstract class TypedefMirror implements TypeMirror {
- /**
- * The defining type for this typedef.
- *
- * If the type referred to by the reflectee is a function type *F*, the
- * result will be [:FunctionTypeMirror:] reflecting *F* which is abstract
- * and has an abstract method [:call:] whose signature corresponds to *F*.
- * For instance [:void f(int):] is the referent for [:typedef void f(int):].
- */
- FunctionTypeMirror get referent;
-}
-
-/**
- * A [MethodMirror] reflects a Dart language function, method,
- * constructor, getter, or setter.
- */
-abstract class MethodMirror implements DeclarationMirror {
- /**
- * A mirror on the return type for the reflectee.
- */
- TypeMirror get returnType;
-
- /**
- * The source code for the reflectee, if available. Otherwise null.
- */
- String get source;
-
- /**
- * A list of mirrors on the parameters for the reflectee.
- */
- List<ParameterMirror> get parameters;
-
- /**
- * A function is considered non-static iff it is permited to refer to 'this'.
- *
- * Note that generative constructors are considered non-static, whereas
- * factory constructors are considered static.
- */
- bool get isStatic;
-
- /**
- * Is the reflectee abstract?
- */
- bool get isAbstract;
-
- /**
- * Returns true if the reflectee is synthetic, and returns false otherwise.
- *
- * A reflectee is synthetic if it is a getter or setter implicitly introduced
- * for a field or Type, or if it is a constructor that was implicitly
- * introduced as a default constructor or as part of a mixin application.
- */
- bool get isSynthetic;
-
- /**
- * 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 isRegularMethod;
-
- /**
- * Is the reflectee an operator?
- */
- bool get isOperator;
-
- /**
- * Is the reflectee a getter?
- */
- bool get isGetter;
-
- /**
- * Is the reflectee a setter?
- */
- bool get isSetter;
-
- /**
- * Is the reflectee a constructor?
- */
- bool get isConstructor;
-
- /**
- * The constructor name for named constructors and factory methods.
- *
- * For unnamed constructors, this is the empty string. For
- * non-constructors, this is the empty string.
- *
- * For example, [:'bar':] is the constructor name for constructor
- * [:Foo.bar:] of type [:Foo:].
- */
- Symbol get constructorName;
-
- /**
- * Is the reflectee a const constructor?
- */
- 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;
-
- /**
- * Whether this mirror is equal to [other].
- *
- * The equality holds if and only if
- *
- * 1. [other] is a mirror of the same kind, and
- * 2. [:simpleName == other.simpleName:] and [:owner == other.owner:].
- */
- bool operator == (other);
-}
-
-/**
- * A [VariableMirror] reflects a Dart language variable declaration.
- */
-abstract class VariableMirror implements DeclarationMirror {
- /**
- * Returns a mirror on the type of the reflectee.
- */
- TypeMirror get type;
-
- /**
- * Returns [:true:] if the reflectee is a static variable.
- * Otherwise returns [:false:].
- *
- * For the purposes of the mirror library, top-level variables are
- * implicitly declared static.
- */
- bool get isStatic;
-
- /**
- * Returns [:true:] if the reflectee is a final variable.
- * Otherwise returns [:false:].
- */
- bool get isFinal;
-
- /**
- * Returns [:true:] if the reflectee is declared [:const:].
- * Otherwise returns [:false:].
- */
- bool get isConst;
-
- /**
- * Whether this mirror is equal to [other].
- *
- * The equality holds if and only if
- *
- * 1. [other] is a mirror of the same kind, and
- * 2. [:simpleName == other.simpleName:] and [:owner == other.owner:].
- */
- bool operator == (other);
-}
-
-/**
- * A [ParameterMirror] reflects a Dart formal parameter declaration.
- */
-abstract class ParameterMirror implements VariableMirror {
- /**
- * A mirror on the type of this parameter.
- */
- TypeMirror get type;
-
- /**
- * Returns [:true:] if the reflectee is an optional parameter.
- * Otherwise returns [:false:].
- */
- bool get isOptional;
-
- /**
- * Returns [:true:] if the reflectee is a named parameter.
- * Otherwise returns [:false:].
- */
- bool get isNamed;
-
- /**
- * Returns [:true:] if the reflectee has explicitly declared a default value.
- * Otherwise returns [:false:].
- */
- bool get hasDefaultValue;
-
- /**
- * Returns the default value of an optional parameter.
- *
- * Returns an [InstanceMirror] on the (compile-time constant)
- * default value for an optional parameter.
- * If no default value is declared, it defaults to `null`
- * and a mirror of `null` is returned.
- *
- * Returns `null` for a required parameter.
- */
- InstanceMirror get defaultValue;
-}
-
-/**
- * A [SourceLocation] describes the span of an entity in Dart source code.
- */
-abstract class SourceLocation {
- /**
- * The 1-based line number for this source location.
- *
- * A value of 0 means that the line number is unknown.
- */
- int get line;
-
- /**
- * The 1-based column number for this source location.
- *
- * A value of 0 means that the column number is unknown.
- */
- int get column;
-
- /**
- * Returns the URI where the source originated.
- */
- Uri get sourceUri;
-}
-
-/**
- * Class used for encoding comments as metadata annotations.
- */
-class Comment {
- /**
- * The comment text as written in the source text.
- */
- final String text;
-
- /**
- * The comment text without the start, end, and padding text.
- *
- * For example, if [text] is [: /** Comment text. */ :] then the [trimmedText]
- * is [: Comment text. :].
- */
- final String trimmedText;
-
- /**
- * Is [:true:] if this comment is a documentation comment.
- *
- * That is, that the comment is either enclosed in [: /** ... */ :] or starts
- * with [: /// :].
- */
- final bool isDocComment;
-
- const Comment(this.text, this.trimmedText, this.isDocComment);
-}
-
-/**
- * Annotation describing how "dart:mirrors" is used (EXPERIMENTAL).
- *
- * When used as metadata on an import of "dart:mirrors" in library *L*, this
- * class describes how "dart:mirrors" is used by library *L* unless overridden.
- * See [override].
- *
- * The following text is non-normative:
- *
- * In some scenarios, for example, when minifying Dart code, or when generating
- * JavaScript code from a Dart program, the size and performance of the output
- * can suffer from use of reflection. In those cases, telling the compiler
- * what is used, can have a significant impact.
- *
- * Example usage:
- *
- * @MirrorsUsed(symbols: 'foo')
- * import 'dart:mirrors';
- *
- * class Foo {
- * noSuchMethod(Invocation invocation) {
- * print(MirrorSystem.getName(invocation.memberName));
- * }
- * }
- *
- * main() {
- * new Foo().foo(); // Prints "foo".
- * new Foo().bar(); // Might print an arbitrary (mangled) name, "bar".
- * }
- *
- * For a detailed description of the parameters to the [MirrorsUsed] constructor
- * see the comments for [symbols], [targets], [metaTargets] and [override].
- *
- * An import of `dart:mirrors` may have multiple [MirrorsUsed] annotations. This
- * is particularly helpful to specify overrides for specific libraries. For
- * example:
- *
- * @MirrorsUsed(targets: 'foo.Bar', override: 'foo')
- * @MirrorsUsed(targets: 'Bar')
- * import 'dart:mirrors';
- *
- * will ensure that the target `Bar` from the current library and from library
- * `foo` is available for reflection. See also [override].
- */
-class MirrorsUsed {
- // Note: the fields of this class are untyped. This is because the most
- // convenient way to specify symbols today is using a single string. In
- // some cases, a const list of classes might be convenient. Some
- // might prefer to use a const list of symbols.
-
- /**
- * The list of strings passed to new [Symbol], and symbols that might be
- * passed to [MirrorSystem.getName].
- *
- * Combined with the names of [targets], [metaTargets] and their members,
- * this forms the complete list of strings passed to new [Symbol], and
- * symbols that might be passed to [MirrorSystem.getName] by the library to
- * which this metadata applies.
- *
- * The following text is non-normative:
- *
- * Dart2js currently supports the following formats to specify symbols:
- *
- * * A constant [List] of [String] constants representing symbol names,
- * e.g., `const ['foo', 'bar']`.
- * * A single [String] constant whose value is a comma-separated list of
- * symbol names, e.g., `"foo, bar"`.
- *
- * Specifying the `symbols` field turns off the following warnings emitted by
- * dart2js:
- *
- * * Using "MirrorSystem.getName" may result in larger output.
- * * Using "new Symbol" may result in larger output.
- *
- * For example, if you're using [noSuchMethod] to interact with a database,
- * extract all the possible column names and include them in this list.
- * Similarly, if you're using [noSuchMethod] to interact with another
- * language (JavaScript, for example) extract all the identifiers from the
- * API you use and include them in this list.
- *
- * Note that specifying a symbol only ensures that the symbol will be
- * available under that name at runtime. It does not mark targets with
- * that name as available for reflection. See [targets] and [metaTargets]
- * for that purpose.
- */
- final symbols;
-
- /**
- * A list of reflective targets.
- *
- * Combined with [metaTargets], this provides the complete list of reflective
- * targets used by the library to which this metadata applies.
- *
- * The following text is non-normative:
- *
- * For now, there is no formal description of what a reflective target is.
- * Informally, a target is a library, a class, a method or a field.
- *
- * Dart2js currently supports the following formats to specify targets:
- *
- * * A constant [List] containing [String] constants representing (qualified)
- * names of targets and Dart types.
- * * A single [String] constant whose value is a comma-separated list of
- * (qualified) names.
- * * A single Dart type.
- *
- * A (qualified) name is resolved to a target as follows:
- *
- * 1. If the qualified name matches a library name, the matching library is
- * the target.
- * 2. Else, find the longest prefix of the name such that the prefix ends
- * just before a `.` and is a library name.
- * 3. Use that library as current scope. If no matching prefix was found, use
- * the current library, i.e., the library where the [MirrorsUsed]
- * annotation was placed.
- * 4. Split the remaining suffix (the entire name if no library name was
- * found in step 3) into a list of [String] using `.` as a
- * separator.
- * 5. Select all targets in the current scope whose name matches a [String]
- * from the list.
- *
- * For example:
- *
- * library my.library.one;
- *
- * class A {
- * var aField;
- * }
- *
- * library main;
- *
- * @MirrorsUsed(targets: "my.library.one.A.aField")
- * import "dart:mirrors";
- *
- * The [MirrorsUsed] annotation specifies `A` and `aField` from library
- * `my.library.one` as targets. This will mark the class `A` as a reflective
- * target. The target specification for `aField` has no effect, as there is
- * no target in `my.library.one` with that name.
- *
- * Note that everything within a target also is available for reflection.
- * So, if a library is specified as target, all classes in that library
- * become targets for reflection. Likewise, if a class is a target, all
- * its methods and fields become targets for reflection. As a consequence,
- * `aField` in the above example is also a reflective target.
- *
- */
- final targets;
-
- /**
- * A list of classes that when used as metadata indicates a reflective
- * target. See also [targets].
- *
- * The following text is non-normative:
- *
- * The format for specifying the list of classes is the same as used for
- * specifying [targets]. However, as a library cannot be used as a metadata
- * annotation in Dart, adding a library to the list of [metaTargets] has no
- * effect. In particular, adding a library to [metaTargets] does not make
- * the library's classes valid metadata annotations to enable reflection.
- *
- * If an instance of a class specified in [metaTargets] is used as
- * metadata annotation on a library, class, field or method, that library,
- * class, field or method is added to the set of targets for reflection.
- *
- * Example usage:
- *
- * library example;
- * @MirrorsUsed(metaTargets: "example.Reflectable")
- * import "dart:mirrors";
- *
- * class Reflectable {
- * const Reflectable();
- * }
- *
- * class Foo {
- * @Reflectable()
- * reflectableMethod() { ... }
- *
- * nonReflectableMethod() { ... }
- * }
- *
- * In the above example. `reflectableMethod` is marked as reflectable by
- * using the `Reflectable` class, which in turn is specified in the
- * [metaTargets] annotation.
- *
- * The method `nonReflectableMethod` lacks a metadata annotation and thus
- * will not be reflectable at runtime.
- */
- final metaTargets;
-
- /**
- * A list of library names or "*".
- *
- * When used as metadata on an import of "dart:mirrors", this metadata does
- * not apply to the library in which the annotation is used, but instead
- * applies to the other libraries (all libraries if "*" is used).
- *
- * The following text is non-normative:
- *
- * Dart2js currently supports the following formats to specify libraries:
- *
- * * A constant [List] containing [String] constants representing names of
- * libraries.
- * * A single [String] constant whose value is a comma-separated list of
- * library names.
- *
- * Conceptually, a [MirrorsUsed] annotation with [override] has the same
- * effect as placing the annotation directly on the import of `dart:mirrors`
- * in each of the referenced libraries. Thus, if the library had no
- * [MirrorsUsed] annotation before, its unconditional import of
- * `dart:mirrors` is overridden by an annotated import.
- *
- * Note that, like multiple explicit [MirrorsUsed] annotations, using
- * override on a library with an existing [MirrorsUsed] annotation is
- * additive. That is, the overall set of reflective targets is the union
- * of the reflective targets that arise from the original and the
- * overriding [MirrorsUsed] annotations.
- *
- * The use of [override] is only meaningful for libraries that have an
- * import of `dart:mirrors` without annotation because otherwise it would
- * work exactly the same way without the [override] parameter.
- *
- * While the annotation will apply to the given target libraries, the
- * [symbols], [targets] and [metaTargets] are still evaluated in the
- * scope of the annotation. Thus, to select a target from library `foo`,
- * a qualified name has to be used or, if the target is visible in the
- * current scope, its type may be referenced.
- *
- * For example, the following code marks all targets in the library `foo`
- * as reflectable that have a metadata annotation using the `Reflectable`
- * class from the same library.
- *
- * @MirrorsUsed(metaTargets: "foo.Reflectable", override: "foo")
- *
- * However, the following code would require the use of the `Reflectable`
- * class from the current library, instead.
- *
- * @MirrorsUsed(metaTargets: "Reflectable", override: "foo")
- *
- */
- final override;
-
- /**
- * See the documentation for [MirrorsUsed.symbols], [MirrorsUsed.targets],
- * [MirrorsUsed.metaTargets] and [MirrorsUsed.override] for documentation
- * of the parameters.
- */
- const MirrorsUsed(
- {this.symbols, this.targets, this.metaTargets, this.override});
-}
diff --git a/pkg/dev_compiler/tool/input_sdk/libraries.dart b/pkg/dev_compiler/tool/input_sdk/libraries.dart
new file mode 100644
index 0000000..69b4856
--- /dev/null
+++ b/pkg/dev_compiler/tool/input_sdk/libraries.dart
@@ -0,0 +1,378 @@
+// Copyright (c) 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 libraries;
+
+/**
+ * A bit flag used by [LibraryInfo] indicating that a library is used by dart2js
+ */
+const int DART2JS_PLATFORM = 1;
+
+/**
+ * A bit flag used by [LibraryInfo] indicating that a library is used by the VM
+ */
+const int VM_PLATFORM = 2;
+
+/// The contexts that a library can be used from.
+enum Category {
+ /// Indicates that a library can be used in a browser context.
+ client,
+ /// Indicates that a library can be used in a command line context.
+ server,
+ /// Indicates that a library can be used from embedded devices.
+ embedded
+}
+
+Category parseCategory(String name) {
+ switch (name) {
+ case "Client": return Category.client;
+ case "Server": return Category.server;
+ case "Embedded": return Category.embedded;
+ }
+ return null;
+}
+
+/// Mapping of "dart:" library name (e.g. "core") to information about that
+/// library.
+const Map<String, LibraryInfo> libraries = const {
+ "async": const LibraryInfo(
+ "async/async.dart",
+ categories: "Client,Server",
+ maturity: Maturity.STABLE,
+ dart2jsPatchPath: "_internal/js_runtime/lib/async_patch.dart"),
+
+ "_blink": const LibraryInfo(
+ "_blink/dartium/_blink_dartium.dart",
+ categories: "Client",
+ implementation: true,
+ documented: false,
+ platforms: VM_PLATFORM),
+
+ "_chrome": const LibraryInfo(
+ "_chrome/dart2js/chrome_dart2js.dart",
+ categories: "Client",
+ documented: false),
+
+ "collection": const LibraryInfo(
+ "collection/collection.dart",
+ categories: "Client,Server,Embedded",
+ maturity: Maturity.STABLE,
+ dart2jsPatchPath: "_internal/js_runtime/lib/collection_patch.dart"),
+
+ "convert": const LibraryInfo(
+ "convert/convert.dart",
+ categories: "Client,Server",
+ maturity: Maturity.STABLE,
+ dart2jsPatchPath: "_internal/js_runtime/lib/convert_patch.dart"),
+
+ "core": const LibraryInfo(
+ "core/core.dart",
+ categories: "Client,Server,Embedded",
+ maturity: Maturity.STABLE,
+ dart2jsPatchPath: "_internal/js_runtime/lib/core_patch.dart"),
+
+ "developer": const LibraryInfo(
+ "developer/developer.dart",
+ categories: "Client,Server,Embedded",
+ maturity: Maturity.UNSTABLE,
+ dart2jsPatchPath: "_internal/js_runtime/lib/developer_patch.dart"),
+
+ "html": const LibraryInfo(
+ "html/dartium/html_dartium.dart",
+ categories: "Client",
+ maturity: Maturity.WEB_STABLE,
+ dart2jsPath: "html/dart2js/html_dart2js.dart"),
+
+ "html_common": const LibraryInfo(
+ "html/html_common/html_common.dart",
+ categories: "Client",
+ maturity: Maturity.WEB_STABLE,
+ dart2jsPath: "html/html_common/html_common_dart2js.dart",
+ documented: false,
+ implementation: true),
+
+ "indexed_db": const LibraryInfo(
+ "indexed_db/dartium/indexed_db_dartium.dart",
+ categories: "Client",
+ maturity: Maturity.WEB_STABLE,
+ dart2jsPath: "indexed_db/dart2js/indexed_db_dart2js.dart"),
+
+ "io": const LibraryInfo(
+ "io/io.dart",
+ categories: "Server",
+ dart2jsPatchPath: "_internal/js_runtime/lib/io_patch.dart"),
+
+ "isolate": const LibraryInfo(
+ "isolate/isolate.dart",
+ categories: "Client,Server",
+ maturity: Maturity.STABLE,
+ dart2jsPatchPath: "_internal/js_runtime/lib/isolate_patch.dart"),
+
+ "js": const LibraryInfo(
+ "js/dartium/js_dartium.dart",
+ categories: "Client",
+ maturity: Maturity.STABLE,
+ dart2jsPath: "js/dart2js/js_dart2js.dart"),
+
+ "js_util": const LibraryInfo(
+ "js_util/dartium/js_util_dartium.dart",
+ categories: "Client",
+ maturity: Maturity.STABLE,
+ dart2jsPath: "js_util/dart2js/js_util_dart2js.dart"),
+
+ "math": const LibraryInfo(
+ "math/math.dart",
+ categories: "Client,Server,Embedded",
+ maturity: Maturity.STABLE,
+ dart2jsPatchPath: "_internal/js_runtime/lib/math_patch.dart"),
+
+ "mirrors": const LibraryInfo(
+ "mirrors/mirrors.dart",
+ categories: "Client,Server",
+ maturity: Maturity.UNSTABLE,
+ dart2jsPatchPath: "_internal/js_runtime/lib/mirrors_patch.dart"),
+
+ "typed_data": const LibraryInfo(
+ "typed_data/typed_data.dart",
+ categories: "Client,Server,Embedded",
+ maturity: Maturity.STABLE,
+ dart2jsPatchPath: "_internal/js_runtime/lib/typed_data_patch.dart"),
+
+ "_native_typed_data": const LibraryInfo(
+ "_internal/js_runtime/lib/native_typed_data.dart",
+ categories: "",
+ implementation: true,
+ documented: false,
+ platforms: DART2JS_PLATFORM),
+
+ "svg": const LibraryInfo(
+ "svg/dartium/svg_dartium.dart",
+ categories: "Client",
+ maturity: Maturity.WEB_STABLE,
+ dart2jsPath: "svg/dart2js/svg_dart2js.dart"),
+
+ "web_audio": const LibraryInfo(
+ "web_audio/dartium/web_audio_dartium.dart",
+ categories: "Client",
+ maturity: Maturity.WEB_STABLE,
+ dart2jsPath: "web_audio/dart2js/web_audio_dart2js.dart"),
+
+ "web_gl": const LibraryInfo(
+ "web_gl/dartium/web_gl_dartium.dart",
+ categories: "Client",
+ maturity: Maturity.WEB_STABLE,
+ dart2jsPath: "web_gl/dart2js/web_gl_dart2js.dart"),
+
+ "web_sql": const LibraryInfo(
+ "web_sql/dartium/web_sql_dartium.dart",
+ categories: "Client",
+ maturity: Maturity.WEB_STABLE,
+ dart2jsPath: "web_sql/dart2js/web_sql_dart2js.dart"),
+
+ "_internal": const LibraryInfo(
+ "internal/internal.dart",
+ categories: "",
+ documented: false,
+ dart2jsPatchPath: "_internal/js_runtime/lib/internal_patch.dart"),
+
+ "_js_helper": const LibraryInfo(
+ "_internal/js_runtime/lib/js_helper.dart",
+ categories: "",
+ documented: false,
+ platforms: DART2JS_PLATFORM),
+
+ "_interceptors": const LibraryInfo(
+ "_internal/js_runtime/lib/interceptors.dart",
+ categories: "",
+ documented: false,
+ platforms: DART2JS_PLATFORM),
+
+ "_foreign_helper": const LibraryInfo(
+ "_internal/js_runtime/lib/foreign_helper.dart",
+ categories: "",
+ documented: false,
+ platforms: DART2JS_PLATFORM),
+
+ "_isolate_helper": const LibraryInfo(
+ "_internal/js_runtime/lib/isolate_helper.dart",
+ categories: "",
+ documented: false,
+ platforms: DART2JS_PLATFORM),
+
+ "_js_mirrors": const LibraryInfo(
+ "_internal/js_runtime/lib/js_mirrors.dart",
+ categories: "",
+ documented: false,
+ platforms: DART2JS_PLATFORM),
+
+ "_js_names": const LibraryInfo(
+ "_internal/js_runtime/lib/js_names.dart",
+ categories: "",
+ documented: false,
+ platforms: DART2JS_PLATFORM),
+
+ "_js_primitives": const LibraryInfo(
+ "_internal/js_runtime/lib/js_primitives.dart",
+ categories: "",
+ documented: false,
+ platforms: DART2JS_PLATFORM),
+
+ "_js_embedded_names": const LibraryInfo(
+ "_internal/js_runtime/lib/shared/embedded_names.dart",
+ categories: "",
+ documented: false,
+ platforms: DART2JS_PLATFORM),
+
+ "_async_await_error_codes": const LibraryInfo(
+ "_internal/js_runtime/lib/shared/async_await_error_codes.dart",
+ categories: "",
+ documented: false,
+ platforms: DART2JS_PLATFORM),
+
+ "_metadata": const LibraryInfo(
+ "html/html_common/metadata.dart",
+ categories: "",
+ documented: false,
+ platforms: DART2JS_PLATFORM),
+
+ "_debugger": const LibraryInfo(
+ "_internal/js_runtime/lib/debugger.dart",
+ category: "",
+ documented: false,
+ platforms: DART2JS_PLATFORM),
+
+ "_runtime": const LibraryInfo(
+ "_internal/js_runtime/lib/ddc_runtime/runtime.dart",
+ category: "",
+ documented: false,
+ platforms: DART2JS_PLATFORM),
+};
+
+/**
+ * Information about a "dart:" library.
+ */
+class LibraryInfo {
+ /**
+ * Path to the library's *.dart file relative to this file.
+ */
+ final String path;
+
+ /**
+ * The categories in which the library can be used encoded as a
+ * comma-separated String.
+ */
+ final String _categories;
+
+ /**
+ * Path to the dart2js library's *.dart file relative to this file
+ * or null if dart2js uses the common library path defined above.
+ * Access using the [#getDart2JsPath()] method.
+ */
+ final String dart2jsPath;
+
+ /**
+ * Path to the dart2js library's patch file relative to this file
+ * or null if no dart2js patch file associated with this library.
+ * Access using the [#getDart2JsPatchPath()] method.
+ */
+ final String dart2jsPatchPath;
+
+ /**
+ * True if this library is documented and should be shown to the user.
+ */
+ final bool documented;
+
+ /**
+ * Bit flags indicating which platforms consume this library.
+ * See [DART2JS_LIBRARY] and [VM_LIBRARY].
+ */
+ final int platforms;
+
+ /**
+ * True if the library contains implementation details for another library.
+ * The implication is that these libraries are less commonly used
+ * and that tools like Dart Editor should not show these libraries
+ * in a list of all libraries unless the user specifically asks the tool to
+ * do so.
+ */
+ final bool implementation;
+
+ /**
+ * States the current maturity of this library.
+ */
+ final Maturity maturity;
+
+ const LibraryInfo(this.path, {
+ String categories: "",
+ this.dart2jsPath,
+ this.dart2jsPatchPath,
+ this.implementation: false,
+ this.documented: true,
+ this.maturity: Maturity.UNSPECIFIED,
+ this.platforms: DART2JS_PLATFORM | VM_PLATFORM})
+ : _categories = categories;
+
+ bool get isDart2jsLibrary => (platforms & DART2JS_PLATFORM) != 0;
+ bool get isVmLibrary => (platforms & VM_PLATFORM) != 0;
+
+ /**
+ * The categories in which the library can be used.
+ *
+ * If no categories are specified, the library is internal and can not be
+ * loaded by user code.
+ */
+ List<Category> get categories {
+ // `"".split(,)` returns [""] not [], so we handle that case separately.
+ if (_categories == "") return const <Category>[];
+ return _categories.split(",").map(parseCategory).toList();
+ }
+
+ bool get isInternal => categories.isEmpty;
+
+ /// The original "categories" String that was passed to the constructor.
+ ///
+ /// Can be used to construct a slightly modified copy of this LibraryInfo.
+ String get categoriesString {
+ return _categories;
+ }
+}
+
+/**
+ * Abstraction to capture the maturity of a library.
+ */
+class Maturity {
+ final int level;
+ final String name;
+ final String description;
+
+ const Maturity(this.level, this.name, this.description);
+
+ String toString() => "$name: $level\n$description\n";
+
+ static const Maturity DEPRECATED = const Maturity(0, "Deprecated",
+ "This library will be remove before next major release.");
+
+ static const Maturity EXPERIMENTAL = const Maturity(1, "Experimental",
+ "This library is experimental and will likely change or be removed\n"
+ "in future versions.");
+
+ static const Maturity UNSTABLE = const Maturity(2, "Unstable",
+ "This library is in still changing and have not yet endured\n"
+ "sufficient real-world testing.\n"
+ "Backwards-compatibility is NOT guaranteed.");
+
+ static const Maturity WEB_STABLE = const Maturity(3, "Web Stable",
+ "This library is tracking the DOM evolution as defined by WC3.\n"
+ "Backwards-compatibility is NOT guaranteed.");
+
+ static const Maturity STABLE = const Maturity(4, "Stable",
+ "The library is stable. API backwards-compatibility is guaranteed.\n"
+ "However implementation details might change.");
+
+ static const Maturity LOCKED = const Maturity(5, "Locked",
+ "This library will not change except when serious bugs are encountered.");
+
+ static const Maturity UNSPECIFIED = const Maturity(-1, "Unspecified",
+ "The maturity for this library has not been specified.");
+}
diff --git a/pkg/dev_compiler/tool/input_sdk/patch/collection_patch.dart b/pkg/dev_compiler/tool/input_sdk/patch/collection_patch.dart
index 7fccdc3..5e2a79c 100644
--- a/pkg/dev_compiler/tool/input_sdk/patch/collection_patch.dart
+++ b/pkg/dev_compiler/tool/input_sdk/patch/collection_patch.dart
@@ -431,7 +431,7 @@
String toString() => Maps.mapToString(this);
}
-class _HashMapKeyIterable<E> extends Iterable<E> implements EfficientLength {
+class _HashMapKeyIterable<E> extends EfficientLengthIterable<E> {
final _HashMap/*<E, dynamic>*/ _map;
_HashMapKeyIterable(this._map);
@@ -639,8 +639,7 @@
String toString() => Maps.mapToString(this);
}
-class _Es6MapIterable<E> extends Iterable<E>
- implements EfficientLength {
+class _Es6MapIterable<E> extends EfficientLengthIterable<E> {
final _map;
final bool _isKeys;
diff --git a/pkg/dev_compiler/tool/input_sdk/patch/core_patch.dart b/pkg/dev_compiler/tool/input_sdk/patch/core_patch.dart
index 910858f..71a568b 100644
--- a/pkg/dev_compiler/tool/input_sdk/patch/core_patch.dart
+++ b/pkg/dev_compiler/tool/input_sdk/patch/core_patch.dart
@@ -29,8 +29,10 @@
@patch
class Object {
@patch
- int get hashCode => Primitives.objectHashCode(this);
+ bool operator==(other) => identical(this, other);
+ @patch
+ int get hashCode => Primitives.objectHashCode(this);
@patch
String toString() => Primitives.objectToString(this);
@@ -49,6 +51,12 @@
JS('Type', 'dart.wrapType(dart.getReifiedType(#))', this);
}
+@patch
+class Null {
+ @patch
+ int get hashCode => super.hashCode;
+}
+
// Patch for Function implementation.
@patch
class Function {
@@ -156,6 +164,18 @@
StackTrace get stackTrace => Primitives.extractStackTrace(this);
}
+@patch
+class FallThroughError {
+ @patch
+ String toString() => super.toString();
+}
+
+@patch
+class AbstractClassInstantiationError {
+ @patch
+ String toString() => "Cannot instantiate abstract class: '$_className'";
+}
+
/// An interface type for all Strong-mode errors.
class StrongModeError extends Error {}
@@ -427,6 +447,9 @@
throw new UnsupportedError(
'bool.fromEnvironment can only be used as a const constructor');
}
+
+ @patch
+ int get hashCode => super.hashCode;
}
@patch
@@ -513,6 +536,18 @@
@patch
class NoSuchMethodError {
@patch
+ NoSuchMethodError(Object receiver,
+ Symbol memberName,
+ List positionalArguments,
+ Map<Symbol, dynamic> namedArguments,
+ [List existingArgumentNames = null])
+ : _receiver = receiver,
+ _memberName = memberName,
+ _arguments = positionalArguments,
+ _namedArguments = namedArguments,
+ _existingArgumentNames = existingArgumentNames;
+
+ @patch
String toString() {
StringBuffer sb = new StringBuffer();
int i = 0;
@@ -561,15 +596,17 @@
@patch
class Uri {
@patch
- static bool get _isWindows => false;
-
- @patch
static Uri get base {
String uri = Primitives.currentUri();
if (uri != null) return Uri.parse(uri);
throw new UnsupportedError("'Uri.base' is not supported");
}
+}
+@patch
+class _Uri {
+ @patch
+ static bool get _isWindows => false;
// Matches a String that _uriEncodes to itself regardless of the kind of
// component. This corresponds to [_unreservedTable], i.e. characters that
@@ -592,7 +629,7 @@
// Encode the string into bytes then generate an ASCII only string
// by percent encoding selected bytes.
- StringBuffer result = new StringBuffer();
+ StringBuffer result = new StringBuffer('');
var bytes = encoding.encode(text);
for (int i = 0; i < bytes.length; i++) {
int byte = bytes[i];
diff --git a/pkg/dev_compiler/tool/input_sdk/patch/developer_patch.dart b/pkg/dev_compiler/tool/input_sdk/patch/developer_patch.dart
index 93f19fb..4cefe98 100644
--- a/pkg/dev_compiler/tool/input_sdk/patch/developer_patch.dart
+++ b/pkg/dev_compiler/tool/input_sdk/patch/developer_patch.dart
@@ -8,7 +8,7 @@
import 'dart:_foreign_helper' show JS;
@patch
-// @ForceInline()
+@ForceInline()
bool debugger({bool when: true, String message}) {
if (when) {
JS('', 'debugger');
@@ -46,7 +46,7 @@
}
@patch
-_postEvent(String eventKind, String eventData) {
+void _postEvent(String eventKind, String eventData) {
// TODO.
}
@@ -117,11 +117,63 @@
}
@patch
-void _getServerInfo(SendPort sp) {
- sp.send(null);
+void _getServerInfo(SendPort sendPort) {
+ sendPort.send(null);
}
@patch
-void _webServerControl(SendPort sp, bool enable) {
- sp.send(null);
+void _webServerControl(SendPort sendPort, bool enable) {
+ sendPort.send(null);
}
+
+@patch
+String _getIsolateIDFromSendPort(SendPort sendPort) {
+ return null;
+}
+
+@patch
+class UserTag {
+ @patch
+ factory UserTag(String label) = _FakeUserTag;
+
+ @patch
+ static UserTag get defaultTag => _FakeUserTag._defaultTag;
+}
+
+class _FakeUserTag implements UserTag {
+ static Map _instances = {};
+
+ _FakeUserTag.real(this.label);
+
+ factory _FakeUserTag(String label) {
+ // Canonicalize by name.
+ var existingTag = _instances[label];
+ if (existingTag != null) {
+ return existingTag;
+ }
+ // Throw an exception if we've reached the maximum number of user tags.
+ if (_instances.length == UserTag.MAX_USER_TAGS) {
+ throw new UnsupportedError(
+ 'UserTag instance limit (${UserTag.MAX_USER_TAGS}) reached.');
+ }
+ // Create a new instance and add it to the instance map.
+ var instance = new _FakeUserTag.real(label);
+ _instances[label] = instance;
+ return instance;
+ }
+
+ final String label;
+
+ UserTag makeCurrent() {
+ var old = _currentTag;
+ _currentTag = this;
+ return old;
+ }
+
+ static final UserTag _defaultTag = new _FakeUserTag('Default');
+}
+
+var _currentTag = _FakeUserTag._defaultTag;
+
+@patch
+UserTag getCurrentTag() => _currentTag;
diff --git a/pkg/dev_compiler/tool/input_sdk/patch/internal_patch.dart b/pkg/dev_compiler/tool/input_sdk/patch/internal_patch.dart
index 22f67d3..d878d54 100644
--- a/pkg/dev_compiler/tool/input_sdk/patch/internal_patch.dart
+++ b/pkg/dev_compiler/tool/input_sdk/patch/internal_patch.dart
@@ -11,11 +11,7 @@
class Symbol implements core.Symbol {
@patch
const Symbol(String name)
- : this._name = name, this._nativeSymbol = null;
-
- @patch
- const Symbol.es6(String name, dynamic nativeSymbol)
- : this._name = name, this._nativeSymbol = nativeSymbol;
+ : this._name = name;
@patch
int get hashCode {
@@ -26,6 +22,33 @@
JS('', '#._hashCode = #', this, hash);
return hash;
}
+
+ @patch
+ toString() => 'Symbol("$_name")';
+}
+
+/// Used internally by DDC to map ES6 symbols to Dart.
+class PrivateSymbol implements core.Symbol {
+ // TODO(jmesserly): could also get this off the native symbol instead of
+ // storing it. Mirrors already does this conversion.
+ final String _name;
+ final Object _nativeSymbol;
+
+ const PrivateSymbol(this._name, this._nativeSymbol);
+
+ static String getName(core.Symbol symbol) =>
+ (symbol as PrivateSymbol)._name;
+
+ static Object getNativeSymbol(core.Symbol symbol) {
+ if (symbol is PrivateSymbol) return symbol._nativeSymbol;
+ return null;
+ }
+
+ bool operator ==(other) => other is PrivateSymbol &&
+ identical(_nativeSymbol, other._nativeSymbol);
+
+ // TODO(jmesserly): is this equivalent to _nativeSymbol toString?
+ toString() => 'Symbol("$_name")';
}
@patch
diff --git a/pkg/dev_compiler/tool/input_sdk/patch/io_patch.dart b/pkg/dev_compiler/tool/input_sdk/patch/io_patch.dart
index d941bb2..f79da5c 100644
--- a/pkg/dev_compiler/tool/input_sdk/patch/io_patch.dart
+++ b/pkg/dev_compiler/tool/input_sdk/patch/io_patch.dart
@@ -135,6 +135,18 @@
throw new UnsupportedError("File._lastModified");
}
@patch
+ static _lastAccessed(String path) {
+ throw new UnsupportedError("File._lastAccessed");
+ }
+ @patch
+ static _setLastModified(String path, int millis) {
+ throw new UnsupportedError("File._setLastModified");
+ }
+ @patch
+ static _setLastAccessed(String path, int millis) {
+ throw new UnsupportedError("File._setLastAccessed");
+ }
+ @patch
static _open(String path, int mode) {
throw new UnsupportedError("File._open");
}
diff --git a/pkg/dev_compiler/tool/input_sdk/patch/isolate_patch.dart b/pkg/dev_compiler/tool/input_sdk/patch/isolate_patch.dart
index 3498c7a..637943b 100644
--- a/pkg/dev_compiler/tool/input_sdk/patch/isolate_patch.dart
+++ b/pkg/dev_compiler/tool/input_sdk/patch/isolate_patch.dart
@@ -6,12 +6,12 @@
import 'dart:_js_helper' show patch;
import 'dart:_isolate_helper' show CapabilityImpl,
- CloseToken,
IsolateNatives,
- JsIsolateSink,
ReceivePortImpl,
RawReceivePortImpl;
+typedef _UnaryFunction(arg);
+
@patch
class Isolate {
static final _currentIsolateCache = IsolateNatives.currentIsolate;
@@ -22,13 +22,61 @@
static Isolate get current => _currentIsolateCache;
@patch
+ static Future<Uri> get packageRoot {
+ throw new UnsupportedError("Isolate.packageRoot");
+ }
+
+ @patch
+ static Future<Uri> get packageConfig {
+ throw new UnsupportedError("Isolate.packageConfig");
+ }
+
+ static Uri _packageBase = Uri.base.resolve(IsolateNatives.packagesBase);
+
+ @patch
+ static Future<Uri> resolvePackageUri(Uri packageUri) async {
+ if (packageUri.scheme != 'package') return packageUri;
+ return _packageBase.resolveUri(packageUri.replace(scheme: ''));
+ }
+
+ @patch
static Future<Isolate> spawn(void entryPoint(message), var message,
- { bool paused: false }) {
+ {bool paused: false, bool errorsAreFatal,
+ SendPort onExit, SendPort onError}) {
+ bool forcePause = (errorsAreFatal != null) ||
+ (onExit != null) ||
+ (onError != null);
try {
- return IsolateNatives.spawnFunction(entryPoint, message, paused)
- .then((msg) => new Isolate(msg[1],
- pauseCapability: msg[2],
- terminateCapability: msg[3]));
+ // Check for the type of `entryPoint` on the spawning isolate to make
+ // error-handling easier.
+ if (entryPoint is! _UnaryFunction) {
+ throw new ArgumentError(entryPoint);
+ }
+ // TODO: Consider passing the errorsAreFatal/onExit/onError values
+ // as arguments to the internal spawnUri instead of setting
+ // them after the isolate has been created.
+ return IsolateNatives.spawnFunction(entryPoint, message,
+ paused || forcePause)
+ .then((msg) {
+ var isolate = new Isolate(msg[1],
+ pauseCapability: msg[2],
+ terminateCapability: msg[3]);
+ if (forcePause) {
+ if (errorsAreFatal != null) {
+ isolate.setErrorsFatal(errorsAreFatal);
+ }
+ if (onExit != null) {
+ isolate.addOnExitListener(onExit);
+ }
+ if (onError != null) {
+ isolate.addErrorListener(onError);
+ }
+ if (!paused) {
+ isolate.resume(isolate.pauseCapability);
+ }
+ }
+ return isolate;
+ });
} catch (e, st) {
return new Future<Isolate>.error(e, st);
}
@@ -36,11 +84,26 @@
@patch
static Future<Isolate> spawnUri(
- Uri uri, List<String> args, var message, { bool paused: false,
- Uri packageRoot }) {
+ Uri uri, List<String> args, var message,
+ {bool paused: false,
+ SendPort onExit,
+ SendPort onError,
+ bool errorsAreFatal,
+ bool checked,
+ Map<String, String> environment,
+ Uri packageRoot,
+ Uri packageConfig,
+ bool automaticPackageResolution: false}) {
+ if (environment != null) throw new UnimplementedError("environment");
if (packageRoot != null) throw new UnimplementedError("packageRoot");
+ if (packageConfig != null) throw new UnimplementedError("packageConfig");
+ // TODO(lrn): Figure out how to handle the automaticPackageResolution
+ // parameter.
+ bool forcePause = (errorsAreFatal != null) ||
+ (onExit != null) ||
+ (onError != null);
try {
- if (args is List) {
+ if (args is List<String>) {
for (int i = 0; i < args.length; i++) {
if (args[i] is! String) {
throw new ArgumentError("Args must be a list of Strings $args");
@@ -49,10 +112,31 @@
} else if (args != null) {
throw new ArgumentError("Args must be a list of Strings $args");
}
- return IsolateNatives.spawnUri(uri, args, message, paused)
- .then((msg) => new Isolate(msg[1],
- pauseCapability: msg[2],
- terminateCapability: msg[3]));
+ // TODO: Handle [packageRoot] somehow, possibly by throwing.
+ // TODO: Consider passing the errorsAreFatal/onExit/onError values
+ // as arguments to the internal spawnUri instead of setting
+ // them after the isolate has been created.
+ return IsolateNatives.spawnUri(uri, args, message, paused || forcePause)
+ .then((msg) {
+ var isolate = new Isolate(msg[1],
+ pauseCapability: msg[2],
+ terminateCapability: msg[3]);
+ if (forcePause) {
+ if (errorsAreFatal != null) {
+ isolate.setErrorsFatal(errorsAreFatal);
+ }
+ if (onExit != null) {
+ isolate.addOnExitListener(onExit);
+ }
+ if (onError != null) {
+ isolate.addErrorListener(onError);
+ }
+ if (!paused) {
+ isolate.resume(isolate.pauseCapability);
+ }
+ }
+ return isolate;
+ });
} catch (e, st) {
return new Future<Isolate>.error(e, st);
}
@@ -76,12 +160,13 @@
}
@patch
- void addOnExitListener(SendPort responsePort) {
+ void addOnExitListener(SendPort responsePort, {Object response}) {
// TODO(lrn): Can we have an internal method that checks if the receiving
// isolate of a SendPort is still alive?
- var message = new List(2)
+ var message = new List(3)
..[0] = "add-ondone"
- ..[1] = responsePort;
+ ..[1] = responsePort
+ ..[2] = response;
controlPort.send(message);
}
@@ -103,16 +188,18 @@
}
@patch
- void kill([int priority = BEFORE_NEXT_EVENT]) {
+ void kill({int priority: BEFORE_NEXT_EVENT}) {
controlPort.send(["kill", terminateCapability, priority]);
}
@patch
- void ping(SendPort responsePort, [int pingType = IMMEDIATE]) {
- var message = new List(3)
+ void ping(SendPort responsePort, {Object response,
+ int priority: IMMEDIATE}) {
+ var message = new List(4)
..[0] = "ping"
..[1] = responsePort
- ..[2] = pingType;
+ ..[2] = priority
+ ..[3] = response;
controlPort.send(message);
}
diff --git a/pkg/dev_compiler/tool/input_sdk/patch/mirrors_patch.dart b/pkg/dev_compiler/tool/input_sdk/patch/mirrors_patch.dart
index 758b164..eb6319c 100644
--- a/pkg/dev_compiler/tool/input_sdk/patch/mirrors_patch.dart
+++ b/pkg/dev_compiler/tool/input_sdk/patch/mirrors_patch.dart
@@ -10,6 +10,12 @@
@patch
class MirrorSystem {
@patch
+ LibraryMirror findLibrary(Symbol libraryName) {
+ return libraries.values.singleWhere(
+ (library) => library.simpleName == libraryName);
+ }
+
+ @patch
static String getName(Symbol symbol) => js.getName(symbol);
@patch
diff --git a/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/operations.dart b/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/operations.dart
index 6f4236c..f89ca0c 100644
--- a/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/operations.dart
+++ b/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/operations.dart
@@ -208,7 +208,7 @@
Symbol _dartSymbol(name) {
return (JS('bool', 'typeof # === "symbol"', name))
- ? JS('', '#(new #.es6(#, #))', const_, _internal.Symbol,
+ ? JS('', '#(new #(#, #))', const_, _internal.PrivateSymbol,
_toSymbolName(name), name)
: JS('', '#(#.new(#))', const_, Symbol, _toDisplayName(name));
}
@@ -882,6 +882,12 @@
return JS('String', '#[dartx.toString]()', obj);
}
if (JS('bool', 'typeof # == "function"', obj)) {
+ // If the function is a Type object, we should just display the type name.
+ // Regular Dart code should typically get wrapped type objects instead of
+ // raw type (aka JS constructor) objects however raw type objects can be
+ // exposed to Dart code via JS interop or debugging tools.
+ if (isType(obj)) return typeName(obj);
+
return JS(
'String', r'"Closure: " + # + " from: " + #', getReifiedType(obj), obj);
}
diff --git a/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/rtti.dart b/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/rtti.dart
index 344c592..dc776c8 100644
--- a/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/rtti.dart
+++ b/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/rtti.dart
@@ -74,6 +74,8 @@
final _runtimeType = JS('', 'Symbol("_runtimeType")');
final isNamedConstructor = JS('', 'Symbol("isNamedConstructor")');
+final _moduleName = JS('', 'Symbol("_moduleName")');
+
_checkPrimitiveType(obj) {
// TODO(jmesserly): JS is used to prevent type literal wrapping. Is there a
// better way we can handle this? (sra: It is super dodgy that the values
@@ -187,9 +189,9 @@
_getRuntimeType(value) => JS('', '#[#]', value, _runtimeType);
getIsNamedConstructor(value) => JS('', '#[#]', value, isNamedConstructor);
-// TODO(bmilligan): Define the symbol in rtti.dart instead of dart_library.js
-// and get rid of the call to dart_library in the JS here.
-getDartLibraryName(value) => JS('', '#[dart_library.dartLibraryName]', value);
+
+/// Return the module name for a raw library object.
+getModuleName(value) => JS('', '#[#]', value, _moduleName);
/// Tag the runtime type of [value] to be type [t].
void tag(value, t) {
@@ -204,3 +206,22 @@
JS('', '#(#, #, { get: # })', defineLazyProperty, value, _runtimeType,
compute);
}
+
+var _loadedModules = JS('', 'new Map()');
+
+List getModuleNames() {
+ return JS('', 'Array.from(#.keys())', _loadedModules);
+}
+
+/// Return all library objects in the specified module.
+getModuleLibraries(String name) {
+ var module = JS('', '#.get(#)', _loadedModules, name);
+ if (module == null) return null;
+ JS('', '#[#] = #', module, _moduleName, name);
+ return module;
+}
+
+/// Track all libraries
+void trackLibraries(String moduleName, libraries) {
+ JS('', '#.set(#, #)', _loadedModules, moduleName, libraries);
+}
\ No newline at end of file
diff --git a/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/types.dart b/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/types.dart
index e64daf7..d1000c7 100644
--- a/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/types.dart
+++ b/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/types.dart
@@ -513,6 +513,12 @@
definiteFunctionType(returnType, args, extra) =>
_functionType(true, returnType, args, extra);
+bool isType(obj) => JS(
+ '',
+ '''(() => {
+ return $_getRuntimeType($obj) === $Type;
+ })()''');
+
String typeName(type) => JS(
'',
'''(() => {
@@ -698,8 +704,8 @@
if (JS('bool', '# === #', getGenericClass(type), getGenericClass(FutureOr))) {
return _isTop(JS('', '#[0]', getGenericArgs(type)));
}
- return JS('bool', '# == # || # == # || # == #',
- type, Object, type, dynamic, type, _void);
+ return JS('bool', '# == # || # == # || # == #', type, Object, type, dynamic,
+ type, _void);
}
_isSubtype(t1, t2, isCovariant) => JS(
diff --git a/pkg/dev_compiler/tool/input_sdk/private/debugger.dart b/pkg/dev_compiler/tool/input_sdk/private/debugger.dart
index a6bc963..7fbc2de 100644
--- a/pkg/dev_compiler/tool/input_sdk/private/debugger.dart
+++ b/pkg/dev_compiler/tool/input_sdk/private/debugger.dart
@@ -53,11 +53,68 @@
void addMetadataChildren(object, Set<NameValuePair> ret) {
ret.add(new NameValuePair(
- name: getTypeName(_getType(object)),
- value: object,
+ name: "[[class]]",
+ value: dart.getReifiedType(object),
config: JsonMLConfig.asClass));
}
+/// Add properties from a signature definition [sig] for [object].
+/// Walk the prototype chain if [walkProtypeChain] is set.
+/// Tag types on function typed properties of [object] if [tagTypes] is set.
+///
+void addPropertiesFromSignature(
+ sig, Set<NameValuePair> properties, object, bool walkPrototypeChain,
+ {tagTypes: false}) {
+ // Including these property names doesn't add any value and just clutters
+ // the debugger output.
+ // TODO(jacobr): consider adding runtimeType to this list.
+ var skippedNames = new Set()..add('hashCode');
+
+ while (sig != null) {
+ for (var symbol in getOwnPropertySymbols(sig)) {
+ var dartName = symbolName(symbol);
+ String dartXPrefix = 'dartx.';
+ if (dartName.startsWith(dartXPrefix)) {
+ dartName = dartName.substring(dartXPrefix.length);
+ }
+ if (skippedNames.contains(dartName)) continue;
+ var value = safeGetProperty(object, symbol);
+ // Tag the function with its runtime type.
+ if (tagTypes && _typeof(value) == 'function') {
+ dart.tag(value, JS('', '#[#]', sig, symbol));
+ }
+ properties.add(new NameValuePair(name: dartName, value: value));
+ }
+
+ for (var name in getOwnPropertyNames(sig)) {
+ var value = safeGetProperty(object, name);
+ if (skippedNames.contains(name)) continue;
+ // Tag the function with its runtime type.
+ if (tagTypes && _typeof(value) == 'function') {
+ dart.tag(value, JS('', '#[#]', sig, name));
+ }
+ properties.add(new NameValuePair(name: name, value: value));
+ }
+
+ if (!walkPrototypeChain) break;
+
+ sig = safeGetProperty(sig, '__proto__');
+ }
+}
+
+/// Sort properties sorting public names before private names.
+List<NameValuePair> sortProperties(Iterable<NameValuePair> properties) {
+ var sortedProperties = properties.toList();
+
+ sortedProperties.sort((a, b) {
+ var aPrivate = a.name.startsWith('_');
+ var bPrivate = b.name.startsWith('_');
+ if (aPrivate != bPrivate) return aPrivate ? 1 : -1;
+ return a.name.compareTo(b.name);
+ });
+ return sortedProperties;
+}
+
String getObjectTypeName(object) {
var reifiedType = dart.getReifiedType(object);
if (reifiedType == null) {
@@ -69,7 +126,7 @@
return getTypeName(reifiedType);
}
-String getTypeName(Type type) {
+String getTypeName(type) {
var name = dart.typeName(type);
// Hack to cleanup names for List<dynamic>
// TODO(jacobr): it would be nice if there was a way we could distinguish
@@ -80,9 +137,6 @@
return name;
}
-Object _getType(object) =>
- object is Type ? object : dart.getReifiedType(object);
-
String safePreview(object, config) {
try {
var preview = _devtoolsFormatter._simpleFormatter.preview(object, config);
@@ -117,7 +171,12 @@
// Define equality and hashCode so that NameValuePair can be used
// in a Set to dedupe entries with duplicate names.
- operator ==(other) => other is NameValuePair && other.name == name;
+ bool operator ==(other) {
+ if (other is! NameValuePair) return false;
+ if (this.hideName || other.hideName) return identical(this, other);
+ return other.name == name;
+ }
+
int get hashCode => name.hashCode;
final String name;
@@ -269,7 +328,7 @@
// Treat Node objects as a native JavaScript type as the regular DOM render
// in devtools is superior to the dart specific view.
return (type != 'object' && type != 'function') ||
- object is dart.JSObject ||
+ dart.isJsInterop(object) ||
object is html.Node;
}
@@ -328,27 +387,41 @@
body.addStyle('color: rgb(196, 26, 22);');
}
var children = _simpleFormatter.children(object, config);
+ if (children == null) return body.toJsonML();
for (NameValuePair child in children) {
var li = body.createChild('li');
- var nameSpan = new JsonMLElement('span')
- ..createTextChild(
- child.displayName.isNotEmpty ? '${child.displayName}: ' : '')
- ..setStyle('color: rgb(136, 19, 145);');
+ li.setStyle("padding-left: 13px;");
+
+ // The value is indented when it is on a different line from the name
+ // by setting right padding of the name to -13px and the padding of the
+ // value to 13px.
+ JsonMLElement nameSpan;
+ var valueStyle = '';
+ if (!child.hideName) {
+ nameSpan = new JsonMLElement('span')
+ ..createTextChild(
+ child.displayName.isNotEmpty ? '${child.displayName}: ' : '')
+ ..setStyle('color: rgb(136, 19, 145); margin-right: -13px');
+ valueStyle = 'margin-left: 13px';
+ }
+
if (_typeof(child.value) == 'object' ||
_typeof(child.value) == 'function') {
- nameSpan.addStyle("padding-left: 13px;");
-
- li.appendChild(nameSpan);
- var objectTag = li.createObjectTag(child.value);
- objectTag.addAttribute('config', child.config);
- if (!_simpleFormatter.hasChildren(child.value, child.config)) {
- li.setStyle("padding-left: 13px;");
+ var valueSpan = new JsonMLElement('span')..setStyle(valueStyle);
+ valueSpan.createObjectTag(child.value)
+ ..addAttribute('config', child.config);
+ if (nameSpan != null) {
+ li.appendChild(nameSpan);
}
+ li.appendChild(valueSpan);
} else {
- li.setStyle("padding-left: 13px;");
- li.createChild('span')
- ..appendChild(nameSpan)
- ..createTextChild(safePreview(child.value, child.config));
+ var line = li.createChild('span');
+ if (nameSpan != null) {
+ line.appendChild(nameSpan);
+ }
+ line.appendChild(new JsonMLElement('span')
+ ..createTextChild(safePreview(child.value, child.config))
+ ..setStyle(valueStyle));
}
}
return body.toJsonML();
@@ -370,6 +443,7 @@
// precedence.
_formatters = [
new ClassFormatter(),
+ new TypeFormatter(),
new NamedConstructorFormatter(),
new MapFormatter(),
new IterableFormatter(),
@@ -437,10 +511,6 @@
/// Default formatter for Dart Objects.
class ObjectFormatter extends Formatter {
- static Set<String> _customNames = new Set()
- ..add('constructor')
- ..add('prototype')
- ..add('__proto__');
bool accept(object, config) => !isNativeJavaScriptObject(object);
String preview(object) => getObjectTypeName(object);
@@ -448,76 +518,34 @@
bool hasChildren(object) => true;
List<NameValuePair> children(object) {
- var properties = new LinkedHashSet<NameValuePair>();
- // Set of property names used to avoid duplicates.
- addMetadataChildren(object, properties);
-
- var current = object;
-
- var protoChain = <Object>[];
- while (current != null &&
- !isNativeJavaScriptObject(current) &&
- JS("bool", "# !== Object.prototype", current)) {
- protoChain.add(current);
- current = safeGetProperty(current, '__proto__');
- }
-
- // We walk the prototype chain for symbol properties because they take
- // priority and are accessed instead of Dart properties according to Dart
- // calling conventions.
- // TODO(jacobr): where possible use the data stored by dart.setSignature
- // instead of walking the JavaScript object directly.
- for (current in protoChain) {
- for (var symbol in getOwnPropertySymbols(current)) {
- var dartName = symbolName(symbol);
- if (hasMethod(object, dartName)) {
- continue;
- }
- // TODO(jacobr): find a cleaner solution than checking for dartx
- String dartXPrefix = 'dartx.';
- if (dartName.startsWith(dartXPrefix)) {
- dartName = dartName.substring(dartXPrefix.length);
- } else if (!dartName.startsWith('_')) {
- // Dart method extension names should either be from dartx or should
- // start with an _
- continue;
- }
- var value = safeGetProperty(object, symbol);
- properties.add(new NameValuePair(name: dartName, value: value));
- }
- }
-
- for (current in protoChain) {
- // TODO(jacobr): optionally distinguish properties and fields so that
- // it is safe to expand untrusted objects without side effects.
- var className = dart.getReifiedType(current).name;
- for (var name in getOwnPropertyNames(current)) {
- if (_customNames.contains(name) || name == className) continue;
- if (hasMethod(object, name)) {
- continue;
- }
- var value = safeGetProperty(object, name);
- properties.add(new NameValuePair(name: name, value: value));
- }
- }
-
- return properties.toList();
+ var type = dart.getType(object);
+ var ret = new LinkedHashSet<NameValuePair>();
+ // We use a Set rather than a List to avoid duplicates.
+ var properties = new Set<NameValuePair>();
+ addPropertiesFromSignature(
+ dart.getFieldSig(type), properties, object, true);
+ addPropertiesFromSignature(
+ dart.getGetterSig(type), properties, object, true);
+ ret.addAll(sortProperties(properties));
+ addMetadataChildren(object, ret);
+ return ret.toList();
}
}
/// Formatter for module Dart Library objects.
class LibraryModuleFormatter implements Formatter {
- accept(object, config) => dart.getDartLibraryName(object) != null;
+ accept(object, config) => dart.getModuleName(object) != null;
bool hasChildren(object) => true;
String preview(object) {
- var libraryNames = dart.getDartLibraryName(object).split('/');
+ var libraryNames = dart.getModuleName(object).split('/');
// Library names are received with a repeat directory name, so strip the
// last directory entry here to make the path cleaner. For example, the
// library "third_party/dart/utf/utf" shoud display as
// "third_party/dart/utf/".
- if (libraryNames.length > 1) {
+ if (libraryNames.length > 1 &&
+ libraryNames.last == libraryNames[libraryNames.length - 2]) {
libraryNames[libraryNames.length - 1] = '';
}
return 'Library Module: ${libraryNames.join('/')}';
@@ -527,9 +555,6 @@
var children = new LinkedHashSet<NameValuePair>();
for (var name in getOwnPropertyNames(object)) {
var value = safeGetProperty(object, name);
- // Replace __ with / to make file paths more readable. Then
- // 'src__result__error' becomes 'src/result/error'.
- name = '${name.replaceAll("__", "/")}.dart';
children.add(new NameValuePair(
name: name, value: new Library(name, value), hideName: true));
}
@@ -547,51 +572,26 @@
String preview(object) => object.name;
List<NameValuePair> children(object) {
+ // Maintain library member order rather than sorting members as is the
+ // case for class members.
var children = new LinkedHashSet<NameValuePair>();
- var nonGenericProperties = new LinkedHashMap<String, Object>();
var objectProperties = safeProperties(object.object);
objectProperties.forEach((name, value) {
- var genericTypeConstructor = dart.getGenericTypeCtor(value);
- if (genericTypeConstructor != null) {
- recordGenericParameters(name, genericTypeConstructor);
- } else {
- nonGenericProperties[name] = value;
- }
- });
- nonGenericProperties.forEach((name, value) {
- if (value is Type) {
- children.add(classChild(name, value));
- } else {
- children.add(new NameValuePair(name: name, value: value));
- }
+ // Skip the generic constructors for each class as users are only
+ // interested in seeing the actual classes.
+ if (dart.getGenericTypeCtor(value) != null) return;
+
+ children.add(dart.isType(value)
+ ? classChild(name, value)
+ : new NameValuePair(name: name, value: value));
});
return children.toList();
}
- recordGenericParameters(String name, Object genericTypeConstructor) {
- // Using JS toString() eliminates the leading metadata that is generated
- // with the toString function provided in operations.dart.
- // Splitting by => and taking the first element gives the list of
- // arguments in the constructor.
- genericParameters[name] =
- JS('String', '#.toString()', genericTypeConstructor)
- .split(' =>')
- .first
- .replaceAll(new RegExp(r'[(|)]'), '');
- }
-
classChild(String name, Object child) {
var typeName = getTypeName(child);
- // Generic class names are generated with a $ at the end, so the
- // corresponding non-generic class can be identified by adding $.
- var parameterName = '$name\$';
- if (genericParameters.keys.contains(parameterName)) {
- typeName = '$typeName<${genericParameters[parameterName]}>';
- // TODO(bmilligan): Add a symbol to classes with generic types at their
- // creation so they can be recognized independently by the debugger.
- JSNative.setProperty(child, 'genericTypeName', typeName);
- }
- return new NameValuePair(name: typeName, value: child);
+ return new NameValuePair(
+ name: typeName, value: child, config: JsonMLConfig.asClass);
}
}
@@ -770,14 +770,11 @@
}
class ClassFormatter implements Formatter {
- accept(object, config) => object is Type || config == JsonMLConfig.asClass;
+ accept(object, config) => config == JsonMLConfig.asClass;
- String preview(object) {
- var typeName = safeGetProperty(object, 'genericTypeName');
- if (typeName != null) return typeName;
- var type = _getType(object);
+ String preview(type) {
var implements = dart.getImplements(type);
- typeName = getTypeName(type);
+ var typeName = getTypeName(type);
if (implements != null) {
var typeNames = implements().map(getTypeName);
return '${typeName} implements ${typeNames.join(", ")}';
@@ -788,60 +785,86 @@
bool hasChildren(object) => true;
- List<NameValuePair> children(object) {
+ List<NameValuePair> children(type) {
// TODO(jacobr): add other entries describing the class such as
- // links to the superclass, mixins, implemented interfaces, and methods.
- var type = _getType(object);
- var children = <NameValuePair>[];
- var typeName = getTypeName(_getType(object));
+ // implemented interfaces, and methods.
+ var ret = new LinkedHashSet<NameValuePair>();
+
+ var staticProperties = new Set<NameValuePair>();
+ var staticMethods = new Set<NameValuePair>();
+ // Static fields and properties.
+ addPropertiesFromSignature(
+ dart.getStaticFieldSig(type), staticProperties, type, false);
+ addPropertiesFromSignature(
+ dart.getStaticGetterSig(type), staticProperties, type, false);
+ // static methods.
+ addPropertiesFromSignature(
+ dart.getStaticSig(type), staticMethods, type, false);
+
+ if (staticProperties.isNotEmpty || staticMethods.isNotEmpty) {
+ ret
+ ..add(new NameValuePair(value: '[[Static members]]', hideName: true))
+ ..addAll(sortProperties(staticProperties))
+ ..addAll(sortProperties(staticMethods));
+ }
+
+ // instance methods.
+ var instanceMethods = new Set<NameValuePair>();
+ // Instance methods are defined on the prototype not the constructor object.
+ addPropertiesFromSignature(dart.getMethodSig(type), instanceMethods,
+ JS('', '#.prototype', type), false,
+ tagTypes: true);
+ if (instanceMethods.isNotEmpty) {
+ ret
+ ..add(new NameValuePair(value: '[[Instance Methods]]', hideName: true))
+ ..addAll(sortProperties(instanceMethods));
+ }
+
+ var typeName = getTypeName(type);
var mixins = dart.getMixins(type);
if (mixins != null && mixins.isNotEmpty) {
- children.add(new NameValuePair(
+ ret.add(new NameValuePair(
name: '[[Mixins]]', value: new HeritageClause('mixins', mixins)));
}
- var hiddenProperties = ['length', 'name', 'prototype', 'genericTypeName'];
- // Addition of NameValuePairs for static variables and named constructors.
- for (var name in getOwnPropertyNames(object)) {
- // TODO(bmilligan): Perform more principled checks to filter out spurious
- // members.
- if (hiddenProperties.contains(name)) continue;
- var value = safeGetProperty(object, name);
- if (value != null && dart.getIsNamedConstructor(value) != null) {
- value = new NamedConstructor(value);
- name = '${typeName}.$name';
- }
- children.add(new NameValuePair(name: name, value: value));
+ var baseProto = JS('', '#.__proto__', type);
+ if (baseProto != null && !dart.isJsInterop(baseProto)) {
+ ret.add(new NameValuePair(
+ name: "[[base class]]",
+ value: baseProto,
+ config: JsonMLConfig.asClass));
}
- // TODO(bmilligan): Replace the hard coding of $identityHash.
- var hiddenPrototypeProperties = ['constructor', 'new', r'$identityHash'];
- // Addition of class methods.
- var prototype = JS('var', '#["prototype"]', object);
- if (prototype != null) {
- for (var name in getOwnPropertyNames(prototype)) {
- if (hiddenPrototypeProperties.contains(name)) continue;
- // Simulate dart.bind by using dart.tag and tear off the function
- // so it will be recognized by the FunctionFormatter.
- var function = safeGetProperty(prototype, name);
- var constructor = safeGetProperty(prototype, 'constructor');
- var sigObj = dart.getMethodSig(constructor);
- if (sigObj != null) {
- var value = safeGetProperty(sigObj, name);
- if (getTypeName(dart.getReifiedType(value)) != 'Null') {
- dart.tag(function, value);
- children.add(new NameValuePair(name: name, value: function));
- }
- }
- }
- }
- return children;
+ // TODO(jacobr): add back fields for named constructors.
+ return ret.toList();
}
}
+class TypeFormatter implements Formatter {
+ accept(object, config) => object is Type;
+
+ String preview(object) => object.toString();
+
+ bool hasChildren(object) => false;
+
+ List<NameValuePair> children(object) => [];
+}
+
/// This entry point is automatically invoked by the code generated by
/// Dart Dev Compiler
registerDevtoolsFormatter() {
var formatters = [_devtoolsFormatter];
JS('', 'dart.global.devtoolsFormatters = #', formatters);
}
+
+// Expose these methods here to facilitate writing debugger tests.
+// If export worked for private SDK libraries we could just export
+// these methods from dart:_runtime.
+
+getModuleNames() {
+ return dart.getModuleNames();
+}
+
+getModuleLibraries(String name) {
+ return dart.getModuleLibraries(name);
+}
diff --git a/pkg/dev_compiler/tool/input_sdk/private/isolate_helper.dart b/pkg/dev_compiler/tool/input_sdk/private/isolate_helper.dart
index 975dde7..a6310d5 100644
--- a/pkg/dev_compiler/tool/input_sdk/private/isolate_helper.dart
+++ b/pkg/dev_compiler/tool/input_sdk/private/isolate_helper.dart
@@ -382,10 +382,6 @@
return;
}
void respond() { responsePort.send(null); }
- if (pingType == Isolate.AS_EVENT) {
- _globalState.topEventLoop.enqueue(this, respond, "ping");
- return;
- }
assert(pingType == Isolate.BEFORE_NEXT_EVENT);
if (_scheduledControlEvents == null) {
_scheduledControlEvents = new Queue();
@@ -401,10 +397,6 @@
kill();
return;
}
- if (priority == Isolate.AS_EVENT) {
- _globalState.topEventLoop.enqueue(this, kill, "kill");
- return;
- }
assert(priority == Isolate.BEFORE_NEXT_EVENT);
if (_scheduledControlEvents == null) {
_scheduledControlEvents = new Queue();
diff --git a/pkg/dev_compiler/tool/input_sdk/private/js_array.dart b/pkg/dev_compiler/tool/input_sdk/private/js_array.dart
index 80a5289..c33ca35 100644
--- a/pkg/dev_compiler/tool/input_sdk/private/js_array.dart
+++ b/pkg/dev_compiler/tool/input_sdk/private/js_array.dart
@@ -93,7 +93,7 @@
void insertAll(int index, Iterable<E> iterable) {
checkGrowable('insertAll');
RangeError.checkValueInInterval(index, 0, this.length, "index");
- if (iterable is! EfficientLength) {
+ if (iterable is! EfficientLengthIterable) {
iterable = iterable.toList();
}
int insertionLength = iterable.length;
@@ -411,7 +411,7 @@
void replaceRange(int start, int end, Iterable<E> replacement) {
checkGrowable('replace range');
RangeError.checkValidRange(start, end, this.length);
- if (replacement is! EfficientLength) {
+ if (replacement is! EfficientLengthIterable) {
replacement = replacement.toList();
}
int removeLength = end - start;
diff --git a/pkg/dev_compiler/tool/input_sdk/private/js_helper.dart b/pkg/dev_compiler/tool/input_sdk/private/js_helper.dart
index a20547b..fee11a5 100644
--- a/pkg/dev_compiler/tool/input_sdk/private/js_helper.dart
+++ b/pkg/dev_compiler/tool/input_sdk/private/js_helper.dart
@@ -12,7 +12,7 @@
import 'dart:_interceptors';
import 'dart:_internal' show
- EfficientLength,
+ EfficientLengthIterable,
MappedIterable,
IterableElementError;
@@ -25,6 +25,8 @@
part 'string_helper.dart';
part 'js_rti.dart';
+final _identityHashCode = JS('', 'Symbol("_identityHashCode")');
+
class _Patch {
const _Patch();
}
@@ -57,10 +59,10 @@
}
static int objectHashCode(object) {
- int hash = JS('int|Null', r'#.$identityHash', object);
+ int hash = JS('int|Null', r'#[#]', object, _identityHashCode);
if (hash == null) {
hash = JS('int', '(Math.random() * 0x3fffffff) | 0');
- JS('void', r'#.$identityHash = #', object, hash);
+ JS('void', r'#[#] = #', object, _identityHashCode, hash);
}
return JS('int', '#', hash);
}
diff --git a/pkg/dev_compiler/tool/input_sdk/private/js_mirrors.dart b/pkg/dev_compiler/tool/input_sdk/private/js_mirrors.dart
index 62cb4a6..98c6dbd 100644
--- a/pkg/dev_compiler/tool/input_sdk/private/js_mirrors.dart
+++ b/pkg/dev_compiler/tool/input_sdk/private/js_mirrors.dart
@@ -8,8 +8,13 @@
import 'dart:_foreign_helper' show JS;
import 'dart:_internal' as _internal;
-String getName(Symbol symbol) =>
- _internal.Symbol.getName(symbol as _internal.Symbol);
+String getName(Symbol symbol) {
+ if (symbol is _internal.PrivateSymbol) {
+ return _internal.PrivateSymbol.getName(symbol);
+ } else {
+ return _internal.Symbol.getName(symbol as _internal.Symbol);
+ }
+}
Symbol getSymbol(name, library) =>
throw new UnimplementedError("MirrorSystem.getSymbol unimplemented");
@@ -79,7 +84,7 @@
typedef T _Lazy<T>();
dynamic _getESSymbol(Symbol symbol) =>
- _internal.Symbol.getNativeSymbol(symbol as _internal.Symbol);
+ _internal.PrivateSymbol.getNativeSymbol(symbol);
dynamic _getMember(Symbol symbol) {
var privateSymbol = _getESSymbol(symbol);
@@ -116,7 +121,7 @@
Symbol _getSymbolForESSymbol(member) {
var name = _getNameForESSymbol(member);
- return new _internal.Symbol.es6(name, member);
+ return new _internal.PrivateSymbol(name, member);
}
// The [member] must be either a string (public) or an ES6 symbol (private).
@@ -125,7 +130,7 @@
return new Symbol(member);
} else {
var name = _getNameForESSymbol(member);
- return new _internal.Symbol.es6(name, member);
+ return new _internal.PrivateSymbol(name, member);
}
}
@@ -379,7 +384,7 @@
setters.forEach((symbol, ft) {
var name = getName(symbol) + '=';
// Create a separate symbol for the setter.
- symbol = new _internal.Symbol.es6(name, _getESSymbol(symbol));
+ symbol = new _internal.PrivateSymbol(name, _getESSymbol(symbol));
_declarations[symbol] =
new JsMethodMirror._instanceMethod(this, symbol, ft);
});
diff --git a/pkg/dev_compiler/tool/input_sdk/private/linked_hash_map.dart b/pkg/dev_compiler/tool/input_sdk/private/linked_hash_map.dart
index f6c20bf..19ab363 100644
--- a/pkg/dev_compiler/tool/input_sdk/private/linked_hash_map.dart
+++ b/pkg/dev_compiler/tool/input_sdk/private/linked_hash_map.dart
@@ -382,8 +382,7 @@
LinkedHashMapCell(this.hashMapCellKey, this.hashMapCellValue);
}
-class LinkedHashMapKeyIterable<E> extends Iterable<E>
- implements EfficientLength {
+class LinkedHashMapKeyIterable<E> extends EfficientLengthIterable<E> {
final dynamic/*=JsLinkedHashMap<E, dynamic>*/ _map;
LinkedHashMapKeyIterable(this._map);
diff --git a/pkg/dev_compiler/tool/input_sdk/version b/pkg/dev_compiler/tool/input_sdk/version
deleted file mode 100644
index c8f7f49..0000000
--- a/pkg/dev_compiler/tool/input_sdk/version
+++ /dev/null
@@ -1 +0,0 @@
-1.9.0-dev.4.0
diff --git a/pkg/dev_compiler/tool/patch_sdk.dart b/pkg/dev_compiler/tool/patch_sdk.dart
index 00ec5db..2b71640 100755
--- a/pkg/dev_compiler/tool/patch_sdk.dart
+++ b/pkg/dev_compiler/tool/patch_sdk.dart
@@ -15,39 +15,42 @@
void main(List<String> argv) {
var self = path.relative(path.fromUri(Platform.script));
- if (argv.length < 2) {
+ if (argv.length < 3) {
var toolDir = path.relative(path.dirname(path.fromUri(Platform.script)));
- var inputExample = path.join(toolDir, 'input_sdk');
+ var inputExample = path.join(toolDir, '..', '..', '..');
+ var patchExample = path.join(toolDir, 'input_sdk');
var outExample =
path.relative(path.normalize(path.join('gen', 'patched_sdk')));
- print('Usage: $self INPUT_DIR OUTPUT_DIR');
+ print('Usage: $self INPUT_SDK_DIR PATCH_DIR OUTPUT_DIR');
print('For example:');
- print('\$ $self $inputExample $outExample');
+ print('\$ $self $inputExample $patchExample $outExample');
exit(1);
}
var selfModifyTime = new File(self).lastModifiedSync().millisecondsSinceEpoch;
- var input = argv[0];
- var sdkLibIn = path.join(input, 'lib');
- var patchIn = path.join(input, 'patch');
- var privateIn = path.join(input, 'private');
- var sdkOut = path.join(argv[1], 'lib');
+ var inputDir = argv[0];
+ var patchDir = argv[1];
+ var sdkLibIn = path.join(inputDir, 'sdk', 'lib');
+ var patchIn = path.join(patchDir, 'patch');
+ var privateIn = path.join(patchDir, 'private');
+ var sdkOut = path.join(argv[2], 'lib');
- var INTERNAL_PATH = '_internal/compiler/js_lib/';
+ var INTERNAL_PATH = '_internal/js_runtime/lib/';
// Copy libraries.dart and version
- var libContents = new File(path.join(sdkLibIn, '_internal', 'libraries.dart'))
- .readAsStringSync();
+ var librariesDart = path.join(patchDir, 'libraries.dart');
+ var libContents = new File(librariesDart).readAsStringSync();
+ // TODO(jmesserly): can we remove this?
_writeSync(path.join(sdkOut, '_internal', 'libraries.dart'), libContents);
_writeSync(
path.join(
sdkOut, '_internal', 'sdk_library_metadata', 'lib', 'libraries.dart'),
libContents);
_writeSync(path.join(sdkOut, '..', 'version'),
- new File(path.join(sdkLibIn, '..', 'version')).readAsStringSync());
+ new File(path.join(inputDir, 'tools', 'VERSION')).readAsStringSync());
// Parse libraries.dart
var sdkLibraries = _getSdkLibraries(libContents);
@@ -60,10 +63,13 @@
if (library.isVmLibrary) continue;
var libraryOut = path.join(sdkLibIn, library.path);
+ var libraryOverride = path.join(patchDir, 'lib', library.path);
var libraryIn;
if (library.path.contains(INTERNAL_PATH)) {
libraryIn =
path.join(privateIn, library.path.replaceAll(INTERNAL_PATH, ''));
+ } else if (new File(libraryOverride).existsSync()) {
+ libraryIn = libraryOverride;
} else {
libraryIn = libraryOut;
}
@@ -124,8 +130,12 @@
contents = _patchLibrary(contents, patchContents);
}
- for (var i = 0; i < outPaths.length; i++) {
- _writeSync(outPaths[i], contents[i]);
+ if (contents != null) {
+ for (var i = 0; i < outPaths.length; i++) {
+ _writeSync(outPaths[i], contents[i]);
+ }
+ } else {
+ exitCode = 2;
}
}
}
@@ -167,12 +177,16 @@
var patchFinder = new PatchFinder.parseAndVisit(patchContents);
// Merge `external` declarations with the corresponding `@patch` code.
+ bool failed = false;
for (var partContent in partsContents) {
var partEdits = new StringEditBuffer(partContent);
var partUnit = parseCompilationUnit(partContent);
- partUnit.accept(new PatchApplier(partEdits, patchFinder));
+ var patcher = new PatchApplier(partEdits, patchFinder);
+ partUnit.accept(patcher);
+ if (!failed) failed = patcher.patchWasMissing;
results.add(partEdits);
}
+ if (failed) return null;
return new List<String>.from(results.map((e) => e.toString()));
}
@@ -182,6 +196,7 @@
final PatchFinder patch;
bool _isLibrary = true; // until proven otherwise.
+ bool patchWasMissing = false;
PatchApplier(this.edits, this.patch);
@@ -258,6 +273,7 @@
var patchNode = patch.patches[name];
if (patchNode == null) {
print('warning: patch not found for $name: $node');
+ patchWasMissing = true;
return;
}
diff --git a/pkg/dev_compiler/tool/patch_sdk.sh b/pkg/dev_compiler/tool/patch_sdk.sh
index c04c622..45370d1 100755
--- a/pkg/dev_compiler/tool/patch_sdk.sh
+++ b/pkg/dev_compiler/tool/patch_sdk.sh
@@ -2,4 +2,4 @@
set -e
cd "$(dirname "$BASH_SOURCE[0]")/.."
-dart -c tool/patch_sdk.dart tool/input_sdk gen/patched_sdk
+dart -c tool/patch_sdk.dart ../.. tool/input_sdk gen/patched_sdk
diff --git a/pkg/dev_compiler/tool/sdk_expected_errors.txt b/pkg/dev_compiler/tool/sdk_expected_errors.txt
index 381ac61..9badbd3 100644
--- a/pkg/dev_compiler/tool/sdk_expected_errors.txt
+++ b/pkg/dev_compiler/tool/sdk_expected_errors.txt
@@ -1,45 +1,65 @@
-[error] Couldn't infer type parameter 'T'; '_ControllerEventSinkWrapper<dynamic>' must be of type 'EventSink<T>'. (dart:async/stream.dart, line 1346, col 16)
-[error] The argument type '_ControllerEventSinkWrapper' can't be assigned to the parameter type 'EventSink<T>'. (dart:async/stream.dart, line 1346, col 53)
-[error] Type parameter bound types must be instantiated. (dart:collection/queue.dart, line 99, col 29)
+[error] Couldn't infer type parameter 'T'; '_ControllerEventSinkWrapper<dynamic>' must be of type 'EventSink<T>'. (dart:async/stream.dart, line 1359, col 16)
+[error] The argument type '_ControllerEventSinkWrapper' can't be assigned to the parameter type 'EventSink<T>'. (dart:async/stream.dart, line 1359, col 53)
+[error] Type parameter bound types must be instantiated. (dart:collection/queue.dart, line 99, col 32)
+[error] Invalid override. The type of '_UnicodeSubsetEncoder.startChunkedConversion' ('(Sink<List<int>>) → StringConversionSink') isn't a subtype of 'ChunkedConverter<String, List<int>, String, List<int>>.startChunkedConversion' ('(dynamic) → dynamic'). (dart:convert/ascii.dart, line 107, col 3)
+[error] Invalid override. The type of '_UnicodeSubsetEncoder.bind' ('(Stream<String>) → Stream<List<int>>') isn't a subtype of 'ChunkedConverter<String, List<int>, String, List<int>>.bind' ('(dynamic) → dynamic'). (dart:convert/ascii.dart, line 115, col 3)
+[error] Invalid override. The type of '_UnicodeSubsetDecoder.startChunkedConversion' ('(Sink<String>) → ByteConversionSink') isn't a subtype of 'ChunkedConverter<List<int>, String, List<int>, String>.startChunkedConversion' ('(dynamic) → dynamic'). (dart:convert/ascii.dart, line 221, col 3)
+[error] Invalid override. The type of '_UnicodeSubsetDecoder.bind' ('(Stream<List<int>>) → Stream<String>') isn't a subtype of 'ChunkedConverter<List<int>, String, List<int>, String>.bind' ('(dynamic) → dynamic'). (dart:convert/ascii.dart, line 224, col 3)
+[error] Invalid override. The type of 'AsciiDecoder.startChunkedConversion' ('(Sink<String>) → ByteConversionSink') isn't a subtype of 'ChunkedConverter<List<int>, String, List<int>, String>.startChunkedConversion' ('(dynamic) → dynamic'). (dart:convert/ascii.dart, line 237, col 3)
+[error] Base class introduces an invalid override. The type of 'Converter.bind' ('(Stream<List<int>>) → Stream<String>') isn't a subtype of 'ChunkedConverter<List<int>, String, List<int>, String>.bind' ('(dynamic) → dynamic'). (dart:convert/base64.dart, line 207, col 21)
+[error] Invalid override. The type of 'Base64Encoder.startChunkedConversion' ('(Sink<String>) → ByteConversionSink') isn't a subtype of 'ChunkedConverter<List<int>, String, List<int>, String>.startChunkedConversion' ('(dynamic) → dynamic'). (dart:convert/base64.dart, line 222, col 3)
+[error] Base class introduces an invalid override. The type of 'Converter.bind' ('(Stream<String>) → Stream<List<int>>') isn't a subtype of 'ChunkedConverter<String, List<int>, String, List<int>>.bind' ('(dynamic) → dynamic'). (dart:convert/base64.dart, line 479, col 21)
+[error] Invalid override. The type of 'Base64Decoder.startChunkedConversion' ('(Sink<List<int>>) → StringConversionSink') isn't a subtype of 'ChunkedConverter<String, List<int>, String, List<int>>.startChunkedConversion' ('(dynamic) → dynamic'). (dart:convert/base64.dart, line 493, col 3)
[error] Invalid override. The type of 'ChunkedConverter.bind' ('(dynamic) → dynamic') isn't a subtype of 'Converter<S, T>.bind' ('(Stream<S>) → Stream<T>'). (dart:convert/chunked_conversion.dart, line 14, col 3)
[error] Invalid override. The type of 'ChunkedConverter.bind' ('(dynamic) → dynamic') isn't a subtype of 'StreamTransformer<S, T>.bind' ('(Stream<S>) → Stream<T>'). (dart:convert/chunked_conversion.dart, line 14, col 3)
[error] Invalid override. The type of 'ChunkedConverter.startChunkedConversion' ('(dynamic) → dynamic') isn't a subtype of 'Converter<S, T>.startChunkedConversion' ('(Sink<T>) → Sink<S>'). (dart:convert/chunked_conversion.dart, line 15, col 3)
+[error] Base class introduces an invalid override. The type of 'Converter.bind' ('(Stream<S>) → Stream<T>') isn't a subtype of 'ChunkedConverter<S, T, S, T>.bind' ('(dynamic) → dynamic'). (dart:convert/converter.dart, line 54, col 32)
+[error] Invalid override. The type of '_FusedConverter.startChunkedConversion' ('(Sink<T>) → Sink<S>') isn't a subtype of 'ChunkedConverter<S, T, S, T>.startChunkedConversion' ('(dynamic) → dynamic'). (dart:convert/converter.dart, line 63, col 3)
+[error] Base class introduces an invalid override. The type of 'Converter.bind' ('(Stream<String>) → Stream<String>') isn't a subtype of 'ChunkedConverter<String, String, String, String>.bind' ('(dynamic) → dynamic'). (dart:convert/html_escape.dart, line 155, col 18)
+[error] Invalid override. The type of 'HtmlEscape.startChunkedConversion' ('(Sink<String>) → StringConversionSink') isn't a subtype of 'ChunkedConverter<String, String, String, String>.startChunkedConversion' ('(dynamic) → dynamic'). (dart:convert/html_escape.dart, line 207, col 3)
+[error] Invalid override. The type of 'JsonEncoder.startChunkedConversion' ('(Sink<String>) → ChunkedConversionSink<Object>') isn't a subtype of 'ChunkedConverter<Object, String, Object, String>.startChunkedConversion' ('(dynamic) → dynamic'). (dart:convert/json.dart, line 257, col 3)
+[error] Invalid override. The type of 'JsonEncoder.bind' ('(Stream<Object>) → Stream<String>') isn't a subtype of 'ChunkedConverter<Object, String, Object, String>.bind' ('(dynamic) → dynamic'). (dart:convert/json.dart, line 269, col 3)
+[error] Invalid override. The type of 'JsonUtf8Encoder.startChunkedConversion' ('(Sink<List<int>>) → ChunkedConversionSink<Object>') isn't a subtype of 'ChunkedConverter<Object, List<int>, Object, List<int>>.startChunkedConversion' ('(dynamic) → dynamic'). (dart:convert/json.dart, line 385, col 3)
+[error] Invalid override. The type of 'JsonUtf8Encoder.bind' ('(Stream<Object>) → Stream<List<int>>') isn't a subtype of 'ChunkedConverter<Object, List<int>, Object, List<int>>.bind' ('(dynamic) → dynamic'). (dart:convert/json.dart, line 397, col 3)
+[error] Invalid override. The type of 'JsonDecoder.startChunkedConversion' ('(Sink<Object>) → StringConversionSink') isn't a subtype of 'ChunkedConverter<String, Object, String, Object>.startChunkedConversion' ('(dynamic) → dynamic'). (dart:convert/json.dart, line 507, col 3)
+[error] Invalid override. The type of 'JsonDecoder.bind' ('(Stream<String>) → Stream<Object>') isn't a subtype of 'ChunkedConverter<String, Object, String, Object>.bind' ('(dynamic) → dynamic'). (dart:convert/json.dart, line 512, col 3)
+[error] Invalid override. The type of 'Latin1Decoder.startChunkedConversion' ('(Sink<String>) → ByteConversionSink') isn't a subtype of 'ChunkedConverter<List<int>, String, List<int>, String>.startChunkedConversion' ('(dynamic) → dynamic'). (dart:convert/latin1.dart, line 100, col 3)
+[error] Invalid override. The type of 'Utf8Encoder.startChunkedConversion' ('(Sink<List<int>>) → StringConversionSink') isn't a subtype of 'ChunkedConverter<String, List<int>, String, List<int>>.startChunkedConversion' ('(dynamic) → dynamic'). (dart:convert/utf.dart, line 122, col 3)
+[error] Invalid override. The type of 'Utf8Encoder.bind' ('(Stream<String>) → Stream<List<int>>') isn't a subtype of 'ChunkedConverter<String, List<int>, String, List<int>>.bind' ('(dynamic) → dynamic'). (dart:convert/utf.dart, line 130, col 3)
+[error] Invalid override. The type of 'Utf8Decoder.startChunkedConversion' ('(Sink<String>) → ByteConversionSink') isn't a subtype of 'ChunkedConverter<List<int>, String, List<int>, String>.startChunkedConversion' ('(dynamic) → dynamic'). (dart:convert/utf.dart, line 360, col 3)
+[error] Invalid override. The type of 'Utf8Decoder.bind' ('(Stream<List<int>>) → Stream<String>') isn't a subtype of 'ChunkedConverter<List<int>, String, List<int>, String>.bind' ('(dynamic) → dynamic'). (dart:convert/utf.dart, line 371, col 3)
[error] Only redirecting factory constructors can be declared to be 'const'. (dart:core/bool.dart, line 41, col 9)
[error] Const constructors can't throw exceptions. (dart:core/bool.dart, line 42, col 5)
[error] Only redirecting factory constructors can be declared to be 'const'. (dart:core/int.dart, line 33, col 9)
[error] Const constructors can't throw exceptions. (dart:core/int.dart, line 34, col 5)
+[error] Annotation must be either a const variable reference or const constructor invocation. (dart:core/stacktrace.dart, line 43, col 3)
[error] Only redirecting factory constructors can be declared to be 'const'. (dart:core/string.dart, line 156, col 9)
[error] Const constructors can't throw exceptions. (dart:core/string.dart, line 157, col 5)
-[error] Couldn't infer type parameter 'S'; 'RandomAccessFile' must be of type 'File'. (dart:io/file_impl.dart, line 216, col 19)
-[error] The argument type '(RandomAccessFile) → Future<RandomAccessFile>' can't be assigned to the parameter type '(RandomAccessFile) → FutureOr<File>'. (dart:io/file_impl.dart, line 216, col 24)
-[error] The return type 'Future' isn't a 'FutureOr<File>', as defined by the method ''. (dart:io/file_impl.dart, line 545, col 14)
-[error] The return type 'StreamSubscription<int>' isn't a 'StreamSubscription<List<int>>', as defined by the method 'listen'. (dart:io/http_parser.dart, line 208, col 14)
-[error] The argument type '(List<int>) → void' can't be assigned to the parameter type '(int) → void'. (dart:io/http_parser.dart, line 209, col 19)
-[error] Couldn't infer type parameter 'V'; 'Object' must be of type 'String'. (dart:io/io_resource_info.dart, line 27, col 7)
-[error] The element type 'int' can't be assigned to the map value type 'String'. (dart:io/io_resource_info.dart, line 30, col 15)
-[error] Couldn't infer type parameter 'V'; 'Object' must be of type 'String'. (dart:io/io_resource_info.dart, line 75, col 5)
-[error] The element type 'int' can't be assigned to the map value type 'String'. (dart:io/io_resource_info.dart, line 77, col 13)
-[error] The element type 'int' can't be assigned to the map value type 'String'. (dart:io/io_resource_info.dart, line 79, col 20)
-[error] The element type 'int' can't be assigned to the map value type 'String'. (dart:io/io_resource_info.dart, line 80, col 23)
-[error] The element type 'int' can't be assigned to the map value type 'String'. (dart:io/io_resource_info.dart, line 81, col 20)
-[error] The element type 'int' can't be assigned to the map value type 'String'. (dart:io/io_resource_info.dart, line 82, col 21)
-[error] The element type 'double' can't be assigned to the map value type 'String'. (dart:io/io_resource_info.dart, line 83, col 19)
-[error] The element type 'double' can't be assigned to the map value type 'String'. (dart:io/io_resource_info.dart, line 84, col 20)
-[error] Couldn't infer type parameter 'V'; 'Object' must be of type 'String'. (dart:io/io_resource_info.dart, line 159, col 5)
-[error] The element type 'int' can't be assigned to the map value type 'String'. (dart:io/io_resource_info.dart, line 161, col 13)
-[error] The element type 'double' can't be assigned to the map value type 'String'. (dart:io/io_resource_info.dart, line 164, col 20)
-[error] The argument type 'List' can't be assigned to the parameter type 'Iterable<int>'. (dart:io/secure_socket.dart, line 1129, col 23)
+[error] Annotation must be either a const variable reference or const constructor invocation. (dart:developer, line 39, col 1)
+[error] Base class introduces an invalid override. The type of 'Converter.bind' ('(Stream<List<int>>) → Stream<List<int>>') isn't a subtype of 'ChunkedConverter<List<int>, List<int>, List<int>, List<int>>.bind' ('(dynamic) → dynamic'). (dart:io/data_transformer.dart, line 278, col 19)
+[error] Invalid override. The type of 'ZLibEncoder.startChunkedConversion' ('(Sink<List<int>>) → ByteConversionSink') isn't a subtype of 'ChunkedConverter<List<int>, List<int>, List<int>, List<int>>.startChunkedConversion' ('(dynamic) → dynamic'). (dart:io/data_transformer.dart, line 370, col 3)
+[error] The argument type '(RandomAccessFile) → Future<RandomAccessFile>' can't be assigned to the parameter type '(RandomAccessFile) → FutureOr<File>'. (dart:io/file_impl.dart, line 216, col 30)
+[error] The return type 'Future' isn't a 'FutureOr<File>', as defined by the method ''. (dart:io/file_impl.dart, line 614, col 14)
+[error] Target of URI doesn't exist: 'dart:nativewrappers'. (dart:io, line 211, col 8)
[error] Undefined name 'lineMode'. (dart:io/stdio.dart, line 64, col 10)
-[error] The name 'echoMode=' is already defined. (dart:io/stdio.dart, line 126, col 12)
-[error] The name 'lineMode=' is already defined. (dart:io/stdio.dart, line 145, col 12)
-[error] Couldn't infer type parameter 'S'; 'dynamic' must be of type 'WebSocket'. (dart:io/websocket_impl.dart, line 469, col 10)
-[error] The argument type '(String) → Future<dynamic>' can't be assigned to the parameter type '(dynamic) → FutureOr<WebSocket>'. (dart:io/websocket_impl.dart, line 469, col 15)
+[error] The name 'echoMode=' is already defined. (dart:io/stdio.dart, line 128, col 12)
+[error] The name 'lineMode=' is already defined. (dart:io/stdio.dart, line 149, col 12)
+[error] Base class introduces an invalid override. The type of 'Converter.bind' ('(Stream<String>) → Stream<List<int>>') isn't a subtype of 'ChunkedConverter<String, List<int>, String, List<int>>.bind' ('(dynamic) → dynamic'). (dart:io/string_transformer.dart, line 45, col 31)
+[error] Invalid override. The type of '_WindowsCodePageEncoder.startChunkedConversion' ('(Sink<List<int>>) → StringConversionSink') isn't a subtype of 'ChunkedConverter<String, List<int>, String, List<int>>.startChunkedConversion' ('(dynamic) → dynamic'). (dart:io/string_transformer.dart, line 61, col 3)
+[error] Base class introduces an invalid override. The type of 'Converter.bind' ('(Stream<List<int>>) → Stream<String>') isn't a subtype of 'ChunkedConverter<List<int>, String, List<int>, String>.bind' ('(dynamic) → dynamic'). (dart:io/string_transformer.dart, line 100, col 31)
+[error] Invalid override. The type of '_WindowsCodePageDecoder.startChunkedConversion' ('(Sink<String>) → ByteConversionSink') isn't a subtype of 'ChunkedConverter<List<int>, String, List<int>, String>.startChunkedConversion' ('(dynamic) → dynamic'). (dart:io/string_transformer.dart, line 112, col 3)
+[error] The getter 'packagesBase' isn't defined for the class 'IsolateNatives'. (dart:isolate, line 721, col 61)
[error] Invalid override. The type of 'JsArray.[]=' ('(Object, E) → void') isn't a subtype of 'JsObject.[]=' ('(Object, dynamic) → dynamic'). (dart:js, line 363, col 3)
+[error] The return type 'double' isn't a 'T', as defined by the method 'min'. (dart:math, line 90, col 16)
+[error] The return type 'double' isn't a 'T', as defined by the method 'max'. (dart:math, line 125, col 16)
[warning] Unsafe implicit cast from 'List<dynamic>' to 'List<String>'. This usually indicates that type information was lost and resulted in 'dynamic' and/or a place that will have a failure at runtime. (dart:_js_helper/regexp_helper.dart, line 140, col 43)
[warning] Unsafe implicit cast from 'List<dynamic>' to 'List<String>'. This usually indicates that type information was lost and resulted in 'dynamic' and/or a place that will have a failure at runtime. (dart:_js_helper/regexp_helper.dart, line 152, col 43)
+[warning] Unsafe implicit cast from 'Function' to '(dynamic) → FutureOr<T>'. This usually indicates that type information was lost and resulted in 'dynamic' and/or a place that will have a failure at runtime. (dart:async/future_impl.dart, line 151, col 11)
+[warning] Unsafe implicit cast from '(T) → dynamic' to '(T) → FutureOr<E>'. This usually indicates that type information was lost and resulted in 'dynamic' and/or a place that will have a failure at runtime. (dart:async/future_impl.dart, line 249, col 57)
+[warning] Unsafe implicit cast from 'StreamSubscription<dynamic>' to 'StreamSubscription<T>'. This usually indicates that type information was lost and resulted in 'dynamic' and/or a place that will have a failure at runtime. (dart:async/stream_impl.dart, line 1011, col 42)
[warning] Unsafe implicit cast from 'Object' to 'K'. This usually indicates that type information was lost and resulted in 'dynamic' and/or a place that will have a failure at runtime. (dart:collection, line 411, col 49)
-[warning] Unsafe implicit cast from 'Object' to 'E'. This usually indicates that type information was lost and resulted in 'dynamic' and/or a place that will have a failure at runtime. (dart:collection, line 758, col 14)
-[warning] Unsafe implicit cast from 'Object' to 'E'. This usually indicates that type information was lost and resulted in 'dynamic' and/or a place that will have a failure at runtime. (dart:collection, line 1135, col 14)
+[warning] Unsafe implicit cast from 'Object' to 'E'. This usually indicates that type information was lost and resulted in 'dynamic' and/or a place that will have a failure at runtime. (dart:collection, line 757, col 14)
+[warning] Unsafe implicit cast from 'Object' to 'E'. This usually indicates that type information was lost and resulted in 'dynamic' and/or a place that will have a failure at runtime. (dart:collection, line 1134, col 14)
[warning] The final variable 'origin' must be initialized. (dart:html, line 177, col 3)
[warning] The final variable 'origin' must be initialized. (dart:html, line 813, col 3)
[warning] The final variables 'form', 'labels' and '3' more must be initialized. (dart:html, line 1691, col 3)
@@ -73,31 +93,9 @@
[warning] The final variables 'readyState' and 'track' must be initialized. (dart:html, line 33056, col 3)
[warning] The final variables 'decodedFrameCount', 'droppedFrameCount' and '2' more must be initialized. (dart:html, line 33754, col 3)
[warning] Unsafe implicit cast from '(T) → void' to '(Event) → dynamic'. This usually indicates that type information was lost and resulted in 'dynamic' and/or a place that will have a failure at runtime. (dart:html, line 40126, col 45)
-[warning] Unsafe implicit cast from 'List<dynamic>' to 'List<int>'. This usually indicates that type information was lost and resulted in 'dynamic' and/or a place that will have a failure at runtime. (dart:io/data_transformer.dart, line 492, col 23)
-[warning] Unsafe implicit cast from 'Stream<dynamic>' to 'Stream<FileSystemEntity>'. This usually indicates that type information was lost and resulted in 'dynamic' and/or a place that will have a failure at runtime. (dart:io/directory_impl.dart, line 239, col 12)
-[warning] Unsafe implicit cast from 'Future<dynamic>' to 'Future<List<int>>'. This usually indicates that type information was lost and resulted in 'dynamic' and/or a place that will have a failure at runtime. (dart:io/file_impl.dart, line 484, col 14)
-[warning] Unsafe implicit cast from 'List<dynamic>' to 'List<int>'. This usually indicates that type information was lost and resulted in 'dynamic' and/or a place that will have a failure at runtime. (dart:io/file_impl.dart, line 831, col 33)
-[warning] Unsafe implicit cast from 'StreamSubscription<dynamic>' to 'StreamSubscription<List<int>>'. This usually indicates that type information was lost and resulted in 'dynamic' and/or a place that will have a failure at runtime. (dart:io/http_impl.dart, line 269, col 14)
-[warning] Unsafe implicit cast from 'Stream<dynamic>' to 'Stream<List<int>>'. This usually indicates that type information was lost and resulted in 'dynamic' and/or a place that will have a failure at runtime. (dart:io/http_impl.dart, line 1056, col 29)
-[warning] Unsafe implicit cast from 'Function' to '(List<int>) → void'. This usually indicates that type information was lost and resulted in 'dynamic' and/or a place that will have a failure at runtime. (dart:io/http_impl.dart, line 1173, col 54)
-[warning] Unsafe implicit cast from 'Function' to '(List<int>) → void'. This usually indicates that type information was lost and resulted in 'dynamic' and/or a place that will have a failure at runtime. (dart:io/http_impl.dart, line 1175, col 33)
-[warning] Unsafe implicit cast from 'Future<dynamic>' to 'Future<_ConnectionInfo>'. This usually indicates that type information was lost and resulted in 'dynamic' and/or a place that will have a failure at runtime. (dart:io/http_impl.dart, line 1635, col 14)
-[warning] Unsafe implicit cast from 'StreamSubscription<dynamic>' to 'StreamSubscription<List<int>>'. This usually indicates that type information was lost and resulted in 'dynamic' and/or a place that will have a failure at runtime. (dart:io/http_parser.dart, line 201, col 16)
-[warning] Unsafe implicit cast from 'StreamSubscription<dynamic>' to 'StreamSubscription<List<int>>'. This usually indicates that type information was lost and resulted in 'dynamic' and/or a place that will have a failure at runtime. (dart:io/http_parser.dart, line 203, col 50)
-[warning] Unsafe implicit cast from 'Map<dynamic, dynamic>' to 'Map<String, String>'. This usually indicates that type information was lost and resulted in 'dynamic' and/or a place that will have a failure at runtime. (dart:io/platform_impl.dart, line 100, col 69)
-[warning] Unsafe implicit cast from 'Future<dynamic>' to 'Future<SecureSocket>'. This usually indicates that type information was lost and resulted in 'dynamic' and/or a place that will have a failure at runtime. (dart:io/secure_socket.dart, line 92, col 12)
-[warning] Unsafe implicit cast from 'Future<dynamic>' to 'Future<SecureSocket>'. This usually indicates that type information was lost and resulted in 'dynamic' and/or a place that will have a failure at runtime. (dart:io/secure_socket.dart, line 138, col 12)
-[warning] Unsafe implicit cast from 'StreamSubscription<dynamic>' to 'StreamSubscription<RawSocketEvent>'. This usually indicates that type information was lost and resulted in 'dynamic' and/or a place that will have a failure at runtime. (dart:io/secure_socket.dart, line 446, col 33)
-[warning] Unsafe implicit cast from 'Future<dynamic>' to 'Future<RawSecureSocket>'. This usually indicates that type information was lost and resulted in 'dynamic' and/or a place that will have a failure at runtime. (dart:io/secure_socket.dart, line 580, col 12)
-[warning] Unsafe implicit cast from 'List<dynamic>' to 'List<int>'. This usually indicates that type information was lost and resulted in 'dynamic' and/or a place that will have a failure at runtime. (dart:io/secure_socket.dart, line 1176, col 32)
-[warning] Unsafe implicit cast from 'List<dynamic>' to 'List<int>'. This usually indicates that type information was lost and resulted in 'dynamic' and/or a place that will have a failure at runtime. (dart:io/stdio.dart, line 109, col 28)
-[warning] Unsafe implicit cast from 'Future<dynamic>' to 'Future<WebSocket>'. This usually indicates that type information was lost and resulted in 'dynamic' and/or a place that will have a failure at runtime. (dart:io/websocket_impl.dart, line 471, col 14)
-[warning] Unsafe implicit cast from 'List<dynamic>' to 'List<int>'. This usually indicates that type information was lost and resulted in 'dynamic' and/or a place that will have a failure at runtime. (dart:io/websocket_impl.dart, line 577, col 21)
-[warning] Unsafe implicit cast from 'List<dynamic>' to 'List<int>'. This usually indicates that type information was lost and resulted in 'dynamic' and/or a place that will have a failure at runtime. (dart:io/websocket_impl.dart, line 590, col 35)
-[warning] Unsafe implicit cast from 'List<dynamic>' to 'List<int>'. This usually indicates that type information was lost and resulted in 'dynamic' and/or a place that will have a failure at runtime. (dart:io/websocket_impl.dart, line 626, col 12)
-[warning] Unsafe implicit cast from 'num' to 'T'. This usually indicates that type information was lost and resulted in 'dynamic' and/or a place that will have a failure at runtime. (dart:math/rectangle.dart, line 158, col 22)
-[warning] Unsafe implicit cast from 'num' to 'T'. This usually indicates that type information was lost and resulted in 'dynamic' and/or a place that will have a failure at runtime. (dart:math/rectangle.dart, line 159, col 23)
-[warning] Unsafe implicit cast from 'num' to 'T'. This usually indicates that type information was lost and resulted in 'dynamic' and/or a place that will have a failure at runtime. (dart:math/rectangle.dart, line 282, col 10)
+[warning] Unsafe implicit cast from 'num' to 'T'. This usually indicates that type information was lost and resulted in 'dynamic' and/or a place that will have a failure at runtime. (dart:math/rectangle.dart, line 151, col 22)
+[warning] Unsafe implicit cast from 'num' to 'T'. This usually indicates that type information was lost and resulted in 'dynamic' and/or a place that will have a failure at runtime. (dart:math/rectangle.dart, line 152, col 23)
+[warning] Unsafe implicit cast from 'num' to 'T'. This usually indicates that type information was lost and resulted in 'dynamic' and/or a place that will have a failure at runtime. (dart:math/rectangle.dart, line 275, col 10)
[warning] The final variables 'href' and 'target' must be initialized. (dart:svg, line 60, col 3)
[warning] The final variables 'requiredExtensions', 'requiredFeatures' and '2' more must be initialized. (dart:svg, line 489, col 3)
[warning] The final variables 'cx', 'cy' and '1' more must be initialized. (dart:svg, line 562, col 3)
diff --git a/pkg/front_end/lib/src/fasta/analyzer/analyzer_compile.dart b/pkg/front_end/lib/src/fasta/analyzer/analyzer_compile.dart
new file mode 100644
index 0000000..dd90575
--- /dev/null
+++ b/pkg/front_end/lib/src/fasta/analyzer/analyzer_compile.dart
@@ -0,0 +1,63 @@
+// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
+// for 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 fasta.analyzer_compile;
+
+import 'dart:async' show Future;
+
+import 'dart:io' show exitCode;
+
+import '../compiler_command_line.dart' show CompilerCommandLine;
+
+import '../compiler_context.dart' show CompilerContext;
+
+import '../ticker.dart' show Ticker;
+
+import '../outline.dart' show CompileTask;
+
+import '../errors.dart' show InputError;
+
+import 'analyzer_target.dart' show AnalyzerTarget;
+
+import '../dill/dill_target.dart' show DillTarget;
+
+import '../translate_uri.dart' show TranslateUri;
+
+const int iterations = const int.fromEnvironment("iterations", defaultValue: 1);
+
+Future<Uri> compile(List<String> arguments) async {
+ try {
+ return await CompilerCommandLine.withGlobalOptions("kompile", arguments,
+ (CompilerContext c) async {
+ if (c.options.verbose) {
+ print("Compiling via analyzer: ${arguments.join(' ')}");
+ }
+ AnalyzerCompileTask task =
+ new AnalyzerCompileTask(c, new Ticker(isVerbose: c.options.verbose));
+ return await task.compile();
+ });
+ } on InputError catch (e) {
+ exitCode = 1;
+ print(e.format());
+ return null;
+ }
+}
+
+class AnalyzerCompileTask extends CompileTask {
+ AnalyzerCompileTask(CompilerContext c, Ticker ticker) : super(c, ticker);
+
+ AnalyzerTarget createKernelTarget(
+ DillTarget dillTarget, TranslateUri uriTranslator) {
+ return new AnalyzerTarget(dillTarget, uriTranslator, c.uriToSource);
+ }
+}
+
+mainEntryPoint(List<String> arguments) async {
+ for (int i = 0; i < iterations; i++) {
+ if (i > 0) {
+ print("\n");
+ }
+ await compile(arguments);
+ }
+}
diff --git a/pkg/front_end/lib/src/fasta/analyzer/analyzer_diet_listener.dart b/pkg/front_end/lib/src/fasta/analyzer/analyzer_diet_listener.dart
new file mode 100644
index 0000000..f907b47
--- /dev/null
+++ b/pkg/front_end/lib/src/fasta/analyzer/analyzer_diet_listener.dart
@@ -0,0 +1,37 @@
+// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
+// for 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 fasta.analyzer_diet_listener;
+
+import 'package:kernel/ast.dart' show AsyncMarker;
+
+import '../source/stack_listener.dart' show StackListener;
+
+import '../builder/builder.dart';
+
+import '../builder/scope.dart' show Scope;
+
+import '../source/source_library_builder.dart' show SourceLibraryBuilder;
+
+import '../source/diet_listener.dart' show DietListener;
+
+import 'element_store.dart' show ElementStore;
+
+import 'ast_builder.dart' show AstBuilder;
+
+class AnalyzerDietListener extends DietListener {
+ final ElementStore elementStore;
+
+ AnalyzerDietListener(SourceLibraryBuilder library, this.elementStore)
+ : super(library, null, null);
+
+ StackListener createListener(
+ MemberBuilder builder, Scope memberScope, bool isInstanceMember,
+ [Scope formalParameterScope]) {
+ return new AstBuilder(library, builder, elementStore, memberScope, uri);
+ }
+
+ @override
+ AsyncMarker getAsyncMarker(StackListener listener) => null;
+}
diff --git a/pkg/front_end/lib/src/fasta/analyzer/analyzer_loader.dart b/pkg/front_end/lib/src/fasta/analyzer/analyzer_loader.dart
new file mode 100644
index 0000000..6cacc9e
--- /dev/null
+++ b/pkg/front_end/lib/src/fasta/analyzer/analyzer_loader.dart
@@ -0,0 +1,34 @@
+// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
+// for 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 fasta.analyzer_loader;
+
+import 'package:kernel/ast.dart' show Program;
+
+import '../builder/builder.dart' show LibraryBuilder;
+
+import '../target_implementation.dart' show TargetImplementation;
+
+import '../source/source_loader.dart' show SourceLoader;
+
+import 'element_store.dart' show ElementStore;
+
+import 'analyzer_diet_listener.dart' show AnalyzerDietListener;
+
+class AnalyzerLoader<L> extends SourceLoader<L> {
+ ElementStore elementStore;
+
+ AnalyzerLoader(TargetImplementation target) : super(target);
+
+ @override
+ void computeHierarchy(Program program) {
+ elementStore = new ElementStore(coreLibrary, builders);
+ ticker.logMs("Built analyzer element model.");
+ }
+
+ @override
+ AnalyzerDietListener createDietListener(LibraryBuilder library) {
+ return new AnalyzerDietListener(library, elementStore);
+ }
+}
diff --git a/pkg/front_end/lib/src/fasta/analyzer/analyzer_target.dart b/pkg/front_end/lib/src/fasta/analyzer/analyzer_target.dart
new file mode 100644
index 0000000..0562dfe
--- /dev/null
+++ b/pkg/front_end/lib/src/fasta/analyzer/analyzer_target.dart
@@ -0,0 +1,24 @@
+// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
+// for 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 fasta.analyzer_target;
+
+import 'package:kernel/ast.dart' show Library, Source;
+
+import '../kernel/kernel_target.dart' show KernelTarget;
+
+import '../translate_uri.dart' show TranslateUri;
+
+import '../dill/dill_target.dart' show DillTarget;
+
+import 'analyzer_loader.dart' show AnalyzerLoader;
+
+class AnalyzerTarget extends KernelTarget {
+ AnalyzerTarget(DillTarget dillTarget, TranslateUri uriTranslator,
+ [Map<String, Source> uriToSource])
+ : super(dillTarget, uriTranslator, uriToSource);
+
+ @override
+ AnalyzerLoader<Library> createLoader() => new AnalyzerLoader<Library>(this);
+}
diff --git a/pkg/front_end/lib/src/fasta/analyzer/ast_builder.dart b/pkg/front_end/lib/src/fasta/analyzer/ast_builder.dart
index fb2421a..c2d1c67 100644
--- a/pkg/front_end/lib/src/fasta/analyzer/ast_builder.dart
+++ b/pkg/front_end/lib/src/fasta/analyzer/ast_builder.dart
@@ -9,18 +9,14 @@
import 'package:analyzer/dart/ast/standard_ast_factory.dart' as standard;
import 'package:analyzer/dart/ast/token.dart' as analyzer show Token;
import 'package:analyzer/dart/element/element.dart' show Element;
-import 'package:front_end/src/fasta/parser/parser.dart'
- show FormalParameterType;
-import 'package:front_end/src/fasta/scanner/token.dart'
- show BeginGroupToken, Token;
-import 'package:kernel/ast.dart' show AsyncMarker;
+import '../parser/parser.dart' show FormalParameterType;
+import '../scanner/token.dart' show BeginGroupToken, Token;
import '../errors.dart' show internalError;
import '../kernel/kernel_builder.dart'
show Builder, KernelLibraryBuilder, ProcedureBuilder;
import '../parser/identifier_context.dart' show IdentifierContext;
import '../quote.dart';
-import '../source/outline_builder.dart' show asyncMarkerFromTokens;
import '../source/scope_listener.dart'
show JumpTargetKind, NullValue, Scope, ScopeListener;
import 'analyzer.dart' show toKernel;
@@ -44,11 +40,6 @@
@override
final Uri uri;
- /// If `true`, the first call to [handleIdentifier] should push a
- /// List<SimpleIdentifier> on the stack, and [handleQualified] should append
- /// to the list.
- var accumulateIdentifierComponents = false;
-
/// The name of the class currently being parsed, or `null` if no class is
/// being parsed.
String className;
@@ -68,6 +59,40 @@
push(token);
}
+ @override
+ void handleNoConstructorReferenceContinuationAfterTypeArguments(Token token) {
+ debugEvent("NoConstructorReferenceContinuationAfterTypeArguments");
+ push(NullValue.ConstructorReferenceContinuationAfterTypeArguments);
+ }
+
+ @override
+ void endConstructorReference(
+ Token start, Token periodBeforeName, Token endToken) {
+ debugEvent("ConstructorReference");
+ SimpleIdentifier constructorName = pop();
+ TypeArgumentList typeArguments = pop();
+ Identifier typeNameIdentifier = pop();
+ push(ast.constructorName(ast.typeName(typeNameIdentifier, typeArguments),
+ toAnalyzerToken(periodBeforeName), constructorName));
+ }
+
+ @override
+ void handleNewExpression(Token token) {
+ debugEvent("NewExpression");
+ MethodInvocation arguments = pop();
+ ConstructorName constructorName = pop();
+ push(ast.instanceCreationExpression(
+ toAnalyzerToken(token), constructorName, arguments.argumentList));
+ }
+
+ @override
+ void handleParenthesizedExpression(BeginGroupToken token) {
+ debugEvent("ParenthesizedExpression");
+ Expression expression = pop();
+ push(ast.parenthesizedExpression(
+ toAnalyzerToken(token), expression, toAnalyzerToken(token.endGroup)));
+ }
+
void handleStringPart(Token token) {
debugEvent("StringPart");
push(token);
@@ -159,22 +184,24 @@
MethodInvocation arguments = pop();
TypeArgumentList typeArguments = pop();
if (arguments != null) {
- if (typeArguments != null) {
- arguments.typeArguments = typeArguments;
- }
- doInvocation(token, arguments);
+ doInvocation(token, typeArguments, arguments);
} else {
doPropertyGet(token);
}
}
- void doInvocation(Token token, MethodInvocation arguments) {
+ void doInvocation(
+ Token token, TypeArgumentList typeArguments, MethodInvocation arguments) {
Expression receiver = pop();
if (receiver is SimpleIdentifier) {
arguments.methodName = receiver;
+ if (typeArguments != null) {
+ arguments.typeArguments = typeArguments;
+ }
push(arguments);
} else {
- internalError("Unhandled receiver in send: ${receiver.runtimeType}");
+ push(ast.functionExpressionInvocation(
+ receiver, typeArguments, arguments.argumentList));
}
}
@@ -191,13 +218,22 @@
if (beginToken != null) {
exitLocalScope();
}
- push(ast.block(
- toAnalyzerToken(beginToken), statements, toAnalyzerToken(endToken)));
+ Block block = ast.block(
+ toAnalyzerToken(beginToken), statements, toAnalyzerToken(endToken));
+ analyzer.Token star = pop();
+ analyzer.Token asyncKeyword = pop();
+ push(ast.blockFunctionBody(asyncKeyword, star, block));
}
- void finishFunction(formals, asyncModifier, Statement body) {
+ void finishFunction(formals, asyncModifier, FunctionBody body) {
debugEvent("finishFunction");
- var kernel = toKernel(body, elementStore, library.library, scope);
+ Statement bodyStatement;
+ if (body is ExpressionFunctionBody) {
+ bodyStatement = ast.returnStatement(null, body.expression, null);
+ } else {
+ bodyStatement = (body as BlockFunctionBody).block;
+ }
+ var kernel = toKernel(bodyStatement, elementStore, library.library, scope);
if (member is ProcedureBuilder) {
ProcedureBuilder builder = member;
builder.body = kernel;
@@ -230,6 +266,7 @@
void handleBinaryExpression(Token token) {
debugEvent("BinaryExpression");
if (identical(".", token.stringValue) ||
+ identical("?.", token.stringValue) ||
identical("..", token.stringValue)) {
doDotExpression(token);
} else {
@@ -243,8 +280,13 @@
Expression identifierOrInvoke = pop();
Expression receiver = pop();
if (identifierOrInvoke is SimpleIdentifier) {
- push(ast.propertyAccess(
- receiver, toAnalyzerToken(token), identifierOrInvoke));
+ if (receiver is SimpleIdentifier && identical('.', token.stringValue)) {
+ push(ast.prefixedIdentifier(
+ receiver, toAnalyzerToken(token), identifierOrInvoke));
+ } else {
+ push(ast.propertyAccess(
+ receiver, toAnalyzerToken(token), identifierOrInvoke));
+ }
} else if (identifierOrInvoke is MethodInvocation) {
assert(identifierOrInvoke.target == null);
identifierOrInvoke
@@ -262,6 +304,16 @@
push(ast.integerLiteral(toAnalyzerToken(token), int.parse(token.value)));
}
+ void endExpressionFunctionBody(Token arrowToken, Token endToken) {
+ debugEvent("ExpressionFunctionBody");
+ Expression expression = pop();
+ analyzer.Token star = pop();
+ analyzer.Token asyncKeyword = pop();
+ assert(star == null);
+ push(ast.expressionFunctionBody(asyncKeyword, toAnalyzerToken(arrowToken),
+ expression, toAnalyzerToken(endToken)));
+ }
+
void endReturnStatement(
bool hasExpression, Token beginToken, Token endToken) {
debugEvent("ReturnStatement");
@@ -337,7 +389,7 @@
debugEvent("VariablesDeclaration");
List<VariableDeclaration> variables = popList(count);
TypeName type = pop();
- pop(); // Modifiers.
+ pop(); // TODO(paulberry): Modifiers.
push(ast.variableDeclarationStatement(
ast.variableDeclarationList(null, null, null, type, variables),
toAnalyzerToken(endToken)));
@@ -393,7 +445,8 @@
void handleAsyncModifier(Token asyncToken, Token starToken) {
debugEvent("AsyncModifier");
- push(asyncMarkerFromTokens(asyncToken, starToken));
+ push(toAnalyzerToken(asyncToken) ?? NullValue.FunctionBodyAsyncToken);
+ push(toAnalyzerToken(starToken) ?? NullValue.FunctionBodyStarToken);
}
void endAwaitExpression(Token beginToken, Token endToken) {
@@ -444,6 +497,18 @@
push(ast.symbolLiteral(toAnalyzerToken(hashToken), components));
}
+ @override
+ void handleSuperExpression(Token token) {
+ debugEvent("SuperExpression");
+ push(ast.superExpression(toAnalyzerToken(token)));
+ }
+
+ @override
+ void handleThisExpression(Token token) {
+ debugEvent("ThisExpression");
+ push(ast.thisExpression(toAnalyzerToken(token)));
+ }
+
void handleType(Token beginToken, Token endToken) {
debugEvent("Type");
TypeArgumentList arguments = pop();
@@ -516,7 +581,8 @@
} else {
name = nameOrFunctionTypedParameter;
TypeName type = pop();
- Token keyword = _popOptionalSingleModifier();
+ _Modifiers modifiers = pop();
+ Token keyword = modifiers?.finalConstOrVarKeyword;
pop(); // TODO(paulberry): Metadata.
if (thisKeyword == null) {
node = ast.simpleFormalParameter2(
@@ -559,8 +625,8 @@
TypeName returnType = pop();
{
- List<Token> modifiers = pop();
- if (modifiers.isNotEmpty) {
+ _Modifiers modifiers = pop();
+ if (modifiers != null) {
// TODO(scheglov): Report error.
internalError('Unexpected modifier. Report an error.');
}
@@ -709,26 +775,10 @@
void handleModifiers(int count) {
debugEvent("Modifiers");
- push(popList(count) ?? const <Token>[]);
- }
-
- FunctionBody _endFunctionBody() {
- AstNode body = pop();
- // TODO(paulberry): asyncMarker should have a type that allows constructing
- // the necessary analyzer AST data structures.
- AsyncMarker asyncMarker = pop();
- assert(asyncMarker == AsyncMarker.Sync);
- analyzer.Token asyncKeyword = null;
- analyzer.Token star = null;
- if (body is Block) {
- return ast.blockFunctionBody(asyncKeyword, star, body);
- } else if (body is ReturnStatement) {
- assert(star == null);
- return ast.expressionFunctionBody(
- asyncKeyword, body.returnKeyword, body.expression, body.semicolon);
+ if (count == 0) {
+ push(NullValue.Modifiers);
} else {
- return internalError(
- 'Unexpected function body type: ${body.runtimeType}');
+ push(new _Modifiers(popList(count)));
}
}
@@ -736,13 +786,14 @@
// TODO(paulberry): set up scopes properly to resolve parameters and type
// variables.
debugEvent("TopLevelMethod");
- FunctionBody body = _endFunctionBody();
+ FunctionBody body = pop();
FormalParameterList parameters = pop();
TypeParameterList typeParameters = pop();
SimpleIdentifier name = pop();
analyzer.Token propertyKeyword = toAnalyzerToken(getOrSet);
TypeAnnotation returnType = pop();
- Token externalKeyword = _popOptionalSingleModifier();
+ _Modifiers modifiers = pop();
+ Token externalKeyword = modifiers?.externalKeyword;
List<Annotation> metadata = pop();
// TODO(paulberry): capture doc comments. See dartbug.com/28851.
Comment comment = null;
@@ -929,7 +980,8 @@
SimpleIdentifier name = pop();
assert(className == name.name);
className = null;
- Token abstractKeyword = _popOptionalSingleModifier();
+ _Modifiers modifiers = pop();
+ Token abstractKeyword = modifiers?.abstractKeyword;
List<Annotation> metadata = pop();
// TODO(paulberry): capture doc comments. See dartbug.com/28851.
Comment comment = null;
@@ -977,7 +1029,8 @@
analyzer.Token equals = toAnalyzerToken(equalsToken);
TypeParameterList typeParameters = pop();
SimpleIdentifier name = pop();
- Token abstractKeyword = _popOptionalSingleModifier();
+ _Modifiers modifiers = pop();
+ Token abstractKeyword = modifiers?.abstractKeyword;
List<Annotation> metadata = pop();
// TODO(paulberry): capture doc comments. See dartbug.com/28851.
Comment comment = null;
@@ -1058,7 +1111,7 @@
// in constructors, so the logic should be shared with BodyBuilder as much
// as possible.
debugEvent("UnnamedFunction");
- var body = _endFunctionBody();
+ FunctionBody body = pop();
FormalParameterList parameters = pop();
TypeParameterList typeParameters = pop();
push(ast.functionExpression(typeParameters, parameters, body));
@@ -1083,7 +1136,8 @@
debugEvent("TopLevelFields");
List<VariableDeclaration> variables = popList(count);
TypeAnnotation type = pop();
- Token keyword = _popOptionalSingleModifier();
+ _Modifiers modifiers = pop();
+ Token keyword = modifiers?.finalConstOrVarKeyword;
var variableList = ast.variableDeclarationList(
null, null, toAnalyzerToken(keyword), type, variables);
List<Annotation> metadata = pop();
@@ -1120,61 +1174,64 @@
@override
void endMethod(Token getOrSet, Token beginToken, Token endToken) {
debugEvent("Method");
- FunctionBody body = _endFunctionBody();
+ FunctionBody body = pop();
ConstructorName redirectedConstructor = null; // TODO(paulberry)
List<ConstructorInitializer> initializers = null; // TODO(paulberry)
Token separator = null; // TODO(paulberry)
FormalParameterList parameters = pop();
- /* TypeParameterList typeParameters = */ pop(); // TODO(paulberry)
+ TypeParameterList typeParameters = pop(); // TODO(paulberry)
var name = pop();
- // TODO(paulberry)
- // analyzer.Token propertyKeyword = toAnalyzerToken(getOrSet);
- /* TypeAnnotation returnType = */ pop(); // TODO(paulberry)
-
- Token externalKeyword = null;
- Token constKeyword = null;
- Token factoryKeyword = null;
- List<Token> modifiers = pop();
- for (Token modifier in modifiers) {
- String value = modifier.stringValue;
- if (identical('external', value)) {
- // TODO(scheglov): Check the order and uniqueness.
- externalKeyword = modifier;
- } else if (identical('const', value)) {
- // TODO(scheglov): Check the order and uniqueness.
- constKeyword = modifier;
- } else if (identical('factory', value)) {
- // TODO(scheglov): Check the order and uniqueness.
- factoryKeyword = modifier;
- } else {
- // TODO(scheglov): Report error.
- internalError("Invalid modifier ($value). Report an error.");
- }
- }
-
+ TypeAnnotation returnType = pop(); // TODO(paulberry)
+ _Modifiers modifiers = pop();
List<Annotation> metadata = pop();
// TODO(paulberry): capture doc comments. See dartbug.com/28851.
Comment comment = null;
- SimpleIdentifier returnType2;
Token period;
- SimpleIdentifier name2;
- if (name is SimpleIdentifier) {
- returnType2 = name;
+ void unnamedConstructor(
+ SimpleIdentifier returnType, SimpleIdentifier name) {
+ push(ast.constructorDeclaration(
+ comment,
+ metadata,
+ toAnalyzerToken(modifiers?.externalKeyword),
+ toAnalyzerToken(modifiers?.finalConstOrVarKeyword),
+ null, // TODO(paulberry): factoryKeyword
+ returnType,
+ toAnalyzerToken(period),
+ name,
+ parameters,
+ toAnalyzerToken(separator),
+ initializers,
+ redirectedConstructor,
+ body));
}
- push(ast.constructorDeclaration(
- comment,
- metadata,
- toAnalyzerToken(externalKeyword),
- toAnalyzerToken(constKeyword),
- toAnalyzerToken(factoryKeyword),
- returnType2,
- toAnalyzerToken(period),
- name2,
- parameters,
- toAnalyzerToken(separator),
- initializers,
- redirectedConstructor,
- body));
+
+ void method(Token operatorKeyword, SimpleIdentifier name) {
+ push(ast.methodDeclaration(
+ comment,
+ metadata,
+ toAnalyzerToken(modifiers?.externalKeyword),
+ toAnalyzerToken(
+ modifiers?.abstractKeyword ?? modifiers?.staticKeyword),
+ returnType,
+ toAnalyzerToken(getOrSet),
+ toAnalyzerToken(operatorKeyword),
+ name,
+ typeParameters,
+ parameters,
+ body));
+ }
+
+ if (name is SimpleIdentifier) {
+ if (name.name == className) {
+ unnamedConstructor(name, null);
+ } else {
+ method(null, name);
+ }
+ } else if (name is _OperatorName) {
+ method(name.operatorKeyword, name.name);
+ } else {
+ throw new UnimplementedError();
+ }
}
@override
@@ -1268,22 +1325,32 @@
toAnalyzerToken(beginToken), arguments, toAnalyzerToken(endToken)));
}
- /**
- * Pop the modifiers list, if the list is empty return `null`, if the list
- * has one item return it; otherwise return `null`.
- */
- Token _popOptionalSingleModifier() {
- List<Token> modifiers = pop();
- if (modifiers.length == 0) {
- return null;
- } else if (modifiers.length == 1) {
- // TODO(scheglov): Verify that the modifier is valid.
- return modifiers[0];
- } else {
- // TODO(scheglov): Report error.
- internalError("Invalid modifier. Report an error.");
- return null;
- }
+ @override
+ void endFields(
+ int count, Token covariantKeyword, Token beginToken, Token endToken) {
+ debugEvent("Fields");
+ List<VariableDeclaration> variables = popList(count);
+ TypeAnnotation type = pop();
+ _Modifiers modifiers = pop();
+ var variableList = ast.variableDeclarationList(null, null,
+ toAnalyzerToken(modifiers?.finalConstOrVarKeyword), type, variables);
+ List<Annotation> metadata = pop();
+ // TODO(paulberry): capture doc comments. See dartbug.com/28851.
+ Comment comment = null;
+ push(ast.fieldDeclaration2(
+ comment: comment,
+ metadata: metadata,
+ covariantKeyword: toAnalyzerToken(covariantKeyword),
+ staticKeyword: toAnalyzerToken(modifiers?.staticKeyword),
+ fieldList: variableList,
+ semicolon: toAnalyzerToken(endToken)));
+ }
+
+ @override
+ void handleOperatorName(Token operatorKeyword, Token token) {
+ debugEvent("OperatorName");
+ push(new _OperatorName(operatorKeyword,
+ ast.simpleIdentifier(toAnalyzerToken(token), isDeclaration: true)));
}
ParameterKind _toAnalyzerParameterKind(FormalParameterType type) {
@@ -1346,3 +1413,45 @@
_OptionalFormalParameters(
this.parameters, this.leftDelimiter, this.rightDelimiter);
}
+
+/// Data structure placed on the stack to represent the keyword "operator"
+/// followed by a token.
+class _OperatorName {
+ final Token operatorKeyword;
+ final SimpleIdentifier name;
+
+ _OperatorName(this.operatorKeyword, this.name);
+}
+
+/// Data structure placed on the stack to represent a non-empty sequence
+/// of modifiers.
+class _Modifiers {
+ Token abstractKeyword;
+ Token externalKeyword;
+ Token finalConstOrVarKeyword;
+ Token staticKeyword;
+
+ _Modifiers(List<Token> modifierTokens) {
+ // No need to check the order and uniqueness of the modifiers, or that
+ // disallowed modifiers are not used; the parser should do that.
+ // TODO(paulberry,ahe): implement the necessary logic in the parser.
+ for (var token in modifierTokens) {
+ var s = token.value;
+ if (identical('abstract', s)) {
+ abstractKeyword = token;
+ } else if (identical('const', s)) {
+ finalConstOrVarKeyword = token;
+ } else if (identical('external', s)) {
+ externalKeyword = token;
+ } else if (identical('final', s)) {
+ finalConstOrVarKeyword = token;
+ } else if (identical('static', s)) {
+ staticKeyword = token;
+ } else if (identical('var', s)) {
+ finalConstOrVarKeyword = token;
+ } else {
+ internalError('Unhandled modifier: $s');
+ }
+ }
+ }
+}
diff --git a/pkg/front_end/lib/src/fasta/compile_platform_dartk.dart b/pkg/front_end/lib/src/fasta/analyzer/compile_platform_dartk.dart
similarity index 96%
rename from pkg/front_end/lib/src/fasta/compile_platform_dartk.dart
rename to pkg/front_end/lib/src/fasta/analyzer/compile_platform_dartk.dart
index f494e05..2e7e2ca 100644
--- a/pkg/front_end/lib/src/fasta/compile_platform_dartk.dart
+++ b/pkg/front_end/lib/src/fasta/analyzer/compile_platform_dartk.dart
@@ -25,10 +25,10 @@
import 'package:kernel/ast.dart' show Program;
-import 'environment_variable.dart'
+import '../environment_variable.dart'
show EnvironmentVariableDirectory, fileExists;
-import 'errors.dart' show inputError;
+import '../errors.dart' show inputError;
const EnvironmentVariableSdk dartAotSdk = const EnvironmentVariableSdk(
"DART_AOT_SDK",
@@ -60,7 +60,7 @@
}
}
-main(List<String> arguments) async {
+mainEntryPoint(List<String> arguments) async {
Uri output = Uri.base.resolveUri(new Uri.file(arguments.single));
DartOptions options = new DartOptions(
strongMode: false, sdk: await dartAotSdk.value, packagePath: null);
diff --git a/pkg/front_end/lib/src/fasta/analyzer/token_utils.dart b/pkg/front_end/lib/src/fasta/analyzer/token_utils.dart
index 41481c7..4d7ccc2 100644
--- a/pkg/front_end/lib/src/fasta/analyzer/token_utils.dart
+++ b/pkg/front_end/lib/src/fasta/analyzer/token_utils.dart
@@ -4,20 +4,20 @@
library fasta.analyzer.token_utils;
-import 'package:front_end/src/fasta/parser/error_kind.dart' show ErrorKind;
+import '../parser/error_kind.dart' show ErrorKind;
-import 'package:front_end/src/fasta/scanner/error_token.dart' show ErrorToken;
+import '../scanner/error_token.dart' show ErrorToken;
-import 'package:front_end/src/fasta/scanner/keyword.dart' show Keyword;
+import '../scanner/keyword.dart' show Keyword;
-import 'package:front_end/src/fasta/scanner/precedence.dart';
+import '../scanner/precedence.dart';
-import 'package:front_end/src/fasta/scanner/token.dart'
+import '../scanner/token.dart'
show BeginGroupToken, KeywordToken, StringToken, SymbolToken, Token;
-import 'package:front_end/src/fasta/scanner/token_constants.dart';
+import '../scanner/token_constants.dart';
-import 'package:front_end/src/scanner/token.dart' as analyzer
+import '../../scanner/token.dart' as analyzer
show
BeginToken,
BeginTokenWithComment,
@@ -30,8 +30,7 @@
Token,
TokenWithComment;
-import 'package:front_end/src/scanner/errors.dart' as analyzer
- show ScannerErrorCode;
+import '../../scanner/errors.dart' as analyzer show ScannerErrorCode;
import 'package:analyzer/dart/ast/token.dart' show TokenType;
diff --git a/pkg/front_end/lib/src/fasta/ast_kind.dart b/pkg/front_end/lib/src/fasta/ast_kind.dart
deleted file mode 100644
index e636942..0000000
--- a/pkg/front_end/lib/src/fasta/ast_kind.dart
+++ /dev/null
@@ -1,10 +0,0 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
-// for 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 fasta.ast_kind;
-
-enum AstKind {
- Analyzer,
- Kernel,
-}
diff --git a/pkg/front_end/lib/src/fasta/bin/compile.dart b/pkg/front_end/lib/src/fasta/bin/compile.dart
deleted file mode 100644
index 65b2373..0000000
--- a/pkg/front_end/lib/src/fasta/bin/compile.dart
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'package:front_end/src/fasta/outline.dart' as outline;
-
-const int iterations = const int.fromEnvironment("iterations", defaultValue: 1);
-
-main(List<String> arguments) async {
- for (int i = 0; i < iterations; i++) {
- if (i > 0) {
- print("\n");
- }
- await outline.compile(arguments);
- }
-}
diff --git a/pkg/front_end/lib/src/fasta/bin/compile_platform.dart b/pkg/front_end/lib/src/fasta/bin/compile_platform.dart
deleted file mode 100644
index 93205c4..0000000
--- a/pkg/front_end/lib/src/fasta/bin/compile_platform.dart
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'package:front_end/src/fasta/compile_platform.dart' as compile_platform;
-
-const int iterations = const int.fromEnvironment("iterations", defaultValue: 1);
-
-main(List<String> arguments) async {
- for (int i = 0; i < iterations; i++) {
- if (i > 0) {
- print("\n");
- }
- await compile_platform.main(arguments);
- }
-}
diff --git a/pkg/front_end/lib/src/fasta/bin/kompile.dart b/pkg/front_end/lib/src/fasta/bin/kompile.dart
deleted file mode 100644
index 96e09a6..0000000
--- a/pkg/front_end/lib/src/fasta/bin/kompile.dart
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'package:front_end/src/fasta/outline.dart' as outline;
-
-const int iterations = const int.fromEnvironment("iterations", defaultValue: 1);
-
-main(List<String> arguments) async {
- for (int i = 0; i < iterations; i++) {
- if (i > 0) {
- print("\n");
- }
- await outline.kompile(arguments);
- }
-}
diff --git a/pkg/front_end/lib/src/fasta/bin/outline.dart b/pkg/front_end/lib/src/fasta/bin/outline.dart
deleted file mode 100644
index faa54a7..0000000
--- a/pkg/front_end/lib/src/fasta/bin/outline.dart
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'package:front_end/src/fasta/outline.dart' as outline;
-
-const int iterations = const int.fromEnvironment("iterations", defaultValue: 1);
-
-main(List<String> arguments) async {
- for (int i = 0; i < iterations; i++) {
- if (i > 0) {
- print("\n");
- }
- await outline.outline(arguments);
- }
-}
diff --git a/pkg/front_end/lib/src/fasta/bin/run.dart b/pkg/front_end/lib/src/fasta/bin/run.dart
deleted file mode 100644
index 501a26b..0000000
--- a/pkg/front_end/lib/src/fasta/bin/run.dart
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'dart:io' show exit, exitCode;
-
-import 'package:front_end/src/fasta/ast_kind.dart' show AstKind;
-
-import 'package:front_end/src/fasta/compiler_command_line.dart'
- show CompilerCommandLine;
-
-import 'package:front_end/src/fasta/compiler_context.dart' show CompilerContext;
-
-import 'package:front_end/src/fasta/outline.dart' show doCompile;
-
-import 'package:front_end/src/fasta/errors.dart' show InputError;
-
-import 'package:front_end/src/fasta/run.dart' show run;
-
-import 'package:front_end/src/fasta/ticker.dart' show Ticker;
-
-const int iterations = const int.fromEnvironment("iterations", defaultValue: 1);
-
-main(List<String> arguments) async {
- Uri uri;
- for (int i = 0; i < iterations; i++) {
- await CompilerCommandLine.withGlobalOptions("run", arguments,
- (CompilerContext c) async {
- if (i > 0) {
- print("\n");
- }
- try {
- uri = await doCompile(
- c, new Ticker(isVerbose: c.options.verbose), AstKind.Kernel);
- } on InputError catch (e) {
- print(e.format());
- exit(1);
- }
- if (exitCode != 0) exit(exitCode);
- if (i + 1 == iterations) {
- exit(await run(uri, c));
- }
- });
- }
-}
diff --git a/pkg/front_end/lib/src/fasta/builder/formal_parameter_builder.dart b/pkg/front_end/lib/src/fasta/builder/formal_parameter_builder.dart
index 7a7212b..af6ee41 100644
--- a/pkg/front_end/lib/src/fasta/builder/formal_parameter_builder.dart
+++ b/pkg/front_end/lib/src/fasta/builder/formal_parameter_builder.dart
@@ -4,8 +4,7 @@
library fasta.formal_parameter_builder;
-import 'package:front_end/src/fasta/parser/parser.dart'
- show FormalParameterType;
+import '../parser/parser.dart' show FormalParameterType;
import 'builder.dart'
show LibraryBuilder, MetadataBuilder, ModifierBuilder, TypeBuilder;
diff --git a/pkg/front_end/lib/src/fasta/builder/procedure_builder.dart b/pkg/front_end/lib/src/fasta/builder/procedure_builder.dart
index 64f19a7..fc62cee 100644
--- a/pkg/front_end/lib/src/fasta/builder/procedure_builder.dart
+++ b/pkg/front_end/lib/src/fasta/builder/procedure_builder.dart
@@ -69,7 +69,7 @@
if (formals == null) return parent;
Map<String, Builder> local = <String, Builder>{};
for (FormalParameterBuilder formal in formals) {
- if (!formal.hasThis) {
+ if (!isConstructor || !formal.hasThis) {
local[formal.name] = formal;
}
}
diff --git a/pkg/front_end/lib/src/fasta/builder/type_declaration_builder.dart b/pkg/front_end/lib/src/fasta/builder/type_declaration_builder.dart
index 2b14e59..e0cc771 100644
--- a/pkg/front_end/lib/src/fasta/builder/type_declaration_builder.dart
+++ b/pkg/front_end/lib/src/fasta/builder/type_declaration_builder.dart
@@ -23,7 +23,7 @@
final String relativeFileUri;
TypeDeclarationBuilder(
- this.metadata, this.modifiers, this.name, Builder parent, int charOffset,
+ this.metadata, this.modifiers, this.name, this.parent, int charOffset,
[Uri fileUri])
: fileUri = fileUri ?? parent?.fileUri,
relativeFileUri =
diff --git a/pkg/front_end/lib/src/fasta/compile_platform.dart b/pkg/front_end/lib/src/fasta/compile_platform.dart
index 6774aed..879d08d 100644
--- a/pkg/front_end/lib/src/fasta/compile_platform.dart
+++ b/pkg/front_end/lib/src/fasta/compile_platform.dart
@@ -24,23 +24,29 @@
import 'translate_uri.dart' show TranslateUri;
-import 'ast_kind.dart' show AstKind;
+const int iterations = const int.fromEnvironment("iterations", defaultValue: 1);
-Future main(List<String> arguments) async {
- Ticker ticker = new Ticker();
- try {
- await CompilerCommandLine.withGlobalOptions("compile_platform", arguments,
- (CompilerContext c) => compilePlatform(c, ticker));
- } on InputError catch (e) {
- exitCode = 1;
- print(e.format());
- return null;
+Future mainEntryPoint(List<String> arguments) async {
+ for (int i = 0; i < iterations; i++) {
+ if (i > 0) {
+ print("\n");
+ }
+ Ticker ticker = new Ticker();
+ try {
+ await CompilerCommandLine.withGlobalOptions("compile_platform", arguments,
+ (CompilerContext c) => compilePlatform(c, ticker));
+ } on InputError catch (e) {
+ exitCode = 1;
+ print(e.format());
+ return null;
+ }
}
}
Future compilePlatform(CompilerContext c, Ticker ticker) async {
ticker.isVerbose = c.options.verbose;
Uri output = Uri.base.resolveUri(new Uri.file(c.options.arguments[1]));
+ Uri deps = Uri.base.resolveUri(new Uri.file("${c.options.arguments[1]}.d"));
Uri patchedSdk = Uri.base.resolveUri(new Uri.file(c.options.arguments[0]));
ticker.logMs("Parsed arguments");
if (ticker.isVerbose) {
@@ -60,7 +66,6 @@
await kernelTarget.writeOutline(output);
if (exitCode != 0) return null;
- await kernelTarget.writeProgram(output, AstKind.Kernel);
if (c.options.dumpIr) {
kernelTarget.dumpIr();
}
@@ -76,4 +81,7 @@
}
}
}
+ if (exitCode != 0) return null;
+ await kernelTarget.writeProgram(output);
+ await kernelTarget.writeDepsFile(output, deps);
}
diff --git a/pkg/front_end/lib/src/fasta/compiler_command_line.dart b/pkg/front_end/lib/src/fasta/compiler_command_line.dart
index fedd733..5874bc3 100644
--- a/pkg/front_end/lib/src/fasta/compiler_command_line.dart
+++ b/pkg/front_end/lib/src/fasta/compiler_command_line.dart
@@ -139,7 +139,7 @@
const String allOptions = """
Supported options:
- -o <file>, --out=<file>
+ -o <file>, --output=<file>
Generate the output into <file>.
-h, /h, /?, --help
diff --git a/pkg/front_end/lib/src/fasta/dill/dill_loader.dart b/pkg/front_end/lib/src/fasta/dill/dill_loader.dart
index 4f1fd41..281bfff 100644
--- a/pkg/front_end/lib/src/fasta/dill/dill_loader.dart
+++ b/pkg/front_end/lib/src/fasta/dill/dill_loader.dart
@@ -37,7 +37,7 @@
builder.library.fields.forEach(builder.addMember);
}
- Future<Null> buildBody(DillLibraryBuilder builder, _) {
+ Future<Null> buildBody(DillLibraryBuilder builder) {
return buildOutline(builder);
}
diff --git a/pkg/front_end/lib/src/fasta/dill/dill_target.dart b/pkg/front_end/lib/src/fasta/dill/dill_target.dart
index 7114d5a..5bc79ab 100644
--- a/pkg/front_end/lib/src/fasta/dill/dill_target.dart
+++ b/pkg/front_end/lib/src/fasta/dill/dill_target.dart
@@ -18,8 +18,6 @@
import '../translate_uri.dart' show TranslateUri;
-import '../ast_kind.dart' show AstKind;
-
import '../kernel/kernel_builder.dart' show ClassBuilder, KernelClassBuilder;
import 'dill_library_builder.dart' show DillLibraryBuilder;
@@ -45,7 +43,7 @@
}
}
- Future<Null> writeProgram(Uri uri, AstKind kind) {
+ Future<Null> writeProgram(Uri uri) {
return internalError("not implemented.");
}
diff --git a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
index b1d82d8..e906a19 100644
--- a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
@@ -4,13 +4,11 @@
library fasta.body_builder;
-import 'package:front_end/src/fasta/parser/parser.dart'
- show FormalParameterType, optional;
+import '../parser/parser.dart' show FormalParameterType, optional;
-import 'package:front_end/src/fasta/parser/error_kind.dart' show ErrorKind;
+import '../parser/error_kind.dart' show ErrorKind;
-import 'package:front_end/src/fasta/parser/identifier_context.dart'
- show IdentifierContext;
+import '../parser/identifier_context.dart' show IdentifierContext;
import 'package:kernel/ast.dart';
@@ -24,7 +22,7 @@
import '../parser/dart_vm_native.dart' show skipNativeClause;
-import 'package:front_end/src/fasta/scanner/token.dart'
+import '../scanner/token.dart'
show BeginGroupToken, Token, isBinaryOperator, isMinusOperator;
import '../errors.dart' show internalError, printUnexpected;
@@ -295,7 +293,8 @@
}
@override
- void endFields(int count, Token beginToken, Token endToken) {
+ void endFields(
+ int count, Token covariantKeyword, Token beginToken, Token endToken) {
debugEvent("Fields");
doFields(count);
pop(); // Metadata.
@@ -841,6 +840,12 @@
}
@override
+ void endExpressionFunctionBody(Token arrowToken, Token endToken) {
+ debugEvent("ExpressionFunctionBody");
+ endReturnStatement(true, arrowToken, endToken);
+ }
+
+ @override
void endReturnStatement(
bool hasExpression, Token beginToken, Token endToken) {
debugEvent("ReturnStatement");
@@ -1316,7 +1321,7 @@
FormalParameterType kind = optional("{", beginToken)
? FormalParameterType.NAMED
: FormalParameterType.POSITIONAL;
- push(new OptionalFormals(kind, popList(count)));
+ push(new OptionalFormals(kind, popList(count) ?? []));
}
@override
@@ -1647,6 +1652,11 @@
List<DartType> typeArguments = pop();
var type = pop();
+ if (arguments == null) {
+ push(buildCompileTimeError("No arguments.", token.charOffset));
+ return;
+ }
+
if (typeArguments != null) {
assert(arguments.types.isEmpty);
arguments.types.addAll(typeArguments);
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_library_builder.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_library_builder.dart
index 22be183..fae44fc 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_library_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_library_builder.dart
@@ -201,6 +201,7 @@
void addFactoryMethod(
List<MetadataBuilder> metadata,
+ int modifiers,
ConstructorReferenceBuilder constructorName,
List<FormalParameterBuilder> formals,
AsyncMarker asyncModifier,
@@ -216,7 +217,7 @@
assert(constructorName.suffix == null);
KernelProcedureBuilder procedure = new KernelProcedureBuilder(
metadata,
- staticMask,
+ staticMask | modifiers,
null,
name,
<TypeVariableBuilder>[],
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart
index 1a1be1b..2ed1a8c 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart
@@ -41,6 +41,10 @@
import 'package:kernel/text/ast_to_text.dart' show Printer;
+import 'package:kernel/transformations/erasure.dart' show Erasure;
+
+import 'package:kernel/transformations/continuation.dart' as transformAsync;
+
import 'package:kernel/transformations/mixin_full_resolution.dart'
show MixinFullResolution;
@@ -57,8 +61,6 @@
import '../dill/dill_target.dart' show DillTarget;
-import '../ast_kind.dart' show AstKind;
-
import '../errors.dart'
show InputError, internalError, reportCrash, resetCrashReporting;
@@ -99,9 +101,11 @@
uriToSource = uriToSource ?? CompilerContext.current.uriToSource,
super(dillTarget.ticker, uriTranslator) {
resetCrashReporting();
- loader = new SourceLoader<Library>(this);
+ loader = createLoader();
}
+ SourceLoader<Library> createLoader() => new SourceLoader<Library>(this);
+
void addLineStarts(Uri uri, List<int> lineStarts) {
String fileUri = relativizeUri(uri);
uriToSource[fileUri] = new Source(lineStarts, fileUri);
@@ -205,24 +209,21 @@
: writeLinkedProgram(uri, program, isFullProgram: isFullProgram);
}
- Future<Program> writeProgram(Uri uri, AstKind astKind) async {
+ Future<Program> writeProgram(Uri uri) async {
if (loader.first == null) return null;
if (errors.isNotEmpty) {
return handleInputError(uri, null, isFullProgram: true);
}
try {
- if (astKind == AstKind.Analyzer) {
- loader.buildElementStore();
- } else {
- loader.computeHierarchy(program);
- }
- await loader.buildBodies(astKind);
+ loader.computeHierarchy(program);
+ await loader.buildBodies();
loader.finishStaticInvocations();
finishAllConstructors();
loader.finishNativeMethods();
transformMixinApplications();
// TODO(ahe): Don't call this from two different places.
setup_builtin_library.transformProgram(program);
+ otherTransformations();
errors.addAll(loader.collectCompileTimeErrors().map((e) => e.format()));
if (errors.isNotEmpty) {
return handleInputError(uri, null, isFullProgram: true);
@@ -260,6 +261,20 @@
}
}
+ Future writeDepsFile(Uri output, Uri depsFile) async {
+ if (loader.first == null) return null;
+ StringBuffer sb = new StringBuffer();
+ Uri base = depsFile.resolve(".");
+ sb.write(Uri.parse(relativizeUri(output, base: base)).toFilePath());
+ sb.write(":");
+ for (Uri dependency in loader.getDependencies()) {
+ sb.write(" ");
+ sb.write(Uri.parse(relativizeUri(dependency, base: base)).toFilePath());
+ }
+ sb.writeln();
+ await new File.fromUri(depsFile).writeAsString("$sb");
+ }
+
Program erroneousProgram(bool isFullProgram) {
Uri uri = loader.first?.uri ?? Uri.parse("error:error");
Uri fileUri = loader.first?.fileUri ?? uri;
@@ -293,12 +308,8 @@
/// Creates a program by combining [libraries] with the libraries of
/// `dillTarget.loader.program`.
Program link(List<Library> libraries) {
- Map<String, Source> uriToSource = <String, Source>{};
-
- // for (Library library in libraries) {
- // // TODO(ahe): Compute line starts instead.
- // uriToLineStarts[library.fileUri] = <int>[0];
- // }
+ Map<String, Source> uriToSource =
+ new Map<String, Source>.from(this.uriToSource);
final Program binary = dillTarget.loader.program;
if (binary != null) {
@@ -553,6 +564,15 @@
ticker.logMs("Transformed mixin applications");
}
+ void otherTransformations() {
+ // TODO(ahe): Don't generate type variables in the first place.
+ program.accept(new Erasure());
+ ticker.logMs("Erased type variables in generic methods");
+ // TODO(kmillikin): Make this run on a per-method basis.
+ transformAsync.transformProgram(program);
+ ticker.logMs("Transformed async methods");
+ }
+
void dumpIr() {
StringBuffer sb = new StringBuffer();
for (Library library in loader.libraries) {
diff --git a/pkg/front_end/lib/src/fasta/kernel/verifier.dart b/pkg/front_end/lib/src/fasta/kernel/verifier.dart
index a38a15d..b1bab55 100644
--- a/pkg/front_end/lib/src/fasta/kernel/verifier.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/verifier.dart
@@ -4,22 +4,54 @@
library fasta.verifier;
-import 'package:kernel/ast.dart' show ExpressionStatement, Program;
+import 'package:kernel/ast.dart'
+ show
+ InvalidExpression,
+ InvalidStatement,
+ InvalidInitializer,
+ Class,
+ ExpressionStatement,
+ Field,
+ Library,
+ Procedure,
+ Program,
+ TreeNode;
-import 'package:kernel/verifier.dart' show VerifyingVisitor;
+import 'package:kernel/verifier.dart' show VerificationError, VerifyingVisitor;
+
+import '../errors.dart' show printUnexpected;
import 'redirecting_factory_body.dart' show RedirectingFactoryBody;
void verifyProgram(Program program, {bool isOutline: false}) {
- program.accept(new FastaVerifyingVisitor(isOutline));
+ FastaVerifyingVisitor verifier = new FastaVerifyingVisitor(isOutline);
+ program.accept(verifier);
+ if (verifier.errors.isNotEmpty) {
+ throw verifier.errors.first;
+ }
}
class FastaVerifyingVisitor extends VerifyingVisitor {
+ final List<VerificationError> errors = <VerificationError>[];
+
+ String fileUri;
+
FastaVerifyingVisitor(bool isOutline) {
this.isOutline = isOutline;
}
@override
+ problem(TreeNode node, String details) {
+ // TODO(karlklose): Remove this when underlying problem is fixed.
+ if (details.startsWith("Type parameter 'dart.collection::MapView::")) {
+ return;
+ }
+ VerificationError error = new VerificationError(context, node, details);
+ printUnexpected(Uri.parse(fileUri), node.fileOffset, "$error");
+ errors.add(error);
+ }
+
+ @override
visitExpressionStatement(ExpressionStatement node) {
// Bypass verification of the [StaticGet] in [RedirectingFactoryBody] as
// this is a static get without a getter.
@@ -27,4 +59,43 @@
super.visitExpressionStatement(node);
}
}
+
+ @override
+ visitLibrary(Library node) {
+ fileUri = node.fileUri;
+ super.visitLibrary(node);
+ }
+
+ @override
+ visitClass(Class node) {
+ fileUri = node.fileUri;
+ super.visitClass(node);
+ }
+
+ @override
+ visitField(Field node) {
+ fileUri = node.fileUri;
+ super.visitField(node);
+ }
+
+ @override
+ visitProcedure(Procedure node) {
+ fileUri = node.fileUri;
+ super.visitProcedure(node);
+ }
+
+ @override
+ visitInvalidExpression(InvalidExpression node) {
+ problem(node, "Invalid expression.");
+ }
+
+ @override
+ visitInvalidStatement(InvalidStatement node) {
+ problem(node, "Invalid statement.");
+ }
+
+ @override
+ visitInvalidInitializer(InvalidInitializer node) {
+ problem(node, "Invalid initializer.");
+ }
}
diff --git a/pkg/front_end/lib/src/fasta/loader.dart b/pkg/front_end/lib/src/fasta/loader.dart
index 14a8b0c..0af3e1f 100644
--- a/pkg/front_end/lib/src/fasta/loader.dart
+++ b/pkg/front_end/lib/src/fasta/loader.dart
@@ -8,8 +8,6 @@
import 'dart:collection' show Queue;
-import 'ast_kind.dart' show AstKind;
-
import 'builder/builder.dart' show Builder, LibraryBuilder;
import 'errors.dart' show InputError, firstSourceUri;
@@ -81,11 +79,11 @@
}
}
- Future<Null> buildBodies(AstKind astKind) async {
+ Future<Null> buildBodies() async {
assert(coreLibrary != null);
for (LibraryBuilder library in builders.values) {
currentUriForCrashReporting = library.uri;
- await buildBody(library, astKind);
+ await buildBody(library);
}
currentUriForCrashReporting = null;
ticker.log((Duration elapsed, Duration sinceStart) {
@@ -126,10 +124,7 @@
Future<Null> buildOutline(covariant LibraryBuilder library);
/// Builds all the method bodies found in the given [library].
- ///
- /// [astKind] determines whether or not analyzer ASTs are used as an
- /// intermediate data structure.
- Future<Null> buildBody(covariant LibraryBuilder library, AstKind astKind);
+ Future<Null> buildBody(covariant LibraryBuilder library);
List<InputError> collectCompileTimeErrors() {
List<InputError> errors = <InputError>[];
diff --git a/pkg/front_end/lib/src/fasta/outline.dart b/pkg/front_end/lib/src/fasta/outline.dart
index 128afb7..0604a26 100644
--- a/pkg/front_end/lib/src/fasta/outline.dart
+++ b/pkg/front_end/lib/src/fasta/outline.dart
@@ -24,7 +24,25 @@
import 'translate_uri.dart' show TranslateUri;
-import 'ast_kind.dart' show AstKind;
+const int iterations = const int.fromEnvironment("iterations", defaultValue: 1);
+
+compileEntryPoint(List<String> arguments) async {
+ for (int i = 0; i < iterations; i++) {
+ if (i > 0) {
+ print("\n");
+ }
+ await compile(arguments);
+ }
+}
+
+outlineEntryPoint(List<String> arguments) async {
+ for (int i = 0; i < iterations; i++) {
+ if (i > 0) {
+ print("\n");
+ }
+ await outline(arguments);
+ }
+}
Future<KernelTarget> outline(List<String> arguments) async {
try {
@@ -33,8 +51,9 @@
if (c.options.verbose) {
print("Building outlines for ${arguments.join(' ')}");
}
- return await doOutline(
- c, new Ticker(isVerbose: c.options.verbose), c.options.output);
+ CompileTask task =
+ new CompileTask(c, new Ticker(isVerbose: c.options.verbose));
+ return await task.buildOutline(c.options.output);
});
} on InputError catch (e) {
exitCode = 1;
@@ -50,8 +69,9 @@
if (c.options.verbose) {
print("Compiling directly to Kernel: ${arguments.join(' ')}");
}
- return await doCompile(
- c, new Ticker(isVerbose: c.options.verbose), AstKind.Kernel);
+ CompileTask task =
+ new CompileTask(c, new Ticker(isVerbose: c.options.verbose));
+ return await task.compile();
});
} on InputError catch (e) {
exitCode = 1;
@@ -60,69 +80,62 @@
}
}
-Future<Uri> kompile(List<String> arguments) async {
- try {
- return await CompilerCommandLine.withGlobalOptions("kompile", arguments,
- (CompilerContext c) async {
- if (c.options.verbose) {
- print("Compiling via analyzer: ${arguments.join(' ')}");
- }
- return await doCompile(
- c, new Ticker(isVerbose: c.options.verbose), AstKind.Analyzer);
- });
- } on InputError catch (e) {
- exitCode = 1;
- print(e.format());
- return null;
- }
-}
+class CompileTask {
+ final CompilerContext c;
+ final Ticker ticker;
-Future<KernelTarget> doOutline(CompilerContext c, Ticker ticker,
- [Uri output]) async {
- TranslateUri uriTranslator = await TranslateUri.parse(c.options.sdk);
- ticker.logMs("Read packages file");
- DillTarget dillTarget = new DillTarget(ticker, uriTranslator);
- KernelTarget kernelTarget =
- new KernelTarget(dillTarget, uriTranslator, c.uriToSource);
- Uri platform = c.options.platform;
- if (platform != null) {
- dillTarget.read(platform);
- }
- String argument = c.options.arguments.first;
- Uri uri = Uri.base.resolve(argument);
- String path = uriTranslator.translate(uri)?.path ?? argument;
- if (path.endsWith(".dart")) {
- kernelTarget.read(uri);
- } else {
- inputError(uri, -1, "Unexpected input: $uri");
- }
- await dillTarget.writeOutline(null);
- await kernelTarget.writeOutline(output);
- if (c.options.dumpIr && output != null) {
- kernelTarget.dumpIr();
- }
- return kernelTarget;
-}
+ CompileTask(this.c, this.ticker);
-Future<Uri> doCompile(CompilerContext c, Ticker ticker, AstKind kind) async {
- KernelTarget kernelTarget = await doOutline(c, ticker);
- if (exitCode != 0) return null;
- Uri uri = c.options.output;
- await kernelTarget.writeProgram(uri, kind);
- if (c.options.dumpIr) {
- kernelTarget.dumpIr();
+ KernelTarget createKernelTarget(
+ DillTarget dillTarget, TranslateUri uriTranslator) {
+ return new KernelTarget(dillTarget, uriTranslator, c.uriToSource);
}
- if (c.options.verify) {
- try {
- verifyProgram(kernelTarget.program);
- ticker.logMs("Verified program");
- } catch (e, s) {
- exitCode = 1;
- print("Verification of program failed: $e");
- if (s != null && c.options.verbose) {
- print(s);
+
+ Future<KernelTarget> buildOutline([Uri output]) async {
+ TranslateUri uriTranslator = await TranslateUri.parse(c.options.sdk);
+ ticker.logMs("Read packages file");
+ DillTarget dillTarget = new DillTarget(ticker, uriTranslator);
+ KernelTarget kernelTarget = createKernelTarget(dillTarget, uriTranslator);
+ Uri platform = c.options.platform;
+ if (platform != null) {
+ dillTarget.read(platform);
+ }
+ String argument = c.options.arguments.first;
+ Uri uri = Uri.base.resolve(argument);
+ String path = uriTranslator.translate(uri)?.path ?? argument;
+ if (path.endsWith(".dart")) {
+ kernelTarget.read(uri);
+ } else {
+ inputError(uri, -1, "Unexpected input: $uri");
+ }
+ await dillTarget.writeOutline(null);
+ await kernelTarget.writeOutline(output);
+ if (c.options.dumpIr && output != null) {
+ kernelTarget.dumpIr();
+ }
+ return kernelTarget;
+ }
+
+ Future<Uri> compile() async {
+ KernelTarget kernelTarget = await buildOutline();
+ if (exitCode != 0) return null;
+ Uri uri = c.options.output;
+ await kernelTarget.writeProgram(uri);
+ if (c.options.dumpIr) {
+ kernelTarget.dumpIr();
+ }
+ if (c.options.verify) {
+ try {
+ verifyProgram(kernelTarget.program);
+ ticker.logMs("Verified program");
+ } catch (e, s) {
+ exitCode = 1;
+ print("Verification of program failed: $e");
+ if (s != null && c.options.verbose) {
+ print(s);
+ }
}
}
+ return uri;
}
- return uri;
}
diff --git a/pkg/front_end/lib/src/fasta/parser.dart b/pkg/front_end/lib/src/fasta/parser.dart
index e99cfcf2..0a352e4 100644
--- a/pkg/front_end/lib/src/fasta/parser.dart
+++ b/pkg/front_end/lib/src/fasta/parser.dart
@@ -4,7 +4,7 @@
library fasta.parser;
-import 'package:front_end/src/fasta/scanner/token.dart' show Token;
+import 'scanner/token.dart' show Token;
import 'parser/listener.dart' show Listener;
diff --git a/pkg/front_end/lib/src/fasta/parser/bin/parser.dart b/pkg/front_end/lib/src/fasta/parser/bin/parser.dart
deleted file mode 100644
index a20586a..0000000
--- a/pkg/front_end/lib/src/fasta/parser/bin/parser.dart
+++ /dev/null
@@ -1,7 +0,0 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'package:front_end/src/fasta/parser/main.dart' as dart_parser;
-
-main(List<String> arguments) => dart_parser.main(arguments);
diff --git a/pkg/front_end/lib/src/fasta/parser/class_member_parser.dart b/pkg/front_end/lib/src/fasta/parser/class_member_parser.dart
index 679cb47..7901df0 100644
--- a/pkg/front_end/lib/src/fasta/parser/class_member_parser.dart
+++ b/pkg/front_end/lib/src/fasta/parser/class_member_parser.dart
@@ -4,7 +4,7 @@
library fasta.parser.class_member_parser;
-import 'package:front_end/src/fasta/scanner/token.dart' show Token;
+import '../scanner/token.dart' show Token;
import 'listener.dart' show Listener;
@@ -18,6 +18,13 @@
Token parseExpression(Token token) => skipExpression(token);
+ Token parseRecoverExpression(Token token) {
+ Token begin = token;
+ token = skipExpression(token);
+ listener.handleRecoverExpression(begin);
+ return token;
+ }
+
// This method is overridden for two reasons:
// 1. Avoid generating events for arguments.
// 2. Avoid calling skip expression for each argument (which doesn't work).
diff --git a/pkg/front_end/lib/src/fasta/parser/listener.dart b/pkg/front_end/lib/src/fasta/parser/listener.dart
index d489a1b..3c6c236 100644
--- a/pkg/front_end/lib/src/fasta/parser/listener.dart
+++ b/pkg/front_end/lib/src/fasta/parser/listener.dart
@@ -152,6 +152,12 @@
void beginExpressionStatement(Token token) {}
+ /// Called by [ClassMemberParser] after skipping an expression as error
+ /// recovery.
+ void handleRecoverExpression(Token token) {
+ logEvent("RecoverExpression");
+ }
+
void endExpressionStatement(Token token) {
logEvent("ExpressionStatement");
}
@@ -179,8 +185,15 @@
logEvent("FormalParameters");
}
+ /// Handle the end of a field declaration. Substructures:
+ /// - Metadata
+ /// - Modifiers
+ /// - Type
+ /// - Variable declarations (count times)
+ ///
/// Doesn't have a corresponding begin event, use [beginMember] instead.
- void endFields(int count, Token beginToken, Token endToken) {
+ void endFields(
+ int count, Token covariantKeyword, Token beginToken, Token endToken) {
logEvent("Fields");
}
@@ -544,6 +557,10 @@
void beginReturnStatement(Token token) {}
+ void endExpressionFunctionBody(Token arrowToken, Token endToken) {
+ logEvent("ExpressionFunctionBody");
+ }
+
void endReturnStatement(
bool hasExpression, Token beginToken, Token endToken) {
logEvent("ReturnStatement");
@@ -842,6 +859,10 @@
logEvent("NoExpression");
}
+ void handleNoConstructorReferenceContinuationAfterTypeArguments(Token token) {
+ logEvent("NoConstructorReferenceContinuationAfterTypeArguments");
+ }
+
void handleNoType(Token token) {
logEvent("NoType");
}
@@ -854,6 +875,7 @@
logEvent("Operator");
}
+ /// Handle the end of a construct of the form "operator <token>".
void handleOperatorName(Token operatorKeyword, Token token) {
logEvent("OperatorName");
}
diff --git a/pkg/front_end/lib/src/fasta/parser/parser.dart b/pkg/front_end/lib/src/fasta/parser/parser.dart
index c517e22..ce6741a 100644
--- a/pkg/front_end/lib/src/fasta/parser/parser.dart
+++ b/pkg/front_end/lib/src/fasta/parser/parser.dart
@@ -8,9 +8,9 @@
import '../scanner/recover.dart' show closeBraceFor, skipToEof;
-import 'package:front_end/src/fasta/scanner/keyword.dart' show Keyword;
+import '../scanner/keyword.dart' show Keyword;
-import 'package:front_end/src/fasta/scanner/precedence.dart'
+import '../scanner/precedence.dart'
show
ASSIGNMENT_PRECEDENCE,
AS_INFO,
@@ -29,7 +29,7 @@
QUESTION_PERIOD_INFO,
RELATIONAL_PRECEDENCE;
-import 'package:front_end/src/fasta/scanner/token.dart'
+import '../scanner/token.dart'
show
BeginGroupToken,
KeywordToken,
@@ -37,7 +37,7 @@
Token,
isUserDefinableOperator;
-import 'package:front_end/src/fasta/scanner/token_constants.dart'
+import '../scanner/token_constants.dart'
show
COMMA_TOKEN,
DOUBLE_TOKEN,
@@ -61,10 +61,9 @@
STRING_INTERPOLATION_TOKEN,
STRING_TOKEN;
-import 'package:front_end/src/fasta/scanner/characters.dart'
- show $CLOSE_CURLY_BRACKET;
+import '../scanner/characters.dart' show $CLOSE_CURLY_BRACKET;
-import 'package:front_end/src/fasta/util/link.dart' show Link;
+import '../util/link.dart' show Link;
import 'listener.dart' show Listener;
@@ -344,8 +343,13 @@
assert(optional('part', token));
assert(optional('of', token.next));
Token partKeyword = token;
- token = parseQualified(token.next.next, IdentifierContext.partName,
- IdentifierContext.partNameContinuation);
+ token = token.next.next;
+ if (token.isIdentifier()) {
+ token = parseQualified(token, IdentifierContext.partName,
+ IdentifierContext.partNameContinuation);
+ } else {
+ token = parseLiteralStringOrRecoverExpression(token);
+ }
Token semicolon = token;
token = expect(';', token);
listener.endPartOf(partKeyword, semicolon);
@@ -1165,8 +1169,15 @@
Token getOrSet, Token name, bool isTopLevel) {
bool hasType = type != null;
+ Token covariantKeyword;
if (getOrSet == null && !isTopLevel) {
- modifiers = removeOptCovariantTokenIfNotStatic(modifiers);
+ // TODO(ahe): replace the method removeOptCovariantTokenIfNotStatic with
+ // a better mechanism.
+ Link<Token> newModifiers = removeOptCovariantTokenIfNotStatic(modifiers);
+ if (!identical(newModifiers, modifiers)) {
+ covariantKeyword = modifiers.first;
+ modifiers = newModifiers;
+ }
}
Token varFinalOrConst =
@@ -1219,7 +1230,7 @@
if (isTopLevel) {
listener.endTopLevelFields(fieldCount, start, semicolon);
} else {
- listener.endFields(fieldCount, start, semicolon);
+ listener.endFields(fieldCount, covariantKeyword, start, semicolon);
}
return token;
}
@@ -1443,7 +1454,7 @@
return parseLiteralString(token);
} else {
reportRecoverableError(token, ErrorKind.ExpectedString);
- return parseExpression(token);
+ return parseRecoverExpression(token);
}
}
@@ -1716,7 +1727,7 @@
token = reportUnrecoverableError(token, ErrorKind.UnexpectedToken);
if (identical(token.kind, EOF_TOKEN)) {
// TODO(ahe): This is a hack, see parseTopLevelMember.
- listener.endFields(1, start, token);
+ listener.endFields(1, null, start, token);
listener.endMember();
return token;
}
@@ -1816,24 +1827,26 @@
Token parseFactoryMethod(Token token) {
assert(isFactoryDeclaration(token));
Token start = token;
- Token externalModifier;
- if (identical(token.stringValue, 'external')) {
- externalModifier = token;
- token = token.next;
+ bool isExternal = false;
+ int modifierCount = 0;
+ while (isModifier(token)) {
+ if (optional('external', token)) {
+ isExternal = true;
+ }
+ token = parseModifier(token);
+ modifierCount++;
}
- if (optional('const', token)) {
- token = token.next; // Skip const.
- }
+ listener.handleModifiers(modifierCount);
Token factoryKeyword = token;
listener.beginFactoryMethod(factoryKeyword);
- token = token.next; // Skip 'factory'.
+ token = expect('factory', token);
token = parseConstructorReference(token);
token = parseFormalParameters(token);
token = parseAsyncModifier(token);
if (optional('=', token)) {
token = parseRedirectingFactoryBody(token);
} else {
- token = parseFunctionBody(token, false, externalModifier != null);
+ token = parseFunctionBody(token, false, isExternal);
}
listener.endFactoryMethod(start, token);
return token.next;
@@ -1952,6 +1965,9 @@
period = token;
token = parseIdentifier(token.next,
IdentifierContext.constructorReferenceContinuationAfterTypeArguments);
+ } else {
+ listener
+ .handleNoConstructorReferenceContinuationAfterTypeArguments(token);
}
listener.endConstructorReference(start, period, token);
return token;
@@ -2005,9 +2021,9 @@
token = parseExpression(token.next);
if (!isExpression) {
expectSemicolon(token);
- listener.endReturnStatement(true, begin, token);
+ listener.endExpressionFunctionBody(begin, token);
} else {
- listener.endReturnStatement(true, begin, null);
+ listener.endExpressionFunctionBody(begin, null);
}
return token;
} else if (optional('=', token)) {
@@ -2017,9 +2033,9 @@
token = parseExpression(token.next);
if (!isExpression) {
expectSemicolon(token);
- listener.endReturnStatement(true, begin, token);
+ listener.endExpressionFunctionBody(begin, token);
} else {
- listener.endReturnStatement(true, begin, null);
+ listener.endExpressionFunctionBody(begin, null);
}
return token;
}
@@ -2407,6 +2423,8 @@
return token;
}
+ Token parseRecoverExpression(Token token) => parseExpression(token);
+
int expressionDepth = 0;
Token parseExpression(Token token) {
if (expressionDepth++ > 500) {
diff --git a/pkg/front_end/lib/src/fasta/parser/main.dart b/pkg/front_end/lib/src/fasta/parser/parser_main.dart
similarity index 83%
rename from pkg/front_end/lib/src/fasta/parser/main.dart
rename to pkg/front_end/lib/src/fasta/parser/parser_main.dart
index 7e88b19..215bddf 100644
--- a/pkg/front_end/lib/src/fasta/parser/main.dart
+++ b/pkg/front_end/lib/src/fasta/parser/parser_main.dart
@@ -8,11 +8,11 @@
import 'dart:io' show File;
-import 'package:front_end/src/fasta/scanner/token.dart' show Token;
+import '../scanner/token.dart' show Token;
-import 'package:front_end/src/fasta/scanner/io.dart' show readBytesFromFileSync;
+import '../scanner/io.dart' show readBytesFromFileSync;
-import 'package:front_end/src/fasta/scanner.dart' show scan;
+import '../scanner.dart' show scan;
import 'listener.dart' show Listener;
@@ -30,7 +30,7 @@
}
}
-main(List<String> arguments) async {
+mainEntryPoint(List<String> arguments) async {
for (String argument in arguments) {
if (argument.startsWith("@")) {
Uri uri = Uri.base.resolve(argument.substring(1));
diff --git a/pkg/front_end/lib/src/fasta/parser/top_level_parser.dart b/pkg/front_end/lib/src/fasta/parser/top_level_parser.dart
index 7ba6383..3e1166f 100644
--- a/pkg/front_end/lib/src/fasta/parser/top_level_parser.dart
+++ b/pkg/front_end/lib/src/fasta/parser/top_level_parser.dart
@@ -4,7 +4,7 @@
library fasta.parser.top_level_parser;
-import 'package:front_end/src/fasta/scanner/token.dart' show Token;
+import '../scanner/token.dart' show Token;
import 'listener.dart' show Listener;
diff --git a/pkg/front_end/lib/src/fasta/quote.dart b/pkg/front_end/lib/src/fasta/quote.dart
index abdf660..8d95253 100644
--- a/pkg/front_end/lib/src/fasta/quote.dart
+++ b/pkg/front_end/lib/src/fasta/quote.dart
@@ -6,7 +6,7 @@
import 'errors.dart' show inputError, internalError;
-import 'package:front_end/src/fasta/scanner/characters.dart'
+import 'scanner/characters.dart'
show
$BACKSLASH,
$BS,
diff --git a/pkg/front_end/lib/src/fasta/run.dart b/pkg/front_end/lib/src/fasta/run.dart
index d7f812f..12041a2 100644
--- a/pkg/front_end/lib/src/fasta/run.dart
+++ b/pkg/front_end/lib/src/fasta/run.dart
@@ -6,7 +6,7 @@
import 'dart:async' show Future;
-import 'dart:io' show stdout;
+import 'dart:io' show stdout, exit, exitCode;
import 'package:testing/testing.dart' show StdioProcess;
@@ -14,6 +14,40 @@
import 'compiler_context.dart' show CompilerContext;
+import 'compiler_command_line.dart' show CompilerCommandLine;
+
+import 'outline.dart' show CompileTask;
+
+import 'errors.dart' show InputError;
+
+import 'ticker.dart' show Ticker;
+
+const int iterations = const int.fromEnvironment("iterations", defaultValue: 1);
+
+mainEntryPoint(List<String> arguments) async {
+ Uri uri;
+ for (int i = 0; i < iterations; i++) {
+ await CompilerCommandLine.withGlobalOptions("run", arguments,
+ (CompilerContext c) async {
+ if (i > 0) {
+ print("\n");
+ }
+ try {
+ CompileTask task =
+ new CompileTask(c, new Ticker(isVerbose: c.options.verbose));
+ uri = await task.compile();
+ } on InputError catch (e) {
+ print(e.format());
+ exit(1);
+ }
+ if (exitCode != 0) exit(exitCode);
+ if (i + 1 == iterations) {
+ exit(await run(uri, c));
+ }
+ });
+ }
+}
+
Future<int> run(Uri uri, CompilerContext c) async {
Uri sdk = await computePatchedSdk();
Uri dartVm = computeDartVm(sdk);
diff --git a/pkg/front_end/lib/src/fasta/scanner/array_based_scanner.dart b/pkg/front_end/lib/src/fasta/scanner/array_based_scanner.dart
index 538c4c5..bf033f0 100644
--- a/pkg/front_end/lib/src/fasta/scanner/array_based_scanner.dart
+++ b/pkg/front_end/lib/src/fasta/scanner/array_based_scanner.dart
@@ -19,7 +19,7 @@
import 'abstract_scanner.dart' show AbstractScanner;
-import 'package:front_end/src/fasta/util/link.dart' show Link;
+import '../util/link.dart' show Link;
abstract class ArrayBasedScanner extends AbstractScanner {
bool hasErrors = false;
diff --git a/pkg/front_end/lib/src/fasta/scanner/bin/scanner.dart b/pkg/front_end/lib/src/fasta/scanner/bin/scanner.dart
deleted file mode 100644
index 4d46811..0000000
--- a/pkg/front_end/lib/src/fasta/scanner/bin/scanner.dart
+++ /dev/null
@@ -1,7 +0,0 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE.md file.
-
-import 'package:front_end/src/fasta/scanner/main.dart' as dart_scanner;
-
-main(List<String> arguments) => dart_scanner.main(arguments);
diff --git a/pkg/front_end/lib/src/fasta/scanner/keyword.dart b/pkg/front_end/lib/src/fasta/scanner/keyword.dart
index 701fa39..0e73786 100644
--- a/pkg/front_end/lib/src/fasta/scanner/keyword.dart
+++ b/pkg/front_end/lib/src/fasta/scanner/keyword.dart
@@ -187,7 +187,7 @@
final List<KeywordState> table;
final Keyword keyword;
- ArrayKeywordState(List<KeywordState> this.table, String syntax)
+ ArrayKeywordState(this.table, String syntax)
: keyword = ((syntax == null) ? null : Keyword.keywords[syntax]);
KeywordState next(int c);
diff --git a/pkg/front_end/lib/src/fasta/scanner/recover.dart b/pkg/front_end/lib/src/fasta/scanner/recover.dart
index 5faa291..46639b1 100644
--- a/pkg/front_end/lib/src/fasta/scanner/recover.dart
+++ b/pkg/front_end/lib/src/fasta/scanner/recover.dart
@@ -18,7 +18,7 @@
/// code.
Token defaultRecoveryStrategy(
List<int> bytes, Token tokens, List<int> lineStarts) {
- // See [Parser.reportErrorToken](package:front_end/src/fasta/parser/src/parser.dart) for how
+ // See [Parser.reportErrorToken](../parser/src/parser.dart) for how
// it currently handles lexical errors. In addition, notice how the parser
// calls [handleInvalidExpression], [handleInvalidFunctionBody], and
// [handleInvalidTypeReference] to allow the listener to recover its internal
diff --git a/pkg/front_end/lib/src/fasta/scanner/main.dart b/pkg/front_end/lib/src/fasta/scanner/scanner_main.dart
similarity index 95%
rename from pkg/front_end/lib/src/fasta/scanner/main.dart
rename to pkg/front_end/lib/src/fasta/scanner/scanner_main.dart
index ccd6acb..f56aa98 100644
--- a/pkg/front_end/lib/src/fasta/scanner/main.dart
+++ b/pkg/front_end/lib/src/fasta/scanner/scanner_main.dart
@@ -20,7 +20,7 @@
print("Bytes/ms: ${byteCount/sw.elapsedMilliseconds}");
}
-main(List<String> arguments) {
+mainEntryPoint(List<String> arguments) {
Map<Uri, List<int>> files = <Uri, List<int>>{};
Stopwatch sw = new Stopwatch()..start();
for (String name in arguments) {
diff --git a/pkg/front_end/lib/src/fasta/source/diet_listener.dart b/pkg/front_end/lib/src/fasta/source/diet_listener.dart
index 780d617..89cbf4a 100644
--- a/pkg/front_end/lib/src/fasta/source/diet_listener.dart
+++ b/pkg/front_end/lib/src/fasta/source/diet_listener.dart
@@ -29,12 +29,8 @@
import '../builder/builder.dart';
-import '../analyzer/analyzer.dart';
-
import '../builder/scope.dart' show Scope;
-import '../ast_kind.dart' show AstKind;
-
import 'source_library_builder.dart' show SourceLibraryBuilder;
import '../kernel/kernel_library_builder.dart' show isConstructorName;
@@ -42,14 +38,10 @@
class DietListener extends StackListener {
final SourceLibraryBuilder library;
- final ElementStore elementStore;
-
final ClassHierarchy hierarchy;
final CoreTypes coreTypes;
- final AstKind astKind;
-
final bool isDartLibrary;
ClassBuilder currentClass;
@@ -61,8 +53,7 @@
@override
Uri uri;
- DietListener(SourceLibraryBuilder library, this.elementStore, this.hierarchy,
- this.coreTypes, this.astKind)
+ DietListener(SourceLibraryBuilder library, this.hierarchy, this.coreTypes)
: library = library,
uri = library.fileUri,
memberScope = library.scope,
@@ -108,6 +99,11 @@
}
@override
+ void handleNoConstructorReferenceContinuationAfterTypeArguments(Token token) {
+ debugEvent("NoConstructorReferenceContinuationAfterTypeArguments");
+ }
+
+ @override
void handleNoType(Token token) {
debugEvent("NoType");
}
@@ -178,11 +174,12 @@
}
@override
- void endFields(int count, Token beginToken, Token endToken) {
+ void endFields(
+ int count, Token covariantToken, Token beginToken, Token endToken) {
debugEvent("Fields");
List<String> names = popList(count);
Builder builder = lookupBuilder(beginToken, null, names.first);
- buildFields(beginToken, false, builder.isInstanceMember);
+ buildFields(beginToken, false, builder);
}
@override
@@ -207,8 +204,9 @@
@override
void endTopLevelFields(int count, Token beginToken, Token endToken) {
debugEvent("TopLevelFields");
- discard(count);
- buildFields(beginToken, true, false);
+ List<String> names = popList(count);
+ Builder builder = lookupBuilder(beginToken, null, names.first);
+ buildFields(beginToken, true, builder);
}
@override
@@ -373,24 +371,8 @@
StackListener createListener(
MemberBuilder builder, Scope memberScope, bool isInstanceMember,
[Scope formalParameterScope]) {
- switch (astKind) {
- case AstKind.Kernel:
- return new BodyBuilder(
- library,
- builder,
- memberScope,
- formalParameterScope,
- hierarchy,
- coreTypes,
- currentClass,
- isInstanceMember,
- uri);
-
- case AstKind.Analyzer:
- return new AstBuilder(library, builder, elementStore, memberScope, uri);
- }
-
- return internalError("Unknown $astKind");
+ return new BodyBuilder(library, builder, memberScope, formalParameterScope,
+ hierarchy, coreTypes, currentClass, isInstanceMember, uri);
}
void buildFunctionBody(Token token, ProcedureBuilder builder) {
@@ -405,9 +387,9 @@
token);
}
- void buildFields(Token token, bool isTopLevel, bool isInstanceMember) {
- parseFields(
- createListener(null, memberScope, isInstanceMember), token, isTopLevel);
+ void buildFields(Token token, bool isTopLevel, MemberBuilder builder) {
+ parseFields(createListener(builder, memberScope, builder.isInstanceMember),
+ token, isTopLevel);
}
@override
@@ -480,6 +462,8 @@
return removeNativeClause(identifiers);
}
+ AsyncMarker getAsyncMarker(StackListener listener) => listener.pop();
+
void parseFunctionBody(StackListener listener, Token token) {
try {
Parser parser = new Parser(listener);
@@ -489,7 +473,7 @@
listener.prepareInitializers();
token = parser.parseInitializersOpt(token);
token = parser.parseAsyncModifier(token);
- AsyncMarker asyncModifier = listener.pop();
+ AsyncMarker asyncModifier = getAsyncMarker(listener);
bool isExpression = false;
bool allowAbstract = true;
parser.parseFunctionBody(token, isExpression, allowAbstract);
diff --git a/pkg/front_end/lib/src/fasta/source/diet_parser.dart b/pkg/front_end/lib/src/fasta/source/diet_parser.dart
index 6fc1c10..8c14258 100644
--- a/pkg/front_end/lib/src/fasta/source/diet_parser.dart
+++ b/pkg/front_end/lib/src/fasta/source/diet_parser.dart
@@ -4,17 +4,15 @@
library fasta.diet_parser;
-import 'package:front_end/src/fasta/scanner/token.dart'
- show BeginGroupToken, Token;
+import '../scanner/token.dart' show BeginGroupToken, Token;
-import 'package:front_end/src/fasta/parser/class_member_parser.dart'
- show ClassMemberParser;
+import '../parser/class_member_parser.dart' show ClassMemberParser;
-import 'package:front_end/src/fasta/parser/error_kind.dart' show ErrorKind;
+import '../parser/error_kind.dart' show ErrorKind;
-import 'package:front_end/src/fasta/parser/listener.dart' show Listener;
+import '../parser/listener.dart' show Listener;
-import 'package:front_end/src/fasta/parser/parser.dart' show optional;
+import '../parser/parser.dart' show optional;
// TODO(ahe): Move this to parser package.
class DietParser extends ClassMemberParser {
diff --git a/pkg/front_end/lib/src/fasta/source/outline_builder.dart b/pkg/front_end/lib/src/fasta/source/outline_builder.dart
index bd466f0..215d2eb 100644
--- a/pkg/front_end/lib/src/fasta/source/outline_builder.dart
+++ b/pkg/front_end/lib/src/fasta/source/outline_builder.dart
@@ -121,8 +121,10 @@
Unhandled conditionalUris = pop();
String uri = pop();
List<MetadataBuilder> metadata = pop();
- library.addExport(
- metadata, uri, conditionalUris, combinators, exportKeyword.charOffset);
+ if (uri != null) {
+ library.addExport(metadata, uri, conditionalUris, combinators,
+ exportKeyword.charOffset);
+ }
checkEmpty(exportKeyword.charOffset);
}
@@ -135,24 +137,34 @@
Unhandled conditionalUris = pop();
String uri = pop();
List<MetadataBuilder> metadata = pop();
- library.addImport(
- metadata,
- uri,
- conditionalUris,
- prefix,
- combinators,
- deferredKeyword != null,
- importKeyword.charOffset,
- asKeyword?.next?.charOffset ?? -1);
+ if (uri != null) {
+ library.addImport(
+ metadata,
+ uri,
+ conditionalUris,
+ prefix,
+ combinators,
+ deferredKeyword != null,
+ importKeyword.charOffset,
+ asKeyword?.next?.charOffset ?? -1);
+ }
checkEmpty(importKeyword.charOffset);
}
@override
+ void handleRecoverExpression(Token token) {
+ debugEvent("RecoverExpression");
+ push(NullValue.Expression);
+ }
+
+ @override
void endPart(Token partKeyword, Token semicolon) {
debugEvent("Part");
String uri = pop();
List<MetadataBuilder> metadata = pop();
- library.addPart(metadata, uri);
+ if (uri != null) {
+ library.addPart(metadata, uri);
+ }
checkEmpty(partKeyword.charOffset);
}
@@ -413,7 +425,11 @@
FormalParameterType kind = optional("{", beginToken)
? FormalParameterType.NAMED
: FormalParameterType.POSITIONAL;
- List parameters = popList(count);
+ // When recovering from an empty list of optional arguments, count may be
+ // 0. It might be simpler if the parser didn't call this method in that
+ // case, however, then [beginOptionalFormalParameters] wouldn't always be
+ // matched by this method.
+ List parameters = popList(count) ?? [];
for (FormalParameterBuilder parameter in parameters) {
parameter.kind = kind;
}
@@ -491,7 +507,8 @@
}
@override
- void endFields(int count, Token beginToken, Token endToken) {
+ void endFields(
+ int count, Token covariantToken, Token beginToken, Token endToken) {
debugEvent("Fields");
List<String> names = popList(count);
TypeBuilder type = pop();
@@ -543,8 +560,9 @@
AsyncMarker asyncModifier = pop();
List<FormalParameterBuilder> formals = pop();
var name = pop();
+ int modifiers = Modifier.validate(pop());
List<MetadataBuilder> metadata = pop();
- library.addFactoryMethod(metadata, name, formals, asyncModifier,
+ library.addFactoryMethod(metadata, modifiers, name, formals, asyncModifier,
redirectionTarget, beginToken.charOffset, nativeMethodName);
nativeMethodName = null;
}
diff --git a/pkg/front_end/lib/src/fasta/source/scope_listener.dart b/pkg/front_end/lib/src/fasta/source/scope_listener.dart
index 19d8564..78aed68 100644
--- a/pkg/front_end/lib/src/fasta/source/scope_listener.dart
+++ b/pkg/front_end/lib/src/fasta/source/scope_listener.dart
@@ -4,7 +4,7 @@
library fasta.scope_listener;
-import 'package:front_end/src/fasta/scanner/token.dart' show Token;
+import '../scanner/token.dart' show Token;
import 'unhandled_listener.dart' show NullValue, UnhandledListener;
diff --git a/pkg/front_end/lib/src/fasta/source/source_library_builder.dart b/pkg/front_end/lib/src/fasta/source/source_library_builder.dart
index 6f591ef..498b074 100644
--- a/pkg/front_end/lib/src/fasta/source/source_library_builder.dart
+++ b/pkg/front_end/lib/src/fasta/source/source_library_builder.dart
@@ -211,6 +211,7 @@
void addFactoryMethod(
List<MetadataBuilder> metadata,
+ int modifiers,
ConstructorReferenceBuilder name,
List<FormalParameterBuilder> formals,
AsyncMarker asyncModifier,
diff --git a/pkg/front_end/lib/src/fasta/source/source_loader.dart b/pkg/front_end/lib/src/fasta/source/source_loader.dart
index e8c9a14..5e50846 100644
--- a/pkg/front_end/lib/src/fasta/source/source_loader.dart
+++ b/pkg/front_end/lib/src/fasta/source/source_loader.dart
@@ -8,13 +8,11 @@
import 'dart:io' show FileSystemException;
-import 'package:front_end/src/fasta/scanner/io.dart' show readBytesFromFile;
+import '../scanner/io.dart' show readBytesFromFile;
-import 'package:front_end/src/fasta/scanner.dart'
- show ErrorToken, ScannerResult, Token, scan;
+import '../scanner.dart' show ErrorToken, ScannerResult, Token, scan;
-import 'package:front_end/src/fasta/parser/class_member_parser.dart'
- show ClassMemberParser;
+import '../parser/class_member_parser.dart' show ClassMemberParser;
import 'package:kernel/ast.dart' show Program;
@@ -28,8 +26,6 @@
import '../export.dart' show Export;
-import '../analyzer/element_store.dart' show ElementStore;
-
import '../builder/builder.dart' show Builder, ClassBuilder, LibraryBuilder;
import 'outline_builder.dart' show OutlineBuilder;
@@ -44,8 +40,6 @@
import 'source_library_builder.dart' show SourceLibraryBuilder;
-import '../ast_kind.dart' show AstKind;
-
class SourceLoader<L> extends Loader<L> {
final Map<Uri, List<int>> sourceBytes = <Uri, List<int>>{};
@@ -53,9 +47,6 @@
ClassHierarchy hierarchy;
CoreTypes coreTypes;
- // Used when building analyzer ASTs.
- ElementStore elementStore;
-
SourceLoader(TargetImplementation target) : super(target);
Future<Token> tokenize(SourceLibraryBuilder library,
@@ -100,15 +91,14 @@
new ClassMemberParser(listener).parseUnit(tokens);
}
- Future<Null> buildBody(LibraryBuilder library, AstKind astKind) async {
+ Future<Null> buildBody(LibraryBuilder library) async {
if (library is SourceLibraryBuilder) {
// We tokenize source files twice to keep memory usage low. This is the
// second time, and the first time was in [buildOutline] above. So this
// time we suppress lexical errors.
Token tokens = await tokenize(library, suppressLexicalErrors: true);
if (tokens == null) return;
- DietListener listener = new DietListener(
- library, elementStore, hierarchy, coreTypes, astKind);
+ DietListener listener = createDietListener(library);
DietParser parser = new DietParser(listener);
parser.parseUnit(tokens);
for (SourceLibraryBuilder part in library.parts) {
@@ -121,6 +111,10 @@
}
}
+ DietListener createDietListener(LibraryBuilder library) {
+ return new DietListener(library, hierarchy, coreTypes);
+ }
+
void resolveParts() {
List<Uri> parts = <Uri>[];
builders.forEach((Uri uri, LibraryBuilder library) {
@@ -341,15 +335,12 @@
ticker.logMs("Built program");
}
- void buildElementStore() {
- elementStore = new ElementStore(coreLibrary, builders);
- ticker.logMs("Built analyzer element model.");
- }
-
void computeHierarchy(Program program) {
hierarchy = new ClassHierarchy(program);
ticker.logMs("Computed class hierarchy");
coreTypes = new CoreTypes(program);
ticker.logMs("Computed core types");
}
+
+ List<Uri> getDependencies() => sourceBytes.keys.toList();
}
diff --git a/pkg/front_end/lib/src/fasta/source/stack_listener.dart b/pkg/front_end/lib/src/fasta/source/stack_listener.dart
index 56fbbba..9793877 100644
--- a/pkg/front_end/lib/src/fasta/source/stack_listener.dart
+++ b/pkg/front_end/lib/src/fasta/source/stack_listener.dart
@@ -4,12 +4,11 @@
library fasta.stack_listener;
-import 'package:front_end/src/fasta/parser.dart' show ErrorKind, Listener;
+import '../parser.dart' show ErrorKind, Listener;
-import 'package:front_end/src/fasta/parser/identifier_context.dart'
- show IdentifierContext;
+import '../parser/identifier_context.dart' show IdentifierContext;
-import 'package:front_end/src/fasta/scanner.dart' show BeginGroupToken, Token;
+import '../scanner.dart' show BeginGroupToken, Token;
import 'package:kernel/ast.dart' show AsyncMarker;
@@ -26,11 +25,14 @@
CascadeReceiver,
Combinators,
ConditionalUris,
+ ConstructorReferenceContinuationAfterTypeArguments,
ContinueTarget,
Expression,
FieldInitializer,
FormalParameters,
FunctionBody,
+ FunctionBodyAsyncToken,
+ FunctionBodyStarToken,
IdentifierList,
Initializers,
Metadata,
@@ -154,6 +156,11 @@
}
@override
+ void handleNoConstructorReferenceContinuationAfterTypeArguments(Token token) {
+ debugEvent("NoConstructorReferenceContinuationAfterTypeArguments");
+ }
+
+ @override
void handleNoType(Token token) {
debugEvent("NoType");
push(NullValue.Type);
@@ -212,6 +219,11 @@
}
@override
+ void handleRecoverExpression(Token token) {
+ debugEvent("RecoverExpression");
+ }
+
+ @override
void endCatchClause(Token token) {
debugEvent("CatchClause");
}
diff --git a/pkg/front_end/lib/src/fasta/source/unhandled_listener.dart b/pkg/front_end/lib/src/fasta/source/unhandled_listener.dart
index 500305c..fb25b83 100644
--- a/pkg/front_end/lib/src/fasta/source/unhandled_listener.dart
+++ b/pkg/front_end/lib/src/fasta/source/unhandled_listener.dart
@@ -4,7 +4,7 @@
library fasta.unhandled_listener;
-import 'package:front_end/src/fasta/scanner/token.dart' show Token;
+import '../scanner/token.dart' show Token;
import 'stack_listener.dart' show NullValue, StackListener;
diff --git a/pkg/front_end/lib/src/fasta/target.dart b/pkg/front_end/lib/src/fasta/target.dart
index 20c59f2..76f8ad3 100644
--- a/pkg/front_end/lib/src/fasta/target.dart
+++ b/pkg/front_end/lib/src/fasta/target.dart
@@ -8,8 +8,6 @@
import 'ticker.dart' show Ticker;
-import 'ast_kind.dart' show AstKind;
-
/// A compilation target.
///
/// A target reads source files with [read] and writes out the resulting
@@ -23,7 +21,7 @@
void read(Uri uri);
/// Write the resulting program in the file [uri].
- Future writeProgram(Uri uri, AstKind astKind);
+ Future writeProgram(Uri uri);
/// Write the resulting outline in the file [uri].
Future writeOutline(Uri uri);
diff --git a/pkg/front_end/lib/src/fasta/scanner/testing/scanner_chain.dart b/pkg/front_end/lib/src/fasta/testing/scanner_chain.dart
similarity index 83%
rename from pkg/front_end/lib/src/fasta/scanner/testing/scanner_chain.dart
rename to pkg/front_end/lib/src/fasta/testing/scanner_chain.dart
index 138b8c4..277697e 100644
--- a/pkg/front_end/lib/src/fasta/scanner/testing/scanner_chain.dart
+++ b/pkg/front_end/lib/src/fasta/testing/scanner_chain.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.md file.
-library fasta.scanner.testing.scanner_chain;
+library fasta.testing.scanner_chain;
import 'package:testing/testing.dart';
-import 'package:front_end/src/fasta/scanner.dart';
+import '../scanner.dart';
-import 'package:front_end/src/fasta/scanner/io.dart';
+import '../scanner/io.dart';
class Read extends Step<TestDescription, List<int>, ChainContext> {
const Read();
diff --git a/pkg/front_end/lib/src/fasta/testing/suite.dart b/pkg/front_end/lib/src/fasta/testing/suite.dart
index f4bd276..8886460 100644
--- a/pkg/front_end/lib/src/fasta/testing/suite.dart
+++ b/pkg/front_end/lib/src/fasta/testing/suite.dart
@@ -28,18 +28,16 @@
import '../translate_uri.dart' show TranslateUri;
+import '../analyzer/analyzer_target.dart' show AnalyzerTarget;
+
import '../kernel/kernel_target.dart' show KernelTarget;
import '../dill/dill_target.dart' show DillTarget;
-import '../ast_kind.dart' show AstKind;
-
export 'kernel_chain.dart' show TestContext;
export 'package:testing/testing.dart' show Chain, runMe;
-export '../ast_kind.dart' show AstKind;
-
const String ENABLE_FULL_COMPILE = " full compile ";
const String AST_KIND_INDEX = " AST kind index ";
@@ -63,7 +61,12 @@
throw "Unknown AST kind: $astKind";
}
-class FeContext extends TestContext {
+enum AstKind {
+ Analyzer,
+ Kernel,
+}
+
+class FastaContext extends TestContext {
final TranslateUri uriTranslator;
final List<Step> steps;
@@ -73,7 +76,7 @@
Future<Program> platform;
- FeContext(
+ FastaContext(
Uri sdk,
Uri vm,
Uri packages,
@@ -122,33 +125,36 @@
});
}
- static Future<FeContext> create(
- Chain suite,
- Map<String, String> environment,
- Uri sdk,
- Uri vm,
- Uri packages,
- bool strongMode,
- DartSdk dartSdk,
- bool updateExpectations) async {
- TranslateUri uriTranslator = await TranslateUri.parse(packages);
- String astKindString = environment[AST_KIND_INDEX];
- AstKind astKind =
- astKindString == null ? null : AstKind.values[int.parse(astKindString)];
- return new FeContext(
- sdk,
- vm,
- packages,
- strongMode,
- dartSdk,
- updateExpectations,
- uriTranslator,
- environment.containsKey(ENABLE_FULL_COMPILE),
- astKind);
+ static Future<FastaContext> create(
+ Chain suite, Map<String, String> environment) async {
+ return TestContext.create(suite, environment, (Chain suite,
+ Map<String, String> environment,
+ Uri sdk,
+ Uri vm,
+ Uri packages,
+ bool strongMode,
+ DartSdk dartSdk,
+ bool updateExpectations) async {
+ TranslateUri uriTranslator = await TranslateUri.parse(packages);
+ String astKindString = environment[AST_KIND_INDEX];
+ AstKind astKind = astKindString == null
+ ? null
+ : AstKind.values[int.parse(astKindString)];
+ return new FastaContext(
+ sdk,
+ vm,
+ packages,
+ strongMode,
+ dartSdk,
+ updateExpectations,
+ uriTranslator,
+ environment.containsKey(ENABLE_FULL_COMPILE),
+ astKind);
+ });
}
}
-class Outline extends Step<TestDescription, Program, FeContext> {
+class Outline extends Step<TestDescription, Program, FastaContext> {
final bool fullCompile;
final AstKind astKind;
@@ -156,28 +162,30 @@
const Outline(this.fullCompile, this.astKind);
String get name {
- return fullCompile ? "${shortenAstKindName(astKind)} compile" : "outline";
+ return fullCompile ? "${astKind} compile" : "outline";
}
bool get isCompiler => fullCompile;
Future<Result<Program>> run(
- TestDescription description, FeContext context) async {
+ TestDescription description, FastaContext context) async {
Program platform = await context.createPlatform();
Ticker ticker = new Ticker();
DillTarget dillTarget = new DillTarget(ticker, context.uriTranslator);
dillTarget.loader
..input = Uri.parse("org.dartlang:platform") // Make up a name.
..setProgram(platform);
- KernelTarget sourceTarget =
- new KernelTarget(dillTarget, context.uriTranslator);
+ KernelTarget sourceTarget = astKind == AstKind.Analyzer
+ ? new AnalyzerTarget(dillTarget, context.uriTranslator)
+ : new KernelTarget(dillTarget, context.uriTranslator);
+
Program p;
try {
sourceTarget.read(description.uri);
await dillTarget.writeOutline(null);
p = await sourceTarget.writeOutline(null);
if (fullCompile) {
- p = await sourceTarget.writeProgram(null, astKind);
+ p = await sourceTarget.writeProgram(null);
}
} on InputError catch (e, s) {
return fail(null, e.error, s);
diff --git a/pkg/front_end/lib/src/fasta/util/link_implementation.dart b/pkg/front_end/lib/src/fasta/util/link_implementation.dart
index b76c98f..cc74c01 100644
--- a/pkg/front_end/lib/src/fasta/util/link_implementation.dart
+++ b/pkg/front_end/lib/src/fasta/util/link_implementation.dart
@@ -12,7 +12,7 @@
T _current;
Link<T> _link;
- LinkIterator(Link<T> this._link);
+ LinkIterator(this._link);
T get current => _current;
@@ -64,7 +64,7 @@
final T head;
Link<T> tail;
- LinkEntry(T this.head, [Link<T> tail])
+ LinkEntry(this.head, [Link<T> tail])
: this.tail = ((tail == null) ? const Link() : tail);
Link<T> prepend(T element) {
diff --git a/pkg/front_end/test/fasta/bootstrap_test.dart b/pkg/front_end/test/fasta/bootstrap_test.dart
new file mode 100644
index 0000000..265c616
--- /dev/null
+++ b/pkg/front_end/test/fasta/bootstrap_test.dart
@@ -0,0 +1,112 @@
+// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'dart:async' show Future;
+
+import 'dart:io' show Directory, File, Platform;
+
+import 'dart:isolate' show Isolate;
+
+import 'package:async_helper/async_helper.dart' show asyncEnd, asyncStart;
+
+import 'package:front_end/src/fasta/testing/kernel_chain.dart'
+ show computePatchedSdk;
+
+import 'package:testing/testing.dart' show StdioProcess;
+
+import 'package:kernel/binary/ast_from_binary.dart' show BinaryBuilder;
+
+import 'package:kernel/ast.dart' show Program;
+
+import 'package:kernel/text/ast_to_text.dart' show programToString;
+
+Future main() async {
+ asyncStart();
+ Uri sourceCompiler = Uri.base.resolve("pkg/front_end/tool/fasta/compile.dart");
+ Uri outline = Uri.base.resolve("pkg/front_end/tool/fasta/outline.dart");
+ Uri packages = await Isolate.packageConfig;
+ Directory tmp = await Directory.systemTemp.createTemp("fasta_bootstrap");
+ Uri compiledOnceOutput = tmp.uri.resolve("fasta1.dill");
+ Uri compiledTwiceOutput = tmp.uri.resolve("fasta2.dill");
+ Uri outlineOutput = tmp.uri.resolve("outline.dill");
+ try {
+ await runCompiler(sourceCompiler, sourceCompiler, compiledOnceOutput);
+ await runCompiler(compiledOnceOutput, sourceCompiler, compiledTwiceOutput);
+ await compare(compiledOnceOutput, compiledTwiceOutput);
+ await runCompiler(compiledTwiceOutput, outline, outlineOutput);
+ try {
+ // Test that compare actually works by comparing the compile program to
+ // the outline program (which are different, but similar).
+ await compare(compiledOnceOutput, outlineOutput, silent: true);
+ throw "Expected an error.";
+ } on ComparisonFailed {
+ // Expected.
+ }
+ } finally {
+ await tmp.delete(recursive: true);
+ }
+ asyncEnd();
+}
+
+Future runCompiler(Uri compiler, Uri input, Uri output) async {
+ Uri patchedSdk = await computePatchedSdk();
+ Uri dartVm = Uri.base.resolve(Platform.resolvedExecutable);
+ StdioProcess result = await StdioProcess.run(dartVm.toFilePath(), <String>[
+ "-c",
+ compiler.toFilePath(),
+ "--compile-sdk=${patchedSdk.toFilePath()}",
+ "--output=${output.toFilePath()}",
+ "--verify",
+ input.toFilePath(),
+ ]);
+ print(result.output);
+ if (result.exitCode != 0) {
+ throw "Compilation failed.";
+ }
+}
+
+Future compare(Uri a, Uri b, {bool silent: false}) async {
+ List<int> bytesA = await new File.fromUri(a).readAsBytes();
+ List<int> bytesB = await new File.fromUri(b).readAsBytes();
+ if (bytesA.length == bytesB.length) {
+ bool same = true;
+ for (int i = 0; i < bytesA.length; i++) {
+ if (bytesA[i] != bytesB[i]) {
+ same = false;
+ break;
+ }
+ }
+ if (same) return;
+ }
+ if (!silent) {
+ print("$a is different from $b");
+ }
+ Program programA = new Program();
+ Program programB = new Program();
+ new BinaryBuilder(bytesA, a.toFilePath()).readProgram(programA);
+ new BinaryBuilder(bytesB, b.toFilePath()).readProgram(programB);
+ RegExp splitLines = new RegExp('^', multiLine: true);
+ List<String> linesA = programToString(programA).split(splitLines);
+ List<String> linesB = programToString(programB).split(splitLines);
+ for (int i = 0; i < linesA.length && i < linesB.length; i++) {
+ String lineA = linesA[i].trimRight();
+ String lineB = linesB[i].trimRight();
+ if (lineA != lineB) {
+ String diffHunk = "${i}c$i\n>$lineA\n---\n<$lineB";
+ if (!silent) {
+ print(diffHunk);
+ }
+ }
+ }
+ throw new ComparisonFailed(a, b);
+}
+
+class ComparisonFailed {
+ final Uri a;
+ final Uri b;
+
+ ComparisonFailed(this.a, this.b);
+
+ toString() => "Error: $a is different from $b";
+}
diff --git a/pkg/front_end/test/fasta/compile.status b/pkg/front_end/test/fasta/compile.status
index 697e762..79faa18 100644
--- a/pkg/front_end/test/fasta/compile.status
+++ b/pkg/front_end/test/fasta/compile.status
@@ -9,6 +9,7 @@
await: Fail
invocations: Fail
function_type_recovery: Crash
+statements: Fail # Make async tranformer optional for golden file testing.
rasta/abstract_constructor: Fail
rasta/bad_constructor_redirection: Fail
@@ -65,9 +66,9 @@
rasta/switch_execution_case_t02: Fail
rasta/switch_fall_through: Fail
rasta/try_label: Fail
-rasta/type_literals: Fail
+rasta/type_literals: VerificationError
rasta/type_with_parse_error: Fail
-rasta/typedef: Fail
+rasta/typedef: VerificationError
rasta/unresolved: Fail
rasta/unresolved_constructor: Fail
rasta/unresolved_for_in: Fail
diff --git a/pkg/front_end/test/fasta/compile_test.dart b/pkg/front_end/test/fasta/compile_test.dart
index cba4097..00a6a69 100644
--- a/pkg/front_end/test/fasta/compile_test.dart
+++ b/pkg/front_end/test/fasta/compile_test.dart
@@ -4,16 +4,15 @@
library fasta.test.compile_test;
-import 'dart:async' show
- Future;
+import 'dart:async' show Future;
import 'package:front_end/src/fasta/testing/suite.dart';
-Future<FeContext> createContext(
+Future<FastaContext> createContext(
Chain suite, Map<String, String> environment) {
environment[ENABLE_FULL_COMPILE] = "";
environment[AST_KIND_INDEX] = "${AstKind.Kernel.index}";
- return TestContext.create(suite, environment, FeContext.create);
+ return FastaContext.create(suite, environment);
}
main(List<String> arguments) => runMe(arguments, createContext, "testing.json");
diff --git a/pkg/front_end/test/fasta/kompile.status b/pkg/front_end/test/fasta/kompile.status
index 9a7396f..f0dc306 100644
--- a/pkg/front_end/test/fasta/kompile.status
+++ b/pkg/front_end/test/fasta/kompile.status
@@ -10,7 +10,7 @@
accessors: Crash
await: Fail
classes: Crash
-cycles: Crash
+cycles: Fail
default_values: Crash
expressions: Crash
fibonacci: Crash
@@ -20,16 +20,16 @@
functions: Crash
implicit_this: Crash
invocations: Fail
-map: Crash
+map: Fail
mixin: Crash
operators: Crash
-redirecting_constructor: Crash
+redirecting_constructor: Fail
statements: Crash
super_rasta_copy: Crash
top_level_accessors: Crash
typedef: Crash
-rasta/abstract_constructor: Crash
+rasta/abstract_constructor: Fail
rasta/bad_constructor_redirection: Crash
rasta/bad_continue: Crash
rasta/bad_default_constructor: Crash
@@ -41,7 +41,7 @@
rasta/bad_unicode: Fail
rasta/breaking_bad: Crash
rasta/cascades: Crash
-rasta/class_hierarchy: Crash
+rasta/class_hierarchy: Fail
rasta/class_member: Crash
rasta/constant_get_and_invoke: Crash
rasta/deferred_lib: Fail
@@ -51,12 +51,12 @@
rasta/external_factory_redirection: Crash
rasta/foo: Fail
rasta/for_loop: Crash
-rasta/generic_factory: Crash
+rasta/generic_factory: VerificationError
rasta/issue_000001: Crash
rasta/issue_000002: Crash
rasta/issue_000004: Crash
rasta/issue_000006: Crash
-rasta/issue_000007: Crash
+rasta/issue_000007: Fail
rasta/issue_000008: Crash
rasta/issue_000011: Crash
rasta/issue_000012: Crash
@@ -69,7 +69,7 @@
rasta/issue_000035a: Fail
rasta/issue_000036: Fail
rasta/issue_000039: Crash
-rasta/issue_000041: Crash
+rasta/issue_000041: Fail
rasta/issue_000042: Crash
rasta/issue_000043: Fail
rasta/issue_000044: Fail
@@ -86,7 +86,7 @@
rasta/issue_000080: Crash
rasta/issue_000081: Crash
rasta/malformed_const_constructor: Fail
-rasta/malformed_function: Fail
+rasta/malformed_function: VerificationError
rasta/malformed_function_type: Crash
rasta/mandatory_parameter_initializer: Fail
rasta/mixin_library: Crash
@@ -107,8 +107,8 @@
rasta/type_literals: Crash
rasta/type_with_parse_error: Fail
rasta/typedef: Crash
-rasta/unresolved: Crash
+rasta/unresolved: Fail
rasta/unresolved_constructor: Crash
rasta/unresolved_for_in: Crash
-rasta/unresolved_recovery: Crash
+rasta/unresolved_recovery: Fail
rasta/unsupported_platform_library: Fail
diff --git a/pkg/front_end/test/fasta/kompile_test.dart b/pkg/front_end/test/fasta/kompile_test.dart
index 34175ad..3a128eb 100644
--- a/pkg/front_end/test/fasta/kompile_test.dart
+++ b/pkg/front_end/test/fasta/kompile_test.dart
@@ -4,16 +4,15 @@
library fasta.test.compile_test;
-import 'dart:async' show
- Future;
+import 'dart:async' show Future;
import 'package:front_end/src/fasta/testing/suite.dart';
-Future<FeContext> createContext(
+Future<FastaContext> createContext(
Chain suite, Map<String, String> environment) {
environment[ENABLE_FULL_COMPILE] = "";
environment[AST_KIND_INDEX] = "${AstKind.Analyzer.index}";
- return TestContext.create(suite, environment, FeContext.create);
+ return FastaContext.create(suite, environment);
}
main(List<String> arguments) => runMe(arguments, createContext, "testing.json");
diff --git a/pkg/front_end/test/fasta/outline_test.dart b/pkg/front_end/test/fasta/outline_test.dart
index 1aad820..3826be1 100644
--- a/pkg/front_end/test/fasta/outline_test.dart
+++ b/pkg/front_end/test/fasta/outline_test.dart
@@ -4,14 +4,13 @@
library fasta.test.outline_test;
-import 'dart:async' show
- Future;
+import 'dart:async' show Future;
import 'package:front_end/src/fasta/testing/suite.dart';
-Future<FeContext> createContext(
+Future<FastaContext> createContext(
Chain suite, Map<String, String> environment) {
- return TestContext.create(suite, environment, FeContext.create);
+ return FastaContext.create(suite, environment);
}
main(List<String> arguments) => runMe(arguments, createContext, "testing.json");
diff --git a/pkg/front_end/test/fasta/parser/parser_suite.dart b/pkg/front_end/test/fasta/parser/parser_suite.dart
index b5c1c03..1ac6b2b 100644
--- a/pkg/front_end/test/fasta/parser/parser_suite.dart
+++ b/pkg/front_end/test/fasta/parser/parser_suite.dart
@@ -6,7 +6,7 @@
import 'package:front_end/src/fasta/scanner.dart';
-import 'package:front_end/src/fasta/scanner/testing/scanner_chain.dart';
+import 'package:front_end/src/fasta/testing/scanner_chain.dart';
import 'package:front_end/src/fasta/parser.dart';
diff --git a/pkg/front_end/test/fasta/scanner/scanner_suite.dart b/pkg/front_end/test/fasta/scanner/scanner_suite.dart
index 64ee2f0..ba48f08 100644
--- a/pkg/front_end/test/fasta/scanner/scanner_suite.dart
+++ b/pkg/front_end/test/fasta/scanner/scanner_suite.dart
@@ -4,7 +4,7 @@
import 'package:testing/testing.dart';
-import 'package:front_end/src/fasta/scanner/testing/scanner_chain.dart';
+import 'package:front_end/src/fasta/testing/scanner_chain.dart';
Future<ChainContext> createContext(
Chain suite, Map<String, String> enviroment) async {
diff --git a/pkg/front_end/test/fasta/sdk_test.dart b/pkg/front_end/test/fasta/sdk_test.dart
index 9e77054..0480c67 100644
--- a/pkg/front_end/test/fasta/sdk_test.dart
+++ b/pkg/front_end/test/fasta/sdk_test.dart
@@ -4,20 +4,18 @@
library fasta.test.compile_test;
-import 'dart:async' show
- Future;
+import 'dart:async' show Future;
import 'package:front_end/src/fasta/testing/suite.dart';
-import 'package:front_end/src/fasta/testing/kernel_chain.dart' show
- MatchExpectation;
+import 'package:front_end/src/fasta/testing/kernel_chain.dart'
+ show MatchExpectation;
-Future<FeContext> createContext(
+Future<FastaContext> createContext(
Chain suite, Map<String, String> environment) async {
environment[ENABLE_FULL_COMPILE] = "";
environment[AST_KIND_INDEX] = "${AstKind.Kernel.index}";
- FeContext context =
- await TestContext.create(suite, environment, FeContext.create);
+ FastaContext context = await FastaContext.create(suite, environment);
int index;
for (int i = 0; i < context.steps.length; i++) {
if (context.steps[i] is MatchExpectation) {
diff --git a/pkg/front_end/test/fasta/testing.json b/pkg/front_end/test/fasta/testing.json
index 5c1d52c..e223c8b 100644
--- a/pkg/front_end/test/fasta/testing.json
+++ b/pkg/front_end/test/fasta/testing.json
@@ -136,25 +136,24 @@
"uris": [
"../../lib/src/fasta",
"../../lib/src/fasta/analyzer",
- "../../lib/src/fasta/bin",
"../../lib/src/fasta/builder",
"../../lib/src/fasta/dill",
"../../lib/src/fasta/kernel",
"../../lib/src/fasta/parser",
- "../../lib/src/fasta/parser/bin",
"../../lib/src/fasta/scanner",
- "../../lib/src/fasta/scanner/bin",
- "../../lib/src/fasta/scanner/testing",
"../../lib/src/fasta/source",
"../../lib/src/fasta/testing",
"../../lib/src/fasta/util",
+ "../../tool",
+ "../../tool/fasta",
"parser/parser_suite.dart",
"scanner/scanner_suite.dart",
"compile_test.dart",
"kompile_test.dart",
"outline_test.dart",
"sdk_test.dart",
- "../../../../utils/kernel-service/kernel-service.dart"
+ "../../../../utils/kernel-service/kernel-service.dart",
+ "../../../../tools/patch_sdk.dart"
],
"exclude": [
diff --git a/pkg/front_end/test/subpackage_relationships_test.dart b/pkg/front_end/test/subpackage_relationships_test.dart
index 0cc4c26..ba82d6b 100644
--- a/pkg/front_end/test/subpackage_relationships_test.dart
+++ b/pkg/front_end/test/subpackage_relationships_test.dart
@@ -32,7 +32,7 @@
'lib/src/base': new SubpackageRules(
mayImportAnalyzer: true, allowedDependencies: ['lib']),
'lib/src/fasta':
- new SubpackageRules(mayImportAnalyzer: true, allowedDependencies: [
+ new SubpackageRules(mayImportAnalyzer: false, allowedDependencies: [
'lib/src/fasta/builder',
'lib/src/fasta/dill',
'lib/src/fasta/kernel',
@@ -52,9 +52,6 @@
'lib/src/fasta/scanner',
'lib/src/fasta/source',
]),
- 'lib/src/fasta/bin': new SubpackageRules(allowedDependencies: [
- 'lib/src/fasta',
- ]),
'lib/src/fasta/builder': new SubpackageRules(allowedDependencies: [
'lib/src/fasta',
'lib/src/fasta/dill',
@@ -89,7 +86,6 @@
]),
'lib/src/fasta/source': new SubpackageRules(allowedDependencies: [
'lib/src/fasta',
- 'lib/src/fasta/analyzer',
'lib/src/fasta/builder',
'lib/src/fasta/dill',
'lib/src/fasta/kernel',
@@ -102,6 +98,8 @@
'lib/src/fasta',
'lib/src/fasta/dill',
'lib/src/fasta/kernel',
+ 'lib/src/fasta/analyzer',
+ 'lib/src/fasta/scanner',
]),
'lib/src/fasta/util': new SubpackageRules(),
'lib/src/scanner': new SubpackageRules(allowedDependencies: [
diff --git a/pkg/front_end/tool/fasta/analyzer_compile.dart b/pkg/front_end/tool/fasta/analyzer_compile.dart
new file mode 100644
index 0000000..27f34da
--- /dev/null
+++ b/pkg/front_end/tool/fasta/analyzer_compile.dart
@@ -0,0 +1,8 @@
+// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:front_end/src/fasta/analyzer/analyzer_compile.dart'
+ show mainEntryPoint;
+
+main(List<String> arguments) => mainEntryPoint(arguments);
diff --git a/pkg/front_end/tool/fasta/compile.dart b/pkg/front_end/tool/fasta/compile.dart
new file mode 100644
index 0000000..fc7ccb3
--- /dev/null
+++ b/pkg/front_end/tool/fasta/compile.dart
@@ -0,0 +1,7 @@
+// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:front_end/src/fasta/outline.dart' show compileEntryPoint;
+
+main(List<String> arguments) => compileEntryPoint(arguments);
diff --git a/pkg/front_end/tool/fasta/compile_platform.dart b/pkg/front_end/tool/fasta/compile_platform.dart
new file mode 100644
index 0000000..3759783
--- /dev/null
+++ b/pkg/front_end/tool/fasta/compile_platform.dart
@@ -0,0 +1,7 @@
+// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:front_end/src/fasta/compile_platform.dart' show mainEntryPoint;
+
+main(List<String> arguments) => mainEntryPoint(arguments);
diff --git a/pkg/front_end/tool/fasta/compile_platform_dartk.dart b/pkg/front_end/tool/fasta/compile_platform_dartk.dart
new file mode 100644
index 0000000..78306c3
--- /dev/null
+++ b/pkg/front_end/tool/fasta/compile_platform_dartk.dart
@@ -0,0 +1,8 @@
+// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:front_end/src/fasta/analyzer/compile_platform_dartk.dart'
+ show mainEntryPoint;
+
+main(List<String> arguments) => mainEntryPoint(arguments);
diff --git a/pkg/front_end/lib/src/fasta/bin/generate_dart_libraries.dart b/pkg/front_end/tool/fasta/generate_dart_libraries.dart
similarity index 100%
rename from pkg/front_end/lib/src/fasta/bin/generate_dart_libraries.dart
rename to pkg/front_end/tool/fasta/generate_dart_libraries.dart
diff --git a/pkg/front_end/lib/src/fasta/bin/log_analyzer.dart b/pkg/front_end/tool/fasta/log_analyzer.dart
similarity index 100%
rename from pkg/front_end/lib/src/fasta/bin/log_analyzer.dart
rename to pkg/front_end/tool/fasta/log_analyzer.dart
diff --git a/pkg/front_end/lib/src/fasta/bin/log_collector.dart b/pkg/front_end/tool/fasta/log_collector.dart
similarity index 100%
rename from pkg/front_end/lib/src/fasta/bin/log_collector.dart
rename to pkg/front_end/tool/fasta/log_collector.dart
diff --git a/pkg/front_end/tool/fasta/outline.dart b/pkg/front_end/tool/fasta/outline.dart
new file mode 100644
index 0000000..da75f37
--- /dev/null
+++ b/pkg/front_end/tool/fasta/outline.dart
@@ -0,0 +1,7 @@
+// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:front_end/src/fasta/outline.dart' show outlineEntryPoint;
+
+main(List<String> arguments) => outlineEntryPoint(arguments);
diff --git a/pkg/front_end/tool/fasta/parser.dart b/pkg/front_end/tool/fasta/parser.dart
new file mode 100644
index 0000000..b6091b4
--- /dev/null
+++ b/pkg/front_end/tool/fasta/parser.dart
@@ -0,0 +1,8 @@
+// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:front_end/src/fasta/parser/parser_main.dart'
+ show mainEntryPoint;
+
+main(List<String> arguments) => mainEntryPoint(arguments);
diff --git a/pkg/front_end/tool/fasta/run.dart b/pkg/front_end/tool/fasta/run.dart
new file mode 100644
index 0000000..f42a5ef
--- /dev/null
+++ b/pkg/front_end/tool/fasta/run.dart
@@ -0,0 +1,7 @@
+// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:front_end/src/fasta/run.dart' show mainEntryPoint;
+
+main(List<String> arguments) => mainEntryPoint(arguments);
diff --git a/pkg/front_end/tool/fasta/scanner.dart b/pkg/front_end/tool/fasta/scanner.dart
new file mode 100644
index 0000000..c0de49b
--- /dev/null
+++ b/pkg/front_end/tool/fasta/scanner.dart
@@ -0,0 +1,8 @@
+// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE.md file.
+
+import 'package:front_end/src/fasta/scanner/scanner_main.dart'
+ show mainEntryPoint;
+
+main(List<String> arguments) => mainEntryPoint(arguments);
diff --git a/pkg/front_end/tool/fasta_perf.dart b/pkg/front_end/tool/fasta_perf.dart
index 246c2bb..5b992de 100644
--- a/pkg/front_end/tool/fasta_perf.dart
+++ b/pkg/front_end/tool/fasta_perf.dart
@@ -9,7 +9,6 @@
import 'dart:io';
import 'package:front_end/src/fasta/analyzer/ast_builder.dart';
-import 'package:front_end/src/fasta/ast_kind.dart' show AstKind;
import 'package:front_end/src/fasta/dill/dill_target.dart' show DillTarget;
import 'package:front_end/src/fasta/kernel/kernel_target.dart'
show KernelTarget;
@@ -276,7 +275,7 @@
}
await dillTarget.writeOutline(null);
var program = await kernelTarget.writeOutline(null);
- program = await kernelTarget.writeProgram(null, AstKind.Kernel);
+ program = await kernelTarget.writeProgram(null);
if (kernelTarget.errors.isNotEmpty) {
throw kernelTarget.errors.first;
}
diff --git a/pkg/kernel/bin/eval.dart b/pkg/kernel/bin/eval.dart
new file mode 100755
index 0000000..a3b6140
--- /dev/null
+++ b/pkg/kernel/bin/eval.dart
@@ -0,0 +1,22 @@
+#!/usr/bin/env dart
+// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:kernel/kernel.dart';
+import 'package:kernel/interpreter/interpreter.dart';
+import 'dart:io';
+
+fail(String message) {
+ stderr.writeln(message);
+ exit(1);
+}
+
+main(List<String> args) {
+ if (args.length == 1 && args[0].endsWith('.dill')) {
+ var program = loadProgramFromBinary(args[0]);
+ new Interpreter(program).evalProgram();
+ } else {
+ return fail('One input binary file should be specified.');
+ }
+}
diff --git a/pkg/kernel/lib/ast.dart b/pkg/kernel/lib/ast.dart
index 8f05d4d..aafafcd 100644
--- a/pkg/kernel/lib/ast.dart
+++ b/pkg/kernel/lib/ast.dart
@@ -1257,7 +1257,7 @@
this.returnType: const DynamicType(),
this.inferredReturnValue,
this.asyncMarker: AsyncMarker.Sync,
- this.dartAsyncMarker: AsyncMarker.Sync})
+ this.dartAsyncMarker})
: this.positionalParameters =
positionalParameters ?? <VariableDeclaration>[],
this.requiredParameterCount =
@@ -1269,6 +1269,7 @@
setParents(this.positionalParameters, this);
setParents(this.namedParameters, this);
body?.parent = this;
+ dartAsyncMarker ??= asyncMarker;
}
static DartType _getTypeOfVariable(VariableDeclaration node) => node.type;
@@ -1406,6 +1407,7 @@
}
accept(ExpressionVisitor v);
+ accept1(ExpressionVisitor1 v, arg);
}
/// An expression containing compile-time errors.
@@ -1415,6 +1417,7 @@
DartType getStaticType(TypeEnvironment types) => const BottomType();
accept(ExpressionVisitor v) => v.visitInvalidExpression(this);
+ accept1(ExpressionVisitor1 v, arg) => v.visitInvalidExpression(this, arg);
visitChildren(Visitor v) {}
transformChildren(Transformer v) {}
@@ -1432,6 +1435,7 @@
}
accept(ExpressionVisitor v) => v.visitVariableGet(this);
+ accept1(ExpressionVisitor1 v, arg) => v.visitVariableGet(this, arg);
visitChildren(Visitor v) {
promotedType?.accept(v);
@@ -1458,6 +1462,7 @@
DartType getStaticType(TypeEnvironment types) => value.getStaticType(types);
accept(ExpressionVisitor v) => v.visitVariableSet(this);
+ accept1(ExpressionVisitor1 v, arg) => v.visitVariableSet(this, arg);
visitChildren(Visitor v) {
value?.accept(v);
@@ -1514,6 +1519,7 @@
}
accept(ExpressionVisitor v) => v.visitPropertyGet(this);
+ accept1(ExpressionVisitor1 v, arg) => v.visitPropertyGet(this, arg);
visitChildren(Visitor v) {
receiver?.accept(v);
@@ -1560,6 +1566,7 @@
DartType getStaticType(TypeEnvironment types) => value.getStaticType(types);
accept(ExpressionVisitor v) => v.visitPropertySet(this);
+ accept1(ExpressionVisitor1 v, arg) => v.visitPropertySet(this, arg);
visitChildren(Visitor v) {
receiver?.accept(v);
@@ -1610,6 +1617,7 @@
}
accept(ExpressionVisitor v) => v.visitDirectPropertyGet(this);
+ accept1(ExpressionVisitor1 v, arg) => v.visitDirectPropertyGet(this, arg);
DartType getStaticType(TypeEnvironment types) {
Class superclass = target.enclosingClass;
@@ -1661,6 +1669,7 @@
}
accept(ExpressionVisitor v) => v.visitDirectPropertySet(this);
+ accept1(ExpressionVisitor1 v, arg) => v.visitDirectPropertySet(this, arg);
DartType getStaticType(TypeEnvironment types) => value.getStaticType(types);
}
@@ -1707,6 +1716,8 @@
}
accept(ExpressionVisitor v) => v.visitDirectMethodInvocation(this);
+ accept1(ExpressionVisitor1 v, arg) =>
+ v.visitDirectMethodInvocation(this, arg);
DartType getStaticType(TypeEnvironment types) {
if (types.isOverloadedArithmeticOperator(target)) {
@@ -1755,6 +1766,7 @@
}
accept(ExpressionVisitor v) => v.visitSuperPropertyGet(this);
+ accept1(ExpressionVisitor1 v, arg) => v.visitSuperPropertyGet(this, arg);
visitChildren(Visitor v) {
name?.accept(v);
@@ -1790,6 +1802,7 @@
DartType getStaticType(TypeEnvironment types) => value.getStaticType(types);
accept(ExpressionVisitor v) => v.visitSuperPropertySet(this);
+ accept1(ExpressionVisitor1 v, arg) => v.visitSuperPropertySet(this, arg);
visitChildren(Visitor v) {
name?.accept(v);
@@ -1822,6 +1835,7 @@
DartType getStaticType(TypeEnvironment types) => target.getterType;
accept(ExpressionVisitor v) => v.visitStaticGet(this);
+ accept1(ExpressionVisitor1 v, arg) => v.visitStaticGet(this, arg);
visitChildren(Visitor v) {
target?.acceptReference(v);
@@ -1854,6 +1868,7 @@
DartType getStaticType(TypeEnvironment types) => value.getStaticType(types);
accept(ExpressionVisitor v) => v.visitStaticSet(this);
+ accept1(ExpressionVisitor1 v, arg) => v.visitStaticSet(this, arg);
visitChildren(Visitor v) {
target?.acceptReference(v);
@@ -1998,6 +2013,7 @@
}
accept(ExpressionVisitor v) => v.visitMethodInvocation(this);
+ accept1(ExpressionVisitor1 v, arg) => v.visitMethodInvocation(this, arg);
visitChildren(Visitor v) {
receiver?.accept(v);
@@ -2055,6 +2071,7 @@
}
accept(ExpressionVisitor v) => v.visitSuperMethodInvocation(this);
+ accept1(ExpressionVisitor1 v, arg) => v.visitSuperMethodInvocation(this, arg);
visitChildren(Visitor v) {
name?.accept(v);
@@ -2104,6 +2121,7 @@
}
accept(ExpressionVisitor v) => v.visitStaticInvocation(this);
+ accept1(ExpressionVisitor1 v, arg) => v.visitStaticInvocation(this, arg);
visitChildren(Visitor v) {
target?.acceptReference(v);
@@ -2155,6 +2173,7 @@
}
accept(ExpressionVisitor v) => v.visitConstructorInvocation(this);
+ accept1(ExpressionVisitor1 v, arg) => v.visitConstructorInvocation(this, arg);
visitChildren(Visitor v) {
target?.acceptReference(v);
@@ -2189,6 +2208,7 @@
DartType getStaticType(TypeEnvironment types) => types.boolType;
accept(ExpressionVisitor v) => v.visitNot(this);
+ accept1(ExpressionVisitor1 v, arg) => v.visitNot(this, arg);
visitChildren(Visitor v) {
operand?.accept(v);
@@ -2216,6 +2236,7 @@
DartType getStaticType(TypeEnvironment types) => types.boolType;
accept(ExpressionVisitor v) => v.visitLogicalExpression(this);
+ accept1(ExpressionVisitor1 v, arg) => v.visitLogicalExpression(this, arg);
visitChildren(Visitor v) {
left?.accept(v);
@@ -2253,6 +2274,7 @@
DartType getStaticType(TypeEnvironment types) => staticType;
accept(ExpressionVisitor v) => v.visitConditionalExpression(this);
+ accept1(ExpressionVisitor1 v, arg) => v.visitConditionalExpression(this, arg);
visitChildren(Visitor v) {
condition?.accept(v);
@@ -2297,6 +2319,7 @@
DartType getStaticType(TypeEnvironment types) => types.stringType;
accept(ExpressionVisitor v) => v.visitStringConcatenation(this);
+ accept1(ExpressionVisitor1 v, arg) => v.visitStringConcatenation(this, arg);
visitChildren(Visitor v) {
visitList(expressions, v);
@@ -2319,6 +2342,7 @@
DartType getStaticType(TypeEnvironment types) => types.boolType;
accept(ExpressionVisitor v) => v.visitIsExpression(this);
+ accept1(ExpressionVisitor1 v, arg) => v.visitIsExpression(this, arg);
visitChildren(Visitor v) {
operand?.accept(v);
@@ -2346,6 +2370,7 @@
DartType getStaticType(TypeEnvironment types) => type;
accept(ExpressionVisitor v) => v.visitAsExpression(this);
+ accept1(ExpressionVisitor1 v, arg) => v.visitAsExpression(this, arg);
visitChildren(Visitor v) {
operand?.accept(v);
@@ -2377,6 +2402,7 @@
DartType getStaticType(TypeEnvironment types) => types.stringType;
accept(ExpressionVisitor v) => v.visitStringLiteral(this);
+ accept1(ExpressionVisitor1 v, arg) => v.visitStringLiteral(this, arg);
}
class IntLiteral extends BasicLiteral {
@@ -2387,6 +2413,7 @@
DartType getStaticType(TypeEnvironment types) => types.intType;
accept(ExpressionVisitor v) => v.visitIntLiteral(this);
+ accept1(ExpressionVisitor1 v, arg) => v.visitIntLiteral(this, arg);
}
class DoubleLiteral extends BasicLiteral {
@@ -2397,6 +2424,7 @@
DartType getStaticType(TypeEnvironment types) => types.doubleType;
accept(ExpressionVisitor v) => v.visitDoubleLiteral(this);
+ accept1(ExpressionVisitor1 v, arg) => v.visitDoubleLiteral(this, arg);
}
class BoolLiteral extends BasicLiteral {
@@ -2407,6 +2435,7 @@
DartType getStaticType(TypeEnvironment types) => types.boolType;
accept(ExpressionVisitor v) => v.visitBoolLiteral(this);
+ accept1(ExpressionVisitor1 v, arg) => v.visitBoolLiteral(this, arg);
}
class NullLiteral extends BasicLiteral {
@@ -2415,6 +2444,7 @@
DartType getStaticType(TypeEnvironment types) => const BottomType();
accept(ExpressionVisitor v) => v.visitNullLiteral(this);
+ accept1(ExpressionVisitor1 v, arg) => v.visitNullLiteral(this, arg);
}
class SymbolLiteral extends Expression {
@@ -2425,6 +2455,7 @@
DartType getStaticType(TypeEnvironment types) => types.symbolType;
accept(ExpressionVisitor v) => v.visitSymbolLiteral(this);
+ accept1(ExpressionVisitor1 v, arg) => v.visitSymbolLiteral(this, arg);
visitChildren(Visitor v) {}
transformChildren(Transformer v) {}
@@ -2438,6 +2469,7 @@
DartType getStaticType(TypeEnvironment types) => types.typeType;
accept(ExpressionVisitor v) => v.visitTypeLiteral(this);
+ accept1(ExpressionVisitor1 v, arg) => v.visitTypeLiteral(this, arg);
visitChildren(Visitor v) {
type?.accept(v);
@@ -2452,6 +2484,7 @@
DartType getStaticType(TypeEnvironment types) => types.thisType;
accept(ExpressionVisitor v) => v.visitThisExpression(this);
+ accept1(ExpressionVisitor1 v, arg) => v.visitThisExpression(this, arg);
visitChildren(Visitor v) {}
transformChildren(Transformer v) {}
@@ -2461,6 +2494,7 @@
DartType getStaticType(TypeEnvironment types) => const BottomType();
accept(ExpressionVisitor v) => v.visitRethrow(this);
+ accept1(ExpressionVisitor1 v, arg) => v.visitRethrow(this, arg);
visitChildren(Visitor v) {}
transformChildren(Transformer v) {}
@@ -2476,6 +2510,7 @@
DartType getStaticType(TypeEnvironment types) => const BottomType();
accept(ExpressionVisitor v) => v.visitThrow(this);
+ accept1(ExpressionVisitor1 v, arg) => v.visitThrow(this, arg);
visitChildren(Visitor v) {
expression?.accept(v);
@@ -2505,6 +2540,7 @@
}
accept(ExpressionVisitor v) => v.visitListLiteral(this);
+ accept1(ExpressionVisitor1 v, arg) => v.visitListLiteral(this, arg);
visitChildren(Visitor v) {
typeArgument?.accept(v);
@@ -2537,6 +2573,7 @@
}
accept(ExpressionVisitor v) => v.visitMapLiteral(this);
+ accept1(ExpressionVisitor1 v, arg) => v.visitMapLiteral(this, arg);
visitChildren(Visitor v) {
keyType?.accept(v);
@@ -2592,6 +2629,7 @@
}
accept(ExpressionVisitor v) => v.visitAwaitExpression(this);
+ accept1(ExpressionVisitor1 v, arg) => v.visitAwaitExpression(this, arg);
visitChildren(Visitor v) {
operand?.accept(v);
@@ -2618,6 +2656,7 @@
DartType getStaticType(TypeEnvironment types) => function.functionType;
accept(ExpressionVisitor v) => v.visitFunctionExpression(this);
+ accept1(ExpressionVisitor1 v, arg) => v.visitFunctionExpression(this, arg);
visitChildren(Visitor v) {
function?.accept(v);
@@ -2644,6 +2683,7 @@
DartType getStaticType(TypeEnvironment types) => body.getStaticType(types);
accept(ExpressionVisitor v) => v.visitLet(this);
+ accept1(ExpressionVisitor1 v, arg) => v.visitLet(this, arg);
visitChildren(Visitor v) {
variable?.accept(v);
@@ -2685,6 +2725,7 @@
}
accept(ExpressionVisitor v) => v.visitLoadLibrary(this);
+ accept1(ExpressionVisitor1 v, arg) => v.visitLoadLibrary(this, arg);
visitChildren(Visitor v) {}
transformChildren(Transformer v) {}
@@ -2702,6 +2743,7 @@
}
accept(ExpressionVisitor v) => v.visitCheckLibraryIsLoaded(this);
+ accept1(ExpressionVisitor1 v, arg) => v.visitCheckLibraryIsLoaded(this, arg);
visitChildren(Visitor v) {}
transformChildren(Transformer v) {}
diff --git a/pkg/kernel/lib/interpreter/interpreter.dart b/pkg/kernel/lib/interpreter/interpreter.dart
new file mode 100644
index 0000000..f4f8779
--- /dev/null
+++ b/pkg/kernel/lib/interpreter/interpreter.dart
@@ -0,0 +1,83 @@
+// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
+// for 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 kernerl.interpreter;
+
+import 'dart:collection';
+import '../ast.dart';
+
+class NotImplemented {
+ String message;
+
+ NotImplemented(this.message);
+
+ String toString() => message;
+}
+
+class Interpreter {
+ Program program;
+
+ Interpreter(this.program);
+
+ void evalProgram() {
+ assert(program.libraries.isEmpty);
+ Procedure mainMethod = program.mainMethod;
+ Statement statementBlock = mainMethod.function.body;
+ // Evaluate only statement with one expression, ExpressionStatement, which
+ // is StaticInvocation of the method print.
+ if (statementBlock is Block) {
+ Statement statement = statementBlock.statements.first;
+ if (statement is ExpressionStatement) {
+ statement.expression.accept1(new ExpressionEval1(),
+ new ExpressionState(new HashMap<String, Object>()));
+ }
+ } else {
+ throw new NotImplemented('Evaluation for statement type '
+ '${statementBlock.runtimeType} is not implemented');
+ }
+ }
+}
+
+class InvalidExpressionError {
+ InvalidExpression expression;
+
+ InvalidExpressionError(this.expression);
+
+ String toString() => 'Invalid expression at '
+ '${expression.location.toString()}';
+}
+
+class ExpressionState {
+ Map<String, Object> environment;
+
+ ExpressionState(this.environment);
+}
+
+class ExpressionEval1 extends ExpressionVisitor1<Object> {
+ @override
+ Object defaultExpression(Expression node, arg) {
+ throw new NotImplemented('Evaluation for expressions of type '
+ '${node.runtimeType} is not implemented.');
+ }
+
+ Object visitInvalidExpression1(InvalidExpression node, arg) =>
+ throw new InvalidExpressionError(node);
+
+ Object visitStaticInvocation(StaticInvocation node, arg) {
+ if ('print' == node.name.toString()) {
+ // Special evaluation of print.
+ var res = node.arguments.positional[0].accept1(this, arg);
+ print(res);
+ } else {
+ throw new NotImplemented('Support for statement type '
+ '${node.runtimeType} is not implemented');
+ }
+ }
+
+ // Evaluation of BasicLiterals.
+ Object visitStringLiteral(StringLiteral node, arg) => node.value;
+ Object visitIntLiteral(IntLiteral node, arg) => node.value;
+ Object visitDoubleLiteral(DoubleLiteral node, arg) => node.value;
+ Object visitBoolLiteral(BoolLiteral node, arg) => node.value;
+ Object visitNullLiteral(NullLiteral node, arg) => node.value;
+}
diff --git a/pkg/kernel/lib/transformations/async.dart b/pkg/kernel/lib/transformations/async.dart
index b01f71a..352b416 100644
--- a/pkg/kernel/lib/transformations/async.dart
+++ b/pkg/kernel/lib/transformations/async.dart
@@ -417,7 +417,8 @@
Arguments arguments = new Arguments(<Expression>[
expr.operand,
new VariableGet(R.thenContinuationVariable),
- new VariableGet(R.catchErrorContinuationVariable)
+ new VariableGet(R.catchErrorContinuationVariable),
+ new VariableGet(R.nestedClosureVariable),
]);
statements.add(new ExpressionStatement(
new StaticInvocation(R.helper.awaitHelper, arguments)
diff --git a/pkg/kernel/lib/transformations/insert_covariance_checks.dart b/pkg/kernel/lib/transformations/insert_covariance_checks.dart
index 081dbfa..7bc18bea 100644
--- a/pkg/kernel/lib/transformations/insert_covariance_checks.dart
+++ b/pkg/kernel/lib/transformations/insert_covariance_checks.dart
@@ -377,7 +377,8 @@
// function type parameters (in case the function is generic).
var targetType = cloneParameter.type;
cloneParameter.type = cloner.visitType(getSafeType(unsafeInputs));
- return new AsExpression(new VariableGet(cloneParameter), targetType);
+ return new AsExpression(new VariableGet(cloneParameter), targetType)
+ ..fileOffset = parameter.fileOffset;
}
// TODO: Insert checks for type parameter bounds.
@@ -416,7 +417,8 @@
Expression argument = new VariableGet(parameter);
if (unsafeTypes != null) {
var castType = substitute(field.type, ownSubstitution);
- argument = new AsExpression(argument, castType);
+ argument = new AsExpression(argument, castType)
+ ..fileOffset = field.fileOffset;
var inputType = substitute(getSafeType(unsafeTypes), ownSubstitution);
parameter.type = inputType;
}
@@ -429,7 +431,8 @@
var setter = new Procedure(
covariantCheckedName(field.name),
ProcedureKind.Setter,
- new FunctionNode(body, positionalParameters: [parameter]));
+ new FunctionNode(body, positionalParameters: [parameter]))
+ ..fileUri = field.fileUri;
host.addMember(setter);
if (field.enclosingClass == host) {
diff --git a/pkg/kernel/lib/visitor.dart b/pkg/kernel/lib/visitor.dart
index 5aec3f7..4790e73 100644
--- a/pkg/kernel/lib/visitor.dart
+++ b/pkg/kernel/lib/visitor.dart
@@ -318,3 +318,66 @@
return node;
}
}
+
+abstract class ExpressionVisitor1<R> {
+ R defaultExpression(Expression node, arg) => null;
+ R defaultBasicLiteral(BasicLiteral node, arg) => defaultExpression(node, arg);
+ R visitInvalidExpression(InvalidExpression node, arg) =>
+ defaultExpression(node, arg);
+ R visitVariableGet(VariableGet node, arg) => defaultExpression(node, arg);
+ R visitVariableSet(VariableSet node, arg) => defaultExpression(node, arg);
+ R visitPropertyGet(PropertyGet node, arg) => defaultExpression(node, arg);
+ R visitPropertySet(PropertySet node, arg) => defaultExpression(node, arg);
+ R visitDirectPropertyGet(DirectPropertyGet node, arg) =>
+ defaultExpression(node, arg);
+ R visitDirectPropertySet(DirectPropertySet node, arg) =>
+ defaultExpression(node, arg);
+ R visitSuperPropertyGet(SuperPropertyGet node, arg) =>
+ defaultExpression(node, arg);
+ R visitSuperPropertySet(SuperPropertySet node, arg) =>
+ defaultExpression(node, arg);
+ R visitStaticGet(StaticGet node, arg) => defaultExpression(node, arg);
+ R visitStaticSet(StaticSet node, arg) => defaultExpression(node, arg);
+ R visitMethodInvocation(MethodInvocation node, arg) =>
+ defaultExpression(node, arg);
+ R visitDirectMethodInvocation(DirectMethodInvocation node, arg) =>
+ defaultExpression(node, arg);
+ R visitSuperMethodInvocation(SuperMethodInvocation node, arg) =>
+ defaultExpression(node, arg);
+ R visitStaticInvocation(StaticInvocation node, arg) =>
+ defaultExpression(node, arg);
+ R visitConstructorInvocation(ConstructorInvocation node, arg) =>
+ defaultExpression(node, arg);
+ R visitNot(Not node, arg) => defaultExpression(node, arg);
+ R visitLogicalExpression(LogicalExpression node, arg) =>
+ defaultExpression(node, arg);
+ R visitConditionalExpression(ConditionalExpression node, arg) =>
+ defaultExpression(node, arg);
+ R visitStringConcatenation(StringConcatenation node, arg) =>
+ defaultExpression(node, arg);
+ R visitIsExpression(IsExpression node, arg) => defaultExpression(node, arg);
+ R visitAsExpression(AsExpression node, arg) => defaultExpression(node, arg);
+ R visitSymbolLiteral(SymbolLiteral node, arg) => defaultExpression(node, arg);
+ R visitTypeLiteral(TypeLiteral node, arg) => defaultExpression(node, arg);
+ R visitThisExpression(ThisExpression node, arg) =>
+ defaultExpression(node, arg);
+ R visitRethrow(Rethrow node, arg) => defaultExpression(node, arg);
+ R visitThrow(Throw node, arg) => defaultExpression(node, arg);
+ R visitListLiteral(ListLiteral node, arg) => defaultExpression(node, arg);
+ R visitMapLiteral(MapLiteral node, arg) => defaultExpression(node, arg);
+ R visitAwaitExpression(AwaitExpression node, arg) =>
+ defaultExpression(node, arg);
+ R visitFunctionExpression(FunctionExpression node, arg) =>
+ defaultExpression(node, arg);
+ R visitStringLiteral(StringLiteral node, arg) =>
+ defaultBasicLiteral(node, arg);
+ R visitIntLiteral(IntLiteral node, arg) => defaultBasicLiteral(node, arg);
+ R visitDoubleLiteral(DoubleLiteral node, arg) =>
+ defaultBasicLiteral(node, arg);
+ R visitBoolLiteral(BoolLiteral node, arg) => defaultBasicLiteral(node, arg);
+ R visitNullLiteral(NullLiteral node, arg) => defaultBasicLiteral(node, arg);
+ R visitLet(Let node, arg) => defaultExpression(node, arg);
+ R visitLoadLibrary(LoadLibrary node, arg) => defaultExpression(node, arg);
+ R visitCheckLibraryIsLoaded(CheckLibraryIsLoaded node, arg) =>
+ defaultExpression(node, arg);
+}
diff --git a/pkg/kernel/testcases/strong-mode/covariant_generic.baseline.txt b/pkg/kernel/testcases/strong-mode/covariant_generic.baseline.txt
index 5bd8f3c..1e99fae 100644
--- a/pkg/kernel/testcases/strong-mode/covariant_generic.baseline.txt
+++ b/pkg/kernel/testcases/strong-mode/covariant_generic.baseline.txt
@@ -15,7 +15,7 @@
method withCallback((self::Foo::T) → void callback) → void {
callback.call(this.{self::Foo::finalField});
}
- set /* from null */ mutableField$cc(core::Object mutableField_) → dynamic
+ set mutableField$cc(core::Object mutableField_) → dynamic
this.{=self::Foo::mutableField} = mutableField_ as self::Foo::T;
method method$cc(core::Object x) → void
this.{=self::Foo::method}(x as self::Foo::T);
diff --git a/pkg/pkg.status b/pkg/pkg.status
index f842b8f..ba2d694 100644
--- a/pkg/pkg.status
+++ b/pkg/pkg.status
@@ -28,6 +28,7 @@
front_end/test/fasta/sdk_test: SkipByDesign
front_end/test/fasta/compile_test: Pass, Slow
+front_end/test/fasta/bootstrap_test: Pass, Slow
# These are not tests but input for tests.
kernel/testcases/*: Skip
@@ -75,6 +76,7 @@
front_end/test/fasta/compile_test: Skip # Issue 28629
front_end/test/fasta/kompile_test: Skip # Issue 28629
front_end/test/fasta/outline_test: Skip # Issue 28629
+front_end/test/fasta/bootstrap_test: Skip # Issue 28629
[ $runtime == vm && $use_sdk == false ]
front_end/test/incremental_kernel_generator_test: Skip # Issue 28698
diff --git a/runtime/bin/isolate_data.cc b/runtime/bin/isolate_data.cc
index c10180d..1cf3ebe 100644
--- a/runtime/bin/isolate_data.cc
+++ b/runtime/bin/isolate_data.cc
@@ -29,6 +29,14 @@
}
+void IsolateData::OnIsolateShutdown() {
+ if (builtin_lib_ != NULL) {
+ Dart_DeletePersistentHandle(builtin_lib_);
+ builtin_lib_ = NULL;
+ }
+}
+
+
IsolateData::~IsolateData() {
free(script_url);
script_url = NULL;
@@ -38,9 +46,6 @@
packages_file = NULL;
free(udp_receive_buffer);
udp_receive_buffer = NULL;
- if (builtin_lib_ != NULL) {
- Dart_DeletePersistentHandle(builtin_lib_);
- }
delete app_snapshot_;
app_snapshot_ = NULL;
}
diff --git a/runtime/bin/isolate_data.h b/runtime/bin/isolate_data.h
index fea458c..792f893 100644
--- a/runtime/bin/isolate_data.h
+++ b/runtime/bin/isolate_data.h
@@ -68,6 +68,8 @@
dependencies_ = deps;
}
+ void OnIsolateShutdown();
+
private:
Dart_Handle builtin_lib_;
Loader* loader_;
diff --git a/runtime/bin/main.cc b/runtime/bin/main.cc
index 6d7bc5e..5290205 100644
--- a/runtime/bin/main.cc
+++ b/runtime/bin/main.cc
@@ -1150,7 +1150,14 @@
return buffer;
}
-static void ShutdownIsolate(void* callback_data) {
+
+static void OnIsolateShutdown(void* callback_data) {
+ IsolateData* isolate_data = reinterpret_cast<IsolateData*>(callback_data);
+ isolate_data->OnIsolateShutdown();
+}
+
+
+static void DeleteIsolateData(void* callback_data) {
IsolateData* isolate_data = reinterpret_cast<IsolateData*>(callback_data);
delete isolate_data;
}
@@ -1613,7 +1620,8 @@
init_params.vm_snapshot_data = vm_snapshot_data;
init_params.vm_snapshot_instructions = vm_snapshot_instructions;
init_params.create = CreateIsolateAndSetup;
- init_params.shutdown = ShutdownIsolate;
+ init_params.shutdown = OnIsolateShutdown;
+ init_params.cleanup = DeleteIsolateData;
init_params.file_open = DartUtils::OpenFile;
init_params.file_read = DartUtils::ReadFile;
init_params.file_write = DartUtils::WriteFile;
diff --git a/runtime/bin/run_vm_tests.cc b/runtime/bin/run_vm_tests.cc
index 2749b14..ed1e096 100644
--- a/runtime/bin/run_vm_tests.cc
+++ b/runtime/bin/run_vm_tests.cc
@@ -123,7 +123,7 @@
ASSERT(set_vm_flags_success);
const char* err_msg = Dart::InitOnce(
dart::bin::vm_snapshot_data, dart::bin::vm_snapshot_instructions, NULL,
- NULL, NULL, dart::bin::DartUtils::OpenFile,
+ NULL, NULL, NULL, dart::bin::DartUtils::OpenFile,
dart::bin::DartUtils::ReadFile, dart::bin::DartUtils::WriteFile,
dart::bin::DartUtils::CloseFile, NULL, NULL);
ASSERT(err_msg == NULL);
diff --git a/runtime/bin/vmservice/server.dart b/runtime/bin/vmservice/server.dart
index 020badb..c789dcf 100644
--- a/runtime/bin/vmservice/server.dart
+++ b/runtime/bin/vmservice/server.dart
@@ -4,6 +4,17 @@
part of vmservice_io;
+final bool silentObservatory =
+ const bool.fromEnvironment('SILENT_OBSERVATORY');
+
+void serverPrint(String s) {
+ if (silentObservatory) {
+ // We've been requested to be silent.
+ return;
+ }
+ print(s);
+}
+
class WebSocketClient extends Client {
static const int PARSE_ERROR_CODE = 4000;
static const int BINARY_MESSAGE_ERROR_CODE = 4001;
@@ -60,9 +71,9 @@
socket.addUtf8Text(cstring);
}
} catch (e, st) {
- print("Ignoring error posting over WebSocket.");
- print(e);
- print(st);
+ serverPrint("Ignoring error posting over WebSocket.");
+ serverPrint(e);
+ serverPrint(st);
}
}
@@ -292,8 +303,8 @@
var message = new Message.fromUri(client, request.uri);
client.onMessage(null, message);
} catch (e) {
- print('Unexpected error processing HTTP request uri: '
- '${request.uri}\n$e\n');
+ serverPrint('Unexpected error processing HTTP request uri: '
+ '${request.uri}\n$e\n');
rethrow;
}
}
@@ -319,13 +330,13 @@
}
_server = await HttpServer.bind(address, _port);
_server.listen(_requestHandler, cancelOnError: true);
- print('Observatory listening on $serverAddress');
+ serverPrint('Observatory listening on $serverAddress');
// Server is up and running.
_notifyServerState(serverAddress.toString());
onServerAddressChange('$serverAddress');
return this;
} catch (e, st) {
- print('Could not start Observatory HTTP server:\n$e\n$st\n');
+ serverPrint('Could not start Observatory HTTP server:\n$e\n$st\n');
_notifyServerState("");
onServerAddressChange(null);
return this;
@@ -348,14 +359,14 @@
// Shutdown HTTP server and subscription.
Uri oldServerAddress = serverAddress;
return cleanup(forced).then((_) {
- print('Observatory no longer listening on $oldServerAddress');
+ serverPrint('Observatory no longer listening on $oldServerAddress');
_server = null;
_notifyServerState("");
onServerAddressChange(null);
return this;
}).catchError((e, st) {
_server = null;
- print('Could not shutdown Observatory HTTP server:\n$e\n$st\n');
+ serverPrint('Could not shutdown Observatory HTTP server:\n$e\n$st\n');
_notifyServerState("");
onServerAddressChange(null);
return this;
diff --git a/runtime/include/dart_api.h b/runtime/include/dart_api.h
index 4db9363..0bbb63b 100644
--- a/runtime/include/dart_api.h
+++ b/runtime/include/dart_api.h
@@ -611,7 +611,7 @@
* for each part.
*/
-#define DART_FLAGS_CURRENT_VERSION (0x00000001)
+#define DART_FLAGS_CURRENT_VERSION (0x00000002)
typedef struct {
int32_t version;
@@ -619,6 +619,7 @@
bool enable_asserts;
bool enable_error_on_bad_type;
bool enable_error_on_bad_override;
+ bool use_field_guards;
} Dart_IsolateFlags;
/**
@@ -708,6 +709,22 @@
typedef void (*Dart_IsolateShutdownCallback)(void* callback_data);
/**
+ * An isolate cleanup callback function.
+ *
+ * This callback, provided by the embedder, is called after the vm
+ * shuts down an isolate. There will be no current isolate and it is *not*
+ * safe to run Dart code.
+ *
+ * This function should be used to dispose of native resources that
+ * are allocated to an isolate in order to avoid leaks.
+ *
+ * \param callback_data The same callback data which was passed to the
+ * isolate when it was created.
+ *
+ */
+typedef void (*Dart_IsolateCleanupCallback)(void* callback_data);
+
+/**
* A thread death callback function.
* This callback, provided by the embedder, is called before a thread in the
* vm thread pool exits.
@@ -788,6 +805,8 @@
* See Dart_IsolateCreateCallback.
* \param shutdown A function to be called when an isolate is shutdown.
* See Dart_IsolateShutdownCallback.
+ * \param cleanup A function to be called after an isolate is shutdown.
+ * See Dart_IsolateCleanupCallback.
* \param get_service_assets A function to be called by the service isolate when
* it requires the vmservice assets archive.
* See Dart_GetVMServiceAssetsArchive.
@@ -798,6 +817,7 @@
const uint8_t* vm_snapshot_instructions;
Dart_IsolateCreateCallback create;
Dart_IsolateShutdownCallback shutdown;
+ Dart_IsolateCleanupCallback cleanup;
Dart_ThreadExitCallback thread_exit;
Dart_FileOpenCallback file_open;
Dart_FileReadCallback file_read;
diff --git a/runtime/lib/async_patch.dart b/runtime/lib/async_patch.dart
index 0dd99e0..2823b73 100644
--- a/runtime/lib/async_patch.dart
+++ b/runtime/lib/async_patch.dart
@@ -45,7 +45,10 @@
///
/// Returns the result of registering with `.then`.
Future _awaitHelper(
- var object, Function thenCallback, Function errorCallback) {
+ var object,
+ Function thenCallback,
+ Function errorCallback,
+ var awaiter) {
if (object is! Future) {
object = new _Future().._setValue(object);
} else if (object is! _Future) {
@@ -59,9 +62,20 @@
//
// We can only do this for our internal futures (the default implementation of
// all futures that are constructed by the `dart:async` library).
+ object._awaiter = awaiter;
return object._thenNoZoneRegistration(thenCallback, errorCallback);
}
+// Called as part of the 'await for (...)' construct. Registers the
+// awaiter on the stream.
+void _asyncStarListenHelper(var object, var awaiter) {
+ if (object is! _StreamImpl) {
+ return;
+ }
+ // `object` is a `_StreamImpl`.
+ object._awaiter = awaiter;
+}
+
// _AsyncStarStreamController is used by the compiler to implement
// async* generator functions.
class _AsyncStarStreamController {
@@ -73,7 +87,14 @@
bool isSuspendedAtYield = false;
Completer cancellationCompleter = null;
- Stream get stream => controller.stream;
+ Stream get stream {
+ Stream local = controller.stream;
+ if (local is! _StreamImpl) {
+ return local;
+ }
+ local._generator = asyncStarBody;
+ return local;
+ }
void runBody() {
isScheduled = false;
@@ -194,10 +215,23 @@
@patch void _rethrow(Object error, StackTrace stackTrace) native "Async_rethrow";
+@patch class _Future<T> {
+ /// The closure implementing the async[*]-body that is `await`ing this future.
+ Function _awaiter;
+}
+
+@patch class _StreamImpl<T> {
+ /// The closure implementing the async[*]-body that is `await`ing this future.
+ Function _awaiter;
+ /// The closure implementing the async-generator body that is creating events
+ /// for this stream.
+ Function _generator;
+}
/// Returns a [StackTrace] object containing the synchronous prefix for this
/// asynchronous method.
-Object _asyncStackTraceHelper() native "StackTrace_asyncStackTraceHelper";
+Object _asyncStackTraceHelper()
+ native "StackTrace_asyncStackTraceHelper";
void _clearAsyncThreadStackTrace()
native "StackTrace_clearAsyncThreadStackTrace";
diff --git a/runtime/observatory/tests/service/pause_on_unhandled_async_exceptions2_test.dart b/runtime/observatory/tests/service/pause_on_unhandled_async_exceptions2_test.dart
new file mode 100644
index 0000000..1812693
--- /dev/null
+++ b/runtime/observatory/tests/service/pause_on_unhandled_async_exceptions2_test.dart
@@ -0,0 +1,53 @@
+// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+// VMOptions=--error_on_bad_type --error_on_bad_override
+
+import 'package:observatory/service_io.dart';
+import 'package:observatory/models.dart' as M;
+import 'package:unittest/unittest.dart';
+import 'test_helper.dart';
+import 'service_test_common.dart';
+
+const LINE_A = 29;
+
+class Foo {
+
+}
+
+doThrow() {
+ throw "TheException"; // Line 13.
+ return "end of doThrow";
+}
+
+asyncThrower() async {
+ doThrow();
+}
+
+testeeMain() async {
+ // No try ... catch.
+ await asyncThrower();
+}
+
+var tests = [
+ hasStoppedWithUnhandledException,
+
+ (Isolate isolate) async {
+ print("We stoppped!");
+ var stack = await isolate.getStack();
+ expect(stack['asyncCausalFrames'], isNotNull);
+ var asyncStack = stack['asyncCausalFrames'];
+ expect(asyncStack[0].toString(), contains('doThrow'));
+ expect(asyncStack[1].toString(), contains('asyncThrower'));
+ expect(asyncStack[2].kind, equals(M.FrameKind.asyncSuspensionMarker));
+ expect(asyncStack[3].toString(), contains('testeeMain'));
+ // We've stopped at LINE_A.
+ expect(await asyncStack[3].location.toUserString(),
+ contains('.dart:$LINE_A'));
+ }
+];
+
+main(args) => runIsolateTests(args,
+ tests,
+ pause_on_unhandled_exceptions: true,
+ testeeConcurrent: testeeMain);
diff --git a/runtime/observatory/tests/service/pause_on_unhandled_async_exceptions_test.dart b/runtime/observatory/tests/service/pause_on_unhandled_async_exceptions_test.dart
new file mode 100644
index 0000000..2f4354e
--- /dev/null
+++ b/runtime/observatory/tests/service/pause_on_unhandled_async_exceptions_test.dart
@@ -0,0 +1,65 @@
+// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+// VMOptions=--error_on_bad_type --error_on_bad_override
+
+import 'package:observatory/service_io.dart';
+import 'package:observatory/models.dart' as M;
+import 'package:unittest/unittest.dart';
+import 'test_helper.dart';
+import 'service_test_common.dart';
+
+const LINE_A = 37;
+
+class Foo {
+
+}
+
+doThrow() {
+ throw "TheException"; // Line 13.
+ return "end of doThrow";
+}
+
+asyncThrower() async {
+ doThrow();
+}
+
+testeeMain() async {
+ try {
+ // caught.
+ try {
+ await asyncThrower();
+ } catch (e) {
+ }
+
+ // uncaught.
+ try {
+ await asyncThrower(); // LINE_A.
+ } on double catch (e) {
+ }
+ } on Foo catch (e) {
+ }
+}
+
+var tests = [
+ hasStoppedWithUnhandledException,
+
+ (Isolate isolate) async {
+ print("We stoppped!");
+ var stack = await isolate.getStack();
+ expect(stack['asyncCausalFrames'], isNotNull);
+ var asyncStack = stack['asyncCausalFrames'];
+ expect(asyncStack[0].toString(), contains('doThrow'));
+ expect(asyncStack[1].toString(), contains('asyncThrower'));
+ expect(asyncStack[2].kind, equals(M.FrameKind.asyncSuspensionMarker));
+ expect(asyncStack[3].toString(), contains('testeeMain'));
+ // We've stopped at LINE_A.
+ expect(await asyncStack[3].location.toUserString(),
+ contains('.dart:$LINE_A'));
+ }
+];
+
+main(args) => runIsolateTests(args,
+ tests,
+ pause_on_unhandled_exceptions: true,
+ testeeConcurrent: testeeMain);
diff --git a/runtime/tools/utils.py b/runtime/tools/utils.py
index 242e6d3..595a9ca 100644
--- a/runtime/tools/utils.py
+++ b/runtime/tools/utils.py
@@ -54,9 +54,9 @@
# Try to guess the number of cpus on this machine.
def GuessCpus():
if os.path.exists("/proc/cpuinfo"):
- return int(commands.getoutput("grep -E '^processor' /proc/cpuinfo | wc -l"))
+ return int(commands.getoutput("GREP_OPTIONS= grep -E '^processor' /proc/cpuinfo | wc -l"))
if os.path.exists("/usr/bin/hostinfo"):
- return int(commands.getoutput('/usr/bin/hostinfo | grep "processors are logically available." | awk "{ print \$1 }"'))
+ return int(commands.getoutput('/usr/bin/hostinfo | GREP_OPTIONS= grep "processors are logically available." | awk "{ print \$1 }"'))
win_cpu_count = os.getenv("NUMBER_OF_PROCESSORS")
if win_cpu_count:
return int(win_cpu_count)
diff --git a/runtime/vm/ast.h b/runtime/vm/ast.h
index c99b6cb..ead710e 100644
--- a/runtime/vm/ast.h
+++ b/runtime/vm/ast.h
@@ -1801,6 +1801,7 @@
class CatchClauseNode : public AstNode {
public:
static const intptr_t kInvalidTryIndex = -1;
+ static const intptr_t kImplicitAsyncTryIndex = 0;
CatchClauseNode(TokenPosition token_pos,
SequenceNode* catch_block,
diff --git a/runtime/vm/ast_transformer.cc b/runtime/vm/ast_transformer.cc
index af1331c..d21ef31 100644
--- a/runtime/vm/ast_transformer.cc
+++ b/runtime/vm/ast_transformer.cc
@@ -136,7 +136,10 @@
// :await_temp_var_X = <expr>;
// AwaitMarker(kNewContinuationState);
// :result_param = _awaitHelper(
- // :await_temp_var_X, :async_then_callback, :async_catch_error_callback);
+ // :await_temp_var_X,
+ // :async_then_callback,
+ // :async_catch_error_callback,
+ // :async_op);
// return; // (return_type() == kContinuationTarget)
//
// :saved_try_ctx_var = :await_saved_try_ctx_var_y;
@@ -165,7 +168,10 @@
preamble_->Add(await_marker);
// :result_param = _awaitHelper(
- // :await_temp, :async_then_callback, :async_catch_error_callback)
+ // :await_temp,
+ // :async_then_callback,
+ // :async_catch_error_callback,
+ // :async_op)
const Library& async_lib = Library::Handle(Library::AsyncLibrary());
const Function& async_await_helper = Function::ZoneHandle(
Z, async_lib.LookupFunctionAllowPrivate(Symbols::AsyncAwaitHelper()));
@@ -177,6 +183,7 @@
new (Z) LoadLocalNode(token_pos, async_then_callback));
async_await_helper_args->Add(
new (Z) LoadLocalNode(token_pos, async_catch_error_callback));
+ async_await_helper_args->Add(new (Z) LoadLocalNode(token_pos, async_op));
StaticCallNode* await_helper_call = new (Z) StaticCallNode(
node->token_pos(), async_await_helper, async_await_helper_args);
@@ -214,8 +221,8 @@
new (Z) LoadLocalNode(token_pos, stack_trace_param);
SequenceNode* error_ne_null_branch =
new (Z) SequenceNode(token_pos, ChainNewScope(preamble_->scope()));
- error_ne_null_branch->Add(new (Z) ThrowNode(
- node->token_pos(), load_error_param, load_stack_trace_param));
+ error_ne_null_branch->Add(
+ new (Z) ThrowNode(token_pos, load_error_param, load_stack_trace_param));
preamble_->Add(new (Z) IfNode(
token_pos, new (Z) ComparisonNode(
token_pos, Token::kNE, load_error_param,
diff --git a/runtime/vm/clustered_snapshot.cc b/runtime/vm/clustered_snapshot.cc
index 1735bdc..3bd1c6c 100644
--- a/runtime/vm/clustered_snapshot.cc
+++ b/runtime/vm/clustered_snapshot.cc
@@ -1093,7 +1093,7 @@
Thread::Current(), Timeline::GetIsolateStream(), "PostLoadField"));
Field& field = Field::Handle(zone);
- if (!FLAG_use_field_guards) {
+ if (!Isolate::Current()->use_field_guards()) {
for (intptr_t i = start_index_; i < stop_index_; i++) {
field ^= refs.At(i);
field.set_guarded_cid(kDynamicCid);
@@ -4648,7 +4648,8 @@
const intptr_t version_len = strlen(expected_version);
WriteBytes(reinterpret_cast<const uint8_t*>(expected_version), version_len);
- const char* expected_features = Dart::FeaturesString(kind_);
+ const char* expected_features =
+ Dart::FeaturesString(Isolate::Current(), kind_);
ASSERT(expected_features != NULL);
const intptr_t features_len = strlen(expected_features);
WriteBytes(reinterpret_cast<const uint8_t*>(expected_features),
@@ -4986,7 +4987,7 @@
}
-RawApiError* Deserializer::VerifyVersionAndFeatures() {
+RawApiError* Deserializer::VerifyVersionAndFeatures(Isolate* isolate) {
// If the version string doesn't match, return an error.
// Note: New things are allocated only if we're going to return an error.
@@ -5023,7 +5024,7 @@
}
Advance(version_len);
- const char* expected_features = Dart::FeaturesString(kind_);
+ const char* expected_features = Dart::FeaturesString(isolate, kind_);
ASSERT(expected_features != NULL);
const intptr_t expected_len = strlen(expected_features);
@@ -5475,7 +5476,7 @@
Deserializer deserializer(thread_, kind_, buffer_, size_,
instructions_buffer_, data_buffer_);
- RawApiError* error = deserializer.VerifyVersionAndFeatures();
+ RawApiError* error = deserializer.VerifyVersionAndFeatures(/*isolate=*/NULL);
if (error != ApiError::null()) {
return error;
}
@@ -5499,7 +5500,8 @@
Deserializer deserializer(thread_, kind_, buffer_, size_,
instructions_buffer_, data_buffer_);
- RawApiError* error = deserializer.VerifyVersionAndFeatures();
+ RawApiError* error =
+ deserializer.VerifyVersionAndFeatures(thread_->isolate());
if (error != ApiError::null()) {
return error;
}
diff --git a/runtime/vm/clustered_snapshot.h b/runtime/vm/clustered_snapshot.h
index e110f74..8e76043 100644
--- a/runtime/vm/clustered_snapshot.h
+++ b/runtime/vm/clustered_snapshot.h
@@ -360,7 +360,7 @@
return instructions_reader_->GetObjectAt(offset);
}
- RawApiError* VerifyVersionAndFeatures();
+ RawApiError* VerifyVersionAndFeatures(Isolate* isolate);
void Prepare();
void Deserialize();
diff --git a/runtime/vm/code_descriptors.cc b/runtime/vm/code_descriptors.cc
index 1eb2092..3922ada 100644
--- a/runtime/vm/code_descriptors.cc
+++ b/runtime/vm/code_descriptors.cc
@@ -102,12 +102,14 @@
ASSERT((list_[i].outer_try_index == -1) &&
(list_[i].pc_offset == ExceptionHandlers::kInvalidPcOffset));
handlers.SetHandlerInfo(i, list_[i].outer_try_index, list_[i].pc_offset,
- list_[i].needs_stacktrace, has_catch_all);
+ list_[i].needs_stacktrace, has_catch_all,
+ list_[i].token_pos, list_[i].is_generated);
handlers.SetHandledTypes(i, Array::empty_array());
} else {
const bool has_catch_all = ContainsDynamic(*list_[i].handler_types);
handlers.SetHandlerInfo(i, list_[i].outer_try_index, list_[i].pc_offset,
- list_[i].needs_stacktrace, has_catch_all);
+ list_[i].needs_stacktrace, has_catch_all,
+ list_[i].token_pos, list_[i].is_generated);
handlers.SetHandledTypes(i, *list_[i].handler_types);
}
}
@@ -323,7 +325,7 @@
if (inline_id < inline_id_to_function_.length()) {
const Function* function = inline_id_to_function_[inline_id];
Script& script = Script::Handle(function->script());
- line = script.GetTokenLineUsingLineStarts(pos);
+ line = script.GetTokenLineUsingLineStarts(pos.SourcePosition());
}
stream_.Write<int32_t>(static_cast<int32_t>(line));
} else {
diff --git a/runtime/vm/code_descriptors.h b/runtime/vm/code_descriptors.h
index 2500ed8..5a1528e 100644
--- a/runtime/vm/code_descriptors.h
+++ b/runtime/vm/code_descriptors.h
@@ -74,6 +74,8 @@
struct HandlerDesc {
intptr_t outer_try_index; // Try block in which this try block is nested.
intptr_t pc_offset; // Handler PC offset value.
+ TokenPosition token_pos; // Token position of handler.
+ bool is_generated; // False if this is directly from Dart code.
const Array* handler_types; // Catch clause guards.
bool needs_stacktrace;
};
@@ -86,6 +88,8 @@
struct HandlerDesc data;
data.outer_try_index = -1;
data.pc_offset = ExceptionHandlers::kInvalidPcOffset;
+ data.token_pos = TokenPosition::kNoSource;
+ data.is_generated = true;
data.handler_types = NULL;
data.needs_stacktrace = false;
list_.Add(data);
@@ -94,6 +98,8 @@
void AddHandler(intptr_t try_index,
intptr_t outer_try_index,
intptr_t pc_offset,
+ TokenPosition token_pos,
+ bool is_generated,
const Array& handler_types,
bool needs_stacktrace) {
ASSERT(try_index >= 0);
@@ -103,6 +109,8 @@
list_[try_index].outer_try_index = outer_try_index;
ASSERT(list_[try_index].pc_offset == ExceptionHandlers::kInvalidPcOffset);
list_[try_index].pc_offset = pc_offset;
+ list_[try_index].token_pos = token_pos;
+ list_[try_index].is_generated = is_generated;
ASSERT(handler_types.IsZoneHandle());
list_[try_index].handler_types = &handler_types;
list_[try_index].needs_stacktrace |= needs_stacktrace;
diff --git a/runtime/vm/compiler.cc b/runtime/vm/compiler.cc
index 2a109db..5a621ef 100644
--- a/runtime/vm/compiler.cc
+++ b/runtime/vm/compiler.cc
@@ -543,6 +543,34 @@
Code::Handle(Code::FinalizeCode(function, assembler, optimized()));
code.set_is_optimized(optimized());
code.set_owner(function);
+#if !defined(PRODUCT)
+ if (FLAG_support_debugger) {
+ ZoneGrowableArray<TokenPosition>* await_token_positions =
+ flow_graph->await_token_positions();
+ if (await_token_positions != NULL) {
+ Smi& token_pos_value = Smi::Handle(zone);
+ if (await_token_positions->length() > 0) {
+ const Array& await_to_token_map = Array::Handle(
+ zone, Array::New(await_token_positions->length(), Heap::kOld));
+ ASSERT(!await_to_token_map.IsNull());
+ for (intptr_t i = 0; i < await_token_positions->length(); i++) {
+ TokenPosition token_pos =
+ await_token_positions->At(i).FromSynthetic();
+ if (!token_pos.IsReal()) {
+ // Some async machinary uses sentinel values. Map them to
+ // no source position.
+ token_pos_value = Smi::New(TokenPosition::kNoSourcePos);
+ } else {
+ token_pos_value = Smi::New(token_pos.value());
+ }
+ await_to_token_map.SetAt(i, token_pos_value);
+ }
+ code.SetAwaitTokenPositions(await_to_token_map);
+ }
+ }
+ }
+#endif // !defined(PRODUCT)
+
if (!function.IsOptimizable()) {
// A function with huge unoptimized code can become non-optimizable
// after generating unoptimized code.
diff --git a/runtime/vm/dart.cc b/runtime/vm/dart.cc
index 83b1055..5a6a1b9 100644
--- a/runtime/vm/dart.cc
+++ b/runtime/vm/dart.cc
@@ -125,6 +125,7 @@
const uint8_t* instructions_snapshot,
Dart_IsolateCreateCallback create,
Dart_IsolateShutdownCallback shutdown,
+ Dart_IsolateCleanupCallback cleanup,
Dart_ThreadExitCallback thread_exit,
Dart_FileOpenCallback file_open,
Dart_FileReadCallback file_read,
@@ -313,6 +314,7 @@
Thread::ExitIsolate(); // Unregister the VM isolate from this thread.
Isolate::SetCreateCallback(create);
Isolate::SetShutdownCallback(shutdown);
+ Isolate::SetCleanupCallback(cleanup);
if (FLAG_support_service) {
Service::SetGetServiceAssetsCallback(get_service_assets);
@@ -653,7 +655,7 @@
}
-const char* Dart::FeaturesString(Snapshot::Kind kind) {
+const char* Dart::FeaturesString(Isolate* isolate, Snapshot::Kind kind) {
TextBuffer buffer(64);
// Different fields are included for DEBUG/RELEASE/PRODUCT.
@@ -667,9 +669,15 @@
if (Snapshot::IncludesCode(kind)) {
// Checked mode affects deopt ids.
- buffer.AddString(FLAG_enable_asserts ? " asserts" : " no-asserts");
- buffer.AddString(FLAG_enable_type_checks ? " type-checks"
- : " no-type-checks");
+ const bool asserts =
+ (isolate != NULL) ? isolate->asserts() : FLAG_enable_asserts;
+ const bool type_checks =
+ (isolate != NULL) ? isolate->type_checks() : FLAG_enable_type_checks;
+ const bool field_guards =
+ (isolate != NULL) ? isolate->use_field_guards() : FLAG_use_field_guards;
+ buffer.AddString(asserts ? " asserts" : " no-asserts");
+ buffer.AddString(type_checks ? " type-checks" : " no-type-checks");
+ buffer.AddString(field_guards ? "field-guards" : "no-field-guards");
// Generated code must match the host architecture and ABI.
#if defined(TARGET_ARCH_ARM)
diff --git a/runtime/vm/dart.h b/runtime/vm/dart.h
index b4376dd..e79fccc 100644
--- a/runtime/vm/dart.h
+++ b/runtime/vm/dart.h
@@ -28,6 +28,7 @@
const uint8_t* vm_snapshot_instructions,
Dart_IsolateCreateCallback create,
Dart_IsolateShutdownCallback shutdown,
+ Dart_IsolateCleanupCallback cleanup,
Dart_ThreadExitCallback thread_exit,
Dart_FileOpenCallback file_open,
Dart_FileReadCallback file_read,
@@ -72,7 +73,7 @@
static uword AllocateReadOnlyHandle();
static bool IsReadOnlyHandle(uword address);
- static const char* FeaturesString(Snapshot::Kind kind);
+ static const char* FeaturesString(Isolate* isolate, Snapshot::Kind kind);
static Snapshot::Kind vm_snapshot_kind() { return vm_snapshot_kind_; }
static Dart_ThreadExitCallback thread_exit_callback() {
diff --git a/runtime/vm/dart_api_impl.cc b/runtime/vm/dart_api_impl.cc
index be6c3f3..f8db6b4 100644
--- a/runtime/vm/dart_api_impl.cc
+++ b/runtime/vm/dart_api_impl.cc
@@ -1192,9 +1192,9 @@
return Dart::InitOnce(
params->vm_snapshot_data, params->vm_snapshot_instructions,
- params->create, params->shutdown, params->thread_exit, params->file_open,
- params->file_read, params->file_write, params->file_close,
- params->entropy_source, params->get_service_assets);
+ params->create, params->shutdown, params->cleanup, params->thread_exit,
+ params->file_open, params->file_read, params->file_write,
+ params->file_close, params->entropy_source, params->get_service_assets);
}
diff --git a/runtime/vm/dart_api_impl_test.cc b/runtime/vm/dart_api_impl_test.cc
index c17c4d2..297703e 100644
--- a/runtime/vm/dart_api_impl_test.cc
+++ b/runtime/vm/dart_api_impl_test.cc
@@ -3521,7 +3521,7 @@
// Create an isolate with checked mode flags.
Dart_IsolateFlags api_flags;
- api_flags.version = DART_FLAGS_CURRENT_VERSION;
+ Isolate::FlagsInitialize(&api_flags);
api_flags.enable_type_checks = true;
api_flags.enable_asserts = true;
api_flags.enable_error_on_bad_type = true;
diff --git a/runtime/vm/debugger.cc b/runtime/vm/debugger.cc
index a74a0f5..61956fa 100644
--- a/runtime/vm/debugger.cc
+++ b/runtime/vm/debugger.cc
@@ -259,7 +259,7 @@
ctx_(Context::ZoneHandle()),
code_(Code::ZoneHandle(code.raw())),
function_(Function::ZoneHandle(code.function())),
- live_frame_(kind == kRegular),
+ live_frame_((kind == kRegular) || (kind == kAsyncActivation)),
token_pos_initialized_(false),
token_pos_(TokenPosition::kNoSource),
try_index_(-1),
@@ -297,6 +297,37 @@
desc_indices_(8),
pc_desc_(PcDescriptors::ZoneHandle()) {}
+
+ActivationFrame::ActivationFrame(const Closure& async_activation)
+ : pc_(0),
+ fp_(0),
+ sp_(0),
+ ctx_(Context::ZoneHandle()),
+ code_(Code::ZoneHandle()),
+ function_(Function::ZoneHandle()),
+ live_frame_(false),
+ token_pos_initialized_(false),
+ token_pos_(TokenPosition::kNoSource),
+ try_index_(-1),
+ line_number_(-1),
+ column_number_(-1),
+ context_level_(-1),
+ deopt_frame_(Array::ZoneHandle()),
+ deopt_frame_offset_(0),
+ kind_(kAsyncActivation),
+ vars_initialized_(false),
+ var_descriptors_(LocalVarDescriptors::ZoneHandle()),
+ desc_indices_(8),
+ pc_desc_(PcDescriptors::ZoneHandle()) {
+ // Extract the function and the code from the asynchronous activation.
+ function_ = async_activation.function();
+ code_ = function_.unoptimized_code();
+ ctx_ = async_activation.context();
+ ASSERT(fp_ == 0);
+ ASSERT(!ctx_.IsNull());
+}
+
+
bool Debugger::NeedsIsolateEvents() {
return ((isolate_ != Dart::vm_isolate()) &&
!ServiceIsolate::IsServiceIsolateDescendant(isolate_) &&
@@ -589,8 +620,8 @@
intptr_t ActivationFrame::LineNumber() {
// Compute line number lazily since it causes scanning of the script.
- if ((line_number_ < 0) && TokenPos().IsReal()) {
- const TokenPosition token_pos = TokenPos();
+ if ((line_number_ < 0) && TokenPos().IsSourcePosition()) {
+ const TokenPosition token_pos = TokenPos().SourcePosition();
const Script& script = Script::Handle(SourceScript());
script.GetTokenLocation(token_pos, &line_number_, NULL);
}
@@ -600,8 +631,8 @@
intptr_t ActivationFrame::ColumnNumber() {
// Compute column number lazily since it causes scanning of the script.
- if ((column_number_ < 0) && TokenPos().IsReal()) {
- const TokenPosition token_pos = TokenPos();
+ if ((column_number_ < 0) && TokenPos().IsSourcePosition()) {
+ const TokenPosition token_pos = TokenPos().SourcePosition();
const Script& script = Script::Handle(SourceScript());
if (script.HasSource()) {
script.GetTokenLocation(token_pos, &line_number_, &column_number_);
@@ -680,6 +711,191 @@
}
+RawObject* ActivationFrame::GetAsyncContextVariable(const String& name) {
+ if (!function_.IsAsyncClosure()) {
+ return Object::null();
+ }
+ GetVarDescriptors();
+ intptr_t var_desc_len = var_descriptors_.Length();
+ for (intptr_t i = 0; i < var_desc_len; i++) {
+ RawLocalVarDescriptors::VarInfo var_info;
+ var_descriptors_.GetInfo(i, &var_info);
+ if (var_descriptors_.GetName(i) == name.raw()) {
+ const int8_t kind = var_info.kind();
+ if (!live_frame_) {
+ ASSERT(kind == RawLocalVarDescriptors::kContextVar);
+ }
+ if (kind == RawLocalVarDescriptors::kStackVar) {
+ return GetStackVar(var_info.index());
+ } else {
+ ASSERT(kind == RawLocalVarDescriptors::kContextVar);
+ if (!live_frame_) {
+ ASSERT(!ctx_.IsNull());
+ return ctx_.At(var_info.index());
+ }
+ return GetContextVar(var_info.scope_id, var_info.index());
+ }
+ }
+ }
+ return Object::null();
+}
+
+
+RawObject* ActivationFrame::GetAsyncCompleter() {
+ return GetAsyncContextVariable(Symbols::AsyncCompleter());
+}
+
+
+RawObject* ActivationFrame::GetAsyncCompleterAwaiter(const Object& completer) {
+ const Class& sync_completer_cls = Class::Handle(completer.clazz());
+ ASSERT(!sync_completer_cls.IsNull());
+ const Class& completer_cls = Class::Handle(sync_completer_cls.SuperClass());
+ const Field& future_field =
+ Field::Handle(completer_cls.LookupInstanceFieldAllowPrivate(
+ Symbols::CompleterFuture()));
+ ASSERT(!future_field.IsNull());
+ Instance& future = Instance::Handle();
+ future ^= Instance::Cast(completer).GetField(future_field);
+ ASSERT(!future.IsNull());
+ const Class& future_cls = Class::Handle(future.clazz());
+ ASSERT(!future_cls.IsNull());
+ const Field& awaiter_field = Field::Handle(
+ future_cls.LookupInstanceFieldAllowPrivate(Symbols::_Awaiter()));
+ ASSERT(!awaiter_field.IsNull());
+ return future.GetField(awaiter_field);
+}
+
+
+RawObject* ActivationFrame::GetAsyncStreamControllerStream() {
+ return GetAsyncContextVariable(Symbols::ControllerStream());
+}
+
+
+RawObject* ActivationFrame::GetAsyncStreamControllerStreamAwaiter(
+ const Object& stream) {
+ const Class& stream_cls = Class::Handle(stream.clazz());
+ ASSERT(!stream_cls.IsNull());
+ const Class& stream_impl_cls = Class::Handle(stream_cls.SuperClass());
+ const Field& awaiter_field = Field::Handle(
+ stream_impl_cls.LookupInstanceFieldAllowPrivate(Symbols::_Awaiter()));
+ ASSERT(!awaiter_field.IsNull());
+ return Instance::Cast(stream).GetField(awaiter_field);
+}
+
+
+RawObject* ActivationFrame::GetAsyncAwaiter() {
+ const Object& completer = Object::Handle(GetAsyncCompleter());
+ if (!completer.IsNull()) {
+ return GetAsyncCompleterAwaiter(completer);
+ }
+ const Object& async_stream_controller_stream =
+ Object::Handle(GetAsyncStreamControllerStream());
+ if (!async_stream_controller_stream.IsNull()) {
+ return GetAsyncStreamControllerStreamAwaiter(
+ async_stream_controller_stream);
+ }
+ return Object::null();
+}
+
+
+bool ActivationFrame::HandlesException(const Instance& exc_obj) {
+ intptr_t try_index = TryIndex();
+ if (try_index < 0) {
+ return false;
+ }
+ ExceptionHandlers& handlers = ExceptionHandlers::Handle();
+ Array& handled_types = Array::Handle();
+ AbstractType& type = Type::Handle();
+ const TypeArguments& no_instantiator = TypeArguments::Handle();
+ const bool is_async =
+ function().IsAsyncClosure() || function().IsAsyncGenClosure();
+ handlers = code().exception_handlers();
+ ASSERT(!handlers.IsNull());
+ intptr_t num_handlers_checked = 0;
+ while (try_index != CatchClauseNode::kInvalidTryIndex) {
+ // Detect circles in the exception handler data.
+ num_handlers_checked++;
+ ASSERT(num_handlers_checked <= handlers.num_entries());
+ // Only consider user written handlers for async methods.
+ if (!is_async || !handlers.IsGenerated(try_index)) {
+ handled_types = handlers.GetHandledTypes(try_index);
+ const intptr_t num_types = handled_types.Length();
+ for (intptr_t k = 0; k < num_types; k++) {
+ type ^= handled_types.At(k);
+ ASSERT(!type.IsNull());
+ // Uninstantiated types are not added to ExceptionHandlers data.
+ ASSERT(type.IsInstantiated());
+ if (type.IsMalformed()) {
+ continue;
+ }
+ if (type.IsDynamicType()) {
+ return true;
+ }
+ if (exc_obj.IsInstanceOf(type, no_instantiator, NULL)) {
+ return true;
+ }
+ }
+ }
+ try_index = handlers.OuterTryIndex(try_index);
+ }
+ return false;
+}
+
+
+void ActivationFrame::ExtractTokenPositionFromAsyncClosure() {
+ // Attempt to determine the token position from the async closure.
+ ASSERT(function_.IsAsyncGenClosure() || function_.IsAsyncClosure());
+ // This should only be called on frames that aren't active on the stack.
+ ASSERT(fp() == 0);
+ const Array& await_to_token_map =
+ Array::Handle(code_.await_token_positions());
+ if (await_to_token_map.IsNull()) {
+ // No mapping.
+ return;
+ }
+ GetVarDescriptors();
+ GetPcDescriptors();
+ intptr_t var_desc_len = var_descriptors_.Length();
+ intptr_t await_jump_var = -1;
+ for (intptr_t i = 0; i < var_desc_len; i++) {
+ RawLocalVarDescriptors::VarInfo var_info;
+ var_descriptors_.GetInfo(i, &var_info);
+ const int8_t kind = var_info.kind();
+ if (var_descriptors_.GetName(i) == Symbols::AwaitJumpVar().raw()) {
+ ASSERT(kind == RawLocalVarDescriptors::kContextVar);
+ ASSERT(!ctx_.IsNull());
+ Object& await_jump_index = Object::Handle(ctx_.At(var_info.index()));
+ ASSERT(await_jump_index.IsSmi());
+ await_jump_var = Smi::Cast(await_jump_index).Value();
+ }
+ }
+ if (await_jump_var < 0) {
+ return;
+ }
+ ASSERT(await_jump_var < await_to_token_map.Length());
+ const Object& token_pos =
+ Object::Handle(await_to_token_map.At(await_jump_var));
+ if (token_pos.IsNull()) {
+ return;
+ }
+ ASSERT(token_pos.IsSmi());
+ token_pos_ = TokenPosition(Smi::Cast(token_pos).Value());
+ token_pos_initialized_ = true;
+ PcDescriptors::Iterator iter(pc_desc_, RawPcDescriptors::kAnyKind);
+ while (iter.MoveNext()) {
+ if (iter.TokenPos() == token_pos_) {
+ // Match the lowest try index at this token position.
+ // TODO(johnmccutchan): Is this heuristic precise enough?
+ if (iter.TryIndex() != CatchClauseNode::kInvalidTryIndex) {
+ if ((try_index_ == -1) || (iter.TryIndex() < try_index_)) {
+ try_index_ = iter.TryIndex();
+ }
+ }
+ }
+ }
+}
+
+
// Get the saved current context of this activation.
const Context& ActivationFrame::GetSavedCurrentContext() {
if (!ctx_.IsNull()) return ctx_;
@@ -724,35 +940,10 @@
ActivationFrame* DebuggerStackTrace::GetHandlerFrame(
const Instance& exc_obj) const {
- ExceptionHandlers& handlers = ExceptionHandlers::Handle();
- Array& handled_types = Array::Handle();
- AbstractType& type = Type::Handle();
- const TypeArguments& no_instantiator = TypeArguments::Handle();
for (intptr_t frame_index = 0; frame_index < Length(); frame_index++) {
ActivationFrame* frame = FrameAt(frame_index);
- intptr_t try_index = frame->TryIndex();
- if (try_index < 0) continue;
- handlers = frame->code().exception_handlers();
- ASSERT(!handlers.IsNull());
- intptr_t num_handlers_checked = 0;
- while (try_index >= 0) {
- // Detect circles in the exception handler data.
- num_handlers_checked++;
- ASSERT(num_handlers_checked <= handlers.num_entries());
- handled_types = handlers.GetHandledTypes(try_index);
- const intptr_t num_types = handled_types.Length();
- for (intptr_t k = 0; k < num_types; k++) {
- type ^= handled_types.At(k);
- ASSERT(!type.IsNull());
- // Uninstantiated types are not added to ExceptionHandlers data.
- ASSERT(type.IsInstantiated());
- if (type.IsMalformed()) continue;
- if (type.IsDynamicType()) return frame;
- if (exc_obj.IsInstanceOf(type, no_instantiator, NULL)) {
- return frame;
- }
- }
- try_index = handlers.OuterTryIndex(try_index);
+ if (frame->HandlesException(exc_obj)) {
+ return frame;
}
}
return NULL;
@@ -1128,10 +1319,7 @@
const Script& script = Script::Handle(SourceScript());
jsobj->AddProperty("type", "Frame");
jsobj->AddProperty("kind", KindToCString(kind_));
- TokenPosition pos = TokenPos();
- if (pos.IsSynthetic()) {
- pos = pos.FromSynthetic();
- }
+ const TokenPosition pos = TokenPos().SourcePosition();
jsobj->AddLocation(script, pos);
jsobj->AddProperty("function", function(), !full);
jsobj->AddProperty("code", code());
@@ -1152,7 +1340,10 @@
TokenPosition visible_end_token_pos;
VariableAt(v, &var_name, &declaration_token_pos, &visible_start_token_pos,
&visible_end_token_pos, &var_value);
- if (var_name.raw() != Symbols::AsyncOperation().raw()) {
+ if ((var_name.raw() != Symbols::AsyncOperation().raw()) &&
+ (var_name.raw() != Symbols::AsyncCompleter().raw()) &&
+ (var_name.raw() != Symbols::ControllerStream().raw()) &&
+ (var_name.raw() != Symbols::AwaitJumpVar().raw())) {
JSONObject jsvar(&jsvars);
jsvar.AddProperty("type", "BoundVariable");
var_name = String::ScrubName(var_name);
@@ -1175,10 +1366,7 @@
jsobj->AddProperty("type", "Frame");
jsobj->AddProperty("kind", KindToCString(kind_));
const Script& script = Script::Handle(SourceScript());
- TokenPosition pos = TokenPos();
- if (pos.IsSynthetic()) {
- pos = pos.FromSynthetic();
- }
+ const TokenPosition pos = TokenPos().SourcePosition();
jsobj->AddLocation(script, pos);
jsobj->AddProperty("function", function(), !full);
jsobj->AddProperty("code", code());
@@ -1548,10 +1736,12 @@
StackFrame* frame,
const Code& code,
const Array& deopt_frame,
- intptr_t deopt_frame_offset) {
+ intptr_t deopt_frame_offset,
+ ActivationFrame::Kind kind) {
ASSERT(code.ContainsInstructionAt(pc));
- ActivationFrame* activation = new ActivationFrame(
- pc, frame->fp(), frame->sp(), code, deopt_frame, deopt_frame_offset);
+ ActivationFrame* activation =
+ new ActivationFrame(pc, frame->fp(), frame->sp(), code, deopt_frame,
+ deopt_frame_offset, kind);
if (FLAG_trace_debugger_stacktrace) {
const Context& ctx = activation->GetSavedCurrentContext();
OS::PrintErr("\tUsing saved context: %s\n", ctx.ToCString());
@@ -1728,6 +1918,64 @@
return stack_trace;
}
+
+DebuggerStackTrace* Debugger::CollectAwaiterReturnStackTrace() {
+ if (!FLAG_causal_async_stacks) {
+ return NULL;
+ }
+ Thread* thread = Thread::Current();
+ Zone* zone = thread->zone();
+ Isolate* isolate = thread->isolate();
+ DebuggerStackTrace* stack_trace = new DebuggerStackTrace(8);
+
+ StackFrameIterator iterator(StackFrameIterator::kDontValidateFrames);
+
+ Code& code = Code::Handle(zone);
+ Function& function = Function::Handle(zone);
+ Code& inlined_code = Code::Handle(zone);
+ Closure& async_activation = Closure::Handle(zone);
+ Array& deopt_frame = Array::Handle(zone);
+
+ for (StackFrame* frame = iterator.NextFrame(); frame != NULL;
+ frame = iterator.NextFrame()) {
+ ASSERT(frame->IsValid());
+ if (frame->IsDartFrame()) {
+ code = frame->LookupDartCode();
+ function = code.function();
+ if (function.IsAsyncClosure() || function.IsAsyncGenClosure()) {
+ ActivationFrame* activation = CollectDartFrame(
+ isolate, frame->pc(), frame, code, Object::null_array(), 0,
+ ActivationFrame::kAsyncActivation);
+ ASSERT(activation != NULL);
+ stack_trace->AddActivation(activation);
+ // Grab the awaiter.
+ async_activation ^= activation->GetAsyncAwaiter();
+ break;
+ } else {
+ AppendCodeFrames(thread, isolate, zone, stack_trace, frame, &code,
+ &inlined_code, &deopt_frame);
+ }
+ }
+ }
+
+ // Return NULL to indicate that there is no useful information in this stack
+ // trace because we never found an awaiter.
+ if (async_activation.IsNull()) {
+ return NULL;
+ }
+
+ // Append the awaiter return call stack.
+ while (!async_activation.IsNull()) {
+ ActivationFrame* activation = new ActivationFrame(async_activation);
+ async_activation ^= activation->GetAsyncAwaiter();
+ activation->ExtractTokenPositionFromAsyncClosure();
+ stack_trace->AddActivation(activation);
+ }
+
+ return stack_trace;
+}
+
+
ActivationFrame* Debugger::TopDartFrame() const {
StackFrameIterator iterator(false);
StackFrame* frame = iterator.NextFrame();
@@ -1828,6 +2076,29 @@
}
+bool Debugger::ShouldPauseOnAsyncException(DebuggerStackTrace* stack_trace,
+ const Instance& exc) {
+ if (exc_pause_info_ == kNoPauseOnExceptions) {
+ return false;
+ }
+ if (exc_pause_info_ == kPauseOnAllExceptions) {
+ return true;
+ }
+ ASSERT(exc_pause_info_ == kPauseOnUnhandledExceptions);
+ for (intptr_t i = 0; i < stack_trace->Length(); i++) {
+ ActivationFrame* frame = stack_trace->FrameAt(i);
+ if (frame->HandlesException(exc)) {
+ if (FLAG_verbose_debug) {
+ OS::PrintErr("%s is caught by frame %s\n", exc.ToCString(),
+ frame->ToCString());
+ }
+ return false;
+ }
+ }
+ return true;
+}
+
+
bool Debugger::ShouldPauseOnException(DebuggerStackTrace* stack_trace,
const Instance& exception) {
if (exc_pause_info_ == kNoPauseOnExceptions) {
@@ -1859,9 +2130,16 @@
(exc_pause_info_ == kNoPauseOnExceptions)) {
return;
}
+ DebuggerStackTrace* awaiter_stack_trace = CollectAwaiterReturnStackTrace();
DebuggerStackTrace* stack_trace = CollectStackTrace();
- if (!ShouldPauseOnException(stack_trace, exc)) {
- return;
+ if (awaiter_stack_trace != NULL) {
+ if (!ShouldPauseOnAsyncException(awaiter_stack_trace, exc)) {
+ return;
+ }
+ } else {
+ if (!ShouldPauseOnException(stack_trace, exc)) {
+ return;
+ }
}
ServiceEvent event(isolate_, ServiceEvent::kPauseException);
event.set_exception(&exc);
@@ -3291,10 +3569,12 @@
}
if (FLAG_verbose_debug) {
- OS::Print(">>> hit breakpoint at %s:%" Pd " (token %s) (address %#" Px
- ")\n",
- String::Handle(cbpt->SourceUrl()).ToCString(), cbpt->LineNumber(),
- cbpt->token_pos().ToCString(), top_frame->pc());
+ OS::Print(">>> hit breakpoint %" Pd " at %s:%" Pd
+ " (token %s) "
+ "(address %#" Px ")\n",
+ bpt_hit->id(), String::Handle(cbpt->SourceUrl()).ToCString(),
+ cbpt->LineNumber(), cbpt->token_pos().ToCString(),
+ top_frame->pc());
}
CacheStackTraces(stack_trace, CollectAsyncCausalStackTrace());
diff --git a/runtime/vm/debugger.h b/runtime/vm/debugger.h
index bf932fe..d9acb88 100644
--- a/runtime/vm/debugger.h
+++ b/runtime/vm/debugger.h
@@ -260,6 +260,7 @@
kRegular,
kAsyncSuspensionMarker,
kAsyncCausal,
+ kAsyncActivation,
};
ActivationFrame(uword pc,
@@ -274,6 +275,8 @@
explicit ActivationFrame(Kind kind);
+ explicit ActivationFrame(const Closure& async_activation);
+
uword pc() const { return pc_; }
uword fp() const { return fp_; }
uword sp() const { return sp_; }
@@ -332,6 +335,10 @@
// the complete script, function, and, local variable objects are included.
void PrintToJSONObject(JSONObject* jsobj, bool full = false);
+ RawObject* GetAsyncAwaiter();
+
+ bool HandlesException(const Instance& exc_obj);
+
private:
void PrintToJSONObjectRegular(JSONObject* jsobj, bool full);
void PrintToJSONObjectAsyncCausal(JSONObject* jsobj, bool full);
@@ -346,6 +353,13 @@
void GetVarDescriptors();
void GetDescIndices();
+ RawObject* GetAsyncContextVariable(const String& name);
+ RawObject* GetAsyncStreamControllerStreamAwaiter(const Object& stream);
+ RawObject* GetAsyncStreamControllerStream();
+ RawObject* GetAsyncCompleterAwaiter(const Object& completer);
+ RawObject* GetAsyncCompleter();
+ void ExtractTokenPositionFromAsyncClosure();
+
static const char* KindToCString(Kind kind) {
switch (kind) {
case kRegular:
@@ -627,12 +641,14 @@
void SyncBreakpointLocation(BreakpointLocation* loc);
ActivationFrame* TopDartFrame() const;
- static ActivationFrame* CollectDartFrame(Isolate* isolate,
- uword pc,
- StackFrame* frame,
- const Code& code,
- const Array& deopt_frame,
- intptr_t deopt_frame_offset);
+ static ActivationFrame* CollectDartFrame(
+ Isolate* isolate,
+ uword pc,
+ StackFrame* frame,
+ const Code& code,
+ const Array& deopt_frame,
+ intptr_t deopt_frame_offset,
+ ActivationFrame::Kind kind = ActivationFrame::kRegular);
static RawArray* DeoptimizeToArray(Thread* thread,
StackFrame* frame,
const Code& code);
@@ -648,10 +664,14 @@
Array* deopt_frame);
static DebuggerStackTrace* CollectStackTrace();
static DebuggerStackTrace* CollectAsyncCausalStackTrace();
+ static DebuggerStackTrace* CollectAwaiterReturnStackTrace();
void SignalPausedEvent(ActivationFrame* top_frame, Breakpoint* bpt);
intptr_t nextId() { return next_id_++; }
+ bool ShouldPauseOnAsyncException(DebuggerStackTrace* stack_trace,
+ const Instance& exc);
+
bool ShouldPauseOnException(DebuggerStackTrace* stack_trace,
const Instance& exc);
diff --git a/runtime/vm/exceptions.h b/runtime/vm/exceptions.h
index 7799153..c2a3350 100644
--- a/runtime/vm/exceptions.h
+++ b/runtime/vm/exceptions.h
@@ -99,6 +99,7 @@
int16_t outer_try_index; // Try block index of enclosing try block.
int8_t needs_stacktrace; // True if a stacktrace is needed.
int8_t has_catch_all; // Catches all exceptions.
+ int8_t is_generated; // True if this is a generated handler.
};
} // namespace dart
diff --git a/runtime/vm/flow_graph.cc b/runtime/vm/flow_graph.cc
index 8a3a691..1ddea4e 100644
--- a/runtime/vm/flow_graph.cc
+++ b/runtime/vm/flow_graph.cc
@@ -46,6 +46,7 @@
loop_headers_(NULL),
loop_invariant_loads_(NULL),
deferred_prefixes_(parsed_function.deferred_prefixes()),
+ await_token_positions_(NULL),
captured_parameters_(new (zone()) BitVector(zone(), variable_count())),
inlining_id_(-1) {
DiscoverBlocks();
diff --git a/runtime/vm/flow_graph.h b/runtime/vm/flow_graph.h
index 9e20957..ff4b7a4 100644
--- a/runtime/vm/flow_graph.h
+++ b/runtime/vm/flow_graph.h
@@ -286,6 +286,15 @@
// Merge instructions (only per basic-block).
void TryOptimizePatterns();
+ ZoneGrowableArray<TokenPosition>* await_token_positions() const {
+ return await_token_positions_;
+ }
+
+ void set_await_token_positions(
+ ZoneGrowableArray<TokenPosition>* await_token_positions) {
+ await_token_positions_ = await_token_positions;
+ }
+
// Replaces uses that are dominated by dom of 'def' with 'other'.
// Note: uses that occur at instruction dom itself are not dominated by it.
static void RenameDominatedUses(Definition* def,
@@ -391,6 +400,7 @@
ZoneGrowableArray<BlockEntryInstr*>* loop_headers_;
ZoneGrowableArray<BitVector*>* loop_invariant_loads_;
ZoneGrowableArray<const LibraryPrefix*>* deferred_prefixes_;
+ ZoneGrowableArray<TokenPosition>* await_token_positions_;
DirectChainedHashMap<ConstantPoolTrait> constant_instr_pool_;
BitVector* captured_parameters_;
diff --git a/runtime/vm/flow_graph_builder.cc b/runtime/vm/flow_graph_builder.cc
index b5061df..bb52f8f 100644
--- a/runtime/vm/flow_graph_builder.cc
+++ b/runtime/vm/flow_graph_builder.cc
@@ -323,7 +323,8 @@
nesting_stack_(NULL),
osr_id_(osr_id),
jump_count_(0),
- await_joins_(new (Z) ZoneGrowableArray<JoinEntryInstr*>()) {}
+ await_joins_(new (Z) ZoneGrowableArray<JoinEntryInstr*>()),
+ await_token_positions_(new (Z) ZoneGrowableArray<TokenPosition>()) {}
void FlowGraphBuilder::AddCatchEntry(CatchBlockEntryInstr* entry) {
@@ -2186,6 +2187,8 @@
Value* jump_val = Bind(new (Z) ConstantInstr(
Smi::ZoneHandle(Z, Smi::New(jump_count)), node->token_pos()));
Do(BuildStoreLocal(*jump_var, jump_val, node->token_pos()));
+ // Add a mapping from jump_count -> token_position.
+ owner()->AppendAwaitTokenPosition(node->token_pos());
// Save the current context for resuming.
BuildSaveContext(*ctx_var, node->token_pos());
}
@@ -3432,7 +3435,7 @@
node->value()->Visit(&for_value);
Append(for_value);
Value* store_value = for_value.value();
- if (Isolate::Current()->type_checks()) {
+ if (isolate()->type_checks()) {
const AbstractType& type =
AbstractType::ZoneHandle(Z, node->field().type());
const String& dst_name = String::ZoneHandle(Z, node->field().name());
@@ -3440,7 +3443,7 @@
type, dst_name);
}
- if (FLAG_use_field_guards) {
+ if (isolate()->use_field_guards()) {
store_value = Bind(BuildStoreExprTemp(store_value, token_pos));
GuardFieldClassInstr* guard_field_class = new (Z) GuardFieldClassInstr(
store_value, node->field(), thread()->GetNextDeoptId());
@@ -4078,6 +4081,7 @@
ASSERT(!catch_block->stacktrace_var().is_captured());
CatchBlockEntryInstr* catch_entry = new (Z) CatchBlockEntryInstr(
+ catch_block->token_pos(), (node->token_pos() == TokenPosition::kNoSource),
owner()->AllocateBlockId(), catch_handler_index, owner()->graph_entry(),
catch_block->handler_types(), try_handler_index,
catch_block->exception_var(), catch_block->stacktrace_var(),
@@ -4120,6 +4124,8 @@
const Array& types = Array::ZoneHandle(Z, Array::New(1, Heap::kOld));
types.SetAt(0, Object::dynamic_type());
CatchBlockEntryInstr* finally_entry = new (Z) CatchBlockEntryInstr(
+ finally_block->token_pos(),
+ true, // this is not a catch block from user code.
owner()->AllocateBlockId(), original_handler_index,
owner()->graph_entry(), types, catch_handler_index,
catch_block->exception_var(), catch_block->stacktrace_var(),
@@ -4367,10 +4373,16 @@
FlowGraph* graph =
new (Z) FlowGraph(parsed_function(), graph_entry_, last_used_block_id_);
+ graph->set_await_token_positions(await_token_positions_);
return graph;
}
+void FlowGraphBuilder::AppendAwaitTokenPosition(TokenPosition token_pos) {
+ await_token_positions_->Add(token_pos);
+}
+
+
void FlowGraphBuilder::PruneUnreachable() {
ASSERT(osr_id_ != Compiler::kNoOSRDeoptId);
BitVector* block_marks = new (Z) BitVector(Z, last_used_block_id_ + 1);
diff --git a/runtime/vm/flow_graph_builder.h b/runtime/vm/flow_graph_builder.h
index 98819bc..56ca965 100644
--- a/runtime/vm/flow_graph_builder.h
+++ b/runtime/vm/flow_graph_builder.h
@@ -172,6 +172,12 @@
Isolate* isolate() const { return parsed_function().isolate(); }
Zone* zone() const { return parsed_function().zone(); }
+ void AppendAwaitTokenPosition(TokenPosition token_pos);
+
+ ZoneGrowableArray<TokenPosition>* await_token_positions() const {
+ return await_token_positions_;
+ }
+
private:
friend class NestedStatement; // Explicit access to nesting_stack_.
friend class Intrinsifier;
@@ -212,6 +218,7 @@
intptr_t jump_count_;
ZoneGrowableArray<JoinEntryInstr*>* await_joins_;
+ ZoneGrowableArray<TokenPosition>* await_token_positions_;
DISALLOW_IMPLICIT_CONSTRUCTORS(FlowGraphBuilder);
};
diff --git a/runtime/vm/flow_graph_builder_test.cc b/runtime/vm/flow_graph_builder_test.cc
index 122e6d4..74a8562 100644
--- a/runtime/vm/flow_graph_builder_test.cc
+++ b/runtime/vm/flow_graph_builder_test.cc
@@ -215,10 +215,7 @@
BlockEntryInstr* entry = (*blocks_)[i];
for (ForwardInstructionIterator it(entry); !it.Done(); it.Advance()) {
Instruction* instr = it.Current();
- TokenPosition token_pos = instr->token_pos();
- if (token_pos.IsSynthetic()) {
- token_pos = token_pos.FromSynthetic();
- }
+ const TokenPosition token_pos = instr->token_pos().SourcePosition();
if (!token_pos.IsReal()) {
continue;
}
diff --git a/runtime/vm/flow_graph_compiler.cc b/runtime/vm/flow_graph_compiler.cc
index 0c9c743..1aa4347 100644
--- a/runtime/vm/flow_graph_compiler.cc
+++ b/runtime/vm/flow_graph_compiler.cc
@@ -671,10 +671,13 @@
void FlowGraphCompiler::AddExceptionHandler(intptr_t try_index,
intptr_t outer_try_index,
intptr_t pc_offset,
+ TokenPosition token_pos,
+ bool is_generated,
const Array& handler_types,
bool needs_stacktrace) {
exception_handlers_list_->AddHandler(try_index, outer_try_index, pc_offset,
- handler_types, needs_stacktrace);
+ token_pos, is_generated, handler_types,
+ needs_stacktrace);
}
@@ -1081,7 +1084,7 @@
if (field.is_instance() &&
(FLAG_precompiled_mode || !IsPotentialUnboxedField(field))) {
GenerateInlinedGetter(field.Offset());
- return !FLAG_use_field_guards;
+ return !isolate()->use_field_guards();
}
return false;
}
@@ -1094,7 +1097,7 @@
if (field.is_instance() &&
(FLAG_precompiled_mode || field.guarded_cid() == kDynamicCid)) {
GenerateInlinedSetter(field.Offset());
- return !FLAG_use_field_guards;
+ return !isolate()->use_field_guards();
}
return false;
}
diff --git a/runtime/vm/flow_graph_compiler.h b/runtime/vm/flow_graph_compiler.h
index a382ef6..b0f034d 100644
--- a/runtime/vm/flow_graph_compiler.h
+++ b/runtime/vm/flow_graph_compiler.h
@@ -491,6 +491,8 @@
void AddExceptionHandler(intptr_t try_index,
intptr_t outer_try_index,
intptr_t pc_offset,
+ TokenPosition token_pos,
+ bool is_generated,
const Array& handler_types,
bool needs_stacktrace);
void SetNeedsStackTrace(intptr_t try_index);
diff --git a/runtime/vm/flow_graph_range_analysis.cc b/runtime/vm/flow_graph_range_analysis.cc
index b19b4e6..d680ea6 100644
--- a/runtime/vm/flow_graph_range_analysis.cc
+++ b/runtime/vm/flow_graph_range_analysis.cc
@@ -2348,7 +2348,7 @@
*result_min = RangeBoundary::FromConstant(0);
} else {
*result_min =
- RangeBoundary::FromConstant(static_cast<int64_t>(-1) << bitsize);
+ RangeBoundary::FromConstant(-(static_cast<int64_t>(1) << bitsize));
}
*result_max =
diff --git a/runtime/vm/intermediate_language.h b/runtime/vm/intermediate_language.h
index 5f837bf..b58d9bf 100644
--- a/runtime/vm/intermediate_language.h
+++ b/runtime/vm/intermediate_language.h
@@ -1469,7 +1469,9 @@
class CatchBlockEntryInstr : public BlockEntryInstr {
public:
- CatchBlockEntryInstr(intptr_t block_id,
+ CatchBlockEntryInstr(TokenPosition handler_token_pos,
+ bool is_generated,
+ intptr_t block_id,
intptr_t try_index,
GraphEntryInstr* graph_entry,
const Array& handler_types,
@@ -1487,7 +1489,9 @@
exception_var_(exception_var),
stacktrace_var_(stacktrace_var),
needs_stacktrace_(needs_stacktrace),
- should_restore_closure_context_(should_restore_closure_context) {
+ should_restore_closure_context_(should_restore_closure_context),
+ handler_token_pos_(handler_token_pos),
+ is_generated_(is_generated) {
deopt_id_ = deopt_id;
}
@@ -1508,6 +1512,9 @@
bool needs_stacktrace() const { return needs_stacktrace_; }
+ bool is_generated() const { return is_generated_; }
+ TokenPosition handler_token_pos() const { return handler_token_pos_; }
+
// Returns try index for the try block to which this catch handler
// corresponds.
intptr_t catch_try_index() const { return catch_try_index_; }
@@ -1541,6 +1548,8 @@
const LocalVariable& stacktrace_var_;
const bool needs_stacktrace_;
const bool should_restore_closure_context_;
+ TokenPosition handler_token_pos_;
+ bool is_generated_;
DISALLOW_COPY_AND_ASSIGN(CatchBlockEntryInstr);
};
diff --git a/runtime/vm/intermediate_language_arm.cc b/runtime/vm/intermediate_language_arm.cc
index 093970f..a327937 100644
--- a/runtime/vm/intermediate_language_arm.cc
+++ b/runtime/vm/intermediate_language_arm.cc
@@ -2874,6 +2874,7 @@
__ Bind(compiler->GetJumpLabel(this));
compiler->AddExceptionHandler(catch_try_index(), try_index(),
compiler->assembler()->CodeSize(),
+ handler_token_pos(), is_generated(),
catch_handler_types_, needs_stacktrace());
// On lazy deoptimization we patch the optimized code here to enter the
// deoptimization stub.
diff --git a/runtime/vm/intermediate_language_arm64.cc b/runtime/vm/intermediate_language_arm64.cc
index fa44b58..0d78d48 100644
--- a/runtime/vm/intermediate_language_arm64.cc
+++ b/runtime/vm/intermediate_language_arm64.cc
@@ -2594,6 +2594,7 @@
__ Bind(compiler->GetJumpLabel(this));
compiler->AddExceptionHandler(catch_try_index(), try_index(),
compiler->assembler()->CodeSize(),
+ handler_token_pos(), is_generated(),
catch_handler_types_, needs_stacktrace());
// On lazy deoptimization we patch the optimized code here to enter the
// deoptimization stub.
diff --git a/runtime/vm/intermediate_language_dbc.cc b/runtime/vm/intermediate_language_dbc.cc
index e15e4fa..7e63b63 100644
--- a/runtime/vm/intermediate_language_dbc.cc
+++ b/runtime/vm/intermediate_language_dbc.cc
@@ -1149,6 +1149,7 @@
__ Bind(compiler->GetJumpLabel(this));
compiler->AddExceptionHandler(catch_try_index(), try_index(),
compiler->assembler()->CodeSize(),
+ handler_token_pos(), is_generated(),
catch_handler_types_, needs_stacktrace());
// On lazy deoptimization we patch the optimized code here to enter the
// deoptimization stub.
diff --git a/runtime/vm/intermediate_language_ia32.cc b/runtime/vm/intermediate_language_ia32.cc
index 7ccabe0..e19bbf1 100644
--- a/runtime/vm/intermediate_language_ia32.cc
+++ b/runtime/vm/intermediate_language_ia32.cc
@@ -2515,6 +2515,7 @@
__ Bind(compiler->GetJumpLabel(this));
compiler->AddExceptionHandler(catch_try_index(), try_index(),
compiler->assembler()->CodeSize(),
+ handler_token_pos(), is_generated(),
catch_handler_types_, needs_stacktrace());
// On lazy deoptimization we patch the optimized code here to enter the
// deoptimization stub.
diff --git a/runtime/vm/intermediate_language_mips.cc b/runtime/vm/intermediate_language_mips.cc
index fec6937..36217a4 100644
--- a/runtime/vm/intermediate_language_mips.cc
+++ b/runtime/vm/intermediate_language_mips.cc
@@ -2731,6 +2731,7 @@
__ Bind(compiler->GetJumpLabel(this));
compiler->AddExceptionHandler(catch_try_index(), try_index(),
compiler->assembler()->CodeSize(),
+ handler_token_pos(), is_generated(),
catch_handler_types_, needs_stacktrace());
// On lazy deoptimization we patch the optimized code here to enter the
// deoptimization stub.
diff --git a/runtime/vm/intermediate_language_x64.cc b/runtime/vm/intermediate_language_x64.cc
index a835e4c..0193a09 100644
--- a/runtime/vm/intermediate_language_x64.cc
+++ b/runtime/vm/intermediate_language_x64.cc
@@ -2546,6 +2546,7 @@
__ Bind(compiler->GetJumpLabel(this));
compiler->AddExceptionHandler(catch_try_index(), try_index(),
compiler->assembler()->CodeSize(),
+ handler_token_pos(), is_generated(),
catch_handler_types_, needs_stacktrace());
// On lazy deoptimization we patch the optimized code here to enter the
// deoptimization stub.
diff --git a/runtime/vm/isolate.cc b/runtime/vm/isolate.cc
index c4dd798..af870e9 100644
--- a/runtime/vm/isolate.cc
+++ b/runtime/vm/isolate.cc
@@ -726,6 +726,7 @@
api_flags->enable_asserts = FLAG_enable_asserts;
api_flags->enable_error_on_bad_type = FLAG_error_on_bad_type;
api_flags->enable_error_on_bad_override = FLAG_error_on_bad_override;
+ api_flags->use_field_guards = FLAG_use_field_guards;
}
@@ -735,6 +736,7 @@
api_flags->enable_asserts = asserts();
api_flags->enable_error_on_bad_type = error_on_bad_type();
api_flags->enable_error_on_bad_override = error_on_bad_override();
+ api_flags->use_field_guards = use_field_guards();
}
@@ -744,6 +746,7 @@
asserts_ = api_flags.enable_asserts;
error_on_bad_type_ = api_flags.enable_error_on_bad_type;
error_on_bad_override_ = api_flags.enable_error_on_bad_override;
+ use_field_guards_ = api_flags.use_field_guards;
// Leave others at defaults.
}
#endif // !defined(PRODUCT)
@@ -1780,11 +1783,17 @@
// TODO(5411455): For now just make sure there are no current isolates
// as we are shutting down the isolate.
Thread::ExitIsolate();
+
+ Dart_IsolateCleanupCallback cleanup = Isolate::CleanupCallback();
+ if (cleanup != NULL) {
+ cleanup(init_callback_data());
+ }
}
Dart_IsolateCreateCallback Isolate::create_callback_ = NULL;
Dart_IsolateShutdownCallback Isolate::shutdown_callback_ = NULL;
+Dart_IsolateCleanupCallback Isolate::cleanup_callback_ = NULL;
Monitor* Isolate::isolates_list_monitor_ = NULL;
Isolate* Isolate::isolates_list_head_ = NULL;
diff --git a/runtime/vm/isolate.h b/runtime/vm/isolate.h
index 115a3a9..3d9bf2b 100644
--- a/runtime/vm/isolate.h
+++ b/runtime/vm/isolate.h
@@ -399,6 +399,14 @@
return shutdown_callback_;
}
+ static void SetCleanupCallback(Dart_IsolateCleanupCallback cb) {
+ cleanup_callback_ = cb;
+ }
+ static Dart_IsolateCleanupCallback CleanupCallback() {
+ return cleanup_callback_;
+ }
+
+
void set_object_id_ring(ObjectIdRing* ring) { object_id_ring_ = ring; }
ObjectIdRing* object_id_ring() { return object_id_ring_; }
@@ -630,11 +638,13 @@
bool asserts() const { return FLAG_enable_asserts; }
bool error_on_bad_type() const { return FLAG_error_on_bad_type; }
bool error_on_bad_override() const { return FLAG_error_on_bad_override; }
+ bool use_field_guards() const { return FLAG_use_field_guards; }
#else // defined(PRODUCT)
bool type_checks() const { return type_checks_; }
bool asserts() const { return asserts_; }
bool error_on_bad_type() const { return error_on_bad_type_; }
bool error_on_bad_override() const { return error_on_bad_override_; }
+ bool use_field_guards() const { return use_field_guards_; }
#endif // defined(PRODUCT)
static void KillAllIsolates(LibMsgId msg_id);
@@ -764,6 +774,7 @@
bool asserts_;
bool error_on_bad_type_;
bool error_on_bad_override_;
+ bool use_field_guards_;
#endif // !defined(PRODUCT)
// Timestamps of last operation via service.
@@ -851,6 +862,7 @@
static Dart_IsolateCreateCallback create_callback_;
static Dart_IsolateShutdownCallback shutdown_callback_;
+ static Dart_IsolateCleanupCallback cleanup_callback_;
static void WakePauseEventHandler(Dart_Isolate isolate);
diff --git a/runtime/vm/jit_optimizer.cc b/runtime/vm/jit_optimizer.cc
index 8bc0776..ac9db2d3 100644
--- a/runtime/vm/jit_optimizer.cc
+++ b/runtime/vm/jit_optimizer.cc
@@ -1805,7 +1805,7 @@
AddReceiverCheck(instr);
}
if (field.guarded_cid() != kDynamicCid) {
- ASSERT(FLAG_use_field_guards);
+ ASSERT(I->use_field_guards());
InsertBefore(
instr, new (Z) GuardFieldClassInstr(new (Z) Value(instr->ArgumentAt(1)),
field, instr->deopt_id()),
@@ -1813,7 +1813,7 @@
}
if (field.needs_length_check()) {
- ASSERT(FLAG_use_field_guards);
+ ASSERT(I->use_field_guards());
InsertBefore(instr, new (Z) GuardFieldLengthInstr(
new (Z) Value(instr->ArgumentAt(1)), field,
instr->deopt_id()),
diff --git a/runtime/vm/kernel_binary.cc b/runtime/vm/kernel_binary.cc
index df7bec8..d7e526f 100644
--- a/runtime/vm/kernel_binary.cc
+++ b/runtime/vm/kernel_binary.cc
@@ -318,7 +318,7 @@
private:
Program* program_;
- MallocGrowableArray<Ref<CanonicalName> > canonical_names_;
+ MallocGrowableArray<CanonicalName*> canonical_names_;
BlockStack<VariableDeclaration> scope_;
BlockStack<TypeParameter> type_parameters_;
BlockStack<SwitchCase> switch_cases_;
diff --git a/runtime/vm/kernel_isolate.cc b/runtime/vm/kernel_isolate.cc
index e10391c..d0a09f8 100644
--- a/runtime/vm/kernel_isolate.cc
+++ b/runtime/vm/kernel_isolate.cc
@@ -68,8 +68,19 @@
return;
}
+ // Note: these flags must match those passed to the VM during
+ // the app-jit training run (see //utils/kernel-service/BUILD.gn).
Dart_IsolateFlags api_flags;
- Isolate::FlagsInitialize(&api_flags);
+ api_flags.version = DART_FLAGS_CURRENT_VERSION;
+ api_flags.enable_type_checks = false;
+ api_flags.enable_asserts = false;
+ api_flags.enable_error_on_bad_type = false;
+ api_flags.enable_error_on_bad_override = false;
+#if defined(DART_PRECOMPILER)
+ api_flags.use_field_guards = false;
+#else
+ api_flags.use_field_guards = true;
+#endif
isolate = reinterpret_cast<Isolate*>(create_callback(
KernelIsolate::kName, NULL, NULL, NULL, &api_flags, NULL, &error));
diff --git a/runtime/vm/kernel_to_il.cc b/runtime/vm/kernel_to_il.cc
index 57a1ba3..6f1a8c1 100644
--- a/runtime/vm/kernel_to_il.cc
+++ b/runtime/vm/kernel_to_il.cc
@@ -2277,6 +2277,8 @@
const bool should_restore_closure_context =
CurrentException()->is_captured() || CurrentCatchContext()->is_captured();
CatchBlockEntryInstr* entry = new (Z) CatchBlockEntryInstr(
+ TokenPosition::kNoSource, // Token position of catch block.
+ false, // Not an artifact of compilation.
AllocateBlockId(), CurrentTryIndex(), graph_entry_, handler_types,
handler_index, *CurrentException(), *CurrentStackTrace(),
/* needs_stacktrace = */ true, H.thread()->GetNextDeoptId(),
@@ -2686,7 +2688,7 @@
bool is_initialization_store) {
Fragment instructions;
const dart::Field& field_clone = MayCloneField(Z, field);
- if (FLAG_use_field_guards) {
+ if (I->use_field_guards()) {
LocalVariable* store_expression = MakeTemporary();
instructions += LoadLocal(store_expression);
instructions += GuardFieldClass(field_clone, H.thread()->GetNextDeoptId());
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index 386c301..37f76b2 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -7655,7 +7655,7 @@
// dynamic and possibly null). Attempt to relax this later.
const bool use_guarded_cid =
FLAG_precompiled_mode ||
- (FLAG_use_field_guards && !isolate->HasAttemptedReload());
+ (isolate->use_field_guards() && !isolate->HasAttemptedReload());
result.set_guarded_cid(use_guarded_cid ? kIllegalCid : kDynamicCid);
result.set_is_nullable(use_guarded_cid ? false : true);
result.set_guarded_list_length_in_object_offset(Field::kUnknownLengthOffset);
@@ -8166,7 +8166,7 @@
void Field::RecordStore(const Object& value) const {
ASSERT(IsOriginal());
- if (!FLAG_use_field_guards) {
+ if (!Isolate::Current()->use_field_guards()) {
return;
}
@@ -12493,7 +12493,9 @@
intptr_t outer_try_index,
uword handler_pc_offset,
bool needs_stacktrace,
- bool has_catch_all) const {
+ bool has_catch_all,
+ TokenPosition token_pos,
+ bool is_generated) const {
ASSERT((try_index >= 0) && (try_index < num_entries()));
NoSafepointScope no_safepoint;
ExceptionHandlerInfo* info =
@@ -12506,6 +12508,7 @@
info->handler_pc_offset = handler_pc_offset;
info->needs_stacktrace = needs_stacktrace;
info->has_catch_all = has_catch_all;
+ info->is_generated = is_generated;
}
void ExceptionHandlers::GetHandlerInfo(intptr_t try_index,
@@ -12534,6 +12537,12 @@
}
+bool ExceptionHandlers::IsGenerated(intptr_t try_index) const {
+ ASSERT((try_index >= 0) && (try_index < num_entries()));
+ return raw_ptr()->data()[try_index].is_generated;
+}
+
+
bool ExceptionHandlers::HasCatchAll(intptr_t try_index) const {
ASSERT((try_index >= 0) && (try_index < num_entries()));
return raw_ptr()->data()[try_index].has_catch_all;
@@ -12612,7 +12621,7 @@
const char* ExceptionHandlers::ToCString() const {
-#define FORMAT1 "%" Pd " => %#x (%" Pd " types) (outer %d)\n"
+#define FORMAT1 "%" Pd " => %#x (%" Pd " types) (outer %d) %s\n"
#define FORMAT2 " %d. %s\n"
if (num_entries() == 0) {
return "empty ExceptionHandlers\n";
@@ -12628,7 +12637,8 @@
const intptr_t num_types =
handled_types.IsNull() ? 0 : handled_types.Length();
len += OS::SNPrint(NULL, 0, FORMAT1, i, info.handler_pc_offset, num_types,
- info.outer_try_index);
+ info.outer_try_index,
+ info.is_generated ? "(generated)" : "");
for (int k = 0; k < num_types; k++) {
type ^= handled_types.At(k);
ASSERT(!type.IsNull());
@@ -12646,7 +12656,8 @@
handled_types.IsNull() ? 0 : handled_types.Length();
num_chars +=
OS::SNPrint((buffer + num_chars), (len - num_chars), FORMAT1, i,
- info.handler_pc_offset, num_types, info.outer_try_index);
+ info.handler_pc_offset, num_types, info.outer_try_index,
+ info.is_generated ? "(generated)" : "");
for (int k = 0; k < num_types; k++) {
type ^= handled_types.At(k);
num_chars += OS::SNPrint((buffer + num_chars), (len - num_chars), FORMAT2,
@@ -14621,6 +14632,14 @@
}
+RawArray* Code::await_token_positions() const {
+#if defined(DART_PRECOMPILED_RUNTIME)
+ return Array::null();
+#else
+ return raw_ptr()->await_token_positions_;
+#endif
+}
+
RawContext* Context::New(intptr_t num_variables, Heap::Space space) {
ASSERT(num_variables >= 0);
ASSERT(Object::context_class() != Class::null());
@@ -22504,11 +22523,11 @@
if (FLAG_precompiled_mode) {
line = token_pos.value();
} else {
- if (!script.IsNull() && token_pos.IsReal()) {
+ if (!script.IsNull() && token_pos.IsSourcePosition()) {
if (script.HasSource() || script.kind() == RawScript::kKernelTag) {
- script.GetTokenLocation(token_pos, &line, &column);
+ script.GetTokenLocation(token_pos.SourcePosition(), &line, &column);
} else {
- script.GetTokenLocation(token_pos, &line, NULL);
+ script.GetTokenLocation(token_pos.SourcePosition(), &line, NULL);
}
}
}
diff --git a/runtime/vm/object.h b/runtime/vm/object.h
index de4a284..84656ed 100644
--- a/runtime/vm/object.h
+++ b/runtime/vm/object.h
@@ -4513,12 +4513,15 @@
uword HandlerPCOffset(intptr_t try_index) const;
intptr_t OuterTryIndex(intptr_t try_index) const;
bool NeedsStackTrace(intptr_t try_index) const;
+ bool IsGenerated(intptr_t try_index) const;
void SetHandlerInfo(intptr_t try_index,
intptr_t outer_try_index,
uword handler_pc_offset,
bool needs_stacktrace,
- bool has_catch_all) const;
+ bool has_catch_all,
+ TokenPosition token_pos,
+ bool is_generated) const;
RawArray* GetHandledTypes(intptr_t try_index) const;
void SetHandledTypes(intptr_t try_index, const Array& handled_types) const;
@@ -4682,6 +4685,9 @@
StorePointer(&raw_ptr()->code_source_map_, code_source_map.raw());
}
+ RawArray* await_token_positions() const;
+ void SetAwaitTokenPositions(const Array& await_token_positions) const;
+
// Used during reloading (see object_reload.cc). Calls Reset on all ICDatas
// that are embedded inside the Code object.
void ResetICDatas(Zone* zone) const;
diff --git a/runtime/vm/object_service.cc b/runtime/vm/object_service.cc
index a7c846b..8cf15a8 100644
--- a/runtime/vm/object_service.cc
+++ b/runtime/vm/object_service.cc
@@ -869,6 +869,13 @@
}
+void Code::SetAwaitTokenPositions(const Array& await_token_positions) const {
+#if !defined(DART_PRECOMPILED_RUNTIME)
+ StorePointer(&raw_ptr()->await_token_positions_, await_token_positions.raw());
+#endif
+}
+
+
void Context::PrintJSONImpl(JSONStream* stream, bool ref) const {
JSONObject jsobj(stream);
// TODO(turnidge): Should the user level type for Context be Context
diff --git a/runtime/vm/object_test.cc b/runtime/vm/object_test.cc
index 46f8eea..fdaff29 100644
--- a/runtime/vm/object_test.cc
+++ b/runtime/vm/object_test.cc
@@ -2800,10 +2800,14 @@
exception_handlers ^= ExceptionHandlers::New(kNumEntries);
const bool kNeedsStackTrace = true;
const bool kNoStackTrace = false;
- exception_handlers.SetHandlerInfo(0, -1, 20u, kNeedsStackTrace, false);
- exception_handlers.SetHandlerInfo(1, 0, 30u, kNeedsStackTrace, false);
- exception_handlers.SetHandlerInfo(2, -1, 40u, kNoStackTrace, true);
- exception_handlers.SetHandlerInfo(3, 1, 150u, kNoStackTrace, true);
+ exception_handlers.SetHandlerInfo(0, -1, 20u, kNeedsStackTrace, false,
+ TokenPosition::kNoSource, true);
+ exception_handlers.SetHandlerInfo(1, 0, 30u, kNeedsStackTrace, false,
+ TokenPosition::kNoSource, true);
+ exception_handlers.SetHandlerInfo(2, -1, 40u, kNoStackTrace, true,
+ TokenPosition::kNoSource, true);
+ exception_handlers.SetHandlerInfo(3, 1, 150u, kNoStackTrace, true,
+ TokenPosition::kNoSource, true);
extern void GenerateIncrement(Assembler * assembler);
Assembler _assembler_;
diff --git a/runtime/vm/parser.cc b/runtime/vm/parser.cc
index f9664bd..f139e76 100644
--- a/runtime/vm/parser.cc
+++ b/runtime/vm/parser.cc
@@ -6609,7 +6609,7 @@
// :controller.AddError(:exception, :stack_trace);
// return; // The finally block will close the stream.
LocalVariable* controller =
- current_block_->scope->LookupVariable(Symbols::Controller(), false);
+ current_block_->scope->LookupVariable(Symbols::ColonController(), false);
ASSERT(controller != NULL);
ArgumentListNode* args = new (Z) ArgumentListNode(TokenPosition::kNoSource);
args->Add(new (Z)
@@ -6817,6 +6817,8 @@
// This is the outermost try-catch in the function.
ASSERT(try_stack_ == NULL);
PushTry(current_block_);
+ // Validate that we always get try index of 0.
+ ASSERT(try_stack_->try_index() == CatchClauseNode::kImplicitAsyncTryIndex);
SetupSavedTryContext(context_var);
}
@@ -7086,11 +7088,12 @@
// var :async_then_callback;
// var :async_catch_error_callback;
// var :async_stack_trace;
+ // var :controller_stream;
// These variables are used to store the async generator closure containing
// the body of the async* function. They are used by the await operator.
LocalVariable* controller_var =
new (Z) LocalVariable(TokenPosition::kNoSource, TokenPosition::kNoSource,
- Symbols::Controller(), Object::dynamic_type());
+ Symbols::ColonController(), Object::dynamic_type());
current_block_->scope->AddVariable(controller_var);
LocalVariable* async_op_var =
new (Z) LocalVariable(TokenPosition::kNoSource, TokenPosition::kNoSource,
@@ -7108,6 +7111,10 @@
LocalVariable(TokenPosition::kNoSource, TokenPosition::kNoSource,
Symbols::AsyncStackTraceVar(), Object::dynamic_type());
current_block_->scope->AddVariable(async_stack_trace);
+ LocalVariable* controller_stream = new (Z)
+ LocalVariable(TokenPosition::kNoSource, TokenPosition::kNoSource,
+ Symbols::ControllerStream(), Object::dynamic_type());
+ current_block_->scope->AddVariable(controller_stream);
}
@@ -7177,7 +7184,8 @@
// var :async_then_callback = _asyncThenWrapperHelper(:async_op);
// var :async_catch_error_callback = _asyncCatchErrorWrapperHelper(:async_op);
// :controller = new _AsyncStarStreamController(:async_op);
-// return :controller.stream;
+// var :controller_stream = :controller.stream;
+// return :controller_stream;
// }
SequenceNode* Parser::CloseAsyncGeneratorFunction(const Function& closure_func,
SequenceNode* closure_body) {
@@ -7194,7 +7202,7 @@
closure_body->scope()->LookupVariable(Symbols::AwaitContextVar(), false);
ASSERT((existing_var != NULL) && existing_var->is_captured());
existing_var =
- closure_body->scope()->LookupVariable(Symbols::Controller(), false);
+ closure_body->scope()->LookupVariable(Symbols::ColonController(), false);
ASSERT((existing_var != NULL) && existing_var->is_captured());
existing_var =
closure_body->scope()->LookupVariable(Symbols::AsyncOperation(), false);
@@ -7208,6 +7216,9 @@
existing_var = closure_body->scope()->LookupVariable(
Symbols::AsyncStackTraceVar(), false);
ASSERT((existing_var != NULL) && existing_var->is_captured());
+ existing_var =
+ closure_body->scope()->LookupVariable(Symbols::ControllerStream(), false);
+ ASSERT((existing_var != NULL) && existing_var->is_captured());
const Library& async_lib = Library::Handle(Library::AsyncLibrary());
@@ -7311,18 +7322,33 @@
TypeArguments::ZoneHandle(Z),
controller_constructor, arguments);
LocalVariable* controller_var =
- current_block_->scope->LookupVariable(Symbols::Controller(), false);
+ current_block_->scope->LookupVariable(Symbols::ColonController(), false);
StoreLocalNode* store_controller = new (Z) StoreLocalNode(
TokenPosition::kNoSource, controller_var, controller_constructor_call);
current_block_->statements->Add(store_controller);
+ // Grab :controller.stream
+ InstanceGetterNode* controller_stream = new (Z) InstanceGetterNode(
+ TokenPosition::kNoSource,
+ new (Z) LoadLocalNode(TokenPosition::kNoSource, controller_var),
+ Symbols::Stream());
+
+ // Store :controller.stream into :controller_stream inside the closure.
+ // We have to remember the stream because a new instance is generated for
+ // each getter invocation and in order to recreate the linkage, we need the
+ // awaited on instance.
+ LocalVariable* controller_stream_var =
+ current_block_->scope->LookupVariable(Symbols::ControllerStream(), false);
+ ASSERT(controller_stream_var != NULL);
+
+ StoreLocalNode* store_controller_stream = new (Z) StoreLocalNode(
+ TokenPosition::kNoSource, controller_stream_var, controller_stream);
+ current_block_->statements->Add(store_controller_stream);
+
// return :controller.stream;
ReturnNode* return_node = new (Z) ReturnNode(
TokenPosition::kNoSource,
- new (Z) InstanceGetterNode(
- TokenPosition::kNoSource,
- new (Z) LoadLocalNode(TokenPosition::kNoSource, controller_var),
- Symbols::Stream()));
+ new (Z) LoadLocalNode(TokenPosition::kNoSource, controller_stream_var));
current_block_->statements->Add(return_node);
return CloseBlock();
}
@@ -9066,6 +9092,37 @@
ParseAwaitableExpr(kAllowConst, kConsumeCascades, NULL);
ExpectToken(Token::kRPAREN);
+ // Create :stream to store the stream into temporarily.
+ LocalVariable* stream_var =
+ new (Z) LocalVariable(stream_expr_pos, stream_expr_pos,
+ Symbols::ColonStream(), Object::dynamic_type());
+ current_block_->scope->AddVariable(stream_var);
+
+ // Store the stream expression into a variable.
+ StoreLocalNode* store_stream_var =
+ new (Z) StoreLocalNode(stream_expr_pos, stream_var, stream_expr);
+ current_block_->statements->Add(store_stream_var);
+
+ // Register the awaiter on the stream by invoking `_asyncStarListenHelper`.
+ const Library& async_lib = Library::Handle(Library::AsyncLibrary());
+ const Function& async_star_listen_helper = Function::ZoneHandle(
+ Z,
+ async_lib.LookupFunctionAllowPrivate(Symbols::_AsyncStarListenHelper()));
+ ASSERT(!async_star_listen_helper.IsNull());
+ LocalVariable* async_op_var =
+ current_block_->scope->LookupVariable(Symbols::AsyncOperation(), false);
+ ASSERT(async_op_var != NULL);
+ ArgumentListNode* async_star_listen_helper_args =
+ new (Z) ArgumentListNode(stream_expr_pos);
+ async_star_listen_helper_args->Add(
+ new (Z) LoadLocalNode(stream_expr_pos, stream_var));
+ async_star_listen_helper_args->Add(
+ new (Z) LoadLocalNode(stream_expr_pos, async_op_var));
+ StaticCallNode* async_star_listen_helper_call = new (Z) StaticCallNode(
+ stream_expr_pos, async_star_listen_helper, async_star_listen_helper_args);
+
+ current_block_->statements->Add(async_star_listen_helper_call);
+
// Build creation of implicit StreamIterator.
// var :for-in-iter = new StreamIterator(stream_expr).
const Class& stream_iterator_cls =
@@ -9076,7 +9133,7 @@
stream_iterator_cls.LookupFunction(Symbols::StreamIteratorConstructor()));
ASSERT(!iterator_ctor.IsNull());
ArgumentListNode* ctor_args = new (Z) ArgumentListNode(stream_expr_pos);
- ctor_args->Add(stream_expr);
+ ctor_args->Add(new (Z) LoadLocalNode(stream_expr_pos, stream_var));
ConstructorCallNode* ctor_call = new (Z) ConstructorCallNode(
stream_expr_pos, TypeArguments::ZoneHandle(Z), iterator_ctor, ctor_args);
const AbstractType& iterator_type = Object::dynamic_type();
@@ -10348,7 +10405,8 @@
ASSERT(innermost_function().IsAsyncGenerator() ||
innermost_function().IsAsyncGenClosure());
- LocalVariable* controller_var = LookupLocalScope(Symbols::Controller());
+ LocalVariable* controller_var =
+ LookupLocalScope(Symbols::ColonController());
ASSERT(controller_var != NULL);
// :controller.add[Stream](expr);
ArgumentListNode* add_args = new (Z) ArgumentListNode(yield_pos);
diff --git a/runtime/vm/profiler_service.cc b/runtime/vm/profiler_service.cc
index 8b9bee9..e750b2c 100644
--- a/runtime/vm/profiler_service.cc
+++ b/runtime/vm/profiler_service.cc
@@ -2590,7 +2590,7 @@
return NULL;
}
TokenPosition token_pos = pfsp.token_pos();
- if (!token_pos.IsReal() && !token_pos.IsSynthetic()) {
+ if (!token_pos.IsSourcePosition()) {
// Not a location in a script.
return NULL;
}
diff --git a/runtime/vm/raw_object.h b/runtime/vm/raw_object.h
index 85cebf5..7f2afec 100644
--- a/runtime/vm/raw_object.h
+++ b/runtime/vm/raw_object.h
@@ -1141,6 +1141,7 @@
RawArray* stackmaps_;
RawArray* inlined_id_to_function_;
RawCodeSourceMap* code_source_map_;
+ NOT_IN_PRECOMPILED(RawArray* await_token_positions_);
NOT_IN_PRECOMPILED(RawInstructions* active_instructions_);
NOT_IN_PRECOMPILED(RawArray* deopt_info_array_);
// (code-offset, function, code) triples.
diff --git a/runtime/vm/raw_object_snapshot.cc b/runtime/vm/raw_object_snapshot.cc
index 95a71c1..db9d539 100644
--- a/runtime/vm/raw_object_snapshot.cc
+++ b/runtime/vm/raw_object_snapshot.cc
@@ -872,7 +872,7 @@
kAsReference);
field.StorePointer(&field.raw_ptr()->dependent_code_, Array::null());
- if (!FLAG_use_field_guards) {
+ if (!reader->isolate()->use_field_guards()) {
field.set_guarded_cid(kDynamicCid);
field.set_is_nullable(true);
field.set_guarded_list_length(Field::kNoFixedLength);
diff --git a/runtime/vm/scopes.cc b/runtime/vm/scopes.cc
index 75f5d68..e7c0432 100644
--- a/runtime/vm/scopes.cc
+++ b/runtime/vm/scopes.cc
@@ -264,6 +264,18 @@
// Keep :async_op for asynchronous debugging.
return false;
}
+ if (str.raw() == Symbols::AsyncCompleter().raw()) {
+ // Keep :async_completer for asynchronous debugging.
+ return false;
+ }
+ if (str.raw() == Symbols::ControllerStream().raw()) {
+ // Keep :controller_stream for asynchronous debugging.
+ return false;
+ }
+ if (str.raw() == Symbols::AwaitJumpVar().raw()) {
+ // Keep :await_jump_var for asynchronous debugging.
+ return false;
+ }
return str.CharAt(0) == ':';
}
diff --git a/runtime/vm/snapshot.cc b/runtime/vm/snapshot.cc
index 97f0d84..5eddb35 100644
--- a/runtime/vm/snapshot.cc
+++ b/runtime/vm/snapshot.cc
@@ -513,7 +513,7 @@
pobj_ = ReadObjectImpl(read_as_reference);
result->SetFieldAtOffset(offset, pobj_);
if ((offset != type_argument_field_offset) &&
- (kind_ == Snapshot::kMessage) && FLAG_use_field_guards) {
+ (kind_ == Snapshot::kMessage) && isolate()->use_field_guards()) {
// TODO(fschneider): Consider hoisting these lookups out of the loop.
// This would involve creating a handle, since cls_ can't be reused
// across the call to ReadObjectImpl.
@@ -580,7 +580,7 @@
ASSERT(kind_ == Snapshot::kScript);
// First read the version string, and check that it matches.
- RawApiError* error = VerifyVersionAndFeatures();
+ RawApiError* error = VerifyVersionAndFeatures(Isolate::Current());
if (error != ApiError::null()) {
return error;
}
@@ -602,7 +602,7 @@
}
-RawApiError* SnapshotReader::VerifyVersionAndFeatures() {
+RawApiError* SnapshotReader::VerifyVersionAndFeatures(Isolate* isolate) {
// If the version string doesn't match, return an error.
// Note: New things are allocated only if we're going to return an error.
@@ -639,7 +639,7 @@
}
Advance(version_len);
- const char* expected_features = Dart::FeaturesString(kind_);
+ const char* expected_features = Dart::FeaturesString(isolate, kind_);
ASSERT(expected_features != NULL);
const intptr_t expected_len = strlen(expected_features);
@@ -1842,7 +1842,8 @@
const intptr_t version_len = strlen(expected_version);
WriteBytes(reinterpret_cast<const uint8_t*>(expected_version), version_len);
- const char* expected_features = Dart::FeaturesString(kind_);
+ const char* expected_features =
+ Dart::FeaturesString(Isolate::Current(), kind_);
ASSERT(expected_features != NULL);
const intptr_t features_len = strlen(expected_features);
WriteBytes(reinterpret_cast<const uint8_t*>(expected_features),
diff --git a/runtime/vm/snapshot.h b/runtime/vm/snapshot.h
index 487aaa9..6051639 100644
--- a/runtime/vm/snapshot.h
+++ b/runtime/vm/snapshot.h
@@ -396,7 +396,7 @@
RawObject* ReadScriptSnapshot();
// Read version number of snapshot and verify.
- RawApiError* VerifyVersionAndFeatures();
+ RawApiError* VerifyVersionAndFeatures(Isolate* isolate);
RawObject* NewInteger(int64_t value);
diff --git a/runtime/vm/source_report.cc b/runtime/vm/source_report.cc
index 1508ae7..cc3cf21 100644
--- a/runtime/vm/source_report.cc
+++ b/runtime/vm/source_report.cc
@@ -332,8 +332,7 @@
for (intptr_t i = 0; i < profile_function->NumSourcePositions(); i++) {
const ProfileFunctionSourcePosition& position =
profile_function->GetSourcePosition(i);
- if (position.token_pos().IsSourcePosition() &&
- !position.token_pos().IsNoSource()) {
+ if (position.token_pos().IsSourcePosition()) {
// Add as an integer.
positions.AddValue(position.token_pos().Pos());
} else {
diff --git a/runtime/vm/symbols.h b/runtime/vm/symbols.h
index 828a7de..edc7f1b 100644
--- a/runtime/vm/symbols.h
+++ b/runtime/vm/symbols.h
@@ -46,8 +46,10 @@
V(IteratorParameter, ":iterator") \
V(_AsyncStarStreamController, "_AsyncStarStreamController") \
V(_AsyncStarStreamControllerConstructor, "_AsyncStarStreamController.") \
- V(Controller, ":controller") \
+ V(ColonController, ":controller") \
+ V(ControllerStream, ":controller_stream") \
V(Stream, "stream") \
+ V(_StreamImpl, "_StreamImpl") \
V(isPaused, "isPaused") \
V(AddError, "addError") \
V(AddStream, "addStream") \
@@ -127,6 +129,7 @@
V(AsyncStackTraceHelper, "_asyncStackTraceHelper") \
V(AsyncAwaitHelper, "_awaitHelper") \
V(Await, "await") \
+ V(_Awaiter, "_awaiter") \
V(AwaitTempVarPrefix, ":await_temp_var_") \
V(AwaitContextVar, ":await_ctx_var") \
V(AwaitJumpVar, ":await_jump_var") \
@@ -218,6 +221,7 @@
V(_RegExp, "_RegExp") \
V(RegExp, "RegExp") \
V(ColonMatcher, ":matcher") \
+ V(ColonStream, ":stream") \
V(Object, "Object") \
V(Int, "int") \
V(Double, "double") \
@@ -429,7 +433,8 @@
V(_classRangeCheckNegative, "_classRangeCheckNegative") \
V(GetRuntimeType, "get:runtimeType") \
V(HaveSameRuntimeType, "_haveSameRuntimeType") \
- V(DartDeveloperCausalAsyncStacks, "dart.developer.causal_async_stacks")
+ V(DartDeveloperCausalAsyncStacks, "dart.developer.causal_async_stacks") \
+ V(_AsyncStarListenHelper, "_asyncStarListenHelper")
// Contains a list of frequently used strings in a canonicalized form. This
diff --git a/runtime/vm/token_position.h b/runtime/vm/token_position.h
index b0a2062..65dd3ed 100644
--- a/runtime/vm/token_position.h
+++ b/runtime/vm/token_position.h
@@ -134,9 +134,11 @@
bool IsReal() const { return value_ >= kMinSourcePos; }
// Is |this| a source position?
- bool IsSourcePosition() const {
- return IsReal() || IsNoSource() || IsSynthetic();
- }
+ bool IsSourcePosition() const { return IsReal() || IsSynthetic(); }
+
+ // Convert |this| into a real source position. Sentinel values remain
+ // unchanged.
+ TokenPosition SourcePosition() const { return FromSynthetic(); }
// Is |this| a debug pause source position?
bool IsDebugPause() const {
diff --git a/sdk/lib/_internal/js_runtime/lib/js_helper.dart b/sdk/lib/_internal/js_runtime/lib/js_helper.dart
index 86e80d8..6e1548d 100644
--- a/sdk/lib/_internal/js_runtime/lib/js_helper.dart
+++ b/sdk/lib/_internal/js_runtime/lib/js_helper.dart
@@ -3361,6 +3361,59 @@
throw new TypeErrorImplementation(value, 'void');
}
+extractFunctionTypeObjectFrom(o) {
+ var interceptor = getInterceptor(o);
+ var signatureName = JS_GET_NAME(JsGetName.SIGNATURE_NAME);
+ return JS('bool', '# in #', signatureName, interceptor)
+ ? JS('', '#[#]()', interceptor, signatureName)
+ : null;
+}
+
+functionTypeTest(value, functionTypeRti) {
+ if (value == null) return false;
+ var functionTypeObject = extractFunctionTypeObjectFrom(value);
+ return functionTypeObject == null
+ ? false
+ : isFunctionSubtype(functionTypeObject, functionTypeRti);
+}
+
+// Declared as 'var' to avoid assignment checks.
+var _inTypeAssertion = false;
+
+functionTypeCheck(value, functionTypeRti) {
+ if (value == null) return value;
+
+ // The function type test code contains type assertions for function
+ // types. This leads to unbounded recursion, so disable the type checking of
+ // function types while checking function types.
+
+ if (true == _inTypeAssertion) return value;
+
+ _inTypeAssertion = true;
+ try {
+ if (functionTypeTest(value, functionTypeRti)) return value;
+ var self = runtimeTypeToString(functionTypeRti);
+ throw new TypeErrorImplementation(value, self);
+ } finally {
+ _inTypeAssertion = false;
+ }
+}
+
+functionTypeCast(value, functionTypeRti) {
+ if (value == null) return value;
+ if (functionTypeTest(value, functionTypeRti)) return value;
+
+ var self = runtimeTypeToString(functionTypeRti);
+ var functionTypeObject = extractFunctionTypeObjectFrom(value);
+ var pretty;
+ if (functionTypeObject != null) {
+ pretty = runtimeTypeToString(functionTypeObject);
+ } else {
+ pretty = Primitives.objectTypeName(value);
+ }
+ throw new CastErrorImplementation(pretty, self);
+}
+
checkMalformedType(value, message) {
if (value == null) return value;
throw new TypeErrorImplementation.fromMessage(message);
@@ -3489,338 +3542,6 @@
}
}
-abstract class RuntimeType {
- const RuntimeType();
-
- toRti();
-}
-
-class RuntimeFunctionType extends RuntimeType {
- final RuntimeType returnType;
- final List<RuntimeType> parameterTypes;
- final List<RuntimeType> optionalParameterTypes;
- final namedParameters;
-
- static var /* bool */ inAssert = false;
-
- RuntimeFunctionType(this.returnType,
- this.parameterTypes,
- this.optionalParameterTypes,
- this.namedParameters);
-
- bool get isVoid => returnType is VoidRuntimeType;
-
- /// Called from generated code. [expression] is a Dart object and this method
- /// returns true if [this] is a supertype of [expression].
- @NoInline() @NoSideEffects()
- bool _isTest(expression) {
- var functionTypeObject = extractFunctionTypeObjectFrom(expression);
- return functionTypeObject == null
- ? false
- : isFunctionSubtype(functionTypeObject, toRti());
- }
-
- @NoInline() @NoSideEffects()
- _asCheck(expression) {
- // Type inferrer doesn't think this is called with dynamic arguments.
- return _check(JS('', '#', expression), true);
- }
-
- @NoInline() @NoSideEffects()
- _assertCheck(expression) {
- if (inAssert) return null;
- inAssert = true; // Don't try to check this library itself.
- try {
- // Type inferrer don't think this is called with dynamic arguments.
- return _check(JS('', '#', expression), false);
- } finally {
- inAssert = false;
- }
- }
-
- _check(expression, bool isCast) {
- if (expression == null) return null;
- if (_isTest(expression)) return expression;
-
- var self = runtimeTypeToString(toRti());
- if (isCast) {
- var functionTypeObject = extractFunctionTypeObjectFrom(expression);
- var pretty;
- if (functionTypeObject != null) {
- pretty = runtimeTypeToString(functionTypeObject);
- } else {
- pretty = Primitives.objectTypeName(expression);
- }
- throw new CastErrorImplementation(pretty, self);
- } else {
- // TODO(ahe): Pass "pretty" function-type to TypeErrorImplementation?
- throw new TypeErrorImplementation(expression, self);
- }
- }
-
- toRti() {
- var result = createDartFunctionTypeRti();
- if (isVoid) {
- JS('', '#[#] = true', result,
- JS_GET_NAME(JsGetName.FUNCTION_TYPE_VOID_RETURN_TAG));
- } else {
- if (returnType is! DynamicRuntimeType) {
- JS('', '#[#] = #', result,
- JS_GET_NAME(JsGetName.FUNCTION_TYPE_RETURN_TYPE_TAG),
- returnType.toRti());
- }
- }
- if (parameterTypes != null && !parameterTypes.isEmpty) {
- JS('', '#[#] = #', result,
- JS_GET_NAME(JsGetName.FUNCTION_TYPE_REQUIRED_PARAMETERS_TAG),
- listToRti(parameterTypes));
- }
-
- if (optionalParameterTypes != null && !optionalParameterTypes.isEmpty) {
- JS('', '#[#] = #', result,
- JS_GET_NAME(JsGetName.FUNCTION_TYPE_OPTIONAL_PARAMETERS_TAG),
- listToRti(optionalParameterTypes));
- }
-
- if (namedParameters != null) {
- var namedRti = JS('=Object', 'Object.create(null)');
- var keys = extractKeys(namedParameters);
- for (var i = 0; i < keys.length; i++) {
- var name = keys[i];
- var rti = JS('', '#[#]', namedParameters, name).toRti();
- JS('', '#[#] = #', namedRti, name, rti);
- }
- JS('', '#[#] = #', result,
- JS_GET_NAME(JsGetName.FUNCTION_TYPE_NAMED_PARAMETERS_TAG),
- namedRti);
- }
-
- return result;
- }
-
- static listToRti(list) {
- list = JS('JSFixedArray', '#', list);
- var result = JS('JSExtendableArray', '[]');
- for (var i = 0; i < list.length; i++) {
- JS('', '#.push(#)', result, list[i].toRti());
- }
- return result;
- }
-
- String toString() {
- String result = '(';
- bool needsComma = false;
- if (parameterTypes != null) {
- for (var i = 0; i < parameterTypes.length; i++) {
- RuntimeType type = parameterTypes[i];
- if (needsComma) result += ', ';
- result += '$type';
- needsComma = true;
- }
- }
- if (optionalParameterTypes != null && !optionalParameterTypes.isEmpty) {
- if (needsComma) result += ', ';
- needsComma = false;
- result += '[';
- for (var i = 0; i < optionalParameterTypes.length; i++) {
- RuntimeType type = optionalParameterTypes[i];
- if (needsComma) result += ', ';
- result += '$type';
- needsComma = true;
- }
- result += ']';
- } else if (namedParameters != null) {
- if (needsComma) result += ', ';
- needsComma = false;
- result += '{';
- var keys = extractKeys(namedParameters);
- for (var i = 0; i < keys.length; i++) {
- var name = keys[i];
- if (needsComma) result += ', ';
- var rti = JS('', '#[#]', namedParameters, name).toRti();
- result += '$rti ${JS("String", "#", name)}';
- needsComma = true;
- }
- result += '}';
- }
-
- result += ') -> $returnType';
- return result;
- }
-}
-
-extractFunctionTypeObjectFrom(o) {
- var interceptor = getInterceptor(o);
- var signatureName = JS_GET_NAME(JsGetName.SIGNATURE_NAME);
- return JS('bool', '# in #', signatureName, interceptor)
- ? JS('', '#[#]()', interceptor, signatureName)
- : null;
-}
-
-RuntimeFunctionType buildFunctionType(returnType,
- parameterTypes,
- optionalParameterTypes) {
- return new RuntimeFunctionType(
- returnType,
- parameterTypes,
- optionalParameterTypes,
- null);
-}
-
-RuntimeFunctionType buildNamedFunctionType(returnType,
- parameterTypes,
- namedParameters) {
- return new RuntimeFunctionType(
- returnType,
- parameterTypes,
- null,
- namedParameters);
-}
-
-RuntimeType buildInterfaceType(rti, typeArguments) {
- String jsConstructorName = rawRtiToJsConstructorName(rti);
- if (typeArguments == null || typeArguments.isEmpty) {
- return new RuntimeTypePlain(jsConstructorName);
- }
- return new RuntimeTypeGeneric(jsConstructorName, typeArguments, null);
-}
-
-class DynamicRuntimeType extends RuntimeType {
- const DynamicRuntimeType();
-
- String toString() => 'dynamic';
-
- toRti() => null;
-}
-
-RuntimeType getDynamicRuntimeType() => const DynamicRuntimeType();
-
-class VoidRuntimeType extends RuntimeType {
- const VoidRuntimeType();
-
- String toString() => 'void';
-
- toRti() => throw 'internal error';
-}
-
-RuntimeType getVoidRuntimeType() => const VoidRuntimeType();
-
-/**
- * Meta helper for function type tests.
- *
- * A "meta helper" is a helper function that is never called but simulates how
- * generated code behaves as far as resolution and type inference is concerned.
- */
-functionTypeTestMetaHelper() {
- var dyn = JS('', 'x');
- var dyn2 = JS('', 'x');
- List fixedListOrNull = JS('JSFixedArray|Null', 'x');
- List fixedListOrNull2 = JS('JSFixedArray|Null', 'x');
- List fixedList = JS('JSFixedArray', 'x');
- // TODO(ahe): Can we use [UnknownJavaScriptObject] below?
- var /* UnknownJavaScriptObject */ jsObject = JS('=Object', 'x');
-
- buildFunctionType(dyn, fixedListOrNull, fixedListOrNull2);
- buildNamedFunctionType(dyn, fixedList, jsObject);
- buildInterfaceType(dyn, fixedListOrNull);
- getDynamicRuntimeType();
- getVoidRuntimeType();
- convertRtiToRuntimeType(dyn);
- dyn._isTest(dyn2);
- dyn._asCheck(dyn2);
- dyn._assertCheck(dyn2);
-}
-
-RuntimeType convertRtiToRuntimeType(rti) {
- if (rti == null) {
- return getDynamicRuntimeType();
- } else if (JS('bool', 'typeof # == "function"', rti)) {
- return new RuntimeTypePlain(JS('String', r'#.name', rti));
- } else if (JS('bool', '#.constructor == Array', rti)) {
- List list = JS('JSFixedArray', '#', rti);
- String name = JS('String', r'#.name', list[0]);
- List arguments = [];
- for (int i = 1; i < list.length; i++) {
- arguments.add(convertRtiToRuntimeType(list[i]));
- }
- return new RuntimeTypeGeneric(name, arguments, rti);
- } else if (JS('bool', '"func" in #', rti)) {
- return new FunctionTypeInfoDecoderRing(rti).toRuntimeType();
- } else {
- throw new RuntimeError(
- "Cannot convert "
- "'${JS('String', 'JSON.stringify(#)', rti)}' to RuntimeType.");
- }
-}
-
-class RuntimeTypePlain extends RuntimeType {
- /// The constructor name of this raw type.
- final String _jsConstructorName;
-
- RuntimeTypePlain(this._jsConstructorName);
-
- toRti() {
- var rti = jsConstructorNameToRti(_jsConstructorName);
- if (rti == null) throw "no type for '$_jsConstructorName'";
- return rti;
- }
-
- String toString() => _jsConstructorName;
-}
-
-class RuntimeTypeGeneric extends RuntimeType {
- /// The constructor name of the raw type for this generic type.
- final String _jsConstructorName;
- final List<RuntimeType> arguments;
- var rti;
-
- RuntimeTypeGeneric(this._jsConstructorName, this.arguments, this.rti);
-
- toRti() {
- if (rti != null) return rti;
- var result = [jsConstructorNameToRti(_jsConstructorName)];
- if (result[0] == null) {
- throw "no type for '$_jsConstructorName<...>'";
- }
- for (RuntimeType argument in arguments) {
- result.add(argument.toRti());
- }
- return rti = result;
- }
-
- String toString() => '$_jsConstructorName<${arguments.join(", ")}>';
-}
-
-class FunctionTypeInfoDecoderRing {
- final _typeData;
- String _cachedToString;
-
- FunctionTypeInfoDecoderRing(this._typeData);
-
- bool get _hasReturnType => JS('bool', '"ret" in #', _typeData);
- get _returnType => JS('', '#.ret', _typeData);
-
- bool get _isVoid => JS('bool', '!!#.v', _typeData);
-
- bool get _hasArguments => JS('bool', '"args" in #', _typeData);
- List get _arguments => JS('JSExtendableArray', '#.args', _typeData);
-
- bool get _hasOptionalArguments => JS('bool', '"opt" in #', _typeData);
- List get _optionalArguments => JS('JSExtendableArray', '#.opt', _typeData);
-
- bool get _hasNamedArguments => JS('bool', '"named" in #', _typeData);
- get _namedArguments => JS('=Object', '#.named', _typeData);
-
- RuntimeType toRuntimeType() {
- // TODO(ahe): Implement this (and update return type).
- return const DynamicRuntimeType();
- }
-
- String toString() {
- return _cachedToString ??= runtimeTypeToString(_typeData);
- }
-}
-
// TODO(ahe): Remove this class and call noSuchMethod instead.
class UnimplementedNoSuchMethodError extends Error
implements NoSuchMethodError {
diff --git a/sdk/lib/_internal/js_runtime/lib/js_rti.dart b/sdk/lib/_internal/js_runtime/lib/js_rti.dart
index 8f27e95..8ee404e 100644
--- a/sdk/lib/_internal/js_runtime/lib/js_rti.dart
+++ b/sdk/lib/_internal/js_runtime/lib/js_rti.dart
@@ -371,23 +371,21 @@
}
Object subtypeCast(Object object, String isField, List checks, String asField) {
- if (object != null && !checkSubtype(object, isField, checks, asField)) {
- String actualType = Primitives.objectTypeName(object);
- String typeName = computeTypeName(isField, checks);
- // TODO(johnniwinther): Move type lookup to [CastErrorImplementation] to
- // align with [TypeErrorImplementation].
- throw new CastErrorImplementation(actualType, typeName);
- }
- return object;
+ if (object == null) return object;
+ if (checkSubtype(object, isField, checks, asField)) return object;
+ String actualType = Primitives.objectTypeName(object);
+ String typeName = computeTypeName(isField, checks);
+ // TODO(johnniwinther): Move type lookup to [CastErrorImplementation] to
+ // align with [TypeErrorImplementation].
+ throw new CastErrorImplementation(actualType, typeName);
}
-Object assertSubtype(Object object, String isField, List checks,
- String asField) {
- if (object != null && !checkSubtype(object, isField, checks, asField)) {
- String typeName = computeTypeName(isField, checks);
- throw new TypeErrorImplementation(object, typeName);
- }
- return object;
+Object assertSubtype(
+ Object object, String isField, List checks, String asField) {
+ if (object == null) return object;
+ if (checkSubtype(object, isField, checks, asField)) return object;
+ String typeName = computeTypeName(isField, checks);
+ throw new TypeErrorImplementation(object, typeName);
}
/// Checks that the type represented by [subtype] is a subtype of [supertype].
diff --git a/sdk/lib/async/future.dart b/sdk/lib/async/future.dart
index 5b570c6..3e5dd58 100644
--- a/sdk/lib/async/future.dart
+++ b/sdk/lib/async/future.dart
@@ -304,7 +304,9 @@
StackTrace stackTrace; // The stackTrace that came with the error.
// Handle an error from any of the futures.
- void handleError(theError, theStackTrace) {
+ // TODO(jmesserly): use `void` return type once it can be inferred for the
+ // `then` call below.
+ handleError(theError, theStackTrace) {
remaining--;
if (values != null) {
if (cleanUp != null) {
@@ -551,17 +553,15 @@
* }
*
*/
- // The `Function` below can stand for several types:
- // - (dynamic) -> T
- // - (dynamic, StackTrace) -> T
- // - (dynamic) -> Future<T>
- // - (dynamic, StackTrace) -> Future<T>
+ // The `Function` below stands for one of two types:
+ // - (dynamic) -> FutureOr<T>
+ // - (dynamic, StackTrace) -> FutureOr<T>
// Given that there is a `test` function that is usually used to do an
// `isCheck` we should also expect functions that take a specific argument.
// Note: making `catchError` return a `Future<T>` in non-strong mode could be
// a breaking change.
Future<T> catchError(Function onError,
- {bool test(Object error)});
+ {bool test(Object error)});
/**
* Register a function to be called when this future completes.
@@ -783,7 +783,7 @@
*
* All listeners on the future are informed about the value.
*/
- void complete([value]);
+ void complete([FutureOr<T> value]);
/**
* Complete [future] with an error.
@@ -825,5 +825,4 @@
}
/** Helper function that converts `null` to a [NullThrownError]. */
-Object _nonNullError(Object error) =>
- (error != null) ? error : new NullThrownError();
+Object _nonNullError(Object error) => error ?? new NullThrownError();
diff --git a/sdk/lib/async/future_impl.dart b/sdk/lib/async/future_impl.dart
index eaad3b4..844646b 100644
--- a/sdk/lib/async/future_impl.dart
+++ b/sdk/lib/async/future_impl.dart
@@ -14,7 +14,7 @@
abstract class _Completer<T> implements Completer<T> {
final _Future<T> future = new _Future<T>();
- void complete([value]);
+ void complete([FutureOr<T> value]);
void completeError(Object error, [StackTrace stackTrace]) {
error = _nonNullError(error);
@@ -36,7 +36,7 @@
class _AsyncCompleter<T> extends _Completer<T> {
- void complete([value]) {
+ void complete([FutureOr<T> value]) {
if (!future._mayComplete) throw new StateError("Future already completed");
future._asyncComplete(value);
}
@@ -47,7 +47,7 @@
}
class _SyncCompleter<T> extends _Completer<T> {
- void complete([value]) {
+ void complete([FutureOr<T> value]) {
if (!future._mayComplete) throw new StateError("Future already completed");
future._complete(value);
}
@@ -237,7 +237,7 @@
if (!identical(currentZone, _ROOT_ZONE)) {
f = currentZone.registerUnaryCallback<FutureOr<E>, T>(f);
if (onError != null) {
- onError = _registerErrorHandler<T>(onError, currentZone);
+ onError = _registerErrorHandler<E>(onError, currentZone);
}
}
return _thenNoZoneRegistration<E>(f, onError);
diff --git a/sdk/lib/collection/list.dart b/sdk/lib/collection/list.dart
index b81b8dd..f340a5e 100644
--- a/sdk/lib/collection/list.dart
+++ b/sdk/lib/collection/list.dart
@@ -267,30 +267,28 @@
}
void removeWhere(bool test(E element)) {
- _filter(this, test, false);
+ _filter(test, false);
}
void retainWhere(bool test(E element)) {
- _filter(this, test, true);
+ _filter(test, true);
}
- static void _filter(List source,
- bool test(var element),
- bool retainMatching) {
- List retained = [];
- int length = source.length;
+ void _filter(bool test(var element), bool retainMatching) {
+ List<E> retained = <E>[];
+ int length = this.length;
for (int i = 0; i < length; i++) {
- var element = source[i];
+ var element = this[i];
if (test(element) == retainMatching) {
retained.add(element);
}
- if (length != source.length) {
- throw new ConcurrentModificationError(source);
+ if (length != this.length) {
+ throw new ConcurrentModificationError(this);
}
}
- if (retained.length != source.length) {
- source.setRange(0, retained.length, retained);
- source.length = retained.length;
+ if (retained.length != this.length) {
+ this.setRange(0, retained.length, retained);
+ this.length = retained.length;
}
}
@@ -308,11 +306,13 @@
}
void sort([int compare(E a, E b)]) {
- if (compare == null) {
- Sort.sort(this, Comparable.compare);
- } else {
- Sort.sort(this, compare);
- }
+ Sort.sort(this, compare ?? _compareAny);
+ }
+
+ static int _compareAny(a, b) {
+ // In strong mode Comparable.compare requires an implicit cast to ensure
+ // `a` and `b` are Comparable.
+ return Comparable.compare(a, b);
}
void shuffle([Random random]) {
diff --git a/sdk/lib/core/uri.dart b/sdk/lib/core/uri.dart
index 232d552..4ce1c17 100644
--- a/sdk/lib/core/uri.dart
+++ b/sdk/lib/core/uri.dart
@@ -697,7 +697,7 @@
* in [RFC-3986 Section 5](http://tools.ietf.org/html/rfc3986#section-5 "RFC-1123").
*
* Updated to handle the case where the base URI is just a relative path -
- * that is: when it has no scheme or authority and the path does not start
+ * that is: when it has no scheme and no authority and the path does not start
* with a slash.
* In that case, the paths are combined without removing leading "..", and
* an empty path is not converted to "/".
diff --git a/sdk/lib/io/io_sink.dart b/sdk/lib/io/io_sink.dart
index b1e1fca..3a5ca68 100644
--- a/sdk/lib/io/io_sink.dart
+++ b/sdk/lib/io/io_sink.dart
@@ -112,7 +112,7 @@
/**
* Returns a [Future] that completes once all buffered data is accepted by the
- * to underlying [StreamConsumer].
+ * underlying [StreamConsumer].
*
* This method must not be called while an [addStream] is incomplete.
*
diff --git a/tests/co19/co19-dart2js.status b/tests/co19/co19-dart2js.status
index 029924a..fa74a1d 100644
--- a/tests/co19/co19-dart2js.status
+++ b/tests/co19/co19-dart2js.status
@@ -10422,21 +10422,6 @@
WebPlatformTest/webstorage/storage_builtins_t01: RuntimeError # Please triage this failure
WebPlatformTest/webstorage/storage_local_setitem_quotaexceedederr_t01: Skip # Times out. Please triage this failure
-[ $compiler == dart2js && $runtime == ie11 && $builder_tag == win7]
-LayoutTests/fast/canvas/webgl/copy-tex-image-and-sub-image-2d_t01: RuntimeError # Please triage this failure
-LayoutTests/fast/canvas/webgl/css-webkit-canvas-repaint_t01: RuntimeError # Please triage this failure
-LayoutTests/fast/canvas/webgl/css-webkit-canvas_t01: RuntimeError # Please triage this failure
-LayoutTests/fast/canvas/webgl/framebuffer-object-attachment_t01: RuntimeError # fixed by co19 pull request whesse-patch-2
-LayoutTests/fast/canvas/webgl/object-deletion-behaviour_t01: RuntimeError # Please triage this failure
-LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-with-array-buffer-view_t01: RuntimeError # Please triage this failure
-LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-with-image-data-rgb565_t01: RuntimeError # Please triage this failure
-LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-with-image-data-rgba4444_t01: RuntimeError # Please triage this failure
-LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-with-image-data-rgba5551_t01: RuntimeError # Please triage this failure
-LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-with-image-data_t01: RuntimeError # Please triage this failure
-LayoutTests/fast/canvas/webgl/tex-sub-image-2d_t01: RuntimeError # Please triage this failure
-LayoutTests/fast/canvas/webgl/tex-sub-image-cube-maps_t01: RuntimeError # Please triage this failure
-LayoutTests/fast/canvas/webgl/webgl-depth-texture_t01: RuntimeError # Please triage this failure
-
[ $compiler == dart2js && $runtime == ie11 && $builder_tag == win8]
LibTest/typed_data/ByteData/offsetInBytes_A01_t01: RuntimeError # Please triage this failure
LayoutTests/fast/dom/XMLSerializer-attribute-entities_t01: RuntimeError # Please triage this failure
diff --git a/tests/co19/co19-kernel.status b/tests/co19/co19-kernel.status
index 0ddcfa4..c7dda2b 100644
--- a/tests/co19/co19-kernel.status
+++ b/tests/co19/co19-kernel.status
@@ -18,6 +18,7 @@
Language/Classes/Constructors/Factories/default_value_t01: MissingCompileTimeError
Language/Classes/Constructors/Factories/default_value_t02: MissingCompileTimeError
Language/Classes/Constructors/Factories/name_t02: DartkCrash
+Language/Classes/Constructors/Generative_Constructors/execution_of_an_initializer_t02: RuntimeError # Dartk Issue 28566
Language/Classes/Constructors/Generative_Constructors/execution_t04: MissingCompileTimeError
Language/Classes/Constructors/Generative_Constructors/execution_t05: MissingCompileTimeError
Language/Classes/Constructors/Generative_Constructors/execution_t06: MissingCompileTimeError
@@ -27,1291 +28,7 @@
Language/Classes/Constructors/Generative_Constructors/formal_parameter_t02: MissingCompileTimeError
Language/Classes/Constructors/Generative_Constructors/formal_parameter_t08: MissingCompileTimeError
Language/Classes/Constructors/Generative_Constructors/initializers_t12: MissingCompileTimeError
-Language/Classes/Constructors/Generative_Constructors/initializing_other_function_t01: DartkCrash
-Language/Classes/Constructors/Generative_Constructors/initializing_other_function_t02: DartkCrash
-Language/Classes/Constructors/Generative_Constructors/initializing_other_function_t03: DartkCrash
-Language/Classes/Constructors/Generative_Constructors/initializing_other_function_t04: DartkCrash
-Language/Classes/Constructors/Generative_Constructors/initializing_other_function_t05: DartkCrash
-Language/Classes/Constructors/Generative_Constructors/initializing_other_function_t06: DartkCrash
-Language/Classes/Constructors/Generative_Constructors/redirection_t02: MissingCompileTimeError
-Language/Classes/Constructors/Generative_Constructors/redirection_t03: MissingCompileTimeError
-Language/Classes/Constructors/Generative_Constructors/redirection_t07: MissingCompileTimeError
-Language/Classes/Constructors/Generative_Constructors/redirection_t08: MissingCompileTimeError
-Language/Classes/Constructors/Generative_Constructors/redirection_t09: MissingCompileTimeError
-Language/Classes/Constructors/Generative_Constructors/superclass_constructor_t01: Crash
-Language/Classes/Constructors/Generative_Constructors/superclass_constructor_t02: Crash
-Language/Classes/Constructors/Generative_Constructors/superclass_constructor_t03: MissingCompileTimeError
-Language/Classes/Constructors/Generative_Constructors/superclass_constructor_t04: Crash
-Language/Classes/Constructors/Generative_Constructors/superclass_constructor_t05: Crash
-Language/Classes/Constructors/Generative_Constructors/superclass_constructor_t06: MissingCompileTimeError
-Language/Classes/Constructors/Generative_Constructors/syntax_t02: MissingCompileTimeError
-Language/Classes/Constructors/Generative_Constructors/syntax_t04: MissingCompileTimeError
-Language/Classes/Constructors/Generative_Constructors/syntax_t05: MissingCompileTimeError
-Language/Classes/Getters/syntax_t02: MissingCompileTimeError
-Language/Classes/Getters/syntax_t03: MissingCompileTimeError
-Language/Classes/Getters/syntax_t04: MissingCompileTimeError
-Language/Classes/Getters/syntax_t05: MissingCompileTimeError
-Language/Classes/Getters/syntax_t07: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/arity_0_or_1_t02: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/arity_0_t02: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/arity_1_t01: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/arity_1_t02: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/arity_1_t03: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/arity_1_t04: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/arity_1_t05: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/arity_1_t06: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/arity_1_t07: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/arity_1_t08: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/arity_1_t09: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/arity_1_t10: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/arity_1_t11: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/arity_1_t12: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/arity_1_t13: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/arity_1_t14: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/arity_1_t15: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/arity_1_t16: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/arity_1_t17: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/arity_1_t18: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/arity_2_t01: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/arity_2_t02: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/optional_parameter_t01: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/optional_parameter_t02: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/optional_parameter_t03: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/optional_parameter_t04: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/optional_parameter_t06: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/optional_parameter_t08: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/syntax_t04: MissingCompileTimeError
-Language/Classes/Instance_Methods/same_name_setter_t01: CompileTimeError
-Language/Classes/Instance_Variables/constant_t01: MissingCompileTimeError
-Language/Classes/Setters/name_t01: CompileTimeError
-Language/Classes/Setters/name_t02: CompileTimeError
-Language/Classes/Setters/name_t07: CompileTimeError
-Language/Classes/Setters/parameter_t01: MissingCompileTimeError
-Language/Classes/Setters/parameter_t02: MissingCompileTimeError
-Language/Classes/Setters/parameter_t03: MissingCompileTimeError
-Language/Classes/Setters/parameter_t04: MissingCompileTimeError
-Language/Classes/Setters/parameter_t05: MissingCompileTimeError
-Language/Classes/Setters/parameter_t06: MissingCompileTimeError
-Language/Classes/Setters/parameter_t07: MissingCompileTimeError
-Language/Classes/Setters/parameter_t08: MissingCompileTimeError
-Language/Classes/Setters/static_setter_t05: RuntimeError
-Language/Classes/Setters/static_setter_t06: DartkCrash
-Language/Classes/Setters/syntax_t01: RuntimeError
-Language/Classes/Setters/syntax_t03: MissingCompileTimeError
-Language/Classes/Setters/syntax_t04: RuntimeError
-Language/Classes/Static_Methods/declaration_t01: MissingCompileTimeError
-Language/Classes/Static_Methods/same_name_method_and_setter_t01: CompileTimeError
-Language/Classes/Superclasses/Inheritance_and_Overriding/inheritance_t03: RuntimeError
-Language/Classes/Superclasses/superclass_of_itself_t01: MissingCompileTimeError
-Language/Classes/Superclasses/superclass_of_itself_t02: MissingCompileTimeError
-Language/Classes/Superclasses/wrong_superclass_t01: MissingCompileTimeError
-Language/Classes/Superclasses/wrong_superclass_t02: DartkCrash
-Language/Classes/Superclasses/wrong_superclass_t03: MissingCompileTimeError
-Language/Classes/Superclasses/wrong_superclass_t05: DartkCrash
-Language/Classes/Superclasses/wrong_superclass_t07: Crash
-Language/Classes/Superclasses/wrong_superclass_t08: MissingCompileTimeError
-Language/Classes/Superinterfaces/dynamic_type_t01: MissingCompileTimeError
-Language/Classes/Superinterfaces/dynamic_type_t02: MissingCompileTimeError
-Language/Classes/Superinterfaces/itself_t01: MissingCompileTimeError
-Language/Classes/Superinterfaces/type_variable_as_superinterface_t01: DartkCrash
-Language/Classes/Superinterfaces/wrong_type_t01: MissingCompileTimeError
-Language/Classes/Superinterfaces/wrong_type_t02: DartkCrash
-Language/Classes/Superinterfaces/wrong_type_t03: MissingCompileTimeError
-Language/Classes/Superinterfaces/wrong_type_t04: MissingCompileTimeError
-Language/Classes/Superinterfaces/wrong_type_t05: MissingCompileTimeError
-Language/Classes/declarations_t02: MissingCompileTimeError
-Language/Classes/declarations_t03: MissingCompileTimeError
-Language/Classes/declarations_t04: MissingCompileTimeError
-Language/Classes/declarations_t06: MissingCompileTimeError
-Language/Classes/declarations_t08: MissingCompileTimeError
-Language/Classes/declarations_t33: MissingCompileTimeError
-Language/Classes/definition_t23: RuntimeError
-Language/Classes/same_name_member_and_class_t01: MissingCompileTimeError
-Language/Classes/same_name_member_and_class_t03: MissingCompileTimeError
-Language/Classes/same_name_type_variable_t01: MissingCompileTimeError
-Language/Classes/same_name_type_variable_t02: MissingCompileTimeError
-Language/Classes/same_name_type_variable_t03: MissingCompileTimeError
-Language/Classes/same_name_type_variable_t05: MissingCompileTimeError
-Language/Classes/same_name_type_variable_t06: MissingCompileTimeError
-Language/Classes/same_name_type_variable_t08: MissingCompileTimeError
-Language/Classes/same_name_type_variable_t09: MissingCompileTimeError
-Language/Enums/restrictions_t01: Crash
-Language/Enums/restrictions_t02: MissingCompileTimeError
-Language/Enums/restrictions_t03: MissingCompileTimeError
-Language/Enums/restrictions_t04: MissingCompileTimeError
-Language/Enums/restrictions_t05: MissingCompileTimeError
-Language/Enums/restrictions_t06: MissingCompileTimeError
-Language/Enums/restrictions_t07: MissingCompileTimeError
-Language/Enums/restrictions_t08: MissingCompileTimeError
-Language/Expressions/Assignable_Expressions/syntax_t04: DartkCrash
-Language/Expressions/Assignable_Expressions/syntax_t05: DartkCrash
-Language/Expressions/Assignable_Expressions/syntax_t23: DartkCrash
-Language/Expressions/Assignment/expression_assignment_failed_t03: RuntimeError
-Language/Expressions/Assignment/expression_assignment_t07: RuntimeError
-Language/Expressions/Assignment/no_such_method_t01: RuntimeError
-Language/Expressions/Assignment/no_such_method_t02: RuntimeError
-Language/Expressions/Assignment/no_such_method_t03: RuntimeError
-Language/Expressions/Assignment/no_such_method_t04: RuntimeError
-Language/Expressions/Assignment/no_such_method_t05: RuntimeError
-Language/Expressions/Assignment/no_such_method_t06: RuntimeError
-Language/Expressions/Assignment/no_such_method_t07: RuntimeError
-Language/Expressions/Assignment/no_such_method_t08: RuntimeError
-Language/Expressions/Assignment/no_such_method_t09: RuntimeError
-Language/Expressions/Assignment/static_type_t05: RuntimeError
-Language/Expressions/Assignment/static_type_t06: RuntimeError
-Language/Expressions/Assignment/static_warning_t03/none: RuntimeError
-Language/Expressions/Assignment/super_assignment_failed_t01: RuntimeError
-Language/Expressions/Assignment/super_assignment_failed_t02: RuntimeError
-Language/Expressions/Assignment/super_assignment_value_t02: RuntimeError
-Language/Expressions/Await_Expressions/evaluation_throws_t06: RuntimeError
-Language/Expressions/Await_Expressions/evaluation_throws_t07: RuntimeError
-Language/Expressions/Await_Expressions/syntax_t06: Crash
-Language/Expressions/Conditional/syntax_t04: MissingCompileTimeError
-Language/Expressions/Constants/bitwise_operators_t02: Crash
-Language/Expressions/Constants/bitwise_operators_t03: Crash
-Language/Expressions/Constants/bitwise_operators_t04: Crash
-Language/Expressions/Constants/bitwise_operators_t05: Crash
-Language/Expressions/Constants/bitwise_operators_t06: Crash
-Language/Expressions/Constants/constant_constructor_t03: MissingCompileTimeError
-Language/Expressions/Constants/constant_list_t02: MissingCompileTimeError
-Language/Expressions/Constants/constant_map_t02: MissingCompileTimeError
-Language/Expressions/Constants/depending_on_itself_t03: Crash
-Language/Expressions/Constants/equals_expression_t02: MissingCompileTimeError
-Language/Expressions/Constants/equals_expression_t03: MissingCompileTimeError
-Language/Expressions/Constants/exception_t03: Crash
-Language/Expressions/Constants/exception_t04: MissingCompileTimeError
-Language/Expressions/Constants/identical_t02: Crash
-Language/Expressions/Constants/identical_t03: MissingCompileTimeError
-Language/Expressions/Constants/identifier_denotes_a_constant_t03: Crash
-Language/Expressions/Constants/identifier_denotes_a_constant_t06: MissingCompileTimeError
-Language/Expressions/Constants/identifier_denotes_a_constant_t07: MissingCompileTimeError
-Language/Expressions/Constants/literal_string_t02: MissingCompileTimeError
-Language/Expressions/Constants/literal_string_t03: MissingCompileTimeError
-Language/Expressions/Constants/literal_string_t04: Crash
-Language/Expressions/Constants/literal_string_t05: MissingCompileTimeError
-Language/Expressions/Constants/logical_expression_t02: MissingCompileTimeError
-Language/Expressions/Constants/logical_expression_t03: MissingCompileTimeError
-Language/Expressions/Constants/logical_expression_t04: MissingCompileTimeError
-Language/Expressions/Constants/math_operators_t02: Crash
-Language/Expressions/Constants/math_operators_t03: Crash
-Language/Expressions/Constants/math_operators_t04: Crash
-Language/Expressions/Constants/math_operators_t05: Crash
-Language/Expressions/Constants/no_other_constant_expressions_t06: MissingCompileTimeError
-Language/Expressions/Constants/no_other_constant_expressions_t07: MissingCompileTimeError
-Language/Expressions/Constants/no_other_constant_expressions_t08: Crash
-Language/Expressions/Constants/no_other_constant_expressions_t09: MissingCompileTimeError
-Language/Expressions/Constants/no_other_constant_expressions_t10: MissingCompileTimeError
-Language/Expressions/Constants/no_other_constant_expressions_t11: Crash
-Language/Expressions/Constants/no_other_constant_expressions_t12: Crash
-Language/Expressions/Constants/no_other_constant_expressions_t13: Crash
-Language/Expressions/Constants/no_other_constant_expressions_t14: Crash
-Language/Expressions/Constants/no_other_constant_expressions_t15: Crash
-Language/Expressions/Constants/no_other_constant_expressions_t17: Crash
-Language/Expressions/Constants/no_other_constant_expressions_t18: Crash
-Language/Expressions/Constants/no_other_constant_expressions_t20: Crash
-Language/Expressions/Constants/no_other_constant_expressions_t21: Crash
-Language/Expressions/Constants/no_other_constant_expressions_t31: Crash
-Language/Expressions/Constants/static_constant_t02: MissingCompileTimeError
-Language/Expressions/Constants/static_constant_t03: Crash
-Language/Expressions/Constants/static_constant_t04: MissingCompileTimeError
-Language/Expressions/Constants/static_constant_t06: MissingCompileTimeError
-Language/Expressions/Constants/static_constant_t07: MissingCompileTimeError
-Language/Expressions/Constants/static_method_t02: Crash
-Language/Expressions/Constants/string_length_t02: MissingCompileTimeError
-Language/Expressions/Constants/string_length_t03: MissingCompileTimeError
-Language/Expressions/Constants/ternary_operator_t02: MissingCompileTimeError
-Language/Expressions/Constants/top_level_function_t01: Crash
-Language/Expressions/Constants/top_level_function_t02: Crash
-Language/Expressions/Constants/top_level_function_t04: MissingCompileTimeError
-Language/Expressions/Constants/top_level_function_t05: MissingCompileTimeError
-Language/Expressions/Function_Expressions/syntax_t03: MissingCompileTimeError
-Language/Expressions/Function_Invocation/Actual_Argument_List_Evaluation/syntax_t02: DartkCrash
-Language/Expressions/Function_Invocation/Actual_Argument_List_Evaluation/syntax_t03: DartkCrash
-Language/Expressions/Function_Invocation/Binding_Actuals_to_Formals/same_name_arguments_t01: MissingCompileTimeError
-Language/Expressions/Identifier_Reference/async_and_generator_t02: MissingCompileTimeError
-Language/Expressions/Identifier_Reference/async_and_generator_t03: MissingCompileTimeError
-Language/Expressions/Identifier_Reference/async_and_generator_t04: MissingCompileTimeError
-Language/Expressions/Identifier_Reference/async_and_generator_t05: MissingCompileTimeError
-Language/Expressions/Identifier_Reference/async_and_generator_t06: MissingCompileTimeError
-Language/Expressions/Identifier_Reference/async_and_generator_t07: MissingCompileTimeError
-Language/Expressions/Identifier_Reference/async_and_generator_t08: MissingCompileTimeError
-Language/Expressions/Identifier_Reference/async_and_generator_t09: MissingCompileTimeError
-Language/Expressions/Identifier_Reference/async_and_generator_t10: MissingCompileTimeError
-Language/Expressions/Identifier_Reference/built_in_identifier_t08: MissingCompileTimeError
-Language/Expressions/Identifier_Reference/built_in_identifier_t09: MissingCompileTimeError
-Language/Expressions/Identifier_Reference/built_in_identifier_t10: MissingCompileTimeError
-Language/Expressions/Identifier_Reference/built_in_not_dynamic_t01: MissingCompileTimeError
-Language/Expressions/Identifier_Reference/built_in_not_dynamic_t12: MissingCompileTimeError
-Language/Expressions/Identifier_Reference/built_in_not_dynamic_t15: MissingCompileTimeError
-Language/Expressions/Identifier_Reference/evaluation_static_t02: Crash
-Language/Expressions/Identifier_Reference/syntax_built_in_t01: CompileTimeError
-Language/Expressions/Identifier_Reference/syntax_t07: MissingCompileTimeError
-Language/Expressions/Identifier_Reference/syntax_t08: MissingCompileTimeError
-Language/Expressions/Identifier_Reference/undeclared_identifier_t04: RuntimeError
-Language/Expressions/Instance_Creation/Const/accessibility_t01: MissingCompileTimeError
-Language/Expressions/Instance_Creation/Const/accessibility_t02: MissingCompileTimeError
-Language/Expressions/Instance_Creation/Const/accessibility_t03: DartkCrash
-Language/Expressions/Instance_Creation/Const/accessibility_t04: MissingCompileTimeError
-Language/Expressions/Instance_Creation/Const/accessibility_t05: DartkCrash
-Language/Expressions/Instance_Creation/Const/accessibility_t06: MissingCompileTimeError
-Language/Expressions/Instance_Creation/Const/accessibility_t07: MissingCompileTimeError
-Language/Expressions/Instance_Creation/Const/arguments_t01: MissingCompileTimeError
-Language/Expressions/Instance_Creation/Const/arguments_t02: MissingCompileTimeError
-Language/Expressions/Instance_Creation/Const/arguments_t03: MissingCompileTimeError
-Language/Expressions/Instance_Creation/Const/constant_constructor_name_t01: MissingCompileTimeError
-Language/Expressions/Instance_Creation/Const/constant_constructor_name_t02: MissingCompileTimeError
-Language/Expressions/Instance_Creation/Const/constant_constructor_name_t03: MissingCompileTimeError
-Language/Expressions/Instance_Creation/Const/constant_constructor_name_t04: MissingCompileTimeError
-Language/Expressions/Instance_Creation/Const/constant_constructor_same_name_as_class_t01: MissingCompileTimeError
-Language/Expressions/Instance_Creation/Const/constant_constructor_same_name_as_class_t02: MissingCompileTimeError
-Language/Expressions/Instance_Creation/Const/deferred_type_t01: MissingCompileTimeError
-Language/Expressions/Instance_Creation/Const/deferred_type_t02: MissingCompileTimeError
-Language/Expressions/Instance_Creation/Const/exception_t01: Crash
-Language/Expressions/Instance_Creation/New/evaluation_t01: RuntimeError
-Language/Expressions/Instance_Creation/New/evaluation_t02: RuntimeError
-Language/Expressions/Instance_Creation/New/evaluation_t06: RuntimeError
-Language/Expressions/Instance_Creation/New/syntax_t02: DartkCrash
-Language/Expressions/Instance_Creation/New/type_t03: DartkCrash
-Language/Expressions/Instance_Creation/New/type_t05: DartkCrash
-Language/Expressions/Instance_Creation/malformed_or_malbounded_t02: MissingCompileTimeError
-Language/Expressions/Instance_Creation/malformed_or_malbounded_t04: MissingCompileTimeError
-Language/Expressions/Lists/constant_list_t01: MissingCompileTimeError
-Language/Expressions/Lists/constant_list_t02: Crash
-Language/Expressions/Maps/constant_map_key_value_t01: Crash
-Language/Expressions/Maps/constant_map_key_value_t03: MissingCompileTimeError
-Language/Expressions/Maps/constant_map_t01: Crash
-Language/Expressions/Maps/constant_map_t02: MissingCompileTimeError
-Language/Expressions/Maps/constant_map_type_t01: MissingCompileTimeError
-Language/Expressions/Maps/key_value_equals_operator_t01: MissingCompileTimeError
-Language/Expressions/Method_Invocation/Cascaded_Invocations/syntax_t02: DartkCrash
-Language/Expressions/Method_Invocation/Cascaded_Invocations/syntax_t03: DartkCrash
-Language/Expressions/Method_Invocation/Cascaded_Invocations/syntax_t04: DartkCrash
-Language/Expressions/Method_Invocation/Ordinary_Invocation/method_lookup_failed_t17: RuntimeError
-Language/Expressions/Method_Invocation/Ordinary_Invocation/syntax_t02: DartkCrash
-Language/Expressions/Method_Invocation/Ordinary_Invocation/syntax_t03: DartkCrash
-Language/Expressions/Method_Invocation/Ordinary_Invocation/syntax_t07: DartkCrash
-Language/Expressions/Method_Invocation/Ordinary_Invocation/syntax_t08: DartkCrash
-Language/Expressions/Method_Invocation/Super_Invocation/getter_lookup_failed_t01: RuntimeError
-Language/Expressions/Method_Invocation/Super_Invocation/getter_lookup_failed_t02: RuntimeError
-Language/Expressions/Method_Invocation/Super_Invocation/getter_lookup_failed_t03: RuntimeError
-Language/Expressions/Method_Invocation/Super_Invocation/getter_lookup_failed_t04: RuntimeError
-Language/Expressions/Method_Invocation/Super_Invocation/invocation_t02: MissingCompileTimeError
-Language/Expressions/Method_Invocation/Super_Invocation/invocation_t03: MissingCompileTimeError
-Language/Expressions/Method_Invocation/Super_Invocation/syntax_t02: DartkCrash
-Language/Expressions/Method_Invocation/Super_Invocation/syntax_t03: DartkCrash
-Language/Expressions/Numbers/extend_or_implement_double_t06: MissingCompileTimeError
-Language/Expressions/Numbers/syntax_t21: MissingCompileTimeError
-Language/Expressions/Numbers/syntax_t25: MissingCompileTimeError
-Language/Expressions/Numbers/syntax_t26: MissingCompileTimeError
-Language/Expressions/Numbers/syntax_t27: MissingCompileTimeError
-Language/Expressions/Numbers/syntax_t29: MissingCompileTimeError
-Language/Expressions/Postfix_Expressions/syntax_t06: MissingCompileTimeError
-Language/Expressions/Postfix_Expressions/syntax_t07: DartkCrash
-Language/Expressions/Postfix_Expressions/syntax_t08: DartkCrash
-Language/Expressions/Property_Extraction/Super_Getter_Access_and_Method_Closurization/no_such_method_t01: RuntimeError
-Language/Expressions/Property_Extraction/Super_Getter_Access_and_Method_Closurization/no_such_method_t02: RuntimeError
-Language/Expressions/This/placement_t04: MissingCompileTimeError
-Language/Expressions/Throw/no_catch_clause_t01: Crash
-Language/Expressions/Throw/no_catch_clause_t02: Crash
-Language/Expressions/Throw/no_catch_clause_t03: Crash
-Language/Expressions/Throw/no_catch_clause_t04: Crash
-Language/Expressions/Throw/no_catch_clause_t05: Crash
-Language/Expressions/Throw/no_catch_clause_t06: Crash
-Language/Expressions/Throw/syntax_t02: MissingCompileTimeError
-Language/Expressions/Type_Cast/evaluation_t04: RuntimeError
-Language/Expressions/Type_Cast/evaluation_t05: RuntimeError
-Language/Expressions/Type_Cast/syntax_t02: MissingCompileTimeError
-Language/Expressions/Type_Test/evaluation_t03: RuntimeError
-Language/Expressions/Type_Test/evaluation_t04: RuntimeError
-Language/Expressions/Unary_Expressions/syntax_t06: DartkCrash
-Language/Expressions/Unary_Expressions/syntax_t07: DartkCrash
-Language/Expressions/Unary_Expressions/syntax_t08: MissingCompileTimeError
-Language/Expressions/Unary_Expressions/syntax_t09: MissingCompileTimeError
-Language/Functions/Formal_Parameters/Optional_Formals/default_value_t01: MissingCompileTimeError
-Language/Functions/Formal_Parameters/Optional_Formals/default_value_t02: MissingCompileTimeError
-Language/Functions/Formal_Parameters/Optional_Formals/name_t01: MissingCompileTimeError
-Language/Functions/Formal_Parameters/Optional_Formals/name_t02: MissingCompileTimeError
-Language/Functions/Formal_Parameters/Required_Formals/syntax_t03: MissingCompileTimeError
-Language/Functions/Formal_Parameters/Required_Formals/syntax_t04: MissingCompileTimeError
-Language/Functions/Formal_Parameters/Required_Formals/syntax_t06: MissingCompileTimeError
-Language/Functions/Formal_Parameters/Required_Formals/syntax_t07: MissingCompileTimeError
-Language/Functions/Formal_Parameters/Required_Formals/syntax_t08: MissingCompileTimeError
-Language/Functions/Formal_Parameters/Required_Formals/syntax_t09: MissingCompileTimeError
-Language/Functions/Formal_Parameters/Required_Formals/syntax_t10: DartkCrash
-Language/Functions/Formal_Parameters/Required_Formals/syntax_t11: DartkCrash
-Language/Functions/Formal_Parameters/declare_as_constant_t01: MissingCompileTimeError
-Language/Functions/Formal_Parameters/declare_as_constant_t02: MissingCompileTimeError
-Language/Functions/Formal_Parameters/declare_as_constant_t03: MissingCompileTimeError
-Language/Functions/Formal_Parameters/declare_as_constant_t04: MissingCompileTimeError
-Language/Functions/Formal_Parameters/declare_as_constant_t05: MissingCompileTimeError
-Language/Functions/Formal_Parameters/declare_as_constant_t06: MissingCompileTimeError
-Language/Functions/Formal_Parameters/syntax_t06: DartkCrash
-Language/Functions/Formal_Parameters/syntax_t13: DartkCrash
-Language/Functions/Function_Declarations/external_function_t01: MissingCompileTimeError
-Language/Functions/Function_Declarations/external_function_t02: MissingCompileTimeError
-Language/Functions/ctor_modifier_t03: MissingCompileTimeError
-Language/Functions/ctor_modifier_t04: MissingCompileTimeError
-Language/Functions/ctor_modifier_t09: MissingCompileTimeError
-Language/Functions/ctor_modifier_t10: MissingCompileTimeError
-Language/Functions/ctor_modifier_t15: MissingCompileTimeError
-Language/Functions/ctor_modifier_t16: MissingCompileTimeError
-Language/Functions/setter_modifier_t01: MissingCompileTimeError
-Language/Functions/setter_modifier_t02: MissingCompileTimeError
-Language/Functions/setter_modifier_t03: MissingCompileTimeError
-Language/Functions/setter_modifier_t04: MissingCompileTimeError
-Language/Functions/setter_modifier_t05: MissingCompileTimeError
-Language/Functions/setter_modifier_t06: MissingCompileTimeError
-Language/Functions/syntax_t05: MissingCompileTimeError
-Language/Functions/syntax_t31: MissingCompileTimeError
-Language/Functions/syntax_t39: MissingCompileTimeError
-Language/Functions/syntax_t40: MissingCompileTimeError
-Language/Generics/malformed_t01: RuntimeError
-Language/Generics/syntax_t17: CompileTimeError
-Language/Interfaces/Superinterfaces/definition_t03: MissingCompileTimeError
-Language/Interfaces/Superinterfaces/definition_t04: MissingCompileTimeError
-Language/Interfaces/Superinterfaces/superinterface_of_itself_t01: MissingCompileTimeError
-Language/Interfaces/Superinterfaces/superinterface_of_itself_t02: MissingCompileTimeError
-Language/Interfaces/Superinterfaces/superinterface_of_itself_t03: MissingCompileTimeError
-Language/Libraries_and_Scripts/Exports/implicit_hide_t01: DartkCrash
-Language/Libraries_and_Scripts/Exports/invalid_uri_t03: DartkCrash
-Language/Libraries_and_Scripts/Imports/implicit_hide_t01: DartkCrash
-Language/Libraries_and_Scripts/Imports/implicit_hide_t02: DartkCrash
-Language/Libraries_and_Scripts/Imports/invalid_uri_t01: MissingCompileTimeError
-Language/Libraries_and_Scripts/Imports/namespace_changes_t07: DartkCrash
-Language/Libraries_and_Scripts/Imports/namespace_changes_t08: DartkCrash
-Language/Libraries_and_Scripts/Imports/namespace_changes_t16: RuntimeError
-Language/Libraries_and_Scripts/Imports/namespace_changes_t17: RuntimeError
-Language/Libraries_and_Scripts/Imports/namespace_changes_t27: CompileTimeError
-Language/Libraries_and_Scripts/Imports/same_name_t02/01: MissingRuntimeError
-Language/Libraries_and_Scripts/Imports/same_name_t05: RuntimeError
-Language/Libraries_and_Scripts/Imports/same_name_t07: MissingCompileTimeError
-Language/Libraries_and_Scripts/Imports/same_name_t10: RuntimeError
-Language/Libraries_and_Scripts/Imports/same_name_t12/01: MissingRuntimeError
-Language/Libraries_and_Scripts/Imports/same_name_t15/01: MissingRuntimeError
-Language/Libraries_and_Scripts/Imports/same_name_t17: MissingCompileTimeError
-Language/Libraries_and_Scripts/Imports/same_name_t19: RuntimeError
-Language/Libraries_and_Scripts/Imports/static_type_t01: Skip # No support for deferred libraries.
-Language/Libraries_and_Scripts/Imports/syntax_t02: DartkCrash
-Language/Libraries_and_Scripts/Imports/syntax_t03: DartkCrash
-Language/Libraries_and_Scripts/Imports/syntax_t04: DartkCrash
-Language/Libraries_and_Scripts/Imports/syntax_t11: DartkCrash
-Language/Libraries_and_Scripts/Imports/syntax_t13: DartkCrash
-Language/Libraries_and_Scripts/Imports/syntax_t18: DartkCrash
-Language/Libraries_and_Scripts/Imports/syntax_t20: DartkCrash
-Language/Libraries_and_Scripts/Imports/syntax_t21: DartkCrash
-Language/Libraries_and_Scripts/Imports/syntax_t32: MissingCompileTimeError
-Language/Libraries_and_Scripts/Imports/syntax_t41: MissingCompileTimeError
-Language/Libraries_and_Scripts/Parts/compilation_t01: DartkCrash
-Language/Libraries_and_Scripts/Parts/compilation_t02: Timeout
-Language/Libraries_and_Scripts/Parts/compilation_t07: MissingCompileTimeError
-Language/Libraries_and_Scripts/Parts/compilation_t08: DartkCrash
-Language/Libraries_and_Scripts/Parts/compilation_t09: DartkCrash
-Language/Libraries_and_Scripts/Parts/compilation_t10: DartkCrash
-Language/Libraries_and_Scripts/Parts/compilation_t11: MissingCompileTimeError
-Language/Libraries_and_Scripts/Parts/static_warning_t01: RuntimeError
-Language/Libraries_and_Scripts/Parts/syntax_t01: MissingCompileTimeError
-Language/Libraries_and_Scripts/Parts/syntax_t05: DartkCrash
-Language/Libraries_and_Scripts/Parts/syntax_t07: DartkCrash
-Language/Libraries_and_Scripts/Parts/syntax_t08: DartkCrash
-Language/Libraries_and_Scripts/Scripts/syntax_t05: MissingCompileTimeError
-Language/Libraries_and_Scripts/Scripts/syntax_t06: MissingCompileTimeError
-Language/Libraries_and_Scripts/Scripts/syntax_t07: MissingCompileTimeError
-Language/Libraries_and_Scripts/Scripts/syntax_t08: MissingCompileTimeError
-Language/Libraries_and_Scripts/Scripts/syntax_t10: MissingCompileTimeError
-Language/Libraries_and_Scripts/Scripts/syntax_t14: MissingCompileTimeError
-Language/Libraries_and_Scripts/Scripts/top_level_main_t01: Crash
-Language/Libraries_and_Scripts/Scripts/top_level_main_t02: Crash
-Language/Libraries_and_Scripts/definition_syntax_t05: MissingCompileTimeError
-Language/Libraries_and_Scripts/private_access_t03: RuntimeError
-Language/Mixins/Mixin_Application/deferred_t01: MissingCompileTimeError
-Language/Mixins/Mixin_Application/syntax_t15: MissingCompileTimeError
-Language/Mixins/Mixin_Application/wrong_mixin_type_t01: MissingCompileTimeError
-Language/Mixins/Mixin_Application/wrong_mixin_type_t02: MissingCompileTimeError
-Language/Mixins/Mixin_Application/wrong_mixin_type_t03: MissingCompileTimeError
-Language/Mixins/Mixin_Application/wrong_mixin_type_t04: MissingCompileTimeError
-Language/Mixins/Mixin_Application/wrong_mixin_type_t05: DartkCrash
-Language/Mixins/Mixin_Application/wrong_mixin_type_t06: DartkCrash
-Language/Mixins/Mixin_Application/wrong_mixin_type_t07: MissingCompileTimeError
-Language/Mixins/Mixin_Application/wrong_mixin_type_t08: Crash
-Language/Mixins/Mixin_Application/wrong_type_t01: MissingCompileTimeError
-Language/Mixins/Mixin_Application/wrong_type_t02: DartkCrash
-Language/Mixins/Mixin_Application/wrong_type_t03: MissingCompileTimeError
-Language/Mixins/Mixin_Application/wrong_type_t04: Crash
-Language/Mixins/Mixin_Application/wrong_type_t05: MissingCompileTimeError
-Language/Mixins/Mixin_Application/wrong_type_t06: Crash
-Language/Mixins/declaring_constructor_t01: MissingCompileTimeError
-Language/Mixins/declaring_constructor_t02: MissingCompileTimeError
-Language/Mixins/declaring_constructor_t03: MissingCompileTimeError
-Language/Mixins/declaring_constructor_t04: MissingCompileTimeError
-Language/Mixins/declaring_constructor_t07: MissingCompileTimeError
-Language/Mixins/declaring_constructor_t08: MissingCompileTimeError
-Language/Mixins/declaring_constructor_t09: MissingCompileTimeError
-Language/Mixins/declaring_constructor_t10: MissingCompileTimeError
-Language/Overview/Privacy/private_and_public_t06: RuntimeError
-Language/Overview/Privacy/private_and_public_t09: RuntimeError
-Language/Overview/Privacy/private_and_public_t10: RuntimeError
-Language/Overview/Privacy/private_and_public_t19: RuntimeError
-Language/Overview/Privacy/private_and_public_t20: RuntimeError
-Language/Overview/Scoping/conflicting_names_t04: DartkCrash
-Language/Overview/Scoping/conflicting_names_t11: DartkCrash
-Language/Overview/Scoping/conflicting_names_t16: Crash
-Language/Overview/Scoping/conflicting_names_t17: Crash
-Language/Overview/Scoping/conflicting_names_t18: Crash
-Language/Overview/Scoping/conflicting_names_t25: Crash
-Language/Overview/Scoping/conflicting_names_t26: Crash
-Language/Overview/Scoping/conflicting_names_t27: Crash
-Language/Overview/Scoping/conflicting_names_t31: MissingCompileTimeError
-Language/Overview/Scoping/conflicting_names_t32: MissingCompileTimeError
-Language/Overview/Scoping/conflicting_names_t33: MissingCompileTimeError
-Language/Overview/Scoping/conflicting_names_t34: MissingCompileTimeError
-Language/Overview/Scoping/conflicting_names_t35: MissingCompileTimeError
-Language/Overview/Scoping/conflicting_names_t37: Crash
-Language/Overview/Scoping/conflicting_names_t38: Crash
-Language/Overview/Scoping/conflicting_names_t39: MissingCompileTimeError
-Language/Overview/Scoping/conflicting_names_t40: MissingCompileTimeError
-Language/Overview/Scoping/conflicting_names_t41: MissingCompileTimeError
-Language/Overview/Scoping/conflicting_names_t44: Crash
-Language/Overview/Scoping/hiding_declaration_t16: Crash
-Language/Overview/Scoping/hiding_declaration_t28: DartkCrash
-Language/Reference/Lexical_Rules/Comments/documentation_t02: Crash
-Language/Reference/Lexical_Rules/Comments/documentation_t03: Crash
-Language/Reference/Lexical_Rules/Comments/documentation_t04: Crash
-Language/Reference/Lexical_Rules/Comments/documentation_t05: Crash
-Language/Reference/Lexical_Rules/Comments/documentation_t06: Crash
-Language/Reference/Lexical_Rules/Comments/documentation_t10: Crash
-Language/Reference/Lexical_Rules/Comments/documentation_t11: Crash
-Language/Reference/Lexical_Rules/Comments/multi_line_t03: Crash
-Language/Reference/Lexical_Rules/Comments/multi_line_t04: Crash
-Language/Reference/Lexical_Rules/Comments/multi_line_t05: Crash
-Language/Reference/Lexical_Rules/Comments/multi_line_t06: Crash
-Language/Reference/Lexical_Rules/Reserved_Words/whitespace_t02: MissingCompileTimeError
-Language/Reference/Lexical_Rules/Reserved_Words/whitespace_t03: MissingCompileTimeError
-Language/Reference/Lexical_Rules/Reserved_Words/whitespace_t04: MissingCompileTimeError
-Language/Reference/Lexical_Rules/whitespace_t01: MissingCompileTimeError
-Language/Reference/Lexical_Rules/whitespace_t02: MissingCompileTimeError
-Language/Reference/Lexical_Rules/whitespace_t03: MissingCompileTimeError
-Language/Reference/Lexical_Rules/whitespace_t04: MissingCompileTimeError
-Language/Reference/Lexical_Rules/whitespace_t05: MissingCompileTimeError
-Language/Reference/Lexical_Rules/whitespace_t06: MissingCompileTimeError
-Language/Reference/Lexical_Rules/whitespace_t07: MissingCompileTimeError
-Language/Reference/Lexical_Rules/whitespace_t08: MissingCompileTimeError
-Language/Reference/Lexical_Rules/whitespace_t09: MissingCompileTimeError
-Language/Statements/Break/label_t11: DartkCrash
-Language/Statements/Break/label_t12: DartkCrash
-Language/Statements/Continue/async_loops_t10: DartkCrash
-Language/Statements/Continue/label_t03: DartkCrash
-Language/Statements/Continue/label_t06: MissingCompileTimeError
-Language/Statements/Continue/label_t08: MissingCompileTimeError
-Language/Statements/Continue/label_t09: MissingCompileTimeError
-Language/Statements/Continue/label_t10: MissingCompileTimeError
-Language/Statements/Continue/label_t11: MissingCompileTimeError
-Language/Statements/Continue/label_t14: DartkCrash
-Language/Statements/Continue/label_t17: DartkCrash
-Language/Statements/Do/execution_t04: Crash
-Language/Statements/For/Asynchronous_For_in/execution_t04: RuntimeError
-Language/Statements/For/Asynchronous_For_in/syntax_t02: MissingCompileTimeError
-Language/Statements/For/syntax_t07: RuntimeError
-Language/Statements/For/syntax_t09: MissingCompileTimeError
-Language/Statements/For/syntax_t12: MissingCompileTimeError
-Language/Statements/For/syntax_t13: MissingCompileTimeError
-Language/Statements/For/syntax_t16: MissingCompileTimeError
-Language/Statements/For/syntax_t19: MissingCompileTimeError
-Language/Statements/For/syntax_t20: MissingCompileTimeError
-Language/Statements/If/execution_t03: Crash
-Language/Statements/Labels/namespace_t01: DartkCrash
-Language/Statements/Labels/scope_t05: MissingCompileTimeError
-Language/Statements/Local_Function_Declaration/reference_before_declaration_t01: MissingCompileTimeError
-Language/Statements/Local_Function_Declaration/reference_before_declaration_t03: MissingCompileTimeError
-Language/Statements/Local_Function_Declaration/syntax_t05: MissingCompileTimeError
-Language/Statements/Local_Function_Declaration/syntax_t06: MissingCompileTimeError
-Language/Statements/Local_Variable_Declaration/syntax_t11: MissingCompileTimeError
-Language/Statements/Local_Variable_Declaration/syntax_t20: MissingCompileTimeError
-Language/Statements/Rethrow/on_catch_clause_t01: Crash
-Language/Statements/Rethrow/on_catch_clause_t02: Crash
-Language/Statements/Return/generator_function_t01: MissingCompileTimeError
-Language/Statements/Return/generator_function_t02: MissingCompileTimeError
-Language/Statements/Return/generator_function_t03: MissingCompileTimeError
-Language/Statements/Return/generator_function_t04: MissingCompileTimeError
-Language/Statements/Return/generator_function_t05: MissingCompileTimeError
-Language/Statements/Return/generator_function_t06: MissingCompileTimeError
-Language/Statements/Return/generator_function_t07: MissingCompileTimeError
-Language/Statements/Return/generator_function_t08: MissingCompileTimeError
-Language/Statements/Switch/equal_operator_t01: MissingCompileTimeError
-Language/Statements/Switch/equal_operator_t02: MissingCompileTimeError
-Language/Statements/Switch/expressions_t01: MissingCompileTimeError
-Language/Statements/Switch/expressions_t02: MissingCompileTimeError
-Language/Statements/Switch/expressions_t03: MissingCompileTimeError
-Language/Statements/Switch/expressions_t04: MissingCompileTimeError
-Language/Statements/Switch/labels_constants_t01: MissingCompileTimeError
-Language/Statements/Switch/syntax_t16: MissingCompileTimeError
-Language/Statements/Switch/syntax_t17: MissingCompileTimeError
-Language/Statements/Try/malformed_type_t04: RuntimeError
-Language/Statements/Try/syntax_t06: MissingCompileTimeError
-Language/Statements/Try/syntax_t13: MissingCompileTimeError
-Language/Statements/Try/syntax_t15: Crash
-Language/Statements/While/execution_t03: Crash
-Language/Statements/Yield_and_Yield_Each/Yield/location_t02: MissingCompileTimeError
-Language/Statements/Yield_and_Yield_Each/Yield/location_t04: MissingCompileTimeError
-Language/Statements/Yield_and_Yield_Each/Yield/location_t06: MissingCompileTimeError
-Language/Statements/Yield_and_Yield_Each/Yield_Each/location_t02: MissingCompileTimeError
-Language/Statements/Yield_and_Yield_Each/Yield_Each/location_t04: MissingCompileTimeError
-Language/Statements/Yield_and_Yield_Each/Yield_Each/location_t06: MissingCompileTimeError
-Language/Statements/Yield_and_Yield_Each/Yield_Each/static_type_t02: Crash
-Language/Types/Static_Types/malformed_type_t01: RuntimeError
-Language/Types/Type_Declarations/Typedef/param_default_value_t02: MissingCompileTimeError
-Language/Types/Type_Declarations/Typedef/param_default_value_t03: MissingCompileTimeError
-Language/Types/Type_Declarations/Typedef/self_reference_t01: MissingCompileTimeError
-Language/Types/Type_Declarations/Typedef/self_reference_t02: MissingCompileTimeError
-Language/Types/Type_Declarations/Typedef/self_reference_t03: MissingCompileTimeError
-Language/Types/Type_Declarations/Typedef/self_reference_t04: MissingCompileTimeError
-Language/Types/Type_Declarations/Typedef/self_reference_t08: MissingCompileTimeError
-Language/Types/Type_Declarations/Typedef/self_reference_t09: MissingCompileTimeError
-Language/Types/Type_Declarations/Typedef/self_reference_t10: MissingCompileTimeError
-Language/Types/Type_Declarations/Typedef/self_reference_t11: MissingCompileTimeError
-Language/Types/Type_Declarations/Typedef/self_reference_t12: MissingCompileTimeError
-Language/Types/Type_Declarations/Typedef/self_reference_t13: MissingCompileTimeError
-Language/Types/Type_Declarations/Typedef/self_reference_t14: MissingCompileTimeError
-Language/Types/Type_Declarations/Typedef/self_reference_t15: MissingCompileTimeError
-Language/Types/Type_Declarations/Typedef/self_reference_t16: MissingCompileTimeError
-Language/Types/Type_Declarations/Typedef/self_reference_t17: MissingCompileTimeError
-Language/Types/Type_Void/syntax_t02: MissingCompileTimeError
-Language/Variables/constant_initialization_t01: MissingCompileTimeError
-Language/Variables/constant_initialization_t02: MissingCompileTimeError
-Language/Variables/constant_variable_t03: RuntimeError
-Language/Variables/constant_variable_t04: RuntimeError
-Language/Variables/constant_variable_t05: MissingCompileTimeError
-Language/Variables/constant_variable_t06: MissingCompileTimeError
-Language/Variables/constant_variable_t07: MissingCompileTimeError
-Language/Variables/constant_variable_t08: MissingCompileTimeError
-Language/Variables/constant_variable_t10: RuntimeError
-Language/Variables/local_variable_t01: MissingCompileTimeError
-Language/Variables/local_variable_t04: MissingCompileTimeError
-Language/Variables/local_variable_t05: MissingCompileTimeError
-Language/Variables/syntax_t04: MissingCompileTimeError
-Language/Variables/syntax_t05: MissingCompileTimeError
-Language/Variables/syntax_t08: MissingCompileTimeError
-Language/Variables/syntax_t12: MissingCompileTimeError
-Language/Variables/syntax_t13: MissingCompileTimeError
-Language/Variables/syntax_t14: MissingCompileTimeError
-LibTest/async/DeferredLibrary/DeferredLibrary_A01_t01: Skip # No support for deferred libraries.
-LibTest/async/Future/catchError_A03_t05: Crash
-LibTest/async/Future/then_A05_t01: Crash
-LibTest/async/Stream/Stream.fromFutures_A01_t01: DartkCrash
-LibTest/async/Stream/Stream.fromFutures_A01_t02: DartkCrash
-LibTest/async/Stream/Stream.fromFutures_A02_t01: DartkCrash
-LibTest/async/Stream/Stream.fromFutures_A02_t02: DartkCrash
-LibTest/async/Stream/asBroadcastStream_A03_t02: Crash
-LibTest/async/Stream/asBroadcastStream_A03_t03: Crash
-LibTest/async/Zone/bindBinaryCallback_A01_t01: Crash
-LibTest/async/Zone/bindCallback_A01_t01: Crash
-LibTest/async/Zone/bindUnaryCallback_A01_t01: Crash
-LibTest/async/Zone/current_A01_t01: Crash
-LibTest/async/Zone/handleUncaughtError_A01_t01: Crash
-LibTest/async/Zone/handleUncaughtError_A01_t04: Crash
-LibTest/async/Zone/inSameErrorZone_A01_t01: Crash
-LibTest/async/Zone/inSameErrorZone_A01_t03: Crash
-LibTest/async/Zone/inSameErrorZone_A01_t04: Crash
-LibTest/async/Zone/inSameErrorZone_A01_t05: Crash
-LibTest/async/Zone/parent_A01_t01: Crash
-LibTest/core/Invocation/isAccessor_A01_t01: RuntimeError
-LibTest/core/Invocation/isAccessor_A01_t02: RuntimeError
-LibTest/core/Invocation/isGetter_A01_t01: RuntimeError
-LibTest/core/Invocation/isGetter_A01_t02: RuntimeError
-LibTest/core/Invocation/isMethod_A01_t01: RuntimeError
-LibTest/core/Invocation/isMethod_A01_t02: RuntimeError
-LibTest/core/Invocation/isSetter_A01_t01: RuntimeError
-LibTest/core/Invocation/isSetter_A01_t02: RuntimeError
-LibTest/core/Invocation/memberName_A01_t01: RuntimeError
-LibTest/core/Invocation/namedArguments_A01_t01: RuntimeError
-LibTest/core/Invocation/positionalArguments_A01_t01: RuntimeError
-LibTest/isolate/Isolate/spawnUri_A01_t06: Skip
-
-Language/Metadata/before_export_t01: RuntimeError # Issue 28434: Kernel IR misses these annotations.
-Language/Metadata/before_import_t01: RuntimeError # Issue 28434: Kernel IR misses these annotations.
-Language/Metadata/before_library_t01: RuntimeError # Issue 28434: Kernel IR misses these annotations.
-Language/Metadata/before_param_t01: RuntimeError # Issue 28434: Kernel IR misses these annotations.
-Language/Metadata/before_param_t02: RuntimeError # Issue 28434: Kernel IR misses these annotations.
-Language/Metadata/before_param_t03: RuntimeError # Issue 28434: Kernel IR misses these annotations.
-Language/Metadata/before_param_t04: RuntimeError # Issue 28434: Kernel IR misses these annotations.
-Language/Metadata/before_param_t05: RuntimeError # Issue 28434: Kernel IR misses these annotations.
-Language/Metadata/before_param_t06: RuntimeError # Issue 28434: Kernel IR misses these annotations.
-Language/Metadata/before_param_t07: RuntimeError # Issue 28434: Kernel IR misses these annotations.
-Language/Metadata/before_param_t08: RuntimeError # Issue 28434: Kernel IR misses these annotations.
-Language/Metadata/before_param_t09: RuntimeError # Issue 28434: Kernel IR misses these annotations.
-Language/Metadata/before_typedef_t01: RuntimeError # Issue 28434: Kernel IR misses these annotations.
-Language/Metadata/before_variable_t01: RuntimeError # Issue 28434: Kernel IR misses these annotations.
-Language/Metadata/before_variable_t02: RuntimeError # Issue 28434: Kernel IR misses these annotations.
-LibTest/isolate/Isolate/spawn_A02_t02: RuntimeError
-LibTest/isolate/Isolate/spawn_A02_t03: RuntimeError
-LibTest/isolate/Isolate/spawn_A02_t04: RuntimeError
-LibTest/isolate/Isolate/spawn_A02_t05: RuntimeError
-LibTest/isolate/Isolate/spawn_A02_t06: RuntimeError
-LibTest/isolate/Isolate/spawn_A02_t07: RuntimeError
-
-
-# Override tests marked as failing elsewhere.
-[ $compiler == dartk || $compiler == dartkp ]
-Language/Classes/Constructors/Constant_Constructors/initializer_not_a_constant_t03: MissingCompileTimeError
-Language/Classes/Constructors/Constant_Constructors/invalid_constant_initializer_t01: Crash
-Language/Classes/Constructors/Constant_Constructors/invalid_constant_initializer_t03: Crash
-Language/Classes/Constructors/Constant_Constructors/non_final_instance_variable_t01: MissingCompileTimeError
-Language/Classes/Constructors/Constant_Constructors/non_final_instance_variable_t02: MissingCompileTimeError
-Language/Classes/Constructors/Constant_Constructors/potentially_constant_expression_t02: MissingCompileTimeError
-Language/Classes/Constructors/Constant_Constructors/superinitializer_t01: MissingCompileTimeError
-Language/Classes/Constructors/Constant_Constructors/superinitializer_t02: MissingCompileTimeError
-Language/Classes/Constructors/Constant_Constructors/syntax_t03: MissingCompileTimeError
-Language/Classes/Constructors/Factories/const_modifier_t01: MissingCompileTimeError
-Language/Classes/Constructors/Factories/const_modifier_t02: MissingCompileTimeError
-Language/Classes/Constructors/Factories/default_value_t01: MissingCompileTimeError
-Language/Classes/Constructors/Factories/default_value_t02: MissingCompileTimeError
-Language/Classes/Constructors/Factories/name_t02: DartkCrash
-Language/Classes/Constructors/Generative_Constructors/execution_t04: MissingCompileTimeError
-Language/Classes/Constructors/Generative_Constructors/execution_t05: MissingCompileTimeError
-Language/Classes/Constructors/Generative_Constructors/execution_t06: MissingCompileTimeError
-Language/Classes/Constructors/Generative_Constructors/execution_t07: MissingCompileTimeError
-Language/Classes/Constructors/Generative_Constructors/execution_t09: MissingCompileTimeError
-Language/Classes/Constructors/Generative_Constructors/execution_t12: MissingCompileTimeError
-Language/Classes/Constructors/Generative_Constructors/formal_parameter_t02: MissingCompileTimeError
-Language/Classes/Constructors/Generative_Constructors/formal_parameter_t08: MissingCompileTimeError
-Language/Classes/Constructors/Generative_Constructors/initializers_t12: MissingCompileTimeError
-Language/Classes/Constructors/Generative_Constructors/initializing_other_function_t01: DartkCrash
-Language/Classes/Constructors/Generative_Constructors/initializing_other_function_t02: DartkCrash
-Language/Classes/Constructors/Generative_Constructors/initializing_other_function_t03: DartkCrash
-Language/Classes/Constructors/Generative_Constructors/initializing_other_function_t04: DartkCrash
-Language/Classes/Constructors/Generative_Constructors/initializing_other_function_t05: DartkCrash
-Language/Classes/Constructors/Generative_Constructors/initializing_other_function_t06: DartkCrash
-Language/Classes/Constructors/Generative_Constructors/redirection_t02: MissingCompileTimeError
-Language/Classes/Constructors/Generative_Constructors/redirection_t03: MissingCompileTimeError
-Language/Classes/Constructors/Generative_Constructors/redirection_t07: MissingCompileTimeError
-Language/Classes/Constructors/Generative_Constructors/redirection_t08: MissingCompileTimeError
-Language/Classes/Constructors/Generative_Constructors/redirection_t09: MissingCompileTimeError
-Language/Classes/Constructors/Generative_Constructors/superclass_constructor_t01: Crash
-Language/Classes/Constructors/Generative_Constructors/superclass_constructor_t02: Crash
-Language/Classes/Constructors/Generative_Constructors/superclass_constructor_t03: MissingCompileTimeError
-Language/Classes/Constructors/Generative_Constructors/superclass_constructor_t04: Crash
-Language/Classes/Constructors/Generative_Constructors/superclass_constructor_t05: Crash
-Language/Classes/Constructors/Generative_Constructors/superclass_constructor_t06: MissingCompileTimeError
-Language/Classes/Constructors/Generative_Constructors/syntax_t02: MissingCompileTimeError
-Language/Classes/Constructors/Generative_Constructors/syntax_t04: MissingCompileTimeError
-Language/Classes/Constructors/Generative_Constructors/syntax_t05: MissingCompileTimeError
-Language/Classes/Getters/syntax_t02: MissingCompileTimeError
-Language/Classes/Getters/syntax_t03: MissingCompileTimeError
-Language/Classes/Getters/syntax_t04: MissingCompileTimeError
-Language/Classes/Getters/syntax_t05: MissingCompileTimeError
-Language/Classes/Getters/syntax_t07: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/arity_0_or_1_t02: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/arity_0_t02: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/arity_1_t01: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/arity_1_t02: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/arity_1_t03: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/arity_1_t04: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/arity_1_t05: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/arity_1_t06: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/arity_1_t07: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/arity_1_t08: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/arity_1_t09: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/arity_1_t10: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/arity_1_t11: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/arity_1_t12: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/arity_1_t13: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/arity_1_t14: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/arity_1_t15: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/arity_1_t16: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/arity_1_t17: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/arity_1_t18: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/arity_2_t01: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/arity_2_t02: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/optional_parameter_t01: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/optional_parameter_t02: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/optional_parameter_t03: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/optional_parameter_t04: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/optional_parameter_t06: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/optional_parameter_t08: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/syntax_t04: MissingCompileTimeError
-Language/Classes/Instance_Methods/same_name_setter_t01: CompileTimeError
-Language/Classes/Instance_Variables/constant_t01: MissingCompileTimeError
-Language/Classes/Setters/name_t01: CompileTimeError
-Language/Classes/Setters/name_t02: CompileTimeError
-Language/Classes/Setters/name_t07: CompileTimeError
-Language/Classes/Setters/parameter_t01: MissingCompileTimeError
-Language/Classes/Setters/parameter_t02: MissingCompileTimeError
-Language/Classes/Setters/parameter_t03: MissingCompileTimeError
-Language/Classes/Setters/parameter_t04: MissingCompileTimeError
-Language/Classes/Setters/parameter_t05: MissingCompileTimeError
-Language/Classes/Setters/parameter_t06: MissingCompileTimeError
-Language/Classes/Setters/parameter_t07: MissingCompileTimeError
-Language/Classes/Setters/parameter_t08: MissingCompileTimeError
-Language/Classes/Setters/static_setter_t05: RuntimeError
-Language/Classes/Setters/static_setter_t06: DartkCrash
-Language/Classes/Setters/syntax_t01: RuntimeError
-Language/Classes/Setters/syntax_t03: MissingCompileTimeError
-Language/Classes/Setters/syntax_t04: RuntimeError
-Language/Classes/Static_Methods/declaration_t01: MissingCompileTimeError
-Language/Classes/Static_Methods/same_name_method_and_setter_t01: CompileTimeError
-Language/Classes/Superclasses/Inheritance_and_Overriding/inheritance_t03: RuntimeError
-Language/Classes/Superclasses/superclass_of_itself_t01: MissingCompileTimeError
-Language/Classes/Superclasses/superclass_of_itself_t02: MissingCompileTimeError
-Language/Classes/Superclasses/wrong_superclass_t01: MissingCompileTimeError
-Language/Classes/Superclasses/wrong_superclass_t02: DartkCrash
-Language/Classes/Superclasses/wrong_superclass_t03: MissingCompileTimeError
-Language/Classes/Superclasses/wrong_superclass_t05: DartkCrash
-Language/Classes/Superclasses/wrong_superclass_t07: Crash
-Language/Classes/Superclasses/wrong_superclass_t08: MissingCompileTimeError
-Language/Classes/Superinterfaces/dynamic_type_t01: MissingCompileTimeError
-Language/Classes/Superinterfaces/dynamic_type_t02: MissingCompileTimeError
-Language/Classes/Superinterfaces/itself_t01: MissingCompileTimeError
-Language/Classes/Superinterfaces/type_variable_as_superinterface_t01: DartkCrash
-Language/Classes/Superinterfaces/wrong_type_t01: MissingCompileTimeError
-Language/Classes/Superinterfaces/wrong_type_t02: DartkCrash
-Language/Classes/Superinterfaces/wrong_type_t03: MissingCompileTimeError
-Language/Classes/Superinterfaces/wrong_type_t04: MissingCompileTimeError
-Language/Classes/Superinterfaces/wrong_type_t05: MissingCompileTimeError
-Language/Classes/declarations_t02: MissingCompileTimeError
-Language/Classes/declarations_t03: MissingCompileTimeError
-Language/Classes/declarations_t04: MissingCompileTimeError
-Language/Classes/declarations_t06: MissingCompileTimeError
-Language/Classes/declarations_t08: MissingCompileTimeError
-Language/Classes/declarations_t33: MissingCompileTimeError
-Language/Classes/definition_t23: RuntimeError
-Language/Classes/same_name_member_and_class_t01: MissingCompileTimeError
-Language/Classes/same_name_member_and_class_t03: MissingCompileTimeError
-Language/Classes/same_name_type_variable_t01: MissingCompileTimeError
-Language/Classes/same_name_type_variable_t02: MissingCompileTimeError
-Language/Classes/same_name_type_variable_t03: MissingCompileTimeError
-Language/Classes/same_name_type_variable_t05: MissingCompileTimeError
-Language/Classes/same_name_type_variable_t06: MissingCompileTimeError
-Language/Classes/same_name_type_variable_t08: MissingCompileTimeError
-Language/Classes/same_name_type_variable_t09: MissingCompileTimeError
-Language/Enums/restrictions_t01: Crash
-Language/Enums/restrictions_t02: MissingCompileTimeError
-Language/Enums/restrictions_t03: MissingCompileTimeError
-Language/Enums/restrictions_t04: MissingCompileTimeError
-Language/Enums/restrictions_t05: MissingCompileTimeError
-Language/Enums/restrictions_t06: MissingCompileTimeError
-Language/Enums/restrictions_t07: MissingCompileTimeError
-Language/Enums/restrictions_t08: MissingCompileTimeError
-Language/Expressions/Assignable_Expressions/syntax_t04: DartkCrash
-Language/Expressions/Assignable_Expressions/syntax_t05: DartkCrash
-Language/Expressions/Assignable_Expressions/syntax_t23: DartkCrash
-Language/Expressions/Assignment/expression_assignment_failed_t03: RuntimeError
-Language/Expressions/Assignment/expression_assignment_t07: RuntimeError
-Language/Expressions/Assignment/no_such_method_t01: RuntimeError
-Language/Expressions/Assignment/no_such_method_t02: RuntimeError
-Language/Expressions/Assignment/no_such_method_t03: RuntimeError
-Language/Expressions/Assignment/no_such_method_t04: RuntimeError
-Language/Expressions/Assignment/no_such_method_t05: RuntimeError
-Language/Expressions/Assignment/no_such_method_t06: RuntimeError
-Language/Expressions/Assignment/no_such_method_t07: RuntimeError
-Language/Expressions/Assignment/no_such_method_t08: RuntimeError
-Language/Expressions/Assignment/no_such_method_t09: RuntimeError
-Language/Expressions/Assignment/static_type_t05: RuntimeError
-Language/Expressions/Assignment/static_type_t06: RuntimeError
-Language/Expressions/Assignment/static_warning_t03/none: RuntimeError
-Language/Expressions/Assignment/super_assignment_failed_t01: RuntimeError
-Language/Expressions/Assignment/super_assignment_failed_t02: RuntimeError
-Language/Expressions/Assignment/super_assignment_value_t02: RuntimeError
-Language/Expressions/Await_Expressions/evaluation_throws_t06: RuntimeError
-Language/Expressions/Await_Expressions/evaluation_throws_t07: RuntimeError
-Language/Expressions/Await_Expressions/syntax_t06: Crash
-Language/Expressions/Conditional/syntax_t04: MissingCompileTimeError
-Language/Expressions/Constants/bitwise_operators_t02: Crash
-Language/Expressions/Constants/bitwise_operators_t03: Crash
-Language/Expressions/Constants/bitwise_operators_t04: Crash
-Language/Expressions/Constants/bitwise_operators_t05: Crash
-Language/Expressions/Constants/bitwise_operators_t06: Crash
-Language/Expressions/Constants/constant_constructor_t03: MissingCompileTimeError
-Language/Expressions/Constants/constant_list_t02: MissingCompileTimeError
-Language/Expressions/Constants/constant_map_t02: MissingCompileTimeError
-Language/Expressions/Constants/depending_on_itself_t03: Crash
-Language/Expressions/Constants/equals_expression_t02: MissingCompileTimeError
-Language/Expressions/Constants/equals_expression_t03: MissingCompileTimeError
-Language/Expressions/Constants/exception_t03: Crash
-Language/Expressions/Constants/exception_t04: MissingCompileTimeError
-Language/Expressions/Constants/identical_t02: Crash
-Language/Expressions/Constants/identical_t03: MissingCompileTimeError
-Language/Expressions/Constants/identifier_denotes_a_constant_t03: Crash
-Language/Expressions/Constants/identifier_denotes_a_constant_t06: MissingCompileTimeError
-Language/Expressions/Constants/identifier_denotes_a_constant_t07: MissingCompileTimeError
-Language/Expressions/Constants/literal_string_t02: MissingCompileTimeError
-Language/Expressions/Constants/literal_string_t03: MissingCompileTimeError
-Language/Expressions/Constants/literal_string_t04: Crash
-Language/Expressions/Constants/literal_string_t05: MissingCompileTimeError
-Language/Expressions/Constants/logical_expression_t02: MissingCompileTimeError
-Language/Expressions/Constants/logical_expression_t03: MissingCompileTimeError
-Language/Expressions/Constants/logical_expression_t04: MissingCompileTimeError
-Language/Expressions/Constants/math_operators_t02: Crash
-Language/Expressions/Constants/math_operators_t03: Crash
-Language/Expressions/Constants/math_operators_t04: Crash
-Language/Expressions/Constants/math_operators_t05: Crash
-Language/Expressions/Constants/no_other_constant_expressions_t06: MissingCompileTimeError
-Language/Expressions/Constants/no_other_constant_expressions_t07: MissingCompileTimeError
-Language/Expressions/Constants/no_other_constant_expressions_t08: Crash
-Language/Expressions/Constants/no_other_constant_expressions_t09: MissingCompileTimeError
-Language/Expressions/Constants/no_other_constant_expressions_t10: MissingCompileTimeError
-Language/Expressions/Constants/no_other_constant_expressions_t11: Crash
-Language/Expressions/Constants/no_other_constant_expressions_t12: Crash
-Language/Expressions/Constants/no_other_constant_expressions_t13: Crash
-Language/Expressions/Constants/no_other_constant_expressions_t14: Crash
-Language/Expressions/Constants/no_other_constant_expressions_t15: Crash
-Language/Expressions/Constants/no_other_constant_expressions_t17: Crash
-Language/Expressions/Constants/no_other_constant_expressions_t18: Crash
-Language/Expressions/Constants/no_other_constant_expressions_t20: Crash
-Language/Expressions/Constants/no_other_constant_expressions_t21: Crash
-Language/Expressions/Constants/no_other_constant_expressions_t31: Crash
-Language/Expressions/Constants/static_constant_t02: MissingCompileTimeError
-Language/Expressions/Constants/static_constant_t03: Crash
-Language/Expressions/Constants/static_constant_t04: MissingCompileTimeError
-Language/Expressions/Constants/static_constant_t06: MissingCompileTimeError
-Language/Expressions/Constants/static_constant_t07: MissingCompileTimeError
-Language/Expressions/Constants/static_method_t02: Crash
-Language/Expressions/Constants/string_length_t02: MissingCompileTimeError
-Language/Expressions/Constants/string_length_t03: MissingCompileTimeError
-Language/Expressions/Constants/ternary_operator_t02: MissingCompileTimeError
-Language/Expressions/Constants/top_level_function_t01: Crash
-Language/Expressions/Constants/top_level_function_t02: Crash
-Language/Expressions/Constants/top_level_function_t04: MissingCompileTimeError
-Language/Expressions/Constants/top_level_function_t05: MissingCompileTimeError
-Language/Expressions/Function_Expressions/syntax_t03: MissingCompileTimeError
-Language/Expressions/Function_Invocation/Actual_Argument_List_Evaluation/syntax_t02: DartkCrash
-Language/Expressions/Function_Invocation/Actual_Argument_List_Evaluation/syntax_t03: DartkCrash
-Language/Expressions/Function_Invocation/Binding_Actuals_to_Formals/same_name_arguments_t01: MissingCompileTimeError
-Language/Expressions/Identifier_Reference/async_and_generator_t02: MissingCompileTimeError
-Language/Expressions/Identifier_Reference/async_and_generator_t03: MissingCompileTimeError
-Language/Expressions/Identifier_Reference/async_and_generator_t04: MissingCompileTimeError
-Language/Expressions/Identifier_Reference/async_and_generator_t05: MissingCompileTimeError
-Language/Expressions/Identifier_Reference/async_and_generator_t06: MissingCompileTimeError
-Language/Expressions/Identifier_Reference/async_and_generator_t07: MissingCompileTimeError
-Language/Expressions/Identifier_Reference/async_and_generator_t08: MissingCompileTimeError
-Language/Expressions/Identifier_Reference/async_and_generator_t09: MissingCompileTimeError
-Language/Expressions/Identifier_Reference/async_and_generator_t10: MissingCompileTimeError
-Language/Expressions/Identifier_Reference/built_in_identifier_t08: MissingCompileTimeError
-Language/Expressions/Identifier_Reference/built_in_identifier_t09: MissingCompileTimeError
-Language/Expressions/Identifier_Reference/built_in_identifier_t10: MissingCompileTimeError
-Language/Expressions/Identifier_Reference/built_in_not_dynamic_t01: MissingCompileTimeError
-Language/Expressions/Identifier_Reference/built_in_not_dynamic_t12: MissingCompileTimeError
-Language/Expressions/Identifier_Reference/built_in_not_dynamic_t15: MissingCompileTimeError
-Language/Expressions/Identifier_Reference/evaluation_static_t02: Crash
-Language/Expressions/Identifier_Reference/syntax_built_in_t01: CompileTimeError
-Language/Expressions/Identifier_Reference/syntax_t07: MissingCompileTimeError
-Language/Expressions/Identifier_Reference/syntax_t08: MissingCompileTimeError
-Language/Expressions/Identifier_Reference/undeclared_identifier_t04: RuntimeError
-Language/Expressions/Instance_Creation/Const/accessibility_t01: MissingCompileTimeError
-Language/Expressions/Instance_Creation/Const/accessibility_t02: MissingCompileTimeError
-Language/Expressions/Instance_Creation/Const/accessibility_t03: DartkCrash
-Language/Expressions/Instance_Creation/Const/accessibility_t04: MissingCompileTimeError
-Language/Expressions/Instance_Creation/Const/accessibility_t05: DartkCrash
-Language/Expressions/Instance_Creation/Const/accessibility_t06: MissingCompileTimeError
-Language/Expressions/Instance_Creation/Const/accessibility_t07: MissingCompileTimeError
-Language/Expressions/Instance_Creation/Const/arguments_t01: MissingCompileTimeError
-Language/Expressions/Instance_Creation/Const/arguments_t02: MissingCompileTimeError
-Language/Expressions/Instance_Creation/Const/arguments_t03: MissingCompileTimeError
-Language/Expressions/Instance_Creation/Const/constant_constructor_name_t01: MissingCompileTimeError
-Language/Expressions/Instance_Creation/Const/constant_constructor_name_t02: MissingCompileTimeError
-Language/Expressions/Instance_Creation/Const/constant_constructor_name_t03: MissingCompileTimeError
-Language/Expressions/Instance_Creation/Const/constant_constructor_name_t04: MissingCompileTimeError
-Language/Expressions/Instance_Creation/Const/constant_constructor_same_name_as_class_t01: MissingCompileTimeError
-Language/Expressions/Instance_Creation/Const/constant_constructor_same_name_as_class_t02: MissingCompileTimeError
-Language/Expressions/Instance_Creation/Const/deferred_type_t01: MissingCompileTimeError
-Language/Expressions/Instance_Creation/Const/deferred_type_t02: MissingCompileTimeError
-Language/Expressions/Instance_Creation/Const/exception_t01: Crash
-Language/Expressions/Instance_Creation/New/evaluation_t01: RuntimeError
-Language/Expressions/Instance_Creation/New/evaluation_t02: RuntimeError
-Language/Expressions/Instance_Creation/New/evaluation_t06: RuntimeError
-Language/Expressions/Instance_Creation/New/syntax_t02: DartkCrash
-Language/Expressions/Instance_Creation/New/type_t03: DartkCrash
-Language/Expressions/Instance_Creation/New/type_t05: DartkCrash
-Language/Expressions/Instance_Creation/malformed_or_malbounded_t02: MissingCompileTimeError
-Language/Expressions/Instance_Creation/malformed_or_malbounded_t04: MissingCompileTimeError
-Language/Expressions/Lists/constant_list_t01: MissingCompileTimeError
-Language/Expressions/Lists/constant_list_t02: Crash
-Language/Expressions/Maps/constant_map_key_value_t01: Crash
-Language/Expressions/Maps/constant_map_key_value_t03: MissingCompileTimeError
-Language/Expressions/Maps/constant_map_t01: Crash
-Language/Expressions/Maps/constant_map_t02: MissingCompileTimeError
-Language/Expressions/Maps/constant_map_type_t01: MissingCompileTimeError
-Language/Expressions/Maps/key_value_equals_operator_t01: MissingCompileTimeError
-Language/Expressions/Method_Invocation/Cascaded_Invocations/syntax_t02: DartkCrash
-Language/Expressions/Method_Invocation/Cascaded_Invocations/syntax_t03: DartkCrash
-Language/Expressions/Method_Invocation/Cascaded_Invocations/syntax_t04: DartkCrash
-Language/Expressions/Method_Invocation/Ordinary_Invocation/method_lookup_failed_t17: RuntimeError
-Language/Expressions/Method_Invocation/Ordinary_Invocation/syntax_t02: DartkCrash
-Language/Expressions/Method_Invocation/Ordinary_Invocation/syntax_t03: DartkCrash
-Language/Expressions/Method_Invocation/Ordinary_Invocation/syntax_t07: DartkCrash
-Language/Expressions/Method_Invocation/Ordinary_Invocation/syntax_t08: DartkCrash
-Language/Expressions/Method_Invocation/Super_Invocation/getter_lookup_failed_t01: RuntimeError
-Language/Expressions/Method_Invocation/Super_Invocation/getter_lookup_failed_t02: RuntimeError
-Language/Expressions/Method_Invocation/Super_Invocation/getter_lookup_failed_t03: RuntimeError
-Language/Expressions/Method_Invocation/Super_Invocation/getter_lookup_failed_t04: RuntimeError
-Language/Expressions/Method_Invocation/Super_Invocation/invocation_t02: MissingCompileTimeError
-Language/Expressions/Method_Invocation/Super_Invocation/invocation_t03: MissingCompileTimeError
-Language/Expressions/Method_Invocation/Super_Invocation/syntax_t02: DartkCrash
-Language/Expressions/Method_Invocation/Super_Invocation/syntax_t03: DartkCrash
-Language/Expressions/Numbers/extend_or_implement_double_t06: MissingCompileTimeError
-Language/Expressions/Numbers/syntax_t21: MissingCompileTimeError
-Language/Expressions/Numbers/syntax_t25: MissingCompileTimeError
-Language/Expressions/Numbers/syntax_t26: MissingCompileTimeError
-Language/Expressions/Numbers/syntax_t27: MissingCompileTimeError
-Language/Expressions/Numbers/syntax_t29: MissingCompileTimeError
-Language/Expressions/Postfix_Expressions/syntax_t06: MissingCompileTimeError
-Language/Expressions/Postfix_Expressions/syntax_t07: DartkCrash
-Language/Expressions/Postfix_Expressions/syntax_t08: DartkCrash
-Language/Expressions/Property_Extraction/Super_Getter_Access_and_Method_Closurization/no_such_method_t01: RuntimeError
-Language/Expressions/Property_Extraction/Super_Getter_Access_and_Method_Closurization/no_such_method_t02: RuntimeError
-Language/Expressions/This/placement_t04: MissingCompileTimeError
-Language/Expressions/Throw/no_catch_clause_t01: Crash
-Language/Expressions/Throw/no_catch_clause_t02: Crash
-Language/Expressions/Throw/no_catch_clause_t03: Crash
-Language/Expressions/Throw/no_catch_clause_t04: Crash
-Language/Expressions/Throw/no_catch_clause_t05: Crash
-Language/Expressions/Throw/no_catch_clause_t06: Crash
-Language/Expressions/Throw/syntax_t02: MissingCompileTimeError
-Language/Expressions/Type_Cast/evaluation_t04: RuntimeError
-Language/Expressions/Type_Cast/evaluation_t05: RuntimeError
-Language/Expressions/Type_Cast/syntax_t02: MissingCompileTimeError
-Language/Expressions/Type_Test/evaluation_t03: RuntimeError
-Language/Expressions/Type_Test/evaluation_t04: RuntimeError
-Language/Expressions/Unary_Expressions/syntax_t06: DartkCrash
-Language/Expressions/Unary_Expressions/syntax_t07: DartkCrash
-Language/Expressions/Unary_Expressions/syntax_t08: MissingCompileTimeError
-Language/Expressions/Unary_Expressions/syntax_t09: MissingCompileTimeError
-Language/Functions/Formal_Parameters/Optional_Formals/default_value_t01: MissingCompileTimeError
-Language/Functions/Formal_Parameters/Optional_Formals/default_value_t02: MissingCompileTimeError
-Language/Functions/Formal_Parameters/Optional_Formals/name_t01: MissingCompileTimeError
-Language/Functions/Formal_Parameters/Optional_Formals/name_t02: MissingCompileTimeError
-Language/Functions/Formal_Parameters/Required_Formals/syntax_t03: MissingCompileTimeError
-Language/Functions/Formal_Parameters/Required_Formals/syntax_t04: MissingCompileTimeError
-Language/Functions/Formal_Parameters/Required_Formals/syntax_t06: MissingCompileTimeError
-Language/Functions/Formal_Parameters/Required_Formals/syntax_t07: MissingCompileTimeError
-Language/Functions/Formal_Parameters/Required_Formals/syntax_t08: MissingCompileTimeError
-Language/Functions/Formal_Parameters/Required_Formals/syntax_t09: MissingCompileTimeError
-Language/Functions/Formal_Parameters/Required_Formals/syntax_t10: DartkCrash
-Language/Functions/Formal_Parameters/Required_Formals/syntax_t11: DartkCrash
-Language/Functions/Formal_Parameters/declare_as_constant_t01: MissingCompileTimeError
-Language/Functions/Formal_Parameters/declare_as_constant_t02: MissingCompileTimeError
-Language/Functions/Formal_Parameters/declare_as_constant_t03: MissingCompileTimeError
-Language/Functions/Formal_Parameters/declare_as_constant_t04: MissingCompileTimeError
-Language/Functions/Formal_Parameters/declare_as_constant_t05: MissingCompileTimeError
-Language/Functions/Formal_Parameters/declare_as_constant_t06: MissingCompileTimeError
-Language/Functions/Formal_Parameters/syntax_t06: DartkCrash
-Language/Functions/Formal_Parameters/syntax_t13: DartkCrash
-Language/Functions/Function_Declarations/external_function_t01: MissingCompileTimeError
-Language/Functions/Function_Declarations/external_function_t02: MissingCompileTimeError
-Language/Functions/ctor_modifier_t03: MissingCompileTimeError
-Language/Functions/ctor_modifier_t04: MissingCompileTimeError
-Language/Functions/ctor_modifier_t09: MissingCompileTimeError
-Language/Functions/ctor_modifier_t10: MissingCompileTimeError
-Language/Functions/ctor_modifier_t15: MissingCompileTimeError
-Language/Functions/ctor_modifier_t16: MissingCompileTimeError
-Language/Functions/setter_modifier_t01: MissingCompileTimeError
-Language/Functions/setter_modifier_t02: MissingCompileTimeError
-Language/Functions/setter_modifier_t03: MissingCompileTimeError
-Language/Functions/setter_modifier_t04: MissingCompileTimeError
-Language/Functions/setter_modifier_t05: MissingCompileTimeError
-Language/Functions/setter_modifier_t06: MissingCompileTimeError
-Language/Functions/syntax_t05: MissingCompileTimeError
-Language/Functions/syntax_t31: MissingCompileTimeError
-Language/Functions/syntax_t39: MissingCompileTimeError
-Language/Functions/syntax_t40: MissingCompileTimeError
-Language/Generics/malformed_t01: RuntimeError
-Language/Generics/syntax_t17: CompileTimeError
-Language/Interfaces/Superinterfaces/definition_t03: MissingCompileTimeError
-Language/Interfaces/Superinterfaces/definition_t04: MissingCompileTimeError
-Language/Interfaces/Superinterfaces/superinterface_of_itself_t01: MissingCompileTimeError
-Language/Interfaces/Superinterfaces/superinterface_of_itself_t02: MissingCompileTimeError
-Language/Interfaces/Superinterfaces/superinterface_of_itself_t03: MissingCompileTimeError
-Language/Libraries_and_Scripts/Exports/implicit_hide_t01: DartkCrash
-Language/Libraries_and_Scripts/Exports/invalid_uri_t03: DartkCrash
-Language/Libraries_and_Scripts/Exports/reexport_t01: Pass
-Language/Functions/Formal_Parameters/Optional_Formals/syntax_t14: Pass
-Language/Libraries_and_Scripts/Imports/implicit_hide_t01: DartkCrash
-Language/Libraries_and_Scripts/Imports/implicit_hide_t02: DartkCrash
-Language/Libraries_and_Scripts/Imports/invalid_uri_t01: MissingCompileTimeError
-Language/Libraries_and_Scripts/Imports/namespace_changes_t07: DartkCrash
-Language/Libraries_and_Scripts/Imports/namespace_changes_t08: DartkCrash
-Language/Libraries_and_Scripts/Imports/namespace_changes_t16: RuntimeError
-Language/Libraries_and_Scripts/Imports/namespace_changes_t17: RuntimeError
-Language/Libraries_and_Scripts/Imports/namespace_changes_t27: CompileTimeError
-Language/Libraries_and_Scripts/Imports/same_name_t02/01: MissingRuntimeError
-Language/Libraries_and_Scripts/Imports/same_name_t05: RuntimeError
-Language/Libraries_and_Scripts/Imports/same_name_t07: MissingCompileTimeError
-Language/Libraries_and_Scripts/Imports/same_name_t10: RuntimeError
-Language/Libraries_and_Scripts/Imports/same_name_t12/01: MissingRuntimeError
-Language/Libraries_and_Scripts/Imports/same_name_t15/01: MissingRuntimeError
-Language/Libraries_and_Scripts/Imports/same_name_t17: MissingCompileTimeError
-Language/Libraries_and_Scripts/Imports/same_name_t19: RuntimeError
-Language/Libraries_and_Scripts/Imports/syntax_t02: DartkCrash
-Language/Libraries_and_Scripts/Imports/syntax_t03: DartkCrash
-Language/Libraries_and_Scripts/Imports/syntax_t04: DartkCrash
-Language/Libraries_and_Scripts/Imports/syntax_t11: DartkCrash
-Language/Libraries_and_Scripts/Imports/syntax_t13: DartkCrash
-Language/Libraries_and_Scripts/Imports/syntax_t18: DartkCrash
-Language/Libraries_and_Scripts/Imports/syntax_t20: DartkCrash
-Language/Libraries_and_Scripts/Imports/syntax_t21: DartkCrash
-Language/Libraries_and_Scripts/Imports/syntax_t32: MissingCompileTimeError
-Language/Libraries_and_Scripts/Imports/syntax_t41: MissingCompileTimeError
-Language/Libraries_and_Scripts/Parts/compilation_t01: DartkCrash
-Language/Libraries_and_Scripts/Parts/compilation_t02: Timeout
-Language/Libraries_and_Scripts/Parts/compilation_t07: MissingCompileTimeError
-Language/Libraries_and_Scripts/Parts/compilation_t08: DartkCrash
-Language/Libraries_and_Scripts/Parts/compilation_t09: DartkCrash
-Language/Libraries_and_Scripts/Parts/compilation_t10: DartkCrash
-Language/Libraries_and_Scripts/Parts/compilation_t11: MissingCompileTimeError
-Language/Libraries_and_Scripts/Parts/static_warning_t01: RuntimeError
-Language/Libraries_and_Scripts/Parts/syntax_t01: MissingCompileTimeError
-Language/Libraries_and_Scripts/Parts/syntax_t05: DartkCrash
-Language/Libraries_and_Scripts/Parts/syntax_t07: DartkCrash
-Language/Libraries_and_Scripts/Parts/syntax_t08: DartkCrash
-Language/Libraries_and_Scripts/Scripts/syntax_t05: MissingCompileTimeError
-Language/Libraries_and_Scripts/Scripts/syntax_t06: MissingCompileTimeError
-Language/Libraries_and_Scripts/Scripts/syntax_t07: MissingCompileTimeError
-Language/Libraries_and_Scripts/Scripts/syntax_t08: MissingCompileTimeError
-Language/Libraries_and_Scripts/Scripts/syntax_t10: MissingCompileTimeError
-Language/Libraries_and_Scripts/Scripts/syntax_t14: MissingCompileTimeError
-Language/Libraries_and_Scripts/Scripts/top_level_main_t01: Crash
-Language/Libraries_and_Scripts/Scripts/top_level_main_t02: Crash
-Language/Libraries_and_Scripts/definition_syntax_t05: MissingCompileTimeError
-Language/Libraries_and_Scripts/private_access_t03: RuntimeError
-Language/Mixins/Mixin_Application/deferred_t01: MissingCompileTimeError
-Language/Mixins/Mixin_Application/syntax_t15: MissingCompileTimeError
-Language/Mixins/Mixin_Application/wrong_mixin_type_t01: MissingCompileTimeError
-Language/Mixins/Mixin_Application/wrong_mixin_type_t02: MissingCompileTimeError
-Language/Mixins/Mixin_Application/wrong_mixin_type_t03: MissingCompileTimeError
-Language/Mixins/Mixin_Application/wrong_mixin_type_t04: MissingCompileTimeError
-Language/Mixins/Mixin_Application/wrong_mixin_type_t05: DartkCrash
-Language/Mixins/Mixin_Application/wrong_mixin_type_t06: DartkCrash
-Language/Mixins/Mixin_Application/wrong_mixin_type_t07: MissingCompileTimeError
-Language/Mixins/Mixin_Application/wrong_mixin_type_t08: Crash
-Language/Mixins/Mixin_Application/wrong_type_t01: MissingCompileTimeError
-Language/Mixins/Mixin_Application/wrong_type_t02: DartkCrash
-Language/Mixins/Mixin_Application/wrong_type_t03: MissingCompileTimeError
-Language/Mixins/Mixin_Application/wrong_type_t04: Crash
-Language/Mixins/Mixin_Application/wrong_type_t05: MissingCompileTimeError
-Language/Mixins/Mixin_Application/wrong_type_t06: Crash
-Language/Mixins/declaring_constructor_t01: MissingCompileTimeError
-Language/Mixins/declaring_constructor_t02: MissingCompileTimeError
-Language/Mixins/declaring_constructor_t03: MissingCompileTimeError
-Language/Mixins/declaring_constructor_t04: MissingCompileTimeError
-Language/Mixins/declaring_constructor_t07: MissingCompileTimeError
-Language/Mixins/declaring_constructor_t08: MissingCompileTimeError
-Language/Mixins/declaring_constructor_t09: MissingCompileTimeError
-Language/Mixins/declaring_constructor_t10: MissingCompileTimeError
-Language/Overview/Privacy/private_and_public_t06: RuntimeError
-Language/Overview/Privacy/private_and_public_t09: RuntimeError
-Language/Overview/Privacy/private_and_public_t10: RuntimeError
-Language/Overview/Privacy/private_and_public_t19: RuntimeError
-Language/Overview/Privacy/private_and_public_t20: RuntimeError
-Language/Overview/Scoping/conflicting_names_t04: DartkCrash
-Language/Overview/Scoping/conflicting_names_t11: DartkCrash
-Language/Overview/Scoping/conflicting_names_t16: Crash
-Language/Overview/Scoping/conflicting_names_t17: Crash
-Language/Overview/Scoping/conflicting_names_t18: Crash
-Language/Overview/Scoping/conflicting_names_t25: Crash
-Language/Overview/Scoping/conflicting_names_t26: Crash
-Language/Overview/Scoping/conflicting_names_t27: Crash
-Language/Overview/Scoping/conflicting_names_t31: MissingCompileTimeError
-Language/Overview/Scoping/conflicting_names_t32: MissingCompileTimeError
-Language/Overview/Scoping/conflicting_names_t33: MissingCompileTimeError
-Language/Overview/Scoping/conflicting_names_t34: MissingCompileTimeError
-Language/Overview/Scoping/conflicting_names_t35: MissingCompileTimeError
-Language/Overview/Scoping/conflicting_names_t37: Crash
-Language/Overview/Scoping/conflicting_names_t38: Crash
-Language/Overview/Scoping/conflicting_names_t39: MissingCompileTimeError
-Language/Overview/Scoping/conflicting_names_t40: MissingCompileTimeError
-Language/Overview/Scoping/conflicting_names_t41: MissingCompileTimeError
-Language/Overview/Scoping/conflicting_names_t44: Crash
-Language/Overview/Scoping/hiding_declaration_t16: Crash
-Language/Overview/Scoping/hiding_declaration_t28: DartkCrash
-Language/Reference/Lexical_Rules/Comments/documentation_t02: Crash
-Language/Reference/Lexical_Rules/Comments/documentation_t03: Crash
-Language/Reference/Lexical_Rules/Comments/documentation_t04: Crash
-Language/Reference/Lexical_Rules/Comments/documentation_t05: Crash
-Language/Reference/Lexical_Rules/Comments/documentation_t06: Crash
-Language/Reference/Lexical_Rules/Comments/documentation_t10: Crash
-Language/Reference/Lexical_Rules/Comments/documentation_t11: Crash
-Language/Reference/Lexical_Rules/Comments/multi_line_t03: Crash
-Language/Reference/Lexical_Rules/Comments/multi_line_t04: Crash
-Language/Reference/Lexical_Rules/Comments/multi_line_t05: Crash
-Language/Reference/Lexical_Rules/Comments/multi_line_t06: Crash
-Language/Reference/Lexical_Rules/Reserved_Words/whitespace_t02: MissingCompileTimeError
-Language/Reference/Lexical_Rules/Reserved_Words/whitespace_t03: MissingCompileTimeError
-Language/Reference/Lexical_Rules/Reserved_Words/whitespace_t04: MissingCompileTimeError
-Language/Reference/Lexical_Rules/whitespace_t01: MissingCompileTimeError
-Language/Reference/Lexical_Rules/whitespace_t02: MissingCompileTimeError
-Language/Reference/Lexical_Rules/whitespace_t03: MissingCompileTimeError
-Language/Reference/Lexical_Rules/whitespace_t04: MissingCompileTimeError
-Language/Reference/Lexical_Rules/whitespace_t05: MissingCompileTimeError
-Language/Reference/Lexical_Rules/whitespace_t06: MissingCompileTimeError
-Language/Reference/Lexical_Rules/whitespace_t07: MissingCompileTimeError
-Language/Reference/Lexical_Rules/whitespace_t08: MissingCompileTimeError
-Language/Reference/Lexical_Rules/whitespace_t09: MissingCompileTimeError
-Language/Statements/Break/label_t11: DartkCrash
-Language/Statements/Break/label_t12: DartkCrash
-Language/Statements/Continue/async_loops_t10: DartkCrash
-Language/Statements/Continue/label_t03: DartkCrash
-Language/Statements/Continue/label_t06: MissingCompileTimeError
-Language/Statements/Continue/label_t08: MissingCompileTimeError
-Language/Statements/Continue/label_t09: MissingCompileTimeError
-Language/Statements/Continue/label_t10: MissingCompileTimeError
-Language/Statements/Continue/label_t11: MissingCompileTimeError
-Language/Statements/Continue/label_t14: DartkCrash
-Language/Statements/Continue/label_t17: DartkCrash
-Language/Statements/Do/execution_t04: Crash
-Language/Statements/For/Asynchronous_For_in/execution_t04: RuntimeError
-Language/Statements/For/Asynchronous_For_in/syntax_t02: MissingCompileTimeError
-Language/Statements/For/syntax_t07: RuntimeError
-Language/Statements/For/syntax_t09: MissingCompileTimeError
-Language/Statements/For/syntax_t12: MissingCompileTimeError
-Language/Statements/For/syntax_t13: MissingCompileTimeError
-Language/Statements/For/syntax_t16: MissingCompileTimeError
-Language/Statements/For/syntax_t19: MissingCompileTimeError
-Language/Statements/For/syntax_t20: MissingCompileTimeError
-Language/Statements/If/execution_t03: Crash
-Language/Statements/Labels/namespace_t01: DartkCrash
-Language/Statements/Labels/scope_t05: MissingCompileTimeError
-Language/Statements/Local_Function_Declaration/reference_before_declaration_t01: MissingCompileTimeError
-Language/Statements/Local_Function_Declaration/reference_before_declaration_t03: MissingCompileTimeError
-Language/Statements/Local_Function_Declaration/syntax_t05: MissingCompileTimeError
-Language/Statements/Local_Function_Declaration/syntax_t06: MissingCompileTimeError
-Language/Statements/Local_Variable_Declaration/syntax_t11: MissingCompileTimeError
-Language/Statements/Local_Variable_Declaration/syntax_t20: MissingCompileTimeError
-Language/Statements/Rethrow/on_catch_clause_t01: Crash
-Language/Statements/Rethrow/on_catch_clause_t02: Crash
-Language/Statements/Return/generator_function_t01: MissingCompileTimeError
-Language/Statements/Return/generator_function_t02: MissingCompileTimeError
-Language/Statements/Return/generator_function_t03: MissingCompileTimeError
-Language/Statements/Return/generator_function_t04: MissingCompileTimeError
-Language/Statements/Return/generator_function_t05: MissingCompileTimeError
-Language/Statements/Return/generator_function_t06: MissingCompileTimeError
-Language/Statements/Return/generator_function_t07: MissingCompileTimeError
-Language/Statements/Return/generator_function_t08: MissingCompileTimeError
-Language/Statements/Switch/equal_operator_t01: MissingCompileTimeError
-Language/Statements/Switch/equal_operator_t02: MissingCompileTimeError
-Language/Statements/Switch/expressions_t01: MissingCompileTimeError
-Language/Statements/Switch/expressions_t02: MissingCompileTimeError
-Language/Statements/Switch/expressions_t03: MissingCompileTimeError
-Language/Statements/Switch/expressions_t04: MissingCompileTimeError
-Language/Statements/Switch/labels_constants_t01: MissingCompileTimeError
-Language/Statements/Switch/syntax_t16: MissingCompileTimeError
-Language/Statements/Switch/syntax_t17: MissingCompileTimeError
-Language/Statements/Try/malformed_type_t04: RuntimeError
-Language/Statements/Try/syntax_t06: MissingCompileTimeError
-Language/Statements/Try/syntax_t13: MissingCompileTimeError
-Language/Statements/Try/syntax_t15: Crash
-Language/Statements/While/execution_t03: Crash
-Language/Statements/Yield_and_Yield_Each/Yield/location_t02: MissingCompileTimeError
-Language/Statements/Yield_and_Yield_Each/Yield/location_t04: MissingCompileTimeError
-Language/Statements/Yield_and_Yield_Each/Yield/location_t06: MissingCompileTimeError
-Language/Statements/Yield_and_Yield_Each/Yield_Each/location_t02: MissingCompileTimeError
-Language/Statements/Yield_and_Yield_Each/Yield_Each/location_t04: MissingCompileTimeError
-Language/Statements/Yield_and_Yield_Each/Yield_Each/location_t06: MissingCompileTimeError
-Language/Statements/Yield_and_Yield_Each/Yield_Each/static_type_t02: Crash
-Language/Types/Static_Types/malformed_type_t01: RuntimeError
-Language/Types/Type_Declarations/Typedef/param_default_value_t02: MissingCompileTimeError
-Language/Types/Type_Declarations/Typedef/param_default_value_t03: MissingCompileTimeError
-Language/Types/Type_Declarations/Typedef/self_reference_t01: MissingCompileTimeError
-Language/Types/Type_Declarations/Typedef/self_reference_t02: MissingCompileTimeError
-Language/Types/Type_Declarations/Typedef/self_reference_t03: MissingCompileTimeError
-Language/Types/Type_Declarations/Typedef/self_reference_t04: MissingCompileTimeError
-Language/Types/Type_Declarations/Typedef/self_reference_t08: MissingCompileTimeError
-Language/Types/Type_Declarations/Typedef/self_reference_t09: MissingCompileTimeError
-Language/Types/Type_Declarations/Typedef/self_reference_t10: MissingCompileTimeError
-Language/Types/Type_Declarations/Typedef/self_reference_t11: MissingCompileTimeError
-Language/Types/Type_Declarations/Typedef/self_reference_t12: MissingCompileTimeError
-Language/Types/Type_Declarations/Typedef/self_reference_t13: MissingCompileTimeError
-Language/Types/Type_Declarations/Typedef/self_reference_t14: MissingCompileTimeError
-Language/Types/Type_Declarations/Typedef/self_reference_t15: MissingCompileTimeError
-Language/Types/Type_Declarations/Typedef/self_reference_t16: MissingCompileTimeError
-Language/Types/Type_Declarations/Typedef/self_reference_t17: MissingCompileTimeError
-Language/Types/Type_Void/syntax_t02: MissingCompileTimeError
-Language/Variables/constant_initialization_t01: MissingCompileTimeError
-Language/Variables/constant_initialization_t02: MissingCompileTimeError
-Language/Variables/constant_variable_t03: RuntimeError
-Language/Variables/constant_variable_t04: RuntimeError
-Language/Variables/constant_variable_t05: MissingCompileTimeError
-Language/Variables/constant_variable_t06: MissingCompileTimeError
-Language/Variables/constant_variable_t07: MissingCompileTimeError
-Language/Variables/constant_variable_t08: MissingCompileTimeError
-Language/Variables/constant_variable_t10: RuntimeError
-Language/Variables/local_variable_t01: MissingCompileTimeError
-Language/Variables/local_variable_t04: MissingCompileTimeError
-Language/Variables/local_variable_t05: MissingCompileTimeError
-Language/Variables/syntax_t04: MissingCompileTimeError
-Language/Variables/syntax_t05: MissingCompileTimeError
-Language/Variables/syntax_t08: MissingCompileTimeError
-Language/Variables/syntax_t12: MissingCompileTimeError
-Language/Variables/syntax_t13: MissingCompileTimeError
-Language/Variables/syntax_t14: MissingCompileTimeError
-LibTest/async/Future/catchError_A03_t05: Crash
-LibTest/async/Future/then_A05_t01: Crash
-LibTest/async/Stream/Stream.fromFutures_A01_t01: DartkCrash
-LibTest/async/Stream/Stream.fromFutures_A01_t02: DartkCrash
-LibTest/async/Stream/Stream.fromFutures_A02_t01: DartkCrash
-LibTest/async/Stream/Stream.fromFutures_A02_t02: DartkCrash
-LibTest/async/Stream/asBroadcastStream_A03_t02: Crash
-LibTest/async/Stream/asBroadcastStream_A03_t03: Crash
-LibTest/async/Zone/bindBinaryCallback_A01_t01: Crash
-LibTest/async/Zone/bindCallback_A01_t01: Crash
-LibTest/async/Zone/bindUnaryCallback_A01_t01: Crash
-LibTest/async/Zone/current_A01_t01: Crash
-LibTest/async/Zone/handleUncaughtError_A01_t01: Crash
-LibTest/async/Zone/handleUncaughtError_A01_t04: Crash
-LibTest/async/Zone/inSameErrorZone_A01_t01: Crash
-LibTest/async/Zone/inSameErrorZone_A01_t03: Crash
-LibTest/async/Zone/inSameErrorZone_A01_t04: Crash
-LibTest/async/Zone/inSameErrorZone_A01_t05: Crash
-LibTest/async/Zone/parent_A01_t01: Crash
-LibTest/core/Invocation/isAccessor_A01_t01: RuntimeError
-LibTest/core/Invocation/isAccessor_A01_t02: RuntimeError
-LibTest/core/Invocation/isGetter_A01_t01: RuntimeError
-LibTest/core/Invocation/isGetter_A01_t02: RuntimeError
-LibTest/core/Invocation/isMethod_A01_t01: RuntimeError
-LibTest/core/Invocation/isMethod_A01_t02: RuntimeError
-LibTest/core/Invocation/isSetter_A01_t01: RuntimeError
-LibTest/core/Invocation/isSetter_A01_t02: RuntimeError
-LibTest/core/Invocation/memberName_A01_t01: RuntimeError
-LibTest/core/Invocation/namedArguments_A01_t01: RuntimeError
-LibTest/core/Invocation/positionalArguments_A01_t01: RuntimeError
-LibTest/isolate/Isolate/spawn_A02_t02: RuntimeError
-LibTest/isolate/Isolate/spawn_A02_t03: RuntimeError
-LibTest/isolate/Isolate/spawn_A02_t04: RuntimeError
-LibTest/isolate/Isolate/spawn_A02_t05: RuntimeError
-LibTest/isolate/Isolate/spawn_A02_t06: RuntimeError
-LibTest/isolate/Isolate/spawn_A02_t07: RuntimeError
-
-###############################################################################
-# Dartk Entries
-###############################################################################
-
-[ $compiler == dartk || $compiler == dartkp ]
-Language/Classes/Constructors/Constant_Constructors/initializer_not_a_constant_t03: MissingCompileTimeError
-Language/Classes/Constructors/Constant_Constructors/invalid_constant_initializer_t01: Crash
-Language/Classes/Constructors/Constant_Constructors/invalid_constant_initializer_t03: Crash
-Language/Classes/Constructors/Constant_Constructors/non_final_instance_variable_t01: MissingCompileTimeError
-Language/Classes/Constructors/Constant_Constructors/non_final_instance_variable_t02: MissingCompileTimeError
-Language/Classes/Constructors/Constant_Constructors/potentially_constant_expression_t02: MissingCompileTimeError
-Language/Classes/Constructors/Constant_Constructors/superinitializer_t01: MissingCompileTimeError
-Language/Classes/Constructors/Constant_Constructors/superinitializer_t02: MissingCompileTimeError
-Language/Classes/Constructors/Constant_Constructors/syntax_t03: MissingCompileTimeError
-Language/Classes/Constructors/Factories/const_modifier_t01: MissingCompileTimeError
-Language/Classes/Constructors/Factories/const_modifier_t02: MissingCompileTimeError
-Language/Classes/Constructors/Factories/default_value_t01: MissingCompileTimeError
-Language/Classes/Constructors/Factories/default_value_t02: MissingCompileTimeError
-Language/Classes/Constructors/Factories/name_t02: DartkCrash
-Language/Classes/Constructors/Generative_Constructors/execution_t04: MissingCompileTimeError
-Language/Classes/Constructors/Generative_Constructors/execution_t05: MissingCompileTimeError
-Language/Classes/Constructors/Generative_Constructors/execution_t06: MissingCompileTimeError
-Language/Classes/Constructors/Generative_Constructors/execution_t07: MissingCompileTimeError
-Language/Classes/Constructors/Generative_Constructors/execution_t09: MissingCompileTimeError
-Language/Classes/Constructors/Generative_Constructors/execution_t12: MissingCompileTimeError
-Language/Classes/Constructors/Generative_Constructors/formal_parameter_t02: MissingCompileTimeError
-Language/Classes/Constructors/Generative_Constructors/formal_parameter_t08: MissingCompileTimeError
-Language/Classes/Constructors/Generative_Constructors/initializers_t12: MissingCompileTimeError
-Language/Classes/Constructors/Generative_Constructors/initializing_other_function_t01: DartkCrash
-Language/Classes/Constructors/Generative_Constructors/initializing_other_function_t02: DartkCrash
-Language/Classes/Constructors/Generative_Constructors/initializing_other_function_t03: DartkCrash
-Language/Classes/Constructors/Generative_Constructors/initializing_other_function_t04: DartkCrash
-Language/Classes/Constructors/Generative_Constructors/initializing_other_function_t05: DartkCrash
-Language/Classes/Constructors/Generative_Constructors/initializing_other_function_t06: DartkCrash
+Language/Classes/Constructors/Generative_Constructors/initializing_formals_execution_t02: RuntimeError # Dartk Issue 28566
Language/Classes/Constructors/Generative_Constructors/redirection_t02: MissingCompileTimeError
Language/Classes/Constructors/Generative_Constructors/redirection_t03: MissingCompileTimeError
Language/Classes/Constructors/Generative_Constructors/redirection_t07: MissingCompileTimeError
@@ -1443,8 +160,6 @@
Language/Expressions/Assignment/super_assignment_failed_t01: RuntimeError
Language/Expressions/Assignment/super_assignment_failed_t02: RuntimeError
Language/Expressions/Assignment/super_assignment_value_t02: RuntimeError
-Language/Expressions/Await_Expressions/evaluation_throws_t06: RuntimeError
-Language/Expressions/Await_Expressions/evaluation_throws_t07: RuntimeError
Language/Expressions/Await_Expressions/syntax_t06: Crash
Language/Expressions/Conditional/syntax_t04: MissingCompileTimeError
Language/Expressions/Constants/bitwise_operators_t02: Crash
@@ -1458,6 +173,8 @@
Language/Expressions/Constants/depending_on_itself_t03: Crash
Language/Expressions/Constants/equals_expression_t02: MissingCompileTimeError
Language/Expressions/Constants/equals_expression_t03: MissingCompileTimeError
+Language/Expressions/Constants/exception_t01: Crash
+Language/Expressions/Constants/exception_t02: Crash
Language/Expressions/Constants/exception_t03: Crash
Language/Expressions/Constants/exception_t04: MissingCompileTimeError
Language/Expressions/Constants/identical_t02: Crash
@@ -1522,8 +239,12 @@
Language/Expressions/Identifier_Reference/built_in_identifier_t08: MissingCompileTimeError
Language/Expressions/Identifier_Reference/built_in_identifier_t09: MissingCompileTimeError
Language/Expressions/Identifier_Reference/built_in_identifier_t10: MissingCompileTimeError
+Language/Expressions/Identifier_Reference/built_in_identifier_t35: Pass # OK, Issue 25732
+Language/Expressions/Identifier_Reference/built_in_identifier_t36: Pass # OK, Issue 25732
+Language/Expressions/Identifier_Reference/built_in_identifier_t37: Pass # OK, Issue 25732
Language/Expressions/Identifier_Reference/built_in_not_dynamic_t01: MissingCompileTimeError
Language/Expressions/Identifier_Reference/built_in_not_dynamic_t12: MissingCompileTimeError
+Language/Expressions/Identifier_Reference/built_in_not_dynamic_t14: Pass # OK, Issue 25732
Language/Expressions/Identifier_Reference/built_in_not_dynamic_t15: MissingCompileTimeError
Language/Expressions/Identifier_Reference/evaluation_static_t02: Crash
Language/Expressions/Identifier_Reference/syntax_built_in_t01: CompileTimeError
@@ -1549,10 +270,14 @@
Language/Expressions/Instance_Creation/Const/deferred_type_t01: MissingCompileTimeError
Language/Expressions/Instance_Creation/Const/deferred_type_t02: MissingCompileTimeError
Language/Expressions/Instance_Creation/Const/exception_t01: Crash
+Language/Expressions/Instance_Creation/Const/parameterized_type_t01: MissingCompileTimeError
+Language/Expressions/Instance_Creation/Const/parameterized_type_t02: MissingCompileTimeError
Language/Expressions/Instance_Creation/New/evaluation_t01: RuntimeError
Language/Expressions/Instance_Creation/New/evaluation_t02: RuntimeError
Language/Expressions/Instance_Creation/New/evaluation_t06: RuntimeError
-Language/Expressions/Instance_Creation/New/syntax_t02: DartkCrash
+Language/Expressions/Instance_Creation/New/evaluation_t12: RuntimeError # Dartk Issue 28564
+Language/Expressions/Instance_Creation/New/evaluation_t19: RuntimeError # Kernel Issue 28335 (deferred libraries)
+Language/Expressions/Instance_Creation/New/evaluation_t20: RuntimeError # Kernel Issue 28335 (deferred libraries)
Language/Expressions/Instance_Creation/New/type_t03: DartkCrash
Language/Expressions/Instance_Creation/New/type_t05: DartkCrash
Language/Expressions/Instance_Creation/malformed_or_malbounded_t02: MissingCompileTimeError
@@ -1568,7 +293,9 @@
Language/Expressions/Method_Invocation/Cascaded_Invocations/syntax_t02: DartkCrash
Language/Expressions/Method_Invocation/Cascaded_Invocations/syntax_t03: DartkCrash
Language/Expressions/Method_Invocation/Cascaded_Invocations/syntax_t04: DartkCrash
+Language/Expressions/Method_Invocation/Ordinary_Invocation/evaluation_t07: RuntimeError # Dartk Issue 28562
Language/Expressions/Method_Invocation/Ordinary_Invocation/method_lookup_failed_t17: RuntimeError
+Language/Expressions/Method_Invocation/Ordinary_Invocation/method_lookup_failed_t18: RuntimeError # Dartk Issue 28562
Language/Expressions/Method_Invocation/Ordinary_Invocation/syntax_t02: DartkCrash
Language/Expressions/Method_Invocation/Ordinary_Invocation/syntax_t03: DartkCrash
Language/Expressions/Method_Invocation/Ordinary_Invocation/syntax_t07: DartkCrash
@@ -1605,30 +332,29 @@
Language/Expressions/Type_Cast/syntax_t02: MissingCompileTimeError
Language/Expressions/Type_Test/evaluation_t03: RuntimeError
Language/Expressions/Type_Test/evaluation_t04: RuntimeError
+Language/Expressions/Type_Test/evaluation_t10: RuntimeError # Kernel Issue 28335 (deferred libraries)
Language/Expressions/Unary_Expressions/syntax_t06: DartkCrash
Language/Expressions/Unary_Expressions/syntax_t07: DartkCrash
Language/Expressions/Unary_Expressions/syntax_t08: MissingCompileTimeError
Language/Expressions/Unary_Expressions/syntax_t09: MissingCompileTimeError
+Language/Functions/External_Functions/not_connected_to_a_body_t01: RuntimeError # Dartk Issue 28565
Language/Functions/Formal_Parameters/Optional_Formals/default_value_t01: MissingCompileTimeError
Language/Functions/Formal_Parameters/Optional_Formals/default_value_t02: MissingCompileTimeError
Language/Functions/Formal_Parameters/Optional_Formals/name_t01: MissingCompileTimeError
Language/Functions/Formal_Parameters/Optional_Formals/name_t02: MissingCompileTimeError
+Language/Functions/Formal_Parameters/Optional_Formals/syntax_t14: Pass
Language/Functions/Formal_Parameters/Required_Formals/syntax_t03: MissingCompileTimeError
Language/Functions/Formal_Parameters/Required_Formals/syntax_t04: MissingCompileTimeError
Language/Functions/Formal_Parameters/Required_Formals/syntax_t06: MissingCompileTimeError
Language/Functions/Formal_Parameters/Required_Formals/syntax_t07: MissingCompileTimeError
Language/Functions/Formal_Parameters/Required_Formals/syntax_t08: MissingCompileTimeError
Language/Functions/Formal_Parameters/Required_Formals/syntax_t09: MissingCompileTimeError
-Language/Functions/Formal_Parameters/Required_Formals/syntax_t10: DartkCrash
-Language/Functions/Formal_Parameters/Required_Formals/syntax_t11: DartkCrash
Language/Functions/Formal_Parameters/declare_as_constant_t01: MissingCompileTimeError
Language/Functions/Formal_Parameters/declare_as_constant_t02: MissingCompileTimeError
Language/Functions/Formal_Parameters/declare_as_constant_t03: MissingCompileTimeError
Language/Functions/Formal_Parameters/declare_as_constant_t04: MissingCompileTimeError
Language/Functions/Formal_Parameters/declare_as_constant_t05: MissingCompileTimeError
Language/Functions/Formal_Parameters/declare_as_constant_t06: MissingCompileTimeError
-Language/Functions/Formal_Parameters/syntax_t06: DartkCrash
-Language/Functions/Formal_Parameters/syntax_t13: DartkCrash
Language/Functions/Function_Declarations/external_function_t01: MissingCompileTimeError
Language/Functions/Function_Declarations/external_function_t02: MissingCompileTimeError
Language/Functions/ctor_modifier_t03: MissingCompileTimeError
@@ -1654,14 +380,14 @@
Language/Interfaces/Superinterfaces/superinterface_of_itself_t01: MissingCompileTimeError
Language/Interfaces/Superinterfaces/superinterface_of_itself_t02: MissingCompileTimeError
Language/Interfaces/Superinterfaces/superinterface_of_itself_t03: MissingCompileTimeError
-Language/Libraries_and_Scripts/Exports/implicit_hide_t01: DartkCrash
+Language/Libraries_and_Scripts/Exports/invalid_uri_t02: Pass # OK
Language/Libraries_and_Scripts/Exports/invalid_uri_t03: DartkCrash
-Language/Libraries_and_Scripts/Imports/implicit_hide_t01: DartkCrash
-Language/Libraries_and_Scripts/Imports/implicit_hide_t02: DartkCrash
+Language/Libraries_and_Scripts/Exports/reexport_t01: Pass
+Language/Libraries_and_Scripts/Imports/deferred_import_t01: RuntimeError # Kernel Issue 28335 (deferred libraries)
+Language/Libraries_and_Scripts/Imports/deferred_import_t02: RuntimeError # Kernel Issue 28335 (deferred libraries)
Language/Libraries_and_Scripts/Imports/invalid_uri_deferred_t02: CompileTimeError
Language/Libraries_and_Scripts/Imports/invalid_uri_t01: MissingCompileTimeError
-Language/Libraries_and_Scripts/Imports/namespace_changes_t07: DartkCrash
-Language/Libraries_and_Scripts/Imports/namespace_changes_t08: DartkCrash
+Language/Libraries_and_Scripts/Imports/invalid_uri_t02: Pass # OK
Language/Libraries_and_Scripts/Imports/namespace_changes_t16: RuntimeError
Language/Libraries_and_Scripts/Imports/namespace_changes_t17: RuntimeError
Language/Libraries_and_Scripts/Imports/namespace_changes_t27: CompileTimeError
@@ -1673,17 +399,9 @@
Language/Libraries_and_Scripts/Imports/same_name_t15/01: MissingRuntimeError
Language/Libraries_and_Scripts/Imports/same_name_t17: MissingCompileTimeError
Language/Libraries_and_Scripts/Imports/same_name_t19: RuntimeError
-Language/Libraries_and_Scripts/Imports/syntax_t02: DartkCrash
-Language/Libraries_and_Scripts/Imports/syntax_t03: DartkCrash
-Language/Libraries_and_Scripts/Imports/syntax_t04: DartkCrash
-Language/Libraries_and_Scripts/Imports/syntax_t11: DartkCrash
-Language/Libraries_and_Scripts/Imports/syntax_t13: DartkCrash
-Language/Libraries_and_Scripts/Imports/syntax_t18: DartkCrash
-Language/Libraries_and_Scripts/Imports/syntax_t20: DartkCrash
-Language/Libraries_and_Scripts/Imports/syntax_t21: DartkCrash
+Language/Libraries_and_Scripts/Imports/static_type_t01: Skip # No support for deferred libraries.
Language/Libraries_and_Scripts/Imports/syntax_t32: MissingCompileTimeError
Language/Libraries_and_Scripts/Imports/syntax_t41: MissingCompileTimeError
-Language/Libraries_and_Scripts/Parts/compilation_t01: DartkCrash
Language/Libraries_and_Scripts/Parts/compilation_t02: Timeout
Language/Libraries_and_Scripts/Parts/compilation_t07: MissingCompileTimeError
Language/Libraries_and_Scripts/Parts/compilation_t08: DartkCrash
@@ -1692,9 +410,7 @@
Language/Libraries_and_Scripts/Parts/compilation_t11: MissingCompileTimeError
Language/Libraries_and_Scripts/Parts/static_warning_t01: RuntimeError
Language/Libraries_and_Scripts/Parts/syntax_t01: MissingCompileTimeError
-Language/Libraries_and_Scripts/Parts/syntax_t05: DartkCrash
-Language/Libraries_and_Scripts/Parts/syntax_t07: DartkCrash
-Language/Libraries_and_Scripts/Parts/syntax_t08: DartkCrash
+Language/Libraries_and_Scripts/Parts/syntax_t06: Pass # OK
Language/Libraries_and_Scripts/Scripts/syntax_t05: MissingCompileTimeError
Language/Libraries_and_Scripts/Scripts/syntax_t06: MissingCompileTimeError
Language/Libraries_and_Scripts/Scripts/syntax_t07: MissingCompileTimeError
@@ -1714,6 +430,21 @@
Language/Libraries_and_Scripts/definition_syntax_t10: MissingCompileTimeError
Language/Libraries_and_Scripts/definition_syntax_t29: MissingCompileTimeError
Language/Libraries_and_Scripts/private_access_t03: RuntimeError
+Language/Metadata/before_export_t01: RuntimeError # Issue 28434: Kernel IR misses these annotations.
+Language/Metadata/before_import_t01: RuntimeError # Issue 28434: Kernel IR misses these annotations.
+Language/Metadata/before_library_t01: RuntimeError # Issue 28434: Kernel IR misses these annotations.
+Language/Metadata/before_param_t01: RuntimeError # Issue 28434: Kernel IR misses these annotations.
+Language/Metadata/before_param_t02: RuntimeError # Issue 28434: Kernel IR misses these annotations.
+Language/Metadata/before_param_t03: RuntimeError # Issue 28434: Kernel IR misses these annotations.
+Language/Metadata/before_param_t04: RuntimeError # Issue 28434: Kernel IR misses these annotations.
+Language/Metadata/before_param_t05: RuntimeError # Issue 28434: Kernel IR misses these annotations.
+Language/Metadata/before_param_t06: RuntimeError # Issue 28434: Kernel IR misses these annotations.
+Language/Metadata/before_param_t07: RuntimeError # Issue 28434: Kernel IR misses these annotations.
+Language/Metadata/before_param_t08: RuntimeError # Issue 28434: Kernel IR misses these annotations.
+Language/Metadata/before_param_t09: RuntimeError # Issue 28434: Kernel IR misses these annotations.
+Language/Metadata/before_typedef_t01: RuntimeError # Issue 28434: Kernel IR misses these annotations.
+Language/Metadata/before_variable_t01: RuntimeError # Issue 28434: Kernel IR misses these annotations.
+Language/Metadata/before_variable_t02: RuntimeError # Issue 28434: Kernel IR misses these annotations.
Language/Mixins/Mixin_Application/deferred_t01: MissingCompileTimeError
Language/Mixins/Mixin_Application/syntax_t15: MissingCompileTimeError
Language/Mixins/Mixin_Application/wrong_mixin_type_t01: MissingCompileTimeError
@@ -1743,8 +474,6 @@
Language/Overview/Privacy/private_and_public_t10: RuntimeError
Language/Overview/Privacy/private_and_public_t19: RuntimeError
Language/Overview/Privacy/private_and_public_t20: RuntimeError
-Language/Overview/Scoping/conflicting_names_t04: DartkCrash
-Language/Overview/Scoping/conflicting_names_t11: DartkCrash
Language/Overview/Scoping/conflicting_names_t16: Crash
Language/Overview/Scoping/conflicting_names_t17: Crash
Language/Overview/Scoping/conflicting_names_t18: Crash
@@ -1801,7 +530,6 @@
Language/Statements/Continue/label_t14: DartkCrash
Language/Statements/Continue/label_t17: DartkCrash
Language/Statements/Do/execution_t04: Crash
-Language/Statements/For/Asynchronous_For_in/execution_t04: RuntimeError
Language/Statements/For/Asynchronous_For_in/syntax_t02: MissingCompileTimeError
Language/Statements/For/syntax_t07: RuntimeError
Language/Statements/For/syntax_t09: MissingCompileTimeError
@@ -1813,6 +541,7 @@
Language/Statements/If/execution_t03: Crash
Language/Statements/Labels/namespace_t01: DartkCrash
Language/Statements/Labels/scope_t05: MissingCompileTimeError
+Language/Statements/Labels/syntax_t03: Pass # OK
Language/Statements/Local_Function_Declaration/reference_before_declaration_t01: MissingCompileTimeError
Language/Statements/Local_Function_Declaration/reference_before_declaration_t03: MissingCompileTimeError
Language/Statements/Local_Function_Declaration/syntax_t05: MissingCompileTimeError
@@ -1836,8 +565,10 @@
Language/Statements/Switch/expressions_t03: MissingCompileTimeError
Language/Statements/Switch/expressions_t04: MissingCompileTimeError
Language/Statements/Switch/labels_constants_t01: MissingCompileTimeError
+Language/Statements/Switch/syntax_t02: Pass # OK
Language/Statements/Switch/syntax_t16: MissingCompileTimeError
Language/Statements/Switch/syntax_t17: MissingCompileTimeError
+Language/Statements/Try/catch_scope_t01: RuntimeError # Dartk Issue 28410
Language/Statements/Try/malformed_type_t04: RuntimeError
Language/Statements/Try/syntax_t06: MissingCompileTimeError
Language/Statements/Try/syntax_t13: MissingCompileTimeError
@@ -1849,7 +580,7 @@
Language/Statements/Yield_and_Yield_Each/Yield_Each/location_t02: MissingCompileTimeError
Language/Statements/Yield_and_Yield_Each/Yield_Each/location_t04: MissingCompileTimeError
Language/Statements/Yield_and_Yield_Each/Yield_Each/location_t06: MissingCompileTimeError
-Language/Statements/Yield_and_Yield_Each/Yield_Each/static_type_t02: Crash
+Language/Types/Static_Types/deferred_type_t01: RuntimeError # Kernel Issue 28335 (deferred libraries)
Language/Types/Static_Types/malformed_type_t01: RuntimeError
Language/Types/Type_Declarations/Typedef/param_default_value_t02: MissingCompileTimeError
Language/Types/Type_Declarations/Typedef/param_default_value_t03: MissingCompileTimeError
@@ -1880,6 +611,8 @@
Language/Variables/final_or_static_initialization_t01: MissingCompileTimeError
Language/Variables/final_or_static_initialization_t02: MissingCompileTimeError
Language/Variables/final_or_static_initialization_t03: MissingCompileTimeError
+Language/Variables/final_t01/01: MissingRuntimeError # Dartk Issue 28566
+Language/Variables/final_t02/01: MissingRuntimeError # Dartk Issue 28566
Language/Variables/final_t04: MissingCompileTimeError
Language/Variables/final_t05: MissingCompileTimeError
Language/Variables/final_t06: MissingCompileTimeError
@@ -1893,25 +626,7 @@
Language/Variables/syntax_t12: MissingCompileTimeError
Language/Variables/syntax_t13: MissingCompileTimeError
Language/Variables/syntax_t14: MissingCompileTimeError
-LibTest/async/Future/catchError_A03_t05: Crash
-LibTest/async/Future/then_A05_t01: Crash
-LibTest/async/Stream/Stream.fromFutures_A01_t01: DartkCrash
-LibTest/async/Stream/Stream.fromFutures_A01_t02: DartkCrash
-LibTest/async/Stream/Stream.fromFutures_A02_t01: DartkCrash
-LibTest/async/Stream/Stream.fromFutures_A02_t02: DartkCrash
-LibTest/async/Stream/asBroadcastStream_A03_t02: Crash
-LibTest/async/Stream/asBroadcastStream_A03_t03: Crash
-LibTest/async/Zone/bindBinaryCallback_A01_t01: Crash
-LibTest/async/Zone/bindCallback_A01_t01: Crash
-LibTest/async/Zone/bindUnaryCallback_A01_t01: Crash
-LibTest/async/Zone/current_A01_t01: Crash
-LibTest/async/Zone/handleUncaughtError_A01_t01: Crash
-LibTest/async/Zone/handleUncaughtError_A01_t04: Crash
-LibTest/async/Zone/inSameErrorZone_A01_t01: Crash
-LibTest/async/Zone/inSameErrorZone_A01_t03: Crash
-LibTest/async/Zone/inSameErrorZone_A01_t04: Crash
-LibTest/async/Zone/inSameErrorZone_A01_t05: Crash
-LibTest/async/Zone/parent_A01_t01: Crash
+LibTest/async/DeferredLibrary/DeferredLibrary_A01_t01: Skip # No support for deferred libraries.
LibTest/core/Invocation/isAccessor_A01_t01: RuntimeError
LibTest/core/Invocation/isAccessor_A01_t02: RuntimeError
LibTest/core/Invocation/isGetter_A01_t01: RuntimeError
@@ -1923,21 +638,39 @@
LibTest/core/Invocation/memberName_A01_t01: RuntimeError
LibTest/core/Invocation/namedArguments_A01_t01: RuntimeError
LibTest/core/Invocation/positionalArguments_A01_t01: RuntimeError
-LibTest/isolate/Isolate/spawn_A02_t02: RuntimeError
-LibTest/isolate/Isolate/spawn_A02_t03: RuntimeError
-LibTest/isolate/Isolate/spawn_A02_t04: RuntimeError
-LibTest/isolate/Isolate/spawn_A02_t05: RuntimeError
-LibTest/isolate/Isolate/spawn_A02_t06: RuntimeError
-LibTest/isolate/Isolate/spawn_A02_t07: RuntimeError
+LibTest/isolate/Isolate/spawnUri_A01_t06: Skip
+
+[ ($compiler == dartk || $compiler == dartkp) && $mode == debug ]
+Language/Classes/Constructors/Constant_Constructors/syntax_t03: Crash
+Language/Classes/Instance_Variables/constant_t01: Crash
+Language/Expressions/Lists/constant_list_t01: Crash
+Language/Libraries_and_Scripts/Scripts/top_level_main_t05: Crash
+Language/Statements/Switch/syntax_t16: Crash
+Language/Statements/Switch/syntax_t17: Crash
+Language/Statements/Yield_and_Yield_Each/Yield/location_t02: Crash
+Language/Statements/Yield_and_Yield_Each/Yield/location_t04: Crash
+Language/Statements/Yield_and_Yield_Each/Yield/location_t06: Crash
+Language/Statements/Yield_and_Yield_Each/Yield_Each/location_t02: Crash
+Language/Statements/Yield_and_Yield_Each/Yield_Each/location_t04: Crash
+Language/Statements/Yield_and_Yield_Each/Yield_Each/location_t06: Crash
# dartk: JIT failures
-[ $compiler == dartk && $runtime == vm ]
+[ $compiler == dartk ]
Language/Classes/Getters/syntax_t06: MissingCompileTimeError
Language/Expressions/Constants/depending_on_itself_t01: MissingCompileTimeError
Language/Expressions/Constants/depending_on_itself_t02: MissingCompileTimeError
-Language/Expressions/Constants/exception_t01: Crash
-Language/Expressions/Constants/exception_t02: Crash
Language/Expressions/Constants/static_method_t03: MissingCompileTimeError
+Language/Expressions/Instance_Creation/Const/canonicalized_t05: RuntimeError
+Language/Expressions/Object_Identity/string_t01: RuntimeError
+Language/Expressions/Strings/adjacent_strings_t02: RuntimeError
+Language/Libraries_and_Scripts/Imports/static_type_t01/01: Pass
+Language/Libraries_and_Scripts/Imports/static_type_t01/02: Pass
+Language/Libraries_and_Scripts/Imports/static_type_t01/03: Pass
+Language/Libraries_and_Scripts/Imports/static_type_t01/04: Pass
+Language/Libraries_and_Scripts/Imports/static_type_t01/05: Pass
+Language/Libraries_and_Scripts/Imports/static_type_t01/06: Pass
+Language/Libraries_and_Scripts/Imports/static_type_t01/07: Pass
+Language/Libraries_and_Scripts/Imports/static_type_t01: RuntimeError
Language/Metadata/before_class_t01: RuntimeError
Language/Metadata/before_ctor_t01: RuntimeError
Language/Metadata/before_ctor_t02: RuntimeError
@@ -1967,10 +700,15 @@
Language/Statements/Local_Variable_Declaration/syntax_t06: CompileTimeError
Language/Statements/Local_Variable_Declaration/syntax_t18: CompileTimeError
Language/Statements/Local_Variable_Declaration/syntax_t19: CompileTimeError
-LibTest/isolate/Isolate/spawnUri_A02_t04: RuntimeError
+
+# dartk: JIT failures (debug)
+[ $compiler == dartk && $mode == debug ]
+Language/Overview/Scoping/conflicting_names_t43: Crash
+Language/Overview/Scoping/hiding_declaration_t11: Crash
+Language/Overview/Scoping/hiding_declaration_t12: Crash
# dartk: precompilation failures
-[ $compiler == dartkp && $runtime == dart_precompiled ]
+[ $compiler == dartkp ]
Language/Classes/Constructors/Factories/redirecting_to_itself_t01: MissingCompileTimeError
Language/Classes/Constructors/Factories/redirecting_to_itself_t02: MissingCompileTimeError
Language/Classes/Constructors/Factories/redirecting_to_itself_t03: MissingCompileTimeError
@@ -2061,804 +799,6 @@
Language/Statements/Try/syntax_t12: MissingCompileTimeError
Language/Variables/final_t03: MissingCompileTimeError
-###############################################################################
-# VM Entries
-###############################################################################
-
-# dartk: Shared JIT & Precompiled failures
-[ ($compiler == dartk && $runtime == vm) || ($compiler == dartkp && $runtime == dart_precompiled) ]
-Language/Classes/Constructors/Constant_Constructors/initializer_not_a_constant_t03: MissingCompileTimeError
-Language/Classes/Constructors/Constant_Constructors/invalid_constant_initializer_t01: Crash
-Language/Classes/Constructors/Constant_Constructors/invalid_constant_initializer_t03: Crash
-Language/Classes/Constructors/Constant_Constructors/non_final_instance_variable_t01: MissingCompileTimeError
-Language/Classes/Constructors/Constant_Constructors/non_final_instance_variable_t02: MissingCompileTimeError
-Language/Classes/Constructors/Constant_Constructors/potentially_constant_expression_t02: MissingCompileTimeError
-Language/Classes/Constructors/Constant_Constructors/superinitializer_t01: MissingCompileTimeError
-Language/Classes/Constructors/Constant_Constructors/superinitializer_t02: MissingCompileTimeError
-Language/Classes/Constructors/Constant_Constructors/syntax_t03: MissingCompileTimeError
-Language/Classes/Constructors/Factories/const_modifier_t01: MissingCompileTimeError
-Language/Classes/Constructors/Factories/const_modifier_t02: MissingCompileTimeError
-Language/Classes/Constructors/Factories/default_value_t01: MissingCompileTimeError
-Language/Classes/Constructors/Factories/default_value_t02: MissingCompileTimeError
-Language/Classes/Constructors/Factories/name_t02: DartkCrash
-Language/Classes/Constructors/Generative_Constructors/execution_of_an_initializer_t02: RuntimeError # Dartk Issue 28566
-Language/Classes/Constructors/Generative_Constructors/execution_t04: MissingCompileTimeError
-Language/Classes/Constructors/Generative_Constructors/execution_t05: MissingCompileTimeError
-Language/Classes/Constructors/Generative_Constructors/execution_t06: MissingCompileTimeError
-Language/Classes/Constructors/Generative_Constructors/execution_t07: MissingCompileTimeError
-Language/Classes/Constructors/Generative_Constructors/execution_t09: MissingCompileTimeError
-Language/Classes/Constructors/Generative_Constructors/execution_t12: MissingCompileTimeError
-Language/Classes/Constructors/Generative_Constructors/formal_parameter_t02: MissingCompileTimeError
-Language/Classes/Constructors/Generative_Constructors/formal_parameter_t08: MissingCompileTimeError
-Language/Classes/Constructors/Generative_Constructors/initializers_t12: MissingCompileTimeError
-Language/Classes/Constructors/Generative_Constructors/initializing_formals_execution_t02: RuntimeError # Dartk Issue 28566
-Language/Classes/Constructors/Generative_Constructors/initializing_other_function_t01: DartkCrash
-Language/Classes/Constructors/Generative_Constructors/initializing_other_function_t02: DartkCrash
-Language/Classes/Constructors/Generative_Constructors/initializing_other_function_t03: DartkCrash
-Language/Classes/Constructors/Generative_Constructors/initializing_other_function_t04: DartkCrash
-Language/Classes/Constructors/Generative_Constructors/initializing_other_function_t05: DartkCrash
-Language/Classes/Constructors/Generative_Constructors/initializing_other_function_t06: DartkCrash
-Language/Classes/Constructors/Generative_Constructors/redirection_t02: MissingCompileTimeError
-Language/Classes/Constructors/Generative_Constructors/redirection_t03: MissingCompileTimeError
-Language/Classes/Constructors/Generative_Constructors/redirection_t07: MissingCompileTimeError
-Language/Classes/Constructors/Generative_Constructors/redirection_t08: MissingCompileTimeError
-Language/Classes/Constructors/Generative_Constructors/redirection_t09: MissingCompileTimeError
-Language/Classes/Constructors/Generative_Constructors/superclass_constructor_t01: Crash
-Language/Classes/Constructors/Generative_Constructors/superclass_constructor_t02: Crash
-Language/Classes/Constructors/Generative_Constructors/superclass_constructor_t03: MissingCompileTimeError
-Language/Classes/Constructors/Generative_Constructors/superclass_constructor_t04: Crash
-Language/Classes/Constructors/Generative_Constructors/superclass_constructor_t05: Crash
-Language/Classes/Constructors/Generative_Constructors/superclass_constructor_t06: MissingCompileTimeError
-Language/Classes/Constructors/Generative_Constructors/syntax_t02: MissingCompileTimeError
-Language/Classes/Constructors/Generative_Constructors/syntax_t04: MissingCompileTimeError
-Language/Classes/Constructors/Generative_Constructors/syntax_t05: MissingCompileTimeError
-Language/Classes/Getters/syntax_t02: MissingCompileTimeError
-Language/Classes/Getters/syntax_t03: MissingCompileTimeError
-Language/Classes/Getters/syntax_t04: MissingCompileTimeError
-Language/Classes/Getters/syntax_t05: MissingCompileTimeError
-Language/Classes/Getters/syntax_t07: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/arity_0_or_1_t02: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/arity_0_t02: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/arity_1_t01: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/arity_1_t02: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/arity_1_t03: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/arity_1_t04: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/arity_1_t05: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/arity_1_t06: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/arity_1_t07: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/arity_1_t08: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/arity_1_t09: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/arity_1_t10: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/arity_1_t11: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/arity_1_t12: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/arity_1_t13: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/arity_1_t14: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/arity_1_t15: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/arity_1_t16: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/arity_1_t17: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/arity_1_t18: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/arity_2_t01: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/arity_2_t02: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/optional_parameter_t01: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/optional_parameter_t02: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/optional_parameter_t03: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/optional_parameter_t04: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/optional_parameter_t06: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/optional_parameter_t08: MissingCompileTimeError
-Language/Classes/Instance_Methods/Operators/syntax_t04: MissingCompileTimeError
-Language/Classes/Instance_Methods/same_name_setter_t01: CompileTimeError
-Language/Classes/Instance_Variables/constant_t01: MissingCompileTimeError
-Language/Classes/Setters/name_t01: CompileTimeError
-Language/Classes/Setters/name_t02: CompileTimeError
-Language/Classes/Setters/name_t07: CompileTimeError
-Language/Classes/Setters/parameter_t01: MissingCompileTimeError
-Language/Classes/Setters/parameter_t02: MissingCompileTimeError
-Language/Classes/Setters/parameter_t03: MissingCompileTimeError
-Language/Classes/Setters/parameter_t04: MissingCompileTimeError
-Language/Classes/Setters/parameter_t05: MissingCompileTimeError
-Language/Classes/Setters/parameter_t06: MissingCompileTimeError
-Language/Classes/Setters/parameter_t07: MissingCompileTimeError
-Language/Classes/Setters/parameter_t08: MissingCompileTimeError
-Language/Classes/Setters/static_setter_t05: RuntimeError
-Language/Classes/Setters/static_setter_t06: DartkCrash
-Language/Classes/Setters/syntax_t01: RuntimeError
-Language/Classes/Setters/syntax_t03: MissingCompileTimeError
-Language/Classes/Setters/syntax_t04: RuntimeError
-Language/Classes/Static_Methods/declaration_t01: MissingCompileTimeError
-Language/Classes/Static_Methods/same_name_method_and_setter_t01: CompileTimeError
-Language/Classes/Superclasses/Inheritance_and_Overriding/inheritance_t03: RuntimeError
-Language/Classes/Superclasses/superclass_of_itself_t01: MissingCompileTimeError
-Language/Classes/Superclasses/superclass_of_itself_t02: MissingCompileTimeError
-Language/Classes/Superclasses/wrong_superclass_t01: MissingCompileTimeError
-Language/Classes/Superclasses/wrong_superclass_t02: DartkCrash
-Language/Classes/Superclasses/wrong_superclass_t03: MissingCompileTimeError
-Language/Classes/Superclasses/wrong_superclass_t05: DartkCrash
-Language/Classes/Superclasses/wrong_superclass_t07: Crash
-Language/Classes/Superclasses/wrong_superclass_t08: MissingCompileTimeError
-Language/Classes/Superinterfaces/dynamic_type_t01: MissingCompileTimeError
-Language/Classes/Superinterfaces/dynamic_type_t02: MissingCompileTimeError
-Language/Classes/Superinterfaces/itself_t01: MissingCompileTimeError
-Language/Classes/Superinterfaces/type_variable_as_superinterface_t01: DartkCrash
-Language/Classes/Superinterfaces/wrong_type_t01: MissingCompileTimeError
-Language/Classes/Superinterfaces/wrong_type_t02: DartkCrash
-Language/Classes/Superinterfaces/wrong_type_t03: MissingCompileTimeError
-Language/Classes/Superinterfaces/wrong_type_t04: MissingCompileTimeError
-Language/Classes/Superinterfaces/wrong_type_t05: MissingCompileTimeError
-Language/Classes/declarations_t02: MissingCompileTimeError
-Language/Classes/declarations_t03: MissingCompileTimeError
-Language/Classes/declarations_t04: MissingCompileTimeError
-Language/Classes/declarations_t06: MissingCompileTimeError
-Language/Classes/declarations_t08: MissingCompileTimeError
-Language/Classes/declarations_t33: MissingCompileTimeError
-Language/Classes/definition_t23: RuntimeError
-Language/Classes/same_name_member_and_class_t01: MissingCompileTimeError
-Language/Classes/same_name_member_and_class_t03: MissingCompileTimeError
-Language/Classes/same_name_type_variable_t01: MissingCompileTimeError
-Language/Classes/same_name_type_variable_t02: MissingCompileTimeError
-Language/Classes/same_name_type_variable_t03: MissingCompileTimeError
-Language/Classes/same_name_type_variable_t05: MissingCompileTimeError
-Language/Classes/same_name_type_variable_t06: MissingCompileTimeError
-Language/Classes/same_name_type_variable_t08: MissingCompileTimeError
-Language/Classes/same_name_type_variable_t09: MissingCompileTimeError
-Language/Enums/restrictions_t01: Crash
-Language/Enums/restrictions_t02: MissingCompileTimeError
-Language/Enums/restrictions_t03: MissingCompileTimeError
-Language/Enums/restrictions_t04: MissingCompileTimeError
-Language/Enums/restrictions_t05: MissingCompileTimeError
-Language/Enums/restrictions_t06: MissingCompileTimeError
-Language/Enums/restrictions_t07: MissingCompileTimeError
-Language/Enums/restrictions_t08: MissingCompileTimeError
-Language/Expressions/Assignable_Expressions/syntax_t04: DartkCrash
-Language/Expressions/Assignable_Expressions/syntax_t05: DartkCrash
-Language/Expressions/Assignable_Expressions/syntax_t23: DartkCrash
-Language/Expressions/Assignment/expression_assignment_failed_t03: RuntimeError
-Language/Expressions/Assignment/expression_assignment_t07: RuntimeError
-Language/Expressions/Assignment/no_such_method_t01: RuntimeError
-Language/Expressions/Assignment/no_such_method_t02: RuntimeError
-Language/Expressions/Assignment/no_such_method_t03: RuntimeError
-Language/Expressions/Assignment/no_such_method_t04: RuntimeError
-Language/Expressions/Assignment/no_such_method_t05: RuntimeError
-Language/Expressions/Assignment/no_such_method_t06: RuntimeError
-Language/Expressions/Assignment/no_such_method_t07: RuntimeError
-Language/Expressions/Assignment/no_such_method_t08: RuntimeError
-Language/Expressions/Assignment/no_such_method_t09: RuntimeError
-Language/Expressions/Assignment/static_type_t05: RuntimeError
-Language/Expressions/Assignment/static_type_t06: RuntimeError
-Language/Expressions/Assignment/static_warning_t03/none: RuntimeError
-Language/Expressions/Assignment/super_assignment_failed_t01: RuntimeError
-Language/Expressions/Assignment/super_assignment_failed_t02: RuntimeError
-Language/Expressions/Assignment/super_assignment_value_t02: RuntimeError
-Language/Expressions/Await_Expressions/evaluation_throws_t06: RuntimeError
-Language/Expressions/Await_Expressions/evaluation_throws_t07: RuntimeError
-Language/Expressions/Await_Expressions/syntax_t06: Crash
-Language/Expressions/Conditional/syntax_t04: MissingCompileTimeError
-Language/Expressions/Constants/bitwise_operators_t02: Crash
-Language/Expressions/Constants/bitwise_operators_t03: Crash
-Language/Expressions/Constants/bitwise_operators_t04: Crash
-Language/Expressions/Constants/bitwise_operators_t05: Crash
-Language/Expressions/Constants/bitwise_operators_t06: Crash
-Language/Expressions/Constants/constant_constructor_t03: MissingCompileTimeError
-Language/Expressions/Constants/constant_list_t02: MissingCompileTimeError
-Language/Expressions/Constants/constant_map_t02: MissingCompileTimeError
-Language/Expressions/Constants/depending_on_itself_t03: Crash
-Language/Expressions/Constants/equals_expression_t02: MissingCompileTimeError
-Language/Expressions/Constants/equals_expression_t03: MissingCompileTimeError
-Language/Expressions/Constants/exception_t03: Crash
-Language/Expressions/Constants/exception_t04: MissingCompileTimeError
-Language/Expressions/Constants/identical_t02: Crash
-Language/Expressions/Constants/identical_t03: MissingCompileTimeError
-Language/Expressions/Constants/identifier_denotes_a_constant_t03: Crash
-Language/Expressions/Constants/identifier_denotes_a_constant_t06: MissingCompileTimeError
-Language/Expressions/Constants/identifier_denotes_a_constant_t07: MissingCompileTimeError
-Language/Expressions/Constants/literal_string_t02: MissingCompileTimeError
-Language/Expressions/Constants/literal_string_t03: MissingCompileTimeError
-Language/Expressions/Constants/literal_string_t04: Crash
-Language/Expressions/Constants/literal_string_t05: MissingCompileTimeError
-Language/Expressions/Constants/logical_expression_t02: MissingCompileTimeError
-Language/Expressions/Constants/logical_expression_t03: MissingCompileTimeError
-Language/Expressions/Constants/logical_expression_t04: MissingCompileTimeError
-Language/Expressions/Constants/math_operators_t02: Crash
-Language/Expressions/Constants/math_operators_t03: Crash
-Language/Expressions/Constants/math_operators_t04: Crash
-Language/Expressions/Constants/math_operators_t05: Crash
-Language/Expressions/Constants/no_other_constant_expressions_t06: MissingCompileTimeError
-Language/Expressions/Constants/no_other_constant_expressions_t07: MissingCompileTimeError
-Language/Expressions/Constants/no_other_constant_expressions_t08: Crash
-Language/Expressions/Constants/no_other_constant_expressions_t09: MissingCompileTimeError
-Language/Expressions/Constants/no_other_constant_expressions_t10: MissingCompileTimeError
-Language/Expressions/Constants/no_other_constant_expressions_t11: Crash
-Language/Expressions/Constants/no_other_constant_expressions_t12: Crash
-Language/Expressions/Constants/no_other_constant_expressions_t13: Crash
-Language/Expressions/Constants/no_other_constant_expressions_t14: Crash
-Language/Expressions/Constants/no_other_constant_expressions_t15: Crash
-Language/Expressions/Constants/no_other_constant_expressions_t17: Crash
-Language/Expressions/Constants/no_other_constant_expressions_t18: Crash
-Language/Expressions/Constants/no_other_constant_expressions_t20: Crash
-Language/Expressions/Constants/no_other_constant_expressions_t21: Crash
-Language/Expressions/Constants/no_other_constant_expressions_t31: Crash
-Language/Expressions/Constants/static_constant_t02: MissingCompileTimeError
-Language/Expressions/Constants/static_constant_t03: Crash
-Language/Expressions/Constants/static_constant_t04: MissingCompileTimeError
-Language/Expressions/Constants/static_constant_t06: MissingCompileTimeError
-Language/Expressions/Constants/static_constant_t07: MissingCompileTimeError
-Language/Expressions/Constants/static_method_t02: Crash
-Language/Expressions/Constants/string_length_t02: MissingCompileTimeError
-Language/Expressions/Constants/string_length_t03: MissingCompileTimeError
-Language/Expressions/Constants/ternary_operator_t02: MissingCompileTimeError
-Language/Expressions/Constants/top_level_function_t01: Crash
-Language/Expressions/Constants/top_level_function_t02: Crash
-Language/Expressions/Constants/top_level_function_t04: MissingCompileTimeError
-Language/Expressions/Constants/top_level_function_t05: MissingCompileTimeError
-Language/Expressions/Function_Expressions/syntax_t03: MissingCompileTimeError
-Language/Expressions/Function_Invocation/Actual_Argument_List_Evaluation/syntax_t02: DartkCrash
-Language/Expressions/Function_Invocation/Actual_Argument_List_Evaluation/syntax_t03: DartkCrash
-Language/Expressions/Function_Invocation/Binding_Actuals_to_Formals/same_name_arguments_t01: MissingCompileTimeError
-Language/Expressions/Identifier_Reference/async_and_generator_t02: MissingCompileTimeError
-Language/Expressions/Identifier_Reference/async_and_generator_t03: MissingCompileTimeError
-Language/Expressions/Identifier_Reference/async_and_generator_t04: MissingCompileTimeError
-Language/Expressions/Identifier_Reference/async_and_generator_t05: MissingCompileTimeError
-Language/Expressions/Identifier_Reference/async_and_generator_t06: MissingCompileTimeError
-Language/Expressions/Identifier_Reference/async_and_generator_t07: MissingCompileTimeError
-Language/Expressions/Identifier_Reference/async_and_generator_t08: MissingCompileTimeError
-Language/Expressions/Identifier_Reference/async_and_generator_t09: MissingCompileTimeError
-Language/Expressions/Identifier_Reference/async_and_generator_t10: MissingCompileTimeError
-Language/Expressions/Identifier_Reference/built_in_identifier_t08: MissingCompileTimeError
-Language/Expressions/Identifier_Reference/built_in_identifier_t09: MissingCompileTimeError
-Language/Expressions/Identifier_Reference/built_in_identifier_t10: MissingCompileTimeError
-Language/Expressions/Identifier_Reference/built_in_not_dynamic_t01: MissingCompileTimeError
-Language/Expressions/Identifier_Reference/built_in_not_dynamic_t12: MissingCompileTimeError
-Language/Expressions/Identifier_Reference/built_in_not_dynamic_t15: MissingCompileTimeError
-Language/Expressions/Identifier_Reference/evaluation_static_t02: Crash
-Language/Expressions/Identifier_Reference/syntax_built_in_t01: CompileTimeError
-Language/Expressions/Identifier_Reference/syntax_t07: MissingCompileTimeError
-Language/Expressions/Identifier_Reference/syntax_t08: MissingCompileTimeError
-Language/Expressions/Identifier_Reference/undeclared_identifier_t04: RuntimeError
-Language/Expressions/Instance_Creation/Const/accessibility_t01: MissingCompileTimeError
-Language/Expressions/Instance_Creation/Const/accessibility_t02: MissingCompileTimeError
-Language/Expressions/Instance_Creation/Const/accessibility_t03: DartkCrash
-Language/Expressions/Instance_Creation/Const/accessibility_t04: MissingCompileTimeError
-Language/Expressions/Instance_Creation/Const/accessibility_t05: DartkCrash
-Language/Expressions/Instance_Creation/Const/accessibility_t06: MissingCompileTimeError
-Language/Expressions/Instance_Creation/Const/accessibility_t07: MissingCompileTimeError
-Language/Expressions/Instance_Creation/Const/arguments_t01: MissingCompileTimeError
-Language/Expressions/Instance_Creation/Const/arguments_t02: MissingCompileTimeError
-Language/Expressions/Instance_Creation/Const/arguments_t03: MissingCompileTimeError
-Language/Expressions/Instance_Creation/Const/constant_constructor_name_t01: MissingCompileTimeError
-Language/Expressions/Instance_Creation/Const/constant_constructor_name_t02: MissingCompileTimeError
-Language/Expressions/Instance_Creation/Const/constant_constructor_name_t03: MissingCompileTimeError
-Language/Expressions/Instance_Creation/Const/constant_constructor_name_t04: MissingCompileTimeError
-Language/Expressions/Instance_Creation/Const/constant_constructor_same_name_as_class_t01: MissingCompileTimeError
-Language/Expressions/Instance_Creation/Const/constant_constructor_same_name_as_class_t02: MissingCompileTimeError
-Language/Expressions/Instance_Creation/Const/deferred_type_t01: MissingCompileTimeError
-Language/Expressions/Instance_Creation/Const/deferred_type_t02: MissingCompileTimeError
-Language/Expressions/Instance_Creation/Const/exception_t01: Crash
-Language/Expressions/Instance_Creation/New/evaluation_t01: RuntimeError
-Language/Expressions/Instance_Creation/New/evaluation_t02: RuntimeError
-Language/Expressions/Instance_Creation/New/evaluation_t06: RuntimeError
-Language/Expressions/Instance_Creation/New/evaluation_t12: RuntimeError # Dartk Issue 28564
-Language/Expressions/Instance_Creation/New/evaluation_t19: RuntimeError # Kernel Issue 28335 (deferred libraries)
-Language/Expressions/Instance_Creation/New/evaluation_t20: RuntimeError # Kernel Issue 28335 (deferred libraries)
-Language/Expressions/Instance_Creation/New/syntax_t02: DartkCrash
-Language/Expressions/Instance_Creation/New/type_t03: DartkCrash
-Language/Expressions/Instance_Creation/New/type_t05: DartkCrash
-Language/Expressions/Instance_Creation/malformed_or_malbounded_t02: MissingCompileTimeError
-Language/Expressions/Instance_Creation/malformed_or_malbounded_t04: MissingCompileTimeError
-Language/Expressions/Lists/constant_list_t01: MissingCompileTimeError
-Language/Expressions/Lists/constant_list_t02: Crash
-Language/Expressions/Maps/constant_map_key_value_t01: Crash
-Language/Expressions/Maps/constant_map_key_value_t03: MissingCompileTimeError
-Language/Expressions/Maps/constant_map_t01: Crash
-Language/Expressions/Maps/constant_map_t02: MissingCompileTimeError
-Language/Expressions/Maps/constant_map_type_t01: MissingCompileTimeError
-Language/Expressions/Maps/key_value_equals_operator_t01: MissingCompileTimeError
-Language/Expressions/Method_Invocation/Cascaded_Invocations/syntax_t02: DartkCrash
-Language/Expressions/Method_Invocation/Cascaded_Invocations/syntax_t03: DartkCrash
-Language/Expressions/Method_Invocation/Cascaded_Invocations/syntax_t04: DartkCrash
-Language/Expressions/Method_Invocation/Ordinary_Invocation/evaluation_t07: RuntimeError # Dartk Issue 28562
-Language/Expressions/Method_Invocation/Ordinary_Invocation/method_lookup_failed_t17: RuntimeError
-Language/Expressions/Method_Invocation/Ordinary_Invocation/method_lookup_failed_t18: RuntimeError # Dartk Issue 28562
-Language/Expressions/Method_Invocation/Ordinary_Invocation/syntax_t02: DartkCrash
-Language/Expressions/Method_Invocation/Ordinary_Invocation/syntax_t03: DartkCrash
-Language/Expressions/Method_Invocation/Ordinary_Invocation/syntax_t07: DartkCrash
-Language/Expressions/Method_Invocation/Ordinary_Invocation/syntax_t08: DartkCrash
-Language/Expressions/Method_Invocation/Super_Invocation/getter_lookup_failed_t01: RuntimeError
-Language/Expressions/Method_Invocation/Super_Invocation/getter_lookup_failed_t02: RuntimeError
-Language/Expressions/Method_Invocation/Super_Invocation/getter_lookup_failed_t03: RuntimeError
-Language/Expressions/Method_Invocation/Super_Invocation/getter_lookup_failed_t04: RuntimeError
-Language/Expressions/Method_Invocation/Super_Invocation/invocation_t02: MissingCompileTimeError
-Language/Expressions/Method_Invocation/Super_Invocation/invocation_t03: MissingCompileTimeError
-Language/Expressions/Method_Invocation/Super_Invocation/syntax_t02: DartkCrash
-Language/Expressions/Method_Invocation/Super_Invocation/syntax_t03: DartkCrash
-Language/Expressions/Numbers/extend_or_implement_double_t06: MissingCompileTimeError
-Language/Expressions/Numbers/syntax_t21: MissingCompileTimeError
-Language/Expressions/Numbers/syntax_t25: MissingCompileTimeError
-Language/Expressions/Numbers/syntax_t26: MissingCompileTimeError
-Language/Expressions/Numbers/syntax_t27: MissingCompileTimeError
-Language/Expressions/Numbers/syntax_t29: MissingCompileTimeError
-Language/Expressions/Postfix_Expressions/syntax_t06: MissingCompileTimeError
-Language/Expressions/Postfix_Expressions/syntax_t07: DartkCrash
-Language/Expressions/Postfix_Expressions/syntax_t08: DartkCrash
-Language/Expressions/Property_Extraction/Super_Getter_Access_and_Method_Closurization/no_such_method_t01: RuntimeError
-Language/Expressions/Property_Extraction/Super_Getter_Access_and_Method_Closurization/no_such_method_t02: RuntimeError
-Language/Expressions/This/placement_t04: MissingCompileTimeError
-Language/Expressions/Throw/no_catch_clause_t01: Crash
-Language/Expressions/Throw/no_catch_clause_t02: Crash
-Language/Expressions/Throw/no_catch_clause_t03: Crash
-Language/Expressions/Throw/no_catch_clause_t04: Crash
-Language/Expressions/Throw/no_catch_clause_t05: Crash
-Language/Expressions/Throw/no_catch_clause_t06: Crash
-Language/Expressions/Throw/syntax_t02: MissingCompileTimeError
-Language/Expressions/Type_Cast/evaluation_t04: RuntimeError
-Language/Expressions/Type_Cast/evaluation_t05: RuntimeError
-Language/Expressions/Type_Cast/syntax_t02: MissingCompileTimeError
-Language/Expressions/Type_Test/evaluation_t03: RuntimeError
-Language/Expressions/Type_Test/evaluation_t04: RuntimeError
-Language/Expressions/Type_Test/evaluation_t10: RuntimeError # Kernel Issue 28335 (deferred libraries)
-Language/Expressions/Unary_Expressions/syntax_t06: DartkCrash
-Language/Expressions/Unary_Expressions/syntax_t07: DartkCrash
-Language/Expressions/Unary_Expressions/syntax_t08: MissingCompileTimeError
-Language/Expressions/Unary_Expressions/syntax_t09: MissingCompileTimeError
-Language/Functions/External_Functions/not_connected_to_a_body_t01: RuntimeError # Dartk Issue 28565
-Language/Functions/Formal_Parameters/Optional_Formals/default_value_t01: MissingCompileTimeError
-Language/Functions/Formal_Parameters/Optional_Formals/default_value_t02: MissingCompileTimeError
-Language/Functions/Formal_Parameters/Optional_Formals/name_t01: MissingCompileTimeError
-Language/Functions/Formal_Parameters/Optional_Formals/name_t02: MissingCompileTimeError
-Language/Functions/Formal_Parameters/Required_Formals/syntax_t03: MissingCompileTimeError
-Language/Functions/Formal_Parameters/Required_Formals/syntax_t04: MissingCompileTimeError
-Language/Functions/Formal_Parameters/Required_Formals/syntax_t06: MissingCompileTimeError
-Language/Functions/Formal_Parameters/Required_Formals/syntax_t07: MissingCompileTimeError
-Language/Functions/Formal_Parameters/Required_Formals/syntax_t08: MissingCompileTimeError
-Language/Functions/Formal_Parameters/Required_Formals/syntax_t09: MissingCompileTimeError
-Language/Functions/Formal_Parameters/Required_Formals/syntax_t10: DartkCrash
-Language/Functions/Formal_Parameters/Required_Formals/syntax_t11: DartkCrash
-Language/Functions/Formal_Parameters/declare_as_constant_t01: MissingCompileTimeError
-Language/Functions/Formal_Parameters/declare_as_constant_t02: MissingCompileTimeError
-Language/Functions/Formal_Parameters/declare_as_constant_t03: MissingCompileTimeError
-Language/Functions/Formal_Parameters/declare_as_constant_t04: MissingCompileTimeError
-Language/Functions/Formal_Parameters/declare_as_constant_t05: MissingCompileTimeError
-Language/Functions/Formal_Parameters/declare_as_constant_t06: MissingCompileTimeError
-Language/Functions/Formal_Parameters/syntax_t06: DartkCrash
-Language/Functions/Formal_Parameters/syntax_t13: DartkCrash
-Language/Functions/Function_Declarations/external_function_t01: MissingCompileTimeError
-Language/Functions/Function_Declarations/external_function_t02: MissingCompileTimeError
-Language/Functions/ctor_modifier_t03: MissingCompileTimeError
-Language/Functions/ctor_modifier_t04: MissingCompileTimeError
-Language/Functions/ctor_modifier_t09: MissingCompileTimeError
-Language/Functions/ctor_modifier_t10: MissingCompileTimeError
-Language/Functions/ctor_modifier_t15: MissingCompileTimeError
-Language/Functions/ctor_modifier_t16: MissingCompileTimeError
-Language/Functions/setter_modifier_t01: MissingCompileTimeError
-Language/Functions/setter_modifier_t02: MissingCompileTimeError
-Language/Functions/setter_modifier_t03: MissingCompileTimeError
-Language/Functions/setter_modifier_t04: MissingCompileTimeError
-Language/Functions/setter_modifier_t05: MissingCompileTimeError
-Language/Functions/setter_modifier_t06: MissingCompileTimeError
-Language/Functions/syntax_t05: MissingCompileTimeError
-Language/Functions/syntax_t31: MissingCompileTimeError
-Language/Functions/syntax_t39: MissingCompileTimeError
-Language/Functions/syntax_t40: MissingCompileTimeError
-Language/Generics/malformed_t01: RuntimeError
-Language/Generics/syntax_t17: CompileTimeError
-Language/Interfaces/Superinterfaces/definition_t03: MissingCompileTimeError
-Language/Interfaces/Superinterfaces/definition_t04: MissingCompileTimeError
-Language/Interfaces/Superinterfaces/superinterface_of_itself_t01: MissingCompileTimeError
-Language/Interfaces/Superinterfaces/superinterface_of_itself_t02: MissingCompileTimeError
-Language/Interfaces/Superinterfaces/superinterface_of_itself_t03: MissingCompileTimeError
-Language/Libraries_and_Scripts/Exports/implicit_hide_t01: DartkCrash
-Language/Libraries_and_Scripts/Exports/invalid_uri_t03: DartkCrash
-Language/Libraries_and_Scripts/Imports/deferred_import_t01: RuntimeError # Kernel Issue 28335 (deferred libraries)
-Language/Libraries_and_Scripts/Imports/deferred_import_t02: RuntimeError # Kernel Issue 28335 (deferred libraries)
-Language/Libraries_and_Scripts/Imports/implicit_hide_t01: DartkCrash
-Language/Libraries_and_Scripts/Imports/implicit_hide_t02: DartkCrash
-Language/Libraries_and_Scripts/Imports/invalid_uri_t01: MissingCompileTimeError
-Language/Libraries_and_Scripts/Imports/namespace_changes_t07: DartkCrash
-Language/Libraries_and_Scripts/Imports/namespace_changes_t08: DartkCrash
-Language/Libraries_and_Scripts/Imports/namespace_changes_t16: RuntimeError
-Language/Libraries_and_Scripts/Imports/namespace_changes_t17: RuntimeError
-Language/Libraries_and_Scripts/Imports/namespace_changes_t27: CompileTimeError
-Language/Libraries_and_Scripts/Imports/same_name_t02/01: MissingRuntimeError
-Language/Libraries_and_Scripts/Imports/same_name_t05: RuntimeError
-Language/Libraries_and_Scripts/Imports/same_name_t07: MissingCompileTimeError
-Language/Libraries_and_Scripts/Imports/same_name_t10: RuntimeError
-Language/Libraries_and_Scripts/Imports/same_name_t12/01: MissingRuntimeError
-Language/Libraries_and_Scripts/Imports/same_name_t15/01: MissingRuntimeError
-Language/Libraries_and_Scripts/Imports/same_name_t17: MissingCompileTimeError
-Language/Libraries_and_Scripts/Imports/same_name_t19: RuntimeError
-Language/Libraries_and_Scripts/Imports/syntax_t02: DartkCrash
-Language/Libraries_and_Scripts/Imports/syntax_t03: DartkCrash
-Language/Libraries_and_Scripts/Imports/syntax_t04: DartkCrash
-Language/Libraries_and_Scripts/Imports/syntax_t11: DartkCrash
-Language/Libraries_and_Scripts/Imports/syntax_t13: DartkCrash
-Language/Libraries_and_Scripts/Imports/syntax_t18: DartkCrash
-Language/Libraries_and_Scripts/Imports/syntax_t20: DartkCrash
-Language/Libraries_and_Scripts/Imports/syntax_t21: DartkCrash
-Language/Libraries_and_Scripts/Imports/syntax_t32: MissingCompileTimeError
-Language/Libraries_and_Scripts/Imports/syntax_t41: MissingCompileTimeError
-Language/Libraries_and_Scripts/Parts/compilation_t01: DartkCrash
-Language/Libraries_and_Scripts/Parts/compilation_t02: Timeout
-Language/Libraries_and_Scripts/Parts/compilation_t07: MissingCompileTimeError
-Language/Libraries_and_Scripts/Parts/compilation_t08: DartkCrash
-Language/Libraries_and_Scripts/Parts/compilation_t09: DartkCrash
-Language/Libraries_and_Scripts/Parts/compilation_t10: DartkCrash
-Language/Libraries_and_Scripts/Parts/compilation_t11: MissingCompileTimeError
-Language/Libraries_and_Scripts/Parts/static_warning_t01: RuntimeError
-Language/Libraries_and_Scripts/Parts/syntax_t01: MissingCompileTimeError
-Language/Libraries_and_Scripts/Parts/syntax_t05: DartkCrash
-Language/Libraries_and_Scripts/Parts/syntax_t07: DartkCrash
-Language/Libraries_and_Scripts/Parts/syntax_t08: DartkCrash
-Language/Libraries_and_Scripts/Scripts/syntax_t05: MissingCompileTimeError
-Language/Libraries_and_Scripts/Scripts/syntax_t06: MissingCompileTimeError
-Language/Libraries_and_Scripts/Scripts/syntax_t07: MissingCompileTimeError
-Language/Libraries_and_Scripts/Scripts/syntax_t08: MissingCompileTimeError
-Language/Libraries_and_Scripts/Scripts/syntax_t10: MissingCompileTimeError
-Language/Libraries_and_Scripts/Scripts/syntax_t14: MissingCompileTimeError
-Language/Libraries_and_Scripts/Scripts/top_level_main_t01: Crash
-Language/Libraries_and_Scripts/Scripts/top_level_main_t02: Crash
-Language/Libraries_and_Scripts/definition_syntax_t05: MissingCompileTimeError
-Language/Libraries_and_Scripts/private_access_t03: RuntimeError
-Language/Mixins/Mixin_Application/deferred_t01: MissingCompileTimeError
-Language/Mixins/Mixin_Application/syntax_t15: MissingCompileTimeError
-Language/Mixins/Mixin_Application/wrong_mixin_type_t01: MissingCompileTimeError
-Language/Mixins/Mixin_Application/wrong_mixin_type_t02: MissingCompileTimeError
-Language/Mixins/Mixin_Application/wrong_mixin_type_t03: MissingCompileTimeError
-Language/Mixins/Mixin_Application/wrong_mixin_type_t04: MissingCompileTimeError
-Language/Mixins/Mixin_Application/wrong_mixin_type_t05: DartkCrash
-Language/Mixins/Mixin_Application/wrong_mixin_type_t06: DartkCrash
-Language/Mixins/Mixin_Application/wrong_mixin_type_t07: MissingCompileTimeError
-Language/Mixins/Mixin_Application/wrong_mixin_type_t08: Crash
-Language/Mixins/Mixin_Application/wrong_type_t01: MissingCompileTimeError
-Language/Mixins/Mixin_Application/wrong_type_t02: DartkCrash
-Language/Mixins/Mixin_Application/wrong_type_t03: MissingCompileTimeError
-Language/Mixins/Mixin_Application/wrong_type_t04: Crash
-Language/Mixins/Mixin_Application/wrong_type_t05: MissingCompileTimeError
-Language/Mixins/Mixin_Application/wrong_type_t06: Crash
-Language/Mixins/declaring_constructor_t01: MissingCompileTimeError
-Language/Mixins/declaring_constructor_t02: MissingCompileTimeError
-Language/Mixins/declaring_constructor_t03: MissingCompileTimeError
-Language/Mixins/declaring_constructor_t04: MissingCompileTimeError
-Language/Mixins/declaring_constructor_t07: MissingCompileTimeError
-Language/Mixins/declaring_constructor_t08: MissingCompileTimeError
-Language/Mixins/declaring_constructor_t09: MissingCompileTimeError
-Language/Mixins/declaring_constructor_t10: MissingCompileTimeError
-Language/Overview/Privacy/private_and_public_t06: RuntimeError
-Language/Overview/Privacy/private_and_public_t09: RuntimeError
-Language/Overview/Privacy/private_and_public_t10: RuntimeError
-Language/Overview/Privacy/private_and_public_t19: RuntimeError
-Language/Overview/Privacy/private_and_public_t20: RuntimeError
-Language/Overview/Scoping/conflicting_names_t04: DartkCrash
-Language/Overview/Scoping/conflicting_names_t11: DartkCrash
-Language/Overview/Scoping/conflicting_names_t16: Crash
-Language/Overview/Scoping/conflicting_names_t17: Crash
-Language/Overview/Scoping/conflicting_names_t18: Crash
-Language/Overview/Scoping/conflicting_names_t25: Crash
-Language/Overview/Scoping/conflicting_names_t26: Crash
-Language/Overview/Scoping/conflicting_names_t27: Crash
-Language/Overview/Scoping/conflicting_names_t31: MissingCompileTimeError
-Language/Overview/Scoping/conflicting_names_t32: MissingCompileTimeError
-Language/Overview/Scoping/conflicting_names_t33: MissingCompileTimeError
-Language/Overview/Scoping/conflicting_names_t34: MissingCompileTimeError
-Language/Overview/Scoping/conflicting_names_t35: MissingCompileTimeError
-Language/Overview/Scoping/conflicting_names_t37: Crash
-Language/Overview/Scoping/conflicting_names_t38: Crash
-Language/Overview/Scoping/conflicting_names_t39: MissingCompileTimeError
-Language/Overview/Scoping/conflicting_names_t40: MissingCompileTimeError
-Language/Overview/Scoping/conflicting_names_t41: MissingCompileTimeError
-Language/Overview/Scoping/conflicting_names_t44: Crash
-Language/Overview/Scoping/hiding_declaration_t16: Crash
-Language/Overview/Scoping/hiding_declaration_t28: DartkCrash
-Language/Reference/Lexical_Rules/Comments/documentation_t02: Crash
-Language/Reference/Lexical_Rules/Comments/documentation_t03: Crash
-Language/Reference/Lexical_Rules/Comments/documentation_t04: Crash
-Language/Reference/Lexical_Rules/Comments/documentation_t05: Crash
-Language/Reference/Lexical_Rules/Comments/documentation_t06: Crash
-Language/Reference/Lexical_Rules/Comments/documentation_t10: Crash
-Language/Reference/Lexical_Rules/Comments/documentation_t11: Crash
-Language/Reference/Lexical_Rules/Comments/multi_line_t03: Crash
-Language/Reference/Lexical_Rules/Comments/multi_line_t04: Crash
-Language/Reference/Lexical_Rules/Comments/multi_line_t05: Crash
-Language/Reference/Lexical_Rules/Comments/multi_line_t06: Crash
-Language/Reference/Lexical_Rules/Reserved_Words/whitespace_t02: MissingCompileTimeError
-Language/Reference/Lexical_Rules/Reserved_Words/whitespace_t03: MissingCompileTimeError
-Language/Reference/Lexical_Rules/Reserved_Words/whitespace_t04: MissingCompileTimeError
-Language/Reference/Lexical_Rules/whitespace_t01: MissingCompileTimeError
-Language/Reference/Lexical_Rules/whitespace_t02: MissingCompileTimeError
-Language/Reference/Lexical_Rules/whitespace_t03: MissingCompileTimeError
-Language/Reference/Lexical_Rules/whitespace_t04: MissingCompileTimeError
-Language/Reference/Lexical_Rules/whitespace_t05: MissingCompileTimeError
-Language/Reference/Lexical_Rules/whitespace_t06: MissingCompileTimeError
-Language/Reference/Lexical_Rules/whitespace_t07: MissingCompileTimeError
-Language/Reference/Lexical_Rules/whitespace_t08: MissingCompileTimeError
-Language/Reference/Lexical_Rules/whitespace_t09: MissingCompileTimeError
-Language/Statements/Break/label_t11: DartkCrash
-Language/Statements/Break/label_t12: DartkCrash
-Language/Statements/Continue/async_loops_t10: DartkCrash
-Language/Statements/Continue/label_t03: DartkCrash
-Language/Statements/Continue/label_t06: MissingCompileTimeError
-Language/Statements/Continue/label_t08: MissingCompileTimeError
-Language/Statements/Continue/label_t09: MissingCompileTimeError
-Language/Statements/Continue/label_t10: MissingCompileTimeError
-Language/Statements/Continue/label_t11: MissingCompileTimeError
-Language/Statements/Continue/label_t14: DartkCrash
-Language/Statements/Continue/label_t17: DartkCrash
-Language/Statements/Do/execution_t04: Crash
-Language/Statements/For/Asynchronous_For_in/execution_t04: RuntimeError
-Language/Statements/For/Asynchronous_For_in/syntax_t02: MissingCompileTimeError
-Language/Statements/For/syntax_t07: RuntimeError
-Language/Statements/For/syntax_t09: MissingCompileTimeError
-Language/Statements/For/syntax_t12: MissingCompileTimeError
-Language/Statements/For/syntax_t13: MissingCompileTimeError
-Language/Statements/For/syntax_t16: MissingCompileTimeError
-Language/Statements/For/syntax_t19: MissingCompileTimeError
-Language/Statements/For/syntax_t20: MissingCompileTimeError
-Language/Statements/If/execution_t03: Crash
-Language/Statements/Labels/namespace_t01: DartkCrash
-Language/Statements/Labels/scope_t05: MissingCompileTimeError
-Language/Statements/Local_Function_Declaration/reference_before_declaration_t01: MissingCompileTimeError
-Language/Statements/Local_Function_Declaration/reference_before_declaration_t03: MissingCompileTimeError
-Language/Statements/Local_Function_Declaration/syntax_t05: MissingCompileTimeError
-Language/Statements/Local_Function_Declaration/syntax_t06: MissingCompileTimeError
-Language/Statements/Local_Variable_Declaration/syntax_t11: MissingCompileTimeError
-Language/Statements/Local_Variable_Declaration/syntax_t20: MissingCompileTimeError
-Language/Statements/Rethrow/on_catch_clause_t01: Crash
-Language/Statements/Rethrow/on_catch_clause_t02: Crash
-Language/Statements/Return/generator_function_t01: MissingCompileTimeError
-Language/Statements/Return/generator_function_t02: MissingCompileTimeError
-Language/Statements/Return/generator_function_t03: MissingCompileTimeError
-Language/Statements/Return/generator_function_t04: MissingCompileTimeError
-Language/Statements/Return/generator_function_t05: MissingCompileTimeError
-Language/Statements/Return/generator_function_t06: MissingCompileTimeError
-Language/Statements/Return/generator_function_t07: MissingCompileTimeError
-Language/Statements/Return/generator_function_t08: MissingCompileTimeError
-Language/Statements/Switch/equal_operator_t01: MissingCompileTimeError
-Language/Statements/Switch/equal_operator_t02: MissingCompileTimeError
-Language/Statements/Switch/expressions_t01: MissingCompileTimeError
-Language/Statements/Switch/expressions_t02: MissingCompileTimeError
-Language/Statements/Switch/expressions_t03: MissingCompileTimeError
-Language/Statements/Switch/expressions_t04: MissingCompileTimeError
-Language/Statements/Switch/labels_constants_t01: MissingCompileTimeError
-Language/Statements/Switch/syntax_t16: MissingCompileTimeError
-Language/Statements/Switch/syntax_t17: MissingCompileTimeError
-Language/Statements/Try/catch_scope_t01: RuntimeError # Dartk Issue 28410
-Language/Statements/Try/malformed_type_t04: RuntimeError
-Language/Statements/Try/syntax_t06: MissingCompileTimeError
-Language/Statements/Try/syntax_t13: MissingCompileTimeError
-Language/Statements/Try/syntax_t15: Crash
-Language/Statements/While/execution_t03: Crash
-Language/Statements/Yield_and_Yield_Each/Yield/location_t02: MissingCompileTimeError
-Language/Statements/Yield_and_Yield_Each/Yield/location_t04: MissingCompileTimeError
-Language/Statements/Yield_and_Yield_Each/Yield/location_t06: MissingCompileTimeError
-Language/Statements/Yield_and_Yield_Each/Yield_Each/location_t02: MissingCompileTimeError
-Language/Statements/Yield_and_Yield_Each/Yield_Each/location_t04: MissingCompileTimeError
-Language/Statements/Yield_and_Yield_Each/Yield_Each/location_t06: MissingCompileTimeError
-Language/Statements/Yield_and_Yield_Each/Yield_Each/static_type_t02: Crash
-Language/Types/Static_Types/deferred_type_t01: RuntimeError # Kernel Issue 28335 (deferred libraries)
-Language/Types/Static_Types/malformed_type_t01: RuntimeError
-Language/Types/Type_Declarations/Typedef/param_default_value_t02: MissingCompileTimeError
-Language/Types/Type_Declarations/Typedef/param_default_value_t03: MissingCompileTimeError
-Language/Types/Type_Declarations/Typedef/self_reference_t01: MissingCompileTimeError
-Language/Types/Type_Declarations/Typedef/self_reference_t02: MissingCompileTimeError
-Language/Types/Type_Declarations/Typedef/self_reference_t03: MissingCompileTimeError
-Language/Types/Type_Declarations/Typedef/self_reference_t04: MissingCompileTimeError
-Language/Types/Type_Declarations/Typedef/self_reference_t08: MissingCompileTimeError
-Language/Types/Type_Declarations/Typedef/self_reference_t09: MissingCompileTimeError
-Language/Types/Type_Declarations/Typedef/self_reference_t10: MissingCompileTimeError
-Language/Types/Type_Declarations/Typedef/self_reference_t11: MissingCompileTimeError
-Language/Types/Type_Declarations/Typedef/self_reference_t12: MissingCompileTimeError
-Language/Types/Type_Declarations/Typedef/self_reference_t13: MissingCompileTimeError
-Language/Types/Type_Declarations/Typedef/self_reference_t14: MissingCompileTimeError
-Language/Types/Type_Declarations/Typedef/self_reference_t15: MissingCompileTimeError
-Language/Types/Type_Declarations/Typedef/self_reference_t16: MissingCompileTimeError
-Language/Types/Type_Declarations/Typedef/self_reference_t17: MissingCompileTimeError
-Language/Types/Type_Void/syntax_t02: MissingCompileTimeError
-Language/Variables/constant_initialization_t01: MissingCompileTimeError
-Language/Variables/constant_initialization_t02: MissingCompileTimeError
-Language/Variables/constant_variable_t03: RuntimeError
-Language/Variables/constant_variable_t04: RuntimeError
-Language/Variables/constant_variable_t05: MissingCompileTimeError
-Language/Variables/constant_variable_t06: MissingCompileTimeError
-Language/Variables/constant_variable_t07: MissingCompileTimeError
-Language/Variables/constant_variable_t08: MissingCompileTimeError
-Language/Variables/constant_variable_t10: RuntimeError
-Language/Variables/final_t01/01: MissingRuntimeError # Dartk Issue 28566
-Language/Variables/final_t02/01: MissingRuntimeError # Dartk Issue 28566
-Language/Libraries_and_Scripts/Exports/invalid_uri_t02: Pass # OK
-Language/Libraries_and_Scripts/Imports/invalid_uri_t02: Pass # OK
-Language/Libraries_and_Scripts/Parts/syntax_t06: Pass # OK
-Language/Statements/Labels/syntax_t03: Pass # OK
-Language/Statements/Switch/syntax_t02: Pass # OK
-Language/Expressions/Identifier_Reference/built_in_identifier_t35: Pass # OK, Issue 25732
-Language/Expressions/Identifier_Reference/built_in_identifier_t36: Pass # OK, Issue 25732
-Language/Expressions/Identifier_Reference/built_in_identifier_t37: Pass # OK, Issue 25732
-Language/Expressions/Identifier_Reference/built_in_not_dynamic_t14: Pass # OK, Issue 25732
-Language/Variables/local_variable_t01: MissingCompileTimeError
-Language/Variables/local_variable_t04: MissingCompileTimeError
-Language/Variables/local_variable_t05: MissingCompileTimeError
-Language/Variables/syntax_t04: MissingCompileTimeError
-Language/Variables/syntax_t05: MissingCompileTimeError
-Language/Variables/syntax_t08: MissingCompileTimeError
-Language/Variables/syntax_t12: MissingCompileTimeError
-Language/Variables/syntax_t13: MissingCompileTimeError
-Language/Variables/syntax_t14: MissingCompileTimeError
-LibTest/async/Future/catchError_A03_t05: Crash
-LibTest/async/Future/then_A05_t01: Crash
-LibTest/async/Stream/Stream.fromFutures_A01_t01: DartkCrash
-LibTest/async/Stream/Stream.fromFutures_A01_t02: DartkCrash
-LibTest/async/Stream/Stream.fromFutures_A02_t01: DartkCrash
-LibTest/async/Stream/Stream.fromFutures_A02_t02: DartkCrash
-LibTest/async/Stream/asBroadcastStream_A03_t02: Crash
-LibTest/async/Stream/asBroadcastStream_A03_t03: Crash
-LibTest/async/Zone/bindBinaryCallback_A01_t01: Crash
-LibTest/async/Zone/bindCallback_A01_t01: Crash
-LibTest/async/Zone/bindUnaryCallback_A01_t01: Crash
-LibTest/async/Zone/current_A01_t01: Crash
-LibTest/async/Zone/handleUncaughtError_A01_t01: Crash
-LibTest/async/Zone/handleUncaughtError_A01_t04: Crash
-LibTest/async/Zone/inSameErrorZone_A01_t01: Crash
-LibTest/async/Zone/inSameErrorZone_A01_t03: Crash
-LibTest/async/Zone/inSameErrorZone_A01_t04: Crash
-LibTest/async/Zone/inSameErrorZone_A01_t05: Crash
-LibTest/async/Zone/parent_A01_t01: Crash
-LibTest/core/Invocation/isAccessor_A01_t01: RuntimeError
-LibTest/core/Invocation/isAccessor_A01_t02: RuntimeError
-LibTest/core/Invocation/isGetter_A01_t01: RuntimeError
-LibTest/core/Invocation/isGetter_A01_t02: RuntimeError
-LibTest/core/Invocation/isMethod_A01_t01: RuntimeError
-LibTest/core/Invocation/isMethod_A01_t02: RuntimeError
-LibTest/core/Invocation/isSetter_A01_t01: RuntimeError
-LibTest/core/Invocation/isSetter_A01_t02: RuntimeError
-LibTest/core/Invocation/memberName_A01_t01: RuntimeError
-LibTest/core/Invocation/namedArguments_A01_t01: RuntimeError
-LibTest/core/Invocation/positionalArguments_A01_t01: RuntimeError
-LibTest/isolate/Isolate/spawn_A02_t02: RuntimeError
-LibTest/isolate/Isolate/spawn_A02_t03: RuntimeError
-LibTest/isolate/Isolate/spawn_A02_t04: RuntimeError
-LibTest/isolate/Isolate/spawn_A02_t05: RuntimeError
-LibTest/isolate/Isolate/spawn_A02_t06: RuntimeError
-LibTest/isolate/Isolate/spawn_A02_t07: RuntimeError
-
-# dartk: JIT failures
-[ $compiler == dartk && $runtime == vm ]
-Language/Classes/Getters/syntax_t06: MissingCompileTimeError
-Language/Expressions/Constants/depending_on_itself_t01: MissingCompileTimeError
-Language/Expressions/Constants/depending_on_itself_t02: MissingCompileTimeError
-Language/Expressions/Constants/static_method_t03: MissingCompileTimeError
-Language/Expressions/Instance_Creation/Const/canonicalized_t05: RuntimeError
-Language/Expressions/Object_Identity/string_t01: RuntimeError
-Language/Expressions/Strings/adjacent_strings_t02: RuntimeError
-Language/Libraries_and_Scripts/Imports/static_type_t01: RuntimeError
-
-# These tests should throw RuntimeError but they Pass instead.
-Language/Libraries_and_Scripts/Imports/static_type_t01/01: Pass
-Language/Libraries_and_Scripts/Imports/static_type_t01/02: Pass
-Language/Libraries_and_Scripts/Imports/static_type_t01/03: Pass
-Language/Libraries_and_Scripts/Imports/static_type_t01/04: Pass
-Language/Libraries_and_Scripts/Imports/static_type_t01/05: Pass
-Language/Libraries_and_Scripts/Imports/static_type_t01/06: Pass
-Language/Libraries_and_Scripts/Imports/static_type_t01/07: Pass
-Language/Metadata/before_class_t01: RuntimeError
-Language/Metadata/before_ctor_t01: RuntimeError
-Language/Metadata/before_ctor_t02: RuntimeError
-Language/Metadata/before_factory_t01: RuntimeError
-Language/Metadata/before_function_t01: RuntimeError
-Language/Metadata/before_function_t02: RuntimeError
-Language/Metadata/before_function_t03: RuntimeError
-Language/Metadata/before_function_t04: RuntimeError
-Language/Metadata/before_function_t05: RuntimeError
-Language/Metadata/before_function_t06: RuntimeError
-Language/Metadata/before_function_t07: RuntimeError
-Language/Metadata/before_type_param_t01: CompileTimeError
-Language/Metadata/compilation_t01: MissingCompileTimeError
-Language/Metadata/compilation_t02: MissingCompileTimeError
-Language/Metadata/compilation_t03: MissingCompileTimeError
-Language/Metadata/compilation_t04: MissingCompileTimeError
-Language/Metadata/compilation_t08: MissingCompileTimeError
-Language/Metadata/compilation_t09: MissingCompileTimeError
-Language/Metadata/compilation_t10: MissingCompileTimeError
-Language/Metadata/compilation_t11: MissingCompileTimeError
-Language/Overview/Privacy/private_and_public_t04: CompileTimeError
-Language/Overview/Scoping/conflicting_names_t43: MissingCompileTimeError
-Language/Statements/Labels/scope_t01: CompileTimeError
-Language/Statements/Labels/scope_t07: CompileTimeError
-Language/Statements/Local_Variable_Declaration/syntax_t05: CompileTimeError
-Language/Statements/Local_Variable_Declaration/syntax_t06: CompileTimeError
-Language/Statements/Local_Variable_Declaration/syntax_t18: CompileTimeError
-Language/Statements/Local_Variable_Declaration/syntax_t19: CompileTimeError
-LibTest/isolate/Isolate/spawnUri_A02_t04: RuntimeError
-
-# dartk: JIT failures (debug)
-[ $compiler == dartk && $runtime == vm && $mode == debug ]
-
-# dartk: precompilation failures
-[ $compiler == dartkp && $runtime == dart_precompiled ]
-Language/Classes/Constructors/Factories/redirecting_to_itself_t01: MissingCompileTimeError
-Language/Classes/Constructors/Factories/redirecting_to_itself_t02: MissingCompileTimeError
-Language/Classes/Constructors/Factories/redirecting_to_itself_t03: MissingCompileTimeError
-Language/Classes/Constructors/Factories/redirecting_to_itself_t04: MissingCompileTimeError
-Language/Classes/Constructors/Generative_Constructors/initializer_for_a_variable_t01: MissingCompileTimeError
-Language/Classes/Constructors/Generative_Constructors/initializer_for_a_variable_t02: MissingCompileTimeError
-Language/Classes/Constructors/Generative_Constructors/initializers_t06: MissingCompileTimeError
-Language/Classes/Constructors/Generative_Constructors/initializers_t08: MissingCompileTimeError
-Language/Classes/Constructors/Generative_Constructors/initializers_t13: MissingCompileTimeError
-Language/Classes/Constructors/Generative_Constructors/initializers_t14: MissingCompileTimeError
-Language/Classes/Constructors/Generative_Constructors/many_initializers_t01: MissingCompileTimeError
-Language/Classes/Constructors/Generative_Constructors/many_initializers_t02: MissingCompileTimeError
-Language/Classes/Constructors/Generative_Constructors/many_initializers_t03: MissingCompileTimeError
-Language/Classes/Constructors/Generative_Constructors/many_initializers_t04: MissingCompileTimeError
-Language/Classes/Constructors/Generative_Constructors/not_an_instance_variable_t01: MissingCompileTimeError
-Language/Classes/Constructors/Generative_Constructors/not_an_instance_variable_t02: MissingCompileTimeError
-Language/Classes/Constructors/Generative_Constructors/not_an_instance_variable_t03: MissingCompileTimeError
-Language/Classes/Constructors/Generative_Constructors/not_an_instance_variable_t04: MissingCompileTimeError
-Language/Classes/Getters/syntax_t06: Crash
-Language/Classes/same_name_member_and_class_t02: MissingCompileTimeError
-Language/Classes/same_name_member_and_class_t04: MissingCompileTimeError
-Language/Expressions/Additive_Expressions/syntax_t15: MissingCompileTimeError
-Language/Expressions/Additive_Expressions/syntax_t16: MissingCompileTimeError
-Language/Expressions/Assignable_Expressions/syntax_t17: MissingCompileTimeError
-Language/Expressions/Assignable_Expressions/syntax_t21: MissingCompileTimeError
-Language/Expressions/Assignable_Expressions/syntax_t22: MissingCompileTimeError
-Language/Expressions/Assignable_Expressions/syntax_t24: MissingCompileTimeError
-Language/Expressions/Assignable_Expressions/syntax_t25: MissingCompileTimeError
-Language/Expressions/Assignment/prefix_object_t01: MissingCompileTimeError
-Language/Expressions/Assignment/prefix_object_t02: MissingCompileTimeError
-Language/Expressions/Bitwise_Expressions/syntax_t02: MissingCompileTimeError
-Language/Expressions/Conditional/syntax_t02: MissingCompileTimeError
-Language/Expressions/Conditional/syntax_t03: MissingCompileTimeError
-Language/Expressions/Constants/depending_on_itself_t01: Crash
-Language/Expressions/Constants/depending_on_itself_t02: Crash
-Language/Expressions/Constants/exception_t01: Crash
-Language/Expressions/Constants/exception_t02: Crash
-Language/Expressions/Constants/static_method_t03: Crash
-Language/Expressions/Equality/syntax_t02: MissingCompileTimeError
-Language/Expressions/Function_Invocation/Unqualified_Invocation/prefix_object_invocation_t01: MissingCompileTimeError
-Language/Expressions/Identifier_Reference/evaluation_prefix_t01: MissingCompileTimeError
-Language/Expressions/Identifier_Reference/evaluation_type_parameter_t02: MissingCompileTimeError
-Language/Expressions/Logical_Boolean_Expressions/syntax_t02: MissingCompileTimeError
-Language/Expressions/Logical_Boolean_Expressions/syntax_t03: MissingCompileTimeError
-Language/Expressions/Method_Invocation/Super_Invocation/invocation_t01: MissingCompileTimeError
-Language/Expressions/Method_Invocation/Super_Invocation/invocation_t04: MissingCompileTimeError
-Language/Expressions/Method_Invocation/Super_Invocation/invocation_t05: MissingCompileTimeError
-Language/Expressions/Method_Invocation/Super_Invocation/invocation_t06: MissingCompileTimeError
-Language/Expressions/Method_Invocation/Super_Invocation/invocation_t07: MissingCompileTimeError
-Language/Expressions/Multiplicative_Expressions/syntax_t26: MissingCompileTimeError
-Language/Expressions/Relational_Expressions/syntax_t24: MissingCompileTimeError
-Language/Expressions/Shift/syntax_t08: MissingCompileTimeError
-Language/Expressions/This/definition_t05: MissingCompileTimeError
-Language/Expressions/This/placement_t01: MissingCompileTimeError
-Language/Expressions/This/placement_t03: MissingCompileTimeError
-Language/Expressions/This/placement_t05: MissingCompileTimeError
-Language/Expressions/This/placement_t06: MissingCompileTimeError
-Language/Expressions/This/placement_t07: MissingCompileTimeError
-Language/Expressions/This/placement_t08: MissingCompileTimeError
-Language/Overview/Privacy/private_and_public_t04: RuntimeError
-Language/Overview/Scoping/conflicting_names_t43: Crash
-Language/Overview/Scoping/hiding_declaration_t11: Crash
-Language/Overview/Scoping/hiding_declaration_t12: Crash
-Language/Statements/Break/label_t01: MissingCompileTimeError
-Language/Statements/Break/label_t02: MissingCompileTimeError
-Language/Statements/Break/label_t05: MissingCompileTimeError
-Language/Statements/Break/label_t06: MissingCompileTimeError
-Language/Statements/Break/label_t07: MissingCompileTimeError
-Language/Statements/Break/label_t08: MissingCompileTimeError
-Language/Statements/Break/label_t09: MissingCompileTimeError
-Language/Statements/Break/label_t10: MissingCompileTimeError
-Language/Statements/Continue/label_t01: MissingCompileTimeError
-Language/Statements/Continue/label_t02: MissingCompileTimeError
-Language/Statements/Continue/label_t04: MissingCompileTimeError
-Language/Statements/Continue/label_t05: MissingCompileTimeError
-Language/Statements/Continue/label_t15: MissingCompileTimeError
-Language/Statements/Continue/label_t16: MissingCompileTimeError
-Language/Statements/Labels/scope_t01: RuntimeError
-Language/Statements/Labels/scope_t02: MissingCompileTimeError
-Language/Statements/Labels/scope_t07: RuntimeError
-Language/Statements/Local_Variable_Declaration/syntax_t05: RuntimeError
-Language/Statements/Local_Variable_Declaration/syntax_t06: RuntimeError
-Language/Statements/Local_Variable_Declaration/syntax_t18: RuntimeError
-Language/Statements/Local_Variable_Declaration/syntax_t19: RuntimeError
-Language/Statements/Return/generative_constructor_t01: MissingCompileTimeError
-Language/Statements/Return/generative_constructor_t02: MissingCompileTimeError
-Language/Statements/Return/generative_constructor_t03: MissingCompileTimeError
-Language/Statements/Try/syntax_t12: MissingCompileTimeError
-Language/Variables/final_t03: MissingCompileTimeError
-
# dartk: precompilation failures (debug)
-[ $compiler == dartkp && $runtime == dart_precompiled && $mode == debug ]
+[ $compiler == dartkp && $mode == debug ]
+Language/Functions/External_Functions/not_connected_to_a_body_t01: Crash
diff --git a/tests/compiler/dart2js/mirrors_used_test.dart b/tests/compiler/dart2js/mirrors_used_test.dart
index d3add31..4748e65 100644
--- a/tests/compiler/dart2js/mirrors_used_test.dart
+++ b/tests/compiler/dart2js/mirrors_used_test.dart
@@ -63,7 +63,7 @@
// 2. Some code was refactored, and there are more methods.
// Either situation could be problematic, but in situation 2, it is often
// acceptable to increase [expectedMethodCount] a little.
- int expectedMethodCount = 476;
+ int expectedMethodCount = 477;
Expect.isTrue(
generatedCode.length <= expectedMethodCount,
'Too many compiled methods: '
diff --git a/tests/compiler/dart2js/mock_libraries.dart b/tests/compiler/dart2js/mock_libraries.dart
index 97ad29f..14cb278 100644
--- a/tests/compiler/dart2js/mock_libraries.dart
+++ b/tests/compiler/dart2js/mock_libraries.dart
@@ -183,6 +183,9 @@
buildNamedFunctionType(null, null, null);
buildInterfaceType(null, null);
}''',
+ 'functionTypeTest': r'functionTypeTest(f, t) {}',
+ 'functionTypeCast': r'functionTypeCast(f, t) { return f; }',
+ 'functionTypeCheck': r'functionTypeCheck(f, t) { return f; }',
'getFallThroughError': 'getFallThroughError() {}',
'getIsolateAffinityTag': 'getIsolateAffinityTag(_) {}',
'getRuntimeTypeArgument':
diff --git a/tests/html/html.status b/tests/html/html.status
index 5ac5e09..0735b89 100644
--- a/tests/html/html.status
+++ b/tests/html/html.status
@@ -431,6 +431,3 @@
custom/js_custom_test: Fail # mirrors not supported
custom/mirrors_test: Fail # mirrors not supported
mirrors_js_typed_interop_test: Fail # mirrors not supported
-
-# These are raw dart:js tests that fail due to bugs in the CPS IR:
-js_test/Dart_functions: RuntimeError # Tree-shaking an escaping closure #25720
diff --git a/tests/language/language_kernel.status b/tests/language/language_kernel.status
index 414115c..4d58159 100644
--- a/tests/language/language_kernel.status
+++ b/tests/language/language_kernel.status
@@ -6,753 +6,11 @@
abstract_beats_arguments_test: RuntimeError
abstract_runtime_error_test/01: RuntimeError
abstract_runtime_error_test/02: RuntimeError
-application_negative_test: Crash
-arg_param_trailing_comma_test/107: MissingCompileTimeError
-arg_param_trailing_comma_test/112: DartkCrash
-arg_param_trailing_comma_test/115: DartkCrash
-async_test/constructor2: DartkCrash
-arg_param_trailing_comma_test/121: DartkCrash
-arg_param_trailing_comma_test/124: DartkCrash
-arg_param_trailing_comma_test/14: DartkCrash
-arg_param_trailing_comma_test/171: DartkCrash
-arg_param_trailing_comma_test/174: DartkCrash
-arg_param_trailing_comma_test/17: DartkCrash
-arg_param_trailing_comma_test/180: DartkCrash
-arg_param_trailing_comma_test/183: DartkCrash
-arg_param_trailing_comma_test/193: DartkCrash
-arg_param_trailing_comma_test/196: DartkCrash
-arg_param_trailing_comma_test/202: DartkCrash
-arg_param_trailing_comma_test/205: DartkCrash
-arg_param_trailing_comma_test/31: DartkCrash
-arg_param_trailing_comma_test/34: DartkCrash
-arg_param_trailing_comma_test/40: DartkCrash
-arg_param_trailing_comma_test/43: DartkCrash
-arg_param_trailing_comma_test/53: DartkCrash
-arg_param_trailing_comma_test/56: DartkCrash
-arg_param_trailing_comma_test/5: DartkCrash
-arg_param_trailing_comma_test/62: DartkCrash
-arg_param_trailing_comma_test/65: DartkCrash
-arg_param_trailing_comma_test/79: DartkCrash
-arg_param_trailing_comma_test/82: DartkCrash
-arg_param_trailing_comma_test/88: DartkCrash
-arg_param_trailing_comma_test/8: DartkCrash
-arg_param_trailing_comma_test/91: DartkCrash
-arg_param_trailing_comma_test/none: RuntimeError
-assignable_expression_test/02: MissingCompileTimeError
-assignable_expression_test/03: MissingCompileTimeError
-assignable_expression_test/12: MissingCompileTimeError
-assignable_expression_test/13: MissingCompileTimeError
-assignable_expression_test/22: MissingCompileTimeError
-assignable_expression_test/23: MissingCompileTimeError
-assignable_expression_test/32: MissingCompileTimeError
-assignable_expression_test/33: MissingCompileTimeError
-assignable_expression_test/42: MissingCompileTimeError
-assignable_expression_test/43: MissingCompileTimeError
-assignable_expression_test/50: MissingCompileTimeError
-async_await_catch_regression_test: RuntimeError
-async_await_syntax_test/a01b: MissingCompileTimeError
-async_await_syntax_test/a01c: MissingCompileTimeError
-async_await_syntax_test/a05f: MissingCompileTimeError
-async_await_syntax_test/a05g: MissingCompileTimeError
-async_await_syntax_test/a05h: MissingCompileTimeError
-async_await_syntax_test/a06b: MissingCompileTimeError
-async_await_syntax_test/a12e: MissingCompileTimeError
-async_await_syntax_test/a12f: MissingCompileTimeError
-async_await_syntax_test/b00a: DartkCrash
-async_await_syntax_test/b00b: DartkCrash
-async_await_syntax_test/b00c: DartkCrash
-async_await_syntax_test/b01b: MissingCompileTimeError
-async_await_syntax_test/b01c: MissingCompileTimeError
-async_await_syntax_test/b10b: MissingCompileTimeError
-async_await_syntax_test/b12e: MissingCompileTimeError
-async_await_syntax_test/b12f: MissingCompileTimeError
-async_await_syntax_test/c01b: MissingCompileTimeError
-async_await_syntax_test/c01c: MissingCompileTimeError
-async_await_syntax_test/c11a: MissingCompileTimeError
-async_await_syntax_test/c11b: MissingCompileTimeError
-async_await_syntax_test/d01b: MissingCompileTimeError
-async_await_syntax_test/d01c: MissingCompileTimeError
-async_await_syntax_test/e1: MissingCompileTimeError
-async_await_syntax_test/e2: MissingCompileTimeError
-async_await_syntax_test/e3: MissingCompileTimeError
-async_await_test: Crash
-async_finally_rethrow_test: RuntimeError
-async_return_types_test/return_value_sync_star: MissingCompileTimeError
-async_star_cancel_and_throw_in_finally_test: RuntimeError
-async_star_pause_test: Crash
-async_star_test: Crash
-async_test/constructor3: MissingCompileTimeError
-async_test/setter1: MissingCompileTimeError
-asyncstar_throw_in_catch_test: RuntimeError
-await_backwards_compatibility_test/await1: MissingCompileTimeError
-await_exceptions_test: RuntimeError
-await_test: RuntimeError
-bad_constructor_test/05: CompileTimeError
-bad_initializer1_negative_test: Crash
-black_listed_test/13: MissingCompileTimeError
-body_less_constructor_wrong_arg_negative_test: Crash
-built_in_identifier_illegal_test/01: MissingCompileTimeError
-built_in_identifier_illegal_test/04: MissingCompileTimeError
-built_in_identifier_illegal_test/05: MissingCompileTimeError
-built_in_identifier_illegal_test/06: MissingCompileTimeError
-built_in_identifier_illegal_test/07: MissingCompileTimeError
-built_in_identifier_illegal_test/08: MissingCompileTimeError
-built_in_identifier_illegal_test/10: MissingCompileTimeError
-built_in_identifier_illegal_test/12: MissingCompileTimeError
-built_in_identifier_illegal_test/13: MissingCompileTimeError
-built_in_identifier_illegal_test/15: MissingCompileTimeError
-built_in_identifier_illegal_test/16: MissingCompileTimeError
-built_in_identifier_illegal_test/17: MissingCompileTimeError
-built_in_identifier_illegal_test/18: MissingCompileTimeError
-built_in_identifier_illegal_test/19: MissingCompileTimeError
-built_in_identifier_illegal_test/20: MissingCompileTimeError
-built_in_identifier_test/01: CompileTimeError
-call_nonexistent_static_test/01: RuntimeError
-call_nonexistent_static_test/04: RuntimeError
-call_nonexistent_static_test/06: RuntimeError
-class_cycle2_test/01: MissingCompileTimeError
-class_cycle2_test/02: MissingCompileTimeError
-class_cycle_test/00: MissingCompileTimeError
-class_cycle_test/01: MissingCompileTimeError
-compile_time_constant10_test/01: Crash
-compile_time_constant10_test/02: Crash
-compile_time_constant13_test/02: Crash
-compile_time_constant13_test/03: MissingCompileTimeError
-compile_time_constant13_test/04: Crash
-compile_time_constant13_test/05: Crash
-compile_time_constant_arguments_test/01: MissingCompileTimeError
-compile_time_constant_arguments_test/02: MissingCompileTimeError
-compile_time_constant_arguments_test/03: MissingCompileTimeError
-compile_time_constant_arguments_test/04: MissingCompileTimeError
-compile_time_constant_arguments_test/05: MissingCompileTimeError
-compile_time_constant_arguments_test/06: MissingCompileTimeError
-compile_time_constant_c_test/02: MissingCompileTimeError
-compile_time_constant_c_test/03: MissingCompileTimeError
-compile_time_constant_p_test/01: Crash
-compile_time_constant_r_test/01: Crash
-compile_time_constant_r_test/02: Crash
-compile_time_constant_r_test/03: Crash
-compile_time_constant_test/01: MissingCompileTimeError
-compile_time_constant_test/02: Crash
-conditional_import_string_test: RuntimeError
-conditional_import_test: RuntimeError
-conditional_method_invocation_test/11: MissingCompileTimeError
-conditional_property_access_test/09: MissingCompileTimeError
-conditional_property_assignment_test/20: MissingCompileTimeError
-conditional_property_assignment_test/21: MissingCompileTimeError
-conditional_property_assignment_test/22: MissingCompileTimeError
-const_conditional_test/01: MissingCompileTimeError
-const_conditional_test/02: MissingCompileTimeError
-const_conditional_test/03: MissingCompileTimeError
-const_conditional_test/04: MissingCompileTimeError
-const_conditional_test/05: MissingCompileTimeError
-const_conditional_test/06: MissingCompileTimeError
-const_conditional_test/07: MissingCompileTimeError
-const_conditional_test/08: MissingCompileTimeError
-const_conditional_test/09: MissingCompileTimeError
-const_conditional_test/10: MissingCompileTimeError
-const_constructor_mixin2_test/01: MissingCompileTimeError
-const_constructor_mixin3_test/01: MissingCompileTimeError
-const_constructor_mixin_test/01: MissingCompileTimeError
-const_constructor_nonconst_field_test/01: MissingCompileTimeError
-const_constructor_super_test/01: MissingCompileTimeError
-const_constructor_super_test/02: Crash
-const_constructor_syntax_test/01: MissingCompileTimeError
-const_constructor_syntax_test/02: MissingCompileTimeError
-const_constructor_syntax_test/03: MissingCompileTimeError
-const_constructor_syntax_test/04: MissingCompileTimeError
-const_constructor_test/01: MissingCompileTimeError
-const_error_multiply_initialized_test/01: MissingCompileTimeError
-const_error_multiply_initialized_test/03: MissingCompileTimeError
-const_factory_with_body_test/01: MissingCompileTimeError
-const_for_in_variable_test/01: MissingCompileTimeError
-const_instance_field_test/01: MissingCompileTimeError
-const_map2_test/00: MissingCompileTimeError
-const_map3_test/00: MissingCompileTimeError
-const_optional_args_negative_test: Fail
-const_switch2_test/01: MissingCompileTimeError
-const_syntax_test/01: MissingCompileTimeError
-const_syntax_test/02: MissingCompileTimeError
-const_syntax_test/03: MissingCompileTimeError
-const_syntax_test/04: MissingCompileTimeError
-const_syntax_test/05: MissingCompileTimeError
-const_syntax_test/06: MissingCompileTimeError
-const_syntax_test/07: MissingCompileTimeError
-const_syntax_test/10: Crash
-const_syntax_test/11: MissingCompileTimeError
-const_syntax_test/12: MissingCompileTimeError
-const_types_test/09: MissingCompileTimeError
-const_types_test/10: MissingCompileTimeError
-const_types_test/11: MissingCompileTimeError
-const_types_test/12: MissingCompileTimeError
-const_types_test/16: MissingCompileTimeError
-const_types_test/17: MissingCompileTimeError
-const_types_test/18: MissingCompileTimeError
-const_types_test/19: MissingCompileTimeError
-const_types_test/20: MissingCompileTimeError
-const_types_test/21: MissingCompileTimeError
-const_types_test/22: MissingCompileTimeError
-const_types_test/23: MissingCompileTimeError
-const_types_test/24: MissingCompileTimeError
-const_types_test/25: MissingCompileTimeError
-const_types_test/26: MissingCompileTimeError
-const_types_test/27: MissingCompileTimeError
-const_types_test/28: MissingCompileTimeError
-const_types_test/29: MissingCompileTimeError
-const_types_test/30: MissingCompileTimeError
-const_types_test/41: MissingCompileTimeError
-constant_locals_test/01: MissingCompileTimeError
-constant_locals_test/02: MissingCompileTimeError
-constant_locals_test/03: MissingCompileTimeError
-constant_locals_test/04: MissingCompileTimeError
-constant_locals_test/05: MissingCompileTimeError
-constructor10_test/00: Crash
-constructor10_test/01: Crash
-constructor10_test/02: Crash
-constructor_duplicate_initializers_test/03: MissingCompileTimeError
-constructor_redirect2_test/01: MissingCompileTimeError
-constructor_redirect_test/01: MissingCompileTimeError
-covariant_test/00c: RuntimeError
-covariant_test/02: MissingCompileTimeError
-covariant_test/08: MissingCompileTimeError
-covariant_test/12: MissingCompileTimeError
-covariant_test/14: MissingCompileTimeError
-covariant_test/16: MissingCompileTimeError
-covariant_test/19: MissingCompileTimeError
-covariant_test/20c: RuntimeError
-covariant_test/22: MissingCompileTimeError
-covariant_test/28: MissingCompileTimeError
-covariant_test/32: MissingCompileTimeError
-covariant_test/34: MissingCompileTimeError
-covariant_test/36: MissingCompileTimeError
-covariant_test/39: MissingCompileTimeError
-covariant_test/40: RuntimeError
-covariant_test/40b: RuntimeError
-covariant_test/40c: RuntimeError
-covariant_test/42: RuntimeError
-covariant_test/46: MissingCompileTimeError
-covariant_test/46b: MissingCompileTimeError
-covariant_test/48: RuntimeError
-covariant_test/52: RuntimeError
-covariant_test/54: RuntimeError
-covariant_test/56: RuntimeError
-covariant_test/59: MissingCompileTimeError
-covariant_test/none: RuntimeError
-custom_await_stack_trace_test: RuntimeError
-cyclic_class_member_test/01: MissingCompileTimeError
-cyclic_constructor_test/01: MissingCompileTimeError
-cyclic_typedef_test/01: MissingCompileTimeError
-cyclic_typedef_test/02: MissingCompileTimeError
-cyclic_typedef_test/03: MissingCompileTimeError
-cyclic_typedef_test/04: MissingCompileTimeError
-cyclic_typedef_test/05: MissingCompileTimeError
-cyclic_typedef_test/06: MissingCompileTimeError
-cyclic_typedef_test/07: MissingCompileTimeError
-cyclic_typedef_test/08: MissingCompileTimeError
-cyclic_typedef_test/09: MissingCompileTimeError
-cyclic_typedef_test/10: MissingCompileTimeError
-cyclic_typedef_test/11: MissingCompileTimeError
-deferred_duplicate_prefix1_test/01: MissingCompileTimeError
-deferred_duplicate_prefix2_test/01: MissingCompileTimeError
-deferred_duplicate_prefix3_test/01: MissingCompileTimeError
-deferred_inheritance_constraints_test/extends: MissingCompileTimeError
-deferred_inheritance_constraints_test/implements: MissingCompileTimeError
-deferred_inheritance_constraints_test/mixin: MissingCompileTimeError
-deferred_load_constants_test/01: MissingCompileTimeError
-deferred_load_constants_test/02: MissingCompileTimeError
-deferred_load_constants_test/03: MissingCompileTimeError
-deferred_load_constants_test/04: MissingCompileTimeError
-deferred_load_constants_test/05: MissingCompileTimeError
-deferred_no_prefix_test/01: MissingCompileTimeError
-duplicate_export_negative_test: DartkCrash
-dynamic2_test/00: MissingCompileTimeError
-dynamic2_test/01: MissingCompileTimeError
-dynamic_prefix_core_test/01: RuntimeError
-enum_private_test/02: RuntimeError
-enum_syntax_test/06: MissingCompileTimeError
-enum_syntax_test/11: DartkCrash
-enum_syntax_test/20: Crash
-enum_syntax_test/21: MissingCompileTimeError
-enum_syntax_test/22: Crash
-enum_syntax_test/30: MissingCompileTimeError
-export_ambiguous_main_negative_test: Crash
-export_double_same_main_test: Crash
-export_main_test: Crash
-export_private_test/01: MissingCompileTimeError
-extend_type_parameter2_negative_test: DartkCrash
-extend_type_parameter_negative_test: DartkCrash
-external_test/11: MissingCompileTimeError
-external_test/12: MissingCompileTimeError
-external_test/21: MissingCompileTimeError
-external_test/22: MissingCompileTimeError
-external_test/23: MissingCompileTimeError
-external_test/24: MissingCompileTimeError
-external_test/25: MissingCompileTimeError
-external_test/30: MissingCompileTimeError
-external_test/31: MissingCompileTimeError
-factory2_negative_test: DartkCrash
-factory_negative_test: DartkCrash
-factory_redirection_test/07: MissingCompileTimeError
-field_decl_missing_var_type_test/01: MissingCompileTimeError
-final_initializer_instance_reference_test/01: MissingCompileTimeError
-final_is_not_const_test/01: MissingCompileTimeError
-final_super_field_set_test/01: RuntimeError
-final_syntax_test/01: MissingCompileTimeError
-final_syntax_test/02: MissingCompileTimeError
-final_syntax_test/03: MissingCompileTimeError
-final_syntax_test/04: MissingCompileTimeError
-first_class_types_literals_test/08: RuntimeError
-function_subtype0_test: RuntimeError
-function_subtype1_test: RuntimeError
-function_syntax_test/00: MissingCompileTimeError
-function_syntax_test/01: MissingCompileTimeError
-function_syntax_test/22: MissingCompileTimeError
-function_syntax_test/64: MissingCompileTimeError
-function_syntax_test/67: MissingCompileTimeError
-function_syntax_test/68: MissingCompileTimeError
-function_syntax_test/69: MissingCompileTimeError
-function_syntax_test/71: MissingCompileTimeError
-function_syntax_test/73: MissingCompileTimeError
-function_syntax_test/74: MissingCompileTimeError
-function_type/function_type*: DartkCrash # Issue 27969
-function_type_alias5_test/00: MissingCompileTimeError
-function_type_alias5_test/01: MissingCompileTimeError
-function_type_alias5_test/02: MissingCompileTimeError
-function_type_alias6_test/00: MissingCompileTimeError
-function_type_alias7_test/00: MissingCompileTimeError
-function_type_alias7_test/01: DartkCrash
-function_type_alias7_test/02: MissingCompileTimeError
-function_type_alias9_test/00: MissingCompileTimeError
-function_type_parameter2_negative_test: Crash
-function_type_parameter_negative_test: Crash
-generic_constructor_mixin3_test: Crash
-generic_field_mixin2_test: RuntimeError
-generic_field_mixin3_test: RuntimeError
-generic_field_mixin5_test: RuntimeError
-generic_field_mixin_test: RuntimeError
-generic_function_typedef2_test: DartkCrash # Issue 27969
-generic_function_typedef_test: DartkCrash # Issue 27969
-generic_local_functions_test: DartkCrash
-generic_metadata_test/02: MissingCompileTimeError
-generic_metadata_test/03: MissingCompileTimeError
-generic_methods_generic_function_parameter_test: DartkCrash
-getter_parameters_test/01: MissingCompileTimeError
-getter_parameters_test/03: MissingCompileTimeError
-getter_parameters_test/04: MissingCompileTimeError
-hidden_import_test/01: DartkCrash
-hidden_import_test/02: DartkCrash
-hidden_import_test/none: DartkCrash
-if_null_assignment_behavior_test/09: RuntimeError
-if_null_assignment_behavior_test/10: RuntimeError
-if_null_assignment_behavior_test/15: RuntimeError
-implicit_scope_test: Crash
-import_combinators_test: RuntimeError
-import_private_test/01: DartkCrash
-initializing_formal_capture_test: RuntimeError
-inst_field_initializer1_negative_test: Fail
-instanceof3_test: RuntimeError
-interface2_negative_test: Fail
-interface_cycle_test/01: MissingCompileTimeError
-interface_cycle_test/02: MissingCompileTimeError
-invocation_mirror_test: RuntimeError
-is_malformed_type_test/94: RuntimeError
-is_malformed_type_test/95: RuntimeError
-is_malformed_type_test/96: RuntimeError
-is_malformed_type_test/97: RuntimeError
-is_malformed_type_test/98: RuntimeError
-is_malformed_type_test/99: RuntimeError
-is_not_class4_negative_test: Fail
-isnot_malformed_type_test: RuntimeError
-label6_negative_test: DartkCrash
-large_class_declaration_test: SkipSlow # KernelVM Issue 28312
-library_ambiguous_test/00: MissingRuntimeError
-library_ambiguous_test/04: MissingRuntimeError
-library_ambiguous_test/05: MissingCompileTimeError
-list_literal2_negative_test: Fail
-list_literal_negative_test: DartkCrash
-malformed2_test/00: RuntimeError
-malformed_inheritance_test/01: MissingCompileTimeError
-malformed_inheritance_test/03: Crash
-malformed_inheritance_test/05: MissingCompileTimeError
-malformed_inheritance_test/07: DartkCrash
-malformed_inheritance_test/08: DartkCrash
-malformed_inheritance_test/09: MissingCompileTimeError
-malformed_inheritance_test/10: MissingCompileTimeError
-malformed_inheritance_test/11: DartkCrash
-malformed_inheritance_test/12: DartkCrash
-map_literal2_negative_test: Fail
-map_literal_negative_test: DartkCrash
-metadata_test: CompileTimeError
-method_name_test: CompileTimeError
-missing_const_constructor_test/02: MissingCompileTimeError
-missing_const_constructor_test/03: MissingCompileTimeError
-missing_const_constructor_test/04: Crash
-missing_const_constructor_test/05: MissingCompileTimeError
-missing_const_constructor_test/06: MissingCompileTimeError
-missing_part_of_tag_test/01: MissingCompileTimeError
-mixin_black_listed_test/08: DartkCrash
-mixin_cyclic_test/01: MissingCompileTimeError
-mixin_cyclic_test/02: MissingCompileTimeError
-mixin_forwarding_constructor4_test/01: MissingCompileTimeError
-mixin_forwarding_constructor4_test/02: MissingCompileTimeError
-mixin_forwarding_constructor4_test/03: MissingCompileTimeError
-mixin_illegal_constructor_test/01: MissingCompileTimeError
-mixin_illegal_constructor_test/02: MissingCompileTimeError
-mixin_illegal_constructor_test/03: MissingCompileTimeError
-mixin_illegal_constructor_test/04: MissingCompileTimeError
-mixin_illegal_constructor_test/05: MissingCompileTimeError
-mixin_illegal_constructor_test/06: MissingCompileTimeError
-mixin_illegal_constructor_test/07: MissingCompileTimeError
-mixin_illegal_constructor_test/08: MissingCompileTimeError
-mixin_illegal_constructor_test/09: MissingCompileTimeError
-mixin_illegal_constructor_test/10: MissingCompileTimeError
-mixin_illegal_constructor_test/11: MissingCompileTimeError
-mixin_illegal_constructor_test/12: MissingCompileTimeError
-mixin_illegal_cycles_test/01: MissingCompileTimeError
-mixin_illegal_cycles_test/02: MissingCompileTimeError
-mixin_illegal_cycles_test/03: MissingCompileTimeError
-mixin_illegal_cycles_test/04: MissingCompileTimeError
-mixin_illegal_cycles_test/05: MissingCompileTimeError
-mixin_illegal_cycles_test/06: MissingCompileTimeError
-mixin_illegal_object_test/01: MissingCompileTimeError
-mixin_illegal_object_test/02: MissingCompileTimeError
-mixin_illegal_syntax_test/00: DartkCrash
-mixin_invalid_inheritance1_test/01: Crash
-mixin_invalid_inheritance1_test/02: Crash
-mixin_invalid_inheritance1_test/03: Crash
-mixin_invalid_inheritance2_test/01: MissingCompileTimeError
-mixin_invalid_inheritance2_test/02: MissingCompileTimeError
-mixin_invalid_inheritance2_test/03: DartkCrash
-mixin_issue10216_2_test: RuntimeError
-mixin_mixin2_test: RuntimeError
-mixin_mixin3_test: RuntimeError
-mixin_mixin4_test: RuntimeError
-mixin_mixin5_test: RuntimeError
-mixin_mixin6_test: RuntimeError
-mixin_mixin7_test: RuntimeError
-mixin_mixin_bound2_test: RuntimeError
-mixin_mixin_bound_test: RuntimeError
-mixin_mixin_test: RuntimeError
-mixin_of_mixin_test/03: RuntimeError
-mixin_of_mixin_test/14: RuntimeError
-mixin_super_constructor_named_test/01: MissingCompileTimeError
-mixin_super_constructor_positionals_test/01: MissingCompileTimeError
-mixin_super_test: RuntimeError
-mixin_type_parameters_errors_test/01: DartkCrash
-mixin_type_parameters_errors_test/02: DartkCrash
-mixin_type_parameters_errors_test/05: DartkCrash
-multiline_newline_test/01: RuntimeError
-multiline_newline_test/02: RuntimeError
-multiline_newline_test/03: RuntimeError
-multiline_newline_test/04: MissingCompileTimeError
-multiline_newline_test/05: MissingCompileTimeError
-multiline_newline_test/06: MissingCompileTimeError
-named_constructor_test/01: MissingRuntimeError
-named_constructor_test/02: DartkCrash
-named_constructor_test/04: DartkCrash
-named_constructor_test/05: DartkCrash
-named_constructor_test/06: DartkCrash
-named_constructor_test/07: DartkCrash
-named_constructor_test/08: DartkCrash
-named_constructor_test/09: DartkCrash
-named_constructor_test/10: DartkCrash
-named_parameters_aggregated_test/01: MissingCompileTimeError
-named_parameters_aggregated_test/03: MissingCompileTimeError
-named_parameters_aggregated_test/04: MissingCompileTimeError
-named_parameters_default_eq_test/01: MissingCompileTimeError
-named_parameters_default_eq_test/02: MissingCompileTimeError
-new_expression1_negative_test: DartkCrash
-no_main_test/01: Crash
-number_identifier_test/02: MissingCompileTimeError
-number_identifier_test/04: MissingCompileTimeError
-on_catch_malformed_type_test: RuntimeError
-parameter_initializer1_negative_test: DartkCrash
-parameter_initializer2_negative_test: DartkCrash
-parameter_initializer3_negative_test: DartkCrash
-parameter_initializer4_negative_test: DartkCrash
-parameter_initializer6_negative_test: Fail
-part2_test: RuntimeError
-prefix13_negative_test: Fail
-prefix15_negative_test: Fail
-private_access_test/05: RuntimeError
-private_access_test/06: RuntimeError
-private_super_constructor_test/01: MissingCompileTimeError
-redirecting_factory_default_values_test/01: MissingCompileTimeError
-redirecting_factory_default_values_test/02: MissingCompileTimeError
-redirecting_factory_infinite_steps_test/02: Crash
-redirecting_factory_long_test: RuntimeError
-regress_13494_test: RuntimeError
-regress_20394_test/01: MissingCompileTimeError
-regress_22438_test: RuntimeError
-regress_22445_test: RuntimeError
-regress_22579_test: RuntimeError
-regress_23498_test: RuntimeError
-regress_23500_test/01: RuntimeError
-regress_23500_test/02: RuntimeError
-regress_23500_test/none: RuntimeError
-regress_26855_test/0: DartkCrash
-regress_27617_test/1: MissingCompileTimeError
-regress_27957_test: RuntimeError
-regress_28217_test/01: MissingCompileTimeError
-regress_28217_test/none: MissingCompileTimeError
-reify_typevar_static_test/00: MissingCompileTimeError
-scope_variable_test/01: MissingCompileTimeError
-setter0_test: RuntimeError
-setter4_test: CompileTimeError
-setter_override_test/01: RuntimeError
-setter_override_test/02: RuntimeError
-setter_override_test/none: RuntimeError
-source_self_negative_test: DartkCrash
-static_final_field2_test/02: MissingCompileTimeError
-static_parameter_test/01: MissingCompileTimeError
-static_parameter_test/02: MissingCompileTimeError
-static_parameter_test/03: MissingCompileTimeError
-static_parameter_test/04: MissingCompileTimeError
-static_parameter_test/05: MissingCompileTimeError
-static_parameter_test/06: MissingCompileTimeError
-static_parameter_test/07: MissingCompileTimeError
-static_parameter_test/08: MissingCompileTimeError
-static_parameter_test/09: MissingCompileTimeError
-static_parameter_test/10: MissingCompileTimeError
-static_parameter_test/11: MissingCompileTimeError
-static_parameter_test/12: MissingCompileTimeError
-super_call3_test/02: Crash
-super_conditional_operator_test/01: MissingCompileTimeError
-super_conditional_operator_test/02: MissingCompileTimeError
-super_conditional_operator_test/03: MissingCompileTimeError
-super_conditional_operator_test/04: MissingCompileTimeError
-super_conditional_operator_test/05: MissingCompileTimeError
-super_conditional_operator_test/06: MissingCompileTimeError
-super_conditional_operator_test/07: MissingCompileTimeError
-super_conditional_operator_test/08: MissingCompileTimeError
-super_conditional_operator_test/09: MissingCompileTimeError
-super_conditional_operator_test/10: MissingCompileTimeError
-super_conditional_operator_test/11: MissingCompileTimeError
-super_conditional_operator_test/12: MissingCompileTimeError
-super_conditional_operator_test/13: MissingCompileTimeError
-super_conditional_operator_test/14: MissingCompileTimeError
-super_conditional_operator_test/15: MissingCompileTimeError
-super_conditional_operator_test/16: MissingCompileTimeError
-super_conditional_operator_test/17: MissingCompileTimeError
-super_conditional_operator_test/18: MissingCompileTimeError
-super_no_such_method1_test/01: RuntimeError
-super_no_such_method2_test/01: RuntimeError
-super_no_such_method3_test/01: RuntimeError
-super_no_such_method4_test/01: RuntimeError
-super_no_such_method5_test/01: RuntimeError
-switch1_negative_test: Fail
-switch4_negative_test: DartkCrash
-switch_bad_case_test/01: MissingCompileTimeError
-switch_bad_case_test/02: MissingCompileTimeError
-switch_case_test/00: MissingCompileTimeError
-switch_case_test/01: MissingCompileTimeError
-switch_case_test/02: MissingCompileTimeError
-switch_label_test: DartkCrash
-sync_generator2_test/01: MissingCompileTimeError
-sync_generator2_test/02: MissingCompileTimeError
-sync_generator2_test/03: MissingCompileTimeError
-sync_generator2_test/04: MissingCompileTimeError
-sync_generator2_test/05: MissingCompileTimeError
-sync_generator2_test/06: MissingCompileTimeError
-sync_generator2_test/09: Crash
-sync_generator2_test/11: MissingCompileTimeError
-sync_generator2_test/20: MissingCompileTimeError
-sync_generator2_test/30: MissingCompileTimeError
-sync_generator2_test/40: MissingCompileTimeError
-sync_generator2_test/41: MissingCompileTimeError
-sync_generator2_test/51: MissingCompileTimeError
-sync_generator2_test/52: MissingCompileTimeError
-syntax_test/02: MissingCompileTimeError
-syntax_test/03: MissingCompileTimeError
-syntax_test/27: MissingCompileTimeError
-syntax_test/50: MissingCompileTimeError
-syntax_test/51: MissingCompileTimeError
-syntax_test/64: MissingCompileTimeError
-syntax_test/65: MissingCompileTimeError
-this_conditional_operator_test/01: MissingCompileTimeError
-toplevel_collision1_test/00: DartkCrash
-toplevel_collision1_test/01: DartkCrash
-toplevel_collision1_test/02: DartkCrash
-try_catch2_test: DartkCrash
-try_catch3_test: DartkCrash
-try_catch_syntax_test/01: MissingCompileTimeError
-try_catch_syntax_test/07: MissingCompileTimeError
-try_catch_syntax_test/09: MissingCompileTimeError
-try_catch_syntax_test/10: MissingCompileTimeError
-try_catch_syntax_test/11: MissingCompileTimeError
-try_catch_syntax_test/12: MissingCompileTimeError
-try_catch_syntax_test/16: Crash
-try_catch_syntax_test/17: Crash
-type_variable_conflict2_test/01: RuntimeError
-type_variable_conflict_test/01: MissingCompileTimeError
-type_variable_conflict_test/02: MissingCompileTimeError
-type_variable_conflict_test/03: MissingCompileTimeError
-type_variable_conflict_test/04: MissingCompileTimeError
-type_variable_conflict_test/05: MissingCompileTimeError
-type_variable_conflict_test/06: MissingCompileTimeError
-type_variable_scope3_test/00: MissingCompileTimeError
-vm/closure_memory_retention_test: Crash, Timeout
-vm/debug_break_enabled_vm_test/01: CompileTimeError
-vm/debug_break_enabled_vm_test/none: CompileTimeError
-vm/regress_27201_test: CompileTimeError
-vm/regress_28325_test: RuntimeError
-
-# dartk: JIT failures
-[ $compiler == dartk && $runtime == vm ]
-config_import_corelib_test: RuntimeError
-const_evaluation_test/01: RuntimeError
-const_syntax_test/08: MissingCompileTimeError
-const_syntax_test/09: MissingCompileTimeError
-deferred_constraints_constants_test/constructor1: MissingCompileTimeError
-deferred_constraints_constants_test/constructor2: MissingCompileTimeError
-deferred_constraints_constants_test/default_argument1: MissingCompileTimeError
-deferred_constraints_constants_test/default_argument2: MissingCompileTimeError
-deferred_constraints_constants_test/metadata1: MissingCompileTimeError
-deferred_constraints_constants_test/metadata2: MissingCompileTimeError
-deferred_constraints_constants_test/metadata3: MissingCompileTimeError
-deferred_constraints_constants_test/reference1: MissingCompileTimeError
-deferred_constraints_constants_test/reference2: MissingCompileTimeError
-final_syntax_test/09: Crash
-getter_declaration_negative_test: Fail
-getter_parameters_test/02: MissingCompileTimeError
-hello_dart_test: Crash
-instance_creation_in_function_annotation_test: RuntimeError
-label_test: CompileTimeError
-redirecting_factory_reflection_test: Crash
-ref_before_declaration_test/00: MissingCompileTimeError
-ref_before_declaration_test/01: MissingCompileTimeError
-ref_before_declaration_test/02: MissingCompileTimeError
-ref_before_declaration_test/03: MissingCompileTimeError
-ref_before_declaration_test/04: MissingCompileTimeError
-ref_before_declaration_test/05: MissingCompileTimeError
-ref_before_declaration_test/06: MissingCompileTimeError
-ref_before_declaration_test/07: MissingCompileTimeError
-setter_declaration2_negative_test: Fail
-setter_declaration_negative_test: Fail
-super_call4_test: RuntimeError
-super_getter_setter_test: RuntimeError
-try_catch_syntax_test/05: MissingCompileTimeError
-vm/lazy_deopt_vm_test: Timeout
-vm/optimized_stacktrace_test: Skip # Issue 28788
-ct_const2_test: Pass, Crash # Flaky
-
-# dartk: precompilation failures
-[ $compiler == dartkp && $runtime == dart_precompiled ]
-assignable_expression_test/01: MissingCompileTimeError
-assignable_expression_test/11: MissingCompileTimeError
-assignable_expression_test/21: MissingCompileTimeError
-assignable_expression_test/31: MissingCompileTimeError
-assignable_expression_test/41: MissingCompileTimeError
-config_import_corelib_test: RuntimeError
-const_syntax_test/08: Crash
-const_syntax_test/09: Crash
-constructor_duplicate_initializers_test/01: MissingCompileTimeError
-constructor_duplicate_initializers_test/02: MissingCompileTimeError
-constructor_return_test/01: MissingCompileTimeError
-constructor_return_test/02: MissingCompileTimeError
-constructor_return_test/03: MissingCompileTimeError
-constructor_return_test/04: MissingCompileTimeError
-constructor_return_test/05: MissingCompileTimeError
-factory_redirection3_cyclic_test/01: MissingCompileTimeError
-factory_redirection_test/04: MissingCompileTimeError
-final_syntax_test/09: MissingCompileTimeError
-getter_declaration_negative_test: Crash
-getter_no_setter2_test/02: MissingCompileTimeError
-getter_no_setter_test/02: MissingCompileTimeError
-getter_parameters_test/02: Crash
-if_null_assignment_behavior_test/29: MissingCompileTimeError
-if_null_assignment_behavior_test/30: MissingCompileTimeError
-illegal_initializer_test/01: MissingCompileTimeError
-illegal_initializer_test/02: MissingCompileTimeError
-illegal_initializer_test/03: MissingCompileTimeError
-illegal_initializer_test/04: MissingCompileTimeError
-illegal_invocation_test/01: MissingCompileTimeError
-label_test: RuntimeError
-main_not_a_function_test/01: Crash
-prefix_assignment_test/01: MissingCompileTimeError
-prefix_assignment_test/02: MissingCompileTimeError
-prefix_identifier_reference_test/01: MissingCompileTimeError
-prefix_identifier_reference_test/02: MissingCompileTimeError
-prefix_identifier_reference_test/03: MissingCompileTimeError
-prefix_identifier_reference_test/04: MissingCompileTimeError
-prefix_identifier_reference_test/05: MissingCompileTimeError
-prefix_unqualified_invocation_test/01: MissingCompileTimeError
-prefix_unqualified_invocation_test/02: MissingCompileTimeError
-ref_before_declaration_test/00: Crash
-ref_before_declaration_test/01: Crash
-ref_before_declaration_test/02: Crash
-ref_before_declaration_test/03: Crash
-ref_before_declaration_test/04: Crash
-ref_before_declaration_test/05: Crash
-ref_before_declaration_test/06: Crash
-ref_before_declaration_test/07: Crash
-ref_before_declaration_test/none: Crash
-regress_23038_test/01: MissingCompileTimeError
-setter_declaration2_negative_test: Crash
-setter_declaration_negative_test: Crash
-this_test/01: MissingCompileTimeError
-this_test/02: MissingCompileTimeError
-this_test/03: MissingCompileTimeError
-this_test/04: MissingCompileTimeError
-this_test/05: MissingCompileTimeError
-this_test/06: MissingCompileTimeError
-this_test/07: MissingCompileTimeError
-this_test/08: MissingCompileTimeError
-try_catch_syntax_test/05: Crash
-try_catch_syntax_test/13: MissingCompileTimeError
-try_catch_syntax_test/14: MissingCompileTimeError
-try_catch_syntax_test/15: MissingCompileTimeError
-type_variable_conflict2_test/02: MissingCompileTimeError
-type_variable_conflict2_test/06: MissingCompileTimeError
-type_variable_conflict2_test/08: MissingCompileTimeError
-type_variable_conflict2_test/10: MissingCompileTimeError
-unsupported_operators_test/01: MissingCompileTimeError
-unsupported_operators_test/02: MissingCompileTimeError
-unsupported_operators_test/03: MissingCompileTimeError
-unsupported_operators_test/04: MissingCompileTimeError
-
-###############################################################################
-# VM Entries
-###############################################################################
-
-# dartk: Shared JIT & Precompilation failures
-[ ($compiler == dartk && $runtime == vm) || ($compiler == dartkp && $runtime == dart_precompiled) ]
-abstract_beats_arguments_test: RuntimeError
-abstract_runtime_error_test/01: RuntimeError
-abstract_runtime_error_test/02: RuntimeError
accessor_conflict_export2_test: RuntimeError
accessor_conflict_export_test: RuntimeError
accessor_conflict_import2_test: RuntimeError
application_negative_test: Crash
arg_param_trailing_comma_test/107: MissingCompileTimeError
-arg_param_trailing_comma_test/112: DartkCrash
-arg_param_trailing_comma_test/115: DartkCrash
-arg_param_trailing_comma_test/121: DartkCrash
-arg_param_trailing_comma_test/124: DartkCrash
-arg_param_trailing_comma_test/14: DartkCrash
-arg_param_trailing_comma_test/17: DartkCrash
-arg_param_trailing_comma_test/171: DartkCrash
-arg_param_trailing_comma_test/174: DartkCrash
-arg_param_trailing_comma_test/180: DartkCrash
-arg_param_trailing_comma_test/183: DartkCrash
-arg_param_trailing_comma_test/193: DartkCrash
-arg_param_trailing_comma_test/196: DartkCrash
-arg_param_trailing_comma_test/202: DartkCrash
-arg_param_trailing_comma_test/205: DartkCrash
-arg_param_trailing_comma_test/31: DartkCrash
-arg_param_trailing_comma_test/34: DartkCrash
-arg_param_trailing_comma_test/40: DartkCrash
-arg_param_trailing_comma_test/43: DartkCrash
-arg_param_trailing_comma_test/5: DartkCrash
-arg_param_trailing_comma_test/53: DartkCrash
-arg_param_trailing_comma_test/56: DartkCrash
-arg_param_trailing_comma_test/62: DartkCrash
-arg_param_trailing_comma_test/65: DartkCrash
-arg_param_trailing_comma_test/79: DartkCrash
-arg_param_trailing_comma_test/8: DartkCrash
-arg_param_trailing_comma_test/82: DartkCrash
-arg_param_trailing_comma_test/88: DartkCrash
-arg_param_trailing_comma_test/91: DartkCrash
arg_param_trailing_comma_test/none: RuntimeError
assignable_expression_test/02: MissingCompileTimeError
assignable_expression_test/03: MissingCompileTimeError
@@ -765,7 +23,6 @@
assignable_expression_test/42: MissingCompileTimeError
assignable_expression_test/43: MissingCompileTimeError
assignable_expression_test/50: MissingCompileTimeError
-async_await_catch_regression_test: RuntimeError
async_await_syntax_test/a01b: MissingCompileTimeError
async_await_syntax_test/a01c: MissingCompileTimeError
async_await_syntax_test/a05f: MissingCompileTimeError
@@ -791,17 +48,12 @@
async_await_syntax_test/e1: MissingCompileTimeError
async_await_syntax_test/e2: MissingCompileTimeError
async_await_syntax_test/e3: MissingCompileTimeError
-async_await_test: Crash
-async_finally_rethrow_test: RuntimeError
async_return_types_test/return_value_sync_star: MissingCompileTimeError
-async_star_cancel_and_throw_in_finally_test: RuntimeError
async_star_pause_test: Crash
-async_star_test: Crash
+async_test/constructor2: DartkCrash
async_test/constructor3: MissingCompileTimeError
async_test/setter1: MissingCompileTimeError
-asyncstar_throw_in_catch_test: RuntimeError
await_backwards_compatibility_test/await1: MissingCompileTimeError
-await_exceptions_test: RuntimeError
await_test: RuntimeError
bad_constructor_test/05: CompileTimeError
bad_initializer1_negative_test: Crash
@@ -866,6 +118,7 @@
conditional_property_assignment_test/20: MissingCompileTimeError
conditional_property_assignment_test/21: MissingCompileTimeError
conditional_property_assignment_test/22: MissingCompileTimeError
+config_import_corelib_test: RuntimeError
config_import_test: RuntimeError
const_conditional_test/01: MissingCompileTimeError
const_conditional_test/02: MissingCompileTimeError
@@ -894,6 +147,7 @@
const_error_multiply_initialized_test/03: MissingCompileTimeError
const_error_multiply_initialized_test/04: RuntimeError
const_factory_with_body_test/01: MissingCompileTimeError
+const_for_in_variable_test/01: MissingCompileTimeError
const_instance_field_test/01: MissingCompileTimeError
const_map2_test/00: MissingCompileTimeError
const_map3_test/00: MissingCompileTimeError
@@ -910,10 +164,14 @@
const_syntax_test/10: Crash
const_syntax_test/11: MissingCompileTimeError
const_syntax_test/12: MissingCompileTimeError
+const_types_test/07: MissingCompileTimeError
+const_types_test/08: MissingCompileTimeError
const_types_test/09: MissingCompileTimeError
const_types_test/10: MissingCompileTimeError
const_types_test/11: MissingCompileTimeError
const_types_test/12: MissingCompileTimeError
+const_types_test/14: MissingCompileTimeError
+const_types_test/15: MissingCompileTimeError
const_types_test/16: MissingCompileTimeError
const_types_test/17: MissingCompileTimeError
const_types_test/18: MissingCompileTimeError
@@ -935,6 +193,7 @@
constant_locals_test/03: MissingCompileTimeError
constant_locals_test/04: MissingCompileTimeError
constant_locals_test/05: MissingCompileTimeError
+constant_type_literal_test/01: MissingCompileTimeError
constructor10_test/00: Crash
constructor10_test/01: Crash
constructor10_test/02: Crash
@@ -969,7 +228,6 @@
covariant_test/56: RuntimeError
covariant_test/59: MissingCompileTimeError
covariant_test/none: RuntimeError
-custom_await_stack_trace_test: RuntimeError
cyclic_class_member_test/01: MissingCompileTimeError
cyclic_constructor_test/01: MissingCompileTimeError
cyclic_type_test/00: RuntimeError
@@ -1039,7 +297,9 @@
deferred_not_loaded_check_test: RuntimeError
deferred_only_constant_test: RuntimeError
deferred_optimized_test: RuntimeError
+deferred_redirecting_factory_test: RuntimeError
deferred_regression_22995_test: RuntimeError
+deferred_regression_28678_test: RuntimeError
deferred_shadow_load_library_test: RuntimeError
deferred_shared_and_unshared_classes_test: RuntimeError
deferred_static_seperate_test: RuntimeError
@@ -1053,7 +313,7 @@
dynamic2_test/01: MissingCompileTimeError
dynamic_prefix_core_test/01: RuntimeError
enum_private_test/02: RuntimeError
-enum_syntax_test/11: DartkCrash
+enum_syntax_test/06: MissingCompileTimeError
enum_syntax_test/20: Crash
enum_syntax_test/21: MissingCompileTimeError
enum_syntax_test/22: Crash
@@ -1069,8 +329,11 @@
external_test/12: MissingCompileTimeError
external_test/13: MissingRuntimeError
external_test/20: MissingRuntimeError
+external_test/21: MissingCompileTimeError
external_test/22: MissingCompileTimeError
external_test/23: MissingCompileTimeError
+external_test/24: MissingCompileTimeError
+external_test/25: MissingCompileTimeError
external_test/30: MissingCompileTimeError
external_test/31: MissingCompileTimeError
factory2_negative_test: DartkCrash
@@ -1080,6 +343,10 @@
final_initializer_instance_reference_test/01: MissingCompileTimeError
final_is_not_const_test/01: MissingCompileTimeError
final_super_field_set_test/01: RuntimeError
+final_syntax_test/01: MissingCompileTimeError
+final_syntax_test/02: MissingCompileTimeError
+final_syntax_test/03: MissingCompileTimeError
+final_syntax_test/04: MissingCompileTimeError
first_class_types_literals_test/08: RuntimeError
for2_test: RuntimeError
for_variable_capture_test: RuntimeError
@@ -1103,6 +370,7 @@
function_syntax_test/71: MissingCompileTimeError
function_syntax_test/73: MissingCompileTimeError
function_syntax_test/74: MissingCompileTimeError
+function_type/function_type*: DartkCrash # Issue 27969
function_type_alias2_test: RuntimeError
function_type_alias3_test: RuntimeError
function_type_alias4_test: RuntimeError
@@ -1123,6 +391,8 @@
generic_field_mixin4_test: RuntimeError
generic_field_mixin5_test: RuntimeError
generic_field_mixin_test: RuntimeError
+generic_function_typedef2_test: DartkCrash # Issue 27969
+generic_function_typedef_test: DartkCrash # Issue 27969
generic_local_functions_test: DartkCrash
generic_metadata_test/02: MissingCompileTimeError
generic_metadata_test/03: MissingCompileTimeError
@@ -1133,15 +403,12 @@
getter_parameters_test/03: MissingCompileTimeError
getter_parameters_test/04: MissingCompileTimeError
getter_setter_in_lib_test: RuntimeError
-hidden_import_test/01: DartkCrash
-hidden_import_test/02: DartkCrash
-hidden_import_test/none: DartkCrash
if_null_assignment_behavior_test/09: RuntimeError
if_null_assignment_behavior_test/10: RuntimeError
if_null_assignment_behavior_test/15: RuntimeError
implicit_scope_test: Crash
import_combinators_test: RuntimeError
-import_private_test/01: DartkCrash
+import_private_test/01: MissingCompileTimeError
initializing_formal_capture_test: RuntimeError
initializing_formal_final_test: RuntimeError
inst_field_initializer1_negative_test: Fail
@@ -1161,6 +428,7 @@
isnot_malformed_type_test: RuntimeError
issue_1751477_test: RuntimeError
label6_negative_test: DartkCrash
+large_class_declaration_test: SkipSlow # KernelVM Issue 28312
library_ambiguous_test/00: MissingRuntimeError
library_ambiguous_test/04: MissingRuntimeError
library_ambiguous_test/05: MissingCompileTimeError
@@ -1168,7 +436,7 @@
library_env_test/has_no_io_support: RuntimeError
list_literal2_negative_test: Fail
list_literal4_test: RuntimeError
-list_literal_negative_test: DartkCrash
+main_not_a_function_test/01: Crash
malformed2_test/00: RuntimeError
malformed_inheritance_test/01: MissingCompileTimeError
malformed_inheritance_test/03: Crash
@@ -1183,7 +451,7 @@
map_literal2_negative_test: Fail
map_literal3_test: RuntimeError
map_literal6_test: RuntimeError
-map_literal_negative_test: DartkCrash
+metadata_test: CompileTimeError
method_name_test: CompileTimeError
method_override_test: RuntimeError
missing_const_constructor_test/02: MissingCompileTimeError
@@ -1218,6 +486,7 @@
mixin_illegal_cycles_test/06: MissingCompileTimeError
mixin_illegal_object_test/01: MissingCompileTimeError
mixin_illegal_object_test/02: MissingCompileTimeError
+mixin_illegal_syntax_test/00: DartkCrash
mixin_invalid_inheritance1_test/01: Crash
mixin_invalid_inheritance1_test/02: Crash
mixin_invalid_inheritance1_test/03: Crash
@@ -1247,32 +516,22 @@
multiline_newline_test/01: RuntimeError
multiline_newline_test/02: RuntimeError
multiline_newline_test/03: RuntimeError
+multiline_newline_test/04: MissingCompileTimeError
+multiline_newline_test/05: MissingCompileTimeError
+multiline_newline_test/06: MissingCompileTimeError
multiline_newline_test/none: RuntimeError
named_constructor_test/01: MissingRuntimeError
-named_constructor_test/02: DartkCrash
-named_constructor_test/04: DartkCrash
-named_constructor_test/05: DartkCrash
-named_constructor_test/06: DartkCrash
-named_constructor_test/07: DartkCrash
-named_constructor_test/08: DartkCrash
-named_constructor_test/09: DartkCrash
-named_constructor_test/10: DartkCrash
named_parameters_aggregated_test/01: MissingCompileTimeError
named_parameters_aggregated_test/03: MissingCompileTimeError
named_parameters_aggregated_test/04: MissingCompileTimeError
named_parameters_default_eq_test/01: MissingCompileTimeError
named_parameters_default_eq_test/02: MissingCompileTimeError
-new_expression1_negative_test: DartkCrash
no_main_test/01: Crash
not_enough_positional_arguments_test/02: MissingRuntimeError # Dartk Issue 28301
not_enough_positional_arguments_test/05: MissingRuntimeError # Dartk Issue 28301
number_identifier_test/02: MissingCompileTimeError
number_identifier_test/04: MissingCompileTimeError
on_catch_malformed_type_test: RuntimeError
-parameter_initializer1_negative_test: DartkCrash
-parameter_initializer2_negative_test: DartkCrash
-parameter_initializer3_negative_test: DartkCrash
-parameter_initializer4_negative_test: DartkCrash
parameter_initializer6_negative_test: Fail
part2_test: RuntimeError
prefix13_negative_test: Fail
@@ -1289,17 +548,14 @@
regress_20394_test/01: MissingCompileTimeError
regress_22438_test: RuntimeError
regress_22443_test: RuntimeError # Deferred Loading Issue 28335
-regress_22445_test: RuntimeError
-regress_22579_test: RuntimeError
regress_23408_test: RuntimeError # Deferred Loading Issue 28335
-regress_23498_test: RuntimeError
-regress_23500_test/01: RuntimeError
-regress_23500_test/02: RuntimeError
-regress_23500_test/none: RuntimeError
-regress_26855_test/0: DartkCrash
+regress_27617_test/1: MissingCompileTimeError
regress_27957_test: RuntimeError
+regress_28217_test/01: MissingCompileTimeError
+regress_28217_test/none: MissingCompileTimeError
regress_28278_test: RuntimeError # Mirrors Issue
reify_typevar_static_test/00: MissingCompileTimeError
+runtime_type_function_test: RuntimeError
scope_variable_test/01: MissingCompileTimeError
script1_negative_test: Fail
script2_negative_test: Fail
@@ -1376,11 +632,6 @@
syntax_test/64: MissingCompileTimeError
syntax_test/65: MissingCompileTimeError
this_conditional_operator_test/01: MissingCompileTimeError
-toplevel_collision1_test/00: DartkCrash
-toplevel_collision1_test/01: DartkCrash
-toplevel_collision1_test/02: DartkCrash
-try_catch2_test: DartkCrash
-try_catch3_test: DartkCrash
try_catch_on_syntax_test/10: MissingRuntimeError # Dartk Issue 28410
try_catch_on_syntax_test/11: MissingRuntimeError # Dartk Issue 28410
try_catch_syntax_test/01: MissingCompileTimeError
@@ -1400,17 +651,41 @@
type_variable_conflict_test/06: MissingCompileTimeError
type_variable_function_type_test: RuntimeError
type_variable_scope3_test/00: MissingCompileTimeError
+vm/causal_async_exception_stack_test: RuntimeError
+vm/debug_break_enabled_vm_test/01: CompileTimeError
+vm/debug_break_enabled_vm_test/none: CompileTimeError
+vm/regress_27201_test: CompileTimeError
+vm/regress_27671_test: RuntimeError
+vm/regress_28325_test: RuntimeError
vm/type_cast_vm_test: RuntimeError
vm/type_vm_test: RuntimeError
+# dartk: JIT & AOT failures (debug)
+[ ($compiler == dartk || $compiler == dartkp) && $mode == debug ]
+async_await_syntax_test/a05g: Crash
+async_await_syntax_test/a05h: Crash
+async_await_syntax_test/b10b: Crash
+async_await_syntax_test/c11a: Crash
+async_await_syntax_test/c11b: Crash
+const_instance_field_test/01: Crash
+list_literal2_negative_test: Crash
+switch1_negative_test: Crash
+type_parameter_test/04: Crash
+type_parameter_test/05: Crash
+
+# Triaged checked mode failures
+[ ($compiler == dartk || $compiler == dartkp) && $checked ]
+language/regress_22728_test: Fail # Dartk Issue 28498
+
# dartk: JIT failures
-[ $compiler == dartk && $runtime == vm ]
+[ $compiler == dartk ]
const_evaluation_test/01: RuntimeError
const_locals_test: RuntimeError
+const_string_test: RuntimeError # Dartk Issue 28306
const_syntax_test/08: MissingCompileTimeError
const_syntax_test/09: MissingCompileTimeError
constructor_named_arguments_test/01: Crash # Dartk Issue 28301
-const_string_test: RuntimeError # Dartk Issue 28306
+ct_const2_test: Pass, Crash # Flaky
deferred_constraints_constants_test/constructor1: MissingCompileTimeError
deferred_constraints_constants_test/constructor2: MissingCompileTimeError
deferred_constraints_constants_test/default_argument1: MissingCompileTimeError
@@ -1420,6 +695,7 @@
deferred_constraints_constants_test/metadata3: MissingCompileTimeError
deferred_constraints_constants_test/reference1: MissingCompileTimeError
deferred_constraints_constants_test/reference2: MissingCompileTimeError
+disassemble_test: Pass, Crash # Multitest via multiple VMOptions! Hits assert "kind() != RawScript::kKernelTag". Issue 28790
final_syntax_test/09: Crash
getter_declaration_negative_test: Fail
getter_parameters_test/02: MissingCompileTimeError
@@ -1427,8 +703,8 @@
instance_creation_in_function_annotation_test: RuntimeError
label_test: CompileTimeError
library_env_test/has_no_mirror_support: RuntimeError
-main_not_a_function_test/01: Crash
redirecting_factory_reflection_test: Crash
+redirecting_factory_reflection_test: RuntimeError
ref_before_declaration_test/00: MissingCompileTimeError
ref_before_declaration_test/01: MissingCompileTimeError
ref_before_declaration_test/02: MissingCompileTimeError
@@ -1442,25 +718,42 @@
super_call4_test: RuntimeError
super_getter_setter_test: RuntimeError
try_catch_syntax_test/05: MissingCompileTimeError
-vm/lazy_deopt_vm_test: Timeout
+vm/lazy_deopt_vm_test: Pass, Slow
+vm/lazy_deopt_vm_test: Pass, Timeout
+vm/optimized_stacktrace_test: Skip # Issue 28788
# dartk: JIT failures (debug)
-[ $compiler == dartk && $runtime == vm && $mode == debug ]
+[ $compiler == dartk && $mode == debug ]
+constructor_duplicate_initializers_test/03: Crash
+deopt_inlined_function_lazy_test: Timeout
+hello_dart_test: Crash # error: expected: cls.is_type_finalized()
not_enough_positional_arguments_test/02: Crash # Dartk Issue 28301
not_enough_positional_arguments_test/05: Crash # Dartk Issue 28301
+ref_before_declaration_test/00: Crash
+ref_before_declaration_test/01: Crash
+ref_before_declaration_test/02: Crash
+ref_before_declaration_test/03: Crash
+ref_before_declaration_test/04: Crash
+ref_before_declaration_test/05: Crash
+ref_before_declaration_test/06: Crash
+ref_before_declaration_test/07: Crash
+ref_before_declaration_test/none: Crash
+try_catch_syntax_test/05: Crash
# dartk: precompilation failures
-[ $compiler == dartkp && $runtime == dart_precompiled ]
+[ $compiler == dartkp ]
assignable_expression_test/01: MissingCompileTimeError
assignable_expression_test/11: MissingCompileTimeError
assignable_expression_test/21: MissingCompileTimeError
assignable_expression_test/31: MissingCompileTimeError
assignable_expression_test/41: MissingCompileTimeError
+bad_raw_string_test/03: Skip # Issue 28680
+bad_raw_string_test/none: Skip # Issue 28680
const_syntax_test/08: Crash
const_syntax_test/09: Crash
+constructor_duplicate_final_test/03: MissingCompileTimeError
constructor_duplicate_initializers_test/01: MissingCompileTimeError
constructor_duplicate_initializers_test/02: MissingCompileTimeError
-constructor_duplicate_final_test/03: MissingCompileTimeError
constructor_return_test/01: MissingCompileTimeError
constructor_return_test/02: MissingCompileTimeError
constructor_return_test/03: MissingCompileTimeError
@@ -1481,7 +774,6 @@
illegal_initializer_test/04: MissingCompileTimeError
illegal_invocation_test/01: MissingCompileTimeError
label_test: RuntimeError
-main_not_a_function_test/01: Crash
prefix_assignment_test/01: MissingCompileTimeError
prefix_assignment_test/02: MissingCompileTimeError
prefix_identifier_reference_test/01: MissingCompileTimeError
@@ -1515,6 +807,7 @@
try_catch_syntax_test/13: MissingCompileTimeError
try_catch_syntax_test/14: MissingCompileTimeError
try_catch_syntax_test/15: MissingCompileTimeError
+type_variable_conflict2_test/02: MissingCompileTimeError
type_variable_conflict2_test/06: MissingCompileTimeError
type_variable_conflict2_test/08: MissingCompileTimeError
type_variable_conflict2_test/10: MissingCompileTimeError
@@ -1524,1198 +817,8 @@
unsupported_operators_test/04: MissingCompileTimeError
# dartk: precompilation failures (debug)
-[ $compiler == dartkp && $runtime == dart_precompiled && $mode == debug ]
+[ $compiler == dartkp && $mode == debug ]
+external_test/13: Crash
+final_syntax_test/09: Crash
constructor_named_arguments_test/01: Crash # Dartk Issue 28301
not_enough_positional_arguments_test/05: Crash # Dartk Issue 28301
-
-# New failures after respecting VMOptions in test files
-[ $compiler == dartk || $compiler == dartkp ]
-abstract_beats_arguments_test: RuntimeError
-abstract_runtime_error_test/01: RuntimeError
-abstract_runtime_error_test/02: RuntimeError
-application_negative_test: Crash
-arg_param_trailing_comma_test/107: MissingCompileTimeError
-arg_param_trailing_comma_test/112: DartkCrash
-arg_param_trailing_comma_test/115: DartkCrash
-arg_param_trailing_comma_test/121: DartkCrash
-arg_param_trailing_comma_test/124: DartkCrash
-arg_param_trailing_comma_test/14: DartkCrash
-arg_param_trailing_comma_test/17: DartkCrash
-arg_param_trailing_comma_test/171: DartkCrash
-arg_param_trailing_comma_test/174: DartkCrash
-arg_param_trailing_comma_test/180: DartkCrash
-arg_param_trailing_comma_test/183: DartkCrash
-arg_param_trailing_comma_test/193: DartkCrash
-arg_param_trailing_comma_test/196: DartkCrash
-arg_param_trailing_comma_test/202: DartkCrash
-arg_param_trailing_comma_test/205: DartkCrash
-arg_param_trailing_comma_test/31: DartkCrash
-arg_param_trailing_comma_test/34: DartkCrash
-arg_param_trailing_comma_test/40: DartkCrash
-arg_param_trailing_comma_test/43: DartkCrash
-arg_param_trailing_comma_test/5: DartkCrash
-arg_param_trailing_comma_test/53: DartkCrash
-arg_param_trailing_comma_test/56: DartkCrash
-arg_param_trailing_comma_test/62: DartkCrash
-arg_param_trailing_comma_test/65: DartkCrash
-arg_param_trailing_comma_test/79: DartkCrash
-arg_param_trailing_comma_test/8: DartkCrash
-arg_param_trailing_comma_test/82: DartkCrash
-arg_param_trailing_comma_test/88: DartkCrash
-arg_param_trailing_comma_test/91: DartkCrash
-arg_param_trailing_comma_test/none: RuntimeError
-assignable_expression_test/02: MissingCompileTimeError
-assignable_expression_test/03: MissingCompileTimeError
-assignable_expression_test/12: MissingCompileTimeError
-assignable_expression_test/13: MissingCompileTimeError
-assignable_expression_test/22: MissingCompileTimeError
-assignable_expression_test/23: MissingCompileTimeError
-assignable_expression_test/32: MissingCompileTimeError
-assignable_expression_test/33: MissingCompileTimeError
-assignable_expression_test/42: MissingCompileTimeError
-assignable_expression_test/43: MissingCompileTimeError
-assignable_expression_test/50: MissingCompileTimeError
-async_await_catch_regression_test: RuntimeError
-async_await_syntax_test/a01b: MissingCompileTimeError
-async_await_syntax_test/a01c: MissingCompileTimeError
-async_await_syntax_test/a05f: MissingCompileTimeError
-async_await_syntax_test/a05g: MissingCompileTimeError
-async_await_syntax_test/a05h: MissingCompileTimeError
-async_await_syntax_test/a06b: MissingCompileTimeError
-async_await_syntax_test/a12e: MissingCompileTimeError
-async_await_syntax_test/a12f: MissingCompileTimeError
-async_await_syntax_test/b00a: DartkCrash
-async_await_syntax_test/b00b: DartkCrash
-async_await_syntax_test/b00c: DartkCrash
-async_await_syntax_test/b01b: MissingCompileTimeError
-async_await_syntax_test/b01c: MissingCompileTimeError
-async_await_syntax_test/b10b: MissingCompileTimeError
-async_await_syntax_test/b12e: MissingCompileTimeError
-async_await_syntax_test/b12f: MissingCompileTimeError
-async_await_syntax_test/c01b: MissingCompileTimeError
-async_await_syntax_test/c01c: MissingCompileTimeError
-async_await_syntax_test/c11a: MissingCompileTimeError
-async_await_syntax_test/c11b: MissingCompileTimeError
-async_await_syntax_test/d01b: MissingCompileTimeError
-async_await_syntax_test/d01c: MissingCompileTimeError
-async_await_syntax_test/e1: MissingCompileTimeError
-async_await_syntax_test/e2: MissingCompileTimeError
-async_await_syntax_test/e3: MissingCompileTimeError
-async_await_test: Crash
-async_finally_rethrow_test: RuntimeError
-async_return_types_test/return_value_sync_star: MissingCompileTimeError
-async_star_cancel_and_throw_in_finally_test: RuntimeError
-async_star_pause_test: Crash
-async_star_test: Crash
-async_test/constructor3: MissingCompileTimeError
-async_test/setter1: MissingCompileTimeError
-asyncstar_throw_in_catch_test: RuntimeError
-await_backwards_compatibility_test/await1: MissingCompileTimeError
-await_exceptions_test: RuntimeError
-await_test: RuntimeError
-bad_constructor_test/05: CompileTimeError
-bad_initializer1_negative_test: Crash
-black_listed_test/13: MissingCompileTimeError
-body_less_constructor_wrong_arg_negative_test: Crash
-built_in_identifier_illegal_test/01: MissingCompileTimeError
-built_in_identifier_illegal_test/04: MissingCompileTimeError
-built_in_identifier_illegal_test/05: MissingCompileTimeError
-built_in_identifier_illegal_test/06: MissingCompileTimeError
-built_in_identifier_illegal_test/07: MissingCompileTimeError
-built_in_identifier_illegal_test/08: MissingCompileTimeError
-built_in_identifier_illegal_test/10: MissingCompileTimeError
-built_in_identifier_illegal_test/12: MissingCompileTimeError
-built_in_identifier_illegal_test/13: MissingCompileTimeError
-built_in_identifier_illegal_test/15: MissingCompileTimeError
-built_in_identifier_illegal_test/16: MissingCompileTimeError
-built_in_identifier_illegal_test/17: MissingCompileTimeError
-built_in_identifier_illegal_test/18: MissingCompileTimeError
-built_in_identifier_illegal_test/19: MissingCompileTimeError
-built_in_identifier_illegal_test/20: MissingCompileTimeError
-built_in_identifier_test/01: CompileTimeError
-call_nonexistent_static_test/01: RuntimeError
-call_nonexistent_static_test/04: RuntimeError
-call_nonexistent_static_test/06: RuntimeError
-class_cycle2_test/01: MissingCompileTimeError
-class_cycle2_test/02: MissingCompileTimeError
-class_cycle_test/00: MissingCompileTimeError
-class_cycle_test/01: MissingCompileTimeError
-compile_time_constant10_test/01: Crash
-compile_time_constant10_test/02: Crash
-compile_time_constant13_test/02: Crash
-compile_time_constant13_test/03: MissingCompileTimeError
-compile_time_constant13_test/04: Crash
-compile_time_constant13_test/05: Crash
-compile_time_constant_arguments_test/01: MissingCompileTimeError
-compile_time_constant_arguments_test/02: MissingCompileTimeError
-compile_time_constant_arguments_test/03: MissingCompileTimeError
-compile_time_constant_arguments_test/04: MissingCompileTimeError
-compile_time_constant_arguments_test/05: MissingCompileTimeError
-compile_time_constant_arguments_test/06: MissingCompileTimeError
-compile_time_constant_c_test/02: MissingCompileTimeError
-compile_time_constant_c_test/03: MissingCompileTimeError
-compile_time_constant_p_test/01: Crash
-compile_time_constant_r_test/01: Crash
-compile_time_constant_r_test/02: Crash
-compile_time_constant_r_test/03: Crash
-compile_time_constant_test/01: MissingCompileTimeError
-compile_time_constant_test/02: Crash
-conditional_import_string_test: RuntimeError
-conditional_import_test: RuntimeError
-conditional_method_invocation_test/11: MissingCompileTimeError
-conditional_property_access_test/09: MissingCompileTimeError
-conditional_property_assignment_test/20: MissingCompileTimeError
-conditional_property_assignment_test/21: MissingCompileTimeError
-conditional_property_assignment_test/22: MissingCompileTimeError
-const_conditional_test/01: MissingCompileTimeError
-const_conditional_test/02: MissingCompileTimeError
-const_conditional_test/03: MissingCompileTimeError
-const_conditional_test/04: MissingCompileTimeError
-const_conditional_test/05: MissingCompileTimeError
-const_conditional_test/06: MissingCompileTimeError
-const_conditional_test/07: MissingCompileTimeError
-const_conditional_test/08: MissingCompileTimeError
-const_conditional_test/09: MissingCompileTimeError
-const_conditional_test/10: MissingCompileTimeError
-const_constructor_mixin2_test/01: MissingCompileTimeError
-const_constructor_mixin3_test/01: MissingCompileTimeError
-const_constructor_mixin_test/01: MissingCompileTimeError
-const_constructor_nonconst_field_test/01: MissingCompileTimeError
-const_constructor_super_test/01: MissingCompileTimeError
-const_constructor_super_test/02: Crash
-const_constructor_syntax_test/01: MissingCompileTimeError
-const_constructor_syntax_test/02: MissingCompileTimeError
-const_constructor_syntax_test/03: MissingCompileTimeError
-const_constructor_syntax_test/04: MissingCompileTimeError
-const_constructor_test/01: MissingCompileTimeError
-const_error_multiply_initialized_test/01: MissingCompileTimeError
-const_error_multiply_initialized_test/03: MissingCompileTimeError
-const_factory_with_body_test/01: MissingCompileTimeError
-const_instance_field_test/01: MissingCompileTimeError
-const_map2_test/00: MissingCompileTimeError
-const_map3_test/00: MissingCompileTimeError
-const_optional_args_negative_test: Fail
-const_switch2_test/01: MissingCompileTimeError
-const_syntax_test/01: MissingCompileTimeError
-const_syntax_test/02: MissingCompileTimeError
-const_syntax_test/03: MissingCompileTimeError
-const_syntax_test/04: MissingCompileTimeError
-const_syntax_test/05: MissingCompileTimeError
-const_syntax_test/06: MissingCompileTimeError
-const_syntax_test/07: MissingCompileTimeError
-const_syntax_test/10: Crash
-const_syntax_test/11: MissingCompileTimeError
-const_syntax_test/12: MissingCompileTimeError
-const_types_test/09: MissingCompileTimeError
-const_types_test/10: MissingCompileTimeError
-const_types_test/11: MissingCompileTimeError
-const_types_test/12: MissingCompileTimeError
-const_types_test/16: MissingCompileTimeError
-const_types_test/17: MissingCompileTimeError
-const_types_test/18: MissingCompileTimeError
-const_types_test/19: MissingCompileTimeError
-const_types_test/20: MissingCompileTimeError
-const_types_test/21: MissingCompileTimeError
-const_types_test/22: MissingCompileTimeError
-const_types_test/23: MissingCompileTimeError
-const_types_test/24: MissingCompileTimeError
-const_types_test/25: MissingCompileTimeError
-const_types_test/26: MissingCompileTimeError
-const_types_test/27: MissingCompileTimeError
-const_types_test/28: MissingCompileTimeError
-const_types_test/29: MissingCompileTimeError
-const_types_test/30: MissingCompileTimeError
-const_types_test/41: MissingCompileTimeError
-constant_locals_test/01: MissingCompileTimeError
-constant_locals_test/02: MissingCompileTimeError
-constant_locals_test/03: MissingCompileTimeError
-constant_locals_test/04: MissingCompileTimeError
-constant_locals_test/05: MissingCompileTimeError
-constructor10_test/00: Crash
-constructor10_test/01: Crash
-constructor10_test/02: Crash
-constructor_duplicate_initializers_test/03: MissingCompileTimeError
-constructor_redirect2_test/01: MissingCompileTimeError
-constructor_redirect_test/01: MissingCompileTimeError
-covariant_test/00c: RuntimeError
-covariant_test/02: MissingCompileTimeError
-covariant_test/08: MissingCompileTimeError
-covariant_test/12: MissingCompileTimeError
-covariant_test/14: MissingCompileTimeError
-covariant_test/16: MissingCompileTimeError
-covariant_test/19: MissingCompileTimeError
-covariant_test/20c: RuntimeError
-covariant_test/22: MissingCompileTimeError
-covariant_test/28: MissingCompileTimeError
-covariant_test/32: MissingCompileTimeError
-covariant_test/34: MissingCompileTimeError
-covariant_test/36: MissingCompileTimeError
-covariant_test/39: MissingCompileTimeError
-covariant_test/40: RuntimeError
-covariant_test/40b: RuntimeError
-covariant_test/40c: RuntimeError
-covariant_test/42: RuntimeError
-covariant_test/46: MissingCompileTimeError
-covariant_test/46b: MissingCompileTimeError
-covariant_test/48: RuntimeError
-covariant_test/52: RuntimeError
-covariant_test/54: RuntimeError
-covariant_test/56: RuntimeError
-covariant_test/59: MissingCompileTimeError
-covariant_test/none: RuntimeError
-custom_await_stack_trace_test: RuntimeError
-cyclic_class_member_test/01: MissingCompileTimeError
-cyclic_constructor_test/01: MissingCompileTimeError
-cyclic_typedef_test/01: MissingCompileTimeError
-cyclic_typedef_test/02: MissingCompileTimeError
-cyclic_typedef_test/03: MissingCompileTimeError
-cyclic_typedef_test/04: MissingCompileTimeError
-cyclic_typedef_test/05: MissingCompileTimeError
-cyclic_typedef_test/06: MissingCompileTimeError
-cyclic_typedef_test/07: MissingCompileTimeError
-cyclic_typedef_test/08: MissingCompileTimeError
-cyclic_typedef_test/09: MissingCompileTimeError
-cyclic_typedef_test/10: MissingCompileTimeError
-cyclic_typedef_test/11: MissingCompileTimeError
-deferred_duplicate_prefix1_test/01: MissingCompileTimeError
-deferred_duplicate_prefix2_test/01: MissingCompileTimeError
-deferred_duplicate_prefix3_test/01: MissingCompileTimeError
-deferred_inheritance_constraints_test/extends: MissingCompileTimeError
-deferred_inheritance_constraints_test/implements: MissingCompileTimeError
-deferred_inheritance_constraints_test/mixin: MissingCompileTimeError
-deferred_load_constants_test/01: MissingCompileTimeError
-deferred_load_constants_test/02: MissingCompileTimeError
-deferred_load_constants_test/03: MissingCompileTimeError
-deferred_load_constants_test/04: MissingCompileTimeError
-deferred_load_constants_test/05: MissingCompileTimeError
-deferred_no_prefix_test/01: MissingCompileTimeError
-duplicate_export_negative_test: DartkCrash
-dynamic2_test/00: MissingCompileTimeError
-dynamic2_test/01: MissingCompileTimeError
-dynamic_prefix_core_test/01: RuntimeError
-enum_private_test/02: RuntimeError
-enum_syntax_test/11: DartkCrash
-enum_syntax_test/20: Crash
-enum_syntax_test/21: MissingCompileTimeError
-enum_syntax_test/22: Crash
-enum_syntax_test/30: MissingCompileTimeError
-export_ambiguous_main_negative_test: Crash
-export_double_same_main_test: Crash
-export_main_test: Crash
-export_private_test/01: MissingCompileTimeError
-extend_type_parameter2_negative_test: DartkCrash
-extend_type_parameter_negative_test: DartkCrash
-external_test/11: MissingCompileTimeError
-external_test/12: MissingCompileTimeError
-external_test/22: MissingCompileTimeError
-external_test/23: MissingCompileTimeError
-external_test/30: MissingCompileTimeError
-external_test/31: MissingCompileTimeError
-factory2_negative_test: DartkCrash
-factory_negative_test: DartkCrash
-factory_redirection_test/07: MissingCompileTimeError
-field_decl_missing_var_type_test/01: MissingCompileTimeError
-final_initializer_instance_reference_test/01: MissingCompileTimeError
-final_is_not_const_test/01: MissingCompileTimeError
-final_super_field_set_test/01: RuntimeError
-first_class_types_literals_test/08: RuntimeError
-function_subtype0_test: RuntimeError
-function_subtype1_test: RuntimeError
-function_syntax_test/00: MissingCompileTimeError
-function_syntax_test/01: MissingCompileTimeError
-function_syntax_test/22: MissingCompileTimeError
-function_syntax_test/64: MissingCompileTimeError
-function_syntax_test/67: MissingCompileTimeError
-function_syntax_test/68: MissingCompileTimeError
-function_syntax_test/69: MissingCompileTimeError
-function_syntax_test/71: MissingCompileTimeError
-function_syntax_test/73: MissingCompileTimeError
-function_syntax_test/74: MissingCompileTimeError
-function_type_alias5_test/00: MissingCompileTimeError
-function_type_alias5_test/01: MissingCompileTimeError
-function_type_alias5_test/02: MissingCompileTimeError
-function_type_alias6_test/00: MissingCompileTimeError
-function_type_alias7_test/00: MissingCompileTimeError
-function_type_alias7_test/01: DartkCrash
-function_type_alias7_test/02: MissingCompileTimeError
-function_type_alias9_test/00: MissingCompileTimeError
-function_type_parameter2_negative_test: Crash
-function_type_parameter_negative_test: Crash
-generic_constructor_mixin3_test: Crash
-generic_field_mixin2_test: RuntimeError
-generic_field_mixin3_test: RuntimeError
-generic_field_mixin5_test: RuntimeError
-generic_field_mixin_test: RuntimeError
-generic_local_functions_test: DartkCrash
-generic_metadata_test/02: MissingCompileTimeError
-generic_metadata_test/03: MissingCompileTimeError
-generic_methods_generic_function_parameter_test: DartkCrash
-getter_parameters_test/01: MissingCompileTimeError
-getter_parameters_test/03: MissingCompileTimeError
-getter_parameters_test/04: MissingCompileTimeError
-hidden_import_test/01: DartkCrash
-hidden_import_test/02: DartkCrash
-hidden_import_test/none: DartkCrash
-if_null_assignment_behavior_test/09: RuntimeError
-if_null_assignment_behavior_test/10: RuntimeError
-if_null_assignment_behavior_test/15: RuntimeError
-implicit_scope_test: Crash
-import_combinators_test: RuntimeError
-import_private_test/01: DartkCrash
-initializing_formal_capture_test: RuntimeError
-inst_field_initializer1_negative_test: Fail
-instanceof3_test: RuntimeError
-interface2_negative_test: Fail
-interface_cycle_test/01: MissingCompileTimeError
-interface_cycle_test/02: MissingCompileTimeError
-invocation_mirror_test: RuntimeError
-is_malformed_type_test/94: RuntimeError
-is_malformed_type_test/95: RuntimeError
-is_malformed_type_test/96: RuntimeError
-is_malformed_type_test/97: RuntimeError
-is_malformed_type_test/98: RuntimeError
-is_malformed_type_test/99: RuntimeError
-is_not_class4_negative_test: Fail
-isnot_malformed_type_test: RuntimeError
-label6_negative_test: DartkCrash
-library_ambiguous_test/00: MissingRuntimeError
-library_ambiguous_test/04: MissingRuntimeError
-library_ambiguous_test/05: MissingCompileTimeError
-list_literal2_negative_test: Fail
-list_literal_negative_test: DartkCrash
-malformed2_test/00: RuntimeError
-malformed_inheritance_test/01: MissingCompileTimeError
-malformed_inheritance_test/03: Crash
-malformed_inheritance_test/05: MissingCompileTimeError
-malformed_inheritance_test/07: DartkCrash
-malformed_inheritance_test/08: DartkCrash
-malformed_inheritance_test/09: MissingCompileTimeError
-malformed_inheritance_test/10: MissingCompileTimeError
-malformed_inheritance_test/11: DartkCrash
-malformed_inheritance_test/12: DartkCrash
-map_literal2_negative_test: Fail
-map_literal_negative_test: DartkCrash
-method_name_test: CompileTimeError
-missing_const_constructor_test/02: MissingCompileTimeError
-missing_const_constructor_test/03: MissingCompileTimeError
-missing_const_constructor_test/04: Crash
-missing_const_constructor_test/05: MissingCompileTimeError
-missing_const_constructor_test/06: MissingCompileTimeError
-missing_part_of_tag_test/01: MissingCompileTimeError
-mixin_black_listed_test/08: DartkCrash
-mixin_cyclic_test/01: MissingCompileTimeError
-mixin_cyclic_test/02: MissingCompileTimeError
-mixin_forwarding_constructor4_test/01: MissingCompileTimeError
-mixin_forwarding_constructor4_test/02: MissingCompileTimeError
-mixin_forwarding_constructor4_test/03: MissingCompileTimeError
-mixin_illegal_constructor_test/01: MissingCompileTimeError
-mixin_illegal_constructor_test/02: MissingCompileTimeError
-mixin_illegal_constructor_test/03: MissingCompileTimeError
-mixin_illegal_constructor_test/04: MissingCompileTimeError
-mixin_illegal_constructor_test/05: MissingCompileTimeError
-mixin_illegal_constructor_test/06: MissingCompileTimeError
-mixin_illegal_constructor_test/07: MissingCompileTimeError
-mixin_illegal_constructor_test/08: MissingCompileTimeError
-mixin_illegal_constructor_test/09: MissingCompileTimeError
-mixin_illegal_constructor_test/10: MissingCompileTimeError
-mixin_illegal_constructor_test/11: MissingCompileTimeError
-mixin_illegal_constructor_test/12: MissingCompileTimeError
-mixin_illegal_cycles_test/01: MissingCompileTimeError
-mixin_illegal_cycles_test/02: MissingCompileTimeError
-mixin_illegal_cycles_test/03: MissingCompileTimeError
-mixin_illegal_cycles_test/04: MissingCompileTimeError
-mixin_illegal_cycles_test/05: MissingCompileTimeError
-mixin_illegal_cycles_test/06: MissingCompileTimeError
-mixin_illegal_object_test/01: MissingCompileTimeError
-mixin_illegal_object_test/02: MissingCompileTimeError
-mixin_invalid_inheritance1_test/01: Crash
-mixin_invalid_inheritance1_test/02: Crash
-mixin_invalid_inheritance1_test/03: Crash
-mixin_invalid_inheritance2_test/01: MissingCompileTimeError
-mixin_invalid_inheritance2_test/02: MissingCompileTimeError
-mixin_invalid_inheritance2_test/03: DartkCrash
-mixin_issue10216_2_test: RuntimeError
-mixin_mixin2_test: RuntimeError
-mixin_mixin3_test: RuntimeError
-mixin_mixin4_test: RuntimeError
-mixin_mixin5_test: RuntimeError
-mixin_mixin6_test: RuntimeError
-mixin_mixin7_test: RuntimeError
-mixin_mixin_bound2_test: RuntimeError
-mixin_mixin_bound_test: RuntimeError
-mixin_mixin_test: RuntimeError
-mixin_of_mixin_test/03: RuntimeError
-mixin_of_mixin_test/14: RuntimeError
-mixin_super_constructor_named_test/01: MissingCompileTimeError
-mixin_super_constructor_positionals_test/01: MissingCompileTimeError
-mixin_super_test: RuntimeError
-mixin_type_parameters_errors_test/01: DartkCrash
-mixin_type_parameters_errors_test/02: DartkCrash
-mixin_type_parameters_errors_test/05: DartkCrash
-multiline_newline_test/01: RuntimeError
-multiline_newline_test/02: RuntimeError
-multiline_newline_test/03: RuntimeError
-named_constructor_test/01: MissingRuntimeError
-named_constructor_test/02: DartkCrash
-named_constructor_test/04: DartkCrash
-named_constructor_test/05: DartkCrash
-named_constructor_test/06: DartkCrash
-named_constructor_test/07: DartkCrash
-named_constructor_test/08: DartkCrash
-named_constructor_test/09: DartkCrash
-named_constructor_test/10: DartkCrash
-named_parameters_aggregated_test/01: MissingCompileTimeError
-named_parameters_aggregated_test/03: MissingCompileTimeError
-named_parameters_aggregated_test/04: MissingCompileTimeError
-named_parameters_default_eq_test/01: MissingCompileTimeError
-named_parameters_default_eq_test/02: MissingCompileTimeError
-new_expression1_negative_test: DartkCrash
-no_main_test/01: Crash
-number_identifier_test/02: MissingCompileTimeError
-number_identifier_test/04: MissingCompileTimeError
-on_catch_malformed_type_test: RuntimeError
-parameter_initializer1_negative_test: DartkCrash
-parameter_initializer2_negative_test: DartkCrash
-parameter_initializer3_negative_test: DartkCrash
-parameter_initializer4_negative_test: DartkCrash
-parameter_initializer6_negative_test: Fail
-part2_test: RuntimeError
-prefix13_negative_test: Fail
-prefix15_negative_test: Fail
-private_access_test/05: RuntimeError
-private_access_test/06: RuntimeError
-private_super_constructor_test/01: MissingCompileTimeError
-redirecting_factory_default_values_test/01: MissingCompileTimeError
-redirecting_factory_default_values_test/02: MissingCompileTimeError
-redirecting_factory_infinite_steps_test/02: Crash
-redirecting_factory_long_test: RuntimeError
-regress_13494_test: RuntimeError
-regress_20394_test/01: MissingCompileTimeError
-regress_22438_test: RuntimeError
-regress_22445_test: RuntimeError
-regress_22579_test: RuntimeError
-regress_23498_test: RuntimeError
-regress_23500_test/01: RuntimeError
-regress_23500_test/02: RuntimeError
-regress_23500_test/none: RuntimeError
-regress_26855_test/0: DartkCrash
-regress_27957_test: RuntimeError
-reify_typevar_static_test/00: MissingCompileTimeError
-scope_variable_test/01: MissingCompileTimeError
-setter0_test: RuntimeError
-setter4_test: CompileTimeError
-setter_override_test/01: RuntimeError
-setter_override_test/02: RuntimeError
-setter_override_test/none: RuntimeError
-source_self_negative_test: DartkCrash
-static_final_field2_test/02: MissingCompileTimeError
-static_parameter_test/01: MissingCompileTimeError
-static_parameter_test/02: MissingCompileTimeError
-static_parameter_test/03: MissingCompileTimeError
-static_parameter_test/04: MissingCompileTimeError
-static_parameter_test/05: MissingCompileTimeError
-static_parameter_test/06: MissingCompileTimeError
-static_parameter_test/07: MissingCompileTimeError
-static_parameter_test/08: MissingCompileTimeError
-static_parameter_test/09: MissingCompileTimeError
-static_parameter_test/10: MissingCompileTimeError
-static_parameter_test/11: MissingCompileTimeError
-static_parameter_test/12: MissingCompileTimeError
-super_call3_test/02: Crash
-super_conditional_operator_test/01: MissingCompileTimeError
-super_conditional_operator_test/02: MissingCompileTimeError
-super_conditional_operator_test/03: MissingCompileTimeError
-super_conditional_operator_test/04: MissingCompileTimeError
-super_conditional_operator_test/05: MissingCompileTimeError
-super_conditional_operator_test/06: MissingCompileTimeError
-super_conditional_operator_test/07: MissingCompileTimeError
-super_conditional_operator_test/08: MissingCompileTimeError
-super_conditional_operator_test/09: MissingCompileTimeError
-super_conditional_operator_test/10: MissingCompileTimeError
-super_conditional_operator_test/11: MissingCompileTimeError
-super_conditional_operator_test/12: MissingCompileTimeError
-super_conditional_operator_test/13: MissingCompileTimeError
-super_conditional_operator_test/14: MissingCompileTimeError
-super_conditional_operator_test/15: MissingCompileTimeError
-super_conditional_operator_test/16: MissingCompileTimeError
-super_conditional_operator_test/17: MissingCompileTimeError
-super_conditional_operator_test/18: MissingCompileTimeError
-super_no_such_method1_test/01: RuntimeError
-super_no_such_method2_test/01: RuntimeError
-super_no_such_method3_test/01: RuntimeError
-super_no_such_method4_test/01: RuntimeError
-super_no_such_method5_test/01: RuntimeError
-switch1_negative_test: Fail
-switch4_negative_test: DartkCrash
-switch_bad_case_test/01: MissingCompileTimeError
-switch_bad_case_test/02: MissingCompileTimeError
-switch_case_test/00: MissingCompileTimeError
-switch_case_test/01: MissingCompileTimeError
-switch_case_test/02: MissingCompileTimeError
-switch_label_test: DartkCrash
-sync_generator2_test/01: MissingCompileTimeError
-sync_generator2_test/02: MissingCompileTimeError
-sync_generator2_test/03: MissingCompileTimeError
-sync_generator2_test/04: MissingCompileTimeError
-sync_generator2_test/05: MissingCompileTimeError
-sync_generator2_test/06: MissingCompileTimeError
-sync_generator2_test/09: Crash
-sync_generator2_test/11: MissingCompileTimeError
-sync_generator2_test/20: MissingCompileTimeError
-sync_generator2_test/30: MissingCompileTimeError
-sync_generator2_test/40: MissingCompileTimeError
-sync_generator2_test/41: MissingCompileTimeError
-sync_generator2_test/51: MissingCompileTimeError
-sync_generator2_test/52: MissingCompileTimeError
-syntax_test/02: MissingCompileTimeError
-syntax_test/03: MissingCompileTimeError
-syntax_test/27: MissingCompileTimeError
-syntax_test/50: MissingCompileTimeError
-syntax_test/51: MissingCompileTimeError
-syntax_test/64: MissingCompileTimeError
-syntax_test/65: MissingCompileTimeError
-this_conditional_operator_test/01: MissingCompileTimeError
-toplevel_collision1_test/00: DartkCrash
-toplevel_collision1_test/01: DartkCrash
-toplevel_collision1_test/02: DartkCrash
-try_catch2_test: DartkCrash
-try_catch3_test: DartkCrash
-try_catch_syntax_test/01: MissingCompileTimeError
-try_catch_syntax_test/07: MissingCompileTimeError
-try_catch_syntax_test/09: MissingCompileTimeError
-try_catch_syntax_test/10: MissingCompileTimeError
-try_catch_syntax_test/11: MissingCompileTimeError
-try_catch_syntax_test/12: MissingCompileTimeError
-try_catch_syntax_test/16: Crash
-try_catch_syntax_test/17: Crash
-type_variable_conflict2_test/01: RuntimeError
-type_variable_conflict_test/01: MissingCompileTimeError
-type_variable_conflict_test/02: MissingCompileTimeError
-type_variable_conflict_test/03: MissingCompileTimeError
-type_variable_conflict_test/04: MissingCompileTimeError
-type_variable_conflict_test/05: MissingCompileTimeError
-type_variable_conflict_test/06: MissingCompileTimeError
-type_variable_scope3_test/00: MissingCompileTimeError
-vm/regress_27671_test: RuntimeError
-
-# New failures after respecting VMOptions in test files
-[ $compiler == dartk && $runtime == vm && $mode == debug]
-hello_dart_test: Crash # error: expected: cls.is_type_finalized()
-
-# New failures after respecting VMOptions in test files
-[ $compiler == dartk && $runtime == vm ]
-const_evaluation_test/01: RuntimeError
-const_syntax_test/08: MissingCompileTimeError
-const_syntax_test/09: MissingCompileTimeError
-deferred_constraints_constants_test/constructor1: MissingCompileTimeError
-deferred_constraints_constants_test/constructor2: MissingCompileTimeError
-deferred_constraints_constants_test/default_argument1: MissingCompileTimeError
-deferred_constraints_constants_test/default_argument2: MissingCompileTimeError
-deferred_constraints_constants_test/metadata1: MissingCompileTimeError
-deferred_constraints_constants_test/metadata2: MissingCompileTimeError
-deferred_constraints_constants_test/metadata3: MissingCompileTimeError
-deferred_constraints_constants_test/reference1: MissingCompileTimeError
-deferred_constraints_constants_test/reference2: MissingCompileTimeError
-final_syntax_test/09: Crash
-getter_declaration_negative_test: Fail
-getter_parameters_test/02: MissingCompileTimeError
-hello_dart_test: Crash
-disassemble_test: Pass, Crash # Multitest via multiple VMOptions! Hits assert "kind() != RawScript::kKernelTag". Issue 28790
-instance_creation_in_function_annotation_test: RuntimeError
-label_test: CompileTimeError
-redirecting_factory_reflection_test: Crash
-ref_before_declaration_test/00: MissingCompileTimeError
-ref_before_declaration_test/01: MissingCompileTimeError
-ref_before_declaration_test/02: MissingCompileTimeError
-ref_before_declaration_test/03: MissingCompileTimeError
-ref_before_declaration_test/04: MissingCompileTimeError
-ref_before_declaration_test/05: MissingCompileTimeError
-ref_before_declaration_test/06: MissingCompileTimeError
-ref_before_declaration_test/07: MissingCompileTimeError
-setter_declaration2_negative_test: Fail
-setter_declaration_negative_test: Fail
-super_call4_test: RuntimeError
-super_getter_setter_test: RuntimeError
-try_catch_syntax_test/05: MissingCompileTimeError
-vm/lazy_deopt_vm_test: Timeout
-
-# Failures during Gardening shift: To be triaged!
-[ $compiler == dartk || $compiler == dartkp ]
-abstract_beats_arguments_test: RuntimeError
-abstract_runtime_error_test/01: RuntimeError
-abstract_runtime_error_test/02: RuntimeError
-application_negative_test: Crash
-arg_param_trailing_comma_test/107: MissingCompileTimeError
-arg_param_trailing_comma_test/112: DartkCrash
-arg_param_trailing_comma_test/115: DartkCrash
-arg_param_trailing_comma_test/121: DartkCrash
-arg_param_trailing_comma_test/124: DartkCrash
-arg_param_trailing_comma_test/14: DartkCrash
-arg_param_trailing_comma_test/17: DartkCrash
-arg_param_trailing_comma_test/171: DartkCrash
-arg_param_trailing_comma_test/174: DartkCrash
-arg_param_trailing_comma_test/180: DartkCrash
-arg_param_trailing_comma_test/183: DartkCrash
-arg_param_trailing_comma_test/193: DartkCrash
-arg_param_trailing_comma_test/196: DartkCrash
-arg_param_trailing_comma_test/202: DartkCrash
-arg_param_trailing_comma_test/205: DartkCrash
-arg_param_trailing_comma_test/31: DartkCrash
-arg_param_trailing_comma_test/34: DartkCrash
-arg_param_trailing_comma_test/40: DartkCrash
-arg_param_trailing_comma_test/43: DartkCrash
-arg_param_trailing_comma_test/5: DartkCrash
-arg_param_trailing_comma_test/53: DartkCrash
-arg_param_trailing_comma_test/56: DartkCrash
-arg_param_trailing_comma_test/62: DartkCrash
-arg_param_trailing_comma_test/65: DartkCrash
-arg_param_trailing_comma_test/79: DartkCrash
-arg_param_trailing_comma_test/8: DartkCrash
-arg_param_trailing_comma_test/82: DartkCrash
-arg_param_trailing_comma_test/88: DartkCrash
-arg_param_trailing_comma_test/91: DartkCrash
-arg_param_trailing_comma_test/none: RuntimeError
-assignable_expression_test/02: MissingCompileTimeError
-assignable_expression_test/03: MissingCompileTimeError
-assignable_expression_test/12: MissingCompileTimeError
-assignable_expression_test/13: MissingCompileTimeError
-assignable_expression_test/22: MissingCompileTimeError
-assignable_expression_test/23: MissingCompileTimeError
-assignable_expression_test/32: MissingCompileTimeError
-assignable_expression_test/33: MissingCompileTimeError
-assignable_expression_test/42: MissingCompileTimeError
-assignable_expression_test/43: MissingCompileTimeError
-assignable_expression_test/50: MissingCompileTimeError
-async_await_catch_regression_test: RuntimeError
-async_await_syntax_test/a01b: MissingCompileTimeError
-async_await_syntax_test/a01c: MissingCompileTimeError
-async_await_syntax_test/a05f: MissingCompileTimeError
-async_await_syntax_test/a05g: MissingCompileTimeError
-async_await_syntax_test/a05h: MissingCompileTimeError
-async_await_syntax_test/a06b: MissingCompileTimeError
-async_await_syntax_test/a12e: MissingCompileTimeError
-async_await_syntax_test/a12f: MissingCompileTimeError
-async_await_syntax_test/b00a: DartkCrash
-async_await_syntax_test/b00b: DartkCrash
-async_await_syntax_test/b00c: DartkCrash
-async_await_syntax_test/b01b: MissingCompileTimeError
-async_await_syntax_test/b01c: MissingCompileTimeError
-async_await_syntax_test/b10b: MissingCompileTimeError
-async_await_syntax_test/b12e: MissingCompileTimeError
-async_await_syntax_test/b12f: MissingCompileTimeError
-async_await_syntax_test/c01b: MissingCompileTimeError
-async_await_syntax_test/c01c: MissingCompileTimeError
-async_await_syntax_test/c11a: MissingCompileTimeError
-async_await_syntax_test/c11b: MissingCompileTimeError
-async_await_syntax_test/d01b: MissingCompileTimeError
-async_await_syntax_test/d01c: MissingCompileTimeError
-async_await_syntax_test/e1: MissingCompileTimeError
-async_await_syntax_test/e2: MissingCompileTimeError
-async_await_syntax_test/e3: MissingCompileTimeError
-async_await_test: Crash
-async_finally_rethrow_test: RuntimeError
-async_return_types_test/return_value_sync_star: MissingCompileTimeError
-async_star_cancel_and_throw_in_finally_test: RuntimeError
-async_star_pause_test: Crash
-async_star_test: Crash
-async_test/constructor3: MissingCompileTimeError
-async_test/setter1: MissingCompileTimeError
-asyncstar_throw_in_catch_test: RuntimeError
-await_backwards_compatibility_test/await1: MissingCompileTimeError
-await_exceptions_test: RuntimeError
-await_test: RuntimeError
-bad_constructor_test/05: CompileTimeError
-bad_initializer1_negative_test: Crash
-black_listed_test/13: MissingCompileTimeError
-body_less_constructor_wrong_arg_negative_test: Crash
-built_in_identifier_illegal_test/01: MissingCompileTimeError
-built_in_identifier_illegal_test/04: MissingCompileTimeError
-built_in_identifier_illegal_test/05: MissingCompileTimeError
-built_in_identifier_illegal_test/06: MissingCompileTimeError
-built_in_identifier_illegal_test/07: MissingCompileTimeError
-built_in_identifier_illegal_test/08: MissingCompileTimeError
-built_in_identifier_illegal_test/10: MissingCompileTimeError
-built_in_identifier_illegal_test/12: MissingCompileTimeError
-built_in_identifier_illegal_test/13: MissingCompileTimeError
-built_in_identifier_illegal_test/15: MissingCompileTimeError
-built_in_identifier_illegal_test/16: MissingCompileTimeError
-built_in_identifier_illegal_test/17: MissingCompileTimeError
-built_in_identifier_illegal_test/18: MissingCompileTimeError
-built_in_identifier_illegal_test/19: MissingCompileTimeError
-built_in_identifier_illegal_test/20: MissingCompileTimeError
-built_in_identifier_test/01: CompileTimeError
-call_nonexistent_static_test/01: RuntimeError
-call_nonexistent_static_test/04: RuntimeError
-call_nonexistent_static_test/06: RuntimeError
-class_cycle2_test/01: MissingCompileTimeError
-class_cycle2_test/02: MissingCompileTimeError
-class_cycle_test/00: MissingCompileTimeError
-class_cycle_test/01: MissingCompileTimeError
-compile_time_constant10_test/01: Crash
-compile_time_constant10_test/02: Crash
-compile_time_constant13_test/02: Crash
-compile_time_constant13_test/03: MissingCompileTimeError
-compile_time_constant13_test/04: Crash
-compile_time_constant13_test/05: Crash
-compile_time_constant_arguments_test/01: MissingCompileTimeError
-compile_time_constant_arguments_test/02: MissingCompileTimeError
-compile_time_constant_arguments_test/03: MissingCompileTimeError
-compile_time_constant_arguments_test/04: MissingCompileTimeError
-compile_time_constant_arguments_test/05: MissingCompileTimeError
-compile_time_constant_arguments_test/06: MissingCompileTimeError
-compile_time_constant_c_test/02: MissingCompileTimeError
-compile_time_constant_c_test/03: MissingCompileTimeError
-compile_time_constant_p_test/01: Crash
-compile_time_constant_r_test/01: Crash
-compile_time_constant_r_test/02: Crash
-compile_time_constant_r_test/03: Crash
-compile_time_constant_test/01: MissingCompileTimeError
-compile_time_constant_test/02: Crash
-conditional_import_string_test: RuntimeError
-conditional_import_test: RuntimeError
-conditional_method_invocation_test/11: MissingCompileTimeError
-conditional_property_access_test/09: MissingCompileTimeError
-conditional_property_assignment_test/20: MissingCompileTimeError
-conditional_property_assignment_test/21: MissingCompileTimeError
-conditional_property_assignment_test/22: MissingCompileTimeError
-const_conditional_test/01: MissingCompileTimeError
-const_conditional_test/02: MissingCompileTimeError
-const_conditional_test/03: MissingCompileTimeError
-const_conditional_test/04: MissingCompileTimeError
-const_conditional_test/05: MissingCompileTimeError
-const_conditional_test/06: MissingCompileTimeError
-const_conditional_test/07: MissingCompileTimeError
-const_conditional_test/08: MissingCompileTimeError
-const_conditional_test/09: MissingCompileTimeError
-const_conditional_test/10: MissingCompileTimeError
-const_constructor_mixin2_test/01: MissingCompileTimeError
-const_constructor_mixin3_test/01: MissingCompileTimeError
-const_constructor_mixin_test/01: MissingCompileTimeError
-const_constructor_nonconst_field_test/01: MissingCompileTimeError
-const_constructor_super_test/01: MissingCompileTimeError
-const_constructor_super_test/02: Crash
-const_constructor_syntax_test/01: MissingCompileTimeError
-const_constructor_syntax_test/02: MissingCompileTimeError
-const_constructor_syntax_test/03: MissingCompileTimeError
-const_constructor_syntax_test/04: MissingCompileTimeError
-const_constructor_test/01: MissingCompileTimeError
-const_error_multiply_initialized_test/01: MissingCompileTimeError
-const_error_multiply_initialized_test/03: MissingCompileTimeError
-const_factory_with_body_test/01: MissingCompileTimeError
-const_instance_field_test/01: MissingCompileTimeError
-const_map2_test/00: MissingCompileTimeError
-const_map3_test/00: MissingCompileTimeError
-const_optional_args_negative_test: Fail
-const_switch2_test/01: MissingCompileTimeError
-const_syntax_test/01: MissingCompileTimeError
-const_syntax_test/02: MissingCompileTimeError
-const_syntax_test/03: MissingCompileTimeError
-const_syntax_test/04: MissingCompileTimeError
-const_syntax_test/05: MissingCompileTimeError
-const_syntax_test/06: MissingCompileTimeError
-const_syntax_test/07: MissingCompileTimeError
-const_syntax_test/10: Crash
-const_syntax_test/11: MissingCompileTimeError
-const_syntax_test/12: MissingCompileTimeError
-const_types_test/09: MissingCompileTimeError
-const_types_test/10: MissingCompileTimeError
-const_types_test/11: MissingCompileTimeError
-const_types_test/12: MissingCompileTimeError
-const_types_test/16: MissingCompileTimeError
-const_types_test/17: MissingCompileTimeError
-const_types_test/18: MissingCompileTimeError
-const_types_test/19: MissingCompileTimeError
-const_types_test/20: MissingCompileTimeError
-const_types_test/21: MissingCompileTimeError
-const_types_test/22: MissingCompileTimeError
-const_types_test/23: MissingCompileTimeError
-const_types_test/24: MissingCompileTimeError
-const_types_test/25: MissingCompileTimeError
-const_types_test/26: MissingCompileTimeError
-const_types_test/27: MissingCompileTimeError
-const_types_test/28: MissingCompileTimeError
-const_types_test/29: MissingCompileTimeError
-const_types_test/30: MissingCompileTimeError
-const_types_test/41: MissingCompileTimeError
-constant_locals_test/01: MissingCompileTimeError
-constant_locals_test/02: MissingCompileTimeError
-constant_locals_test/03: MissingCompileTimeError
-constant_locals_test/04: MissingCompileTimeError
-constant_locals_test/05: MissingCompileTimeError
-constructor10_test/00: Crash
-constructor10_test/01: Crash
-constructor10_test/02: Crash
-constructor_duplicate_initializers_test/03: MissingCompileTimeError
-constructor_redirect2_test/01: MissingCompileTimeError
-constructor_redirect_test/01: MissingCompileTimeError
-covariant_test/00c: RuntimeError
-covariant_test/02: MissingCompileTimeError
-covariant_test/08: MissingCompileTimeError
-covariant_test/12: MissingCompileTimeError
-covariant_test/14: MissingCompileTimeError
-covariant_test/16: MissingCompileTimeError
-covariant_test/19: MissingCompileTimeError
-covariant_test/20c: RuntimeError
-covariant_test/22: MissingCompileTimeError
-covariant_test/28: MissingCompileTimeError
-covariant_test/32: MissingCompileTimeError
-covariant_test/34: MissingCompileTimeError
-covariant_test/36: MissingCompileTimeError
-covariant_test/39: MissingCompileTimeError
-covariant_test/40: RuntimeError
-covariant_test/40b: RuntimeError
-covariant_test/40c: RuntimeError
-covariant_test/42: RuntimeError
-covariant_test/46: MissingCompileTimeError
-covariant_test/46b: MissingCompileTimeError
-covariant_test/48: RuntimeError
-covariant_test/52: RuntimeError
-covariant_test/54: RuntimeError
-covariant_test/56: RuntimeError
-covariant_test/59: MissingCompileTimeError
-covariant_test/none: RuntimeError
-custom_await_stack_trace_test: RuntimeError
-cyclic_class_member_test/01: MissingCompileTimeError
-cyclic_constructor_test/01: MissingCompileTimeError
-cyclic_typedef_test/01: MissingCompileTimeError
-cyclic_typedef_test/02: MissingCompileTimeError
-cyclic_typedef_test/03: MissingCompileTimeError
-cyclic_typedef_test/04: MissingCompileTimeError
-cyclic_typedef_test/05: MissingCompileTimeError
-cyclic_typedef_test/06: MissingCompileTimeError
-cyclic_typedef_test/07: MissingCompileTimeError
-cyclic_typedef_test/08: MissingCompileTimeError
-cyclic_typedef_test/09: MissingCompileTimeError
-cyclic_typedef_test/10: MissingCompileTimeError
-cyclic_typedef_test/11: MissingCompileTimeError
-deferred_duplicate_prefix1_test/01: MissingCompileTimeError
-deferred_duplicate_prefix2_test/01: MissingCompileTimeError
-deferred_duplicate_prefix3_test/01: MissingCompileTimeError
-deferred_inheritance_constraints_test/extends: MissingCompileTimeError
-deferred_inheritance_constraints_test/implements: MissingCompileTimeError
-deferred_inheritance_constraints_test/mixin: MissingCompileTimeError
-deferred_load_constants_test/01: MissingCompileTimeError
-deferred_load_constants_test/02: MissingCompileTimeError
-deferred_load_constants_test/03: MissingCompileTimeError
-deferred_load_constants_test/04: MissingCompileTimeError
-deferred_load_constants_test/05: MissingCompileTimeError
-deferred_no_prefix_test/01: MissingCompileTimeError
-duplicate_export_negative_test: DartkCrash
-dynamic2_test/00: MissingCompileTimeError
-dynamic2_test/01: MissingCompileTimeError
-dynamic_prefix_core_test/01: RuntimeError
-enum_private_test/02: RuntimeError
-enum_syntax_test/11: DartkCrash
-enum_syntax_test/20: Crash
-enum_syntax_test/21: MissingCompileTimeError
-enum_syntax_test/22: Crash
-enum_syntax_test/30: MissingCompileTimeError
-export_ambiguous_main_negative_test: Crash
-export_double_same_main_test: Crash
-export_main_test: Crash
-export_private_test/01: MissingCompileTimeError
-extend_type_parameter2_negative_test: DartkCrash
-extend_type_parameter_negative_test: DartkCrash
-external_test/11: MissingCompileTimeError
-external_test/12: MissingCompileTimeError
-external_test/22: MissingCompileTimeError
-external_test/23: MissingCompileTimeError
-external_test/30: MissingCompileTimeError
-external_test/31: MissingCompileTimeError
-factory2_negative_test: DartkCrash
-factory_negative_test: DartkCrash
-factory_redirection_test/07: MissingCompileTimeError
-field_decl_missing_var_type_test/01: MissingCompileTimeError
-final_initializer_instance_reference_test/01: MissingCompileTimeError
-final_is_not_const_test/01: MissingCompileTimeError
-final_super_field_set_test/01: RuntimeError
-first_class_types_literals_test/08: RuntimeError
-function_subtype0_test: RuntimeError
-function_subtype1_test: RuntimeError
-function_syntax_test/00: MissingCompileTimeError
-function_syntax_test/01: MissingCompileTimeError
-function_syntax_test/22: MissingCompileTimeError
-function_syntax_test/64: MissingCompileTimeError
-function_syntax_test/67: MissingCompileTimeError
-function_syntax_test/68: MissingCompileTimeError
-function_syntax_test/69: MissingCompileTimeError
-function_syntax_test/71: MissingCompileTimeError
-function_syntax_test/73: MissingCompileTimeError
-function_syntax_test/74: MissingCompileTimeError
-function_type_alias5_test/00: MissingCompileTimeError
-function_type_alias5_test/01: MissingCompileTimeError
-function_type_alias5_test/02: MissingCompileTimeError
-function_type_alias6_test/00: MissingCompileTimeError
-function_type_alias7_test/00: MissingCompileTimeError
-function_type_alias7_test/01: DartkCrash
-function_type_alias7_test/02: MissingCompileTimeError
-function_type_alias9_test/00: MissingCompileTimeError
-function_type_parameter2_negative_test: Crash
-function_type_parameter_negative_test: Crash
-generic_constructor_mixin3_test: Crash
-generic_field_mixin2_test: RuntimeError
-generic_field_mixin3_test: RuntimeError
-generic_field_mixin5_test: RuntimeError
-generic_field_mixin_test: RuntimeError
-generic_local_functions_test: DartkCrash
-generic_metadata_test/02: MissingCompileTimeError
-generic_metadata_test/03: MissingCompileTimeError
-generic_methods_generic_function_parameter_test: DartkCrash
-getter_parameters_test/01: MissingCompileTimeError
-getter_parameters_test/03: MissingCompileTimeError
-getter_parameters_test/04: MissingCompileTimeError
-hidden_import_test/01: DartkCrash
-hidden_import_test/02: DartkCrash
-hidden_import_test/none: DartkCrash
-if_null_assignment_behavior_test/09: RuntimeError
-if_null_assignment_behavior_test/10: RuntimeError
-if_null_assignment_behavior_test/15: RuntimeError
-implicit_scope_test: Crash
-import_combinators_test: RuntimeError
-import_private_test/01: DartkCrash
-initializing_formal_capture_test: RuntimeError
-inst_field_initializer1_negative_test: Fail
-instanceof3_test: RuntimeError
-interface2_negative_test: Fail
-interface_cycle_test/01: MissingCompileTimeError
-interface_cycle_test/02: MissingCompileTimeError
-invocation_mirror_test: RuntimeError
-is_malformed_type_test/94: RuntimeError
-is_malformed_type_test/95: RuntimeError
-is_malformed_type_test/96: RuntimeError
-is_malformed_type_test/97: RuntimeError
-is_malformed_type_test/98: RuntimeError
-is_malformed_type_test/99: RuntimeError
-is_not_class4_negative_test: Fail
-isnot_malformed_type_test: RuntimeError
-label6_negative_test: DartkCrash
-library_ambiguous_test/00: MissingRuntimeError
-library_ambiguous_test/04: MissingRuntimeError
-library_ambiguous_test/05: MissingCompileTimeError
-list_literal2_negative_test: Fail
-list_literal_negative_test: DartkCrash
-malformed2_test/00: RuntimeError
-malformed_inheritance_test/01: MissingCompileTimeError
-malformed_inheritance_test/03: Crash
-malformed_inheritance_test/05: MissingCompileTimeError
-malformed_inheritance_test/07: DartkCrash
-malformed_inheritance_test/08: DartkCrash
-malformed_inheritance_test/09: MissingCompileTimeError
-malformed_inheritance_test/10: MissingCompileTimeError
-malformed_inheritance_test/11: DartkCrash
-malformed_inheritance_test/12: DartkCrash
-map_literal2_negative_test: Fail
-map_literal_negative_test: DartkCrash
-method_name_test: CompileTimeError
-missing_const_constructor_test/02: MissingCompileTimeError
-missing_const_constructor_test/03: MissingCompileTimeError
-missing_const_constructor_test/04: Crash
-missing_const_constructor_test/05: MissingCompileTimeError
-missing_const_constructor_test/06: MissingCompileTimeError
-missing_part_of_tag_test/01: MissingCompileTimeError
-mixin_black_listed_test/08: DartkCrash
-mixin_cyclic_test/01: MissingCompileTimeError
-mixin_cyclic_test/02: MissingCompileTimeError
-mixin_forwarding_constructor4_test/01: MissingCompileTimeError
-mixin_forwarding_constructor4_test/02: MissingCompileTimeError
-mixin_forwarding_constructor4_test/03: MissingCompileTimeError
-mixin_illegal_constructor_test/01: MissingCompileTimeError
-mixin_illegal_constructor_test/02: MissingCompileTimeError
-mixin_illegal_constructor_test/03: MissingCompileTimeError
-mixin_illegal_constructor_test/04: MissingCompileTimeError
-mixin_illegal_constructor_test/05: MissingCompileTimeError
-mixin_illegal_constructor_test/06: MissingCompileTimeError
-mixin_illegal_constructor_test/07: MissingCompileTimeError
-mixin_illegal_constructor_test/08: MissingCompileTimeError
-mixin_illegal_constructor_test/09: MissingCompileTimeError
-mixin_illegal_constructor_test/10: MissingCompileTimeError
-mixin_illegal_constructor_test/11: MissingCompileTimeError
-mixin_illegal_constructor_test/12: MissingCompileTimeError
-mixin_illegal_cycles_test/01: MissingCompileTimeError
-mixin_illegal_cycles_test/02: MissingCompileTimeError
-mixin_illegal_cycles_test/03: MissingCompileTimeError
-mixin_illegal_cycles_test/04: MissingCompileTimeError
-mixin_illegal_cycles_test/05: MissingCompileTimeError
-mixin_illegal_cycles_test/06: MissingCompileTimeError
-mixin_illegal_object_test/01: MissingCompileTimeError
-mixin_illegal_object_test/02: MissingCompileTimeError
-mixin_invalid_inheritance1_test/01: Crash
-mixin_invalid_inheritance1_test/02: Crash
-mixin_invalid_inheritance1_test/03: Crash
-mixin_invalid_inheritance2_test/01: MissingCompileTimeError
-mixin_invalid_inheritance2_test/02: MissingCompileTimeError
-mixin_invalid_inheritance2_test/03: DartkCrash
-mixin_issue10216_2_test: RuntimeError
-mixin_mixin2_test: RuntimeError
-mixin_mixin3_test: RuntimeError
-mixin_mixin4_test: RuntimeError
-mixin_mixin5_test: RuntimeError
-mixin_mixin6_test: RuntimeError
-mixin_mixin7_test: RuntimeError
-mixin_mixin_bound2_test: RuntimeError
-mixin_mixin_bound_test: RuntimeError
-mixin_mixin_test: RuntimeError
-mixin_of_mixin_test/03: RuntimeError
-mixin_of_mixin_test/14: RuntimeError
-mixin_super_constructor_named_test/01: MissingCompileTimeError
-mixin_super_constructor_positionals_test/01: MissingCompileTimeError
-mixin_super_test: RuntimeError
-mixin_type_parameters_errors_test/01: DartkCrash
-mixin_type_parameters_errors_test/02: DartkCrash
-mixin_type_parameters_errors_test/05: DartkCrash
-multiline_newline_test/01: RuntimeError
-multiline_newline_test/02: RuntimeError
-multiline_newline_test/03: RuntimeError
-named_constructor_test/01: MissingRuntimeError
-named_constructor_test/02: DartkCrash
-named_constructor_test/04: DartkCrash
-named_constructor_test/05: DartkCrash
-named_constructor_test/06: DartkCrash
-named_constructor_test/07: DartkCrash
-named_constructor_test/08: DartkCrash
-named_constructor_test/09: DartkCrash
-named_constructor_test/10: DartkCrash
-named_parameters_aggregated_test/01: MissingCompileTimeError
-named_parameters_aggregated_test/03: MissingCompileTimeError
-named_parameters_aggregated_test/04: MissingCompileTimeError
-named_parameters_default_eq_test/01: MissingCompileTimeError
-named_parameters_default_eq_test/02: MissingCompileTimeError
-new_expression1_negative_test: DartkCrash
-no_main_test/01: Crash
-number_identifier_test/02: MissingCompileTimeError
-number_identifier_test/04: MissingCompileTimeError
-on_catch_malformed_type_test: RuntimeError
-parameter_initializer1_negative_test: DartkCrash
-parameter_initializer2_negative_test: DartkCrash
-parameter_initializer3_negative_test: DartkCrash
-parameter_initializer4_negative_test: DartkCrash
-parameter_initializer6_negative_test: Fail
-part2_test: RuntimeError
-prefix13_negative_test: Fail
-prefix15_negative_test: Fail
-private_access_test/05: RuntimeError
-private_access_test/06: RuntimeError
-private_super_constructor_test/01: MissingCompileTimeError
-redirecting_factory_default_values_test/01: MissingCompileTimeError
-redirecting_factory_default_values_test/02: MissingCompileTimeError
-redirecting_factory_infinite_steps_test/02: Crash
-redirecting_factory_long_test: RuntimeError
-regress_13494_test: RuntimeError
-regress_20394_test/01: MissingCompileTimeError
-regress_22438_test: RuntimeError
-regress_22445_test: RuntimeError
-regress_22579_test: RuntimeError
-regress_23498_test: RuntimeError
-regress_23500_test/01: RuntimeError
-regress_23500_test/02: RuntimeError
-regress_23500_test/none: RuntimeError
-regress_26855_test/0: DartkCrash
-regress_27957_test: RuntimeError
-reify_typevar_static_test/00: MissingCompileTimeError
-runtime_type_function_test: RuntimeError
-scope_variable_test/01: MissingCompileTimeError
-setter0_test: RuntimeError
-setter4_test: CompileTimeError
-setter_override_test/01: RuntimeError
-setter_override_test/02: RuntimeError
-setter_override_test/none: RuntimeError
-source_self_negative_test: DartkCrash
-static_final_field2_test/02: MissingCompileTimeError
-static_parameter_test/01: MissingCompileTimeError
-static_parameter_test/02: MissingCompileTimeError
-static_parameter_test/03: MissingCompileTimeError
-static_parameter_test/04: MissingCompileTimeError
-static_parameter_test/05: MissingCompileTimeError
-static_parameter_test/06: MissingCompileTimeError
-static_parameter_test/07: MissingCompileTimeError
-static_parameter_test/08: MissingCompileTimeError
-static_parameter_test/09: MissingCompileTimeError
-static_parameter_test/10: MissingCompileTimeError
-static_parameter_test/11: MissingCompileTimeError
-static_parameter_test/12: MissingCompileTimeError
-super_call3_test/02: Crash
-super_conditional_operator_test/01: MissingCompileTimeError
-super_conditional_operator_test/02: MissingCompileTimeError
-super_conditional_operator_test/03: MissingCompileTimeError
-super_conditional_operator_test/04: MissingCompileTimeError
-super_conditional_operator_test/05: MissingCompileTimeError
-super_conditional_operator_test/06: MissingCompileTimeError
-super_conditional_operator_test/07: MissingCompileTimeError
-super_conditional_operator_test/08: MissingCompileTimeError
-super_conditional_operator_test/09: MissingCompileTimeError
-super_conditional_operator_test/10: MissingCompileTimeError
-super_conditional_operator_test/11: MissingCompileTimeError
-super_conditional_operator_test/12: MissingCompileTimeError
-super_conditional_operator_test/13: MissingCompileTimeError
-super_conditional_operator_test/14: MissingCompileTimeError
-super_conditional_operator_test/15: MissingCompileTimeError
-super_conditional_operator_test/16: MissingCompileTimeError
-super_conditional_operator_test/17: MissingCompileTimeError
-super_conditional_operator_test/18: MissingCompileTimeError
-super_no_such_method1_test/01: RuntimeError
-super_no_such_method2_test/01: RuntimeError
-super_no_such_method3_test/01: RuntimeError
-super_no_such_method4_test/01: RuntimeError
-super_no_such_method5_test/01: RuntimeError
-switch1_negative_test: Fail
-switch4_negative_test: DartkCrash
-switch_bad_case_test/01: MissingCompileTimeError
-switch_bad_case_test/02: MissingCompileTimeError
-switch_case_test/00: MissingCompileTimeError
-switch_case_test/01: MissingCompileTimeError
-switch_case_test/02: MissingCompileTimeError
-switch_label_test: DartkCrash
-sync_generator2_test/01: MissingCompileTimeError
-sync_generator2_test/02: MissingCompileTimeError
-sync_generator2_test/03: MissingCompileTimeError
-sync_generator2_test/04: MissingCompileTimeError
-sync_generator2_test/05: MissingCompileTimeError
-sync_generator2_test/06: MissingCompileTimeError
-sync_generator2_test/09: Crash
-sync_generator2_test/11: MissingCompileTimeError
-sync_generator2_test/20: MissingCompileTimeError
-sync_generator2_test/30: MissingCompileTimeError
-sync_generator2_test/40: MissingCompileTimeError
-sync_generator2_test/41: MissingCompileTimeError
-sync_generator2_test/51: MissingCompileTimeError
-sync_generator2_test/52: MissingCompileTimeError
-syntax_test/02: MissingCompileTimeError
-syntax_test/03: MissingCompileTimeError
-syntax_test/27: MissingCompileTimeError
-syntax_test/50: MissingCompileTimeError
-syntax_test/51: MissingCompileTimeError
-syntax_test/64: MissingCompileTimeError
-syntax_test/65: MissingCompileTimeError
-this_conditional_operator_test/01: MissingCompileTimeError
-toplevel_collision1_test/00: DartkCrash
-toplevel_collision1_test/01: DartkCrash
-toplevel_collision1_test/02: DartkCrash
-try_catch2_test: DartkCrash
-try_catch3_test: DartkCrash
-try_catch_syntax_test/01: MissingCompileTimeError
-try_catch_syntax_test/07: MissingCompileTimeError
-try_catch_syntax_test/09: MissingCompileTimeError
-try_catch_syntax_test/10: MissingCompileTimeError
-try_catch_syntax_test/11: MissingCompileTimeError
-try_catch_syntax_test/12: MissingCompileTimeError
-try_catch_syntax_test/16: Crash
-try_catch_syntax_test/17: Crash
-type_variable_conflict2_test/01: RuntimeError
-type_variable_conflict_test/01: MissingCompileTimeError
-type_variable_conflict_test/02: MissingCompileTimeError
-type_variable_conflict_test/03: MissingCompileTimeError
-type_variable_conflict_test/04: MissingCompileTimeError
-type_variable_conflict_test/05: MissingCompileTimeError
-type_variable_conflict_test/06: MissingCompileTimeError
-type_variable_scope3_test/00: MissingCompileTimeError
-
-[ $compiler == dartk ]
-redirecting_factory_reflection_test: RuntimeError
-
-[ $compiler == dartkp ]
-bad_raw_string_test/none: Skip # Issue 28680
-bad_raw_string_test/03: Skip # Issue 28680
-
-# Triaged checked mode failures
-[ ($compiler == dartk || $compiler == dartkp) && $checked ]
-language/regress_22728_test: Fail # Dartk Issue 28498
diff --git a/tests/language/vm/causal_async_exception_stack_test.dart b/tests/language/vm/causal_async_exception_stack_test.dart
index d08ae9d..58c1938 100644
--- a/tests/language/vm/causal_async_exception_stack_test.dart
+++ b/tests/language/vm/causal_async_exception_stack_test.dart
@@ -27,6 +27,7 @@
// Test async and async*.
try {
await foo();
+ fail("Did not throw");
} catch (e, st) {
expect(st.toString(), stringContainsInOrder([
'thrower', '.dart:8',
@@ -69,7 +70,7 @@
expect(st.toString(), stringContainsInOrder([
'thrower', '.dart:8',
'<asynchronous suspension>',
- 'main', '.dart:67',
+ 'main', '.dart:68',
]));
}
-}
\ No newline at end of file
+}
diff --git a/tests/language_strong/covariant_subtyping_tearoff1_test.dart b/tests/language_strong/covariant_subtyping_tearoff1_test.dart
new file mode 100644
index 0000000..404b4bb
--- /dev/null
+++ b/tests/language_strong/covariant_subtyping_tearoff1_test.dart
@@ -0,0 +1,19 @@
+// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+import 'package:expect/expect.dart';
+
+class Foo<T> {
+ dynamic method(T x) {}
+}
+
+typedef dynamic TakeNum(num x);
+
+main() {
+ Foo<int> intFoo = new Foo<int>();
+ Foo<num> numFoo = intFoo;
+ TakeNum f = numFoo.method;
+ Expect.throws(() => f(2.5));
+ dynamic f2 = numFoo.method;
+ Expect.throws(() => f2(2.5));
+}
diff --git a/tests/language_strong/covariant_subtyping_tearoff2_test.dart b/tests/language_strong/covariant_subtyping_tearoff2_test.dart
new file mode 100644
index 0000000..306d83d
--- /dev/null
+++ b/tests/language_strong/covariant_subtyping_tearoff2_test.dart
@@ -0,0 +1,26 @@
+// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+import 'package:expect/expect.dart';
+
+class Implementation {
+ dynamic method(int x) {}
+}
+
+abstract class Interface<T> {
+ dynamic method(T x);
+}
+
+class Subclass extends Implementation implements Interface<int> {}
+
+typedef dynamic TakeNum(num x);
+
+main() {
+ Subclass subclass = new Subclass();
+ Interface<int> intInterface = subclass;
+ Interface<num> numInterface = intInterface;
+ TakeNum f = numInterface.method;
+ Expect.throws(() => f(2.5));
+ dynamic f2 = f;
+ Expect.throws(() => f2(2.5));
+}
diff --git a/tests/language_strong/covariant_subtyping_tearoff3_test.dart b/tests/language_strong/covariant_subtyping_tearoff3_test.dart
new file mode 100644
index 0000000..3e1109b
--- /dev/null
+++ b/tests/language_strong/covariant_subtyping_tearoff3_test.dart
@@ -0,0 +1,39 @@
+// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+import 'package:expect/expect.dart';
+
+class Implementation {
+ dynamic method(int x) {}
+}
+
+abstract class Interface1<T> {
+ dynamic method(T x);
+}
+
+abstract class Interface2<T> {
+ dynamic method(T x);
+}
+
+class Subclass extends Implementation
+ implements Interface1<int>, Interface2<int> {}
+
+typedef dynamic TakeNum(num x);
+
+main() {
+ Subclass subclass = new Subclass();
+
+ Interface1<int> intInterface1 = subclass;
+ Interface1<num> numInterface1 = intInterface1;
+ TakeNum f1 = numInterface1.method;
+ Expect.throws(() => f1(2.5));
+ dynamic f1dynamic = f1;
+ Expect.throws(() => f1dynamic(2.5));
+
+ Interface2<int> intInterface2 = subclass;
+ Interface2<num> numInterface2 = intInterface2;
+ TakeNum f2 = numInterface2.method;
+ Expect.throws(() => f2(2.5));
+ dynamic f2dynamic = f2;
+ Expect.throws(() => f2dynamic(2.5));
+}
diff --git a/tests/language_strong/covariant_subtyping_unsafe_call1_test.dart b/tests/language_strong/covariant_subtyping_unsafe_call1_test.dart
index 79fced2..b5d4884 100644
--- a/tests/language_strong/covariant_subtyping_unsafe_call1_test.dart
+++ b/tests/language_strong/covariant_subtyping_unsafe_call1_test.dart
@@ -4,7 +4,7 @@
import 'package:expect/expect.dart';
class Foo<T> {
- method(T x) {}
+ dynamic method(T x) {}
}
main() {
diff --git a/tests/language_strong/covariant_subtyping_unsafe_call2_test.dart b/tests/language_strong/covariant_subtyping_unsafe_call2_test.dart
index ea59203..5e45c37 100644
--- a/tests/language_strong/covariant_subtyping_unsafe_call2_test.dart
+++ b/tests/language_strong/covariant_subtyping_unsafe_call2_test.dart
@@ -4,11 +4,11 @@
import 'package:expect/expect.dart';
class Implementation {
- method(int x) {}
+ dynamic method(int x) {}
}
abstract class Interface<T> {
- method(T x);
+ dynamic method(T x);
}
class Subclass extends Implementation implements Interface<int> {}
diff --git a/tests/language_strong/covariant_subtyping_unsafe_call3_test.dart b/tests/language_strong/covariant_subtyping_unsafe_call3_test.dart
new file mode 100644
index 0000000..71143e6
--- /dev/null
+++ b/tests/language_strong/covariant_subtyping_unsafe_call3_test.dart
@@ -0,0 +1,31 @@
+// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+import 'package:expect/expect.dart';
+
+class Implementation {
+ dynamic method(int x) {}
+}
+
+abstract class Interface1<T> {
+ dynamic method(T x);
+}
+
+abstract class Interface2<T> {
+ dynamic method(T x);
+}
+
+class Subclass extends Implementation
+ implements Interface1<int>, Interface2<int> {}
+
+main() {
+ Subclass subclass = new Subclass();
+
+ Interface1<int> intInterface1 = subclass;
+ Interface1<num> numInterface1 = intInterface1;
+ Expect.throws(() => numInterface1.method(2.5));
+
+ Interface2<int> intInterface2 = subclass;
+ Interface2<num> numInterface2 = intInterface2;
+ Expect.throws(() => numInterface2.method(2.5));
+}
diff --git a/tests/language_strong/interface_inherit_field_test.dart b/tests/language_strong/interface_inherit_field_test.dart
index c1f685a..354b1ea 100644
--- a/tests/language_strong/interface_inherit_field_test.dart
+++ b/tests/language_strong/interface_inherit_field_test.dart
@@ -5,11 +5,11 @@
// Test that it is legal to override a field with a field in an interface.
abstract class IA {
- final int foo;
+ final int foo; /// static warning
}
abstract class IB implements IA {
- final int foo;
+ final int foo; /// static warning
}
class B implements IB {
diff --git a/tests/language_strong/super_setter_test.dart b/tests/language_strong/super_setter_test.dart
index 7683d78..4a9792f 100644
--- a/tests/language_strong/super_setter_test.dart
+++ b/tests/language_strong/super_setter_test.dart
@@ -10,7 +10,7 @@
String value_;
String get value { return value_; }
- String set value(String newValue) {
+ String set value(String newValue) { /// static warning
value_ = 'Base:$newValue';
}
}
@@ -19,7 +19,7 @@
class Derived extends Base {
Derived() : super() {}
- String set value(String newValue) {
+ String set value(String newValue) { /// static warning
super.value = 'Derived:$newValue';
}
String get value { return super.value; }
diff --git a/tests/language_strong/tearoff_dynamic_test.dart b/tests/language_strong/tearoff_dynamic_test.dart
new file mode 100644
index 0000000..9d324d6
--- /dev/null
+++ b/tests/language_strong/tearoff_dynamic_test.dart
@@ -0,0 +1,18 @@
+// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+import 'package:expect/expect.dart';
+
+class Foo {
+ dynamic method(int x) {}
+}
+
+main() {
+ Foo foo = new Foo();
+
+ dynamic dynamicMethod1 = foo.method;
+ Expect.throws(() => dynamicMethod1(2.5));
+
+ dynamic dynamicMethod2 = (foo as dynamic).method;
+ Expect.throws(() => dynamicMethod2(2.5));
+}
diff --git a/tests/language_strong/try_catch4_test.dart b/tests/language_strong/try_catch4_test.dart
index 9d39f11..c71b6d2 100644
--- a/tests/language_strong/try_catch4_test.dart
+++ b/tests/language_strong/try_catch4_test.dart
@@ -13,11 +13,11 @@
var b = false;
var entered = false;
while (true) {
- if (entered) return b;
+ if (entered) return b; /// static warning
b = 8 == a; // This expression should not be GVN'ed.
try {
a = 8;
- return;
+ return; /// static warning
} finally {
b = 8 == a;
entered = true;
@@ -32,12 +32,12 @@
var b = false;
var entered = false;
while (true) {
- if (entered) return b;
+ if (entered) return b; /// static warning
b = 8 == a; // This expression should not be GVN'ed.
try {
a = 8;
doThrow();
- return;
+ return; /// static warning
} catch(e) {
b = 8 == a;
entered = true;
@@ -50,14 +50,14 @@
var b = false;
var entered = false;
while (true) {
- if (entered) return b;
+ if (entered) return b; /// static warning
b = 8 == a; // This expression should not be GVN'ed.
try {
doThrow();
} catch(e) {
a = 8;
entered = true;
- return;
+ return; /// static warning
} finally {
b = 8 == a;
entered = true;
diff --git a/tests/language_strong/try_catch5_test.dart b/tests/language_strong/try_catch5_test.dart
index 5aa16e9..2b6d862 100644
--- a/tests/language_strong/try_catch5_test.dart
+++ b/tests/language_strong/try_catch5_test.dart
@@ -13,12 +13,12 @@
var b = false;
var entered = false;
while (true) {
- if (entered) return b;
+ if (entered) return b; /// static warning
b = 8 == a; // This expression should not be GVN'ed.
try {
try {
a = 8;
- return;
+ return; /// static warning
} finally {
b = 8 == a;
entered = true;
diff --git a/tests/lib_strong/html/custom/constructor_calls_created_synchronously_test.dart b/tests/lib_strong/html/custom/constructor_calls_created_synchronously_test.dart
index 256b9f8..b621efc 100644
--- a/tests/lib_strong/html/custom/constructor_calls_created_synchronously_test.dart
+++ b/tests/lib_strong/html/custom/constructor_calls_created_synchronously_test.dart
@@ -55,7 +55,7 @@
extendsTag: 'section');
var fancy = document.createElement('section', 'fancy-section');
expect(fancy is FancySection, true, reason: 'fancy-section was registered');
- expect(fancy.wasCreated, true, reason: 'FancySection ctor was called');
+ expect((fancy as FancySection).wasCreated, true, reason: 'FancySection ctor was called');
});
}
diff --git a/tests/lib_strong/html/custom/document_register_basic_test.dart b/tests/lib_strong/html/custom/document_register_basic_test.dart
index 33f07ba..95b71f8 100644
--- a/tests/lib_strong/html/custom/document_register_basic_test.dart
+++ b/tests/lib_strong/html/custom/document_register_basic_test.dart
@@ -39,7 +39,7 @@
BadC.created() : super.created();
}
-class BadF implements HtmlElement {
+class BadF implements HtmlElement { /// compile-time error
static final tag = 'x-tag-f';
factory BadF() => new Element.tag(tag);
}
@@ -100,7 +100,7 @@
var parsedFoo = container.firstChild;
expect(parsedFoo is Foo, isTrue);
- expect(parsedFoo.tagName, "X-FOO");
+ expect((parsedFoo as Foo).tagName, "X-FOO");
// Ensuring the wrapper is retained
var someProperty = new Expando();
@@ -134,9 +134,9 @@
treeSanitizer: new NullTreeSanitizer());
upgradeCustomElements(container);
expect(container.firstChild is Bar, isTrue);
- expect(container.firstChild.tagName, "X-BAR");
+ expect((container.firstChild as Bar).tagName, "X-BAR");
expect(container.lastChild is Bar, isTrue);
- expect(container.lastChild.tagName, "X-BAR");
+ expect((container.lastChild as Bar).tagName, "X-BAR");
// Constructors shouldn't interfere with each other
expect((new Foo()).tagName, "X-FOO");
diff --git a/tests/lib_strong/html/custom/element_upgrade_test.dart b/tests/lib_strong/html/custom/element_upgrade_test.dart
index a1f071b..6fd9def 100644
--- a/tests/lib_strong/html/custom/element_upgrade_test.dart
+++ b/tests/lib_strong/html/custom/element_upgrade_test.dart
@@ -44,13 +44,13 @@
test('created gets proxied', () {
var element = document.createElement(FooElement.tag);
expect(element is FooElement, isTrue);
- expect(element.initializedField, 666);
+ expect((element as FooElement).initializedField, 666);
expect(element.text, 'constructed');
js.context.callMethod('validateIsFoo', [element]);
- expect(element.doSomething(), 'didSomething');
- expect(element.fooCreated, true);
+ expect((element as FooElement).doSomething(), 'didSomething');
+ expect((element as FooElement).fooCreated, true);
});
test('dart constructor works', () {
@@ -71,7 +71,7 @@
test('cannot upgrade interfaces', () {
expect(() {
- upgrader.upgrade(new HtmlElementInterface());
+ upgrader.upgrade(new HtmlElementInterface()); /// compile-time error
}, throws);
});
@@ -115,7 +115,7 @@
});
}
-class HtmlElementInterface implements HtmlElement {
+class HtmlElementInterface implements HtmlElement { /// compile-time error
HtmlElementInterface.created();
}
diff --git a/tests/lib_strong/html/debugger_test.dart b/tests/lib_strong/html/debugger_test.dart
new file mode 100644
index 0000000..37384fe
--- /dev/null
+++ b/tests/lib_strong/html/debugger_test.dart
@@ -0,0 +1,8816 @@
+/// Debugger custom formatter tests.
+/// If the tests fail, paste the expected output into the [expectedGolden]
+/// string literal in this file and audit the diff to ensure changes are
+/// expected.
+///
+/// Currently only DDC supports debugging objects with custom formatters
+/// but it is reasonable to add support to Dart2JS in the future.
+@JS()
+library debugger_test;
+
+import 'dart:html';
+import 'package:js/js.dart';
+import 'package:js/js_util.dart' as js_util;
+
+import 'package:expect/minitest.dart';
+
+import 'dart:_debugger' as _debugger;
+
+class TestClass {
+ String name = 'test class';
+ int date;
+ static List<int> foo = [1, 2, 3, 4];
+ static String greeting = 'Hello world';
+ static Object bar = new Object();
+
+ static exampleStaticMethod(x) => x * 2;
+
+ TestClass(this.date);
+
+ String nameAndDate() => '$name on day $date';
+
+ int last(List<int> list) => list.last;
+
+ void addOne(String name) {
+ name = '${name}1';
+ }
+
+ get someInt => 42;
+ get someString => "Hello world";
+ get someObject => this;
+
+ Object returnObject() => bar;
+}
+
+class TestGenericClass<X, Y> {
+ TestGenericClass(this.x);
+ X x;
+}
+
+@JS('Object.getOwnPropertyNames')
+external List getOwnPropertyNames(obj);
+
+@JS('devtoolsFormatters')
+external List get _devtoolsFormatters;
+List get devtoolsFormatters => _devtoolsFormatters;
+
+@JS('JSON.stringify')
+external stringify(value, [Function replacer, int space]);
+
+// TODO(jacobr): this is only valid if the legacy library loader is used.
+// We need a solution that works with all library loaders.
+@JS('dart_library.import')
+external importDartLibrary(String path);
+
+// Replacer normalizes file names that could vary depending on the test runner.
+// styles.
+replacer(String key, value) {
+ // The values for keys with name 'object' may be arbitrary Dart nested
+ // Objects so are not safe to stringify.
+ if (key == 'object') return '<OBJECT>';
+ if (value is String) {
+ if (value.contains('dart_sdk.js')) return '<DART_SDK>';
+ if (new RegExp(r'[.](js|dart|html)').hasMatch(value)) return '<FILE>';
+ }
+ return value;
+}
+
+String format(value) {
+ // Avoid double-escaping strings.
+ if (value is String) return value;
+ return stringify(value, replacer, 4);
+}
+
+class FormattedObject {
+ FormattedObject(this.object, this.config);
+
+ Object object;
+ Object config;
+}
+
+/// Extract all object tags from a json ml expression to enable
+/// calling the custom formatter on the extracted object tag.
+List<FormattedObject> extractNestedFormattedObjects(json) {
+ var ret = <FormattedObject>[];
+ if (json is String || json is bool || json is num) return ret;
+ if (json is List) {
+ for (var e in json) {
+ ret.addAll(extractNestedFormattedObjects(e));
+ }
+ return ret;
+ }
+
+ for (var name in getOwnPropertyNames(json)) {
+ if (name == 'object') {
+ // Found a nested formatted object.
+ ret.add(new FormattedObject(js_util.getProperty(json, 'object'),
+ js_util.getProperty(json, 'config')));
+ return ret;
+ }
+ ret.addAll(extractNestedFormattedObjects(js_util.getProperty(json, name)));
+ }
+ return ret;
+}
+
+main() {
+ if (devtoolsFormatters == null) {
+ print("Warning: no devtools custom formatters specified. Skipping tests.");
+ return;
+ }
+ var _devtoolsFormatter = devtoolsFormatters.first;
+
+ var actual = new StringBuffer();
+
+ // Accumulate the entire expected custom formatted data as a single
+ // massive string buffer so it is simple to update expectations when
+ // modifying the formatting code.
+ // Otherwise a small formatting change would result in tweaking lots
+ // of expectations.
+ // The verify golden match test cases does the final comparison of golden
+ // to expected output.
+ addGolden(String name, value) {
+ actual.write('Test: $name\n'
+ 'Value:\n'
+ '${format(value)}\n'
+ '-----------------------------------\n');
+ }
+
+ addFormatterGoldens(String name, object, [config]) {
+ addGolden(
+ '$name formatting header', _devtoolsFormatter.header(object, config));
+ addGolden('$name formatting body', _devtoolsFormatter.body(object, config));
+ }
+
+ // Include goldens for the nested [[class]] definition field.
+ addNestedFormatterGoldens(String name, obj) {
+ addGolden('$name instance header', _devtoolsFormatter.header(obj, null));
+ var body = _devtoolsFormatter.body(obj, null);
+ addGolden('$name instance body', body);
+
+ var nestedObjects = extractNestedFormattedObjects(body);
+ var clazz = nestedObjects.last;
+ // By convention assume last nested object is the [[class]] definition
+ // describing the object's static members and inheritance hierarchy
+ addFormatterGoldens('$name definition', clazz.object, clazz.config);
+ }
+
+ // Include goldens for the nested [[class]] definition field.
+ addAllNestedFormatterGoldens(String name, obj) {
+ addGolden('$name header', _devtoolsFormatter.header(obj, null));
+ var body = _devtoolsFormatter.body(obj, null);
+ addGolden('$name body', body);
+
+ var nestedObjects = extractNestedFormattedObjects(body);
+ var i = 0;
+ for (var nested in nestedObjects) {
+ addFormatterGoldens('$name child $i', nested.object, nested.config);
+ i++;
+ }
+ }
+
+ group('Iterable formatting', () {
+ var list = ['foo', 'bar', 'baz'];
+ var iterable = list.map((x) => x * 5);
+ addFormatterGoldens('List<String>', list);
+
+ var listOfObjects = <Object>[42, 'bar', true];
+
+ addNestedFormatterGoldens('List<Object>', listOfObjects);
+
+ var largeList = <int>[];
+ for (var i = 0; i < 200; ++i) {
+ largeList.add(i * 10);
+ }
+ addNestedFormatterGoldens('List<int> large', largeList);
+
+ addNestedFormatterGoldens('Iterable', iterable);
+
+ var s = new Set()..add("foo")..add(42)..add(true);
+ addNestedFormatterGoldens('Set', s);
+ });
+
+ group('Map formatting', () {
+ Map<String, int> foo = new Map();
+ foo = {'1': 2, 'x': 4, '5': 6};
+
+ addFormatterGoldens('Map<String, int>', foo);
+ test('hasBody', () {
+ expect(_devtoolsFormatter.hasBody(foo, null), isTrue);
+ });
+
+ Map<dynamic, dynamic> dynamicMap = new Map();
+ dynamicMap = {1: 2, 'x': 4, true: "truthy"};
+
+ addNestedFormatterGoldens('Map<dynamic, dynamic>', dynamicMap);
+ });
+
+ group('Function formatting', () {
+ adder(int a, int b) => a + b;
+
+ addFormatterGoldens('Function', adder);
+
+ test('hasBody', () {
+ expect(_devtoolsFormatter.hasBody(adder, null), isTrue);
+ });
+
+ addEventListener(String name, bool callback(Event e)) => null;
+
+ addFormatterGoldens('Function with functon arguments', addEventListener);
+
+ // Closure
+ addGolden('dart:html method', window.addEventListener);
+
+ // Get a reference to the JS constructor for a Dart class.
+ // This tracks a regression bug where overly verbose and confusing output
+ // was shown for this case.
+ var testClass = new TestClass(17);
+ var dartConstructor = js_util.getProperty(
+ js_util.getProperty(testClass, '__proto__'), 'constructor');
+ addFormatterGoldens('Raw reference to dart constructor', dartConstructor);
+ });
+
+ group('Object formatting', () {
+ var object = new Object();
+ addFormatterGoldens('Object', object);
+ test('hasBody', () {
+ expect(_devtoolsFormatter.hasBody(object, null), isTrue);
+ });
+ });
+
+ group('Type formatting', () {
+ addFormatterGoldens('Type TestClass', TestClass);
+ addFormatterGoldens('Type HttpRequest', HttpRequest);
+ });
+
+ group('JS interop object formatting', () {
+ var object = js_util.newObject();
+ js_util.setProperty(object, 'foo', 'bar');
+ // Make sure we don't apply the Dart custom formatter to JS interop objects.
+ expect(_devtoolsFormatter.header(object, null), isNull);
+ });
+
+ group('Module formatting', () {
+ var moduleNames = _debugger.getModuleNames();
+ var testModuleName = "lib/html/debugger_test";
+ expect(moduleNames.contains(testModuleName), isTrue);
+
+ addAllNestedFormatterGoldens(
+ 'Test library Module', _debugger.getModuleLibraries(testModuleName));
+ });
+
+ group('StackTrace formatting', () {
+ StackTrace stack;
+ try {
+ throw new Error();
+ } catch (exception, stackTrace) {
+ stack = stackTrace;
+ }
+ addFormatterGoldens('StackTrace', stack);
+ test('hasBody', () {
+ expect(_devtoolsFormatter.hasBody(stack, null), isTrue);
+ });
+ });
+
+ group('Class formatting', () {
+ addNestedFormatterGoldens('TestClass', new TestClass(17));
+ addNestedFormatterGoldens('MouseEvent', new MouseEvent("click"));
+ // This is a good class to test as it has statics and a deep inheritance heirarchy
+ addNestedFormatterGoldens('HttpRequest', new HttpRequest());
+ });
+
+ test('verify golden match', () {
+ // Warning: all other test groups must have run for this test to be meaningful
+ print("Actual:##############\n$actual\n#################");
+
+ expect(actual.toString().trim(), equals(expectedGolden().trim()));
+ });
+}
+
+/// The golden custom formatter output is placed at the bottom of the file
+/// to simplify replacing the golden data when the custom formatter code is
+/// changed.
+///
+/// This value is placed in a function rather than a field to avoid a recursive
+/// program that prints itself issue as the golden includes the formatter output
+/// for this library
+String expectedGolden() => r"""Test: List<String> formatting header
+Value:
+[
+ "span",
+ {
+ "style": "background-color: #d9edf7;"
+ },
+ "JSArray<String> length 3"
+]
+-----------------------------------
+Test: List<String> formatting body
+Value:
+[
+ "ol",
+ {
+ "style": "list-style-type: none;padding-left: 0px;margin-top: 0px;margin-bottom: 0px;margin-left: 12px;"
+ },
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {},
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "0: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ "foo"
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {},
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "1: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ "bar"
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {},
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "2: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ "baz"
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "[[class]]: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "asClass"
+ }
+ }
+ ]
+ ]
+ ]
+]
+-----------------------------------
+Test: List<Object> instance header
+Value:
+[
+ "span",
+ {
+ "style": "background-color: #d9edf7;"
+ },
+ "JSArray<Object> length 3"
+]
+-----------------------------------
+Test: List<Object> instance body
+Value:
+[
+ "ol",
+ {
+ "style": "list-style-type: none;padding-left: 0px;margin-top: 0px;margin-bottom: 0px;margin-left: 12px;"
+ },
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {},
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "0: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ "42"
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {},
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "1: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ "bar"
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {},
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "2: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ "true"
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "[[class]]: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "asClass"
+ }
+ }
+ ]
+ ]
+ ]
+]
+-----------------------------------
+Test: List<Object> definition formatting header
+Value:
+[
+ "span",
+ {
+ "style": "background-color: #d9edf7;"
+ },
+ "JSArray<Object> implements List<Object>, JSIndexable<Object>"
+]
+-----------------------------------
+Test: List<Object> definition formatting body
+Value:
+[
+ "ol",
+ {
+ "style": "list-style-type: none;padding-left: 0px;margin-top: 0px;margin-bottom: 0px;margin-left: 12px;"
+ },
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {},
+ [
+ "span",
+ {
+ "style": ""
+ },
+ "[[Static members]]"
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "markFixedList: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "markUnmodifiableList: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {},
+ [
+ "span",
+ {
+ "style": ""
+ },
+ "[[Instance Methods]]"
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "add: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "addAll: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "any: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "asMap: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "checkGrowable: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "checkMutable: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "clear: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "contains: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "elementAt: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "every: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "expand: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "fillRange: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "firstWhere: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "fold: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "forEach: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "getRange: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "indexOf: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "insert: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "insertAll: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "join: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "lastIndexOf: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "lastWhere: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "map: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "reduce: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "remove: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "removeAt: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "removeLast: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "removeRange: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "removeWhere: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "replaceRange: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "retainWhere: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "setAll: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "setRange: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "shuffle: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "singleWhere: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "skip: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "skipWhile: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "sort: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "sublist: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "take: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "takeWhile: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "toList: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "toSet: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "where: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "_get: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "_removeWhere: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "_set: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "[[base class]]: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "asClass"
+ }
+ }
+ ]
+ ]
+ ]
+]
+-----------------------------------
+Test: List<int> large instance header
+Value:
+[
+ "span",
+ {
+ "style": "background-color: #d9edf7;"
+ },
+ "JSArray<int> length 200"
+]
+-----------------------------------
+Test: List<int> large instance body
+Value:
+[
+ "ol",
+ {
+ "style": "list-style-type: none;padding-left: 0px;margin-top: 0px;margin-bottom: 0px;margin-left: 12px;"
+ },
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": ""
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": ""
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "[[class]]: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "asClass"
+ }
+ }
+ ]
+ ]
+ ]
+]
+-----------------------------------
+Test: List<int> large definition formatting header
+Value:
+[
+ "span",
+ {
+ "style": "background-color: #d9edf7;"
+ },
+ "JSArray<int> implements List<int>, JSIndexable<int>"
+]
+-----------------------------------
+Test: List<int> large definition formatting body
+Value:
+[
+ "ol",
+ {
+ "style": "list-style-type: none;padding-left: 0px;margin-top: 0px;margin-bottom: 0px;margin-left: 12px;"
+ },
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {},
+ [
+ "span",
+ {
+ "style": ""
+ },
+ "[[Static members]]"
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "markFixedList: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "markUnmodifiableList: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {},
+ [
+ "span",
+ {
+ "style": ""
+ },
+ "[[Instance Methods]]"
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "add: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "addAll: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "any: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "asMap: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "checkGrowable: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "checkMutable: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "clear: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "contains: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "elementAt: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "every: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "expand: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "fillRange: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "firstWhere: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "fold: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "forEach: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "getRange: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "indexOf: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "insert: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "insertAll: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "join: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "lastIndexOf: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "lastWhere: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "map: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "reduce: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "remove: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "removeAt: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "removeLast: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "removeRange: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "removeWhere: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "replaceRange: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "retainWhere: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "setAll: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "setRange: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "shuffle: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "singleWhere: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "skip: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "skipWhile: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "sort: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "sublist: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "take: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "takeWhile: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "toList: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "toSet: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "where: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "_get: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "_removeWhere: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "_set: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "[[base class]]: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "asClass"
+ }
+ }
+ ]
+ ]
+ ]
+]
+-----------------------------------
+Test: Iterable instance header
+Value:
+[
+ "span",
+ {
+ "style": "background-color: #d9edf7;"
+ },
+ "MappedListIterable<String, String> length 3"
+]
+-----------------------------------
+Test: Iterable instance body
+Value:
+[
+ "ol",
+ {
+ "style": "list-style-type: none;padding-left: 0px;margin-top: 0px;margin-bottom: 0px;margin-left: 12px;"
+ },
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {},
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "0: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ "foofoofoofoofoo"
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {},
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "1: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ "barbarbarbarbar"
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {},
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "2: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ "bazbazbazbazbaz"
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "[[class]]: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "asClass"
+ }
+ }
+ ]
+ ]
+ ]
+]
+-----------------------------------
+Test: Iterable definition formatting header
+Value:
+[
+ "span",
+ {
+ "style": "background-color: #d9edf7;"
+ },
+ "MappedListIterable<String, String>"
+]
+-----------------------------------
+Test: Iterable definition formatting body
+Value:
+[
+ "ol",
+ {
+ "style": "list-style-type: none;padding-left: 0px;margin-top: 0px;margin-bottom: 0px;margin-left: 12px;"
+ },
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {},
+ [
+ "span",
+ {
+ "style": ""
+ },
+ "[[Instance Methods]]"
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "elementAt: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "[[base class]]: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "asClass"
+ }
+ }
+ ]
+ ]
+ ]
+]
+-----------------------------------
+Test: Set instance header
+Value:
+[
+ "span",
+ {
+ "style": "background-color: #d9edf7;"
+ },
+ "_LinkedHashSet length 3"
+]
+-----------------------------------
+Test: Set instance body
+Value:
+[
+ "ol",
+ {
+ "style": "list-style-type: none;padding-left: 0px;margin-top: 0px;margin-bottom: 0px;margin-left: 12px;"
+ },
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {},
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "0: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ "foo"
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {},
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "1: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ "42"
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {},
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "2: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ "true"
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "[[class]]: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "asClass"
+ }
+ }
+ ]
+ ]
+ ]
+]
+-----------------------------------
+Test: Set definition formatting header
+Value:
+[
+ "span",
+ {
+ "style": "background-color: #d9edf7;"
+ },
+ "_LinkedHashSet implements LinkedHashSet"
+]
+-----------------------------------
+Test: Set definition formatting body
+Value:
+[
+ "ol",
+ {
+ "style": "list-style-type: none;padding-left: 0px;margin-top: 0px;margin-bottom: 0px;margin-left: 12px;"
+ },
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {},
+ [
+ "span",
+ {
+ "style": ""
+ },
+ "[[Static members]]"
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "_deleteTableEntry: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "_isNumericElement: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "_isStringElement: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "_newHashTable: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "_setTableEntry: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {},
+ [
+ "span",
+ {
+ "style": ""
+ },
+ "[[Instance Methods]]"
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "add: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "contains: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "forEach: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "lookup: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "remove: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "_add: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "_addHashTableEntry: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "_computeHashCode: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "_contains: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "_filterWhere: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "_findBucketIndex: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "_getBucket: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "_getTableEntry: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "_lookup: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "_modified: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "_newLinkedCell: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "_newSet: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "_remove: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "_removeHashTableEntry: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "_unlinkCell: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "_unsupported: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "[[base class]]: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "asClass"
+ }
+ }
+ ]
+ ]
+ ]
+]
+-----------------------------------
+Test: Map<String, int> formatting header
+Value:
+[
+ "span",
+ {
+ "style": "background-color: #d9edf7;"
+ },
+ "JsLinkedHashMap<String, int> length 3"
+]
+-----------------------------------
+Test: Map<String, int> formatting body
+Value:
+[
+ "ol",
+ {
+ "style": "list-style-type: none;padding-left: 0px;margin-top: 0px;margin-bottom: 0px;margin-left: 12px;"
+ },
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "0: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "1: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "2: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "[[class]]: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "asClass"
+ }
+ }
+ ]
+ ]
+ ]
+]
+-----------------------------------
+Test: Map<dynamic, dynamic> instance header
+Value:
+[
+ "span",
+ {
+ "style": "background-color: #d9edf7;"
+ },
+ "JsLinkedHashMap<Object, Object> length 3"
+]
+-----------------------------------
+Test: Map<dynamic, dynamic> instance body
+Value:
+[
+ "ol",
+ {
+ "style": "list-style-type: none;padding-left: 0px;margin-top: 0px;margin-bottom: 0px;margin-left: 12px;"
+ },
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "0: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "1: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "2: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "[[class]]: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "asClass"
+ }
+ }
+ ]
+ ]
+ ]
+]
+-----------------------------------
+Test: Map<dynamic, dynamic> definition formatting header
+Value:
+[
+ "span",
+ {
+ "style": "background-color: #d9edf7;"
+ },
+ "JsLinkedHashMap<Object, Object> implements LinkedHashMap<Object, Object>, InternalMap<Object, Object>"
+]
+-----------------------------------
+Test: Map<dynamic, dynamic> definition formatting body
+Value:
+[
+ "ol",
+ {
+ "style": "list-style-type: none;padding-left: 0px;margin-top: 0px;margin-bottom: 0px;margin-left: 12px;"
+ },
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {},
+ [
+ "span",
+ {
+ "style": ""
+ },
+ "[[Static members]]"
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "_isNumericKey: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "_isStringKey: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {},
+ [
+ "span",
+ {
+ "style": ""
+ },
+ "[[Instance Methods]]"
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "addAll: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "clear: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "containsKey: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "containsValue: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "forEach: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "internalComputeHashCode: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "internalContainsKey: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "internalFindBucketIndex: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "internalGet: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "internalRemove: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "internalSet: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "putIfAbsent: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "remove: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "_addHashTableEntry: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "_containsTableEntry: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "_deleteTableEntry: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "_get: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "_getBucket: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "_getTableBucket: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "_getTableCell: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "_modified: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "_newHashTable: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "_newLinkedCell: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "_removeHashTableEntry: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "_set: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "_setTableEntry: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "_unlinkCell: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "[[base class]]: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "asClass"
+ }
+ }
+ ]
+ ]
+ ]
+]
+-----------------------------------
+Test: Function formatting header
+Value:
+[
+ "span",
+ {
+ "style": "background-color: #d9edf7;"
+ },
+ "(int, int) -> int"
+]
+-----------------------------------
+Test: Function formatting body
+Value:
+[
+ "ol",
+ {
+ "style": "list-style-type: none;padding-left: 0px;margin-top: 0px;margin-bottom: 0px;margin-left: 12px;"
+ },
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {},
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "signature: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ "(int, int) -> int"
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "JavaScript Function: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "skipDart"
+ }
+ }
+ ]
+ ]
+ ]
+]
+-----------------------------------
+Test: Function with functon arguments formatting header
+Value:
+[
+ "span",
+ {
+ "style": "background-color: #d9edf7;"
+ },
+ "(String, (Event) -> bool) -> dynamic"
+]
+-----------------------------------
+Test: Function with functon arguments formatting body
+Value:
+[
+ "ol",
+ {
+ "style": "list-style-type: none;padding-left: 0px;margin-top: 0px;margin-bottom: 0px;margin-left: 12px;"
+ },
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {},
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "signature: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ "(String, (Event) -> bool) -> dynamic"
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "JavaScript Function: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "skipDart"
+ }
+ }
+ ]
+ ]
+ ]
+]
+-----------------------------------
+Test: dart:html method
+Value:
+null
+-----------------------------------
+Test: Raw reference to dart constructor formatting header
+Value:
+[
+ "span",
+ {
+ "style": "background-color: #d9edf7;"
+ },
+ "TestClass"
+]
+-----------------------------------
+Test: Raw reference to dart constructor formatting body
+Value:
+[
+ "ol",
+ {
+ "style": "list-style-type: none;padding-left: 0px;margin-top: 0px;margin-bottom: 0px;margin-left: 12px;"
+ }
+]
+-----------------------------------
+Test: Object formatting header
+Value:
+[
+ "span",
+ {
+ "style": "background-color: #d9edf7;"
+ },
+ "Object"
+]
+-----------------------------------
+Test: Object formatting body
+Value:
+[
+ "ol",
+ {
+ "style": "list-style-type: none;padding-left: 0px;margin-top: 0px;margin-bottom: 0px;margin-left: 12px;"
+ },
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "runtimeType: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "[[class]]: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "asClass"
+ }
+ }
+ ]
+ ]
+ ]
+]
+-----------------------------------
+Test: Type TestClass formatting header
+Value:
+[
+ "span",
+ {
+ "style": "background-color: #d9edf7;"
+ },
+ "TestClass"
+]
+-----------------------------------
+Test: Type TestClass formatting body
+Value:
+[
+ "ol",
+ {
+ "style": "list-style-type: none;padding-left: 0px;margin-top: 0px;margin-bottom: 0px;margin-left: 12px;"
+ }
+]
+-----------------------------------
+Test: Type HttpRequest formatting header
+Value:
+[
+ "span",
+ {
+ "style": "background-color: #d9edf7;"
+ },
+ "HttpRequest"
+]
+-----------------------------------
+Test: Type HttpRequest formatting body
+Value:
+[
+ "ol",
+ {
+ "style": "list-style-type: none;padding-left: 0px;margin-top: 0px;margin-bottom: 0px;margin-left: 12px;"
+ }
+]
+-----------------------------------
+Test: Test library Module header
+Value:
+null
+-----------------------------------
+Test: Test library Module body
+Value:
+[
+ "ol",
+ {
+ "style": "list-style-type: none;padding-left: 0px;margin-top: 0px;margin-bottom: 0px;margin-left: 12px;"
+ },
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": ""
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ]
+]
+-----------------------------------
+Test: Test library Module child 0 formatting header
+Value:
+[
+ "span",
+ {
+ "style": "background-color: #d9edf7;"
+ },
+ "<FILE>"
+]
+-----------------------------------
+Test: Test library Module child 0 formatting body
+Value:
+[
+ "ol",
+ {
+ "style": "list-style-type: none;padding-left: 0px;margin-top: 0px;margin-bottom: 0px;margin-left: 12px;"
+ },
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "TestClass: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "asClass"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "TestGenericClass: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "asClass"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "devtoolsFormatters: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "replacer: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "format: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "FormattedObject: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "asClass"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "extractNestedFormattedObjects: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "main: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "expectedGolden: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ]
+]
+-----------------------------------
+Test: StackTrace formatting header
+Value:
+[
+ "span",
+ {
+ "style": "background-color: #d9edf7;"
+ },
+ "StackTrace"
+]
+-----------------------------------
+Test: StackTrace formatting body
+Value:
+[
+ "ol",
+ {
+ "style": "list-style-type: none;padding-left: 0px;margin-top: 0px;margin-bottom: 0px;margin-left: 12px;color: rgb(196, 26, 22);"
+ },
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {},
+ [
+ "span",
+ {
+ "style": ""
+ },
+ "Error"
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {},
+ [
+ "span",
+ {
+ "style": ""
+ },
+ "<DART_SDK>"
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {},
+ [
+ "span",
+ {
+ "style": ""
+ },
+ "<FILE>"
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {},
+ [
+ "span",
+ {
+ "style": ""
+ },
+ "<FILE>"
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {},
+ [
+ "span",
+ {
+ "style": ""
+ },
+ "<FILE>"
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {},
+ [
+ "span",
+ {
+ "style": ""
+ },
+ "<FILE>"
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {},
+ [
+ "span",
+ {
+ "style": ""
+ },
+ "<FILE>"
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {},
+ [
+ "span",
+ {
+ "style": ""
+ },
+ "<FILE>"
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {},
+ [
+ "span",
+ {
+ "style": ""
+ },
+ "<FILE>"
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {},
+ [
+ "span",
+ {
+ "style": ""
+ },
+ "<FILE>"
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {},
+ [
+ "span",
+ {
+ "style": ""
+ },
+ "<FILE>"
+ ]
+ ]
+ ]
+]
+-----------------------------------
+Test: TestClass instance header
+Value:
+[
+ "span",
+ {
+ "style": "background-color: #d9edf7;"
+ },
+ "TestClass"
+]
+-----------------------------------
+Test: TestClass instance body
+Value:
+[
+ "ol",
+ {
+ "style": "list-style-type: none;padding-left: 0px;margin-top: 0px;margin-bottom: 0px;margin-left: 12px;"
+ },
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {},
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "date: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ "17"
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {},
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "name: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ "test class"
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {},
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "someInt: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ "42"
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "someObject: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {},
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "someString: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ "Hello world"
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "[[class]]: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "asClass"
+ }
+ }
+ ]
+ ]
+ ]
+]
+-----------------------------------
+Test: TestClass definition formatting header
+Value:
+[
+ "span",
+ {
+ "style": "background-color: #d9edf7;"
+ },
+ "TestClass"
+]
+-----------------------------------
+Test: TestClass definition formatting body
+Value:
+[
+ "ol",
+ {
+ "style": "list-style-type: none;padding-left: 0px;margin-top: 0px;margin-bottom: 0px;margin-left: 12px;"
+ },
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {},
+ [
+ "span",
+ {
+ "style": ""
+ },
+ "[[Static members]]"
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "exampleStaticMethod: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {},
+ [
+ "span",
+ {
+ "style": ""
+ },
+ "[[Instance Methods]]"
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "addOne: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "last: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "nameAndDate: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "returnObject: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "[[base class]]: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "asClass"
+ }
+ }
+ ]
+ ]
+ ]
+]
+-----------------------------------
+Test: MouseEvent instance header
+Value:
+[
+ "span",
+ {
+ "style": "background-color: #d9edf7;"
+ },
+ "MouseEvent"
+]
+-----------------------------------
+Test: MouseEvent instance body
+Value:
+[
+ "ol",
+ {
+ "style": "list-style-type: none;padding-left: 0px;margin-top: 0px;margin-bottom: 0px;margin-left: 12px;"
+ },
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {},
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "altKey: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ "false"
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {},
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "button: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ "0"
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {},
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "buttons: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ "0"
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "client: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {},
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "ctrlKey: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ "false"
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {},
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "dataTransfer: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ "null"
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "fromElement: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "layer: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {},
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "metaKey: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ "false"
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "movement: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {},
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "offset: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ "<Exception thrown> Unsupported operation: offsetX is only supported on elements"
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "page: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {},
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "region: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ "null"
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "relatedTarget: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "screen: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {},
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "shiftKey: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ "false"
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "toElement: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {},
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "_clientX: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ "0"
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {},
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "_clientY: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ "0"
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "_get_relatedTarget: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {},
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "_layerX: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ "0"
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {},
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "_layerY: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ "0"
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {},
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "_movementX: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ "0"
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {},
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "_movementY: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ "0"
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {},
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "_pageX: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ "0"
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {},
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "_pageY: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ "0"
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {},
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "_screenX: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ "0"
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {},
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "_screenY: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ "0"
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {},
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "_webkitMovementX: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ "null"
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {},
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "_webkitMovementY: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ "null"
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "[[class]]: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "asClass"
+ }
+ }
+ ]
+ ]
+ ]
+]
+-----------------------------------
+Test: MouseEvent definition formatting header
+Value:
+[
+ "span",
+ {
+ "style": "background-color: #d9edf7;"
+ },
+ "MouseEvent"
+]
+-----------------------------------
+Test: MouseEvent definition formatting body
+Value:
+[
+ "ol",
+ {
+ "style": "list-style-type: none;padding-left: 0px;margin-top: 0px;margin-bottom: 0px;margin-left: 12px;"
+ },
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {},
+ [
+ "span",
+ {
+ "style": ""
+ },
+ "[[Static members]]"
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "_create_1: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "_create_2: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {},
+ [
+ "span",
+ {
+ "style": ""
+ },
+ "[[Instance Methods]]"
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "_initMouseEvent: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "_initMouseEvent_1: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "[[base class]]: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "asClass"
+ }
+ }
+ ]
+ ]
+ ]
+]
+-----------------------------------
+Test: HttpRequest instance header
+Value:
+[
+ "span",
+ {
+ "style": "background-color: #d9edf7;"
+ },
+ "HttpRequest"
+]
+-----------------------------------
+Test: HttpRequest instance body
+Value:
+[
+ "ol",
+ {
+ "style": "list-style-type: none;padding-left: 0px;margin-top: 0px;margin-bottom: 0px;margin-left: 12px;"
+ },
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "onReadyStateChange: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {},
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "readyState: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ "0"
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {},
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "response: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ ""
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "responseHeaders: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {},
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "responseText: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ ""
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {},
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "responseType: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ ""
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {},
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "responseUrl: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ ""
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "responseXml: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {},
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "status: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ "0"
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {},
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "statusText: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ ""
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {},
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "timeout: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ "0"
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "upload: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {},
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "withCredentials: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ "false"
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {},
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "_get_response: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ ""
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "[[class]]: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "asClass"
+ }
+ }
+ ]
+ ]
+ ]
+]
+-----------------------------------
+Test: HttpRequest definition formatting header
+Value:
+[
+ "span",
+ {
+ "style": "background-color: #d9edf7;"
+ },
+ "HttpRequest"
+]
+-----------------------------------
+Test: HttpRequest definition formatting body
+Value:
+[
+ "ol",
+ {
+ "style": "list-style-type: none;padding-left: 0px;margin-top: 0px;margin-bottom: 0px;margin-left: 12px;"
+ },
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {},
+ [
+ "span",
+ {
+ "style": ""
+ },
+ "[[Static members]]"
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "getString: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "postFormData: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "request: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "requestCrossOrigin: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "_create_1: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {},
+ [
+ "span",
+ {
+ "style": ""
+ },
+ "[[Instance Methods]]"
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "abort: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "getAllResponseHeaders: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "getResponseHeader: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "open: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "overrideMimeType: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "send: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "setRequestHeader: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "none"
+ }
+ }
+ ]
+ ]
+ ],
+ [
+ "li",
+ {
+ "style": "padding-left: 13px;"
+ },
+ [
+ "span",
+ {
+ "style": "color: rgb(136, 19, 145); margin-right: -13px"
+ },
+ "[[base class]]: "
+ ],
+ [
+ "span",
+ {
+ "style": "margin-left: 13px"
+ },
+ [
+ "object",
+ {
+ "object": "<OBJECT>",
+ "config": {
+ "name": "asClass"
+ }
+ }
+ ]
+ ]
+ ]
+]
+-----------------------------------
+""";
diff --git a/tools/VERSION b/tools/VERSION
index 36dec5b..a5691e7 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 1
MINOR 23
PATCH 0
-PRERELEASE 2
+PRERELEASE 3
PRERELEASE_PATCH 0
diff --git a/tools/observatory_tool.py b/tools/observatory_tool.py
index e82c72c..8450a07 100755
--- a/tools/observatory_tool.py
+++ b/tools/observatory_tool.py
@@ -43,7 +43,17 @@
# True, and return the return code.
def RunCommand(command, always_silent=False):
try:
- subprocess.check_output(command, stderr=subprocess.STDOUT)
+ # Dart IO respects the following environment variables to configure the
+ # HttpClient proxy: https://api.dartlang.org/stable/1.22.1/dart-io/HttpClient/findProxyFromEnvironment.html
+ # We strip these to avoid problems with pub build and transformers.
+ no_http_proxy_env = os.environ.copy()
+ no_http_proxy_env.pop('http_proxy', None)
+ no_http_proxy_env.pop('HTTP_PROXY', None)
+ no_http_proxy_env.pop('https_proxy', None)
+ no_http_proxy_env.pop('HTTPS_PROXY', None)
+ subprocess.check_output(command,
+ stderr=subprocess.STDOUT,
+ env=no_http_proxy_env)
return 0
except subprocess.CalledProcessError as e:
if not always_silent:
diff --git a/tools/patch_sdk.dart b/tools/patch_sdk.dart
index 0954757..33a06fb 100644
--- a/tools/patch_sdk.dart
+++ b/tools/patch_sdk.dart
@@ -13,7 +13,7 @@
import 'package:analyzer/analyzer.dart';
import 'package:analyzer/src/generated/sdk.dart';
import 'package:path/path.dart' as path;
-import 'package:front_end/src/fasta/bin/compile_platform.dart' as
+import 'package:front_end/src/fasta/compile_platform.dart' as
compile_platform;
Future main(List<String> argv) async {
@@ -26,8 +26,6 @@
final repositoryDir = path.relative(path.dirname(path.dirname(base)));
final sdkExample = path.relative(path.join(repositoryDir, 'sdk'));
- final packagesExample = path.relative(
- path.join(repositoryDir, '.packages'));
final patchExample = path.relative(
path.join(repositoryDir, 'out', 'DebugX64', 'obj', 'gen', 'patch'));
final outExample = path.relative(path.join(repositoryDir, 'out', 'DebugX64',
@@ -52,7 +50,6 @@
// Copy and patch libraries.dart and version
var libContents = new File(path.join(sdkLibIn, '_internal',
'sdk_library_metadata', 'lib', 'libraries.dart')).readAsStringSync();
- var patchedLibContents = libContents;
if (mode == 'vm') {
libContents = libContents.replaceAll(
' libraries = const {',
@@ -101,7 +98,7 @@
// TODO(jmesserly): analyzer does not handle the default case of
// "both platforms" correctly, and treats it as being supported on neither.
// So instead we skip explicitly marked as either VM or dart2js libs.
- if (mode == 'ddc' ? libary.isVmLibrary : library.isDart2JsLibrary) {
+ if (mode == 'ddc' ? library.isVmLibrary : library.isDart2JsLibrary) {
continue;
}
@@ -203,7 +200,7 @@
final capturedLines = <String>[];
try {
await runZoned(() async {
- await compile_platform.main(<String>[
+ await compile_platform.mainEntryPoint(<String>[
'--packages',
new Uri.file(packagesFile).toString(),
new Uri.directory(outDir).toString(),
diff --git a/tools/testing/dart/test_options.dart b/tools/testing/dart/test_options.dart
index d156801..cf49269 100644
--- a/tools/testing/dart/test_options.dart
+++ b/tools/testing/dart/test_options.dart
@@ -372,7 +372,7 @@
new _TestOptionSpecification(
'write_test_outcome_log',
'Write the outcome of all tests executed to a '
- '"${TestUtils.flakyFileName()}" file.',
+ '"${TestUtils.testOutcomeFileName()}" file.',
['--write-test-outcome-log'],
[],
false,
diff --git a/tools/testing/dart/test_runner.dart b/tools/testing/dart/test_runner.dart
index 9df2b25..292416e 100644
--- a/tools/testing/dart/test_runner.dart
+++ b/tools/testing/dart/test_runner.dart
@@ -1792,7 +1792,7 @@
hasNonUtf8 = true;
String malformed = UTF8.decode(data, allowMalformed: true);
data..clear()
- ..addAll(malformed.codeUnits)
+ ..addAll(UTF8.encode(malformed))
..addAll("""
*****************************************************************************
diff --git a/utils/kernel-service/kernel-service.dart b/utils/kernel-service/kernel-service.dart
index 284970c..f181237 100644
--- a/utils/kernel-service/kernel-service.dart
+++ b/utils/kernel-service/kernel-service.dart
@@ -21,7 +21,6 @@
library runtime.tools.kernel_service;
import 'dart:async';
-import 'dart:convert';
import 'dart:io';
import 'dart:isolate';
import 'dart:typed_data';
@@ -35,7 +34,6 @@
import 'package:front_end/src/fasta/ticker.dart' show Ticker;
import 'package:front_end/src/fasta/kernel/kernel_target.dart'
show KernelTarget;
-import 'package:front_end/src/fasta/ast_kind.dart' show AstKind;
import 'package:front_end/src/fasta/errors.dart' show InputError;
const bool verbose = const bool.fromEnvironment('DFE_VERBOSE');
@@ -118,13 +116,12 @@
final Ticker ticker = new Ticker(isVerbose: verbose);
final DillTarget dillTarget = new DillTarget(ticker, uriTranslator);
dillTarget.read(new Uri.directory(sdkPath).resolve('platform.dill'));
- final KernelTarget kernelTarget =
- new KernelTarget(dillTarget, uriTranslator);
+ final KernelTarget kernelTarget = new KernelTarget(dillTarget, uriTranslator);
try {
kernelTarget.read(fileName);
await dillTarget.writeOutline(null);
program = await kernelTarget.writeOutline(null);
- program = await kernelTarget.writeProgram(null, AstKind.Kernel);
+ program = await kernelTarget.writeProgram(null);
if (kernelTarget.errors.isNotEmpty) {
return new CompilationError(kernelTarget.errors
.map((err) => err.toString())