| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 dart_tree; | 5 library dart_tree; |
| 6 | 6 |
| 7 import '../dart2jslib.dart' as dart2js; | 7 import '../dart2jslib.dart' as dart2js; |
| 8 import '../elements/elements.dart'; | 8 import '../elements/elements.dart'; |
| 9 import '../universe/universe.dart'; | 9 import '../universe/universe.dart'; |
| 10 import '../ir/ir_nodes.dart' as ir; | 10 import '../ir/ir_nodes.dart' as ir; |
| (...skipping 961 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 972 return new Assign(variable, value, visit(node.body), | 972 return new Assign(variable, value, visit(node.body), |
| 973 isDeclaration: node.isDeclaration); | 973 isDeclaration: node.isDeclaration); |
| 974 } | 974 } |
| 975 | 975 |
| 976 Statement visitDeclareFunction(ir.DeclareFunction node) { | 976 Statement visitDeclareFunction(ir.DeclareFunction node) { |
| 977 Variable variable = getClosureVariable(node.variable); | 977 Variable variable = getClosureVariable(node.variable); |
| 978 FunctionDefinition function = makeSubFunction(node.definition); | 978 FunctionDefinition function = makeSubFunction(node.definition); |
| 979 return new FunctionDeclaration(variable, function, visit(node.body)); | 979 return new FunctionDeclaration(variable, function, visit(node.body)); |
| 980 } | 980 } |
| 981 | 981 |
| 982 Statement visitAsCast(ir.AsCast node) { | 982 Statement visitTypeOperator(ir.TypeOperator node) { |
| 983 Expression receiver = getVariableReference(node.receiver); | 983 Expression receiver = getVariableReference(node.receiver); |
| 984 Expression concat = new TypeOperator(receiver, node.type, "as"); | 984 Expression concat = new TypeOperator(receiver, node.type, node.operator); |
| 985 return continueWithExpression(node.continuation, concat); | 985 return continueWithExpression(node.continuation, concat); |
| 986 } | 986 } |
| 987 | 987 |
| 988 Statement visitInvokeConstructor(ir.InvokeConstructor node) { | 988 Statement visitInvokeConstructor(ir.InvokeConstructor node) { |
| 989 List<Expression> arguments = translateArguments(node.arguments); | 989 List<Expression> arguments = translateArguments(node.arguments); |
| 990 Expression invoke = | 990 Expression invoke = |
| 991 new InvokeConstructor(node.type, node.target, node.selector, arguments); | 991 new InvokeConstructor(node.type, node.target, node.selector, arguments); |
| 992 return continueWithExpression(node.continuation, invoke); | 992 return continueWithExpression(node.continuation, invoke); |
| 993 } | 993 } |
| 994 | 994 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1079 bool hasReturnType = !signature.type.returnType.treatAsDynamic; | 1079 bool hasReturnType = !signature.type.returnType.treatAsDynamic; |
| 1080 if (hasReturnType) { | 1080 if (hasReturnType) { |
| 1081 // This function cannot occur in expression context. | 1081 // This function cannot occur in expression context. |
| 1082 // The successor will be filled in by visitLetPrim. | 1082 // The successor will be filled in by visitLetPrim. |
| 1083 return new FunctionDeclaration(getVariable(node), def, null); | 1083 return new FunctionDeclaration(getVariable(node), def, null); |
| 1084 } else { | 1084 } else { |
| 1085 return new FunctionExpression(def); | 1085 return new FunctionExpression(def); |
| 1086 } | 1086 } |
| 1087 } | 1087 } |
| 1088 | 1088 |
| 1089 Expression visitIsCheck(ir.IsCheck node) { | |
| 1090 return new TypeOperator(getVariableReference(node.receiver), | |
| 1091 node.type, | |
| 1092 "is"); | |
| 1093 } | |
| 1094 | |
| 1095 Expression visitParameter(ir.Parameter node) { | 1089 Expression visitParameter(ir.Parameter node) { |
| 1096 // Continuation parameters are not visited (continuations themselves are | 1090 // Continuation parameters are not visited (continuations themselves are |
| 1097 // not visited yet). | 1091 // not visited yet). |
| 1098 compiler.internalError(compiler.currentElement, 'Unexpected IR node.'); | 1092 compiler.internalError(compiler.currentElement, 'Unexpected IR node.'); |
| 1099 return null; | 1093 return null; |
| 1100 } | 1094 } |
| 1101 | 1095 |
| 1102 Expression visitContinuation(ir.Continuation node) { | 1096 Expression visitContinuation(ir.Continuation node) { |
| 1103 // Until continuations with multiple uses are supported, they are not | 1097 // Until continuations with multiple uses are supported, they are not |
| 1104 // visited. | 1098 // visited. |
| (...skipping 1299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2404 } | 2398 } |
| 2405 | 2399 |
| 2406 /// Destructively updates each entry of [l] with the result of visiting it. | 2400 /// Destructively updates each entry of [l] with the result of visiting it. |
| 2407 void _rewriteList(List<Expression> l) { | 2401 void _rewriteList(List<Expression> l) { |
| 2408 for (int i = 0; i < l.length; i++) { | 2402 for (int i = 0; i < l.length; i++) { |
| 2409 l[i] = visitExpression(l[i]); | 2403 l[i] = visitExpression(l[i]); |
| 2410 } | 2404 } |
| 2411 } | 2405 } |
| 2412 } | 2406 } |
| 2413 | 2407 |
| OLD | NEW |