OLD | NEW |
---|---|
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 import 'package:kernel/ast.dart' as ir; | 5 import 'package:kernel/ast.dart' as ir; |
6 | 6 |
7 import '../common.dart'; | 7 import '../common.dart'; |
8 import '../common/codegen.dart' show CodegenRegistry, CodegenWorkItem; | 8 import '../common/codegen.dart' show CodegenRegistry, CodegenWorkItem; |
9 import '../common/tasks.dart' show CompilerTask; | 9 import '../common/tasks.dart' show CompilerTask; |
10 import '../compiler.dart'; | 10 import '../compiler.dart'; |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
272 astAdapter.getConstantForSymbol(symbolLiteral), compiler)); | 272 astAdapter.getConstantForSymbol(symbolLiteral), compiler)); |
273 registry?.registerConstSymbol(symbolLiteral.value); | 273 registry?.registerConstSymbol(symbolLiteral.value); |
274 } | 274 } |
275 | 275 |
276 @override | 276 @override |
277 void visitNullLiteral(ir.NullLiteral nullLiteral) { | 277 void visitNullLiteral(ir.NullLiteral nullLiteral) { |
278 stack.add(graph.addConstantNull(compiler)); | 278 stack.add(graph.addConstantNull(compiler)); |
279 } | 279 } |
280 | 280 |
281 @override | 281 @override |
282 void visitListLiteral(ir.ListLiteral listLiteral) { | |
283 HInstruction listInstruction; | |
284 if (listLiteral.isConst) { | |
285 listInstruction = graph.addConstant(astAdapter.getConstantFor(listLiteral) , compiler); | |
Siggi Cherem (dart-lang)
2016/09/14 18:23:26
dartfmt
Harry Terkelsen
2016/09/14 18:25:55
Done.
| |
286 } else { | |
287 List<HInstruction> elements = <HInstruction>[]; | |
288 for (ir.Expression element in listLiteral.expressions) { | |
289 element.accept(this); | |
290 elements.add(pop()); | |
291 } | |
292 listInstruction = new HLiteralList(elements, backend.extendableArrayType); | |
293 add(listInstruction); | |
294 // TODO(het): set runtime type info | |
295 } | |
296 | |
297 // TODO(het): Set the instruction type to the list type given by inference | |
298 stack.add(listInstruction); | |
299 } | |
300 | |
301 @override | |
282 void visitStaticGet(ir.StaticGet staticGet) { | 302 void visitStaticGet(ir.StaticGet staticGet) { |
283 var staticTarget = staticGet.target; | 303 var staticTarget = staticGet.target; |
284 Element element = astAdapter.getElement(staticTarget).declaration; | 304 Element element = astAdapter.getElement(staticTarget).declaration; |
285 if (staticTarget is ir.Procedure && | 305 if (staticTarget is ir.Procedure && |
286 staticTarget.kind == ir.ProcedureKind.Getter) { | 306 staticTarget.kind == ir.ProcedureKind.Getter) { |
287 // Invoke the getter | 307 // Invoke the getter |
288 _pushStaticInvocation( | 308 _pushStaticInvocation( |
289 target, const <HInstruction>[], astAdapter.returnTypeOf(target)); | 309 target, const <HInstruction>[], astAdapter.returnTypeOf(target)); |
290 } else { | 310 } else { |
291 push(new HStatic(element, astAdapter.inferredTypeOf(staticTarget))); | 311 push(new HStatic(element, astAdapter.inferredTypeOf(staticTarget))); |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
511 void visitThisExpression(ir.ThisExpression thisExpression) { | 531 void visitThisExpression(ir.ThisExpression thisExpression) { |
512 stack.add(localsHandler.readThis()); | 532 stack.add(localsHandler.readThis()); |
513 } | 533 } |
514 | 534 |
515 @override | 535 @override |
516 void visitNot(ir.Not not) { | 536 void visitNot(ir.Not not) { |
517 not.operand.accept(this); | 537 not.operand.accept(this); |
518 push(new HNot(popBoolified(), backend.boolType)); | 538 push(new HNot(popBoolified(), backend.boolType)); |
519 } | 539 } |
520 } | 540 } |
OLD | NEW |