Inserts new and replaces old (if any) constant declaration statements in the class that acts like a namespace
        for constants.
358692
def __write_constant_class(self):
        
        helper = ConstantClass(self._class_name, self._io)

        content = helper.source_with_constants(self._constants)

        Util.write_two_phases(helper.file_name(), content, self._io)
1355815
def add_namespace(self, namespace, interface=None, check_extras=True,
                      load_now=False):
        
        tempo = self._namespaces.get(namespace)

        if tempo is None:
            tempo = _Plugins(namespace, interface, check_extras)
            self._namespaces[namespace] = tempo

        if load_now:
            tempo.load()

        return tempo
1248312
def constants(opts = {})
      opts = SymbolHash[:included => true].update(opts)
      consts = children.select {|o| o.is_a? ConstantObject }
      consts + (opts[:included] ? included_constants : [])
    end
274728
protected function addConstants(array $constants, ClassDescriptor $classDescriptor): void
    {
        foreach ($constants as $constant) {
            $constantDescriptor = $this->getBuilder()->buildDescriptor($constant);
            if ($constantDescriptor instanceof ConstantDescriptor) {
                $constantDescriptor->setParent($classDescriptor);
                $classDescriptor->getConstants()->set($constantDescriptor->getName(), $constantDescriptor);
            }
        }
    }
1241041
def add_namespaces(metadata, namespaces):
    # type: (Mapping[Text, Any], MutableMapping[Text, Text]) -> None
    """"""
    for key, value in metadata.items():
        if key not in namespaces:
            namespaces[key] = value
        elif namespaces[key] != value:
            raise validate.ValidationException(
                "Namespace prefix '{}' has conflicting definitions '{}'"
                " and '{}'.".format(key, namespaces[key], value))
1154144
def _update_const_classes():
    """"""
    klasses = (bool, int, float, complex, str, bytes)
    for kls in klasses:
        CONST_CLS[kls] = Const
1202938
public ConstantMethodInfo addConstantMethod(String className,
                                                String methodName,
                                                TypeDesc ret,
                                                TypeDesc[] params) {
        
        MethodDesc md = MethodDesc.forArguments(ret, params);

        return ConstantMethodInfo.make
            (this,
             ConstantClassInfo.make(this, className),
             ConstantNameAndTypeInfo.make(this, methodName, md));
    }
60921
public function AddConstant(
        \Peg\Lib\Definitions\Element\Constant $constant, 
        $namespace = "\\"
    )
    {
        $this->CreateNamespace($namespace);
        
        $constant->header =& $this;
        $constant->namespace =& $this->namespaces[$namespace];

        $this->namespaces[$namespace]->constants[$constant->name] = $constant;
    }
13759
static ConstantLongInfo make(ConstantPool cp, long value) {
        ConstantInfo ci = new ConstantLongInfo(value);
        return (ConstantLongInfo)cp.addConstant(ci);
    }
