OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 // WARNING: Do not edit - generated code. | 5 // WARNING: Do not edit - generated code. |
6 | 6 |
7 part of $LIBRARYNAME; | 7 part of $LIBRARYNAME; |
8 | 8 |
9 $(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS
{ | 9 $(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS
{ |
10 $!MEMBERS | 10 $!MEMBERS |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 createdParametersValid = true; // Assume no parameters. | 275 createdParametersValid = true; // Assume no parameters. |
276 if (methodMirror.parameters.length != 0) { | 276 if (methodMirror.parameters.length != 0) { |
277 // If any parameters each one must be optional. | 277 // If any parameters each one must be optional. |
278 methodMirror.parameters.forEach((parameter) { | 278 methodMirror.parameters.forEach((parameter) { |
279 createdParametersValid = createdParametersValid && parameter.isOptio
nal; | 279 createdParametersValid = createdParametersValid && parameter.isOptio
nal; |
280 }); | 280 }); |
281 } | 281 } |
282 | 282 |
283 // Get the created constructor source and look at the initializer; | 283 // Get the created constructor source and look at the initializer; |
284 // Must call super.created() if not its as an error. | 284 // Must call super.created() if not its as an error. |
285 var createdSource = methodMirror.source?.replaceAll('\n', ' '); | 285 var createdSource = methodMirror.source; |
286 RegExp regExp = new RegExp(r":(.*?)(;|}|\n)"); | 286 superCreatedCalled = createdSource.contains("super.created("); |
287 var match = regExp.firstMatch(createdSource); | |
288 superCreatedCalled = match.input.substring(match.start,match.end).contai
ns("super.created("); | |
289 } | 287 } |
290 | 288 |
291 if (!superCreatedCalled) { | 289 if (!superCreatedCalled) { |
292 throw new DomException.jsInterop('created constructor initializer must c
all super.created()'); | 290 throw new DomException.jsInterop('created constructor initializer must c
all super.created()'); |
293 } else if (!createdParametersValid) { | 291 } else if (!createdParametersValid) { |
294 throw new DomException.jsInterop('created constructor must have no param
eters'); | 292 throw new DomException.jsInterop('created constructor must have no param
eters'); |
295 } | 293 } |
296 | 294 |
297 classMirror = classMirror.superclass; | 295 classMirror = classMirror.superclass; |
298 while (classMirror != classMirror.mixin) { | 296 while (classMirror != classMirror.mixin) { |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 // | 391 // |
394 // MyElement.created() : super.created() { | 392 // MyElement.created() : super.created() { |
395 // this.innerHtml = "<b>I'm an x-foo-with-markup!</b>"; | 393 // this.innerHtml = "<b>I'm an x-foo-with-markup!</b>"; |
396 // } | 394 // } |
397 // | 395 // |
398 // sanitizing causes custom element to created recursively | 396 // sanitizing causes custom element to created recursively |
399 // until stack overflow. | 397 // until stack overflow. |
400 // | 398 // |
401 // See https://github.com/dart-lang/sdk/issues/23666 | 399 // See https://github.com/dart-lang/sdk/issues/23666 |
402 int creating = 0; | 400 int creating = 0; |
403 // TODO(jacobr): warning: | 401 // TODO(jacobr): warning: |
404 elemProto['createdCallback'] = js.JsNative.withThis(($this) { | 402 elemProto['createdCallback'] = js.JsNative.withThis(($this) { |
405 if (_getJSClassName(reflectClass(customElementClass).superclass) != null
&& creating < 2) { | 403 if (_getJSClassName(reflectClass(customElementClass).superclass) != null
&& creating < 2) { |
406 creating++; | 404 creating++; |
407 | 405 |
408 var dartClass; | 406 var dartClass; |
409 try { | 407 try { |
410 dartClass = _blink.Blink_Utils.constructElement(customElementClass,
$this); | 408 dartClass = _blink.Blink_Utils.constructElement(customElementClass,
$this); |
411 } catch (e) { | 409 } catch (e) { |
412 dartClass = HtmlElement.internalCreateHtmlElement(); | 410 dartClass = HtmlElement.internalCreateHtmlElement(); |
413 dartClass._badUpgrade(); | 411 dartClass._badUpgrade(); |
414 throw e; | 412 throw e; |
415 } finally { | 413 } finally { |
416 // Need to remember the Dart class that was created for this custom
so | 414 // Need to remember the Dart class that was created for this custom
so |
417 // return it and setup the blink_jsObject to the $this that we'll be
working | 415 // return it and setup the blink_jsObject to the $this that we'll be
working |
418 // with as we talk to blink. | 416 // with as we talk to blink. |
419 js.setDartHtmlWrapperFor($this, dartClass); | 417 js.setDartHtmlWrapperFor($this, dartClass); |
420 | 418 |
421 creating--; | 419 creating--; |
422 } | 420 } |
423 } | 421 } |
424 }); | 422 }); |
425 elemProto['attributeChangedCallback'] = new js.JsFunction.withThis(($this,
attrName, oldVal, newVal) { | 423 elemProto['attributeChangedCallback'] = new js.JsFunction.withThis(($this,
attrName, oldVal, newVal) { |
426 $this.attributeChanged(attrName, oldVal, newVal); | 424 $this.attributeChanged(attrName, oldVal, newVal); |
427 }); | 425 }); |
428 elemProto['attachedCallback'] = new js.JsFunction.withThis(($this) { | 426 elemProto['attachedCallback'] = new js.JsFunction.withThis(($this) { |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 /// parameter must be provided. | 493 /// parameter must be provided. |
496 @Experimental() | 494 @Experimental() |
497 ElementUpgrader createElementUpgrader(Type type, {String extendsTag}) { | 495 ElementUpgrader createElementUpgrader(Type type, {String extendsTag}) { |
498 $if DART2JS | 496 $if DART2JS |
499 return new _JSElementUpgrader(this, type, extendsTag); | 497 return new _JSElementUpgrader(this, type, extendsTag); |
500 $else | 498 $else |
501 return new _VMElementUpgrader(this, type, extendsTag); | 499 return new _VMElementUpgrader(this, type, extendsTag); |
502 $endif | 500 $endif |
503 } | 501 } |
504 } | 502 } |
OLD | NEW |