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

Side by Side Diff: pkg/compiler/lib/src/serialization/resolved_ast_serialization.dart

Issue 1942763002: Rebased and retested version of CL 1915123008. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 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/compiler/lib/src/serialization/modelz.dart ('k') | pkg/compiler/lib/src/tree/nodes.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) 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 dart2js.serialization.resolved_ast; 5 library dart2js.serialization.resolved_ast;
6 6
7 import '../common.dart'; 7 import '../common.dart';
8 import '../common/resolution.dart'; 8 import '../common/resolution.dart';
9 import '../constants/expressions.dart'; 9 import '../constants/expressions.dart';
10 import '../dart_types.dart'; 10 import '../dart_types.dart';
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 valueBuilder.literalInt(enumConstant.index), 422 valueBuilder.literalInt(enumConstant.index),
423 valueBuilder 423 valueBuilder
424 .literalString('${enumClass.name}.${name.source}'))); 424 .literalString('${enumClass.name}.${name.source}')));
425 } 425 }
426 426
427 // TODO(johnniwinther): Support return type. Note `String` might be 427 // TODO(johnniwinther): Support return type. Note `String` might be
428 // prefixed or not imported within the current library. 428 // prefixed or not imported within the current library.
429 FunctionExpression toStringNode = builder.functionExpression( 429 FunctionExpression toStringNode = builder.functionExpression(
430 Modifiers.EMPTY, 430 Modifiers.EMPTY,
431 'toString', 431 'toString',
432 null,
432 builder.argumentList([]), 433 builder.argumentList([]),
433 builder.returnStatement(builder.indexGet( 434 builder.returnStatement(builder.indexGet(
434 builder.mapLiteral(mapEntries, isConst: true), 435 builder.mapLiteral(mapEntries, isConst: true),
435 builder.reference(builder.identifier('index'))))); 436 builder.reference(builder.identifier('index')))));
436 return toStringNode; 437 return toStringNode;
437 case AstKind.ENUM_CONSTRUCTOR: 438 case AstKind.ENUM_CONSTRUCTOR:
438 AstBuilder builder = new AstBuilder(element.sourcePosition.begin); 439 AstBuilder builder = new AstBuilder(element.sourcePosition.begin);
439 VariableDefinitions indexDefinition = 440 VariableDefinitions indexDefinition =
440 builder.initializingFormal('index'); 441 builder.initializingFormal('index');
441 FunctionExpression constructorNode = builder.functionExpression( 442 FunctionExpression constructorNode = builder.functionExpression(
442 builder.modifiers(isConst: true), 443 builder.modifiers(isConst: true),
443 element.enclosingClass.name, 444 element.enclosingClass.name,
445 null,
444 builder.argumentList([indexDefinition]), 446 builder.argumentList([indexDefinition]),
445 builder.emptyStatement()); 447 builder.emptyStatement());
446 return constructorNode; 448 return constructorNode;
447 case AstKind.ENUM_CONSTANT: 449 case AstKind.ENUM_CONSTANT:
448 EnumConstantElement enumConstant = element; 450 EnumConstantElement enumConstant = element;
449 EnumClassElement enumClass = element.enclosingClass; 451 EnumClassElement enumClass = element.enclosingClass;
450 int index = enumConstant.index; 452 int index = enumConstant.index;
451 AstBuilder builder = new AstBuilder(element.sourcePosition.begin); 453 AstBuilder builder = new AstBuilder(element.sourcePosition.begin);
452 Identifier name = builder.identifier(element.name); 454 Identifier name = builder.identifier(element.name);
453 455
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 var nativeData = nativeDataDeserializer.onData(nativeDataDecoder); 623 var nativeData = nativeDataDeserializer.onData(nativeDataDecoder);
622 if (nativeData != null) { 624 if (nativeData != null) {
623 elements.registerNativeData(node, nativeData); 625 elements.registerNativeData(node, nativeData);
624 } 626 }
625 } 627 }
626 } 628 }
627 } 629 }
628 return new ParsedResolvedAst(element, root, body, elements); 630 return new ParsedResolvedAst(element, root, body, elements);
629 } 631 }
630 } 632 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/serialization/modelz.dart ('k') | pkg/compiler/lib/src/tree/nodes.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698