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

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

Issue 2711843003: Fix summarize const expression logic to be compatible with Dart2JS. (Closed)
Patch Set: Created 3 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 | « no previous file | no next file » | 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) 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_const_expr; 5 library serialization.summarize_const_expr;
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/element/type.dart' show DartType; 9 import 'package:analyzer/dart/element/type.dart' show DartType;
10 import 'package:analyzer/src/summary/format.dart'; 10 import 'package:analyzer/src/summary/format.dart';
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 operations.add(UnlinkedExprOperation.pushParameter); 268 operations.add(UnlinkedExprOperation.pushParameter);
269 strings.add(expr.identifier.name); 269 strings.add(expr.identifier.name);
270 operations.add(UnlinkedExprOperation.assignToProperty); 270 operations.add(UnlinkedExprOperation.assignToProperty);
271 } else { 271 } else {
272 throw new StateError('Unsupported assignable: $expr'); 272 throw new StateError('Unsupported assignable: $expr');
273 } 273 }
274 } 274 }
275 275
276 void _pushInt(int value) { 276 void _pushInt(int value) {
277 assert(value >= 0); 277 assert(value >= 0);
278 if (value >= (1 << 32)) { 278 if (value >= 0x100000000) {
279 int numOfComponents = 0; 279 int numOfComponents = 0;
280 ints.add(numOfComponents); 280 ints.add(numOfComponents);
281 void pushComponents(int value) { 281 void pushComponents(int value) {
282 if (value >= (1 << 32)) { 282 if (value >= 0x100000000) {
283 pushComponents(value >> 32); 283 pushComponents(value ~/ 0x100000000);
284 } 284 }
285 numOfComponents++; 285 numOfComponents++;
286 ints.add(value & 0xFFFFFFFF); 286 ints.add(value & 0xFFFFFFFF);
287 } 287 }
288 288
289 pushComponents(value); 289 pushComponents(value);
290 ints[ints.length - 1 - numOfComponents] = numOfComponents; 290 ints[ints.length - 1 - numOfComponents] = numOfComponents;
291 operations.add(UnlinkedExprOperation.pushLongInt); 291 operations.add(UnlinkedExprOperation.pushLongInt);
292 } else { 292 } else {
293 operations.add(UnlinkedExprOperation.pushInt); 293 operations.add(UnlinkedExprOperation.pushInt);
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 if (typeArguments == null) { 670 if (typeArguments == null) {
671 ints.add(0); 671 ints.add(0);
672 } else { 672 } else {
673 ints.add(typeArguments.arguments.length); 673 ints.add(typeArguments.arguments.length);
674 for (TypeAnnotation type in typeArguments.arguments) { 674 for (TypeAnnotation type in typeArguments.arguments) {
675 references.add(serializeTypeName(type)); 675 references.add(serializeTypeName(type));
676 } 676 }
677 } 677 }
678 } 678 }
679 } 679 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698