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 1897 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1908 /** | 1908 /** |
1909 * Initialize a newly created local variable element to have the given [name] | 1909 * Initialize a newly created local variable element to have the given [name] |
1910 * and [offset]. | 1910 * and [offset]. |
1911 */ | 1911 */ |
1912 ConstLocalVariableElementImpl(String name, int offset) : super(name, offset); | 1912 ConstLocalVariableElementImpl(String name, int offset) : super(name, offset); |
1913 | 1913 |
1914 /** | 1914 /** |
1915 * Initialize a newly created local variable element to have the given [name]. | 1915 * Initialize a newly created local variable element to have the given [name]. |
1916 */ | 1916 */ |
1917 ConstLocalVariableElementImpl.forNode(Identifier name) : super.forNode(name); | 1917 ConstLocalVariableElementImpl.forNode(Identifier name) : super.forNode(name); |
1918 | |
1919 /** | |
1920 * Initialize using the given serialized information. | |
1921 */ | |
1922 ConstLocalVariableElementImpl.forSerialized(UnlinkedVariable unlinkedVariable, | |
1923 ExecutableElementImpl enclosingExecutable) | |
1924 : super.forSerialized(unlinkedVariable, enclosingExecutable); | |
1925 } | 1918 } |
1926 | 1919 |
1927 /** | 1920 /** |
1928 * A concrete implementation of a [ConstructorElement]. | 1921 * A concrete implementation of a [ConstructorElement]. |
1929 */ | 1922 */ |
1930 class ConstructorElementImpl extends ExecutableElementImpl | 1923 class ConstructorElementImpl extends ExecutableElementImpl |
1931 implements ConstructorElement { | 1924 implements ConstructorElement { |
1932 /** | 1925 /** |
1933 * The constructor to which this constructor is redirecting. | 1926 * The constructor to which this constructor is redirecting. |
1934 */ | 1927 */ |
(...skipping 4450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6385 * Initialize a newly created method element to have the given [name] and | 6378 * Initialize a newly created method element to have the given [name] and |
6386 * [offset]. | 6379 * [offset]. |
6387 */ | 6380 */ |
6388 LocalVariableElementImpl(String name, int offset) : super(name, offset); | 6381 LocalVariableElementImpl(String name, int offset) : super(name, offset); |
6389 | 6382 |
6390 /** | 6383 /** |
6391 * Initialize a newly created local variable element to have the given [name]. | 6384 * Initialize a newly created local variable element to have the given [name]. |
6392 */ | 6385 */ |
6393 LocalVariableElementImpl.forNode(Identifier name) : super.forNode(name); | 6386 LocalVariableElementImpl.forNode(Identifier name) : super.forNode(name); |
6394 | 6387 |
6395 /** | |
6396 * Initialize using the given serialized information. | |
6397 */ | |
6398 LocalVariableElementImpl.forSerialized(UnlinkedVariable unlinkedVariable, | |
6399 ExecutableElementImpl enclosingExecutable) | |
6400 : super.forSerialized(unlinkedVariable, enclosingExecutable); | |
6401 | |
6402 /** | |
6403 * Initialize using the given serialized information. | |
6404 */ | |
6405 factory LocalVariableElementImpl.forSerializedFactory( | |
6406 UnlinkedVariable unlinkedVariable, | |
6407 ExecutableElementImpl enclosingExecutable) { | |
6408 if (unlinkedVariable.isConst && | |
6409 unlinkedVariable.initializer?.bodyExpr != null) { | |
6410 return new ConstLocalVariableElementImpl.forSerialized( | |
6411 unlinkedVariable, enclosingExecutable); | |
6412 } else { | |
6413 return new LocalVariableElementImpl.forSerialized( | |
6414 unlinkedVariable, enclosingExecutable); | |
6415 } | |
6416 } | |
6417 | |
6418 @override | 6388 @override |
6419 String get identifier { | 6389 String get identifier { |
6420 return '$name$nameOffset'; | 6390 return '$name$nameOffset'; |
6421 } | 6391 } |
6422 | 6392 |
6423 @override | 6393 @override |
6424 bool get isPotentiallyMutatedInClosure => true; | 6394 bool get isPotentiallyMutatedInClosure => true; |
6425 | 6395 |
6426 @override | 6396 @override |
6427 bool get isPotentiallyMutatedInScope => true; | 6397 bool get isPotentiallyMutatedInScope => true; |
(...skipping 2569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8997 | 8967 |
8998 @override | 8968 @override |
8999 DartObject computeConstantValue() => null; | 8969 DartObject computeConstantValue() => null; |
9000 | 8970 |
9001 @override | 8971 @override |
9002 void visitChildren(ElementVisitor visitor) { | 8972 void visitChildren(ElementVisitor visitor) { |
9003 super.visitChildren(visitor); | 8973 super.visitChildren(visitor); |
9004 _initializer?.accept(visitor); | 8974 _initializer?.accept(visitor); |
9005 } | 8975 } |
9006 } | 8976 } |
OLD | NEW |