| 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?.replaceAll('\n', ' '); |
| 286 RegExp regExp = new RegExp(r":(.*?)(;|}|\n)"); | 286 RegExp regExp = new RegExp(r":(.*?)(;|}|\n)"); |
| 287 var match = regExp.firstMatch(createdSource); | 287 var match = regExp.firstMatch(createdSource); |
| 288 superCreatedCalled = match.input.substring(match.start,match.end).contai
ns("super.created("); | 288 superCreatedCalled = match.input.substring(match.start,match.end).contai
ns("super.created("); |
| 289 } | 289 } |
| 290 | 290 |
| 291 if (!superCreatedCalled) { | 291 if (!superCreatedCalled) { |
| 292 throw new DomException.jsInterop('created constructor initializer must c
all super.created()'); | 292 throw new DomException.jsInterop('created constructor initializer must c
all super.created()'); |
| 293 } else if (!createdParametersValid) { | 293 } else if (!createdParametersValid) { |
| 294 throw new DomException.jsInterop('created constructor must have no param
eters'); | 294 throw new DomException.jsInterop('created constructor must have no param
eters'); |
| 295 } | 295 } |
| 296 | 296 |
| 297 classMirror = classMirror.superclass; | 297 classMirror = classMirror.superclass; |
| 298 while (classMirror != classMirror.mixin) { |
| 299 // Skip the mixins. |
| 300 classMirror = classMirror.superclass; |
| 301 } |
| 298 } | 302 } |
| 299 | 303 |
| 300 return true; | 304 return true; |
| 301 } | 305 } |
| 302 $endif | 306 $endif |
| 303 | 307 |
| 304 @Experimental() | 308 @Experimental() |
| 305 /** | 309 /** |
| 306 * Register a custom subclass of Element to be instantiatable by the DOM. | 310 * Register a custom subclass of Element to be instantiatable by the DOM. |
| 307 * | 311 * |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 484 /// parameter must be provided. | 488 /// parameter must be provided. |
| 485 @Experimental() | 489 @Experimental() |
| 486 ElementUpgrader createElementUpgrader(Type type, {String extendsTag}) { | 490 ElementUpgrader createElementUpgrader(Type type, {String extendsTag}) { |
| 487 $if DART2JS | 491 $if DART2JS |
| 488 return new _JSElementUpgrader(this, type, extendsTag); | 492 return new _JSElementUpgrader(this, type, extendsTag); |
| 489 $else | 493 $else |
| 490 return new _VMElementUpgrader(this, type, extendsTag); | 494 return new _VMElementUpgrader(this, type, extendsTag); |
| 491 $endif | 495 $endif |
| 492 } | 496 } |
| 493 } | 497 } |
| OLD | NEW |