| 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.builder; | 5 library analyzer.src.dart.element.builder; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 | 8 |
| 9 import 'package:analyzer/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
| 10 import 'package:analyzer/dart/ast/token.dart'; | 10 import 'package:analyzer/dart/ast/token.dart'; |
| (...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 550 } | 550 } |
| 551 parameter.const3 = node.isConst; | 551 parameter.const3 = node.isConst; |
| 552 parameter.final2 = node.isFinal; | 552 parameter.final2 = node.isFinal; |
| 553 parameter.parameterKind = node.kind; | 553 parameter.parameterKind = node.kind; |
| 554 // set initializer, default value range | 554 // set initializer, default value range |
| 555 Expression defaultValue = node.defaultValue; | 555 Expression defaultValue = node.defaultValue; |
| 556 if (defaultValue != null) { | 556 if (defaultValue != null) { |
| 557 _visit(holder, defaultValue); | 557 _visit(holder, defaultValue); |
| 558 FunctionElementImpl initializer = | 558 FunctionElementImpl initializer = |
| 559 new FunctionElementImpl.forOffset(defaultValue.beginToken.offset); | 559 new FunctionElementImpl.forOffset(defaultValue.beginToken.offset); |
| 560 initializer.hasImplicitReturnType = true; |
| 560 initializer.functions = holder.functions; | 561 initializer.functions = holder.functions; |
| 561 initializer.labels = holder.labels; | 562 initializer.labels = holder.labels; |
| 562 initializer.localVariables = holder.localVariables; | 563 initializer.localVariables = holder.localVariables; |
| 563 initializer.parameters = holder.parameters; | 564 initializer.parameters = holder.parameters; |
| 564 initializer.synthetic = true; | 565 initializer.synthetic = true; |
| 565 initializer.type = new FunctionTypeImpl(initializer); | 566 initializer.type = new FunctionTypeImpl(initializer); |
| 566 parameter.initializer = initializer; | 567 parameter.initializer = initializer; |
| 567 parameter.defaultValueCode = defaultValue.toSource(); | 568 parameter.defaultValueCode = defaultValue.toSource(); |
| 568 } | 569 } |
| 569 // visible range | 570 // visible range |
| (...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1151 _currentHolder.addTopLevelVariable(variable); | 1152 _currentHolder.addTopLevelVariable(variable); |
| 1152 variableName.staticElement = element; | 1153 variableName.staticElement = element; |
| 1153 } | 1154 } |
| 1154 element.const3 = isConst; | 1155 element.const3 = isConst; |
| 1155 element.final2 = isFinal; | 1156 element.final2 = isFinal; |
| 1156 if (hasInitializer) { | 1157 if (hasInitializer) { |
| 1157 ElementHolder holder = new ElementHolder(); | 1158 ElementHolder holder = new ElementHolder(); |
| 1158 _visit(holder, node.initializer); | 1159 _visit(holder, node.initializer); |
| 1159 FunctionElementImpl initializer = | 1160 FunctionElementImpl initializer = |
| 1160 new FunctionElementImpl.forOffset(node.initializer.beginToken.offset); | 1161 new FunctionElementImpl.forOffset(node.initializer.beginToken.offset); |
| 1162 initializer.hasImplicitReturnType = true; |
| 1161 initializer.functions = holder.functions; | 1163 initializer.functions = holder.functions; |
| 1162 initializer.labels = holder.labels; | 1164 initializer.labels = holder.labels; |
| 1163 initializer.localVariables = holder.localVariables; | 1165 initializer.localVariables = holder.localVariables; |
| 1164 initializer.synthetic = true; | 1166 initializer.synthetic = true; |
| 1165 initializer.type = new FunctionTypeImpl(initializer); | 1167 initializer.type = new FunctionTypeImpl(initializer); |
| 1166 element.initializer = initializer; | 1168 element.initializer = initializer; |
| 1167 holder.validate(); | 1169 holder.validate(); |
| 1168 } | 1170 } |
| 1169 if (element is PropertyInducingElementImpl) { | 1171 if (element is PropertyInducingElementImpl) { |
| 1170 PropertyAccessorElementImpl getter = | 1172 PropertyAccessorElementImpl getter = |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1397 return null; | 1399 return null; |
| 1398 } | 1400 } |
| 1399 | 1401 |
| 1400 /** | 1402 /** |
| 1401 * Return the lexical identifiers associated with the given [identifiers]. | 1403 * Return the lexical identifiers associated with the given [identifiers]. |
| 1402 */ | 1404 */ |
| 1403 static List<String> _getIdentifiers(NodeList<SimpleIdentifier> identifiers) { | 1405 static List<String> _getIdentifiers(NodeList<SimpleIdentifier> identifiers) { |
| 1404 return identifiers.map((identifier) => identifier.name).toList(); | 1406 return identifiers.map((identifier) => identifier.name).toList(); |
| 1405 } | 1407 } |
| 1406 } | 1408 } |
| OLD | NEW |