| 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 3774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3785 void set labels(List<LabelElement> labels) { | 3785 void set labels(List<LabelElement> labels) { |
| 3786 _assertNotResynthesized(serializedExecutable); | 3786 _assertNotResynthesized(serializedExecutable); |
| 3787 for (LabelElement label in labels) { | 3787 for (LabelElement label in labels) { |
| 3788 (label as LabelElementImpl).enclosingElement = this; | 3788 (label as LabelElementImpl).enclosingElement = this; |
| 3789 } | 3789 } |
| 3790 this._labels = labels; | 3790 this._labels = labels; |
| 3791 } | 3791 } |
| 3792 | 3792 |
| 3793 @override | 3793 @override |
| 3794 List<LocalVariableElement> get localVariables { | 3794 List<LocalVariableElement> get localVariables { |
| 3795 if (serializedExecutable != null && _localVariables == null) { | |
| 3796 List<UnlinkedVariable> unlinkedVariables = | |
| 3797 serializedExecutable.localVariables; | |
| 3798 int length = unlinkedVariables.length; | |
| 3799 if (length != 0) { | |
| 3800 List<LocalVariableElementImpl> localVariables = | |
| 3801 new List<LocalVariableElementImpl>(length); | |
| 3802 for (int i = 0; i < length; i++) { | |
| 3803 localVariables[i] = new LocalVariableElementImpl.forSerializedFactory( | |
| 3804 unlinkedVariables[i], this); | |
| 3805 } | |
| 3806 _localVariables = localVariables; | |
| 3807 } else { | |
| 3808 _localVariables = const <LocalVariableElement>[]; | |
| 3809 } | |
| 3810 } | |
| 3811 return _localVariables ?? const <LocalVariableElement>[]; | 3795 return _localVariables ?? const <LocalVariableElement>[]; |
| 3812 } | 3796 } |
| 3813 | 3797 |
| 3814 /** | 3798 /** |
| 3815 * Set the local variables defined within this executable element to the given | 3799 * Set the local variables defined within this executable element to the given |
| 3816 * [variables]. | 3800 * [variables]. |
| 3817 */ | 3801 */ |
| 3818 void set localVariables(List<LocalVariableElement> variables) { | 3802 void set localVariables(List<LocalVariableElement> variables) { |
| 3819 _assertNotResynthesized(serializedExecutable); | 3803 _assertNotResynthesized(serializedExecutable); |
| 3820 for (LocalVariableElement variable in variables) { | 3804 for (LocalVariableElement variable in variables) { |
| (...skipping 5259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9080 | 9064 |
| 9081 @override | 9065 @override |
| 9082 void visitElement(Element element) { | 9066 void visitElement(Element element) { |
| 9083 int offset = element.nameOffset; | 9067 int offset = element.nameOffset; |
| 9084 if (offset != -1) { | 9068 if (offset != -1) { |
| 9085 map[offset] = element; | 9069 map[offset] = element; |
| 9086 } | 9070 } |
| 9087 super.visitElement(element); | 9071 super.visitElement(element); |
| 9088 } | 9072 } |
| 9089 } | 9073 } |
| OLD | NEW |