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