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

Side by Side Diff: lib/compiler/implementation/ssa/codegen.dart

Issue 10825177: Unify ClassElement and TypedefElement. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 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 | « lib/compiler/implementation/resolver.dart ('k') | lib/compiler/implementation/ssa/ssa.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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 class SsaCodeGeneratorTask extends CompilerTask { 5 class SsaCodeGeneratorTask extends CompilerTask {
6 final JavaScriptBackend backend; 6 final JavaScriptBackend backend;
7 SsaCodeGeneratorTask(JavaScriptBackend backend) 7 SsaCodeGeneratorTask(JavaScriptBackend backend)
8 : this.backend = backend, 8 : this.backend = backend,
9 super(backend.compiler); 9 super(backend.compiler);
10 String get name() => 'SSA code generator'; 10 String get name() => 'SSA code generator';
(...skipping 2557 matching lines...) Expand 10 before | Expand all | Expand 10 after
2568 endExpression(JSPrecedence.LOGICAL_AND_PRECEDENCE); 2568 endExpression(JSPrecedence.LOGICAL_AND_PRECEDENCE);
2569 } else { 2569 } else {
2570 checkType(input, element); 2570 checkType(input, element);
2571 } 2571 }
2572 if (compiler.codegenWorld.rti.hasTypeArguments(type)) { 2572 if (compiler.codegenWorld.rti.hasTypeArguments(type)) {
2573 InterfaceType interfaceType = type; 2573 InterfaceType interfaceType = type;
2574 ClassElement cls = type.element; 2574 ClassElement cls = type.element;
2575 Link<Type> arguments = interfaceType.arguments; 2575 Link<Type> arguments = interfaceType.arguments;
2576 buffer.add(' && '); 2576 buffer.add(' && ');
2577 checkObject(node.typeInfoCall, '==='); 2577 checkObject(node.typeInfoCall, '===');
2578 cls.typeParameters.forEach((name, _) { 2578 for (TypeVariableType typeVariable in cls.typeVariables) {
2579 buffer.add(' && '); 2579 buffer.add(' && ');
2580 beginExpression(JSPrecedence.LOGICAL_AND_PRECEDENCE); 2580 beginExpression(JSPrecedence.LOGICAL_AND_PRECEDENCE);
2581 use(node.typeInfoCall, JSPrecedence.EQUALITY_PRECEDENCE); 2581 use(node.typeInfoCall, JSPrecedence.EQUALITY_PRECEDENCE);
2582 buffer.add(".${name.slowToString()} === '${arguments.head}'"); 2582 // TODO(johnniwinther): Retrieve the type name properly and not through
2583 // [toString]. Note: Two cases below [typeVariable] and
2584 // [arguments.head].
2585 buffer.add(
2586 ".${typeVariable} === '${arguments.head}'");
2583 endExpression(JSPrecedence.LOGICAL_AND_PRECEDENCE); 2587 endExpression(JSPrecedence.LOGICAL_AND_PRECEDENCE);
2584 }); 2588 }
2585 } 2589 }
2586 if (node.nullOk) { 2590 if (node.nullOk) {
2587 expectedPrecedence = oldPrecedence; 2591 expectedPrecedence = oldPrecedence;
2588 endExpression(JSPrecedence.LOGICAL_OR_PRECEDENCE); 2592 endExpression(JSPrecedence.LOGICAL_OR_PRECEDENCE);
2589 } 2593 }
2590 } 2594 }
2591 2595
2592 void visitTypeConversion(HTypeConversion node) { 2596 void visitTypeConversion(HTypeConversion node) {
2593 Map<String, SourceString> castNames = const <SourceString> { 2597 Map<String, SourceString> castNames = const <SourceString> {
2594 "stringTypeCheck": 2598 "stringTypeCheck":
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after
3179 if (leftType.canBeNull() && rightType.canBeNull()) { 3183 if (leftType.canBeNull() && rightType.canBeNull()) {
3180 if (left.isConstantNull() || right.isConstantNull() || 3184 if (left.isConstantNull() || right.isConstantNull() ||
3181 (leftType.isPrimitive() && leftType == rightType)) { 3185 (leftType.isPrimitive() && leftType == rightType)) {
3182 return '=='; 3186 return '==';
3183 } 3187 }
3184 return null; 3188 return null;
3185 } else { 3189 } else {
3186 return '==='; 3190 return '===';
3187 } 3191 }
3188 } 3192 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/resolver.dart ('k') | lib/compiler/implementation/ssa/ssa.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698