| OLD | NEW |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 library kernel.interpreter; | 4 library kernel.interpreter; |
| 5 | 5 |
| 6 import '../ast.dart'; | 6 import '../ast.dart'; |
| 7 import '../ast.dart' as ast show Class; | 7 import '../ast.dart' as ast show Class; |
| 8 | 8 |
| 9 import '../log.dart'; | 9 import '../log.dart'; |
| 10 export '../log.dart'; | 10 export '../log.dart'; |
| (...skipping 2090 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2101 } | 2101 } |
| 2102 | 2102 |
| 2103 /// Creates a list of all field expressions to be evaluated. | 2103 /// Creates a list of all field expressions to be evaluated. |
| 2104 /// | 2104 /// |
| 2105 /// A field expression is an initializer expression for a given field defined | 2105 /// A field expression is an initializer expression for a given field defined |
| 2106 /// when the field was created. | 2106 /// when the field was created. |
| 2107 List<InterpreterExpression> _getFieldInitializers(ast.Class class_) { | 2107 List<InterpreterExpression> _getFieldInitializers(ast.Class class_) { |
| 2108 var fieldInitializers = new List<InterpreterExpression>(); | 2108 var fieldInitializers = new List<InterpreterExpression>(); |
| 2109 | 2109 |
| 2110 for (Field f in class_.fields) { | 2110 for (Field f in class_.fields) { |
| 2111 if (f.initializer != null) { | 2111 if (!f.isStatic && f.initializer != null) { |
| 2112 fieldInitializers.add(new FieldInitializerExpression(f, f.initializer)); | 2112 fieldInitializers.add(new FieldInitializerExpression(f, f.initializer)); |
| 2113 } | 2113 } |
| 2114 } | 2114 } |
| 2115 | 2115 |
| 2116 return fieldInitializers; | 2116 return fieldInitializers; |
| 2117 } | 2117 } |
| 2118 | 2118 |
| 2119 /// Initializes all non initialized fields from the provided class to | 2119 /// Initializes all non initialized fields from the provided class to |
| 2120 /// `Value.nullInstance` in the provided value. | 2120 /// `Value.nullInstance` in the provided value. |
| 2121 void _initializeNullFields(Class class_, Value value) { | 2121 void _initializeNullFields(Class class_, Value value) { |
| 2122 int startIndex = class_.superclass?.instanceSize ?? 0; | 2122 int startIndex = class_.superclass?.instanceSize ?? 0; |
| 2123 for (int i = startIndex; i < class_.instanceSize; i++) { | 2123 for (int i = startIndex; i < class_.instanceSize; i++) { |
| 2124 if (value.fields[i].value == null) { | 2124 if (value.fields[i].value == null) { |
| 2125 value.fields[i].value = Value.nullInstance; | 2125 value.fields[i].value = Value.nullInstance; |
| 2126 } | 2126 } |
| 2127 } | 2127 } |
| 2128 } | 2128 } |
| OLD | NEW |