| 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 1522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1533 void set enums(List<ClassElement> enums) { | 1533 void set enums(List<ClassElement> enums) { |
| 1534 _assertNotResynthesized(_unlinkedUnit); | 1534 _assertNotResynthesized(_unlinkedUnit); |
| 1535 for (ClassElement enumDeclaration in enums) { | 1535 for (ClassElement enumDeclaration in enums) { |
| 1536 (enumDeclaration as EnumElementImpl).enclosingElement = this; | 1536 (enumDeclaration as EnumElementImpl).enclosingElement = this; |
| 1537 } | 1537 } |
| 1538 this._enums = enums; | 1538 this._enums = enums; |
| 1539 } | 1539 } |
| 1540 | 1540 |
| 1541 @override | 1541 @override |
| 1542 List<FunctionElement> get functions { | 1542 List<FunctionElement> get functions { |
| 1543 if (_kernelContext != null) { |
| 1544 _functions ??= _kernelContext.library.procedures |
| 1545 .where((k) => k.kind == kernel.ProcedureKind.Method) |
| 1546 .map((k) => new FunctionElementImpl.forKernel(this, k)) |
| 1547 .toList(growable: false); |
| 1548 } |
| 1543 if (_unlinkedUnit != null) { | 1549 if (_unlinkedUnit != null) { |
| 1544 _functions ??= _unlinkedUnit.executables | 1550 _functions ??= _unlinkedUnit.executables |
| 1545 .where((e) => e.kind == UnlinkedExecutableKind.functionOrMethod) | 1551 .where((e) => e.kind == UnlinkedExecutableKind.functionOrMethod) |
| 1546 .map((e) => new FunctionElementImpl.forSerialized(e, this)) | 1552 .map((e) => new FunctionElementImpl.forSerialized(e, this)) |
| 1547 .toList(growable: false); | 1553 .toList(growable: false); |
| 1548 } | 1554 } |
| 1549 return _functions ?? const <FunctionElement>[]; | 1555 return _functions ?? const <FunctionElement>[]; |
| 1550 } | 1556 } |
| 1551 | 1557 |
| 1552 /** | 1558 /** |
| (...skipping 2897 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4450 FunctionElementImpl.forOffset(int nameOffset) : super("", nameOffset); | 4456 FunctionElementImpl.forOffset(int nameOffset) : super("", nameOffset); |
| 4451 | 4457 |
| 4452 /** | 4458 /** |
| 4453 * Initialize using the given serialized information. | 4459 * Initialize using the given serialized information. |
| 4454 */ | 4460 */ |
| 4455 FunctionElementImpl.forSerialized( | 4461 FunctionElementImpl.forSerialized( |
| 4456 UnlinkedExecutable serializedExecutable, ElementImpl enclosingElement) | 4462 UnlinkedExecutable serializedExecutable, ElementImpl enclosingElement) |
| 4457 : super.forSerialized(serializedExecutable, enclosingElement); | 4463 : super.forSerialized(serializedExecutable, enclosingElement); |
| 4458 | 4464 |
| 4459 /** | 4465 /** |
| 4466 * Initialize using the given kernel. |
| 4467 */ |
| 4468 FunctionElementImpl.forKernel( |
| 4469 ElementImpl enclosingElement, kernel.Procedure kernel) |
| 4470 : super.forKernel(enclosingElement, kernel); |
| 4471 |
| 4472 /** |
| 4460 * Synthesize an unnamed function element that takes [parameters] and returns | 4473 * Synthesize an unnamed function element that takes [parameters] and returns |
| 4461 * [returnType]. | 4474 * [returnType]. |
| 4462 */ | 4475 */ |
| 4463 FunctionElementImpl.synthetic( | 4476 FunctionElementImpl.synthetic( |
| 4464 List<ParameterElement> parameters, DartType returnType) | 4477 List<ParameterElement> parameters, DartType returnType) |
| 4465 : super("", -1) { | 4478 : super("", -1) { |
| 4466 isSynthetic = true; | 4479 isSynthetic = true; |
| 4467 this.returnType = returnType; | 4480 this.returnType = returnType; |
| 4468 this.parameters = parameters; | 4481 this.parameters = parameters; |
| 4469 | 4482 |
| (...skipping 4733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9203 | 9216 |
| 9204 @override | 9217 @override |
| 9205 DartObject computeConstantValue() => null; | 9218 DartObject computeConstantValue() => null; |
| 9206 | 9219 |
| 9207 @override | 9220 @override |
| 9208 void visitChildren(ElementVisitor visitor) { | 9221 void visitChildren(ElementVisitor visitor) { |
| 9209 super.visitChildren(visitor); | 9222 super.visitChildren(visitor); |
| 9210 _initializer?.accept(visitor); | 9223 _initializer?.accept(visitor); |
| 9211 } | 9224 } |
| 9212 } | 9225 } |
| OLD | NEW |