style(dart): Format with dartfmt v0.2.0
Format all pure Dart code with package:dart_style v0.2.0 Command: ``` find -type f -name "*.dart" | xargs dartformat -w ```
This commit is contained in:
parent
450d3630cc
commit
f11f4e0b45
|
@ -10,7 +10,8 @@ import './interface_query.dart';
|
||||||
* In the future this class will implement an Observable interface.
|
* In the future this class will implement an Observable interface.
|
||||||
* For now it uses a plain list of observable callbacks.
|
* For now it uses a plain list of observable callbacks.
|
||||||
*/
|
*/
|
||||||
class QueryList<T> extends Object with IterableMixin<T>
|
class QueryList<T> extends Object
|
||||||
|
with IterableMixin<T>
|
||||||
implements IQueryList<T> {
|
implements IQueryList<T> {
|
||||||
List<T> _results = [];
|
List<T> _results = [];
|
||||||
List _callbacks = [];
|
List _callbacks = [];
|
||||||
|
|
|
@ -10,8 +10,17 @@ import 'dart:js' as js;
|
||||||
// Proxies a Dart function that accepts up to 10 parameters.
|
// Proxies a Dart function that accepts up to 10 parameters.
|
||||||
js.JsFunction _jsFunction(Function fn) {
|
js.JsFunction _jsFunction(Function fn) {
|
||||||
const Object X = __varargSentinel;
|
const Object X = __varargSentinel;
|
||||||
return new js.JsFunction.withThis((thisArg, [o1 = X, o2 = X, o3 = X, o4 = X,
|
return new js.JsFunction.withThis((thisArg,
|
||||||
o5 = X, o6 = X, o7 = X, o8 = X, o9 = X, o10 = X]) {
|
[o1 = X,
|
||||||
|
o2 = X,
|
||||||
|
o3 = X,
|
||||||
|
o4 = X,
|
||||||
|
o5 = X,
|
||||||
|
o6 = X,
|
||||||
|
o7 = X,
|
||||||
|
o8 = X,
|
||||||
|
o9 = X,
|
||||||
|
o10 = X]) {
|
||||||
return __invokeFn(fn, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10);
|
return __invokeFn(fn, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -88,8 +97,8 @@ class GetTestability {
|
||||||
});
|
});
|
||||||
js.context['getAllAngularTestabilities'] = _jsify(() {
|
js.context['getAllAngularTestabilities'] = _jsify(() {
|
||||||
List<Testability> testabilities = registry.getAllTestabilities();
|
List<Testability> testabilities = registry.getAllTestabilities();
|
||||||
List<PublicTestability> publicTestabilities =
|
List<PublicTestability> publicTestabilities = testabilities
|
||||||
testabilities.map((testability) => new PublicTestability(testability));
|
.map((testability) => new PublicTestability(testability));
|
||||||
return _jsify(publicTestabilities);
|
return _jsify(publicTestabilities);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,8 +94,8 @@ class NgZone {
|
||||||
} else {
|
} else {
|
||||||
_innerZone = _createInnerZone(Zone.current,
|
_innerZone = _createInnerZone(Zone.current,
|
||||||
handleUncaughtError: (Zone self, ZoneDelegate parent, Zone zone,
|
handleUncaughtError: (Zone self, ZoneDelegate parent, Zone zone,
|
||||||
error,
|
error, StackTrace trace) =>
|
||||||
StackTrace trace) => _onErrorWithoutLongStackTrace(error, trace));
|
_onErrorWithoutLongStackTrace(error, trace));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -231,7 +231,8 @@ class NgZone {
|
||||||
_run(self, parent, zone, () => fn(arg));
|
_run(self, parent, zone, () => fn(arg));
|
||||||
|
|
||||||
dynamic _runBinary(Zone self, ZoneDelegate parent, Zone zone, fn(arg1, arg2),
|
dynamic _runBinary(Zone self, ZoneDelegate parent, Zone zone, fn(arg1, arg2),
|
||||||
arg1, arg2) => _run(self, parent, zone, () => fn(arg1, arg2));
|
arg1, arg2) =>
|
||||||
|
_run(self, parent, zone, () => fn(arg1, arg2));
|
||||||
|
|
||||||
void _scheduleMicrotask(Zone self, ZoneDelegate parent, Zone zone, fn) {
|
void _scheduleMicrotask(Zone self, ZoneDelegate parent, Zone zone, fn) {
|
||||||
_pendingMicrotasks++;
|
_pendingMicrotasks++;
|
||||||
|
|
|
@ -104,14 +104,15 @@ class BrowserDomAdapter extends GenericBrowserDomAdapter {
|
||||||
_hasPropertyCache = new Map();
|
_hasPropertyCache = new Map();
|
||||||
_setProperty = js.context.callMethod(
|
_setProperty = js.context.callMethod(
|
||||||
'eval', ['(function(el, prop, value) { el[prop] = value; })']);
|
'eval', ['(function(el, prop, value) { el[prop] = value; })']);
|
||||||
_getProperty = js.context.callMethod(
|
_getProperty = js.context
|
||||||
'eval', ['(function(el, prop) { return el[prop]; })']);
|
.callMethod('eval', ['(function(el, prop) { return el[prop]; })']);
|
||||||
_hasProperty = js.context.callMethod(
|
_hasProperty = js.context
|
||||||
'eval', ['(function(el, prop) { return prop in el; })']);
|
.callMethod('eval', ['(function(el, prop) { return prop in el; })']);
|
||||||
}
|
}
|
||||||
static void makeCurrent() {
|
static void makeCurrent() {
|
||||||
setRootDomAdapter(new BrowserDomAdapter());
|
setRootDomAdapter(new BrowserDomAdapter());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool hasProperty(Element element, String name) {
|
bool hasProperty(Element element, String name) {
|
||||||
// Always return true as the serverside version html_adapter.dart does so.
|
// Always return true as the serverside version html_adapter.dart does so.
|
||||||
// TODO: change this once we have schema support.
|
// TODO: change this once we have schema support.
|
||||||
|
@ -173,29 +174,35 @@ class BrowserDomAdapter extends GenericBrowserDomAdapter {
|
||||||
// addEventListener misses zones so we use element.on.
|
// addEventListener misses zones so we use element.on.
|
||||||
element.on[event].listen(callback);
|
element.on[event].listen(callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
Function onAndCancel(EventTarget element, String event, callback(arg)) {
|
Function onAndCancel(EventTarget element, String event, callback(arg)) {
|
||||||
// due to https://code.google.com/p/dart/issues/detail?id=17406
|
// due to https://code.google.com/p/dart/issues/detail?id=17406
|
||||||
// addEventListener misses zones so we use element.on.
|
// addEventListener misses zones so we use element.on.
|
||||||
var subscription = element.on[event].listen(callback);
|
var subscription = element.on[event].listen(callback);
|
||||||
return subscription.cancel;
|
return subscription.cancel;
|
||||||
}
|
}
|
||||||
|
|
||||||
void dispatchEvent(EventTarget el, Event evt) {
|
void dispatchEvent(EventTarget el, Event evt) {
|
||||||
el.dispatchEvent(evt);
|
el.dispatchEvent(evt);
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseEvent createMouseEvent(String eventType) =>
|
MouseEvent createMouseEvent(String eventType) =>
|
||||||
new MouseEvent(eventType, canBubble: true);
|
new MouseEvent(eventType, canBubble: true);
|
||||||
Event createEvent(String eventType) => new Event(eventType, canBubble: true);
|
Event createEvent(String eventType) => new Event(eventType, canBubble: true);
|
||||||
void preventDefault(Event evt) {
|
void preventDefault(Event evt) {
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isPrevented(Event evt) {
|
bool isPrevented(Event evt) {
|
||||||
return evt.defaultPrevented;
|
return evt.defaultPrevented;
|
||||||
}
|
}
|
||||||
|
|
||||||
String getInnerHTML(Element el) => el.innerHtml;
|
String getInnerHTML(Element el) => el.innerHtml;
|
||||||
String getOuterHTML(Element el) => el.outerHtml;
|
String getOuterHTML(Element el) => el.outerHtml;
|
||||||
void setInnerHTML(Element el, String value) {
|
void setInnerHTML(Element el, String value) {
|
||||||
el.innerHtml = value;
|
el.innerHtml = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
String nodeName(Node el) => el.nodeName;
|
String nodeName(Node el) => el.nodeName;
|
||||||
String nodeValue(Node el) => el.nodeValue;
|
String nodeValue(Node el) => el.nodeValue;
|
||||||
String type(InputElement el) => el.type;
|
String type(InputElement el) => el.type;
|
||||||
|
@ -208,42 +215,54 @@ class BrowserDomAdapter extends GenericBrowserDomAdapter {
|
||||||
void clearNodes(Node el) {
|
void clearNodes(Node el) {
|
||||||
el.nodes = const [];
|
el.nodes = const [];
|
||||||
}
|
}
|
||||||
|
|
||||||
void appendChild(Node el, Node node) {
|
void appendChild(Node el, Node node) {
|
||||||
el.append(node);
|
el.append(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
void removeChild(el, Node node) {
|
void removeChild(el, Node node) {
|
||||||
node.remove();
|
node.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
void replaceChild(Node el, Node newNode, Node oldNode) {
|
void replaceChild(Node el, Node newNode, Node oldNode) {
|
||||||
oldNode.replaceWith(newNode);
|
oldNode.replaceWith(newNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
ChildNode remove(ChildNode el) {
|
ChildNode remove(ChildNode el) {
|
||||||
return el..remove();
|
return el..remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
void insertBefore(Node el, node) {
|
void insertBefore(Node el, node) {
|
||||||
el.parentNode.insertBefore(node, el);
|
el.parentNode.insertBefore(node, el);
|
||||||
}
|
}
|
||||||
|
|
||||||
void insertAllBefore(Node el, Iterable<Node> nodes) {
|
void insertAllBefore(Node el, Iterable<Node> nodes) {
|
||||||
el.parentNode.insertAllBefore(nodes, el);
|
el.parentNode.insertAllBefore(nodes, el);
|
||||||
}
|
}
|
||||||
|
|
||||||
void insertAfter(Node el, Node node) {
|
void insertAfter(Node el, Node node) {
|
||||||
el.parentNode.insertBefore(node, el.nextNode);
|
el.parentNode.insertBefore(node, el.nextNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
String getText(Node el) => el.text;
|
String getText(Node el) => el.text;
|
||||||
void setText(Node el, String value) {
|
void setText(Node el, String value) {
|
||||||
el.text = value;
|
el.text = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
String getValue(el) => el.value;
|
String getValue(el) => el.value;
|
||||||
void setValue(el, String value) {
|
void setValue(el, String value) {
|
||||||
el.value = value;
|
el.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool getChecked(InputElement el) => el.checked;
|
bool getChecked(InputElement el) => el.checked;
|
||||||
void setChecked(InputElement el, bool isChecked) {
|
void setChecked(InputElement el, bool isChecked) {
|
||||||
el.checked = isChecked;
|
el.checked = isChecked;
|
||||||
}
|
}
|
||||||
|
|
||||||
Comment createComment(String text) {
|
Comment createComment(String text) {
|
||||||
return new Comment(text);
|
return new Comment(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
TemplateElement createTemplate(String html) {
|
TemplateElement createTemplate(String html) {
|
||||||
var t = new TemplateElement();
|
var t = new TemplateElement();
|
||||||
// We do not sanitize because templates are part of the application code
|
// We do not sanitize because templates are part of the application code
|
||||||
|
@ -251,13 +270,16 @@ class BrowserDomAdapter extends GenericBrowserDomAdapter {
|
||||||
t.setInnerHtml(html, treeSanitizer: _identitySanitizer);
|
t.setInnerHtml(html, treeSanitizer: _identitySanitizer);
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
Element createElement(String tagName, [HtmlDocument doc = null]) {
|
Element createElement(String tagName, [HtmlDocument doc = null]) {
|
||||||
if (doc == null) doc = document;
|
if (doc == null) doc = document;
|
||||||
return doc.createElement(tagName);
|
return doc.createElement(tagName);
|
||||||
}
|
}
|
||||||
|
|
||||||
Text createTextNode(String text, [HtmlDocument doc = null]) {
|
Text createTextNode(String text, [HtmlDocument doc = null]) {
|
||||||
return new Text(text);
|
return new Text(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
createScriptTag(String attrName, String attrValue,
|
createScriptTag(String attrName, String attrValue,
|
||||||
[HtmlDocument doc = null]) {
|
[HtmlDocument doc = null]) {
|
||||||
if (doc == null) doc = document;
|
if (doc == null) doc = document;
|
||||||
|
@ -265,12 +287,14 @@ class BrowserDomAdapter extends GenericBrowserDomAdapter {
|
||||||
el.setAttribute(attrName, attrValue);
|
el.setAttribute(attrName, attrValue);
|
||||||
return el;
|
return el;
|
||||||
}
|
}
|
||||||
|
|
||||||
StyleElement createStyleElement(String css, [HtmlDocument doc = null]) {
|
StyleElement createStyleElement(String css, [HtmlDocument doc = null]) {
|
||||||
if (doc == null) doc = document;
|
if (doc == null) doc = document;
|
||||||
var el = doc.createElement('STYLE');
|
var el = doc.createElement('STYLE');
|
||||||
el.text = css;
|
el.text = css;
|
||||||
return el;
|
return el;
|
||||||
}
|
}
|
||||||
|
|
||||||
ShadowRoot createShadowRoot(Element el) => el.createShadowRoot();
|
ShadowRoot createShadowRoot(Element el) => el.createShadowRoot();
|
||||||
ShadowRoot getShadowRoot(Element el) => el.shadowRoot;
|
ShadowRoot getShadowRoot(Element el) => el.shadowRoot;
|
||||||
Element getHost(Element el) => (el as ShadowRoot).host;
|
Element getHost(Element el) => (el as ShadowRoot).host;
|
||||||
|
@ -283,18 +307,22 @@ class BrowserDomAdapter extends GenericBrowserDomAdapter {
|
||||||
void addClass(Element element, String classname) {
|
void addClass(Element element, String classname) {
|
||||||
element.classes.add(classname);
|
element.classes.add(classname);
|
||||||
}
|
}
|
||||||
|
|
||||||
void removeClass(Element element, String classname) {
|
void removeClass(Element element, String classname) {
|
||||||
element.classes.remove(classname);
|
element.classes.remove(classname);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool hasClass(Element element, String classname) =>
|
bool hasClass(Element element, String classname) =>
|
||||||
element.classes.contains(classname);
|
element.classes.contains(classname);
|
||||||
|
|
||||||
void setStyle(Element element, String stylename, String stylevalue) {
|
void setStyle(Element element, String stylename, String stylevalue) {
|
||||||
element.style.setProperty(stylename, stylevalue);
|
element.style.setProperty(stylename, stylevalue);
|
||||||
}
|
}
|
||||||
|
|
||||||
void removeStyle(Element element, String stylename) {
|
void removeStyle(Element element, String stylename) {
|
||||||
element.style.removeProperty(stylename);
|
element.style.removeProperty(stylename);
|
||||||
}
|
}
|
||||||
|
|
||||||
String getStyle(Element element, String stylename) {
|
String getStyle(Element element, String stylename) {
|
||||||
return element.style.getPropertyValue(stylename);
|
return element.style.getPropertyValue(stylename);
|
||||||
}
|
}
|
||||||
|
@ -332,6 +360,7 @@ class BrowserDomAdapter extends GenericBrowserDomAdapter {
|
||||||
void setTitle(String newTitle) {
|
void setTitle(String newTitle) {
|
||||||
document.title = newTitle;
|
document.title = newTitle;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool elementMatches(n, String selector) =>
|
bool elementMatches(n, String selector) =>
|
||||||
n is Element && n.matches(selector);
|
n is Element && n.matches(selector);
|
||||||
bool isTemplateElement(Element el) => el is TemplateElement;
|
bool isTemplateElement(Element el) => el is TemplateElement;
|
||||||
|
@ -341,15 +370,19 @@ class BrowserDomAdapter extends GenericBrowserDomAdapter {
|
||||||
bool hasShadowRoot(Node node) {
|
bool hasShadowRoot(Node node) {
|
||||||
return node is Element && node.shadowRoot != null;
|
return node is Element && node.shadowRoot != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isShadowRoot(Node node) {
|
bool isShadowRoot(Node node) {
|
||||||
return node is ShadowRoot;
|
return node is ShadowRoot;
|
||||||
}
|
}
|
||||||
|
|
||||||
Node importIntoDoc(Node node) {
|
Node importIntoDoc(Node node) {
|
||||||
return document.importNode(node, true);
|
return document.importNode(node, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
Node adoptNode(Node node) {
|
Node adoptNode(Node node) {
|
||||||
return document.adoptNode(node);
|
return document.adoptNode(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isPageRule(CssRule rule) => rule is CssPageRule;
|
bool isPageRule(CssRule rule) => rule is CssPageRule;
|
||||||
bool isStyleRule(CssRule rule) => rule is CssStyleRule;
|
bool isStyleRule(CssRule rule) => rule is CssStyleRule;
|
||||||
bool isMediaRule(CssRule rule) => rule is CssMediaRule;
|
bool isMediaRule(CssRule rule) => rule is CssMediaRule;
|
||||||
|
@ -357,12 +390,14 @@ class BrowserDomAdapter extends GenericBrowserDomAdapter {
|
||||||
String getHref(AnchorElement element) {
|
String getHref(AnchorElement element) {
|
||||||
return element.href;
|
return element.href;
|
||||||
}
|
}
|
||||||
|
|
||||||
String getEventKey(KeyboardEvent event) {
|
String getEventKey(KeyboardEvent event) {
|
||||||
int keyCode = event.keyCode;
|
int keyCode = event.keyCode;
|
||||||
return _keyCodeToKeyMap.containsKey(keyCode)
|
return _keyCodeToKeyMap.containsKey(keyCode)
|
||||||
? _keyCodeToKeyMap[keyCode]
|
? _keyCodeToKeyMap[keyCode]
|
||||||
: 'Unidentified';
|
: 'Unidentified';
|
||||||
}
|
}
|
||||||
|
|
||||||
getGlobalEventTarget(String target) {
|
getGlobalEventTarget(String target) {
|
||||||
if (target == "window") {
|
if (target == "window") {
|
||||||
return window;
|
return window;
|
||||||
|
@ -372,12 +407,15 @@ class BrowserDomAdapter extends GenericBrowserDomAdapter {
|
||||||
return document.body;
|
return document.body;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getHistory() {
|
getHistory() {
|
||||||
return window.history;
|
return window.history;
|
||||||
}
|
}
|
||||||
|
|
||||||
getLocation() {
|
getLocation() {
|
||||||
return window.location;
|
return window.location;
|
||||||
}
|
}
|
||||||
|
|
||||||
getBaseHref() {
|
getBaseHref() {
|
||||||
var href = getBaseElementHref();
|
var href = getBaseElementHref();
|
||||||
if (href == null) {
|
if (href == null) {
|
||||||
|
@ -386,15 +424,19 @@ class BrowserDomAdapter extends GenericBrowserDomAdapter {
|
||||||
var baseUri = Uri.parse(href);
|
var baseUri = Uri.parse(href);
|
||||||
return baseUri.path;
|
return baseUri.path;
|
||||||
}
|
}
|
||||||
|
|
||||||
String getUserAgent() {
|
String getUserAgent() {
|
||||||
return window.navigator.userAgent;
|
return window.navigator.userAgent;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setData(Element element, String name, String value) {
|
void setData(Element element, String name, String value) {
|
||||||
element.dataset[name] = value;
|
element.dataset[name] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
String getData(Element element, String name) {
|
String getData(Element element, String name) {
|
||||||
return element.dataset[name];
|
return element.dataset[name];
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(tbosch): move this into a separate environment class once we have it
|
// TODO(tbosch): move this into a separate environment class once we have it
|
||||||
setGlobalVar(String name, value) {
|
setGlobalVar(String name, value) {
|
||||||
js.context[name] = value;
|
js.context[name] = value;
|
||||||
|
|
|
@ -32,9 +32,11 @@ class Html5LibDomAdapter implements DomAdapter {
|
||||||
log(error) {
|
log(error) {
|
||||||
stdout.writeln('${error}');
|
stdout.writeln('${error}');
|
||||||
}
|
}
|
||||||
|
|
||||||
logGroup(error) {
|
logGroup(error) {
|
||||||
stdout.writeln('${error}');
|
stdout.writeln('${error}');
|
||||||
}
|
}
|
||||||
|
|
||||||
logGroupEnd() {}
|
logGroupEnd() {}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -78,39 +80,51 @@ class Html5LibDomAdapter implements DomAdapter {
|
||||||
query(selector) {
|
query(selector) {
|
||||||
throw 'not implemented';
|
throw 'not implemented';
|
||||||
}
|
}
|
||||||
|
|
||||||
querySelector(el, String selector) {
|
querySelector(el, String selector) {
|
||||||
return el.querySelector(selector);
|
return el.querySelector(selector);
|
||||||
}
|
}
|
||||||
|
|
||||||
List querySelectorAll(el, String selector) {
|
List querySelectorAll(el, String selector) {
|
||||||
return el.querySelectorAll(selector);
|
return el.querySelectorAll(selector);
|
||||||
}
|
}
|
||||||
|
|
||||||
on(el, evt, listener) {
|
on(el, evt, listener) {
|
||||||
throw 'not implemented';
|
throw 'not implemented';
|
||||||
}
|
}
|
||||||
|
|
||||||
Function onAndCancel(el, evt, listener) {
|
Function onAndCancel(el, evt, listener) {
|
||||||
throw 'not implemented';
|
throw 'not implemented';
|
||||||
}
|
}
|
||||||
|
|
||||||
dispatchEvent(el, evt) {
|
dispatchEvent(el, evt) {
|
||||||
throw 'not implemented';
|
throw 'not implemented';
|
||||||
}
|
}
|
||||||
|
|
||||||
createMouseEvent(eventType) {
|
createMouseEvent(eventType) {
|
||||||
throw 'not implemented';
|
throw 'not implemented';
|
||||||
}
|
}
|
||||||
|
|
||||||
createEvent(eventType) {
|
createEvent(eventType) {
|
||||||
throw 'not implemented';
|
throw 'not implemented';
|
||||||
}
|
}
|
||||||
|
|
||||||
preventDefault(evt) {
|
preventDefault(evt) {
|
||||||
throw 'not implemented';
|
throw 'not implemented';
|
||||||
}
|
}
|
||||||
|
|
||||||
isPrevented(evt) {
|
isPrevented(evt) {
|
||||||
throw 'not implemented';
|
throw 'not implemented';
|
||||||
}
|
}
|
||||||
|
|
||||||
getInnerHTML(el) {
|
getInnerHTML(el) {
|
||||||
return el.innerHtml;
|
return el.innerHtml;
|
||||||
}
|
}
|
||||||
|
|
||||||
getOuterHTML(el) {
|
getOuterHTML(el) {
|
||||||
return el.outerHtml;
|
return el.outerHtml;
|
||||||
}
|
}
|
||||||
|
|
||||||
String nodeName(node) {
|
String nodeName(node) {
|
||||||
switch (node.nodeType) {
|
switch (node.nodeType) {
|
||||||
case Node.ELEMENT_NODE:
|
case Node.ELEMENT_NODE:
|
||||||
|
@ -123,10 +137,12 @@ class Html5LibDomAdapter implements DomAdapter {
|
||||||
' for node types definitions.';
|
' for node types definitions.';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String nodeValue(node) => node.data;
|
String nodeValue(node) => node.data;
|
||||||
String type(node) {
|
String type(node) {
|
||||||
throw 'not implemented';
|
throw 'not implemented';
|
||||||
}
|
}
|
||||||
|
|
||||||
content(node) {
|
content(node) {
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
@ -147,81 +163,103 @@ class Html5LibDomAdapter implements DomAdapter {
|
||||||
parentElement(el) {
|
parentElement(el) {
|
||||||
return el.parent;
|
return el.parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
List childNodes(el) => el.nodes;
|
List childNodes(el) => el.nodes;
|
||||||
List childNodesAsList(el) => el.nodes;
|
List childNodesAsList(el) => el.nodes;
|
||||||
clearNodes(el) {
|
clearNodes(el) {
|
||||||
el.nodes.forEach((e) => e.remove());
|
el.nodes.forEach((e) => e.remove());
|
||||||
}
|
}
|
||||||
|
|
||||||
appendChild(el, node) => el.append(node.remove());
|
appendChild(el, node) => el.append(node.remove());
|
||||||
removeChild(el, node) {
|
removeChild(el, node) {
|
||||||
throw 'not implemented';
|
throw 'not implemented';
|
||||||
}
|
}
|
||||||
|
|
||||||
remove(el) => el.remove();
|
remove(el) => el.remove();
|
||||||
insertBefore(el, node) {
|
insertBefore(el, node) {
|
||||||
if (el.parent == null) throw '$el must have a parent';
|
if (el.parent == null) throw '$el must have a parent';
|
||||||
el.parent.insertBefore(node, el);
|
el.parent.insertBefore(node, el);
|
||||||
}
|
}
|
||||||
|
|
||||||
insertAllBefore(el, nodes) {
|
insertAllBefore(el, nodes) {
|
||||||
throw 'not implemented';
|
throw 'not implemented';
|
||||||
}
|
}
|
||||||
|
|
||||||
insertAfter(el, node) {
|
insertAfter(el, node) {
|
||||||
throw 'not implemented';
|
throw 'not implemented';
|
||||||
}
|
}
|
||||||
|
|
||||||
setInnerHTML(el, value) {
|
setInnerHTML(el, value) {
|
||||||
el.innerHtml = value;
|
el.innerHtml = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
getText(el) {
|
getText(el) {
|
||||||
return el.text;
|
return el.text;
|
||||||
}
|
}
|
||||||
|
|
||||||
setText(el, String value) => el.text = value;
|
setText(el, String value) => el.text = value;
|
||||||
|
|
||||||
getValue(el) {
|
getValue(el) {
|
||||||
throw 'not implemented';
|
throw 'not implemented';
|
||||||
}
|
}
|
||||||
|
|
||||||
setValue(el, String value) {
|
setValue(el, String value) {
|
||||||
throw 'not implemented';
|
throw 'not implemented';
|
||||||
}
|
}
|
||||||
|
|
||||||
getChecked(el) {
|
getChecked(el) {
|
||||||
throw 'not implemented';
|
throw 'not implemented';
|
||||||
}
|
}
|
||||||
|
|
||||||
setChecked(el, bool value) {
|
setChecked(el, bool value) {
|
||||||
throw 'not implemented';
|
throw 'not implemented';
|
||||||
}
|
}
|
||||||
|
|
||||||
createComment(String text) => new Comment(text);
|
createComment(String text) => new Comment(text);
|
||||||
createTemplate(String html) => createElement('template')..innerHtml = html;
|
createTemplate(String html) => createElement('template')..innerHtml = html;
|
||||||
createElement(tagName, [doc]) {
|
createElement(tagName, [doc]) {
|
||||||
return new Element.tag(tagName);
|
return new Element.tag(tagName);
|
||||||
}
|
}
|
||||||
|
|
||||||
createTextNode(String text, [doc]) {
|
createTextNode(String text, [doc]) {
|
||||||
throw 'not implemented';
|
throw 'not implemented';
|
||||||
}
|
}
|
||||||
|
|
||||||
createScriptTag(String attrName, String attrValue, [doc]) {
|
createScriptTag(String attrName, String attrValue, [doc]) {
|
||||||
throw 'not implemented';
|
throw 'not implemented';
|
||||||
}
|
}
|
||||||
|
|
||||||
createStyleElement(String css, [doc]) {
|
createStyleElement(String css, [doc]) {
|
||||||
throw 'not implemented';
|
throw 'not implemented';
|
||||||
}
|
}
|
||||||
|
|
||||||
createShadowRoot(el) {
|
createShadowRoot(el) {
|
||||||
throw 'not implemented';
|
throw 'not implemented';
|
||||||
}
|
}
|
||||||
|
|
||||||
getShadowRoot(el) {
|
getShadowRoot(el) {
|
||||||
throw 'not implemented';
|
throw 'not implemented';
|
||||||
}
|
}
|
||||||
|
|
||||||
getHost(el) {
|
getHost(el) {
|
||||||
throw 'not implemented';
|
throw 'not implemented';
|
||||||
}
|
}
|
||||||
|
|
||||||
clone(node) => node.clone(true);
|
clone(node) => node.clone(true);
|
||||||
getElementsByClassName(element, String name) {
|
getElementsByClassName(element, String name) {
|
||||||
throw 'not implemented';
|
throw 'not implemented';
|
||||||
}
|
}
|
||||||
|
|
||||||
getElementsByTagName(element, String name) {
|
getElementsByTagName(element, String name) {
|
||||||
throw 'not implemented';
|
throw 'not implemented';
|
||||||
}
|
}
|
||||||
|
|
||||||
List classList(element) => element.classes.toList();
|
List classList(element) => element.classes.toList();
|
||||||
|
|
||||||
addClass(element, String classname) {
|
addClass(element, String classname) {
|
||||||
element.classes.add(classname);
|
element.classes.add(classname);
|
||||||
}
|
}
|
||||||
|
|
||||||
removeClass(element, String classname) {
|
removeClass(element, String classname) {
|
||||||
throw 'not implemented';
|
throw 'not implemented';
|
||||||
}
|
}
|
||||||
|
@ -231,9 +269,11 @@ class Html5LibDomAdapter implements DomAdapter {
|
||||||
setStyle(element, String stylename, String stylevalue) {
|
setStyle(element, String stylename, String stylevalue) {
|
||||||
throw 'not implemented';
|
throw 'not implemented';
|
||||||
}
|
}
|
||||||
|
|
||||||
removeStyle(element, String stylename) {
|
removeStyle(element, String stylename) {
|
||||||
throw 'not implemented';
|
throw 'not implemented';
|
||||||
}
|
}
|
||||||
|
|
||||||
getStyle(element, String stylename) {
|
getStyle(element, String stylename) {
|
||||||
throw 'not implemented';
|
throw 'not implemented';
|
||||||
}
|
}
|
||||||
|
@ -248,19 +288,23 @@ class Html5LibDomAdapter implements DomAdapter {
|
||||||
});
|
});
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
hasAttribute(element, String attribute) {
|
hasAttribute(element, String attribute) {
|
||||||
// `attributes` keys can be {@link AttributeName}s.
|
// `attributes` keys can be {@link AttributeName}s.
|
||||||
return element.attributes.keys.any((key) => '$key' == attribute);
|
return element.attributes.keys.any((key) => '$key' == attribute);
|
||||||
}
|
}
|
||||||
|
|
||||||
getAttribute(element, String attribute) {
|
getAttribute(element, String attribute) {
|
||||||
// `attributes` keys can be {@link AttributeName}s.
|
// `attributes` keys can be {@link AttributeName}s.
|
||||||
var key = element.attributes.keys.firstWhere((key) => '$key' == attribute,
|
var key = element.attributes.keys.firstWhere((key) => '$key' == attribute,
|
||||||
orElse: () {});
|
orElse: () {});
|
||||||
return element.attributes[key];
|
return element.attributes[key];
|
||||||
}
|
}
|
||||||
|
|
||||||
setAttribute(element, String name, String value) {
|
setAttribute(element, String name, String value) {
|
||||||
element.attributes[name] = value;
|
element.attributes[name] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
removeAttribute(element, String attribute) {
|
removeAttribute(element, String attribute) {
|
||||||
element.attributes.remove(attribute);
|
element.attributes.remove(attribute);
|
||||||
}
|
}
|
||||||
|
@ -282,6 +326,7 @@ class Html5LibDomAdapter implements DomAdapter {
|
||||||
bool isTemplateElement(Element el) {
|
bool isTemplateElement(Element el) {
|
||||||
return el != null && el.localName.toLowerCase() == 'template';
|
return el != null && el.localName.toLowerCase() == 'template';
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isTextNode(node) => node.nodeType == Node.TEXT_NODE;
|
bool isTextNode(node) => node.nodeType == Node.TEXT_NODE;
|
||||||
bool isCommentNode(node) => node.nodeType == Node.COMMENT_NODE;
|
bool isCommentNode(node) => node.nodeType == Node.COMMENT_NODE;
|
||||||
|
|
||||||
|
@ -290,63 +335,83 @@ class Html5LibDomAdapter implements DomAdapter {
|
||||||
bool hasShadowRoot(node) {
|
bool hasShadowRoot(node) {
|
||||||
throw 'not implemented';
|
throw 'not implemented';
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isShadowRoot(node) {
|
bool isShadowRoot(node) {
|
||||||
throw 'not implemented';
|
throw 'not implemented';
|
||||||
}
|
}
|
||||||
|
|
||||||
importIntoDoc(node) {
|
importIntoDoc(node) {
|
||||||
throw 'not implemented';
|
throw 'not implemented';
|
||||||
}
|
}
|
||||||
|
|
||||||
adoptNode(node) {
|
adoptNode(node) {
|
||||||
throw 'not implemented';
|
throw 'not implemented';
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isPageRule(rule) {
|
bool isPageRule(rule) {
|
||||||
throw 'not implemented';
|
throw 'not implemented';
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isStyleRule(rule) {
|
bool isStyleRule(rule) {
|
||||||
throw 'not implemented';
|
throw 'not implemented';
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isMediaRule(rule) {
|
bool isMediaRule(rule) {
|
||||||
throw 'not implemented';
|
throw 'not implemented';
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isKeyframesRule(rule) {
|
bool isKeyframesRule(rule) {
|
||||||
throw 'not implemented';
|
throw 'not implemented';
|
||||||
}
|
}
|
||||||
|
|
||||||
String getHref(element) {
|
String getHref(element) {
|
||||||
throw 'not implemented';
|
throw 'not implemented';
|
||||||
}
|
}
|
||||||
|
|
||||||
void resolveAndSetHref(element, baseUrl, href) {
|
void resolveAndSetHref(element, baseUrl, href) {
|
||||||
throw 'not implemented';
|
throw 'not implemented';
|
||||||
}
|
}
|
||||||
|
|
||||||
List cssToRules(String css) {
|
List cssToRules(String css) {
|
||||||
throw 'not implemented';
|
throw 'not implemented';
|
||||||
}
|
}
|
||||||
|
|
||||||
List getDistributedNodes(Node) {
|
List getDistributedNodes(Node) {
|
||||||
throw 'not implemented';
|
throw 'not implemented';
|
||||||
}
|
}
|
||||||
|
|
||||||
bool supportsDOMEvents() {
|
bool supportsDOMEvents() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool supportsNativeShadowDOM() {
|
bool supportsNativeShadowDOM() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
getHistory() {
|
getHistory() {
|
||||||
throw 'not implemented';
|
throw 'not implemented';
|
||||||
}
|
}
|
||||||
|
|
||||||
getLocation() {
|
getLocation() {
|
||||||
throw 'not implemented';
|
throw 'not implemented';
|
||||||
}
|
}
|
||||||
|
|
||||||
getBaseHref() {
|
getBaseHref() {
|
||||||
throw 'not implemented';
|
throw 'not implemented';
|
||||||
}
|
}
|
||||||
|
|
||||||
String getUserAgent() {
|
String getUserAgent() {
|
||||||
throw 'not implemented';
|
throw 'not implemented';
|
||||||
}
|
}
|
||||||
|
|
||||||
void setData(Element element, String name, String value) {
|
void setData(Element element, String name, String value) {
|
||||||
this.setAttribute(element, 'data-${name}', value);
|
this.setAttribute(element, 'data-${name}', value);
|
||||||
}
|
}
|
||||||
|
|
||||||
String getData(Element element, String name) {
|
String getData(Element element, String name) {
|
||||||
return this.getAttribute(element, 'data-${name}');
|
return this.getAttribute(element, 'data-${name}');
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(tbosch): move this into a separate environment class once we have it
|
// TODO(tbosch): move this into a separate environment class once we have it
|
||||||
setGlobalVar(String name, value) {
|
setGlobalVar(String name, value) {
|
||||||
// noop on the server
|
// noop on the server
|
||||||
|
|
|
@ -46,6 +46,7 @@ class TimerWrapper {
|
||||||
fn();
|
fn();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
static void clearInterval(Timer timer) {
|
static void clearInterval(Timer timer) {
|
||||||
timer.cancel();
|
timer.cancel();
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,16 +48,19 @@ class MapWrapper {
|
||||||
static forEach(Map m, fn(v, k)) {
|
static forEach(Map m, fn(v, k)) {
|
||||||
m.forEach((k, v) => fn(v, k));
|
m.forEach((k, v) => fn(v, k));
|
||||||
}
|
}
|
||||||
|
|
||||||
static get(Map map, key) => map[key];
|
static get(Map map, key) => map[key];
|
||||||
static int size(Map m) => m.length;
|
static int size(Map m) => m.length;
|
||||||
static void delete(Map m, k) {
|
static void delete(Map m, k) {
|
||||||
m.remove(k);
|
m.remove(k);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void clearValues(Map m) {
|
static void clearValues(Map m) {
|
||||||
for (var k in m.keys) {
|
for (var k in m.keys) {
|
||||||
m[k] = null;
|
m[k] = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static Iterable iterable(Map m) => new IterableMap(m);
|
static Iterable iterable(Map m) => new IterableMap(m);
|
||||||
static List keys(Map m) => m.keys.toList();
|
static List keys(Map m) => m.keys.toList();
|
||||||
static List values(Map m) => m.values.toList();
|
static List values(Map m) => m.values.toList();
|
||||||
|
@ -70,12 +73,15 @@ class StringMapWrapper {
|
||||||
static void set(Map map, key, value) {
|
static void set(Map map, key, value) {
|
||||||
map[key] = value;
|
map[key] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void delete(Map m, k) {
|
static void delete(Map m, k) {
|
||||||
m.remove(k);
|
m.remove(k);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void forEach(Map m, fn(v, k)) {
|
static void forEach(Map m, fn(v, k)) {
|
||||||
m.forEach((k, v) => fn(v, k));
|
m.forEach((k, v) => fn(v, k));
|
||||||
}
|
}
|
||||||
|
|
||||||
static Map merge(Map a, Map b) {
|
static Map merge(Map a, Map b) {
|
||||||
var m = new Map.from(a);
|
var m = new Map.from(a);
|
||||||
if (b != null) {
|
if (b != null) {
|
||||||
|
@ -83,9 +89,11 @@ class StringMapWrapper {
|
||||||
}
|
}
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
static List<String> keys(Map<String, dynamic> a) {
|
static List<String> keys(Map<String, dynamic> a) {
|
||||||
return a.keys.toList();
|
return a.keys.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool isEmpty(Map m) => m.isEmpty;
|
static bool isEmpty(Map m) => m.isEmpty;
|
||||||
static bool equals(Map m1, Map m2) {
|
static bool equals(Map m1, Map m2) {
|
||||||
if (m1.length != m2.length) {
|
if (m1.length != m2.length) {
|
||||||
|
@ -111,6 +119,7 @@ class ListWrapper {
|
||||||
static void set(List m, int k, v) {
|
static void set(List m, int k, v) {
|
||||||
m[k] = v;
|
m[k] = v;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool contains(List m, k) => m.contains(k);
|
static bool contains(List m, k) => m.contains(k);
|
||||||
static List map(list, fn(item)) => list.map(fn).toList();
|
static List map(list, fn(item)) => list.map(fn).toList();
|
||||||
static List filter(List list, bool fn(item)) => list.where(fn).toList();
|
static List filter(List list, bool fn(item)) => list.where(fn).toList();
|
||||||
|
@ -124,9 +133,11 @@ class ListWrapper {
|
||||||
static void forEach(Iterable list, fn(item)) {
|
static void forEach(Iterable list, fn(item)) {
|
||||||
list.forEach(fn);
|
list.forEach(fn);
|
||||||
}
|
}
|
||||||
|
|
||||||
static reduce(List list, fn(a, b), init) {
|
static reduce(List list, fn(a, b), init) {
|
||||||
return list.fold(init, fn);
|
return list.fold(init, fn);
|
||||||
}
|
}
|
||||||
|
|
||||||
static first(List list) => list.isEmpty ? null : list.first;
|
static first(List list) => list.isEmpty ? null : list.first;
|
||||||
static last(List list) => list.isEmpty ? null : list.last;
|
static last(List list) => list.isEmpty ? null : list.last;
|
||||||
static List reversed(List list) => list.reversed.toList();
|
static List reversed(List list) => list.reversed.toList();
|
||||||
|
@ -136,25 +147,30 @@ class ListWrapper {
|
||||||
..setRange(0, a.length, a)
|
..setRange(0, a.length, a)
|
||||||
..setRange(a.length, a.length + b.length, b);
|
..setRange(a.length, a.length + b.length, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void insert(List l, int index, value) {
|
static void insert(List l, int index, value) {
|
||||||
l.insert(index, value);
|
l.insert(index, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
static removeAt(List l, int index) => l.removeAt(index);
|
static removeAt(List l, int index) => l.removeAt(index);
|
||||||
static void removeAll(List list, List items) {
|
static void removeAll(List list, List items) {
|
||||||
for (var i = 0; i < items.length; ++i) {
|
for (var i = 0; i < items.length; ++i) {
|
||||||
list.remove(items[i]);
|
list.remove(items[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static removeLast(List list) => list.removeLast();
|
static removeLast(List list) => list.removeLast();
|
||||||
static bool remove(List list, item) => list.remove(item);
|
static bool remove(List list, item) => list.remove(item);
|
||||||
static void clear(List l) {
|
static void clear(List l) {
|
||||||
l.clear();
|
l.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
static String join(List l, String s) => l.join(s);
|
static String join(List l, String s) => l.join(s);
|
||||||
static bool isEmpty(Iterable list) => list.isEmpty;
|
static bool isEmpty(Iterable list) => list.isEmpty;
|
||||||
static void fill(List l, value, [int start = 0, int end]) {
|
static void fill(List l, value, [int start = 0, int end]) {
|
||||||
l.fillRange(_startOffset(l, start), _endOffset(l, end), value);
|
l.fillRange(_startOffset(l, start), _endOffset(l, end), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool equals(List a, List b) {
|
static bool equals(List a, List b) {
|
||||||
if (a.length != b.length) return false;
|
if (a.length != b.length) return false;
|
||||||
for (var i = 0; i < a.length; ++i) {
|
for (var i = 0; i < a.length; ++i) {
|
||||||
|
@ -162,9 +178,11 @@ class ListWrapper {
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static List slice(List l, [int from = 0, int to]) {
|
static List slice(List l, [int from = 0, int to]) {
|
||||||
return l.sublist(_startOffset(l, from), _endOffset(l, to));
|
return l.sublist(_startOffset(l, from), _endOffset(l, to));
|
||||||
}
|
}
|
||||||
|
|
||||||
static List splice(List l, int from, int length) {
|
static List splice(List l, int from, int length) {
|
||||||
from = _startOffset(l, from);
|
from = _startOffset(l, from);
|
||||||
var to = from + length;
|
var to = from + length;
|
||||||
|
@ -172,6 +190,7 @@ class ListWrapper {
|
||||||
l.removeRange(from, to);
|
l.removeRange(from, to);
|
||||||
return sub;
|
return sub;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sort(List l, [compareFn(a, b) = null]) {
|
static void sort(List l, [compareFn(a, b) = null]) {
|
||||||
if (compareFn == null) {
|
if (compareFn == null) {
|
||||||
l.sort();
|
l.sort();
|
||||||
|
|
|
@ -8,8 +8,10 @@ enum NumberFormatStyle { DECIMAL, PERCENT, CURRENCY }
|
||||||
|
|
||||||
class NumberFormatter {
|
class NumberFormatter {
|
||||||
static String format(num number, String locale, NumberFormatStyle style,
|
static String format(num number, String locale, NumberFormatStyle style,
|
||||||
{int minimumIntegerDigits: 1, int minimumFractionDigits: 0,
|
{int minimumIntegerDigits: 1,
|
||||||
int maximumFractionDigits: 3, String currency,
|
int minimumFractionDigits: 0,
|
||||||
|
int maximumFractionDigits: 3,
|
||||||
|
String currency,
|
||||||
bool currencyAsSymbol: false}) {
|
bool currencyAsSymbol: false}) {
|
||||||
locale = _normalizeLocale(locale);
|
locale = _normalizeLocale(locale);
|
||||||
NumberFormat formatter;
|
NumberFormat formatter;
|
||||||
|
|
|
@ -20,9 +20,11 @@ int ENUM_INDEX(value) => value.index;
|
||||||
class CONST {
|
class CONST {
|
||||||
const CONST();
|
const CONST();
|
||||||
}
|
}
|
||||||
|
|
||||||
class ABSTRACT {
|
class ABSTRACT {
|
||||||
const ABSTRACT();
|
const ABSTRACT();
|
||||||
}
|
}
|
||||||
|
|
||||||
class IMPLEMENTS {
|
class IMPLEMENTS {
|
||||||
final interfaceClass;
|
final interfaceClass;
|
||||||
const IMPLEMENTS(this.interfaceClass);
|
const IMPLEMENTS(this.interfaceClass);
|
||||||
|
@ -161,12 +163,15 @@ class RegExpWrapper {
|
||||||
return new RegExp(regExpStr,
|
return new RegExp(regExpStr,
|
||||||
multiLine: multiLine, caseSensitive: caseSensitive);
|
multiLine: multiLine, caseSensitive: caseSensitive);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Match firstMatch(RegExp regExp, String input) {
|
static Match firstMatch(RegExp regExp, String input) {
|
||||||
return regExp.firstMatch(input);
|
return regExp.firstMatch(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool test(RegExp regExp, String input) {
|
static bool test(RegExp regExp, String input) {
|
||||||
return regExp.hasMatch(input);
|
return regExp.hasMatch(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Iterator<Match> matcher(RegExp regExp, String input) {
|
static Iterator<Match> matcher(RegExp regExp, String input) {
|
||||||
return regExp.allMatches(input).iterator;
|
return regExp.allMatches(input).iterator;
|
||||||
}
|
}
|
||||||
|
@ -263,19 +268,28 @@ class Json {
|
||||||
}
|
}
|
||||||
|
|
||||||
class DateWrapper {
|
class DateWrapper {
|
||||||
static DateTime create(int year, [int month = 1, int day = 1, int hour = 0,
|
static DateTime create(int year,
|
||||||
int minutes = 0, int seconds = 0, int milliseconds = 0]) {
|
[int month = 1,
|
||||||
|
int day = 1,
|
||||||
|
int hour = 0,
|
||||||
|
int minutes = 0,
|
||||||
|
int seconds = 0,
|
||||||
|
int milliseconds = 0]) {
|
||||||
return new DateTime(year, month, day, hour, minutes, seconds, milliseconds);
|
return new DateTime(year, month, day, hour, minutes, seconds, milliseconds);
|
||||||
}
|
}
|
||||||
|
|
||||||
static DateTime fromMillis(int ms) {
|
static DateTime fromMillis(int ms) {
|
||||||
return new DateTime.fromMillisecondsSinceEpoch(ms, isUtc: true);
|
return new DateTime.fromMillisecondsSinceEpoch(ms, isUtc: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int toMillis(DateTime date) {
|
static int toMillis(DateTime date) {
|
||||||
return date.millisecondsSinceEpoch;
|
return date.millisecondsSinceEpoch;
|
||||||
}
|
}
|
||||||
|
|
||||||
static DateTime now() {
|
static DateTime now() {
|
||||||
return new DateTime.now();
|
return new DateTime.now();
|
||||||
}
|
}
|
||||||
|
|
||||||
static String toJson(DateTime date) {
|
static String toJson(DateTime date) {
|
||||||
return date.toUtc().toIso8601String();
|
return date.toUtc().toIso8601String();
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,14 +39,14 @@ int getArgSize(String signature) {
|
||||||
int end = signature.indexOf(')', start);
|
int end = signature.indexOf(')', start);
|
||||||
bool found = false;
|
bool found = false;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for(var i = start; i < end; i++) {
|
for (var i = start; i < end; i++) {
|
||||||
var ch = signature[i];
|
var ch = signature[i];
|
||||||
if (identical(ch, ',')) {
|
if (identical(ch, ',')) {
|
||||||
found = false;
|
found = false;
|
||||||
}
|
}
|
||||||
if (!found) {
|
if (!found) {
|
||||||
found = true;
|
found = true;
|
||||||
count ++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return count;
|
return count;
|
||||||
|
@ -56,7 +56,7 @@ dynamic createScope(String signature, [flags]) {
|
||||||
_arg2[0] = signature;
|
_arg2[0] = signature;
|
||||||
_arg2[1] = flags;
|
_arg2[1] = flags;
|
||||||
var jsScope = _createScope.apply(_arg2, thisArg: _events);
|
var jsScope = _createScope.apply(_arg2, thisArg: _events);
|
||||||
switch(getArgSize(signature)) {
|
switch (getArgSize(signature)) {
|
||||||
case 0:
|
case 0:
|
||||||
return ([arg0, arg1]) {
|
return ([arg0, arg1]) {
|
||||||
return jsScope.apply(const []);
|
return jsScope.apply(const []);
|
||||||
|
|
|
@ -49,24 +49,13 @@ class ReflectionCapabilities implements PlatformReflectionCapabilities {
|
||||||
return (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) =>
|
return (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) =>
|
||||||
create(name, [a1, a2, a3, a4, a5, a6, a7, a8, a9, a10]).reflectee;
|
create(name, [a1, a2, a3, a4, a5, a6, a7, a8, a9, a10]).reflectee;
|
||||||
case 11:
|
case 11:
|
||||||
return (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) => create(
|
return (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) =>
|
||||||
name, [a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11]).reflectee;
|
create(name, [a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11])
|
||||||
|
.reflectee;
|
||||||
case 12:
|
case 12:
|
||||||
return (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) => create(
|
return (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) =>
|
||||||
name, [
|
create(name, [a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12])
|
||||||
a1,
|
.reflectee;
|
||||||
a2,
|
|
||||||
a3,
|
|
||||||
a4,
|
|
||||||
a5,
|
|
||||||
a6,
|
|
||||||
a7,
|
|
||||||
a8,
|
|
||||||
a9,
|
|
||||||
a10,
|
|
||||||
a11,
|
|
||||||
a12
|
|
||||||
]).reflectee;
|
|
||||||
case 13:
|
case 13:
|
||||||
return (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13) =>
|
return (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13) =>
|
||||||
create(name, [
|
create(name, [
|
||||||
|
@ -104,7 +93,8 @@ class ReflectionCapabilities implements PlatformReflectionCapabilities {
|
||||||
]).reflectee;
|
]).reflectee;
|
||||||
case 15:
|
case 15:
|
||||||
return (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14,
|
return (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14,
|
||||||
a15) => create(name, [
|
a15) =>
|
||||||
|
create(name, [
|
||||||
a1,
|
a1,
|
||||||
a2,
|
a2,
|
||||||
a3,
|
a3,
|
||||||
|
@ -123,7 +113,8 @@ class ReflectionCapabilities implements PlatformReflectionCapabilities {
|
||||||
]).reflectee;
|
]).reflectee;
|
||||||
case 16:
|
case 16:
|
||||||
return (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14,
|
return (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14,
|
||||||
a15, a16) => create(name, [
|
a15, a16) =>
|
||||||
|
create(name, [
|
||||||
a1,
|
a1,
|
||||||
a2,
|
a2,
|
||||||
a3,
|
a3,
|
||||||
|
@ -143,7 +134,8 @@ class ReflectionCapabilities implements PlatformReflectionCapabilities {
|
||||||
]).reflectee;
|
]).reflectee;
|
||||||
case 17:
|
case 17:
|
||||||
return (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14,
|
return (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14,
|
||||||
a15, a16, a17) => create(name, [
|
a15, a16, a17) =>
|
||||||
|
create(name, [
|
||||||
a1,
|
a1,
|
||||||
a2,
|
a2,
|
||||||
a3,
|
a3,
|
||||||
|
@ -164,7 +156,8 @@ class ReflectionCapabilities implements PlatformReflectionCapabilities {
|
||||||
]).reflectee;
|
]).reflectee;
|
||||||
case 18:
|
case 18:
|
||||||
return (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14,
|
return (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14,
|
||||||
a15, a16, a17, a18) => create(name, [
|
a15, a16, a17, a18) =>
|
||||||
|
create(name, [
|
||||||
a1,
|
a1,
|
||||||
a2,
|
a2,
|
||||||
a3,
|
a3,
|
||||||
|
@ -186,7 +179,8 @@ class ReflectionCapabilities implements PlatformReflectionCapabilities {
|
||||||
]).reflectee;
|
]).reflectee;
|
||||||
case 19:
|
case 19:
|
||||||
return (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14,
|
return (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14,
|
||||||
a15, a16, a17, a18, a19) => create(name, [
|
a15, a16, a17, a18, a19) =>
|
||||||
|
create(name, [
|
||||||
a1,
|
a1,
|
||||||
a2,
|
a2,
|
||||||
a3,
|
a3,
|
||||||
|
@ -209,7 +203,8 @@ class ReflectionCapabilities implements PlatformReflectionCapabilities {
|
||||||
]).reflectee;
|
]).reflectee;
|
||||||
case 20:
|
case 20:
|
||||||
return (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14,
|
return (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14,
|
||||||
a15, a16, a17, a18, a19, a20) => create(name, [
|
a15, a16, a17, a18, a19, a20) =>
|
||||||
|
create(name, [
|
||||||
a1,
|
a1,
|
||||||
a2,
|
a2,
|
||||||
a3,
|
a3,
|
||||||
|
|
|
@ -30,9 +30,13 @@ class HammerGesturesPlugin extends HammerGesturesPluginCommon {
|
||||||
var mc = new js.JsObject(js.context['Hammer'], [element]);
|
var mc = new js.JsObject(js.context['Hammer'], [element]);
|
||||||
|
|
||||||
var jsObj = mc.callMethod('get', ['pinch']);
|
var jsObj = mc.callMethod('get', ['pinch']);
|
||||||
jsObj.callMethod('set', [new js.JsObject.jsify({'enable': true})]);
|
jsObj.callMethod('set', [
|
||||||
|
new js.JsObject.jsify({'enable': true})
|
||||||
|
]);
|
||||||
jsObj = mc.callMethod('get', ['rotate']);
|
jsObj = mc.callMethod('get', ['rotate']);
|
||||||
jsObj.callMethod('set', [new js.JsObject.jsify({'enable': true})]);
|
jsObj.callMethod('set', [
|
||||||
|
new js.JsObject.jsify({'enable': true})
|
||||||
|
]);
|
||||||
|
|
||||||
mc.callMethod('on', [
|
mc.callMethod('on', [
|
||||||
eventName,
|
eventName,
|
||||||
|
|
|
@ -23,25 +23,25 @@ Function fakeAsync(Function fn) {
|
||||||
throw 'fakeAsync() calls can not be nested';
|
throw 'fakeAsync() calls can not be nested';
|
||||||
}
|
}
|
||||||
|
|
||||||
return ([a0 = _u, a1 = _u, a2 = _u, a3 = _u, a4 = _u, a5 = _u, a6 = _u,
|
return (
|
||||||
a7 = _u, a8 = _u, a9 = _u]) {
|
[a0 = _u,
|
||||||
|
a1 = _u,
|
||||||
|
a2 = _u,
|
||||||
|
a3 = _u,
|
||||||
|
a4 = _u,
|
||||||
|
a5 = _u,
|
||||||
|
a6 = _u,
|
||||||
|
a7 = _u,
|
||||||
|
a8 = _u,
|
||||||
|
a9 = _u]) {
|
||||||
// runZoned() to install a custom exception handler that re-throws
|
// runZoned() to install a custom exception handler that re-throws
|
||||||
return runZoned(() {
|
return runZoned(() {
|
||||||
return new quiver.FakeAsync().run((quiver.FakeAsync async) {
|
return new quiver.FakeAsync().run((quiver.FakeAsync async) {
|
||||||
try {
|
try {
|
||||||
_fakeAsync = async;
|
_fakeAsync = async;
|
||||||
List args = [
|
List args = [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9]
|
||||||
a0,
|
.takeWhile((a) => a != _u)
|
||||||
a1,
|
.toList();
|
||||||
a2,
|
|
||||||
a3,
|
|
||||||
a4,
|
|
||||||
a5,
|
|
||||||
a6,
|
|
||||||
a7,
|
|
||||||
a8,
|
|
||||||
a9
|
|
||||||
].takeWhile((a) => a != _u).toList();
|
|
||||||
var res = Function.apply(fn, args);
|
var res = Function.apply(fn, args);
|
||||||
_fakeAsync.flushMicrotasks();
|
_fakeAsync.flushMicrotasks();
|
||||||
|
|
||||||
|
@ -84,8 +84,7 @@ void tick([int millis = 0]) {
|
||||||
* This is not needed in Dart. Because quiver correctly removes a timer when
|
* This is not needed in Dart. Because quiver correctly removes a timer when
|
||||||
* it throws an exception.
|
* it throws an exception.
|
||||||
*/
|
*/
|
||||||
void clearPendingTimers() {
|
void clearPendingTimers() {}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flush any pending microtasks.
|
* Flush any pending microtasks.
|
||||||
|
|
|
@ -35,6 +35,7 @@ class SpyChangeDetectorRef extends SpyObject implements ChangeDetectorRef {
|
||||||
}
|
}
|
||||||
|
|
||||||
@proxy
|
@proxy
|
||||||
class SpyIterableDifferFactory extends SpyObject implements IterableDifferFactory {
|
class SpyIterableDifferFactory extends SpyObject
|
||||||
|
implements IterableDifferFactory {
|
||||||
noSuchMethod(m) => super.noSuchMethod(m);
|
noSuchMethod(m) => super.noSuchMethod(m);
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,7 +86,8 @@ class AnnotationMatcher extends ClassMatcherBase {
|
||||||
ClassDescriptor descriptor = firstMatch(annotation.name, assetId);
|
ClassDescriptor descriptor = firstMatch(annotation.name, assetId);
|
||||||
if (descriptor == null) return false;
|
if (descriptor == null) return false;
|
||||||
return implements(descriptor, interfaces,
|
return implements(descriptor, interfaces,
|
||||||
missingSuperClassWarning: 'Missing `custom_annotation` entry for `${descriptor.superClass}`.');
|
missingSuperClassWarning:
|
||||||
|
'Missing `custom_annotation` entry for `${descriptor.superClass}`.');
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Checks if an [Annotation] node implements [Injectable].
|
/// Checks if an [Annotation] node implements [Injectable].
|
||||||
|
|
|
@ -48,8 +48,8 @@ abstract class ClassMatcherBase {
|
||||||
if (descriptor == null) return false;
|
if (descriptor == null) return false;
|
||||||
if (interfaces.contains(descriptor)) return true;
|
if (interfaces.contains(descriptor)) return true;
|
||||||
if (descriptor.superClass == null) return false;
|
if (descriptor.superClass == null) return false;
|
||||||
var superClass = _classDescriptors.firstWhere(
|
var superClass = _classDescriptors
|
||||||
(a) => a.name == descriptor.superClass, orElse: () => null);
|
.firstWhere((a) => a.name == descriptor.superClass, orElse: () => null);
|
||||||
if (superClass == null) {
|
if (superClass == null) {
|
||||||
if (missingSuperClassWarning != null &&
|
if (missingSuperClassWarning != null &&
|
||||||
missingSuperClassWarning.isNotEmpty) {
|
missingSuperClassWarning.isNotEmpty) {
|
||||||
|
@ -74,7 +74,8 @@ ImportDirective _getMatchingImport(
|
||||||
name = className.name;
|
name = className.name;
|
||||||
}
|
}
|
||||||
if (name != descriptor.name) return null;
|
if (name != descriptor.name) return null;
|
||||||
return (className.root as CompilationUnit).directives
|
return (className.root as CompilationUnit)
|
||||||
|
.directives
|
||||||
.where((d) => d is ImportDirective)
|
.where((d) => d is ImportDirective)
|
||||||
.firstWhere((ImportDirective i) {
|
.firstWhere((ImportDirective i) {
|
||||||
var importMatch = false;
|
var importMatch = false;
|
||||||
|
@ -106,8 +107,10 @@ bool isMatch(
|
||||||
class ClassDescriptor {
|
class ClassDescriptor {
|
||||||
/// The name of the class.
|
/// The name of the class.
|
||||||
final String name;
|
final String name;
|
||||||
|
|
||||||
/// A `package:` style import path to the file where the class is defined.
|
/// A `package:` style import path to the file where the class is defined.
|
||||||
final String import;
|
final String import;
|
||||||
|
|
||||||
/// The class that this class extends or implements. This is the only optional
|
/// The class that this class extends or implements. This is the only optional
|
||||||
/// field.
|
/// field.
|
||||||
final String superClass;
|
final String superClass;
|
||||||
|
|
|
@ -108,7 +108,8 @@ class _DirectiveMetadataVisitor extends Object
|
||||||
var directiveType = _getDirectiveType('${node.name}', node.element);
|
var directiveType = _getDirectiveType('${node.name}', node.element);
|
||||||
if (directiveType >= 0) {
|
if (directiveType >= 0) {
|
||||||
if (_hasMeta) {
|
if (_hasMeta) {
|
||||||
throw new FormatException('Only one Directive is allowed per class. '
|
throw new FormatException(
|
||||||
|
'Only one Directive is allowed per class. '
|
||||||
'Found "$node" but already processed "$meta".',
|
'Found "$node" but already processed "$meta".',
|
||||||
'$node' /* source */);
|
'$node' /* source */);
|
||||||
}
|
}
|
||||||
|
@ -125,7 +126,8 @@ class _DirectiveMetadataVisitor extends Object
|
||||||
'${node.constructorName.type.name}', node.staticElement);
|
'${node.constructorName.type.name}', node.staticElement);
|
||||||
if (directiveType >= 0) {
|
if (directiveType >= 0) {
|
||||||
if (_hasMeta) {
|
if (_hasMeta) {
|
||||||
throw new FormatException('Only one Directive is allowed per class. '
|
throw new FormatException(
|
||||||
|
'Only one Directive is allowed per class. '
|
||||||
'Found "$node" but already processed "$meta".',
|
'Found "$node" but already processed "$meta".',
|
||||||
'$node' /* source */);
|
'$node' /* source */);
|
||||||
}
|
}
|
||||||
|
@ -177,8 +179,10 @@ class _DirectiveMetadataVisitor extends Object
|
||||||
String _expressionToString(Expression node, String nodeDescription) {
|
String _expressionToString(Expression node, String nodeDescription) {
|
||||||
var value = node.accept(_evaluator);
|
var value = node.accept(_evaluator);
|
||||||
if (value is! String) {
|
if (value is! String) {
|
||||||
throw new FormatException('Angular 2 could not understand the value '
|
throw new FormatException(
|
||||||
'in $nodeDescription.', '$node' /* source */);
|
'Angular 2 could not understand the value '
|
||||||
|
'in $nodeDescription.',
|
||||||
|
'$node' /* source */);
|
||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
@ -203,7 +207,8 @@ class _DirectiveMetadataVisitor extends Object
|
||||||
if (evaluated is! bool) {
|
if (evaluated is! bool) {
|
||||||
throw new FormatException(
|
throw new FormatException(
|
||||||
'Angular 2 expects a bool but could not understand the value for '
|
'Angular 2 expects a bool but could not understand the value for '
|
||||||
'Directive#compileChildren.', '$compileChildrenValue' /* source */);
|
'Directive#compileChildren.',
|
||||||
|
'$compileChildrenValue' /* source */);
|
||||||
}
|
}
|
||||||
_compileChildren = evaluated;
|
_compileChildren = evaluated;
|
||||||
}
|
}
|
||||||
|
@ -216,7 +221,8 @@ class _DirectiveMetadataVisitor extends Object
|
||||||
if (evaluated is! Map) {
|
if (evaluated is! Map) {
|
||||||
throw new FormatException(
|
throw new FormatException(
|
||||||
'Angular 2 expects a Map but could not understand the value for '
|
'Angular 2 expects a Map but could not understand the value for '
|
||||||
'$propertyName.', '$expression' /* source */);
|
'$propertyName.',
|
||||||
|
'$expression' /* source */);
|
||||||
}
|
}
|
||||||
evaluated.forEach((key, value) {
|
evaluated.forEach((key, value) {
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
|
@ -233,7 +239,8 @@ class _DirectiveMetadataVisitor extends Object
|
||||||
if (evaluated is! List) {
|
if (evaluated is! List) {
|
||||||
throw new FormatException(
|
throw new FormatException(
|
||||||
'Angular 2 expects a List but could not understand the value for '
|
'Angular 2 expects a List but could not understand the value for '
|
||||||
'$propertyName.', '$expression' /* source */);
|
'$propertyName.',
|
||||||
|
'$expression' /* source */);
|
||||||
}
|
}
|
||||||
list.addAll(evaluated);
|
list.addAll(evaluated);
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,6 +40,7 @@ class PrintLogger implements BuildLogger {
|
||||||
void error(msg, {AssetId asset, SourceSpan span}) {
|
void error(msg, {AssetId asset, SourceSpan span}) {
|
||||||
throw new PrintLoggerError(msg, asset, span);
|
throw new PrintLoggerError(msg, asset, span);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future writeOutput() => null;
|
Future writeOutput() => null;
|
||||||
Future addLogFilesFromAsset(AssetId id, [int nextNumber = 1]) => null;
|
Future addLogFilesFromAsset(AssetId id, [int nextNumber = 1]) => null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,25 +51,41 @@ class TransformerOptions {
|
||||||
/// The "correct" number of phases varies with the structure of the app.
|
/// The "correct" number of phases varies with the structure of the app.
|
||||||
final int optimizationPhases;
|
final int optimizationPhases;
|
||||||
|
|
||||||
TransformerOptions._internal(this.entryPoints, this.reflectionEntryPoints,
|
TransformerOptions._internal(
|
||||||
this.modeName, this.mirrorMode, this.initReflector,
|
this.entryPoints,
|
||||||
this.annotationMatcher, this.optimizationPhases,
|
this.reflectionEntryPoints,
|
||||||
this.generateChangeDetectors, this.inlineViews);
|
this.modeName,
|
||||||
|
this.mirrorMode,
|
||||||
|
this.initReflector,
|
||||||
|
this.annotationMatcher,
|
||||||
|
this.optimizationPhases,
|
||||||
|
this.generateChangeDetectors,
|
||||||
|
this.inlineViews);
|
||||||
|
|
||||||
factory TransformerOptions(List<String> entryPoints,
|
factory TransformerOptions(List<String> entryPoints,
|
||||||
{List<String> reflectionEntryPoints, String modeName: 'release',
|
{List<String> reflectionEntryPoints,
|
||||||
MirrorMode mirrorMode: MirrorMode.none, bool initReflector: true,
|
String modeName: 'release',
|
||||||
|
MirrorMode mirrorMode: MirrorMode.none,
|
||||||
|
bool initReflector: true,
|
||||||
List<ClassDescriptor> customAnnotationDescriptors: const [],
|
List<ClassDescriptor> customAnnotationDescriptors: const [],
|
||||||
int optimizationPhases: DEFAULT_OPTIMIZATION_PHASES,
|
int optimizationPhases: DEFAULT_OPTIMIZATION_PHASES,
|
||||||
bool inlineViews: true, bool generateChangeDetectors: true}) {
|
bool inlineViews: true,
|
||||||
|
bool generateChangeDetectors: true}) {
|
||||||
if (reflectionEntryPoints == null || reflectionEntryPoints.isEmpty) {
|
if (reflectionEntryPoints == null || reflectionEntryPoints.isEmpty) {
|
||||||
reflectionEntryPoints = entryPoints;
|
reflectionEntryPoints = entryPoints;
|
||||||
}
|
}
|
||||||
var annotationMatcher = new AnnotationMatcher()
|
var annotationMatcher = new AnnotationMatcher()
|
||||||
..addAll(customAnnotationDescriptors);
|
..addAll(customAnnotationDescriptors);
|
||||||
optimizationPhases = optimizationPhases.isNegative ? 0 : optimizationPhases;
|
optimizationPhases = optimizationPhases.isNegative ? 0 : optimizationPhases;
|
||||||
return new TransformerOptions._internal(entryPoints, reflectionEntryPoints,
|
return new TransformerOptions._internal(
|
||||||
modeName, mirrorMode, initReflector, annotationMatcher,
|
entryPoints,
|
||||||
optimizationPhases, generateChangeDetectors, inlineViews);
|
reflectionEntryPoints,
|
||||||
|
modeName,
|
||||||
|
mirrorMode,
|
||||||
|
initReflector,
|
||||||
|
annotationMatcher,
|
||||||
|
optimizationPhases,
|
||||||
|
generateChangeDetectors,
|
||||||
|
inlineViews);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,12 +10,16 @@ import 'package:angular2/src/transform/common/names.dart';
|
||||||
class RegisteredType {
|
class RegisteredType {
|
||||||
/// The type registered by this call.
|
/// The type registered by this call.
|
||||||
final Identifier typeName;
|
final Identifier typeName;
|
||||||
|
|
||||||
/// The actual call to `Reflector#registerType`.
|
/// The actual call to `Reflector#registerType`.
|
||||||
final MethodInvocation registerMethod;
|
final MethodInvocation registerMethod;
|
||||||
|
|
||||||
/// The factory method registered.
|
/// The factory method registered.
|
||||||
final Expression factoryFn;
|
final Expression factoryFn;
|
||||||
|
|
||||||
/// The parameters registered.
|
/// The parameters registered.
|
||||||
final Expression parameters;
|
final Expression parameters;
|
||||||
|
|
||||||
/// The annotations registered.
|
/// The annotations registered.
|
||||||
final Expression annotations;
|
final Expression annotations;
|
||||||
|
|
||||||
|
|
|
@ -44,8 +44,8 @@ class Rewriter {
|
||||||
visitor.loadLibraryInvocations.sort(compare);
|
visitor.loadLibraryInvocations.sort(compare);
|
||||||
|
|
||||||
var buf = new StringBuffer();
|
var buf = new StringBuffer();
|
||||||
var idx = visitor.deferredImports.fold(0,
|
var idx =
|
||||||
(int lastIdx, ImportDirective node) {
|
visitor.deferredImports.fold(0, (int lastIdx, ImportDirective node) {
|
||||||
buf.write(code.substring(lastIdx, node.offset));
|
buf.write(code.substring(lastIdx, node.offset));
|
||||||
|
|
||||||
var import = code.substring(node.offset, node.end);
|
var import = code.substring(node.offset, node.end);
|
||||||
|
@ -120,8 +120,7 @@ class _FindDeferredLibraries extends Object with RecursiveAstVisitor<Object> {
|
||||||
.map((asset) => _reader.hasInput(asset)));
|
.map((asset) => _reader.hasInput(asset)));
|
||||||
|
|
||||||
// Filter out any deferred imports that do not have ng_deps.
|
// Filter out any deferred imports that do not have ng_deps.
|
||||||
deferredImports = it
|
deferredImports = it.zip([deferredImports, hasInputs])
|
||||||
.zip([deferredImports, hasInputs])
|
|
||||||
.where((importHasInput) => importHasInput[1])
|
.where((importHasInput) => importHasInput[1])
|
||||||
.map((importHasInput) => importHasInput[0])
|
.map((importHasInput) => importHasInput[0])
|
||||||
.toList();
|
.toList();
|
||||||
|
|
|
@ -116,5 +116,6 @@ Future<Map<UriBasedDirective, String>> _processNgImports(AssetReader reader,
|
||||||
retVal[directive] = ngDepsUri;
|
retVal[directive] = ngDepsUri;
|
||||||
}
|
}
|
||||||
}, onError: (_) => null);
|
}, onError: (_) => null);
|
||||||
})).then((_) => retVal);
|
}))
|
||||||
|
.then((_) => retVal);
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,9 +30,14 @@ Future<String> createNgDeps(AssetReader reader, AssetId assetId,
|
||||||
// TODO(kegluneq): Shortcut if we can determine that there are no
|
// TODO(kegluneq): Shortcut if we can determine that there are no
|
||||||
// [Directive]s present, taking into account `export`s.
|
// [Directive]s present, taking into account `export`s.
|
||||||
var writer = new AsyncStringWriter();
|
var writer = new AsyncStringWriter();
|
||||||
var visitor = new CreateNgDepsVisitor(writer, assetId,
|
var visitor = new CreateNgDepsVisitor(
|
||||||
new XhrImpl(reader, assetId), annotationMatcher, _interfaceMatcher,
|
writer,
|
||||||
ngMeta, inlineViews: inlineViews);
|
assetId,
|
||||||
|
new XhrImpl(reader, assetId),
|
||||||
|
annotationMatcher,
|
||||||
|
_interfaceMatcher,
|
||||||
|
ngMeta,
|
||||||
|
inlineViews: inlineViews);
|
||||||
var code = await reader.readAsString(assetId);
|
var code = await reader.readAsString(assetId);
|
||||||
parseCompilationUnit(code, name: assetId.path).accept(visitor);
|
parseCompilationUnit(code, name: assetId.path).accept(visitor);
|
||||||
|
|
||||||
|
@ -76,9 +81,14 @@ class CreateNgDepsVisitor extends Object with SimpleAstVisitor<Object> {
|
||||||
/// The assetId for the file which we are parsing.
|
/// The assetId for the file which we are parsing.
|
||||||
final AssetId assetId;
|
final AssetId assetId;
|
||||||
|
|
||||||
CreateNgDepsVisitor(AsyncStringWriter writer, AssetId assetId, XHR xhr,
|
CreateNgDepsVisitor(
|
||||||
AnnotationMatcher annotationMatcher, InterfaceMatcher interfaceMatcher,
|
AsyncStringWriter writer,
|
||||||
this.ngMeta, {bool inlineViews})
|
AssetId assetId,
|
||||||
|
XHR xhr,
|
||||||
|
AnnotationMatcher annotationMatcher,
|
||||||
|
InterfaceMatcher interfaceMatcher,
|
||||||
|
this.ngMeta,
|
||||||
|
{bool inlineViews})
|
||||||
: writer = writer,
|
: writer = writer,
|
||||||
_copyVisitor = new ToSourceVisitor(writer),
|
_copyVisitor = new ToSourceVisitor(writer),
|
||||||
_factoryVisitor = new FactoryTransformVisitor(writer),
|
_factoryVisitor = new FactoryTransformVisitor(writer),
|
||||||
|
|
|
@ -124,6 +124,7 @@ class _CtorTransformVisitor extends ToSourceVisitor {
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
||||||
/// Overridden to avoid outputting grouping operators for default parameters.
|
/// Overridden to avoid outputting grouping operators for default parameters.
|
||||||
Object visitFormalParameterList(FormalParameterList node) {
|
Object visitFormalParameterList(FormalParameterList node) {
|
||||||
writer.print('(');
|
writer.print('(');
|
||||||
|
|
|
@ -9,6 +9,7 @@ class Codegen {
|
||||||
|
|
||||||
/// The prefix used to import our generated file.
|
/// The prefix used to import our generated file.
|
||||||
final String prefix;
|
final String prefix;
|
||||||
|
|
||||||
/// The import uris
|
/// The import uris
|
||||||
final Iterable<String> importUris;
|
final Iterable<String> importUris;
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,10 @@ class Rewriter {
|
||||||
final MirrorMode _mirrorMode;
|
final MirrorMode _mirrorMode;
|
||||||
final bool _writeStaticInit;
|
final bool _writeStaticInit;
|
||||||
|
|
||||||
Rewriter(this._code, this._codegen, {AstTester tester,
|
Rewriter(this._code, this._codegen,
|
||||||
MirrorMode mirrorMode: MirrorMode.none, bool writeStaticInit: true})
|
{AstTester tester,
|
||||||
|
MirrorMode mirrorMode: MirrorMode.none,
|
||||||
|
bool writeStaticInit: true})
|
||||||
: _mirrorMode = mirrorMode,
|
: _mirrorMode = mirrorMode,
|
||||||
_writeStaticInit = writeStaticInit,
|
_writeStaticInit = writeStaticInit,
|
||||||
_tester = tester == null ? const AstTester() : tester;
|
_tester = tester == null ? const AstTester() : tester;
|
||||||
|
@ -132,9 +134,8 @@ class _RewriterVisitor extends Object with RecursiveAstVisitor<Object> {
|
||||||
'Found bootstrap${node.argumentList}. Transform may not succeed.');
|
'Found bootstrap${node.argumentList}. Transform may not succeed.');
|
||||||
}
|
}
|
||||||
|
|
||||||
var reflectorInit = _setupAdded
|
var reflectorInit =
|
||||||
? ''
|
_setupAdded ? '' : ', () { ${_getStaticReflectorInitBlock()} }';
|
||||||
: ', () { ${_getStaticReflectorInitBlock()} }';
|
|
||||||
|
|
||||||
// rewrite `bootstrap(...)` to `bootstrapStatic(...)`
|
// rewrite `bootstrap(...)` to `bootstrapStatic(...)`
|
||||||
buf.write('bootstrapStatic(${args[0]}');
|
buf.write('bootstrapStatic(${args[0]}');
|
||||||
|
|
|
@ -18,8 +18,10 @@ import 'package:angular2/src/facade/lang.dart' show BaseException;
|
||||||
class Codegen {
|
class Codegen {
|
||||||
/// Stores the generated class definitions.
|
/// Stores the generated class definitions.
|
||||||
final StringBuffer _buf = new StringBuffer();
|
final StringBuffer _buf = new StringBuffer();
|
||||||
|
|
||||||
/// Stores all generated initialization code.
|
/// Stores all generated initialization code.
|
||||||
final StringBuffer _initBuf = new StringBuffer();
|
final StringBuffer _initBuf = new StringBuffer();
|
||||||
|
|
||||||
/// The names of already generated classes.
|
/// The names of already generated classes.
|
||||||
final Set<String> _names = new Set<String>();
|
final Set<String> _names = new Set<String>();
|
||||||
|
|
||||||
|
@ -78,12 +80,18 @@ class _CodegenState {
|
||||||
final CodegenNameUtil _names;
|
final CodegenNameUtil _names;
|
||||||
final bool _generateCheckNoChanges;
|
final bool _generateCheckNoChanges;
|
||||||
|
|
||||||
_CodegenState._(this._changeDetectorDefId, this._contextTypeName,
|
_CodegenState._(
|
||||||
this._changeDetectorTypeName, String changeDetectionStrategy,
|
this._changeDetectorDefId,
|
||||||
this._records, this._directiveRecords, this._logic, this._names,
|
this._contextTypeName,
|
||||||
|
this._changeDetectorTypeName,
|
||||||
|
String changeDetectionStrategy,
|
||||||
|
this._records,
|
||||||
|
this._directiveRecords,
|
||||||
|
this._logic,
|
||||||
|
this._names,
|
||||||
this._generateCheckNoChanges)
|
this._generateCheckNoChanges)
|
||||||
: _changeDetectionMode = ChangeDetectionUtil
|
: _changeDetectionMode =
|
||||||
.changeDetectionMode(changeDetectionStrategy);
|
ChangeDetectionUtil.changeDetectionMode(changeDetectionStrategy);
|
||||||
|
|
||||||
factory _CodegenState(String typeName, String changeDetectorTypeName,
|
factory _CodegenState(String typeName, String changeDetectorTypeName,
|
||||||
ChangeDetectorDefinition def) {
|
ChangeDetectorDefinition def) {
|
||||||
|
@ -92,8 +100,15 @@ class _CodegenState {
|
||||||
var protoRecords = coalesce(recBuilder.records);
|
var protoRecords = coalesce(recBuilder.records);
|
||||||
var names = new CodegenNameUtil(protoRecords, def.directiveRecords, _UTIL);
|
var names = new CodegenNameUtil(protoRecords, def.directiveRecords, _UTIL);
|
||||||
var logic = new CodegenLogicUtil(names, _UTIL);
|
var logic = new CodegenLogicUtil(names, _UTIL);
|
||||||
return new _CodegenState._(def.id, typeName, changeDetectorTypeName,
|
return new _CodegenState._(
|
||||||
def.strategy, protoRecords, def.directiveRecords, logic, names,
|
def.id,
|
||||||
|
typeName,
|
||||||
|
changeDetectorTypeName,
|
||||||
|
def.strategy,
|
||||||
|
protoRecords,
|
||||||
|
def.directiveRecords,
|
||||||
|
logic,
|
||||||
|
names,
|
||||||
def.generateCheckNoChanges);
|
def.generateCheckNoChanges);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,8 +39,8 @@ Future<String> processTemplates(AssetReader reader, AssetId entryPoint,
|
||||||
// Note: TemplateCloner(-1) never serializes Nodes into strings.
|
// Note: TemplateCloner(-1) never serializes Nodes into strings.
|
||||||
// we might want to change this to TemplateCloner(0) to force the serialization
|
// we might want to change this to TemplateCloner(0) to force the serialization
|
||||||
// later when the transformer also stores the proto view template.
|
// later when the transformer also stores the proto view template.
|
||||||
var extractor = new _TemplateExtractor(
|
var extractor = new _TemplateExtractor(new DomElementSchemaRegistry(),
|
||||||
new DomElementSchemaRegistry(), new TemplateCloner(-1), new XhrImpl(reader, entryPoint));
|
new TemplateCloner(-1), new XhrImpl(reader, entryPoint));
|
||||||
|
|
||||||
var registrations = new reg.Codegen();
|
var registrations = new reg.Codegen();
|
||||||
var changeDetectorClasses = new change.Codegen();
|
var changeDetectorClasses = new change.Codegen();
|
||||||
|
@ -93,7 +93,8 @@ class _TemplateExtractor {
|
||||||
ElementSchemaRegistry _schemaRegistry;
|
ElementSchemaRegistry _schemaRegistry;
|
||||||
TemplateCloner _templateCloner;
|
TemplateCloner _templateCloner;
|
||||||
|
|
||||||
_TemplateExtractor(ElementSchemaRegistry schemaRegistry, TemplateCloner templateCloner, XHR xhr)
|
_TemplateExtractor(ElementSchemaRegistry schemaRegistry,
|
||||||
|
TemplateCloner templateCloner, XHR xhr)
|
||||||
: _factory = new CompileStepFactory(new ng.Parser(new ng.Lexer())) {
|
: _factory = new CompileStepFactory(new ng.Parser(new ng.Lexer())) {
|
||||||
var urlResolver = new UrlResolver();
|
var urlResolver = new UrlResolver();
|
||||||
var styleUrlResolver = new StyleUrlResolver(urlResolver);
|
var styleUrlResolver = new StyleUrlResolver(urlResolver);
|
||||||
|
@ -120,10 +121,12 @@ class _TemplateExtractor {
|
||||||
var pipeline = new CompilePipeline(_factory.createSteps(viewDef));
|
var pipeline = new CompilePipeline(_factory.createSteps(viewDef));
|
||||||
|
|
||||||
var compileElements = pipeline.processElements(
|
var compileElements = pipeline.processElements(
|
||||||
DOM.createTemplate(templateAndStyles.template), ViewType.COMPONENT,
|
DOM.createTemplate(templateAndStyles.template),
|
||||||
|
ViewType.COMPONENT,
|
||||||
viewDef);
|
viewDef);
|
||||||
var protoViewDto =
|
var protoViewDto = compileElements[0]
|
||||||
compileElements[0].inheritedProtoView.build(_schemaRegistry, _templateCloner);
|
.inheritedProtoView
|
||||||
|
.build(_schemaRegistry, _templateCloner);
|
||||||
|
|
||||||
reflector.reflectionCapabilities = savedReflectionCapabilities;
|
reflector.reflectionCapabilities = savedReflectionCapabilities;
|
||||||
|
|
||||||
|
|
|
@ -39,8 +39,10 @@ _nullMethod(Object p, List a) => null;
|
||||||
class RecordingReflectionCapabilities extends NullReflectionCapabilities {
|
class RecordingReflectionCapabilities extends NullReflectionCapabilities {
|
||||||
/// The names of all requested `getter`s.
|
/// The names of all requested `getter`s.
|
||||||
final Set<String> getterNames = new Set<String>();
|
final Set<String> getterNames = new Set<String>();
|
||||||
|
|
||||||
/// The names of all requested `setter`s.
|
/// The names of all requested `setter`s.
|
||||||
final Set<String> setterNames = new Set<String>();
|
final Set<String> setterNames = new Set<String>();
|
||||||
|
|
||||||
/// The names of all requested `method`s.
|
/// The names of all requested `method`s.
|
||||||
final Set<String> methodNames = new Set<String>();
|
final Set<String> methodNames = new Set<String>();
|
||||||
|
|
||||||
|
|
|
@ -63,8 +63,16 @@ final Map EVENT_PROPERTIES = {
|
||||||
|
|
||||||
// List of all elements with HTML value attribute.
|
// List of all elements with HTML value attribute.
|
||||||
// Taken from: https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes
|
// Taken from: https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes
|
||||||
final Set<String> NODES_WITH_VALUE =
|
final Set<String> NODES_WITH_VALUE = new Set<String>.from([
|
||||||
new Set<String>.from(["input", "select", "option", "button", "li", "meter", "progress", "param"]);
|
"input",
|
||||||
|
"select",
|
||||||
|
"option",
|
||||||
|
"button",
|
||||||
|
"li",
|
||||||
|
"meter",
|
||||||
|
"progress",
|
||||||
|
"param"
|
||||||
|
]);
|
||||||
|
|
||||||
Map<String, dynamic> serializeGenericEvent(dynamic e) {
|
Map<String, dynamic> serializeGenericEvent(dynamic e) {
|
||||||
return serializeEvent(e, EVENT_PROPERTIES);
|
return serializeEvent(e, EVENT_PROPERTIES);
|
||||||
|
@ -76,6 +84,7 @@ Map<String, dynamic> serializeEventWithValue(dynamic e) {
|
||||||
var serializedEvent = serializeEvent(e, EVENT_PROPERTIES);
|
var serializedEvent = serializeEvent(e, EVENT_PROPERTIES);
|
||||||
return addValue(e, serializedEvent);
|
return addValue(e, serializedEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, dynamic> serializeMouseEvent(dynamic e) {
|
Map<String, dynamic> serializeMouseEvent(dynamic e) {
|
||||||
return serializeEvent(e, MOUSE_EVENT_PROPERTIES);
|
return serializeEvent(e, MOUSE_EVENT_PROPERTIES);
|
||||||
}
|
}
|
||||||
|
@ -87,7 +96,7 @@ Map<String, dynamic> serializeKeyboardEvent(dynamic e) {
|
||||||
|
|
||||||
// TODO(jteplitz602): #3374. See above.
|
// TODO(jteplitz602): #3374. See above.
|
||||||
Map<String, dynamic> addValue(dynamic e, Map<String, dynamic> serializedEvent) {
|
Map<String, dynamic> addValue(dynamic e, Map<String, dynamic> serializedEvent) {
|
||||||
if (NODES_WITH_VALUE.contains(e.target.tagName.toLowerCase())){
|
if (NODES_WITH_VALUE.contains(e.target.tagName.toLowerCase())) {
|
||||||
serializedEvent['target'] = {'value': e.target.value};
|
serializedEvent['target'] = {'value': e.target.value};
|
||||||
}
|
}
|
||||||
return serializedEvent;
|
return serializedEvent;
|
||||||
|
|
|
@ -31,10 +31,10 @@ class GenericEvent {
|
||||||
Point get page => _getPoint('page');
|
Point get page => _getPoint('page');
|
||||||
Point get screen => _getPoint('screen');
|
Point get screen => _getPoint('screen');
|
||||||
|
|
||||||
EventTarget get target{
|
EventTarget get target {
|
||||||
if (_target != null){
|
if (_target != null) {
|
||||||
return _target;
|
return _target;
|
||||||
} else if (properties.containsKey("target")){
|
} else if (properties.containsKey("target")) {
|
||||||
_target = new EventTarget(properties['target']);
|
_target = new EventTarget(properties['target']);
|
||||||
return _target;
|
return _target;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -16,8 +16,9 @@ allTests() {
|
||||||
Future<double> runBenchmark() async {
|
Future<double> runBenchmark() async {
|
||||||
var options = new TransformerOptions(['this_is_ignored.dart']);
|
var options = new TransformerOptions(['this_is_ignored.dart']);
|
||||||
var files = {new AssetId('a', 'a.ng_deps.dart'): aContents};
|
var files = {new AssetId('a', 'a.ng_deps.dart'): aContents};
|
||||||
return new TransformerBenchmark([[new BindGenerator(options)]], files)
|
return new TransformerBenchmark([
|
||||||
.measure();
|
[new BindGenerator(options)]
|
||||||
|
], files).measure();
|
||||||
}
|
}
|
||||||
|
|
||||||
const aContents = '''
|
const aContents = '''
|
||||||
|
|
|
@ -19,7 +19,9 @@ Future<double> runBenchmark() async {
|
||||||
new AssetId('a', 'b.ng_deps.dart'): bContents,
|
new AssetId('a', 'b.ng_deps.dart'): bContents,
|
||||||
new AssetId('a', 'c.ng_deps.dart'): cContents,
|
new AssetId('a', 'c.ng_deps.dart'): cContents,
|
||||||
};
|
};
|
||||||
return new TransformerBenchmark([[new DirectiveLinker()]], files).measure();
|
return new TransformerBenchmark([
|
||||||
|
[new DirectiveLinker()]
|
||||||
|
], files).measure();
|
||||||
}
|
}
|
||||||
|
|
||||||
const aContents = '''
|
const aContents = '''
|
||||||
|
|
|
@ -16,8 +16,9 @@ allTests() {
|
||||||
Future runBenchmark() async {
|
Future runBenchmark() async {
|
||||||
var options = new TransformerOptions(['this_is_ignored.dart']);
|
var options = new TransformerOptions(['this_is_ignored.dart']);
|
||||||
var files = {new AssetId('a', 'a.dart'): aContents,};
|
var files = {new AssetId('a', 'a.dart'): aContents,};
|
||||||
return new TransformerBenchmark([[new DirectiveProcessor(options)]], files)
|
return new TransformerBenchmark([
|
||||||
.measure();
|
[new DirectiveProcessor(options)]
|
||||||
|
], files).measure();
|
||||||
}
|
}
|
||||||
|
|
||||||
const aContents = '''
|
const aContents = '''
|
||||||
|
|
|
@ -16,8 +16,9 @@ allTests() {
|
||||||
Future runBenchmark() async {
|
Future runBenchmark() async {
|
||||||
var options = new TransformerOptions(['web/index.dart']);
|
var options = new TransformerOptions(['web/index.dart']);
|
||||||
var files = {new AssetId('a', 'web/index.dart'): indexContents,};
|
var files = {new AssetId('a', 'web/index.dart'): indexContents,};
|
||||||
return new TransformerBenchmark([[new ReflectionRemover(options)]], files)
|
return new TransformerBenchmark([
|
||||||
.measure();
|
[new ReflectionRemover(options)]
|
||||||
|
], files).measure();
|
||||||
}
|
}
|
||||||
|
|
||||||
const indexContents = '''
|
const indexContents = '''
|
||||||
|
|
|
@ -16,8 +16,9 @@ allTests() {
|
||||||
Future runBenchmark() async {
|
Future runBenchmark() async {
|
||||||
var options = new TransformerOptions(['index.dart']);
|
var options = new TransformerOptions(['index.dart']);
|
||||||
var files = {new AssetId('a', 'web/a.ng_deps.dart'): aContents,};
|
var files = {new AssetId('a', 'web/a.ng_deps.dart'): aContents,};
|
||||||
return new TransformerBenchmark([[new TemplateCompiler(options)]], files)
|
return new TransformerBenchmark([
|
||||||
.measure();
|
[new TemplateCompiler(options)]
|
||||||
|
], files).measure();
|
||||||
}
|
}
|
||||||
|
|
||||||
const aContents = '''
|
const aContents = '''
|
||||||
|
|
|
@ -19,8 +19,9 @@ Future runBenchmark() async {
|
||||||
new AssetId('a', 'web/a.ng_deps.dart'): aContents,
|
new AssetId('a', 'web/a.ng_deps.dart'): aContents,
|
||||||
new AssetId('a', 'web/template.html'): templateContents,
|
new AssetId('a', 'web/template.html'): templateContents,
|
||||||
};
|
};
|
||||||
return new TransformerBenchmark([[new TemplateCompiler(options)]], files)
|
return new TransformerBenchmark([
|
||||||
.measure();
|
[new TemplateCompiler(options)]
|
||||||
|
], files).measure();
|
||||||
}
|
}
|
||||||
|
|
||||||
const aContents = '''
|
const aContents = '''
|
||||||
|
|
|
@ -12,14 +12,14 @@ main() {
|
||||||
|
|
||||||
describe("onChange", () {
|
describe("onChange", () {
|
||||||
it("should be true when the directive implements OnChange", () {
|
it("should be true when the directive implements OnChange", () {
|
||||||
expect(metadata(
|
expect(metadata(DirectiveImplementingOnChange, new Directive())
|
||||||
DirectiveImplementingOnChange, new Directive()).callOnChange)
|
.callOnChange).toBe(true);
|
||||||
.toBe(true);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should be true when the lifecycle includes onChange", () {
|
it("should be true when the lifecycle includes onChange", () {
|
||||||
expect(metadata(DirectiveNoHooks, new Directive(
|
expect(metadata(DirectiveNoHooks,
|
||||||
lifecycle: [LifecycleEvent.onChange])).callOnChange).toBe(true);
|
new Directive(lifecycle: [LifecycleEvent.onChange]))
|
||||||
|
.callOnChange).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should be false otherwise", () {
|
it("should be false otherwise", () {
|
||||||
|
@ -28,20 +28,22 @@ main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should be false when empty lifecycle", () {
|
it("should be false when empty lifecycle", () {
|
||||||
expect(metadata(DirectiveImplementingOnChange,
|
expect(metadata(
|
||||||
new Directive(lifecycle: [])).callOnChange).toBe(false);
|
DirectiveImplementingOnChange, new Directive(lifecycle: []))
|
||||||
|
.callOnChange).toBe(false);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("onDestroy", () {
|
describe("onDestroy", () {
|
||||||
it("should be true when the directive implements OnDestroy", () {
|
it("should be true when the directive implements OnDestroy", () {
|
||||||
expect(metadata(DirectiveImplementingOnDestroy,
|
expect(metadata(DirectiveImplementingOnDestroy, new Directive())
|
||||||
new Directive()).callOnDestroy).toBe(true);
|
.callOnDestroy).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should be true when the lifecycle includes onDestroy", () {
|
it("should be true when the lifecycle includes onDestroy", () {
|
||||||
expect(metadata(DirectiveNoHooks, new Directive(
|
expect(metadata(DirectiveNoHooks,
|
||||||
lifecycle: [LifecycleEvent.onDestroy])).callOnDestroy).toBe(true);
|
new Directive(lifecycle: [LifecycleEvent.onDestroy]))
|
||||||
|
.callOnDestroy).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should be false otherwise", () {
|
it("should be false otherwise", () {
|
||||||
|
@ -52,14 +54,14 @@ main() {
|
||||||
|
|
||||||
describe("onCheck", () {
|
describe("onCheck", () {
|
||||||
it("should be true when the directive implements OnCheck", () {
|
it("should be true when the directive implements OnCheck", () {
|
||||||
expect(metadata(
|
expect(metadata(DirectiveImplementingOnCheck, new Directive())
|
||||||
DirectiveImplementingOnCheck, new Directive()).callOnCheck)
|
.callOnCheck).toBe(true);
|
||||||
.toBe(true);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should be true when the lifecycle includes onCheck", () {
|
it("should be true when the lifecycle includes onCheck", () {
|
||||||
expect(metadata(DirectiveNoHooks, new Directive(
|
expect(metadata(DirectiveNoHooks,
|
||||||
lifecycle: [LifecycleEvent.onCheck])).callOnCheck).toBe(true);
|
new Directive(lifecycle: [LifecycleEvent.onCheck]))
|
||||||
|
.callOnCheck).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should be false otherwise", () {
|
it("should be false otherwise", () {
|
||||||
|
@ -70,9 +72,8 @@ main() {
|
||||||
|
|
||||||
describe("onInit", () {
|
describe("onInit", () {
|
||||||
it("should be true when the directive implements OnInit", () {
|
it("should be true when the directive implements OnInit", () {
|
||||||
expect(metadata(
|
expect(metadata(DirectiveImplementingOnInit, new Directive())
|
||||||
DirectiveImplementingOnInit, new Directive()).callOnInit)
|
.callOnInit).toBe(true);
|
||||||
.toBe(true);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should be true when the lifecycle includes onInit", () {
|
it("should be true when the lifecycle includes onInit", () {
|
||||||
|
@ -89,21 +90,20 @@ main() {
|
||||||
|
|
||||||
describe("onAllChangesDone", () {
|
describe("onAllChangesDone", () {
|
||||||
it("should be true when the directive implements OnAllChangesDone", () {
|
it("should be true when the directive implements OnAllChangesDone", () {
|
||||||
expect(metadata(DirectiveImplementingOnAllChangesDone,
|
expect(
|
||||||
new Directive()).callOnAllChangesDone).toBe(true);
|
metadata(DirectiveImplementingOnAllChangesDone, new Directive())
|
||||||
|
.callOnAllChangesDone).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should be true when the lifecycle includes onAllChangesDone", () {
|
it("should be true when the lifecycle includes onAllChangesDone", () {
|
||||||
expect(metadata(DirectiveNoHooks, new Directive(
|
expect(metadata(DirectiveNoHooks,
|
||||||
lifecycle: [
|
new Directive(lifecycle: [LifecycleEvent.onAllChangesDone]))
|
||||||
LifecycleEvent.onAllChangesDone
|
.callOnAllChangesDone).toBe(true);
|
||||||
])).callOnAllChangesDone).toBe(true);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should be false otherwise", () {
|
it("should be false otherwise", () {
|
||||||
expect(metadata(
|
expect(metadata(DirectiveNoHooks, new Directive())
|
||||||
DirectiveNoHooks, new Directive()).callOnAllChangesDone)
|
.callOnAllChangesDone).toBe(false);
|
||||||
.toBe(false);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -12,6 +12,7 @@ class MockException implements Error {
|
||||||
var message;
|
var message;
|
||||||
var stackTrace;
|
var stackTrace;
|
||||||
}
|
}
|
||||||
|
|
||||||
class NonError {
|
class NonError {
|
||||||
var message;
|
var message;
|
||||||
}
|
}
|
||||||
|
@ -41,13 +42,15 @@ void functionThatThrowsNonError() {
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
describe('TypeLiteral', () {
|
describe('TypeLiteral', () {
|
||||||
it('should publish via viewBindings', inject([
|
it(
|
||||||
TestComponentBuilder,
|
'should publish via viewBindings',
|
||||||
AsyncTestCompleter
|
inject([TestComponentBuilder, AsyncTestCompleter], (tb, async) {
|
||||||
], (tb, async) {
|
|
||||||
tb
|
tb
|
||||||
.overrideView(Dummy, new View(
|
.overrideView(
|
||||||
template: '<type-literal-component></type-literal-component>',
|
Dummy,
|
||||||
|
new View(
|
||||||
|
template:
|
||||||
|
'<type-literal-component></type-literal-component>',
|
||||||
directives: [TypeLiteralComponent]))
|
directives: [TypeLiteralComponent]))
|
||||||
.createAsync(Dummy)
|
.createAsync(Dummy)
|
||||||
.then((tc) {
|
.then((tc) {
|
||||||
|
@ -60,12 +63,13 @@ main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Error handling', () {
|
describe('Error handling', () {
|
||||||
it('should preserve Error stack traces thrown from components', inject([
|
it(
|
||||||
TestComponentBuilder,
|
'should preserve Error stack traces thrown from components',
|
||||||
AsyncTestCompleter
|
inject([TestComponentBuilder, AsyncTestCompleter], (tb, async) {
|
||||||
], (tb, async) {
|
|
||||||
tb
|
tb
|
||||||
.overrideView(Dummy, new View(
|
.overrideView(
|
||||||
|
Dummy,
|
||||||
|
new View(
|
||||||
template: '<throwing-component></throwing-component>',
|
template: '<throwing-component></throwing-component>',
|
||||||
directives: [ThrowingComponent]))
|
directives: [ThrowingComponent]))
|
||||||
.createAsync(Dummy)
|
.createAsync(Dummy)
|
||||||
|
@ -76,12 +80,13 @@ main() {
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should preserve non-Error stack traces thrown from components', inject([
|
it(
|
||||||
TestComponentBuilder,
|
'should preserve non-Error stack traces thrown from components',
|
||||||
AsyncTestCompleter
|
inject([TestComponentBuilder, AsyncTestCompleter], (tb, async) {
|
||||||
], (tb, async) {
|
|
||||||
tb
|
tb
|
||||||
.overrideView(Dummy, new View(
|
.overrideView(
|
||||||
|
Dummy,
|
||||||
|
new View(
|
||||||
template: '<throwing-component2></throwing-component2>',
|
template: '<throwing-component2></throwing-component2>',
|
||||||
directives: [ThrowingComponent2]))
|
directives: [ThrowingComponent2]))
|
||||||
.createAsync(Dummy)
|
.createAsync(Dummy)
|
||||||
|
@ -94,12 +99,13 @@ main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Property access', () {
|
describe('Property access', () {
|
||||||
it('should distinguish between map and property access', inject([
|
it(
|
||||||
TestComponentBuilder,
|
'should distinguish between map and property access',
|
||||||
AsyncTestCompleter
|
inject([TestComponentBuilder, AsyncTestCompleter], (tb, async) {
|
||||||
], (tb, async) {
|
|
||||||
tb
|
tb
|
||||||
.overrideView(Dummy, new View(
|
.overrideView(
|
||||||
|
Dummy,
|
||||||
|
new View(
|
||||||
template: '<property-access></property-access>',
|
template: '<property-access></property-access>',
|
||||||
directives: [PropertyAccess]))
|
directives: [PropertyAccess]))
|
||||||
.createAsync(Dummy)
|
.createAsync(Dummy)
|
||||||
|
@ -111,12 +117,13 @@ main() {
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should not fallback on map access if property missing', inject([
|
it(
|
||||||
TestComponentBuilder,
|
'should not fallback on map access if property missing',
|
||||||
AsyncTestCompleter
|
inject([TestComponentBuilder, AsyncTestCompleter], (tb, async) {
|
||||||
], (tb, async) {
|
|
||||||
tb
|
tb
|
||||||
.overrideView(Dummy, new View(
|
.overrideView(
|
||||||
|
Dummy,
|
||||||
|
new View(
|
||||||
template: '<no-property-access></no-property-access>',
|
template: '<no-property-access></no-property-access>',
|
||||||
directives: [NoPropertyAccess]))
|
directives: [NoPropertyAccess]))
|
||||||
.createAsync(Dummy)
|
.createAsync(Dummy)
|
||||||
|
@ -129,12 +136,13 @@ main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('OnChange', () {
|
describe('OnChange', () {
|
||||||
it('should be notified of changes', inject([
|
it(
|
||||||
TestComponentBuilder,
|
'should be notified of changes',
|
||||||
AsyncTestCompleter
|
inject([TestComponentBuilder, AsyncTestCompleter], (tb, async) {
|
||||||
], (tb, async) {
|
|
||||||
tb
|
tb
|
||||||
.overrideView(Dummy, new View(
|
.overrideView(
|
||||||
|
Dummy,
|
||||||
|
new View(
|
||||||
template: '''<on-change [prop]="'hello'"></on-change>''',
|
template: '''<on-change [prop]="'hello'"></on-change>''',
|
||||||
directives: [OnChangeComponent]))
|
directives: [OnChangeComponent]))
|
||||||
.createAsync(Dummy)
|
.createAsync(Dummy)
|
||||||
|
@ -149,13 +157,16 @@ main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("ObservableListDiff", () {
|
describe("ObservableListDiff", () {
|
||||||
it('should be notified of changes', inject([
|
it(
|
||||||
TestComponentBuilder,
|
'should be notified of changes',
|
||||||
Log
|
inject([TestComponentBuilder, Log],
|
||||||
], fakeAsync((TestComponentBuilder tcb, Log log) {
|
fakeAsync((TestComponentBuilder tcb, Log log) {
|
||||||
tcb
|
tcb
|
||||||
.overrideView(Dummy, new View(
|
.overrideView(
|
||||||
template: '''<component-with-observable-list [list]="value"></component-with-observable-list>''',
|
Dummy,
|
||||||
|
new View(
|
||||||
|
template:
|
||||||
|
'''<component-with-observable-list [list]="value"></component-with-observable-list>''',
|
||||||
directives: [ComponentWithObservableList]))
|
directives: [ComponentWithObservableList]))
|
||||||
.createAsync(Dummy)
|
.createAsync(Dummy)
|
||||||
.then((tc) {
|
.then((tc) {
|
||||||
|
@ -179,7 +190,8 @@ main() {
|
||||||
|
|
||||||
// we changed the list => a check
|
// we changed the list => a check
|
||||||
expect(log.result()).toEqual("check; check");
|
expect(log.result()).toEqual("check; check");
|
||||||
expect(asNativeElements(tc.componentViewChildren)).toHaveText('123');
|
expect(asNativeElements(tc.componentViewChildren))
|
||||||
|
.toHaveText('123');
|
||||||
|
|
||||||
// we replaced the list => a check
|
// we replaced the list => a check
|
||||||
tc.componentInstance.value = new ObservableList.from([5, 6, 7]);
|
tc.componentInstance.value = new ObservableList.from([5, 6, 7]);
|
||||||
|
@ -187,7 +199,8 @@ main() {
|
||||||
tc.detectChanges();
|
tc.detectChanges();
|
||||||
|
|
||||||
expect(log.result()).toEqual("check; check; check");
|
expect(log.result()).toEqual("check; check; check");
|
||||||
expect(asNativeElements(tc.componentViewChildren)).toHaveText('567');
|
expect(asNativeElements(tc.componentViewChildren))
|
||||||
|
.toHaveText('567');
|
||||||
});
|
});
|
||||||
})));
|
})));
|
||||||
});
|
});
|
||||||
|
@ -203,7 +216,7 @@ class Dummy {
|
||||||
viewBindings: const [
|
viewBindings: const [
|
||||||
const Binding(const TypeLiteral<List<String>>(),
|
const Binding(const TypeLiteral<List<String>>(),
|
||||||
toValue: const <String>['Hello', 'World'])
|
toValue: const <String>['Hello', 'World'])
|
||||||
])
|
])
|
||||||
@View(template: '{{list}}')
|
@View(template: '{{list}}')
|
||||||
class TypeLiteralComponent {
|
class TypeLiteralComponent {
|
||||||
final List<String> list;
|
final List<String> list;
|
||||||
|
@ -250,9 +263,11 @@ class NoPropertyAccess {
|
||||||
final model = new PropModel();
|
final model = new PropModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Component(selector: 'on-change',
|
@Component(
|
||||||
|
selector: 'on-change',
|
||||||
// TODO: needed because of https://github.com/angular/angular/issues/2120
|
// TODO: needed because of https://github.com/angular/angular/issues/2120
|
||||||
lifecycle: const [LifecycleEvent.onChange], properties: const ['prop'])
|
lifecycle: const [LifecycleEvent.onChange],
|
||||||
|
properties: const ['prop'])
|
||||||
@View(template: '')
|
@View(template: '')
|
||||||
class OnChangeComponent implements OnChange {
|
class OnChangeComponent implements OnChange {
|
||||||
Map changes;
|
Map changes;
|
||||||
|
@ -273,11 +288,11 @@ class OnChangeComponent implements OnChange {
|
||||||
toValue: const IterableDiffers(const [
|
toValue: const IterableDiffers(const [
|
||||||
const ObservableListDiffFactory(),
|
const ObservableListDiffFactory(),
|
||||||
const DefaultIterableDifferFactory()
|
const DefaultIterableDifferFactory()
|
||||||
]
|
]))
|
||||||
))
|
])
|
||||||
])
|
|
||||||
@View(
|
@View(
|
||||||
template: '<span *ng-for="#item of list">{{item}}</span><directive-logging-checks></directive-logging-checks>',
|
template:
|
||||||
|
'<span *ng-for="#item of list">{{item}}</span><directive-logging-checks></directive-logging-checks>',
|
||||||
directives: const [NgFor, DirectiveLoggingChecks])
|
directives: const [NgFor, DirectiveLoggingChecks])
|
||||||
class ComponentWithObservableList {
|
class ComponentWithObservableList {
|
||||||
Iterable list;
|
Iterable list;
|
||||||
|
|
|
@ -40,7 +40,9 @@ main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
class Foo {}
|
class Foo {}
|
||||||
|
|
||||||
class Bar extends Foo {}
|
class Bar extends Foo {}
|
||||||
|
|
||||||
fn() => null;
|
fn() => null;
|
||||||
|
|
||||||
class Annotation {
|
class Annotation {
|
||||||
|
|
|
@ -7,8 +7,10 @@ import 'package:angular2/di.dart';
|
||||||
main() {
|
main() {
|
||||||
describe('Injector', () {
|
describe('Injector', () {
|
||||||
it('should support TypeLiteral', () {
|
it('should support TypeLiteral', () {
|
||||||
var i = Injector.resolveAndCreate(
|
var i = Injector.resolveAndCreate([
|
||||||
[bind(new TypeLiteral<List<int>>()).toValue([1, 2, 3]), Foo,]);
|
bind(new TypeLiteral<List<int>>()).toValue([1, 2, 3]),
|
||||||
|
Foo,
|
||||||
|
]);
|
||||||
expect(i.get(Foo).value).toEqual([1, 2, 3]);
|
expect(i.get(Foo).value).toEqual([1, 2, 3]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -23,8 +23,7 @@ main() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should return itself when called the first time",
|
it("should return itself when called the first time", () {
|
||||||
() {
|
|
||||||
final d = factory.create(changeDetectorRef);
|
final d = factory.create(changeDetectorRef);
|
||||||
final c = new ObservableList.from([1, 2]);
|
final c = new ObservableList.from([1, 2]);
|
||||||
expect(d.diff(c)).toBe(d);
|
expect(d.diff(c)).toBe(d);
|
||||||
|
|
|
@ -8,6 +8,7 @@ class MockException implements Error {
|
||||||
var message;
|
var message;
|
||||||
var stackTrace;
|
var stackTrace;
|
||||||
}
|
}
|
||||||
|
|
||||||
class NonError {
|
class NonError {
|
||||||
var message;
|
var message;
|
||||||
}
|
}
|
||||||
|
@ -46,8 +47,9 @@ void expectFunctionThatThrowsWithStackTrace(
|
||||||
main() {
|
main() {
|
||||||
describe('async facade', () {
|
describe('async facade', () {
|
||||||
describe('Completer', () {
|
describe('Completer', () {
|
||||||
it('should preserve Error stack traces', inject([AsyncTestCompleter],
|
it(
|
||||||
(async) {
|
'should preserve Error stack traces',
|
||||||
|
inject([AsyncTestCompleter], (async) {
|
||||||
var c = PromiseWrapper.completer();
|
var c = PromiseWrapper.completer();
|
||||||
|
|
||||||
expectFunctionThatThrowsWithStackTrace(c.promise, async);
|
expectFunctionThatThrowsWithStackTrace(c.promise, async);
|
||||||
|
@ -59,8 +61,9 @@ main() {
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should preserve error stack traces for non-Errors', inject(
|
it(
|
||||||
[AsyncTestCompleter], (async) {
|
'should preserve error stack traces for non-Errors',
|
||||||
|
inject([AsyncTestCompleter], (async) {
|
||||||
var c = PromiseWrapper.completer();
|
var c = PromiseWrapper.completer();
|
||||||
|
|
||||||
expectFunctionThatThrowsWithStackTrace(c.promise, async);
|
expectFunctionThatThrowsWithStackTrace(c.promise, async);
|
||||||
|
@ -75,8 +78,9 @@ main() {
|
||||||
|
|
||||||
describe('PromiseWrapper', () {
|
describe('PromiseWrapper', () {
|
||||||
describe('reject', () {
|
describe('reject', () {
|
||||||
it('should preserve Error stack traces', inject([AsyncTestCompleter],
|
it(
|
||||||
(async) {
|
'should preserve Error stack traces',
|
||||||
|
inject([AsyncTestCompleter], (async) {
|
||||||
try {
|
try {
|
||||||
functionThatThrows();
|
functionThatThrows();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -85,8 +89,9 @@ main() {
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should preserve stack traces for non-Errors', inject(
|
it(
|
||||||
[AsyncTestCompleter], (async) {
|
'should preserve stack traces for non-Errors',
|
||||||
|
inject([AsyncTestCompleter], (async) {
|
||||||
try {
|
try {
|
||||||
functionThatThrowsNonError();
|
functionThatThrowsNonError();
|
||||||
} catch (e, s) {
|
} catch (e, s) {
|
||||||
|
|
|
@ -25,7 +25,8 @@ void allTests() {
|
||||||
expect(output).toEqual(expected);
|
expect(output).toEqual(expected);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should generate a single setter when multiple annotations bind to the '
|
it(
|
||||||
|
'should generate a single setter when multiple annotations bind to the '
|
||||||
'same property.', () async {
|
'same property.', () async {
|
||||||
var inputPath =
|
var inputPath =
|
||||||
'bind_generator/duplicate_bind_name_files/soup.ng_deps.dart';
|
'bind_generator/duplicate_bind_name_files/soup.ng_deps.dart';
|
||||||
|
|
|
@ -8,7 +8,9 @@ void initReflector(reflector) {
|
||||||
if (_visited) return;
|
if (_visited) return;
|
||||||
_visited = true;
|
_visited = true;
|
||||||
reflector
|
reflector
|
||||||
..registerType(ToolTip, new ReflectionInfo(const [
|
..registerType(
|
||||||
|
ToolTip,
|
||||||
|
new ReflectionInfo(const [
|
||||||
const Directive(
|
const Directive(
|
||||||
selector: '[tool-tip]', properties: const ['text: tool-tip'])
|
selector: '[tool-tip]', properties: const ['text: tool-tip'])
|
||||||
], const [], () => new ToolTip()));
|
], const [], () => new ToolTip()));
|
||||||
|
|
|
@ -8,7 +8,9 @@ void initReflector(reflector) {
|
||||||
if (_visited) return;
|
if (_visited) return;
|
||||||
_visited = true;
|
_visited = true;
|
||||||
reflector
|
reflector
|
||||||
..registerType(ToolTip, new ReflectionInfo(const [
|
..registerType(
|
||||||
|
ToolTip,
|
||||||
|
new ReflectionInfo(const [
|
||||||
const Directive(
|
const Directive(
|
||||||
selector: '[tool-tip]', properties: const ['text: tool-tip'])
|
selector: '[tool-tip]', properties: const ['text: tool-tip'])
|
||||||
], const [], () => new ToolTip()))
|
], const [], () => new ToolTip()))
|
||||||
|
|
|
@ -8,12 +8,17 @@ void initReflector(reflector) {
|
||||||
if (_visited) return;
|
if (_visited) return;
|
||||||
_visited = true;
|
_visited = true;
|
||||||
reflector
|
reflector
|
||||||
..registerType(SoupComponent, new ReflectionInfo(const [
|
..registerType(
|
||||||
|
SoupComponent,
|
||||||
|
new ReflectionInfo(const [
|
||||||
const Component(
|
const Component(
|
||||||
componentServices: const [SaladComponent], properties: const ['menu'])
|
componentServices: const [SaladComponent],
|
||||||
|
properties: const ['menu'])
|
||||||
], const [], () => new SoupComponent()))
|
], const [], () => new SoupComponent()))
|
||||||
..registerType(SaladComponent, new ReflectionInfo(
|
..registerType(
|
||||||
const [const Component(properties: const ['menu'])], const [],
|
SaladComponent,
|
||||||
() => new SaladComponent()))
|
new ReflectionInfo(const [
|
||||||
|
const Component(properties: const ['menu'])
|
||||||
|
], const [], () => new SaladComponent()))
|
||||||
..registerSetters({'menu': (o, v) => o.menu = v});
|
..registerSetters({'menu': (o, v) => o.menu = v});
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,11 +8,16 @@ void initReflector(reflector) {
|
||||||
if (_visited) return;
|
if (_visited) return;
|
||||||
_visited = true;
|
_visited = true;
|
||||||
reflector
|
reflector
|
||||||
..registerType(SoupComponent, new ReflectionInfo(const [
|
..registerType(
|
||||||
|
SoupComponent,
|
||||||
|
new ReflectionInfo(const [
|
||||||
const Component(
|
const Component(
|
||||||
componentServices: const [SaladComponent], properties: const ['menu'])
|
componentServices: const [SaladComponent],
|
||||||
|
properties: const ['menu'])
|
||||||
], const [], () => new SoupComponent()))
|
], const [], () => new SoupComponent()))
|
||||||
..registerType(SaladComponent, new ReflectionInfo(
|
..registerType(
|
||||||
const [const Component(properties: const ['menu'])], const [],
|
SaladComponent,
|
||||||
() => new SaladComponent()));
|
new ReflectionInfo(const [
|
||||||
|
const Component(properties: const ['menu'])
|
||||||
|
], const [], () => new SaladComponent()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,8 +8,11 @@ void initReflector(reflector) {
|
||||||
if (_visited) return;
|
if (_visited) return;
|
||||||
_visited = true;
|
_visited = true;
|
||||||
reflector
|
reflector
|
||||||
..registerType(ToolTip, new ReflectionInfo(const [
|
..registerType(
|
||||||
|
ToolTip,
|
||||||
|
new ReflectionInfo(const [
|
||||||
const Directive(
|
const Directive(
|
||||||
selector: '[tool-tip]', events: const ['onOpen', 'close: onClose'])
|
selector: '[tool-tip]',
|
||||||
|
events: const ['onOpen', 'close: onClose'])
|
||||||
], const [], () => new ToolTip()));
|
], const [], () => new ToolTip()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,9 +8,12 @@ void initReflector(reflector) {
|
||||||
if (_visited) return;
|
if (_visited) return;
|
||||||
_visited = true;
|
_visited = true;
|
||||||
reflector
|
reflector
|
||||||
..registerType(ToolTip, new ReflectionInfo(const [
|
..registerType(
|
||||||
|
ToolTip,
|
||||||
|
new ReflectionInfo(const [
|
||||||
const Directive(
|
const Directive(
|
||||||
selector: '[tool-tip]', events: const ['onOpen', 'close: onClose'])
|
selector: '[tool-tip]',
|
||||||
|
events: const ['onOpen', 'close: onClose'])
|
||||||
], const [], () => new ToolTip()))
|
], const [], () => new ToolTip()))
|
||||||
..registerGetters({'onOpen': (o) => o.onOpen, 'close': (o) => o.close});
|
..registerGetters({'onOpen': (o) => o.onOpen, 'close': (o) => o.close});
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,7 +79,8 @@ void allTests() {
|
||||||
return Future.wait([f1, f2]);
|
return Future.wait([f1, f2]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should handle calls to async methods that complete in reverse '
|
it(
|
||||||
|
'should handle calls to async methods that complete in reverse '
|
||||||
'order while waiting.', () {
|
'order while waiting.', () {
|
||||||
var completer1 = new Completer<String>();
|
var completer1 = new Completer<String>();
|
||||||
var completer2 = new Completer<String>();
|
var completer2 = new Completer<String>();
|
||||||
|
|
|
@ -11,7 +11,9 @@ void initReflector() {
|
||||||
if (_visited) return;
|
if (_visited) return;
|
||||||
_visited = true;
|
_visited = true;
|
||||||
_ngRef.reflector
|
_ngRef.reflector
|
||||||
..registerType(HelloCmp, new _ngRef.ReflectionInfo(const [
|
..registerType(
|
||||||
|
HelloCmp,
|
||||||
|
new _ngRef.ReflectionInfo(const [
|
||||||
const Component(selector: 'hello-app'),
|
const Component(selector: 'hello-app'),
|
||||||
const View(
|
const View(
|
||||||
template: r'''{{greeting}}''',
|
template: r'''{{greeting}}''',
|
||||||
|
|
|
@ -11,7 +11,9 @@ void initReflector() {
|
||||||
if (_visited) return;
|
if (_visited) return;
|
||||||
_visited = true;
|
_visited = true;
|
||||||
_ngRef.reflector
|
_ngRef.reflector
|
||||||
..registerType(HelloCmp, new _ngRef.RegistrationInfo(const [
|
..registerType(
|
||||||
|
HelloCmp,
|
||||||
|
new _ngRef.RegistrationInfo(const [
|
||||||
const Component(selector: 'hello-app'),
|
const Component(selector: 'hello-app'),
|
||||||
const View(
|
const View(
|
||||||
template: r'''{{greeting}}''',
|
template: r'''{{greeting}}''',
|
||||||
|
|
|
@ -11,7 +11,8 @@ void initReflector() {
|
||||||
if (_visited) return;
|
if (_visited) return;
|
||||||
_visited = true;
|
_visited = true;
|
||||||
_ngRef.reflector
|
_ngRef.reflector
|
||||||
..registerType(MyComponent, new _ngRef.ReflectionInfo(
|
..registerType(
|
||||||
const [const Component(selector: '[soup]')], const [],
|
MyComponent,
|
||||||
() => new MyComponent()));
|
new _ngRef.ReflectionInfo(const [const Component(selector: '[soup]')],
|
||||||
|
const [], () => new MyComponent()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,8 +12,9 @@ void initReflector() {
|
||||||
if (_visited) return;
|
if (_visited) return;
|
||||||
_visited = true;
|
_visited = true;
|
||||||
_ngRef.reflector
|
_ngRef.reflector
|
||||||
..registerType(MyComponent, new _ngRef.ReflectionInfo(
|
..registerType(
|
||||||
const [const Component(selector: '[soup]')], const [],
|
MyComponent,
|
||||||
() => new MyComponent()));
|
new _ngRef.ReflectionInfo(const [const Component(selector: '[soup]')],
|
||||||
|
const [], () => new MyComponent()));
|
||||||
i0.initReflector();
|
i0.initReflector();
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,8 @@ void initReflector() {
|
||||||
if (_visited) return;
|
if (_visited) return;
|
||||||
_visited = true;
|
_visited = true;
|
||||||
_ngRef.reflector
|
_ngRef.reflector
|
||||||
..registerType(DependencyComponent, new _ngRef.ReflectionInfo(
|
..registerType(
|
||||||
const [const Component(selector: '[salad]')], const [],
|
DependencyComponent,
|
||||||
() => new DependencyComponent()));
|
new _ngRef.ReflectionInfo(const [const Component(selector: '[salad]')],
|
||||||
|
const [], () => new DependencyComponent()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,8 @@ void initReflector() {
|
||||||
if (_visited) return;
|
if (_visited) return;
|
||||||
_visited = true;
|
_visited = true;
|
||||||
_ngRef.reflector
|
_ngRef.reflector
|
||||||
..registerType(DependencyComponent, new _ngRef.ReflectionInfo(
|
..registerType(
|
||||||
const [const Component(selector: '[salad]')], const [],
|
DependencyComponent,
|
||||||
() => new DependencyComponent()));
|
new _ngRef.ReflectionInfo(const [const Component(selector: '[salad]')],
|
||||||
|
const [], () => new DependencyComponent()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,9 @@ void initReflector() {
|
||||||
if (_visited) return;
|
if (_visited) return;
|
||||||
_visited = true;
|
_visited = true;
|
||||||
_ngRef.reflector
|
_ngRef.reflector
|
||||||
..registerType(MyComponent, new ReflectionInfo(const [
|
..registerType(
|
||||||
|
MyComponent,
|
||||||
|
new ReflectionInfo(const [
|
||||||
const Component(
|
const Component(
|
||||||
selector: '[soup]', viewBindings: const [dep.DependencyComponent])
|
selector: '[soup]', viewBindings: const [dep.DependencyComponent])
|
||||||
], const [], () => new MyComponent()));
|
], const [], () => new MyComponent()));
|
||||||
|
|
|
@ -12,7 +12,9 @@ void initReflector() {
|
||||||
if (_visited) return;
|
if (_visited) return;
|
||||||
_visited = true;
|
_visited = true;
|
||||||
_ngRef.reflector
|
_ngRef.reflector
|
||||||
..registerType(MyComponent, new ReflectionInfo(const [
|
..registerType(
|
||||||
|
MyComponent,
|
||||||
|
new ReflectionInfo(const [
|
||||||
const Component(
|
const Component(
|
||||||
selector: '[soup]', viewBindings: const [dep.DependencyComponent])
|
selector: '[soup]', viewBindings: const [dep.DependencyComponent])
|
||||||
], const [], () => new MyComponent()));
|
], const [], () => new MyComponent()));
|
||||||
|
|
|
@ -10,7 +10,8 @@ void initReflector() {
|
||||||
if (_visited) return;
|
if (_visited) return;
|
||||||
_visited = true;
|
_visited = true;
|
||||||
_ngRef.reflector
|
_ngRef.reflector
|
||||||
..registerType(DependencyComponent, new _ngRef.ReflectionInfo(
|
..registerType(
|
||||||
const [const Component(selector: '[salad]')], const [],
|
DependencyComponent,
|
||||||
() => new DependencyComponent()));
|
new _ngRef.ReflectionInfo(const [const Component(selector: '[salad]')],
|
||||||
|
const [], () => new DependencyComponent()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,8 @@ void initReflector() {
|
||||||
if (_visited) return;
|
if (_visited) return;
|
||||||
_visited = true;
|
_visited = true;
|
||||||
_ngRef.reflector
|
_ngRef.reflector
|
||||||
..registerType(DependencyComponent, new _ngRef.ReflectionInfo(
|
..registerType(
|
||||||
const [const Component(selector: '[salad]')], const [],
|
DependencyComponent,
|
||||||
() => new DependencyComponent()));
|
new _ngRef.ReflectionInfo(const [const Component(selector: '[salad]')],
|
||||||
|
const [], () => new DependencyComponent()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,8 @@ void initReflector(reflector) {
|
||||||
if (_visited) return;
|
if (_visited) return;
|
||||||
_visited = true;
|
_visited = true;
|
||||||
reflector
|
reflector
|
||||||
..registerType(BarComponent, new ReflectionInfo(
|
..registerType(
|
||||||
const [const Component(selector: '[bar]')], const [],
|
BarComponent,
|
||||||
|
new ReflectionInfo(const [const Component(selector: '[bar]')], const [],
|
||||||
() => new BarComponent()));
|
() => new BarComponent()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,8 +11,9 @@ void initReflector(reflector) {
|
||||||
if (_visited) return;
|
if (_visited) return;
|
||||||
_visited = true;
|
_visited = true;
|
||||||
reflector
|
reflector
|
||||||
..registerType(FooComponent, new ReflectionInfo(
|
..registerType(
|
||||||
const [const Component(selector: '[foo]')], const [],
|
FooComponent,
|
||||||
|
new ReflectionInfo(const [const Component(selector: '[foo]')], const [],
|
||||||
() => new FooComponent()));
|
() => new FooComponent()));
|
||||||
i0.initReflector(reflector);
|
i0.initReflector(reflector);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,8 @@ void initReflector(reflector) {
|
||||||
if (_visited) return;
|
if (_visited) return;
|
||||||
_visited = true;
|
_visited = true;
|
||||||
reflector
|
reflector
|
||||||
..registerType(FooComponent, new ReflectionInfo(
|
..registerType(
|
||||||
const [const Component(selector: '[fo' 'o]')], const [],
|
FooComponent,
|
||||||
() => new FooComponent()));
|
new ReflectionInfo(const [const Component(selector: '[fo' 'o]')],
|
||||||
|
const [], () => new FooComponent()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,10 @@ void allTests() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should parse compile children values', () async {
|
it('should parse compile children values', () async {
|
||||||
var ngDeps = await NgDeps.parse(reader, new AssetId('a',
|
var ngDeps = await NgDeps.parse(
|
||||||
|
reader,
|
||||||
|
new AssetId(
|
||||||
|
'a',
|
||||||
'directive_metadata_extractor/'
|
'directive_metadata_extractor/'
|
||||||
'directive_metadata_files/compile_children.ng_deps.dart'));
|
'directive_metadata_files/compile_children.ng_deps.dart'));
|
||||||
var it = ngDeps.registeredTypes.iterator;
|
var it = ngDeps.registeredTypes.iterator;
|
||||||
|
@ -124,28 +127,37 @@ void allTests() {
|
||||||
|
|
||||||
it('should fail when a class is annotated with multiple Directives.',
|
it('should fail when a class is annotated with multiple Directives.',
|
||||||
() async {
|
() async {
|
||||||
var ngDeps = await NgDeps.parse(reader, new AssetId('a',
|
var ngDeps = await NgDeps.parse(
|
||||||
|
reader,
|
||||||
|
new AssetId(
|
||||||
|
'a',
|
||||||
'directive_metadata_extractor/'
|
'directive_metadata_extractor/'
|
||||||
'directive_metadata_files/too_many_directives.ng_deps.dart'));
|
'directive_metadata_files/too_many_directives.ng_deps.dart'));
|
||||||
expect(() => ngDeps.registeredTypes.first.directiveMetadata).toThrowWith(
|
expect(() => ngDeps.registeredTypes.first.directiveMetadata)
|
||||||
anInstanceOf: PrintLoggerError);
|
.toThrowWith(anInstanceOf: PrintLoggerError);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('extractMetadata', () {
|
describe('extractMetadata', () {
|
||||||
it('should generate `DirectiveMetadata` from .ng_deps.dart files.',
|
it('should generate `DirectiveMetadata` from .ng_deps.dart files.',
|
||||||
() async {
|
() async {
|
||||||
var extracted = await extractDirectiveMetadata(reader, new AssetId(
|
var extracted = await extractDirectiveMetadata(
|
||||||
'a', 'directive_metadata_extractor/simple_files/foo.ng_deps.dart'));
|
reader,
|
||||||
|
new AssetId('a',
|
||||||
|
'directive_metadata_extractor/simple_files/foo.ng_deps.dart'));
|
||||||
expect(extracted.types).toContain('FooComponent');
|
expect(extracted.types).toContain('FooComponent');
|
||||||
|
|
||||||
var extractedMeta = extracted.types['FooComponent'];
|
var extractedMeta = extracted.types['FooComponent'];
|
||||||
expect(extractedMeta.selector).toEqual('[foo]');
|
expect(extractedMeta.selector).toEqual('[foo]');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should generate `DirectiveMetadata` from .ng_deps.dart files that use '
|
it(
|
||||||
|
'should generate `DirectiveMetadata` from .ng_deps.dart files that use '
|
||||||
'automatic adjacent string concatenation.', () async {
|
'automatic adjacent string concatenation.', () async {
|
||||||
var extracted = await extractDirectiveMetadata(reader, new AssetId('a',
|
var extracted = await extractDirectiveMetadata(
|
||||||
|
reader,
|
||||||
|
new AssetId(
|
||||||
|
'a',
|
||||||
'directive_metadata_extractor/adjacent_strings_files/'
|
'directive_metadata_extractor/adjacent_strings_files/'
|
||||||
'foo.ng_deps.dart'));
|
'foo.ng_deps.dart'));
|
||||||
expect(extracted.types).toContain('FooComponent');
|
expect(extracted.types).toContain('FooComponent');
|
||||||
|
@ -155,8 +167,10 @@ void allTests() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should include `DirectiveMetadata` from exported files.', () async {
|
it('should include `DirectiveMetadata` from exported files.', () async {
|
||||||
var extracted = await extractDirectiveMetadata(reader, new AssetId(
|
var extracted = await extractDirectiveMetadata(
|
||||||
'a', 'directive_metadata_extractor/export_files/foo.ng_deps.dart'));
|
reader,
|
||||||
|
new AssetId('a',
|
||||||
|
'directive_metadata_extractor/export_files/foo.ng_deps.dart'));
|
||||||
expect(extracted.types).toContain('FooComponent');
|
expect(extracted.types).toContain('FooComponent');
|
||||||
expect(extracted.types).toContain('BarComponent');
|
expect(extracted.types).toContain('BarComponent');
|
||||||
|
|
||||||
|
@ -166,7 +180,9 @@ void allTests() {
|
||||||
|
|
||||||
it('should include `DirectiveMetadata` recursively from exported files.',
|
it('should include `DirectiveMetadata` recursively from exported files.',
|
||||||
() async {
|
() async {
|
||||||
var extracted = await extractDirectiveMetadata(reader, new AssetId('a',
|
var extracted = await extractDirectiveMetadata(
|
||||||
|
reader,
|
||||||
|
new AssetId('a',
|
||||||
'directive_metadata_extractor/recursive_export_files/foo.ng_deps.dart'));
|
'directive_metadata_extractor/recursive_export_files/foo.ng_deps.dart'));
|
||||||
expect(extracted.types).toContain('FooComponent');
|
expect(extracted.types).toContain('FooComponent');
|
||||||
expect(extracted.types).toContain('BarComponent');
|
expect(extracted.types).toContain('BarComponent');
|
||||||
|
@ -177,12 +193,17 @@ void allTests() {
|
||||||
expect(extracted.types['BazComponent'].selector).toEqual('[baz]');
|
expect(extracted.types['BazComponent'].selector).toEqual('[baz]');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should include `DirectiveMetadata` from exported files '
|
it(
|
||||||
|
'should include `DirectiveMetadata` from exported files '
|
||||||
'expressed as absolute uris', () async {
|
'expressed as absolute uris', () async {
|
||||||
reader.addAsset(new AssetId('bar', 'lib/bar.ng_deps.dart'), readFile(
|
reader.addAsset(
|
||||||
|
new AssetId('bar', 'lib/bar.ng_deps.dart'),
|
||||||
|
readFile(
|
||||||
'directive_metadata_extractor/absolute_export_files/bar.ng_deps.dart'));
|
'directive_metadata_extractor/absolute_export_files/bar.ng_deps.dart'));
|
||||||
|
|
||||||
var extracted = await extractDirectiveMetadata(reader, new AssetId('a',
|
var extracted = await extractDirectiveMetadata(
|
||||||
|
reader,
|
||||||
|
new AssetId('a',
|
||||||
'directive_metadata_extractor/absolute_export_files/foo.ng_deps.dart'));
|
'directive_metadata_extractor/absolute_export_files/foo.ng_deps.dart'));
|
||||||
expect(extracted.types).toContain('FooComponent');
|
expect(extracted.types).toContain('FooComponent');
|
||||||
expect(extracted.types).toContain('BarComponent');
|
expect(extracted.types).toContain('BarComponent');
|
||||||
|
@ -192,10 +213,14 @@ void allTests() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should include directive aliases', () async {
|
it('should include directive aliases', () async {
|
||||||
reader.addAsset(new AssetId('bar', 'lib/bar.ng_deps.dart'), readFile(
|
reader.addAsset(
|
||||||
|
new AssetId('bar', 'lib/bar.ng_deps.dart'),
|
||||||
|
readFile(
|
||||||
'directive_metadata_extractor/directive_aliases_files/bar.ng_deps.dart'));
|
'directive_metadata_extractor/directive_aliases_files/bar.ng_deps.dart'));
|
||||||
|
|
||||||
var extracted = await extractDirectiveMetadata(reader, new AssetId('a',
|
var extracted = await extractDirectiveMetadata(
|
||||||
|
reader,
|
||||||
|
new AssetId('a',
|
||||||
'directive_metadata_extractor/directive_aliases_files/foo.ng_deps.dart'));
|
'directive_metadata_extractor/directive_aliases_files/foo.ng_deps.dart'));
|
||||||
expect(extracted.aliases).toContain('alias1');
|
expect(extracted.aliases).toContain('alias1');
|
||||||
expect(extracted.aliases).toContain('alias2');
|
expect(extracted.aliases).toContain('alias2');
|
||||||
|
|
|
@ -8,7 +8,8 @@ void initReflector(reflector) {
|
||||||
if (_visited) return;
|
if (_visited) return;
|
||||||
_visited = true;
|
_visited = true;
|
||||||
reflector
|
reflector
|
||||||
..registerType(BarComponent, new ReflectionInfo(
|
..registerType(
|
||||||
const [const Component(selector: '[bar]')], const [],
|
BarComponent,
|
||||||
|
new ReflectionInfo(const [const Component(selector: '[bar]')], const [],
|
||||||
() => new BarComponent()));
|
() => new BarComponent()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,8 +11,9 @@ void initReflector(reflector) {
|
||||||
if (_visited) return;
|
if (_visited) return;
|
||||||
_visited = true;
|
_visited = true;
|
||||||
reflector
|
reflector
|
||||||
..registerType(FooComponent, new ReflectionInfo(
|
..registerType(
|
||||||
const [const Component(selector: '[foo]')], const [],
|
FooComponent,
|
||||||
|
new ReflectionInfo(const [const Component(selector: '[foo]')], const [],
|
||||||
() => new FooComponent()));
|
() => new FooComponent()));
|
||||||
i0.initReflector(reflector);
|
i0.initReflector(reflector);
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,10 @@ void initReflector(reflector) {
|
||||||
if (_visited) return;
|
if (_visited) return;
|
||||||
_visited = true;
|
_visited = true;
|
||||||
reflector
|
reflector
|
||||||
..registerType(HelloCmp, new ReflectionInfo(
|
..registerType(
|
||||||
|
HelloCmp,
|
||||||
|
new ReflectionInfo(
|
||||||
const [const Component(changeDetection: 'CHECK_ONCE')],
|
const [const Component(changeDetection: 'CHECK_ONCE')],
|
||||||
const [const []], () => new HelloCmp()));
|
const [const []],
|
||||||
|
() => new HelloCmp()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,12 +8,16 @@ void initReflector(reflector) {
|
||||||
if (_visited) return;
|
if (_visited) return;
|
||||||
_visited = true;
|
_visited = true;
|
||||||
reflector
|
reflector
|
||||||
..registerType(UnsetComp, new ReflectionInfo(
|
..registerType(
|
||||||
|
UnsetComp,
|
||||||
|
new ReflectionInfo(
|
||||||
const [const Directive()], const [const []], () => new UnsetComp()))
|
const [const Directive()], const [const []], () => new UnsetComp()))
|
||||||
..registerType(FalseComp, new ReflectionInfo(
|
..registerType(
|
||||||
const [const Directive(compileChildren: false)], const [const []],
|
FalseComp,
|
||||||
() => new FalseComp()))
|
new ReflectionInfo(const [const Directive(compileChildren: false)],
|
||||||
..registerType(TrueComp, new ReflectionInfo(
|
const [const []], () => new FalseComp()))
|
||||||
const [const Directive(compileChildren: true)], const [const []],
|
..registerType(
|
||||||
() => new TrueComp()));
|
TrueComp,
|
||||||
|
new ReflectionInfo(const [const Directive(compileChildren: true)],
|
||||||
|
const [const []], () => new TrueComp()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,8 @@ void initReflector(reflector) {
|
||||||
if (_visited) return;
|
if (_visited) return;
|
||||||
_visited = true;
|
_visited = true;
|
||||||
reflector
|
reflector
|
||||||
..registerType(HelloCmp, new ReflectionInfo(
|
..registerType(
|
||||||
const [const Directive(exportAs: 'exportAsName')], const [const []],
|
HelloCmp,
|
||||||
() => new HelloCmp()));
|
new ReflectionInfo(const [const Directive(exportAs: 'exportAsName')],
|
||||||
|
const [const []], () => new HelloCmp()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,11 @@ void initReflector(reflector) {
|
||||||
if (_visited) return;
|
if (_visited) return;
|
||||||
_visited = true;
|
_visited = true;
|
||||||
reflector
|
reflector
|
||||||
..registerType(HelloCmp, new ReflectionInfo(
|
..registerType(
|
||||||
const [const Component(events: ['onFoo', 'onBar'])], const [const []],
|
HelloCmp,
|
||||||
() => new HelloCmp()));
|
new ReflectionInfo(const [
|
||||||
|
const Component(events: ['onFoo', 'onBar'])
|
||||||
|
], const [
|
||||||
|
const []
|
||||||
|
], () => new HelloCmp()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,13 +9,16 @@ void initReflector(reflector) {
|
||||||
if (_visited) return;
|
if (_visited) return;
|
||||||
_visited = true;
|
_visited = true;
|
||||||
reflector
|
reflector
|
||||||
..registerType(HelloCmp, new ReflectionInfo(const [
|
..registerType(
|
||||||
const Component(
|
HelloCmp,
|
||||||
host: const {
|
new ReflectionInfo(const [
|
||||||
|
const Component(host: const {
|
||||||
'(change)': 'onChange(\$event)',
|
'(change)': 'onChange(\$event)',
|
||||||
'[value]': 'value',
|
'[value]': 'value',
|
||||||
'@actionName': 'actionValue',
|
'@actionName': 'actionValue',
|
||||||
'attName': 'attValue'
|
'attName': 'attValue'
|
||||||
})
|
})
|
||||||
], const [const []], () => new HelloCmp()));
|
], const [
|
||||||
|
const []
|
||||||
|
], () => new HelloCmp()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,14 +9,17 @@ void initReflector(reflector) {
|
||||||
if (_visited) return;
|
if (_visited) return;
|
||||||
_visited = true;
|
_visited = true;
|
||||||
reflector
|
reflector
|
||||||
..registerType(HelloCmp, new ReflectionInfo(const [
|
..registerType(
|
||||||
const Component(
|
HelloCmp,
|
||||||
lifecycle: [
|
new ReflectionInfo(const [
|
||||||
|
const Component(lifecycle: [
|
||||||
LifecycleEvent.onChange,
|
LifecycleEvent.onChange,
|
||||||
LifecycleEvent.onDestroy,
|
LifecycleEvent.onDestroy,
|
||||||
LifecycleEvent.onInit,
|
LifecycleEvent.onInit,
|
||||||
LifecycleEvent.onCheck,
|
LifecycleEvent.onCheck,
|
||||||
LifecycleEvent.onAllChangesDone
|
LifecycleEvent.onAllChangesDone
|
||||||
])
|
])
|
||||||
], const [const []], () => new HelloCmp()));
|
], const [
|
||||||
|
const []
|
||||||
|
], () => new HelloCmp()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,11 @@ void initReflector(reflector) {
|
||||||
if (_visited) return;
|
if (_visited) return;
|
||||||
_visited = true;
|
_visited = true;
|
||||||
reflector
|
reflector
|
||||||
..registerType(HelloCmp, new ReflectionInfo(
|
..registerType(
|
||||||
const [const Component(properties: const ['key1: val1', 'key2: val2'])],
|
HelloCmp,
|
||||||
const [const []], () => new HelloCmp()));
|
new ReflectionInfo(const [
|
||||||
|
const Component(properties: const ['key1: val1', 'key2: val2'])
|
||||||
|
], const [
|
||||||
|
const []
|
||||||
|
], () => new HelloCmp()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,8 @@ void initReflector(reflector) {
|
||||||
if (_visited) return;
|
if (_visited) return;
|
||||||
_visited = true;
|
_visited = true;
|
||||||
reflector
|
reflector
|
||||||
..registerType(HelloCmp, new ReflectionInfo(
|
..registerType(
|
||||||
const [const Component(selector: 'hello-app')], const [const []],
|
HelloCmp,
|
||||||
() => new HelloCmp()));
|
new ReflectionInfo(const [const Component(selector: 'hello-app')],
|
||||||
|
const [const []], () => new HelloCmp()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,8 +9,12 @@ void initReflector(reflector) {
|
||||||
if (_visited) return;
|
if (_visited) return;
|
||||||
_visited = true;
|
_visited = true;
|
||||||
reflector
|
reflector
|
||||||
..registerType(HelloCmp, new ReflectionInfo(const [
|
..registerType(
|
||||||
|
HelloCmp,
|
||||||
|
new ReflectionInfo(const [
|
||||||
const Component(selector: 'hello-app'),
|
const Component(selector: 'hello-app'),
|
||||||
const Component(selector: 'goodbye-app')
|
const Component(selector: 'goodbye-app')
|
||||||
], const [const []], () => new HelloCmp()));
|
], const [
|
||||||
|
const []
|
||||||
|
], () => new HelloCmp()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,8 @@ void initReflector(reflector) {
|
||||||
if (_visited) return;
|
if (_visited) return;
|
||||||
_visited = true;
|
_visited = true;
|
||||||
reflector
|
reflector
|
||||||
..registerType(BarComponent, new ReflectionInfo(
|
..registerType(
|
||||||
const [const Component(selector: '[bar]')], const [],
|
BarComponent,
|
||||||
|
new ReflectionInfo(const [const Component(selector: '[bar]')], const [],
|
||||||
() => new BarComponent()));
|
() => new BarComponent()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,8 +11,9 @@ void initReflector(reflector) {
|
||||||
if (_visited) return;
|
if (_visited) return;
|
||||||
_visited = true;
|
_visited = true;
|
||||||
reflector
|
reflector
|
||||||
..registerType(FooComponent, new ReflectionInfo(
|
..registerType(
|
||||||
const [const Component(selector: '[foo]')], const [],
|
FooComponent,
|
||||||
|
new ReflectionInfo(const [const Component(selector: '[foo]')], const [],
|
||||||
() => new FooComponent()));
|
() => new FooComponent()));
|
||||||
i0.initReflector(reflector);
|
i0.initReflector(reflector);
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,8 +11,9 @@ void initReflector(reflector) {
|
||||||
if (_visited) return;
|
if (_visited) return;
|
||||||
_visited = true;
|
_visited = true;
|
||||||
reflector
|
reflector
|
||||||
..registerType(BarComponent, new ReflectionInfo(
|
..registerType(
|
||||||
const [const Component(selector: '[bar]')], const [],
|
BarComponent,
|
||||||
|
new ReflectionInfo(const [const Component(selector: '[bar]')], const [],
|
||||||
() => new BarComponent()));
|
() => new BarComponent()));
|
||||||
i0.initReflector(reflector);
|
i0.initReflector(reflector);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,8 @@ void initReflector(reflector) {
|
||||||
if (_visited) return;
|
if (_visited) return;
|
||||||
_visited = true;
|
_visited = true;
|
||||||
reflector
|
reflector
|
||||||
..registerType(BazComponent, new ReflectionInfo(
|
..registerType(
|
||||||
const [const Component(selector: '[baz]')], const [],
|
BazComponent,
|
||||||
|
new ReflectionInfo(const [const Component(selector: '[baz]')], const [],
|
||||||
() => new BazComponent()));
|
() => new BazComponent()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,8 +11,9 @@ void initReflector(reflector) {
|
||||||
if (_visited) return;
|
if (_visited) return;
|
||||||
_visited = true;
|
_visited = true;
|
||||||
reflector
|
reflector
|
||||||
..registerType(FooComponent, new ReflectionInfo(
|
..registerType(
|
||||||
const [const Component(selector: '[foo]')], const [],
|
FooComponent,
|
||||||
|
new ReflectionInfo(const [const Component(selector: '[foo]')], const [],
|
||||||
() => new FooComponent()));
|
() => new FooComponent()));
|
||||||
i0.initReflector(reflector);
|
i0.initReflector(reflector);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,8 @@ void initReflector(reflector) {
|
||||||
if (_visited) return;
|
if (_visited) return;
|
||||||
_visited = true;
|
_visited = true;
|
||||||
reflector
|
reflector
|
||||||
..registerType(FooComponent, new ReflectionInfo(
|
..registerType(
|
||||||
const [const Component(selector: '[foo]')], const [],
|
FooComponent,
|
||||||
|
new ReflectionInfo(const [const Component(selector: '[foo]')], const [],
|
||||||
() => new FooComponent()));
|
() => new FooComponent()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,9 @@ void initReflector() {
|
||||||
if (_visited) return;
|
if (_visited) return;
|
||||||
_visited = true;
|
_visited = true;
|
||||||
_ngRef.reflector
|
_ngRef.reflector
|
||||||
..registerType(HelloCmp, new _ngRef.ReflectionInfo(const [
|
..registerType(
|
||||||
|
HelloCmp,
|
||||||
|
new _ngRef.ReflectionInfo(const [
|
||||||
const Component(selector: 'hello-app'),
|
const Component(selector: 'hello-app'),
|
||||||
const View(
|
const View(
|
||||||
template: r'''{{greeting}}''',
|
template: r'''{{greeting}}''',
|
||||||
|
|
|
@ -50,14 +50,18 @@ void allTests() {
|
||||||
'should inline `templateUrl` values.', 'url_expression_files/hello.dart');
|
'should inline `templateUrl` values.', 'url_expression_files/hello.dart');
|
||||||
|
|
||||||
var absoluteReader = new TestAssetReader();
|
var absoluteReader = new TestAssetReader();
|
||||||
absoluteReader.addAsset(new AssetId('other_package', 'lib/template.html'),
|
absoluteReader.addAsset(
|
||||||
|
new AssetId('other_package', 'lib/template.html'),
|
||||||
readFile(
|
readFile(
|
||||||
'directive_processor/absolute_url_expression_files/template.html'));
|
'directive_processor/absolute_url_expression_files/template.html'));
|
||||||
absoluteReader.addAsset(new AssetId('other_package', 'lib/template.css'),
|
absoluteReader.addAsset(
|
||||||
|
new AssetId('other_package', 'lib/template.css'),
|
||||||
readFile(
|
readFile(
|
||||||
'directive_processor/absolute_url_expression_files/template.css'));
|
'directive_processor/absolute_url_expression_files/template.css'));
|
||||||
_testProcessor('should inline `templateUrl` and `styleUrls` values expressed'
|
_testProcessor(
|
||||||
' as absolute urls.', 'absolute_url_expression_files/hello.dart',
|
'should inline `templateUrl` and `styleUrls` values expressed'
|
||||||
|
' as absolute urls.',
|
||||||
|
'absolute_url_expression_files/hello.dart',
|
||||||
reader: absoluteReader);
|
reader: absoluteReader);
|
||||||
|
|
||||||
_testProcessor(
|
_testProcessor(
|
||||||
|
@ -68,12 +72,16 @@ void allTests() {
|
||||||
readFile('directive_processor/multiple_style_urls_files/template.html'));
|
readFile('directive_processor/multiple_style_urls_files/template.html'));
|
||||||
absoluteReader.addAsset(new AssetId('a', 'lib/template.css'),
|
absoluteReader.addAsset(new AssetId('a', 'lib/template.css'),
|
||||||
readFile('directive_processor/multiple_style_urls_files/template.css'));
|
readFile('directive_processor/multiple_style_urls_files/template.css'));
|
||||||
absoluteReader.addAsset(new AssetId('a', 'lib/template_other.css'), readFile(
|
absoluteReader.addAsset(
|
||||||
|
new AssetId('a', 'lib/template_other.css'),
|
||||||
|
readFile(
|
||||||
'directive_processor/multiple_style_urls_files/template_other.css'));
|
'directive_processor/multiple_style_urls_files/template_other.css'));
|
||||||
_testProcessor(
|
_testProcessor(
|
||||||
'shouldn\'t inline multiple `styleUrls` values expressed as absolute '
|
'shouldn\'t inline multiple `styleUrls` values expressed as absolute '
|
||||||
'urls.', 'multiple_style_urls_not_inlined_files/hello.dart',
|
'urls.',
|
||||||
inlineViews: false, reader: absoluteReader);
|
'multiple_style_urls_not_inlined_files/hello.dart',
|
||||||
|
inlineViews: false,
|
||||||
|
reader: absoluteReader);
|
||||||
|
|
||||||
_testProcessor('should inline `templateUrl`s expressed as adjacent strings.',
|
_testProcessor('should inline `templateUrl`s expressed as adjacent strings.',
|
||||||
'split_url_expression_files/hello.dart');
|
'split_url_expression_files/hello.dart');
|
||||||
|
@ -118,12 +126,16 @@ void allTests() {
|
||||||
'static_function_files/hello.dart');
|
'static_function_files/hello.dart');
|
||||||
|
|
||||||
_testProcessor('should find direcive aliases patterns.',
|
_testProcessor('should find direcive aliases patterns.',
|
||||||
'directive_aliases_files/hello.dart', reader: absoluteReader);
|
'directive_aliases_files/hello.dart',
|
||||||
|
reader: absoluteReader);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _testProcessor(String name, String inputPath,
|
void _testProcessor(String name, String inputPath,
|
||||||
{List<AnnotationDescriptor> customDescriptors: const [], AssetId assetId,
|
{List<AnnotationDescriptor> customDescriptors: const [],
|
||||||
AssetReader reader, List<String> expectedLogs, bool inlineViews: true,
|
AssetId assetId,
|
||||||
|
AssetReader reader,
|
||||||
|
List<String> expectedLogs,
|
||||||
|
bool inlineViews: true,
|
||||||
bool isolate: false}) {
|
bool isolate: false}) {
|
||||||
var testFn = isolate ? iit : it;
|
var testFn = isolate ? iit : it;
|
||||||
testFn(name, () async {
|
testFn(name, () async {
|
||||||
|
@ -149,7 +161,8 @@ void _testProcessor(String name, String inputPath,
|
||||||
..addAll(customDescriptors);
|
..addAll(customDescriptors);
|
||||||
var ngMeta = new NgMeta.empty();
|
var ngMeta = new NgMeta.empty();
|
||||||
var output = await createNgDeps(
|
var output = await createNgDeps(
|
||||||
reader, inputId, annotationMatcher, ngMeta, inlineViews: inlineViews);
|
reader, inputId, annotationMatcher, ngMeta,
|
||||||
|
inlineViews: inlineViews);
|
||||||
if (output == null) {
|
if (output == null) {
|
||||||
expect(await reader.hasInput(expectedNgDepsId)).toBeFalse();
|
expect(await reader.hasInput(expectedNgDepsId)).toBeFalse();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -10,6 +10,8 @@ void initReflector() {
|
||||||
if (_visited) return;
|
if (_visited) return;
|
||||||
_visited = true;
|
_visited = true;
|
||||||
_ngRef.reflector
|
_ngRef.reflector
|
||||||
..registerType(PackageSoup, new _ngRef.ReflectionInfo(
|
..registerType(
|
||||||
|
PackageSoup,
|
||||||
|
new _ngRef.ReflectionInfo(
|
||||||
const [const Soup()], const [], () => new PackageSoup()));
|
const [const Soup()], const [], () => new PackageSoup()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,8 @@ void initReflector() {
|
||||||
if (_visited) return;
|
if (_visited) return;
|
||||||
_visited = true;
|
_visited = true;
|
||||||
_ngRef.reflector
|
_ngRef.reflector
|
||||||
..registerType(RelativeSoup, new _ngRef.ReflectionInfo(
|
..registerType(
|
||||||
|
RelativeSoup,
|
||||||
|
new _ngRef.ReflectionInfo(
|
||||||
const [const Soup()], const [], () => new RelativeSoup()));
|
const [const Soup()], const [], () => new RelativeSoup()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,9 @@ void initReflector() {
|
||||||
if (_visited) return;
|
if (_visited) return;
|
||||||
_visited = true;
|
_visited = true;
|
||||||
_ngRef.reflector
|
_ngRef.reflector
|
||||||
..registerType(HelloCmp, new _ngRef.ReflectionInfo(const [
|
..registerType(
|
||||||
|
HelloCmp,
|
||||||
|
new _ngRef.ReflectionInfo(const [
|
||||||
const Component(selector: 'hello-app'),
|
const Component(selector: 'hello-app'),
|
||||||
const View(
|
const View(
|
||||||
template: r'''{{greeting}}''',
|
template: r'''{{greeting}}''',
|
||||||
|
|
|
@ -11,7 +11,9 @@ void initReflector() {
|
||||||
if (_visited) return;
|
if (_visited) return;
|
||||||
_visited = true;
|
_visited = true;
|
||||||
_ngRef.reflector
|
_ngRef.reflector
|
||||||
..registerType(HelloCmp, new _ngRef.ReflectionInfo(const [
|
..registerType(
|
||||||
|
HelloCmp,
|
||||||
|
new _ngRef.ReflectionInfo(const [
|
||||||
const Component(selector: 'hello-app'),
|
const Component(selector: 'hello-app'),
|
||||||
const View(
|
const View(
|
||||||
template: r'''{{greeting}}''',
|
template: r'''{{greeting}}''',
|
||||||
|
|
|
@ -10,7 +10,11 @@ void initReflector() {
|
||||||
if (_visited) return;
|
if (_visited) return;
|
||||||
_visited = true;
|
_visited = true;
|
||||||
_ngRef.reflector
|
_ngRef.reflector
|
||||||
..registerType(ChangingSoupComponent, new _ngRef.ReflectionInfo(
|
..registerType(
|
||||||
const [const Component(selector: '[soup]')], const [],
|
ChangingSoupComponent,
|
||||||
() => new ChangingSoupComponent(), const [PrimaryInterface]));
|
new _ngRef.ReflectionInfo(
|
||||||
|
const [const Component(selector: '[soup]')],
|
||||||
|
const [],
|
||||||
|
() => new ChangingSoupComponent(),
|
||||||
|
const [PrimaryInterface]));
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,27 +10,57 @@ void initReflector() {
|
||||||
if (_visited) return;
|
if (_visited) return;
|
||||||
_visited = true;
|
_visited = true;
|
||||||
_ngRef.reflector
|
_ngRef.reflector
|
||||||
..registerType(OnChangeSoupComponent, new _ngRef.ReflectionInfo(const [
|
..registerType(
|
||||||
|
OnChangeSoupComponent,
|
||||||
|
new _ngRef.ReflectionInfo(
|
||||||
|
const [
|
||||||
const Component(
|
const Component(
|
||||||
selector: '[soup]', lifecycle: const [LifecycleEvent.onChange])
|
selector: '[soup]',
|
||||||
], const [], () => new OnChangeSoupComponent(), const [OnChange]))
|
lifecycle: const [LifecycleEvent.onChange])
|
||||||
..registerType(OnDestroySoupComponent, new _ngRef.ReflectionInfo(const [
|
],
|
||||||
|
const [],
|
||||||
|
() => new OnChangeSoupComponent(),
|
||||||
|
const [OnChange]))
|
||||||
|
..registerType(
|
||||||
|
OnDestroySoupComponent,
|
||||||
|
new _ngRef.ReflectionInfo(
|
||||||
|
const [
|
||||||
const Component(
|
const Component(
|
||||||
selector: '[soup]', lifecycle: const [LifecycleEvent.onDestroy])
|
selector: '[soup]',
|
||||||
], const [], () => new OnDestroySoupComponent(), const [OnDestroy]))
|
lifecycle: const [LifecycleEvent.onDestroy])
|
||||||
..registerType(OnCheckSoupComponent, new _ngRef.ReflectionInfo(const [
|
],
|
||||||
|
const [],
|
||||||
|
() => new OnDestroySoupComponent(),
|
||||||
|
const [OnDestroy]))
|
||||||
|
..registerType(
|
||||||
|
OnCheckSoupComponent,
|
||||||
|
new _ngRef.ReflectionInfo(
|
||||||
|
const [
|
||||||
const Component(
|
const Component(
|
||||||
selector: '[soup]', lifecycle: const [LifecycleEvent.onCheck])
|
selector: '[soup]', lifecycle: const [LifecycleEvent.onCheck])
|
||||||
], const [], () => new OnCheckSoupComponent(), const [OnCheck]))
|
],
|
||||||
..registerType(OnInitSoupComponent, new _ngRef.ReflectionInfo(const [
|
const [],
|
||||||
|
() => new OnCheckSoupComponent(),
|
||||||
|
const [OnCheck]))
|
||||||
|
..registerType(
|
||||||
|
OnInitSoupComponent,
|
||||||
|
new _ngRef.ReflectionInfo(
|
||||||
|
const [
|
||||||
const Component(
|
const Component(
|
||||||
selector: '[soup]', lifecycle: const [LifecycleEvent.onInit])
|
selector: '[soup]', lifecycle: const [LifecycleEvent.onInit])
|
||||||
], const [], () => new OnInitSoupComponent(), const [OnInit]))
|
],
|
||||||
..registerType(OnAllChangesDoneSoupComponent, new _ngRef.ReflectionInfo(
|
const [],
|
||||||
|
() => new OnInitSoupComponent(),
|
||||||
|
const [OnInit]))
|
||||||
|
..registerType(
|
||||||
|
OnAllChangesDoneSoupComponent,
|
||||||
|
new _ngRef.ReflectionInfo(
|
||||||
const [
|
const [
|
||||||
const Component(
|
const Component(
|
||||||
selector: '[soup]',
|
selector: '[soup]',
|
||||||
lifecycle: const [LifecycleEvent.onAllChangesDone])
|
lifecycle: const [LifecycleEvent.onAllChangesDone])
|
||||||
], const [], () => new OnAllChangesDoneSoupComponent(),
|
],
|
||||||
|
const [],
|
||||||
|
() => new OnAllChangesDoneSoupComponent(),
|
||||||
const [OnAllChangesDone]));
|
const [OnAllChangesDone]));
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,11 @@ void initReflector() {
|
||||||
if (_visited) return;
|
if (_visited) return;
|
||||||
_visited = true;
|
_visited = true;
|
||||||
_ngRef.reflector
|
_ngRef.reflector
|
||||||
..registerType(ChangingSoupComponent, new _ngRef.ReflectionInfo(
|
..registerType(
|
||||||
const [const Component(selector: '[soup]')], const [],
|
ChangingSoupComponent,
|
||||||
() => new ChangingSoupComponent(), const [OnChange, AnotherInterface]));
|
new _ngRef.ReflectionInfo(
|
||||||
|
const [const Component(selector: '[soup]')],
|
||||||
|
const [],
|
||||||
|
() => new ChangingSoupComponent(),
|
||||||
|
const [OnChange, AnotherInterface]));
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,9 @@ void initReflector() {
|
||||||
if (_visited) return;
|
if (_visited) return;
|
||||||
_visited = true;
|
_visited = true;
|
||||||
_ngRef.reflector
|
_ngRef.reflector
|
||||||
..registerType(HelloCmp, new _ngRef.ReflectionInfo(const [
|
..registerType(
|
||||||
|
HelloCmp,
|
||||||
|
new _ngRef.ReflectionInfo(const [
|
||||||
const Component(selector: 'hello-app'),
|
const Component(selector: 'hello-app'),
|
||||||
const View(
|
const View(
|
||||||
template: r'''''',
|
template: r'''''',
|
||||||
|
|
|
@ -10,7 +10,10 @@ void initReflector() {
|
||||||
if (_visited) return;
|
if (_visited) return;
|
||||||
_visited = true;
|
_visited = true;
|
||||||
_ngRef.reflector
|
_ngRef.reflector
|
||||||
..registerType(MultiSoupComponent, new _ngRef.ReflectionInfo(const [
|
..registerType(
|
||||||
|
MultiSoupComponent,
|
||||||
|
new _ngRef.ReflectionInfo(
|
||||||
|
const [
|
||||||
const Component(
|
const Component(
|
||||||
selector: '[soup]',
|
selector: '[soup]',
|
||||||
lifecycle: const [
|
lifecycle: const [
|
||||||
|
@ -18,18 +21,33 @@ void initReflector() {
|
||||||
LifecycleEvent.onDestroy,
|
LifecycleEvent.onDestroy,
|
||||||
LifecycleEvent.onInit
|
LifecycleEvent.onInit
|
||||||
])
|
])
|
||||||
], const [], () => new MultiSoupComponent(), const [
|
],
|
||||||
OnChange,
|
const [],
|
||||||
OnDestroy,
|
() => new MultiSoupComponent(),
|
||||||
OnInit
|
const [OnChange, OnDestroy, OnInit]))
|
||||||
]))
|
..registerType(
|
||||||
..registerType(MixedSoupComponent, new _ngRef.ReflectionInfo(const [
|
MixedSoupComponent,
|
||||||
|
new _ngRef.ReflectionInfo(
|
||||||
|
const [
|
||||||
const Component(
|
const Component(
|
||||||
selector: '[soup]',
|
selector: '[soup]',
|
||||||
lifecycle: const [LifecycleEvent.onChange, LifecycleEvent.onCheck])
|
lifecycle: const [
|
||||||
], const [], () => new MixedSoupComponent(), const [OnChange]))
|
LifecycleEvent.onChange,
|
||||||
..registerType(MatchedSoupComponent, new _ngRef.ReflectionInfo(const [
|
LifecycleEvent.onCheck
|
||||||
|
])
|
||||||
|
],
|
||||||
|
const [],
|
||||||
|
() => new MixedSoupComponent(),
|
||||||
|
const [OnChange]))
|
||||||
|
..registerType(
|
||||||
|
MatchedSoupComponent,
|
||||||
|
new _ngRef.ReflectionInfo(
|
||||||
|
const [
|
||||||
const Component(
|
const Component(
|
||||||
selector: '[soup]', lifecycle: const [LifecycleEvent.onChange])
|
selector: '[soup]',
|
||||||
], const [], () => new MatchedSoupComponent(), const [OnChange]));
|
lifecycle: const [LifecycleEvent.onChange])
|
||||||
|
],
|
||||||
|
const [],
|
||||||
|
() => new MatchedSoupComponent(),
|
||||||
|
const [OnChange]));
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,9 @@ void initReflector() {
|
||||||
if (_visited) return;
|
if (_visited) return;
|
||||||
_visited = true;
|
_visited = true;
|
||||||
_ngRef.reflector
|
_ngRef.reflector
|
||||||
..registerType(HelloCmp, new _ngRef.ReflectionInfo(const [
|
..registerType(
|
||||||
|
HelloCmp,
|
||||||
|
new _ngRef.ReflectionInfo(const [
|
||||||
const Component(selector: 'hello-app'),
|
const Component(selector: 'hello-app'),
|
||||||
const View(
|
const View(
|
||||||
template: r'''{{greeting}}''',
|
template: r'''{{greeting}}''',
|
||||||
|
|
|
@ -11,7 +11,9 @@ void initReflector() {
|
||||||
if (_visited) return;
|
if (_visited) return;
|
||||||
_visited = true;
|
_visited = true;
|
||||||
_ngRef.reflector
|
_ngRef.reflector
|
||||||
..registerType(HelloCmp, new _ngRef.ReflectionInfo(const [
|
..registerType(
|
||||||
|
HelloCmp,
|
||||||
|
new _ngRef.ReflectionInfo(const [
|
||||||
const Component(selector: 'hello-app'),
|
const Component(selector: 'hello-app'),
|
||||||
const View(
|
const View(
|
||||||
templateUrl: 'package:a/template.html',
|
templateUrl: 'package:a/template.html',
|
||||||
|
|
|
@ -10,8 +10,11 @@ void initReflector() {
|
||||||
if (_visited) return;
|
if (_visited) return;
|
||||||
_visited = true;
|
_visited = true;
|
||||||
_ngRef.reflector
|
_ngRef.reflector
|
||||||
..registerType(SoupComponent, new _ngRef.ReflectionInfo(
|
..registerType(
|
||||||
const [const Component(selector: '[soup]')], const [
|
SoupComponent,
|
||||||
|
new _ngRef.ReflectionInfo(const [
|
||||||
|
const Component(selector: '[soup]')
|
||||||
|
], const [
|
||||||
const [String, Tasty],
|
const [String, Tasty],
|
||||||
const [const Inject(Salt)]
|
const [const Inject(Salt)]
|
||||||
], (String description, salt) => new SoupComponent(description, salt)));
|
], (String description, salt) => new SoupComponent(description, salt)));
|
||||||
|
|
|
@ -10,8 +10,15 @@ void initReflector() {
|
||||||
if (_visited) return;
|
if (_visited) return;
|
||||||
_visited = true;
|
_visited = true;
|
||||||
_ngRef.reflector
|
_ngRef.reflector
|
||||||
..registerType(OnChangeSoupComponent, new _ngRef.ReflectionInfo(const [
|
..registerType(
|
||||||
|
OnChangeSoupComponent,
|
||||||
|
new _ngRef.ReflectionInfo(
|
||||||
|
const [
|
||||||
const prefix.Component(
|
const prefix.Component(
|
||||||
selector: '[soup]', lifecycle: const [prefix.LifecycleEvent.onChange])
|
selector: '[soup]',
|
||||||
], const [], () => new OnChangeSoupComponent(), const [prefix.OnChange]));
|
lifecycle: const [prefix.LifecycleEvent.onChange])
|
||||||
|
],
|
||||||
|
const [],
|
||||||
|
() => new OnChangeSoupComponent(),
|
||||||
|
const [prefix.OnChange]));
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,8 +11,11 @@ void initReflector() {
|
||||||
if (_visited) return;
|
if (_visited) return;
|
||||||
_visited = true;
|
_visited = true;
|
||||||
_ngRef.reflector
|
_ngRef.reflector
|
||||||
..registerType(HelloCmp, new _ngRef.ReflectionInfo(const [
|
..registerType(
|
||||||
|
HelloCmp,
|
||||||
|
new _ngRef.ReflectionInfo(const [
|
||||||
const Component(selector: 'hello-app'),
|
const Component(selector: 'hello-app'),
|
||||||
const View(template: r'''{{greeting}}''', templateUrl: r'template.html')
|
const View(
|
||||||
|
template: r'''{{greeting}}''', templateUrl: r'template.html')
|
||||||
], const [], () => new HelloCmp()));
|
], const [], () => new HelloCmp()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,8 +10,15 @@ void initReflector() {
|
||||||
if (_visited) return;
|
if (_visited) return;
|
||||||
_visited = true;
|
_visited = true;
|
||||||
_ngRef.reflector
|
_ngRef.reflector
|
||||||
..registerFunction(getMessage, new _ngRef.ReflectionInfo(
|
..registerFunction(
|
||||||
const [const Injectable()], const [const [const Inject(Message)]]))
|
getMessage,
|
||||||
..registerType(Message, new _ngRef.ReflectionInfo(
|
new _ngRef.ReflectionInfo(const [
|
||||||
|
const Injectable()
|
||||||
|
], const [
|
||||||
|
const [const Inject(Message)]
|
||||||
|
]))
|
||||||
|
..registerType(
|
||||||
|
Message,
|
||||||
|
new _ngRef.ReflectionInfo(
|
||||||
const [const Injectable()], const [], () => new Message()));
|
const [const Injectable()], const [], () => new Message()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,8 @@ void initReflector() {
|
||||||
if (_visited) return;
|
if (_visited) return;
|
||||||
_visited = true;
|
_visited = true;
|
||||||
_ngRef.reflector
|
_ngRef.reflector
|
||||||
..registerType(ChangingSoupComponent, new _ngRef.ReflectionInfo(
|
..registerType(
|
||||||
const [const Component(selector: '[soup]')], const [],
|
ChangingSoupComponent,
|
||||||
() => new ChangingSoupComponent()));
|
new _ngRef.ReflectionInfo(const [const Component(selector: '[soup]')],
|
||||||
|
const [], () => new ChangingSoupComponent()));
|
||||||
}
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue