dbc907a6a0
Change-Id: Ia9be24f02f07e0d3329125b2ffed28e16bf34be3 Reviewed-on: https://dart-review.googlesource.com/26280 Reviewed-by: Stephen Adams <sra@google.com>
74 lines
1.8 KiB
Dart
74 lines
1.8 KiB
Dart
// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
import 'dart:html';
|
|
|
|
/// ignore: IMPORT_INTERNAL_LIBRARY
|
|
import 'dart:_js_helper';
|
|
|
|
/*element: main:[]*/
|
|
main() {
|
|
document.createElement(CustomElement.tag);
|
|
newCustom();
|
|
newCustomCreated();
|
|
newNormal();
|
|
newNormalCreated();
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
// Create a custom element. The factory is inlined but the generative
|
|
// constructor isn't.
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
/*element: newCustom:[]*/
|
|
@NoInline()
|
|
newCustom() {
|
|
new CustomElement();
|
|
}
|
|
|
|
/*element: newCustomCreated:[]*/
|
|
@NoInline()
|
|
newCustomCreated() {
|
|
new CustomElement.created();
|
|
}
|
|
|
|
class CustomElement extends HtmlElement {
|
|
static final tag = 'x-foo';
|
|
|
|
/*element: CustomElement.:[newCustom:CustomElement]*/
|
|
factory CustomElement() => new Element.tag(tag);
|
|
|
|
/*element: CustomElement.created:[]*/
|
|
CustomElement.created() : super.created() {
|
|
print('boo');
|
|
}
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
// Create a normal class, similar to a custom element. Both the factory and
|
|
// the generative constructor are inlined.
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
/*element: newNormal:[]*/
|
|
@NoInline()
|
|
newNormal() {
|
|
new NormalElement();
|
|
}
|
|
|
|
/*element: newNormalCreated:[]*/
|
|
@NoInline()
|
|
newNormalCreated() {
|
|
new NormalElement.created();
|
|
}
|
|
|
|
class NormalElement {
|
|
/*element: NormalElement.:[newNormal:NormalElement]*/
|
|
factory NormalElement() => null;
|
|
|
|
/*element: NormalElement.created:[newNormalCreated+,newNormalCreated:NormalElement]*/
|
|
NormalElement.created() {
|
|
print('foo');
|
|
}
|
|
}
|