| 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 library fasta.source_library_builder; | 5 library fasta.source_library_builder; |
| 6 | 6 |
| 7 import 'package:front_end/src/scanner/token.dart' show Token; | 7 import 'package:front_end/src/scanner/token.dart' show Token; |
| 8 | 8 |
| 9 import 'package:kernel/ast.dart' show ProcedureKind; | 9 import 'package:kernel/ast.dart' show ProcedureKind; |
| 10 | 10 |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 List<TypeVariableBuilder> typeVariables, | 185 List<TypeVariableBuilder> typeVariables, |
| 186 int modifiers, | 186 int modifiers, |
| 187 T mixinApplication, | 187 T mixinApplication, |
| 188 List<T> interfaces, | 188 List<T> interfaces, |
| 189 int charOffset); | 189 int charOffset); |
| 190 | 190 |
| 191 void addField(List<MetadataBuilder> metadata, int modifiers, T type, | 191 void addField(List<MetadataBuilder> metadata, int modifiers, T type, |
| 192 String name, int charOffset, Token initializer); | 192 String name, int charOffset, Token initializer); |
| 193 | 193 |
| 194 void addFields(List<MetadataBuilder> metadata, int modifiers, T type, | 194 void addFields(List<MetadataBuilder> metadata, int modifiers, T type, |
| 195 List<Object> namesOffsetsAndInitializers) { | 195 List<Object> fieldsInfo) { |
| 196 for (int i = 0; i < namesOffsetsAndInitializers.length; i += 4) { | 196 for (int i = 0; i < fieldsInfo.length; i += 4) { |
| 197 String name = namesOffsetsAndInitializers[i]; | 197 String name = fieldsInfo[i]; |
| 198 int charOffset = namesOffsetsAndInitializers[i + 1]; | 198 int charOffset = fieldsInfo[i + 1]; |
| 199 Token initializer; | 199 Token initializer = fieldsInfo[i + 2]; |
| 200 if (type == null) { | 200 if (initializer != null) { |
| 201 initializer = namesOffsetsAndInitializers[i + 2]; | 201 Token beforeLast = fieldsInfo[i + 3]; |
| 202 Token afterInitializer = namesOffsetsAndInitializers[i + 3]; | 202 beforeLast.setNext(new Token.eof(beforeLast.next.offset)); |
| 203 // TODO(paulberry): figure out a way to do this without using | |
| 204 // Token.previous. | |
| 205 afterInitializer?.previous | |
| 206 ?.setNext(new Token.eof(afterInitializer.offset)); | |
| 207 } | 203 } |
| 208 addField(metadata, modifiers, type, name, charOffset, initializer); | 204 addField(metadata, modifiers, type, name, charOffset, initializer); |
| 209 } | 205 } |
| 210 } | 206 } |
| 211 | 207 |
| 212 void addProcedure( | 208 void addProcedure( |
| 213 List<MetadataBuilder> metadata, | 209 List<MetadataBuilder> metadata, |
| 214 int modifiers, | 210 int modifiers, |
| 215 T returnType, | 211 T returnType, |
| 216 String name, | 212 String name, |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 578 /// synthesize type variables on the factory matching the class'. | 574 /// synthesize type variables on the factory matching the class'. |
| 579 void addFactoryDeclaration( | 575 void addFactoryDeclaration( |
| 580 ProcedureBuilder procedure, DeclarationBuilder<T> factoryDeclaration) { | 576 ProcedureBuilder procedure, DeclarationBuilder<T> factoryDeclaration) { |
| 581 factoryDeclarations[procedure] = factoryDeclaration; | 577 factoryDeclarations[procedure] = factoryDeclaration; |
| 582 } | 578 } |
| 583 | 579 |
| 584 Scope toScope(Scope parent) { | 580 Scope toScope(Scope parent) { |
| 585 return new Scope(members, setters, parent, isModifiable: false); | 581 return new Scope(members, setters, parent, isModifiable: false); |
| 586 } | 582 } |
| 587 } | 583 } |
| OLD | NEW |