Version 2.14.0-162.0.dev
Merge commit '6a4bd42396c4cc9b73cf210e563d5245eb351a8e' into 'dev'
diff --git a/benchmarks/SDKArtifactSizes/dart/SDKArtifactSizes.dart b/benchmarks/SDKArtifactSizes/dart/SDKArtifactSizes.dart
index d1f4ee9..d914254 100644
--- a/benchmarks/SDKArtifactSizes/dart/SDKArtifactSizes.dart
+++ b/benchmarks/SDKArtifactSizes/dart/SDKArtifactSizes.dart
@@ -35,7 +35,7 @@
Future<void> reportArtifactSize(String path, String name) async {
final size = await File(path).length();
- print('SDKArtifactSize_$name(CodeSize): $size');
+ print('SDKArtifactSize.$name(CodeSize): $size');
}
Future<void> main() async {
diff --git a/benchmarks/SDKArtifactSizes/dart2/SDKArtifactSizes.dart b/benchmarks/SDKArtifactSizes/dart2/SDKArtifactSizes.dart
index d1f4ee9..d914254 100644
--- a/benchmarks/SDKArtifactSizes/dart2/SDKArtifactSizes.dart
+++ b/benchmarks/SDKArtifactSizes/dart2/SDKArtifactSizes.dart
@@ -35,7 +35,7 @@
Future<void> reportArtifactSize(String path, String name) async {
final size = await File(path).length();
- print('SDKArtifactSize_$name(CodeSize): $size');
+ print('SDKArtifactSize.$name(CodeSize): $size');
}
Future<void> main() async {
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/documentation_cache.dart b/pkg/analysis_server/lib/src/services/completion/dart/documentation_cache.dart
index 5724484..498197c 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/documentation_cache.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/documentation_cache.dart
@@ -29,9 +29,10 @@
/// Fill the cache with data from the [result].
void cacheFromResult(ResolvedUnitResult result) {
- var element = result.unit?.declaredElement;
- if (element != null) {
- _cacheFromElement(element);
+ var compilationUnit = result.unit?.declaredElement;
+ if (compilationUnit != null) {
+ documentationCache.remove(_keyForUnit(compilationUnit));
+ _cacheFromElement(compilationUnit);
for (var library in result.libraryElement.importedLibraries) {
_cacheLibrary(library);
}
@@ -87,12 +88,12 @@
elementMap.cacheTopLevelElement(dartdocDirectiveInfo, element);
if (parentKey != null) {
for (var member in element.accessors) {
- if (!element.isSynthetic) {
+ if (!member.isSynthetic) {
elementMap.cacheMember(dartdocDirectiveInfo, parentKey, member);
}
}
for (var member in element.fields) {
- if (!element.isSynthetic) {
+ if (!member.isSynthetic) {
elementMap.cacheMember(dartdocDirectiveInfo, parentKey, member);
}
}
diff --git a/pkg/compiler/lib/src/js_backend/namer.dart b/pkg/compiler/lib/src/js_backend/namer.dart
index 2f994bb..8503a49 100644
--- a/pkg/compiler/lib/src/js_backend/namer.dart
+++ b/pkg/compiler/lib/src/js_backend/namer.dart
@@ -246,21 +246,15 @@
"eval", "arguments"
];
- // Symbols that we might be using in our JS snippets.
- static const List<String> reservedGlobalSymbols = const <String>[
+ /// A set of all capitalized global symbols.
+ /// This set is so [DeferredHolderFinalizer] can use names like:
+ /// [A-Z][_0-9a-zA-Z]* without collisions
+ static const Set<String> reservedCapitalizedGlobalSymbols = const {
// Section references are from Ecma-262
// (http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf)
// 15.1.1 Value Properties of the Global Object
- "NaN", "Infinity", "undefined",
-
- // 15.1.2 Function Properties of the Global Object
- "eval", "parseInt", "parseFloat", "isNaN", "isFinite",
-
- // 15.1.3 URI Handling Function Properties
- "decodeURI", "decodeURIComponent",
- "encodeURI",
- "encodeURIComponent",
+ "NaN", "Infinity",
// 15.1.4 Constructor Properties of the Global Object
"Object", "Function", "Array", "String", "Boolean", "Number", "Date",
@@ -270,6 +264,61 @@
// 15.1.5 Other Properties of the Global Object
"Math",
+ // Window props (https://developer.mozilla.org/en/DOM/window)
+ "Components",
+
+ // Window methods (https://developer.mozilla.org/en/DOM/window)
+ "GeckoActiveXObject", "QueryInterface", "XPCNativeWrapper",
+ "XPCSafeJSOjbectWrapper",
+
+ // Common browser-defined identifiers not defined in ECMAScript
+ "Debug", "Enumerator", "Global", "Image",
+ "ActiveXObject", "VBArray",
+
+ // Client-side JavaScript identifiers
+ "Anchor", "Applet", "Attr", "Canvas", "CanvasGradient",
+ "CanvasPattern", "CanvasRenderingContext2D", "CDATASection",
+ "CharacterData", "Comment", "CSS2Properties", "CSSRule",
+ "CSSStyleSheet", "Document", "DocumentFragment", "DocumentType",
+ "DOMException", "DOMImplementation", "DOMParser", "Element", "Event",
+ "ExternalInterface", "FlashPlayer", "Form", "Frame", "History",
+ "HTMLCollection", "HTMLDocument", "HTMLElement", "IFrame",
+ "Input", "JSObject", "KeyEvent", "Link", "Location", "MimeType",
+ "MouseEvent", "Navigator", "Node", "NodeList", "Option", "Plugin",
+ "ProcessingInstruction", "Range", "RangeException", "Screen", "Select",
+ "Table", "TableCell", "TableRow", "TableSelection", "Text", "TextArea",
+ "UIEvent", "Window", "XMLHttpRequest", "XMLSerializer",
+ "XPathException", "XPathResult", "XSLTProcessor",
+
+ // These keywords trigger the loading of the java-plugin. For the
+ // next-generation plugin, this results in starting a new Java process.
+ "Packages", "JavaObject", "JavaClass",
+ "JavaArray", "JavaMember",
+
+ // ES6 collections.
+ "Map", "Set",
+
+ // Some additional names
+ "Isolate",
+ };
+
+ /// Symbols that we might be using in our JS snippets. Some of the symbols in
+ /// these sections are in [reservedGlobalUpperCaseSymbols] above.
+ static const List<String> reservedGlobalSymbols = const <String>[
+ // Section references are from Ecma-262
+ // (http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf)
+
+ // 15.1.1 Value Properties of the Global Object
+ "undefined",
+
+ // 15.1.2 Function Properties of the Global Object
+ "eval", "parseInt", "parseFloat", "isNaN", "isFinite",
+
+ // 15.1.3 URI Handling Function Properties
+ "decodeURI", "decodeURIComponent",
+ "encodeURI",
+ "encodeURIComponent",
+
// 10.1.6 Activation Object
"arguments",
@@ -277,7 +326,7 @@
"escape", "unescape",
// Window props (https://developer.mozilla.org/en/DOM/window)
- "applicationCache", "closed", "Components", "content", "controllers",
+ "applicationCache", "closed", "content", "controllers",
"crypto", "defaultStatus", "dialogArguments", "directories",
"document", "frameElement", "frames", "fullScreen", "globalStorage",
"history", "innerHeight", "innerWidth", "length",
@@ -294,15 +343,14 @@
"captureEvents", "clearInterval", "clearTimeout", "close", "confirm",
"disableExternalCapture", "dispatchEvent", "dump",
"enableExternalCapture", "escape", "find", "focus", "forward",
- "GeckoActiveXObject", "getAttention", "getAttentionWithCycleCount",
+ "getAttention", "getAttentionWithCycleCount",
"getComputedStyle", "getSelection", "home", "maximize", "minimize",
"moveBy", "moveTo", "open", "openDialog", "postMessage", "print",
- "prompt", "QueryInterface", "releaseEvents", "removeEventListener",
+ "prompt", "releaseEvents", "removeEventListener",
"resizeBy", "resizeTo", "restore", "routeEvent", "scroll", "scrollBy",
"scrollByLines", "scrollByPages", "scrollTo", "setInterval",
"setResizeable", "setTimeout", "showModalDialog", "sizeToContent",
- "stop", "uuescape", "updateCommands", "XPCNativeWrapper",
- "XPCSafeJSOjbectWrapper",
+ "stop", "uuescape", "updateCommands",
// Mozilla Window event handlers, same cite
"onabort", "onbeforeunload", "onchange", "onclick", "onclose",
@@ -334,34 +382,14 @@
"oncontrolselect", "ondeactivate", "onhelp", "onresizeend",
// Common browser-defined identifiers not defined in ECMAScript
- "event", "external", "Debug", "Enumerator", "Global", "Image",
- "ActiveXObject", "VBArray", "Components",
+ "event", "external",
// Functions commonly defined on Object
"toString", "getClass", "constructor", "prototype", "valueOf",
- // Client-side JavaScript identifiers
- "Anchor", "Applet", "Attr", "Canvas", "CanvasGradient",
- "CanvasPattern", "CanvasRenderingContext2D", "CDATASection",
- "CharacterData", "Comment", "CSS2Properties", "CSSRule",
- "CSSStyleSheet", "Document", "DocumentFragment", "DocumentType",
- "DOMException", "DOMImplementation", "DOMParser", "Element", "Event",
- "ExternalInterface", "FlashPlayer", "Form", "Frame", "History",
- "HTMLCollection", "HTMLDocument", "HTMLElement", "IFrame", "Image",
- "Input", "JSObject", "KeyEvent", "Link", "Location", "MimeType",
- "MouseEvent", "Navigator", "Node", "NodeList", "Option", "Plugin",
- "ProcessingInstruction", "Range", "RangeException", "Screen", "Select",
- "Table", "TableCell", "TableRow", "TableSelection", "Text", "TextArea",
- "UIEvent", "Window", "XMLHttpRequest", "XMLSerializer",
- "XPathException", "XPathResult", "XSLTProcessor",
-
// These keywords trigger the loading of the java-plugin. For the
// next-generation plugin, this results in starting a new Java process.
- "java", "Packages", "netscape", "sun", "JavaObject", "JavaClass",
- "JavaArray", "JavaMember",
-
- // ES6 collections.
- "Map", "Set",
+ "java", "netscape", "sun",
];
// TODO(joshualitt): Stop reserving these names after local naming is updated
@@ -397,7 +425,6 @@
static const List<String> reservedGlobalHelperFunctions = const <String>[
"init",
- "Isolate",
];
static final List<String> userGlobalObjects =
@@ -413,12 +440,7 @@
/// Names that cannot be used by members, top level and static
/// methods.
Set<String> get jsReserved {
- if (_jsReserved == null) {
- _jsReserved = new Set<String>();
- _jsReserved.addAll(javaScriptKeywords);
- _jsReserved.addAll(reservedPropertySymbols);
- }
- return _jsReserved;
+ return _jsReserved ??= {...javaScriptKeywords, ...reservedPropertySymbols};
}
final String stubNameField = r'$stubName';
@@ -2232,17 +2254,37 @@
Set<String> _jsVariableReservedCache = null;
+ /// Returns true if all reserved names with 2 or more characters long where
+ /// the first character is upper case are in
+ /// [Namer.reservedGlobalUpperCaseSymbols] and all names in that said have
+ /// already been added to [_jsVariableReservedCache].
+ bool _sanityCheckUpperCaseNames(Set<String> reserved) {
+ for (var name in reserved) {
+ var firstChar = name.codeUnitAt(0);
+ if (name.length > 1 &&
+ firstChar >= $A &&
+ firstChar <= $Z &&
+ !Namer.reservedCapitalizedGlobalSymbols.contains(name)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
/// Names that cannot be used by local variables and parameters.
Set<String> get _jsVariableReserved {
if (_jsVariableReservedCache == null) {
- _jsVariableReservedCache = new Set<String>();
- _jsVariableReservedCache.addAll(Namer.javaScriptKeywords);
- _jsVariableReservedCache.addAll(Namer.reservedPropertySymbols);
- _jsVariableReservedCache.addAll(Namer.reservedGlobalSymbols);
- _jsVariableReservedCache.addAll(Namer.reservedGlobalObjectNames);
+ _jsVariableReservedCache = {
+ ...Namer.javaScriptKeywords,
+ ...Namer.reservedPropertySymbols,
+ ...Namer.reservedGlobalSymbols,
+ ...Namer.reservedGlobalObjectNames,
+ ...Namer.reservedCapitalizedGlobalSymbols,
+ ...Namer.reservedGlobalHelperFunctions
+ };
// 26 letters in the alphabet, 25 not counting I.
assert(Namer.reservedGlobalObjectNames.length == 25);
- _jsVariableReservedCache.addAll(Namer.reservedGlobalHelperFunctions);
+ assert(_sanityCheckUpperCaseNames(_jsVariableReservedCache));
}
return _jsVariableReservedCache;
}
diff --git a/pkg/meta/lib/meta.dart b/pkg/meta/lib/meta.dart
index 6bebee4..54768af 100644
--- a/pkg/meta/lib/meta.dart
+++ b/pkg/meta/lib/meta.dart
@@ -207,24 +207,41 @@
/// warnings that would otherwise require type arguments on `C` to be provided.
const _OptionalTypeArgs optionalTypeArgs = _OptionalTypeArgs();
-/// Used to annotate an instance member (method, getter, setter, operator, or
-/// field) `m` in a class `C`. If the annotation is on a field it applies to the
-/// getter, and setter if appropriate, that are induced by the field. Indicates
-/// that `m` should only be invoked from instance methods of `C` or classes that
-/// extend, implement or mix in `C`, either directly or indirectly or from within
-/// the same library that `m` is declared in. Additionally indicates that `m`
-/// should only be invoked on `this` (when outside of the library that it is
-/// declared in), whether explicitly or implicitly.
+/// Used to annotate an instance member in a class or mixin which is meant to
+/// be visible only within the declaring library, and to other instance members
+/// of the class or mixin, and their subtypes.
+///
+/// If the annotation is on a field it applies to the getter, and setter if
+/// appropriate, that are induced by the field.
+///
+/// Indicates that the annotated instance member (method, getter, setter,
+/// operator, or field) `m` in a class or mixin `C` should only be referenced
+/// in specific locations. A reference from within the library in which `C` is
+/// declared is valid. Additionally, a reference from within an instance member
+/// in `C`, or a class that extends, implements, or mixes in `C` (either
+/// directly or indirectly) or a mixin that uses `C` as a superclass constraint
+/// is valid. Additionally a reference from within an instance member in an
+/// extension that applies to `C` is valid.
+///
+/// Additionally restricts the instance of `C` on which `m` is referenced: a
+/// reference to `m` should either be in the same library in which `C` is
+/// declared, or should refer to `this.m` (explicitly or implicitly), and not
+/// `m` on any other instance of `C`.
///
/// Tools, such as the analyzer, can provide feedback if
///
/// * the annotation is associated with anything other than an instance member,
/// or
-/// * an invocation of a member that has this annotation is used outside of an
-/// instance member defined on a class that extends or mixes in (or a mixin
-/// constrained to) the class in which the protected member is defined.
-/// * an invocation of a member that has this annotation is used within an
-/// instance method, but the receiver is something other than `this`.
+/// * a reference to a member `m` which has this annotation, declared in a
+/// class or mixin `C`, is found outside of the declaring library and outside
+/// of an instance member in any class that extends, implements, or mixes in
+/// `C` or any mixin that uses `C` as a superclass constraint, or
+/// * a reference to a member `m` which has this annotation, declared in a
+/// class or mixin `C`, is found outside of the declaring library and the
+/// receiver is something other than `this`.
+// TODO(srawlins): Add a sentence which defines "referencing" and explicitly
+// mentions tearing off, here and on the other annotations which use the word
+// "referenced."
const _Protected protected = _Protected();
/// Used to annotate a named parameter `p` in a method or function `f`.
diff --git a/tools/VERSION b/tools/VERSION
index bc0a457..868836c 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 14
PATCH 0
-PRERELEASE 161
+PRERELEASE 162
PRERELEASE_PATCH 0
\ No newline at end of file