Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(160)

Side by Side Diff: pkg/analyzer/lib/src/summary/summarize_ast.dart

Issue 2010993002: Migrate UnlinkedParam.defaultValue to UnlinkedExecutable.bodyExpr. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/token.dart'; 8 import 'package:analyzer/dart/ast/token.dart';
9 import 'package:analyzer/dart/ast/visitor.dart'; 9 import 'package:analyzer/dart/ast/visitor.dart';
10 import 'package:analyzer/dart/element/type.dart' show DartType; 10 import 'package:analyzer/dart/element/type.dart' show DartType;
(...skipping 1026 matching lines...) Expand 10 before | Expand all | Expand 10 after
1037 })) 1037 }))
1038 .toList(); 1038 .toList();
1039 } 1039 }
1040 executables.add(b); 1040 executables.add(b);
1041 } 1041 }
1042 1042
1043 @override 1043 @override
1044 UnlinkedParamBuilder visitDefaultFormalParameter( 1044 UnlinkedParamBuilder visitDefaultFormalParameter(
1045 DefaultFormalParameter node) { 1045 DefaultFormalParameter node) {
1046 UnlinkedParamBuilder b = node.parameter.accept(this); 1046 UnlinkedParamBuilder b = node.parameter.accept(this);
1047 b.initializer = serializeInitializerFunction(node.defaultValue);
1047 if (node.defaultValue != null) { 1048 if (node.defaultValue != null) {
1048 // Closures can't appear inside default values, so we don't need a 1049 // Closures can't appear inside default values, so we don't need a
1049 // localClosureIndexMap. 1050 // localClosureIndexMap.
1050 Map<int, int> localClosureIndexMap = null; 1051 Map<int, int> localClosureIndexMap = null;
1051 b.defaultValue = 1052 b.initializer?.bodyExpr =
1052 serializeConstExpr(localClosureIndexMap, node.defaultValue); 1053 serializeConstExpr(localClosureIndexMap, node.defaultValue);
1053 b.defaultValueCode = node.defaultValue.toSource(); 1054 b.defaultValueCode = node.defaultValue.toSource();
1054 } 1055 }
1055 b.initializer = serializeInitializerFunction(node.defaultValue);
1056 b.codeRange = serializeCodeRange(node); 1056 b.codeRange = serializeCodeRange(node);
1057 return b; 1057 return b;
1058 } 1058 }
1059 1059
1060 @override 1060 @override
1061 void visitEnumDeclaration(EnumDeclaration node) { 1061 void visitEnumDeclaration(EnumDeclaration node) {
1062 UnlinkedEnumBuilder b = new UnlinkedEnumBuilder(); 1062 UnlinkedEnumBuilder b = new UnlinkedEnumBuilder();
1063 b.name = node.name.name; 1063 b.name = node.name.name;
1064 b.nameOffset = node.name.offset; 1064 b.nameOffset = node.name.offset;
1065 b.values = node.constants 1065 b.values = node.constants
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
1343 /** 1343 /**
1344 * A [_TypeParameterScope] is a [_Scope] which defines [_ScopedTypeParameter]s. 1344 * A [_TypeParameterScope] is a [_Scope] which defines [_ScopedTypeParameter]s.
1345 */ 1345 */
1346 class _TypeParameterScope extends _Scope { 1346 class _TypeParameterScope extends _Scope {
1347 /** 1347 /**
1348 * Get the number of [_ScopedTypeParameter]s defined in this 1348 * Get the number of [_ScopedTypeParameter]s defined in this
1349 * [_TypeParameterScope]. 1349 * [_TypeParameterScope].
1350 */ 1350 */
1351 int get length => _definedNames.length; 1351 int get length => _definedNames.length;
1352 } 1352 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/summary/resynthesize.dart ('k') | pkg/analyzer/lib/src/summary/summarize_elements.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698