| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library analyzer.src.dart.element.element; | 5 library analyzer.src.dart.element.element; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 import 'dart:math' show min; | 8 import 'dart:math' show min; |
| 9 | 9 |
| 10 import 'package:analyzer/dart/ast/ast.dart'; | 10 import 'package:analyzer/dart/ast/ast.dart'; |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 bool get isProxy { | 329 bool get isProxy { |
| 330 for (ElementAnnotation annotation in metadata) { | 330 for (ElementAnnotation annotation in metadata) { |
| 331 if (annotation.isProxy) { | 331 if (annotation.isProxy) { |
| 332 return true; | 332 return true; |
| 333 } | 333 } |
| 334 } | 334 } |
| 335 return false; | 335 return false; |
| 336 } | 336 } |
| 337 | 337 |
| 338 @override | 338 @override |
| 339 bool get isValidMixin => hasModifier(Modifier.MIXIN); | 339 bool get isValidMixin { |
| 340 if (!context.analysisOptions.enableSuperMixins) { |
| 341 if (hasReferenceToSuper) { |
| 342 return false; |
| 343 } |
| 344 if (!supertype.isObject) { |
| 345 return false; |
| 346 } |
| 347 } |
| 348 for (ConstructorElement constructor in constructors) { |
| 349 if (!constructor.isSynthetic && !constructor.isFactory) { |
| 350 return false; |
| 351 } |
| 352 } |
| 353 return true; |
| 354 } |
| 340 | 355 |
| 341 @override | 356 @override |
| 342 ElementKind get kind => ElementKind.CLASS; | 357 ElementKind get kind => ElementKind.CLASS; |
| 343 | 358 |
| 344 @override | 359 @override |
| 345 List<MethodElement> get methods => _methods; | 360 List<MethodElement> get methods => _methods; |
| 346 | 361 |
| 347 /** | 362 /** |
| 348 * Set the methods contained in this class to the given [methods]. | 363 * Set the methods contained in this class to the given [methods]. |
| 349 */ | 364 */ |
| (...skipping 29 matching lines...) Expand all Loading... |
| 379 ConstructorElement get unnamedConstructor { | 394 ConstructorElement get unnamedConstructor { |
| 380 for (ConstructorElement element in constructors) { | 395 for (ConstructorElement element in constructors) { |
| 381 String name = element.displayName; | 396 String name = element.displayName; |
| 382 if (name == null || name.isEmpty) { | 397 if (name == null || name.isEmpty) { |
| 383 return element; | 398 return element; |
| 384 } | 399 } |
| 385 } | 400 } |
| 386 return null; | 401 return null; |
| 387 } | 402 } |
| 388 | 403 |
| 389 /** | |
| 390 * Set whether this class is a valid mixin. | |
| 391 */ | |
| 392 void set validMixin(bool isValidMixin) { | |
| 393 setModifier(Modifier.MIXIN, isValidMixin); | |
| 394 } | |
| 395 | |
| 396 @override | 404 @override |
| 397 accept(ElementVisitor visitor) => visitor.visitClassElement(this); | 405 accept(ElementVisitor visitor) => visitor.visitClassElement(this); |
| 398 | 406 |
| 399 @override | 407 @override |
| 400 void appendTo(StringBuffer buffer) { | 408 void appendTo(StringBuffer buffer) { |
| 401 if (isAbstract) { | 409 if (isAbstract) { |
| 402 buffer.write('abstract '); | 410 buffer.write('abstract '); |
| 403 } | 411 } |
| 404 if (isEnum) { | 412 if (isEnum) { |
| 405 buffer.write('enum '); | 413 buffer.write('enum '); |
| (...skipping 4192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4598 | 4606 |
| 4599 @override | 4607 @override |
| 4600 void visitElement(Element element) { | 4608 void visitElement(Element element) { |
| 4601 int offset = element.nameOffset; | 4609 int offset = element.nameOffset; |
| 4602 if (offset != -1) { | 4610 if (offset != -1) { |
| 4603 map[offset] = element; | 4611 map[offset] = element; |
| 4604 } | 4612 } |
| 4605 super.visitElement(element); | 4613 super.visitElement(element); |
| 4606 } | 4614 } |
| 4607 } | 4615 } |
| OLD | NEW |