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 2724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2735 * Initialize a newly created function element to have the given [name]. | 2735 * Initialize a newly created function element to have the given [name]. |
2736 */ | 2736 */ |
2737 FunctionElementImpl.forNode(Identifier name) : super.forNode(name); | 2737 FunctionElementImpl.forNode(Identifier name) : super.forNode(name); |
2738 | 2738 |
2739 /** | 2739 /** |
2740 * Initialize a newly created function element to have no name and the given | 2740 * Initialize a newly created function element to have no name and the given |
2741 * [offset]. This is used for function expressions, that have no name. | 2741 * [offset]. This is used for function expressions, that have no name. |
2742 */ | 2742 */ |
2743 FunctionElementImpl.forOffset(int nameOffset) : super("", nameOffset); | 2743 FunctionElementImpl.forOffset(int nameOffset) : super("", nameOffset); |
2744 | 2744 |
| 2745 /** |
| 2746 * Synthesize an unnamed function element that takes [parameters] and returns |
| 2747 * [returnType]. |
| 2748 */ |
| 2749 FunctionElementImpl.synthetic( |
| 2750 List<ParameterElement> parameters, DartType returnType) |
| 2751 : super("", -1) { |
| 2752 synthetic = true; |
| 2753 this.returnType = returnType; |
| 2754 this.parameters = parameters; |
| 2755 |
| 2756 type = new FunctionTypeImpl(this); |
| 2757 } |
| 2758 |
2745 @override | 2759 @override |
2746 String get identifier { | 2760 String get identifier { |
2747 String identifier = super.identifier; | 2761 String identifier = super.identifier; |
2748 if (!isStatic) { | 2762 if (!isStatic) { |
2749 identifier += "@$nameOffset"; | 2763 identifier += "@$nameOffset"; |
2750 } | 2764 } |
2751 return identifier; | 2765 return identifier; |
2752 } | 2766 } |
2753 | 2767 |
2754 @override | 2768 @override |
(...skipping 2175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4930 | 4944 |
4931 @override | 4945 @override |
4932 void visitElement(Element element) { | 4946 void visitElement(Element element) { |
4933 int offset = element.nameOffset; | 4947 int offset = element.nameOffset; |
4934 if (offset != -1) { | 4948 if (offset != -1) { |
4935 map[offset] = element; | 4949 map[offset] = element; |
4936 } | 4950 } |
4937 super.visitElement(element); | 4951 super.visitElement(element); |
4938 } | 4952 } |
4939 } | 4953 } |
OLD | NEW |