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

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

Issue 1712583003: Serialize and resynthesize labels. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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
« no previous file with comments | « pkg/analyzer/lib/src/summary/idl.dart ('k') | pkg/analyzer/lib/src/summary/summarize_ast.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 summary_resynthesizer; 5 library summary_resynthesizer;
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 1144 matching lines...) Expand 10 before | Expand all | Expand 10 after
1155 serializedExecutable.returnType == null; 1155 serializedExecutable.returnType == null;
1156 } 1156 }
1157 executableElement.type = new FunctionTypeImpl.elementWithNameAndArgs( 1157 executableElement.type = new FunctionTypeImpl.elementWithNameAndArgs(
1158 executableElement, null, getCurrentTypeArguments(skipLevels: 1), false); 1158 executableElement, null, getCurrentTypeArguments(skipLevels: 1), false);
1159 executableElement.external = serializedExecutable.isExternal; 1159 executableElement.external = serializedExecutable.isExternal;
1160 buildDocumentation( 1160 buildDocumentation(
1161 executableElement, serializedExecutable.documentationComment); 1161 executableElement, serializedExecutable.documentationComment);
1162 buildAnnotations(executableElement, serializedExecutable.annotations); 1162 buildAnnotations(executableElement, serializedExecutable.annotations);
1163 executableElement.functions = 1163 executableElement.functions =
1164 serializedExecutable.localFunctions.map(buildLocalFunction).toList(); 1164 serializedExecutable.localFunctions.map(buildLocalFunction).toList();
1165 executableElement.labels =
1166 serializedExecutable.localLabels.map(buildLocalLabel).toList();
1165 executableElement.localVariables = 1167 executableElement.localVariables =
1166 serializedExecutable.localVariables.map(buildLocalVariable).toList(); 1168 serializedExecutable.localVariables.map(buildLocalVariable).toList();
1167 currentTypeParameters.removeLast(); 1169 currentTypeParameters.removeLast();
1168 } 1170 }
1169 1171
1170 /** 1172 /**
1171 * Resynthesize an [ExportElement], 1173 * Resynthesize an [ExportElement],
1172 */ 1174 */
1173 ExportElement buildExport(UnlinkedExportPublic serializedExportPublic, 1175 ExportElement buildExport(UnlinkedExportPublic serializedExportPublic,
1174 UnlinkedExportNonPublic serializedExportNonPublic) { 1176 UnlinkedExportNonPublic serializedExportNonPublic) {
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
1472 serializedExecutable.name, serializedExecutable.nameOffset); 1474 serializedExecutable.name, serializedExecutable.nameOffset);
1473 if (serializedExecutable.visibleOffset != 0) { 1475 if (serializedExecutable.visibleOffset != 0) {
1474 element.setVisibleRange(serializedExecutable.visibleOffset, 1476 element.setVisibleRange(serializedExecutable.visibleOffset,
1475 serializedExecutable.visibleLength); 1477 serializedExecutable.visibleLength);
1476 } 1478 }
1477 buildExecutableCommonParts(element, serializedExecutable); 1479 buildExecutableCommonParts(element, serializedExecutable);
1478 return element; 1480 return element;
1479 } 1481 }
1480 1482
1481 /** 1483 /**
1484 * Resynthesize a [LabelElement].
1485 */
1486 LabelElement buildLocalLabel(UnlinkedLabel serializedLabel) {
1487 return new LabelElementImpl(
1488 serializedLabel.name,
1489 serializedLabel.nameOffset,
1490 serializedLabel.isOnSwitchStatement,
1491 serializedLabel.isOnSwitchMember);
1492 }
1493
1494 /**
1482 * Resynthesize a [LocalVariableElement]. 1495 * Resynthesize a [LocalVariableElement].
1483 */ 1496 */
1484 LocalVariableElement buildLocalVariable(UnlinkedVariable serializedVariable) { 1497 LocalVariableElement buildLocalVariable(UnlinkedVariable serializedVariable) {
1485 LocalVariableElementImpl element; 1498 LocalVariableElementImpl element;
1486 if (serializedVariable.constExpr != null) { 1499 if (serializedVariable.constExpr != null) {
1487 ConstLocalVariableElementImpl constElement = 1500 ConstLocalVariableElementImpl constElement =
1488 new ConstLocalVariableElementImpl( 1501 new ConstLocalVariableElementImpl(
1489 serializedVariable.name, serializedVariable.nameOffset); 1502 serializedVariable.name, serializedVariable.nameOffset);
1490 element = constElement; 1503 element = constElement;
1491 constElement.constantInitializer = 1504 constElement.constantInitializer =
(...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after
2227 } 2240 }
2228 : () => this.element; 2241 : () => this.element;
2229 // TODO(paulberry): Is it a bug that we have to pass `false` for 2242 // TODO(paulberry): Is it a bug that we have to pass `false` for
2230 // isInstantiated? 2243 // isInstantiated?
2231 return new DeferredFunctionTypeImpl(computer, null, typeArguments, false); 2244 return new DeferredFunctionTypeImpl(computer, null, typeArguments, false);
2232 } else { 2245 } else {
2233 return null; 2246 return null;
2234 } 2247 }
2235 } 2248 }
2236 } 2249 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/summary/idl.dart ('k') | pkg/analyzer/lib/src/summary/summarize_ast.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698