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

Side by Side Diff: frog/gen.dart

Issue 9085016: Fix bug 1011 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | frog/minfrog » ('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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 /** 5 /**
6 * Top level generator object for writing code and keeping track of 6 * Top level generator object for writing code and keeping track of
7 * dependencies. 7 * dependencies.
8 * 8 *
9 * Should have two compilation models, but only one implemented so far. 9 * Should have two compilation models, but only one implemented so far.
10 * 10 *
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 _usedDynamicDispatchOnType(Type type) { 550 _usedDynamicDispatchOnType(Type type) {
551 if (typesWithDynamicDispatch == null) typesWithDynamicDispatch = new Set(); 551 if (typesWithDynamicDispatch == null) typesWithDynamicDispatch = new Set();
552 typesWithDynamicDispatch.add(type); 552 typesWithDynamicDispatch.add(type);
553 } 553 }
554 554
555 writeDynamicDispatchMetadata() { 555 writeDynamicDispatchMetadata() {
556 if (typesWithDynamicDispatch == null) return; 556 if (typesWithDynamicDispatch == null) return;
557 writer.comment('// ${typesWithDynamicDispatch.length} dynamic types.'); 557 writer.comment('// ${typesWithDynamicDispatch.length} dynamic types.');
558 558
559 typeTag(type) => type.definition.nativeType.name; 559 typeTag(type) => type.definition.nativeType.name;
560 560
561 // Build a pre-order traversal over all the types and their subtypes. 561 // Build a pre-order traversal over all the types and their subtypes.
562 var seen = new Set(); 562 var seen = new Set();
563 var types = []; 563 var types = [];
564 visit(type) { 564 visit(type) {
565 if (seen.contains(type)) return; 565 if (seen.contains(type)) return;
566 seen.add(type); 566 seen.add(type);
567 for (final subtype in _orderCollectionValues(type.directSubtypes)) { 567 for (final subtype in _orderCollectionValues(type.directSubtypes)) {
568 visit(subtype); 568 visit(subtype);
569 } 569 }
570 types.add(type); 570 types.add(type);
(...skipping 1682 matching lines...) Expand 10 before | Expand all | Expand 10 after
2253 return value.invoke(this, ':negate', node, Arguments.EMPTY); 2253 return value.invoke(this, ':negate', node, Arguments.EMPTY);
2254 } else { 2254 } else {
2255 world.internalError('unimplemented: unary ${node.op}', 2255 world.internalError('unimplemented: unary ${node.op}',
2256 node.span); 2256 node.span);
2257 } 2257 }
2258 default: 2258 default:
2259 world.internalError('unimplemented: ${node.op}', node.span); 2259 world.internalError('unimplemented: ${node.op}', node.span);
2260 } 2260 }
2261 } 2261 }
2262 2262
2263 visitDeclaredIdentifier(DeclaredIdentifier node) {
2264 world.error('Expected expression', node.span);
2265 }
2266
2263 visitAwaitExpression(AwaitExpression node) { 2267 visitAwaitExpression(AwaitExpression node) {
2264 world.internalError( 2268 world.internalError(
2265 'Await expressions should have been eliminated before code generation', 2269 'Await expressions should have been eliminated before code generation',
2266 node.span); 2270 node.span);
2267 } 2271 }
2268 2272
2269 visitPostfixExpression(PostfixExpression node, [bool isVoid = false]) { 2273 visitPostfixExpression(PostfixExpression node, [bool isVoid = false]) {
2270 var value = visitValue(node.body); 2274 var value = visitValue(node.body);
2271 if (value.type.isNum && !value.isFinal) { 2275 if (value.type.isNum && !value.isFinal) {
2272 return new Value(value.type, '${value.code}${node.op}', node.span); 2276 return new Value(value.type, '${value.code}${node.op}', node.span);
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
2714 result.add(new Value(world.varType, '\$$i', null, /*needsTemp:*/false)); 2718 result.add(new Value(world.varType, '\$$i', null, /*needsTemp:*/false));
2715 } 2719 }
2716 for (int i = bareCount; i < length; i++) { 2720 for (int i = bareCount; i < length; i++) {
2717 var name = getName(i); 2721 var name = getName(i);
2718 if (name == null) name = '\$$i'; 2722 if (name == null) name = '\$$i';
2719 result.add(new Value(world.varType, name, null, /*needsTemp:*/false)); 2723 result.add(new Value(world.varType, name, null, /*needsTemp:*/false));
2720 } 2724 }
2721 return new Arguments(nodes, result); 2725 return new Arguments(nodes, result);
2722 } 2726 }
2723 } 2727 }
OLDNEW
« no previous file with comments | « no previous file | frog/minfrog » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698