| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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.ir_builder; | 5 library dart2js.ir_builder; |
| 6 | 6 |
| 7 import 'ir_nodes.dart' as ir; | 7 import 'ir_nodes.dart' as ir; |
| 8 import '../elements/elements.dart'; | 8 import '../elements/elements.dart'; |
| 9 import '../dart2jslib.dart'; | 9 import '../dart2jslib.dart'; |
| 10 import '../source_file.dart'; | 10 import '../source_file.dart'; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 if (kind == ElementKind.GENERATIVE_CONSTRUCTOR) { | 58 if (kind == ElementKind.GENERATIVE_CONSTRUCTOR) { |
| 59 // TODO(lry): build ir for constructors. | 59 // TODO(lry): build ir for constructors. |
| 60 } else if (kind == ElementKind.GENERATIVE_CONSTRUCTOR_BODY || | 60 } else if (kind == ElementKind.GENERATIVE_CONSTRUCTOR_BODY || |
| 61 kind == ElementKind.FUNCTION || | 61 kind == ElementKind.FUNCTION || |
| 62 kind == ElementKind.GETTER || | 62 kind == ElementKind.GETTER || |
| 63 kind == ElementKind.SETTER) { | 63 kind == ElementKind.SETTER) { |
| 64 function = builder.buildFunction(element); | 64 function = builder.buildFunction(element); |
| 65 } else if (kind == ElementKind.FIELD) { | 65 } else if (kind == ElementKind.FIELD) { |
| 66 // TODO(lry): build ir for lazy initializers of static fields. | 66 // TODO(lry): build ir for lazy initializers of static fields. |
| 67 } else { | 67 } else { |
| 68 compiler.internalErrorOnElement(element, | 68 compiler.internalError(element, 'Unexpected element kind $kind.'); |
| 69 'unexpected element kind $kind'); | |
| 70 } | 69 } |
| 71 | 70 |
| 72 if (function != null) { | 71 if (function != null) { |
| 73 assert(() { | 72 assert(() { |
| 74 // In host-checked mode, serialize and de-serialize the IrNode. | 73 // In host-checked mode, serialize and de-serialize the IrNode. |
| 75 LibraryElement library = element.declaration.getLibrary(); | 74 LibraryElement library = element.declaration.getLibrary(); |
| 76 IrConstantPool constantPool = IrConstantPool.forLibrary(library); | 75 IrConstantPool constantPool = IrConstantPool.forLibrary(library); |
| 77 List<int> data = function.pickle(constantPool); | 76 List<int> data = function.pickle(constantPool); |
| 78 function = new Unpickler(compiler, constantPool).unpickle(data); | 77 function = new Unpickler(compiler, constantPool).unpickle(data); |
| 79 return true; | 78 return true; |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 } catch(e) { | 379 } catch(e) { |
| 381 if (e == ABORT_IRNODE_BUILDER) return null; | 380 if (e == ABORT_IRNODE_BUILDER) return null; |
| 382 rethrow; | 381 rethrow; |
| 383 } | 382 } |
| 384 } | 383 } |
| 385 | 384 |
| 386 void internalError(String reason, {ast.Node node}) { | 385 void internalError(String reason, {ast.Node node}) { |
| 387 giveup(); | 386 giveup(); |
| 388 } | 387 } |
| 389 } | 388 } |
| OLD | NEW |