<?php
/*
- * Copyright 2011 Facebook, Inc.
+ * Copyright 2012 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
}
public function addClassDeclaration(XHPASTNode $where, $name) {
- $name = self::mungeXHPClassName($name);
return $this->addDeclaration('class', $where, $name);
}
}
public function addClassDependency($child, XHPASTNode $where, $name) {
- $name = self::mungeXHPClassName($name);
if ($child !== null) {
if (empty($this->builtins['class'][$name])) {
- $child = self::mungeXHPClassName($child);
$this->chain['class'][$child] = $name;
}
}
);
}
- private static function mungeXHPClassName($name) {
- if (strlen($name) && $name[0] == ':') {
- // XHP's semantic actions munge element names without a preceding colon.
- $name = substr($name, 1);
- return 'xhp_'.str_replace(array(':', '-'), array('__', '_'), $name);
- }
- return $name;
- }
}