437013
def write_namespaces(self, namespaces):
        """"""
        self.printer.writelines(
            "def _mako_get_namespace(context, name):",
                "try:",
                    "return context.namespaces[(__name__, name)]",
                "except KeyError:",
                    "_mako_generate_namespaces(context)",
                "return context.namespaces[(__name__, name)]",
            None, None
        )
        self.printer.writeline("def _mako_generate_namespaces(context):")


        for node in namespaces.values():
            if 'import' in node.attributes:
                self.compiler.has_ns_imports = True
            self.printer.start_source(node.lineno)
            if len(node.nodes):
                self.printer.writeline("def make_namespace():")
                export = []
                identifiers = self.compiler.identifiers.branch(node)
                self.in_def = True
                class NSDefVisitor(object):
                    def visitDefTag(s, node):
                        s.visitDefOrBase(node)

                    def visitBlockTag(s, node):
                        s.visitDefOrBase(node)

                    def visitDefOrBase(s, node):
                        if node.is_anonymous:
                            raise exceptions.CompileException(
                                "Can't put anonymous blocks inside "
                                "<%namespace>",
                                **node.exception_kwargs
                            )
                        self.write_inline_def(node, identifiers, nested=False)
                        export.append(node.funcname)
                vis = NSDefVisitor()
                for n in node.nodes:
                    n.accept_visitor(vis)
                self.printer.writeline("return [%s]" % (','.join(export)))
                self.printer.writeline(None)
                self.in_def = False
                callable_name = "make_namespace()"
            else:
                callable_name = "None"

            if 'file' in node.parsed_attributes:
                self.printer.writeline(
                                "ns = runtime.TemplateNamespace(%r,"
                                " context._clean_inheritance_tokens(),"
                                " templateuri=%s, callables=%s, "
                                " calling_uri=_template_uri)" %
                                (
                                    node.name,
                                    node.parsed_attributes.get('file', 'None'),
                                    callable_name,
                                )
                            )
            elif 'module' in node.parsed_attributes:
                self.printer.writeline(
                                "ns = runtime.ModuleNamespace(%r,"
                                " context._clean_inheritance_tokens(),"
                                " callables=%s, calling_uri=_template_uri,"
                                " module=%s)" %
                                (
                                    node.name,
                                    callable_name,
                                    node.parsed_attributes.get(
                                                'module', 'None')
                                )
                            )
            else:
                self.printer.writeline(
                                "ns = runtime.Namespace(%r,"
                                " context._clean_inheritance_tokens(),"
                                " callables=%s, calling_uri=_template_uri)" %
                                (
                                    node.name,
                                    callable_name,
                                )
                            )
            if eval(node.attributes.get('inheritable', "False")):
                self.printer.writeline("context['self'].%s = ns" % (node.name))

            self.printer.writeline(
                "context.namespaces[(__name__, %s)] = ns" % repr(node.name))
            self.printer.write_blanks(1)
        if not len(namespaces):
            self.printer.writeline("pass")
        self.printer.writeline(None)
444485
void defineStaticFields(ClassVisitor writer) {
    if (staticFields.isEmpty()) {
      return;
    }
    List<Statement> statements = new ArrayList<>();
    for (StaticFieldVariable staticField : staticFields) {
      staticField.field().defineField(writer);
      statements.add(staticField.field().putStaticField(staticField.initializer()));
    }
    statements.add(Statement.RETURN);
    Statement.concat(statements).writeMethod(Opcodes.ACC_STATIC, BytecodeUtils.CLASS_INIT, writer);
  }
399327
public void add(Namespace namespace) {
		if (has(namespace)) {
			get(namespace.getNamespace()).addPaths(namespace.getPaths());
		} else {
			namespace.addPropertyChangeListener(listener);
			set(namespace.getNamespace(), namespace);
		}
	}
589197
private void addAliasDeclarationNodes() {
    for (Entry<String, StringInfo> entry : stringInfoMap.entrySet()) {
      StringInfo info = entry.getValue();
      if (!info.isAliased) {
        continue;
      }
      String alias = info.getVariableName(entry.getKey());
      Node var = IR.var(IR.name(alias), IR.string(entry.getKey()));
      var.useSourceInfoFromForTree(info.parentForNewVarDecl);
      if (info.siblingToInsertVarDeclBefore == null) {
        info.parentForNewVarDecl.addChildToFront(var);
      } else {
        info.parentForNewVarDecl.addChildBefore(
            var, info.siblingToInsertVarDeclBefore);
      }
      compiler.reportChangeToEnclosingScope(var);
    }
  }
1136093
public ConstantMethodInfo addConstantConstructor(String className,
                                                     TypeDesc[] params) {
        return addConstantMethod(className, "<init>", null, params);
    }
634380
function(ns, members) {
			var no;
			if (gui.Type.isString(ns)) {
				no = gui.Object.lookup(ns);
				no = new gui.Namespace(ns);
				no = gui.Object.assert(ns, no);
			} else {
				throw new TypeError("Expected a namespace string");
			}
			return gui.Object.extend(no, members || {});
		}
253094
static ConstantFloatInfo make(ConstantPool cp, float value) {
        ConstantInfo ci = new ConstantFloatInfo(value);
        return (ConstantFloatInfo)cp.addConstant(ci);
    }
889751
private function _const() {
    $node = new ConstantDeclarationStatementNode();
    $this->matchDocComment($node);
    $this->mustMatch(T_CONST, $node);
    $declarations = new CommaListNode();
    do {
      $declarations->addChild($this->constDeclaration());
    } while ($this->tryMatch(',', $declarations));
    $node->addChild($declarations, 'declarations');
    $this->endStatement($node);
    return $node;
  }