Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Side by Side Diff: tools/dom/templates/html/impl/impl_HTMLDocument.darttemplate

Issue 1537563006: Remove ugly check for super.created call in constructor (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sdk/lib/html/dartium/html_dartium.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 var className = MirrorSystem.getName(classMirror.simpleName); 288 var className = MirrorSystem.getName(classMirror.simpleName);
289 var methodMirror = classMirror.declarations[new Symbol("$className.created ")]; 289 var methodMirror = classMirror.declarations[new Symbol("$className.created ")];
290 if (methodMirror != null && methodMirror.isConstructor) { 290 if (methodMirror != null && methodMirror.isConstructor) {
291 createdParametersValid = true; // Assume no parameters. 291 createdParametersValid = true; // Assume no parameters.
292 if (methodMirror.parameters.length != 0) { 292 if (methodMirror.parameters.length != 0) {
293 // If any parameters each one must be optional. 293 // If any parameters each one must be optional.
294 methodMirror.parameters.forEach((parameter) { 294 methodMirror.parameters.forEach((parameter) {
295 createdParametersValid = createdParametersValid && parameter.isOptio nal; 295 createdParametersValid = createdParametersValid && parameter.isOptio nal;
296 }); 296 });
297 } 297 }
298
299 // Get the created constructor source and look at the initializer;
300 // Must call super.created() if not its as an error.
301 var createdSource = methodMirror.source;
302 superCreatedCalled = createdSource.contains("super.created(");
303 } 298 }
304 299
305 if (!superCreatedCalled) { 300 if (!createdParametersValid) {
306 throw new DomException.jsInterop('created constructor initializer must c all super.created()');
307 } else if (!createdParametersValid) {
308 throw new DomException.jsInterop('created constructor must have no param eters'); 301 throw new DomException.jsInterop('created constructor must have no param eters');
309 } 302 }
310 303
311 classMirror = classMirror.superclass; 304 classMirror = classMirror.superclass;
312 while (classMirror != classMirror.mixin) { 305 while (classMirror != classMirror.mixin) {
313 // Skip the mixins. 306 // Skip the mixins.
314 classMirror = classMirror.superclass; 307 classMirror = classMirror.superclass;
315 } 308 }
316 } 309 }
317 310
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 /// parameter must be provided. 557 /// parameter must be provided.
565 @Experimental() 558 @Experimental()
566 ElementUpgrader createElementUpgrader(Type type, {String extendsTag}) { 559 ElementUpgrader createElementUpgrader(Type type, {String extendsTag}) {
567 $if DART2JS 560 $if DART2JS
568 return new _JSElementUpgrader(this, type, extendsTag); 561 return new _JSElementUpgrader(this, type, extendsTag);
569 $else 562 $else
570 return new _VMElementUpgrader(this, type, extendsTag); 563 return new _VMElementUpgrader(this, type, extendsTag);
571 $endif 564 $endif
572 } 565 }
573 } 566 }
OLDNEW
« no previous file with comments | « sdk/lib/html/dartium/html_dartium.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698