Exemplo n.º 1
0
  public Value evaluate(Context context, MetaDataNode node) {
    if ("Style".equals(node.getId())) {
      if (NodeMagic.isClassDefinition(node)) {
        processStyle(context, node);
      } else {
        context.localizedError2(node.pos(), new StyleMustAnnotateAClass());
      }
    }

    return null;
  }
Exemplo n.º 2
0
  private void processStyle(Context context, MetaDataNode metaDataNode) {
    MetaData metaData = new MetaData(metaDataNode);
    String styleName = metaData.getValue("name");
    String typeName = metaData.getValue("type");

    if (styleName == null) {
      // preilly: we should report this earlier in the process.
      context.localizedError2(metaDataNode.pos(), new StyleHasMissingName());
    }

    if (typeName != null) {
      unit.expressions.add(NameFormatter.toMultiName(typeName));
    }

    registerStyle(context, metaDataNode, styleName, metaData);
  }