013cf68624
@ForceInline is still used by dart:html, will be removed in a later CL. Change-Id: I480325fe91cc6baefb17ead49f839442e023d441 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/95160 Commit-Queue: Johnni Winther <johnniwinther@google.com> Reviewed-by: Stephen Adams <sra@google.com>
71 lines
1.8 KiB
Dart
71 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';
|
|
|
|
/*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:[]*/
|
|
@pragma('dart2js:noInline')
|
|
newCustom() {
|
|
new CustomElement();
|
|
}
|
|
|
|
/*element: newCustomCreated:[]*/
|
|
@pragma('dart2js: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:[]*/
|
|
@pragma('dart2js:noInline')
|
|
newNormal() {
|
|
new NormalElement();
|
|
}
|
|
|
|
/*element: newNormalCreated:[]*/
|
|
@pragma('dart2js:noInline')
|
|
newNormalCreated() {
|
|
new NormalElement.created();
|
|
}
|
|
|
|
class NormalElement {
|
|
/*element: NormalElement.:[newNormal:NormalElement]*/
|
|
factory NormalElement() => null;
|
|
|
|
/*element: NormalElement.created:[newNormalCreated+,newNormalCreated:NormalElement]*/
|
|
NormalElement.created() {
|
|
print('foo');
|
|
}
|
|
}
|