| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 serialization.summarize_ast; | 5 library serialization.summarize_ast; |
| 6 | 6 |
| 7 import 'package:analyzer/dart/ast/ast.dart'; | 7 import 'package:analyzer/dart/ast/ast.dart'; |
| 8 import 'package:analyzer/dart/ast/visitor.dart'; | 8 import 'package:analyzer/dart/ast/visitor.dart'; |
| 9 import 'package:analyzer/src/generated/scanner.dart'; | 9 import 'package:analyzer/src/generated/scanner.dart'; |
| 10 import 'package:analyzer/src/generated/utilities_dart.dart'; | 10 import 'package:analyzer/src/generated/utilities_dart.dart'; |
| (...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 537 } | 537 } |
| 538 b.visibleOffset = enclosingBlock?.offset; | 538 b.visibleOffset = enclosingBlock?.offset; |
| 539 b.visibleLength = enclosingBlock?.length; | 539 b.visibleLength = enclosingBlock?.length; |
| 540 serializeFunctionBody(b, body); | 540 serializeFunctionBody(b, body); |
| 541 scopes.removeLast(); | 541 scopes.removeLast(); |
| 542 assert(scopes.length == oldScopesLength); | 542 assert(scopes.length == oldScopesLength); |
| 543 return b; | 543 return b; |
| 544 } | 544 } |
| 545 | 545 |
| 546 void serializeFunctionBody(UnlinkedExecutableBuilder b, FunctionBody body) { | 546 void serializeFunctionBody(UnlinkedExecutableBuilder b, FunctionBody body) { |
| 547 if (body is BlockFunctionBody || body is ExpressionFunctionBody) { |
| 548 for (UnlinkedParamBuilder parameter in b.parameters) { |
| 549 parameter.visibleOffset = body.offset; |
| 550 parameter.visibleLength = body.length; |
| 551 } |
| 552 } |
| 547 List<UnlinkedExecutableBuilder> oldExecutables = executables; | 553 List<UnlinkedExecutableBuilder> oldExecutables = executables; |
| 548 List<UnlinkedVariableBuilder> oldVariables = variables; | 554 List<UnlinkedVariableBuilder> oldVariables = variables; |
| 549 executables = <UnlinkedExecutableBuilder>[]; | 555 executables = <UnlinkedExecutableBuilder>[]; |
| 550 variables = <UnlinkedVariableBuilder>[]; | 556 variables = <UnlinkedVariableBuilder>[]; |
| 551 body.accept(this); | 557 body.accept(this); |
| 552 b.localFunctions = executables; | 558 b.localFunctions = executables; |
| 553 b.localVariables = variables; | 559 b.localVariables = variables; |
| 554 executables = oldExecutables; | 560 executables = oldExecutables; |
| 555 variables = oldVariables; | 561 variables = oldVariables; |
| 556 } | 562 } |
| (...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1055 /** | 1061 /** |
| 1056 * A [_TypeParameterScope] is a [_Scope] which defines [_ScopedTypeParameter]s. | 1062 * A [_TypeParameterScope] is a [_Scope] which defines [_ScopedTypeParameter]s. |
| 1057 */ | 1063 */ |
| 1058 class _TypeParameterScope extends _Scope { | 1064 class _TypeParameterScope extends _Scope { |
| 1059 /** | 1065 /** |
| 1060 * Get the number of [_ScopedTypeParameter]s defined in this | 1066 * Get the number of [_ScopedTypeParameter]s defined in this |
| 1061 * [_TypeParameterScope]. | 1067 * [_TypeParameterScope]. |
| 1062 */ | 1068 */ |
| 1063 int get length => _definedNames.length; | 1069 int get length => _definedNames.length; |
| 1064 } | 1070 } |
| OLD | NEW |