OLD | NEW |
(Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 library dart2js.serialization.util; |
| 6 |
| 7 import '../dart_types.dart'; |
| 8 import '../common/resolution.dart'; |
| 9 import '../constants/expressions.dart'; |
| 10 import '../elements/elements.dart'; |
| 11 import '../resolution/access_semantics.dart'; |
| 12 import '../resolution/operators.dart'; |
| 13 import '../resolution/send_structure.dart'; |
| 14 import '../universe/call_structure.dart'; |
| 15 import '../universe/selector.dart'; |
| 16 import '../universe/world_impact.dart'; |
| 17 import '../universe/use.dart'; |
| 18 import '../util/enumset.dart'; |
| 19 |
| 20 import 'keys.dart'; |
| 21 import 'serialization.dart'; |
| 22 |
| 23 /// Serialize [name] into [encoder]. |
| 24 void serializeName(Name name, ObjectEncoder encoder) { |
| 25 encoder.setString(Key.NAME, name.text); |
| 26 encoder.setBool(Key.IS_SETTER, name.isSetter); |
| 27 if (name.library != null) { |
| 28 encoder.setElement(Key.LIBRARY, name.library); |
| 29 } |
| 30 } |
| 31 |
| 32 /// Deserialize a [Name] from [decoder]. |
| 33 Name deserializeName(ObjectDecoder decoder) { |
| 34 String name = decoder.getString(Key.NAME); |
| 35 bool isSetter = decoder.getBool(Key.IS_SETTER); |
| 36 LibraryElement library = decoder.getElement(Key.LIBRARY, isOptional: true); |
| 37 return new Name(name, library, isSetter: isSetter); |
| 38 } |
| 39 |
| 40 /// Serialize [selector] into [encoder]. |
| 41 void serializeSelector(Selector selector, ObjectEncoder encoder) { |
| 42 encoder.setEnum(Key.KIND, selector.kind); |
| 43 |
| 44 encoder.setInt(Key.ARGUMENTS, selector.callStructure.argumentCount); |
| 45 encoder.setStrings( |
| 46 Key.NAMED_ARGUMENTS, selector.callStructure.namedArguments); |
| 47 serializeName(selector.memberName, encoder); |
| 48 } |
| 49 |
| 50 /// Deserialize a [Selector] from [decoder]. |
| 51 Selector deserializeSelector(ObjectDecoder decoder) { |
| 52 SelectorKind kind = decoder.getEnum(Key.KIND, SelectorKind.values); |
| 53 int argumentCount = decoder.getInt(Key.ARGUMENTS); |
| 54 List<String> namedArguments = |
| 55 decoder.getStrings(Key.NAMED_ARGUMENTS, isOptional: true); |
| 56 String name = decoder.getString(Key.NAME); |
| 57 bool isSetter = decoder.getBool(Key.IS_SETTER); |
| 58 LibraryElement library = decoder.getElement(Key.LIBRARY, isOptional: true); |
| 59 return new Selector(kind, deserializeName(decoder), |
| 60 new CallStructure(argumentCount, namedArguments)); |
| 61 } |
| 62 |
| 63 /// Serialize [sendStructure] into [encoder]. |
| 64 void serializeSendStructure( |
| 65 SendStructure sendStructure, ObjectEncoder encoder) { |
| 66 encoder.setEnum(Key.KIND, sendStructure.kind); |
| 67 switch (sendStructure.kind) { |
| 68 case SendStructureKind.IF_NULL: |
| 69 case SendStructureKind.LOGICAL_AND: |
| 70 case SendStructureKind.LOGICAL_OR: |
| 71 case SendStructureKind.NOT: |
| 72 case SendStructureKind.INVALID_UNARY: |
| 73 case SendStructureKind.INVALID_BINARY: |
| 74 // No additional properties. |
| 75 break; |
| 76 case SendStructureKind.IS: |
| 77 IsStructure structure = sendStructure; |
| 78 encoder.setType(Key.TYPE, structure.type); |
| 79 break; |
| 80 case SendStructureKind.IS_NOT: |
| 81 IsNotStructure structure = sendStructure; |
| 82 encoder.setType(Key.TYPE, structure.type); |
| 83 break; |
| 84 case SendStructureKind.AS: |
| 85 AsStructure structure = sendStructure; |
| 86 encoder.setType(Key.TYPE, structure.type); |
| 87 break; |
| 88 case SendStructureKind.INVOKE: |
| 89 InvokeStructure structure = sendStructure; |
| 90 serializeAccessSemantics( |
| 91 structure.semantics, encoder.createObject(Key.SEMANTICS)); |
| 92 serializeSelector(structure.selector, encoder.createObject(Key.SELECTOR)); |
| 93 break; |
| 94 case SendStructureKind.INCOMPATIBLE_INVOKE: |
| 95 IncompatibleInvokeStructure structure = sendStructure; |
| 96 serializeAccessSemantics( |
| 97 structure.semantics, encoder.createObject(Key.SEMANTICS)); |
| 98 serializeSelector(structure.selector, encoder.createObject(Key.SELECTOR)); |
| 99 break; |
| 100 case SendStructureKind.GET: |
| 101 GetStructure structure = sendStructure; |
| 102 serializeAccessSemantics( |
| 103 structure.semantics, encoder.createObject(Key.SEMANTICS)); |
| 104 break; |
| 105 case SendStructureKind.SET: |
| 106 SetStructure structure = sendStructure; |
| 107 serializeAccessSemantics( |
| 108 structure.semantics, encoder.createObject(Key.SEMANTICS)); |
| 109 break; |
| 110 case SendStructureKind.UNARY: |
| 111 UnaryStructure structure = sendStructure; |
| 112 serializeAccessSemantics( |
| 113 structure.semantics, encoder.createObject(Key.SEMANTICS)); |
| 114 encoder.setEnum(Key.OPERATOR, structure.operator.kind); |
| 115 break; |
| 116 case SendStructureKind.INDEX: |
| 117 IndexStructure structure = sendStructure; |
| 118 serializeAccessSemantics( |
| 119 structure.semantics, encoder.createObject(Key.SEMANTICS)); |
| 120 break; |
| 121 case SendStructureKind.EQUALS: |
| 122 EqualsStructure structure = sendStructure; |
| 123 serializeAccessSemantics( |
| 124 structure.semantics, encoder.createObject(Key.SEMANTICS)); |
| 125 break; |
| 126 case SendStructureKind.NOT_EQUALS: |
| 127 NotEqualsStructure structure = sendStructure; |
| 128 serializeAccessSemantics( |
| 129 structure.semantics, encoder.createObject(Key.SEMANTICS)); |
| 130 break; |
| 131 case SendStructureKind.BINARY: |
| 132 BinaryStructure structure = sendStructure; |
| 133 serializeAccessSemantics( |
| 134 structure.semantics, encoder.createObject(Key.SEMANTICS)); |
| 135 encoder.setEnum(Key.OPERATOR, structure.operator.kind); |
| 136 break; |
| 137 case SendStructureKind.INDEX_SET: |
| 138 IndexSetStructure structure = sendStructure; |
| 139 serializeAccessSemantics( |
| 140 structure.semantics, encoder.createObject(Key.SEMANTICS)); |
| 141 break; |
| 142 case SendStructureKind.INDEX_PREFIX: |
| 143 IndexPrefixStructure structure = sendStructure; |
| 144 serializeAccessSemantics( |
| 145 structure.semantics, encoder.createObject(Key.SEMANTICS)); |
| 146 encoder.setEnum(Key.OPERATOR, structure.operator.kind); |
| 147 break; |
| 148 case SendStructureKind.INDEX_POSTFIX: |
| 149 IndexPostfixStructure structure = sendStructure; |
| 150 serializeAccessSemantics( |
| 151 structure.semantics, encoder.createObject(Key.SEMANTICS)); |
| 152 encoder.setEnum(Key.OPERATOR, structure.operator.kind); |
| 153 break; |
| 154 case SendStructureKind.COMPOUND: |
| 155 CompoundStructure structure = sendStructure; |
| 156 serializeAccessSemantics( |
| 157 structure.semantics, encoder.createObject(Key.SEMANTICS)); |
| 158 encoder.setEnum(Key.OPERATOR, structure.operator.kind); |
| 159 break; |
| 160 case SendStructureKind.SET_IF_NULL: |
| 161 SetIfNullStructure structure = sendStructure; |
| 162 serializeAccessSemantics( |
| 163 structure.semantics, encoder.createObject(Key.SEMANTICS)); |
| 164 break; |
| 165 case SendStructureKind.COMPOUND_INDEX_SET: |
| 166 CompoundIndexSetStructure structure = sendStructure; |
| 167 serializeAccessSemantics( |
| 168 structure.semantics, encoder.createObject(Key.SEMANTICS)); |
| 169 encoder.setEnum(Key.OPERATOR, structure.operator.kind); |
| 170 break; |
| 171 case SendStructureKind.INDEX_SET_IF_NULL: |
| 172 IndexSetIfNullStructure structure = sendStructure; |
| 173 serializeAccessSemantics( |
| 174 structure.semantics, encoder.createObject(Key.SEMANTICS)); |
| 175 break; |
| 176 case SendStructureKind.PREFIX: |
| 177 PrefixStructure structure = sendStructure; |
| 178 serializeAccessSemantics( |
| 179 structure.semantics, encoder.createObject(Key.SEMANTICS)); |
| 180 encoder.setEnum(Key.OPERATOR, structure.operator.kind); |
| 181 break; |
| 182 case SendStructureKind.POSTFIX: |
| 183 PostfixStructure structure = sendStructure; |
| 184 serializeAccessSemantics( |
| 185 structure.semantics, encoder.createObject(Key.SEMANTICS)); |
| 186 encoder.setEnum(Key.OPERATOR, structure.operator.kind); |
| 187 break; |
| 188 case SendStructureKind.DEFERRED_PREFIX: |
| 189 DeferredPrefixStructure structure = sendStructure; |
| 190 encoder.setElement(Key.PREFIX, structure.prefix); |
| 191 serializeSendStructure( |
| 192 structure.sendStructure, encoder.createObject(Key.SEND_STRUCTURE)); |
| 193 break; |
| 194 } |
| 195 } |
| 196 |
| 197 /// Deserialize a [SendStructure] from [decoder]. |
| 198 SendStructure deserializeSendStructure(ObjectDecoder decoder) { |
| 199 SendStructureKind kind = decoder.getEnum(Key.KIND, SendStructureKind.values); |
| 200 switch (kind) { |
| 201 case SendStructureKind.IF_NULL: |
| 202 return const IfNullStructure(); |
| 203 case SendStructureKind.LOGICAL_AND: |
| 204 return const LogicalAndStructure(); |
| 205 case SendStructureKind.LOGICAL_OR: |
| 206 return const LogicalOrStructure(); |
| 207 case SendStructureKind.IS: |
| 208 return new IsStructure(decoder.getType(Key.TYPE)); |
| 209 case SendStructureKind.IS_NOT: |
| 210 return new IsNotStructure(decoder.getType(Key.TYPE)); |
| 211 case SendStructureKind.AS: |
| 212 return new AsStructure(decoder.getType(Key.TYPE)); |
| 213 case SendStructureKind.INVOKE: |
| 214 AccessSemantics semantics = |
| 215 deserializeAccessSemantics(decoder.getObject(Key.SEMANTICS)); |
| 216 Selector selector = deserializeSelector(decoder.getObject(Key.SELECTOR)); |
| 217 return new InvokeStructure(semantics, selector); |
| 218 case SendStructureKind.INCOMPATIBLE_INVOKE: |
| 219 AccessSemantics semantics = |
| 220 deserializeAccessSemantics(decoder.getObject(Key.SEMANTICS)); |
| 221 Selector selector = deserializeSelector(decoder.getObject(Key.SELECTOR)); |
| 222 return new IncompatibleInvokeStructure(semantics, selector); |
| 223 case SendStructureKind.GET: |
| 224 AccessSemantics semantics = |
| 225 deserializeAccessSemantics(decoder.getObject(Key.SEMANTICS)); |
| 226 return new GetStructure(semantics); |
| 227 case SendStructureKind.SET: |
| 228 AccessSemantics semantics = |
| 229 deserializeAccessSemantics(decoder.getObject(Key.SEMANTICS)); |
| 230 return new SetStructure(semantics); |
| 231 case SendStructureKind.NOT: |
| 232 return const NotStructure(); |
| 233 case SendStructureKind.UNARY: |
| 234 AccessSemantics semantics = |
| 235 deserializeAccessSemantics(decoder.getObject(Key.SEMANTICS)); |
| 236 return new UnaryStructure( |
| 237 semantics, |
| 238 UnaryOperator.fromKind( |
| 239 decoder.getEnum(Key.OPERATOR, UnaryOperatorKind.values))); |
| 240 case SendStructureKind.INVALID_UNARY: |
| 241 return new InvalidUnaryStructure(); |
| 242 case SendStructureKind.INDEX: |
| 243 AccessSemantics semantics = |
| 244 deserializeAccessSemantics(decoder.getObject(Key.SEMANTICS)); |
| 245 return new IndexStructure(semantics); |
| 246 case SendStructureKind.EQUALS: |
| 247 AccessSemantics semantics = |
| 248 deserializeAccessSemantics(decoder.getObject(Key.SEMANTICS)); |
| 249 return new EqualsStructure(semantics); |
| 250 case SendStructureKind.NOT_EQUALS: |
| 251 AccessSemantics semantics = |
| 252 deserializeAccessSemantics(decoder.getObject(Key.SEMANTICS)); |
| 253 return new NotEqualsStructure(semantics); |
| 254 case SendStructureKind.BINARY: |
| 255 AccessSemantics semantics = |
| 256 deserializeAccessSemantics(decoder.getObject(Key.SEMANTICS)); |
| 257 return new BinaryStructure( |
| 258 semantics, |
| 259 BinaryOperator.fromKind( |
| 260 decoder.getEnum(Key.OPERATOR, BinaryOperatorKind.values))); |
| 261 case SendStructureKind.INVALID_BINARY: |
| 262 return const InvalidBinaryStructure(); |
| 263 case SendStructureKind.INDEX_SET: |
| 264 AccessSemantics semantics = |
| 265 deserializeAccessSemantics(decoder.getObject(Key.SEMANTICS)); |
| 266 return new IndexSetStructure(semantics); |
| 267 case SendStructureKind.INDEX_PREFIX: |
| 268 AccessSemantics semantics = |
| 269 deserializeAccessSemantics(decoder.getObject(Key.SEMANTICS)); |
| 270 return new IndexPrefixStructure( |
| 271 semantics, |
| 272 IncDecOperator.fromKind( |
| 273 decoder.getEnum(Key.OPERATOR, IncDecOperatorKind.values))); |
| 274 case SendStructureKind.INDEX_POSTFIX: |
| 275 AccessSemantics semantics = |
| 276 deserializeAccessSemantics(decoder.getObject(Key.SEMANTICS)); |
| 277 return new IndexPostfixStructure( |
| 278 semantics, |
| 279 IncDecOperator.fromKind( |
| 280 decoder.getEnum(Key.OPERATOR, IncDecOperatorKind.values))); |
| 281 case SendStructureKind.COMPOUND: |
| 282 AccessSemantics semantics = |
| 283 deserializeAccessSemantics(decoder.getObject(Key.SEMANTICS)); |
| 284 return new CompoundStructure( |
| 285 semantics, |
| 286 AssignmentOperator.fromKind( |
| 287 decoder.getEnum(Key.OPERATOR, AssignmentOperatorKind.values))); |
| 288 case SendStructureKind.SET_IF_NULL: |
| 289 AccessSemantics semantics = |
| 290 deserializeAccessSemantics(decoder.getObject(Key.SEMANTICS)); |
| 291 return new SetIfNullStructure(semantics); |
| 292 case SendStructureKind.COMPOUND_INDEX_SET: |
| 293 AccessSemantics semantics = |
| 294 deserializeAccessSemantics(decoder.getObject(Key.SEMANTICS)); |
| 295 return new CompoundIndexSetStructure( |
| 296 semantics, |
| 297 AssignmentOperator.fromKind( |
| 298 decoder.getEnum(Key.OPERATOR, AssignmentOperatorKind.values))); |
| 299 case SendStructureKind.INDEX_SET_IF_NULL: |
| 300 AccessSemantics semantics = |
| 301 deserializeAccessSemantics(decoder.getObject(Key.SEMANTICS)); |
| 302 return new IndexSetIfNullStructure(semantics); |
| 303 case SendStructureKind.PREFIX: |
| 304 AccessSemantics semantics = |
| 305 deserializeAccessSemantics(decoder.getObject(Key.SEMANTICS)); |
| 306 return new PrefixStructure( |
| 307 semantics, |
| 308 IncDecOperator.fromKind( |
| 309 decoder.getEnum(Key.OPERATOR, IncDecOperatorKind.values))); |
| 310 case SendStructureKind.POSTFIX: |
| 311 AccessSemantics semantics = |
| 312 deserializeAccessSemantics(decoder.getObject(Key.SEMANTICS)); |
| 313 return new PostfixStructure( |
| 314 semantics, |
| 315 IncDecOperator.fromKind( |
| 316 decoder.getEnum(Key.OPERATOR, IncDecOperatorKind.values))); |
| 317 case SendStructureKind.DEFERRED_PREFIX: |
| 318 PrefixElement prefix = decoder.getElement(Key.PREFIX); |
| 319 SendStructure sendStructure = |
| 320 deserializeSendStructure(decoder.getObject(Key.SEND_STRUCTURE)); |
| 321 return new DeferredPrefixStructure(prefix, sendStructure); |
| 322 } |
| 323 } |
| 324 |
| 325 /// Serialize [newStructure] into [encoder]. |
| 326 void serializeNewStructure(NewStructure newStructure, ObjectEncoder encoder) { |
| 327 encoder.setEnum(Key.KIND, newStructure.kind); |
| 328 switch (newStructure.kind) { |
| 329 case NewStructureKind.NEW_INVOKE: |
| 330 NewInvokeStructure structure = newStructure; |
| 331 encoder.setEnum(Key.SUB_KIND, structure.semantics.kind); |
| 332 encoder.setElement(Key.ELEMENT, structure.semantics.element); |
| 333 encoder.setType(Key.TYPE, structure.semantics.type); |
| 334 serializeSelector(structure.selector, encoder.createObject(Key.SELECTOR)); |
| 335 break; |
| 336 case NewStructureKind.CONST_INVOKE: |
| 337 ConstInvokeStructure structure = newStructure; |
| 338 encoder.setEnum(Key.SUB_KIND, structure.constantInvokeKind); |
| 339 encoder.setConstant(Key.CONSTANT, structure.constant); |
| 340 break; |
| 341 case NewStructureKind.LATE_CONST: |
| 342 throw new UnsupportedError( |
| 343 'Unsupported NewStructure kind ${newStructure.kind}.'); |
| 344 } |
| 345 } |
| 346 |
| 347 /// Deserialize a [NewStructure] from [decoder]. |
| 348 NewStructure deserializeNewStructure(ObjectDecoder decoder) { |
| 349 NewStructureKind kind = decoder.getEnum(Key.KIND, NewStructureKind.values); |
| 350 switch (kind) { |
| 351 case NewStructureKind.NEW_INVOKE: |
| 352 ConstructorAccessKind constructorAccessKind = |
| 353 decoder.getEnum(Key.SUB_KIND, ConstructorAccessKind.values); |
| 354 Element element = decoder.getElement(Key.ELEMENT); |
| 355 DartType type = decoder.getType(Key.TYPE); |
| 356 ConstructorAccessSemantics semantics = |
| 357 new ConstructorAccessSemantics(constructorAccessKind, element, type); |
| 358 Selector selector = deserializeSelector(decoder.getObject(Key.SELECTOR)); |
| 359 return new NewInvokeStructure(semantics, selector); |
| 360 |
| 361 case NewStructureKind.CONST_INVOKE: |
| 362 ConstantInvokeKind constantInvokeKind = |
| 363 decoder.getEnum(Key.SUB_KIND, ConstantInvokeKind.values); |
| 364 ConstantExpression constant = decoder.getConstant(Key.CONSTANT); |
| 365 return new ConstInvokeStructure(constantInvokeKind, constant); |
| 366 case NewStructureKind.LATE_CONST: |
| 367 throw new UnsupportedError('Unsupported NewStructure kind $kind.'); |
| 368 } |
| 369 } |
| 370 |
| 371 /// Serialize [semantics] into [encoder]. |
| 372 void serializeAccessSemantics( |
| 373 AccessSemantics semantics, ObjectEncoder encoder) { |
| 374 encoder.setEnum(Key.KIND, semantics.kind); |
| 375 switch (semantics.kind) { |
| 376 case AccessKind.EXPRESSION: |
| 377 case AccessKind.THIS: |
| 378 // No additional properties. |
| 379 break; |
| 380 case AccessKind.THIS_PROPERTY: |
| 381 case AccessKind.DYNAMIC_PROPERTY: |
| 382 case AccessKind.CONDITIONAL_DYNAMIC_PROPERTY: |
| 383 serializeName(semantics.name, encoder); |
| 384 break; |
| 385 case AccessKind.CLASS_TYPE_LITERAL: |
| 386 case AccessKind.TYPEDEF_TYPE_LITERAL: |
| 387 case AccessKind.DYNAMIC_TYPE_LITERAL: |
| 388 encoder.setConstant(Key.CONSTANT, semantics.constant); |
| 389 break; |
| 390 case AccessKind.LOCAL_FUNCTION: |
| 391 case AccessKind.LOCAL_VARIABLE: |
| 392 case AccessKind.FINAL_LOCAL_VARIABLE: |
| 393 case AccessKind.PARAMETER: |
| 394 case AccessKind.FINAL_PARAMETER: |
| 395 case AccessKind.STATIC_FIELD: |
| 396 case AccessKind.FINAL_STATIC_FIELD: |
| 397 case AccessKind.STATIC_METHOD: |
| 398 case AccessKind.STATIC_GETTER: |
| 399 case AccessKind.STATIC_SETTER: |
| 400 case AccessKind.TOPLEVEL_FIELD: |
| 401 case AccessKind.FINAL_TOPLEVEL_FIELD: |
| 402 case AccessKind.TOPLEVEL_METHOD: |
| 403 case AccessKind.TOPLEVEL_GETTER: |
| 404 case AccessKind.TOPLEVEL_SETTER: |
| 405 case AccessKind.SUPER_FIELD: |
| 406 case AccessKind.SUPER_FINAL_FIELD: |
| 407 case AccessKind.SUPER_METHOD: |
| 408 case AccessKind.SUPER_GETTER: |
| 409 case AccessKind.SUPER_SETTER: |
| 410 case AccessKind.TYPE_PARAMETER_TYPE_LITERAL: |
| 411 case AccessKind.UNRESOLVED: |
| 412 case AccessKind.UNRESOLVED_SUPER: |
| 413 case AccessKind.INVALID: |
| 414 encoder.setElement(Key.ELEMENT, semantics.element); |
| 415 break; |
| 416 case AccessKind.COMPOUND: |
| 417 CompoundAccessSemantics compoundAccess = semantics; |
| 418 encoder.setEnum(Key.SUB_KIND, compoundAccess.compoundAccessKind); |
| 419 encoder.setElement(Key.GETTER, semantics.getter); |
| 420 encoder.setElement(Key.SETTER, semantics.setter); |
| 421 break; |
| 422 case AccessKind.CONSTANT: |
| 423 throw new UnsupportedError('Unsupported access kind: ${semantics.kind}'); |
| 424 } |
| 425 } |
| 426 |
| 427 /// Deserialize a [AccessSemantics] from [decoder]. |
| 428 AccessSemantics deserializeAccessSemantics(ObjectDecoder decoder) { |
| 429 AccessKind kind = decoder.getEnum(Key.KIND, AccessKind.values); |
| 430 switch (kind) { |
| 431 case AccessKind.EXPRESSION: |
| 432 return const DynamicAccess.expression(); |
| 433 case AccessKind.THIS: |
| 434 return const DynamicAccess.thisAccess(); |
| 435 case AccessKind.THIS_PROPERTY: |
| 436 return new DynamicAccess.thisProperty(deserializeName(decoder)); |
| 437 case AccessKind.DYNAMIC_PROPERTY: |
| 438 return new DynamicAccess.dynamicProperty(deserializeName(decoder)); |
| 439 case AccessKind.CONDITIONAL_DYNAMIC_PROPERTY: |
| 440 return new DynamicAccess.ifNotNullProperty(deserializeName(decoder)); |
| 441 case AccessKind.CLASS_TYPE_LITERAL: |
| 442 case AccessKind.TYPEDEF_TYPE_LITERAL: |
| 443 case AccessKind.DYNAMIC_TYPE_LITERAL: |
| 444 return new ConstantAccess(kind, decoder.getConstant(Key.CONSTANT)); |
| 445 |
| 446 case AccessKind.LOCAL_FUNCTION: |
| 447 case AccessKind.LOCAL_VARIABLE: |
| 448 case AccessKind.FINAL_LOCAL_VARIABLE: |
| 449 case AccessKind.PARAMETER: |
| 450 case AccessKind.FINAL_PARAMETER: |
| 451 case AccessKind.STATIC_FIELD: |
| 452 case AccessKind.FINAL_STATIC_FIELD: |
| 453 case AccessKind.STATIC_METHOD: |
| 454 case AccessKind.STATIC_GETTER: |
| 455 case AccessKind.STATIC_SETTER: |
| 456 case AccessKind.TOPLEVEL_FIELD: |
| 457 case AccessKind.FINAL_TOPLEVEL_FIELD: |
| 458 case AccessKind.TOPLEVEL_METHOD: |
| 459 case AccessKind.TOPLEVEL_GETTER: |
| 460 case AccessKind.TOPLEVEL_SETTER: |
| 461 case AccessKind.SUPER_FIELD: |
| 462 case AccessKind.SUPER_FINAL_FIELD: |
| 463 case AccessKind.SUPER_METHOD: |
| 464 case AccessKind.SUPER_GETTER: |
| 465 case AccessKind.SUPER_SETTER: |
| 466 case AccessKind.TYPE_PARAMETER_TYPE_LITERAL: |
| 467 case AccessKind.UNRESOLVED: |
| 468 case AccessKind.UNRESOLVED_SUPER: |
| 469 case AccessKind.INVALID: |
| 470 return new StaticAccess.internal(kind, decoder.getElement(Key.ELEMENT)); |
| 471 |
| 472 case AccessKind.COMPOUND: |
| 473 CompoundAccessKind compoundAccessKind = |
| 474 decoder.getEnum(Key.SUB_KIND, CompoundAccessKind.values); |
| 475 Element getter = decoder.getElement(Key.GETTER); |
| 476 Element setter = decoder.getElement(Key.SETTER); |
| 477 return new CompoundAccessSemantics(compoundAccessKind, getter, setter); |
| 478 case AccessKind.CONSTANT: |
| 479 throw new UnsupportedError('Unsupported access kind: $kind'); |
| 480 } |
| 481 } |
OLD | NEW |